-
Notifications
You must be signed in to change notification settings - Fork 6.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add acpi device resource enumeration support #62694
Changes from all commits
951ae52
8ecbe96
ec96619
a5e52de
f73a6a9
122af4c
eb83021
1a3fbd5
0cbbdb0
c58b8e4
142cfaf
08ecb14
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/* | ||
* Copyright (c) 2023, Intel Corporation | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
#include <zephyr/acpi/acpi.h> | ||
#include <zephyr/dt-bindings/interrupt-controller/intel-ioapic.h> | ||
|
||
uint32_t arch_acpi_encode_irq_flags(uint8_t polarity, uint8_t trigger) | ||
{ | ||
uint32_t irq_flag = IRQ_DELIVERY_LOWEST; | ||
|
||
if (trigger == ACPI_LEVEL_SENSITIVE) { | ||
irq_flag |= IRQ_TYPE_LEVEL; | ||
} else { | ||
irq_flag |= IRQ_TYPE_EDGE; | ||
} | ||
|
||
if (polarity == ACPI_ACTIVE_HIGH) { | ||
irq_flag |= IRQ_TYPE_HIGH; | ||
} else if (polarity == ACPI_ACTIVE_LOW) { | ||
irq_flag |= IRQ_TYPE_LOW; | ||
} | ||
|
||
return irq_flag; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,8 @@ | |
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
#define DT_DRV_COMPAT pcie_controller | ||
|
||
#include <zephyr/logging/log.h> | ||
LOG_MODULE_REGISTER(pcie, LOG_LEVEL_ERR); | ||
|
||
|
@@ -28,6 +30,11 @@ LOG_MODULE_REGISTER(pcie, LOG_LEVEL_ERR); | |
#include <zephyr/drivers/pcie/controller.h> | ||
#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 */ | ||
|
||
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 || | ||
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 | ||
irq = acpi_legacy_irq_get(bdf); | ||
if (prt_en) { | ||
irq = acpi_legacy_irq_get(bdf); | ||
} else { | ||
irq = arch_irq_allocate(); | ||
} | ||
#else | ||
irq = arch_irq_allocate(); | ||
#endif | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. rewrite the above so it becomes:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
@tbursztyka I don't think what you proposed will generate correct code, since it leaves out the |
||
|
@@ -545,6 +560,21 @@ static int pcie_init(void) | |
.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); | ||
/* Don't bother calling pcie_scan() if there are no devices to look for */ | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# Copyright (c) 2023 Intel Corporation | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
# Common fields for ACPI informed based devices | ||
|
||
properties: | ||
acpi-hid: | ||
type: string | ||
description: Used to supply OSPM with the device’s PNP ID or ACPI ID. | ||
A node is consder as acpi based or not based on whether this property | ||
is present or not. | ||
|
||
acpi-uid: | ||
type: string | ||
description: | | ||
Provides OSPM with a logical device ID that does not change | ||
across reboots. This object is optional, but is required when the device | ||
has no other way to report a persistent unique device ID. The _UID must be | ||
unique across all devices with either a common _HID or _CID. | ||
|
||
acpi-comp-id: | ||
type: string-array | ||
description: Used to supply OSPM with a device’s Plug and Play-Compatible Device ID |
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so this change should go in the previous patch that remove "intel,pcie"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Which commit you referring ? This commit is specifically for board configuration changes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think @tbursztyka is referring to the commit where you remove the intel,pcie binding (yaml) file. Once that file is removed there shouldn't be any more references to "intel,pcie" in dts files or the documentation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated