From 20c368af696ff2e31532d539c52b82419473ebee Mon Sep 17 00:00:00 2001 From: chetan singh rathore Date: Wed, 6 Nov 2024 04:42:34 +0000 Subject: [PATCH 1/2] Update sbsa_pal_linux.h --- .../files/platform/pal_linux/files/sbsa/include/sbsa_pal_linux.h | 1 + 1 file changed, 1 insertion(+) diff --git a/acs-drv/files/platform/pal_linux/files/sbsa/include/sbsa_pal_linux.h b/acs-drv/files/platform/pal_linux/files/sbsa/include/sbsa_pal_linux.h index bc40b26..a2f2f7a 100644 --- a/acs-drv/files/platform/pal_linux/files/sbsa/include/sbsa_pal_linux.h +++ b/acs-drv/files/platform/pal_linux/files/sbsa/include/sbsa_pal_linux.h @@ -39,5 +39,6 @@ uint32_t pal_get_device_path(const char *hid, char hid_path[][MAX_NAMED_COMP_LEN uint32_t pal_smmu_is_etr_behind_catu(char *etr_path); +uint32_t pal_pcie_dsm_ste_tags(void); #endif -- GitLab From b5b83c1fc614a8acee6adc9563e12c14a0824cdc Mon Sep 17 00:00:00 2001 From: chetan singh rathore Date: Wed, 6 Nov 2024 04:44:49 +0000 Subject: [PATCH 2/2] Update sbsa_pal_pcie.c --- .../pal_linux/files/sbsa/src/sbsa_pal_pcie.c | 83 +++++++++++++++++++ 1 file changed, 83 insertions(+) diff --git a/acs-drv/files/platform/pal_linux/files/sbsa/src/sbsa_pal_pcie.c b/acs-drv/files/platform/pal_linux/files/sbsa/src/sbsa_pal_pcie.c index df9cd7a..c63d18b 100644 --- a/acs-drv/files/platform/pal_linux/files/sbsa/src/sbsa_pal_pcie.c +++ b/acs-drv/files/platform/pal_linux/files/sbsa/src/sbsa_pal_pcie.c @@ -23,9 +23,26 @@ #include #include #include +#include +#include "common/include/pal_linux.h" +#include "sbsa/include/sbsa_pal_linux.h" #include "val/sbsa/include/sbsa_pal_interface.h" +#define NOT_IMPLEMENTED 0x4B1D + +/* UUID for PCIe */ +static const guid_t pci_guid = + GUID_INIT(0xE5C937D0, 0x3553, 0x4D7A, + 0x91, 0x17, 0xEA, 0x4D, 0x19, 0xC3, 0x43, 0x4D); + +/* Defines for the _DSM method for obtaining Steering tag value */ +#define PCI_REVISION 0x6 +#define PCI_FUNC_INDEX 0x0E + +acpi_status ste_user_function(acpi_handle handle, uint32_t level, void *context, void **return_value); + + /** @brief Gets RP support of transaction forwarding. @@ -42,3 +59,69 @@ pal_pcie_get_rp_transaction_frwd_support(uint32_t seg, uint32_t bus, uint32_t de { return 1; } + + + +/** + @brief This function is called by the function pal_pcie_dsm_ste_tags + when the any device is found + + @param handle device handle + @param level nesting level + @param context data to be passed from caller function + @param return_value return value passed to caller function pal_pcie_dsm_ste_tags + + @return 0 - Failure, NOT_IMPLEMENTED - DSM Method not implemented, Other values - PASS +**/ +acpi_status ste_user_function(acpi_handle handle, uint32_t level, + void *context, void **return_value) +{ + + acpi_status status; + struct acpi_buffer buffer; + union acpi_object *obj; + uint32_t ste_value; + + buffer.length = ACPI_ALLOCATE_BUFFER; + status = acpi_get_name(handle, ACPI_FULL_PATHNAME, &buffer); + + if (acpi_has_method(handle, "_DSM")) { + obj = acpi_evaluate_dsm_typed(handle, &pci_guid, PCI_REVISION, + PCI_FUNC_INDEX, NULL, ACPI_TYPE_INTEGER); + + if (!obj) { + acs_print(ACS_PRINT_INFO,"\n DSM method for STE not present.", 0); + return NOT_IMPLEMENTED; + } + + ste_value = obj->integer.value; + acs_print(ACS_PRINT_DEBUG,"\n Steering tag value is %x", ste_value); + if (ste_value == 0) { + ACPI_FREE(obj); + return ste_value; + } + + ACPI_FREE(obj); + return ste_value; + } + else + return 0; + + return NOT_IMPLEMENTED; +} + +/** + @brief Check for the _DSM method to obtain the STE value + + @param None + + @return 0 - Failure, NOT_IMPLEMENTED - DSM Method not implemented, Other values - PASS +**/ +uint32_t pal_pcie_dsm_ste_tags(void) +{ + acpi_handle handle = NULL; + acpi_status status; + + status = acpi_get_devices(NULL, ste_user_function, NULL, &handle); + return status; +} \ No newline at end of file -- GitLab