Fix some Sparc64 compile warnings

git-svn-id: svn://coreboot.org/openbios/openbios-devel@190 f158a5a8-5612-0410-a976-696ce0be7e32
This commit is contained in:
Blue Swirl
2008-07-07 18:36:16 +00:00
parent 5205e45840
commit 3409ec8b13
22 changed files with 88 additions and 93 deletions

View File

@@ -7,18 +7,14 @@
#include "openbios/elfload.h"
#include "openbios/nvram.h"
#include "libc/diskio.h"
#include "libc/vsprintf.h"
#include "sys_info.h"
int elf_load(struct sys_info *, const char *filename, const char *cmdline);
int aout_load(struct sys_info *, const char *filename, const char *cmdline);
int linux_load(struct sys_info *, const char *filename, const char *cmdline);
void boot(void);
#include "boot.h"
struct sys_info sys_info;
uint64_t kernel_image;
uint64_t kernel_size;
uint64_t cmdline;
uint64_t qemu_cmdline;
uint64_t cmdline_size;
char boot_device;
@@ -60,7 +56,7 @@ void boot(void)
*param = '\0';
param++;
} else if (cmdline_size) {
param = (char *)cmdline;
param = (char *)qemu_cmdline;
}
printk("[sparc64] Booting file '%s' ", path);

View File

@@ -10,11 +10,13 @@ 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);
unsigned int start_elf(unsigned long entry_point, unsigned long param);
uint64_t start_elf(uint64_t entry_point, uint64_t param);
void boot(void);
extern uint64_t kernel_image;
extern uint64_t kernel_size;
extern uint64_t cmdline;
extern uint64_t qemu_cmdline;
extern uint64_t cmdline_size;
extern char boot_device;
extern struct sys_info sys_info;

View File

