Arthur Heymans has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/47522 )
Change subject: soc/intel/xeon_sp: move get_iiostack_info() to a common place ......................................................................
soc/intel/xeon_sp: move get_iiostack_info() to a common place
All this function does is looping over IIO stacks in the FSP HOB. The only 'SOC/FSP specific' thing is the way to detect if the stack is an IIO stack so add a callback to determine this.
Change-Id: I4fa9c54d50279213a4174186a23c3cc156e21c9a Signed-off-by: Arthur Heymans arthur@aheymans.xyz --- M src/soc/intel/xeon_sp/cpx/include/soc/soc_util.h M src/soc/intel/xeon_sp/cpx/soc_acpi.c M src/soc/intel/xeon_sp/cpx/soc_util.c M src/soc/intel/xeon_sp/include/soc/util.h M src/soc/intel/xeon_sp/skx/include/soc/soc_util.h M src/soc/intel/xeon_sp/skx/soc_util.c M src/soc/intel/xeon_sp/util.c 7 files changed, 31 insertions(+), 45 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/22/47522/1
diff --git a/src/soc/intel/xeon_sp/cpx/include/soc/soc_util.h b/src/soc/intel/xeon_sp/cpx/include/soc/soc_util.h index e3c971d..5ce3928 100644 --- a/src/soc/intel/xeon_sp/cpx/include/soc/soc_util.h +++ b/src/soc/intel/xeon_sp/cpx/include/soc/soc_util.h @@ -6,13 +6,6 @@ #include <hob_iiouds.h> #include <hob_memmap.h>
-struct iiostack_resource { - uint8_t no_of_stacks; - STACK_RES res[MAX_SOCKET * MAX_LOGIC_IIO_STACK]; -}; - -void get_iiostack_info(struct iiostack_resource *info); - const struct SystemMemoryMapHob *get_system_memory_map(void);
uint32_t get_socket_stack_busno(uint32_t socket, uint32_t stack); diff --git a/src/soc/intel/xeon_sp/cpx/soc_acpi.c b/src/soc/intel/xeon_sp/cpx/soc_acpi.c index c35c248..599ccff 100644 --- a/src/soc/intel/xeon_sp/cpx/soc_acpi.c +++ b/src/soc/intel/xeon_sp/cpx/soc_acpi.c @@ -16,6 +16,7 @@ #include <soc/pci_devs.h> #include <soc/pm.h> #include <soc/soc_util.h> +#include <soc/util.h>
/* TODO: Check if the common/acpi weak function can be used */ unsigned long acpi_fill_mcfg(unsigned long current) diff --git a/src/soc/intel/xeon_sp/cpx/soc_util.c b/src/soc/intel/xeon_sp/cpx/soc_util.c index 242fcfe..578f67c 100644 --- a/src/soc/intel/xeon_sp/cpx/soc_util.c +++ b/src/soc/intel/xeon_sp/cpx/soc_util.c @@ -27,21 +27,9 @@ return *memmap_addr; }
-void get_iiostack_info(struct iiostack_resource *info) +bool is_iio_stack_res(const STACK_RES *res) { - const IIO_UDS *hob = get_iio_uds(); - - // copy IIO Stack info from FSP HOB - info->no_of_stacks = 0; - for (int s = 0; s < hob->PlatformData.numofIIO; ++s) { - for (int x = 0; x < MAX_IIO_STACK; ++x) { - const STACK_RES *ri = &hob->PlatformData.IIO_resource[s].StackRes[x]; - if (ri->Personality == TYPE_UBOX_IIO) { - assert(info->no_of_stacks < ARRAY_SIZE(info->res)); - memcpy(&info->res[info->no_of_stacks++], ri, sizeof(STACK_RES)); - } - } - } + return res->Personality == TYPE_UBOX_IIO; }
uint32_t get_socket_stack_busno(uint32_t socket, uint32_t stack) diff --git a/src/soc/intel/xeon_sp/include/soc/util.h b/src/soc/intel/xeon_sp/include/soc/util.h index 014b238..fc0dee7 100644 --- a/src/soc/intel/xeon_sp/include/soc/util.h +++ b/src/soc/intel/xeon_sp/include/soc/util.h @@ -17,4 +17,12 @@ void xeonsp_init_cpu_config(void); void set_bios_init_completion(void);
+struct iiostack_resource { + uint8_t no_of_stacks; + STACK_RES res[CONFIG_MAX_SOCKET * MAX_IIO_STACK]; +}; + +void get_iiostack_info(struct iiostack_resource *info); +bool is_iio_stack_res(const STACK_RES *res); + #endif diff --git a/src/soc/intel/xeon_sp/skx/include/soc/soc_util.h b/src/soc/intel/xeon_sp/skx/include/soc/soc_util.h index 0f52811..526f5a6 100644 --- a/src/soc/intel/xeon_sp/skx/include/soc/soc_util.h +++ b/src/soc/intel/xeon_sp/skx/include/soc/soc_util.h @@ -6,13 +6,6 @@ #include <hob_iiouds.h> #include <hob_memmap.h>
-struct iiostack_resource { - uint8_t no_of_stacks; - STACK_RES res[CONFIG_MAX_SOCKET * MAX_IIO_STACK]; -}; - -void get_iiostack_info(struct iiostack_resource *info); - void config_reset_cpl3_csrs(void);
const struct SystemMemoryMapHob *get_system_memory_map(void); diff --git a/src/soc/intel/xeon_sp/skx/soc_util.c b/src/soc/intel/xeon_sp/skx/soc_util.c index 767871b..cb818cb 100644 --- a/src/soc/intel/xeon_sp/skx/soc_util.c +++ b/src/soc/intel/xeon_sp/skx/soc_util.c @@ -55,24 +55,10 @@ return memmap_addr; }
-void get_iiostack_info(struct iiostack_resource *info) +bool is_iio_stack_res(const STACK_RES *res) { - const IIO_UDS *hob = get_iio_uds(); - - // copy IIO Stack info from FSP HOB - info->no_of_stacks = 0; - for (int s = 0; s < hob->PlatformData.numofIIO; ++s) { - for (int x = 0; x < MAX_IIO_STACK; ++x) { - const STACK_RES *ri = &hob->PlatformData.IIO_resource[s].StackRes[x]; - // TODO: do we have situation with only bux 0 and one stack? - if (ri->BusBase >= ri->BusLimit) - continue; - assert(info->no_of_stacks < (CONFIG_MAX_SOCKET * MAX_IIO_STACK)); - memcpy(&info->res[info->no_of_stacks++], ri, sizeof(STACK_RES)); - } - } - - return hob->PlatformData.Pci64BitResourceAllocation; + // TODO: do we have situation with only bux 0 and one stack? + return ri->BusBase < ri->BusLimit; }
uint32_t get_socket_stack_busno(uint32_t socket, uint32_t stack) diff --git a/src/soc/intel/xeon_sp/util.c b/src/soc/intel/xeon_sp/util.c index 3104215..b4f7eaa 100644 --- a/src/soc/intel/xeon_sp/util.c +++ b/src/soc/intel/xeon_sp/util.c @@ -119,6 +119,23 @@ return hob; }
+void get_iiostack_info(struct iiostack_resource *info) +{ + const IIO_UDS *hob = get_iio_uds(); + + // copy IIO Stack info from FSP HOB + info->no_of_stacks = 0; + for (int s = 0; s < hob->PlatformData.numofIIO; ++s) { + for (int x = 0; x < MAX_IIO_STACK; ++x) { + const STACK_RES *ri = &hob->PlatformData.IIO_resource[s].StackRes[x]; + if (!is_iio_stack_res(ri)) + continue; + assert(info->no_of_stacks < (CONFIG_MAX_SOCKET * MAX_IIO_STACK)); + memcpy(&info->res[info->no_of_stacks++], ri, sizeof(STACK_RES)); + } + } +} + unsigned int soc_get_num_cpus(void) { /* The FSP IIO UDS HOB has field numCpus, it is actually socket count */
Hello Patrick Rudolph,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/47522
to look at the new patch set (#2).
Change subject: soc/intel/xeon_sp: move get_iiostack_info() to a common place ......................................................................
soc/intel/xeon_sp: move get_iiostack_info() to a common place
All this function does is looping over IIO stacks in the FSP HOB. The only 'SOC/FSP specific' thing is the way to detect if the stack is an IIO stack so add a callback to determine this.
Change-Id: I4fa9c54d50279213a4174186a23c3cc156e21c9a Signed-off-by: Arthur Heymans arthur@aheymans.xyz --- M src/soc/intel/xeon_sp/cpx/include/soc/soc_util.h M src/soc/intel/xeon_sp/cpx/soc_acpi.c M src/soc/intel/xeon_sp/cpx/soc_util.c M src/soc/intel/xeon_sp/include/soc/util.h M src/soc/intel/xeon_sp/skx/include/soc/soc_util.h M src/soc/intel/xeon_sp/skx/soc_util.c M src/soc/intel/xeon_sp/util.c 7 files changed, 31 insertions(+), 43 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/22/47522/2
Marc Jones has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/47522 )
Change subject: soc/intel/xeon_sp: move get_iiostack_info() to a common place ......................................................................
Patch Set 2: Code-Review+2
Arthur Heymans has submitted this change. ( https://review.coreboot.org/c/coreboot/+/47522 )
Change subject: soc/intel/xeon_sp: move get_iiostack_info() to a common place ......................................................................
soc/intel/xeon_sp: move get_iiostack_info() to a common place
All this function does is looping over IIO stacks in the FSP HOB. The only 'SOC/FSP specific' thing is the way to detect if the stack is an IIO stack so add a callback to determine this.
Change-Id: I4fa9c54d50279213a4174186a23c3cc156e21c9a Signed-off-by: Arthur Heymans arthur@aheymans.xyz Reviewed-on: https://review.coreboot.org/c/coreboot/+/47522 Tested-by: build bot (Jenkins) no-reply@coreboot.org Reviewed-by: Marc Jones marc@marcjonesconsulting.com --- M src/soc/intel/xeon_sp/cpx/include/soc/soc_util.h M src/soc/intel/xeon_sp/cpx/soc_acpi.c M src/soc/intel/xeon_sp/cpx/soc_util.c M src/soc/intel/xeon_sp/include/soc/util.h M src/soc/intel/xeon_sp/skx/include/soc/soc_util.h M src/soc/intel/xeon_sp/skx/soc_util.c M src/soc/intel/xeon_sp/util.c 7 files changed, 31 insertions(+), 43 deletions(-)
Approvals: build bot (Jenkins): Verified Marc Jones: Looks good to me, approved
diff --git a/src/soc/intel/xeon_sp/cpx/include/soc/soc_util.h b/src/soc/intel/xeon_sp/cpx/include/soc/soc_util.h index e3c971d..5ce3928 100644 --- a/src/soc/intel/xeon_sp/cpx/include/soc/soc_util.h +++ b/src/soc/intel/xeon_sp/cpx/include/soc/soc_util.h @@ -6,13 +6,6 @@ #include <hob_iiouds.h> #include <hob_memmap.h>
-struct iiostack_resource { - uint8_t no_of_stacks; - STACK_RES res[MAX_SOCKET * MAX_LOGIC_IIO_STACK]; -}; - -void get_iiostack_info(struct iiostack_resource *info); - const struct SystemMemoryMapHob *get_system_memory_map(void);
uint32_t get_socket_stack_busno(uint32_t socket, uint32_t stack); diff --git a/src/soc/intel/xeon_sp/cpx/soc_acpi.c b/src/soc/intel/xeon_sp/cpx/soc_acpi.c index c35c248..599ccff 100644 --- a/src/soc/intel/xeon_sp/cpx/soc_acpi.c +++ b/src/soc/intel/xeon_sp/cpx/soc_acpi.c @@ -16,6 +16,7 @@ #include <soc/pci_devs.h> #include <soc/pm.h> #include <soc/soc_util.h> +#include <soc/util.h>
/* TODO: Check if the common/acpi weak function can be used */ unsigned long acpi_fill_mcfg(unsigned long current) diff --git a/src/soc/intel/xeon_sp/cpx/soc_util.c b/src/soc/intel/xeon_sp/cpx/soc_util.c index 242fcfe..578f67c 100644 --- a/src/soc/intel/xeon_sp/cpx/soc_util.c +++ b/src/soc/intel/xeon_sp/cpx/soc_util.c @@ -27,21 +27,9 @@ return *memmap_addr; }
-void get_iiostack_info(struct iiostack_resource *info) +bool is_iio_stack_res(const STACK_RES *res) { - const IIO_UDS *hob = get_iio_uds(); - - // copy IIO Stack info from FSP HOB - info->no_of_stacks = 0; - for (int s = 0; s < hob->PlatformData.numofIIO; ++s) { - for (int x = 0; x < MAX_IIO_STACK; ++x) { - const STACK_RES *ri = &hob->PlatformData.IIO_resource[s].StackRes[x]; - if (ri->Personality == TYPE_UBOX_IIO) { - assert(info->no_of_stacks < ARRAY_SIZE(info->res)); - memcpy(&info->res[info->no_of_stacks++], ri, sizeof(STACK_RES)); - } - } - } + return res->Personality == TYPE_UBOX_IIO; }
uint32_t get_socket_stack_busno(uint32_t socket, uint32_t stack) diff --git a/src/soc/intel/xeon_sp/include/soc/util.h b/src/soc/intel/xeon_sp/include/soc/util.h index 014b238..fc0dee7 100644 --- a/src/soc/intel/xeon_sp/include/soc/util.h +++ b/src/soc/intel/xeon_sp/include/soc/util.h @@ -17,4 +17,12 @@ void xeonsp_init_cpu_config(void); void set_bios_init_completion(void);
+struct iiostack_resource { + uint8_t no_of_stacks; + STACK_RES res[CONFIG_MAX_SOCKET * MAX_IIO_STACK]; +}; + +void get_iiostack_info(struct iiostack_resource *info); +bool is_iio_stack_res(const STACK_RES *res); + #endif diff --git a/src/soc/intel/xeon_sp/skx/include/soc/soc_util.h b/src/soc/intel/xeon_sp/skx/include/soc/soc_util.h index 0f52811..526f5a6 100644 --- a/src/soc/intel/xeon_sp/skx/include/soc/soc_util.h +++ b/src/soc/intel/xeon_sp/skx/include/soc/soc_util.h @@ -6,13 +6,6 @@ #include <hob_iiouds.h> #include <hob_memmap.h>
-struct iiostack_resource { - uint8_t no_of_stacks; - STACK_RES res[CONFIG_MAX_SOCKET * MAX_IIO_STACK]; -}; - -void get_iiostack_info(struct iiostack_resource *info); - void config_reset_cpl3_csrs(void);
const struct SystemMemoryMapHob *get_system_memory_map(void); diff --git a/src/soc/intel/xeon_sp/skx/soc_util.c b/src/soc/intel/xeon_sp/skx/soc_util.c index d5e1ae1..7d95ae8 100644 --- a/src/soc/intel/xeon_sp/skx/soc_util.c +++ b/src/soc/intel/xeon_sp/skx/soc_util.c @@ -55,22 +55,10 @@ return memmap_addr; }
-void get_iiostack_info(struct iiostack_resource *info) +bool is_iio_stack_res(const STACK_RES *res) { - const IIO_UDS *hob = get_iio_uds(); - - // copy IIO Stack info from FSP HOB - info->no_of_stacks = 0; - for (int s = 0; s < hob->PlatformData.numofIIO; ++s) { - for (int x = 0; x < MAX_IIO_STACK; ++x) { - const STACK_RES *ri = &hob->PlatformData.IIO_resource[s].StackRes[x]; - // TODO: do we have situation with only bux 0 and one stack? - if (ri->BusBase >= ri->BusLimit) - continue; - assert(info->no_of_stacks < (CONFIG_MAX_SOCKET * MAX_IIO_STACK)); - memcpy(&info->res[info->no_of_stacks++], ri, sizeof(STACK_RES)); - } - } + // TODO: do we have situation with only bux 0 and one stack? + return res->BusBase < res->BusLimit; }
uint32_t get_socket_stack_busno(uint32_t socket, uint32_t stack) diff --git a/src/soc/intel/xeon_sp/util.c b/src/soc/intel/xeon_sp/util.c index 3104215..b4f7eaa 100644 --- a/src/soc/intel/xeon_sp/util.c +++ b/src/soc/intel/xeon_sp/util.c @@ -119,6 +119,23 @@ return hob; }
+void get_iiostack_info(struct iiostack_resource *info) +{ + const IIO_UDS *hob = get_iio_uds(); + + // copy IIO Stack info from FSP HOB + info->no_of_stacks = 0; + for (int s = 0; s < hob->PlatformData.numofIIO; ++s) { + for (int x = 0; x < MAX_IIO_STACK; ++x) { + const STACK_RES *ri = &hob->PlatformData.IIO_resource[s].StackRes[x]; + if (!is_iio_stack_res(ri)) + continue; + assert(info->no_of_stacks < (CONFIG_MAX_SOCKET * MAX_IIO_STACK)); + memcpy(&info->res[info->no_of_stacks++], ri, sizeof(STACK_RES)); + } + } +} + unsigned int soc_get_num_cpus(void) { /* The FSP IIO UDS HOB has field numCpus, it is actually socket count */