12.9. SMBus Host Controller Interface via Embedded Controller

This section specifies a standard interface that an ACPI-compatible OS can use to communicate with embedded controller-based SMBus host controllers (EC-SMB-HC). This interface allows the host processor (under control of OSPM) to manage devices on the SMBus. Typical devices residing on the SMBus include Smart Batteries, Smart Battery Chargers, contrast/backlight control, and temperature sensors.

The EC-SMB-HC interface consists of a block of registers that reside in embedded controller space. These registers are used by software to initiate SMBus transactions and receive SMBus notifications. By using a well-defined register set, OS software can be written to operate with any vendor’s embedded controller hardware.

Certain SMBus segments have special requirements that the host controller filters certain SMBus commands (for example, to prevent an errant application or virus from potentially damaging the battery subsystem). This is most easily accomplished by implementing the host interface controller through an embedded controller–as embedded controller can easily filter out potentially problematic commands.

Notice that an EC-SMB-HC interface will require the inclusion of the GLK method in its ACPI namespace if potentially contentious accesses to device resources are performed by non-OS code. See _GLK (Global Lock) for details on using the _GLK method.

12.9.1. Register Description

The EC-SMBus host interface is a flat array of registers that are arranged sequentially in the embedded controller address space.

12.9.1.1. Status Register, SMB_STS

This register indicates general status on the SMBus. This includes SMB-HC command completion status, alarm received status, and error detection status (the error codes are defined later in this section). This register is cleared to zeroes (except for the ALRM bit) whenever a new command is issued using a write to the protocol (SMB_PRTCL) register. This register is always written with the error code before clearing the protocol register. The SMB-HC query event (that is, an SMB-HC interrupt) is raised after the clearing of the protocol register.

Note

OSPM must ensure the ALRM bit is cleared after it has been serviced by writing ‘00’ to the SMB_STS register.

Table 12.9 Status Register, SMB_STS

Bit7

Bit6

Bit5

Bit4

Bit3

Bit2

Bit1

Bit0

Done

ALRM

RES

STATUS

Where:

DONE:

Indicates the last command has completed and no error.

ALRM:

Indicates an SMBus alarm message has been received.

RES:

Reserved

STATUS:

Indicates SMBus communication status for one of the reasons listed in the following table.

Table 12.10 SMBus Status Codes

Status Code

Name

Description

00h

SMBus OK

Indicates the transaction has been successfully completed.

07h

SMBus Unknown Failure

Indicates failure because of an unknown SMBus error.

10h

SMBus Device Address Not Acknowledged

Indicates the transaction failed because the slave device address was not acknowledged.

11h

SMBus Device Error Detected

Indicates the transaction failed because the slave device signaled an error condition.

12h

SMBus Device Command Access Denied

Indicates the transaction failed because the SMBus host does not allow the specific command for the device being addressed. For example, the SMBus host might not allow a caller to adjust the Smart Battery Charger’s output.

13h

SMBus Unknown Error

Indicates the transaction failed because the SMBus host encountered an unknown error.

17h

SMBus Device Access Denied

Indicates the transaction failed because the SMBus host does not allow access to the device addressed. For example, the SMBus host might not allow a caller to directly communicate with an SMBus device that controls the system’s power planes.

18h

SMBus Timeout

Indicates the transaction failed because the SMBus host detected a timeout on the bus.

19h

SMBus Host Unsupported Protocol

Indicates the transaction failed because the SMBus host does not support the requested protocol.

1Ah

SMBus Busy

Indicates that the transaction failed because the SMBus host reports that the SMBus is presently busy with some other transaction. For example, the Smart Battery might be sending charging information to the Smart Battery Charger.

1Fh

SMBus PEC (CRC-8) Error

Indicates that a Packet Error Checking (PEC) error occurred during the last transaction.

All other error codes are reserved.

12.9.1.2. Protocol Register, SMB_PRTCL

This register determines the type of SMBus transaction generated on the SMBus. In addition to indicating the protocol type to the SMB-HC, a write to this register initiates the transaction on the SMBus. Notice that bit 7 of the protocol value is used to indicate whether packet error checking should be employed. A value of 1 (one) in this bit indicates that PEC format should be used for the specified protocol, and a value of 0 (zero) indicates the standard (non-PEC) format should be used.

Table 12.11 Protocol Register, SMB_PRTCL

Bit7