@@ -6,6 +6,8 @@
#include "openbios/config.h"
#include "openbios/kernel.h"
#include "context.h"
#include "sys_info.h"
#include "boot.h"
#define MAIN_STACK_SIZE 16384
#define IMAGE_STACK_SIZE 4096
@@ -20,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.
*/
const struct context main_ctx = {
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

@@ -11,10 +11,10 @@
#include "sys_info.h"
#include "ipchecksum.h"
#include "loadfs.h"
#include "boot.h"
#define printf printk
#define debug printk
extern unsigned int start_elf(unsigned long entry_point, unsigned long param);
#define addr_fixup(addr) ((addr) & 0x00ffffff)
static char *image_name, *image_version;
@@ -92,7 +92,7 @@ static unsigned long process_image_notes(Elf_phdr *phdr, int phnum,
continue;
buf = malloc(phdr[i].p_filesz);
file_seek(offset + phdr[i].p_offset);
if (lfile_read(buf, phdr[i].p_filesz) != phdr[i].p_filesz) {
if ((uint64_t)lfile_read(buf, phdr[i].p_filesz) != phdr[i].p_filesz) {
printf("Can't read note segment\n");
goto out;
}
@@ -150,7 +150,7 @@ static int load_segments(Elf_phdr *phdr, int phnum,
i, addr_fixup(phdr[i].p_paddr), phdr[i].p_filesz, phdr[i].p_memsz);
file_seek(offset + phdr[i].p_offset);
debug("loading... ");
if (lfile_read(phys_to_virt(addr_fixup(phdr[i].p_paddr)), phdr[i].p_filesz)
if ((uint64_t)lfile_read(phys_to_virt(addr_fixup(phdr[i].p_paddr)), phdr[i].p_filesz)
!= phdr[i].p_filesz) {
printf("Can't read program segment %d\n", i);
return 0;
@@ -320,7 +320,7 @@ int elf_load(struct sys_info *info, const char *filename, const char *cmdline)
goto out;
for (offset = 0; offset < 16 * 512; offset += 512) {
if (lfile_read(&ehdr, sizeof ehdr) != sizeof ehdr) {
if ((size_t)lfile_read(&ehdr, sizeof ehdr) != sizeof ehdr) {
debug("Can't read ELF header\n");
retval = LOADER_NOT_SUPPORT;
goto out;
@@ -351,7 +351,7 @@ int elf_load(struct sys_info *info, const char *filename, const char *cmdline)
phdr_size = ehdr.e_phnum * sizeof *phdr;
phdr = malloc(phdr_size);
file_seek(offset + ehdr.e_phoff);
if (lfile_read(phdr, phdr_size) != phdr_size) {
if ((unsigned long)lfile_read(phdr, phdr_size) != phdr_size) {
printf("Can't read program header\n");
goto out;
}

View File

@@ -50,7 +50,7 @@ void *malloc(int size)
if(memsize>=size) {
memsize-=size;
ret=memptr;
memptr+=size;
memptr = (void *)((unsigned long)memptr + size);
}
return ret;
}
@@ -59,7 +59,3 @@ void free(void *ptr)
{
/* Nothing yet */
}
unsigned long map_page(unsigned long va, unsigned long epa, int type)
{
}

View File

@@ -14,6 +14,7 @@
#include "sys_info.h"
#include "context.h"
#include "loadfs.h"
#include "boot.h"
#define printf printk
#define debug printk
@@ -355,7 +356,7 @@ static char *parse_command_line(const char *orig_cmdline, char *kern_cmdline)
printf("Garbage after mem=<size>, ignored\n");
forced_memsize = 0;
}
debug("mem=%Lu\n", forced_memsize);
debug("mem=%llu\n", (unsigned long long)forced_memsize);
}
/* mem= is for both loader and kernel */
to_kern = 1;
@@ -424,7 +425,7 @@ static int load_linux_kernel(struct linux_header *hdr, uint32_t kern_addr)
#endif
printf("Loading kernel... ");
if (lfile_read(phys_to_virt(kern_addr), kern_size) != kern_size) {
if ((uint32_t)lfile_read(phys_to_virt(kern_addr), kern_size) != kern_size) {
printf("Can't read kernel\n");
return 0;
}
@@ -433,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;
@@ -497,7 +498,7 @@ static int load_initrd(struct linux_header *hdr, struct sys_info *info,
}
printf("Loading initrd... ");
if (lfile_read(phys_to_virt(start), size) != size) {
if ((uint32_t)lfile_read(phys_to_virt(start), size) != size) {
printf("Can't read initrd\n");
return -1;
}
@@ -548,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;
@@ -573,7 +574,7 @@ static int start_linux(uint32_t kern_addr, struct linux_params *params)
ctx = switch_to(ctx);
/* It's impossible but... */
printf("Returned with o0=%#x\n", ctx->regs[REG_O0]);
printf("Returned with o0=%#lx\n", ctx->regs[REG_O0]);
return ctx->regs[REG_O0];
}
@@ -608,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;
@@ -618,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

@@ -2,6 +2,4 @@ int file_open(const char *filename);
int lfile_read(void *buf, unsigned long len);
int file_seek(unsigned long offset);
unsigned long file_size(void);
void file_close(void);

View File

@@ -13,12 +13,14 @@
#include "dict.h"
#include "openbios/kernel.h"
#include "openbios/stack.h"
#include "openbios/nvram.h"
#include "sys_info.h"
#include "openbios.h"
#include "libc/byteorder.h"
#define cpu_to_be16(x) __cpu_to_be16(x)
#include "openbios/firmware_abi.h"
#include "boot.h"
void boot(void);
#include "../../drivers/timer.h" // XXX
static unsigned char intdict[256 * 1024];
@@ -122,9 +124,9 @@ id_cpu(void)
void arch_nvram_get(char *data)
{
unsigned short i;
unsigned char *nvptr = &nv_info;
unsigned char *nvptr = (unsigned char *)&nv_info;
uint32_t size;
struct cpudef *cpu;
const struct cpudef *cpu;
for (i = 0; i < sizeof(ohwcfg_v3_t); i++) {
outb(i & 0xff, 0x74);
@@ -146,13 +148,13 @@ void arch_nvram_get(char *data)
size = nv_info.cmdline_size;
if (size > OBIO_CMDLINE_MAX - 1)
size = OBIO_CMDLINE_MAX - 1;
memcpy(obio_cmdline, (void *)nv_info.cmdline, size);
memcpy(&obio_cmdline, (void *)(long)nv_info.cmdline, size);
obio_cmdline[size] = '\0';
cmdline = obio_cmdline;
qemu_cmdline = (uint64_t)obio_cmdline;
cmdline_size = size;
boot_device = nv_info.boot_devices[0];
printk("kernel addr %x size %x\n", kernel_image, kernel_size);
printk("kernel addr %lx size %lx\n", kernel_image, kernel_size);
if (size)
printk("kernel cmdline %s\n", obio_cmdline);
@@ -178,16 +180,16 @@ void arch_nvram_put(char *data)
}
}
int arch_nvram_size()
int arch_nvram_size(void)
{
return NVRAM_OB_SIZE;
}
void setup_timers()
void setup_timers(void)
{
}
void udelay()
void udelay(unsigned int usecs)
{
}
@@ -208,8 +210,6 @@ static void init_memory(void)
static void
arch_init( void )
{
void setup_timers(void);
modules_init();
#ifdef CONFIG_DRIVER_PCI
ob_pci_init();