1 %{ 2 /****************************************************************************** 3 * 4 * Module Name: aslcompiler.l - Flex/lex input file 5 * 6 *****************************************************************************/ 7 8 /* 9 * Copyright (C) 2000 - 2013, Intel Corp. 10 * All rights reserved. 11 * 12 * Redistribution and use in source and binary forms, with or without 13 * modification, are permitted provided that the following conditions 14 * are met: 15 * 1. Redistributions of source code must retain the above copyright 16 * notice, this list of conditions, and the following disclaimer, 17 * without modification. 18 * 2. Redistributions in binary form must reproduce at minimum a disclaimer 19 * substantially similar to the "NO WARRANTY" disclaimer below 20 * ("Disclaimer") and any redistribution must be conditioned upon 21 * including a substantially similar Disclaimer requirement for further 22 * binary redistribution. 23 * 3. Neither the names of the above-listed copyright holders nor the names 24 * of any contributors may be used to endorse or promote products derived 25 * from this software without specific prior written permission. 26 * 27 * Alternatively, this software may be distributed under the terms of the 28 * GNU General Public License ("GPL") version 2 as published by the Free 29 * Software Foundation. 30 * 31 * NO WARRANTY 32 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 33 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 34 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR 35 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 36 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 37 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 38 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 39 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 40 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 41 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 42 * POSSIBILITY OF SUCH DAMAGES. 43 */ 44 45 #include "aslcompiler.h" 46 #include "aslcompiler.y.h" 47 48 #include <stdlib.h> 49 #include <string.h> 50 YYSTYPE AslCompilerlval; 51 52 /* 53 * Generation: Use the following command line: 54 * 55 * flex.exe -PAslCompiler -i -o$(InputPath).c $(InputPath) 56 * 57 * -i: Scanner must be case-insensitive 58 */ 59 60 #define _COMPONENT ACPI_COMPILER 61 ACPI_MODULE_NAME ("aslscanner") 62 63 64 /* Local prototypes */ 65 66 static void 67 AslDoLineDirective (void); 68 69 static char 70 AslDoComment (void); 71 72 static char 73 AslDoCommentType2 (void); 74 75 static char 76 AslDoStringLiteral (void); 77 78 static void 79 count (int type); 80 81 82 /*! [Begin] no source code translation */ 83 84 %} 85 /* Definitions */ 86 87 LeadNameChar [A-Za-z_] 88 DigitChar [0-9] 89 HexDigitChar [A-Fa-f0-9] 90 RootChar [\\] 91 Nothing [] 92 93 NameChar [A-Za-z_0-9] 94 NameSeg1 {LeadNameChar}{NameChar} 95 NameSeg2 {LeadNameChar}{NameChar}{NameChar} 96 NameSeg3 {LeadNameChar}{NameChar}{NameChar}{NameChar} 97 NameSeg {LeadNameChar}|{NameSeg1}|{NameSeg2}|{NameSeg3} 98 99 NameString {RootChar}|{RootChar}{NamePath}|[\^]+{NamePath}|{NonEmptyNamePath} 100 NamePath {NonEmptyNamePath}? 101 NonEmptyNamePath {NameSeg}{NamePathTail}* 102 NamePathTail [.]{NameSeg} 103 104 %% 105 /* Rules */ 106 107 [ ] { count (0); } 108 [\n] { count (0); } /* Handle files with both LF and CR/LF */ 109 [\r] { count (0); } /* termination on both Unix and Windows */ 110 [ \t] { count (0); } 111 112 113 "/*" { if (!AslDoComment ()) yyterminate (); } 114 "//" { if (!AslDoCommentType2 ()) yyterminate (); } 115 116 "\"" { if (AslDoStringLiteral ()) return (PARSEOP_STRING_LITERAL); else yyterminate (); } 117 ";" { count (0); return(';'); } 118 119 120 0[xX]{HexDigitChar}+ | 121 {DigitChar}+ { AslCompilerlval.i = UtDoConstant ((char *) AslCompilertext); 122 count (1); return (PARSEOP_INTEGER); } 123 124 "Include" { count (1); return (PARSEOP_INCLUDE); } 125 "External" { count (1); return (PARSEOP_EXTERNAL); } 126 127 /* 128 * The #line directive is emitted by the preprocessor and handled 129 * here in the main iASL lexer - simply set the line number and 130 * optionally the current filename. 131 */ 132 "#line" { AslDoLineDirective ();} 133 134 135 /**************************************************************************** 136 * 137 * Main ASL operators 138 * 139 ****************************************************************************/ 140 141 "AccessAs" { count (1); return (PARSEOP_ACCESSAS); } 142 "Acquire" { count (3); return (PARSEOP_ACQUIRE); } 143 "Add" { count (3); return (PARSEOP_ADD); } 144 "Alias" { count (2); return (PARSEOP_ALIAS); } 145 "And" { count (3); return (PARSEOP_AND); } 146 "BankField" { count (2); return (PARSEOP_BANKFIELD); } 147 "Break" { count (3); return (PARSEOP_BREAK); } 148 "BreakPoint" { count (3); return (PARSEOP_BREAKPOINT); } 149 "Buffer" { count (1); return (PARSEOP_BUFFER); } 150 "Case" { count (3); return (PARSEOP_CASE); } 151 "Concatenate" { count (3); return (PARSEOP_CONCATENATE); } 152 "ConcatenateResTemplate" { count (3); return (PARSEOP_CONCATENATERESTEMPLATE); } 153 "CondRefOf" { count (3); return (PARSEOP_CONDREFOF); } 154 "Connection" { count (2); return (PARSEOP_CONNECTION); } 155 "Continue" { count (3); return (PARSEOP_CONTINUE); } 156 "CopyObject" { count (3); return (PARSEOP_COPYOBJECT); } 157 "CreateBitField" { count (2); return (PARSEOP_CREATEBITFIELD); } 158 "CreateByteField" { count (2); return (PARSEOP_CREATEBYTEFIELD); } 159 "CreateDWordField" { count (2); return (PARSEOP_CREATEDWORDFIELD); } 160 "CreateField" { count (2); return (PARSEOP_CREATEFIELD); } 161 "CreateQWordField" { count (2); return (PARSEOP_CREATEQWORDFIELD); } 162 "CreateWordField" { count (2); return (PARSEOP_CREATEWORDFIELD); } 163 "DataTableRegion" { count (2); return (PARSEOP_DATATABLEREGION); } 164 "Debug" { count (1); return (PARSEOP_DEBUG); } 165 "Decrement" { count (3); return (PARSEOP_DECREMENT); } 166 "Default" { count (3); return (PARSEOP_DEFAULT); } 167 "DefinitionBlock" { count (1); return (PARSEOP_DEFINITIONBLOCK); } 168 "DeRefOf" { count (3); return (PARSEOP_DEREFOF); } 169 "Device" { count (2); return (PARSEOP_DEVICE); } 170 "Divide" { count (3); return (PARSEOP_DIVIDE); } 171 "Eisaid" { count (1); return (PARSEOP_EISAID); } 172 "Else" { count (3); return (PARSEOP_ELSE); } 173 "ElseIf" { count (3); return (PARSEOP_ELSEIF); } 174 "Event" { count (2); return (PARSEOP_EVENT); } 175 "Fatal" { count (3); return (PARSEOP_FATAL); } 176 "Field" { count (2); return (PARSEOP_FIELD); } 177 "FindSetLeftBit" { count (3); return (PARSEOP_FINDSETLEFTBIT); } 178 "FindSetRightBit" { count (3); return (PARSEOP_FINDSETRIGHTBIT); } 179 "FromBcd" { count (3); return (PARSEOP_FROMBCD); } 180 "Function" { count (2); return (PARSEOP_FUNCTION); } 181 "If" { count (3); return (PARSEOP_IF); } 182 "Increment" { count (3); return (PARSEOP_INCREMENT); } 183 "Index" { count (3); return (PARSEOP_INDEX); } 184 "IndexField" { count (2); return (PARSEOP_INDEXFIELD); } 185 "LAnd" { count (3); return (PARSEOP_LAND); } 186 "LEqual" { count (3); return (PARSEOP_LEQUAL); } 187 "LGreater" { count (3); return (PARSEOP_LGREATER); } 188 "LGreaterEqual" { count (3); return (PARSEOP_LGREATEREQUAL); } 189 "LLess" { count (3); return (PARSEOP_LLESS); } 190 "LLessEqual" { count (3); return (PARSEOP_LLESSEQUAL); } 191 "LNot" { count (3); return (PARSEOP_LNOT); } 192 "LNotEqual" { count (3); return (PARSEOP_LNOTEQUAL); } 193 "Load" { count (3); return (PARSEOP_LOAD); } 194 "LoadTable" { count (3); return (PARSEOP_LOADTABLE); } 195 "LOr" { count (3); return (PARSEOP_LOR); } 196 "Match" { count (3); return (PARSEOP_MATCH); } 197 "Method" { count (2); return (PARSEOP_METHOD); } 198 "Mid" { count (3); return (PARSEOP_MID); } 199 "Mod" { count (3); return (PARSEOP_MOD); } 200 "Multiply" { count (3); return (PARSEOP_MULTIPLY); } 201 "Mutex" { count (2); return (PARSEOP_MUTEX); } 202 "Name" { count (2); return (PARSEOP_NAME); } 203 "NAnd" { count (3); return (PARSEOP_NAND); } 204 "Noop" { if (!AcpiGbl_IgnoreNoopOperator) {count (3); return (PARSEOP_NOOP);} } 205 "NOr" { count (3); return (PARSEOP_NOR); } 206 "Not" { count (3); return (PARSEOP_NOT); } 207 "Notify" { count (3); return (PARSEOP_NOTIFY); } 208 "ObjectType" { count (3); return (PARSEOP_OBJECTTYPE); } 209 "Offset" { count (1); return (PARSEOP_OFFSET); } 210 "One" { count (1); return (PARSEOP_ONE); } 211 "Ones" { count (1); return (PARSEOP_ONES); } 212 "OperationRegion" { count (2); return (PARSEOP_OPERATIONREGION); } 213 "Or" { count (3); return (PARSEOP_OR); } 214 "Package" { count (1); return (PARSEOP_PACKAGE); } 215 "PowerResource" { count (2); return (PARSEOP_POWERRESOURCE); } 216 "Processor" { count (2); return (PARSEOP_PROCESSOR); } 217 "RefOf" { count (3); return (PARSEOP_REFOF); } 218 "Release" { count (3); return (PARSEOP_RELEASE); } 219 "Reset" { count (3); return (PARSEOP_RESET); } 220 "Return" { count (3); return (PARSEOP_RETURN); } 221 "Revision" { count (1); return (PARSEOP_REVISION); } 222 "Scope" { count (2); return (PARSEOP_SCOPE); } 223 "ShiftLeft" { count (3); return (PARSEOP_SHIFTLEFT); } 224 "ShiftRight" { count (3); return (PARSEOP_SHIFTRIGHT); } 225 "Signal" { count (3); return (PARSEOP_SIGNAL); } 226 "SizeOf" { count (3); return (PARSEOP_SIZEOF); } 227 "Sleep" { count (3); return (PARSEOP_SLEEP); } 228 "Stall" { count (3); return (PARSEOP_STALL); } 229 "Store" { count (3); return (PARSEOP_STORE); } 230 "Subtract" { count (3); return (PARSEOP_SUBTRACT); } 231 "Switch" { count (3); return (PARSEOP_SWITCH); } 232 "ThermalZone" { count (2); return (PARSEOP_THERMALZONE); } 233 "Timer" { count (3); return (PARSEOP_TIMER); } 234 "ToBcd" { count (3); return (PARSEOP_TOBCD); } 235 "ToBuffer" { count (3); return (PARSEOP_TOBUFFER); } 236 "ToDecimalString" { count (3); return (PARSEOP_TODECIMALSTRING); } 237 "ToHexString" { count (3); return (PARSEOP_TOHEXSTRING); } 238 "ToInteger" { count (3); return (PARSEOP_TOINTEGER); } 239 "ToString" { count (3); return (PARSEOP_TOSTRING); } 240 "ToUuid" { count (1); return (PARSEOP_TOUUID); } 241 "Unicode" { count (1); return (PARSEOP_UNICODE); } 242 "Unload" { count (3); return (PARSEOP_UNLOAD); } 243 "Wait" { count (3); return (PARSEOP_WAIT); } 244 "While" { count (3); return (PARSEOP_WHILE); } 245 "XOr" { count (3); return (PARSEOP_XOR); } 246 "Zero" { count (1); return (PARSEOP_ZERO); } 247 248 /* Control method arguments and locals */ 249 250 "Arg0" { count (1); return (PARSEOP_ARG0); } 251 "Arg1" { count (1); return (PARSEOP_ARG1); } 252 "Arg2" { count (1); return (PARSEOP_ARG2); } 253 "Arg3" { count (1); return (PARSEOP_ARG3); } 254 "Arg4" { count (1); return (PARSEOP_ARG4); } 255 "Arg5" { count (1); return (PARSEOP_ARG5); } 256 "Arg6" { count (1); return (PARSEOP_ARG6); } 257 "Local0" { count (1); return (PARSEOP_LOCAL0); } 258 "Local1" { count (1); return (PARSEOP_LOCAL1); } 259 "Local2" { count (1); return (PARSEOP_LOCAL2); } 260 "Local3" { count (1); return (PARSEOP_LOCAL3); } 261 "Local4" { count (1); return (PARSEOP_LOCAL4); } 262 "Local5" { count (1); return (PARSEOP_LOCAL5); } 263 "Local6" { count (1); return (PARSEOP_LOCAL6); } 264 "Local7" { count (1); return (PARSEOP_LOCAL7); } 265 266 267 /**************************************************************************** 268 * 269 * Resource Descriptor macros 270 * 271 ****************************************************************************/ 272 273 "ResourceTemplate" { count (1); return (PARSEOP_RESOURCETEMPLATE); } 274 "RawDataBuffer" { count (1); return (PARSEOP_DATABUFFER); } 275 276 "DMA" { count (1); return (PARSEOP_DMA); } 277 "DWordIO" { count (1); return (PARSEOP_DWORDIO); } 278 "DWordMemory" { count (1); return (PARSEOP_DWORDMEMORY); } 279 "DWordSpace" { count (1); return (PARSEOP_DWORDSPACE); } 280 "EndDependentFn" { count (1); return (PARSEOP_ENDDEPENDENTFN); } 281 "ExtendedIO" { count (1); return (PARSEOP_EXTENDEDIO); } 282 "ExtendedMemory" { count (1); return (PARSEOP_EXTENDEDMEMORY); } 283 "ExtendedSpace" { count (1); return (PARSEOP_EXTENDEDSPACE); } 284 "FixedDma" { count (1); return (PARSEOP_FIXEDDMA); } 285 "FixedIO" { count (1); return (PARSEOP_FIXEDIO); } 286 "GpioInt" { count (1); return (PARSEOP_GPIO_INT); } 287 "GpioIo" { count (1); return (PARSEOP_GPIO_IO); } 288 "I2cSerialBus" { count (1); return (PARSEOP_I2C_SERIALBUS); } 289 "Interrupt" { count (1); return (PARSEOP_INTERRUPT); } 290 "IO" { count (1); return (PARSEOP_IO); } 291 "IRQ" { count (1); return (PARSEOP_IRQ); } 292 "IRQNoFlags" { count (1); return (PARSEOP_IRQNOFLAGS); } 293 "Memory24" { count (1); return (PARSEOP_MEMORY24); } 294 "Memory32" { count (1); return (PARSEOP_MEMORY32); } 295 "Memory32Fixed" { count (1); return (PARSEOP_MEMORY32FIXED); } 296 "QWordIO" { count (1); return (PARSEOP_QWORDIO); } 297 "QWordMemory" { count (1); return (PARSEOP_QWORDMEMORY); } 298 "QWordSpace" { count (1); return (PARSEOP_QWORDSPACE); } 299 "Register" { count (1); return (PARSEOP_REGISTER); } 300 "SpiSerialBus" { count (1); return (PARSEOP_SPI_SERIALBUS); } 301 "StartDependentFn" { count (1); return (PARSEOP_STARTDEPENDENTFN); } 302 "StartDependentFnNoPri" { count (1); return (PARSEOP_STARTDEPENDENTFN_NOPRI); } 303 "UartSerialBus" { count (1); return (PARSEOP_UART_SERIALBUS); } 304 "VendorLong" { count (1); return (PARSEOP_VENDORLONG); } 305 "VendorShort" { count (1); return (PARSEOP_VENDORSHORT); } 306 "WordBusNumber" { count (1); return (PARSEOP_WORDBUSNUMBER); } 307 "WordIO" { count (1); return (PARSEOP_WORDIO); } 308 "WordSpace" { count (1); return (PARSEOP_WORDSPACE); } 309 310 311 /**************************************************************************** 312 * 313 * Keywords used as arguments to ASL operators and macros 314 * 315 ****************************************************************************/ 316 317 /* AccessAttribKeyword: Serial Bus Attributes (ACPI 5.0) */ 318 319 "AttribQuick" { count (0); return (PARSEOP_ACCESSATTRIB_QUICK); } 320 "AttribSendReceive" { count (0); return (PARSEOP_ACCESSATTRIB_SND_RCV); } 321 "AttribByte" { count (0); return (PARSEOP_ACCESSATTRIB_BYTE); } 322 "AttribWord" { count (0); return (PARSEOP_ACCESSATTRIB_WORD); } 323 "AttribBlock" { count (0); return (PARSEOP_ACCESSATTRIB_BLOCK); } 324 "AttribProcessCall" { count (0); return (PARSEOP_ACCESSATTRIB_WORD_CALL); } 325 "AttribBlockProcessCall" { count (0); return (PARSEOP_ACCESSATTRIB_BLOCK_CALL); } 326 327 /* AccessAttribKeyword: Legacy synonyms for above (pre-ACPI 5.0) */ 328 329 "SMBQuick" { count (0); return (PARSEOP_ACCESSATTRIB_QUICK); } 330 "SMBSendReceive" { count (0); return (PARSEOP_ACCESSATTRIB_SND_RCV); } 331 "SMBByte" { count (0); return (PARSEOP_ACCESSATTRIB_BYTE); } 332 "SMBWord" { count (0); return (PARSEOP_ACCESSATTRIB_WORD); } 333 "SMBBlock" { count (0); return (PARSEOP_ACCESSATTRIB_BLOCK); } 334 "SMBProcessCall" { count (0); return (PARSEOP_ACCESSATTRIB_WORD_CALL); } 335 "SMBBlockProcessCall" { count (0); return (PARSEOP_ACCESSATTRIB_BLOCK_CALL); } 336 337 /* AccessTypeKeyword: Field Access Types */ 338 339 "AnyAcc" { count (0); return (PARSEOP_ACCESSTYPE_ANY); } 340 "ByteAcc" { count (0); return (PARSEOP_ACCESSTYPE_BYTE); } 341 "WordAcc" { count (0); return (PARSEOP_ACCESSTYPE_WORD); } 342 "DWordAcc" { count (0); return (PARSEOP_ACCESSTYPE_DWORD); } 343 "QWordAcc" { count (0); return (PARSEOP_ACCESSTYPE_QWORD); } 344 "BufferAcc" { count (0); return (PARSEOP_ACCESSTYPE_BUF); } 345 346 /* AddressingModeKeyword: Mode - Resource Descriptors (ACPI 5.0) */ 347 348 "AddressingMode7Bit" { count (0); return (PARSEOP_ADDRESSINGMODE_7BIT); } 349 "AddressingMode10Bit" { count (0); return (PARSEOP_ADDRESSINGMODE_10BIT); } 350 351 /* AddressKeyword: ACPI memory range types */ 352 353 "AddressRangeMemory" { count (0); return (PARSEOP_ADDRESSTYPE_MEMORY); } 354 "AddressRangeReserved" { count (0); return (PARSEOP_ADDRESSTYPE_RESERVED); } 355 "AddressRangeNVS" { count (0); return (PARSEOP_ADDRESSTYPE_NVS); } 356 "AddressRangeACPI" { count (0); return (PARSEOP_ADDRESSTYPE_ACPI); } 357 358 /* BusMasterKeyword: DMA Bus Mastering */ 359 360 "BusMaster" { count (0); return (PARSEOP_BUSMASTERTYPE_MASTER); } 361 "NotBusMaster" { count (0); return (PARSEOP_BUSMASTERTYPE_NOTMASTER); } 362 363 /* ByteLengthKeyword: Bits per Byte - Resource Descriptors (ACPI 5.0) */ 364 365 "DataBitsFive" { count (0); return (PARSEOP_BITSPERBYTE_FIVE); } 366 "DataBitsSix" { count (0); return (PARSEOP_BITSPERBYTE_SIX); } 367 "DataBitsSeven" { count (0); return (PARSEOP_BITSPERBYTE_SEVEN); } 368 "DataBitsEight" { count (0); return (PARSEOP_BITSPERBYTE_EIGHT); } 369 "DataBitsNine" { count (0); return (PARSEOP_BITSPERBYTE_NINE); } 370 371 /* ClockPhaseKeyword: Resource Descriptors (ACPI 5.0) */ 372 373 "ClockPhaseFirst" { count (0); return (PARSEOP_CLOCKPHASE_FIRST); } 374 "ClockPhaseSecond" { count (0); return (PARSEOP_CLOCKPHASE_SECOND); } 375 376 /* ClockPolarityKeyword: Resource Descriptors (ACPI 5.0) */ 377 378 "ClockPolarityLow" { count (0); return (PARSEOP_CLOCKPOLARITY_LOW); } 379 "ClockPolarityHigh" { count (0); return (PARSEOP_CLOCKPOLARITY_HIGH); } 380 381 /* DecodeKeyword: Type of Memory Decoding - Resource Descriptors */ 382 383 "PosDecode" { count (0); return (PARSEOP_DECODETYPE_POS); } 384 "SubDecode" { count (0); return (PARSEOP_DECODETYPE_SUB); } 385 386 /* DmaTypeKeyword: DMA Types - DMA Resource Descriptor */ 387 388 "Compatibility" { count (0); return (PARSEOP_DMATYPE_COMPATIBILITY); } 389 "TypeA" { count (0); return (PARSEOP_DMATYPE_A); } 390 "TypeB" { count (0); return (PARSEOP_DMATYPE_B); } 391 "TypeF" { count (0); return (PARSEOP_DMATYPE_F); } 392 393 /* EndianKeyword: Endian type - Resource Descriptor (ACPI 5.0) */ 394 395 "LittleEndian" { count (0); return (PARSEOP_ENDIAN_LITTLE); } 396 "BigEndian" { count (0); return (PARSEOP_ENDIAN_BIG); } 397 398 /* ExtendedAttribKeyword: Bus attributes, AccessAs operator (ACPI 5.0) */ 399 400 "AttribBytes" { count (0); return (PARSEOP_ACCESSATTRIB_MULTIBYTE); } 401 "AttribRawBytes" { count (0); return (PARSEOP_ACCESSATTRIB_RAW_BYTES); } 402 "AttribRawProcessBytes" { count (0); return (PARSEOP_ACCESSATTRIB_RAW_PROCESS); } 403 404 /* FlowControlKeyword: Resource Descriptors (ACPI 5.0) */ 405 406 "FlowControlHardware" { count (0); return (PARSEOP_FLOWCONTROL_HW); } 407 "FlowControlNone" { count (0); return (PARSEOP_FLOWCONTROL_NONE); } 408 "FlowControlXon" { count (0); return (PARSEOP_FLOWCONTROL_SW); } 409 410 /* InterruptLevelKeyword: Interrupt Active Types */ 411 412 "ActiveBoth" { count (0); return (PARSEOP_INTLEVEL_ACTIVEBOTH); } 413 "ActiveHigh" { count (0); return (PARSEOP_INTLEVEL_ACTIVEHIGH); } 414 "ActiveLow" { count (0); return (PARSEOP_INTLEVEL_ACTIVELOW); } 415 416 /* InterruptTypeKeyword: Interrupt Types */ 417 418 "Edge" { count (0); return (PARSEOP_INTTYPE_EDGE); } 419 "Level" { count (0); return (PARSEOP_INTTYPE_LEVEL); } 420 421 /* IoDecodeKeyword: Type of Memory Decoding - Resource Descriptors */ 422 423 "Decode10" { count (0); return (PARSEOP_IODECODETYPE_10); } 424 "Decode16" { count (0); return (PARSEOP_IODECODETYPE_16); } 425 426 /* IoRestrictionKeyword: I/O Restriction - GPIO Resource Descriptors (ACPI 5.0) */ 427 428 "IoRestrictionNone" { count (0); return (PARSEOP_IORESTRICT_NONE); } 429 "IoRestrictionInputOnly" { count (0); return (PARSEOP_IORESTRICT_IN); } 430 "IoRestrictionOutputOnly" { count (0); return (PARSEOP_IORESTRICT_OUT); } 431 "IoRestrictionNoneAndPreserve" { count (0); return (PARSEOP_IORESTRICT_PRESERVE); } 432 433 /* LockRuleKeyword: Global Lock use for Field Operator */ 434 435 "Lock" { count (0); return (PARSEOP_LOCKRULE_LOCK); } 436 "NoLock" { count (0); return (PARSEOP_LOCKRULE_NOLOCK); } 437 438 /* MatchOpKeyword: Types for Match Operator */ 439 440 "MTR" { count (0); return (PARSEOP_MATCHTYPE_MTR); } 441 "MEQ" { count (0); return (PARSEOP_MATCHTYPE_MEQ); } 442 "MLE" { count (0); return (PARSEOP_MATCHTYPE_MLE); } 443 "MLT" { count (0); return (PARSEOP_MATCHTYPE_MLT); } 444 "MGE" { count (0); return (PARSEOP_MATCHTYPE_MGE); } 445 "MGT" { count (0); return (PARSEOP_MATCHTYPE_MGT); } 446 447 /* MaxKeyword: Max Range Type - Resource Descriptors */ 448 449 "MaxFixed" { count (0); return (PARSEOP_MAXTYPE_FIXED); } 450 "MaxNotFixed" { count (0); return (PARSEOP_MAXTYPE_NOTFIXED); } 451 452 /* MemTypeKeyword: Memory Types - Resource Descriptors */ 453 454 "Cacheable" { count (0); return (PARSEOP_MEMTYPE_CACHEABLE); } 455 "WriteCombining" { count (0); return (PARSEOP_MEMTYPE_WRITECOMBINING); } 456 "Prefetchable" { count (0); return (PARSEOP_MEMTYPE_PREFETCHABLE); } 457 "NonCacheable" { count (0); return (PARSEOP_MEMTYPE_NONCACHEABLE); } 458 459 /* MinKeyword: Min Range Type - Resource Descriptors */ 460 461 "MinFixed" { count (0); return (PARSEOP_MINTYPE_FIXED); } 462 "MinNotFixed" { count (0); return (PARSEOP_MINTYPE_NOTFIXED); } 463 464 /* ObjectTypeKeyword: ACPI Object Types */ 465 466 "UnknownObj" { count (0); return (PARSEOP_OBJECTTYPE_UNK); } 467 "IntObj" { count (0); return (PARSEOP_OBJECTTYPE_INT); } 468 "StrObj" { count (0); return (PARSEOP_OBJECTTYPE_STR); } 469 "BuffObj" { count (0); return (PARSEOP_OBJECTTYPE_BUF); } 470 "PkgObj" { count (0); return (PARSEOP_OBJECTTYPE_PKG); } 471 "FieldUnitObj" { count (0); return (PARSEOP_OBJECTTYPE_FLD); } 472 "DeviceObj" { count (0); return (PARSEOP_OBJECTTYPE_DEV); } 473 "EventObj" { count (0); return (PARSEOP_OBJECTTYPE_EVT); } 474 "MethodObj" { count (0); return (PARSEOP_OBJECTTYPE_MTH); } 475 "MutexObj" { count (0); return (PARSEOP_OBJECTTYPE_MTX); } 476 "OpRegionObj" { count (0); return (PARSEOP_OBJECTTYPE_OPR); } 477 "PowerResObj" { count (0); return (PARSEOP_OBJECTTYPE_POW); } 478 "ProcessorObj" { count (0); return (PARSEOP_OBJECTTYPE_PRO); } 479 "ThermalZoneObj" { count (0); return (PARSEOP_OBJECTTYPE_THZ); } 480 "BuffFieldObj" { count (0); return (PARSEOP_OBJECTTYPE_BFF); } 481 "DDBHandleObj" { count (0); return (PARSEOP_OBJECTTYPE_DDB); } 482 483 /* ParityKeyword: Resource Descriptors (ACPI 5.0) */ 484 485 "ParityTypeSpace" { count (0); return (PARSEOP_PARITYTYPE_SPACE); } 486 "ParityTypeMark" { count (0); return (PARSEOP_PARITYTYPE_MARK); } 487 "ParityTypeOdd" { count (0); return (PARSEOP_PARITYTYPE_ODD); } 488 "ParityTypeEven" { count (0); return (PARSEOP_PARITYTYPE_EVEN); } 489 "ParityTypeNone" { count (0); return (PARSEOP_PARITYTYPE_NONE); } 490 491 /* PinConfigKeyword: Pin Configuration - GPIO Resource Descriptors (ACPI 5.0) */ 492 493 "PullDefault" { count (0); return (PARSEOP_PIN_PULLDEFAULT); } 494 "PullUp" { count (0); return (PARSEOP_PIN_PULLUP); } 495 "PullDown" { count (0); return (PARSEOP_PIN_PULLDOWN); } 496 "PullNone" { count (0); return (PARSEOP_PIN_NOPULL); } 497 498 /* PolarityKeyword: Resource Descriptors (ACPI 5.0) */ 499 500 "PolarityLow" { count (0); return (PARSEOP_DEVICEPOLARITY_LOW); } 501 "PolarityHigh" { count (0); return (PARSEOP_DEVICEPOLARITY_HIGH); } 502 503 /* RangeTypeKeyword: I/O Range Types - Resource Descriptors */ 504 505 "ISAOnlyRanges" { count (0); return (PARSEOP_RANGETYPE_ISAONLY); } 506 "NonISAOnlyRanges" { count (0); return (PARSEOP_RANGETYPE_NONISAONLY); } 507 "EntireRange" { count (0); return (PARSEOP_RANGETYPE_ENTIRE); } 508 509 /* ReadWriteKeyword: Memory Access Types - Resource Descriptors */ 510 511 "ReadWrite" { count (0); return (PARSEOP_READWRITETYPE_BOTH); } 512 "ReadOnly" { count (0); return (PARSEOP_READWRITETYPE_READONLY); } 513 514 /* RegionSpaceKeyword: Operation Region Address Space Types */ 515 516 "SystemIO" { count (0); return (PARSEOP_REGIONSPACE_IO); } 517 "SystemMemory" { count (0); return (PARSEOP_REGIONSPACE_MEM); } 518 "PCI_Config" { count (0); return (PARSEOP_REGIONSPACE_PCI); } 519 "EmbeddedControl" { count (0); return (PARSEOP_REGIONSPACE_EC); } 520 "SMBus" { count (0); return (PARSEOP_REGIONSPACE_SMBUS); } 521 "SystemCMOS" { count (0); return (PARSEOP_REGIONSPACE_CMOS); } 522 "PciBarTarget" { count (0); return (PARSEOP_REGIONSPACE_PCIBAR); } 523 "IPMI" { count (0); return (PARSEOP_REGIONSPACE_IPMI); } 524 "GeneralPurposeIo" { count (0); return (PARSEOP_REGIONSPACE_GPIO); } /* ACPI 5.0 */ 525 "GenericSerialBus" { count (0); return (PARSEOP_REGIONSPACE_GSBUS); } /* ACPI 5.0 */ 526 "PCC" { count (0); return (PARSEOP_REGIONSPACE_PCC); } /* ACPI 5.0 */ 527 "FFixedHW" { count (0); return (PARSEOP_REGIONSPACE_FFIXEDHW); } 528 529 /* ResourceTypeKeyword: Resource Usage - Resource Descriptors */ 530 531 "ResourceConsumer" { count (0); return (PARSEOP_RESOURCETYPE_CONSUMER); } 532 "ResourceProducer" { count (0); return (PARSEOP_RESOURCETYPE_PRODUCER); } 533 534 /* SerializeRuleKeyword: Control Method Serialization */ 535 536 "Serialized" { count (0); return (PARSEOP_SERIALIZERULE_SERIAL); } 537 "NotSerialized" { count (0); return (PARSEOP_SERIALIZERULE_NOTSERIAL); } 538 539 /* ShareTypeKeyword: Interrupt Sharing - Resource Descriptors */ 540 541 "Shared" { count (0); return (PARSEOP_SHARETYPE_SHARED); } 542 "Exclusive" { count (0); return (PARSEOP_SHARETYPE_EXCLUSIVE); } 543 "SharedAndWake" { count (0); return (PARSEOP_SHARETYPE_SHAREDWAKE); } /* ACPI 5.0 */ 544 "ExclusiveAndWake" { count (0); return (PARSEOP_SHARETYPE_EXCLUSIVEWAKE); } /* ACPI 5.0 */ 545 546 /* SlaveModeKeyword: Resource Descriptors (ACPI 5.0) */ 547 548 "ControllerInitiated" { count (0); return (PARSEOP_SLAVEMODE_CONTROLLERINIT); } 549 "DeviceInitiated" { count (0); return (PARSEOP_SLAVEMODE_DEVICEINIT); } 550 551 /* StopBitsKeyword: Resource Descriptors (ACPI 5.0) */ 552 553 "StopBitsOne" { count (0); return (PARSEOP_STOPBITS_ONE); } 554 "StopBitsOnePlusHalf" { count (0); return (PARSEOP_STOPBITS_ONEPLUSHALF); } 555 "StopBitsTwo" { count (0); return (PARSEOP_STOPBITS_TWO); } 556 "StopBitsZero" { count (0); return (PARSEOP_STOPBITS_ZERO); } 557 558 /* TransferWidthKeyword: DMA Widths - Fixed DMA Resource Descriptor (ACPI 5.0) */ 559 560 "Width8bit" { count (0); return (PARSEOP_XFERSIZE_8); } 561 "Width16bit" { count (0); return (PARSEOP_XFERSIZE_16); } 562 "Width32bit" { count (0); return (PARSEOP_XFERSIZE_32); } 563 "Width64bit" { count (0); return (PARSEOP_XFERSIZE_64); } 564 "Width128bit" { count (0); return (PARSEOP_XFERSIZE_128); } 565 "Width256bit" { count (0); return (PARSEOP_XFERSIZE_256); } 566 567 /* TranslationKeyword: Translation Density Types - Resource Descriptors */ 568 569 "SparseTranslation" { count (0); return (PARSEOP_TRANSLATIONTYPE_SPARSE); } 570 "DenseTranslation" { count (0); return (PARSEOP_TRANSLATIONTYPE_DENSE); } 571 572 /* TypeKeyword: Translation Types - Resource Descriptors */ 573 574 "TypeTranslation" { count (0); return (PARSEOP_TYPE_TRANSLATION); } 575 "TypeStatic" { count (0); return (PARSEOP_TYPE_STATIC); } 576 577 /* UpdateRuleKeyword: Field Update Rules */ 578 579 "Preserve" { count (0); return (PARSEOP_UPDATERULE_PRESERVE); } 580 "WriteAsOnes" { count (0); return (PARSEOP_UPDATERULE_ONES); } 581 "WriteAsZeros" { count (0); return (PARSEOP_UPDATERULE_ZEROS); } 582 583 /* WireModeKeyword: SPI Wire Mode - Resource Descriptors (ACPI 5.0) */ 584 585 "FourWireMode" { count (0); return (PARSEOP_WIREMODE_FOUR); } 586 "ThreeWireMode" { count (0); return (PARSEOP_WIREMODE_THREE); } 587 588 /* XferTypeKeyword: DMA Transfer Types */ 589 590 "Transfer8" { count (0); return (PARSEOP_XFERTYPE_8); } 591 "Transfer8_16" { count (0); return (PARSEOP_XFERTYPE_8_16); } 592 "Transfer16" { count (0); return (PARSEOP_XFERTYPE_16); } 593 594 /* Predefined compiler names */ 595 596 "__DATE__" { count (0); return (PARSEOP___DATE__); } 597 "__FILE__" { count (0); return (PARSEOP___FILE__); } 598 "__LINE__" { count (0); return (PARSEOP___LINE__); } 599 "__PATH__" { count (0); return (PARSEOP___PATH__); } 600 601 602 "{" { count (0); return('{'); } 603 "}" { count (0); return('}'); } 604 "," { count (0); return(','); } 605 "(" { count (0); return('('); } 606 ")" { count (0); return(')'); } 607 608 {NameSeg} { char *s; 609 count (0); 610 s=malloc (ACPI_NAME_SIZE + 1); 611 if (strcmp (AslCompilertext, "\\")) 612 { 613 strcpy (s, "____"); 614 AcpiUtStrupr (AslCompilertext); 615 } 616 memcpy (s, AslCompilertext, strlen (AslCompilertext)); 617 AslCompilerlval.s = s; 618 DbgPrint (ASL_PARSE_OUTPUT, "NameSeg: %s\n", s); 619 return (PARSEOP_NAMESEG); } 620 621 {NameString} { char *s; 622 count (0); 623 s=malloc (strlen (AslCompilertext)+1); 624 AcpiUtStrupr (AslCompilertext); 625 strcpy (s, AslCompilertext); 626 s[strlen (AslCompilertext)] = 0; 627 AslCompilerlval.s = s; 628 DbgPrint (ASL_PARSE_OUTPUT, "NameString: %s\n", s); 629 return (PARSEOP_NAMESTRING); } 630 631 "*" | 632 "/" { count (1); 633 AslCompilererror ("Parse error, expecting ASL keyword or name");} 634 635 . { count (1); 636 sprintf (MsgBuffer, 637 "Invalid character (0x%2.2X), expecting ASL keyword or name", 638 *AslCompilertext); 639 AslCompilererror (MsgBuffer);} 640 641 <<EOF>> { if (AslPopInputFileStack ()) 642 yyterminate(); 643 else 644 return (PARSEOP_INCLUDE_END);}; 645 646 %% 647 648 /*! [End] no source code translation !*/ 649 650 /* 651 * Bring in the scanner support routines 652 */ 653 #include "aslsupport.l"