arm64: Use ACPI for PCI interrupt routing.
Change-Id: I4bf578aacda1be44cf5b8f95681a57ab5eabda23 Reviewed-on: https://review.haiku-os.org/c/haiku/+/5278 Tested-by: Commit checker robot <[email protected]> Reviewed-by: David Karoly <[email protected]> Reviewed-by: Fredrik Holmqvist <[email protected]>
This commit is contained in:
@@ -6,6 +6,8 @@ UsePrivateKernelHeaders ;
|
|||||||
UsePrivateHeaders kernel [ FDirName kernel arch $(TARGET_ARCH) ]
|
UsePrivateHeaders kernel [ FDirName kernel arch $(TARGET_ARCH) ]
|
||||||
[ FDirName kernel boot platform $(HAIKU_BOOT_PLATFORM) ] ;
|
[ FDirName kernel boot platform $(HAIKU_BOOT_PLATFORM) ] ;
|
||||||
|
|
||||||
|
SubDirHdrs $(HAIKU_TOP) src system kernel arch generic ;
|
||||||
|
|
||||||
SEARCH_SOURCE += [ FDirName $(SUBDIR) $(DOTDOT) generic ] ;
|
SEARCH_SOURCE += [ FDirName $(SUBDIR) $(DOTDOT) generic ] ;
|
||||||
|
|
||||||
KernelStaticLibrary pci_arch_bus_manager :
|
KernelStaticLibrary pci_arch_bus_manager :
|
||||||
|
|||||||
@@ -7,6 +7,7 @@
|
|||||||
#include "pci_controller.h"
|
#include "pci_controller.h"
|
||||||
|
|
||||||
#include <kernel/debug.h>
|
#include <kernel/debug.h>
|
||||||
|
#include <kernel/int.h>
|
||||||
#include <util/Vector.h>
|
#include <util/Vector.h>
|
||||||
|
|
||||||
#include <AutoDeleterDrivers.h>
|
#include <AutoDeleterDrivers.h>
|
||||||
@@ -16,6 +17,8 @@
|
|||||||
#include <ACPI.h> // module
|
#include <ACPI.h> // module
|
||||||
#include <acpi.h>
|
#include <acpi.h>
|
||||||
|
|
||||||
|
#include "acpi_irq_routing_table.h"
|
||||||
|
|
||||||
|
|
||||||
addr_t gPCIeBase;
|
addr_t gPCIeBase;
|
||||||
uint8 gStartBusNumber;
|
uint8 gStartBusNumber;
|
||||||
@@ -92,6 +95,13 @@ AcpiCrsScanCallback(acpi_resource *res, void *context)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static bool
|
||||||
|
is_interrupt_available(int32 gsi)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
pci_controller_init(void)
|
pci_controller_init(void)
|
||||||
{
|
{
|
||||||
@@ -191,6 +201,38 @@ pci_controller_init(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
status_t
|
||||||
|
pci_controller_finalize(void)
|
||||||
|
{
|
||||||
|
status_t res;
|
||||||
|
|
||||||
|
acpi_module_info *acpiModule;
|
||||||
|
res = get_module(B_ACPI_MODULE_NAME, (module_info**)&acpiModule);
|
||||||
|
if (res != B_OK)
|
||||||
|
return B_ERROR;
|
||||||
|
|
||||||
|
IRQRoutingTable table;
|
||||||
|
res = prepare_irq_routing(acpiModule, table, &is_interrupt_available);
|
||||||
|
if (res != B_OK) {
|
||||||
|
dprintf("PCI: irq routing preparation failed\n");
|
||||||
|
return B_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (Vector<irq_routing_entry>::Iterator it = table.Begin(); it != table.End(); it++)
|
||||||
|
reserve_io_interrupt_vectors(1, it->irq, INTERRUPT_TYPE_IRQ);
|
||||||
|
|
||||||
|
res = enable_irq_routing(acpiModule, table);
|
||||||
|
if (res != B_OK) {
|
||||||
|
dprintf("PCI: irq routing failed\n");
|
||||||
|
return B_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
print_irq_routing_table(table);
|
||||||
|
|
||||||
|
return B_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
phys_addr_t
|
phys_addr_t
|
||||||
pci_ram_address(phys_addr_t addr)
|
pci_ram_address(phys_addr_t addr)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -476,6 +476,9 @@ pcirefresh(int argc, char **argv)
|
|||||||
static bool sInitDone;
|
static bool sInitDone;
|
||||||
|
|
||||||
|
|
||||||
|
status_t __attribute__((weak)) pci_controller_finalize() { return B_OK; }
|
||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
pci_init_deferred(void)
|
pci_init_deferred(void)
|
||||||
{
|
{
|
||||||
@@ -516,6 +519,11 @@ pci_init_deferred(void)
|
|||||||
add_debugger_command("pcistatus", &pcistatus, "dump and clear pci device status registers");
|
add_debugger_command("pcistatus", &pcistatus, "dump and clear pci device status registers");
|
||||||
add_debugger_command("pcirefresh", &pcirefresh, "refresh and print all pci_info");
|
add_debugger_command("pcirefresh", &pcirefresh, "refresh and print all pci_info");
|
||||||
|
|
||||||
|
if (pci_controller_finalize() != B_OK) {
|
||||||
|
TRACE(("PCI: pci_controller_finalize failed\n"));
|
||||||
|
return B_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
sInitDone = true;
|
sInitDone = true;
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,6 +38,7 @@ extern "C" {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
status_t pci_controller_init(void);
|
status_t pci_controller_init(void);
|
||||||
|
status_t pci_controller_finalize(void);
|
||||||
status_t pci_controller_add(pci_controller *controller, void *cookie);
|
status_t pci_controller_add(pci_controller *controller, void *cookie);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
SubDir HAIKU_TOP src system kernel arch arm64 ;
|
SubDir HAIKU_TOP src system kernel arch arm64 ;
|
||||||
|
|
||||||
|
SubDirHdrs $(HAIKU_TOP) src add-ons kernel bus_managers acpi acpica include ;
|
||||||
SubDirHdrs $(SUBDIR) $(DOTDOT) generic ;
|
SubDirHdrs $(SUBDIR) $(DOTDOT) generic ;
|
||||||
UsePrivateKernelHeaders ;
|
UsePrivateKernelHeaders ;
|
||||||
|
|
||||||
@@ -25,6 +26,7 @@ KernelMergeObject kernel_arch_arm64.o :
|
|||||||
arch_asm.S
|
arch_asm.S
|
||||||
arch_int_gicv2.cpp
|
arch_int_gicv2.cpp
|
||||||
soc.cpp
|
soc.cpp
|
||||||
|
acpi_irq_routing_table.cpp
|
||||||
|
|
||||||
VMSAv8TranslationMap.cpp
|
VMSAv8TranslationMap.cpp
|
||||||
PMAPPhysicalPageMapper.cpp
|
PMAPPhysicalPageMapper.cpp
|
||||||
|
|||||||
Reference in New Issue
Block a user