From nobody Fri Mar 25 11:07:24 2022 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id CDC891A244BA; Fri, 25 Mar 2022 11:07:24 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4KPznm5Q3nz4SDR; Fri, 25 Mar 2022 11:07:24 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1648206444; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Hu4VXoFl5yms8jctLXtEGCEr89nXRjbV6CqxPZYz/xM=; b=jZLMJlqI8VWFWGSt6y5ofaiYH3pf1tv8xL8OJhyrOhfm+WZoympFxBoZZ6+eZYMBbBIyCA vKOWVCvHSCgu+mBi9NMW6/NRNzDclbDzrzA53Q6j84Wws8WdvVMZgfc+xZ8AnYqOF6D1ta ij9qjrfgkGdTHETeLR7hrQvLGl8d5zsU2KY3r8ysLWuHMYVi/4Bxr1kV/J0JLmqWSY5gbx bokCnVxEuHiCSefED00VWekxPw/YsJhFaNs/pf6OP4zU87lXAiW6O4pdDo35GMJ2BkC1kE zW33OFquQkkvx5Siiel88cqAa48B+5rM1He3Fc9a4stafghSyPgsOz1IUffy/A== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 99C8A2FE3; Fri, 25 Mar 2022 11:07:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 22PB7OCD099672; Fri, 25 Mar 2022 11:07:24 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 22PB7OqG099671; Fri, 25 Mar 2022 11:07:24 GMT (envelope-from git) Date: Fri, 25 Mar 2022 11:07:24 GMT Message-Id: <202203251107.22PB7OqG099671@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Alfredo Dal'Ava Junior" Subject: git: 4081882c415b - stable/13 - powerpcspe: fix PCI enumeration on ppce500 List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: alfredo X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 4081882c415b4d4aadec140df3658163d55c6d7b Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1648206444; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Hu4VXoFl5yms8jctLXtEGCEr89nXRjbV6CqxPZYz/xM=; b=ACW/cLBeZMfZuSPFZndQlr6ZcRDHuZYWlwkiMfummsZ23FOXt1zimchfyvGgJ9xbTMe/F6 IItwHb2ObUaaJyylFBEmKgv/uFRjhq03e525MgBxmCIDfUK2cXUmbKEhlCKFFI5xMiyrcV I2yUHO2HkCiRH9CJclCgjwFkyxer6sQwnibLJ5s7I0Si7bzwNJFep+Ja8XZZRbFriOERZ2 e2yLN9zVV97RDvjJLQI5cKmbYPuXwP8runS4aA7D07CdZsjijidvWjT5HSKPLeXfbUj2Q2 IFnp8sMD9Q45/ZmyDhVJqrDBGxUGamVML4N8VgF6UJ3SDtCGqJFIgdTDhGdSNQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1648206444; a=rsa-sha256; cv=none; b=sv//+pZAVoDEMXcKfOetTTwkYoD2SYl4dsBpD3yVyK+vssjuvePPXFQcTDYoinMhKtj/Gu /B+XSQCtSKj/j/BnwzCQs8k5bkwbKLXNNOtH8CAqciQ4fcqDuKfeSDcv8/tVgsesp4AXQC k8R6etpLYuohQt0JHUgu9s42AtxWc10DastPhGqQjOW9M9hGnZri5nmPt2IN9A3cbgJFE1 MP9jE/YONgdEGOuCToY9noInSaBCzvgFpgxFOWClqHLwk+lU1/Lm86WNq7eHaa+0vxBbcy yjrJ966wSkX3F/kox7jDBZm/1nZQzQyDvNCwTN9ZWIUH37l86+vVkycNFekPrQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by alfredo: URL: https://cgit.FreeBSD.org/src/commit/?id=4081882c415b4d4aadec140df3658163d55c6d7b commit 4081882c415b4d4aadec140df3658163d55c6d7b Author: Alfredo Dal'Ava Junior AuthorDate: 2022-03-21 10:57:07 +0000 Commit: Alfredo Dal'Ava Junior CommitDate: 2022-03-25 11:07:09 +0000 powerpcspe: fix PCI enumeration on ppce500 This fixes PCI devices not being found on QEMU ppce500. This generic board used to have its first PCI slot at 0x11, like the mpc8544dsi and some real HW. After commit [1], it was changed to 0x1 and our driver wasn't prepared for that. [1] https://gitlab.com/qemu-project/qemu/-/commit/3bb7e02a9725a24e5bf915b35f914f82f5b07a1f Reviewed by: jhibbits, bdragon MFC after: 2 days Sponsored by: Institudo de Pesquisas Eldorado (eldorado.org.br) Differential Revision: https://reviews.freebsd.org/D34621 (cherry picked from commit 27f56d337be39a3f493febb585f3484c4cb6c3b6) --- sys/powerpc/mpc85xx/pci_mpc85xx.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/sys/powerpc/mpc85xx/pci_mpc85xx.c b/sys/powerpc/mpc85xx/pci_mpc85xx.c index b7035e372105..909c7ef8cd6b 100644 --- a/sys/powerpc/mpc85xx/pci_mpc85xx.c +++ b/sys/powerpc/mpc85xx/pci_mpc85xx.c @@ -138,7 +138,8 @@ __FBSDID("$FreeBSD$"); #define DEVFN(b, s, f) ((b << 16) | (s << 8) | f) -#define FSL_NUM_MSIS 256 /* 8 registers of 32 bits (8 hardware IRQs) */ +#define FSL_NUM_MSIS 256 /* 8 registers of 32 bits (8 hardware IRQs) */ +#define PCI_SLOT_FIRST 0x1 /* used to be 0x11 but qemu-ppce500 starts from 0x1 */ struct fsl_pcib_softc { struct ofw_pci_softc pci_sc; @@ -552,7 +553,8 @@ fsl_pcib_read_config(device_t dev, u_int bus, u_int slot, u_int func, struct fsl_pcib_softc *sc = device_get_softc(dev); u_int devfn; - if (bus == sc->sc_busnr && !sc->sc_pcie && slot < 10) + if (bus == sc->sc_busnr && !sc->sc_pcie && + slot < PCI_SLOT_FIRST) return (~0); devfn = DEVFN(bus, slot, func); @@ -565,7 +567,8 @@ fsl_pcib_write_config(device_t dev, u_int bus, u_int slot, u_int func, { struct fsl_pcib_softc *sc = device_get_softc(dev); - if (bus == sc->sc_busnr && !sc->sc_pcie && slot < 10) + if (bus == sc->sc_busnr && !sc->sc_pcie && + slot < PCI_SLOT_FIRST) return; fsl_pcib_cfgwrite(sc, bus, slot, func, reg, val, bytes); }