From nobody Thu Jan 18 23:39:12 2024 X-Original-To: dev-commits-src-all@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 4TGK2n0bPcz57Ht6; Thu, 18 Jan 2024 23:39:13 +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 4TGK2m64JZz4SN7; Thu, 18 Jan 2024 23:39:12 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1705621152; 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=bl0CPqAVc78cjcSgXWbnyGXx/Uvv2VkgK/C8Xl/oin4=; b=OYYOC4FXRhUszUQbh4tkQCqQrzz260s2RFlTw3tLdYd3N8MPwATafvdAg/UC8Ej629P2Xh kKDg1yYKdGQ7gUJp45dskOlqhY/zwknIdOjpYYe7w7UxZ1XnXTM9LZftXeChrFh31Lw0KH 2vPBAa/nhUgiozqZbqstmuUy31iSNDYDDCwin/qe0Ie8+OA9/WcEgGIZlScRO+k/H7a7oG JIRIqdx38j6aQBTYvwRm8dRvbOALMFOmuHUvXbBW/XYkIfBz8GGzq5w5Mi8r97INPiI5BD HmJKPHEVAkiFehaktjURvURmWaLjEPpzjwfvcOX4rFSOKh+XAndXQkGQCvLKzg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1705621152; 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=bl0CPqAVc78cjcSgXWbnyGXx/Uvv2VkgK/C8Xl/oin4=; b=kdCswZpvx4wP2xMnVNrgis2WoN9cbF2g2Xu0bK8Gb0RNFPvxzbvQdGtqGK7wnfXquaSzdQ 97b2CNEL5enuQe43kILk3oAS+08lyXQV+NpoBZps7LAl4S7dcMfPf8/qZliHY9txFrr5Zo U3pT6Ac+lau1HWGbgXvXdXMV4f891n0LH4yYxhleA10an6RgWA7tirOFZq4FN2Wx/RTvgL jKiytcw0OTBkqC0El/BDAisDqNTB0rDsecQ0cOAVg+fKwBw8EgsPJywTMe4jRUjRzAsPBb nVH98N4hd7LwvTviNVCihrYZusZgn60/sFUDiT56y8xTNphZnev5b/RdOKl97w== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1705621152; a=rsa-sha256; cv=none; b=cpEV5pCwQu67z8p3SXBGFNbl/r7AGPA1R4b83vRDgwenBbBTcFye6BPuG9i4BkQHkzh2A+ 9cSaeAaxwPJAv9f2xKt9Jx1iRRoaMwPQeD2KGoATPDLZkbDhZwSpadkAqGHSPXHxvLRpOb 73NtGSmPS/b7NCqPSQac023ReWRxrYsw0fvfxxJoLlara6GZIOiLUDbSuiY7+cY+c5SvhC r67VaE+EgOlA1VgugtM9qBH9okyB1RrSBmYtiZuSvQeTZ2BPB/RZg/ezaCm96RM0bsxXdC NLBFVMsa40DJZ0JpoQqvEJ77dVeybHDUPs2U42lo49fq2GcEv5yKr3gOqrWtuw== 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 4TGK2m58ZRzRkm; Thu, 18 Jan 2024 23:39:12 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 40INdCaB011396; Thu, 18 Jan 2024 23:39:12 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 40INdCdk011393; Thu, 18 Jan 2024 23:39:12 GMT (envelope-from git) Date: Thu, 18 Jan 2024 23:39:12 GMT Message-Id: <202401182339.40INdCdk011393@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: John Baldwin Subject: git: b5d2a06b2c4f - stable/14 - pci_cfgreg: Add shims to preserve ABI of pci_cfgreg(read|write) List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: b5d2a06b2c4f50fd20774928602a3b5f0f27b127 Auto-Submitted: auto-generated The branch stable/14 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=b5d2a06b2c4f50fd20774928602a3b5f0f27b127 commit b5d2a06b2c4f50fd20774928602a3b5f0f27b127 Author: John Baldwin AuthorDate: 2024-01-18 23:19:11 +0000 Commit: John Baldwin CommitDate: 2024-01-18 23:19:11 +0000 pci_cfgreg: Add shims to preserve ABI of pci_cfgreg(read|write) This is a direct commit to stable/14 to preserve the ABI of the the pci_cfgregread and pci_cfgregwrite functions. The new routines are renamed to add a _domain suffix and macros map the new API to the new functions. Note: No API compatibility has been provided as modules in ports should not be using this internal API (normal PCI drivers use pci_read_config and pci_write_config with a device_t). --- sys/amd64/pci/pci_cfgreg.c | 27 ++++++++++++++++++++++++--- sys/arm64/acpica/pci_cfgreg.c | 27 ++++++++++++++++++++++++--- sys/arm64/include/pci_cfgreg.h | 7 +++++-- sys/i386/pci/pci_cfgreg.c | 20 ++++++++++++++++++++ sys/x86/include/pci_cfgreg.h | 7 +++++-- 5 files changed, 78 insertions(+), 10 deletions(-) diff --git a/sys/amd64/pci/pci_cfgreg.c b/sys/amd64/pci/pci_cfgreg.c index 5218ff3a40f7..6b95c6fae0ab 100644 --- a/sys/amd64/pci/pci_cfgreg.c +++ b/sys/amd64/pci/pci_cfgreg.c @@ -95,7 +95,8 @@ pci_docfgregread(int domain, int bus, int slot, int func, int reg, int bytes) * Read configuration space register */ u_int32_t -pci_cfgregread(int domain, int bus, int slot, int func, int reg, int bytes) +pci_cfgregread_domain(int domain, int bus, int slot, int func, int reg, + int bytes) { uint32_t line; @@ -121,8 +122,8 @@ pci_cfgregread(int domain, int bus, int slot, int func, int reg, int bytes) * Write configuration space register */ void -pci_cfgregwrite(int domain, int bus, int slot, int func, int reg, uint32_t data, - int bytes) +pci_cfgregwrite_domain(int domain, int bus, int slot, int func, int reg, + uint32_t data, int bytes) { if (domain == 0 && bus == 0 && (1 << slot & pcie_badslots) != 0) { pcireg_cfgwrite(bus, slot, func, reg, data, bytes); @@ -333,3 +334,23 @@ pciereg_cfgwrite(int domain, int bus, unsigned slot, unsigned func, break; } } + +/* ABI compatibility shims. */ +#undef pci_cfgregread +#undef pci_cfgregwrite + +u_int32_t pci_cfgregread(int bus, int slot, int func, int reg, int bytes); +void pci_cfgregwrite(int bus, int slot, int func, int reg, uint32_t data, + int bytes); + +u_int32_t +pci_cfgregread(int bus, int slot, int func, int reg, int bytes) +{ + return (pci_cfgregread_domain(0, bus, slot, func, reg, bytes)); +} + +void +pci_cfgregwrite(int bus, int slot, int func, int reg, uint32_t data, int bytes) +{ + return (pci_cfgregwrite_domain(0, bus, slot, func, reg, data, bytes)); +} diff --git a/sys/arm64/acpica/pci_cfgreg.c b/sys/arm64/acpica/pci_cfgreg.c index 55627d4abfaf..3b38be05beb5 100644 --- a/sys/arm64/acpica/pci_cfgreg.c +++ b/sys/arm64/acpica/pci_cfgreg.c @@ -41,7 +41,8 @@ * Read configuration space register */ uint32_t -pci_cfgregread(int domain, int bus, int slot, int func, int reg, int bytes) +pci_cfgregread_domain(int domain, int bus, int slot, int func, int reg, + int bytes) { /* ARM64TODO */ @@ -53,8 +54,8 @@ pci_cfgregread(int domain, int bus, int slot, int func, int reg, int bytes) * Write configuration space register */ void -pci_cfgregwrite(int domain, int bus, int slot, int func, int reg, uint32_t data, - int bytes) +pci_cfgregwrite_domain(int domain, int bus, int slot, int func, int reg, + uint32_t data, int bytes) { /* ARM64TODO */ @@ -72,3 +73,23 @@ pci_cfgregopen(void) panic("pci_cfgregopen not implemented"); return (0); } + +/* ABI compatibility shims. */ +#undef pci_cfgregread +#undef pci_cfgregwrite + +uint32_t pci_cfgregread(int bus, int slot, int func, int reg, int bytes); +void pci_cfgregwrite(int bus, int slot, int func, int reg, uint32_t data, + int bytes); + +uint32_t +pci_cfgregread(int bus, int slot, int func, int reg, int bytes) +{ + return (pci_cfgregread_domain(0, bus, slot, func, reg, bytes)); +} + +void +pci_cfgregwrite(int bus, int slot, int func, int reg, uint32_t data, int bytes) +{ + return (pci_cfgregwrite_domain(0, bus, slot, func, reg, data, bytes)); +} diff --git a/sys/arm64/include/pci_cfgreg.h b/sys/arm64/include/pci_cfgreg.h index 579dcd954c9b..cce7e6bd8961 100644 --- a/sys/arm64/include/pci_cfgreg.h +++ b/sys/arm64/include/pci_cfgreg.h @@ -27,7 +27,10 @@ #define _MACHINE_PCI_CFGREG_H int pci_cfgregopen(void); -uint32_t pci_cfgregread(int, int, int, int, int, int); -void pci_cfgregwrite(int, int, int, int, int, uint32_t, int); +uint32_t pci_cfgregread_domain(int, int, int, int, int, int); +void pci_cfgregwrite_domain(int, int, int, int, int, uint32_t, int); + +#define pci_cfgregread pci_cfgregread_domain +#define pci_cfgregwrite pci_cfgregwrite_domain #endif /* !_MACHINE_PCI_CFGREG_H */ diff --git a/sys/i386/pci/pci_cfgreg.c b/sys/i386/pci/pci_cfgreg.c index a512e3ea2c66..ef712fe49fe3 100644 --- a/sys/i386/pci/pci_cfgreg.c +++ b/sys/i386/pci/pci_cfgreg.c @@ -640,3 +640,23 @@ pciereg_cfgwrite(int domain, int bus, unsigned slot, unsigned func, critical_exit(); } + +/* ABI compatibility shims. */ +#undef pci_cfgregread +#undef pci_cfgregwrite + +u_int32_t pci_cfgregread(int bus, int slot, int func, int reg, int bytes); +void pci_cfgregwrite(int bus, int slot, int func, int reg, uint32_t data, + int bytes); + +u_int32_t +pci_cfgregread(int bus, int slot, int func, int reg, int bytes) +{ + return (pci_cfgregread_domain(0, bus, slot, func, reg, bytes)); +} + +void +pci_cfgregwrite(int bus, int slot, int func, int reg, uint32_t data, int bytes) +{ + return (pci_cfgregwrite_domain(0, bus, slot, func, reg, data, bytes)); +} diff --git a/sys/x86/include/pci_cfgreg.h b/sys/x86/include/pci_cfgreg.h index 370113b9d7bd..680a4551af07 100644 --- a/sys/x86/include/pci_cfgreg.h +++ b/sys/x86/include/pci_cfgreg.h @@ -58,12 +58,15 @@ extern int cfgmech; rman_res_t hostb_alloc_start(int type, rman_res_t start, rman_res_t end, rman_res_t count); int pcie_cfgregopen(uint64_t base, uint8_t minbus, uint8_t maxbus); int pci_cfgregopen(void); -u_int32_t pci_cfgregread(int domain, int bus, int slot, int func, int reg, int bytes); -void pci_cfgregwrite(int domain, int bus, int slot, int func, int reg, u_int32_t data, int bytes); +u_int32_t pci_cfgregread_domain(int domain, int bus, int slot, int func, int reg, int bytes); +void pci_cfgregwrite_domain(int domain, int bus, int slot, int func, int reg, u_int32_t data, int bytes); #ifdef __HAVE_PIR void pci_pir_open(void); int pci_pir_probe(int bus, int require_parse); int pci_pir_route_interrupt(int bus, int device, int func, int pin); #endif +#define pci_cfgregread pci_cfgregread_domain +#define pci_cfgregwrite pci_cfgregwrite_domain + #endif /* !__X86_PCI_CFGREG_H__ */