summaryrefslogtreecommitdiff
path: root/src/soc/intel/xeon_sp/cpx
diff options
context:
space:
mode:
authorJonathan Zhang <jonzhang@meta.com>2023-01-23 18:14:53 -0800
committerFelix Held <felix-coreboot@felixheld.de>2023-03-09 21:39:17 +0000
commitca520a726a6d47c31c5a8c278e2a272b1f89bac4 (patch)
treee58fdcdce41799990df27fa4d83ccabe1a3f58a2 /src/soc/intel/xeon_sp/cpx
parent2285b72d0684f958ab372948d17f2da89db456c7 (diff)
soc/intel/xeon_sp: use get_socket_ubox_busno() to hide soc specifics
Intel SPR-SP has its specific way to get the bus number of ubox. Move the current implementations to CPX-SP and SKX-SP folders. Change-Id: I2b69be74d140115f9f78bc991fb690e3c90c88db Signed-off-by: Jonathan Zhang <jonzhang@meta.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/72403 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: David Hendricks <david.hendricks@gmail.com>
Diffstat (limited to 'src/soc/intel/xeon_sp/cpx')
-rw-r--r--src/soc/intel/xeon_sp/cpx/Makefile.inc2
-rw-r--r--src/soc/intel/xeon_sp/cpx/include/soc/soc_util.h2
-rw-r--r--src/soc/intel/xeon_sp/cpx/soc_util.c19
3 files changed, 22 insertions, 1 deletions
diff --git a/src/soc/intel/xeon_sp/cpx/Makefile.inc b/src/soc/intel/xeon_sp/cpx/Makefile.inc
index 593c339f45..911cf66e4a 100644
--- a/src/soc/intel/xeon_sp/cpx/Makefile.inc
+++ b/src/soc/intel/xeon_sp/cpx/Makefile.inc
@@ -5,7 +5,7 @@ ifeq ($(CONFIG_SOC_INTEL_COOPERLAKE_SP),y)
subdirs-y += ../../../../cpu/intel/turbo
subdirs-y += ../../../../cpu/intel/microcode
-romstage-y += romstage.c ddr.c
+romstage-y += romstage.c ddr.c soc_util.c
romstage-$(CONFIG_DISPLAY_UPD_DATA) += upd_display.c
romstage-$(CONFIG_DISPLAY_HOBS) += hob_display.c
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 5ce392863c..a1f6b22524 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
@@ -8,7 +8,9 @@
const struct SystemMemoryMapHob *get_system_memory_map(void);
+uint8_t get_stack_busno(const uint8_t stack);
uint32_t get_socket_stack_busno(uint32_t socket, uint32_t stack);
+uint32_t get_socket_ubox_busno(uint32_t socket);
int soc_get_stack_for_port(int port);
diff --git a/src/soc/intel/xeon_sp/cpx/soc_util.c b/src/soc/intel/xeon_sp/cpx/soc_util.c
index a6bcad3c51..01057fa17c 100644
--- a/src/soc/intel/xeon_sp/cpx/soc_util.c
+++ b/src/soc/intel/xeon_sp/cpx/soc_util.c
@@ -29,6 +29,17 @@ bool is_iio_stack_res(const STACK_RES *res)
return res->Personality == TYPE_UBOX_IIO;
}
+uint8_t get_stack_busno(const uint8_t stack)
+{
+ if (stack >= MAX_IIO_STACK) {
+ printk(BIOS_ERR, "%s: Stack %u does not exist!\n", __func__, stack);
+ return 0;
+ }
+ const pci_devfn_t dev = PCI_DEV(UBOX_DECS_BUS, UBOX_DECS_DEV, UBOX_DECS_FUNC);
+ const uint16_t offset = stack / 4 ? UBOX_DECS_CPUBUSNO1_CSR : UBOX_DECS_CPUBUSNO_CSR;
+ return pci_io_read_config32(dev, offset) >> (8 * (stack % 4)) & 0xff;
+}
+
uint32_t get_socket_stack_busno(uint32_t socket, uint32_t stack)
{
const IIO_UDS *hob = get_iio_uds();
@@ -38,6 +49,14 @@ uint32_t get_socket_stack_busno(uint32_t socket, uint32_t stack)
return hob->PlatformData.IIO_resource[socket].StackRes[stack].BusBase;
}
+uint32_t get_socket_ubox_busno(uint32_t socket)
+{
+ if (socket == 0)
+ return get_stack_busno(PCU_IIO_STACK);
+
+ return get_socket_stack_busno(socket, PCU_IIO_STACK);
+}
+
/*
* EX: CPX-SP
* Ports Stack Stack(HOB) IioConfigIou