diff options
author | Maxim Polyakov <max.senia.poliak@gmail.com> | 2021-01-14 01:37:26 +0300 |
---|---|---|
committer | Patrick Georgi <pgeorgi@google.com> | 2021-01-19 09:03:00 +0000 |
commit | 91a4512adfe37438b193c3c982e06ec21f75edc4 (patch) | |
tree | 6dc8826397fcde39d4a72131cc30094cdb4b5876 /src/soc/intel/xeon_sp/util.c | |
parent | 0c094aeb0e214b2abcef9a15ab23b1669a20d80e (diff) |
intel/xeon_sp, mb/ocp/deltalake: Rework get_stack_busnos()
- Return the busno based on the stack number.
- Replace pci_mmio_read_config32 with pci_io_read_config32 to get the
register value before mapping the MMIOCFG space.
- Remove the plural `s` as the function now provides one bus number.
Change-Id: I6e78e31b8ab89b1bdcfdeffae2e193e698385186
Signed-off-by: Maxim Polyakov <max.senia.poliak@gmail.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/49457
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Lance Zhao
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Diffstat (limited to 'src/soc/intel/xeon_sp/util.c')
-rw-r--r-- | src/soc/intel/xeon_sp/util.c | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/src/soc/intel/xeon_sp/util.c b/src/soc/intel/xeon_sp/util.c index b4f7eaab3c..c0b05cbf6c 100644 --- a/src/soc/intel/xeon_sp/util.c +++ b/src/soc/intel/xeon_sp/util.c @@ -13,19 +13,15 @@ #include <soc/util.h> #include <timer.h> -void get_stack_busnos(uint32_t *bus) +uint8_t get_stack_busno(const uint8_t stack) { - uint32_t reg1, reg2; - - reg1 = pci_mmio_read_config32(PCI_DEV(UBOX_DECS_BUS, UBOX_DECS_DEV, UBOX_DECS_FUNC), - 0xcc); - reg2 = pci_mmio_read_config32(PCI_DEV(UBOX_DECS_BUS, UBOX_DECS_DEV, UBOX_DECS_FUNC), - 0xd0); - - for (int i = 0; i < 4; ++i) - bus[i] = ((reg1 >> (i * 8)) & 0xff); - for (int i = 0; i < 2; ++i) - bus[4+i] = ((reg2 >> (i * 8)) & 0xff); + 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; } void unlock_pam_regions(void) |