Reduce warnings by 29%

git-svn-id: svn://coreboot.org/openbios/openbios-devel@273 f158a5a8-5612-0410-a976-696ce0be7e32
This commit is contained in:
Blue Swirl
2008-11-29 19:31:28 +00:00
parent a0cabb495a
commit c52d26b976
19 changed files with 94 additions and 116 deletions

View File

@@ -308,7 +308,7 @@ int elf_load(struct sys_info *info, const char *filename, const char *cmdline,
Elf_phdr *phdr = NULL;
unsigned long phdr_size;
unsigned long checksum_offset;
unsigned short checksum;
unsigned short checksum = 0;
Elf_Bhdr *boot_notes = NULL;
int retval = -1;
int image_retval;

View File

@@ -265,9 +265,9 @@ static void obp_reboot(char *str)
for (;;) {}
}
extern volatile unsigned char *power_reg;
static void obp_abort(void)
{
extern volatile unsigned char *power_reg;
printk("abort, power off\n");
*power_reg = 1;
@@ -277,8 +277,6 @@ static void obp_abort(void)
static void obp_halt(void)
{
extern volatile unsigned char *power_reg;
printk("halt, power off\n");
*power_reg = 1;
printk("power off failed\n");

View File

@@ -307,7 +307,7 @@ int elf_load(struct sys_info *info, const char *filename, const char *cmdline)
Elf_phdr *phdr = NULL;
unsigned long phdr_size;
unsigned long checksum_offset;
unsigned short checksum;
unsigned short checksum = 0;
Elf_Bhdr *boot_notes = NULL;
int retval = -1;
int image_retval;

View File

@@ -58,14 +58,12 @@ struct hwdef {
static const struct hwdef hwdefs[] = {
{
.pci.cfg_addr = PCI_CONFIG,
.pci.cfg_data = 0,
.pci.cfg_base = 0x80000000ULL,
.pci.cfg_len = 0,
.pci.mem_base = 0,
.pci.mem_len = 0,
.pci.io_base = 0,
.pci.io_len = 0,
.pci = {
.cfg_addr = PCI_CONFIG,
.cfg_data = 0,
.cfg_base = 0x80000000ULL,
.cfg_len = 0,
},
.machine_id_low = 0,
.machine_id_high = 255,
},

View File

@@ -223,7 +223,7 @@ static void show_floppy(void);
static void floppy_reset(void);
static int set_dor(int fdc, char mask, char data)
static int set_dor(char mask, char data)
{
unsigned char newdor,olddor;
@@ -236,15 +236,6 @@ static int set_dor(int fdc, char mask, char data)
return olddor;
}
static void bounce_motor(void)
{
/* Bounce the drive motor... */
outb(fdc_state.dor & ~(0x10<<FD_DRIVE), FD_DOR);
outb(fdc_state.dor, FD_DOR);
}
/* waits until the fdc becomes ready */
static int wait_til_ready(void)
{
@@ -408,7 +399,7 @@ static void set_drive(int drive)
#endif
new_dor |= (1 << (drive + 4)); /* Spinup the selected drive */
new_dor |= drive; /* Select the drive for commands as well */
set_dor(fdc, 0xc, new_dor);
set_dor(0xc, new_dor);
mdelay(DRIVE_H1440_SPINUP);
@@ -432,7 +423,7 @@ static void floppy_motor_off(int drive)
mask = 0xff;
mask &= ~(1 << (drive +4));
/* Now clear the bit in the Digital Output Register */
set_dor(0, mask, 0);
set_dor(mask, 0);
}
/* Set the FDC's data transfer rate on behalf of the specified drive.
@@ -523,7 +514,6 @@ static void fdc_specify(
case 1:
dtr = 300;
if (fdc_state.version >= FDC_82078) {
unsigned char cmd[3];
/* chose the default rate table, not the one
* where 1 = 2 Mbps */
cmd[0] = FD_DRIVESPEC;
@@ -553,9 +543,6 @@ static void fdc_specify(
if (srt > 0xf) {
srt = 0xf;
}
if (srt < 0 ) {
srt = 0;
}
hlt = (head_load_time*scale_dtr/2 + NOMINAL_DTR - 1)/NOMINAL_DTR;
if (hlt < 0x01)
@@ -726,7 +713,6 @@ static int floppy_seek(unsigned track)
if (success)
drive_state[FD_DRIVE].track = track;
else {
int i;
printk_debug("seek failed\n");
printk_debug("nr = %d\n", nr);
printk_debug("ST0 = %02x\n", reply[0]);
@@ -906,21 +892,23 @@ static int __floppy_read(char *dest, unsigned long offset, unsigned long length)
return -1;
}
int floppy_read(char *dest, unsigned long offset, unsigned long length)
static int floppy_read(char *dest, unsigned long offset, unsigned long length)
{
int result, bytes_read;;
int fr_result, bytes_read;;
printk_debug("floppy_read\n");
bytes_read = 0;
do {
int max_errors = 3;
do {
result = __floppy_read(dest + bytes_read, offset, length - bytes_read);
fr_result = __floppy_read(dest + bytes_read, offset,
length - bytes_read);
if (max_errors-- == 0) {
return (bytes_read)?bytes_read: -1;
}
} while (result <= 0);
offset += result;
bytes_read += result;
} while (fr_result <= 0);
offset += fr_result;
bytes_read += fr_result;
} while(bytes_read < length);
return bytes_read;
}
@@ -1005,7 +993,7 @@ static char get_fdc_version(void)
} /* get_fdc_version */
int floppy_init(void)
static int floppy_init(void)
{
printk_debug("floppy_init\n");
fdc_state.in_sync = 0;
@@ -1041,13 +1029,6 @@ static void floppy_reset(void)
fdc_state.in_sync = 1;
}
void floppy_fini(void)
{
/* Disable the floppy and the floppy drive controller */
set_dor(0, 0, 0);
}
static void
ob_floppy_initialize(int *idx)
{
@@ -1068,7 +1049,7 @@ ob_floppy_initialize(int *idx)
static void
ob_floppy_open(int *idx)
{
int ret=1, len;
int ret = 1;
phandle_t ph;
fword("my-unit");

View File

@@ -831,7 +831,7 @@ ob_nvram_init(uint64_t base, uint64_t offset)
ob_new_obio_device("eeprom", NULL);
nvram = (char *)ob_reg(base, offset, NVRAM_SIZE, 1);
nvram = (unsigned char *)ob_reg(base, offset, NVRAM_SIZE, 1);
PUSH((unsigned long)nvram);
fword("encode-int");

View File

@@ -227,4 +227,8 @@ struct screeninfo {
__u32 reserved[6]; /* Reserved for future compatibility */
};
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);
#endif

View File

@@ -137,11 +137,5 @@ DIR;
#ifndef NULL
#define NULL 0
#endif
extern DIR *opendir ();
extern struct direct *readdir ();
extern int telldir ();
extern void seekdir ();
#define rewinddir(dirp) seekdir((dirp), (long)0)
extern void closedir ();
#endif /* not KERNEL */
#endif /* _BOOT_UFS_DIR_H_ */

View File

@@ -56,7 +56,7 @@ struct PartitionBlock
unsigned long pb_Flags;
unsigned long pb_Reserved1[2];
unsigned long pb_DevFlags;
unsigned char pb_DriveName[32];
char pb_DriveName[32];
unsigned long pb_Reserved2[15];
unsigned long pb_Environment[20];
unsigned long pb_EReserved[12];
@@ -201,7 +201,7 @@ struct ReadData {
unsigned int filesize;
};
#warning "Big vs. little endian for configure needed"
//#warning "Big vs. little endian for configure needed"
#define AROS_BE2LONG(l) \
( \
((((unsigned long)(l)) >> 24) & 0x000000FFUL) | \
@@ -240,7 +240,8 @@ int blockoffset; /* offset if there is an embedded RDB partition */
int rootb; /* block number of root block */
int rdbb; /* block number of rdb block */
void initCache() {
static void initCache(void)
{
int i;
for (i=0;i<MAX_CACHE_BLOCKS;i++)
@@ -251,7 +252,8 @@ int i;
}
}
struct CacheBlock *getBlock(unsigned int block) {
static struct CacheBlock *getBlock(unsigned int block)
{
struct CacheBlock *freeblock;
int i;
@@ -278,7 +280,8 @@ int i;
return freeblock;
}
unsigned int calcChkSum(unsigned short SizeBlock, unsigned int *buffer) {
static unsigned int calcChkSum(unsigned short SizeBlock, unsigned int *buffer)
{
unsigned int sum=0,count=0;
for (count=0;count<SizeBlock;count++)
@@ -337,7 +340,8 @@ int i;
return 1;
}
int seek(unsigned long offset) {
static int seek(unsigned long offset)
{
struct CacheBlock *cblock;
unsigned long block;
unsigned long togo;
@@ -391,7 +395,7 @@ unsigned int readbytes = 0;
{
cblock = getBlock(fsysb->file.current.block);
}
#warning "else shouldn't occour"
//#warning "else shouldn't occour"
}
size = 512;
size -= fsysb->file.current.byte;
@@ -405,7 +409,7 @@ unsigned int readbytes = 0;
extensionBlock(cblock)->filekey_table
[fsysb->file.current.filekey]
)+blockoffset,
fsysb->file.current.byte, size, (char *)((int)buf+readbytes)
fsysb->file.current.byte, size, (char *)((long)buf+readbytes)
);
fsysb->file.current.byte += size;
}
@@ -418,7 +422,7 @@ unsigned int readbytes = 0;
extensionBlock(cblock)->filekey_table
[fsysb->file.current.filekey]
)+blockoffset,
fsysb->file.current.byte, size, (char *)((int)buf+readbytes)
fsysb->file.current.byte, size, (char *)((long)buf+readbytes)
);
fsysb->file.current.byte = 0;
fsysb->file.current.filekey--;
@@ -432,7 +436,8 @@ unsigned int readbytes = 0;
return readbytes;
}
unsigned char capitalch(unsigned char ch, unsigned char flags) {
static unsigned char capitalch(unsigned char ch, unsigned char flags)
{
if ((flags==0) || (flags==1))
return (unsigned char)((ch>='a') && (ch<='z') ? ch-('a'-'A') : ch);
@@ -442,7 +447,8 @@ unsigned char capitalch(unsigned char ch, unsigned char flags) {
}
// str2 is a BCPL string
int noCaseStrCmp(char *str1, char *str2, unsigned char flags) {
static int noCaseStrCmp(char *str1, char *str2, unsigned char flags)
{
unsigned char length;
length=str2++[0];
@@ -456,7 +462,8 @@ unsigned char length;
return (*str1) ? 1 : -1;
}
unsigned int getHashKey(char *name,unsigned int tablesize, unsigned char flags) {
static unsigned int getHashKey(char *name,unsigned int tablesize, unsigned char flags)
{
unsigned int length;
length=0;
@@ -467,7 +474,8 @@ unsigned int length;
return length%tablesize;
}
grub_error_t getHeaderBlock(char *name, struct CacheBlock **dirh) {
static grub_error_t getHeaderBlock(char *name, struct CacheBlock **dirh)
{
int key;
key = getHashKey(name, 72, 1);
@@ -501,8 +509,8 @@ printf("ghb2: %d\n", (*dirh)->blocknum);
return 0;
}
char *copyPart(char *src, char *dst) {
static char *copyPart(char *src, char *dst)
{
while ((*src != '/') && (*src))
*dst++ = *src++;
if (*src == '/')
@@ -514,7 +522,8 @@ char *copyPart(char *src, char *dst) {
return src;
}
grub_error_t findBlock(char *name, struct CacheBlock **dirh) {
static grub_error_t findBlock(char *name, struct CacheBlock **dirh)
{
char dname[32];
int block;
@@ -571,7 +580,8 @@ int block;
return 0;
}
void checkPossibility(char *filename, char *bstr) {
static void checkPossibility(char *filename, char *bstr)
{
#ifndef STAGE1_5
char cstr[32];
@@ -668,7 +678,7 @@ int affs_dir(char *dirname)
fname = filename;
while (*fname)
*current++ = *fname++;
#warning "TODO: add some more chars until posibilities differ"
//#warning "TODO: add some more chars until possibilities differ"
if (print_possibilities>0)
errnum = ERR_FILE_NOT_FOUND;
return (print_possibilities<0);

View File

@@ -587,7 +587,7 @@ ext2fs_dir (char *dirname)
log2 (EXT2_BLOCK_SIZE (SUPERBLOCK) / sizeof (struct ext2_inode)));
printf ("ext2fs_dir: inode table fsblock=%d\n", ino_blk);
#endif /* E2DEBUG */
if (!ext2_rdfsb (ino_blk, INODE))
if (!ext2_rdfsb (ino_blk, (char *)INODE))
{
return 0;
}

View File

@@ -30,8 +30,8 @@ static struct dir_entry *vstafs_nextdir (void);
#define FIRST_SECTOR ((struct first_sector *) FSYS_BUF)
#define FILE_INFO ((struct fs_file *) (int) FIRST_SECTOR + 8192)
#define DIRECTORY_BUF ((struct dir_entry *) (int) FILE_INFO + 512)
#define FILE_INFO ((struct fs_file *) (long) FIRST_SECTOR + 8192)
#define DIRECTORY_BUF ((struct dir_entry *) (long) FILE_INFO + 512)
#define ROOT_SECTOR 1
@@ -39,7 +39,6 @@ static struct dir_entry *vstafs_nextdir (void);
* In f_sector we store the sector number in which the information about
* the found file is.
*/
extern int filepos;
static int f_sector;
int
@@ -63,7 +62,7 @@ get_file_info (int sector)
}
static int curr_ext, current_direntry, current_blockpos;
static struct alloc *a;
static struct alloc *a1;
static struct dir_entry *
vstafs_readdir (long sector)
@@ -78,9 +77,9 @@ vstafs_readdir (long sector)
return 0;
}
a = FILE_INFO->blocks;
a1 = FILE_INFO->blocks;
curr_ext = 0;
devread (a[curr_ext].a_start, 0, 512, (char *) DIRECTORY_BUF);
devread (a1[curr_ext].a_start, 0, 512, (char *) DIRECTORY_BUF);
current_direntry = 11;
current_blockpos = 0;
@@ -93,7 +92,7 @@ vstafs_nextdir (void)
if (current_direntry > 15)
{
current_direntry = 0;
if (++current_blockpos > (a[curr_ext].a_len - 1))
if (++current_blockpos > (a1[curr_ext].a_len - 1))
{
current_blockpos = 0;
curr_ext++;
@@ -101,8 +100,8 @@ vstafs_nextdir (void)
if (curr_ext < FILE_INFO->extents)
{
devread (a[curr_ext].a_start + current_blockpos, 0,
512, (char *) DIRECTORY_BUF);
devread (a1[curr_ext].a_start + current_blockpos, 0,
512, (char *) DIRECTORY_BUF);
}
else
{
@@ -188,35 +187,35 @@ vstafs_dir (char *dirname)
int
vstafs_read (char *addr, int len)
{
struct alloc *a;
struct alloc *a2;
int size, ret = 0, offset, curr_len = 0;
int curr_ext;
int curr_ext2;
char extent;
int ext_size;
char *curr_pos;
get_file_info (f_sector);
size = FILE_INFO->len-VSTAFS_START_DATA;
a = FILE_INFO->blocks;
a2 = FILE_INFO->blocks;
if (filepos > 0)
{
if (filepos < a[0].a_len * 512 - VSTAFS_START_DATA)
if (filepos < a2[0].a_len * 512 - VSTAFS_START_DATA)
{
offset = filepos + VSTAFS_START_DATA;
extent = 0;
curr_len = a[0].a_len * 512 - offset - filepos;
curr_len = a2[0].a_len * 512 - offset - filepos;
}
else
{
ext_size = a[0].a_len * 512 - VSTAFS_START_DATA;
ext_size = a2[0].a_len * 512 - VSTAFS_START_DATA;
offset = filepos - ext_size;
extent = 1;
do
{
curr_len -= ext_size;
offset -= ext_size;
ext_size = a[extent+1].a_len * 512;
ext_size = a2[extent+1].a_len * 512;
}
while (extent < FILE_INFO->extents && offset>ext_size);
}
@@ -225,16 +224,16 @@ vstafs_read (char *addr, int len)
{
offset = VSTAFS_START_DATA;
extent = 0;
curr_len = a[0].a_len * 512 - offset;
curr_len = a2[0].a_len * 512 - offset;
}
curr_pos = addr;
if (curr_len > len)
curr_len = len;
for (curr_ext=extent;
curr_ext < FILE_INFO->extents;
curr_len = a[curr_ext].a_len * 512, curr_pos += curr_len, curr_ext++)
for (curr_ext2=extent;
curr_ext2 < FILE_INFO->extents;
curr_len = a2[curr_ext].a_len * 512, curr_pos += curr_len, curr_ext2++)
{
ret += curr_len;
size -= curr_len;
@@ -244,7 +243,7 @@ vstafs_read (char *addr, int len)
curr_len += size;
}
devread (a[curr_ext].a_start,offset, curr_len, curr_pos);
devread (a2[curr_ext2].a_start,offset, curr_len, curr_pos);
offset = 0;
}

View File

@@ -97,7 +97,7 @@ ino2offset (xfs_ino_t ino)
return ino & XFS_INO_MASK(XFS_INO_OFFSET_BITS);
}
static inline __const__ __uint16_t
static inline __uint16_t
le16 (__uint16_t x)
{
#ifdef __i386__
@@ -110,7 +110,7 @@ le16 (__uint16_t x)
#endif
}
static inline __const__ __uint32_t
static inline __uint32_t
le32 (__uint32_t x)
{
#ifdef __i386__
@@ -130,7 +130,7 @@ le32 (__uint32_t x)
#endif
}
static inline __const__ __uint64_t
static inline __uint64_t
le64 (__uint64_t x)
{
__uint32_t h = x >> 32;
@@ -195,7 +195,7 @@ fsb2daddr (xfs_fsblock_t fsbno)
}
#undef offsetof
#define offsetof(t,m) ((int)&(((t *)0)->m))
#define offsetof(t,m) ((long)&(((t *)0)->m))
static inline int
btroot_maxrecs (void)

View File

@@ -38,7 +38,7 @@
*
* return pointer after reading the structure
*/
static void* btree_readnode(btree* bt, btree_node_desc* node, void *p)
static void* btree_readnode(btree_node_desc* node, void *p)
{
node->next = bswabU32_inc(p);
node->prev = bswabU32_inc(p);
@@ -53,7 +53,7 @@ static void* btree_readnode(btree* bt, btree_node_desc* node, void *p)
*
* return pointer after reading the structure
*/
static void* btree_readhead(btree* bt, btree_head* head, void *p)
static void* btree_readhead(btree_head* head, void *p)
{
UInt32 *q;
head->depth = bswabU16_inc(p);
@@ -153,7 +153,7 @@ static node_buf* node_cache_load_buf
return NULL; // evil ...
result->index = node_index;
btree_readnode(bt, &result->desc, p);
btree_readnode(&result->desc, p);
e -> priority = result->desc.height * DEPTH_FACTOR;
e -> index = node_index;
@@ -229,10 +229,10 @@ static int btree_init(btree* bt, volume* vol, hfsp_fork_raw* fork)
HFSP_EXTENT_DATA, bt->cnid);
if (!p)
return -1;
p = btree_readnode(bt, &node, p);
p = btree_readnode(&node, p);
if (node.kind != HFSP_NODE_HEAD)
return -1; // should not happen ?
p = btree_readhead(bt, &bt->head, p);
p = btree_readhead(&bt->head, p);
node_size = bt->head.node_size;
bt->blkpernode = node_size / vol->blksize;

View File

@@ -98,7 +98,7 @@ root_search_files( fs_ops_t *fs, int recursive, match_proc_t proc, const void *m
static int
match_file( record *r, record *parent, const void *match_data, hfsp_file_t *pt )
{
unsigned char *p = (char*)match_data;
const char *p = (const char*)match_data;
char name[256];
int ret=1;
@@ -340,7 +340,7 @@ file_read( file_desc_t *fd, void *buf, size_t count )
max -= t->pos - curpos;
}
size = (count-act_count > max)? max : count-act_count;
memcpy( buf + act_count, &buf2[add], size );
memcpy( (char *)buf + act_count, &buf2[add], size );
curpos += blksize;
act_count += size;

View File

@@ -79,8 +79,8 @@ SInt32 fast_unicode_compare ( const hfsp_unistr255 *ustr1,
register UInt16 length1 = ustr1->strlen;
register UInt16 length2 = ustr2->strlen;
register const UInt16* lowerCaseTable = gLowerCaseTable;
register UInt16* str1 = ustr1->name;
register UInt16* str2 = ustr2->name;
register const UInt16* str1 = ustr1->name;
register const UInt16* str2 = ustr2->name;
while (1) {
// Set default values for c1, c2 in case there are no more valid chars

View File

@@ -115,7 +115,7 @@ volume_readfork(void *p, hfsp_fork_raw* f)
* ToDo: add more consitency checks.
*/
static int
volume_readbuf(volume * vol, hfsp_vh* vh, void* p)
volume_readbuf(volume * vol, hfsp_vh* vh, char * p)
{
if( (vh->signature = bswabU16_inc(p)) != HFSP_VOLHEAD_SIG)
HFSP_ERROR(-1, "This is not a HFS+ volume");
@@ -168,7 +168,7 @@ volume_read_wrapper(volume * vol, hfsp_vh* vh)
{
UInt16 signature;
char buf[vol->blksize];
void *p = buf;
char *p = buf;
if( volume_readinbuf(vol, buf, 2) ) // Wrapper or volume header starts here
return -1;

View File

@@ -29,10 +29,4 @@ extern int ofmem_map( ulong phys, ulong virt, ulong size, int mode );
extern void ofmem_release( ulong virt, ulong size );
extern ulong ofmem_translate( ulong virt, ulong *ret_mode );
/* allocations from the private pool */
extern void *malloc( int size );
extern void free( void *ptr );
extern void *realloc( void *ptr, size_t size );
#endif /* _H_OFMEM */

View File

@@ -139,7 +139,7 @@ OpenBIOS_finish_partition(struct OpenBIOS_nvpart_v1 *header, uint32_t size)
}
static inline uint32_t
OpenBIOS_set_var(uint8_t *nvram, uint32_t addr, const unsigned char *str)
OpenBIOS_set_var(uint8_t *nvram, uint32_t addr, const char *str)
{
uint32_t len;

View File

@@ -108,7 +108,7 @@ reopen( int fd, const char *filename )
push_str( filename );
call_package( fdp->reopen_xt, fdp->ih );
ret = (POP() == -1)? 0:-1;
ret = (POP() == (ucell)-1)? 0 : -1;
return ret;
}
@@ -121,7 +121,7 @@ reopen_nwrom( int fd )
if( lookup_xt(fdp->ih, "open-nwrom", &fdp->open_nwrom_xt) )
return -1;
call_package( fdp->open_nwrom_xt, fdp->ih );
return (POP() == -1)? 0:-1;
return (POP() == (ucell)-1)? 0 : -1;
}
ihandle_t