do better error reporting in i82801dx early smbus functions.
Signed-off-by: Stefan Reinauer <stepan@coresystems.de> Acked-by: Stefan Reinauer <stepan@coresystems.de> git-svn-id: svn://svn.coreboot.org/coreboot/trunk@5407 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
This commit is contained in:
parent
accb50a4e3
commit
4cc5af95b5
@ -18,8 +18,7 @@
|
|||||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
//#define SMBUS_IO_BASE 0x1000
|
#include "i82801dx.h"
|
||||||
//#define SMBUS_IO_BASE 0x0f00
|
|
||||||
|
|
||||||
#define SMBHSTSTAT 0x0
|
#define SMBHSTSTAT 0x0
|
||||||
#define SMBHSTCTL 0x2
|
#define SMBHSTCTL 0x2
|
||||||
@ -42,7 +41,7 @@ static void enable_smbus(void)
|
|||||||
{
|
{
|
||||||
device_t dev = PCI_DEV(0x0, 0x1f, 0x3);
|
device_t dev = PCI_DEV(0x0, 0x1f, 0x3);
|
||||||
|
|
||||||
print_debug("SMBus controller enabled\n");
|
printk(BIOS_DEBUG, "SMBus controller enabled\n");
|
||||||
/* set smbus iobase */
|
/* set smbus iobase */
|
||||||
pci_write_config32(dev, 0x20, SMBUS_IO_BASE | 1);
|
pci_write_config32(dev, 0x20, SMBUS_IO_BASE | 1);
|
||||||
/* Set smbus enable */
|
/* Set smbus enable */
|
||||||
@ -118,9 +117,9 @@ static int smbus_read_byte(unsigned device, unsigned address)
|
|||||||
unsigned char global_status_register;
|
unsigned char global_status_register;
|
||||||
unsigned char byte;
|
unsigned char byte;
|
||||||
|
|
||||||
/*print_err("smbus_read_byte\n"); */
|
/* printk(BIOS_ERR, "smbus_read_byte\n"); */
|
||||||
if (smbus_wait_until_ready() < 0) {
|
if (smbus_wait_until_ready() < 0) {
|
||||||
print_err_hex8(-2);
|
printk(BIOS_ERR, "SMBUS not ready (%02x)\n", -2);
|
||||||
return -2;
|
return -2;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -146,13 +145,13 @@ static int smbus_read_byte(unsigned device, unsigned address)
|
|||||||
SMBUS_IO_BASE + SMBHSTCTL);
|
SMBUS_IO_BASE + SMBHSTCTL);
|
||||||
/* poll for it to start */
|
/* poll for it to start */
|
||||||
if (smbus_wait_until_active() < 0) {
|
if (smbus_wait_until_active() < 0) {
|
||||||
print_err_hex8(-4);
|
printk(BIOS_ERR, "SMBUS not active (%02x)\n", -4);
|
||||||
return -4;
|
return -4;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* poll for transaction completion */
|
/* poll for transaction completion */
|
||||||
if (smbus_wait_until_done() < 0) {
|
if (smbus_wait_until_done() < 0) {
|
||||||
print_err_hex8(-3);
|
printk(BIOS_ERR, "SMBUS not completed (%02x)\n", -3);
|
||||||
return -3;
|
return -3;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -162,14 +161,10 @@ static int smbus_read_byte(unsigned device, unsigned address)
|
|||||||
byte = inb(SMBUS_IO_BASE + SMBHSTDAT0);
|
byte = inb(SMBUS_IO_BASE + SMBHSTDAT0);
|
||||||
|
|
||||||
if (global_status_register != 2) {
|
if (global_status_register != 2) {
|
||||||
print_err_hex8(-1);
|
//printk(BIOS_SPEW, "%s: no device (%02x, %02x)\n", __func__, device, address);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
/*
|
//printk(BIOS_DEBUG, "%s: %02x@%02x = %02x\n", __func__, device, address, byte);
|
||||||
print_err("smbus_read_byte: ");
|
|
||||||
print_err_hex32(device); print_err(" ad "); print_err_hex32(address);
|
|
||||||
print_err("value "); print_err_hex8(byte); print_err("\n");
|
|
||||||
*/
|
|
||||||
return byte;
|
return byte;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user