diff mbox series

[v5,2/2] Add acpi_check_dsm() for PCI _DSM definitions

Message ID 20250313100658.15805-2-zhoushengqing@ttyinfo.com (mailing list archive)
State Changes Requested, archived
Headers show
Series [v5,1/2] Add rev 2 check for PRESERVE_BOOT_CONFIG function | expand

Commit Message

Zhou Shengqing March 13, 2025, 10:06 a.m. UTC
add acpi_check_dsm() for DSM_PCI_POWER_ON_RESET_DELAY,
DSM_PCI_DEVICE_READINESS_DURATIONS.

Signed-off-by: Zhou Shengqing <zhoushengqing@ttyinfo.com>
---
 drivers/pci/pci-acpi.c | 8 ++++++++
 1 file changed, 8 insertions(+)

Comments

Rafael J. Wysocki March 27, 2025, 7:09 p.m. UTC | #1
On Thu, Mar 13, 2025 at 11:07 AM Zhou Shengqing
<zhoushengqing@ttyinfo.com> wrote:
>
> add acpi_check_dsm() for DSM_PCI_POWER_ON_RESET_DELAY,
> DSM_PCI_DEVICE_READINESS_DURATIONS.
>
> Signed-off-by: Zhou Shengqing <zhoushengqing@ttyinfo.com>
> ---
>  drivers/pci/pci-acpi.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
>
> diff --git a/drivers/pci/pci-acpi.c b/drivers/pci/pci-acpi.c
> index 4f9e0548c96d..47caad28a133 100644
> --- a/drivers/pci/pci-acpi.c
> +++ b/drivers/pci/pci-acpi.c
> @@ -1257,6 +1257,10 @@ void acpi_pci_add_bus(struct pci_bus *bus)
>         if (!pci_is_root_bus(bus))
>                 return;
>
> +       if (!acpi_check_dsm(ACPI_HANDLE(bus->bridge), &pci_acpi_dsm_guid, 3,
> +                               BIT(DSM_PCI_POWER_ON_RESET_DELAY)))
> +               return;
> +
>         obj = acpi_evaluate_dsm_typed(ACPI_HANDLE(bus->bridge), &pci_acpi_dsm_guid, 3,
>                                       DSM_PCI_POWER_ON_RESET_DELAY, NULL, ACPI_TYPE_INTEGER);
>         if (!obj)
> @@ -1418,6 +1422,10 @@ static void pci_acpi_optimize_delay(struct pci_dev *pdev,
>         if (bridge->ignore_reset_delay)
>                 pdev->d3cold_delay = 0;
>
> +       if (!acpi_check_dsm(handle, &pci_acpi_dsm_guid, 3,
> +                               BIT(DSM_PCI_DEVICE_READINESS_DURATIONS)))
> +               return;
> +
>         obj = acpi_evaluate_dsm_typed(handle, &pci_acpi_dsm_guid, 3,
>                                       DSM_PCI_DEVICE_READINESS_DURATIONS, NULL,
>                                       ACPI_TYPE_PACKAGE);
> --

The code changes look reasonable to me, although it would be cleaner
to use a local variable for the revision instead of repeating the
number 3 multiple times, but please add the "PCI/ACPI:" prefix to the
subject.
diff mbox series

Patch

diff --git a/drivers/pci/pci-acpi.c b/drivers/pci/pci-acpi.c
index 4f9e0548c96d..47caad28a133 100644
--- a/drivers/pci/pci-acpi.c
+++ b/drivers/pci/pci-acpi.c
@@ -1257,6 +1257,10 @@  void acpi_pci_add_bus(struct pci_bus *bus)
 	if (!pci_is_root_bus(bus))
 		return;
 
+	if (!acpi_check_dsm(ACPI_HANDLE(bus->bridge), &pci_acpi_dsm_guid, 3,
+				BIT(DSM_PCI_POWER_ON_RESET_DELAY)))
+		return;
+
 	obj = acpi_evaluate_dsm_typed(ACPI_HANDLE(bus->bridge), &pci_acpi_dsm_guid, 3,
 				      DSM_PCI_POWER_ON_RESET_DELAY, NULL, ACPI_TYPE_INTEGER);
 	if (!obj)
@@ -1418,6 +1422,10 @@  static void pci_acpi_optimize_delay(struct pci_dev *pdev,
 	if (bridge->ignore_reset_delay)
 		pdev->d3cold_delay = 0;
 
+	if (!acpi_check_dsm(handle, &pci_acpi_dsm_guid, 3,
+				BIT(DSM_PCI_DEVICE_READINESS_DURATIONS)))
+		return;
+
 	obj = acpi_evaluate_dsm_typed(handle, &pci_acpi_dsm_guid, 3,
 				      DSM_PCI_DEVICE_READINESS_DURATIONS, NULL,
 				      ACPI_TYPE_PACKAGE);