summaryrefslogtreecommitdiff
path: root/src/soc/amd/common/block/smn/smn.c
blob: 055f732cf73fc84e30a51db1bd71f9652e86c684 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
/* SPDX-License-Identifier: GPL-2.0-only */

#include <amdblocks/smn.h>
#include <device/pci_ops.h>
#include <soc/pci_devs.h>
#include <types.h>

/* SMN registers accessed indirectly using an index/data pair in D0F00 config space */
#define SMN_INDEX_ADDR		0xb8 /* 32 bit */
#define SMN_DATA_ADDR		0xbc /* 32 bit */

uint32_t smn_read32(uint32_t reg)
{
	pci_write_config32(SOC_GNB_DEV, SMN_INDEX_ADDR, reg);
	return pci_read_config32(SOC_GNB_DEV, SMN_DATA_ADDR);
}

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_DATA_ADDR, val);
}