From owner-svn-src-all@freebsd.org Fri May 1 18:36:49 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6E02D2DCFD1; Fri, 1 May 2020 18:36:49 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49DLZ92LZLz3yTr; Fri, 1 May 2020 18:36:49 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 479A6CA71; Fri, 1 May 2020 18:36:49 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 041IanC0090690; Fri, 1 May 2020 18:36:49 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 041Ianpm090689; Fri, 1 May 2020 18:36:49 GMT (envelope-from imp@FreeBSD.org) Message-Id: <202005011836.041Ianpm090689@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Fri, 1 May 2020 18:36:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r360543 - head/stand/libofw X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/stand/libofw X-SVN-Commit-Revision: 360543 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 May 2020 18:36:49 -0000 Author: imp Date: Fri May 1 18:36:48 2020 New Revision: 360543 URL: https://svnweb.freebsd.org/changeset/base/360543 Log: 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 Modified: head/stand/libofw/ofw_net.c Modified: head/stand/libofw/ofw_net.c ============================================================================== --- head/stand/libofw/ofw_net.c Fri May 1 18:27:14 2020 (r360542) +++ head/stand/libofw/ofw_net.c Fri May 1 18:36:48 2020 (r360543) @@ -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: