aboutsummaryrefslogtreecommitdiff
path: root/stand/libofw
diff options
context:
space:
mode:
Diffstat (limited to 'stand/libofw')
-rw-r--r--stand/libofw/Makefile6
-rw-r--r--stand/libofw/devicename.c152
-rw-r--r--stand/libofw/libofw.h14
-rw-r--r--stand/libofw/ofw_console.c32
-rw-r--r--stand/libofw/ofw_copy.c11
-rw-r--r--stand/libofw/ofw_disk.c80
-rw-r--r--stand/libofw/ofw_memory.c3
-rw-r--r--stand/libofw/ofw_module.c5
-rw-r--r--stand/libofw/ofw_net.c102
-rw-r--r--stand/libofw/ofw_reboot.c3
-rw-r--r--stand/libofw/ofw_time.c7
-rw-r--r--stand/libofw/openfirm.c17
-rw-r--r--stand/libofw/openfirm.h3
13 files changed, 239 insertions, 196 deletions
diff --git a/stand/libofw/Makefile b/stand/libofw/Makefile
index 2d3e30e1ace9..3d4c70dcfc10 100644
--- a/stand/libofw/Makefile
+++ b/stand/libofw/Makefile
@@ -1,5 +1,3 @@
-# $FreeBSD$
-
.include <bsd.init.mk>
LIB= ofw
@@ -7,10 +5,6 @@ LIB= ofw
SRCS= devicename.c ofw_console.c ofw_copy.c ofw_disk.c \
ofw_memory.c ofw_module.c ofw_net.c ofw_reboot.c \
ofw_time.c openfirm.c
-.PATH: ${ZFSSRC}
-SRCS+= devicename_stubs.c
-CFLAGS+= -I${ZFSSRC} -I${SYSDIR}/cddl/boot/zfs
-CFLAGS+= -I${SYSDIR}/cddl/contrib/opensolaris/uts/common
# Pick up the bootstrap header for some interface items
CFLAGS+= -I${LDRSRC}
diff --git a/stand/libofw/devicename.c b/stand/libofw/devicename.c
index 11c0a1719ff3..f6419632c6bc 100644
--- a/stand/libofw/devicename.c
+++ b/stand/libofw/devicename.c
@@ -24,18 +24,12 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <stand.h>
#include "bootstrap.h"
#include "libofw.h"
-#include "libzfs.h"
-
-static int ofw_parsedev(struct ofw_devdesc **, const char *, const char **);
-/*
+/*
* Point (dev) at an allocated device specifier for the device matching the
* path in (devspec). If it contains an explicit device specification,
* use that. If not, use the default device.
@@ -43,104 +37,76 @@ static int ofw_parsedev(struct ofw_devdesc **, const char *, const char **);
int
ofw_getdev(void **vdev, const char *devspec, const char **path)
{
- struct ofw_devdesc **dev = (struct ofw_devdesc **)vdev;
- int rv;
+ struct devdesc **dev = (struct devdesc **)vdev;
+ int rv;
- /*
- * If it looks like this is just a path and no
- * device, go with the current device.
- */
- if ((devspec == NULL) ||
- ((strchr(devspec, '@') == NULL) &&
- (strchr(devspec, ':') == NULL))) {
+ /*
+ * If it looks like this is just a path and no device, go with the
+ * current device.
+ */
+ if (devspec == NULL || strpbrk(devspec, ":@") == NULL) {
+ rv = devparse(dev, getenv("currdev"), NULL);
+ if (rv == 0 && path != NULL)
+ *path = devspec;
+ return (rv);
+ }
- if (((rv = ofw_parsedev(dev, getenv("currdev"), NULL)) == 0) &&
- (path != NULL))
- *path = devspec;
- return(rv);
- }
-
- /*
- * Try to parse the device name off the beginning of the devspec
- */
- return(ofw_parsedev(dev, devspec, path));
+ /*
+ * Try to parse the device name off the beginning of the devspec
+ */
+ return (devparse(dev, devspec, path));
}
/*
- * Point (dev) at an allocated device specifier matching the string version
- * at the beginning of (devspec). Return a pointer to the remaining
- * text in (path).
+ * Search the OFW (path) for a node that's of (want_type).
*/
-static int
-ofw_parsedev(struct ofw_devdesc **dev, const char *devspec, const char **path)
+phandle_t
+ofw_path_to_handle(const char *ofwpath, const char *want_type, const char **path)
{
- struct ofw_devdesc *idev;
- struct devsw *dv;
- phandle_t handle;
- const char *p;
- const char *s;
- char *ep;
- char name[256];
- char type[64];
- int err;
- int len;
- int i;
+ const char *p, *s;
+ char name[256];
+ char type[64];
+ phandle_t handle;
+ int len;
- for (p = s = devspec; *s != '\0'; p = s) {
- if ((s = strchr(p + 1, '/')) == NULL)
- s = strchr(p, '\0');
- len = s - devspec;
- bcopy(devspec, name, len);
- name[len] = '\0';
- if ((handle = OF_finddevice(name)) == -1) {
- bcopy(name, type, len);
- type[len] = '\0';
- } else if (OF_getprop(handle, "device_type", type, sizeof(type)) == -1)
- continue;
- for (i = 0; (dv = devsw[i]) != NULL; i++) {
- if (strncmp(dv->dv_name, type, strlen(dv->dv_name)) == 0)
- goto found;
+ for (p = s = ofwpath; *s != '\0'; p = s) {
+ if ((s = strchr(p + 1, '/')) == NULL)
+ s = strchr(p, '\0');
+ len = s - ofwpath;
+ if (len >= sizeof(name))
+ return ((phandle_t)-1);
+ bcopy(ofwpath, name, len);
+ name[len] = '\0';
+ if ((handle = OF_finddevice(name)) == -1)
+ continue;
+ if (OF_getprop(handle, "device_type", type, sizeof(type)) == -1)
+ continue;
+ if (strcmp(want_type, type) == 0) {
+ *path = s;
+ return (handle);
+ }
}
- }
- return(ENOENT);
-
-found:
- if (path != NULL)
- *path = s;
- idev = malloc(sizeof(struct ofw_devdesc));
- if (idev == NULL) {
- printf("ofw_parsedev: malloc failed\n");
- return ENOMEM;
- }
- strcpy(idev->d_path, name);
- idev->dd.d_dev = dv;
- if (dv->dv_type == DEVT_ZFS) {
- p = devspec + strlen(dv->dv_name);
- err = zfs_parsedev((struct zfs_devdesc *)idev, p, path);
- if (err != 0) {
- free(idev);
- return (err);
- }
- }
-
- if (dev == NULL) {
- free(idev);
- } else {
- *dev = idev;
- }
- return(0);
+ return ((phandle_t)-1);
}
int
-ofw_setcurrdev(struct env_var *ev, int flags, const void *value)
+ofw_common_parsedev(struct devdesc **dev, const char *devspec, const char **path,
+ const char *ofwtype)
{
- struct ofw_devdesc *ncurr;
- int rv;
-
- if ((rv = ofw_parsedev(&ncurr, value, NULL)) != 0)
- return (rv);
-
- free(ncurr);
+ const char *rem_path;
+ struct ofw_devdesc *idev;
- return (mount_currdev(ev, flags, value));
+ if (ofw_path_to_handle(devspec, ofwtype, &rem_path) == -1)
+ return (ENOENT);
+ idev = malloc(sizeof(struct ofw_devdesc));
+ if (idev == NULL) {
+ printf("ofw_parsedev: malloc failed\n");
+ return (ENOMEM);
+ };
+ strlcpy(idev->d_path, devspec, min(rem_path - devspec + 1,
+ sizeof(idev->d_path)));
+ *dev = &idev->dd;
+ if (path != NULL)
+ *path = rem_path;
+ return (0);
}
diff --git a/stand/libofw/libofw.h b/stand/libofw/libofw.h
index 0483c9dbf754..0f477ef66c93 100644
--- a/stand/libofw/libofw.h
+++ b/stand/libofw/libofw.h
@@ -21,13 +21,13 @@
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * $FreeBSD$
*/
#include "openfirm.h"
#include <readin.h>
+#define DEVT_OFDISK 1001
+
struct ofw_devdesc {
struct devdesc dd;
union {
@@ -43,9 +43,9 @@ struct ofw_devdesc {
};
extern int ofw_getdev(void **vdev, const char *devspec, const char **path);
-extern ev_sethook_t ofw_setcurrdev;
extern struct devsw ofwdisk;
+extern struct devsw ofw_netdev;
extern struct netif_driver ofwnet;
int ofwn_getunit(const char *);
@@ -59,13 +59,13 @@ extern int ofw_autoload(void);
void ofw_memmap(int);
+phandle_t ofw_path_to_handle(const char *ofwpath, const char *want_type, const char **path);
+int ofw_common_parsedev(struct devdesc **dev, const char *devspec, const char **path,
+ const char *ofwtype);
+
struct preloaded_file;
struct file_format;
-/* MD code implementing MI interfaces */
-vm_offset_t md_load(char *args, vm_offset_t *modulep, vm_offset_t *dtb);
-vm_offset_t md_load64(char *args, vm_offset_t *modulep, vm_offset_t *dtb);
-
extern void reboot(void);
struct ofw_reg
diff --git a/stand/libofw/ofw_console.c b/stand/libofw/ofw_console.c
index a129997c5df2..6925641eb606 100644
--- a/stand/libofw/ofw_console.c
+++ b/stand/libofw/ofw_console.c
@@ -26,9 +26,6 @@
* the rights to redistribute these changes.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/types.h>
#include "bootstrap.h"
@@ -44,14 +41,13 @@ static ihandle_t stdin;
static ihandle_t stdout;
struct console ofwconsole = {
- "ofw",
- "Open Firmware console",
- 0,
- ofw_cons_probe,
- ofw_cons_init,
- ofw_cons_putchar,
- ofw_cons_getchar,
- ofw_cons_poll,
+ .c_name = "ofw",
+ .c_desc = "Open Firmware console",
+ .c_probe = ofw_cons_probe,
+ .c_init = ofw_cons_init,
+ .c_out = ofw_cons_putchar,
+ .c_in = ofw_cons_getchar,
+ .c_ready = ofw_cons_poll,
};
static void
@@ -66,7 +62,7 @@ ofw_cons_probe(struct console *cp)
static int
ofw_cons_init(int arg)
{
- return 0;
+ return (0);
}
void
@@ -86,7 +82,7 @@ ofw_cons_putchar(int c)
static int saved_char = -1;
int
-ofw_cons_getchar()
+ofw_cons_getchar(void)
{
unsigned char ch = '\0';
int l;
@@ -94,7 +90,7 @@ ofw_cons_getchar()
if (saved_char != -1) {
l = saved_char;
saved_char = -1;
- return l;
+ return (l);
}
/* At least since version 4.0.0, QEMU became bug-compatible
@@ -108,17 +104,17 @@ ofw_cons_getchar()
}
int
-ofw_cons_poll()
+ofw_cons_poll(void)
{
unsigned char ch;
if (saved_char != -1)
- return 1;
+ return (1);
if (OF_read(stdin, &ch, 1) > 0) {
saved_char = ch;
- return 1;
+ return (1);
}
- return 0;
+ return (0);
}
diff --git a/stand/libofw/ofw_copy.c b/stand/libofw/ofw_copy.c
index 1d46ba29d9ca..17a46fe4e480 100644
--- a/stand/libofw/ofw_copy.c
+++ b/stand/libofw/ofw_copy.c
@@ -24,9 +24,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
/*
* MD primitives supporting placement of module data
*
@@ -122,14 +119,14 @@ ofw_copyin(const void *src, vm_offset_t dest, const size_t len)
}
bcopy(src, (void *)dest, len);
- return(len);
+ return (len);
}
ssize_t
ofw_copyout(const vm_offset_t src, void *dest, const size_t len)
{
bcopy((void *)src, dest, len);
- return(len);
+ return (len);
}
ssize_t
@@ -146,7 +143,7 @@ ofw_readin(readin_handle_t fd, vm_offset_t dest, const size_t len)
buf = malloc(chunk);
if (buf == NULL) {
printf("ofw_readin: buf malloc failed\n");
- return(0);
+ return (0);
}
if (ofw_mapmem(dest, len)) {
@@ -169,5 +166,5 @@ ofw_readin(readin_handle_t fd, vm_offset_t dest, const size_t len)
}
free(buf);
- return(len - resid);
+ return (len - resid);
}
diff --git a/stand/libofw/ofw_disk.c b/stand/libofw/ofw_disk.c
index 2c3bd568a268..d4bce64d9be5 100644
--- a/stand/libofw/ofw_disk.c
+++ b/stand/libofw/ofw_disk.c
@@ -23,23 +23,19 @@
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
/*
* Disk I/O routines using Open Firmware
*/
#include <sys/param.h>
+#include <sys/stdarg.h>
#include <netinet/in.h>
-#include <machine/stdarg.h>
-
#include <stand.h>
#include <sys/disk.h>
-#include "bootstrap.h"
+#include "disk.h"
#include "libofw.h"
static int ofwd_init(void);
@@ -49,16 +45,23 @@ static int ofwd_open(struct open_file *f, ...);
static int ofwd_close(struct open_file *f);
static int ofwd_ioctl(struct open_file *f, u_long cmd, void *data);
static int ofwd_print(int verbose);
+static char * ofwd_fmtdev(struct devdesc *);
+static int ofwd_parsedev(struct devdesc **, const char *, const char **);
+static bool ofwd_match(struct devsw *, const char *);
struct devsw ofwdisk = {
- "block",
- DEVT_DISK,
- ofwd_init,
- ofwd_strategy,
- ofwd_open,
- ofwd_close,
- ofwd_ioctl,
- ofwd_print
+ .dv_name = "block",
+ .dv_type = DEVT_OFDISK,
+ .dv_init = ofwd_init,
+ .dv_strategy = ofwd_strategy,
+ .dv_open = ofwd_open,
+ .dv_close = ofwd_close,
+ .dv_ioctl = ofwd_ioctl,
+ .dv_print = ofwd_print,
+ .dv_cleanup = nullsys,
+ .dv_match = ofwd_match,
+ .dv_fmtdev = ofwd_fmtdev,
+ .dv_parsedev = ofwd_parsedev,
};
/*
@@ -169,7 +172,7 @@ ofwd_ioctl(struct open_file *f, u_long cmd, void *data)
case DIOCGMEDIASIZE:
block_size = OF_block_size(dev->d_handle);
n = OF_blocks(dev->d_handle);
- *(uint64_t *)data = (uint64_t)(n * block_size);
+ *(uint64_t *)data = ((uint64_t)n * block_size);
break;
default:
return (ENOTTY);
@@ -180,5 +183,52 @@ ofwd_ioctl(struct open_file *f, u_long cmd, void *data)
static int
ofwd_print(int verbose __unused)
{
+ uintmax_t block_size, n;
+ int ret;
+ char line[80];
+
+ /*
+ * We don't have a list of devices since we don't parse the whole OFW
+ * tree to find them. Instead, if we have an open device print info
+ * about it. Otherwise say we can't. Makes lsdev nicer.
+ */
+ if ((ret = pager_output("block devices:\n")) != 0)
+ return (ret);
+ if (kdp != NULL) {
+ block_size = OF_block_size(kdp->d_handle);
+ n = OF_blocks(kdp->d_handle);
+ snprintf(line, sizeof(line),
+ " %s: OFW block device (%ju X %ju): %ju bytes\n",
+ kdp->d_path, n, block_size, n * block_size);
+ if ((ret = pager_output(line)) != 0)
+ return (ret);
+ } else {
+ if ((ret = pager_output(" none are open, so no info\n")) != 0)
+ return (ret);
+ }
+
return (0);
}
+
+
+static bool
+ofwd_match(struct devsw *devsw, const char *devspec)
+{
+ const char *path;
+
+ return (ofw_path_to_handle(devspec, devsw->dv_name, &path) != -1);
+}
+
+static char *
+ofwd_fmtdev(struct devdesc *idev)
+{
+ struct ofw_devdesc *dev = (struct ofw_devdesc *)idev;
+
+ return (dev->d_path);
+}
+
+static int
+ofwd_parsedev(struct devdesc **dev, const char *devspec, const char **path)
+{
+ return (ofw_common_parsedev(dev, devspec, path, ofwdisk.dv_name));
+}
diff --git a/stand/libofw/ofw_memory.c b/stand/libofw/ofw_memory.c
index 2b7cd87ac765..67a4527e07b4 100644
--- a/stand/libofw/ofw_memory.c
+++ b/stand/libofw/ofw_memory.c
@@ -24,9 +24,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/param.h>
#include <sys/types.h>
diff --git a/stand/libofw/ofw_module.c b/stand/libofw/ofw_module.c
index d39a34344556..4c1fe9cd279d 100644
--- a/stand/libofw/ofw_module.c
+++ b/stand/libofw/ofw_module.c
@@ -24,9 +24,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
/*
* ofw-specific module functionality.
*
@@ -45,5 +42,5 @@ int
ofw_autoload(void)
{
/* XXX Call some machdep autoload routine? */
- return(0);
+ return (0);
}
diff --git a/stand/libofw/ofw_net.c b/stand/libofw/ofw_net.c
index 4f393cebc2fa..3418216a9836 100644
--- a/stand/libofw/ofw_net.c
+++ b/stand/libofw/ofw_net.c
@@ -24,9 +24,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/param.h>
#include <sys/types.h>
#include <sys/socket.h>
@@ -41,6 +38,7 @@ __FBSDID("$FreeBSD$");
#include <net.h>
#include <netif.h>
+#include "libofw.h"
#include "openfirm.h"
static int ofwn_probe(struct netif *, void *);
@@ -53,22 +51,26 @@ static void ofwn_end(struct netif *);
extern struct netif_stats ofwn_stats[];
struct netif_dif ofwn_ifs[] = {
- /* dif_unit dif_nsel dif_stats dif_private */
- { 0, 1, &ofwn_stats[0], 0, },
+ {
+ .dif_unit=0,
+ .dif_nsel=1,
+ .dif_stats=&ofwn_stats[0],
+ .dif_private=0,
+ },
};
struct netif_stats ofwn_stats[nitems(ofwn_ifs)];
struct netif_driver ofwnet = {
- "net", /* netif_bname */
- ofwn_match, /* netif_match */
- ofwn_probe, /* netif_probe */
- ofwn_init, /* netif_init */
- ofwn_get, /* netif_get */
- ofwn_put, /* netif_put */
- ofwn_end, /* netif_end */
- ofwn_ifs, /* netif_ifs */
- nitems(ofwn_ifs) /* netif_nifs */
+ .netif_bname="net",
+ .netif_match=ofwn_match,
+ .netif_probe=ofwn_probe,
+ .netif_init=ofwn_init,
+ .netif_get=ofwn_get,
+ .netif_put=ofwn_put,
+ .netif_end=ofwn_end,
+ .netif_ifs=ofwn_ifs,
+ .netif_nifs=nitems(ofwn_ifs)
};
static ihandle_t netinstance;
@@ -78,13 +80,13 @@ static void *dmabuf;
static int
ofwn_match(struct netif *nif, void *machdep_hint)
{
- return 1;
+ return (1);
}
static int
ofwn_probe(struct netif *nif, void *machdep_hint)
{
- return 0;
+ return (0);
}
static ssize_t
@@ -121,7 +123,7 @@ ofwn_put(struct iodesc *desc, void *pkt, size_t len)
printf("netif_put: OF_write returned %d\n", rv);
#endif
- return rv;
+ return (rv);
}
static ssize_t
@@ -189,8 +191,6 @@ ofwn_get(struct iodesc *desc, void **pkt, time_t timeout)
return (length);
}
-extern char *strchr();
-
static void
ofwn_init(struct iodesc *desc, void *machdep_hint)
{
@@ -256,12 +256,70 @@ ofwn_getunit(const char *path)
for (i = 0; i < nofwninfo; i++) {
printf(">>> test =\t%s\n", ofwninfo[i].ofwn_path);
if (strcmp(path, ofwninfo[i].ofwn_path) == 0)
- return i;
+ return (i);
if (strcmp(newpath, ofwninfo[i].ofwn_path) == 0)
- return i;
+ return (i);
}
- return -1;
+ return (-1);
}
#endif
+
+/*
+ * To properly match network devices, we have to subclass the netdev device.
+ * It has a different devdesc than a normal network device (which is fine:
+ * it's a struct superset) and different matching criteria (since it has to
+ * look at the path, find a handle and see if that handle is a network node
+ * or not).
+ */
+
+static int ofwnd_init(void);
+static int ofwnd_parsedev(struct devdesc **, const char *, const char **);
+static bool ofwnd_match(struct devsw *, const char *);
+static char *ofwnd_fmtdev(struct devdesc *);
+
+struct devsw ofw_netdev = {
+ .dv_name = "network",
+ .dv_type = DEVT_NET,
+ .dv_init = ofwnd_init,
+ .dv_match = ofwnd_match,
+ .dv_fmtdev = ofwnd_fmtdev,
+ .dv_parsedev = ofwnd_parsedev,
+};
+
+static int ofwnd_init(void)
+{
+ netdev.dv_init();
+ ofw_netdev.dv_strategy = netdev.dv_strategy;
+ ofw_netdev.dv_open = netdev.dv_open;
+ ofw_netdev.dv_close = netdev.dv_close;
+ ofw_netdev.dv_ioctl = netdev.dv_ioctl;
+ ofw_netdev.dv_print = netdev.dv_print;
+ ofw_netdev.dv_fmtdev = netdev.dv_fmtdev;
+ /* parsedev is unique to ofwnd */
+ /* match is unique to ofwnd */
+ return (0);
+}
+
+static int
+ofwnd_parsedev(struct devdesc **dev, const char *devspec, const char **path)
+{
+ return (ofw_common_parsedev(dev, devspec, path, ofw_netdev.dv_name));
+}
+
+static bool
+ofwnd_match(struct devsw *devsw, const char *devspec)
+{
+ const char *path;
+
+ return (ofw_path_to_handle(devspec, devsw->dv_name, &path) != -1);
+}
+
+static char *
+ofwnd_fmtdev(struct devdesc *idev)
+{
+ struct ofw_devdesc *dev = (struct ofw_devdesc *)idev;
+
+ return (dev->d_path);
+}
diff --git a/stand/libofw/ofw_reboot.c b/stand/libofw/ofw_reboot.c
index bbb420ac1767..3f705d57d0d2 100644
--- a/stand/libofw/ofw_reboot.c
+++ b/stand/libofw/ofw_reboot.c
@@ -24,9 +24,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <stand.h>
#include "openfirm.h"
diff --git a/stand/libofw/ofw_time.c b/stand/libofw/ofw_time.c
index d5ca271564de..48372428ae29 100644
--- a/stand/libofw/ofw_time.c
+++ b/stand/libofw/ofw_time.c
@@ -24,9 +24,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <stand.h>
#include "openfirm.h"
@@ -38,7 +35,7 @@ time(time_t *tloc)
secs = OF_milliseconds() / 1000;
if (tloc)
*tloc = secs;
- return secs;
+ return (secs);
}
time_t
@@ -46,7 +43,7 @@ getsecs(void)
{
time_t n = 0;
time(&n);
- return n;
+ return (n);
}
void
diff --git a/stand/libofw/openfirm.c b/stand/libofw/openfirm.c
index b2b89581ae70..1df65784e47a 100644
--- a/stand/libofw/openfirm.c
+++ b/stand/libofw/openfirm.c
@@ -55,12 +55,8 @@
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/endian.h>
-
-#include <machine/stdarg.h>
+#include <sys/stdarg.h>
#include <stand.h>
@@ -137,7 +133,7 @@ OF_test(char *name)
/* Return firmware millisecond count. */
int
-OF_milliseconds()
+OF_milliseconds(void)
{
static struct {
cell_t name;
@@ -695,7 +691,7 @@ OF_boot(char *bootspec)
/* Suspend and drop back to the Open Firmware interface. */
void
-OF_enter()
+OF_enter(void)
{
static struct {
cell_t name;
@@ -710,7 +706,7 @@ OF_enter()
/* Shut down and drop back to the Open Firmware interface. */
void
-OF_exit()
+OF_exit(void)
{
static struct {
cell_t name;
@@ -725,7 +721,7 @@ OF_exit()
}
void
-OF_quiesce()
+OF_quiesce(void)
{
static struct {
cell_t name;
@@ -772,6 +768,7 @@ OF_chain(void *virt, u_int size, void (*entry)(), void *arg, u_int len)
if (size > 0)
OF_release(virt, size);
#endif
- entry(0, 0, openfirmware, arg, len);
+ ((int (*)(u_long, u_long, u_long, void *, u_long))entry)
+ (0, 0, (u_long)openfirmware, arg, len);
}
#endif
diff --git a/stand/libofw/openfirm.h b/stand/libofw/openfirm.h
index 0981dbf093eb..35d10c320b57 100644
--- a/stand/libofw/openfirm.h
+++ b/stand/libofw/openfirm.h
@@ -53,8 +53,6 @@
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * $FreeBSD$
*/
#ifndef _OPENFIRM_H_
#define _OPENFIRM_H_
@@ -62,7 +60,6 @@
* Prototypes for Open Firmware Interface Routines
*/
-#include <sys/cdefs.h>
#include <sys/types.h>
typedef uint32_t ihandle_t;