19.6.63. IndexField(声明索引/数据字段)
语法 :
IndexField (IndexName, DataName, AccessType, LockRule, UpdateRule) {FieldUnitList}
参数
IndexName 按 Namestring 求值,并引用一个 Field Unit 对象。
DataName 按 Namestring 求值,并引用一个 Field Unit 对象。
AccessType、LockRule、UpdateRule 和 FieldList 与 Field 术语的格式相同。
说明
创建一系列已命名的数据对象,这些对象的数据值是更大对象中的字段,并通过对 IndexName 和 DataName 的索引/数据样式引用来访问。
此编码用于定义一系列已命名的数据对象,这些对象的数据值是某个索引/数据寄存器对中的字段。这提供了一种声明位于典型索引寄存器与数据寄存器对之后的寄存器变量的简单方法。
访问索引字段数据对象的内容时,将自动通过 DataName 对象进行,并使用按 AccessType 边界对齐的 IndexName 对象;同步则发生在包含索引数据变量的操作区域上,并且如果 LockRule 指定,则还发生在 Global Lock 上。
写入 IndexName 寄存器的值被定义为按 AccessType 边界对齐的字节偏移。例如,如果 AccessType 为 DWordAcc,则有效的索引值为 0、4、8 等。该值始终是字节偏移,并且独立于 DataName 寄存器的宽度或访问类型。
示例
下面的示例包含一段使用 IndexField 的 ASL 示例代码,它:
在系统 I/O 空间中创建一个由 8 位寄存器组成的索引/数据寄存器。
在索引范围内创建一个 FET0 字段。
Method (EX1) {
// Define a 256-byte operational region in SystemIO space
// and name it GIO0
OperationRegion (GIO0, 1, 0x125, 0x100)
// Create a field named Preserve structured as a sequence
// of index and data bytes
Field (GIO0, ByteAcc, NoLock, WriteAsZeros) {
IDX0, 8,
DAT0, 8,
.
.
.
}
// Create an IndexField within IDX0 & DAT0 which has
// FETs in the first two bits of indexed offset 0,
// and another 2 FETs in the high bit on indexed
// 2F and the low bit of indexed offset 30
IndexField (IDX0, DAT0, ByteAcc, NoLock, Preserve) {
FET0, 1,
FET1, 1,
Offset (0x2f), // skip to byte offset 2f
, 7, // skip another 7 bits
FET3, 1,
FET4, 1
}
// Clear FET3 (index 2F, bit 7)
Store (Zero, FET3)
} // End EX1