Fix most warnings from Sparse

git-svn-id: svn://coreboot.org/openbios/openbios-devel@274 f158a5a8-5612-0410-a976-696ce0be7e32
This commit is contained in:
Blue Swirl
2008-11-30 11:54:01 +00:00
parent c52d26b976
commit bf0c6b1c38
51 changed files with 186 additions and 166 deletions

View File

@@ -58,7 +58,7 @@ static char uart_getchar(int port)
static void uart_putchar(int port, unsigned char c)
{
if (!port)
return -1;
return;
while (!(inb(LSR(port)) & 0x20));
outb(c, THR(port));
}
@@ -134,6 +134,7 @@ typedef struct osi_fb_info {
#define openbios_GetFBInfo(x) Qemu_GetFBInfo(x)
#include "../../../modules/font_8x16.c"
#undef FONTDATAMAX
#include "../../../modules/video.c"
#include "../../../modules/console.c"

View File

@@ -47,7 +47,7 @@ enum {
ARCH_HEATHROW,
};
pci_arch_t known_arch[] = {
static pci_arch_t known_arch[] = {
[ARCH_PREP] = { "PREP", 0x1057, 0x4801, 0x80800000, 0x800c0000,
0x80000000, 0x00100000, 0xf0000000, 0x10000000,
0x80000000, 0x00010000, 0x00000000, 0x00400000,

View File

@@ -20,6 +20,7 @@
#include "openbios/kernel.h"
#include "openbios/nvram.h"
#include "openbios/bindings.h"
#include "openbios/drivers.h"
#include "libc/vsprintf.h"
#include "libc/string.h"
#include "libc/byteorder.h"
@@ -111,7 +112,7 @@ void macio_nvram_init(char *path, uint32_t addr)
set_property(dnode, "compatible", "nvram,flash", 12);
props[0] = __cpu_to_be32(IO_NVRAM_OFFSET);
props[1] = __cpu_to_be32(IO_NVRAM_SIZE);
set_property(dnode, "reg", &props, sizeof(props));
set_property(dnode, "reg", (char *)&props, sizeof(props));
set_property(dnode, "device_type", "nvram", 6);
chosen = find_dev("/chosen");

View File

@@ -21,6 +21,9 @@ extern void vfd_close( void );
extern int console_draw_str( const char *str );
/* console.c */
int serial_init(void);
#include "kernel.h"
#endif /* _H_QEMU */

View File

@@ -16,6 +16,7 @@
#include "openbios/config.h"
#include "openbios/bindings.h"
#include "qemu.h"
void devtree_init( void )
{

View File

@@ -51,8 +51,7 @@ static int check_mem_ranges(struct sys_info *info,
return 0;
}
int aout_load(struct sys_info *info, const char *filename, const char *cmdline,
const void *romvec)
int aout_load(struct sys_info *info, const char *filename, const void *romvec)
{
int retval = -1;
int image_retval;
@@ -60,7 +59,7 @@ int aout_load(struct sys_info *info, const char *filename, const char *cmdline,
unsigned long start, size;
unsigned int offset;
image_name = image_version = 0;
image_name = image_version = NULL;
if (!file_open(filename))
goto out;

View File

@@ -6,6 +6,7 @@
#include "openbios/bindings.h"
#include "openbios/elfload.h"
#include "openbios/nvram.h"
#include "openbios/drivers.h"
#include "libc/diskio.h"
#include "libc/vsprintf.h"
#include "sys_info.h"
@@ -103,14 +104,17 @@ void boot(void)
printk("without parameters.\n");
if (elf_load(&sys_info, path, param, romvec) == LOADER_NOT_SUPPORT)
if (linux_load(&sys_info, path, param, romvec) == LOADER_NOT_SUPPORT)
if (aout_load(&sys_info, path, param, romvec) == LOADER_NOT_SUPPORT) {
if (linux_load(&sys_info, path, param) == LOADER_NOT_SUPPORT)
if (aout_load(&sys_info, path, romvec) == LOADER_NOT_SUPPORT) {
sprintf(altpath, "%s:d", path);
if (elf_load(&sys_info, altpath, param, romvec) == LOADER_NOT_SUPPORT)
if (linux_load(&sys_info, altpath, param, romvec) == LOADER_NOT_SUPPORT)
if (aout_load(&sys_info, altpath, param, romvec) == LOADER_NOT_SUPPORT)
if (elf_load(&sys_info, altpath, param, romvec)
== LOADER_NOT_SUPPORT)
if (linux_load(&sys_info, altpath, param)
== LOADER_NOT_SUPPORT)
if (aout_load(&sys_info, altpath, romvec)
== LOADER_NOT_SUPPORT)
printk("Unsupported image format\n");
}

View File

@@ -6,25 +6,35 @@
* the copyright and warranty status of this work.
*/
int forth_load(struct sys_info *info, const char *filename, const char *cmdline);
// forthload.c
int forth_load(const char *filename);
// elfload.c
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);
// aout_load.c
int aout_load(struct sys_info *info, const char *filename, const void *romvec);
// linux_load.c
int linux_load(struct sys_info *info, const char *file, const char *cmdline);
// context.c
extern struct context *__context;
unsigned int start_elf(unsigned long entry_point, unsigned long param);
// romvec.c
void *init_openprom(unsigned long memsize, const char *path);
// boot.c
extern struct sys_info sys_info;
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;
// sys_info.c
extern unsigned int qemu_mem_size;
// romvec.c
extern struct linux_arguments_v0 obp_arg;
// openbios.c
extern int qemu_machine_type;

View File

@@ -22,7 +22,7 @@ void __exit_context(void); /* assembly routine */
* It is placed at the bottom of our stack, and loaded by assembly routine
* to start us up.
*/
struct context main_ctx = {
static struct context main_ctx = {
.regs[REG_SP] = (uint32_t) &_estack - 96,
.pc = (uint32_t) start_main,
.npc = (uint32_t) start_main + 4,

View File

@@ -26,7 +26,7 @@ static void *calloc(size_t nmemb, size_t size)
if (alloc_size < nmemb || alloc_size < size) {
printf("calloc overflow: %u, %u\n", nmemb, size);
return 0;
return NULL;
}
mem = malloc(alloc_size);
@@ -314,7 +314,7 @@ int elf_load(struct sys_info *info, const char *filename, const char *cmdline,
int image_retval;
unsigned int offset;
image_name = image_version = 0;
image_name = image_version = NULL;
if (!file_open(filename))
goto out;

View File

@@ -16,7 +16,8 @@
#define debug printk
static char *forthtext=NULL;
int forth_load(struct sys_info *info, const char *filename, const char *cmdline)
int forth_load(const char *filename)
{
char magic[2];
unsigned long forthsize;

View File

@@ -156,7 +156,7 @@ struct linux_params {
uint8_t reserved17[1792]; /* 0x900 - 0x1000 */
};
uint64_t forced_memsize;
static uint64_t forced_memsize;
/* Load the first part the file and check if it's Linux */
static uint32_t load_linux_header(struct linux_header *hdr)
@@ -293,14 +293,14 @@ static char *parse_command_line(const char *orig_cmdline, char *kern_cmdline)
unsigned long len;
int k_len;
int to_kern;
char *initrd = 0;
char *initrd = NULL;
int toolong = 0;
forced_memsize = 0;
if (!orig_cmdline) {
*kern_cmdline = 0;
return 0;
*kern_cmdline = '\0';
return NULL;
}
k_len = 0;
@@ -327,7 +327,7 @@ static char *parse_command_line(const char *orig_cmdline, char *kern_cmdline)
val = sep + 1;
len = end - val;
} else {
val = 0;
val = NULL;
len = 0;
}
@@ -434,8 +434,8 @@ static int load_linux_kernel(struct linux_header *hdr, uint32_t kern_addr)
return kern_size;
}
static int load_initrd(struct linux_header *hdr, struct sys_info *info,
uint32_t kern_end, struct linux_params *params, const char *initrd_file)
static int load_initrd(struct linux_header *hdr, uint32_t kern_end,
struct linux_params *params, const char *initrd_file)
{
uint32_t max;
uint32_t start, end, size;
@@ -549,7 +549,7 @@ static void hardware_setup(void)
}
/* Start Linux */
static int start_linux(uint32_t kern_addr, struct linux_params *params)
static int start_linux(uint32_t kern_addr)
{
struct context *ctx;
//extern int cursor_x, cursor_y;
@@ -579,13 +579,12 @@ static int start_linux(uint32_t kern_addr, struct linux_params *params)
return ctx->regs[REG_O0];
}
int linux_load(struct sys_info *info, const char *file, const char *cmdline,
const void *romvec)
int linux_load(struct sys_info *info, const char *file, const char *cmdline)
{
struct linux_header hdr;
struct linux_params *params;
uint32_t kern_addr, kern_size;
char *initrd_file = 0;
char *initrd_file = NULL;
if (!file_open(file))
return -1;
@@ -610,7 +609,7 @@ int linux_load(struct sys_info *info, const char *file, const char *cmdline,
}
if (initrd_file) {
if (load_initrd(&hdr, info, kern_addr+kern_size, params, initrd_file)
if (load_initrd(&hdr, kern_addr+kern_size, params, initrd_file)
!= 0) {
free(initrd_file);
return -1;
@@ -620,6 +619,6 @@ int linux_load(struct sys_info *info, const char *file, const char *cmdline,
hardware_setup();
start_linux(kern_addr, params);
start_linux(kern_addr);
return 0;
}

View File

@@ -257,18 +257,14 @@ static int obp_nbputchar(int ch)
static void obp_reboot(char *str)
{
extern volatile unsigned int *reset_reg;
printk("rebooting (%s)\n", str);
*reset_reg = 1;
printk("reboot failed\n");
for (;;) {}
}
extern volatile unsigned char *power_reg;
static void obp_abort(void)
{
printk("abort, power off\n");
*power_reg = 1;
printk("power off failed\n");

View File

@@ -3,6 +3,7 @@
#include "elf_boot.h"
#include "sys_info.h"
#include "context.h"
#include "boot.h"
#define printf printk
#ifdef CONFIG_DEBUG_BOOT
@@ -20,7 +21,6 @@ void collect_sys_info(struct sys_info *info)
int i;
unsigned long long total = 0;
struct memrange *mmap;
extern struct elf_image_note elf_image_notes;
/* Pick up paramters given by bootloader to us */
//info->boot_type = boot_ctx->eax;

View File

@@ -52,7 +52,7 @@ static int check_mem_ranges(struct sys_info *info,
return 0;
}
int aout_load(struct sys_info *info, const char *filename, const char *cmdline)
int aout_load(struct sys_info *info, const char *filename)
{
int retval = -1;
int image_retval;
@@ -60,7 +60,7 @@ int aout_load(struct sys_info *info, const char *filename, const char *cmdline)
unsigned long start, size;
unsigned int offset;
image_name = image_version = 0;
image_name = image_version = NULL;
if (!file_open(filename))
goto out;

View File

@@ -85,9 +85,8 @@ void boot(void)
if (elf_load(&sys_info, path, param) == LOADER_NOT_SUPPORT)
if (linux_load(&sys_info, path, param) == LOADER_NOT_SUPPORT)
if (aout_load(&sys_info, path, param) == LOADER_NOT_SUPPORT)
if (fcode_load(&sys_info, path, param)
== LOADER_NOT_SUPPORT) {
if (aout_load(&sys_info, path) == LOADER_NOT_SUPPORT)
if (fcode_load(path) == LOADER_NOT_SUPPORT) {
sprintf(altpath, "%s:d", path);
@@ -95,9 +94,9 @@ void boot(void)
== LOADER_NOT_SUPPORT)
if (linux_load(&sys_info, altpath, param)
== LOADER_NOT_SUPPORT)
if (aout_load(&sys_info, altpath, param)
if (aout_load(&sys_info, altpath)
== LOADER_NOT_SUPPORT)
if (fcode_load(&sys_info, path, param)
if (fcode_load(altpath)
== LOADER_NOT_SUPPORT)
printk("Unsupported image format\n");
}

View File

@@ -6,21 +6,32 @@
* the copyright and warranty status of this work.
*/
int forth_load(struct sys_info *info, const char *filename, const char *cmdline);
int elf_load(struct sys_info *info, const char *filename, const char *cmdline);
int linux_load(struct sys_info *info, const char *file, const char *cmdline);
int aout_load(struct sys_info *info, const char *filename, const char *cmdline);
int fcode_load(struct sys_info *info, const char *filename,
const char *cmdline);
// forthload.c
int forth_load(const char *filename);
// elfload.c
int elf_load(struct sys_info *info, const char *filename, const char *cmdline);
// aout_load.c
int aout_load(struct sys_info *info, const char *filename);
// linux_load.c
int linux_load(struct sys_info *info, const char *file, const char *cmdline);
// fcodeload.c
int fcode_load(const char *filename);
// context.c
uint64_t start_elf(uint64_t entry_point, uint64_t param);
void boot(void);
// boot.c
extern struct sys_info sys_info;
extern uint64_t kernel_image;
extern uint64_t kernel_size;
extern uint64_t qemu_cmdline;
extern uint64_t cmdline_size;
extern char boot_device;
extern struct sys_info sys_info;
void boot(void);
// console.c
void ob_su_init(uint64_t base, uint64_t offset, int intr);

View File

@@ -22,7 +22,7 @@ void __exit_context(void); /* assembly routine */
* It is placed at the bottom of our stack, and loaded by assembly routine
* to start us up.
*/
struct context main_ctx = {
static struct context main_ctx = {
.regs[REG_SP] = (uint64_t) &_estack - 2047 - 96,
.pc = (uint64_t) start_main,
.npc = (uint64_t) start_main + 4,

View File

@@ -26,7 +26,7 @@ static void *calloc(size_t nmemb, size_t size)
if (alloc_size < nmemb || alloc_size < size) {
printf("calloc overflow: %u, %u\n", nmemb, size);
return 0;
return NULL;
}
mem = malloc(alloc_size);
@@ -313,7 +313,7 @@ int elf_load(struct sys_info *info, const char *filename, const char *cmdline)
int image_retval;
unsigned int offset;
image_name = image_version = 0;
image_name = image_version = NULL;
if (!file_open(filename))
goto out;

View File

@@ -11,8 +11,7 @@
#define printf printk
#define debug printk
int fcode_load(struct sys_info *info, const char *filename,
const char *cmdline)
int fcode_load(const char *filename)
{
int retval = -1;
uint8_t fcode_header[8];

View File

@@ -16,7 +16,7 @@
#define debug printk
static char *forthtext=NULL;
int forth_load(struct sys_info *info, const char *filename, const char *cmdline)
int forth_load(const char *filename)
{
char magic[2];
unsigned long forthsize;

View File

@@ -156,7 +156,7 @@ struct linux_params {
uint8_t reserved17[1792]; /* 0x900 - 0x1000 */
};
uint64_t forced_memsize;
static uint64_t forced_memsize;
/* Load the first part the file and check if it's Linux */
static uint32_t load_linux_header(struct linux_header *hdr)
@@ -293,14 +293,14 @@ static char *parse_command_line(const char *orig_cmdline, char *kern_cmdline)
unsigned long len;
int k_len;
int to_kern;
char *initrd = 0;
char *initrd = NULL;
int toolong = 0;
forced_memsize = 0;
if (!orig_cmdline) {
*kern_cmdline = 0;
return 0;
*kern_cmdline = '\0';
return NULL;
}
k_len = 0;
@@ -327,7 +327,7 @@ static char *parse_command_line(const char *orig_cmdline, char *kern_cmdline)
val = sep + 1;
len = end - val;
} else {
val = 0;
val = NULL;
len = 0;
}
@@ -584,7 +584,7 @@ int linux_load(struct sys_info *info, const char *file, const char *cmdline)
struct linux_header hdr;
struct linux_params *params;
uint32_t kern_addr, kern_size;
char *initrd_file = 0;
char *initrd_file = NULL;
if (!file_open(file))
return -1;

View File

@@ -21,7 +21,6 @@ void collect_sys_info(struct sys_info *info)
int i;
unsigned long long total = 0;
struct memrange *mmap;
extern struct elf_image_note elf_image_notes;
/* Pick up paramters given by bootloader to us */
//info->boot_type = boot_ctx->eax;

View File

@@ -39,8 +39,6 @@ do { printk("ADB - %s: " fmt, __func__ , ##args); } while (0)
#define ADB_DPRINTF(fmt, args...) do { } while (0)
#endif
static void adb_read(void);
DECLARE_UNNAMED_NODE( keyboard, INSTALL_OPEN, sizeof(int));
static void
@@ -447,7 +445,6 @@ struct adb_kbd_t {
int next_key;
};
static adb_kbd_t *my_adb_kbd = NULL;
static adb_dev_t *my_adb_dev = NULL;
static int adb_kbd_read (void *private)
@@ -504,7 +501,7 @@ void *adb_kbd_new (char *path, void *private)
set_property(ph, "device_type", "keyboard", 9);
props[0] = __cpu_to_be32(dev->addr);
set_property(ph, "reg", &props, sizeof(props));
set_property(ph, "reg", (char *)&props, sizeof(props));
aliases = find_dev("/aliases");
set_property(aliases, "adb-keyboard", buf, strlen(buf) + 1);
@@ -542,14 +539,12 @@ mouse_close(int *idx)
{
}
static void mouse_read(void);
NODE_METHODS( mouse ) = {
{ "open", mouse_open },
{ "close", mouse_close },
};
void *adb_mouse_new (char *path, void *private)
void adb_mouse_new (char *path, void *private)
{
char buf[64];
int props[1];
@@ -563,7 +558,7 @@ void *adb_mouse_new (char *path, void *private)
set_property(ph, "device_type", "mouse", 6);
props[0] = __cpu_to_be32(dev->addr);
set_property(ph, "reg", &props, sizeof(props));
set_property(ph, "reg", (char *)&props, sizeof(props));
set_int_property(ph, "#buttons", 3);
aliases = find_dev("/aliases");

View File

@@ -101,5 +101,6 @@ static inline int adb_reg_set (adb_dev_t *dev, uint8_t reg,
void *adb_kbd_new (char *path, void *private);
void adb_mouse_new (char *path, void *private);
#endif /* !defined(__OHW_ADB_H__) */

View File

@@ -171,7 +171,7 @@ ob_cuda_initialize (int *idx)
props[0] = __cpu_to_be32(IO_CUDA_OFFSET);
props[1] = __cpu_to_be32(IO_CUDA_SIZE);
set_property(ph, "reg", &props, sizeof(props));
set_property(ph, "reg", (char *)&props, sizeof(props));
set_int_property(ph, "interrupt-parent", pic_handle);
// HEATHROW
set_int_property(ph, "interrupts", 0x12);

View File

@@ -62,7 +62,7 @@ typedef struct esp_private {
sd_private_t sd[8];
} esp_private_t;
esp_private_t *global_esp;
static esp_private_t *global_esp;
/* DECLARE data structures for the nodes. */
DECLARE_UNNAMED_NODE(ob_sd, INSTALL_OPEN, sizeof(sd_private_t *));
@@ -304,7 +304,7 @@ espdma_init(unsigned int slot, uint64_t base, unsigned long offset,
{
espdma->regs = (void *)map_io(base + (uint64_t)offset, 0x10);
if (espdma->regs == 0) {
if (espdma->regs == NULL) {
DPRINTF("espdma_init: cannot map registers\n");
return -1;
}
@@ -437,7 +437,7 @@ ob_esp_init(unsigned int slot, uint64_t base, unsigned long espoffset,
/* Get the IO region */
esp->ll = (void *)map_io(base + (uint64_t)espoffset,
sizeof(struct esp_regs));
if (esp->ll == 0) {
if (esp->ll == NULL) {
DPRINTF("Can't map ESP registers\n");
return -1;
}

View File

@@ -41,7 +41,7 @@ struct mem {
};
struct mem cmem; /* Current memory, virtual */
struct mem cio; /* Current I/O space */
static struct mem cio; /* Current I/O space */
unsigned int va_shift;
@@ -59,7 +59,7 @@ struct iommu {
struct mem bmap;
};
struct iommu ciommu;
static struct iommu ciommu;
static struct iommu_regs *regs;
static void iommu_init(struct iommu *t, uint64_t base);
@@ -95,7 +95,7 @@ mem_alloc(struct mem *t, int size, int align)
if ((unsigned long)p >= (unsigned long)t->uplim ||
(unsigned long)p + size > (unsigned long)t->uplim)
return 0;
return NULL;
t->curp = p + size;
return p;
@@ -106,7 +106,7 @@ mem_zalloc(struct mem *t, int size, int align)
{
char *p;
if ((p = mem_alloc(t, size, align)) != 0)
if ((p = mem_alloc(t, size, align)) != NULL)
memset(p, 0, size);
return p;
@@ -124,7 +124,7 @@ find_pte(unsigned long va, int alloc)
if (alloc) {
p = mem_zalloc(&cmem, SRMMU_PTRS_PER_PMD * sizeof(int),
SRMMU_PTRS_PER_PMD * sizeof(int));
if (p == 0)
if (p == NULL)
return -1;
pte = SRMMU_ET_PTD | ((va2pa((unsigned long)p)) >> 4);
l1[(va >> SRMMU_PGDIR_SHIFT) & (SRMMU_PTRS_PER_PGD - 1)] = pte;
@@ -141,7 +141,7 @@ find_pte(unsigned long va, int alloc)
if (alloc) {
p = mem_zalloc(&cmem, SRMMU_PTRS_PER_PTE * sizeof(void *),
SRMMU_PTRS_PER_PTE * sizeof(void *));
if (p == 0)
if (p == NULL)
return -2;
pte = SRMMU_ET_PTD | ((va2pa((unsigned int)p)) >> 4);
*(uint32_t *)pa2va(pa) = pte;
@@ -199,7 +199,7 @@ map_io(uint64_t pa, int size)
pa &= ~(PAGE_SIZE - 1);
va = mem_alloc(&cio, npages * PAGE_SIZE, PAGE_SIZE);
if (va == 0)
if (va == NULL)
return va;
mva = (unsigned int) va;
@@ -435,12 +435,12 @@ dvma_alloc(int size, unsigned int *pphys)
npages = (size + (PAGE_SIZE-1)) / PAGE_SIZE;
va = mem_alloc(&cmem, npages * PAGE_SIZE, PAGE_SIZE);
if (va == 0)
return 0;
if (va == NULL)
return NULL;
ba = (unsigned int)mem_alloc(&t->bmap, npages * PAGE_SIZE, PAGE_SIZE);
if (ba == 0)
return 0;
return NULL;
pa = (unsigned int)va2pa((unsigned long)va);
@@ -484,7 +484,7 @@ iommu_init(struct iommu *t, uint64_t base)
unsigned int tmp;
regs = map_io(base, IOMMU_REGS);
if (regs == 0) {
if (regs == NULL) {
DPRINTF("Cannot map IOMMU\n");
for (;;) { }
}
@@ -505,7 +505,7 @@ iommu_init(struct iommu *t, uint64_t base)
/* Allocate IOMMU page table */
/* Thremendous alignment causes great waste... */
ptsize = (t->vasize/PAGE_SIZE) * sizeof(int);
if ((ptab = mem_zalloc(&cmem, ptsize, ptsize)) == 0) {
if ((ptab = mem_zalloc(&cmem, ptsize, ptsize)) == NULL) {
DPRINTF("Cannot allocate IOMMU table [0x%x]\n", ptsize);
for (;;) { }
}

View File

@@ -325,7 +325,7 @@ ob_eccmemctl_init(void)
}
static unsigned char *nvram;
ohwcfg_v3_t nv_info;
static ohwcfg_v3_t nv_info;
#define NVRAM_OB_START (sizeof(ohwcfg_v3_t) + sizeof(struct sparc_arch_cfg))
#define NVRAM_OB_SIZE ((NVRAM_IDPROM - NVRAM_OB_START) & ~15)
@@ -807,15 +807,6 @@ id_machine(uint16_t machine_id)
static void
ob_nvram_init(uint64_t base, uint64_t offset)
{
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 char obp_stdin, obp_stdout;
extern const char *obp_stdin_path, *obp_stdout_path;
extern uint16_t graphic_depth;
const char *stdin, *stdout;
unsigned int i;
char nographic;

View File

@@ -79,7 +79,7 @@ void setup_timers(void)
* TODO: pass via lb table
*/
unsigned long get_timer_freq()
unsigned long get_timer_freq(void)
{
return 100000000 / 4;
}

View File

@@ -14,6 +14,8 @@
#ifndef VGA_H_INCL
#define VGA_H_INCL 1
#include "video_subr.h"
//#include <cpu/p5/io.h>
#define u8 unsigned char
@@ -226,9 +228,4 @@ struct screeninfo {
__u32 vmode; /* interlaced etc */
__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

@@ -235,10 +235,10 @@ struct FSysBuffer {
#define rdsk(x) ((struct RigidDiskBlock *)(x)->blockbuffer)
#define part(x) ((struct PartitionBlock *)(x)->blockbuffer)
struct FSysBuffer *fsysb;
int blockoffset; /* offset if there is an embedded RDB partition */
int rootb; /* block number of root block */
int rdbb; /* block number of rdb block */
static struct FSysBuffer *fsysb;
static int blockoffset; /* offset if there is an embedded RDB partition */
static int rootb; /* block number of root block */
static int rdbb; /* block number of rdb block */
static void initCache(void)
{
@@ -357,7 +357,7 @@ unsigned long togo;
{
disk_read_func = disk_read_hook;
cblock = getBlock(block);
disk_read_func = 0;
disk_read_func = NULL;
block = AROS_BE2LONG(extensionBlock(cblock)->extension);
togo--;
}
@@ -383,7 +383,7 @@ unsigned int readbytes = 0;
len=fsysb->file.filesize-fsysb->file.current.offset;
disk_read_func = disk_read_hook;
cblock = getBlock(fsysb->file.current.block);
disk_read_func = 0;
disk_read_func = NULL;
while (len)
{
disk_read_func = disk_read_hook;
@@ -427,7 +427,7 @@ unsigned int readbytes = 0;
fsysb->file.current.byte = 0;
fsysb->file.current.filekey--;
}
disk_read_func = 0;
disk_read_func = NULL;
len -= size;
readbytes += size;
}
@@ -580,10 +580,9 @@ int block;
return 0;
}
#ifndef STAGE1_5
static void checkPossibility(char *filename, char *bstr)
{
#ifndef STAGE1_5
char cstr[32];
if (noCaseStrCmp(filename, bstr, 1)<=0)
@@ -594,8 +593,10 @@ static void checkPossibility(char *filename, char *bstr)
cstr[bstr[0]]=0;
print_a_completion(cstr);
}
#endif
}
#else
#define checkPossibility(a, b) do { } while(0)
#endif
int affs_dir(char *dirname)
{

View File

@@ -468,7 +468,7 @@ ext2fs_read (char *buf, int len)
devread (map * (EXT2_BLOCK_SIZE (SUPERBLOCK) / DEV_BSIZE),
offset, size, buf);
disk_read_func = 0;
disk_read_func = NULL;
buf += size;
len -= size;

View File

@@ -53,8 +53,8 @@ static struct jfs_info jfs;
#define dtroot ((dtroot_t *)(&inode->di_btroot))
static ldtentry_t de_always[2] = {
{1, -1, 2, {'.', '.'}},
{1, -1, 1, {'.'}}
{1, -1, 2, {'.', '.'}, 0},
{1, -1, 1, {'.'}, 0}
};
static int

View File

@@ -691,12 +691,12 @@ read_tree_node (unsigned int blockNr, int depth)
blockNr, depth);
#endif /* REISERDEBUG */
if (! block_read (blockNr, 0, INFO->blocksize, cache))
return 0;
return NULL;
/* Make sure it has the right node level */
if (BLOCKHEAD (cache)->blk_level != depth)
{
errnum = ERR_FSYS_CORRUPT;
return 0;
return NULL;
}
INFO->blocks[depth] = blockNr;

View File

@@ -94,7 +94,7 @@ struct dmadat {
char sbbuf[SBLOCKSIZE]; /* superblock */
char secbuf[DEV_BSIZE]; /* for MBR/disklabel */
};
struct dmadat *dmadat = (struct dmadat*)FSYS_BUF;
static struct dmadat *dmadat = (struct dmadat*)FSYS_BUF;
#define SUPERBLOCK ((struct fs*)dmadat->sbbuf)

View File

@@ -74,7 +74,7 @@ vstafs_readdir (long sector)
if (FILE_INFO->type != 2)
{
errnum = ERR_FILE_NOT_FOUND;
return 0;
return NULL;
}
a1 = FILE_INFO->blocks;
@@ -105,8 +105,8 @@ vstafs_nextdir (void)
}
else
{
/* errnum =ERR_FILE_NOT_FOUND; */
return 0;
/* errnum =ERR_FILE_NOT_FOUND; */
return NULL;
}
}

View File

@@ -57,34 +57,34 @@ typedef struct fsys_entry {
static const struct fsys_entry fsys_table[] = {
# ifdef CONFIG_FSYS_FAT
{"fat", fat_mount, fat_read, fat_dir, 0, 0},
{"fat", fat_mount, fat_read, fat_dir, NULL, NULL},
# endif
# ifdef CONFIG_FSYS_EXT2FS
{"ext2fs", ext2fs_mount, ext2fs_read, ext2fs_dir, 0, 0},
{"ext2fs", ext2fs_mount, ext2fs_read, ext2fs_dir, NULL, NULL},
# endif
# ifdef CONFIG_FSYS_MINIX
{"minix", minix_mount, minix_read, minix_dir, 0, 0},
{"minix", minix_mount, minix_read, minix_dir, NULL, NULL},
# endif
# ifdef CONFIG_FSYS_REISERFS
{"reiserfs", reiserfs_mount, reiserfs_read, reiserfs_dir, 0, reiserfs_embed},
{"reiserfs", reiserfs_mount, reiserfs_read, reiserfs_dir, NULL, reiserfs_embed},
# endif
# ifdef CONFIG_FSYS_JFS
{"jfs", jfs_mount, jfs_read, jfs_dir, 0, jfs_embed},
{"jfs", jfs_mount, jfs_read, jfs_dir, NULL, jfs_embed},
# endif
# ifdef CONFIG_FSYS_XFS
{"xfs", xfs_mount, xfs_read, xfs_dir, 0, 0},
{"xfs", xfs_mount, xfs_read, xfs_dir, NULL, NULL},
# endif
# ifdef CONFIG_FSYS_UFS
{"ufs", ufs_mount, ufs_read, ufs_dir, 0, ufs_embed},
{"ufs", ufs_mount, ufs_read, ufs_dir, NULL, ufs_embed},
# endif
# ifdef CONFIG_FSYS_ISO9660
{"iso9660", iso9660_mount, iso9660_read, iso9660_dir, 0, 0},
{"iso9660", iso9660_mount, iso9660_read, iso9660_dir, NULL, NULL},
# endif
# ifdef CONFIG_FSYS_NTFS
{"ntfs", ntfs_mount, ntfs_read, ntfs_dir, 0, 0},
{"ntfs", ntfs_mount, ntfs_read, ntfs_dir, NULL, NULL},
# endif
# ifdef CONFIG_FSYS_AFFS
{"affs", affs_mount, affs_read, affs_dir, 0, 0},
{"affs", affs_mount, affs_read, affs_dir, NULL, NULL},
# endif
};
@@ -157,8 +157,9 @@ static int
grubfs_file_read( file_desc_t *fd, void *buf, size_t count )
{
grubfile_t *file = (grubfile_t*)fd;
curfs = (grubfs_t *)file->fs->fs_data;
int ret;
int ret;
curfs = (grubfs_t *)file->fs->fs_data;
filepos=file->pos;
filemax=file->len;
@@ -186,8 +187,9 @@ static file_desc_t *
open_path( fs_ops_t *fs, const char *path )
{
grubfile_t *ret = NULL;
char *s = (char *)path;
curfs = (grubfs_t *)fs->fs_data;
char *s=(char *)path;
while(*s) {
if(*s=='\\') *s='/';

View File

@@ -114,12 +114,6 @@ static inline node_buf* node_buf_get(node_cache* cache, int i)
{
return (node_buf*) (cache->buffers + (i * cache->nodebufsize));
}
/* flush the cache NYI */
static void node_cache_flush(node_cache* cache)
{
// NYI
}
/* flush the node at index */
static void node_cache_flush_node(node_cache* cache, int index)
@@ -132,7 +126,6 @@ static void node_cache_close(node_cache* cache)
{
if (!cache->entries) // not (fully) intialized ?
return;
node_cache_flush(cache);
free(cache->entries);
}

View File

@@ -27,7 +27,6 @@
# include "hfs.h"
# include "hfsp.h"
extern int errno;
/* Last error is eventually found here */
extern const char *hfsp_error;

View File

@@ -114,8 +114,8 @@ volume_readfork(void *p, hfsp_fork_raw* f)
*
* ToDo: add more consitency checks.
*/
static int
volume_readbuf(volume * vol, hfsp_vh* vh, char * p)
static int
volume_readbuf(hfsp_vh* vh, char * p)
{
if( (vh->signature = bswabU16_inc(p)) != HFSP_VOLHEAD_SIG)
HFSP_ERROR(-1, "This is not a HFS+ volume");
@@ -159,7 +159,7 @@ volume_read(volume * vol, hfsp_vh* vh, UInt32 block)
if( volume_readinbuf(vol, buf, block))
return -1;
return volume_readbuf(vol, vh, buf);
return volume_readbuf(vh, buf);
}
/* Find out wether the volume is wrapped and unwrap it eventually */
@@ -200,7 +200,7 @@ volume_read_wrapper(volume * vol, hfsp_vh* vh)
}
else if( signature == HFSP_VOLHEAD_SIG) { /* Native HFS+ volume */
p = buf; // Restore to begin of block
return volume_readbuf(vol, vh, p);
return volume_readbuf(vh, p);
} else
HFSP_ERROR(-1, "Neither Wrapper nor native HFS+ volume header found");
fail:

View File

@@ -100,5 +100,6 @@ typedef struct Elf_Nhdr
#define EB_IA64_IMAGE_HANDLE 0x00000007
#define EB_I386_MEMMAP 0x00000008
extern const struct elf_image_note elf_image_notes;
#endif /* ELF_BOOT_H */

View File

@@ -17,6 +17,8 @@
#ifndef _H_STRING
#define _H_STRING
#include "openbios/config.h"
#define bzero(s,n) memset( s, 0, n )
#define atol(nptr) strtol(nptr, NULL, 10 )
@@ -95,5 +97,6 @@ static inline unsigned char __toupper(unsigned char c) {
#define tolower(c) __tolower(c)
#define toupper(c) __toupper(c)
extern int errno_int;
#endif /* _H_STRING */

View File

@@ -13,6 +13,7 @@
#ifdef CONFIG_DRIVER_PCI
int ob_pci_init(void);
void macio_nvram_init(char *path, uint32_t addr);
#endif
#ifdef CONFIG_DRIVER_SBUS
int ob_sbus_init(uint64_t base, int machine_id);
@@ -38,6 +39,17 @@ int ob_obio_init(uint64_t slavio_base, unsigned long fd_offset,
int start_cpu(unsigned int pc, unsigned int context_ptr, unsigned int context,
int cpu);
extern struct mem cmem;
extern uint16_t graphic_depth;
extern volatile unsigned char *power_reg;
extern volatile unsigned int *reset_reg;
extern const char *obp_stdin_path, *obp_stdout_path;
extern char obp_stdin, obp_stdout;
extern volatile struct sun4m_timer_regs *counter_regs;
extern uint32_t kernel_image;
extern uint32_t kernel_size;
extern uint32_t qemu_cmdline;
extern uint32_t cmdline_size;
extern char boot_device;
#endif
#ifdef CONFIG_DRIVER_FLOPPY
int ob_floppy_init(void);

View File

@@ -18,7 +18,7 @@
#include "cross.h"
unsigned char *dict = 0;
unsigned char *dict = NULL;
ucell *last;
cell dicthead = 0;

View File

@@ -24,7 +24,7 @@ extern ucell *trampoline;
* point behind the pointer.
*/
static ucell t[] = { DOCOL, 0, (ucell)(t+3), 0 };
ucell *trampoline = t;
static ucell *trampoline = t;
#endif
#ifndef CONFIG_DEBUG_INTERPRETER
@@ -287,7 +287,7 @@ static void doplusloop(void)
#ifndef FCOMPILER
static ucell get_myself(void)
{
static ucell **myself = 0;
static ucell **myself = NULL;
if( !myself )
myself = (ucell**)findword("my-self") + 1;
return (*myself && **myself) ? (ucell)**myself : 0;

View File

@@ -17,7 +17,7 @@
#include "openbios/config.h"
#include "libc/string.h"
int errno;
int errno_int;
void
qsort( void *base, size_t nmemb, size_t size, int (*compar)(const void *, const void*) )

View File

@@ -50,7 +50,7 @@ int strnicmp(const char *s1, const char *s2, size_t len)
return (int)c1 - (int)c2;
}
char * ___strtok;
static char * ___strtok;
/**
* strcpy - Copy a %NUL terminated string

View File

@@ -63,7 +63,7 @@ static char * number(char * buf, char * end, long long num, int base, int size,
if (type & LEFT)
type &= ~ZEROPAD;
if (base < 2 || base > 36)
return 0;
return NULL;
c = (type & ZEROPAD) ? '0' : ' ';
sign = 0;
if (type & SIGN) {

View File

@@ -120,7 +120,7 @@ history_get( cmdline_info_t *ci, int n )
ci->buf[0] = 0;
if( !p )
return 0;
return NULL;
for( len=0; len <= ci->ncol && p[len] != '\n' && p[len] ; len++ )
;

View File

@@ -41,11 +41,13 @@ video_get_res( int *w, int *h )
static void
startup_splash( void )
{
#ifdef CONFIG_MOL
int fd, s, i, y, x, dx, dy;
int width, height;
char *pp, *p;
char buf[64];
#endif
/* only draw logo in 24-bit mode (for now) */
if( video.fb.depth < 15 )
return;
@@ -247,7 +249,7 @@ static void
video_write(void)
{
char *addr;
int i, len;
int len;
len = GETTOS();
addr = pop_fstr_copy();