summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrahnds <rahnds@openbsd.org>1999-10-28 04:25:25 +0000
committerrahnds <rahnds@openbsd.org>1999-10-28 04:25:25 +0000
commit9bc53ddb20c4a70c63fca1436f96d989ba655f13 (patch)
tree182a6a20993a0514b2a1f76bfb51325ec303b57f
parentAdd ip4.allow and etherip.allow entries. (diff)
downloadwireguard-openbsd-9bc53ddb20c4a70c63fca1436f96d989ba655f13.tar.xz
wireguard-openbsd-9bc53ddb20c4a70c63fca1436f96d989ba655f13.zip
Sync up with some piece of reality, start supporting powerpc again.
-rw-r--r--sys/dev/ofw/ofbus.c9
-rw-r--r--sys/dev/ofw/ofcons.c11
-rw-r--r--sys/dev/ofw/ofnet.c28
-rw-r--r--sys/dev/ofw/openfirm.h4
4 files changed, 36 insertions, 16 deletions
diff --git a/sys/dev/ofw/ofbus.c b/sys/dev/ofw/ofbus.c
index fceaae1b837..41e3fec1c84 100644
--- a/sys/dev/ofw/ofbus.c
+++ b/sys/dev/ofw/ofbus.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ofbus.c,v 1.5 1998/09/20 23:03:03 rahnds Exp $ */
+/* $OpenBSD: ofbus.c,v 1.6 1999/10/28 04:25:25 rahnds Exp $ */
/* $NetBSD: ofbus.c,v 1.3 1996/10/13 01:38:11 christos Exp $ */
/*
@@ -40,7 +40,6 @@
/* a bit of a hack to prevent conflicts between ofdisk and sd/wd */
#include "sd.h"
-#include "wd.h"
int ofrprobe __P((struct device *, void *, void *));
void ofrattach __P((struct device *, struct device *, void *));
@@ -187,9 +186,9 @@ ofbattach(parent, dev, aux)
units = 7; /* What about wide or hostid != 7? XXX */
#endif
} else if (!strcmp(name, "ide")) {
-#if NWD > 0
- units = 0; /* if wd driver in kernel, dont use ofw */
-else
+#if NSD > 0
+ units = 0; /* if sd? driver in kernel, dont use ofw */
+#else
units = 2;
#endif
}
diff --git a/sys/dev/ofw/ofcons.c b/sys/dev/ofw/ofcons.c
index addc97fb72b..c08749386d3 100644
--- a/sys/dev/ofw/ofcons.c
+++ b/sys/dev/ofw/ofcons.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ofcons.c,v 1.2 1997/11/07 08:07:21 niklas Exp $ */
+/* $OpenBSD: ofcons.c,v 1.3 1999/10/28 04:25:25 rahnds Exp $ */
/* $NetBSD: ofcons.c,v 1.3 1996/10/13 01:38:11 christos Exp $ */
/*
@@ -53,7 +53,8 @@ struct ofc_softc {
#define OFBURSTLEN 128 /* max number of bytes to write in one chunk */
-static int stdin, stdout;
+static int stdin = 0;
+static int stdout = 0;
static int ofcmatch __P((struct device *, void *, void *));
static void ofcattach __P((struct device *, struct device *, void *));
@@ -327,6 +328,12 @@ ofccnputc(dev, c)
{
char ch = c;
+/*#ifdef DEBUG */
+#if 1
+ if (stdout == 0) {
+ ofcprobe();
+ }
+#endif
OF_write(stdout, &ch, 1);
}
diff --git a/sys/dev/ofw/ofnet.c b/sys/dev/ofw/ofnet.c
index 5e3e0b600a3..8efc624d665 100644
--- a/sys/dev/ofw/ofnet.c
+++ b/sys/dev/ofw/ofnet.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ofnet.c,v 1.2 1997/11/07 08:07:22 niklas Exp $ */
+/* $OpenBSD: ofnet.c,v 1.3 1999/10/28 04:25:25 rahnds Exp $ */
/* $NetBSD: ofnet.c,v 1.4 1996/10/16 19:33:21 ws Exp $ */
/*
@@ -69,6 +69,7 @@ struct ofn_softc {
int sc_phandle;
int sc_ihandle;
struct arpcom sc_arpcom;
+ void *dmabuf;
};
static int ofnprobe __P((struct device *, void *, void *));
@@ -138,10 +139,20 @@ ofnattach(parent, self, aux)
|| l >= sizeof path
|| (path[l] = 0, !(of->sc_ihandle = OF_open(path))))
panic("ofnattach: unable to open");
+printf("\nethernet dev: path %s\n", path);
+ OF_call_method("dma-alloc", of->sc_ihandle, 1, 1, MAXPHYS,
+ &(of->dmabuf));
if (OF_getprop(ofp->phandle, "mac-address",
- of->sc_arpcom.ac_enaddr, sizeof of->sc_arpcom.ac_enaddr)
- < 0)
- panic("ofnattach: no max-address");
+ of->sc_arpcom.ac_enaddr, sizeof
+ (of->sc_arpcom.ac_enaddr)) < 0)
+ {
+ if (OF_getprop(ofp->phandle, "local-mac-address",
+ of->sc_arpcom.ac_enaddr, sizeof
+ (of->sc_arpcom.ac_enaddr)) < 0)
+ {
+ panic("ofnattach: no mac-address");
+ }
+ }
printf(": address %s\n", ether_sprintf(of->sc_arpcom.ac_enaddr));
bcopy(of->sc_dev.dv_xname, ifp->if_xname, IFNAMSIZ);
@@ -162,8 +173,6 @@ ofnattach(parent, self, aux)
dk_establish(0, self); /* XXX */
}
-static char buf[ETHERMTU + sizeof(struct ether_header)];
-
static void
ofnread(of)
struct ofn_softc *of;
@@ -173,6 +182,7 @@ ofnread(of)
struct mbuf *m, **mp, *head;
int l, len;
char *bufp;
+ char *buf = of->dmabuf;
#if NIPKDB_OFN > 0
ipkdbrint(kifp, ifp);
@@ -278,7 +288,9 @@ ofnstart(ifp)
struct ofn_softc *of = ifp->if_softc;
struct mbuf *m, *m0;
char *bufp;
+ char *buf;
int len;
+ buf = of->dmabuf;
if (!(ifp->if_flags & IFF_RUNNING))
return;
@@ -378,6 +390,7 @@ ofnwatchdog(ifp)
}
#if NIPKDB_OFN > 0
+/* has not been updated to use dmabuf */
static void
ipkdbofstart(kip)
struct ipkdb_if *kip;
@@ -439,7 +452,8 @@ ipkdbprobe(match, aux)
name[len] = 0;
if ((phandle = OF_instance_to_package(kip->port)) == -1)
return -1;
- if (OF_getprop(phandle, "mac-address", kip->myenetaddr, sizeof kip->myenetaddr)
+ if ( OF_getprop(phandle, "local-mac-address", kip->myenetaddr, sizeof kip->myenetaddr) &&
+ OF_getprop(phandle, "mac-address", kip->myenetaddr, sizeof kip->myenetaddr)
< 0)
return -1;
diff --git a/sys/dev/ofw/openfirm.h b/sys/dev/ofw/openfirm.h
index 386239df8ec..342bac5c4af 100644
--- a/sys/dev/ofw/openfirm.h
+++ b/sys/dev/ofw/openfirm.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: openfirm.h,v 1.2 1997/11/07 08:07:24 niklas Exp $ */
+/* $OpenBSD: openfirm.h,v 1.3 1999/10/28 04:25:25 rahnds Exp $ */
/* $NetBSD: openfirm.h,v 1.1 1996/09/30 16:35:10 ws Exp $ */
/*
@@ -40,7 +40,7 @@
int openfirmware __P((void *));
-extern char *OF_buf;
+extern char OF_buf[];
int OF_peer __P((int phandle));
int OF_child __P((int phandle));