git: deb36d0c6543 - main - pci_host_generic: Support ACPI_IVAR_HANDLE

From: Andrew Turner <andrew_at_FreeBSD.org>
Date: Thu, 12 Dec 2024 18:19:05 UTC
The branch main has been updated by andrew:

URL: https://cgit.FreeBSD.org/src/commit/?id=deb36d0c65436d16b04f99cc2a27bd0f3980a6f0

commit deb36d0c65436d16b04f99cc2a27bd0f3980a6f0
Author:     Andrew Turner <andrew@FreeBSD.org>
AuthorDate: 2024-12-12 16:30:28 +0000
Commit:     Andrew Turner <andrew@FreeBSD.org>
CommitDate: 2024-12-12 18:00:23 +0000

    pci_host_generic: Support ACPI_IVAR_HANDLE
    
    In the ACPI attachment support the ACPI_IVAR_HANDLE ivar. While here
    use the common ivar function to support the common ivars.
    
    Reviewed by:    imp, jhb
    Sponsored by:   Arm Ltd
    Differential Revision:  https://reviews.freebsd.org/D48047
---
 sys/dev/pci/pci_host_generic_acpi.c | 19 ++++++-------------
 1 file changed, 6 insertions(+), 13 deletions(-)

diff --git a/sys/dev/pci/pci_host_generic_acpi.c b/sys/dev/pci/pci_host_generic_acpi.c
index 770060e7f46f..d90b7c0c01f8 100644
--- a/sys/dev/pci/pci_host_generic_acpi.c
+++ b/sys/dev/pci/pci_host_generic_acpi.c
@@ -344,23 +344,16 @@ static int
 generic_pcie_acpi_read_ivar(device_t dev, device_t child, int index,
     uintptr_t *result)
 {
-	struct generic_pcie_acpi_softc *sc;
-
-	sc = device_get_softc(dev);
-
-	if (index == PCIB_IVAR_BUS) {
-		*result = sc->base.bus_start;
-		return (0);
-	}
+	ACPI_HANDLE handle;
 
-	if (index == PCIB_IVAR_DOMAIN) {
-		*result = sc->base.ecam;
+	switch (index) {
+	case ACPI_IVAR_HANDLE:
+		handle = acpi_get_handle(dev);
+		*result = (uintptr_t)handle;
 		return (0);
 	}
 
-	if (bootverbose)
-		device_printf(dev, "ERROR: Unknown index %d.\n", index);
-	return (ENOENT);
+	return (generic_pcie_read_ivar(dev, child, index, result));
 }
 
 static int