diff --git a/arch/sparc32/aoutload.c b/arch/sparc32/aoutload.c index fac570f..1004e9b 100644 --- a/arch/sparc32/aoutload.c +++ b/arch/sparc32/aoutload.c @@ -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 @@ int aout_load(struct sys_info *info, const char *filename, const char *cmdline, 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 @@ int aout_load(struct sys_info *info, const char *filename, const char *cmdline, 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 @@ int aout_load(struct sys_info *info, const char *filename, const char *cmdline, #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); diff --git a/arch/sparc32/boot.c b/arch/sparc32/boot.c index dfd15c1..05e23cb 100644 --- a/arch/sparc32/boot.c +++ b/arch/sparc32/boot.c @@ -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 @@ void boot(void) 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 @@ void boot(void) case 'n': path = strdup("net"); oldpath = "le()"; - unit = 0; break; } } @@ -78,14 +67,14 @@ void boot(void) 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 @@ void boot(void) 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 @@ void boot(void) } printk("[sparc] Booting file '%s' ", path); - if(param) + if (param) printk("with parameters '%s'\n", param); else printk("without parameters.\n"); diff --git a/arch/sparc32/boot.h b/arch/sparc32/boot.h index e870a58..97cae40 100644 --- a/arch/sparc32/boot.h +++ b/arch/sparc32/boot.h @@ -15,3 +15,16 @@ int linux_load(struct sys_info *, const char *filename, const char *cmdline, 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; diff --git a/arch/sparc32/build.xml b/arch/sparc32/build.xml index e9bbdf7..45fcb98 100644 --- a/arch/sparc32/build.xml +++ b/arch/sparc32/build.xml @@ -21,7 +21,7 @@ - + - + $@ @@ -63,14 +63,14 @@ ]]> - + - + @@ -91,5 +91,5 @@ - + diff --git a/arch/sparc32/console.c b/arch/sparc32/console.c index d411ac4..08b90d7 100644 --- a/arch/sparc32/console.c +++ b/arch/sparc32/console.c @@ -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 @@ typedef struct osi_fb_info { 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; } diff --git a/arch/sparc32/context.c b/arch/sparc32/context.c index 8be54f7..657bcb0 100644 --- a/arch/sparc32/context.c +++ b/arch/sparc32/context.c @@ -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 @@ static void start_main(void); /* forward decl. */ 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 @@ struct context *switch_to(struct context *ctx) } /* 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; diff --git a/arch/sparc32/elfload.c b/arch/sparc32/elfload.c index 7b4134b..e49c888 100644 --- a/arch/sparc32/elfload.c +++ b/arch/sparc32/elfload.c @@ -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 @@ static unsigned long process_image_notes(Elf_phdr *phdr, int phnum, 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 @@ static int load_segments(Elf_phdr *phdr, int phnum, 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 @@ int elf_load(struct sys_info *info, const char *filename, const char *cmdline, 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 @@ int elf_load(struct sys_info *info, const char *filename, const char *cmdline, 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 @@ int elf_load(struct sys_info *info, const char *filename, const char *cmdline, #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); diff --git a/arch/sparc32/entry.S b/arch/sparc32/entry.S index a8292da..6982ca6 100644 --- a/arch/sparc32/entry.S +++ b/arch/sparc32/entry.S @@ -120,7 +120,7 @@ ss10: 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 @@ highmem: 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 @@ highmem: 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 diff --git a/arch/sparc32/forthload.c b/arch/sparc32/forthload.c index 6d4804c..e5e7870 100644 --- a/arch/sparc32/forthload.c +++ b/arch/sparc32/forthload.c @@ -38,10 +38,10 @@ int forth_load(struct sys_info *info, const char *filename, const char *cmdline) } 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"); diff --git a/arch/sparc32/init.fs b/arch/sparc32/init.fs index f2e2cb0..90ebd04 100644 --- a/arch/sparc32/init.fs +++ b/arch/sparc32/init.fs @@ -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 ) diff --git a/arch/sparc32/ldscript b/arch/sparc32/ldscript index 2711637..498e073 100644 --- a/arch/sparc32/ldscript +++ b/arch/sparc32/ldscript @@ -20,7 +20,7 @@ SECTIONS { . = 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 = .; diff --git a/arch/sparc32/lib.c b/arch/sparc32/lib.c index 47fb82a..88faa98 100644 --- a/arch/sparc32/lib.c +++ b/arch/sparc32/lib.c @@ -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 @@ void *malloc(int size) 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); diff --git a/arch/sparc32/linux_load.c b/arch/sparc32/linux_load.c index 38824c7..badf252 100644 --- a/arch/sparc32/linux_load.c +++ b/arch/sparc32/linux_load.c @@ -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 @@ static int load_linux_kernel(struct linux_header *hdr, uint32_t kern_addr) #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 @@ static int load_initrd(struct linux_header *hdr, struct sys_info *info, 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 @@ static int load_initrd(struct linux_header *hdr, struct sys_info *info, } 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 @@ static void hardware_setup(void) 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 @@ static int start_linux(uint32_t kern_addr, struct linux_params *params) params->orig_x = cursor_x; params->orig_y = cursor_y; #endif - + /* Go... */ ctx = switch_to(ctx); diff --git a/arch/sparc32/loadfs.c b/arch/sparc32/loadfs.c index d9bfbb4..a03454e 100644 --- a/arch/sparc32/loadfs.c +++ b/arch/sparc32/loadfs.c @@ -15,7 +15,7 @@ int file_open(const char *filename) void file_close(void) { - if(load_fd==-1) + if(load_fd==-1) return; close_io(load_fd); diff --git a/arch/sparc32/loadfs.h b/arch/sparc32/loadfs.h index 71b39c1..58fa722 100644 --- a/arch/sparc32/loadfs.h +++ b/arch/sparc32/loadfs.h @@ -2,6 +2,4 @@ int file_open(const char *filename); int lfile_read(void *buf, unsigned long len); int file_seek(unsigned long offset); unsigned long file_size(void); - - - +void file_close(void); diff --git a/arch/sparc32/multiboot.c b/arch/sparc32/multiboot.c index d5877d4..30e3509 100644 --- a/arch/sparc32/multiboot.c +++ b/arch/sparc32/multiboot.c @@ -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 @@ void collect_multiboot_info(struct sys_info *info) 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); diff --git a/arch/sparc32/multiboot.h b/arch/sparc32/multiboot.h index 14e1e03..17cf202 100644 --- a/arch/sparc32/multiboot.h +++ b/arch/sparc32/multiboot.h @@ -1,5 +1,5 @@ -/* multiboot.h - * tag: header for multiboot +/* multiboot.h + * tag: header for multiboot * * Copyright (C) 2003-2004 Stefan Reinauer * diff --git a/arch/sparc32/openbios.c b/arch/sparc32/openbios.c index 8622ac3..c2d32a8 100644 --- a/arch/sparc32/openbios.c +++ b/arch/sparc32/openbios.c @@ -13,13 +13,10 @@ #include "dict.h" #include "openbios/kernel.h" #include "openbios/stack.h" +#include "openbios/nvram.h" #include "sys_info.h" #include "openbios.h" - -void boot(void); -void ob_ide_init(void); -void tcx_init(uint64_t base); -void kbd_init(uint64_t base); +#include "boot.h" int qemu_machine_type; @@ -97,7 +94,7 @@ static void init_memory(void) { /* 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 @@ arch_init( void ) 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 @@ int openbios(void) #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 @@ int openbios(void) PUSH_xt( bind_noname_func(arch_init) ); fword("PREPOST-initializer"); - + PC = (ucell)findword("initialize-of"); if (!PC) { diff --git a/arch/sparc32/openbios.h b/arch/sparc32/openbios.h index f08eaeb..54213ac 100644 --- a/arch/sparc32/openbios.h +++ b/arch/sparc32/openbios.h @@ -1,17 +1,17 @@ -/* +/* * Creation Date: <2004/01/15 16:14:05 samuel> * Time-stamp: <2004/01/15 16:14:05 samuel> - * + * * - * - * - * + * + * + * * 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 diff --git a/arch/sparc32/openprom.h b/arch/sparc32/openprom.h index dec80d5..12fbe99 100644 --- a/arch/sparc32/openprom.h +++ b/arch/sparc32/openprom.h @@ -205,7 +205,7 @@ struct linux_prom_ranges { /* 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, ... diff --git a/arch/sparc32/romvec.c b/arch/sparc32/romvec.c index 9e4a92e..7769ebd 100644 --- a/arch/sparc32/romvec.c +++ b/arch/sparc32/romvec.c @@ -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 @@ static int obp_getprop(int node, char *name, char *value) 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 @@ static const char *obp_nextprop(int node, char *name) } else { int len; char *str; - + len = POP(); str = (char *) POP(); @@ -437,7 +440,7 @@ static char * obp_dumb_memalloc(char *va, unsigned int size) // 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 @@ static char * obp_dumb_memalloc(char *va, unsigned int size) 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 @@ static void obp_fortheval_v2(char *str) // don't get a stack underrun. // // FIXME: find out why solaris doesnt put its stuff on the stack - // + // fword("0"); fword("0"); diff --git a/arch/sparc32/switch.S b/arch/sparc32/switch.S index b405d30..83739a5 100644 --- a/arch/sparc32/switch.S +++ b/arch/sparc32/switch.S @@ -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 @@ __switch_context_nosave: ld [%g1 + 116], %i5 ld [%g1 + 120], %i6 ld [%g1 + 124], %i7 - + ld [%g1 + 128], %g1 /* Finally, load new %pc */ jmp %g1 diff --git a/arch/sparc32/sys_info.c b/arch/sparc32/sys_info.c index 15c0ce4..4188fd7 100644 --- a/arch/sparc32/sys_info.c +++ b/arch/sparc32/sys_info.c @@ -8,7 +8,7 @@ #ifdef CONFIG_DEBUG_BOOT #define debug printk #else -#define debug(x...) +#define debug(x...) #endif unsigned int qemu_mem_size; diff --git a/arch/sparc32/tree.fs b/arch/sparc32/tree.fs index 4b14dcb..9671f8f 100644 --- a/arch/sparc32/tree.fs +++ b/arch/sparc32/tree.fs @@ -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 ; diff --git a/arch/sparc32/vectors.S b/arch/sparc32/vectors.S index 5184f91..595a649 100644 --- a/arch/sparc32/vectors.S +++ b/arch/sparc32/vectors.S @@ -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, diff --git a/arch/sparc32/wof.S b/arch/sparc32/wof.S index 0d6fd75..506deee 100644 --- a/arch/sparc32/wof.S +++ b/arch/sparc32/wof.S @@ -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 @@ spnwin_patch3_7win: and %twin_tmp, 0x7f, %twin_tmp * nop */ - .globl spill_window_entry + .globl spill_window_entry .globl spnwin_patch1, spnwin_patch2 spill_window_entry: /* LOCATION: Trap Window */ diff --git a/arch/sparc32/wuf.S b/arch/sparc32/wuf.S index 818cc88..5dbd283 100644 --- a/arch/sparc32/wuf.S +++ b/arch/sparc32/wuf.S @@ -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, diff --git a/drivers/esp.c b/drivers/esp.c index 406669f..46f568d 100644 --- a/drivers/esp.c +++ b/drivers/esp.c @@ -1,6 +1,6 @@ /* * OpenBIOS ESP driver - * + * * Copyright (C) 2004 Jens Axboe * Copyright (C) 2005 Stefan Reinauer * @@ -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 || (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 @@ inquiry(esp_private_t *esp, sd_private_t *sd) } sd->present = 1; sd->media = esp->buffer[0]; - + switch (sd->media) { case TYPE_DISK: media = "disk"; @@ -271,7 +271,7 @@ ob_sd_open(__attribute__((unused))sd_private_t **sd) 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 @@ ob_esp_init(unsigned int slot, uint64_t base, unsigned long espoffset, // 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"); diff --git a/drivers/iommu.c b/drivers/iommu.c index 5be307a..33dae53 100644 --- a/drivers/iommu.c +++ b/drivers/iommu.c @@ -92,7 +92,7 @@ mem_alloc(struct mem *t, int size, int align) 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; diff --git a/drivers/obio.c b/drivers/obio.c index b3bd967..e1c5971 100644 --- a/drivers/obio.c +++ b/drivers/obio.c @@ -1,9 +1,9 @@ /* * OpenBIOS Sparc OBIO driver - * + * * (C) 2004 Stefan Reinauer * (C) 2005 Ed Schouten - * + * * 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 @@ zs_read(unsigned long *address) } } -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 @@ ob_eccmemctl_init(void) 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 @@ ob_nvram_init(uint64_t base, uint64_t offset) { 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 @@ ob_nvram_init(uint64_t base, uint64_t offset) 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 @@ ob_nvram_init(uint64_t base, uint64_t offset) 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 @@ ob_nvram_init(uint64_t base, uint64_t offset) 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 @@ ob_nvram_init(uint64_t base, uint64_t offset) // Add /idprom push_str("/"); fword("find-device"); - + PUSH((long)&nvram[NVRAM_IDPROM]); PUSH(32); fword("encode-bytes"); @@ -940,7 +938,7 @@ ob_nvram_init(uint64_t base, uint64_t offset) fword("encode-int"); push_str("ecache-associativity"); fword("property"); - + PUSH(2); fword("encode-int"); push_str("ncaches"); @@ -973,7 +971,7 @@ ob_nvram_init(uint64_t base, uint64_t offset) fword("encode-int"); push_str("mid"); fword("property"); - + cpu->initfn(); 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); - 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 @@ start_cpu(unsigned int pc, unsigned int context_ptr, unsigned int context, int c 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; diff --git a/drivers/pgtsrmmu.h b/drivers/pgtsrmmu.h index 1999537..109fd23 100644 --- a/drivers/pgtsrmmu.h +++ b/drivers/pgtsrmmu.h @@ -218,7 +218,7 @@ static __inline__ int 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)); diff --git a/drivers/sbus.c b/drivers/sbus.c index 522ca9b..6487e2f 100644 --- a/drivers/sbus.c +++ b/drivers/sbus.c @@ -1,9 +1,9 @@ /* * OpenBIOS SBus driver - * + * * (C) 2004 Stefan Reinauer * (C) 2005 Ed Schouten - * + * * 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 @@ ob_sbus_node_init(uint64_t base) } 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 @@ ob_le_init(unsigned int slot, unsigned long base, unsigned long leoffset, 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 @@ ob_apc_init(unsigned int slot, unsigned long base) } 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 @@ ob_macio_init(unsigned int slot, uint64_t base, unsigned long offset) #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 @@ sbus_probe_slot_ss5(unsigned int slot, uint64_t base) // 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 @@ sbus_probe_slot_ss10(unsigned int slot, uint64_t base) // 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 @@ sbus_probe_slot_ss600mp(unsigned int slot, uint64_t base) // 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 @@ sbus_probe_slot_ss600mp(unsigned int slot, uint64_t base) } 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 @@ ob_add_sbus_range(const struct sbus_offset *range, int notfirst) } static int -ob_sbus_init_ss5(uint64_t base) +ob_sbus_init_ss5(void) { unsigned int slot; int notfirst = 0; @@ -526,7 +525,7 @@ ob_sbus_init_ss5(uint64_t base) } static int -ob_sbus_init_ss10(uint64_t base) +ob_sbus_init_ss10(void) { unsigned int slot; int notfirst = 0; @@ -547,7 +546,7 @@ ob_sbus_init_ss10(uint64_t base) } static int -ob_sbus_init_ss600mp(uint64_t base) +ob_sbus_init_ss600mp(void) { unsigned int slot; int notfirst = 0; @@ -573,11 +572,11 @@ int ob_sbus_init(uint64_t base, int machine_id) 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; } diff --git a/include/openbios/drivers.h b/include/openbios/drivers.h index 499cf91..79b07a1 100644 --- a/include/openbios/drivers.h +++ b/include/openbios/drivers.h @@ -16,6 +16,13 @@ int ob_pci_init(void); #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); @@ -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, 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 -