Bit6 to Bit0

PEC

PROTOCOL

Where the PROTOCOL values are as follows:

0x00

Controller Not In Use

0x01

Reserved

0x02

Write Quick Command

0x03

Read Quick Command

0x04

Send Byte

0x05

Receive Byte

0x06

Write Byte

0x07

Read Byte

0x08

Write Word

0x09

Read Word

0x0A

Write Block

0x0B

Read Block

0x0C

Process Call

0x0D

Block Write-Block Read Process Call

For example, the protocol value of 0x09 would be used to communicate to a device that supported the standard read word protocol. If this device also supported packet error checking for this protocol, a value of 0x89 (read word with PEC) could optionally be used. See the SMBus specification for more information on packet error checking.

When OSPM initiates a new command such as write to the SMB_PRTCL register, the SMBus controller first updates the SMB_STS register and then clears the SMB_PRTCL register. After the SMB_PRTCL register is cleared, the host controller query value is raised.

All other protocol values are reserved.

12.9.1.3. Address Register, SMB_ADDR

This register contains the 7-bit address to be generated on the SMBus. This is the first byte to be sent on the SMBus for all of the different protocols.

Table 12.12 Address Register, SMB_ADDR

Bit7 to Bit1

Bit0

ADDRESS (A6:A0)

RES

Where:

RES:

Reserved

ADDRESS:

7-bit SMBus address. This address is not zero-aligned (in other words, it is only a 7-bit address (A6:A0) that is aligned from bit 1-7).

12.9.1.4. Command Register, SMB_CMD

This register contains the command byte that will be sent to the target device on the SMBus and is used for the following protocols: send byte, write byte, write word, read byte, read word, process call, block read and block write. It is not used for the quick commands or the receive byte protocol, and as such, its value is a “don’t care” for those commands.

Table 12.13 Command Register, SMB_CMD

Bit7 to Bit0

COMMAND

Where:

COMMAND

Command byte to be sent to SMBus device.

12.9.1.5. Data Register Array, SMB_DATA[i], i=0-31

This bank of registers contains the remaining bytes to be sent or received in any of the different protocols that can be run on the SMBus. The SMB_DATA[i] registers are defined on a per-protocol basis and, as such, provide efficient use of register space.

Table 12.14 Data Register Array, SMB_DATA[i], i=0-31

Bit7 to Bit0

DATA

Where:

DATA

One byte of data to be sent or received (depending upon protocol).

12.9.1.6. Block Count Register, SMB_BCNT

This register contains the number of bytes of data present in the SMB_DATA[i] registers preceding any write block and following any read block transaction. The data size is defined on a per protocol basis.

Table 12.15 Block Count Register, SMB_BCNT

Bit7 to Bit5

Bit4 to Bit0

RES

BCNT

12.9.1.7. Alarm Address Register, SMB_ALRM_ADDR

This register contains the address of an alarm message received by the host controller, at slave address 0x8, from the SMBus master that initiated the alarm. The address indicates the slave address of the device on the SMBus that initiated the alarm message. The status of the alarm message is contained in the SMB_ALRM_DATAx registers. Once an alarm message has been received, the SMB-HC will not receive additional alarm messages until the ALRM status bit is cleared.

Table 12.16 Alarm Address Register, SMB_ALRM_ADDR

Bit7 to Bit1

Bit0

ADDRESS (A6:A0)

RES

Where:

RES:

Reserved

ADDRESS:

Slave address (A6:A0) of the SMBus device that initiated the SMBus alarm message.

12.9.1.8. Alarm Data Registers, SMB_ALRM_DATA[0], SMB_ALRM_DATA[1]

These registers contain the two data bytes of an alarm message received by the host controller, at slave address 0x8, from the SMBus master that initiated the alarm. These data bytes indicate the specific reason for the alarm message, such that OSPM can take actions. Once an alarm message has been received, the SMB-HC will not receive additional alarm messages until the ALRM status bit is cleared.

Table 12.17 Alarm Data Registers, SMB_ALRM_DATA[0], SMB_ALRM_DATA[1]

Bit7 to Bit0

DATA (D7:D0)

Where:

DATA

Data byte received in alarm message.

The alarm address and alarm data registers are not read by OSPM until the alarm status bit is set. OSPM driver then reads the 3 bytes, and clears the alarm status bit to indicate that the alarm registers are now available for the next event.

