soc/amd/common/block/smn: add smn_read64

Add smn_read64 which calls smn_read32 twice to read two adjacent 32 bit
SMN registers and merges the results into a 64 bit value which it then
returns.

Signed-off-by: Felix Held <felix-coreboot@felixheld.de>
Change-Id: Ib2d58ec9818559cbefd7b819ae311ad02fafa18f
Reviewed-on: https://review.coreboot.org/c/coreboot/+/76552
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Fred Reitberger <reitbergerfred@gmail.com>
This commit is contained in:
Felix Held 2023-07-18 17:29:04 +02:00
parent 545d9992dc
commit ed7b1c4ba0
2 changed files with 6 additions and 0 deletions

View File

@ -6,6 +6,7 @@
#include <types.h> #include <types.h>
uint32_t smn_read32(uint32_t reg); uint32_t smn_read32(uint32_t reg);
uint64_t smn_read64(uint32_t reg);
void smn_write32(uint32_t reg, uint32_t val); void smn_write32(uint32_t reg, uint32_t val);
#endif /* AMD_BLOCK_SMN_H */ #endif /* AMD_BLOCK_SMN_H */

View File

@ -15,6 +15,11 @@ uint32_t smn_read32(uint32_t reg)
return pci_read_config32(SOC_GNB_DEV, SMN_DATA_ADDR); return pci_read_config32(SOC_GNB_DEV, SMN_DATA_ADDR);
} }
uint64_t smn_read64(uint32_t reg)
{
return smn_read32(reg) | (uint64_t)smn_read32(reg + 4) << 32;
}
void smn_write32(uint32_t reg, uint32_t val) void smn_write32(uint32_t reg, uint32_t val)
{ {
pci_write_config32(SOC_GNB_DEV, SMN_INDEX_ADDR, reg); pci_write_config32(SOC_GNB_DEV, SMN_INDEX_ADDR, reg);