summaryrefslogtreecommitdiffstats
path: root/sys/dev/ofw
diff options
context:
space:
mode:
authorbenno <benno@FreeBSD.org>2000-11-10 06:39:58 +0000
committerbenno <benno@FreeBSD.org>2000-11-10 06:39:58 +0000
commit7d73a3330371286c3b3b0c935dabb9f849aef4d1 (patch)
tree22789847a40afa54801d110d94fa52b73934f134 /sys/dev/ofw
parent0268629b4f753fd4a0f76b1ab3467287f30fd286 (diff)
downloadFreeBSD-src-7d73a3330371286c3b3b0c935dabb9f849aef4d1.zip
FreeBSD-src-7d73a3330371286c3b3b0c935dabb9f849aef4d1.tar.gz
OpenFirmware/PowerPC loader, part 2.
As of this patchset, the loader builds (under NetBSD/macppc), boots, interacts and talks to BOOTP/NFS servers. (main.c was moved from boot/ofw/libofw to boot/ofw/common but has no revision history) Reviewed by: obrien
Diffstat (limited to 'sys/dev/ofw')
-rw-r--r--sys/dev/ofw/openfirm.c26
-rw-r--r--sys/dev/ofw/openfirm.h6
2 files changed, 23 insertions, 9 deletions
diff --git a/sys/dev/ofw/openfirm.c b/sys/dev/ofw/openfirm.c
index 76ec191..365358e 100644
--- a/sys/dev/ofw/openfirm.c
+++ b/sys/dev/ofw/openfirm.c
@@ -59,6 +59,8 @@
#include <machine/stdarg.h>
+#include <stand.h>
+
#include "openfirm.h"
static int (*openfirmware)(void *);
@@ -319,7 +321,7 @@ OF_setprop(phandle_t package, char *propname, void *buf, int len)
/* Convert a device specifier to a fully qualified pathname. */
int
-OF_canon(char *device, char *buf, int len)
+OF_canon(const char *device, char *buf, int len)
{
static struct {
char *name;
@@ -335,7 +337,7 @@ OF_canon(char *device, char *buf, int len)
1,
};
- args.device = device;
+ args.device = (char *)(uintptr_t *)device;
args.buf = buf;
args.len = len;
if (openfirmware(&args) == -1)
@@ -345,7 +347,7 @@ OF_canon(char *device, char *buf, int len)
/* Return a package handle for the specified device. */
phandle_t
-OF_finddevice(char *device)
+OF_finddevice(const char *device)
{
static struct {
char *name;
@@ -359,7 +361,7 @@ OF_finddevice(char *device)
1,
};
- args.device = device;
+ args.device = (char *)(uintptr_t *)device;
if (openfirmware(&args) == -1)
return -1;
return args.package;
@@ -523,8 +525,20 @@ OF_read(ihandle_t instance, void *addr, int len)
args.instance = instance;
args.addr = addr;
args.len = len;
+
+#if defined(OPENFIRM_DEBUG)
+ printf("OF_read: called with instance=%08x, addr=%p, len=%d\n",
+ args.instance, args.addr, args.len);
+#endif
+
if (openfirmware(&args) == -1)
return -1;
+
+#if defined(OPENFIRM_DEBUG)
+ printf("OF_read: returning instance=%d, addr=%p, len=%d, actual=%d\n",
+ args.instance, args.addr, args.len, args.actual);
+#endif
+
return args.actual;
}
@@ -556,7 +570,7 @@ OF_write(ihandle_t instance, void *addr, int len)
/* Seek to a position. */
int
-OF_seek(ihandle_t instance, u_quad_t pos)
+OF_seek(ihandle_t instance, u_int64_t pos)
{
static struct {
char *name;
@@ -674,7 +688,7 @@ OF_enter()
}
/* Shut down and drop back to the OpenFirmware interface. */
-__dead void
+void
OF_exit()
{
static struct {
diff --git a/sys/dev/ofw/openfirm.h b/sys/dev/ofw/openfirm.h
index 815e0ef..5ee672a 100644
--- a/sys/dev/ofw/openfirm.h
+++ b/sys/dev/ofw/openfirm.h
@@ -85,8 +85,8 @@ int OF_getproplen(phandle_t, char *);
int OF_getprop(phandle_t, char *, void *, int);
int OF_nextprop(phandle_t, char *, char *);
int OF_setprop(phandle_t, char *, void *, int);
-int OF_canon(char *, char *, int);
-phandle_t OF_finddevice(char *);
+int OF_canon(const char *, char *, int);
+phandle_t OF_finddevice(const char *);
int OF_instance_to_path(ihandle_t, char *, int);
int OF_package_to_path(phandle_t, char *, int);
int OF_call_method(char *, ihandle_t, int, int, ...);
@@ -105,7 +105,7 @@ void OF_release(void *, u_int);
/* Control transfer functions */
void OF_boot(char *);
void OF_enter(void);
-__dead void OF_exit(void) __attribute__((noreturn));
+void OF_exit(void) __attribute__((noreturn));
void OF_chain(void *, u_int, void (*)(), void *, u_int);
#if 0
OpenPOWER on IntegriCloud