27.10.2015 Views

Advanced Configuration and Power Interface Specification

ACPI_6.0

ACPI_6.0

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>Advanced</strong> <strong>Configuration</strong> <strong>and</strong> <strong>Power</strong> <strong>Interface</strong> <strong>Specification</strong><br />

19.6.60 Index (Indexed Reference To Member Object)<br />

Syntax<br />

Index (Source, Index, Destination) => ObjectReference<br />

Destination = Source [Index] => ObjectReference<br />

Arguments<br />

Source is evaluated to a buffer, string, or package data type. Index is evaluated to an integer. The<br />

reference to the nth object (where n = Index) within Source is optionally stored as a reference into<br />

Destination.<br />

Description<br />

When Source evaluates to a Buffer, Index returns a reference to a Buffer Field containing the nth<br />

byte in the buffer. When Source evaluates to a String, Index returns a reference to a Buffer Field<br />

containing the nth character in the string. When Source evaluates to a Package, Index returns a<br />

reference to the nth object in the package.<br />

19.6.60.1 Index with Packages<br />

The following example ASL code shows a way to use the Index term to store into a local variable<br />

the sixth element of the first package of a set of nested packages:<br />

Name (IO0D, Package () {<br />

Package () {<br />

0x01, 0x03F8, 0x03F8, 0x01, 0x08, 0x01, 0x25, 0xFF, 0xFE, 0x00, 0x00<br />

},<br />

Package () {<br />

0x01, 0x02F8, 0x02F8, 0x01, 0x08, 0x01, 0x25, 0xFF, 0xBE, 0x00, 0x00<br />

},<br />

Package () {<br />

0x01, 0x03E8, 0x03E8, 0x01, 0x08, 0x01, 0x25, 0xFF, 0xFA, 0x00, 0x00<br />

},<br />

Package () {<br />

x01, 0x02E8, 0x02E8, 0x01, 0x08, 0x01, 0x25, 0xFF, 0xBA, 0x00, 0x00<br />

},<br />

Package() {<br />

0x01, 0x0100, 0x03F8, 0x08, 0x08, 0x02, 0x25, 0x20, 0x7F, 0x00, 0x00<br />

}<br />

})<br />

// Get the 6th element of the first package<br />

Store (DeRefOf (Index (DeRefOf (Index (IO0D, 0)), 5)), Local0)<br />

Note: DeRefOf is necessary in the first oper<strong>and</strong> of the Store operator in order to get the actual object,<br />

rather than just a reference to the object. If DeRefOf were not used, then Local0 would contain an<br />

object reference to the sixth element in the first package rather than the number 1.<br />

19.6.60.2 Index with Buffers<br />

The following example ASL code shows a way to store into the third byte of a buffer:<br />

848 April, 2015 Version 6.0

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

Saved successfully!

Ooh no, something went wrong!