mirror of
https://gitlab.com/qemu-project/openbios.git
synced 2024-02-13 08:34:06 +08:00
merge more sparc32 code from: Blue Swirl <blueswir1@hotmail.com>
git-svn-id: svn://coreboot.org/openbios/openbios-devel@16 f158a5a8-5612-0410-a976-696ce0be7e32
This commit is contained in:
committed by
Stefan Reinauer
parent
d421756207
commit
db8e7fe92a
@@ -20,6 +20,7 @@
|
||||
<object source="elfload.c"/>
|
||||
<object source="forthload.c"/>
|
||||
<object source="loadfs.c"/>
|
||||
<object source="romvec.c"/>
|
||||
</library>
|
||||
|
||||
<executable name="target/arch/sparc32/entry.o" target="target">
|
||||
|
||||
@@ -369,7 +369,22 @@ int elf_load(struct sys_info *info, const char *filename, const char *cmdline)
|
||||
|
||||
debug("entry point is %#x\n", addr_fixup(ehdr.e_entry));
|
||||
printf("Jumping to entry point...\n");
|
||||
|
||||
#if 1
|
||||
{
|
||||
extern unsigned int qemu_mem_size;
|
||||
void *init_openprom(unsigned long memsize, const char *cmdline, char boot_device);
|
||||
|
||||
int (*entry)(const void *romvec, int p2, int p3, int p4, int p5);
|
||||
const void *romvec;
|
||||
|
||||
romvec = init_openprom(qemu_mem_size, NULL, 'c');
|
||||
entry = (void *) addr_fixup(ehdr.e_entry);
|
||||
image_retval = entry(romvec, 0, 0, 0, 0);
|
||||
}
|
||||
#else
|
||||
image_retval = start_elf(addr_fixup(ehdr.e_entry), virt_to_phys(boot_notes));
|
||||
#endif
|
||||
|
||||
// console_init(); FIXME
|
||||
printf("Image returned with return value %#x\n", image_retval);
|
||||
|
||||
@@ -23,6 +23,8 @@ static char intdict[256 * 1024];
|
||||
|
||||
static void init_memory(void)
|
||||
{
|
||||
extern char _heap, _eheap;
|
||||
|
||||
/* push start and end of available memory to the stack
|
||||
* so that the forth word QUIT can initialize memory
|
||||
* management. For now we use hardcoded memory between
|
||||
@@ -30,8 +32,8 @@ static void init_memory(void)
|
||||
* than that we have serious bloat.
|
||||
*/
|
||||
|
||||
PUSH(0x10000);
|
||||
PUSH(0x9FFFF);
|
||||
PUSH((unsigned int)&_heap);
|
||||
PUSH((unsigned int)&_eheap);
|
||||
}
|
||||
|
||||
void exception(cell no)
|
||||
|
||||
257
arch/sparc32/openprom.h
Normal file
257
arch/sparc32/openprom.h
Normal file
@@ -0,0 +1,257 @@
|
||||
#ifndef __SPARC_OPENPROM_H
|
||||
#define __SPARC_OPENPROM_H
|
||||
|
||||
/* openprom.h: Prom structures and defines for access to the OPENBOOT
|
||||
* prom routines and data areas.
|
||||
*
|
||||
* Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
|
||||
*/
|
||||
|
||||
// #include <asm/vaddrs.h>
|
||||
|
||||
/* Empirical constants... */
|
||||
#define LINUX_OPPROM_MAGIC 0x10010407
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
/* V0 prom device operations. */
|
||||
struct linux_dev_v0_funcs {
|
||||
int (*v0_devopen)(char *device_str);
|
||||
int (*v0_devclose)(int dev_desc);
|
||||
int (*v0_rdblkdev)(int dev_desc, int num_blks, int blk_st, char *buf);
|
||||
int (*v0_wrblkdev)(int dev_desc, int num_blks, int blk_st, char *buf);
|
||||
int (*v0_wrnetdev)(int dev_desc, int num_bytes, char *buf);
|
||||
int (*v0_rdnetdev)(int dev_desc, int num_bytes, char *buf);
|
||||
int (*v0_rdchardev)(int dev_desc, int num_bytes, int dummy, char *buf);
|
||||
int (*v0_wrchardev)(int dev_desc, int num_bytes, int dummy, char *buf);
|
||||
int (*v0_seekdev)(int dev_desc, long logical_offst, int from);
|
||||
};
|
||||
|
||||
/* V2 and later prom device operations. */
|
||||
struct linux_dev_v2_funcs {
|
||||
int (*v2_inst2pkg)(int d); /* Convert ihandle to phandle */
|
||||
char * (*v2_dumb_mem_alloc)(char *va, unsigned sz);
|
||||
void (*v2_dumb_mem_free)(char *va, unsigned sz);
|
||||
|
||||
/* To map devices into virtual I/O space. */
|
||||
char * (*v2_dumb_mmap)(char *virta, int which_io, unsigned paddr, unsigned sz);
|
||||
void (*v2_dumb_munmap)(char *virta, unsigned size);
|
||||
|
||||
int (*v2_dev_open)(char *devpath);
|
||||
void (*v2_dev_close)(int d);
|
||||
int (*v2_dev_read)(int d, char *buf, int nbytes);
|
||||
int (*v2_dev_write)(int d, char *buf, int nbytes);
|
||||
int (*v2_dev_seek)(int d, int hi, int lo);
|
||||
|
||||
/* Never issued (multistage load support) */
|
||||
void (*v2_wheee2)(void);
|
||||
void (*v2_wheee3)(void);
|
||||
};
|
||||
|
||||
struct linux_mlist_v0 {
|
||||
struct linux_mlist_v0 *theres_more;
|
||||
char *start_adr;
|
||||
unsigned num_bytes;
|
||||
};
|
||||
|
||||
struct linux_mem_v0 {
|
||||
struct linux_mlist_v0 * const *v0_totphys;
|
||||
struct linux_mlist_v0 * const *v0_prommap;
|
||||
struct linux_mlist_v0 * const *v0_available; /* What we can use */
|
||||
};
|
||||
|
||||
/* Arguments sent to the kernel from the boot prompt. */
|
||||
struct linux_arguments_v0 {
|
||||
const char *argv[8];
|
||||
char args[100];
|
||||
char boot_dev[2];
|
||||
int boot_dev_ctrl;
|
||||
int boot_dev_unit;
|
||||
int dev_partition;
|
||||
const char *kernel_file_name;
|
||||
void *aieee1; /* XXX */
|
||||
};
|
||||
|
||||
/* V2 and up boot things. */
|
||||
struct linux_bootargs_v2 {
|
||||
const char **bootpath;
|
||||
const char **bootargs;
|
||||
const int *fd_stdin;
|
||||
const int *fd_stdout;
|
||||
};
|
||||
|
||||
/* The top level PROM vector. */
|
||||
struct linux_romvec {
|
||||
/* Version numbers. */
|
||||
unsigned int pv_magic_cookie;
|
||||
unsigned int pv_romvers;
|
||||
unsigned int pv_plugin_revision;
|
||||
unsigned int pv_printrev;
|
||||
|
||||
/* Version 0 memory descriptors. */
|
||||
struct linux_mem_v0 pv_v0mem;
|
||||
|
||||
/* Node operations. */
|
||||
const struct linux_nodeops *pv_nodeops;
|
||||
|
||||
char **pv_bootstr;
|
||||
struct linux_dev_v0_funcs pv_v0devops;
|
||||
|
||||
const char *pv_stdin;
|
||||
const char *pv_stdout;
|
||||
#define PROMDEV_KBD 0 /* input from keyboard */
|
||||
#define PROMDEV_SCREEN 0 /* output to screen */
|
||||
#define PROMDEV_TTYA 1 /* in/out to ttya */
|
||||
#define PROMDEV_TTYB 2 /* in/out to ttyb */
|
||||
|
||||
/* Blocking getchar/putchar. NOT REENTRANT! (grr) */
|
||||
int (*pv_getchar)(void);
|
||||
void (*pv_putchar)(int ch);
|
||||
|
||||
/* Non-blocking variants. */
|
||||
int (*pv_nbgetchar)(void);
|
||||
int (*pv_nbputchar)(int ch);
|
||||
|
||||
void (*pv_putstr)(char *str, int len);
|
||||
|
||||
/* Miscellany. */
|
||||
void (*pv_reboot)(char *bootstr);
|
||||
void (*pv_printf)(__const__ char *fmt, ...);
|
||||
void (*pv_abort)(void);
|
||||
__volatile__ int *pv_ticks;
|
||||
void (*pv_halt)(void);
|
||||
void (**pv_synchook)(void);
|
||||
|
||||
/* Evaluate a forth string, not different proto for V0 and V2->up. */
|
||||
union {
|
||||
void (*v0_eval)(int len, char *str);
|
||||
void (*v2_eval)(char *str);
|
||||
} pv_fortheval;
|
||||
|
||||
const struct linux_arguments_v0 * const *pv_v0bootargs;
|
||||
|
||||
/* Get ether address. */
|
||||
unsigned int (*pv_enaddr)(int d, char *enaddr);
|
||||
|
||||
struct linux_bootargs_v2 pv_v2bootargs;
|
||||
struct linux_dev_v2_funcs pv_v2devops;
|
||||
|
||||
int filler[15];
|
||||
|
||||
/* This one is sun4c/sun4 only. */
|
||||
void (*pv_setctxt)(int ctxt, char *va, int pmeg);
|
||||
|
||||
/* Prom version 3 Multiprocessor routines. This stuff is crazy.
|
||||
* No joke. Calling these when there is only one cpu probably
|
||||
* crashes the machine, have to test this. :-)
|
||||
*/
|
||||
|
||||
/* v3_cpustart() will start the cpu 'whichcpu' in mmu-context
|
||||
* 'thiscontext' executing at address 'prog_counter'
|
||||
*/
|
||||
int (*v3_cpustart)(unsigned int whichcpu, int ctxtbl_ptr,
|
||||
int thiscontext, char *prog_counter);
|
||||
|
||||
/* v3_cpustop() will cause cpu 'whichcpu' to stop executing
|
||||
* until a resume cpu call is made.
|
||||
*/
|
||||
int (*v3_cpustop)(unsigned int whichcpu);
|
||||
|
||||
/* v3_cpuidle() will idle cpu 'whichcpu' until a stop or
|
||||
* resume cpu call is made.
|
||||
*/
|
||||
int (*v3_cpuidle)(unsigned int whichcpu);
|
||||
|
||||
/* v3_cpuresume() will resume processor 'whichcpu' executing
|
||||
* starting with whatever 'pc' and 'npc' were left at the
|
||||
* last 'idle' or 'stop' call.
|
||||
*/
|
||||
int (*v3_cpuresume)(unsigned int whichcpu);
|
||||
};
|
||||
|
||||
/* Routines for traversing the prom device tree. */
|
||||
struct linux_nodeops {
|
||||
int (*no_nextnode)(int node);
|
||||
int (*no_child)(int node);
|
||||
int (*no_proplen)(int node, char *name);
|
||||
int (*no_getprop)(int node, char *name, char *val);
|
||||
int (*no_setprop)(int node, char *name, char *val, int len);
|
||||
const char * (*no_nextprop)(int node, char *name);
|
||||
};
|
||||
|
||||
/* More fun PROM structures for device probing. */
|
||||
#define PROMREG_MAX 16
|
||||
#define PROMVADDR_MAX 16
|
||||
#define PROMINTR_MAX 15
|
||||
|
||||
struct linux_prom_registers {
|
||||
unsigned int which_io; /* is this in OBIO space? */
|
||||
unsigned int phys_addr; /* The physical address of this register */
|
||||
unsigned int reg_size; /* How many bytes does this register take up? */
|
||||
};
|
||||
|
||||
struct linux_prom_irqs {
|
||||
int pri; /* IRQ priority */
|
||||
int vector; /* This is foobar, what does it do? */
|
||||
};
|
||||
|
||||
/* Element of the "ranges" vector */
|
||||
struct linux_prom_ranges {
|
||||
unsigned int ot_child_space;
|
||||
unsigned int ot_child_base; /* Bus feels this */
|
||||
unsigned int ot_parent_space;
|
||||
unsigned int ot_parent_base; /* CPU looks from here */
|
||||
unsigned int or_size;
|
||||
};
|
||||
|
||||
/* Ranges and reg properties are a bit different for PCI. */
|
||||
struct linux_prom_pci_registers {
|
||||
/*
|
||||
* We don't know what information this field contain.
|
||||
* We guess, PCI device function is in bits 15:8
|
||||
* So, ...
|
||||
*/
|
||||
unsigned int which_io; /* Let it be which_io */
|
||||
|
||||
unsigned int phys_hi;
|
||||
unsigned int phys_lo;
|
||||
|
||||
unsigned int size_hi;
|
||||
unsigned int size_lo;
|
||||
};
|
||||
|
||||
struct linux_prom_pci_ranges {
|
||||
unsigned int child_phys_hi; /* Only certain bits are encoded here. */
|
||||
unsigned int child_phys_mid;
|
||||
unsigned int child_phys_lo;
|
||||
|
||||
unsigned int parent_phys_hi;
|
||||
unsigned int parent_phys_lo;
|
||||
|
||||
unsigned int size_hi;
|
||||
unsigned int size_lo;
|
||||
};
|
||||
|
||||
struct linux_prom_pci_assigned_addresses {
|
||||
unsigned int which_io;
|
||||
|
||||
unsigned int phys_hi;
|
||||
unsigned int phys_lo;
|
||||
|
||||
unsigned int size_hi;
|
||||
unsigned int size_lo;
|
||||
};
|
||||
|
||||
struct linux_prom_ebus_ranges {
|
||||
unsigned int child_phys_hi;
|
||||
unsigned int child_phys_lo;
|
||||
|
||||
unsigned int parent_phys_hi;
|
||||
unsigned int parent_phys_mid;
|
||||
unsigned int parent_phys_lo;
|
||||
|
||||
unsigned int size;
|
||||
};
|
||||
|
||||
#endif /* !(__ASSEMBLY__) */
|
||||
|
||||
#endif /* !(__SPARC_OPENPROM_H) */
|
||||
440
arch/sparc32/romvec.c
Normal file
440
arch/sparc32/romvec.c
Normal file
@@ -0,0 +1,440 @@
|
||||
/*
|
||||
* PROM interface support
|
||||
* Copyright 1996 The Australian National University.
|
||||
* Copyright 1996 Fujitsu Laboratories Limited
|
||||
* Copyright 1999 Pete A. Zaitcev
|
||||
* This software may be distributed under the terms of the Gnu
|
||||
* Public License version 2 or later
|
||||
*/
|
||||
|
||||
#include "openprom.h"
|
||||
#include "stdint.h"
|
||||
#include "asm/io.h"
|
||||
#include "asm/types.h"
|
||||
#include "libc/vsprintf.h"
|
||||
#include "openbios/config.h"
|
||||
#include "openbios/bindings.h"
|
||||
#include "openbios/kernel.h"
|
||||
#include "openbios/sysinclude.h"
|
||||
|
||||
//#define DEBUG_OBP
|
||||
|
||||
#ifdef DEBUG_OBP
|
||||
#define DPRINTF(fmt, args...) \
|
||||
do { printk(fmt , ##args); } while (0)
|
||||
#else
|
||||
#define DPRINTF(fmt, args...)
|
||||
#endif
|
||||
|
||||
#define PAGE_SIZE 4096
|
||||
|
||||
static struct linux_mlist_v0 totphys[1];
|
||||
static struct linux_mlist_v0 totmap[1];
|
||||
static struct linux_mlist_v0 totavail[1];
|
||||
|
||||
static struct linux_mlist_v0 *ptphys;
|
||||
static struct linux_mlist_v0 *ptmap;
|
||||
static struct linux_mlist_v0 *ptavail;
|
||||
static char obp_stdin, obp_stdout;
|
||||
static int obp_fd_stdin, obp_fd_stdout;
|
||||
|
||||
static int obp_nextnode(int node);
|
||||
static int obp_child(int node);
|
||||
static int obp_proplen(int node, char *name);
|
||||
static int obp_getprop(int node, char *name, char *val);
|
||||
static int obp_setprop(int node, char *name, char *val, int len);
|
||||
static const char *obp_nextprop(int node, char *name);
|
||||
|
||||
static const struct linux_nodeops nodeops0 = {
|
||||
obp_nextnode, /* int (*no_nextnode)(int node); */
|
||||
obp_child, /* int (*no_child)(int node); */
|
||||
obp_proplen, /* int (*no_proplen)(int node, char *name); */
|
||||
obp_getprop, /* int (*no_getprop)(int node,char *name,char *val); */
|
||||
obp_setprop, /* int (*no_setprop)(int node, char *name,
|
||||
char *val, int len); */
|
||||
obp_nextprop /* char * (*no_nextprop)(int node, char *name); */
|
||||
};
|
||||
|
||||
static struct linux_arguments_v0 obp_arg;
|
||||
static const struct linux_arguments_v0 * const obp_argp = &obp_arg;
|
||||
|
||||
static void (*synch_hook)(void);
|
||||
|
||||
static struct linux_romvec romvec0;
|
||||
static int prop_mem_reg[3];
|
||||
static int prop_mem_avail[3];
|
||||
static int prop_vmem_avail[6];
|
||||
|
||||
static void doublewalk(unsigned ptab1, unsigned va)
|
||||
{
|
||||
}
|
||||
|
||||
static int obp_nextnode(int node)
|
||||
{
|
||||
int peer;
|
||||
|
||||
PUSH(node);
|
||||
fword("peer");
|
||||
peer = POP();
|
||||
DPRINTF("obp_nextnode(%x) = %x\n", node, peer);
|
||||
|
||||
return peer;
|
||||
}
|
||||
|
||||
static int obp_child(int node)
|
||||
{
|
||||
int child;
|
||||
|
||||
PUSH(node);
|
||||
fword("child");
|
||||
child = POP();
|
||||
DPRINTF("obp_child(%x) = %x\n", node, child);
|
||||
|
||||
return child;
|
||||
}
|
||||
|
||||
static int obp_proplen(int node, char *name)
|
||||
{
|
||||
int notfound;
|
||||
|
||||
push_str(name);
|
||||
PUSH(node);
|
||||
fword("get-package-property");
|
||||
notfound = POP();
|
||||
|
||||
if (notfound) {
|
||||
DPRINTF("obp_proplen(%x, %s) (not found)\n", node, name);
|
||||
(void) POP();
|
||||
(void) POP();
|
||||
|
||||
return -1;
|
||||
} else {
|
||||
int len;
|
||||
|
||||
len = POP();
|
||||
(void) POP();
|
||||
DPRINTF("obp_proplen(%x, %s) = %d\n", node, name, len);
|
||||
|
||||
return len;
|
||||
}
|
||||
}
|
||||
|
||||
static int obp_getprop(int node, char *name, char *value)
|
||||
{
|
||||
int notfound;
|
||||
|
||||
if (!name) {
|
||||
// NULL name means get first property
|
||||
name = "NULL";
|
||||
push_str("");
|
||||
PUSH(node);
|
||||
fword("next-property");
|
||||
notfound = POP();
|
||||
notfound = !notfound; // Different return value
|
||||
} else {
|
||||
push_str(name);
|
||||
PUSH(node);
|
||||
fword("get-package-property");
|
||||
notfound = POP();
|
||||
}
|
||||
if (notfound) {
|
||||
DPRINTF("obp_getprop(%x, %s) (not found)\n", node, name);
|
||||
(void) POP();
|
||||
(void) POP();
|
||||
|
||||
return -1;
|
||||
} else {
|
||||
int len;
|
||||
char *str;
|
||||
|
||||
len = POP();
|
||||
str = (char *) POP();
|
||||
memcpy(value, str, len);
|
||||
|
||||
DPRINTF("obp_getprop(%x, %s) = %s\n", node, name, str);
|
||||
|
||||
return len;
|
||||
}
|
||||
}
|
||||
|
||||
static int obp_setprop(__attribute__((unused)) int node,
|
||||
__attribute__((unused)) char *name,
|
||||
__attribute__((unused)) char *value,
|
||||
__attribute__((unused)) int len)
|
||||
{
|
||||
DPRINTF("obp_setprop(%x, %s) = %s (%d)\n", node, name, value, len);
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
static const char *obp_nextprop(int node, char *name)
|
||||
{
|
||||
if (!name || *name == '\0') {
|
||||
// NULL name means get first property
|
||||
DPRINTF("obp_nextprop(%x, NULL)\n", node);
|
||||
return 0;
|
||||
}
|
||||
DPRINTF("obp_nextprop(%x, %s)\n", node, name);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int obp_nbgetchar(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int obp_nbputchar(int ch)
|
||||
{
|
||||
putchar(ch);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void obp_reboot(char *str)
|
||||
{
|
||||
printk("rebooting (%s)\n", str);
|
||||
outb(0x71f00000, 1);
|
||||
for (;;) {}
|
||||
}
|
||||
|
||||
static void obp_abort()
|
||||
{
|
||||
printk("abort, power off\n");
|
||||
outb(0x71910000, 1);
|
||||
for (;;) {}
|
||||
}
|
||||
|
||||
static void obp_halt()
|
||||
{
|
||||
printk("halt, power off\n");
|
||||
outb(0x71910000, 1);
|
||||
for (;;) {}
|
||||
}
|
||||
|
||||
static int obp_devopen(char *str)
|
||||
{
|
||||
DPRINTF("obp_devopen(%s)\n", str);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int obp_devclose(__attribute__((unused)) int dev_desc)
|
||||
{
|
||||
DPRINTF("obp_devclose %x\n", dev_desc);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int obp_rdblkdev(int dev_desc, int num_blks, int offset, char *buf)
|
||||
{
|
||||
DPRINTF("obp_rdblkdev: fd %x, num_blks %d, offset %d, buf 0x%x\n", dev_desc, num_blks, offset, buf);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static char *obp_dumb_mmap(char *va, __attribute__((unused)) int which_io,
|
||||
unsigned int pa, unsigned int size)
|
||||
{
|
||||
unsigned int npages;
|
||||
unsigned int off;
|
||||
unsigned int mva;
|
||||
|
||||
DPRINTF("obp_dumb_mmap: virta %x, which_io %d, paddr %x, sz %d\n", va, which_io, pa, size);
|
||||
off = pa & (PAGE_SIZE-1);
|
||||
npages = (off + size + (PAGE_SIZE-1)) / PAGE_SIZE;
|
||||
pa &= ~(PAGE_SIZE-1);
|
||||
|
||||
mva = (unsigned int) va;
|
||||
while (npages-- != 0) {
|
||||
map_page(mva, pa, 1);
|
||||
mva += PAGE_SIZE;
|
||||
pa += PAGE_SIZE;
|
||||
}
|
||||
|
||||
return va;
|
||||
}
|
||||
|
||||
static void obp_dumb_munmap(__attribute__((unused)) char *va,
|
||||
__attribute__((unused)) unsigned int size)
|
||||
{
|
||||
DPRINTF("obp_dumb_munmap: virta %x, sz %d\n", va, size);
|
||||
}
|
||||
|
||||
static int obp_devread(int dev_desc, char *buf, int nbytes)
|
||||
{
|
||||
DPRINTF("obp_devread: fd %d, nbytes %d\n", dev_desc, nbytes);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int obp_devwrite(int dev_desc, char *buf, int nbytes)
|
||||
{
|
||||
DPRINTF("obp_devwrite: fd %d, buf %s, nbytes %d\n", dev_desc, buf, nbytes);
|
||||
|
||||
return nbytes;
|
||||
}
|
||||
|
||||
static int obp_devseek(int dev_desc, __attribute__((unused)) int hi, int lo)
|
||||
{
|
||||
DPRINTF("obp_devseek: fd %d, hi %d, lo %d\n", dev_desc, hi, lo);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int obp_inst2pkg(int dev_desc)
|
||||
{
|
||||
DPRINTF("obp_inst2pkg: fd %d\n", dev_desc);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int obp_cpustart(unsigned int whichcpu, int ctxtbl_ptr,
|
||||
int thiscontext, char *prog_counter)
|
||||
{
|
||||
//int cpu, found;
|
||||
struct linux_prom_registers *smp_ctable = (void *)ctxtbl_ptr;
|
||||
|
||||
DPRINTF("obp_cpustart: cpu %d, ctxptr %x, ctx %d, pc %x\n", whichcpu,
|
||||
smp_ctable->phys_addr, thiscontext, prog_counter);
|
||||
#if 0
|
||||
found = obp_getprop(whichcpu, "mid", (char *)&cpu);
|
||||
if (found == -1)
|
||||
return -1;
|
||||
st_bypass(PHYS_JJ_EEPROM + 0x38, (unsigned int)prog_counter);
|
||||
st_bypass(PHYS_JJ_EEPROM + 0x3C, ((unsigned int)smp_ctable->phys_addr) >> 4);
|
||||
st_bypass(PHYS_JJ_EEPROM + 0x40, thiscontext);
|
||||
DPRINTF("obp_cpustart: sending interrupt to CPU %d\n", cpu);
|
||||
st_bypass(PHYS_JJ_INTR0 + 0x1000 * cpu + 8, 0x40000000);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int obp_cpustop(__attribute__((unused)) unsigned int whichcpu)
|
||||
{
|
||||
DPRINTF("obp_cpustop: cpu %d\n", whichcpu);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int obp_cpuidle(__attribute__((unused)) unsigned int whichcpu)
|
||||
{
|
||||
DPRINTF("obp_cpuidle: cpu %d\n", whichcpu);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int obp_cpuresume(__attribute__((unused)) unsigned int whichcpu)
|
||||
{
|
||||
DPRINTF("obp_cpuresume: cpu %d\n", whichcpu);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void *
|
||||
init_openprom(unsigned long memsize, const char *cmdline, char boot_device)
|
||||
{
|
||||
ptphys = totphys;
|
||||
ptmap = totmap;
|
||||
ptavail = totavail;
|
||||
|
||||
/*
|
||||
* Form memory descriptors.
|
||||
*/
|
||||
totphys[0].theres_more = 0;
|
||||
totphys[0].start_adr = (char *) 0;
|
||||
totphys[0].num_bytes = memsize;
|
||||
|
||||
totavail[0].theres_more = 0;
|
||||
totavail[0].start_adr = (char*) 0;
|
||||
totavail[0].num_bytes = memsize;
|
||||
|
||||
totmap[0].theres_more = 0;
|
||||
totmap[0].start_adr = &_start;
|
||||
totmap[0].num_bytes = (unsigned long) &_iomem - (unsigned long) &_start;
|
||||
|
||||
prop_mem_reg[0] = 0;
|
||||
prop_mem_reg[1] = 0;
|
||||
prop_mem_reg[2] = memsize;
|
||||
prop_mem_avail[0] = 0;
|
||||
prop_mem_avail[1] = 0;
|
||||
prop_mem_avail[2] = va2pa((unsigned long)&_data);
|
||||
prop_vmem_avail[0] = 0;
|
||||
prop_vmem_avail[1] = 0;
|
||||
prop_vmem_avail[2] = (unsigned long)&_start - 1;
|
||||
prop_vmem_avail[3] = 0;
|
||||
prop_vmem_avail[4] = 0xffe00000;
|
||||
prop_vmem_avail[5] = 0x00200000;
|
||||
|
||||
// Linux wants a R/W romvec table
|
||||
romvec0.pv_magic_cookie = LINUX_OPPROM_MAGIC;
|
||||
romvec0.pv_romvers = 0;
|
||||
romvec0.pv_plugin_revision = 77;
|
||||
romvec0.pv_printrev = 0x10203;
|
||||
romvec0.pv_v0mem.v0_totphys = &ptphys;
|
||||
romvec0.pv_v0mem.v0_prommap = &ptmap;
|
||||
romvec0.pv_v0mem.v0_available = &ptavail;
|
||||
romvec0.pv_nodeops = &nodeops0;
|
||||
romvec0.pv_bootstr = (void *)doublewalk;
|
||||
romvec0.pv_v0devops.v0_devopen = &obp_devopen;
|
||||
romvec0.pv_v0devops.v0_devclose = &obp_devclose;
|
||||
romvec0.pv_v0devops.v0_rdblkdev = &obp_rdblkdev;
|
||||
romvec0.pv_stdin = &obp_stdin;
|
||||
romvec0.pv_stdout = &obp_stdout;
|
||||
romvec0.pv_getchar = obp_nbgetchar;
|
||||
romvec0.pv_putchar = (void (*)(int))obp_nbputchar;
|
||||
romvec0.pv_nbgetchar = obp_nbgetchar;
|
||||
romvec0.pv_nbputchar = obp_nbputchar;
|
||||
romvec0.pv_reboot = obp_reboot;
|
||||
romvec0.pv_printf = (void (*)(const char *fmt, ...))printk;
|
||||
romvec0.pv_abort = obp_abort;
|
||||
romvec0.pv_halt = obp_halt;
|
||||
romvec0.pv_synchook = &synch_hook;
|
||||
romvec0.pv_v0bootargs = &obp_argp;
|
||||
romvec0.pv_v2devops.v2_inst2pkg = obp_inst2pkg;
|
||||
romvec0.pv_v2devops.v2_dumb_mmap = obp_dumb_mmap;
|
||||
romvec0.pv_v2devops.v2_dumb_munmap = obp_dumb_munmap;
|
||||
romvec0.pv_v2devops.v2_dev_open = obp_devopen;
|
||||
romvec0.pv_v2devops.v2_dev_close = (void (*)(int))obp_devclose;
|
||||
romvec0.pv_v2devops.v2_dev_read = obp_devread;
|
||||
romvec0.pv_v2devops.v2_dev_write = obp_devwrite;
|
||||
romvec0.pv_v2devops.v2_dev_seek = obp_devseek;
|
||||
obp_arg.boot_dev_ctrl = 0;
|
||||
obp_arg.boot_dev_unit = '0';
|
||||
obp_arg.argv[0] = "sd(0,0,0):d";
|
||||
|
||||
switch(boot_device) {
|
||||
default:
|
||||
case 'a':
|
||||
obp_arg.argv[0] = "fd()";
|
||||
obp_arg.boot_dev[0] = 'f';
|
||||
obp_arg.boot_dev[1] = 'd';
|
||||
break;
|
||||
case 'd':
|
||||
obp_arg.boot_dev_unit = '2';
|
||||
obp_arg.argv[0] = "sd(0,2,0):d";
|
||||
// Fall through
|
||||
case 'c':
|
||||
obp_arg.boot_dev[0] = 's';
|
||||
obp_arg.boot_dev[1] = 'd';
|
||||
break;
|
||||
case 'n':
|
||||
obp_arg.argv[0] = "le()";
|
||||
obp_arg.boot_dev[0] = 'l';
|
||||
obp_arg.boot_dev[1] = 'e';
|
||||
break;
|
||||
}
|
||||
obp_arg.argv[1] = cmdline;
|
||||
romvec0.pv_v2bootargs.bootpath = &obp_arg.argv[0];
|
||||
romvec0.pv_v2bootargs.bootargs = &cmdline;
|
||||
romvec0.pv_v2bootargs.fd_stdin = &obp_fd_stdin;
|
||||
romvec0.pv_v2bootargs.fd_stdout = &obp_fd_stdout;
|
||||
|
||||
romvec0.v3_cpustart = obp_cpustart;
|
||||
romvec0.v3_cpustop = obp_cpustop;
|
||||
romvec0.v3_cpuidle = obp_cpuidle;
|
||||
romvec0.v3_cpuresume = obp_cpuresume;
|
||||
|
||||
return &romvec0;
|
||||
}
|
||||
@@ -3,14 +3,29 @@
|
||||
2 encode-int " #address-cells" property
|
||||
1 encode-int " #size-cells" property
|
||||
" SUNW,SparcStation-5" encode-string " name" property
|
||||
" " encode-string " idprom" property
|
||||
" SparcStation" encode-string " banner-name" property
|
||||
" sun4m" encode-string " compatible" property
|
||||
h# 01800000 encode-int 0 encode-int encode+ 0 encode-int encode+ h# 00000081 encode-int encode+
|
||||
0 encode-int encode+ 0 encode-int encode+ 0 encode-int encode+ 0 encode-int encode+
|
||||
" idprom" property \ XXX
|
||||
: encode-unit encode-unit-sbus ;
|
||||
: decode-unit decode-unit-sbus ;
|
||||
|
||||
new-device
|
||||
" memory" device-name
|
||||
h# 100000 encode-int " available" property \ XXX
|
||||
h# 0 encode-int h# 10000000 encode-int encode+ h# 00000300 encode-int encode+ " reg" property \ XXX
|
||||
external
|
||||
: open true ;
|
||||
: close ;
|
||||
\ claim ( phys size align -- base )
|
||||
\ release ( phys size -- )
|
||||
finish-device
|
||||
|
||||
new-device
|
||||
" virtual-memory" device-name
|
||||
h# 100000 encode-int " available" property \ XXX
|
||||
h# 0 encode-int h# 10000000 encode-int encode+ h# 00000300 encode-int encode+ " reg" property \ XXX
|
||||
external
|
||||
: open true ;
|
||||
: close ;
|
||||
@@ -33,7 +48,7 @@ new-device
|
||||
1 encode-int " #size-cells" property
|
||||
h# 0 encode-int h# 10000000 encode-int encode+ h# 00000300 encode-int encode+ " reg" property
|
||||
external
|
||||
: open cr ." opening iommu" cr true ;
|
||||
: open ( cr ." opening iommu" cr) true ;
|
||||
: close ;
|
||||
: encode-unit encode-unit-sbus ;
|
||||
: decode-unit decode-unit-sbus ;
|
||||
@@ -53,7 +68,7 @@ new-device
|
||||
" ranges" property
|
||||
h# 0 encode-int h# 10001000 encode-int encode+ h# 00000028 encode-int encode+ " reg" property
|
||||
external
|
||||
: open cr ." opening SBus" cr true ;
|
||||
: open ( cr ." opening SBus" cr) true ;
|
||||
: close ;
|
||||
: encode-unit encode-unit-sbus ;
|
||||
: decode-unit decode-unit-sbus ;
|
||||
@@ -157,7 +172,7 @@ new-device
|
||||
h# 0 encode-int h# 0 encode-int encode+ h# 0 encode-int encode+ h# 71000000 encode-int encode+ h# 01000000 encode-int encode+
|
||||
" ranges" property
|
||||
external
|
||||
: open cr ." opening obio" cr true ;
|
||||
: open ( cr ." opening obio" cr) true ;
|
||||
: close ;
|
||||
: encode-unit encode-unit-sbus ;
|
||||
: decode-unit decode-unit-sbus ;
|
||||
|
||||
@@ -26,7 +26,8 @@
|
||||
<option name="CONFIG_DEBUG_INTERPRETER" type="boolean" value="false"/>
|
||||
<option name="CONFIG_DEBUG_CONSOLE" type="boolean" value="true"/>
|
||||
<option name="CONFIG_DEBUG_CONSOLE_SERIAL" type="boolean" value="true"/>
|
||||
<option name="CONFIG_DEBUG_ESP" type="boolean" value="true"/>
|
||||
<option name="CONFIG_DEBUG_ESP" type="boolean" value="false"/>
|
||||
<option name="CONFIG_DEBUG_SUN_PARTS" type="boolean" value="false"/>
|
||||
<option name="CONFIG_SERIAL_PORT" type="integer" value="0"/>
|
||||
<option name="CONFIG_SERIAL_SPEED" type="integer" value="115200"/>
|
||||
|
||||
@@ -43,13 +44,13 @@
|
||||
<option name="CONFIG_SUN_PARTS" type="boolean" value="true"/>
|
||||
<option name="CONFIG_FS" type="boolean" value="true"/>
|
||||
<option name="CONFIG_HFS" type="boolean" value="false"/>
|
||||
<option name="CONFIG_HFSP" type="boolean" value="true"/>
|
||||
<option name="CONFIG_HFSP" type="boolean" value="false"/>
|
||||
<option name="CONFIG_GRUBFS" type="boolean" value="true"/>
|
||||
<option name="CONFIG_FSYS_EXT2FS" type="boolean" value="true"/>
|
||||
<option name="CONFIG_FSYS_FAT" type="boolean" value="false"/>
|
||||
<option name="CONFIG_FSYS_JFS" type="boolean" value="false"/>
|
||||
<option name="CONFIG_FSYS_MINIX" type="boolean" value="false"/>
|
||||
<option name="CONFIG_FSYS_REISERFS" type="boolean" value="true"/>
|
||||
<option name="CONFIG_FSYS_REISERFS" type="boolean" value="false"/>
|
||||
<option name="CONFIG_FSYS_XFS" type="boolean" value="false"/>
|
||||
<option name="CONFIG_FSYS_UFS" type="boolean" value="true"/>
|
||||
<option name="CONFIG_FSYS_ISO9660" type="boolean" value="true"/>
|
||||
|
||||
@@ -26,6 +26,8 @@
|
||||
<option name="CONFIG_DEBUG_INTERPRETER" type="boolean" value="false"/>
|
||||
<option name="CONFIG_DEBUG_CONSOLE" type="boolean" value="true"/>
|
||||
<option name="CONFIG_DEBUG_CONSOLE_SERIAL" type="boolean" value="true"/>
|
||||
<option name="CONFIG_DEBUG_ESP" type="boolean" value="false"/>
|
||||
<option name="CONFIG_DEBUG_SUN_PARTS" type="boolean" value="false"/>
|
||||
<option name="CONFIG_SERIAL_PORT" type="integer" value="0"/>
|
||||
<option name="CONFIG_SERIAL_SPEED" type="integer" value="115200"/>
|
||||
|
||||
@@ -42,13 +44,13 @@
|
||||
<option name="CONFIG_SUN_PARTS" type="boolean" value="true"/>
|
||||
<option name="CONFIG_FS" type="boolean" value="true"/>
|
||||
<option name="CONFIG_HFS" type="boolean" value="false"/>
|
||||
<option name="CONFIG_HFSP" type="boolean" value="true"/>
|
||||
<option name="CONFIG_HFSP" type="boolean" value="false"/>
|
||||
<option name="CONFIG_GRUBFS" type="boolean" value="true"/>
|
||||
<option name="CONFIG_FSYS_EXT2FS" type="boolean" value="true"/>
|
||||
<option name="CONFIG_FSYS_FAT" type="boolean" value="false"/>
|
||||
<option name="CONFIG_FSYS_JFS" type="boolean" value="false"/>
|
||||
<option name="CONFIG_FSYS_MINIX" type="boolean" value="false"/>
|
||||
<option name="CONFIG_FSYS_REISERFS" type="boolean" value="true"/>
|
||||
<option name="CONFIG_FSYS_REISERFS" type="boolean" value="false"/>
|
||||
<option name="CONFIG_FSYS_XFS" type="boolean" value="false"/>
|
||||
<option name="CONFIG_FSYS_UFS" type="boolean" value="true"/>
|
||||
<option name="CONFIG_FSYS_ISO9660" type="boolean" value="true"/>
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
} while(0)
|
||||
|
||||
#define REGISTER_NODE_METHODS( name, path ) do { \
|
||||
char *paths[1]; \
|
||||
const char *paths[1]; \
|
||||
\
|
||||
paths[0] = path; \
|
||||
bind_node( name##_flags_, name##_size_, \
|
||||
@@ -76,9 +76,9 @@ esp_private_t *global_esp;
|
||||
DECLARE_UNNAMED_NODE(ob_sd, INSTALL_OPEN, sizeof(sd_private_t *));
|
||||
DECLARE_UNNAMED_NODE(ob_esp, INSTALL_OPEN, sizeof(esp_private_t *));
|
||||
|
||||
#ifdef CONFIG_DEBUG_ESP
|
||||
static void dump_drive(sd_private_t *drive)
|
||||
{
|
||||
#ifdef CONFIG_DEBUG_ESP
|
||||
printk("SCSI DRIVE @%lx:\n", (unsigned long)drive);
|
||||
printk("id: %d\n", drive->id);
|
||||
printk("media: %s\n", drive->media_str);
|
||||
@@ -86,8 +86,8 @@ static void dump_drive(sd_private_t *drive)
|
||||
printk("sectors: %d\n", drive->sectors);
|
||||
printk("present: %d\n", drive->present);
|
||||
printk("bs: %d\n", drive->bs);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
static int
|
||||
do_command(esp_private_t *esp, sd_private_t *sd, int cmdlen, int replylen)
|
||||
|
||||
@@ -35,8 +35,8 @@ struct mem cio; /* Current I/O space */
|
||||
|
||||
unsigned int va_shift;
|
||||
|
||||
unsigned long *context_table;
|
||||
unsigned long *l1;
|
||||
static unsigned long *context_table;
|
||||
static unsigned long *l1;
|
||||
|
||||
/*
|
||||
* IOMMU parameters
|
||||
@@ -105,21 +105,20 @@ mem_zalloc(struct mem *t, int size, int align)
|
||||
* highbase is used for v2p translation.
|
||||
*/
|
||||
int
|
||||
map_page(unsigned long *pgd, unsigned long va,
|
||||
unsigned long epa, int type)
|
||||
map_page(unsigned long va, unsigned long epa, int type)
|
||||
{
|
||||
uint32_t pte;
|
||||
void *p;
|
||||
unsigned long pa;
|
||||
|
||||
pte = pgd[(va >> SRMMU_PGDIR_SHIFT) & (SRMMU_PTRS_PER_PGD - 1)];
|
||||
pte = l1[(va >> SRMMU_PGDIR_SHIFT) & (SRMMU_PTRS_PER_PGD - 1)];
|
||||
if ((pte & SRMMU_ET_MASK) == SRMMU_ET_INVALID) {
|
||||
p = mem_zalloc(&cmem, SRMMU_PTRS_PER_PMD * sizeof(int),
|
||||
SRMMU_PTRS_PER_PMD * sizeof(int));
|
||||
if (p == 0)
|
||||
goto drop;
|
||||
pte = SRMMU_ET_PTD | ((va2pa((unsigned long)p)) >> 4);
|
||||
pgd[(va >> SRMMU_PGDIR_SHIFT) & (SRMMU_PTRS_PER_PGD - 1)] = pte;
|
||||
l1[(va >> SRMMU_PGDIR_SHIFT) & (SRMMU_PTRS_PER_PGD - 1)] = pte;
|
||||
/* barrier() */
|
||||
}
|
||||
|
||||
@@ -178,9 +177,9 @@ map_io(unsigned pa, int size)
|
||||
return va;
|
||||
|
||||
mva = (unsigned int) va;
|
||||
printk("map_io: va 0x%p pa 0x%x off 0x%x npages %d\n", va, pa, off, npages); /* P3 */
|
||||
//printk("map_io: va 0x%p pa 0x%x off 0x%x npages %d\n", va, pa, off, npages); /* P3 */
|
||||
while (npages-- != 0) {
|
||||
map_page(l1, mva, pa, 1);
|
||||
map_page(mva, pa, 1);
|
||||
mva += PAGE_SIZE;
|
||||
pa += PAGE_SIZE;
|
||||
}
|
||||
@@ -215,20 +214,20 @@ init_mmu_swift()
|
||||
// 1:1 mapping for ROM
|
||||
pa = va = (unsigned long)&_start;
|
||||
for (; va < (unsigned long)&_data; va += PAGE_SIZE, pa += PAGE_SIZE) {
|
||||
map_page(l1, va, pa, 0);
|
||||
map_page(va, pa, 0);
|
||||
}
|
||||
|
||||
// data & bss mapped to end of RAM
|
||||
va = (unsigned long)&_data;
|
||||
for (; va < (unsigned long)&_end; va += PAGE_SIZE) {
|
||||
pa = va2pa(va);
|
||||
map_page(l1, va, pa, 0);
|
||||
map_page(va, pa, 0);
|
||||
}
|
||||
|
||||
// 1:1 mapping for RAM
|
||||
pa = va = 0;
|
||||
for (; va < LOWMEMSZ; va += PAGE_SIZE, pa += PAGE_SIZE) {
|
||||
map_page(l1, va, pa, 0);
|
||||
map_page(va, pa, 0);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -279,7 +278,7 @@ dvma_alloc(int size, unsigned int *pphys)
|
||||
mva = (unsigned int) va;
|
||||
mpa = (unsigned int) pa;
|
||||
for (i = 0; i < npages; i++) {
|
||||
map_page(l1, mva, mpa, 1);
|
||||
map_page(mva, mpa, 1);
|
||||
mva += PAGE_SIZE;
|
||||
mpa += PAGE_SIZE;
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ NODE_METHODS(ob_sbus_node) = {
|
||||
|
||||
int ob_sbus_init(void)
|
||||
{
|
||||
printk("Initializing SBus devices...\n");
|
||||
//printk("Initializing SBus devices...\n");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -124,11 +124,11 @@ static const method_t name##_m[]
|
||||
name##_m, sizeof(name##_m)/sizeof(method_t) ); \
|
||||
} while(0)
|
||||
|
||||
extern void bind_node( int flags, int size, char **paths, int npaths,
|
||||
method_t *methods, int nmethods );
|
||||
extern void bind_node( int flags, int size, const char * const *paths, int npaths,
|
||||
const method_t *methods, int nmethods );
|
||||
|
||||
extern void bind_new_node( int flags, int size, char *name,
|
||||
method_t *methods, int nmethods );
|
||||
extern void bind_new_node( int flags, int size, const char *name,
|
||||
const method_t *methods, int nmethods );
|
||||
|
||||
#define INSTALL_OPEN 1 /* install trivial open and close methods */
|
||||
|
||||
|
||||
@@ -34,8 +34,7 @@ struct mem;
|
||||
|
||||
void *mem_alloc(struct mem *t, int size, int align);
|
||||
void *mem_zalloc(struct mem *t, int size, int align);
|
||||
int map_page(unsigned long *pgd, unsigned long va,
|
||||
unsigned long epa, int type);
|
||||
int map_page(unsigned long va, unsigned long epa, int type);
|
||||
void *map_io(unsigned pa, int size);
|
||||
void init_mmu_swift();
|
||||
void *dvma_alloc(int size, unsigned int *pphys);
|
||||
|
||||
@@ -22,7 +22,7 @@ int errno;
|
||||
void
|
||||
qsort( void *base, size_t nmemb, size_t size, int (*compar)(const void *, const void*) )
|
||||
{
|
||||
int worked, i, j;
|
||||
unsigned int worked, i, j;
|
||||
|
||||
/* even more inefficient than the glibc variant :-) */
|
||||
do {
|
||||
|
||||
@@ -431,7 +431,7 @@ call1_func( void )
|
||||
|
||||
|
||||
static void
|
||||
add_methods( int flags, int size, method_t *methods, int nmet )
|
||||
add_methods( int flags, int size, const method_t *methods, int nmet )
|
||||
{
|
||||
xt_t xt=0;
|
||||
int i;
|
||||
@@ -470,14 +470,14 @@ add_methods( int flags, int size, method_t *methods, int nmet )
|
||||
}
|
||||
|
||||
void
|
||||
bind_node( int flags, int size, char **paths, int npaths,
|
||||
method_t *methods, int nmet )
|
||||
bind_node( int flags, int size, const char * const *paths, int npaths,
|
||||
const method_t *methods, int nmet )
|
||||
{
|
||||
phandle_t save_ph = get_cur_dev();
|
||||
int i;
|
||||
|
||||
for( i=0; i<npaths; i++ ) {
|
||||
char *name = paths[i];
|
||||
const char *name = paths[i];
|
||||
|
||||
/* type matching? */
|
||||
if( *name == 'T' ) {
|
||||
@@ -506,8 +506,8 @@ bind_node( int flags, int size, char **paths, int npaths,
|
||||
}
|
||||
|
||||
void
|
||||
bind_new_node( int flags, int size, char *name,
|
||||
method_t *methods, int nmet )
|
||||
bind_new_node( int flags, int size, const char *name,
|
||||
const method_t *methods, int nmet )
|
||||
{
|
||||
phandle_t save_ph = get_cur_dev();
|
||||
|
||||
|
||||
@@ -17,6 +17,13 @@
|
||||
#include "libc/byteorder.h"
|
||||
#include "modules.h"
|
||||
|
||||
#ifdef CONFIG_DEBUG_SUN_PARTS
|
||||
#define DPRINTF(fmt, args...) \
|
||||
do { printk(fmt , ##args); } while (0)
|
||||
#else
|
||||
#define DPRINTF(fmt, args...)
|
||||
#endif
|
||||
|
||||
typedef struct {
|
||||
ullong offs;
|
||||
ullong size;
|
||||
@@ -88,7 +95,7 @@ sunparts_open( sunparts_info_t *di )
|
||||
struct sun_disklabel *p;
|
||||
unsigned int i;
|
||||
|
||||
printk("sunparts_open '%s'\n", str );
|
||||
DPRINTF("sunparts_open '%s'\n", str );
|
||||
|
||||
if( str ) {
|
||||
parnum = atol(str);
|
||||
@@ -103,7 +110,7 @@ sunparts_open( sunparts_info_t *di )
|
||||
|
||||
/* Check Magic */
|
||||
if (!has_sun_part_magic(buf)) {
|
||||
printk("sun partition magic not found.\n");
|
||||
DPRINTF("sun partition magic not found.\n");
|
||||
RET(0);
|
||||
}
|
||||
|
||||
@@ -111,7 +118,7 @@ sunparts_open( sunparts_info_t *di )
|
||||
p = (struct sun_disklabel *)buf;
|
||||
|
||||
for (i = 0; i < 8; i++) {
|
||||
printk("%c: %d + %d, id %x, flags %x\n", 'a' + i, p->partitions[i].start_cylinder,
|
||||
DPRINTF("%c: %d + %d, id %x, flags %x\n", 'a' + i, p->partitions[i].start_cylinder,
|
||||
p->partitions[i].num_sectors, p->infos[i].id, p->infos[i].flags);
|
||||
if (parnum < 0) {
|
||||
if (p->partitions[i].num_sectors != 0 && p->infos[i].id != 0)
|
||||
@@ -122,7 +129,7 @@ sunparts_open( sunparts_info_t *di )
|
||||
__be16_to_cpu(p->ntrks) * __be16_to_cpu(p->nsect);
|
||||
|
||||
di->size = (llong)__be32_to_cpu(p->partitions[parnum].num_sectors) ;
|
||||
printk("Found Sun partition table, offs %d size %d\n", (int)di->offs, (int)di->size);
|
||||
DPRINTF("Found Sun partition table, offs %d size %d\n", (int)di->offs, (int)di->size);
|
||||
|
||||
RET( -1 );
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user