Fix some Sparc32 compile warnings

git-svn-id: svn://coreboot.org/openbios/openbios-devel@189 f158a5a8-5612-0410-a976-696ce0be7e32
This commit is contained in:
Blue Swirl
2008-07-07 18:35:51 +00:00
parent a7b1d8e657
commit 5205e45840
33 changed files with 169 additions and 159 deletions

View File

@@ -8,6 +8,7 @@
#include "a.out.h" #include "a.out.h"
#include "sys_info.h" #include "sys_info.h"
#include "loadfs.h" #include "loadfs.h"
#include "boot.h"
#define printf printk #define printf printk
#define debug printk #define debug printk
@@ -84,7 +85,7 @@ int aout_load(struct sys_info *info, const char *filename, const char *cmdline,
if (ehdr.a_text == 0x30800007) if (ehdr.a_text == 0x30800007)
ehdr.a_text=64*1024; ehdr.a_text=64*1024;
if (N_MAGIC(ehdr) == NMAGIC) { if (N_MAGIC(ehdr) == NMAGIC) {
size = addr_fixup(N_DATADDR(ehdr)) + addr_fixup(ehdr.a_data); size = addr_fixup(N_DATADDR(ehdr)) + addr_fixup(ehdr.a_data);
} else { } else {
@@ -105,21 +106,21 @@ int aout_load(struct sys_info *info, const char *filename, const char *cmdline,
file_seek(offset + N_TXTOFF(ehdr)); file_seek(offset + N_TXTOFF(ehdr));
if (N_MAGIC(ehdr) == NMAGIC) { if (N_MAGIC(ehdr) == NMAGIC) {
if (lfile_read(start, ehdr.a_text) != ehdr.a_text) { if ((unsigned long)lfile_read((void *)start, ehdr.a_text) != ehdr.a_text) {
printf("Can't read program text segment (size 0x%lx)\n", ehdr.a_text); printf("Can't read program text segment (size 0x%lx)\n", ehdr.a_text);
goto out; goto out;
} }
if (lfile_read(start + N_DATADDR(ehdr), ehdr.a_data) != ehdr.a_data) { if ((unsigned long)lfile_read((void *)(start + N_DATADDR(ehdr)), ehdr.a_data) != ehdr.a_data) {
printf("Can't read program data segment (size 0x%lx)\n", ehdr.a_data); printf("Can't read program data segment (size 0x%lx)\n", ehdr.a_data);
goto out; goto out;
} }
} else { } else {
if (lfile_read(start, size) != size) { if ((unsigned long)lfile_read((void *)start, size) != size) {
printf("Can't read program (size 0x%lx)\n", size); printf("Can't read program (size 0x%lx)\n", size);
goto out; goto out;
} }
} }
debug("Loaded %lu bytes\n", size); debug("Loaded %lu bytes\n", size);
debug("entry point is %#lx\n", start); debug("entry point is %#lx\n", start);
@@ -127,7 +128,7 @@ int aout_load(struct sys_info *info, const char *filename, const char *cmdline,
#if 1 #if 1
{ {
int (*entry)(const void *romvec, int p2, int p3, int p4, int p5); int (*entry)(const void *romvec_ptr, int p2, int p3, int p4, int p5);
entry = (void *) addr_fixup(start); entry = (void *) addr_fixup(start);
image_retval = entry(romvec, 0, 0, 0, 0); image_retval = entry(romvec, 0, 0, 0, 0);

View File

@@ -7,30 +7,23 @@
#include "openbios/elfload.h" #include "openbios/elfload.h"
#include "openbios/nvram.h" #include "openbios/nvram.h"
#include "libc/diskio.h" #include "libc/diskio.h"
#include "libc/vsprintf.h"
#include "sys_info.h" #include "sys_info.h"
#include "openprom.h" #include "openprom.h"
#include "boot.h"
int elf_load(struct sys_info *, const char *filename, const char *cmdline, const void *romvec); struct sys_info sys_info;
int aout_load(struct sys_info *, const char *filename, const char *cmdline, const void *romvec);
int linux_load(struct sys_info *, const char *filename, const char *cmdline, const void *romvec);
void boot(void);
struct sys_info sys_info;
uint32_t kernel_image; uint32_t kernel_image;
uint32_t kernel_size; uint32_t kernel_size;
uint32_t cmdline; uint32_t qemu_cmdline;
uint32_t cmdline_size; uint32_t cmdline_size;
char boot_device; char boot_device;
extern unsigned int qemu_mem_size;
void *init_openprom(unsigned long memsize);
extern struct linux_arguments_v0 obp_arg;
void boot(void) void boot(void)
{ {
char *path = pop_fstr_copy(), *param, *oldpath = path; char *path = pop_fstr_copy(), *param, *oldpath = path;
char altpath[256]; char altpath[256];
int unit; int unit = 0;
const void *romvec; const void *romvec;
if(!path) { if(!path) {
@@ -41,18 +34,15 @@ void boot(void)
fword("get-package-property"); fword("get-package-property");
if (!POP()) { if (!POP()) {
path = pop_fstr_copy(); path = pop_fstr_copy();
unit = 0;
} else { } else {
switch (boot_device) { switch (boot_device) {
case 'a': case 'a':
path = strdup("/obio/SUNW,fdtwo"); path = strdup("/obio/SUNW,fdtwo");
oldpath = "fd()"; oldpath = "fd()";
unit = 0;
break; break;
case 'c': case 'c':
path = strdup("disk"); path = strdup("disk");
oldpath = "sd(0,0,0):d"; oldpath = "sd(0,0,0):d";
unit = 0;
break; break;
default: default:
case 'd': case 'd':
@@ -66,7 +56,6 @@ void boot(void)
case 'n': case 'n':
path = strdup("net"); path = strdup("net");
oldpath = "le()"; oldpath = "le()";
unit = 0;
break; break;
} }
} }
@@ -78,14 +67,14 @@ void boot(void)
obp_arg.boot_dev[0] = oldpath[0]; obp_arg.boot_dev[0] = oldpath[0];
obp_arg.boot_dev[1] = oldpath[1]; obp_arg.boot_dev[1] = oldpath[1];
obp_arg.argv[0] = oldpath; obp_arg.argv[0] = oldpath;
obp_arg.argv[1] = cmdline; obp_arg.argv[1] = (void *)(long)qemu_cmdline;
param = strchr(path, ' '); param = strchr(path, ' ');
if(param) { if(param) {
*param = '\0'; *param = '\0';
param++; param++;
} else if (cmdline_size) { } else if (cmdline_size) {
param = (char *)cmdline; param = (char *)qemu_cmdline;
} else { } else {
push_str("boot-args"); push_str("boot-args");
push_str("/options"); push_str("/options");
@@ -100,7 +89,7 @@ void boot(void)
romvec = init_openprom(qemu_mem_size); romvec = init_openprom(qemu_mem_size);
if (kernel_size) { if (kernel_size) {
int (*entry)(const void *romvec, int p2, int p3, int p4, int p5); int (*entry)(const void *romvec_ptr, int p2, int p3, int p4, int p5);
printk("[sparc] Kernel already loaded\n"); printk("[sparc] Kernel already loaded\n");
entry = (void *) kernel_image; entry = (void *) kernel_image;
@@ -108,7 +97,7 @@ void boot(void)
} }
printk("[sparc] Booting file '%s' ", path); printk("[sparc] Booting file '%s' ", path);
if(param) if (param)
printk("with parameters '%s'\n", param); printk("with parameters '%s'\n", param);
else else
printk("without parameters.\n"); printk("without parameters.\n");

View File

@@ -15,3 +15,16 @@ int linux_load(struct sys_info *, const char *filename, const char *cmdline,
const void *romvec); const void *romvec);
unsigned int start_elf(unsigned long entry_point, unsigned long param); unsigned int start_elf(unsigned long entry_point, unsigned long param);
void *init_openprom(unsigned long memsize);
void boot(void);
extern struct sys_info sys_info;
extern uint32_t kernel_image;
extern uint32_t kernel_size;
extern uint32_t qemu_cmdline;
extern uint32_t cmdline_size;
extern char boot_device;
extern unsigned int qemu_mem_size;
extern struct linux_arguments_v0 obp_arg;
extern int qemu_machine_type;

View File

@@ -21,7 +21,7 @@
<object source="loadfs.c"/> <object source="loadfs.c"/>
<object source="romvec.c"/> <object source="romvec.c"/>
</library> </library>
<executable name="target/arch/sparc32/entry.o" target="target"> <executable name="target/arch/sparc32/entry.o" target="target">
<rule><![CDATA[ <rule><![CDATA[
$(CC) $$EXTRACFLAGS $(CFLAGS) $(INCLUDES) -c -o $@ arch/sparc32/entry.S $(CC) $$EXTRACFLAGS $(CFLAGS) $(INCLUDES) -c -o $@ arch/sparc32/entry.S
@@ -53,7 +53,7 @@
</executable> </executable>
<!-- HACK ALERT --> <!-- HACK ALERT -->
<executable name="target/include/static-dict.h" target="target" condition="IMAGE_ELF_EMBEDDED"> <executable name="target/include/static-dict.h" target="target" condition="IMAGE_ELF_EMBEDDED">
<rule><![CDATA[ <rule><![CDATA[
@echo "static const char forth_dictionary[] = {" > $@ @echo "static const char forth_dictionary[] = {" > $@
@@ -63,14 +63,14 @@
]]></rule> ]]></rule>
<external-object source="openbios-sparc32.dict"/> <external-object source="openbios-sparc32.dict"/>
</executable> </executable>
<executable name="target/arch/sparc32/builtin.o" target="target" condition="IMAGE_ELF_EMBEDDED"> <executable name="target/arch/sparc32/builtin.o" target="target" condition="IMAGE_ELF_EMBEDDED">
<rule><![CDATA[ <rule><![CDATA[
$(CC) $$EXTRACFLAGS $(CFLAGS) $(INCLUDES) -c -o $@ arch/sparc32/builtin.c $(CC) $$EXTRACFLAGS $(CFLAGS) $(INCLUDES) -c -o $@ arch/sparc32/builtin.c
]]></rule> ]]></rule>
<external-object source="target/include/static-dict.h"/> <external-object source="target/include/static-dict.h"/>
</executable> </executable>
<!-- END OF HACK ALERT --> <!-- END OF HACK ALERT -->
<executable name="openbios-builtin.elf" target="target" condition="IMAGE_ELF_EMBEDDED"> <executable name="openbios-builtin.elf" target="target" condition="IMAGE_ELF_EMBEDDED">
@@ -91,5 +91,5 @@
<external-object source="libfs.a"/> <external-object source="libfs.a"/>
<external-object source="libgcc.a"/> <external-object source="libgcc.a"/>
</executable> </executable>
</build> </build>

View File

@@ -7,6 +7,7 @@
#include "openbios/config.h" #include "openbios/config.h"
#include "openbios/kernel.h" #include "openbios/kernel.h"
#include "openbios/drivers.h"
#include "openbios.h" #include "openbios.h"
#ifdef CONFIG_DEBUG_CONSOLE #ifdef CONFIG_DEBUG_CONSOLE
@@ -148,13 +149,13 @@ typedef struct osi_fb_info {
int rb, w, h, depth; int rb, w, h, depth;
} osi_fb_info_t; } osi_fb_info_t;
int TCX_GetFBInfo( osi_fb_info_t *fb ) static int TCX_GetFBInfo( osi_fb_info_t *fb )
{ {
fb->w = 1024; fb->w = 1024;
fb->h = 768; fb->h = 768;
fb->depth = 8; fb->depth = 8;
fb->rb = 1024; fb->rb = 1024;
fb->mphys = vmem; fb->mphys = (unsigned long)vmem;
return 0; return 0;
} }

View File

@@ -6,6 +6,8 @@
#include "openbios/config.h" #include "openbios/config.h"
#include "openbios/kernel.h" #include "openbios/kernel.h"
#include "context.h" #include "context.h"
#include "sys_info.h"
#include "boot.h"
#define MAIN_STACK_SIZE 16384 #define MAIN_STACK_SIZE 16384
#define IMAGE_STACK_SIZE 4096 #define IMAGE_STACK_SIZE 4096
@@ -16,7 +18,7 @@ static void start_main(void); /* forward decl. */
void __exit_context(void); /* assembly routine */ void __exit_context(void); /* assembly routine */
/* /*
* Main context structure * Main context structure
* It is placed at the bottom of our stack, and loaded by assembly routine * It is placed at the bottom of our stack, and loaded by assembly routine
* to start us up. * to start us up.
*/ */
@@ -93,7 +95,7 @@ struct context *switch_to(struct context *ctx)
} }
/* Start ELF Boot image */ /* Start ELF Boot image */
uint32_t start_elf(uint32_t entry_point, uint32_t param) unsigned int start_elf(unsigned long entry_point, unsigned long param)
{ {
struct context *ctx; struct context *ctx;

View File

@@ -11,10 +11,10 @@
#include "sys_info.h" #include "sys_info.h"
#include "ipchecksum.h" #include "ipchecksum.h"
#include "loadfs.h" #include "loadfs.h"
#include "boot.h"
#define printf printk #define printf printk
#define debug printk #define debug printk
extern unsigned int start_elf(unsigned long entry_point, unsigned long param);
#define addr_fixup(addr) ((addr) & 0x00ffffff) #define addr_fixup(addr) ((addr) & 0x00ffffff)
static char *image_name, *image_version; static char *image_name, *image_version;
@@ -92,7 +92,7 @@ static unsigned long process_image_notes(Elf_phdr *phdr, int phnum,
continue; continue;
buf = malloc(phdr[i].p_filesz); buf = malloc(phdr[i].p_filesz);
file_seek(offset + phdr[i].p_offset); file_seek(offset + phdr[i].p_offset);
if (lfile_read(buf, phdr[i].p_filesz) != phdr[i].p_filesz) { if ((uint32_t)lfile_read(buf, phdr[i].p_filesz) != phdr[i].p_filesz) {
printf("Can't read note segment\n"); printf("Can't read note segment\n");
goto out; goto out;
} }
@@ -150,14 +150,14 @@ static int load_segments(Elf_phdr *phdr, int phnum,
i, addr_fixup(phdr[i].p_paddr), phdr[i].p_filesz, phdr[i].p_memsz); i, addr_fixup(phdr[i].p_paddr), phdr[i].p_filesz, phdr[i].p_memsz);
file_seek(offset + phdr[i].p_offset); file_seek(offset + phdr[i].p_offset);
debug("loading... "); debug("loading... ");
if (lfile_read(phys_to_virt(addr_fixup(phdr[i].p_paddr)), phdr[i].p_filesz) if ((uint32_t)lfile_read(phys_to_virt(addr_fixup(phdr[i].p_paddr)), phdr[i].p_filesz)
!= phdr[i].p_filesz) { != phdr[i].p_filesz) {
printf("Can't read program segment %d\n", i); printf("Can't read program segment %d\n", i);
return 0; return 0;
} }
bytes += phdr[i].p_filesz; bytes += phdr[i].p_filesz;
debug("clearing... "); debug("clearing... ");
memset(phys_to_virt(addr_fixup(phdr[i].p_paddr) + phdr[i].p_filesz), 0, memset(phys_to_virt(addr_fixup(phdr[i].p_paddr) + phdr[i].p_filesz), 0,
phdr[i].p_memsz - phdr[i].p_filesz); phdr[i].p_memsz - phdr[i].p_filesz);
if (phdr[i].p_offset <= checksum_offset if (phdr[i].p_offset <= checksum_offset
&& phdr[i].p_offset + phdr[i].p_filesz >= checksum_offset+2) { && phdr[i].p_offset + phdr[i].p_filesz >= checksum_offset+2) {
@@ -352,7 +352,7 @@ int elf_load(struct sys_info *info, const char *filename, const char *cmdline,
phdr_size = ehdr.e_phnum * sizeof *phdr; phdr_size = ehdr.e_phnum * sizeof *phdr;
phdr = malloc(phdr_size); phdr = malloc(phdr_size);
file_seek(offset + ehdr.e_phoff); file_seek(offset + ehdr.e_phoff);
if (lfile_read(phdr, phdr_size) != phdr_size) { if ((uint32_t)lfile_read(phdr, phdr_size) != phdr_size) {
printf("Can't read program header\n"); printf("Can't read program header\n");
goto out; goto out;
} }
@@ -369,7 +369,7 @@ int elf_load(struct sys_info *info, const char *filename, const char *cmdline,
if (!load_segments(phdr, ehdr.e_phnum, checksum_offset, offset)) if (!load_segments(phdr, ehdr.e_phnum, checksum_offset, offset))
goto out; goto out;
if (checksum_offset) { if (checksum_offset) {
if (!verify_image(&ehdr, phdr, ehdr.e_phnum, checksum)) if (!verify_image(&ehdr, phdr, ehdr.e_phnum, checksum))
goto out; goto out;
@@ -384,7 +384,7 @@ int elf_load(struct sys_info *info, const char *filename, const char *cmdline,
#if 1 #if 1
{ {
int (*entry)(const void *romvec, int p2, int p3, int p4, int p5); int (*entry)(const void *romvec_ptr, int p2, int p3, int p4, int p5);
entry = (void *) addr_fixup(ehdr.e_entry); entry = (void *) addr_fixup(ehdr.e_entry);
image_retval = entry(romvec, 0, 0, 0, 0); image_retval = entry(romvec, 0, 0, 0, 0);

View File

@@ -120,7 +120,7 @@ ss10:
lduba [%g1] ASI_M_CTL, %g2 lduba [%g1] ASI_M_CTL, %g2
cmp %g2, 'U' cmp %g2, 'U'
bne ss2 bne ss2
! Ok, this is SS-10 or SS-600MP ! Ok, this is SS-10 or SS-600MP
set PHYS_SS10_EEPROM + SPARC_MACHINE_ID, %g1 set PHYS_SS10_EEPROM + SPARC_MACHINE_ID, %g1
lduba [%g1] ASI_M_CTL, %g2 lduba [%g1] ASI_M_CTL, %g2
@@ -359,7 +359,7 @@ highmem:
set qemu_mem_size, %g1 set qemu_mem_size, %g1
st %g6, [%g1] st %g6, [%g1]
sll %g7, 4, %g7 ! Store va->pa conversion factor sll %g7, 4, %g7 ! Store va->pa conversion factor
set _start - 0x1000, %g1 set _start - 0x1000, %g1
sub %g1, %g7, %g7 sub %g1, %g7, %g7
@@ -369,7 +369,7 @@ highmem:
set qemu_machine_type, %g1 set qemu_machine_type, %g1
mov %y, %g2 mov %y, %g2
st %g2, [%g1] st %g2, [%g1]
/* Finally, turn on traps so that we can call c-code. */ /* Finally, turn on traps so that we can call c-code. */
rd %psr, %g3 rd %psr, %g3
wr %g3, 0x0, %psr wr %g3, 0x0, %psr

View File

@@ -38,10 +38,10 @@ int forth_load(struct sys_info *info, const char *filename, const char *cmdline)
} }
forthsize = file_size(); forthsize = file_size();
forthtext = malloc(forthsize+1); forthtext = malloc(forthsize+1);
file_seek(0); file_seek(0);
printk("Loading forth source ..."); printk("Loading forth source ...");
if ((unsigned long)lfile_read(forthtext, forthsize) != forthsize) { if ((unsigned long)lfile_read(forthtext, forthsize) != forthsize) {
printk("Can't read forth text\n"); printk("Can't read forth text\n");

View File

@@ -1,4 +1,4 @@
:noname :noname
." Type 'help' for detailed information" cr ." Type 'help' for detailed information" cr
\ ." boot secondary slave cdrom: " cr \ ." boot secondary slave cdrom: " cr
\ ." 0 > boot hd:2,\boot\vmlinuz root=/dev/hda2" cr \ ." 0 > boot hd:2,\boot\vmlinuz root=/dev/hda2" cr
@@ -16,7 +16,7 @@
: preopen ( chosen-str node-path ) : preopen ( chosen-str node-path )
2dup make-openable 2dup make-openable
" /chosen" find-device " /chosen" find-device
open-dev ?dup if open-dev ?dup if
encode-int 2swap property encode-int 2swap property
@@ -24,7 +24,7 @@
2drop 2drop
then then
; ;
:noname :noname
set-defaults set-defaults
; PREPOST-initializer ; PREPOST-initializer
@@ -45,11 +45,11 @@
" /builtin/console" " output-device" $setenv " /builtin/console" " output-device" $setenv
then then
; SYSTEM-initializer ; SYSTEM-initializer
:noname :noname
" keyboard" input " keyboard" input
; CONSOLE-IN-initializer ; CONSOLE-IN-initializer
device-end device-end
: rmap@ ( virt -- rmentry ) : rmap@ ( virt -- rmentry )

View File

@@ -20,7 +20,7 @@ SECTIONS
{ {
. = BASE_ADDR; . = BASE_ADDR;
/* Start of the program. /* Start of the program.
* Now the version string is in the note, we must include it * Now the version string is in the note, we must include it
* in the program. Otherwise we lose the string after relocation. */ * in the program. Otherwise we lose the string after relocation. */
_start = .; _start = .;

View File

@@ -15,7 +15,7 @@
#include "openbios/kernel.h" #include "openbios/kernel.h"
/* Format a string and print it on the screen, just like the libc /* Format a string and print it on the screen, just like the libc
* function printf. * function printf.
*/ */
int printk( const char *fmt, ... ) int printk( const char *fmt, ... )
{ {
@@ -92,12 +92,13 @@ void *malloc(int size)
if (size > ALLOC_BLOCK) if (size > ALLOC_BLOCK)
alloc_size = size; alloc_size = size;
// Recover possible leftover // Recover possible leftover
if (ofmem.left > sizeof(alloc_desc_t) + 4) { if ((size_t)ofmem.left > sizeof(alloc_desc_t) + 4) {
alloc_desc_t *d; alloc_desc_t *d_leftover;
d = (alloc_desc_t*)ofmem.next_malloc; d_leftover = (alloc_desc_t*)ofmem.next_malloc;
d->size = ofmem.left - sizeof(alloc_desc_t); d_leftover->size = ofmem.left - sizeof(alloc_desc_t);
free((unsigned long)d + sizeof(alloc_desc_t)); free((void *)((unsigned long)d_leftover +
sizeof(alloc_desc_t)));
} }
ofmem.next_malloc = mem_alloc(&cmem, alloc_size, 4); ofmem.next_malloc = mem_alloc(&cmem, alloc_size, 4);

View File

@@ -14,6 +14,7 @@
#include "sys_info.h" #include "sys_info.h"
#include "context.h" #include "context.h"
#include "loadfs.h" #include "loadfs.h"
#include "boot.h"
#define printf printk #define printf printk
#define debug printk #define debug printk
@@ -424,7 +425,7 @@ static int load_linux_kernel(struct linux_header *hdr, uint32_t kern_addr)
#endif #endif
printf("Loading kernel... "); printf("Loading kernel... ");
if (lfile_read(phys_to_virt(kern_addr), kern_size) != kern_size) { if ((uint32_t)lfile_read(phys_to_virt(kern_addr), kern_size) != kern_size) {
printf("Can't read kernel\n"); printf("Can't read kernel\n");
return 0; return 0;
} }
@@ -462,7 +463,7 @@ static int load_initrd(struct linux_header *hdr, struct sys_info *info,
max = hdr->initrd_addr_max; max = hdr->initrd_addr_max;
else else
max = 0x38000000; /* Hardcoded value for older kernels */ max = 0x38000000; /* Hardcoded value for older kernels */
/* FILO itself is at the top of RAM. (relocated) /* FILO itself is at the top of RAM. (relocated)
* So, try putting initrd just below us. */ * So, try putting initrd just below us. */
end = virt_to_phys(_start); end = virt_to_phys(_start);
@@ -497,7 +498,7 @@ static int load_initrd(struct linux_header *hdr, struct sys_info *info,
} }
printf("Loading initrd... "); printf("Loading initrd... ");
if (lfile_read(phys_to_virt(start), size) != size) { if ((uint32_t)lfile_read(phys_to_virt(start), size) != size) {
printf("Can't read initrd\n"); printf("Can't read initrd\n");
return -1; return -1;
} }
@@ -518,9 +519,9 @@ static void hardware_setup(void)
outb(0, 0xf0); outb(0, 0xf0);
outb(0, 0xf1); outb(0, 0xf1);
/* we're getting screwed again and again by this problem of the 8259. /* we're getting screwed again and again by this problem of the 8259.
* so we're going to leave this lying around for inclusion into * so we're going to leave this lying around for inclusion into
* crt0.S on an as-needed basis. * crt0.S on an as-needed basis.
* *
* well, that went ok, I hope. Now we have to reprogram the interrupts :-( * well, that went ok, I hope. Now we have to reprogram the interrupts :-(
* we put them right after the intel-reserved hardware interrupts, at * we put them right after the intel-reserved hardware interrupts, at
@@ -568,7 +569,7 @@ static int start_linux(uint32_t kern_addr, struct linux_params *params)
params->orig_x = cursor_x; params->orig_x = cursor_x;
params->orig_y = cursor_y; params->orig_y = cursor_y;
#endif #endif
/* Go... */ /* Go... */
ctx = switch_to(ctx); ctx = switch_to(ctx);

View File

@@ -15,7 +15,7 @@ int file_open(const char *filename)
void file_close(void) void file_close(void)
{ {
if(load_fd==-1) if(load_fd==-1)
return; return;
close_io(load_fd); close_io(load_fd);

View File

@@ -2,6 +2,4 @@ int file_open(const char *filename);
int lfile_read(void *buf, unsigned long len); int lfile_read(void *buf, unsigned long len);
int file_seek(unsigned long offset); int file_seek(unsigned long offset);
unsigned long file_size(void); unsigned long file_size(void);
void file_close(void);

View File

@@ -1,6 +1,6 @@
/* Support for Multiboot */ /* Support for Multiboot */
#include "openbios/config.h" #include "openbios/config.h"
#include "asm/io.h" #include "asm/io.h"
#include "sys_info.h" #include "sys_info.h"
#include "multiboot.h" #include "multiboot.h"
@@ -9,7 +9,7 @@
#ifdef CONFIG_DEBUG_BOOT #ifdef CONFIG_DEBUG_BOOT
#define debug printk #define debug printk
#else #else
#define debug(x...) #define debug(x...)
#endif #endif
struct mbheader { struct mbheader {
@@ -62,11 +62,11 @@ void collect_multiboot_info(struct sys_info *info)
printf("Multiboot: no dictionary\n"); printf("Multiboot: no dictionary\n");
return; return;
} }
mod = (module_t *) mbinfo->mods_addr; mod = (module_t *) mbinfo->mods_addr;
info->dict_start=(unsigned long *)mod->mod_start; info->dict_start=(unsigned long *)mod->mod_start;
info->dict_end=(unsigned long *)mod->mod_end; info->dict_end=(unsigned long *)mod->mod_end;
if (mbinfo->flags & MULTIBOOT_MMAP_VALID) { if (mbinfo->flags & MULTIBOOT_MMAP_VALID) {
/* convert mmap records */ /* convert mmap records */
mbmem = phys_to_virt(mbinfo->mmap_addr); mbmem = phys_to_virt(mbinfo->mmap_addr);

View File

@@ -1,5 +1,5 @@
/* multiboot.h /* multiboot.h
* tag: header for multiboot * tag: header for multiboot
* *
* Copyright (C) 2003-2004 Stefan Reinauer * Copyright (C) 2003-2004 Stefan Reinauer
* *

View File

@@ -13,13 +13,10 @@
#include "dict.h" #include "dict.h"
#include "openbios/kernel.h" #include "openbios/kernel.h"
#include "openbios/stack.h" #include "openbios/stack.h"
#include "openbios/nvram.h"
#include "sys_info.h" #include "sys_info.h"
#include "openbios.h" #include "openbios.h"
#include "boot.h"
void boot(void);
void ob_ide_init(void);
void tcx_init(uint64_t base);
void kbd_init(uint64_t base);
int qemu_machine_type; int qemu_machine_type;
@@ -97,7 +94,7 @@ static void init_memory(void)
{ {
/* push start and end of available memory to the stack /* push start and end of available memory to the stack
* so that the forth word QUIT can initialize memory * so that the forth word QUIT can initialize memory
* management. For now we use hardcoded memory between * management. For now we use hardcoded memory between
* 0x10000 and 0x9ffff (576k). If we need more memory * 0x10000 and 0x9ffff (576k). If we need more memory
* than that we have serious bloat. * than that we have serious bloat.
@@ -133,8 +130,6 @@ arch_init( void )
int openbios(void) int openbios(void)
{ {
extern struct sys_info sys_info;
extern struct mem cmem;
unsigned int i; unsigned int i;
for (i = 0; i < sizeof(hwdefs) / sizeof(struct hwdef); i++) { for (i = 0; i < sizeof(hwdefs) / sizeof(struct hwdef); i++) {
@@ -164,10 +159,10 @@ int openbios(void)
#endif #endif
collect_sys_info(&sys_info); collect_sys_info(&sys_info);
dict=intdict; dict=intdict;
load_dictionary((char *)sys_info.dict_start, load_dictionary((char *)sys_info.dict_start,
(unsigned long)sys_info.dict_end (unsigned long)sys_info.dict_end
- (unsigned long)sys_info.dict_start); - (unsigned long)sys_info.dict_start);
#ifdef CONFIG_DEBUG_BOOT #ifdef CONFIG_DEBUG_BOOT
@@ -183,7 +178,7 @@ int openbios(void)
PUSH_xt( bind_noname_func(arch_init) ); PUSH_xt( bind_noname_func(arch_init) );
fword("PREPOST-initializer"); fword("PREPOST-initializer");
PC = (ucell)findword("initialize-of"); PC = (ucell)findword("initialize-of");
if (!PC) { if (!PC) {

View File

@@ -1,17 +1,17 @@
/* /*
* Creation Date: <2004/01/15 16:14:05 samuel> * Creation Date: <2004/01/15 16:14:05 samuel>
* Time-stamp: <2004/01/15 16:14:05 samuel> * Time-stamp: <2004/01/15 16:14:05 samuel>
* *
* <openbios.h> * <openbios.h>
* *
* *
* *
* Copyright (C) 2004 Samuel Rydh (samuel@ibrium.se) * Copyright (C) 2004 Samuel Rydh (samuel@ibrium.se)
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
* version 2 * version 2
* *
*/ */
#ifndef _H_OPENBIOS #ifndef _H_OPENBIOS

View File

@@ -205,7 +205,7 @@ struct linux_prom_ranges {
/* Ranges and reg properties are a bit different for PCI. */ /* Ranges and reg properties are a bit different for PCI. */
struct linux_prom_pci_registers { struct linux_prom_pci_registers {
/* /*
* We don't know what information this field contain. * We don't know what information this field contain.
* We guess, PCI device function is in bits 15:8 * We guess, PCI device function is in bits 15:8
* So, ... * So, ...

View File

@@ -14,8 +14,11 @@
#include "libc/vsprintf.h" #include "libc/vsprintf.h"
#include "openbios/config.h" #include "openbios/config.h"
#include "openbios/bindings.h" #include "openbios/bindings.h"
#include "openbios/drivers.h"
#include "openbios/kernel.h" #include "openbios/kernel.h"
#include "openbios/sysinclude.h" #include "openbios/sysinclude.h"
#include "sys_info.h"
#include "boot.h"
#ifdef CONFIG_DEBUG_OBP #ifdef CONFIG_DEBUG_OBP
#define DPRINTF(fmt, args...) \ #define DPRINTF(fmt, args...) \
@@ -178,7 +181,7 @@ static int obp_getprop(int node, char *name, char *value)
int i; int i;
DPRINTF("obp_getprop(0x%x, %s) = ", node, name); DPRINTF("obp_getprop(0x%x, %s) = ", node, name);
for (i = 0; i < len; i++) { for (i = 0; i < len; i++) {
DPRINTF("%02x%s", str[i] & 0xFF, DPRINTF("%02x%s", str[i] & 0xFF,
(len == 4 || i == len-1) ? "" : " "); (len == 4 || i == len-1) ? "" : " ");
} }
DPRINTF("\n"); DPRINTF("\n");
@@ -210,7 +213,7 @@ static const char *obp_nextprop(int node, char *name)
} else { } else {
int len; int len;
char *str; char *str;
len = POP(); len = POP();
str = (char *) POP(); str = (char *) POP();
@@ -437,7 +440,7 @@ static char * obp_dumb_memalloc(char *va, unsigned int size)
// ROM. // ROM.
if (va == NULL) { if (va == NULL) {
va = next_free_address - size; va = (char *)(next_free_address - size);
next_free_address -= size; next_free_address -= size;
DPRINTF("obp_dumb_memalloc req null -> 0x%x\n", va); DPRINTF("obp_dumb_memalloc req null -> 0x%x\n", va);
} }
@@ -447,9 +450,6 @@ static char * obp_dumb_memalloc(char *va, unsigned int size)
return va; return va;
} }
extern int start_cpu(unsigned int pc, unsigned int context_ptr,
unsigned int context, int cpu);
static int obp_cpustart(__attribute__((unused))unsigned int whichcpu, static int obp_cpustart(__attribute__((unused))unsigned int whichcpu,
__attribute__((unused))int ctxtbl_ptr, __attribute__((unused))int ctxtbl_ptr,
__attribute__((unused))int thiscontext, __attribute__((unused))int thiscontext,
@@ -497,7 +497,7 @@ static void obp_fortheval_v2(char *str)
// don't get a stack underrun. // don't get a stack underrun.
// //
// FIXME: find out why solaris doesnt put its stuff on the stack // FIXME: find out why solaris doesnt put its stuff on the stack
// //
fword("0"); fword("0");
fword("0"); fword("0");

View File

@@ -14,7 +14,7 @@
* switches the stack, and restores everything from the new stack. * switches the stack, and restores everything from the new stack.
* This function takes no argument. New stack pointer is * This function takes no argument. New stack pointer is
* taken from global variable __context, and old stack pointer * taken from global variable __context, and old stack pointer
* is also saved to __context. This way we can just jump to * is also saved to __context. This way we can just jump to
* this routine to get back to the original context. * this routine to get back to the original context.
*/ */
@@ -104,7 +104,7 @@ __switch_context_nosave:
ld [%g1 + 116], %i5 ld [%g1 + 116], %i5
ld [%g1 + 120], %i6 ld [%g1 + 120], %i6
ld [%g1 + 124], %i7 ld [%g1 + 124], %i7
ld [%g1 + 128], %g1 ld [%g1 + 128], %g1
/* Finally, load new %pc */ /* Finally, load new %pc */
jmp %g1 jmp %g1

View File

@@ -8,7 +8,7 @@
#ifdef CONFIG_DEBUG_BOOT #ifdef CONFIG_DEBUG_BOOT
#define debug printk #define debug printk
#else #else
#define debug(x...) #define debug(x...)
#endif #endif
unsigned int qemu_mem_size; unsigned int qemu_mem_size;

View File

@@ -5,7 +5,7 @@
" sun4m" encode-string " compatible" property " sun4m" encode-string " compatible" property
h# 0a21fe80 encode-int " clock-frequency" property h# 0a21fe80 encode-int " clock-frequency" property
: encode-unit encode-unit-sbus ; : encode-unit encode-unit-sbus ;
: decode-unit decode-unit-sbus ; : decode-unit decode-unit-sbus ;

View File

@@ -4,7 +4,7 @@
* Sparc V9 Trap Table(s) with SpitFire/Cheetah extensions. * Sparc V9 Trap Table(s) with SpitFire/Cheetah extensions.
* *
* Copyright (C) 1996, 2001 David S. Miller (davem@caip.rutgers.edu) * Copyright (C) 1996, 2001 David S. Miller (davem@caip.rutgers.edu)
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
* version 2 as published by the Free Software Foundation. * version 2 as published by the Free Software Foundation.
@@ -13,7 +13,7 @@
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,

View File

@@ -3,7 +3,7 @@
* because we have no user windows. * because we have no user windows.
* *
* Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu) * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
* version 2 as published by the Free Software Foundation. * version 2 as published by the Free Software Foundation.
@@ -12,7 +12,7 @@
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
@@ -96,7 +96,7 @@ spnwin_patch3_7win: and %twin_tmp, 0x7f, %twin_tmp
* nop * nop
*/ */
.globl spill_window_entry .globl spill_window_entry
.globl spnwin_patch1, spnwin_patch2 .globl spnwin_patch1, spnwin_patch2
spill_window_entry: spill_window_entry:
/* LOCATION: Trap Window */ /* LOCATION: Trap Window */

View File

@@ -11,7 +11,7 @@
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,

View File

@@ -1,6 +1,6 @@
/* /*
* OpenBIOS ESP driver * OpenBIOS ESP driver
* *
* Copyright (C) 2004 Jens Axboe <axboe@suse.de> * Copyright (C) 2004 Jens Axboe <axboe@suse.de>
* Copyright (C) 2005 Stefan Reinauer <stepan@openbios.org> * Copyright (C) 2005 Stefan Reinauer <stepan@openbios.org>
* *
@@ -122,7 +122,7 @@ do_command(esp_private_t *esp, sd_private_t *sd, int cmdlen, int replylen)
if ((status & ESP_STAT_TCNT) != ESP_STAT_TCNT if ((status & ESP_STAT_TCNT) != ESP_STAT_TCNT
|| (status & ESP_STAT_PMASK) == ESP_STATP) || (status & ESP_STAT_PMASK) == ESP_STATP)
return status; return status;
// Get reply // Get reply
// Set DMA address // Set DMA address
esp->espdma.regs->st_addr = esp->buffer_dvma; esp->espdma.regs->st_addr = esp->buffer_dvma;
@@ -211,7 +211,7 @@ inquiry(esp_private_t *esp, sd_private_t *sd)
} }
sd->present = 1; sd->present = 1;
sd->media = esp->buffer[0]; sd->media = esp->buffer[0];
switch (sd->media) { switch (sd->media) {
case TYPE_DISK: case TYPE_DISK:
media = "disk"; media = "disk";
@@ -271,7 +271,7 @@ ob_sd_open(__attribute__((unused))sd_private_t **sd)
phandle_t ph; phandle_t ph;
fword("my-unit"); fword("my-unit");
id = POP(); id = POP();
//POP(); // unit id is 2 ints but we only need one. //POP(); // unit id is 2 ints but we only need one.
*sd = &global_esp->sd[id]; *sd = &global_esp->sd[id];
@@ -463,7 +463,7 @@ ob_esp_init(unsigned int slot, uint64_t base, unsigned long espoffset,
// Chip reset // Chip reset
esp->ll->regs[ESP_CMD] = ESP_CMD_RC; esp->ll->regs[ESP_CMD] = ESP_CMD_RC;
DPRINTF("ESP at 0x%lx, buffer va 0x%lx dva 0x%lx\n", (unsigned long)esp, DPRINTF("ESP at 0x%lx, buffer va 0x%lx dva 0x%lx\n", (unsigned long)esp,
(unsigned long)esp->buffer, (unsigned long)esp->buffer_dvma); (unsigned long)esp->buffer, (unsigned long)esp->buffer_dvma);
DPRINTF("done\n"); DPRINTF("done\n");

View File

@@ -92,7 +92,7 @@ mem_alloc(struct mem *t, int size, int align)
pa = va2pa((unsigned long)t->curp) + (align - 1); pa = va2pa((unsigned long)t->curp) + (align - 1);
pa &= ~(align - 1); pa &= ~(align - 1);
p = (char *)pa2va(pa); p = (char *)pa2va(pa);
if ((unsigned long)p >= (unsigned long)t->uplim || if ((unsigned long)p >= (unsigned long)t->uplim ||
(unsigned long)p + size > (unsigned long)t->uplim) (unsigned long)p + size > (unsigned long)t->uplim)
return 0; return 0;

View File

@@ -1,9 +1,9 @@
/* /*
* OpenBIOS Sparc OBIO driver * OpenBIOS Sparc OBIO driver
* *
* (C) 2004 Stefan Reinauer <stepan@openbios.org> * (C) 2004 Stefan Reinauer <stepan@openbios.org>
* (C) 2005 Ed Schouten <ed@fxq.nl> * (C) 2005 Ed Schouten <ed@fxq.nl>
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
* version 2 * version 2
@@ -19,6 +19,7 @@
#include "openbios/drivers.h" #include "openbios/drivers.h"
#include "openbios/nvram.h" #include "openbios/nvram.h"
#include "obio.h" #include "obio.h"
#define cpu_to_be16(x) __cpu_to_be16(x)
#include "openbios/firmware_abi.h" #include "openbios/firmware_abi.h"
#define REGISTER_NAMED_NODE( name, path ) do { \ #define REGISTER_NAMED_NODE( name, path ) do { \
@@ -50,7 +51,7 @@
* mapped memory. * mapped memory.
*/ */
#define OBIO_CMDLINE_MAX 256 #define OBIO_CMDLINE_MAX 256
char obio_cmdline[OBIO_CMDLINE_MAX]; static char obio_cmdline[OBIO_CMDLINE_MAX];
/* DECLARE data structures for the nodes. */ /* DECLARE data structures for the nodes. */
DECLARE_UNNAMED_NODE( ob_obio, INSTALL_OPEN, sizeof(int) ); DECLARE_UNNAMED_NODE( ob_obio, INSTALL_OPEN, sizeof(int) );
@@ -171,12 +172,9 @@ zs_read(unsigned long *address)
} }
} }
int keyboard_dataready(void);
unsigned char keyboard_readdata(void);
/* ( addr len -- actual ) */ /* ( addr len -- actual ) */
static void static void
zs_read_keyboard(unsigned long *address) zs_read_keyboard(void)
{ {
unsigned char *addr; unsigned char *addr;
int len; int len;
@@ -314,7 +312,7 @@ ob_eccmemctl_init(void)
push_str("width"); push_str("width");
fword("property"); fword("property");
regs = map_reg(ECC_BASE, 0, ECC_SIZE, 1, ECC_BASE >> 32); regs = (uint32_t *)map_reg(ECC_BASE, 0, ECC_SIZE, 1, ECC_BASE >> 32);
version = regs[0]; version = regs[0];
switch (version) { switch (version) {
@@ -723,7 +721,7 @@ ob_nvram_init(uint64_t base, uint64_t offset)
{ {
extern uint32_t kernel_image; extern uint32_t kernel_image;
extern uint32_t kernel_size; extern uint32_t kernel_size;
extern uint32_t cmdline; extern uint32_t qemu_cmdline;
extern uint32_t cmdline_size; extern uint32_t cmdline_size;
extern char boot_device; extern char boot_device;
extern char obp_stdin, obp_stdout; extern char obp_stdin, obp_stdout;
@@ -735,7 +733,7 @@ ob_nvram_init(uint64_t base, uint64_t offset)
char nographic; char nographic;
uint32_t size; uint32_t size;
unsigned int machine_id; unsigned int machine_id;
struct cpudef *cpu; const struct cpudef *cpu;
ohwcfg_v3_t *header; ohwcfg_v3_t *header;
ob_new_obio_device("eeprom", NULL); ob_new_obio_device("eeprom", NULL);
@@ -746,7 +744,7 @@ ob_nvram_init(uint64_t base, uint64_t offset)
fword("encode-int"); fword("encode-int");
push_str("address"); push_str("address");
fword("property"); fword("property");
memcpy(&nv_info, nvram, sizeof(nv_info)); memcpy(&nv_info, nvram, sizeof(nv_info));
machine_id = (unsigned int)nvram[0x1fd9] & 0xff; machine_id = (unsigned int)nvram[0x1fd9] & 0xff;
printk("Nvram id %s, version %d, machine id 0x%2.2x\n", printk("Nvram id %s, version %d, machine id 0x%2.2x\n",
@@ -763,9 +761,9 @@ ob_nvram_init(uint64_t base, uint64_t offset)
size = nv_info.cmdline_size; size = nv_info.cmdline_size;
if (size > OBIO_CMDLINE_MAX - 1) if (size > OBIO_CMDLINE_MAX - 1)
size = OBIO_CMDLINE_MAX - 1; size = OBIO_CMDLINE_MAX - 1;
memcpy(obio_cmdline, nv_info.cmdline, size); memcpy(&obio_cmdline, (void *)(long)nv_info.cmdline, size);
obio_cmdline[size] = '\0'; obio_cmdline[size] = '\0';
cmdline = obio_cmdline; qemu_cmdline = (uint32_t) &obio_cmdline;
cmdline_size = size; cmdline_size = size;
header = (ohwcfg_v3_t *)nvram; header = (ohwcfg_v3_t *)nvram;
header->kernel_image = 0; header->kernel_image = 0;
@@ -785,7 +783,7 @@ ob_nvram_init(uint64_t base, uint64_t offset)
// Add /idprom // Add /idprom
push_str("/"); push_str("/");
fword("find-device"); fword("find-device");
PUSH((long)&nvram[NVRAM_IDPROM]); PUSH((long)&nvram[NVRAM_IDPROM]);
PUSH(32); PUSH(32);
fword("encode-bytes"); fword("encode-bytes");
@@ -940,7 +938,7 @@ ob_nvram_init(uint64_t base, uint64_t offset)
fword("encode-int"); fword("encode-int");
push_str("ecache-associativity"); push_str("ecache-associativity");
fword("property"); fword("property");
PUSH(2); PUSH(2);
fword("encode-int"); fword("encode-int");
push_str("ncaches"); push_str("ncaches");
@@ -973,7 +971,7 @@ ob_nvram_init(uint64_t base, uint64_t offset)
fword("encode-int"); fword("encode-int");
push_str("mid"); push_str("mid");
fword("property"); fword("property");
cpu->initfn(); cpu->initfn();
fword("finish-device"); fword("finish-device");
@@ -1055,7 +1053,7 @@ ob_aux2_reset_init(uint64_t base, uint64_t offset, int intr)
{ {
ob_new_obio_device("power", NULL); ob_new_obio_device("power", NULL);
power_reg = ob_reg(base, offset, AUXIO2_REGS, 1); power_reg = (void *)ob_reg(base, offset, AUXIO2_REGS, 1);
// Not in device tree // Not in device tree
reset_reg = map_io(base + (uint64_t)SLAVIO_RESET, RESET_REGS); reset_reg = map_io(base + (uint64_t)SLAVIO_RESET, RESET_REGS);
@@ -1187,7 +1185,7 @@ start_cpu(unsigned int pc, unsigned int context_ptr, unsigned int context, int c
if (!cpu) if (!cpu)
return -1; return -1;
sparc_header = &nvram[header->nvram_arch_ptr]; sparc_header = (struct sparc_arch_cfg *)&nvram[header->nvram_arch_ptr];
sparc_header->smp_entry = pc; sparc_header->smp_entry = pc;
sparc_header->smp_ctxtbl = context_ptr; sparc_header->smp_ctxtbl = context_ptr;
sparc_header->smp_ctx = context; sparc_header->smp_ctx = context;

View File

@@ -218,7 +218,7 @@ static __inline__ int
srmmu_get_pte (unsigned long addr) srmmu_get_pte (unsigned long addr)
{ {
register unsigned long entry; register unsigned long entry;
__asm__ __volatile__("\n\tlda [%1] %2,%0\n\t" : __asm__ __volatile__("\n\tlda [%1] %2,%0\n\t" :
"=r" (entry): "=r" (entry):
"r" ((addr & 0xfffff000) | 0x400), "i" (ASI_M_FLUSH_PROBE)); "r" ((addr & 0xfffff000) | 0x400), "i" (ASI_M_FLUSH_PROBE));

View File

@@ -1,9 +1,9 @@
/* /*
* OpenBIOS SBus driver * OpenBIOS SBus driver
* *
* (C) 2004 Stefan Reinauer <stepan@openbios.org> * (C) 2004 Stefan Reinauer <stepan@openbios.org>
* (C) 2005 Ed Schouten <ed@fxq.nl> * (C) 2005 Ed Schouten <ed@fxq.nl>
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
* version 2 * version 2
@@ -57,8 +57,7 @@ ob_sbus_node_init(uint64_t base)
} }
static void static void
ob_le_init(unsigned int slot, unsigned long base, unsigned long leoffset, ob_le_init(unsigned int slot, unsigned long leoffset, unsigned long dmaoffset)
unsigned long dmaoffset)
{ {
push_str("/iommu/sbus/ledma"); push_str("/iommu/sbus/ledma");
fword("find-device"); fword("find-device");
@@ -90,7 +89,7 @@ ob_le_init(unsigned int slot, unsigned long base, unsigned long leoffset,
uint16_t graphic_depth; uint16_t graphic_depth;
static void static void
ob_tcx_init(unsigned int slot, unsigned long base) ob_tcx_init(unsigned int slot)
{ {
push_str("/iommu/sbus/SUNW,tcx"); push_str("/iommu/sbus/SUNW,tcx");
fword("find-device"); fword("find-device");
@@ -305,7 +304,7 @@ ob_apc_init(unsigned int slot, unsigned long base)
} }
static void static void
ob_cs4231_init(unsigned int slot, unsigned long base) ob_cs4231_init(unsigned int slot)
{ {
push_str("/iommu/sbus"); push_str("/iommu/sbus");
fword("find-device"); fword("find-device");
@@ -362,7 +361,7 @@ ob_macio_init(unsigned int slot, uint64_t base, unsigned long offset)
#endif #endif
// NCR 92C990, Am7990, Lance. See http://www.amd.com // NCR 92C990, Am7990, Lance. See http://www.amd.com
ob_le_init(slot, base, offset + 0x00c00000, offset + 0x00400010); ob_le_init(slot, offset + 0x00c00000, offset + 0x00400010);
// Parallel port // Parallel port
//ob_bpp_init(base); //ob_bpp_init(base);
@@ -374,11 +373,11 @@ sbus_probe_slot_ss5(unsigned int slot, uint64_t base)
// OpenBIOS and Qemu don't know how to do Sbus probing // OpenBIOS and Qemu don't know how to do Sbus probing
switch(slot) { switch(slot) {
case 3: // SUNW,tcx case 3: // SUNW,tcx
ob_tcx_init(slot, base); ob_tcx_init(slot);
break; break;
case 4: case 4:
// SUNW,CS4231 // SUNW,CS4231
ob_cs4231_init(slot, base); ob_cs4231_init(slot);
// Power management (APC) // Power management (APC)
ob_apc_init(slot, APC_OFFSET); ob_apc_init(slot, APC_OFFSET);
break; break;
@@ -396,7 +395,7 @@ sbus_probe_slot_ss10(unsigned int slot, uint64_t base)
// OpenBIOS and Qemu don't know how to do Sbus probing // OpenBIOS and Qemu don't know how to do Sbus probing
switch(slot) { switch(slot) {
case 2: // SUNW,tcx case 2: // SUNW,tcx
ob_tcx_init(slot, base); ob_tcx_init(slot);
break; break;
case 0xf: // le, esp, bpp, power-management case 0xf: // le, esp, bpp, power-management
ob_macio_init(slot, base, 0); ob_macio_init(slot, base, 0);
@@ -414,14 +413,14 @@ sbus_probe_slot_ss600mp(unsigned int slot, uint64_t base)
// OpenBIOS and Qemu don't know how to do Sbus probing // OpenBIOS and Qemu don't know how to do Sbus probing
switch(slot) { switch(slot) {
case 2: // SUNW,tcx case 2: // SUNW,tcx
ob_tcx_init(slot, base); ob_tcx_init(slot);
break; break;
case 0xf: // le, esp, bpp, power-management case 0xf: // le, esp, bpp, power-management
#ifdef CONFIG_DRIVER_ESP #ifdef CONFIG_DRIVER_ESP
ob_esp_init(slot, base, SS600MP_ESP, SS600MP_ESPDMA); ob_esp_init(slot, base, SS600MP_ESP, SS600MP_ESPDMA);
#endif #endif
// NCR 92C990, Am7990, Lance. See http://www.amd.com // NCR 92C990, Am7990, Lance. See http://www.amd.com
ob_le_init(slot, base, 0x00060000, SS600MP_LEBUFFER); ob_le_init(slot, 0x00060000, SS600MP_LEBUFFER);
// Power management (APC) XXX should not exist // Power management (APC) XXX should not exist
ob_apc_init(slot, APC_OFFSET); ob_apc_init(slot, APC_OFFSET);
break; break;
@@ -431,20 +430,20 @@ sbus_probe_slot_ss600mp(unsigned int slot, uint64_t base)
} }
static void static void
ob_sbus_open(int *idx) ob_sbus_open(void)
{ {
int ret=1; int ret=1;
RET ( -ret ); RET ( -ret );
} }
static void static void
ob_sbus_close(int *idx) ob_sbus_close(void)
{ {
selfword("close-deblocker"); selfword("close-deblocker");
} }
static void static void
ob_sbus_initialize(int *idx) ob_sbus_initialize(void)
{ {
} }
@@ -505,7 +504,7 @@ ob_add_sbus_range(const struct sbus_offset *range, int notfirst)
} }
static int static int
ob_sbus_init_ss5(uint64_t base) ob_sbus_init_ss5(void)
{ {
unsigned int slot; unsigned int slot;
int notfirst = 0; int notfirst = 0;
@@ -526,7 +525,7 @@ ob_sbus_init_ss5(uint64_t base)
} }
static int static int
ob_sbus_init_ss10(uint64_t base) ob_sbus_init_ss10(void)
{ {
unsigned int slot; unsigned int slot;
int notfirst = 0; int notfirst = 0;
@@ -547,7 +546,7 @@ ob_sbus_init_ss10(uint64_t base)
} }
static int static int
ob_sbus_init_ss600mp(uint64_t base) ob_sbus_init_ss600mp(void)
{ {
unsigned int slot; unsigned int slot;
int notfirst = 0; int notfirst = 0;
@@ -573,11 +572,11 @@ int ob_sbus_init(uint64_t base, int machine_id)
switch (machine_id) { switch (machine_id) {
case 0x71: case 0x71:
return ob_sbus_init_ss600mp(base); return ob_sbus_init_ss600mp();
case 0x72: case 0x72:
return ob_sbus_init_ss10(base); return ob_sbus_init_ss10();
case 0x80: case 0x80:
return ob_sbus_init_ss5(base); return ob_sbus_init_ss5();
default: default:
return -1; return -1;
} }

View File

@@ -16,6 +16,13 @@ int ob_pci_init(void);
#endif #endif
#ifdef CONFIG_DRIVER_SBUS #ifdef CONFIG_DRIVER_SBUS
int ob_sbus_init(uint64_t base, int machine_id); int ob_sbus_init(uint64_t base, int machine_id);
void tcx_init(uint64_t base);
void kbd_init(uint64_t base);
int keyboard_dataready(void);
unsigned char keyboard_readdata(void);
#ifdef CONFIG_DEBUG_CONSOLE_VIDEO
void init_video(void);
#endif
#endif #endif
#ifdef CONFIG_DRIVER_IDE #ifdef CONFIG_DRIVER_IDE
int ob_ide_init(void); int ob_ide_init(void);
@@ -28,5 +35,10 @@ int ob_esp_init(unsigned int slot, uint64_t base, unsigned long espoffset,
int ob_obio_init(uint64_t slavio_base, unsigned long fd_offset, int ob_obio_init(uint64_t slavio_base, unsigned long fd_offset,
unsigned long counter_offset, unsigned long intr_offset, unsigned long counter_offset, unsigned long intr_offset,
unsigned long aux1_offset, unsigned long aux2_offset); unsigned long aux1_offset, unsigned long aux2_offset);
int start_cpu(unsigned int pc, unsigned int context_ptr, unsigned int context,
int cpu);
extern struct mem cmem;
#endif
#ifdef CONFIG_DRIVER_FLOPPY
int ob_floppy_init(void);
#endif #endif