summaryrefslogtreecommitdiffstats
path: root/sys/boot/uboot
diff options
context:
space:
mode:
authorraj <raj@FreeBSD.org>2008-09-03 15:39:50 +0000
committerraj <raj@FreeBSD.org>2008-09-03 15:39:50 +0000
commitc96f761ec1a0290b67e5d8a5396d883187b67221 (patch)
tree892bb1df63c93744c5e68f7e56ba2072cc220c72 /sys/boot/uboot
parentadfbe058ec9f9187c69e93a461e063d55fe67e66 (diff)
downloadFreeBSD-src-c96f761ec1a0290b67e5d8a5396d883187b67221.zip
FreeBSD-src-c96f761ec1a0290b67e5d8a5396d883187b67221.tar.gz
Move U-Boot compatibility library to WARNS=2 level.
Diffstat (limited to 'sys/boot/uboot')
-rw-r--r--sys/boot/uboot/common/main.c11
-rw-r--r--sys/boot/uboot/lib/Makefile1
-rw-r--r--sys/boot/uboot/lib/console.c3
-rw-r--r--sys/boot/uboot/lib/elf_freebsd.c19
-rw-r--r--sys/boot/uboot/lib/glue.h10
-rw-r--r--sys/boot/uboot/lib/net.c38
-rw-r--r--sys/boot/uboot/lib/reboot.c3
-rw-r--r--sys/boot/uboot/lib/time.c4
8 files changed, 49 insertions, 40 deletions
diff --git a/sys/boot/uboot/common/main.c b/sys/boot/uboot/common/main.c
index 9b4379f..7498c76 100644
--- a/sys/boot/uboot/common/main.c
+++ b/sys/boot/uboot/common/main.c
@@ -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);
diff --git a/sys/boot/uboot/lib/Makefile b/sys/boot/uboot/lib/Makefile
index 5e66bfb..894784f 100644
--- a/sys/boot/uboot/lib/Makefile
+++ b/sys/boot/uboot/lib/Makefile
@@ -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
diff --git a/sys/boot/uboot/lib/console.c b/sys/boot/uboot/lib/console.c
index edc3c31..f49f455c 100644
--- a/sys/boot/uboot/lib/console.c
+++ b/sys/boot/uboot/lib/console.c
@@ -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
diff --git a/sys/boot/uboot/lib/elf_freebsd.c b/sys/boot/uboot/lib/elf_freebsd.c
index 31da240..222c314 100644
--- a/sys/boot/uboot/lib/elf_freebsd.c
+++ b/sys/boot/uboot/lib/elf_freebsd.c
@@ -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();
diff --git a/sys/boot/uboot/lib/glue.h b/sys/boot/uboot/lib/glue.h
index a7d0868..72aff3b 100644
--- a/sys/boot/uboot/lib/glue.h
+++ b/sys/boot/uboot/lib/glue.h
@@ -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);
diff --git a/sys/boot/uboot/lib/net.c b/sys/boot/uboot/lib/net.c
index 6e05e73..5902a1b 100644
--- a/sys/boot/uboot/lib/net.c
+++ b/sys/boot/uboot/lib/net.c
@@ -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);
}
diff --git a/sys/boot/uboot/lib/reboot.c b/sys/boot/uboot/lib/reboot.c
index 6271ed1..9f4d277 100644
--- a/sys/boot/uboot/lib/reboot.c
+++ b/sys/boot/uboot/lib/reboot.c
@@ -27,6 +27,9 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
+#include <stand.h>
+#include "glue.h"
+
void
exit(int code)
{
diff --git a/sys/boot/uboot/lib/time.c b/sys/boot/uboot/lib/time.c
index f1cf7ee..b7c3fe8 100644
--- a/sys/boot/uboot/lib/time.c
+++ b/sys/boot/uboot/lib/time.c
@@ -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
OpenPOWER on IntegriCloud