Author: blueswirl Date: 2008-12-20 18:15:47 +0100 (Sat, 20 Dec 2008) New Revision: 294
Modified: openbios-devel/arch/ppc/ofmem.c openbios-devel/arch/ppc/qemu/main.c openbios-devel/arch/ppc/qemu/methods.c openbios-devel/arch/ppc/qemu/qemu.c openbios-devel/arch/ppc/qemu/qemu.h openbios-devel/arch/sparc32/openbios.h openbios-devel/arch/sparc64/console.c openbios-devel/arch/sparc64/openbios.c openbios-devel/arch/sparc64/openbios.h openbios-devel/drivers/cuda.c openbios-devel/drivers/cuda.h openbios-devel/drivers/pci.c openbios-devel/drivers/vga_vbe.c openbios-devel/fs/grubfs/fsys_iso9660.c openbios-devel/fs/grubfs/fsys_xfs.c openbios-devel/fs/grubfs/iso9660.h openbios-devel/include/openbios/drivers.h openbios-devel/include/sparc64/types.h openbios-devel/include/video_subr.h openbios-devel/kernel/cross.h openbios-devel/modules/console.c openbios-devel/modules/font_8x16.c openbios-devel/modules/video.c Log: Fix almost all remaining warnings
Modified: openbios-devel/arch/ppc/ofmem.c =================================================================== --- openbios-devel/arch/ppc/ofmem.c 2008-12-20 15:05:43 UTC (rev 293) +++ openbios-devel/arch/ppc/ofmem.c 2008-12-20 17:15:47 UTC (rev 294) @@ -155,7 +155,7 @@ if( !ptr ) return;
- d = (alloc_desc_t*)(ptr - sizeof(alloc_desc_t)); + d = (alloc_desc_t*)((char *)ptr - sizeof(alloc_desc_t)); d->next = ofmem.mfree;
/* insert in the (sorted) freelist */ @@ -168,7 +168,7 @@ void * realloc( void *ptr, size_t size ) { - alloc_desc_t *d = (alloc_desc_t*)(ptr - sizeof(alloc_desc_t)); + alloc_desc_t *d = (alloc_desc_t*)((char *)ptr - sizeof(alloc_desc_t)); char *p;
if( !ptr )
Modified: openbios-devel/arch/ppc/qemu/main.c =================================================================== --- openbios-devel/arch/ppc/qemu/main.c 2008-12-20 15:05:43 UTC (rev 293) +++ openbios-devel/arch/ppc/qemu/main.c 2008-12-20 17:15:47 UTC (rev 294) @@ -26,10 +26,10 @@ #include "ofmem.h"
static void -transfer_control_to_elf( ulong entry ) +transfer_control_to_elf( ulong elf_entry ) { extern void call_elf( ulong entry ); - printk("Starting ELF image at 0x%08lX\n", entry); + printk("Starting ELF image at 0x%08lX\n", elf_entry); call_elf( 0x400000 ); //call_elf( entry );
@@ -37,7 +37,7 @@ }
static int -load_elf_rom( ulong *entry, int fd ) +load_elf_rom( ulong *elf_entry, int fd ) { int i, lszz_offs, elf_offs; char buf[128], *addr; @@ -55,7 +55,7 @@ if( !(phdr=elf_readhdrs(fd, elf_offs, &ehdr)) ) fatal_error("elf_readhdrs failed\n");
- *entry = ehdr.e_entry; + *elf_entry = ehdr.e_entry;
/* load segments. Compressed ROM-image assumed to be located immediately * after the last segment */ @@ -83,7 +83,8 @@
#if 0 /* patch CODE segment */ - if( *entry >= phdr[i].p_vaddr && *entry < phdr[i].p_vaddr + s ) { + if( *elf_entry >= phdr[i].p_vaddr && + *elf_entry < phdr[i].p_vaddr + s ) { patch_newworld_rom( (char*)phdr[i].p_vaddr, s ); newworld_timer_hack( (char*)phdr[i].p_vaddr, s ); } @@ -115,18 +116,18 @@ { const char *paths[] = { "hd:0,\zImage.chrp", NULL }; const char *args[] = { "root=/dev/hda2 console=ttyS0,115200", NULL }; - ulong entry; + ulong elf_entry; int i, fd;
for( i=0; paths[i]; i++ ) { if( (fd=open_io(paths[i])) == -1 ) continue; - (void) load_elf_rom( &entry, fd ); + (void) load_elf_rom( &elf_entry, fd ); close_io( fd ); encode_bootpath( paths[i], args[i] );
update_nvram(); - transfer_control_to_elf( entry ); + transfer_control_to_elf( elf_entry ); /* won't come here */ } printk("*** Boot failure! No secondary bootloader specified ***\n");
Modified: openbios-devel/arch/ppc/qemu/methods.c =================================================================== --- openbios-devel/arch/ppc/qemu/methods.c 2008-12-20 15:05:43 UTC (rev 293) +++ openbios-devel/arch/ppc/qemu/methods.c 2008-12-20 17:15:47 UTC (rev 294) @@ -20,6 +20,7 @@
#include "openbios/config.h" #include "openbios/bindings.h" +#include "openbios/drivers.h" #include "libc/string.h" #include "qemu/qemu.h" #include "ofmem.h" @@ -155,7 +156,7 @@ static void ciface_milliseconds( ulong args[], ulong ret[] ) { - extern unsigned long get_timer_freq(); + extern unsigned long get_timer_freq(void); static ulong mticks=0, usecs=0; ulong t;
Modified: openbios-devel/arch/ppc/qemu/qemu.c =================================================================== --- openbios-devel/arch/ppc/qemu/qemu.c 2008-12-20 15:05:43 UTC (rev 293) +++ openbios-devel/arch/ppc/qemu/qemu.c 2008-12-20 17:15:47 UTC (rev 294) @@ -97,7 +97,7 @@
static char *nvram;
-void macio_nvram_init(char *path, uint32_t addr) +void macio_nvram_init(const char *path, uint32_t addr) { phandle_t chosen, aliases; phandle_t dnode;
Modified: openbios-devel/arch/ppc/qemu/qemu.h =================================================================== --- openbios-devel/arch/ppc/qemu/qemu.h 2008-12-20 15:05:43 UTC (rev 293) +++ openbios-devel/arch/ppc/qemu/qemu.h 2008-12-20 17:15:47 UTC (rev 294) @@ -19,8 +19,6 @@ extern int vfd_draw_str( const char *str ); extern void vfd_close( void );
-extern int console_draw_str( const char *str ); - /* console.c */ int serial_init(void);
Modified: openbios-devel/arch/sparc32/openbios.h =================================================================== --- openbios-devel/arch/sparc32/openbios.h 2008-12-20 15:05:43 UTC (rev 293) +++ openbios-devel/arch/sparc32/openbios.h 2008-12-20 17:15:47 UTC (rev 294) @@ -21,7 +21,6 @@
/* console.c */ extern unsigned char *vmem; -extern void cls(void); #ifdef CONFIG_DEBUG_CONSOLE extern int uart_init(uint64_t port, unsigned long speed); extern void video_init(void);
Modified: openbios-devel/arch/sparc64/console.c =================================================================== --- openbios-devel/arch/sparc64/console.c 2008-12-20 15:05:43 UTC (rev 293) +++ openbios-devel/arch/sparc64/console.c 2008-12-20 17:15:47 UTC (rev 294) @@ -8,6 +8,7 @@ #include "openbios/config.h" #include "openbios/bindings.h" #include "openbios/kernel.h" +#include "openbios/drivers.h" #include "openbios.h" #include "video_subr.h" #include "libc/vsprintf.h"
Modified: openbios-devel/arch/sparc64/openbios.c =================================================================== --- openbios-devel/arch/sparc64/openbios.c 2008-12-20 15:05:43 UTC (rev 293) +++ openbios-devel/arch/sparc64/openbios.c 2008-12-20 17:15:47 UTC (rev 294) @@ -300,7 +300,7 @@ { unsigned long phys, data;
- unsigned long tte_data, currsize; + unsigned long currsize;
// align size size = (size + PAGE_MASK_8K) & ~PAGE_MASK_8K;
Modified: openbios-devel/arch/sparc64/openbios.h =================================================================== --- openbios-devel/arch/sparc64/openbios.h 2008-12-20 15:05:43 UTC (rev 293) +++ openbios-devel/arch/sparc64/openbios.h 2008-12-20 17:15:47 UTC (rev 294) @@ -20,7 +20,6 @@ int openbios(void);
/* console.c */ -extern void cls(void); #ifdef CONFIG_DEBUG_CONSOLE extern int uart_init(int port, unsigned long speed); extern void video_init(void);
Modified: openbios-devel/drivers/cuda.c =================================================================== --- openbios-devel/drivers/cuda.c 2008-12-20 15:05:43 UTC (rev 293) +++ openbios-devel/drivers/cuda.c 2008-12-20 17:15:47 UTC (rev 294) @@ -239,7 +239,7 @@
}
-cuda_t *cuda_init (char *path, uint32_t base) +cuda_t *cuda_init (const char *path, uint32_t base) { cuda_t *cuda; char buf[64];
Modified: openbios-devel/drivers/cuda.h =================================================================== --- openbios-devel/drivers/cuda.h 2008-12-20 15:05:43 UTC (rev 293) +++ openbios-devel/drivers/cuda.h 2008-12-20 17:15:47 UTC (rev 294) @@ -15,4 +15,4 @@ };
-cuda_t *cuda_init (char *path, uint32_t base); +cuda_t *cuda_init (const char *path, uint32_t base);
Modified: openbios-devel/drivers/pci.c =================================================================== --- openbios-devel/drivers/pci.c 2008-12-20 15:05:43 UTC (rev 293) +++ openbios-devel/drivers/pci.c 2008-12-20 17:15:47 UTC (rev 294) @@ -21,8 +21,10 @@ #include "libc/vsprintf.h"
#include "openbios/drivers.h" +#include "video_subr.h" #include "timer.h" #include "pci.h" +#include "cuda.h"
#define set_bool_property(ph, name) set_property(ph, name, NULL, 0);
@@ -219,7 +221,7 @@ }, };
-static void eth_config_cb (const pci_config_t *config) +static int eth_config_cb (const pci_config_t *config) { phandle_t ph; cell props[12]; @@ -236,7 +238,8 @@ props[i*2] = config->regions[i]; props[i*2 + 1] = config->sizes[i]; } - set_property(ph, "reg", props, i * 2 * sizeof(cell)); + set_property(ph, "reg", (char *)props, i * 2 * sizeof(cell)); + return 0; }
static const pci_subclass_t net_subclass[] = { @@ -1104,7 +1107,7 @@ set_int_property(ph, "#interrupt-cells", 1); props[0]= 0x10; props[1]= 0x20; - set_property(ph, "reg", &props, sizeof(props)); + set_property(ph, "reg", (char *)&props, sizeof(props)); pic_handle = ph;
cuda_init(config->path, config->regions[0]); @@ -1140,7 +1143,7 @@ uint8_t iface, uint16_t vendor, uint16_t product) { - int (*config_cb)(pci_config_t *config); + int (*config_cb)(const pci_config_t *config); const pci_class_t *pclass; const pci_subclass_t *psubclass; const pci_iface_t *piface; @@ -1371,8 +1374,8 @@ #endif
static void -ob_pci_configure(pci_arch_t *addr, pci_config_t *config, uint32_t *mem_base, - uint32_t *io_base) +ob_pci_configure(pci_addr addr, pci_config_t *config, unsigned long *mem_base, + unsigned long *io_base)
{ uint32_t smask, omask, amask, size, reloc, min_align;
Modified: openbios-devel/drivers/vga_vbe.c =================================================================== --- openbios-devel/drivers/vga_vbe.c 2008-12-20 15:05:43 UTC (rev 293) +++ openbios-devel/drivers/vga_vbe.c 2008-12-20 17:15:47 UTC (rev 294) @@ -19,7 +19,9 @@ #include "openbios/kernel.h" #include "openbios/bindings.h" #include "openbios/pci.h" +#include "openbios/drivers.h" #include "asm/io.h" +#include "video_subr.h"
/* VGA init. We use the Bochs VESA VBE extensions */ #define VBE_DISPI_INDEX_ID 0x0 @@ -96,8 +98,8 @@ vga_build_rgb_palette(); }
-void vga_vbe_init(char *path, uint32_t fb, uint32_t fb_size, - uint32_t rom, uint32_t rom_size) +void vga_vbe_init(const char *path, uint32_t fb, uint32_t fb_size, + unsigned long rom, uint32_t rom_size) { phandle_t ph, chosen, aliases;
@@ -117,9 +119,10 @@ aliases = find_dev("/aliases"); set_property(aliases, "screen", path, strlen(path) + 1); if (rom_size >= 8) { - const uint8_t *p; + const char *p; int size; - p = rom; + + p = (const char *)rom; if (p[0] == 'N' && p[1] == 'D' && p[2] == 'R' && p[3] == 'V') { size = *(uint32_t*)(p + 4); set_property(ph, "driver,AAPL,MacOS,PowerPC",
Modified: openbios-devel/fs/grubfs/fsys_iso9660.c =================================================================== --- openbios-devel/fs/grubfs/fsys_iso9660.c 2008-12-20 15:05:43 UTC (rev 293) +++ openbios-devel/fs/grubfs/fsys_iso9660.c 2008-12-20 17:15:47 UTC (rev 294) @@ -141,7 +141,7 @@ for (; idr->length.l > 0; idr = (struct iso_directory_record *)((char *)idr + idr->length.l) ) { - const char *name = idr->name; + const char *name = (char *)idr->name; unsigned int name_len = idr->name_len.l;
file_type = (idr->flags.l & 2) ? ISO_DIRECTORY : ISO_REGULAR; @@ -164,7 +164,7 @@ rr_len = (idr->length.l - idr->name_len.l - (unsigned char)sizeof(struct iso_directory_record) + (unsigned char)sizeof(idr->name)); - rr_ptr.ptr = ((unsigned char *)idr + idr->name_len.l + rr_ptr.ptr = ((char *)idr + idr->name_len.l + sizeof(struct iso_directory_record) - sizeof(idr->name)); if (rr_ptr.i & 1) @@ -190,7 +190,7 @@ rr_flag &= rr_ptr.rr->u.rr.flags.l; else if (rr_ptr.rr->signature == RRMAGIC('N', 'M')) { - name = rr_ptr.rr->u.nm.name; + name = (char *)rr_ptr.rr->u.nm.name; name_len = rr_ptr.rr->len - 5; rr_flag &= ~RR_FLAG_NM; } @@ -222,11 +222,12 @@ && (unsigned char *)name < RRCONT_BUF + ISO_SECTOR_SIZE ) { memcpy(NAME_BUF, name, name_len); - name = NAME_BUF; + name = (char *)NAME_BUF; } - rr_ptr.ptr = RRCONT_BUF + ce_ptr->u.ce.offset.l; + rr_ptr.ptr = (char *)(RRCONT_BUF + ce_ptr->u.ce.offset.l); rr_len = ce_ptr->u.ce.size.l; - if (!iso9660_devread(ce_ptr->u.ce.extent.l, 0, ISO_SECTOR_SIZE, RRCONT_BUF)) + if (!iso9660_devread(ce_ptr->u.ce.extent.l, 0, + ISO_SECTOR_SIZE, (char *)RRCONT_BUF)) { errnum = 0; /* this is not fatal. */ break;
Modified: openbios-devel/fs/grubfs/fsys_xfs.c =================================================================== --- openbios-devel/fs/grubfs/fsys_xfs.c 2008-12-20 15:05:43 UTC (rev 293) +++ openbios-devel/fs/grubfs/fsys_xfs.c 2008-12-20 17:15:47 UTC (rev 294) @@ -382,7 +382,7 @@ default: namelen = sfe->namelen; *ino = sf_ino ((char *)sfe, namelen); - name = sfe->name; + name = (char *)sfe->name; sfe = (xfs_dir2_sf_entry_t *) ((char *)sfe + namelen + 11 - xfs.i8param); }
Modified: openbios-devel/fs/grubfs/iso9660.h =================================================================== --- openbios-devel/fs/grubfs/iso9660.h 2008-12-20 15:05:43 UTC (rev 293) +++ openbios-devel/fs/grubfs/iso9660.h 2008-12-20 17:15:47 UTC (rev 294) @@ -66,11 +66,11 @@
typedef struct __iso_16bit { u_int16_t l, b; -} iso_16bit_t __attribute__ ((packed)); +} iso_16bit_t;
typedef struct __iso_32bit { u_int32_t l, b; -} iso_32bit_t __attribute__ ((packed)); +} iso_32bit_t;
typedef u_int8_t iso_date_t[7];
Modified: openbios-devel/include/openbios/drivers.h =================================================================== --- openbios-devel/include/openbios/drivers.h 2008-12-20 15:05:43 UTC (rev 293) +++ openbios-devel/include/openbios/drivers.h 2008-12-20 17:15:47 UTC (rev 294) @@ -8,44 +8,74 @@ * version 2 * */ +#ifndef OPENBIOS_DRIVERS_H +#define OPENBIOS_DRIVERS_H
#include "openbios/config.h"
+/* modules/video.c */ +int video_get_res(int *w, int *h); +void draw_pixel(int x, int y, int colind); +void set_color(int ind, ulong color); +void video_scroll(int height); +void init_video(unsigned long fb, int width, int height, int depth, int rb); + +/* modules/console.c */ +int console_draw_str(const char *str); +void console_close(void); +void cls(void); + #ifdef CONFIG_DRIVER_PCI +/* drivers/pci.c */ int ob_pci_init(void); -void macio_nvram_init(char *path, uint32_t addr); + +/* arch/ppc/qemu/qemu.c */ +void macio_nvram_init(const char *path, uint32_t addr); #endif #ifdef CONFIG_DRIVER_SBUS +/* drivers/sbus.c */ int ob_sbus_init(uint64_t base, int machine_id); + +/* arch/sparc32/console.c */ 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(unsigned long fb, int width, int height, int depth, int rb); #endif -#endif #ifdef CONFIG_DRIVER_IDE +/* drivers/ide.c */ int ob_ide_init(const char *path, uint32_t io_port0, uint32_t ctl_port0, uint32_t io_port1, uint32_t ctl_port1); #endif #ifdef CONFIG_DRIVER_ESP +/* drivers/esp.c */ int ob_esp_init(unsigned int slot, uint64_t base, unsigned long espoffset, unsigned long dmaoffset); #endif #ifdef CONFIG_DRIVER_OBIO +/* drivers/obio.c */ 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); + +/* drivers/iommu.c */ extern struct mem cmem; + +/* drivers/sbus.c */ extern uint16_t graphic_depth; + +/* drivers/obio.c */ extern volatile unsigned char *power_reg; extern volatile unsigned int *reset_reg; +extern volatile struct sun4m_timer_regs *counter_regs; + +/* arch/sparc32/romvec.c */ extern const char *obp_stdin_path, *obp_stdout_path; extern char obp_stdin, obp_stdout; -extern volatile struct sun4m_timer_regs *counter_regs; + +/* arch/sparc32/boot.c */ extern uint32_t kernel_image; extern uint32_t kernel_size; extern uint32_t qemu_cmdline; @@ -55,3 +85,5 @@ #ifdef CONFIG_DRIVER_FLOPPY int ob_floppy_init(void); #endif + +#endif /* OPENBIOS_DRIVERS_H */
Modified: openbios-devel/include/sparc64/types.h =================================================================== --- openbios-devel/include/sparc64/types.h 2008-12-20 15:05:43 UTC (rev 293) +++ openbios-devel/include/sparc64/types.h 2008-12-20 17:15:47 UTC (rev 294) @@ -29,8 +29,8 @@ #include "autoconf.h"
/* cell based types */ -typedef int64_t cell; -typedef uint64_t ucell; +typedef long long cell; +typedef unsigned long long ucell;
#ifdef NEED_FAKE_INT128_T typedef struct {
Modified: openbios-devel/include/video_subr.h =================================================================== --- openbios-devel/include/video_subr.h 2008-12-20 15:05:43 UTC (rev 293) +++ openbios-devel/include/video_subr.h 2008-12-20 17:15:47 UTC (rev 294) @@ -1,11 +1,18 @@ #ifndef VIDEO_SUBR_H #define VIDEO_SUBR_H
-void video_tx_byte(unsigned char byte); +/* drivers/vga_load_regs.c */ void vga_load_regs(void); + +/* drivers/vga_set_mode.c */ +void vga_set_gmode (void); void vga_set_amode (void); -void vga_set_gmode (void); void vga_font_load(unsigned char *vidmem, const unsigned char *font, int height, int num_chars); -extern const unsigned char fontdata_8x16[];
+/* drivers/vga_vbe.c */ +void vga_set_color(int i, unsigned int r, unsigned int g, unsigned int b); +void vga_vbe_set_mode(int width, int height, int depth); +void vga_vbe_init(const char *path, uint32_t fb, uint32_t fb_size, + unsigned long rom, uint32_t rom_size); + #endif /* VIDEO_SUBR_H */
Modified: openbios-devel/kernel/cross.h =================================================================== --- openbios-devel/kernel/cross.h 2008-12-20 15:05:43 UTC (rev 293) +++ openbios-devel/kernel/cross.h 2008-12-20 17:15:47 UTC (rev 294) @@ -112,8 +112,8 @@ #define FMT_CELL_x "x" #define FMT_CELL_d "d" #else -#define FMT_CELL_x "lx" -#define FMT_CELL_d "ld" +#define FMT_CELL_x "llx" +#define FMT_CELL_d "lld" #endif #endif
Modified: openbios-devel/modules/console.c =================================================================== --- openbios-devel/modules/console.c 2008-12-20 15:05:43 UTC (rev 293) +++ openbios-devel/modules/console.c 2008-12-20 17:15:47 UTC (rev 294) @@ -53,7 +53,7 @@ static void draw_char( uint h, uint v ) { - char *c = fontdata; + const unsigned char *c = fontdata; int x, y, xx, rskip, m; int invert = (h==cons.x && v==cons.y && cons.cursor_on); int ch = get_conschar( h, v );
Modified: openbios-devel/modules/font_8x16.c =================================================================== --- openbios-devel/modules/font_8x16.c 2008-12-20 15:05:43 UTC (rev 293) +++ openbios-devel/modules/font_8x16.c 2008-12-20 17:15:47 UTC (rev 294) @@ -10,7 +10,7 @@
#define FONTDATAMAX 4096
-const unsigned char fontdata_8x16[FONTDATAMAX] = { +static const unsigned char fontdata_8x16[FONTDATAMAX] = {
/* 0 0x00 '^@' */ 0x00, /* 00000000 */
Modified: openbios-devel/modules/video.c =================================================================== --- openbios-devel/modules/video.c 2008-12-20 15:05:43 UTC (rev 293) +++ openbios-devel/modules/video.c 2008-12-20 17:15:47 UTC (rev 294) @@ -18,6 +18,8 @@ #include "openbios/bindings.h" #include "libc/diskio.h" #include "ofmem.h" +#include "openbios/drivers.h" +#include "video_subr.h"
static struct { int has_video; @@ -148,7 +150,8 @@ while( ww-- ) *p++ = col; } else { - char *p = (ushort*)pp + x; + char *p = (char *)((ushort*)pp + x); + while( ww-- ) *p++ = col; }