Attention is currently required from: Arthur Heymans, Christian Walter, Johnny Lin, Lean Sheng Tan, Shuo Liu, Tim Chu.
Patrick Rudolph has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/80794?usp=email )
Change subject: soc/intel/xeon_sp: Add ACPI names ......................................................................
soc/intel/xeon_sp: Add ACPI names
Prepare for SSDT PCI domain generation by providing the domain names using the 'device' property of each domain device.
The 'device' property is being used since change Ic4cc81d198fb88300394055682a3954bf22db570 to identify the domain and by coincidence the name can also be used to generate the ACPI name.
Change-Id: I4353db33e7ac98db41728bcf61ee01e21433dded Signed-off-by: Patrick Rudolph patrick.rudolph@9elements.com --- M src/soc/intel/xeon_sp/acpi.c M src/soc/intel/xeon_sp/chip_common.c M src/soc/intel/xeon_sp/cpx/chip.c M src/soc/intel/xeon_sp/skx/chip.c M src/soc/intel/xeon_sp/spr/chip.c M src/soc/intel/xeon_sp/spr/ioat.c 6 files changed, 47 insertions(+), 31 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/94/80794/1
diff --git a/src/soc/intel/xeon_sp/acpi.c b/src/soc/intel/xeon_sp/acpi.c index 5eaa762..507c654 100644 --- a/src/soc/intel/xeon_sp/acpi.c +++ b/src/soc/intel/xeon_sp/acpi.c @@ -1,7 +1,9 @@ /* SPDX-License-Identifier: GPL-2.0-or-later */
#include <assert.h> +#include <commonlib/stdlib.h> #include <intelblocks/acpi.h> +#include <soc/chip_common.h> #include <soc/pci_devs.h> #include <soc/util.h> #include <stdint.h> @@ -125,3 +127,32 @@
return index; } + +static const char *iio_domain_acpi_name(const struct device *dev) +{ + const union xeon_domain_path dn = { + .domain_path = dev->path.domain.domain + }; + + assert(dn.socket < CONFIG_MAX_SOCKET); + assert(dn.stack < 16); + assert(dev->name && strlen(dev->name) == 2); + + if (dn.socket >= CONFIG_MAX_SOCKET || dn.stack >= 16 || !dev->name) + return NULL; + + char *name = xmalloc(ACPI_NAME_BUFFER_SIZE); + snprintf(name, ACPI_NAME_BUFFER_SIZE, "%s%1X%1X", dev->name, dn.socket, dn.stack); + + return name; +} + +const char *soc_acpi_name(const struct device *dev) +{ + if (dev->path.type == DEVICE_PATH_DOMAIN) + return iio_domain_acpi_name(dev); + + /* FIXME: Add SoC specific device names here */ + + return NULL; +} \ No newline at end of file diff --git a/src/soc/intel/xeon_sp/chip_common.c b/src/soc/intel/xeon_sp/chip_common.c index 4ec7da6..a0ecfd1 100644 --- a/src/soc/intel/xeon_sp/chip_common.c +++ b/src/soc/intel/xeon_sp/chip_common.c @@ -2,8 +2,9 @@
#include <assert.h> #include <console/console.h> -#include <post.h> #include <device/pci.h> +#include <intelblocks/acpi.h> +#include <post.h> #include <soc/chip_common.h> #include <soc/soc_util.h> #include <soc/util.h> @@ -170,6 +171,9 @@ .read_resources = iio_pci_domain_read_resources, .set_resources = pci_domain_set_resources, .scan_bus = iio_pci_domain_scan_bus, +#if CONFIG(HAVE_ACPI_TABLES) + .acpi_name = soc_acpi_name, +#endif };
/* @@ -180,6 +184,9 @@ .read_resources = noop_read_resources, .set_resources = noop_set_resources, .scan_bus = pci_host_bridge_scan_bus, +#if CONFIG(HAVE_ACPI_TABLES) + .acpi_name = soc_acpi_name, +#endif };
/* diff --git a/src/soc/intel/xeon_sp/cpx/chip.c b/src/soc/intel/xeon_sp/cpx/chip.c index 6274f02..5fc90e7 100644 --- a/src/soc/intel/xeon_sp/cpx/chip.c +++ b/src/soc/intel/xeon_sp/cpx/chip.c @@ -27,22 +27,13 @@ mainboard_silicon_init_params(silupd); }
-#if CONFIG(HAVE_ACPI_TABLES) -const char *soc_acpi_name(const struct device *dev) -{ - if (dev->path.type == DEVICE_PATH_DOMAIN) - return "PC00"; - return NULL; -} -#endif - static struct device_operations pci_domain_ops = { .read_resources = iio_pci_domain_read_resources, .set_resources = pci_domain_set_resources, .scan_bus = iio_pci_domain_scan_bus, #if CONFIG(HAVE_ACPI_TABLES) .write_acpi_tables = &northbridge_write_acpi_tables, - .acpi_name = soc_acpi_name + .acpi_name = soc_acpi_name, #endif };
diff --git a/src/soc/intel/xeon_sp/skx/chip.c b/src/soc/intel/xeon_sp/skx/chip.c index 68737ed..92663d9 100644 --- a/src/soc/intel/xeon_sp/skx/chip.c +++ b/src/soc/intel/xeon_sp/skx/chip.c @@ -13,22 +13,13 @@ #include <soc/soc_util.h> #include <soc/util.h>
-#if CONFIG(HAVE_ACPI_TABLES) -const char *soc_acpi_name(const struct device *dev) -{ - if (dev->path.type == DEVICE_PATH_DOMAIN) - return "PC00"; - return NULL; -} -#endif - static struct device_operations pci_domain_ops = { .read_resources = iio_pci_domain_read_resources, .set_resources = pci_domain_set_resources, .scan_bus = iio_pci_domain_scan_bus, #if CONFIG(HAVE_ACPI_TABLES) .write_acpi_tables = &northbridge_write_acpi_tables, - .acpi_name = soc_acpi_name + .acpi_name = soc_acpi_name, #endif };
diff --git a/src/soc/intel/xeon_sp/spr/chip.c b/src/soc/intel/xeon_sp/spr/chip.c index d57b240..cc3719d 100644 --- a/src/soc/intel/xeon_sp/spr/chip.c +++ b/src/soc/intel/xeon_sp/spr/chip.c @@ -8,6 +8,7 @@ #include <device/pci_ids.h> #include <device/pci_def.h> #include <device/pciexp.h> +#include <intelblocks/acpi.h> #include <intelblocks/gpio.h> #include <intelblocks/lpc_lib.h> #include <intelblocks/p2sb.h> @@ -37,15 +38,6 @@ mainboard_silicon_init_params(silupd); }
-#if CONFIG(HAVE_ACPI_TABLES) -const char *soc_acpi_name(const struct device *dev); -const char *soc_acpi_name(const struct device *dev) -{ - if (dev->path.type == DEVICE_PATH_DOMAIN) - return "PC00"; - return NULL; -} -#endif
static struct device_operations pci_domain_ops = { .read_resources = iio_pci_domain_read_resources, @@ -53,7 +45,7 @@ .scan_bus = iio_pci_domain_scan_bus, #if CONFIG(HAVE_ACPI_TABLES) .write_acpi_tables = &northbridge_write_acpi_tables, - .acpi_name = soc_acpi_name + .acpi_name = soc_acpi_name, #endif };
diff --git a/src/soc/intel/xeon_sp/spr/ioat.c b/src/soc/intel/xeon_sp/spr/ioat.c index ed01e15..b48a130 100644 --- a/src/soc/intel/xeon_sp/spr/ioat.c +++ b/src/soc/intel/xeon_sp/spr/ioat.c @@ -8,6 +8,7 @@
#include <defs_iio.h> #include <hob_iiouds.h> +#include <intelblocks/acpi.h> #include <IioPcieConfigUpd.h>
#include <soc/chip_common.h> @@ -21,6 +22,9 @@ .read_resources = noop_read_resources, .set_resources = pci_domain_set_resources, .scan_bus = pci_host_bridge_scan_bus, +#if CONFIG(HAVE_ACPI_TABLES) + .acpi_name = soc_acpi_name, +#endif };
static void create_ioat_domain(const union xeon_domain_path dp, struct bus *const upstream,