linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] PCI: Rename _DSM constants to align with PCI Firmware specification
@ 2020-05-26 21:39 Krzysztof Wilczyński
  2020-05-27 21:48 ` Bjorn Helgaas
  0 siblings, 1 reply; 2+ messages in thread
From: Krzysztof Wilczyński @ 2020-05-26 21:39 UTC (permalink / raw)
  To: Bjorn Helgaas; +Cc: Rafael J. Wysocki, Len Brown, linux-pci, linux-acpi

Rename PCI-related _DSM constants to better align them with the PCI
Firmware specification (see PCI Firmware Specification, Revision 3.2,
Section 4.6., p. 58).  All the constants names should correlate more
strongly with the descriptions in the aforementioned specification to
make them unambiguous.

Additionally, all of the renamed constants will use the DSM_ prefix,
similarly to the PCI _OSC constants that use the OSC_ prefix, to make it
clear what these are.

Signed-off-by: Krzysztof Wilczyński <kw@linux.com>
---
 drivers/acpi/pci_root.c  |  2 +-
 drivers/pci/pci-acpi.c   |  4 ++--
 drivers/pci/pci-label.c  |  4 ++--
 include/linux/pci-acpi.h | 10 ++++++----
 4 files changed, 11 insertions(+), 9 deletions(-)

diff --git a/drivers/acpi/pci_root.c b/drivers/acpi/pci_root.c
index ac8ad6cb82aa..ee4d0bf717fd 100644
--- a/drivers/acpi/pci_root.c
+++ b/drivers/acpi/pci_root.c
@@ -938,7 +938,7 @@ struct pci_bus *acpi_pci_root_create(struct acpi_pci_root *root,
 	 * assignments made by firmware for this host bridge.
 	 */
 	obj = acpi_evaluate_dsm(ACPI_HANDLE(bus->bridge), &pci_acpi_dsm_guid, 1,
-	                        IGNORE_PCI_BOOT_CONFIG_DSM, NULL);
+				DSM_PCI_IGNORE_BOOT_CONFIG, NULL);
 	if (obj && obj->type == ACPI_TYPE_INTEGER && obj->integer.value == 0)
 		host_bridge->preserve_config = 1;
 	ACPI_FREE(obj);
diff --git a/drivers/pci/pci-acpi.c b/drivers/pci/pci-acpi.c
index d21969fba6ab..a2e9f01434de 100644
--- a/drivers/pci/pci-acpi.c
+++ b/drivers/pci/pci-acpi.c
@@ -1128,7 +1128,7 @@ void acpi_pci_add_bus(struct pci_bus *bus)
 		return;
 
 	obj = acpi_evaluate_dsm(ACPI_HANDLE(bus->bridge), &pci_acpi_dsm_guid, 3,
-				RESET_DELAY_DSM, NULL);
+				DSM_PCI_POWER_ON_RESET_DELAY, NULL);
 	if (!obj)
 		return;
 
@@ -1193,7 +1193,7 @@ static void pci_acpi_optimize_delay(struct pci_dev *pdev,
 		pdev->d3cold_delay = 0;
 
 	obj = acpi_evaluate_dsm(handle, &pci_acpi_dsm_guid, 3,
-				FUNCTION_DELAY_DSM, NULL);
+				DSM_PCI_DEVICE_READINESS_DURATIONS, NULL);
 	if (!obj)
 		return;
 
diff --git a/drivers/pci/pci-label.c b/drivers/pci/pci-label.c
index a5910f942857..69db1fd10f21 100644
--- a/drivers/pci/pci-label.c
+++ b/drivers/pci/pci-label.c
@@ -178,7 +178,7 @@ static int dsm_get_label(struct device *dev, char *buf,
 		return -1;
 
 	obj = acpi_evaluate_dsm(handle, &pci_acpi_dsm_guid, 0x2,
-				DEVICE_LABEL_DSM, NULL);
+				DSM_PCI_PCIE_DEVICE_NAME, NULL);
 	if (!obj)
 		return -1;
 
@@ -218,7 +218,7 @@ static bool device_has_dsm(struct device *dev)
 		return false;
 
 	return !!acpi_check_dsm(handle, &pci_acpi_dsm_guid, 0x2,
-				1 << DEVICE_LABEL_DSM);
+				1 << DSM_PCI_PCIE_DEVICE_NAME);
 }
 
 static umode_t acpi_index_string_exist(struct kobject *kobj,
diff --git a/include/linux/pci-acpi.h b/include/linux/pci-acpi.h
index 2d155bfb8fbf..21b32fe47607 100644
--- a/include/linux/pci-acpi.h
+++ b/include/linux/pci-acpi.h
@@ -107,10 +107,12 @@ static inline void acpiphp_check_host_bridge(struct acpi_device *adev) { }
 #endif
 
 extern const guid_t pci_acpi_dsm_guid;
-#define IGNORE_PCI_BOOT_CONFIG_DSM	0x05
-#define DEVICE_LABEL_DSM		0x07
-#define RESET_DELAY_DSM			0x08
-#define FUNCTION_DELAY_DSM		0x09
+
+/* _DSM Definitions for PCI */
+#define DSM_PCI_IGNORE_BOOT_CONFIG		0x05
+#define DSM_PCI_PCIE_DEVICE_NAME		0x07
+#define DSM_PCI_POWER_ON_RESET_DELAY		0x08
+#define DSM_PCI_DEVICE_READINESS_DURATIONS	0x09
 
 #ifdef CONFIG_PCIE_EDR
 void pci_acpi_add_edr_notifier(struct pci_dev *pdev);
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] PCI: Rename _DSM constants to align with PCI Firmware specification
  2020-05-26 21:39 [PATCH] PCI: Rename _DSM constants to align with PCI Firmware specification Krzysztof Wilczyński
@ 2020-05-27 21:48 ` Bjorn Helgaas
  0 siblings, 0 replies; 2+ messages in thread
