From owner-svn-src-projects@freebsd.org Sun Aug 21 00:00:06 2016 Return-Path: Delivered-To: svn-src-projects@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 096FEBC1505 for ; Sun, 21 Aug 2016 00:00:06 +0000 (UTC) (envelope-from nwhitehorn@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 mx1.freebsd.org (Postfix) with ESMTPS id B4D4B18ED; Sun, 21 Aug 2016 00:00:05 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u7L0045r002563; Sun, 21 Aug 2016 00:00:04 GMT (envelope-from nwhitehorn@FreeBSD.org) Received: (from nwhitehorn@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u7L004Rt002562; Sun, 21 Aug 2016 00:00:04 GMT (envelope-from nwhitehorn@FreeBSD.org) Message-Id: <201608210000.u7L004Rt002562@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: nwhitehorn set sender to nwhitehorn@FreeBSD.org using -f From: Nathan Whitehorn Date: Sun, 21 Aug 2016 00:00:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r304551 - projects/powernv/powerpc/powernv X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 21 Aug 2016 00:00:06 -0000 Author: nwhitehorn Date: Sun Aug 21 00:00:04 2016 New Revision: 304551 URL: https://svnweb.freebsd.org/changeset/base/304551 Log: Interpret Maxmem correctly when setting up DMA. Modified: projects/powernv/powerpc/powernv/opal_pci.c Modified: projects/powernv/powerpc/powernv/opal_pci.c ============================================================================== --- projects/powernv/powerpc/powernv/opal_pci.c Sat Aug 20 23:58:13 2016 (r304550) +++ projects/powernv/powerpc/powernv/opal_pci.c Sun Aug 21 00:00:04 2016 (r304551) @@ -130,7 +130,8 @@ struct opalpci_softc { static devclass_t opalpci_devclass; DEFINE_CLASS_1(pcib, opalpci_driver, opalpci_methods, sizeof(struct opalpci_softc), ofw_pci_driver); -DRIVER_MODULE(opalpci, ofwbus, opalpci_driver, opalpci_devclass, 0, 0); +EARLY_DRIVER_MODULE(opalpci, ofwbus, opalpci_driver, opalpci_devclass, 0, 0, + BUS_PASS_BUS); static int opalpci_probe(device_t dev) @@ -189,6 +190,12 @@ opalpci_attach(device_t dev) device_printf(dev, "IODA table reset failed: %d\n", err); return (ENXIO); } + while ((err = opal_call(OPAL_PCI_POLL, sc->phb_id)) > 0) + DELAY(1000*err); /* Returns expected delay in ms */ + if (err < 0) { + device_printf(dev, "PHB IODA reset poll failed: %d\n", err); + return (ENXIO); + } /* * Reset everything. Especially important if we have inherited the @@ -266,9 +273,13 @@ opalpci_attach(device_t dev) /* * Also disable the IOMMU for the time being for PE 1 (everything) */ + if (bootverbose) + device_printf(dev, "Mapping 0-%#lx for DMA\n", + roundup2(powerpc_ptob(Maxmem), 16*1024*1024)); err = opal_call(OPAL_PCI_MAP_PE_DMA_WINDOW_REAL, sc->phb_id, - OPAL_PCI_DEFAULT_PE, 2, 0 /* start address */, - roundup2(Maxmem, 16*1024*1024)/* all RAM */); + OPAL_PCI_DEFAULT_PE, OPAL_PCI_DEFAULT_PE << 1, + 0 /* start address */, roundup2(powerpc_ptob(Maxmem), + 16*1024*1024)/* all RAM */); if (err != 0) { device_printf(dev, "DMA mapping failed: %d\n", err); return (ENXIO);