12.9.2. Protocol Description

This section describes how to initiate the different protocols on the SMBus through the interface described in Register Description. The registers should all be written with the appropriate values before writing the protocol value that starts the SMBus transaction. All transactions can be completed in one pass.

12.9.2.1. Write Quick

Data Sent:

SMB_ADDR:

Address of SMBus device.

SMB_PRTCL:

Write 0x02 to initiate the write quick protocol.

Data Returned:

SMB_STS:

Status code for transaction.

SMB_PRTCL:

0x00 to indicate command completion.

12.9.2.2. Read Quick

Data Sent:

SMB_ADDR:

Address of SMBus device.

SMB_PRTCL:

Write 0x03 to initiate the read quick protocol.

Data Returned:

SMB_STS:

Status code for transaction.

SMB_PRTCL:

0x00 to indicate command completion.

12.9.2.3. Send Byte

Data Sent:

SMB_ADDR:

Address of SMBus device.

SMB_CMD:

Command byte to be sent.

SMB_PRTCL:

Write 0x04 to initiate the send byte protocol, or 0x84 to initiate the send byte protocol with PEC.

Data Returned:

SMB_STS:

Status code for transaction.

SMB_PRTCL:

0x00 to indicate command completion.

12.9.2.4. Receive Byte

Data Sent:

SMB_ADDR:

Address of SMBus device.

SMB_PRTCL:

Write 0x05 to initiate the receive byte protocol, or 0x85 to initiate the receive byte protocol with PEC.

Data Returned:

SMB_DATA[0]:

Data byte received.

SMB_STS:

Status code for transaction.

SMB_PRTCL:

0x00 to indicate command completion.

12.9.2.5. Write Byte

Data Sent:

SMB_ADDR:

Address of SMBus device.

SMB_CMD:

Command byte to be sent.

SMB_DATA[0]:

Data byte to be sent.

SMB_PRTCL:

Write 0x06 to initiate the write byte protocol, or 0x86 to initiate the write byte protocol with PEC.

Data Returned:

SMB_STS:

Status code for transaction.

SMB_PRTCL:

0x00 to indicate command completion.

12.9.2.6. Read Byte

Data Sent:

SMB_ADDR:

Address of SMBus device.

SMB_CMD:

Command byte to be sent.

SMB_PRTCL:

Write 0x07 to initiate the read byte protocol, or 0x87 to initiate the read byte protocol with PEC.

Data Returned:

SMB_DATA[0]:

Data byte received.

SMB_STS:

Status code for transaction.

SMB_PRTCL:

0x00 to indicate command completion.

12.9.2.7. Write Word

Data Sent:

SMB_ADDR:

Address of SMBus device.

SMB_CMD:

Command byte to be sent.

SMB_DATA[0]:

Low data byte to be sent.

SMB_DATA[1]:

High data byte to be sent.

SMB_PRTCL:

Write 0x08 to initiate the write word protocol, or 0x88 to initiate the write word protocol with PEC.

Data Returned:

SMB_STS:

Status code for transaction.

SMB_PRTCL:

0x00 to indicate command completion.

12.9.2.8. Read Word

Data Sent:

SMB_ADDR:

Address of SMBus device.

SMB_CMD:

Command byte to be sent.

SMB_PRTCL:

Write 0x09 to initiate the read word protocol, or 0x89 to initiate the read word protocol with PEC.

Data Returned:

SMB_DATA[0]:

Low data byte received.

SMB_DATA[1]:

High data byte received.

SMB_STS:

Status code for transaction.

SMB_PRTCL:

0x00 to indicate command completion.

12.9.2.9. Write Block

Data Sent:

SMB_ADDR:

Address of SMBus device.

SMB_CMD:

Command byte to be sent.

SMB_DATA[0-31]:

Data bytes to write (1-32).

SMB_BCNT:

Number of data bytes (1-32) to be sent.

SMB_PRTCL:

Write 0x0A to initiate the write block protocol, or 0x8A to initiate the write block protocol with PEC.

Data Returned:

SMB_PRTCL:

0x00 to indicate command completion.

SMB_STS:

Status code for transaction.

12.9.2.10. Read Block

Data Sent:

SMB_ADDR:

Address of SMBus device.

SMB_CMD:

Command byte to be sent.

SMB_PRTCL:

Write 0x0B to initiate the read block protocol, or 0x8B to initiate the read block protocol with PEC.

