Search This Blog

Thursday, March 17, 2011

How to Access Byte Data on SMBus (Simple)

#define SMBusStatus         0x00
#define SMBusSlaveStatus 0x01
#define SMBusControl       0x02
#define SMBusHostCmd    0x03
#define SMBusAddress      0x04
#define SMBusData0          0x05
#define DeviceAddress       0xA0  // It depends on H/W design.
#define RWDataByte          0x48
#define SMBusInterrupt      1 << 1
#define BIT0                      1

UINT8
SMBusReadByte (
  IN UINT8 RegisterIndex
)
{
  UINT8 Data8;
 
  do {
     IoWrite8 (SMBusBaseAddress + SMBusStatus, 0xFF);
     IoRead8 (SMBusBaseAddress + SMBusStatus, Data8);
  } while (Data8 != 0);                                                                  // Waiting for all status be cleared

  IoWrite8 (SMBusBaseAddress + SMBusAddress, (DeviceAddress << 1) | BIT0);  //Read
  IoWrite8 (SMBusBaseAddress + SMBusHostCmd, RegisterIndex);
  IoWrite8 (SMBusBaseAddress + SMBusControl, RWDataByte);
  do {
     IoRead8 (SMBusBaseAddress + SMBusStatus, Data8);
  } while (Data8 != SMBusInterrupt);                                                     // Check SMBus read ready
  IoRead8 (SMBusBaseAddress + SMBusData0, Data8);
  Return Data8;
}

VOID
SMBusWriteByte (
  IN UINT8 RegisterIndex,
  IN UINT8 WriteData
)
{
  UINT8 Data8;
 
  do {
     IoWrite8 (SMBusBaseAddress + SMBusStatus, 0xFF);
     IoRead8 (SMBusBaseAddress + SMBusStatus, Data8);
  } while (Data8 != 0);                                                                     // Waiting for all status be cleared

  IoWrite8 (SMBusBaseAddress + SMBusAddress, (DeviceAddress << 1));  // Write
  IoWrite8 (SMBusBaseAddress + SMBusData0, WriteData);
  IoWrite8 (SMBusBaseAddress + SMBusHostCmd, RegisterIndex);
  IoWrite8 (SMBusBaseAddress + SMBusControl, RWDataByte);
  do {
     IoRead8 (SMBusBaseAddress + SMBusStatus, Data8);
  } while (Data8 != SMBusInterrupt);                                            // Check SMBus write ready
}

Wednesday, March 9, 2011

SLP - System Locked Preinstallation

Version Windows
SLP       Windows XP,    Windows Server 2003
SLP 2.0 Windows Vista, Windows Server 2008
SLP 2.1 Windows 7,       Windows Server 2008 R2

Implement SLP that requirement as below.
1. OEMID and table ID should be provided by ODM.
2. OEMID and table ID should be the same in RSDT and SLIC table.
3. Need to install SLP public binary key into system BIOS.

Saturday, March 5, 2011

gEfiPciEnumerationCompleteGuid

The PCI deivce will complete enumeration when gEfiPciEnumerationCompleteGuid be installed.
So we can access PCI device behind PCI bridge when gEfiPciEnumerationCompleteGuid  be installed.