| 1 |
|
| 2 |
|
| 3 |
#include <stdint.h> |
| 4 |
#include <device/pci_ops.h> |
| 5 |
#include <device/pci.h> |
| 6 |
#include <device/pci_ids.h> |
| 7 |
#include <device/smbus_host.h> |
| 8 |
#include "i82371eb.h" |
| 9 |
|
| 10 |
void i82371eb_early_init(void) |
| 11 |
{ |
| 12 |
enable_smbus(); |
| 13 |
enable_pm(); |
| 14 |
} |
| 15 |
|
| 16 |
uintptr_t smbus_base(void) |
| 17 |
{ |
| 18 |
return SMBUS_IO_BASE; |
| 19 |
} |
| 20 |
|
| 21 |
int smbus_enable_iobar(uintptr_t base) |
| 22 |
{ |
| 23 |
u8 reg8; |
| 24 |
u16 reg16; |
| 25 |
|
| 26 |
|
| 27 |
const pci_devfn_t dev = pci_locate_device(PCI_ID(PCI_VID_INTEL, |
| 28 |
PCI_DID_INTEL_82371AB_SMB_ACPI), 0); |
| 29 |
|
| 30 |
|
| 31 |
pci_write_config32(dev, SMBBA, base | 1); |
| 32 |
|
| 33 |
|
| 34 |
reg8 = pci_read_config8(dev, SMBHSTCFG); |
| 35 |
reg8 |= SMB_HST_EN; |
| 36 |
pci_write_config8(dev, SMBHSTCFG, reg8); |
| 37 |
|
| 38 |
|
| 39 |
reg16 = pci_read_config16(dev, PCI_COMMAND); |
| 40 |
reg16 |= PCI_COMMAND_IO; |
| 41 |
pci_write_config16(dev, PCI_COMMAND, reg16); |
| 42 |
|
| 43 |
return 0; |
| 44 |
} |