27.10.2015 Views

Advanced Configuration and Power Interface Specification

ACPI_6.0

ACPI_6.0

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

ACPI System Management Bus <strong>Interface</strong> <strong>Specification</strong><br />

// Create the SMBus data buffer<br />

Name(BUFF, Buffer(34){})<br />

CreateByteField(BUFF, 0x00, STAT)<br />

CreateByteField(BUFF, 0x01, SIZE)<br />

CreateField(BUFF, 0x10, 256, DATA)<br />

// Create SMBus data buffer as BUFF<br />

// STAT = Status (Byte)<br />

// SIZE = Length (Byte)<br />

// DATA = Data (Block)<br />

// Read block data from the device using comm<strong>and</strong> value 1<br />

Store(FLD1, BUFF)<br />

// Invoke a Read Block transaction<br />

If(LEqual(STAT, 0x00))<br />

// Successful?<br />

{<br />

// SIZE = Size (number of bytes) of the block data read from FLD1…<br />

// DATA = Block data read from FLD1…<br />

}<br />

// Write the block ‘TEST’ to the device using comm<strong>and</strong> value 2<br />

Store(“TEST”, DATA)<br />

// Save “TEST” into the data buffer<br />

Store(4, SIZE)<br />

// Length of valid data in the data buffer<br />

Store(BUFF, FLD2)<br />

// Invoke a Write Word transaction<br />

In this example, three field elements (FLD0, FLD1, <strong>and</strong> FLD2) are defined to represent the virtual<br />

registers for comm<strong>and</strong> values 0, 1, <strong>and</strong> 2. Access to any of the field elements will cause an SMBus<br />

transaction to occur to the device. Reading FLD1 results in a Read Block with a comm<strong>and</strong> value of<br />

1, <strong>and</strong> writing to FLD2 results in a Write Block with comm<strong>and</strong> value 2.<br />

13.3.6 Word Process Call (SMBProcessCall)<br />

The SMBus Process Call protocol (SMBProcessCall) transfers 2 bytes of data bi-directionally<br />

(performs a Write Word followed by a Read Word as an atomic transaction). This protocol uses a<br />

comm<strong>and</strong> value to reference up to 256 word-sized virtual registers.<br />

The following ASL code illustrates how a device supporting the Process Call protocol should be<br />

accessed:<br />

OperationRegion(SMBD, SMBus, 0x4200, 0x100) // SMBus device at slave address 0x42<br />

Field(SMBD, BufferAcc, NoLock, Preserve)<br />

{<br />

AccessAs(BufferAcc, SMBProcessCall) // Use the SMBus Process Call protocol<br />

FLD0, 8, // Virtual register at comm<strong>and</strong> value 0.<br />

FLD1, 8, // Virtual register at comm<strong>and</strong> value 1.<br />

FLD2, 8 // Virtual register at comm<strong>and</strong> value 2.<br />

}<br />

Name(BUFF, Buffer(34){})<br />

CreateByteField(BUFF, 0x00, STAT)<br />

CreateWordField(BUFF, 0x02, DATA)<br />

// Create the SMBus data buffer<br />

// Create SMBus data buffer as BUFF<br />

// STAT = Status (Byte)<br />

// DATA = Data (Word)<br />

// Process Call with input value ‘0x5416’ to the device using comm<strong>and</strong> value 1<br />

Store(0x5416, DATA)<br />

// Save 0x5416 into the data buffer<br />

Store(Store(BUFF, FLD1), BUFF)<br />

// Invoke a Process Call transaction<br />

If(LEqual(STAT, 0x00))<br />

// Successful?<br />

{<br />

// DATA = Word returned from FLD1…<br />

}<br />

In this example, three field elements (FLD0, FLD1, <strong>and</strong> FLD2) are defined to represent the virtual<br />

registers for comm<strong>and</strong> values 0, 1, <strong>and</strong> 2. Access to any of the field elements will cause an SMBus<br />

transaction to occur to the device. Reading or writing FLD1 results in a Process Call with a<br />

Version 6.0 673

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!