sb/intel/common: Declare common smbus_base() and enable_smbus()
This avoids including platform-specific headers with different
filenames from common code.
Change-Id: Idf9893e55949d63f3ceca2249e618d0f81320321
Signed-off-by: Kyösti Mälkki <kyosti.malkki@gmail.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/38232
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
diff --git a/src/include/device/smbus_host.h b/src/include/device/smbus_host.h
index cb31d02..c12718d 100644
--- a/src/include/device/smbus_host.h
+++ b/src/include/device/smbus_host.h
@@ -15,6 +15,7 @@
#define __DEVICE_SMBUS_HOST_H__
#include <stdint.h>
+#include <console/console.h>
/* Low-level SMBUS host controller. */
@@ -34,7 +35,20 @@
/* Upstream API */
+uintptr_t smbus_base(void);
+int smbus_enable_iobar(uintptr_t base);
void smbus_host_reset(uintptr_t base);
void smbus_set_slave_addr(uintptr_t base, u8 slave_address);
+static inline void enable_smbus(void)
+{
+ uintptr_t base = smbus_base();
+
+ if (smbus_enable_iobar(base) < 0)
+ die("SMBus controller not found!");
+
+ smbus_host_reset(base);
+ printk(BIOS_DEBUG, "SMBus controller enabled\n");
+}
+
#endif
diff --git a/src/soc/intel/baytrail/romstage/raminit.c b/src/soc/intel/baytrail/romstage/raminit.c
index 62f8e42..c21a0c4 100644
--- a/src/soc/intel/baytrail/romstage/raminit.c
+++ b/src/soc/intel/baytrail/romstage/raminit.c
@@ -22,6 +22,7 @@
#include <console/console.h>
#include <device/pci_def.h>
#include <device/pci_ops.h>
+#include <device/smbus_host.h>
#include <mrc_cache.h>
#include <soc/gpio.h>
#include <soc/iomap.h>
@@ -32,13 +33,18 @@
#include <ec/google/chromeec/ec_commands.h>
#include <security/vboot/vboot_common.h>
-static void enable_smbus(void)
+uintptr_t smbus_base(void)
+{
+ return SMBUS_BASE_ADDRESS;
+}
+
+int smbus_enable_iobar(uintptr_t base)
{
uint32_t reg;
const uint32_t smbus_dev = PCI_DEV(0, SMBUS_DEV, SMBUS_FUNC);
/* SMBus I/O BAR */
- reg = SMBUS_BASE_ADDRESS | 2;
+ reg = base | 2;
pci_write_config32(smbus_dev, PCI_BASE_ADDRESS_4, reg);
/* Enable decode of I/O space. */
reg = pci_read_config16(smbus_dev, PCI_COMMAND);
@@ -52,6 +58,8 @@
/* Configure pads to be used for SMBus */
score_select_func(PCU_SMB_CLK_PAD, 1);
score_select_func(PCU_SMB_DATA_PAD, 1);
+
+ return 0;
}
static void ABI_X86 send_to_console(unsigned char b)
diff --git a/src/soc/intel/broadwell/include/soc/romstage.h b/src/soc/intel/broadwell/include/soc/romstage.h
index 4631652..b32b043 100644
--- a/src/soc/intel/broadwell/include/soc/romstage.h
+++ b/src/soc/intel/broadwell/include/soc/romstage.h
@@ -42,6 +42,4 @@
void pch_uart_init(void);
void intel_early_me_status(void);
-void enable_smbus(void);
-
#endif
diff --git a/src/soc/intel/broadwell/romstage/pch.c b/src/soc/intel/broadwell/romstage/pch.c
index af8ea53..e8f4eb8 100644
--- a/src/soc/intel/broadwell/romstage/pch.c
+++ b/src/soc/intel/broadwell/romstage/pch.c
@@ -16,6 +16,7 @@
#include <device/device.h>
#include <device/pci_def.h>
#include <device/pci_ops.h>
+#include <device/smbus_host.h>
#include <reg_script.h>
#include <soc/iomap.h>
#include <soc/lpc.h>
diff --git a/src/soc/intel/broadwell/romstage/smbus.c b/src/soc/intel/broadwell/romstage/smbus.c
index dd5d030..4b08b4c 100644
--- a/src/soc/intel/broadwell/romstage/smbus.c
+++ b/src/soc/intel/broadwell/romstage/smbus.c
@@ -15,6 +15,7 @@
*/
#include <device/pci_def.h>
+#include <device/smbus_host.h>
#include <reg_script.h>
#include <soc/iomap.h>
#include <soc/pci_devs.h>
@@ -36,7 +37,13 @@
REG_SCRIPT_END,
};
-void enable_smbus(void)
+uintptr_t smbus_base(void)
+{
+ return SMBUS_BASE_ADDRESS;
+}
+
+int smbus_enable_iobar(uintptr_t base)
{
reg_script_run_on_dev(PCH_DEV_SMBUS, smbus_init_script);
+ return 0;
}
diff --git a/src/southbridge/intel/bd82x6x/early_pch.c b/src/southbridge/intel/bd82x6x/early_pch.c
index 6f06a57..2213878 100644
--- a/src/southbridge/intel/bd82x6x/early_pch.c
+++ b/src/southbridge/intel/bd82x6x/early_pch.c
@@ -18,6 +18,7 @@
#include <cf9_reset.h>
#include <ip_checksum.h>
#include <device/pci_def.h>
+#include <device/smbus_host.h>
#include <southbridge/intel/common/gpio.h>
#include <southbridge/intel/common/pmbase.h>
#include <southbridge/intel/common/rcba.h>
diff --git a/src/southbridge/intel/bd82x6x/early_smbus.c b/src/southbridge/intel/bd82x6x/early_smbus.c
index 5ecce28..91f1bc3 100644
--- a/src/southbridge/intel/bd82x6x/early_smbus.c
+++ b/src/southbridge/intel/bd82x6x/early_smbus.c
@@ -15,26 +15,27 @@
*/
#include <device/pci_ops.h>
-#include <console/console.h>
#include <device/pci_def.h>
#include <device/smbus_host.h>
#include "pch.h"
-void enable_smbus(void)
+uintptr_t smbus_base(void)
{
- pci_devfn_t dev;
+ return SMBUS_IO_BASE;
+}
+int smbus_enable_iobar(uintptr_t base)
+{
/* Set the SMBus device statically. */
- dev = PCI_DEV(0x0, 0x1f, 0x3);
+ pci_devfn_t dev = PCI_DEV(0x0, 0x1f, 0x3);
/* Check to make sure we've got the right device. */
- if (pci_read_config16(dev, 0x0) != 0x8086) {
- die("SMBus controller not found!");
- }
+ if (pci_read_config16(dev, 0x0) != 0x8086)
+ return -1;
/* Set SMBus I/O base. */
pci_write_config32(dev, SMB_BASE,
- SMBUS_IO_BASE | PCI_BASE_ADDRESS_SPACE_IO);
+ base | PCI_BASE_ADDRESS_SPACE_IO);
/* Set SMBus enable. */
pci_write_config8(dev, HOSTC, HST_EN);
@@ -42,9 +43,7 @@
/* Set SMBus I/O space enable. */
pci_write_config16(dev, PCI_COMMAND, PCI_COMMAND_IO);
- smbus_host_reset(SMBUS_IO_BASE);
-
- printk(BIOS_DEBUG, "SMBus controller enabled.\n");
+ return 0;
}
int smbus_read_byte(unsigned int device, unsigned int address)
diff --git a/src/southbridge/intel/bd82x6x/pch.h b/src/southbridge/intel/bd82x6x/pch.h
index 5f353af..5348478 100644
--- a/src/southbridge/intel/bd82x6x/pch.h
+++ b/src/southbridge/intel/bd82x6x/pch.h
@@ -62,7 +62,6 @@
int pch_silicon_supported(int type, int rev);
void pch_iobp_update(u32 address, u32 andvalue, u32 orvalue);
-void enable_smbus(void);
void enable_usb_bar(void);
#if ENV_ROMSTAGE
diff --git a/src/southbridge/intel/i82371eb/early_smbus.c b/src/southbridge/intel/i82371eb/early_smbus.c
index f69cb93..671bfc5 100644
--- a/src/southbridge/intel/i82371eb/early_smbus.c
+++ b/src/southbridge/intel/i82371eb/early_smbus.c
@@ -15,7 +15,6 @@
*/
#include <stdint.h>
-#include <console/console.h>
#include <device/pci_ops.h>
#include <device/pci.h>
#include <device/pci_ids.h>
@@ -29,7 +28,12 @@
enable_pm();
}
-void enable_smbus(void)
+uintptr_t smbus_base(void)
+{
+ return SMBUS_IO_BASE;
+}
+
+int smbus_enable_iobar(uintptr_t base)
{
pci_devfn_t dev;
u8 reg8;
@@ -40,7 +44,7 @@
PCI_DEVICE_ID_INTEL_82371AB_SMB_ACPI), 0);
/* Set the SMBus I/O base. */
- pci_write_config32(dev, SMBBA, SMBUS_IO_BASE | 1);
+ pci_write_config32(dev, SMBBA, base | 1);
/* Enable the SMBus controller host interface. */
reg8 = pci_read_config8(dev, SMBHSTCFG);
@@ -52,9 +56,7 @@
reg16 |= PCI_COMMAND_IO;
pci_write_config16(dev, PCI_COMMAND, reg16);
- smbus_host_reset(SMBUS_IO_BASE);
-
- printk(BIOS_DEBUG, "SMBus controller enabled\n");
+ return 0;
}
int smbus_read_byte(u8 device, u8 address)
diff --git a/src/southbridge/intel/i82371eb/i82371eb.h b/src/southbridge/intel/i82371eb/i82371eb.h
index b292beb..2b53010 100644
--- a/src/southbridge/intel/i82371eb/i82371eb.h
+++ b/src/southbridge/intel/i82371eb/i82371eb.h
@@ -19,7 +19,6 @@
#if !defined(__ACPI__)
-void enable_smbus(void);
void enable_pm(void);
void i82371eb_early_init(void);
diff --git a/src/southbridge/intel/i82801dx/early_smbus.c b/src/southbridge/intel/i82801dx/early_smbus.c
index de0bc93..5ab7f8d 100644
--- a/src/southbridge/intel/i82801dx/early_smbus.c
+++ b/src/southbridge/intel/i82801dx/early_smbus.c
@@ -16,9 +16,7 @@
#include <device/pci_ops.h>
#include <device/pci_def.h>
-#include <console/console.h>
#include <device/smbus_host.h>
-
#include "i82801dx.h"
void i82801dx_early_init(void)
@@ -26,20 +24,23 @@
enable_smbus();
}
-void enable_smbus(void)
+uintptr_t smbus_base(void)
+{
+ return SMBUS_IO_BASE;
+}
+
+int smbus_enable_iobar(uintptr_t base)
{
pci_devfn_t dev = PCI_DEV(0x0, 0x1f, 0x3);
/* set smbus iobase */
- pci_write_config32(dev, 0x20, SMBUS_IO_BASE | 1);
+ pci_write_config32(dev, 0x20, base | 1);
/* Set smbus enable */
pci_write_config8(dev, 0x40, 0x01);
/* Set smbus iospace enable */
pci_write_config16(dev, 0x4, 0x01);
- smbus_host_reset(SMBUS_IO_BASE);
-
- printk(BIOS_DEBUG, "SMBus controller enabled\n");
+ return 0;
}
int smbus_read_byte(unsigned int device, unsigned int address)
diff --git a/src/southbridge/intel/i82801dx/i82801dx.h b/src/southbridge/intel/i82801dx/i82801dx.h
index 8717e59..18db9e9 100644
--- a/src/southbridge/intel/i82801dx/i82801dx.h
+++ b/src/southbridge/intel/i82801dx/i82801dx.h
@@ -36,7 +36,6 @@
void i82801dx_enable(struct device *dev);
void i82801dx_early_init(void);
-void enable_smbus(void);
int smbus_read_byte(unsigned int device, unsigned int address);
void aseg_smm_lock(void);
diff --git a/src/southbridge/intel/i82801gx/early_init.c b/src/southbridge/intel/i82801gx/early_init.c
index 29c4550..a627cc15 100644
--- a/src/southbridge/intel/i82801gx/early_init.c
+++ b/src/southbridge/intel/i82801gx/early_init.c
@@ -14,6 +14,7 @@
#include <stdint.h>
#include <console/console.h>
#include <device/pci_ops.h>
+#include <device/smbus_host.h>
#include <southbridge/intel/common/gpio.h>
#include <southbridge/intel/common/pmbase.h>
#include "i82801gx.h"
diff --git a/src/southbridge/intel/i82801gx/early_smbus.c b/src/southbridge/intel/i82801gx/early_smbus.c
index 60fcceb..b89e57d 100644
--- a/src/southbridge/intel/i82801gx/early_smbus.c
+++ b/src/southbridge/intel/i82801gx/early_smbus.c
@@ -15,25 +15,27 @@
*/
#include <device/pci_ops.h>
-#include <console/console.h>
#include <device/pci_def.h>
#include <device/smbus_host.h>
#include "i82801gx.h"
-void enable_smbus(void)
+uintptr_t smbus_base(void)
{
- pci_devfn_t dev;
+ return SMBUS_IO_BASE;
+}
+int smbus_enable_iobar(uintptr_t base)
+{
/* Set the SMBus device statically. */
- dev = PCI_DEV(0x0, 0x1f, 0x3);
+ pci_devfn_t dev = PCI_DEV(0x0, 0x1f, 0x3);
/* Check to make sure we've got the right device. */
if (pci_read_config16(dev, 0x2) != 0x27da)
- die("SMBus controller not found!");
+ return -1;
/* Set SMBus I/O base. */
pci_write_config32(dev, SMB_BASE,
- SMBUS_IO_BASE | PCI_BASE_ADDRESS_SPACE_IO);
+ base | PCI_BASE_ADDRESS_SPACE_IO);
/* Set SMBus enable. */
pci_write_config8(dev, HOSTC, HST_EN);
@@ -41,9 +43,7 @@
/* Set SMBus I/O space enable. */
pci_write_config16(dev, PCI_COMMAND, PCI_COMMAND_IO);
- smbus_host_reset(SMBUS_IO_BASE);
-
- printk(BIOS_DEBUG, "SMBus controller enabled.\n");
+ return 0;
}
int smbus_read_byte(unsigned int device, unsigned int address)
diff --git a/src/southbridge/intel/i82801gx/i82801gx.h b/src/southbridge/intel/i82801gx/i82801gx.h
index 0516a7a..688f1c3 100644
--- a/src/southbridge/intel/i82801gx/i82801gx.h
+++ b/src/southbridge/intel/i82801gx/i82801gx.h
@@ -37,7 +37,6 @@
#include <device/device.h>
void i82801gx_enable(struct device *dev);
-void enable_smbus(void);
void i82801gx_lpc_setup(void);
void i82801gx_setup_bars(void);
void i82801gx_early_init(void);
diff --git a/src/southbridge/intel/i82801ix/early_init.c b/src/southbridge/intel/i82801ix/early_init.c
index 4ce4fbe..9c1e6c0 100644
--- a/src/southbridge/intel/i82801ix/early_init.c
+++ b/src/southbridge/intel/i82801ix/early_init.c
@@ -16,6 +16,7 @@
#include <arch/io.h>
#include <device/pci_ops.h>
+#include <device/smbus_host.h>
#include "i82801ix.h"
#include "chip.h"
diff --git a/src/southbridge/intel/i82801ix/early_smbus.c b/src/southbridge/intel/i82801ix/early_smbus.c
index 4286760..60f49d2 100644
--- a/src/southbridge/intel/i82801ix/early_smbus.c
+++ b/src/southbridge/intel/i82801ix/early_smbus.c
@@ -16,26 +16,28 @@
*/
#include <device/pci_ops.h>
-#include <console/console.h>
#include <device/pci_def.h>
#include <device/pci_ids.h>
#include <device/smbus_host.h>
#include "i82801ix.h"
-void enable_smbus(void)
+uintptr_t smbus_base(void)
{
- pci_devfn_t dev;
+ return SMBUS_IO_BASE;
+}
+int smbus_enable_iobar(uintptr_t base)
+{
/* Set the SMBus device statically. */
- dev = PCI_DEV(0x0, 0x1f, 0x3);
+ pci_devfn_t dev = PCI_DEV(0x0, 0x1f, 0x3);
/* Check to make sure we've got the right device. */
if (pci_read_config16(dev, 0x2) != PCI_DEVICE_ID_INTEL_82801IB_SMB)
- die("SMBus controller not found!");
+ return -1;
/* Set SMBus I/O base. */
pci_write_config32(dev, SMB_BASE,
- SMBUS_IO_BASE | PCI_BASE_ADDRESS_SPACE_IO);
+ base | PCI_BASE_ADDRESS_SPACE_IO);
/* Set SMBus enable. */
pci_write_config8(dev, HOSTC, HST_EN);
@@ -43,9 +45,7 @@
/* Set SMBus I/O space enable. */
pci_write_config16(dev, PCI_COMMAND, PCI_COMMAND_IO);
- smbus_host_reset(SMBUS_IO_BASE);
-
- printk(BIOS_DEBUG, "SMBus controller enabled.\n");
+ return 0;
}
int smbus_read_byte(unsigned int device, unsigned int address)
diff --git a/src/southbridge/intel/i82801ix/i82801ix.h b/src/southbridge/intel/i82801ix/i82801ix.h
index 906d24e..f60aad3 100644
--- a/src/southbridge/intel/i82801ix/i82801ix.h
+++ b/src/southbridge/intel/i82801ix/i82801ix.h
@@ -208,7 +208,6 @@
void aseg_smm_lock(void);
-void enable_smbus(void);
void i82801ix_early_init(void);
void i82801ix_lpc_decode(void);
void i82801ix_dmi_setup(void);
diff --git a/src/southbridge/intel/i82801jx/early_init.c b/src/southbridge/intel/i82801jx/early_init.c
index 87831bb..c10c421 100644
--- a/src/southbridge/intel/i82801jx/early_init.c
+++ b/src/southbridge/intel/i82801jx/early_init.c
@@ -14,6 +14,7 @@
#include <console/console.h>
#include <device/pci_ops.h>
+#include <device/smbus_host.h>
#include <southbridge/intel/common/gpio.h>
#include <southbridge/intel/common/pmbase.h>
#include "i82801jx.h"
diff --git a/src/southbridge/intel/i82801jx/early_smbus.c b/src/southbridge/intel/i82801jx/early_smbus.c
index 594400f..8e3329c 100644
--- a/src/southbridge/intel/i82801jx/early_smbus.c
+++ b/src/southbridge/intel/i82801jx/early_smbus.c
@@ -16,21 +16,23 @@
*/
#include <device/pci_ops.h>
-#include <console/console.h>
#include <device/pci_def.h>
#include <device/smbus_host.h>
#include "i82801jx.h"
-void enable_smbus(void)
+uintptr_t smbus_base(void)
{
- pci_devfn_t dev;
+ return SMBUS_IO_BASE;
+}
+int smbus_enable_iobar(uintptr_t base)
+{
/* Set the SMBus device statically. */
- dev = PCI_DEV(0x0, 0x1f, 0x3);
+ pci_devfn_t dev = PCI_DEV(0x0, 0x1f, 0x3);
/* Set SMBus I/O base. */
pci_write_config32(dev, SMB_BASE,
- SMBUS_IO_BASE | PCI_BASE_ADDRESS_SPACE_IO);
+ base | PCI_BASE_ADDRESS_SPACE_IO);
/* Set SMBus enable. */
pci_write_config8(dev, HOSTC, HST_EN);
@@ -38,9 +40,7 @@
/* Set SMBus I/O space enable. */
pci_write_config16(dev, PCI_COMMAND, PCI_COMMAND_IO);
- smbus_host_reset(SMBUS_IO_BASE);
-
- printk(BIOS_DEBUG, "SMBus controller enabled.\n");
+ return 0;
}
int smbus_read_byte(unsigned int device, unsigned int address)
diff --git a/src/southbridge/intel/i82801jx/i82801jx.h b/src/southbridge/intel/i82801jx/i82801jx.h
index 2c5135e..abf6187 100644
--- a/src/southbridge/intel/i82801jx/i82801jx.h
+++ b/src/southbridge/intel/i82801jx/i82801jx.h
@@ -225,7 +225,6 @@
}
#define LPC_IS_MOBILE(dev) lpc_is_mobile(pci_read_config16(dev, PCI_DEVICE_ID))
-void enable_smbus(void);
#if ENV_ROMSTAGE
int smbus_read_byte(unsigned int device, unsigned int address);
int i2c_eeprom_read(unsigned int device, unsigned int cmd, unsigned int bytes,
diff --git a/src/southbridge/intel/ibexpeak/early_pch.c b/src/southbridge/intel/ibexpeak/early_pch.c
index e462dd8..56331cc 100644
--- a/src/southbridge/intel/ibexpeak/early_pch.c
+++ b/src/southbridge/intel/ibexpeak/early_pch.c
@@ -18,6 +18,7 @@
#include <stdint.h>
#include <device/pci_ops.h>
+#include <device/smbus_host.h>
#include <northbridge/intel/nehalem/nehalem.h>
#include <southbridge/intel/ibexpeak/pch.h>
#include <southbridge/intel/common/gpio.h>
diff --git a/src/southbridge/intel/ibexpeak/early_smbus.c b/src/southbridge/intel/ibexpeak/early_smbus.c
index fdf0c32..52d483d 100644
--- a/src/southbridge/intel/ibexpeak/early_smbus.c
+++ b/src/southbridge/intel/ibexpeak/early_smbus.c
@@ -15,26 +15,27 @@
*/
#include <device/pci_ops.h>
-#include <console/console.h>
#include <device/pci_def.h>
#include <device/smbus_host.h>
#include "pch.h"
-void enable_smbus(void)
+uintptr_t smbus_base(void)
{
- pci_devfn_t dev;
+ return SMBUS_IO_BASE;
+}
+int smbus_enable_iobar(uintptr_t base)
+{
/* Set the SMBus device statically. */
- dev = PCI_DEV(0x0, 0x1f, 0x3);
+ pci_devfn_t dev = PCI_DEV(0x0, 0x1f, 0x3);
/* Check to make sure we've got the right device. */
- if (pci_read_config16(dev, 0x0) != 0x8086) {
- die("SMBus controller not found!");
- }
+ if (pci_read_config16(dev, 0x0) != 0x8086)
+ return -1;
/* Set SMBus I/O base. */
pci_write_config32(dev, SMB_BASE,
- SMBUS_IO_BASE | PCI_BASE_ADDRESS_SPACE_IO);
+ base | PCI_BASE_ADDRESS_SPACE_IO);
/* Set SMBus enable. */
pci_write_config8(dev, HOSTC, HST_EN);
@@ -42,9 +43,7 @@
/* Set SMBus I/O space enable. */
pci_write_config16(dev, PCI_COMMAND, PCI_COMMAND_IO);
- smbus_host_reset(SMBUS_IO_BASE);
-
- printk(BIOS_DEBUG, "SMBus controller enabled.\n");
+ return 0;
}
int smbus_read_byte(unsigned int device, unsigned int address)
diff --git a/src/southbridge/intel/ibexpeak/pch.h b/src/southbridge/intel/ibexpeak/pch.h
index 529b7a2..424bf42 100644
--- a/src/southbridge/intel/ibexpeak/pch.h
+++ b/src/southbridge/intel/ibexpeak/pch.h
@@ -52,7 +52,6 @@
#define DEBUG_PERIODIC_SMIS 0
void pch_iobp_update(u32 address, u32 andvalue, u32 orvalue);
-void enable_smbus(void);
void enable_usb_bar(void);
#if ENV_ROMSTAGE
diff --git a/src/southbridge/intel/lynxpoint/early_pch.c b/src/southbridge/intel/lynxpoint/early_pch.c
index 25ffdc4..e0e4613 100644
--- a/src/southbridge/intel/lynxpoint/early_pch.c
+++ b/src/southbridge/intel/lynxpoint/early_pch.c
@@ -19,6 +19,7 @@
#include <device/pci_ops.h>
#include <device/device.h>
#include <device/pci_def.h>
+#include <device/smbus_host.h>
#include <southbridge/intel/common/pmclib.h>
#include <elog.h>
#include "pch.h"
diff --git a/src/southbridge/intel/lynxpoint/early_smbus.c b/src/southbridge/intel/lynxpoint/early_smbus.c
index 5ecce28..91f1bc3 100644
--- a/src/southbridge/intel/lynxpoint/early_smbus.c
+++ b/src/southbridge/intel/lynxpoint/early_smbus.c
@@ -15,26 +15,27 @@
*/
#include <device/pci_ops.h>
-#include <console/console.h>
#include <device/pci_def.h>
#include <device/smbus_host.h>
#include "pch.h"
-void enable_smbus(void)
+uintptr_t smbus_base(void)
{
- pci_devfn_t dev;
+ return SMBUS_IO_BASE;
+}
+int smbus_enable_iobar(uintptr_t base)
+{
/* Set the SMBus device statically. */
- dev = PCI_DEV(0x0, 0x1f, 0x3);
+ pci_devfn_t dev = PCI_DEV(0x0, 0x1f, 0x3);
/* Check to make sure we've got the right device. */
- if (pci_read_config16(dev, 0x0) != 0x8086) {
- die("SMBus controller not found!");
- }
+ if (pci_read_config16(dev, 0x0) != 0x8086)
+ return -1;
/* Set SMBus I/O base. */
pci_write_config32(dev, SMB_BASE,
- SMBUS_IO_BASE | PCI_BASE_ADDRESS_SPACE_IO);
+ base | PCI_BASE_ADDRESS_SPACE_IO);
/* Set SMBus enable. */
pci_write_config8(dev, HOSTC, HST_EN);
@@ -42,9 +43,7 @@
/* Set SMBus I/O space enable. */
pci_write_config16(dev, PCI_COMMAND, PCI_COMMAND_IO);
- smbus_host_reset(SMBUS_IO_BASE);
-
- printk(BIOS_DEBUG, "SMBus controller enabled.\n");
+ return 0;
}
int smbus_read_byte(unsigned int device, unsigned int address)
diff --git a/src/southbridge/intel/lynxpoint/pch.h b/src/southbridge/intel/lynxpoint/pch.h
index 71f42ea..9622c67 100644
--- a/src/southbridge/intel/lynxpoint/pch.h
+++ b/src/southbridge/intel/lynxpoint/pch.h
@@ -174,7 +174,6 @@
void acpi_create_intel_hpet(acpi_hpet_t * hpet);
void acpi_create_serialio_ssdt(acpi_header_t *ssdt);
-void enable_smbus(void);
#if ENV_ROMSTAGE
int smbus_read_byte(unsigned int device, unsigned int address);