1 #include "amd8111_smbus.h"
3 #define SMBUS_IO_BASE 0x0f00
5 static void enable_smbus(void)
8 dev = pci_locate_device(PCI_ID(0x1022, 0x746b), 0);
9 if (dev == PCI_DEV_INVALID) {
10 die("SMBUS controller not found\r\n");
13 print_spew("SMBus controller enabled\r\n");
14 pci_write_config32(dev, 0x58, SMBUS_IO_BASE | 1);
15 enable = pci_read_config8(dev, 0x41);
16 pci_write_config8(dev, 0x41, enable | (1 << 7));
17 /* clear any lingering errors, so the transaction will run */
18 outw(inw(SMBUS_IO_BASE + SMBGSTATUS), SMBUS_IO_BASE + SMBGSTATUS);
21 static int smbus_recv_byte(unsigned device)
23 return do_smbus_recv_byte(SMBUS_IO_BASE, device);
26 static int smbus_send_byte(unsigned device, unsigned char val)
28 return do_smbus_send_byte(SMBUS_IO_BASE, device, val);
31 static int smbus_read_byte(unsigned device, unsigned address)
33 return do_smbus_read_byte(SMBUS_IO_BASE, device, address);
36 static int smbus_write_byte(unsigned device, unsigned address, unsigned char val)
38 return do_smbus_write_byte(SMBUS_IO_BASE, device, address, val);