aboutsummaryrefslogtreecommitdiff
path: root/stand/libofw
diff options
context:
space:
mode:
authorWarner Losh <imp@FreeBSD.org>2020-05-01 18:36:48 +0000
committerWarner Losh <imp@FreeBSD.org>2020-05-01 18:36:48 +0000
commit272a882b37d4de582901bafb44958e4bab6fc90a (patch)
treef22bcbe53fbf3a1732a291eae541620bdbe7565d /stand/libofw
parent25dcf0e53510eb8d2ef5a1fa9aacef02cd94d2ab (diff)
downloadsrc-272a882b37d4de582901bafb44958e4bab6fc90a.tar.gz
src-272a882b37d4de582901bafb44958e4bab6fc90a.zip
Redo r360540 to retain the ifndef sparc code, not delete it.
Also undo the BROKEN stuff, since it was based on the same misreading. Noticed by: Jens Schweikhardt
Notes
Notes: svn path=/head/; revision=360543
Diffstat (limited to 'stand/libofw')
-rw-r--r--stand/libofw/ofw_net.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/stand/libofw/ofw_net.c b/stand/libofw/ofw_net.c
index b8922d682335..4f393cebc2fa 100644
--- a/stand/libofw/ofw_net.c
+++ b/stand/libofw/ofw_net.c
@@ -73,9 +73,7 @@ struct netif_driver ofwnet = {
static ihandle_t netinstance;
-#ifdef BROKEN
static void *dmabuf;
-#endif
static int
ofwn_match(struct netif *nif, void *machdep_hint)
@@ -112,12 +110,10 @@ ofwn_put(struct iodesc *desc, void *pkt, size_t len)
#endif
}
-#ifdef BROKEN
if (dmabuf) {
bcopy(pkt, dmabuf, sendlen);
pkt = dmabuf;
}
-#endif
rv = OF_write(netinstance, pkt, len);
@@ -220,6 +216,16 @@ ofwn_init(struct iodesc *desc, void *machdep_hint)
#if defined(NETIF_DEBUG)
printf("ofwn_init: Open Firmware instance handle: %08x\n", netinstance);
#endif
+ dmabuf = NULL;
+ if (OF_call_method("dma-alloc", netinstance, 1, 1, (64 * 1024), &dmabuf)
+ < 0) {
+ printf("Failed to allocate DMA buffer (got %p).\n", dmabuf);
+ goto punt;
+ }
+#if defined(NETIF_DEBUG)
+ printf("ofwn_init: allocated DMA buffer: %p\n", dmabuf);
+#endif
+
return;
punt: