Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/pci/pci_host_generic_acpi.c
Show All 33 Lines | |||||
#include <sys/cdefs.h> | #include <sys/cdefs.h> | ||||
__FBSDID("$FreeBSD$"); | __FBSDID("$FreeBSD$"); | ||||
#include "opt_platform.h" | #include "opt_platform.h" | ||||
#include <sys/param.h> | #include <sys/param.h> | ||||
#include <sys/systm.h> | #include <sys/systm.h> | ||||
#include <sys/malloc.h> | #include <sys/malloc.h> | ||||
#include <sys/memdesc.h> | |||||
#include <sys/kernel.h> | #include <sys/kernel.h> | ||||
#include <sys/tree.h> | |||||
#include <sys/rman.h> | #include <sys/rman.h> | ||||
#include <sys/module.h> | #include <sys/module.h> | ||||
#include <sys/bus.h> | #include <sys/bus.h> | ||||
#include <sys/endian.h> | #include <sys/endian.h> | ||||
#include <sys/cpuset.h> | #include <sys/cpuset.h> | ||||
#include <sys/rwlock.h> | #include <sys/rwlock.h> | ||||
#include <vm/vm.h> | |||||
#include <vm/vm_page.h> | |||||
#include <contrib/dev/acpica/include/acpi.h> | #include <contrib/dev/acpica/include/acpi.h> | ||||
#include <contrib/dev/acpica/include/accommon.h> | #include <contrib/dev/acpica/include/accommon.h> | ||||
#include <dev/acpica/acpivar.h> | #include <dev/acpica/acpivar.h> | ||||
#include <dev/acpica/acpi_pcibvar.h> | #include <dev/acpica/acpi_pcibvar.h> | ||||
#include <dev/pci/pcivar.h> | #include <dev/pci/pcivar.h> | ||||
#include <dev/pci/pcireg.h> | #include <dev/pci/pcireg.h> | ||||
#include <dev/pci/pcib_private.h> | #include <dev/pci/pcib_private.h> | ||||
#include <dev/pci/pci_host_generic.h> | #include <dev/pci/pci_host_generic.h> | ||||
#include <dev/pci/pci_host_generic_acpi.h> | #include <dev/pci/pci_host_generic_acpi.h> | ||||
#include <dev/iommu/busdma_iommu.h> | |||||
#include <machine/cpu.h> | #include <machine/cpu.h> | ||||
#include <machine/bus.h> | #include <machine/bus.h> | ||||
#include <machine/intr.h> | #include <machine/intr.h> | ||||
#include <machine/iommu.h> | |||||
#include "pcib_if.h" | #include "pcib_if.h" | ||||
#include "acpi_bus_if.h" | #include "acpi_bus_if.h" | ||||
/* Assembling ECAM Configuration Address */ | /* Assembling ECAM Configuration Address */ | ||||
#define PCIE_BUS_SHIFT 20 | #define PCIE_BUS_SHIFT 20 | ||||
#define PCIE_SLOT_SHIFT 15 | #define PCIE_SLOT_SHIFT 15 | ||||
#define PCIE_FUNC_SHIFT 12 | #define PCIE_FUNC_SHIFT 12 | ||||
▲ Show 20 Lines • Show All 313 Lines • ▼ Show 20 Lines | #else | ||||
return (ENXIO); | return (ENXIO); | ||||
#endif | #endif | ||||
} | } | ||||
static int | static int | ||||
generic_pcie_acpi_map_msi(device_t pci, device_t child, int irq, uint64_t *addr, | generic_pcie_acpi_map_msi(device_t pci, device_t child, int irq, uint64_t *addr, | ||||
uint32_t *data) | uint32_t *data) | ||||
{ | { | ||||
int error; | |||||
#if defined(INTRNG) | #if defined(INTRNG) | ||||
return (intr_map_msi(pci, child, generic_pcie_get_xref(pci, child), irq, | error = intr_map_msi(pci, child, generic_pcie_get_xref(pci, child), irq, | ||||
addr, data)); | addr, data); | ||||
if (error) | |||||
return (error); | |||||
#else | #else | ||||
return (ENXIO); | return (ENXIO); | ||||
#endif | #endif | ||||
#if defined(ACPI_SMMU) | |||||
error = smmu_map_msi(child, *addr); | |||||
mmel: this should be called by using common IOMMU interface - you may have different IOMMUs in one… | |||||
Done Inline Actionsyes we are currently reworking this part br: yes we are currently reworking this part | |||||
if (error) | |||||
return (error); | |||||
#endif | |||||
return (0); | |||||
} | } | ||||
static int | static int | ||||
generic_pcie_acpi_alloc_msix(device_t pci, device_t child, int *irq) | generic_pcie_acpi_alloc_msix(device_t pci, device_t child, int *irq) | ||||
{ | { | ||||
#if defined(INTRNG) | #if defined(INTRNG) | ||||
return (intr_alloc_msix(pci, child, generic_pcie_get_xref(pci, child), | return (intr_alloc_msix(pci, child, generic_pcie_get_xref(pci, child), | ||||
▲ Show 20 Lines • Show All 53 Lines • Show Last 20 Lines |
this should be called by using common IOMMU interface - you may have different IOMMUs in one system.