Fix almost all remaining warnings

git-svn-id: svn://coreboot.org/openbios/openbios-devel@294 f158a5a8-5612-0410-a976-696ce0be7e32
This commit is contained in:
Blue Swirl 2008-12-20 17:15:47 +00:00
parent 2324d53cb4
commit 7e21fc929d
23 changed files with 101 additions and 53 deletions

View File

@ -155,7 +155,7 @@ free( void *ptr )
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 @@ free( void *ptr )
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 )

View File

@ -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 @@ transfer_control_to_elf( ulong entry )
}
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 @@ load_elf_rom( ulong *entry, int fd )
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 @@ load_elf_rom( ulong *entry, int fd )
#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 @@ qemu_startup( void )
{
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");

View File

@ -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 @@ ciface_quiesce( ulong args[], ulong ret[] )
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;

View File

@ -97,7 +97,7 @@ printk( const char *fmt, ... )
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;

View File

@ -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);

View File

@ -21,7 +21,6 @@ int openbios(void);
/* 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);

View File

@ -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"

View File

@ -300,7 +300,7 @@ unmap_pages(unsigned long virt, unsigned long size)
{
unsigned long phys, data;
unsigned long tte_data, currsize;
unsigned long currsize;
// align size
size = (size + PAGE_MASK_8K) & ~PAGE_MASK_8K;

View File

@ -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);

View File

@ -239,7 +239,7 @@ rtc_init(char *path)
}
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];

View File

@ -15,4 +15,4 @@ enum {
};
cuda_t *cuda_init (char *path, uint32_t base);
cuda_t *cuda_init (const char *path, uint32_t base);

View File

@ -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 const pci_dev_t eth_devices[] = {
},
};
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 @@ static void eth_config_cb (const pci_config_t *config)
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 @@ static int macio_config_cb (const pci_config_t *config)
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 @@ static const pci_dev_t *pci_find_device (uint8_t class, uint8_t subclass,
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 @@ static char pci_xbox_blacklisted (int bus, int devnum, int fn)
#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;

View File

@ -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 @@ void vga_vbe_set_mode(int width, int height, int depth)
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 @@ void vga_vbe_init(char *path, uint32_t fb, uint32_t fb_size,
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",

View File

@ -141,7 +141,7 @@ iso9660_dir (char *dirname)
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 @@ iso9660_dir (char *dirname)
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 @@ iso9660_dir (char *dirname)
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 @@ iso9660_dir (char *dirname)
&& (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;

View File

@ -382,7 +382,7 @@ next_dentry (xfs_ino_t *ino)
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);
}

View File

@ -66,11 +66,11 @@ typedef union {
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];

View File

@ -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 @@ extern char boot_device;
#ifdef CONFIG_DRIVER_FLOPPY
int ob_floppy_init(void);
#endif
#endif /* OPENBIOS_DRIVERS_H */

View File

@ -29,8 +29,8 @@ typedef long long int64_t;
#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 {

View File

@ -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);
void vga_set_amode (void);
/* drivers/vga_set_mode.c */
void vga_set_gmode (void);
void vga_set_amode (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 */

View File

@ -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

View File

@ -53,7 +53,7 @@ get_conschar( int x, int y )
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 );

View File

@ -10,7 +10,7 @@
#define FONTDATAMAX 4096
const unsigned char fontdata_8x16[FONTDATAMAX] = {
static const unsigned char fontdata_8x16[FONTDATAMAX] = {
/* 0 0x00 '^@' */
0x00, /* 00000000 */

View File

@ -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 @@ fill_rect( int col_ind, int x, int y, int w, int h )
while( ww-- )
*p++ = col;
} else {
char *p = (ushort*)pp + x;
char *p = (char *)((ushort*)pp + x);
while( ww-- )
*p++ = col;
}