drivers: pci: update prt retrieve based on pnp id

update prt retrieve based on acpi pnp id instead of acpi device
path/name

Signed-off-by: Najumon B.A <najumon.ba@intel.com>
This commit is contained in:
Najumon B.A 2023-10-31 19:22:57 +05:30 committed by Carles Cufí
parent 940c66f82e
commit 34a2fbfba1
3 changed files with 36 additions and 10 deletions

View file

@ -5,6 +5,8 @@
* SPDX-License-Identifier: Apache-2.0 * SPDX-License-Identifier: Apache-2.0
*/ */
#define DT_DRV_COMPAT pcie_controller
#include <zephyr/logging/log.h> #include <zephyr/logging/log.h>
LOG_MODULE_REGISTER(pcie, LOG_LEVEL_ERR); LOG_MODULE_REGISTER(pcie, LOG_LEVEL_ERR);
@ -28,6 +30,11 @@ LOG_MODULE_REGISTER(pcie, LOG_LEVEL_ERR);
#include <zephyr/drivers/pcie/controller.h> #include <zephyr/drivers/pcie/controller.h>
#endif #endif
#ifdef CONFIG_PCIE_PRT
/* platform interrupt are hardwired or can be dynamically allocated. */
static bool prt_en;
#endif
/* functions documented in drivers/pcie/pcie.h */ /* functions documented in drivers/pcie/pcie.h */
bool pcie_probe(pcie_bdf_t bdf, pcie_id_t id) bool pcie_probe(pcie_bdf_t bdf, pcie_id_t id)
@ -303,8 +310,16 @@ unsigned int pcie_alloc_irq(pcie_bdf_t bdf)
irq >= CONFIG_MAX_IRQ_LINES || irq >= CONFIG_MAX_IRQ_LINES ||
arch_irq_is_used(irq)) { arch_irq_is_used(irq)) {
/* In some platforms, PCI interrupts are hardwired to specific interrupt inputs
* on the interrupt controller and are not configurable. Hence we need to retrieve
* IRQ from acpi. But if it is configurable then we allocate irq dynamically.
*/
#ifdef CONFIG_PCIE_PRT #ifdef CONFIG_PCIE_PRT
irq = acpi_legacy_irq_get(bdf); if (prt_en) {
irq = acpi_legacy_irq_get(bdf);
} else {
irq = arch_irq_allocate();
}
#else #else
irq = arch_irq_allocate(); irq = arch_irq_allocate();
#endif #endif
@ -545,6 +560,21 @@ static int pcie_init(void)
.flags = PCIE_SCAN_RECURSIVE, .flags = PCIE_SCAN_RECURSIVE,
}; };
#ifdef CONFIG_PCIE_PRT
const char *hid, *uid = ACPI_DT_UID(DT_DRV_INST(0));
int ret;
BUILD_ASSERT(ACPI_DT_HAS_HID(DT_DRV_INST(0)),
"No HID property for PCIe devicetree node");
hid = ACPI_DT_HID(DT_DRV_INST(0));
ret = acpi_legacy_irq_init(hid, uid);
if (!ret) {
prt_en = true;
} else {
__ASSERT(ret == -ENOENT, "Error retrieve interrupt routing table!");
}
#endif
STRUCT_SECTION_COUNT(pcie_dev, &data.max_dev); STRUCT_SECTION_COUNT(pcie_dev, &data.max_dev);
/* Don't bother calling pcie_scan() if there are no devices to look for */ /* Don't bother calling pcie_scan() if there are no devices to look for */

View file

@ -1,8 +0,0 @@
# Copyright (c) 2020 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
description: Intel PCIe host controller
compatible: "intel,pcie"
include: pcie-controller.yaml

View file

@ -3,7 +3,11 @@
# Common fields for PCIe bus controllers # Common fields for PCIe bus controllers
include: base.yaml include: [base.yaml, acpi.yaml]
description: Generic PCIe host controller
compatible: "pcie-controller"
bus: pcie bus: pcie