git: 3c9eae3c11da - stable/14 - pci_host_generic:Add pcib_request_feature on ACPI
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 01 Apr 2025 17:46:14 UTC
The branch stable/14 has been updated by cperciva:
URL: https://cgit.FreeBSD.org/src/commit/?id=3c9eae3c11da69103389c2a1fd5a7c34948e6e13
commit 3c9eae3c11da69103389c2a1fd5a7c34948e6e13
Author: Andrew Turner <andrew@FreeBSD.org>
AuthorDate: 2024-12-12 16:30:39 +0000
Commit: Colin Percival <cperciva@FreeBSD.org>
CommitDate: 2025-04-01 17:43:57 +0000
pci_host_generic:Add pcib_request_feature on ACPI
In the ACPI attachment add support for the pcib_request_feature method.
This uses the common _OSC handling.
Reviewed by: imp, jhb
Sponsored by: Arm Ltd
Differential Revision: https://reviews.freebsd.org/D48048
(cherry picked from commit 1f5c50a8617355758510675cb9412f56fed12efc)
---
sys/dev/pci/pci_host_generic_acpi.c | 27 +++++++++++++++++++++++++++
sys/dev/pci/pci_host_generic_acpi.h | 1 +
2 files changed, 28 insertions(+)
diff --git a/sys/dev/pci/pci_host_generic_acpi.c b/sys/dev/pci/pci_host_generic_acpi.c
index b389eeb16fcf..992e8b5c8b8d 100644
--- a/sys/dev/pci/pci_host_generic_acpi.c
+++ b/sys/dev/pci/pci_host_generic_acpi.c
@@ -287,6 +287,8 @@ pci_host_generic_acpi_init(device_t dev)
sc = device_get_softc(dev);
handle = acpi_get_handle(dev);
+ acpi_pcib_osc(dev, &sc->osc_ctl, 0);
+
/* Get Start bus number for the PCI host bus is from _BBN method */
status = acpi_GetInteger(handle, "_BBN", &sc->base.bus_start);
if (ACPI_FAILURE(status)) {
@@ -503,6 +505,30 @@ generic_pcie_acpi_get_id(device_t pci, device_t child, enum pci_id_type type,
return (pcib_get_id(pci, child, type, id));
}
+static int
+generic_pcie_acpi_request_feature(device_t pcib, device_t dev,
+ enum pci_feature feature)
+{
+ struct generic_pcie_acpi_softc *sc;
+ uint32_t osc_ctl;
+
+ sc = device_get_softc(pcib);
+
+ switch (feature) {
+ case PCI_FEATURE_HP:
+ osc_ctl = PCIM_OSC_CTL_PCIE_HP;
+ break;
+ case PCI_FEATURE_AER:
+ osc_ctl = PCIM_OSC_CTL_PCIE_AER;
+ break;
+ default:
+ return (EINVAL);
+ }
+
+ return (acpi_pcib_osc(pcib, &sc->osc_ctl, osc_ctl));
+}
+
+
static device_method_t generic_pcie_acpi_methods[] = {
DEVMETHOD(device_probe, generic_pcie_acpi_probe),
DEVMETHOD(device_attach, pci_host_generic_acpi_attach),
@@ -516,6 +542,7 @@ static device_method_t generic_pcie_acpi_methods[] = {
DEVMETHOD(pcib_release_msix, generic_pcie_acpi_release_msix),
DEVMETHOD(pcib_map_msi, generic_pcie_acpi_map_msi),
DEVMETHOD(pcib_get_id, generic_pcie_acpi_get_id),
+ DEVMETHOD(pcib_request_feature, generic_pcie_acpi_request_feature),
DEVMETHOD_END
};
diff --git a/sys/dev/pci/pci_host_generic_acpi.h b/sys/dev/pci/pci_host_generic_acpi.h
index 802099abb9d7..5617da971306 100644
--- a/sys/dev/pci/pci_host_generic_acpi.h
+++ b/sys/dev/pci/pci_host_generic_acpi.h
@@ -35,6 +35,7 @@
struct generic_pcie_acpi_softc {
struct generic_pcie_core_softc base;
int segment;
+ uint32_t osc_ctl;
ACPI_BUFFER ap_prt; /* interrupt routing table */
};