summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorPer Fogelstrom <pefo@cvs.openbsd.org>1997-10-21 18:01:46 +0000
committerPer Fogelstrom <pefo@cvs.openbsd.org>1997-10-21 18:01:46 +0000
commit64b85db7003ca4383c9eca901082c2eb5574604d (patch)
treee9e1ea1122ceb3cd0b18ba69904d4f164eb61a43 /sys
parent70c6123e606265546bf91e5c774286867b544cd5 (diff)
Dig out the ethernet address from the board configuration. This just takes
the first "network" with a "mac-address" for this. In the future this has to be improved (probably) to handle more than one ethernet ifc.
Diffstat (limited to 'sys')
-rw-r--r--sys/arch/powerpc/README21
-rw-r--r--sys/arch/powerpc/pci/mpcpcibus.c12
-rw-r--r--sys/arch/powerpc/powerpc/machdep.c36
3 files changed, 57 insertions, 12 deletions
diff --git a/sys/arch/powerpc/README b/sys/arch/powerpc/README
index 63f31f43f68..e4e961b11a6 100644
--- a/sys/arch/powerpc/README
+++ b/sys/arch/powerpc/README
@@ -1,6 +1,17 @@
-This port is heavily based on the NetBSD powerpc port by
-Wolfgang Solfrank. All of the kernel code is derived from there.
-Some modifications have been made, primarily to support ELF.
+
+This port is partly based on the NetBSD powerpc port by Wolfgang Solfrank.
+The NetBSD code was imported by Dale Rahn who also added support for ELF.
+
+The current shape of the PowerPC port is a result of a work performed by
+Per Fogelstrom, Opsycon AB. The work was sponsored by RTMX Inc, North
+Carolina, USA.
+
+A lot of code has been removed and a lot of new code has been added to
+create a monolithic kernel that uses OpenFirmware or any other boot plattform
+as little possible.
+
+The current kernel supports only V.I Power.4e PowerPC 604 based VME board.
+More will come in the future.
Other notes:
@@ -13,6 +24,8 @@ Other notes:
TODO:
ptrace support (that works)
fp (setround, getround, getmask, setmask, setsticky, getsticky)
- cleaner installation
+
Dale
rahnds@cvs.openbsd.org
+Per
+pefo@cvs.openbsd.org
diff --git a/sys/arch/powerpc/pci/mpcpcibus.c b/sys/arch/powerpc/pci/mpcpcibus.c
index 44a26e49b9f..b20c2d84f09 100644
--- a/sys/arch/powerpc/pci/mpcpcibus.c
+++ b/sys/arch/powerpc/pci/mpcpcibus.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mpcpcibus.c,v 1.2 1997/10/20 19:52:42 pefo Exp $ */
+/* $OpenBSD: mpcpcibus.c,v 1.3 1997/10/21 18:01:44 pefo Exp $ */
/*
* Copyright (c) 1997 Per Fogelstrom
@@ -56,6 +56,7 @@
#include <powerpc/pci/mpc106reg.h>
extern vm_map_t phys_map;
+extern ofw_eth_addr[];
int mpcpcibrmatch __P((struct device *, void *, void *));
void mpcpcibrattach __P((struct device *, struct device *, void *));
@@ -216,12 +217,9 @@ mpc_ether_hw_addr(p)
p[i] = 0x00;
p[18] = 0x03; /* Srom version. */
p[19] = 0x01; /* One chip. */
-/*XXX*/ p[20] = 0x00; /* Next six, ethernet address. */
-/*XXX*/ p[21] = 0xa0; /* XXX Should be read from OFW */
-/*XXX*/ p[22] = 0xf7;
-/*XXX*/ p[23] = 0x04;
-/*XXX*/ p[24] = 0x00;
-/*XXX*/ p[25] = 0x4b;
+ /* Next six, ethernet address. */
+ bcopy(ofw_eth_addr, &p[20], 6);
+
p[26] = 0x00; /* Chip 0 device number */
p[27] = 30; /* Descriptor offset */
p[28] = 00;
diff --git a/sys/arch/powerpc/powerpc/machdep.c b/sys/arch/powerpc/powerpc/machdep.c
index 351225153fe..dbeaf15cc4f 100644
--- a/sys/arch/powerpc/powerpc/machdep.c
+++ b/sys/arch/powerpc/powerpc/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.11 1997/10/21 11:00:10 pefo Exp $ */
+/* $OpenBSD: machdep.c,v 1.12 1997/10/21 18:01:45 pefo Exp $ */
/* $NetBSD: machdep.c,v 1.4 1996/10/16 19:33:11 ws Exp $ */
/*
@@ -87,6 +87,7 @@ int astpending;
int system_type = POWER4e; /* XXX Hardwire it for now */
+char ofw_eth_addr[6]; /* Save address of first network ifc found */
char *bootpath;
char bootpathbuf[512];
@@ -99,6 +100,7 @@ struct msgbuf *msgbufp = (struct msgbuf *)0x3000;
int msgbufmapped = 1; /* message buffer is always mapped */
caddr_t allocsys __P((caddr_t));
+int power4e_get_eth_addr __P((void));
void
@@ -282,6 +284,11 @@ initppc(startkernel, endkernel, args)
* Initialize pmap module.
*/
pmap_bootstrap(startkernel, endkernel);
+
+ /*
+ * Figure out ethernet address.
+ */
+ (void)power4e_get_eth_addr();
}
@@ -770,3 +777,30 @@ boot(howto)
#endif
ppc_boot(str);
}
+
+/*
+ * Get Ethernet address for the onboard ethernet chip.
+ */
+int
+power4e_get_eth_addr()
+{
+ int qhandle, phandle;
+ char name[32];
+
+ for (qhandle = OF_peer(0); qhandle; qhandle = phandle) {
+ if (OF_getprop(qhandle, "device_type", name, sizeof name) >= 0
+ && !strcmp(name, "network")
+ && OF_getprop(qhandle, "local-mac-address",
+ &ofw_eth_addr, sizeof ofw_eth_addr) >= 0) {
+ return(0);
+ }
+ if (phandle = OF_child(qhandle))
+ continue;
+ while (qhandle) {
+ if (phandle = OF_peer(qhandle))
+ break;
+ qhandle = OF_parent(qhandle);
+ }
+ }
+ return(-1);
+}