summaryrefslogtreecommitdiff
path: root/source/compiler
diff options
context:
space:
mode:
authorRobert Moore <Robert.Moore@intel.com>2011-06-30 17:10:51 -0700
committerLin Ming <ming.m.lin@intel.com>2011-11-10 10:10:22 +0800
commit81b1f18cdac939127565e48f761a7274c4c27dc6 (patch)
treec2a73337eaca559ae7b411cb51bb679cfad63cf4 /source/compiler
parent1c36e1e78655d363cc44de8071e0ca01940a8261 (diff)
downloadacpica-81b1f18cdac939127565e48f761a7274c4c27dc6.tar.gz
ACPI 5.0: iASL: update resource descs for latest proposals.
Latest version of the resource descriptors. Compiler support only.
Diffstat (limited to 'source/compiler')
-rw-r--r--source/compiler/aslcompiler.l16
-rw-r--r--source/compiler/aslcompiler.y217
-rw-r--r--source/compiler/aslmap.c22
-rw-r--r--source/compiler/aslrestype2.c926
4 files changed, 859 insertions, 322 deletions
diff --git a/source/compiler/aslcompiler.l b/source/compiler/aslcompiler.l
index 6e444ab6c..a0b43ce99 100644
--- a/source/compiler/aslcompiler.l
+++ b/source/compiler/aslcompiler.l
@@ -349,6 +349,7 @@ NamePathTail [.]{NameSeg}
"I2CSerialBus" { count (1); return (PARSEOP_I2C_SERIALBUS); }
"SPISerialBus" { count (1); return (PARSEOP_SPI_SERIALBUS); }
"UARTSerialBus" { count (1); return (PARSEOP_UART_SERIALBUS); }
+"FixedDma" { count (1); return (PARSEOP_FIXED_DMA); }
"UnknownObj" { count (0); return (PARSEOP_OBJECTTYPE_UNK); }
"IntObj" { count (0); return (PARSEOP_OBJECTTYPE_INT); }
@@ -451,11 +452,14 @@ NamePathTail [.]{NameSeg}
"Edge" { count (0); return (PARSEOP_INTTYPE_EDGE); }
"Level" { count (0); return (PARSEOP_INTTYPE_LEVEL); }
+"ActiveBoth" { count (0); return (PARSEOP_INTLEVEL_ACTIVEBOTH); }
"ActiveHigh" { count (0); return (PARSEOP_INTLEVEL_ACTIVEHIGH); }
"ActiveLow" { count (0); return (PARSEOP_INTLEVEL_ACTIVELOW); }
"Shared" { count (0); return (PARSEOP_SHARETYPE_SHARED); }
"Exclusive" { count (0); return (PARSEOP_SHARETYPE_EXCLUSIVE); }
+"SharedAndWake" { count (0); return (PARSEOP_SHARETYPE_SHAREDWAKE); }
+"ExclusiveAndWake" { count (0); return (PARSEOP_SHARETYPE_EXCLUSIVEWAKE); }
"Decode10" { count (0); return (PARSEOP_IODECODETYPE_10); }
"Decode16" { count (0); return (PARSEOP_IODECODETYPE_16); }
@@ -503,16 +507,20 @@ NamePathTail [.]{NameSeg}
"StopBitsOne" { count (0); return (PARSEOP_STOPBITS_ONE); }
"StopBitsNone" { count (0); return (PARSEOP_STOPBITS_NONE); }
-"FlowControlHardware" { count (0); return (PARSEOP_FLOWCONTROL_HARDWARE); }
-"FlowControlXON" { count (0); return (PARSEOP_FLOWCONTROL_XON); }
-"FlowControlNone" { count (0); return (PARSEOP_FLOWCONTROL_NONE); }
-
"ParityTypeSpace" { count (0); return (PARSEOP_PARITYTYPE_SPACE); }
"ParityTypeMark" { count (0); return (PARSEOP_PARITYTYPE_MARK); }
"ParityTypeOdd" { count (0); return (PARSEOP_PARITYTYPE_ODD); }
"ParityTypeEven" { count (0); return (PARSEOP_PARITYTYPE_EVEN); }
"ParityTypeNone" { count (0); return (PARSEOP_PARITYTYPE_NONE); }
+"PullUp" { count (0); return (PARSEOP_PIN_PULLUP); }
+"PullDown" { count (0); return (PARSEOP_PIN_PULLDOWN); }
+"NoPull" { count (0); return (PARSEOP_PIN_NOPULL); }
+
+"InputOnly" { count (0); return (PARSEOP_IORESTRICT_IN); }
+"OutputOnly" { count (0); return (PARSEOP_IORESTRICT_OUT); }
+
+
"__DATE__" { count (0); return (PARSEOP___DATE__); }
"__FILE__" { count (0); return (PARSEOP___FILE__); }
"__LINE__" { count (0); return (PARSEOP___LINE__); }
diff --git a/source/compiler/aslcompiler.y b/source/compiler/aslcompiler.y
index 0377127ce..93c9c924a 100644
--- a/source/compiler/aslcompiler.y
+++ b/source/compiler/aslcompiler.y
@@ -178,7 +178,7 @@ void * AslLocalAllocate (unsigned int Size);
* These shift/reduce conflicts are expected. There should be zero
* reduce/reduce conflicts.
*/
-%expect 67
+%expect 73
/*
* Token types: These are returned by the lexer
@@ -285,10 +285,8 @@ void * AslLocalAllocate (unsigned int Size);
%token <i> PARSEOP_FIELD
%token <i> PARSEOP_FINDSETLEFTBIT
%token <i> PARSEOP_FINDSETRIGHTBIT
+%token <i> PARSEOP_FIXED_DMA
%token <i> PARSEOP_FIXEDIO
-%token <i> PARSEOP_FLOWCONTROL_HARDWARE
-%token <i> PARSEOP_FLOWCONTROL_NONE
-%token <i> PARSEOP_FLOWCONTROL_XON
%token <i> PARSEOP_FROMBCD
%token <i> PARSEOP_FUNCTION
%token <i> PARSEOP_GPIO_INT
@@ -303,6 +301,7 @@ void * AslLocalAllocate (unsigned int Size);
%token <i> PARSEOP_INDEXFIELD
%token <i> PARSEOP_INTEGER
%token <i> PARSEOP_INTERRUPT
+%token <i> PARSEOP_INTLEVEL_ACTIVEBOTH
%token <i> PARSEOP_INTLEVEL_ACTIVEHIGH
%token <i> PARSEOP_INTLEVEL_ACTIVELOW
%token <i> PARSEOP_INTTYPE_EDGE
@@ -310,6 +309,8 @@ void * AslLocalAllocate (unsigned int Size);
%token <i> PARSEOP_IO
%token <i> PARSEOP_IODECODETYPE_10
%token <i> PARSEOP_IODECODETYPE_16
+%token <i> PARSEOP_IORESTRICT_IN
+%token <i> PARSEOP_IORESTRICT_OUT
%token <i> PARSEOP_IRQ
%token <i> PARSEOP_IRQNOFLAGS
%token <i> PARSEOP_LAND
@@ -395,6 +396,9 @@ void * AslLocalAllocate (unsigned int Size);
%token <i> PARSEOP_PARITYTYPE_NONE
%token <i> PARSEOP_PARITYTYPE_ODD
%token <i> PARSEOP_PARITYTYPE_SPACE
+%token <i> PARSEOP_PIN_NOPULL
+%token <i> PARSEOP_PIN_PULLDOWN
+%token <i> PARSEOP_PIN_PULLUP
%token <i> PARSEOP_POWERRESOURCE
%token <i> PARSEOP_PROCESSOR
%token <i> PARSEOP_QWORDCONST
@@ -431,7 +435,9 @@ void * AslLocalAllocate (unsigned int Size);
%token <i> PARSEOP_SERIALIZERULE_NOTSERIAL
%token <i> PARSEOP_SERIALIZERULE_SERIAL
%token <i> PARSEOP_SHARETYPE_EXCLUSIVE
+%token <i> PARSEOP_SHARETYPE_EXCLUSIVEWAKE
%token <i> PARSEOP_SHARETYPE_SHARED
+%token <i> PARSEOP_SHARETYPE_SHAREDWAKE
%token <i> PARSEOP_SHIFTLEFT
%token <i> PARSEOP_SHIFTRIGHT
%token <i> PARSEOP_SIGNAL
@@ -703,8 +709,10 @@ void * AslLocalAllocate (unsigned int Size);
%type <n> EndianKeyword
%type <n> BitsPerByteKeyword
%type <n> StopBitsKeyword
-%type <n> FlowControlKeyword
%type <n> ParityTypeKeyword
+%type <n> PinConfigKeyword
+%type <n> PinConfigByte
+%type <n> IoRestrictionKeyword
/* Types */
@@ -778,6 +786,7 @@ void * AslLocalAllocate (unsigned int Size);
%type <n> I2cSerialBusTerm
%type <n> SpiSerialBusTerm
%type <n> UartSerialBusTerm
+%type <n> FixedDmaTerm
%type <n> NameString
%type <n> NameSeg
@@ -790,6 +799,7 @@ void * AslLocalAllocate (unsigned int Size);
%type <n> OptionalByteConstExpr
%type <n> OptionalDWordConstExpr
%type <n> OptionalQWordConstExpr
+%type <n> OptionalWordConstExpr
%type <n> OptionalSerializeRuleKeyword
%type <n> OptionalResourceType_First
%type <n> OptionalResourceType
@@ -800,6 +810,7 @@ void * AslLocalAllocate (unsigned int Size);
%type <n> OptionalDecodeType
%type <n> OptionalRangeType
%type <n> OptionalShareType
+%type <n> OptionalShareType_First
%type <n> OptionalType
%type <n> OptionalType_Last
%type <n> OptionalTranslationType_Last
@@ -813,16 +824,15 @@ void * AslLocalAllocate (unsigned int Size);
%type <n> OptionalParameterTypesPackage
%type <n> OptionalReference
%type <n> OptionalAccessSize
-%type <n> OptionalAddressingMode_First
+%type <n> OptionalAddressingMode
%type <n> OptionalSlaveMode
-%type <n> OptionalWireMode_First
-%type <n> OptionalDevicePolarity
+%type <n> OptionalWireMode
%type <n> OptionalEndian
%type <n> OptionalBitsPerByte
%type <n> OptionalStopBits
-%type <n> OptionalFlowControl
%type <n> OptionalParityType
-
+%type <n> OptionalIoRestriction
+%type <n> OptionalBuffer_Last
%type <n> TermArgItem
%type <n> NameStringItem
@@ -2330,14 +2340,17 @@ InterruptTypeKeyword
;
InterruptLevel
- : PARSEOP_INTLEVEL_ACTIVEHIGH {$$ = TrCreateLeafNode (PARSEOP_INTLEVEL_ACTIVEHIGH);}
+ : PARSEOP_INTLEVEL_ACTIVEBOTH {$$ = TrCreateLeafNode (PARSEOP_INTLEVEL_ACTIVEBOTH);}
+ | PARSEOP_INTLEVEL_ACTIVEHIGH {$$ = TrCreateLeafNode (PARSEOP_INTLEVEL_ACTIVEHIGH);}
| PARSEOP_INTLEVEL_ACTIVELOW {$$ = TrCreateLeafNode (PARSEOP_INTLEVEL_ACTIVELOW);}
;
ShareTypeKeyword
: PARSEOP_SHARETYPE_SHARED {$$ = TrCreateLeafNode (PARSEOP_SHARETYPE_SHARED);}
| PARSEOP_SHARETYPE_EXCLUSIVE {$$ = TrCreateLeafNode (PARSEOP_SHARETYPE_EXCLUSIVE);}
- ;
+ | PARSEOP_SHARETYPE_SHAREDWAKE {$$ = TrCreateLeafNode (PARSEOP_SHARETYPE_SHAREDWAKE);}
+ | PARSEOP_SHARETYPE_EXCLUSIVEWAKE {$$ = TrCreateLeafNode (PARSEOP_SHARETYPE_EXCLUSIVEWAKE);}
+ ;
IODecodeKeyword
: PARSEOP_IODECODETYPE_16 {$$ = TrCreateLeafNode (PARSEOP_IODECODETYPE_16);}
@@ -2411,12 +2424,6 @@ StopBitsKeyword
| PARSEOP_STOPBITS_NONE {$$ = TrCreateLeafNode (PARSEOP_STOPBITS_NONE);}
;
-FlowControlKeyword
- : PARSEOP_FLOWCONTROL_HARDWARE {$$ = TrCreateLeafNode (PARSEOP_FLOWCONTROL_HARDWARE);}
- | PARSEOP_FLOWCONTROL_XON {$$ = TrCreateLeafNode (PARSEOP_FLOWCONTROL_XON);}
- | PARSEOP_FLOWCONTROL_NONE {$$ = TrCreateLeafNode (PARSEOP_FLOWCONTROL_NONE);}
- ;
-
ParityTypeKeyword
: PARSEOP_PARITYTYPE_SPACE {$$ = TrCreateLeafNode (PARSEOP_PARITYTYPE_SPACE);}
| PARSEOP_PARITYTYPE_MARK {$$ = TrCreateLeafNode (PARSEOP_PARITYTYPE_MARK);}
@@ -2425,6 +2432,17 @@ ParityTypeKeyword
| PARSEOP_PARITYTYPE_NONE {$$ = TrCreateLeafNode (PARSEOP_PARITYTYPE_NONE);}
;
+PinConfigKeyword
+ : PARSEOP_PIN_NOPULL {$$ = TrCreateLeafNode (PARSEOP_PIN_NOPULL);}
+ | PARSEOP_PIN_PULLDOWN {$$ = TrCreateLeafNode (PARSEOP_PIN_PULLDOWN);}
+ | PARSEOP_PIN_PULLUP {$$ = TrCreateLeafNode (PARSEOP_PIN_PULLUP);}
+ ;
+
+IoRestrictionKeyword
+ : PARSEOP_IORESTRICT_IN {$$ = TrCreateLeafNode (PARSEOP_IORESTRICT_IN);}
+ | PARSEOP_IORESTRICT_OUT {$$ = TrCreateLeafNode (PARSEOP_IORESTRICT_OUT);}
+ ;
+
/******* Miscellaneous Types **************************************************/
@@ -2668,6 +2686,7 @@ ResourceMacroTerm
| I2cSerialBusTerm {}
| SpiSerialBusTerm {}
| UartSerialBusTerm {}
+ | FixedDmaTerm {}
;
DMATerm
@@ -3092,86 +3111,123 @@ WordSpaceTerm
error ')' {$$ = AslDoError(); yyclearin;}
;
+
+OptionalBuffer_Last
+ : {$$ = NULL;}
+ | ',' {$$ = NULL;}
+ | ',' BufferTerm {$$ = $2;}
+ ;
+
+PinConfigByte
+ : PinConfigKeyword {$$ = $1;}
+ | ByteConstExpr {$$ = UtCheckIntegerRange ($1, 0x80, 0xFF);}
+ ;
+
GpioIntTerm
: PARSEOP_GPIO_INT '(' {$<n>$ = TrCreateLeafNode (PARSEOP_GPIO_INT);}
- OptionalResourceType_First
- ',' InterruptTypeKeyword
- ',' InterruptLevel
- OptionalShareType
- ',' WordConstExpr
- ',' ByteConstExpr
- OptionalStringData
- OptionalNameString_Last
+ InterruptTypeKeyword // InterruptType
+ ',' InterruptLevel // InterruptLevel
+ OptionalShareType // SharedType
+ ',' PinConfigByte // PinConfig
+ OptionalWordConstExpr // DebounceTimeout
+ ',' StringData // ResourceSource
+ OptionalByteConstExpr // ResourceSourceIndex
+ OptionalResourceType // ResourceType
+ OptionalNameString // DescriptorName
+ OptionalBuffer_Last // VendorData
')' '{'
- DWordList '}' {$$ = TrLinkChildren ($<n>3,9,$4,$6,$8,$9,$11,$13,$14,$15,$18);}
+ DWordList '}' {$$ = TrLinkChildren ($<n>3,11,$4,$6,$7,$9,$10,$12,$13,$14,$15,$16,$19);}
| PARSEOP_GPIO_INT '('
error ')' {$$ = AslDoError(); yyclearin;}
;
GpioIoTerm
: PARSEOP_GPIO_IO '(' {$<n>$ = TrCreateLeafNode (PARSEOP_GPIO_IO);}
- OptionalResourceType_First
- ',' InterruptTypeKeyword
- ',' InterruptLevel
- OptionalShareType
- ',' WordConstExpr
- ',' ByteConstExpr
- OptionalStringData
- OptionalNameString_Last
+ OptionalShareType_First // SharedType
+ ',' PinConfigByte // PinConfig
+ OptionalWordConstExpr // DebounceTimeout
+ OptionalWordConstExpr // DriveStrength
+ OptionalIoRestriction // IoRestriction
+ ',' StringData // ResourceSource
+ OptionalByteConstExpr // ResourceSourceIndex
+ OptionalResourceType // ResourceType
+ OptionalNameString // DescriptorName
+ OptionalBuffer_Last // VendorData
')' '{'
- DWordList '}' {$$ = TrLinkChildren ($<n>3,9,$4,$6,$8,$9,$11,$13,$14,$15,$18);}
+ DWordList '}' {$$ = TrLinkChildren ($<n>3,11,$4,$6,$7,$8,$9,$11,$12,$13,$14,$15,$18);}
| PARSEOP_GPIO_IO '('
error ')' {$$ = AslDoError(); yyclearin;}
;
I2cSerialBusTerm
: PARSEOP_I2C_SERIALBUS '(' {$<n>$ = TrCreateLeafNode (PARSEOP_I2C_SERIALBUS);}
- OptionalAddressingMode_First
- ',' DWordConstExpr
- ',' WordConstExpr
- OptionalSlaveMode
- OptionalStringData
- OptionalNameString_Last
- ')' {$$ = TrLinkChildren ($<n>3,6,$4,$6,$8,$9,$10,$11);}
+ WordConstExpr // SlaveAddress
+ OptionalSlaveMode // SlaveMode
+ ',' DWordConstExpr // ConnectionSpeed
+ OptionalAddressingMode // AddressingMode
+ ',' StringData // ResourceSource
+ OptionalByteConstExpr // ResourceSourceIndex
+ OptionalResourceType // ResourceType
+ OptionalNameString // DescriptorName
+ OptionalReference // VendorData
+ ')' {$$ = TrLinkChildren ($<n>3,9,$4,$5,$7,$8,$10,$11,$12,$13,$14);}
| PARSEOP_I2C_SERIALBUS '('
error ')' {$$ = AslDoError(); yyclearin;}
;
SpiSerialBusTerm
: PARSEOP_SPI_SERIALBUS '(' {$<n>$ = TrCreateLeafNode (PARSEOP_SPI_SERIALBUS);}
- OptionalWireMode_First
- ',' DWordConstExpr
- ',' ByteConstExpr
- ',' ClockPhaseKeyword
- ',' ClockPolarityKeyword
- ',' WordConstExpr
- OptionalDevicePolarity
- OptionalSlaveMode
- OptionalStringData
- OptionalNameString_Last
- ')' {$$ = TrLinkChildren ($<n>3,10,$4,$6,$8,$10,$12,$14,$15,$16,$17,$18);}
+ WordConstExpr // DeviceSelection
+ ',' DevicePolarityKeyword // DevicePolarity
+ OptionalWireMode // WireMode
+ ',' ByteConstExpr // DataBitLength
+ OptionalSlaveMode // SlaveMode
+ ',' DWordConstExpr // ConnectionSpeed
+ ',' ClockPolarityKeyword // ClockPolarity
+ ',' ClockPhaseKeyword // ClockPhase
+ OptionalStringData // ResourceSource
+ OptionalByteConstExpr // ResourceSourceIndex
+ OptionalResourceType // ResourceType
+ OptionalNameString // DescriptorName
+ OptionalReference // VendorData
+ ')' {$$ = TrLinkChildren ($<n>3,13,$4,$6,$7,$9,$10,$12,$14,$16,$17,$18,$19,$20,$21);}
| PARSEOP_SPI_SERIALBUS '('
error ')' {$$ = AslDoError(); yyclearin;}
;
UartSerialBusTerm
: PARSEOP_UART_SERIALBUS '(' {$<n>$ = TrCreateLeafNode (PARSEOP_UART_SERIALBUS);}
- ByteConstExpr
- OptionalEndian
- OptionalBitsPerByte
- OptionalStopBits
- OptionalFlowControl
- ',' DWordConstExpr
- ',' WordConstExpr
- ',' WordConstExpr
- OptionalParityType
- OptionalStringData
- OptionalNameString_Last
- ')' {$$ = TrLinkChildren ($<n>3,11,$4,$5,$6,$7,$8,$10,$12,$14,$15,$16,$17);}
+ DWordConstExpr // ConnectionSpeed
+ OptionalBitsPerByte // BitsPerByte
+ OptionalStopBits // StopBits
+ ',' ByteConstExpr // LinesInUse
+ OptionalEndian // Endianess
+ OptionalParityType // Parity
+ ',' WordConstExpr // Rx BufferSize
+ ',' WordConstExpr // Tx BufferSize
+ OptionalStringData // ResourceSource
+ OptionalByteConstExpr // ResourceSourceIndex
+ OptionalResourceType // ResourceType
+ OptionalNameString // DescriptorName
+ OptionalReference // VendorData
+ ')' {$$ = TrLinkChildren ($<n>3,13,$4,$5,$6,$8,$9,$10,$12,$14,$15,$16,$17,$18,$19);}
| PARSEOP_UART_SERIALBUS '('
error ')' {$$ = AslDoError(); yyclearin;}
;
+FixedDmaTerm
+ : PARSEOP_FIXED_DMA '(' {$<n>$ = TrCreateLeafNode (PARSEOP_FIXED_DMA);}
+ WordConstExpr // DMA Request line
+ ',' WordConstExpr // DMA channel
+ ',' ByteConstExpr // DMA transfer width
+ OptionalNameString // DescriptorName
+ ')' {$$ = TrLinkChildren ($<n>3,4,$4,$6,$8,$9);}
+ | PARSEOP_FIXED_DMA '('
+ error ')' {$$ = AslDoError(); yyclearin;}
+ ;
+
+
+
/******* Object References ***********************************************/
/* Allow IO, DMA, IRQ Resource macro names to also be used as identifiers */
@@ -3215,9 +3271,9 @@ OptionalAccessSize
| ',' ByteConstExpr {$$ = $2;}
;
-OptionalAddressingMode_First
- : {$$ = NULL;}
- | AddressingModeKeyword {$$ = $1;}
+OptionalAddressingMode
+ : ',' {$$ = NULL;}
+ | ',' AddressingModeKeyword {$$ = $2;}
;
OptionalAddressRange
@@ -3242,10 +3298,6 @@ OptionalDecodeType
| ',' DecodeKeyword {$$ = $2;}
;
-OptionalDevicePolarity
- : ',' {$$ = NULL;}
- | ',' DevicePolarityKeyword {$$ = $2;}
- ;
OptionalDWordConstExpr
: {$$ = NULL;}
@@ -3258,9 +3310,9 @@ OptionalEndian
| ',' EndianKeyword {$$ = $2;}
;
-OptionalFlowControl
+OptionalIoRestriction
: ',' {$$ = NULL;}
- | ',' FlowControlKeyword {$$ = $2;}
+ | ',' IoRestrictionKeyword {$$ = $2;}
;
OptionalListString
@@ -3355,6 +3407,11 @@ OptionalShareType
| ',' ShareTypeKeyword {$$ = $2;}
;
+OptionalShareType_First
+ : {$$ = NULL;}
+ | ShareTypeKeyword {$$ = $1;}
+ ;
+
OptionalStopBits
: ',' {$$ = NULL;}
| ',' StopBitsKeyword {$$ = $2;}
@@ -3394,11 +3451,15 @@ OptionalTranslationType_Last
| ',' TranslationKeyword {$$ = $2;}
;
-OptionalWireMode_First
- : {$$ = NULL;}
- | WireModeKeyword {$$ = $1;}
+OptionalWireMode
+ : ',' {$$ = NULL;}
+ | ',' WireModeKeyword {$$ = $2;}
;
+OptionalWordConstExpr
+ : ',' {$$ = NULL;}
+ | ',' WordConstExpr {$$ = $2;}
+ ;
TermArgItem
: ',' TermArg {$$ = $2;}
diff --git a/source/compiler/aslmap.c b/source/compiler/aslmap.c
index 2ff82402c..620d0ef78 100644
--- a/source/compiler/aslmap.c
+++ b/source/compiler/aslmap.c
@@ -296,10 +296,8 @@ const ASL_MAPPING_ENTRY AslKeywordMapping [] =
/* FIELD */ OP_TABLE_ENTRY (AML_FIELD_OP, 0, NODE_AML_PACKAGE, 0),
/* FINDSETLEFTBIT */ OP_TABLE_ENTRY (AML_FIND_SET_LEFT_BIT_OP, 0, 0, ACPI_BTYPE_INTEGER),
/* FINDSETRIGHTBIT */ OP_TABLE_ENTRY (AML_FIND_SET_RIGHT_BIT_OP, 0, 0, ACPI_BTYPE_INTEGER),
+/* FIXEDDMA */ OP_TABLE_ENTRY (AML_DEFAULT_ARG_OP, 0, 0, 0),
/* FIXEDIO */ OP_TABLE_ENTRY (AML_DEFAULT_ARG_OP, 0, 0, 0),
-/* FLOWCONTROL_HARDWARE */ OP_TABLE_ENTRY (AML_BYTE_OP, 1, 0, 0),
-/* FLOWCONTROL_NONE */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0),
-/* FLOWCONTROL_XON */ OP_TABLE_ENTRY (AML_BYTE_OP, 2, 0, 0),
/* FROMBCD */ OP_TABLE_ENTRY (AML_FROM_BCD_OP, 0, 0, ACPI_BTYPE_INTEGER),
/* FUNCTION */ OP_TABLE_ENTRY (AML_METHOD_OP, 0, NODE_AML_PACKAGE, 0),
/* GPIOINT */ OP_TABLE_ENTRY (AML_DEFAULT_ARG_OP, 0, 0, 0),
@@ -314,6 +312,7 @@ const ASL_MAPPING_ENTRY AslKeywordMapping [] =
/* INDEXFIELD */ OP_TABLE_ENTRY (AML_INDEX_FIELD_OP, 0, NODE_AML_PACKAGE, 0),
/* INTEGER */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, ACPI_BTYPE_INTEGER),
/* INTERRUPT */ OP_TABLE_ENTRY (AML_DEFAULT_ARG_OP, 0, 0, 0),
+/* INTLEVEL_ACTIVEBOTH */ OP_TABLE_ENTRY (AML_BYTE_OP, 2, 0, 0),
/* INTLEVEL_ACTIVEHIGH */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0),
/* INTLEVEL_ACTIVELOW */ OP_TABLE_ENTRY (AML_BYTE_OP, 1, 0, 0),
/* INTTYPE_EDGE */ OP_TABLE_ENTRY (AML_BYTE_OP, 1, 0, 0),
@@ -321,6 +320,8 @@ const ASL_MAPPING_ENTRY AslKeywordMapping [] =
/* IO */ OP_TABLE_ENTRY (AML_DEFAULT_ARG_OP, 0, 0, 0),
/* IODECODETYPE_10 */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0),
/* IODECODETYPE_16 */ OP_TABLE_ENTRY (AML_BYTE_OP, 1, 0, 0),
+/* IORESTRICT_IN */ OP_TABLE_ENTRY (AML_BYTE_OP, 1, 0, 0),
+/* IORESTRICT_OUT */ OP_TABLE_ENTRY (AML_BYTE_OP, 2, 0, 0),
/* IRQ */ OP_TABLE_ENTRY (AML_DEFAULT_ARG_OP, 0, 0, 0),
/* IRQNOFLAGS */ OP_TABLE_ENTRY (AML_DEFAULT_ARG_OP, 0, 0, 0),
/* LAND */ OP_TABLE_ENTRY (AML_LAND_OP, 0, 0, ACPI_BTYPE_INTEGER),
@@ -406,6 +407,9 @@ const ASL_MAPPING_ENTRY AslKeywordMapping [] =
/* PARITYTYPE_NONE */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0),
/* PARITYTYPE_ODD */ OP_TABLE_ENTRY (AML_BYTE_OP, 2, 0, 0),
/* PARITYTYPE_SPACE */ OP_TABLE_ENTRY (AML_BYTE_OP, 4, 0, 0),
+/* PIN_NOPULL */ OP_TABLE_ENTRY (AML_BYTE_OP, 3, 0, 0),
+/* PIN_PULLDOWN */ OP_TABLE_ENTRY (AML_BYTE_OP, 2, 0, 0),
+/* PIN_PULLUP */ OP_TABLE_ENTRY (AML_BYTE_OP, 1, 0, 0),
/* POWERRESOURCE */ OP_TABLE_ENTRY (AML_POWER_RES_OP, 0, NODE_AML_PACKAGE, 0),
/* PROCESSOR */ OP_TABLE_ENTRY (AML_PROCESSOR_OP, 0, NODE_AML_PACKAGE, 0),
/* QWORDCONST */ OP_TABLE_ENTRY (AML_RAW_DATA_QWORD, 0, 0, ACPI_BTYPE_INTEGER),
@@ -442,7 +446,9 @@ const ASL_MAPPING_ENTRY AslKeywordMapping [] =
/* SERIALIZERULE_NOTSERIAL */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0),
/* SERIALIZERULE_SERIAL */ OP_TABLE_ENTRY (AML_BYTE_OP, 1, 0, 0),
/* SHARETYPE_EXCLUSIVE */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0),
+/* SHARETYPE_EXCLUSIVEWAKE */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0),
/* SHARETYPE_SHARED */ OP_TABLE_ENTRY (AML_BYTE_OP, 1, 0, 0),
+/* SHARETYPE_SHAREDWAKE */ OP_TABLE_ENTRY (AML_BYTE_OP, 1, 0, 0),
/* SHIFTLEFT */ OP_TABLE_ENTRY (AML_SHIFT_LEFT_OP, 0, 0, ACPI_BTYPE_INTEGER),
/* SHIFTRIGHT */ OP_TABLE_ENTRY (AML_SHIFT_RIGHT_OP, 0, 0, ACPI_BTYPE_INTEGER),
/* SIGNAL */ OP_TABLE_ENTRY (AML_SIGNAL_OP, 0, 0, 0),
@@ -454,10 +460,10 @@ const ASL_MAPPING_ENTRY AslKeywordMapping [] =
/* STALL */ OP_TABLE_ENTRY (AML_STALL_OP, 0, 0, 0),
/* STARTDEPENDENTFN */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0),
/* STARTDEPENDENTFN_NOPRI */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0),
-/* PARSEOP_STOPBITS_NONE */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0),
-/* PARSEOP_STOPBITS_ONE */ OP_TABLE_ENTRY (AML_BYTE_OP, 1, 0, 0),
-/* PARSEOP_STOPBITS_ONEPLUSHALF */ OP_TABLE_ENTRY (AML_BYTE_OP, 2, 0, 0),
-/* PARSEOP_STOPBITS_TWO */ OP_TABLE_ENTRY (AML_BYTE_OP, 3, 0, 0),
+/* STOPBITS_NONE */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0),
+/* STOPBITS_ONE */ OP_TABLE_ENTRY (AML_BYTE_OP, 1, 0, 0),
+/* STOPBITS_ONEPLUSHALF */ OP_TABLE_ENTRY (AML_BYTE_OP, 2, 0, 0),
+/* STOPBITS_TWO */ OP_TABLE_ENTRY (AML_BYTE_OP, 3, 0, 0),
/* STORE */ OP_TABLE_ENTRY (AML_STORE_OP, 0, 0, ACPI_BTYPE_DATA_REFERENCE),
/* STRING_LITERAL */ OP_TABLE_ENTRY (AML_STRING_OP, 0, 0, ACPI_BTYPE_STRING),
/* SUBTRACT */ OP_TABLE_ENTRY (AML_SUBTRACT_OP, 0, 0, ACPI_BTYPE_INTEGER),
@@ -475,7 +481,7 @@ const ASL_MAPPING_ENTRY AslKeywordMapping [] =
/* TRANSLATIONTYPE_SPARSE */ OP_TABLE_ENTRY (AML_BYTE_OP, 1, 0, 0),
/* TYPE_STATIC */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0),
/* TYPE_TRANSLATION */ OP_TABLE_ENTRY (AML_BYTE_OP, 1, 0, 0),
-/* UARTSERIALBUS */ OP_TABLE_ENTRY (AML_DEFAULT_ARG_OP, 0, 0, 0),
+/* UART_SERIALBUS */ OP_TABLE_ENTRY (AML_DEFAULT_ARG_OP, 0, 0, 0),
/* UNICODE */ OP_TABLE_ENTRY (AML_BUFFER_OP, 0, NODE_AML_PACKAGE, 0),
/* UNLOAD */ OP_TABLE_ENTRY (AML_UNLOAD_OP, 0, 0, 0),
/* UPDATERULE_ONES */ OP_TABLE_ENTRY (AML_BYTE_OP, AML_FIELD_UPDATE_WRITE_AS_ONES, 0, 0),
diff --git a/source/compiler/aslrestype2.c b/source/compiler/aslrestype2.c
index 9fb20f353..a1a7e4122 100644
--- a/source/compiler/aslrestype2.c
+++ b/source/compiler/aslrestype2.c
@@ -122,6 +122,15 @@
#define _COMPONENT ACPI_COMPILER
ACPI_MODULE_NAME ("aslrestype2")
+
+UINT16
+RsGetBufferDataLength (
+ ACPI_PARSE_OBJECT *InitializerOp);
+
+UINT16
+RsGetInterruptDataLength (
+ ACPI_PARSE_OBJECT *InitializerOp);
+
/*
* This module contains miscellaneous large resource descriptors:
*
@@ -536,6 +545,72 @@ RsDoVendorLargeDescriptor (
/*******************************************************************************
*
+ * FUNCTION: RsGetBufferDataLength
+ *
+ ******************************************************************************/
+
+UINT16
+RsGetBufferDataLength (
+ ACPI_PARSE_OBJECT *InitializerOp)
+{
+ UINT16 ExtraDataSize = 0;
+ ACPI_PARSE_OBJECT *DataList;
+
+
+ while (InitializerOp)
+ {
+ if (InitializerOp->Asl.ParseOpcode == PARSEOP_BUFFER)
+ {
+ DataList = InitializerOp->Asl.Child;
+ DataList = DataList->Asl.Next;
+
+ while (DataList)
+ {
+ ExtraDataSize++;
+ DataList = DataList->Asl.Next;
+ }
+ return (ExtraDataSize);
+ }
+ InitializerOp = ASL_GET_PEER_NODE (InitializerOp);
+ }
+
+ return (ExtraDataSize);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: RsGetInterruptDataLength
+ *
+ ******************************************************************************/
+
+UINT16
+RsGetInterruptDataLength (
+ ACPI_PARSE_OBJECT *InitializerOp)
+{
+ UINT16 InterruptLength;
+ UINT32 i;
+
+
+ /* Count the interrupt numbers */
+
+ InterruptLength = 0;
+ for (i = 0; InitializerOp; i++)
+ {
+ InitializerOp = ASL_GET_PEER_NODE (InitializerOp);
+
+ if (i >= 10)
+ {
+ InterruptLength += 2;
+ }
+ }
+
+ return (InterruptLength);
+}
+
+
+/*******************************************************************************
+ *
* FUNCTION: RsDoGpioIntDescriptor
*
* PARAMETERS: Op - Parent resource descriptor parse node
@@ -555,27 +630,52 @@ RsDoGpioIntDescriptor (
{
AML_RESOURCE *Descriptor;
ACPI_PARSE_OBJECT *InitializerOp;
+ ACPI_PARSE_OBJECT *BufferOp;
ASL_RESOURCE_NODE *Rnode;
- UINT16 StringLength = 0;
+ char *ResourceSource = NULL;
+ UINT8 *VendorData = NULL;
+ UINT16 *InterruptList = NULL;
+ UINT16 ResSourceLength;
+ UINT16 VendorLength;
+ UINT16 InterruptLength;
+ UINT16 DescriptorSize;
UINT32 i;
- UINT8 *ResSourceString = NULL;
InitializerOp = Op->Asl.Child;
- StringLength = RsGetStringDataLength (InitializerOp);
- Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_GPIO_INT) +
- StringLength);
+ /*
+ * Calculate lengths for fields that have variable length:
+ * 1) Resource Source string
+ * 2) Vendor Data buffer
+ * 3) PIN (interrupt) list
+ */
+ ResSourceLength = RsGetStringDataLength (InitializerOp);
+ VendorLength = RsGetBufferDataLength (InitializerOp);
+ InterruptLength = RsGetInterruptDataLength (InitializerOp);
+
+ DescriptorSize = sizeof (AML_RESOURCE_GPIO_INT) +
+ ResSourceLength + VendorLength + InterruptLength;
+
+ /* Allocate the local resource node and initialize */
+
+ Rnode = RsAllocateResourceNode (DescriptorSize);
Descriptor = Rnode->Buffer;
+ Descriptor->GpioInt.ResourceLength = DescriptorSize;
Descriptor->GpioInt.DescriptorType = ACPI_RESOURCE_NAME_GPIO_INT;
+ Descriptor->GpioInt.RevisionId = AML_RESOURCE_GPIO_REVISION;
+ Descriptor->GpioInt.ConnectionType = AML_RESOURCE_GPIO_TYPE_INT;
- /*
- * Initial descriptor length -- may be enlarged if there are
- * optional fields present
- */
- Descriptor->GpioInt.ResourceLength = sizeof (AML_RESOURCE_GPIO_INT) - 3 + StringLength;
- Descriptor->GpioInt.InterruptCount = 1;
+ /* Build pointers to optional areas */
+
+ VendorData = ACPI_ADD_PTR (UINT8, Descriptor, sizeof (AML_RESOURCE_GPIO_INT));
+ InterruptList = ACPI_ADD_PTR (UINT16, VendorData, VendorLength);
+ ResourceSource = ACPI_ADD_PTR (char, InterruptList, InterruptLength);
+
+ printf ("GPIO_INT: Base: %u, ResLen: %u, VendLen: %u, IntLen: %u, ACTUAL: %X\n",
+ sizeof (AML_RESOURCE_GPIO_INT), ResSourceLength, VendorLength, InterruptLength,
+ Descriptor->GpioInt.ResourceLength);
/* Process all child initialization nodes */
@@ -583,84 +683,147 @@ RsDoGpioIntDescriptor (
{
switch (i)
{
- case 0: /* Resource Usage (Default: consumer (1) */
-
- RsSetFlagBits ((UINT8 *)&Descriptor->GpioInt.Flags, InitializerOp, 0, 1);
- break;
+ case 0: /* Interrupt Type (or Mode - edge/level) */
- case 1: /* Interrupt Type (or Mode - edge/level) */
-
- RsSetFlagBits ((UINT8 *)&Descriptor->GpioInt.Flags, InitializerOp, 1, 0);
+ RsSetFlagBits ((UINT8 *)&Descriptor->GpioInt.IntFlags, InitializerOp, 0, 0);
RsCreateBitField (InitializerOp, ACPI_RESTAG_INTERRUPTTYPE,
- CurrentByteOffset + ASL_RESDESC_OFFSET (GpioInt.Flags), 1);
+ CurrentByteOffset + ASL_RESDESC_OFFSET (GpioInt.IntFlags), 0);
break;
- case 2: /* Interrupt Level (or Polarity - Active high/low) */
+ case 1: /* Interrupt Level (or Polarity - Active high/low) */
- RsSetFlagBits ((UINT8 *)&Descriptor->GpioInt.Flags, InitializerOp, 2, 0);
+ RsSetFlagBits ((UINT8 *)&Descriptor->GpioInt.IntFlags, InitializerOp, 1, 0);
RsCreateBitField (InitializerOp, ACPI_RESTAG_INTERRUPTLEVEL,
- CurrentByteOffset + ASL_RESDESC_OFFSET (GpioInt.Flags), 2);
+ CurrentByteOffset + ASL_RESDESC_OFFSET (GpioInt.IntFlags), 1);
break;
- case 3: /* Share Type - Default: exclusive (0) */
+ case 2: /* Share Type - Default: exclusive (0) */
- RsSetFlagBits ((UINT8 *)&Descriptor->GpioInt.Flags, InitializerOp, 3, 0);
+ RsSetFlagBits ((UINT8 *)&Descriptor->GpioInt.IntFlags, InitializerOp, 3, 0);
RsCreateBitField (InitializerOp, ACPI_RESTAG_INTERRUPTSHARE,
- CurrentByteOffset + ASL_RESDESC_OFFSET (GpioInt.Flags), 3);
+ CurrentByteOffset + ASL_RESDESC_OFFSET (GpioInt.IntFlags), 3);
+ break;
+
+ case 3: /* Pin Config [BYTE] */
+
+ Descriptor->GpioInt.PinConfig = (UINT8) InitializerOp->Asl.Value.Integer;
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_PINCONFIG,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (GpioInt.PinConfig));
break;
case 4: /* DebounceTimeout [WORD] */
Descriptor->GpioInt.DebounceTimeout = (UINT16) InitializerOp->Asl.Value.Integer;
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_DEBOUNCETIME,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (GpioInt.DebounceTimeout));
break;
- case 5: /* GenericFlags? [BYTE] */
+ case 5: /* ResSource [Optional Field - STRING] */
+
+ if (ResSourceLength)
+ {
+ /* Put string at the end of the descriptor */
+
+ strcpy (ResourceSource,
+ InitializerOp->Asl.Value.String);
- Descriptor->GpioInt.GenericFlags = (UINT8) InitializerOp->Asl.Value.Integer;
+ Descriptor->GpioInt.ResSourceOffset = (UINT16)
+ ACPI_PTR_DIFF (ResourceSource, Descriptor);
+ }
break;
- case 6: /* ResSource [Optional Field - STRING] */
+ case 6: /* Resource Index */
- if ((InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG) &&
- (InitializerOp->Asl.Value.String))
+ if (InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG)
{
- if (StringLength)
- {
- ResSourceString = (UINT8 *) InitializerOp->Asl.Value.String;
- }
+ Descriptor->GpioInt.ResSourceIndex = (UINT8) InitializerOp->Asl.Value.Integer;
}
break;
- case 7: /* ResourceTag */
+ case 7: /* Resource Usage (consumer/producer) */
+
+ RsSetFlagBits ((UINT8 *) &Descriptor->GpioInt.Flags, InitializerOp, 0, 1);
+ break;
+
+ case 8: /* ResourceTag (Descriptor Name) */
UtAttachNamepathToOwner (Op, InitializerOp);
break;
- case 8:
- /*
- * Interrupt Numbers come through here, repeatedly
- */
+ case 9: /* Vendor Data (Optional - Buffer of BYTEs) */
+
+ if (InitializerOp->Asl.ParseOpcode == PARSEOP_DEFAULT_ARG)
+ {
+ break;
+ }
+
+ BufferOp = InitializerOp->Asl.Child;
+ if (!BufferOp)
+ {
+ AslError (ASL_ERROR, ASL_MSG_SYNTAX, InitializerOp, "");
+ return (Rnode);
+ }
+ BufferOp = RsCompleteNodeAndGetNext (BufferOp); /* First child is the COUNT */
+
+ /* At this point, we know the offset and length for the vendor data */
- /* Each interrupt number must be a 16-bit value */
+ Descriptor->GpioInt.VendorOffset = sizeof (AML_RESOURCE_GPIO_INT);
+ Descriptor->GpioInt.VendorLength = VendorLength;
- Descriptor->GpioInt.Interrupts[0] = (UINT16)InitializerOp->Asl.Value.Integer;
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_VENDORDATA,
+ CurrentByteOffset + Descriptor->GpioInt.VendorOffset);
+
+ /* Walk the list of buffer initializers (each is one byte) */
+
+ while (BufferOp)
+ {
+ *VendorData = (UINT8) BufferOp->Asl.Value.Integer;
+ VendorData++;
+ BufferOp = RsCompleteNodeAndGetNext (BufferOp);
+ }
break;
default:
+ /*
+ * PINs come through here, repeatedly. Each PIN must be a DWORD.
+ * NOTE: there is no "length" field for this, so from ACPI spec:
+ * The number of pins in the table can be calculated from:
+ * PinCount = (Resource Source Name Offset - Pin Table Offset) / 2
+ * (implies resource source must immediately follow the pin list.)
+ */
+ Descriptor->GpioInt.PinTableOffset =
+ Descriptor->GpioInt.VendorOffset + VendorLength;
+
+ *InterruptList = (UINT16) InitializerOp->Asl.Value.Integer;
+ InterruptList++;
+ /* Case 10: First interrupt number in list */
+
+ if (i == 10)
+ {
+ if (InitializerOp->Asl.ParseOpcode == PARSEOP_DEFAULT_ARG)
+ {
+ /* Must be at least one interrupt */
+
+ AslError (ASL_ERROR, ASL_MSG_EX_INTERRUPT_LIST_MIN,
+ InitializerOp, NULL);
+ }
+
+ /* Check now for duplicates in list */
+
+ RsCheckListForDuplicates (InitializerOp);
+
+ /* Create a named field at the start of the list */
+
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_INTERRUPT,
+ CurrentByteOffset + Descriptor->GpioInt.PinTableOffset);
+ }
break;
}
InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
}
- /* Add optional ResSource string if present */
-
- if (StringLength && ResSourceString)
- {
- strcpy ((char *) Descriptor + sizeof (AML_RESOURCE_GPIO_INT), (char *) ResSourceString);
- }
-
return (Rnode);
}
@@ -686,27 +849,52 @@ RsDoGpioIoDescriptor (
{
AML_RESOURCE *Descriptor;
ACPI_PARSE_OBJECT *InitializerOp;
+ ACPI_PARSE_OBJECT *BufferOp;
ASL_RESOURCE_NODE *Rnode;
- UINT16 StringLength = 0;
+ char *ResourceSource = NULL;
+ UINT8 *VendorData = NULL;
+ UINT16 *InterruptList = NULL;
+ UINT16 ResSourceLength;
+ UINT16 VendorLength;
+ UINT16 InterruptLength;
+ UINT16 DescriptorSize;
UINT32 i;
- UINT8 *ResSourceString = NULL;
InitializerOp = Op->Asl.Child;
- StringLength = RsGetStringDataLength (InitializerOp);
- Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_GPIO_IO) +
- StringLength);
+ /*
+ * Calculate lengths for fields that have variable length:
+ * 1) Resource Source string
+ * 2) Vendor Data buffer
+ * 3) PIN (interrupt) list
+ */
+ ResSourceLength = RsGetStringDataLength (InitializerOp);
+ VendorLength = RsGetBufferDataLength (InitializerOp);
+ InterruptLength = RsGetInterruptDataLength (InitializerOp);
+
+ DescriptorSize = sizeof (AML_RESOURCE_GPIO_IO) +
+ ResSourceLength + VendorLength + InterruptLength;
+
+ /* Allocate the local resource node and initialize */
+
+ Rnode = RsAllocateResourceNode (DescriptorSize);
Descriptor = Rnode->Buffer;
- Descriptor->GpioInt.DescriptorType = ACPI_RESOURCE_NAME_GPIO_IO;
+ Descriptor->GpioIo.ResourceLength = DescriptorSize;
+ Descriptor->GpioIo.DescriptorType = ACPI_RESOURCE_NAME_GPIO_IO;
+ Descriptor->GpioIo.RevisionId = AML_RESOURCE_GPIO_REVISION;
+ Descriptor->GpioIo.ConnectionType = AML_RESOURCE_GPIO_TYPE_IO;
- /*
- * Initial descriptor length -- may be enlarged if there are
- * optional fields present
- */
- Descriptor->GpioInt.ResourceLength = sizeof (AML_RESOURCE_GPIO_IO) - 3 + StringLength;
- Descriptor->GpioInt.InterruptCount = 1;
+ /* Build pointers to optional areas */
+
+ VendorData = ACPI_ADD_PTR (UINT8, Descriptor, sizeof (AML_RESOURCE_GPIO_IO));
+ InterruptList = ACPI_ADD_PTR (UINT16, VendorData, VendorLength);
+ ResourceSource = ACPI_ADD_PTR (char, InterruptList, InterruptLength);
+
+ printf ("GPIO_IO: Base: %u, ResLen: %u, VendLen: %u, IntLen: %u, ACTUAL: %X\n",
+ sizeof (AML_RESOURCE_GPIO_IO), ResSourceLength, VendorLength, InterruptLength,
+ Descriptor->GpioIo.ResourceLength);
/* Process all child initialization nodes */
@@ -714,84 +902,147 @@ RsDoGpioIoDescriptor (
{
switch (i)
{
- case 0: /* Resource Usage (Default: consumer (1) */
+ case 0: /* Share Type - Default: exclusive (0) */
- RsSetFlagBits ((UINT8 *)&Descriptor->GpioInt.Flags, InitializerOp, 0, 1);
+ RsSetFlagBits ((UINT8 *)&Descriptor->GpioIo.IntFlags, InitializerOp, 3, 0);
+ RsCreateBitField (InitializerOp, ACPI_RESTAG_INTERRUPTSHARE,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (GpioInt.IntFlags), 3);
break;
- case 1: /* Interrupt Type (or Mode - edge/level) */
+ case 1: /* Pin Config [BYTE] */
- RsSetFlagBits ((UINT8 *)&Descriptor->GpioInt.Flags, InitializerOp, 1, 0);
- RsCreateBitField (InitializerOp, ACPI_RESTAG_INTERRUPTTYPE,
- CurrentByteOffset + ASL_RESDESC_OFFSET (GpioInt.Flags), 1);
+ Descriptor->GpioIo.PinConfig = (UINT8) InitializerOp->Asl.Value.Integer;
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_PINCONFIG,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (GpioInt.PinConfig));
break;
- case 2: /* Interrupt Level (or Polarity - Active high/low) */
+ case 2: /* DebounceTimeout [WORD] */
- RsSetFlagBits ((UINT8 *)&Descriptor->GpioInt.Flags, InitializerOp, 2, 0);
- RsCreateBitField (InitializerOp, ACPI_RESTAG_INTERRUPTLEVEL,
- CurrentByteOffset + ASL_RESDESC_OFFSET (GpioInt.Flags), 2);
+ Descriptor->GpioIo.DebounceTimeout = (UINT16) InitializerOp->Asl.Value.Integer;
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_DEBOUNCETIME,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (GpioInt.DebounceTimeout));
break;
- case 3: /* Share Type - Default: exclusive (0) */
+ case 3: /* Drive Strength [WORD] */
- RsSetFlagBits ((UINT8 *)&Descriptor->GpioInt.Flags, InitializerOp, 3, 0);
- RsCreateBitField (InitializerOp, ACPI_RESTAG_INTERRUPTSHARE,
- CurrentByteOffset + ASL_RESDESC_OFFSET (GpioInt.Flags), 3);
+ Descriptor->GpioIo.DriveStrength = (UINT16) InitializerOp->Asl.Value.Integer;
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_DEBOUNCETIME,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (GpioInt.DriveStrength));
break;
- case 4: /* DebounceTimeout [WORD] */
+ case 4: /* I/O Restriction */
- Descriptor->GpioInt.DebounceTimeout = (UINT16) InitializerOp->Asl.Value.Integer;
+ RsSetFlagBits ((UINT8 *)&Descriptor->GpioIo.IntFlags, InitializerOp, 0, 0);
+ RsCreateBitField (InitializerOp, ACPI_RESTAG_INTERRUPTSHARE,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (GpioInt.IntFlags), 0);
break;
- case 5: /* GenericFlags? [BYTE] */
+ case 5: /* ResSource [Optional Field - STRING] */
+
+ if (ResSourceLength)
+ {
+ /* Put string at the end of the descriptor */
+
+ strcpy (ResourceSource,
+ InitializerOp->Asl.Value.String);
- Descriptor->GpioInt.GenericFlags = (UINT8) InitializerOp->Asl.Value.Integer;
+ Descriptor->GpioIo.ResSourceOffset = (UINT16)
+ ACPI_PTR_DIFF (ResourceSource, Descriptor);
+ }
break;
- case 6: /* ResSource [Optional Field - STRING] */
+ case 6: /* Resource Index */
- if ((InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG) &&
- (InitializerOp->Asl.Value.String))
+ if (InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG)
{
- if (StringLength)
- {
- ResSourceString = (UINT8 *) InitializerOp->Asl.Value.String;
- }
+ Descriptor->GpioIo.ResSourceIndex = (UINT8) InitializerOp->Asl.Value.Integer;
}
break;
- case 7: /* ResourceTag */
+ case 7: /* Resource Usage (consumer/producer) */
+
+ RsSetFlagBits ((UINT8 *) &Descriptor->GpioIo.Flags, InitializerOp, 0, 1);
+ break;
+
+ case 8: /* ResourceTag (Descriptor Name) */
UtAttachNamepathToOwner (Op, InitializerOp);
break;
- case 8:
- /*
- * Interrupt Numbers come through here, repeatedly
- */
+ case 9: /* Vendor Data (Optional - Buffer of BYTEs) */
+
+ if (InitializerOp->Asl.ParseOpcode == PARSEOP_DEFAULT_ARG)
+ {
+ break;
+ }
- /* Each interrupt number must be a 16-bit value */
+ BufferOp = InitializerOp->Asl.Child;
+ if (!BufferOp)
+ {
+ AslError (ASL_ERROR, ASL_MSG_SYNTAX, InitializerOp, "");
+ return (Rnode);
+ }
+ BufferOp = RsCompleteNodeAndGetNext (BufferOp); /* First child is the COUNT */
+
+ /* At this point, we know the offset and length for the vendor data */
+
+ Descriptor->GpioIo.VendorOffset = sizeof (AML_RESOURCE_GPIO_IO);
+ Descriptor->GpioIo.VendorLength = VendorLength;
+
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_VENDORDATA,
+ CurrentByteOffset + Descriptor->GpioIo.VendorOffset);
- Descriptor->GpioInt.Interrupts[0] = (UINT16)InitializerOp->Asl.Value.Integer;
+ /* Walk the list of buffer initializers (each is one byte) */
+
+ while (BufferOp)
+ {
+ *VendorData = (UINT8) BufferOp->Asl.Value.Integer;
+ VendorData++;
+ BufferOp = RsCompleteNodeAndGetNext (BufferOp);
+ }
break;
default:
+ /*
+ * PINs come through here, repeatedly. Each PIN must be a DWORD.
+ * NOTE: there is no "length" field for this, so from ACPI spec:
+ * The number of pins in the table can be calculated from:
+ * PinCount = (Resource Source Name Offset - Pin Table Offset) / 2
+ * (implies resource source must immediately follow the pin list.)
+ */
+ Descriptor->GpioIo.PinTableOffset =
+ Descriptor->GpioIo.VendorOffset + VendorLength;
+
+ *InterruptList = (UINT16) InitializerOp->Asl.Value.Integer;
+ InterruptList++;
+
+ /* Case 10: First interrupt number in list */
+
+ if (i == 10)
+ {
+ if (InitializerOp->Asl.ParseOpcode == PARSEOP_DEFAULT_ARG)
+ {
+ /* Must be at least one interrupt */
+
+ AslError (ASL_ERROR, ASL_MSG_EX_INTERRUPT_LIST_MIN,
+ InitializerOp, NULL);
+ }
+
+ /* Check now for duplicates in list */
+ RsCheckListForDuplicates (InitializerOp);
+
+ /* Create a named field at the start of the list */
+
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_INTERRUPT,
+ CurrentByteOffset + Descriptor->GpioIo.PinTableOffset);
+ }
break;
}
InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
}
- /* Add optional ResSource string if present */
-
- if (StringLength && ResSourceString)
- {
- strcpy ((char *) Descriptor + sizeof (AML_RESOURCE_GPIO_IO), (char *) ResSourceString);
- }
-
return (Rnode);
}
@@ -817,30 +1068,49 @@ RsDoI2cSerialBusDescriptor (
{
AML_RESOURCE *Descriptor;
ACPI_PARSE_OBJECT *InitializerOp;
+ ACPI_PARSE_OBJECT *BufferOp;
ASL_RESOURCE_NODE *Rnode;
- UINT16 StringLength = 0;
+ char *ResourceSource = NULL;
+ UINT8 *VendorData = NULL;
+ UINT16 ResSourceLength;
+ UINT16 VendorLength;
+ UINT16 DescriptorSize;
UINT32 i;
- UINT8 *ResSourceString = NULL;
InitializerOp = Op->Asl.Child;
- StringLength = RsGetStringDataLength (InitializerOp);
- Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_I2C_SERIALBUS) +
- StringLength);
+ /*
+ * Calculate lengths for fields that have variable length:
+ * 1) Resource Source string
+ * 2) Vendor Data buffer
+ */
+ ResSourceLength = RsGetStringDataLength (InitializerOp);
+ VendorLength = RsGetBufferDataLength (InitializerOp);
+
+ DescriptorSize = sizeof (AML_RESOURCE_I2C_SERIALBUS) +
+ ResSourceLength + VendorLength;
+
+ /* Allocate the local resource node and initialize */
+
+ Rnode = RsAllocateResourceNode (DescriptorSize);
Descriptor = Rnode->Buffer;
- Descriptor->I2cSerialBus.DescriptorType = ACPI_RESOURCE_NAME_SERIAL_BUS;
+ Descriptor->I2cSerialBus.ResourceLength = DescriptorSize;
+ Descriptor->I2cSerialBus.DescriptorType = ACPI_RESOURCE_NAME_SERIAL_BUS;
+ Descriptor->I2cSerialBus.RevisionId = AML_RESOURCE_I2C_REVISION;
+ Descriptor->I2cSerialBus.TypeRevisionId = AML_RESOURCE_I2C_TYPE_REVISION;
+ Descriptor->I2cSerialBus.Type = AML_RESOURCE_I2C_BUS_TYPE;
+ Descriptor->I2cSerialBus.TypeDataLength = AML_RESOURCE_I2C_MIN_DATA_LEN;
- /*
- * Initial descriptor length -- may be enlarged if there are
- * optional fields present
- */
- Descriptor->I2cSerialBus.ResourceLength = sizeof (AML_RESOURCE_I2C_SERIALBUS) - 3 + StringLength;
- Descriptor->I2cSerialBus.RevisionId = 1;
- Descriptor->I2cSerialBus.Type = 1;
- Descriptor->I2cSerialBus.TypeSpecificRevisionId = 1;
- Descriptor->I2cSerialBus.TypeDataLength = 6;
+ /* Build pointers to optional areas */
+
+ VendorData = ACPI_ADD_PTR (UINT8, Descriptor, sizeof (AML_RESOURCE_I2C_SERIALBUS));
+ ResourceSource = ACPI_ADD_PTR (char, VendorData, VendorLength);
+
+ printf ("I2C: Base: %u, ResLen: %u, VendLen: %u, ACTUAL: %X\n",
+ sizeof (AML_RESOURCE_I2C_SERIALBUS), ResSourceLength, VendorLength,
+ Descriptor->I2cSerialBus.ResourceLength);
/* Process all child initialization nodes */
@@ -848,58 +1118,105 @@ RsDoI2cSerialBusDescriptor (
{
switch (i)
{
- case 0: /* AddressMode Usage (Default: AddressMode7Bit (0) */
+ case 0: /* Slave Address [WORD] */
- RsSetFlagBits ((UINT8 *)&Descriptor->I2cSerialBus.TypeSpecificFlags, InitializerOp, 0, 0);
+ Descriptor->I2cSerialBus.SlaveAddress = (UINT16) InitializerOp->Asl.Value.Integer;
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_DEBOUNCETIME,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (I2cSerialBus.SlaveAddress));
break;
- case 1: /* ConnectionSpeed [DWORD] */
+ case 1: /* Slave Mode [Flag] */
- Descriptor->I2cSerialBus.ConnectionSpeed = (UINT32) InitializerOp->Asl.Value.Integer;
+ RsSetFlagBits ((UINT8 *)&Descriptor->I2cSerialBus.Flags, InitializerOp, 0, 0);
+ RsCreateBitField (InitializerOp, ACPI_RESTAG_INTERRUPTSHARE,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (I2cSerialBus.Flags), 0);
break;
- case 2: /* SlaveAddress [WORD] */
+ case 2: /* ConnectionSpeed [DWORD] */
- Descriptor->I2cSerialBus.SlaveAddress = (UINT16) InitializerOp->Asl.Value.Integer;
+ Descriptor->I2cSerialBus.ConnectionSpeed = (UINT32) InitializerOp->Asl.Value.Integer;
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_DEBOUNCETIME,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (I2cSerialBus.ConnectionSpeed));
break;
- case 3: /* SlaveMode (Default: ControllerInit) */
+ case 3: /* Addresssing Mode [Flag] */
- RsSetFlagBits ((UINT8 *)&Descriptor->I2cSerialBus.GeneralFlags, InitializerOp, 0, 0);
+ RsSetFlagBits ((UINT8 *)&Descriptor->I2cSerialBus.TypeSpecificFlags, InitializerOp, 0, 0);
+ RsCreateBitField (InitializerOp, ACPI_RESTAG_INTERRUPTSHARE,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (I2cSerialBus.TypeSpecificFlags), 0);
break;
case 4: /* ResSource [Optional Field - STRING] */
- if ((InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG) &&
- (InitializerOp->Asl.Value.String))
+ if (ResSourceLength)
{
- if (StringLength)
- {
- ResSourceString = (UINT8 *) InitializerOp->Asl.Value.String;
- }
+ /* Put string at the end of the descriptor */
+
+ strcpy (ResourceSource,
+ InitializerOp->Asl.Value.String);
+
+ Descriptor->GpioIo.ResSourceOffset = (UINT16)
+ ACPI_PTR_DIFF (ResourceSource, Descriptor);
+ }
+ break;
+
+ case 5: /* Resource Index */
+
+ if (InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG)
+ {
+ Descriptor->I2cSerialBus.ResSourceIndex = (UINT8) InitializerOp->Asl.Value.Integer;
}
break;
- case 5: /* ResourceTag */
+ case 6: /* Resource Usage (consumer/producer) */
+
+ RsSetFlagBits ((UINT8 *) &Descriptor->I2cSerialBus.Flags, InitializerOp, 0, 1);
+ break;
+
+ case 7: /* ResourceTag (Descriptor Name) */
UtAttachNamepathToOwner (Op, InitializerOp);
break;
- default:
+ case 8: /* Vendor Data (Optional - Buffer of BYTEs) */
+
+ if (InitializerOp->Asl.ParseOpcode == PARSEOP_DEFAULT_ARG)
+ {
+ break;
+ }
+
+ BufferOp = InitializerOp->Asl.Child;
+ if (!BufferOp)
+ {
+ AslError (ASL_ERROR, ASL_MSG_SYNTAX, InitializerOp, "");
+ return (Rnode);
+ }
+ BufferOp = RsCompleteNodeAndGetNext (BufferOp); /* First child is the COUNT */
+
+ /* At this point, we know the offset and length for the vendor data */
+
+ Descriptor->I2cSerialBus.TypeDataLength += VendorLength;
+
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_VENDORDATA,
+ CurrentByteOffset + sizeof (AML_RESOURCE_I2C_SERIALBUS));
+ /* Walk the list of buffer initializers (each is one byte) */
+
+ while (BufferOp)
+ {
+ *VendorData = (UINT8) BufferOp->Asl.Value.Integer;
+ VendorData++;
+ BufferOp = RsCompleteNodeAndGetNext (BufferOp);
+ }
+ break;
+
+ default: /* Ignore any extra nodes */
break;
}
InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
}
- /* Add optional ResSource string if present */
-
- if (StringLength && ResSourceString)
- {
- strcpy ((char *) Descriptor + sizeof (AML_RESOURCE_I2C_SERIALBUS), (char *) ResSourceString);
- }
-
return (Rnode);
}
@@ -925,30 +1242,49 @@ RsDoSpiSerialBusDescriptor (
{
AML_RESOURCE *Descriptor;
ACPI_PARSE_OBJECT *InitializerOp;
+ ACPI_PARSE_OBJECT *BufferOp;
ASL_RESOURCE_NODE *Rnode;
- UINT16 StringLength = 0;
+ char *ResourceSource = NULL;
+ UINT8 *VendorData = NULL;
+ UINT16 ResSourceLength;
+ UINT16 VendorLength;
+ UINT16 DescriptorSize;
UINT32 i;
- UINT8 *ResSourceString = NULL;
InitializerOp = Op->Asl.Child;
- StringLength = RsGetStringDataLength (InitializerOp);
- Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_SPI_SERIALBUS) +
- StringLength);
+ /*
+ * Calculate lengths for fields that have variable length:
+ * 1) Resource Source string
+ * 2) Vendor Data buffer
+ */
+ ResSourceLength = RsGetStringDataLength (InitializerOp);
+ VendorLength = RsGetBufferDataLength (InitializerOp);
+
+ DescriptorSize = sizeof (AML_RESOURCE_SPI_SERIALBUS) +
+ ResSourceLength + VendorLength;
+
+ /* Allocate the local resource node and initialize */
+
+ Rnode = RsAllocateResourceNode (DescriptorSize);
Descriptor = Rnode->Buffer;
- Descriptor->SpiSerialBus.DescriptorType = ACPI_RESOURCE_NAME_SERIAL_BUS;
+ Descriptor->SpiSerialBus.ResourceLength = DescriptorSize;
+ Descriptor->SpiSerialBus.DescriptorType = ACPI_RESOURCE_NAME_SERIAL_BUS;
+ Descriptor->SpiSerialBus.RevisionId = AML_RESOURCE_SPI_REVISION;
+ Descriptor->SpiSerialBus.TypeRevisionId = AML_RESOURCE_SPI_TYPE_REVISION;
+ Descriptor->SpiSerialBus.Type = AML_RESOURCE_SPI_BUS_TYPE;
+ Descriptor->SpiSerialBus.TypeDataLength = AML_RESOURCE_SPI_MIN_DATA_LEN;
- /*
- * Initial descriptor length -- may be enlarged if there are
- * optional fields present
- */
- Descriptor->SpiSerialBus.ResourceLength = sizeof (AML_RESOURCE_SPI_SERIALBUS) - 3 + StringLength;
- Descriptor->SpiSerialBus.RevisionId = 1;
- Descriptor->SpiSerialBus.Type = 2;
- Descriptor->SpiSerialBus.TypeSpecificRevisionId = 1;
- Descriptor->SpiSerialBus.TypeDataLength = 9;
+ /* Build pointers to optional areas */
+
+ VendorData = ACPI_ADD_PTR (UINT8, Descriptor, sizeof (AML_RESOURCE_SPI_SERIALBUS));
+ ResourceSource = ACPI_ADD_PTR (char, VendorData, VendorLength);
+
+ printf ("SPI: Base: %u, ResLen: %u, VendLen: %u, ACTUAL: %X\n",
+ sizeof (AML_RESOURCE_SPI_SERIALBUS), ResSourceLength, VendorLength,
+ Descriptor->SpiSerialBus.ResourceLength);
/* Process all child initialization nodes */
@@ -956,78 +1292,133 @@ RsDoSpiSerialBusDescriptor (
{
switch (i)
{
- case 0: /* WireMode Usage (Default: FourWireMode (0) */
+ case 0: /* Device Selection [WORD] */
- RsSetFlagBits ((UINT8 *)&Descriptor->SpiSerialBus.TypeSpecificFlags, InitializerOp, 0, 0);
+ Descriptor->SpiSerialBus.DeviceSelection = (UINT16) InitializerOp->Asl.Value.Integer;
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_DEBOUNCETIME,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (SpiSerialBus.DeviceSelection));
break;
- case 1: /* ConnectionSpeed [DWORD] */
+ case 1: /* Device Polarity [Flag] */
- Descriptor->SpiSerialBus.ConnectionSpeed = (UINT32) InitializerOp->Asl.Value.Integer;
+ RsSetFlagBits ((UINT8 *)&Descriptor->SpiSerialBus.TypeSpecificFlags, InitializerOp, 1, 0);
+ RsCreateBitField (InitializerOp, ACPI_RESTAG_INTERRUPTSHARE,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (SpiSerialBus.TypeSpecificFlags), 1);
break;
- case 2: /* DataBitLength [BYTE] */
+ case 2: /* Wire Mode [Flag] */
- Descriptor->SpiSerialBus.DataBitLength = (UINT8) InitializerOp->Asl.Value.Integer;
+ RsSetFlagBits ((UINT8 *)&Descriptor->SpiSerialBus.TypeSpecificFlags, InitializerOp, 0, 0);
+ RsCreateBitField (InitializerOp, ACPI_RESTAG_INTERRUPTSHARE,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (SpiSerialBus.TypeSpecificFlags), 0);
break;
- case 3: /* ClockPhase */
+ case 3: /* Device Bit Length [BYTE] */
- RsSetFlagBits ((UINT8 *)&Descriptor->SpiSerialBus.Phase, InitializerOp, 0, 0);
+ Descriptor->SpiSerialBus.DataBitLength = (UINT8) InitializerOp->Asl.Value.Integer;
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_DEBOUNCETIME,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (SpiSerialBus.DataBitLength));
break;
- case 4: /* ClockPolarity */
+ case 4: /* Slave Mode [Flag] */
- RsSetFlagBits ((UINT8 *)&Descriptor->SpiSerialBus.Polarity, InitializerOp, 0, 0);
+ RsSetFlagBits ((UINT8 *)&Descriptor->SpiSerialBus.Flags, InitializerOp, 0, 0);
+ RsCreateBitField (InitializerOp, ACPI_RESTAG_INTERRUPTSHARE,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (SpiSerialBus.Flags), 0);
break;
- case 5: /* DeviceSelection [WORD] */
+ case 5: /* ConnectionSpeed [DWORD] */
- Descriptor->SpiSerialBus.DeviceSelection = (UINT16) InitializerOp->Asl.Value.Integer;
+ Descriptor->SpiSerialBus.ConnectionSpeed = (UINT32) InitializerOp->Asl.Value.Integer;
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_DEBOUNCETIME,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (SpiSerialBus.ConnectionSpeed));
break;
- case 6: /* DevicePolarity (Default: PolarityLow) */
+ case 6: /* Clock Polarity [BYTE] */
- RsSetFlagBits ((UINT8 *)&Descriptor->SpiSerialBus.TypeSpecificFlags, InitializerOp, 1, 0);
+ Descriptor->SpiSerialBus.ClockPolarity = (UINT8) InitializerOp->Asl.Value.Integer;
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_DEBOUNCETIME,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (SpiSerialBus.ClockPolarity));
break;
- case 7: /* SlaveMode (Default: ControllerInit) */
+ case 7: /* Clock Phase [BYTE] */
- RsSetFlagBits ((UINT8 *)&Descriptor->SpiSerialBus.GeneralFlags, InitializerOp, 0, 0);
+ Descriptor->SpiSerialBus.ClockPhase = (UINT8) InitializerOp->Asl.Value.Integer;
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_DEBOUNCETIME,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (SpiSerialBus.ClockPhase));
break;
case 8: /* ResSource [Optional Field - STRING] */
- if ((InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG) &&
- (InitializerOp->Asl.Value.String))
+ if (ResSourceLength)
{
- if (StringLength)
- {
- ResSourceString = (UINT8 *) InitializerOp->Asl.Value.String;
- }
+ /* Put string at the end of the descriptor */
+
+ strcpy (ResourceSource,
+ InitializerOp->Asl.Value.String);
+
+ Descriptor->GpioIo.ResSourceOffset = (UINT16)
+ ACPI_PTR_DIFF (ResourceSource, Descriptor);
}
break;
- case 9: /* ResourceTag */
+ case 9: /* Resource Index */
+
+ if (InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG)
+ {
+ Descriptor->SpiSerialBus.ResSourceIndex = (UINT8) InitializerOp->Asl.Value.Integer;
+ }
+ break;
+
+ case 10: /* Resource Usage (consumer/producer) */
+
+ RsSetFlagBits ((UINT8 *) &Descriptor->SpiSerialBus.Flags, InitializerOp, 0, 1);
+ break;
+
+ case 11: /* ResourceTag (Descriptor Name) */
UtAttachNamepathToOwner (Op, InitializerOp);
break;
- default:
+ case 12: /* Vendor Data (Optional - Buffer of BYTEs) */
+
+ if (InitializerOp->Asl.ParseOpcode == PARSEOP_DEFAULT_ARG)
+ {
+ break;
+ }
+ BufferOp = InitializerOp->Asl.Child;
+ if (!BufferOp)
+ {
+ AslError (ASL_ERROR, ASL_MSG_SYNTAX, InitializerOp, "");
+ return (Rnode);
+ }
+ BufferOp = RsCompleteNodeAndGetNext (BufferOp); /* First child is the COUNT */
+
+ /* At this point, we know the offset and length for the vendor data */
+
+ Descriptor->SpiSerialBus.TypeDataLength += VendorLength;
+
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_VENDORDATA,
+ CurrentByteOffset + sizeof (AML_RESOURCE_SPI_SERIALBUS));
+
+ /* Walk the list of buffer initializers (each is one byte) */
+
+ while (BufferOp)
+ {
+ *VendorData = (UINT8) BufferOp->Asl.Value.Integer;
+ VendorData++;
+ BufferOp = RsCompleteNodeAndGetNext (BufferOp);
+ }
+ break;
+
+ default: /* Ignore any extra nodes */
break;
}
InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
}
- /* Add optional ResSource string if present */
-
- if (StringLength && ResSourceString)
- {
- strcpy ((char *) Descriptor + sizeof (AML_RESOURCE_SPI_SERIALBUS), (char *) ResSourceString);
- }
-
return (Rnode);
}
@@ -1053,30 +1444,49 @@ RsDoUartSerialBusDescriptor (
{
AML_RESOURCE *Descriptor;
ACPI_PARSE_OBJECT *InitializerOp;
+ ACPI_PARSE_OBJECT *BufferOp;
ASL_RESOURCE_NODE *Rnode;
- UINT16 StringLength = 0;
+ char *ResourceSource = NULL;
+ UINT8 *VendorData = NULL;
+ UINT16 ResSourceLength;
+ UINT16 VendorLength;
+ UINT16 DescriptorSize;
UINT32 i;
- UINT8 *ResSourceString = NULL;
InitializerOp = Op->Asl.Child;
- StringLength = RsGetStringDataLength (InitializerOp);
- Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_UART_SERIALBUS) +
- StringLength);
+ /*
+ * Calculate lengths for fields that have variable length:
+ * 1) Resource Source string
+ * 2) Vendor Data buffer
+ */
+ ResSourceLength = RsGetStringDataLength (InitializerOp);
+ VendorLength = RsGetBufferDataLength (InitializerOp);
+
+ DescriptorSize = sizeof (AML_RESOURCE_UART_SERIALBUS) +
+ ResSourceLength + VendorLength;
+
+ /* Allocate the local resource node and initialize */
+
+ Rnode = RsAllocateResourceNode (DescriptorSize);
Descriptor = Rnode->Buffer;
- Descriptor->UartSerialBus.DescriptorType = ACPI_RESOURCE_NAME_SERIAL_BUS;
+ Descriptor->UartSerialBus.ResourceLength = DescriptorSize;
+ Descriptor->UartSerialBus.DescriptorType = ACPI_RESOURCE_NAME_SERIAL_BUS;
+ Descriptor->UartSerialBus.RevisionId = AML_RESOURCE_UART_REVISION;
+ Descriptor->UartSerialBus.TypeRevisionId = AML_RESOURCE_UART_TYPE_REVISION;
+ Descriptor->UartSerialBus.Type = AML_RESOURCE_UART_BUS_TYPE;
+ Descriptor->UartSerialBus.TypeDataLength = AML_RESOURCE_UART_MIN_DATA_LEN;
- /*
- * Initial descriptor length -- may be enlarged if there are
- * optional fields present
- */
- Descriptor->UartSerialBus.ResourceLength = sizeof (AML_RESOURCE_UART_SERIALBUS) - 3 + StringLength;
- Descriptor->UartSerialBus.RevisionId = 1;
- Descriptor->UartSerialBus.Type = 3;
- Descriptor->UartSerialBus.TypeSpecificRevisionId = 1;
- Descriptor->UartSerialBus.TypeDataLength = 9;
+ /* Build pointers to optional areas */
+
+ VendorData = ACPI_ADD_PTR (UINT8, Descriptor, sizeof (AML_RESOURCE_UART_SERIALBUS));
+ ResourceSource = ACPI_ADD_PTR (char, VendorData, VendorLength);
+
+ printf ("UART: Base: %u, ResLen: %u, VendLen: %u, ACTUAL: %X\n",
+ sizeof (AML_RESOURCE_UART_SERIALBUS), ResSourceLength, VendorLength,
+ Descriptor->UartSerialBus.ResourceLength);
/* Process all child initialization nodes */
@@ -1084,82 +1494,134 @@ RsDoUartSerialBusDescriptor (
{
switch (i)
{
- case 0: /* LineInUse [BYTE] */
+ case 0: /* Baud Rate [DWORD] */
- Descriptor->UartSerialBus.TypeSpecificFlags = (UINT16)(UINT8)InitializerOp->Asl.Value.Integer;
+ Descriptor->UartSerialBus.DefaultBaudRate = (UINT32) InitializerOp->Asl.Value.Integer;
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_DEBOUNCETIME,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (UartSerialBus.DefaultBaudRate));
break;
- case 1: /* Endian (Default: Little (0)) */
+/* TBD: Handle 16-bit flags! */
- RsSetFlagBits ((UINT8 *)&Descriptor->UartSerialBus.TypeSpecificFlags + 1, InitializerOp, 7, 0);
+ case 1: /* Bits Per Byte [Flags] */
+
+ RsSetFlagBits ((UINT8 *)&Descriptor->UartSerialBus.TypeSpecificFlags, InitializerOp, 4+8, 0);
+ RsCreateBitField (InitializerOp, ACPI_RESTAG_INTERRUPTSHARE,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (UartSerialBus.TypeSpecificFlags), 4);
break;
- case 2: /* BitsPerByte (Default: DataBitsEight (3)) */
+ case 2: /* Stop Bits [Flags] */
- RsSetFlagBits ((UINT8 *)&Descriptor->UartSerialBus.TypeSpecificFlags + 1, InitializerOp, 4, 3);
+ RsSetFlagBits ((UINT8 *)&Descriptor->UartSerialBus.TypeSpecificFlags, InitializerOp, 2+8, 0);
+ RsCreateBitField (InitializerOp, ACPI_RESTAG_INTERRUPTSHARE,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (UartSerialBus.TypeSpecificFlags), 2);
break;
- case 3: /* StopBits (Default: StopBitsOne (1)) */
+ case 3: /* Lines In Use [Flags] */
- RsSetFlagBits ((UINT8 *)&Descriptor->UartSerialBus.TypeSpecificFlags + 1, InitializerOp, 2, 1);
+ RsSetFlagBits ((UINT8 *)&Descriptor->UartSerialBus.TypeSpecificFlags, InitializerOp, 0, 0);
+ RsCreateBitField (InitializerOp, ACPI_RESTAG_INTERRUPTSHARE,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (UartSerialBus.TypeSpecificFlags), 0);
break;
- case 4: /* FlowControl (Default: FlowControlNone (0)) */
+ case 4: /* Endianness [Flag] */
- RsSetFlagBits ((UINT8 *)&Descriptor->UartSerialBus.TypeSpecificFlags + 1, InitializerOp, 0, 0);
+ RsSetFlagBits ((UINT8 *)&Descriptor->UartSerialBus.TypeSpecificFlags, InitializerOp, 7+8, 0);
+ RsCreateBitField (InitializerOp, ACPI_RESTAG_INTERRUPTSHARE,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (UartSerialBus.TypeSpecificFlags), 7+8);
break;
- case 5: /* DefaultBaudRate [DWORD] */
+ case 5: /* Parity [BYTE] */
- Descriptor->UartSerialBus.DefaultBaudRate = (UINT32)InitializerOp->Asl.Value.Integer;
+ Descriptor->UartSerialBus.Parity = (UINT8) InitializerOp->Asl.Value.Integer;
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_DEBOUNCETIME,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (UartSerialBus.Parity));
break;
- case 6: /* RxFifo [WORD] */
+ case 6: /* Rx Buffer Size [WORD] */
- Descriptor->UartSerialBus.RxFifo = (UINT16)InitializerOp->Asl.Value.Integer;
+ Descriptor->UartSerialBus.RxFifoSize = (UINT16) InitializerOp->Asl.Value.Integer;
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_DEBOUNCETIME,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (UartSerialBus.RxFifoSize));
break;
- case 7: /* TxFifo [WORD] */
+ case 7: /* Tx Buffer Size [WORD] */
- Descriptor->UartSerialBus.TxFifo = (UINT16)InitializerOp->Asl.Value.Integer;
+ Descriptor->UartSerialBus.TxFifoSize = (UINT16) InitializerOp->Asl.Value.Integer;
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_DEBOUNCETIME,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (UartSerialBus.TxFifoSize));
break;
- case 8: /* Parity (Default: ParityTypeNone (0)) */
+ case 8: /* ResSource [Optional Field - STRING] */
+
+ if (ResSourceLength)
+ {
+ /* Put string at the end of the descriptor */
+
+ strcpy (ResourceSource,
+ InitializerOp->Asl.Value.String);
- RsSetFlagBits ((UINT8 *)&Descriptor->UartSerialBus.Parity, InitializerOp, 0, 0);
+ Descriptor->GpioIo.ResSourceOffset = (UINT16)
+ ACPI_PTR_DIFF (ResourceSource, Descriptor);
+ }
break;
- case 9: /* ResSource [Optional Field - STRING] */
+ case 9: /* Resource Index */
- if ((InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG) &&
- (InitializerOp->Asl.Value.String))
+ if (InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG)
{
- if (StringLength)
- {
- ResSourceString = (UINT8 *) InitializerOp->Asl.Value.String;
- }
+ Descriptor->UartSerialBus.ResSourceIndex = (UINT8) InitializerOp->Asl.Value.Integer;
}
break;
- case 10: /* ResourceTag */
+ case 10: /* Resource Usage (consumer/producer) */
+
+ RsSetFlagBits ((UINT8 *) &Descriptor->UartSerialBus.Flags, InitializerOp, 0, 1);
+ break;
+
+ case 11: /* ResourceTag (Descriptor Name) */
UtAttachNamepathToOwner (Op, InitializerOp);
break;
- default:
+ case 12: /* Vendor Data (Optional - Buffer of BYTEs) */
+
+ if (InitializerOp->Asl.ParseOpcode == PARSEOP_DEFAULT_ARG)
+ {
+ break;
+ }
+
+ BufferOp = InitializerOp->Asl.Child;
+ if (!BufferOp)
+ {
+ AslError (ASL_ERROR, ASL_MSG_SYNTAX, InitializerOp, "");
+ return (Rnode);
+ }
+ BufferOp = RsCompleteNodeAndGetNext (BufferOp); /* First child is the COUNT */
+
+ /* At this point, we know the offset and length for the vendor data */
+
+ Descriptor->UartSerialBus.TypeDataLength += VendorLength;
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_VENDORDATA,
+ CurrentByteOffset + sizeof (AML_RESOURCE_UART_SERIALBUS));
+
+ /* Walk the list of buffer initializers (each is one byte) */
+
+ while (BufferOp)
+ {
+ *VendorData = (UINT8) BufferOp->Asl.Value.Integer;
+ VendorData++;
+ BufferOp = RsCompleteNodeAndGetNext (BufferOp);
+ }
+ break;
+
+ default: /* Ignore any extra nodes */
break;
}
InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
}
- /* Add optional ResSource string if present */
-
- if (StringLength && ResSourceString)
- {
- strcpy ((char *) Descriptor + sizeof (AML_RESOURCE_UART_SERIALBUS), (char *) ResSourceString);
- }
-
return (Rnode);
}