From: Bjorn Helgaas @ 2020-05-27 21:48 UTC (permalink / raw)
  To: Krzysztof Wilczyński
  Cc: Bjorn Helgaas, Rafael J. Wysocki, Len Brown, linux-pci, linux-acpi

On Tue, May 26, 2020 at 09:39:05PM +0000, Krzysztof Wilczyński wrote:
> Rename PCI-related _DSM constants to better align them with the PCI
> Firmware specification (see PCI Firmware Specification, Revision 3.2,
> Section 4.6., p. 58).  All the constants names should correlate more
> strongly with the descriptions in the aforementioned specification to
> make them unambiguous.
> 
> Additionally, all of the renamed constants will use the DSM_ prefix,
> similarly to the PCI _OSC constants that use the OSC_ prefix, to make it
> clear what these are.
> 
> Signed-off-by: Krzysztof Wilczyński <kw@linux.com>

Applied to pci/misc for v5.8, thanks!

> ---
>  drivers/acpi/pci_root.c  |  2 +-
>  drivers/pci/pci-acpi.c   |  4 ++--
>  drivers/pci/pci-label.c  |  4 ++--
>  include/linux/pci-acpi.h | 10 ++++++----
>  4 files changed, 11 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/acpi/pci_root.c b/drivers/acpi/pci_root.c
> index ac8ad6cb82aa..ee4d0bf717fd 100644
> --- a/drivers/acpi/pci_root.c
> +++ b/drivers/acpi/pci_root.c
> @@ -938,7 +938,7 @@ struct pci_bus *acpi_pci_root_create(struct acpi_pci_root *root,
>  	 * assignments made by firmware for this host bridge.
>  	 */
>  	obj = acpi_evaluate_dsm(ACPI_HANDLE(bus->bridge), &pci_acpi_dsm_guid, 1,
> -	                        IGNORE_PCI_BOOT_CONFIG_DSM, NULL);
> +				DSM_PCI_IGNORE_BOOT_CONFIG, NULL);
>  	if (obj && obj->type == ACPI_TYPE_INTEGER && obj->integer.value == 0)
>  		host_bridge->preserve_config = 1;
>  	ACPI_FREE(obj);
> diff --git a/drivers/pci/pci-acpi.c b/drivers/pci/pci-acpi.c
> index d21969fba6ab..a2e9f01434de 100644
> --- a/drivers/pci/pci-acpi.c
> +++ b/drivers/pci/pci-acpi.c
> @@ -1128,7 +1128,7 @@ void acpi_pci_add_bus(struct pci_bus *bus)
>  		return;
>  
>  	obj = acpi_evaluate_dsm(ACPI_HANDLE(bus->bridge), &pci_acpi_dsm_guid, 3,
> -				RESET_DELAY_DSM, NULL);
> +				DSM_PCI_POWER_ON_RESET_DELAY, NULL);
>  	if (!obj)
>  		return;
>  
> @@ -1193,7 +1193,7 @@ static void pci_acpi_optimize_delay(struct pci_dev *pdev,
>  		pdev->d3cold_delay = 0;
>  
>  	obj = acpi_evaluate_dsm(handle, &pci_acpi_dsm_guid, 3,
> -				FUNCTION_DELAY_DSM, NULL);
> +				DSM_PCI_DEVICE_READINESS_DURATIONS, NULL);
>  	if (!obj)
>  		return;
>  
> diff --git a/drivers/pci/pci-label.c b/drivers/pci/pci-label.c
> index a5910f942857..69db1fd10f21 100644
> --- a/drivers/pci/pci-label.c
> +++ b/drivers/pci/pci-label.c
> @@ -178,7 +178,7 @@ static int dsm_get_label(struct device *dev, char *buf,
>  		return -1;
>  
>  	obj = acpi_evaluate_dsm(handle, &pci_acpi_dsm_guid, 0x2,
> -				DEVICE_LABEL_DSM, NULL);
> +				DSM_PCI_PCIE_DEVICE_NAME, NULL);
>  	if (!obj)
>  		return -1;
>  
> @@ -218,7 +218,7 @@ static bool device_has_dsm(struct device *dev)
>  		return false;
>  
>  	return !!acpi_check_dsm(handle, &pci_acpi_dsm_guid, 0x2,
> -				1 << DEVICE_LABEL_DSM);
> +				1 << DSM_PCI_PCIE_DEVICE_NAME);
>  }
>  
>  static umode_t acpi_index_string_exist(struct kobject *kobj,
> diff --git a/include/linux/pci-acpi.h b/include/linux/pci-acpi.h
> index 2d155bfb8fbf..21b32fe47607 100644
> --- a/include/linux/pci-acpi.h
> +++ b/include/linux/pci-acpi.h
> @@ -107,10 +107,12 @@ static inline void acpiphp_check_host_bridge(struct acpi_device *adev) { }
>  #endif
>  
>  extern const guid_t pci_acpi_dsm_guid;
> -#define IGNORE_PCI_BOOT_CONFIG_DSM	0x05
> -#define DEVICE_LABEL_DSM		0x07
> -#define RESET_DELAY_DSM			0x08
> -#define FUNCTION_DELAY_DSM		0x09
> +
> +/* _DSM Definitions for PCI */
> +#define DSM_PCI_IGNORE_BOOT_CONFIG		0x05
> +#define DSM_PCI_PCIE_DEVICE_NAME		0x07
> +#define DSM_PCI_POWER_ON_RESET_DELAY		0x08
> +#define DSM_PCI_DEVICE_READINESS_DURATIONS	0x09
>  
>  #ifdef CONFIG_PCIE_EDR
>  void pci_acpi_add_edr_notifier(struct pci_dev *pdev);
> -- 
> 2.26.2
> 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-05-27 21:48 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-26 21:39 [PATCH] PCI: Rename _DSM constants to align with PCI Firmware specification Krzysztof Wilczyński
2020-05-27 21:48 ` Bjorn Helgaas

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).