Data Returned:

SMB_BCNT:

Number of data bytes (1-32) received.

SMB_DATA[0-31]:

Data bytes received (1-32).

SMB_STS:

Status code for transaction.

SMB_PRTCL:

0x00 to indicate command completion.

12.9.2.11. Process Call

Data Sent:

SMB_ADDR:

Address of SMBus device.

SMB_CMD:

Command byte to be sent.

SMB_DATA[0]:

Low data byte to be sent.

SMB_DATA[1]:

High data byte to be sent.

SMB_PRTCL:

Write 0x0C to initiate the process call protocol, or 0x8C to initiate the process call protocol with PEC.

Data Returned:

SMB_DATA[0]:

Low data byte received.

SMB_DATA[1]:

High data byte received.

SMB_STS:

Status code for transaction.

SMB_PRTCL:

0x00 to indicate command completion.

12.9.2.12. Block Write-Block Read Process Call

Data Sent:

SMB_ADDR:

Address of SMBus device.

SMB_CMD:

Command byte to be sent.

SMB_DATA[0-31]:

Data bytes to write (1-31).

SMB_BCNT:

Number of data bytes (1-31) to be sent.

SMB_PRTCL:

Write 0x0D to initiate the write block-read block process call protocol, or 0x8D to initiate the write block-read block process call protocol with PEC.

Data Returned:

SMB_BCNT:

Number of data bytes (1-31) received.

SMB_DATA[0-31]:

Data bytes received (1-31).

SMB_STS:

Status code for transaction.

SMB_PRTCL:

0x00 to indicate command completion.

Note

The following restrictions apply above: The aggregate data length of the write and read blocks must not exceed 32 bytes and each block (write and read) must contain at least 1 byte of data.

12.9.2.13. SMBus Register Set

The register set for the SMB-HC has the following format. All registers are 8 bit.

Table 12.18 SMB EC Interface

Location

Register Name

Description

BASE+0

SMB_PRTCL

Protocol register

BASE+1

SMB_STS

Status register

BASE+2

SMB_ADDR

Address register

BASE+3

SMB_CMD

Command register

BASE+4

SMB_DATA[0]

Data register zero

BASE+5

SMB_DATA[1]

Data register one

BASE+6

SMB_DATA[2]

Data register two

BASE+7

SMB_DATA[3]

Data register three

BASE+8

SMB_DATA[4]

Data register four

BASE+9

SMB_DATA[5]

Data register five

BASE+10

SMB_DATA[6]

Data register six

BASE+11

SMB_DATA[7]

Data register seven

BASE+12

SMB_DATA[8]

Data register eight

BASE+13

SMB_DATA[9]

Data register nine

BASE+14

SMB_DATA[10]

Data register ten

BASE+15

SMB_DATA[11]

Data register eleven

BASE+16

SMB_DATA[12]

Data register twelve

BASE+17

SMB_DATA[13]

Data register thirteen

BASE+18

SMB_DATA[14]

Data register fourteen

BASE+19

SMB_DATA[15]

Data register fifteen

BASE+20

SMB_DATA[16]

Data register sixteen

BASE+21

SMB_DATA[17]

Data register seventeen

BASE+22

SMB_DATA[18]

Data register eighteen

BASE+23

SMB_DATA[19]

Data register nineteen

BASE+24

SMB_DATA[20]

Data register twenty

BASE+25

SMB_DATA[21]

Data register twenty-one

BASE+26

SMB_DATA[22]

Data register twenty-two

BASE+27

SMB_DATA[23]

Data register twenty-three

BASE+28

SMB_DATA[24]

Data register twenty-four

BASE+29

SMB_DATA[25]

Data register twenty-five

BASE+30

SMB_DATA[26]

Data register twenty-six

BASE+31

SMB_DATA[27]

Data register twenty-seven

BASE+32

SMB_DATA[28]

Data register twenty-eight

BASE+33

SMB_DATA[29]

Data register twenty-nine

BASE+34

SMB_DATA[30]

Data register thirty

BASE+35

SMB_DATA[31]

Data register thirty-one

BASE+36

SMB_BCNT

Block Count Register

BASE+37

SMB_ALRM_ADDR

Alarm address

BASE+38

SMB_ALRM_DATA[0]

Alarm data register zero

BASE+39

SMB_ALRM_DATA[1]

Alarm data register one