Debian Codegraph @

src/southbridge/intel/common/early_smbus.c

raw symbols SCIP
1 /* SPDX-License-Identifier: GPL-2.0-only */
2
3 #include <device/pci_def.h>
4 #include <device/pci_ids.h>
5 #include <device/pci_ops.h>
6 #include <device/smbus_host.h>
7 #include "early_smbus.h"
8
9 uintptr_t smbus_base(void)
10 {
11 return CONFIG_FIXED_SMBUS_IO_BASE;
12 }
13
14 int smbus_enable_iobar(uintptr_t base)
15 {
16 /* Set the SMBus device statically. */
17 const pci_devfn_t dev = PCI_DEV_SMBUS;
18
19 /* Check to make sure we've got the right device. */
20 if (pci_read_config16(dev, PCI_VENDOR_ID) != PCI_VID_INTEL)
21 return -1;
22
23 /* Set SMBus I/O base. */
24 pci_write_config32(dev, SMB_BASE, base | PCI_BASE_ADDRESS_SPACE_IO);
25
26 /* Set SMBus enable. */
27 pci_write_config8(dev, HOSTC, HST_EN);
28
29 /* Set SMBus I/O space enable. */
30 pci_write_config16(dev, PCI_COMMAND, PCI_COMMAND_IO);
31
32 return 0;
33 }