aboutsummaryrefslogtreecommitdiff
path: root/sys/boot/uboot/lib
diff options
context:
space:
mode:
authorRafal Jaworowski <raj@FreeBSD.org>2008-09-03 15:39:50 +0000
committerRafal Jaworowski <raj@FreeBSD.org>2008-09-03 15:39:50 +0000
commitaa8fb78b88b1049db923d9e691f280eab8c29463 (patch)
tree892bb1df63c93744c5e68f7e56ba2072cc220c72 /sys/boot/uboot/lib
parent1b217218d501bf6ce346379a51833191f8ab36f0 (diff)
downloadsrc-aa8fb78b88b1049db923d9e691f280eab8c29463.tar.gz
src-aa8fb78b88b1049db923d9e691f280eab8c29463.zip
Move U-Boot compatibility library to WARNS=2 level.
Notes
Notes: svn path=/head/; revision=182723
Diffstat (limited to 'sys/boot/uboot/lib')
-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
7 files changed, 45 insertions, 33 deletions
diff --git a/sys/boot/uboot/lib/Makefile b/sys/boot/uboot/lib/Makefile
index 5e66bfb0a01c..894784f34364 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 edc3c31e85cb..f49f455c7efa 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 31da24063e8c..222c31453722 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 a7d0868f9881..72aff3b55c07 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 6e05e738eb3d..5902a1b24927 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 6271ed1c9565..9f4d277eb6f9 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 f1cf7ee5af39..b7c3fe8ca4da 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