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>
This commit is contained in:
parent
165893b67b
commit
6408ada4a2
|
@ -6,13 +6,6 @@
|
||||||
#include <hob_iiouds.h>
|
#include <hob_iiouds.h>
|
||||||
#include <hob_memmap.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);
|
const struct SystemMemoryMapHob *get_system_memory_map(void);
|
||||||
|
|
||||||
uint32_t get_socket_stack_busno(uint32_t socket, uint32_t stack);
|
uint32_t get_socket_stack_busno(uint32_t socket, uint32_t stack);
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
#include <soc/pci_devs.h>
|
#include <soc/pci_devs.h>
|
||||||
#include <soc/pm.h>
|
#include <soc/pm.h>
|
||||||
#include <soc/soc_util.h>
|
#include <soc/soc_util.h>
|
||||||
|
#include <soc/util.h>
|
||||||
|
|
||||||
/* TODO: Check if the common/acpi weak function can be used */
|
/* TODO: Check if the common/acpi weak function can be used */
|
||||||
unsigned long acpi_fill_mcfg(unsigned long current)
|
unsigned long acpi_fill_mcfg(unsigned long current)
|
||||||
|
|
|
@ -27,21 +27,9 @@ const struct SystemMemoryMapHob *get_system_memory_map(void)
|
||||||
return *memmap_addr;
|
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();
|
return res->Personality == TYPE_UBOX_IIO;
|
||||||
|
|
||||||
// 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));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t get_socket_stack_busno(uint32_t socket, uint32_t stack)
|
uint32_t get_socket_stack_busno(uint32_t socket, uint32_t stack)
|
||||||
|
|
|
@ -17,4 +17,12 @@ unsigned int soc_get_num_cpus(void);
|
||||||
void xeonsp_init_cpu_config(void);
|
void xeonsp_init_cpu_config(void);
|
||||||
void set_bios_init_completion(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
|
#endif
|
||||||
|
|
|
@ -6,13 +6,6 @@
|
||||||
#include <hob_iiouds.h>
|
#include <hob_iiouds.h>
|
||||||
#include <hob_memmap.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);
|
void config_reset_cpl3_csrs(void);
|
||||||
|
|
||||||
const struct SystemMemoryMapHob *get_system_memory_map(void);
|
const struct SystemMemoryMapHob *get_system_memory_map(void);
|
||||||
|
|
|
@ -55,22 +55,10 @@ const struct SystemMemoryMapHob *get_system_memory_map(void)
|
||||||
return memmap_addr;
|
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?
|
// TODO: do we have situation with only bux 0 and one stack?
|
||||||
if (ri->BusBase >= ri->BusLimit)
|
return res->BusBase < res->BusLimit;
|
||||||
continue;
|
|
||||||
assert(info->no_of_stacks < (CONFIG_MAX_SOCKET * MAX_IIO_STACK));
|
|
||||||
memcpy(&info->res[info->no_of_stacks++], ri, sizeof(STACK_RES));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t get_socket_stack_busno(uint32_t socket, uint32_t stack)
|
uint32_t get_socket_stack_busno(uint32_t socket, uint32_t stack)
|
||||||
|
|
|
@ -119,6 +119,23 @@ const IIO_UDS *get_iio_uds(void)
|
||||||
return hob;
|
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)
|
unsigned int soc_get_num_cpus(void)
|
||||||
{
|
{
|
||||||
/* The FSP IIO UDS HOB has field numCpus, it is actually socket count */
|
/* The FSP IIO UDS HOB has field numCpus, it is actually socket count */
|
||||||
|
|
Loading…
Reference in New Issue