| 1 |
|
| 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 |
|
| 17 |
const pci_devfn_t dev = PCI_DEV_SMBUS; |
| 18 |
|
| 19 |
|
| 20 |
if (pci_read_config16(dev, PCI_VENDOR_ID) != PCI_VID_INTEL) |
| 21 |
return -1; |
| 22 |
|
| 23 |
|
| 24 |
pci_write_config32(dev, SMB_BASE, base | PCI_BASE_ADDRESS_SPACE_IO); |
| 25 |
|
| 26 |
|
| 27 |
pci_write_config8(dev, HOSTC, HST_EN); |
| 28 |
|
| 29 |
|
| 30 |
pci_write_config16(dev, PCI_COMMAND, PCI_COMMAND_IO); |
| 31 |
|
| 32 |
return 0; |
| 33 |
} |