git: 1f5c50a86173 - main - pci_host_generic:Add pcib_request_feature on ACPI
Date: Thu, 12 Dec 2024 18:19:06 UTC
The branch main has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=1f5c50a8617355758510675cb9412f56fed12efc commit 1f5c50a8617355758510675cb9412f56fed12efc Author: Andrew Turner <andrew@FreeBSD.org> AuthorDate: 2024-12-12 16:30:39 +0000 Commit: Andrew Turner <andrew@FreeBSD.org> CommitDate: 2024-12-12 18:00:23 +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 --- 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 d90b7c0c01f8..1ff3a6bda707 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)) { @@ -504,6 +506,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), @@ -517,6 +543,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 */ };