Move U-Boot compatibility library to WARNS=2 level.

This commit is contained in:
Rafal Jaworowski 2008-09-03 15:39:50 +00:00
parent 1b217218d5
commit aa8fb78b88
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=182723
8 changed files with 49 additions and 40 deletions

View File

@ -46,8 +46,6 @@ extern char bootprog_rev[];
extern char bootprog_date[];
extern char bootprog_maker[];
static char bootargs[128];
extern unsigned char _etext[];
extern unsigned char _edata[];
extern unsigned char __bss_start[];
@ -110,10 +108,8 @@ memsize(int flags)
int
main(void)
{
char **bargv;
char *ch;
int bargc, i;
struct api_signature *sig = NULL;
int i;
if (!api_search_sig(&sig))
return -1;
@ -134,7 +130,7 @@ main(void)
*/
cons_probe();
printf("Compatible API signature found @%x\n", sig);
printf("Compatible API signature found @%x\n", (uint32_t)sig);
dump_sig(sig);
dump_addr_info();
@ -205,7 +201,8 @@ COMMAND_SET(heap, "heap", "show heap usage", command_heap);
static int
command_heap(int argc, char *argv[])
{
printf("heap base at %p, top at %p, used %ld\n", end, sbrk(0),
printf("heap base at %p, top at %p, used %d\n", end, sbrk(0),
sbrk(0) - end);
return(CMD_OK);

View File

@ -2,6 +2,7 @@
LIB= uboot
INTERNALLIB=
WARNS?= 2
SRCS= devicename.c elf_freebsd.c console.c copy.c disk.c \
module.c net.c reboot.c time.c glue.c

View File

@ -29,6 +29,7 @@ __FBSDID("$FreeBSD$");
#include <stand.h>
#include "bootstrap.h"
#include "glue.h"
int console;
@ -60,7 +61,7 @@ static int
uboot_cons_init(int arg)
{
return 0;
return (0);
}
static void

View File

@ -31,6 +31,7 @@ __FBSDID("$FreeBSD$");
#include <sys/param.h>
#include <sys/linker.h>
#include <machine/md_var.h>
#include <machine/metadata.h>
#include <machine/elf.h>
@ -38,11 +39,13 @@ __FBSDID("$FreeBSD$");
#include "bootstrap.h"
extern vm_offset_t md_load(char *, vm_offset_t *);
int
__elfN(uboot_load)(char *filename, u_int64_t dest,
struct preloaded_file **result)
{
int r;
int r;
r = __elfN(loadfile)(filename, dest, result);
if (r != 0)
@ -62,20 +65,20 @@ __elfN(uboot_load)(char *filename, u_int64_t dest,
int
__elfN(uboot_exec)(struct preloaded_file *fp)
{
struct file_metadata *fmp;
vm_offset_t mdp;
Elf_Ehdr *e;
int error;
struct file_metadata *fmp;
vm_offset_t mdp;
Elf_Ehdr *e;
int error;
if ((fmp = file_findmetadata(fp, MODINFOMD_ELFHDR)) == NULL) {
if ((fmp = file_findmetadata(fp, MODINFOMD_ELFHDR)) == NULL)
return (EFTYPE);
}
e = (Elf_Ehdr *)&fmp->md_data;
if ((error = md_load(fp->f_args, &mdp)) != 0)
return (error);
printf("Kernel entry at 0x%lx ...\n", e->e_entry);
printf("Kernel entry at 0x%x ...\n", e->e_entry);
dev_cleanup();

View File

@ -33,8 +33,10 @@
#ifndef _API_GLUE_H_
#define _API_GLUE_H_
#include "api_public.h"
int syscall(int, int *, ...);
void * syscall_ptr;
void *syscall_ptr;
int api_search_sig(struct api_signature **sig);
@ -53,16 +55,16 @@ void ub_puts(const char *s);
/* system */
void ub_reset(void);
struct sys_info * ub_get_sys_info(void);
struct sys_info *ub_get_sys_info(void);
/* time */
void ub_udelay(unsigned long);
unsigned long ub_get_timer(unsigned long);
/* env vars */
char * ub_env_get(const char *name);
char *ub_env_get(const char *name);
void ub_env_set(const char *name, char *value);
const char * ub_env_enum(const char *last);
const char *ub_env_enum(const char *last);
/* devices */
int ub_dev_enum(void);

View File

@ -43,6 +43,7 @@ __FBSDID("$FreeBSD$");
#include <netif.h>
#include "api_public.h"
#include "glue.h"
#include "libuboot.h"
#define NETIF_DEBUG
@ -58,8 +59,6 @@ static int net_get(struct iodesc *, void *, size_t, time_t);
static int net_put(struct iodesc *, void *, size_t);
static void net_end(struct netif *);
struct device_info * ub_dev_get(int i);
extern int devs_no;
extern struct netif_stats net_stats[];
@ -107,13 +106,14 @@ net_match(struct netif *nif, void *machdep_hint)
static int
net_probe(struct netif *nif, void *machdep_hint)
{
struct device_info *di;
int i;
struct device_info *di;
int i;
for (i = 0; i < devs_no; i++)
if (di = ub_dev_get(i))
if ((di = ub_dev_get(i)) != NULL)
if (di->type == DEV_TYP_NET)
break;
if (i == devs_no) {
printf("net_probe: no network devices found, maybe not"
" enumerated yet..?\n");
@ -131,14 +131,14 @@ net_probe(struct netif *nif, void *machdep_hint)
static int
net_put(struct iodesc *desc, void *pkt, size_t len)
{
struct netif *nif = desc->io_netif;
struct uboot_softc *sc = nif->nif_devdata;
struct ether_header *eh;
size_t sendlen;
ssize_t rv;
struct netif *nif = desc->io_netif;
struct uboot_softc *sc = nif->nif_devdata;
size_t sendlen;
ssize_t rv;
#if defined(NETIF_DEBUG)
struct ether_header *eh;
printf("net_put: desc 0x%x, pkt 0x%x, len %d\n", desc, pkt, len);
eh = pkt;
printf("dst: %s ", ether_sprintf(eh->ether_dhost));
@ -205,14 +205,14 @@ net_get(struct iodesc *desc, void *pkt, size_t len, time_t timeout)
static void
net_init(struct iodesc *desc, void *machdep_hint)
{
struct netif *nif = desc->io_netif;
struct uboot_softc *sc;
struct device_info *di;
int err, i;
struct netif *nif = desc->io_netif;
struct uboot_softc *sc;
struct device_info *di;
int err;
sc = nif->nif_devdata = &uboot_softc;
if (err = ub_dev_open(sc->sc_handle))
if ((err = ub_dev_open(sc->sc_handle)) != 0)
panic("%s%d: initialisation failed with error %d\n",
nif->nif_driver->netif_bname, nif->nif_unit, err);
@ -240,10 +240,10 @@ net_init(struct iodesc *desc, void *machdep_hint)
static void
net_end(struct netif *nif)
{
struct uboot_softc *sc = nif->nif_devdata;
int err;
struct uboot_softc *sc = nif->nif_devdata;
int err;
if (err = ub_dev_close(sc->sc_handle))
if ((err = ub_dev_close(sc->sc_handle)) != 0)
panic("%s%d: net_end failed with error %d\n",
nif->nif_driver->netif_bname, nif->nif_unit, err);
}

View File

@ -27,6 +27,9 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
#include <stand.h>
#include "glue.h"
void
exit(int code)
{

View File

@ -30,6 +30,8 @@ __FBSDID("$FreeBSD$");
#include <stand.h>
#include "glue.h"
/*
* Return the time in seconds since the beginning of the day.
*/
@ -42,7 +44,7 @@ time(time_t *tloc)
if (tloc)
*tloc = secs;
return secs;
return (secs);
}
int