Author: blueswirl Date: 2008-07-07 20:35:51 +0200 (Mon, 07 Jul 2008) New Revision: 189
Modified: openbios-devel/arch/sparc32/aoutload.c openbios-devel/arch/sparc32/boot.c openbios-devel/arch/sparc32/boot.h openbios-devel/arch/sparc32/build.xml openbios-devel/arch/sparc32/console.c openbios-devel/arch/sparc32/context.c openbios-devel/arch/sparc32/elfload.c openbios-devel/arch/sparc32/entry.S openbios-devel/arch/sparc32/forthload.c openbios-devel/arch/sparc32/init.fs openbios-devel/arch/sparc32/ldscript openbios-devel/arch/sparc32/lib.c openbios-devel/arch/sparc32/linux_load.c openbios-devel/arch/sparc32/loadfs.c openbios-devel/arch/sparc32/loadfs.h openbios-devel/arch/sparc32/multiboot.c openbios-devel/arch/sparc32/multiboot.h openbios-devel/arch/sparc32/openbios.c openbios-devel/arch/sparc32/openbios.h openbios-devel/arch/sparc32/openprom.h openbios-devel/arch/sparc32/romvec.c openbios-devel/arch/sparc32/switch.S openbios-devel/arch/sparc32/sys_info.c openbios-devel/arch/sparc32/tree.fs openbios-devel/arch/sparc32/vectors.S openbios-devel/arch/sparc32/wof.S openbios-devel/arch/sparc32/wuf.S openbios-devel/drivers/esp.c openbios-devel/drivers/iommu.c openbios-devel/drivers/obio.c openbios-devel/drivers/pgtsrmmu.h openbios-devel/drivers/sbus.c openbios-devel/include/openbios/drivers.h Log: Fix some Sparc32 compile warnings
Modified: openbios-devel/arch/sparc32/aoutload.c =================================================================== --- openbios-devel/arch/sparc32/aoutload.c 2008-07-05 18:02:18 UTC (rev 188) +++ openbios-devel/arch/sparc32/aoutload.c 2008-07-07 18:35:51 UTC (rev 189) @@ -8,6 +8,7 @@ #include "a.out.h" #include "sys_info.h" #include "loadfs.h" +#include "boot.h" #define printf printk #define debug printk
@@ -84,7 +85,7 @@
if (ehdr.a_text == 0x30800007) ehdr.a_text=64*1024; - + if (N_MAGIC(ehdr) == NMAGIC) { size = addr_fixup(N_DATADDR(ehdr)) + addr_fixup(ehdr.a_data); } else { @@ -105,21 +106,21 @@ file_seek(offset + N_TXTOFF(ehdr));
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); 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); goto out; } } 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); goto out; } } - + debug("Loaded %lu bytes\n", size);
debug("entry point is %#lx\n", start); @@ -127,7 +128,7 @@
#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); image_retval = entry(romvec, 0, 0, 0, 0);
Modified: openbios-devel/arch/sparc32/boot.c =================================================================== --- openbios-devel/arch/sparc32/boot.c 2008-07-05 18:02:18 UTC (rev 188) +++ openbios-devel/arch/sparc32/boot.c 2008-07-07 18:35:51 UTC (rev 189) @@ -7,30 +7,23 @@ #include "openbios/elfload.h" #include "openbios/nvram.h" #include "libc/diskio.h" +#include "libc/vsprintf.h" #include "sys_info.h" #include "openprom.h" +#include "boot.h"
-int elf_load(struct sys_info *, const char *filename, const char *cmdline, const void *romvec); -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; +struct sys_info sys_info; uint32_t kernel_image; uint32_t kernel_size; -uint32_t cmdline; +uint32_t qemu_cmdline; uint32_t cmdline_size; 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) { char *path = pop_fstr_copy(), *param, *oldpath = path; char altpath[256]; - int unit; + int unit = 0; const void *romvec;
if(!path) { @@ -41,18 +34,15 @@ fword("get-package-property"); if (!POP()) { path = pop_fstr_copy(); - unit = 0; } else { switch (boot_device) { case 'a': path = strdup("/obio/SUNW,fdtwo"); oldpath = "fd()"; - unit = 0; break; case 'c': path = strdup("disk"); oldpath = "sd(0,0,0):d"; - unit = 0; break; default: case 'd': @@ -66,7 +56,6 @@ case 'n': path = strdup("net"); oldpath = "le()"; - unit = 0; break; } } @@ -78,14 +67,14 @@ obp_arg.boot_dev[0] = oldpath[0]; obp_arg.boot_dev[1] = oldpath[1]; obp_arg.argv[0] = oldpath; - obp_arg.argv[1] = cmdline; + obp_arg.argv[1] = (void *)(long)qemu_cmdline;
param = strchr(path, ' '); if(param) { *param = '\0'; param++; } else if (cmdline_size) { - param = (char *)cmdline; + param = (char *)qemu_cmdline; } else { push_str("boot-args"); push_str("/options"); @@ -100,7 +89,7 @@ romvec = init_openprom(qemu_mem_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"); entry = (void *) kernel_image; @@ -108,7 +97,7 @@ }
printk("[sparc] Booting file '%s' ", path); - if(param) + if (param) printk("with parameters '%s'\n", param); else printk("without parameters.\n");
Modified: openbios-devel/arch/sparc32/boot.h =================================================================== --- openbios-devel/arch/sparc32/boot.h 2008-07-05 18:02:18 UTC (rev 188) +++ openbios-devel/arch/sparc32/boot.h 2008-07-07 18:35:51 UTC (rev 189) @@ -15,3 +15,16 @@ const void *romvec);
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;
Modified: openbios-devel/arch/sparc32/build.xml =================================================================== --- openbios-devel/arch/sparc32/build.xml 2008-07-05 18:02:18 UTC (rev 188) +++ openbios-devel/arch/sparc32/build.xml 2008-07-07 18:35:51 UTC (rev 189) @@ -21,7 +21,7 @@ <object source="loadfs.c"/> <object source="romvec.c"/> </library> - + <executable name="target/arch/sparc32/entry.o" target="target"> <rule><![CDATA[ $(CC) $$EXTRACFLAGS $(CFLAGS) $(INCLUDES) -c -o $@ arch/sparc32/entry.S @@ -53,7 +53,7 @@ </executable>
<!-- HACK ALERT --> - + <executable name="target/include/static-dict.h" target="target" condition="IMAGE_ELF_EMBEDDED"> <rule><![CDATA[ @echo "static const char forth_dictionary[] = {" > $@ @@ -63,14 +63,14 @@ ]]></rule> <external-object source="openbios-sparc32.dict"/> </executable> - + <executable name="target/arch/sparc32/builtin.o" target="target" condition="IMAGE_ELF_EMBEDDED"> <rule><![CDATA[ $(CC) $$EXTRACFLAGS $(CFLAGS) $(INCLUDES) -c -o $@ arch/sparc32/builtin.c ]]></rule> <external-object source="target/include/static-dict.h"/> </executable> - + <!-- END OF HACK ALERT -->
<executable name="openbios-builtin.elf" target="target" condition="IMAGE_ELF_EMBEDDED"> @@ -91,5 +91,5 @@ <external-object source="libfs.a"/> <external-object source="libgcc.a"/> </executable> - + </build>
Modified: openbios-devel/arch/sparc32/console.c =================================================================== --- openbios-devel/arch/sparc32/console.c 2008-07-05 18:02:18 UTC (rev 188) +++ openbios-devel/arch/sparc32/console.c 2008-07-07 18:35:51 UTC (rev 189) @@ -7,6 +7,7 @@
#include "openbios/config.h" #include "openbios/kernel.h" +#include "openbios/drivers.h" #include "openbios.h"
#ifdef CONFIG_DEBUG_CONSOLE @@ -148,13 +149,13 @@ int rb, w, h, depth; } 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->h = 768; fb->depth = 8; fb->rb = 1024; - fb->mphys = vmem; + fb->mphys = (unsigned long)vmem;
return 0; }
Modified: openbios-devel/arch/sparc32/context.c =================================================================== --- openbios-devel/arch/sparc32/context.c 2008-07-05 18:02:18 UTC (rev 188) +++ openbios-devel/arch/sparc32/context.c 2008-07-07 18:35:51 UTC (rev 189) @@ -6,6 +6,8 @@ #include "openbios/config.h" #include "openbios/kernel.h" #include "context.h" +#include "sys_info.h" +#include "boot.h"
#define MAIN_STACK_SIZE 16384 #define IMAGE_STACK_SIZE 4096 @@ -16,7 +18,7 @@ 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 * to start us up. */ @@ -93,7 +95,7 @@ }
/* 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;
Modified: openbios-devel/arch/sparc32/elfload.c =================================================================== --- openbios-devel/arch/sparc32/elfload.c 2008-07-05 18:02:18 UTC (rev 188) +++ openbios-devel/arch/sparc32/elfload.c 2008-07-07 18:35:51 UTC (rev 189) @@ -11,10 +11,10 @@ #include "sys_info.h" #include "ipchecksum.h" #include "loadfs.h" +#include "boot.h" #define printf printk #define debug printk
-extern unsigned int start_elf(unsigned long entry_point, unsigned long param); #define addr_fixup(addr) ((addr) & 0x00ffffff)
static char *image_name, *image_version; @@ -92,7 +92,7 @@ continue; buf = malloc(phdr[i].p_filesz); 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"); goto out; } @@ -150,14 +150,14 @@ i, addr_fixup(phdr[i].p_paddr), phdr[i].p_filesz, phdr[i].p_memsz); file_seek(offset + phdr[i].p_offset); 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) { printf("Can't read program segment %d\n", i); return 0; } bytes += phdr[i].p_filesz; 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); if (phdr[i].p_offset <= checksum_offset && phdr[i].p_offset + phdr[i].p_filesz >= checksum_offset+2) { @@ -352,7 +352,7 @@ phdr_size = ehdr.e_phnum * sizeof *phdr; phdr = malloc(phdr_size); 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"); goto out; } @@ -369,7 +369,7 @@
if (!load_segments(phdr, ehdr.e_phnum, checksum_offset, offset)) goto out; - + if (checksum_offset) { if (!verify_image(&ehdr, phdr, ehdr.e_phnum, checksum)) goto out; @@ -384,7 +384,7 @@
#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); image_retval = entry(romvec, 0, 0, 0, 0);
Modified: openbios-devel/arch/sparc32/entry.S =================================================================== --- openbios-devel/arch/sparc32/entry.S 2008-07-05 18:02:18 UTC (rev 188) +++ openbios-devel/arch/sparc32/entry.S 2008-07-07 18:35:51 UTC (rev 189) @@ -120,7 +120,7 @@ lduba [%g1] ASI_M_CTL, %g2 cmp %g2, 'U' bne ss2 - + ! Ok, this is SS-10 or SS-600MP set PHYS_SS10_EEPROM + SPARC_MACHINE_ID, %g1 lduba [%g1] ASI_M_CTL, %g2 @@ -359,7 +359,7 @@
set qemu_mem_size, %g1 st %g6, [%g1] - + sll %g7, 4, %g7 ! Store va->pa conversion factor set _start - 0x1000, %g1 sub %g1, %g7, %g7 @@ -369,7 +369,7 @@ set qemu_machine_type, %g1 mov %y, %g2 st %g2, [%g1] - + /* Finally, turn on traps so that we can call c-code. */ rd %psr, %g3 wr %g3, 0x0, %psr
Modified: openbios-devel/arch/sparc32/forthload.c =================================================================== --- openbios-devel/arch/sparc32/forthload.c 2008-07-05 18:02:18 UTC (rev 188) +++ openbios-devel/arch/sparc32/forthload.c 2008-07-07 18:35:51 UTC (rev 189) @@ -38,10 +38,10 @@ }
forthsize = file_size(); - + forthtext = malloc(forthsize+1); file_seek(0); - + printk("Loading forth source ..."); if ((unsigned long)lfile_read(forthtext, forthsize) != forthsize) { printk("Can't read forth text\n");
Modified: openbios-devel/arch/sparc32/init.fs =================================================================== --- openbios-devel/arch/sparc32/init.fs 2008-07-05 18:02:18 UTC (rev 188) +++ openbios-devel/arch/sparc32/init.fs 2008-07-07 18:35:51 UTC (rev 189) @@ -1,4 +1,4 @@ -:noname +:noname ." Type 'help' for detailed information" cr \ ." boot secondary slave cdrom: " cr \ ." 0 > boot hd:2,\boot\vmlinuz root=/dev/hda2" cr @@ -16,7 +16,7 @@
: preopen ( chosen-str node-path ) 2dup make-openable - + " /chosen" find-device open-dev ?dup if encode-int 2swap property @@ -24,7 +24,7 @@ 2drop then ; - + :noname set-defaults ; PREPOST-initializer @@ -45,11 +45,11 @@ " /builtin/console" " output-device" $setenv then ; SYSTEM-initializer - + :noname " keyboard" input ; CONSOLE-IN-initializer - + device-end
: rmap@ ( virt -- rmentry )
Modified: openbios-devel/arch/sparc32/ldscript =================================================================== --- openbios-devel/arch/sparc32/ldscript 2008-07-05 18:02:18 UTC (rev 188) +++ openbios-devel/arch/sparc32/ldscript 2008-07-07 18:35:51 UTC (rev 189) @@ -20,7 +20,7 @@ { . = BASE_ADDR;
- /* Start of the program. + /* Start of the program. * Now the version string is in the note, we must include it * in the program. Otherwise we lose the string after relocation. */ _start = .;
Modified: openbios-devel/arch/sparc32/lib.c =================================================================== --- openbios-devel/arch/sparc32/lib.c 2008-07-05 18:02:18 UTC (rev 188) +++ openbios-devel/arch/sparc32/lib.c 2008-07-07 18:35:51 UTC (rev 189) @@ -15,7 +15,7 @@ #include "openbios/kernel.h"
/* Format a string and print it on the screen, just like the libc - * function printf. + * function printf. */ int printk( const char *fmt, ... ) { @@ -92,12 +92,13 @@ if (size > ALLOC_BLOCK) alloc_size = size; // Recover possible leftover - if (ofmem.left > sizeof(alloc_desc_t) + 4) { - alloc_desc_t *d; + if ((size_t)ofmem.left > sizeof(alloc_desc_t) + 4) { + alloc_desc_t *d_leftover;
- d = (alloc_desc_t*)ofmem.next_malloc; - d->size = ofmem.left - sizeof(alloc_desc_t); - free((unsigned long)d + sizeof(alloc_desc_t)); + d_leftover = (alloc_desc_t*)ofmem.next_malloc; + d_leftover->size = ofmem.left - sizeof(alloc_desc_t); + free((void *)((unsigned long)d_leftover + + sizeof(alloc_desc_t))); }
ofmem.next_malloc = mem_alloc(&cmem, alloc_size, 4);
Modified: openbios-devel/arch/sparc32/linux_load.c =================================================================== --- openbios-devel/arch/sparc32/linux_load.c 2008-07-05 18:02:18 UTC (rev 188) +++ openbios-devel/arch/sparc32/linux_load.c 2008-07-07 18:35:51 UTC (rev 189) @@ -14,6 +14,7 @@ #include "sys_info.h" #include "context.h" #include "loadfs.h" +#include "boot.h"
#define printf printk #define debug printk @@ -424,7 +425,7 @@ #endif
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"); return 0; } @@ -462,7 +463,7 @@ max = hdr->initrd_addr_max; else max = 0x38000000; /* Hardcoded value for older kernels */ - + /* FILO itself is at the top of RAM. (relocated) * So, try putting initrd just below us. */ end = virt_to_phys(_start); @@ -497,7 +498,7 @@ }
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"); return -1; } @@ -518,9 +519,9 @@ outb(0, 0xf0); outb(0, 0xf1);
- /* 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 - * crt0.S on an as-needed basis. + /* 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 + * crt0.S on an as-needed basis. * * well, that went ok, I hope. Now we have to reprogram the interrupts :-( * we put them right after the intel-reserved hardware interrupts, at @@ -568,7 +569,7 @@ params->orig_x = cursor_x; params->orig_y = cursor_y; #endif - + /* Go... */ ctx = switch_to(ctx);
Modified: openbios-devel/arch/sparc32/loadfs.c =================================================================== --- openbios-devel/arch/sparc32/loadfs.c 2008-07-05 18:02:18 UTC (rev 188) +++ openbios-devel/arch/sparc32/loadfs.c 2008-07-07 18:35:51 UTC (rev 189) @@ -15,7 +15,7 @@
void file_close(void) { - if(load_fd==-1) + if(load_fd==-1) return; close_io(load_fd);
Modified: openbios-devel/arch/sparc32/loadfs.h =================================================================== --- openbios-devel/arch/sparc32/loadfs.h 2008-07-05 18:02:18 UTC (rev 188) +++ openbios-devel/arch/sparc32/loadfs.h 2008-07-07 18:35:51 UTC (rev 189) @@ -2,6 +2,4 @@ int lfile_read(void *buf, unsigned long len); int file_seek(unsigned long offset); unsigned long file_size(void); - - - +void file_close(void);
Modified: openbios-devel/arch/sparc32/multiboot.c =================================================================== --- openbios-devel/arch/sparc32/multiboot.c 2008-07-05 18:02:18 UTC (rev 188) +++ openbios-devel/arch/sparc32/multiboot.c 2008-07-07 18:35:51 UTC (rev 189) @@ -1,6 +1,6 @@ /* Support for Multiboot */
-#include "openbios/config.h" +#include "openbios/config.h" #include "asm/io.h" #include "sys_info.h" #include "multiboot.h" @@ -9,7 +9,7 @@ #ifdef CONFIG_DEBUG_BOOT #define debug printk #else -#define debug(x...) +#define debug(x...) #endif
struct mbheader { @@ -62,11 +62,11 @@ printf("Multiboot: no dictionary\n"); return; } - + mod = (module_t *) mbinfo->mods_addr; info->dict_start=(unsigned long *)mod->mod_start; info->dict_end=(unsigned long *)mod->mod_end; - + if (mbinfo->flags & MULTIBOOT_MMAP_VALID) { /* convert mmap records */ mbmem = phys_to_virt(mbinfo->mmap_addr);
Modified: openbios-devel/arch/sparc32/multiboot.h =================================================================== --- openbios-devel/arch/sparc32/multiboot.h 2008-07-05 18:02:18 UTC (rev 188) +++ openbios-devel/arch/sparc32/multiboot.h 2008-07-07 18:35:51 UTC (rev 189) @@ -1,5 +1,5 @@ -/* multiboot.h - * tag: header for multiboot +/* multiboot.h + * tag: header for multiboot * * Copyright (C) 2003-2004 Stefan Reinauer *
Modified: openbios-devel/arch/sparc32/openbios.c =================================================================== --- openbios-devel/arch/sparc32/openbios.c 2008-07-05 18:02:18 UTC (rev 188) +++ openbios-devel/arch/sparc32/openbios.c 2008-07-07 18:35:51 UTC (rev 189) @@ -13,14 +13,11 @@ #include "dict.h" #include "openbios/kernel.h" #include "openbios/stack.h" +#include "openbios/nvram.h" #include "sys_info.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;
struct hwdef { @@ -97,7 +94,7 @@ {
/* 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 * 0x10000 and 0x9ffff (576k). If we need more memory * than that we have serious bloat. @@ -133,8 +130,6 @@
int openbios(void) { - extern struct sys_info sys_info; - extern struct mem cmem; unsigned int i;
for (i = 0; i < sizeof(hwdefs) / sizeof(struct hwdef); i++) { @@ -164,10 +159,10 @@ #endif
collect_sys_info(&sys_info); - + dict=intdict; 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); #ifdef CONFIG_DEBUG_BOOT @@ -183,7 +178,7 @@
PUSH_xt( bind_noname_func(arch_init) ); fword("PREPOST-initializer"); - + PC = (ucell)findword("initialize-of");
if (!PC) {
Modified: openbios-devel/arch/sparc32/openbios.h =================================================================== --- openbios-devel/arch/sparc32/openbios.h 2008-07-05 18:02:18 UTC (rev 188) +++ openbios-devel/arch/sparc32/openbios.h 2008-07-07 18:35:51 UTC (rev 189) @@ -1,17 +1,17 @@ -/* +/* * Creation Date: <2004/01/15 16:14:05 samuel> * Time-stamp: <2004/01/15 16:14:05 samuel> - * + * * <openbios.h> - * - * - * + * + * + * * Copyright (C) 2004 Samuel Rydh (samuel@ibrium.se) - * + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * version 2 - * + * */
#ifndef _H_OPENBIOS
Modified: openbios-devel/arch/sparc32/openprom.h =================================================================== --- openbios-devel/arch/sparc32/openprom.h 2008-07-05 18:02:18 UTC (rev 188) +++ openbios-devel/arch/sparc32/openprom.h 2008-07-07 18:35:51 UTC (rev 189) @@ -205,7 +205,7 @@
/* 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, ...
Modified: openbios-devel/arch/sparc32/romvec.c =================================================================== --- openbios-devel/arch/sparc32/romvec.c 2008-07-05 18:02:18 UTC (rev 188) +++ openbios-devel/arch/sparc32/romvec.c 2008-07-07 18:35:51 UTC (rev 189) @@ -14,8 +14,11 @@ #include "libc/vsprintf.h" #include "openbios/config.h" #include "openbios/bindings.h" +#include "openbios/drivers.h" #include "openbios/kernel.h" #include "openbios/sysinclude.h" +#include "sys_info.h" +#include "boot.h"
#ifdef CONFIG_DEBUG_OBP #define DPRINTF(fmt, args...) \ @@ -178,7 +181,7 @@ int i; DPRINTF("obp_getprop(0x%x, %s) = ", node, name); for (i = 0; i < len; i++) { - DPRINTF("%02x%s", str[i] & 0xFF, + DPRINTF("%02x%s", str[i] & 0xFF, (len == 4 || i == len-1) ? "" : " "); } DPRINTF("\n"); @@ -210,7 +213,7 @@ } else { int len; char *str; - + len = POP(); str = (char *) POP();
@@ -437,7 +440,7 @@ // ROM.
if (va == NULL) { - va = next_free_address - size; + va = (char *)(next_free_address - size); next_free_address -= size; DPRINTF("obp_dumb_memalloc req null -> 0x%x\n", va); } @@ -447,9 +450,6 @@ 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, __attribute__((unused))int ctxtbl_ptr, __attribute__((unused))int thiscontext, @@ -497,7 +497,7 @@ // don't get a stack underrun. // // FIXME: find out why solaris doesnt put its stuff on the stack - // + // fword("0"); fword("0");
Modified: openbios-devel/arch/sparc32/switch.S =================================================================== --- openbios-devel/arch/sparc32/switch.S 2008-07-05 18:02:18 UTC (rev 188) +++ openbios-devel/arch/sparc32/switch.S 2008-07-07 18:35:51 UTC (rev 189) @@ -14,7 +14,7 @@ * switches the stack, and restores everything from the new stack. * This function takes no argument. New stack pointer is * 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. */
@@ -104,7 +104,7 @@ ld [%g1 + 116], %i5 ld [%g1 + 120], %i6 ld [%g1 + 124], %i7 - + ld [%g1 + 128], %g1 /* Finally, load new %pc */ jmp %g1
Modified: openbios-devel/arch/sparc32/sys_info.c =================================================================== --- openbios-devel/arch/sparc32/sys_info.c 2008-07-05 18:02:18 UTC (rev 188) +++ openbios-devel/arch/sparc32/sys_info.c 2008-07-07 18:35:51 UTC (rev 189) @@ -8,7 +8,7 @@ #ifdef CONFIG_DEBUG_BOOT #define debug printk #else -#define debug(x...) +#define debug(x...) #endif
unsigned int qemu_mem_size;
Modified: openbios-devel/arch/sparc32/tree.fs =================================================================== --- openbios-devel/arch/sparc32/tree.fs 2008-07-05 18:02:18 UTC (rev 188) +++ openbios-devel/arch/sparc32/tree.fs 2008-07-07 18:35:51 UTC (rev 189) @@ -5,7 +5,7 @@
" sun4m" encode-string " compatible" property h# 0a21fe80 encode-int " clock-frequency" property - + : encode-unit encode-unit-sbus ; : decode-unit decode-unit-sbus ;
Modified: openbios-devel/arch/sparc32/vectors.S =================================================================== --- openbios-devel/arch/sparc32/vectors.S 2008-07-05 18:02:18 UTC (rev 188) +++ openbios-devel/arch/sparc32/vectors.S 2008-07-07 18:35:51 UTC (rev 189) @@ -4,7 +4,7 @@ * Sparc V9 Trap Table(s) with SpitFire/Cheetah extensions. * * Copyright (C) 1996, 2001 David S. Miller (davem@caip.rutgers.edu) - * + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * version 2 as published by the Free Software Foundation. @@ -13,7 +13,7 @@ * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
Modified: openbios-devel/arch/sparc32/wof.S =================================================================== --- openbios-devel/arch/sparc32/wof.S 2008-07-05 18:02:18 UTC (rev 188) +++ openbios-devel/arch/sparc32/wof.S 2008-07-07 18:35:51 UTC (rev 189) @@ -3,7 +3,7 @@ * because we have no user windows. * * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu) - * + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * version 2 as published by the Free Software Foundation. @@ -12,7 +12,7 @@ * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, @@ -96,7 +96,7 @@ * nop */
- .globl spill_window_entry + .globl spill_window_entry .globl spnwin_patch1, spnwin_patch2 spill_window_entry: /* LOCATION: Trap Window */
Modified: openbios-devel/arch/sparc32/wuf.S =================================================================== --- openbios-devel/arch/sparc32/wuf.S 2008-07-05 18:02:18 UTC (rev 188) +++ openbios-devel/arch/sparc32/wuf.S 2008-07-07 18:35:51 UTC (rev 189) @@ -11,7 +11,7 @@ * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
Modified: openbios-devel/drivers/esp.c =================================================================== --- openbios-devel/drivers/esp.c 2008-07-05 18:02:18 UTC (rev 188) +++ openbios-devel/drivers/esp.c 2008-07-07 18:35:51 UTC (rev 189) @@ -1,6 +1,6 @@ /* * OpenBIOS ESP driver - * + * * Copyright (C) 2004 Jens Axboe axboe@suse.de * Copyright (C) 2005 Stefan Reinauer stepan@openbios.org * @@ -122,7 +122,7 @@ if ((status & ESP_STAT_TCNT) != ESP_STAT_TCNT || (status & ESP_STAT_PMASK) == ESP_STATP) return status; - + // Get reply // Set DMA address esp->espdma.regs->st_addr = esp->buffer_dvma; @@ -211,7 +211,7 @@ } sd->present = 1; sd->media = esp->buffer[0]; - + switch (sd->media) { case TYPE_DISK: media = "disk"; @@ -271,7 +271,7 @@ phandle_t ph;
fword("my-unit"); - id = POP(); + id = POP(); //POP(); // unit id is 2 ints but we only need one. *sd = &global_esp->sd[id];
@@ -463,7 +463,7 @@
// Chip reset esp->ll->regs[ESP_CMD] = ESP_CMD_RC; - + 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); DPRINTF("done\n");
Modified: openbios-devel/drivers/iommu.c =================================================================== --- openbios-devel/drivers/iommu.c 2008-07-05 18:02:18 UTC (rev 188) +++ openbios-devel/drivers/iommu.c 2008-07-07 18:35:51 UTC (rev 189) @@ -92,7 +92,7 @@ pa = va2pa((unsigned long)t->curp) + (align - 1); pa &= ~(align - 1); p = (char *)pa2va(pa); - + if ((unsigned long)p >= (unsigned long)t->uplim || (unsigned long)p + size > (unsigned long)t->uplim) return 0;
Modified: openbios-devel/drivers/obio.c =================================================================== --- openbios-devel/drivers/obio.c 2008-07-05 18:02:18 UTC (rev 188) +++ openbios-devel/drivers/obio.c 2008-07-07 18:35:51 UTC (rev 189) @@ -1,9 +1,9 @@ /* * OpenBIOS Sparc OBIO driver - * + * * (C) 2004 Stefan Reinauer stepan@openbios.org * (C) 2005 Ed Schouten ed@fxq.nl - * + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * version 2 @@ -19,6 +19,7 @@ #include "openbios/drivers.h" #include "openbios/nvram.h" #include "obio.h" +#define cpu_to_be16(x) __cpu_to_be16(x) #include "openbios/firmware_abi.h"
#define REGISTER_NAMED_NODE( name, path ) do { \ @@ -50,7 +51,7 @@ * mapped memory. */ #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_UNNAMED_NODE( ob_obio, INSTALL_OPEN, sizeof(int) ); @@ -171,12 +172,9 @@ } }
-int keyboard_dataready(void); -unsigned char keyboard_readdata(void); - /* ( addr len -- actual ) */ static void -zs_read_keyboard(unsigned long *address) +zs_read_keyboard(void) { unsigned char *addr; int len; @@ -314,7 +312,7 @@ push_str("width"); 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]; switch (version) { @@ -723,7 +721,7 @@ { extern uint32_t kernel_image; extern uint32_t kernel_size; - extern uint32_t cmdline; + extern uint32_t qemu_cmdline; extern uint32_t cmdline_size; extern char boot_device; extern char obp_stdin, obp_stdout; @@ -735,7 +733,7 @@ char nographic; uint32_t size; unsigned int machine_id; - struct cpudef *cpu; + const struct cpudef *cpu; ohwcfg_v3_t *header;
ob_new_obio_device("eeprom", NULL); @@ -746,7 +744,7 @@ fword("encode-int"); push_str("address"); fword("property"); - + memcpy(&nv_info, nvram, sizeof(nv_info)); machine_id = (unsigned int)nvram[0x1fd9] & 0xff; printk("Nvram id %s, version %d, machine id 0x%2.2x\n", @@ -763,9 +761,9 @@ size = nv_info.cmdline_size; if (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'; - cmdline = obio_cmdline; + qemu_cmdline = (uint32_t) &obio_cmdline; cmdline_size = size; header = (ohwcfg_v3_t *)nvram; header->kernel_image = 0; @@ -785,7 +783,7 @@ // Add /idprom push_str("/"); fword("find-device"); - + PUSH((long)&nvram[NVRAM_IDPROM]); PUSH(32); fword("encode-bytes"); @@ -940,7 +938,7 @@ fword("encode-int"); push_str("ecache-associativity"); fword("property"); - + PUSH(2); fword("encode-int"); push_str("ncaches"); @@ -973,7 +971,7 @@ fword("encode-int"); push_str("mid"); fword("property"); - + cpu->initfn();
fword("finish-device"); @@ -1055,7 +1053,7 @@ { 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 reset_reg = map_io(base + (uint64_t)SLAVIO_RESET, RESET_REGS); @@ -1187,7 +1185,7 @@ if (!cpu) 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_ctxtbl = context_ptr; sparc_header->smp_ctx = context;
Modified: openbios-devel/drivers/pgtsrmmu.h =================================================================== --- openbios-devel/drivers/pgtsrmmu.h 2008-07-05 18:02:18 UTC (rev 188) +++ openbios-devel/drivers/pgtsrmmu.h 2008-07-07 18:35:51 UTC (rev 189) @@ -218,7 +218,7 @@ srmmu_get_pte (unsigned long addr) { register unsigned long entry; - + __asm__ __volatile__("\n\tlda [%1] %2,%0\n\t" : "=r" (entry): "r" ((addr & 0xfffff000) | 0x400), "i" (ASI_M_FLUSH_PROBE));
Modified: openbios-devel/drivers/sbus.c =================================================================== --- openbios-devel/drivers/sbus.c 2008-07-05 18:02:18 UTC (rev 188) +++ openbios-devel/drivers/sbus.c 2008-07-07 18:35:51 UTC (rev 189) @@ -1,9 +1,9 @@ /* * OpenBIOS SBus driver - * + * * (C) 2004 Stefan Reinauer stepan@openbios.org * (C) 2005 Ed Schouten ed@fxq.nl - * + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * version 2 @@ -57,8 +57,7 @@ }
static void -ob_le_init(unsigned int slot, unsigned long base, unsigned long leoffset, - unsigned long dmaoffset) +ob_le_init(unsigned int slot, unsigned long leoffset, unsigned long dmaoffset) { push_str("/iommu/sbus/ledma"); fword("find-device"); @@ -90,7 +89,7 @@ uint16_t graphic_depth;
static void -ob_tcx_init(unsigned int slot, unsigned long base) +ob_tcx_init(unsigned int slot) { push_str("/iommu/sbus/SUNW,tcx"); fword("find-device"); @@ -305,7 +304,7 @@ }
static void -ob_cs4231_init(unsigned int slot, unsigned long base) +ob_cs4231_init(unsigned int slot) { push_str("/iommu/sbus"); fword("find-device"); @@ -362,7 +361,7 @@ #endif
// 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 //ob_bpp_init(base); @@ -374,11 +373,11 @@ // OpenBIOS and Qemu don't know how to do Sbus probing switch(slot) { case 3: // SUNW,tcx - ob_tcx_init(slot, base); + ob_tcx_init(slot); break; case 4: // SUNW,CS4231 - ob_cs4231_init(slot, base); + ob_cs4231_init(slot); // Power management (APC) ob_apc_init(slot, APC_OFFSET); break; @@ -396,7 +395,7 @@ // OpenBIOS and Qemu don't know how to do Sbus probing switch(slot) { case 2: // SUNW,tcx - ob_tcx_init(slot, base); + ob_tcx_init(slot); break; case 0xf: // le, esp, bpp, power-management ob_macio_init(slot, base, 0); @@ -414,14 +413,14 @@ // OpenBIOS and Qemu don't know how to do Sbus probing switch(slot) { case 2: // SUNW,tcx - ob_tcx_init(slot, base); + ob_tcx_init(slot); break; case 0xf: // le, esp, bpp, power-management #ifdef CONFIG_DRIVER_ESP ob_esp_init(slot, base, SS600MP_ESP, SS600MP_ESPDMA); #endif // 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 ob_apc_init(slot, APC_OFFSET); break; @@ -431,20 +430,20 @@ }
static void -ob_sbus_open(int *idx) +ob_sbus_open(void) { int ret=1; RET ( -ret ); }
static void -ob_sbus_close(int *idx) +ob_sbus_close(void) { selfword("close-deblocker"); }
static void -ob_sbus_initialize(int *idx) +ob_sbus_initialize(void) { }
@@ -505,7 +504,7 @@ }
static int -ob_sbus_init_ss5(uint64_t base) +ob_sbus_init_ss5(void) { unsigned int slot; int notfirst = 0; @@ -526,7 +525,7 @@ }
static int -ob_sbus_init_ss10(uint64_t base) +ob_sbus_init_ss10(void) { unsigned int slot; int notfirst = 0; @@ -547,7 +546,7 @@ }
static int -ob_sbus_init_ss600mp(uint64_t base) +ob_sbus_init_ss600mp(void) { unsigned int slot; int notfirst = 0; @@ -573,11 +572,11 @@
switch (machine_id) { case 0x71: - return ob_sbus_init_ss600mp(base); + return ob_sbus_init_ss600mp(); case 0x72: - return ob_sbus_init_ss10(base); + return ob_sbus_init_ss10(); case 0x80: - return ob_sbus_init_ss5(base); + return ob_sbus_init_ss5(); default: return -1; }
Modified: openbios-devel/include/openbios/drivers.h =================================================================== --- openbios-devel/include/openbios/drivers.h 2008-07-05 18:02:18 UTC (rev 188) +++ openbios-devel/include/openbios/drivers.h 2008-07-07 18:35:51 UTC (rev 189) @@ -16,7 +16,14 @@ #endif #ifdef CONFIG_DRIVER_SBUS 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 #ifdef CONFIG_DRIVER_IDE int ob_ide_init(void); #endif @@ -28,5 +35,10 @@ int ob_obio_init(uint64_t slavio_base, unsigned long fd_offset, unsigned long counter_offset, unsigned long intr_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