From owner-svn-src-all@freebsd.org Sat May 19 04:01:16 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 42350EEB554; Sat, 19 May 2018 04:01:16 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E2AB57A276; Sat, 19 May 2018 04:01:15 +0000 (UTC) (envelope-from jhibbits@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 C4D8C21CA1; Sat, 19 May 2018 04:01:15 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w4J41FZ6017137; Sat, 19 May 2018 04:01:15 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4J41FBp017135; Sat, 19 May 2018 04:01:15 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201805190401.w4J41FBp017135@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Sat, 19 May 2018 04:01:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r333836 - head/sys/powerpc/powernv X-SVN-Group: head X-SVN-Commit-Author: jhibbits X-SVN-Commit-Paths: head/sys/powerpc/powernv X-SVN-Commit-Revision: 333836 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.26 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: Sat, 19 May 2018 04:01:16 -0000 Author: jhibbits Date: Sat May 19 04:01:15 2018 New Revision: 333836 URL: https://svnweb.freebsd.org/changeset/base/333836 Log: powerpc64: Add OPAL definitions Summary: Add additional OPAL PCI definitions and expand the code to use them in order to ease the OPAL interface process for new comers. These definitions came directly from the OPAL code and they are the same for both PHB3 (POWER8) and PHB4 (POWER9). Submitted by: Breno Leitao Differential Revision: https://reviews.freebsd.org/D15432 Modified: head/sys/powerpc/powernv/opal.h head/sys/powerpc/powernv/opal_pci.c Modified: head/sys/powerpc/powernv/opal.h ============================================================================== --- head/sys/powerpc/powernv/opal.h Sat May 19 03:58:40 2018 (r333835) +++ head/sys/powerpc/powernv/opal.h Sat May 19 04:01:15 2018 (r333836) @@ -79,6 +79,20 @@ int opal_call(uint64_t token, ...); #define OPAL_UNMAP_PE 0 #define OPAL_MAP_PE 1 +#define OPAL_PCI_BUS_ANY 0 +#define OPAL_PCI_BUS_3BITS 2 +#define OPAL_PCI_BUS_4BITS 3 +#define OPAL_PCI_BUS_5BITS 4 +#define OPAL_PCI_BUS_6BITS 5 +#define OPAL_PCI_BUS_7BITS 6 +#define OPAL_PCI_BUS_ALL 7 /* Match bus number exactly */ + +#define OPAL_IGNORE_RID_DEVICE_NUMBER 0 +#define OPAL_COMPARE_RID_DEVICE_NUMBER 1 + +#define OPAL_IGNORE_RID_FUNC_NUMBER 0 +#define OPAL_COMPARE_RID_FUNC_NUMBER 1 + #define OPAL_SUCCESS 0 #define OPAL_PARAMETER -1 #define OPAL_BUSY -2 Modified: head/sys/powerpc/powernv/opal_pci.c ============================================================================== --- head/sys/powerpc/powernv/opal_pci.c Sat May 19 03:58:40 2018 (r333835) +++ head/sys/powerpc/powernv/opal_pci.c Sat May 19 04:01:15 2018 (r333836) @@ -254,8 +254,8 @@ opalpci_attach(device_t dev) * such time as we start wanting to do things like bhyve. */ err = opal_call(OPAL_PCI_SET_PE, sc->phb_id, OPAL_PCI_DEFAULT_PE, - 0, 0, 0, 0, /* All devices */ - OPAL_MAP_PE); + 0, OPAL_PCI_BUS_ANY, OPAL_IGNORE_RID_DEVICE_NUMBER, + OPAL_IGNORE_RID_FUNC_NUMBER, OPAL_MAP_PE); if (err != 0) { device_printf(dev, "PE mapping failed: %d\n", err); return (ENXIO);