mirror of
https://gitlab.com/qemu-project/openbios.git
synced 2024-02-13 08:34:06 +08:00
Warning fixes for Sparc32, Sparc64, PPC
Fix warnings that would be caused by gcc flag -Wwrite-strings and -Wmissing-prototypes. Also fix most PPC specific warnings. git-svn-id: svn://coreboot.org/openbios/openbios-devel@288 f158a5a8-5612-0410-a976-696ce0be7e32
This commit is contained in:
@@ -28,8 +28,6 @@
|
|||||||
#define MEMORY_SIZE (256*1024) /* 256K ram for hosted system */
|
#define MEMORY_SIZE (256*1024) /* 256K ram for hosted system */
|
||||||
#define DICTIONARY_SIZE (512*1024) /* 128K for the dictionary */
|
#define DICTIONARY_SIZE (512*1024) /* 128K for the dictionary */
|
||||||
|
|
||||||
extern unsigned char *dict;
|
|
||||||
extern cell dicthead;
|
|
||||||
static ucell *memory;
|
static ucell *memory;
|
||||||
|
|
||||||
/************************************************************************/
|
/************************************************************************/
|
||||||
|
|||||||
@@ -87,7 +87,7 @@ entry( void )
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
setenv( char *env, char *value )
|
setenv( const char *env, const char *value )
|
||||||
{
|
{
|
||||||
push_str( value );
|
push_str( value );
|
||||||
push_str( env );
|
push_str( env );
|
||||||
@@ -97,7 +97,7 @@ setenv( char *env, char *value )
|
|||||||
void
|
void
|
||||||
arch_of_init( void )
|
arch_of_init( void )
|
||||||
{
|
{
|
||||||
#if USE_RTAS
|
#ifdef USE_RTAS
|
||||||
phandle_t ph;
|
phandle_t ph;
|
||||||
#endif
|
#endif
|
||||||
int autoboot;
|
int autoboot;
|
||||||
@@ -114,7 +114,7 @@ arch_of_init( void )
|
|||||||
|
|
||||||
node_methods_init();
|
node_methods_init();
|
||||||
|
|
||||||
#if USE_RTAS
|
#ifdef USE_RTAS
|
||||||
if( !(ph=find_dev("/rtas")) )
|
if( !(ph=find_dev("/rtas")) )
|
||||||
printk("Warning: No /rtas node\n");
|
printk("Warning: No /rtas node\n");
|
||||||
else {
|
else {
|
||||||
|
|||||||
@@ -34,8 +34,8 @@ static void try_path(const char *path, char *param, const void *romvec)
|
|||||||
|
|
||||||
void boot(void)
|
void boot(void)
|
||||||
{
|
{
|
||||||
char *path = pop_fstr_copy(), *param, *oldpath = path;
|
char *path = pop_fstr_copy(), *param, altpath[256];
|
||||||
char altpath[256];
|
const char *oldpath = path;
|
||||||
int unit = 0;
|
int unit = 0;
|
||||||
const void *romvec;
|
const void *romvec;
|
||||||
|
|
||||||
|
|||||||
@@ -172,10 +172,10 @@ struct linux_romvec {
|
|||||||
struct linux_nodeops {
|
struct linux_nodeops {
|
||||||
int (*no_nextnode)(int node);
|
int (*no_nextnode)(int node);
|
||||||
int (*no_child)(int node);
|
int (*no_child)(int node);
|
||||||
int (*no_proplen)(int node, char *name);
|
int (*no_proplen)(int node, const char *name);
|
||||||
int (*no_getprop)(int node, char *name, char *val);
|
int (*no_getprop)(int node, const char *name, char *val);
|
||||||
int (*no_setprop)(int node, char *name, char *val, int len);
|
int (*no_setprop)(int node, const char *name, char *val, int len);
|
||||||
const char * (*no_nextprop)(int node, char *name);
|
const char * (*no_nextprop)(int node, const char *name);
|
||||||
};
|
};
|
||||||
|
|
||||||
/* More fun PROM structures for device probing. */
|
/* More fun PROM structures for device probing. */
|
||||||
|
|||||||
@@ -41,10 +41,10 @@ const char *obp_stdin_path, *obp_stdout_path;
|
|||||||
|
|
||||||
static int obp_nextnode(int node);
|
static int obp_nextnode(int node);
|
||||||
static int obp_child(int node);
|
static int obp_child(int node);
|
||||||
static int obp_proplen(int node, char *name);
|
static int obp_proplen(int node, const char *name);
|
||||||
static int obp_getprop(int node, char *name, char *val);
|
static int obp_getprop(int node, const char *name, char *val);
|
||||||
static int obp_setprop(int node, char *name, char *val, int len);
|
static int obp_setprop(int node, const char *name, char *val, int len);
|
||||||
static const char *obp_nextprop(int node, char *name);
|
static const char *obp_nextprop(int node, const char *name);
|
||||||
static int obp_devread(int dev_desc, char *buf, int nbytes);
|
static int obp_devread(int dev_desc, char *buf, int nbytes);
|
||||||
static int obp_devseek(int dev_desc, int hi, int lo);
|
static int obp_devseek(int dev_desc, int hi, int lo);
|
||||||
|
|
||||||
@@ -85,7 +85,7 @@ static int obp_child(int node)
|
|||||||
return child;
|
return child;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int obp_proplen(int node, char *name)
|
static int obp_proplen(int node, const char *name)
|
||||||
{
|
{
|
||||||
int notfound;
|
int notfound;
|
||||||
|
|
||||||
@@ -129,11 +129,11 @@ static int looks_like_string(char *str, int len)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static int obp_getprop(int node, char *name, char *value)
|
static int obp_getprop(int node, const char *name, char *value)
|
||||||
{
|
{
|
||||||
int notfound, found;
|
int notfound, found;
|
||||||
int len;
|
int len;
|
||||||
char *str;
|
const char *str;
|
||||||
|
|
||||||
if (!node) {
|
if (!node) {
|
||||||
DPRINTF("obp_getprop(0x0, %s) = -1\n", name);
|
DPRINTF("obp_getprop(0x0, %s) = -1\n", name);
|
||||||
@@ -192,7 +192,7 @@ static int obp_getprop(int node, char *name, char *value)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static const char *obp_nextprop(int node, char *name)
|
static const char *obp_nextprop(int node, const char *name)
|
||||||
{
|
{
|
||||||
int found;
|
int found;
|
||||||
|
|
||||||
@@ -224,7 +224,7 @@ static const char *obp_nextprop(int node, char *name)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int obp_setprop(__attribute__((unused)) int node,
|
static int obp_setprop(__attribute__((unused)) int node,
|
||||||
__attribute__((unused)) char *name,
|
__attribute__((unused)) const char *name,
|
||||||
__attribute__((unused)) char *value,
|
__attribute__((unused)) char *value,
|
||||||
__attribute__((unused)) int len)
|
__attribute__((unused)) int len)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -44,17 +44,17 @@ void boot(void)
|
|||||||
} else {
|
} else {
|
||||||
switch (boot_device) {
|
switch (boot_device) {
|
||||||
case 'a':
|
case 'a':
|
||||||
path = "/obio/SUNW,fdtwo";
|
path = strdup("/obio/SUNW,fdtwo");
|
||||||
break;
|
break;
|
||||||
case 'c':
|
case 'c':
|
||||||
path = "disk";
|
path = strdup("disk");
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
case 'd':
|
case 'd':
|
||||||
path = "cdrom";
|
path = strdup("cdrom");
|
||||||
break;
|
break;
|
||||||
case 'n':
|
case 'n':
|
||||||
path = "net";
|
path = strdup("net");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ struct esp_dma {
|
|||||||
|
|
||||||
typedef struct sd_private {
|
typedef struct sd_private {
|
||||||
unsigned int bs;
|
unsigned int bs;
|
||||||
char *media_str;
|
const char *media_str;
|
||||||
uint32_t sectors;
|
uint32_t sectors;
|
||||||
uint8_t media;
|
uint8_t media;
|
||||||
uint8_t id;
|
uint8_t id;
|
||||||
@@ -182,7 +182,7 @@ read_capacity(esp_private_t *esp, sd_private_t *sd)
|
|||||||
static unsigned int
|
static unsigned int
|
||||||
inquiry(esp_private_t *esp, sd_private_t *sd)
|
inquiry(esp_private_t *esp, sd_private_t *sd)
|
||||||
{
|
{
|
||||||
char *media = "UNKNOWN";
|
const char *media = "UNKNOWN";
|
||||||
|
|
||||||
// Setup command = Inquiry
|
// Setup command = Inquiry
|
||||||
memset(esp->buffer, 0, 7);
|
memset(esp->buffer, 0, 7);
|
||||||
|
|||||||
@@ -157,7 +157,7 @@ ob_ide_400ns_delay(struct ide_drive *drive)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
ob_ide_error(struct ide_drive *drive, unsigned char stat, char *msg)
|
ob_ide_error(struct ide_drive *drive, unsigned char stat, const char *msg)
|
||||||
{
|
{
|
||||||
struct ide_channel *chan = drive->channel;
|
struct ide_channel *chan = drive->channel;
|
||||||
unsigned char err;
|
unsigned char err;
|
||||||
@@ -1285,8 +1285,8 @@ int ob_ide_init(void)
|
|||||||
{
|
{
|
||||||
int i, j;
|
int i, j;
|
||||||
|
|
||||||
char * nodetemp_chan = "/pci/isa/ide%d";
|
const char *nodetemp_chan = "/pci/isa/ide%d";
|
||||||
char * nodetemp = "/pci/isa/ide%d/%s";
|
const char *nodetemp = "/pci/isa/ide%d/%s";
|
||||||
char nodebuff[32];
|
char nodebuff[32];
|
||||||
phandle_t dnode;
|
phandle_t dnode;
|
||||||
|
|
||||||
@@ -1336,7 +1336,7 @@ int ob_ide_init(void)
|
|||||||
printk("ide%d: [io ports 0x%x-0x%x,0x%x]\n", i, chan->io_regs[0], chan->io_regs[0] + 7, chan->io_regs[8]);
|
printk("ide%d: [io ports 0x%x-0x%x,0x%x]\n", i, chan->io_regs[0], chan->io_regs[0] + 7, chan->io_regs[8]);
|
||||||
for (j = 0; j < 2; j++) {
|
for (j = 0; j < 2; j++) {
|
||||||
struct ide_drive *drive = &chan->drives[j];
|
struct ide_drive *drive = &chan->drives[j];
|
||||||
char *media = "UNKNOWN";
|
const char *media = "UNKNOWN";
|
||||||
|
|
||||||
if (!drive->present)
|
if (!drive->present)
|
||||||
continue;
|
continue;
|
||||||
|
|||||||
@@ -342,9 +342,15 @@ next_dentry (xfs_ino_t *ino)
|
|||||||
{
|
{
|
||||||
int namelen = 1;
|
int namelen = 1;
|
||||||
int toread;
|
int toread;
|
||||||
static char *usual[2] = {".", ".."};
|
static char *usual[2];
|
||||||
static xfs_dir2_sf_entry_t *sfe;
|
static xfs_dir2_sf_entry_t *sfe;
|
||||||
char *name = usual[0];
|
char *name;
|
||||||
|
|
||||||
|
if (!usual[0]) {
|
||||||
|
usual[0] = strdup(".");
|
||||||
|
usual[1] = strdup("..");
|
||||||
|
}
|
||||||
|
name = usual[0];
|
||||||
|
|
||||||
if (xfs.dirpos >= xfs.dirmax) {
|
if (xfs.dirpos >= xfs.dirmax) {
|
||||||
if (xfs.forw == 0)
|
if (xfs.forw == 0)
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ void (*disk_read_func) (int, int, int);
|
|||||||
/************************************************************************/
|
/************************************************************************/
|
||||||
|
|
||||||
typedef struct fsys_entry {
|
typedef struct fsys_entry {
|
||||||
char *name;
|
const char *name;
|
||||||
int (*mount_func) (void);
|
int (*mount_func) (void);
|
||||||
int (*read_func) (char *buf, int len);
|
int (*read_func) (char *buf, int len);
|
||||||
int (*dir_func) (char *dirname);
|
int (*dir_func) (char *dirname);
|
||||||
@@ -221,7 +221,7 @@ close_fs( fs_ops_t *fs )
|
|||||||
/* callers responsibility to call free(fs) */
|
/* callers responsibility to call free(fs) */
|
||||||
}
|
}
|
||||||
|
|
||||||
static char *
|
static const char *
|
||||||
grubfs_get_fstype( fs_ops_t *fs )
|
grubfs_get_fstype( fs_ops_t *fs )
|
||||||
{
|
{
|
||||||
grubfs_t *gfs = (grubfs_t*)fs->fs_data;
|
grubfs_t *gfs = (grubfs_t*)fs->fs_data;
|
||||||
|
|||||||
@@ -67,7 +67,9 @@ search_files( record *par, int recursive, match_proc_t proc, const void *match_d
|
|||||||
} while( ret && !record_next(&r) );
|
} while( ret && !record_next(&r) );
|
||||||
|
|
||||||
if( !ret && pt ) {
|
if( !ret && pt ) {
|
||||||
char name[256], *s2 = t.path ? t.path : "";
|
char name[256];
|
||||||
|
const char *s2 = t.path ? t.path : "";
|
||||||
|
|
||||||
unicode_uni2asc( name, &r.key.name, sizeof(name));
|
unicode_uni2asc( name, &r.key.name, sizeof(name));
|
||||||
|
|
||||||
pt->rec = t.rec;
|
pt->rec = t.rec;
|
||||||
@@ -359,7 +361,7 @@ vol_name( fs_ops_t *fs, char *buf, int size )
|
|||||||
return get_hfs_vol_name( fs->fd, buf, size );
|
return get_hfs_vol_name( fs->fd, buf, size );
|
||||||
}
|
}
|
||||||
|
|
||||||
static char *
|
static const char *
|
||||||
get_fstype( fs_ops_t *fs )
|
get_fstype( fs_ops_t *fs )
|
||||||
{
|
{
|
||||||
return ("HFS+");
|
return ("HFS+");
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ struct fs_ops {
|
|||||||
int (*lseek)( file_desc_t *file, off_t offset, int whence );
|
int (*lseek)( file_desc_t *file, off_t offset, int whence );
|
||||||
char *(*get_path)( file_desc_t *file, char *buf, int len );
|
char *(*get_path)( file_desc_t *file, char *buf, int len );
|
||||||
|
|
||||||
char *(*get_fstype)( fs_ops_t *fs );
|
const char *(*get_fstype)( fs_ops_t *fs );
|
||||||
};
|
};
|
||||||
|
|
||||||
extern fs_ops_t *fs_open( int fs_type, int fd );
|
extern fs_ops_t *fs_open( int fs_type, int fd );
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ extern volatile int runforth;
|
|||||||
extern int enterforth( xt_t xt );
|
extern int enterforth( xt_t xt );
|
||||||
extern void panic(const char *error) __attribute__ ((noreturn));
|
extern void panic(const char *error) __attribute__ ((noreturn));
|
||||||
|
|
||||||
extern xt_t findword(char *s1);
|
extern xt_t findword(const char *s1);
|
||||||
extern void modules_init( void );
|
extern void modules_init( void );
|
||||||
|
|
||||||
/* arch kernel hooks */
|
/* arch kernel hooks */
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ unsigned long base_address;
|
|||||||
/* include path handling */
|
/* include path handling */
|
||||||
typedef struct include_path include;
|
typedef struct include_path include;
|
||||||
struct include_path {
|
struct include_path {
|
||||||
char *path;
|
const char *path;
|
||||||
include *next;
|
include *next;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -137,7 +137,7 @@ static void relocation_table(unsigned char * dict_one, unsigned char *dict_two,
|
|||||||
relocation_address=reloc_table;
|
relocation_address=reloc_table;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void write_dictionary(char *filename)
|
static void write_dictionary(const char *filename)
|
||||||
{
|
{
|
||||||
FILE *f;
|
FILE *f;
|
||||||
unsigned char *write_data, *walk_data;
|
unsigned char *write_data, *walk_data;
|
||||||
@@ -375,7 +375,7 @@ static void paddict(ucell align)
|
|||||||
* generic forth word creator function.
|
* generic forth word creator function.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static void fcreate(char *word, ucell cfaval)
|
static void fcreate(const char *word, ucell cfaval)
|
||||||
{
|
{
|
||||||
if (strlen(word) == 0) {
|
if (strlen(word) == 0) {
|
||||||
printk("WARNING: tried to create unnamed word.\n");
|
printk("WARNING: tried to create unnamed word.\n");
|
||||||
@@ -395,20 +395,20 @@ static void fcreate(char *word, ucell cfaval)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static ucell *buildvariable(char *name, cell defval)
|
static ucell *buildvariable(const char *name, cell defval)
|
||||||
{
|
{
|
||||||
fcreate(name, DOVAR); /* see dict.h for DOVAR and other CFA ids */
|
fcreate(name, DOVAR); /* see dict.h for DOVAR and other CFA ids */
|
||||||
writecell(defval);
|
writecell(defval);
|
||||||
return (ucell *) (dict + dicthead - sizeof(cell));
|
return (ucell *) (dict + dicthead - sizeof(cell));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void buildconstant(char *name, cell defval)
|
static void buildconstant(const char *name, cell defval)
|
||||||
{
|
{
|
||||||
fcreate(name, DOCON); /* see dict.h for DOCON and other CFA ids */
|
fcreate(name, DOCON); /* see dict.h for DOCON and other CFA ids */
|
||||||
writecell(defval);
|
writecell(defval);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void builddefer(char *name)
|
static void builddefer(const char *name)
|
||||||
{
|
{
|
||||||
fcreate(name, DODFR); /* see dict.h for DODFR and other CFA ids */
|
fcreate(name, DODFR); /* see dict.h for DODFR and other CFA ids */
|
||||||
writecell((ucell)0);
|
writecell((ucell)0);
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ static int to_lower(int c)
|
|||||||
|
|
||||||
/* fstrcmp - compare null terminated string with forth string. */
|
/* fstrcmp - compare null terminated string with forth string. */
|
||||||
|
|
||||||
static int fstrcmp(char *s1, ucell fstr)
|
static int fstrcmp(const char *s1, ucell fstr)
|
||||||
{
|
{
|
||||||
char *s2 = (char*)cell2pointer(fstr);
|
char *s2 = (char*)cell2pointer(fstr);
|
||||||
while (*s1) {
|
while (*s1) {
|
||||||
@@ -84,7 +84,7 @@ static int fstrcmp(char *s1, ucell fstr)
|
|||||||
* word.
|
* word.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
xt_t findword(char *s1)
|
xt_t findword(const char *s1)
|
||||||
{
|
{
|
||||||
ucell tmplfa, len;
|
ucell tmplfa, len;
|
||||||
|
|
||||||
|
|||||||
@@ -110,7 +110,7 @@ create_free_part( char *ptr, int size )
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
create_nv_part( int signature, char *name, int size )
|
create_nv_part( int signature, const char *name, int size )
|
||||||
{
|
{
|
||||||
nvpart_t *p = NULL;
|
nvpart_t *p = NULL;
|
||||||
int fs;
|
int fs;
|
||||||
|
|||||||
@@ -174,7 +174,7 @@ set_color( int ind, ulong color )
|
|||||||
#ifdef CONFIG_MOL
|
#ifdef CONFIG_MOL
|
||||||
if( video.fb.depth == 8 )
|
if( video.fb.depth == 8 )
|
||||||
OSI_SetColor( ind, color );
|
OSI_SetColor( ind, color );
|
||||||
#elif CONFIG_SPARC32
|
#elif defined(CONFIG_SPARC32)
|
||||||
if( video.fb.depth == 8 ) {
|
if( video.fb.depth == 8 ) {
|
||||||
dac[0] = ind << 24;
|
dac[0] = ind << 24;
|
||||||
dac[1] = ((color >> 16) & 0xff) << 24; // Red
|
dac[1] = ((color >> 16) & 0xff) << 24; // Red
|
||||||
|
|||||||
Reference in New Issue
Block a user