1 %{ 2 /****************************************************************************** 3 * 4 * Module Name: aslcompiler.l - Flex/lex input file 5 * 6 *****************************************************************************/ 7 8 /* 9 * Copyright (C) 2000 - 2014, 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 <contrib/dev/acpica/compiler/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);} 117 else {yyterminate ();} } 118 ";" { count (0); return(';'); } 119 120 121 0[xX]{HexDigitChar}+ | 122 {DigitChar}+ { AslCompilerlval.i = UtDoConstant ((char *) AslCompilertext); 123 count (1); return (PARSEOP_INTEGER); } 124 125 "Include" { count (1); return (PARSEOP_INCLUDE); } 126 "External" { count (1); return (PARSEOP_EXTERNAL); } 127 128 /* 129 * The #line directive is emitted by the preprocessor and handled 130 * here in the main iASL lexer - simply set the line number and 131 * optionally the current filename. 132 */ 133 "#line" { AslDoLineDirective ();} 134 135 136 /**************************************************************************** 137 * 138 * Main ASL operators 139 * 140 ****************************************************************************/ 141 142 "AccessAs" { count (1); return (PARSEOP_ACCESSAS); } 143 "Acquire" { count (3); return (PARSEOP_ACQUIRE); } 144 "Add" { count (3); return (PARSEOP_ADD); } 145 "Alias" { count (2); return (PARSEOP_ALIAS); } 146 "And" { count (3); return (PARSEOP_AND); } 147 "BankField" { count (2); return (PARSEOP_BANKFIELD); } 148 "Break" { count (3); return (PARSEOP_BREAK); } 149 "BreakPoint" { count (3); return (PARSEOP_BREAKPOINT); } 150 "Buffer" { count (1); return (PARSEOP_BUFFER); } 151 "Case" { count (3); return (PARSEOP_CASE); } 152 "Concatenate" { count (3); return (PARSEOP_CONCATENATE); } 153 "ConcatenateResTemplate" { count (3); return (PARSEOP_CONCATENATERESTEMPLATE); } 154 "CondRefOf" { count (3); return (PARSEOP_CONDREFOF); } 155 "Connection" { count (2); return (PARSEOP_CONNECTION); } 156 "Continue" { count (3); return (PARSEOP_CONTINUE); } 157 "CopyObject" { count (3); return (PARSEOP_COPYOBJECT); } 158 "CreateBitField" { count (2); return (PARSEOP_CREATEBITFIELD); } 159 "CreateByteField" { count (2); return (PARSEOP_CREATEBYTEFIELD); } 160 "CreateDWordField" { count (2); return (PARSEOP_CREATEDWORDFIELD); } 161 "CreateField" { count (2); return (PARSEOP_CREATEFIELD); } 162 "CreateQWordField" { count (2); return (PARSEOP_CREATEQWORDFIELD); } 163 "CreateWordField" { count (2); return (PARSEOP_CREATEWORDFIELD); } 164 "DataTableRegion" { count (2); return (PARSEOP_DATATABLEREGION); } 165 "Debug" { count (1); return (PARSEOP_DEBUG); } 166 "Decrement" { count (3); return (PARSEOP_DECREMENT); } 167 "Default" { count (3); return (PARSEOP_DEFAULT); } 168 "DefinitionBlock" { count (1); return (PARSEOP_DEFINITIONBLOCK); } 169 "DeRefOf" { count (3); return (PARSEOP_DEREFOF); } 170 "Device" { count (2); return (PARSEOP_DEVICE); } 171 "Divide" { count (3); return (PARSEOP_DIVIDE); } 172 "Eisaid" { count (1); return (PARSEOP_EISAID); } 173 "Else" { count (3); return (PARSEOP_ELSE); } 174 "ElseIf" { count (3); return (PARSEOP_ELSEIF); } 175 "Event" { count (2); return (PARSEOP_EVENT); } 176 "Fatal" { count (3); return (PARSEOP_FATAL); } 177 "Field" { count (2); return (PARSEOP_FIELD); } 178 "FindSetLeftBit" { count (3); return (PARSEOP_FINDSETLEFTBIT); } 179 "FindSetRightBit" { count (3); return (PARSEOP_FINDSETRIGHTBIT); } 180 "FromBcd" { count (3); return (PARSEOP_FROMBCD); } 181 "Function" { count (2); return (PARSEOP_FUNCTION); } 182 "If" { count (3); return (PARSEOP_IF); } 183 "Increment" { count (3); return (PARSEOP_INCREMENT); } 184 "Index" { count (3); return (PARSEOP_INDEX); } 185 "IndexField" { count (2); return (PARSEOP_INDEXFIELD); } 186 "LAnd" { count (3); return (PARSEOP_LAND); } 187 "LEqual" { count (3); return (PARSEOP_LEQUAL); } 188 "LGreater" { count (3); return (PARSEOP_LGREATER); } 189 "LGreaterEqual" { count (3); return (PARSEOP_LGREATEREQUAL); } 190 "LLess" { count (3); return (PARSEOP_LLESS); } 191 "LLessEqual" { count (3); return (PARSEOP_LLESSEQUAL); } 192 "LNot" { count (3); return (PARSEOP_LNOT); } 193 "LNotEqual" { count (3); return (PARSEOP_LNOTEQUAL); } 194 "Load" { count (3); return (PARSEOP_LOAD); } 195 "LoadTable" { count (3); return (PARSEOP_LOADTABLE); } 196 "LOr" { count (3); return (PARSEOP_LOR); } 197 "Match" { count (3); return (PARSEOP_MATCH); } 198 "Method" { count (2); return (PARSEOP_METHOD); } 199 "Mid" { count (3); return (PARSEOP_MID); } 200 "Mod" { count (3); return (PARSEOP_MOD); } 201 "Multiply" { count (3); return (PARSEOP_MULTIPLY); } 202 "Mutex" { count (2); return (PARSEOP_MUTEX); } 203 "Name" { count (2); return (PARSEOP_NAME); } 204 "NAnd" { count (3); return (PARSEOP_NAND); } 205 "Noop" { if (!AcpiGbl_IgnoreNoopOperator) {count (3); return (PARSEOP_NOOP);} } 206 "NOr" { count (3); return (PARSEOP_NOR); } 207 "Not" { count (3); return (PARSEOP_NOT); } 208 "Notify" { count (3); return (PARSEOP_NOTIFY); } 209 "ObjectType" { count (3); return (PARSEOP_OBJECTTYPE); } 210 "Offset" { count (1); return (PARSEOP_OFFSET); } 211 "One" { count (1); return (PARSEOP_ONE); } 212 "Ones" { count (1); return (PARSEOP_ONES); } 213 "OperationRegion" { count (2); return (PARSEOP_OPERATIONREGION); } 214 "Or" { count (3); return (PARSEOP_OR); } 215 "Package" { count (1); return (PARSEOP_PACKAGE); } 216 "PowerResource" { count (2); return (PARSEOP_POWERRESOURCE); } 217 "Processor" { count (2); return (PARSEOP_PROCESSOR); } 218 "RefOf" { count (3); return (PARSEOP_REFOF); } 219 "Release" { count (3); return (PARSEOP_RELEASE); } 220 "Reset" { count (3); return (PARSEOP_RESET); } 221 "Return" { count (3); return (PARSEOP_RETURN); } 222 "Revision" { count (1); return (PARSEOP_REVISION); } 223 "Scope" { count (2); return (PARSEOP_SCOPE); } 224 "ShiftLeft" { count (3); return (PARSEOP_SHIFTLEFT); } 225 "ShiftRight" { count (3); return (PARSEOP_SHIFTRIGHT); } 226 "Signal" { count (3); return (PARSEOP_SIGNAL); } 227 "SizeOf" { count (3); return (PARSEOP_SIZEOF); } 228 "Sleep" { count (3); return (PARSEOP_SLEEP); } 229 "Stall" { count (3); return (PARSEOP_STALL); } 230 "Store" { count (3); return (PARSEOP_STORE); } 231 "Subtract" { count (3); return (PARSEOP_SUBTRACT); } 232 "Switch" { count (3); return (PARSEOP_SWITCH); } 233 "ThermalZone" { count (2); return (PARSEOP_THERMALZONE); } 234 "Timer" { count (3); return (PARSEOP_TIMER); } 235 "ToBcd" { count (3); return (PARSEOP_TOBCD); } 236 "ToBuffer" { count (3); return (PARSEOP_TOBUFFER); } 237 "ToDecimalString" { count (3); return (PARSEOP_TODECIMALSTRING); } 238 "ToHexString" { count (3); return (PARSEOP_TOHEXSTRING); } 239 "ToInteger" { count (3); return (PARSEOP_TOINTEGER); } 240 "ToString" { count (3); return (PARSEOP_TOSTRING); } 241 "ToUuid" { count (1); return (PARSEOP_TOUUID); } 242 "Unicode" { count (1); return (PARSEOP_UNICODE); } 243 "Unload" { count (3); return (PARSEOP_UNLOAD); } 244 "Wait" { count (3); return (PARSEOP_WAIT); } 245 "While" { count (3); return (PARSEOP_WHILE); } 246 "XOr" { count (3); return (PARSEOP_XOR); } 247 "Zero" { count (1); return (PARSEOP_ZERO); } 248 249 /* Control method arguments and locals */ 250 251 "Arg0" { count (1); return (PARSEOP_ARG0); } 252 "Arg1" { count (1); return (PARSEOP_ARG1); } 253 "Arg2" { count (1); return (PARSEOP_ARG2); } 254 "Arg3" { count (1); return (PARSEOP_ARG3); } 255 "Arg4" { count (1); return (PARSEOP_ARG4); } 256 "Arg5" { count (1); return (PARSEOP_ARG5); } 257 "Arg6" { count (1); return (PARSEOP_ARG6); } 258 "Local0" { count (1); return (PARSEOP_LOCAL0); } 259 "Local1" { count (1); return (PARSEOP_LOCAL1); } 260 "Local2" { count (1); return (PARSEOP_LOCAL2); } 261 "Local3" { count (1); return (PARSEOP_LOCAL3); } 262 "Local4" { count (1); return (PARSEOP_LOCAL4); } 263 "Local5" { count (1); return (PARSEOP_LOCAL5); } 264 "Local6" { count (1); return (PARSEOP_LOCAL6); } 265 "Local7" { count (1); return (PARSEOP_LOCAL7); } 266 267 268 /**************************************************************************** 269 * 270 * Resource Descriptor macros 271 * 272 ****************************************************************************/ 273 274 "ResourceTemplate" { count (1); return (PARSEOP_RESOURCETEMPLATE); } 275 "RawDataBuffer" { count (1); return (PARSEOP_DATABUFFER); } 276 277 "DMA" { count (1); return (PARSEOP_DMA); } 278 "DWordIO" { count (1); return (PARSEOP_DWORDIO); } 279 "DWordMemory" { count (1); return (PARSEOP_DWORDMEMORY); } 280 "DWordSpace" { count (1); return (PARSEOP_DWORDSPACE); } 281 "EndDependentFn" { count (1); return (PARSEOP_ENDDEPENDENTFN); } 282 "ExtendedIO" { count (1); return (PARSEOP_EXTENDEDIO); } 283 "ExtendedMemory" { count (1); return (PARSEOP_EXTENDEDMEMORY); } 284 "ExtendedSpace" { count (1); return (PARSEOP_EXTENDEDSPACE); } 285 "FixedDma" { count (1); return (PARSEOP_FIXEDDMA); } 286 "FixedIO" { count (1); return (PARSEOP_FIXEDIO); } 287 "GpioInt" { count (1); return (PARSEOP_GPIO_INT); } 288 "GpioIo" { count (1); return (PARSEOP_GPIO_IO); } 289 "I2cSerialBus" { count (1); return (PARSEOP_I2C_SERIALBUS); } 290 "Interrupt" { count (1); return (PARSEOP_INTERRUPT); } 291 "IO" { count (1); return (PARSEOP_IO); } 292 "IRQ" { count (1); return (PARSEOP_IRQ); } 293 "IRQNoFlags" { count (1); return (PARSEOP_IRQNOFLAGS); } 294 "Memory24" { count (1); return (PARSEOP_MEMORY24); } 295 "Memory32" { count (1); return (PARSEOP_MEMORY32); } 296 "Memory32Fixed" { count (1); return (PARSEOP_MEMORY32FIXED); } 297 "QWordIO" { count (1); return (PARSEOP_QWORDIO); } 298 "QWordMemory" { count (1); return (PARSEOP_QWORDMEMORY); } 299 "QWordSpace" { count (1); return (PARSEOP_QWORDSPACE); } 300 "Register" { count (1); return (PARSEOP_REGISTER); } 301 "SpiSerialBus" { count (1); return (PARSEOP_SPI_SERIALBUS); } 302 "StartDependentFn" { count (1); return (PARSEOP_STARTDEPENDENTFN); } 303 "StartDependentFnNoPri" { count (1); return (PARSEOP_STARTDEPENDENTFN_NOPRI); } 304 "UartSerialBus" { count (1); return (PARSEOP_UART_SERIALBUS); } 305 "VendorLong" { count (1); return (PARSEOP_VENDORLONG); } 306 "VendorShort" { count (1); return (PARSEOP_VENDORSHORT); } 307 "WordBusNumber" { count (1); return (PARSEOP_WORDBUSNUMBER); } 308 "WordIO" { count (1); return (PARSEOP_WORDIO); } 309 "WordSpace" { count (1); return (PARSEOP_WORDSPACE); } 310 311 312 /**************************************************************************** 313 * 314 * Keywords used as arguments to ASL operators and macros 315 * 316 ****************************************************************************/ 317 318 /* AccessAttribKeyword: Serial Bus Attributes (ACPI 5.0) */ 319 320 "AttribQuick" { count (0); return (PARSEOP_ACCESSATTRIB_QUICK); } 321 "AttribSendReceive" { count (0); return (PARSEOP_ACCESSATTRIB_SND_RCV); } 322 "AttribByte" { count (0); return (PARSEOP_ACCESSATTRIB_BYTE); } 323 "AttribWord" { count (0); return (PARSEOP_ACCESSATTRIB_WORD); } 324 "AttribBlock" { count (0); return (PARSEOP_ACCESSATTRIB_BLOCK); } 325 "AttribProcessCall" { count (0); return (PARSEOP_ACCESSATTRIB_WORD_CALL); } 326 "AttribBlockProcessCall" { count (0); return (PARSEOP_ACCESSATTRIB_BLOCK_CALL); } 327 328 /* AccessAttribKeyword: Legacy synonyms for above (pre-ACPI 5.0) */ 329 330 "SMBQuick" { count (0); return (PARSEOP_ACCESSATTRIB_QUICK); } 331 "SMBSendReceive" { count (0); return (PARSEOP_ACCESSATTRIB_SND_RCV); } 332 "SMBByte" { count (0); return (PARSEOP_ACCESSATTRIB_BYTE); } 333 "SMBWord" { count (0); return (PARSEOP_ACCESSATTRIB_WORD); } 334 "SMBBlock" { count (0); return (PARSEOP_ACCESSATTRIB_BLOCK); } 335 "SMBProcessCall" { count (0); return (PARSEOP_ACCESSATTRIB_WORD_CALL); } 336 "SMBBlockProcessCall" { count (0); return (PARSEOP_ACCESSATTRIB_BLOCK_CALL); } 337 338 /* AccessTypeKeyword: Field Access Types */ 339 340 "AnyAcc" { count (0); return (PARSEOP_ACCESSTYPE_ANY); } 341 "ByteAcc" { count (0); return (PARSEOP_ACCESSTYPE_BYTE); } 342 "WordAcc" { count (0); return (PARSEOP_ACCESSTYPE_WORD); } 343 "DWordAcc" { count (0); return (PARSEOP_ACCESSTYPE_DWORD); } 344 "QWordAcc" { count (0); return (PARSEOP_ACCESSTYPE_QWORD); } 345 "BufferAcc" { count (0); return (PARSEOP_ACCESSTYPE_BUF); } 346 347 /* AddressingModeKeyword: Mode - Resource Descriptors (ACPI 5.0) */ 348 349 "AddressingMode7Bit" { count (0); return (PARSEOP_ADDRESSINGMODE_7BIT); } 350 "AddressingMode10Bit" { count (0); return (PARSEOP_ADDRESSINGMODE_10BIT); } 351 352 /* AddressKeyword: ACPI memory range types */ 353 354 "AddressRangeMemory" { count (0); return (PARSEOP_ADDRESSTYPE_MEMORY); } 355 "AddressRangeReserved" { count (0); return (PARSEOP_ADDRESSTYPE_RESERVED); } 356 "AddressRangeNVS" { count (0); return (PARSEOP_ADDRESSTYPE_NVS); } 357 "AddressRangeACPI" { count (0); return (PARSEOP_ADDRESSTYPE_ACPI); } 358 359 /* BusMasterKeyword: DMA Bus Mastering */ 360 361 "BusMaster" { count (0); return (PARSEOP_BUSMASTERTYPE_MASTER); } 362 "NotBusMaster" { count (0); return (PARSEOP_BUSMASTERTYPE_NOTMASTER); } 363 364 /* ByteLengthKeyword: Bits per Byte - Resource Descriptors (ACPI 5.0) */ 365 366 "DataBitsFive" { count (0); return (PARSEOP_BITSPERBYTE_FIVE); } 367 "DataBitsSix" { count (0); return (PARSEOP_BITSPERBYTE_SIX); } 368 "DataBitsSeven" { count (0); return (PARSEOP_BITSPERBYTE_SEVEN); } 369 "DataBitsEight" { count (0); return (PARSEOP_BITSPERBYTE_EIGHT); } 370 "DataBitsNine" { count (0); return (PARSEOP_BITSPERBYTE_NINE); } 371 372 /* ClockPhaseKeyword: Resource Descriptors (ACPI 5.0) */ 373 374 "ClockPhaseFirst" { count (0); return (PARSEOP_CLOCKPHASE_FIRST); } 375 "ClockPhaseSecond" { count (0); return (PARSEOP_CLOCKPHASE_SECOND); } 376 377 /* ClockPolarityKeyword: Resource Descriptors (ACPI 5.0) */ 378 379 "ClockPolarityLow" { count (0); return (PARSEOP_CLOCKPOLARITY_LOW); } 380 "ClockPolarityHigh" { count (0); return (PARSEOP_CLOCKPOLARITY_HIGH); } 381 382 /* DecodeKeyword: Type of Memory Decoding - Resource Descriptors */ 383 384 "PosDecode" { count (0); return (PARSEOP_DECODETYPE_POS); } 385 "SubDecode" { count (0); return (PARSEOP_DECODETYPE_SUB); } 386 387 /* DmaTypeKeyword: DMA Types - DMA Resource Descriptor */ 388 389 "Compatibility" { count (0); return (PARSEOP_DMATYPE_COMPATIBILITY); } 390 "TypeA" { count (0); return (PARSEOP_DMATYPE_A); } 391 "TypeB" { count (0); return (PARSEOP_DMATYPE_B); } 392 "TypeF" { count (0); return (PARSEOP_DMATYPE_F); } 393 394 /* EndianKeyword: Endian type - Resource Descriptor (ACPI 5.0) */ 395 396 "LittleEndian" { count (0); return (PARSEOP_ENDIAN_LITTLE); } 397 "BigEndian" { count (0); return (PARSEOP_ENDIAN_BIG); } 398 399 /* ExtendedAttribKeyword: Bus attributes, AccessAs operator (ACPI 5.0) */ 400 401 "AttribBytes" { count (0); return (PARSEOP_ACCESSATTRIB_MULTIBYTE); } 402 "AttribRawBytes" { count (0); return (PARSEOP_ACCESSATTRIB_RAW_BYTES); } 403 "AttribRawProcessBytes" { count (0); return (PARSEOP_ACCESSATTRIB_RAW_PROCESS); } 404 405 /* FlowControlKeyword: Resource Descriptors (ACPI 5.0) */ 406 407 "FlowControlHardware" { count (0); return (PARSEOP_FLOWCONTROL_HW); } 408 "FlowControlNone" { count (0); return (PARSEOP_FLOWCONTROL_NONE); } 409 "FlowControlXon" { count (0); return (PARSEOP_FLOWCONTROL_SW); } 410 411 /* InterruptLevelKeyword: Interrupt Active Types */ 412 413 "ActiveBoth" { count (0); return (PARSEOP_INTLEVEL_ACTIVEBOTH); } 414 "ActiveHigh" { count (0); return (PARSEOP_INTLEVEL_ACTIVEHIGH); } 415 "ActiveLow" { count (0); return (PARSEOP_INTLEVEL_ACTIVELOW); } 416 417 /* InterruptTypeKeyword: Interrupt Types */ 418 419 "Edge" { count (0); return (PARSEOP_INTTYPE_EDGE); } 420 "Level" { count (0); return (PARSEOP_INTTYPE_LEVEL); } 421 422 /* IoDecodeKeyword: Type of Memory Decoding - Resource Descriptors */ 423 424 "Decode10" { count (0); return (PARSEOP_IODECODETYPE_10); } 425 "Decode16" { count (0); return (PARSEOP_IODECODETYPE_16); } 426 427 /* IoRestrictionKeyword: I/O Restriction - GPIO Resource Descriptors (ACPI 5.0) */ 428 429 "IoRestrictionNone" { count (0); return (PARSEOP_IORESTRICT_NONE); } 430 "IoRestrictionInputOnly" { count (0); return (PARSEOP_IORESTRICT_IN); } 431 "IoRestrictionOutputOnly" { count (0); return (PARSEOP_IORESTRICT_OUT); } 432 "IoRestrictionNoneAndPreserve" { count (0); return (PARSEOP_IORESTRICT_PRESERVE); } 433 434 /* LockRuleKeyword: Global Lock use for Field Operator */ 435 436 "Lock" { count (0); return (PARSEOP_LOCKRULE_LOCK); } 437 "NoLock" { count (0); return (PARSEOP_LOCKRULE_NOLOCK); } 438 439 /* MatchOpKeyword: Types for Match Operator */ 440 441 "MTR" { count (0); return (PARSEOP_MATCHTYPE_MTR); } 442 "MEQ" { count (0); return (PARSEOP_MATCHTYPE_MEQ); } 443 "MLE" { count (0); return (PARSEOP_MATCHTYPE_MLE); } 444 "MLT" { count (0); return (PARSEOP_MATCHTYPE_MLT); } 445 "MGE" { count (0); return (PARSEOP_MATCHTYPE_MGE); } 446 "MGT" { count (0); return (PARSEOP_MATCHTYPE_MGT); } 447 448 /* MaxKeyword: Max Range Type - Resource Descriptors */ 449 450 "MaxFixed" { count (0); return (PARSEOP_MAXTYPE_FIXED); } 451 "MaxNotFixed" { count (0); return (PARSEOP_MAXTYPE_NOTFIXED); } 452 453 /* MemTypeKeyword: Memory Types - Resource Descriptors */ 454 455 "Cacheable" { count (0); return (PARSEOP_MEMTYPE_CACHEABLE); } 456 "WriteCombining" { count (0); return (PARSEOP_MEMTYPE_WRITECOMBINING); } 457 "Prefetchable" { count (0); return (PARSEOP_MEMTYPE_PREFETCHABLE); } 458 "NonCacheable" { count (0); return (PARSEOP_MEMTYPE_NONCACHEABLE); } 459 460 /* MinKeyword: Min Range Type - Resource Descriptors */ 461 462 "MinFixed" { count (0); return (PARSEOP_MINTYPE_FIXED); } 463 "MinNotFixed" { count (0); return (PARSEOP_MINTYPE_NOTFIXED); } 464 465 /* ObjectTypeKeyword: ACPI Object Types */ 466 467 "UnknownObj" { count (0); return (PARSEOP_OBJECTTYPE_UNK); } 468 "IntObj" { count (0); return (PARSEOP_OBJECTTYPE_INT); } 469 "StrObj" { count (0); return (PARSEOP_OBJECTTYPE_STR); } 470 "BuffObj" { count (0); return (PARSEOP_OBJECTTYPE_BUF); } 471 "PkgObj" { count (0); return (PARSEOP_OBJECTTYPE_PKG); } 472 "FieldUnitObj" { count (0); return (PARSEOP_OBJECTTYPE_FLD); } 473 "DeviceObj" { count (0); return (PARSEOP_OBJECTTYPE_DEV); } 474 "EventObj" { count (0); return (PARSEOP_OBJECTTYPE_EVT); } 475 "MethodObj" { count (0); return (PARSEOP_OBJECTTYPE_MTH); } 476 "MutexObj" { count (0); return (PARSEOP_OBJECTTYPE_MTX); } 477 "OpRegionObj" { count (0); return (PARSEOP_OBJECTTYPE_OPR); } 478 "PowerResObj" { count (0); return (PARSEOP_OBJECTTYPE_POW); } 479 "ProcessorObj" { count (0); return (PARSEOP_OBJECTTYPE_PRO); } 480 "ThermalZoneObj" { count (0); return (PARSEOP_OBJECTTYPE_THZ); } 481 "BuffFieldObj" { count (0); return (PARSEOP_OBJECTTYPE_BFF); } 482 "DDBHandleObj" { count (0); return (PARSEOP_OBJECTTYPE_DDB); } 483 484 /* ParityKeyword: Resource Descriptors (ACPI 5.0) */ 485 486 "ParityTypeSpace" { count (0); return (PARSEOP_PARITYTYPE_SPACE); } 487 "ParityTypeMark" { count (0); return (PARSEOP_PARITYTYPE_MARK); } 488 "ParityTypeOdd" { count (0); return (PARSEOP_PARITYTYPE_ODD); } 489 "ParityTypeEven" { count (0); return (PARSEOP_PARITYTYPE_EVEN); } 490 "ParityTypeNone" { count (0); return (PARSEOP_PARITYTYPE_NONE); } 491 492 /* PinConfigKeyword: Pin Configuration - GPIO Resource Descriptors (ACPI 5.0) */ 493 494 "PullDefault" { count (0); return (PARSEOP_PIN_PULLDEFAULT); } 495 "PullUp" { count (0); return (PARSEOP_PIN_PULLUP); } 496 "PullDown" { count (0); return (PARSEOP_PIN_PULLDOWN); } 497 "PullNone" { count (0); return (PARSEOP_PIN_NOPULL); } 498 499 /* PolarityKeyword: Resource Descriptors (ACPI 5.0) */ 500 501 "PolarityLow" { count (0); return (PARSEOP_DEVICEPOLARITY_LOW); } 502 "PolarityHigh" { count (0); return (PARSEOP_DEVICEPOLARITY_HIGH); } 503 504 /* RangeTypeKeyword: I/O Range Types - Resource Descriptors */ 505 506 "ISAOnlyRanges" { count (0); return (PARSEOP_RANGETYPE_ISAONLY); } 507 "NonISAOnlyRanges" { count (0); return (PARSEOP_RANGETYPE_NONISAONLY); } 508 "EntireRange" { count (0); return (PARSEOP_RANGETYPE_ENTIRE); } 509 510 /* ReadWriteKeyword: Memory Access Types - Resource Descriptors */ 511 512 "ReadWrite" { count (0); return (PARSEOP_READWRITETYPE_BOTH); } 513 "ReadOnly" { count (0); return (PARSEOP_READWRITETYPE_READONLY); } 514 515 /* RegionSpaceKeyword: Operation Region Address Space Types */ 516 517 "SystemIO" { count (0); return (PARSEOP_REGIONSPACE_IO); } 518 "SystemMemory" { count (0); return (PARSEOP_REGIONSPACE_MEM); } 519 "PCI_Config" { count (0); return (PARSEOP_REGIONSPACE_PCI); } 520 "EmbeddedControl" { count (0); return (PARSEOP_REGIONSPACE_EC); } 521 "SMBus" { count (0); return (PARSEOP_REGIONSPACE_SMBUS); } 522 "SystemCMOS" { count (0); return (PARSEOP_REGIONSPACE_CMOS); } 523 "PciBarTarget" { count (0); return (PARSEOP_REGIONSPACE_PCIBAR); } 524 "IPMI" { count (0); return (PARSEOP_REGIONSPACE_IPMI); } 525 "GeneralPurposeIo" { count (0); return (PARSEOP_REGIONSPACE_GPIO); } /* ACPI 5.0 */ 526 "GenericSerialBus" { count (0); return (PARSEOP_REGIONSPACE_GSBUS); } /* ACPI 5.0 */ 527 "PCC" { count (0); return (PARSEOP_REGIONSPACE_PCC); } /* ACPI 5.0 */ 528 "FFixedHW" { count (0); return (PARSEOP_REGIONSPACE_FFIXEDHW); } 529 530 /* ResourceTypeKeyword: Resource Usage - Resource Descriptors */ 531 532 "ResourceConsumer" { count (0); return (PARSEOP_RESOURCETYPE_CONSUMER); } 533 "ResourceProducer" { count (0); return (PARSEOP_RESOURCETYPE_PRODUCER); } 534 535 /* SerializeRuleKeyword: Control Method Serialization */ 536 537 "Serialized" { count (0); return (PARSEOP_SERIALIZERULE_SERIAL); } 538 "NotSerialized" { count (0); return (PARSEOP_SERIALIZERULE_NOTSERIAL); } 539 540 /* ShareTypeKeyword: Interrupt Sharing - Resource Descriptors */ 541 542 "Shared" { count (0); return (PARSEOP_SHARETYPE_SHARED); } 543 "Exclusive" { count (0); return (PARSEOP_SHARETYPE_EXCLUSIVE); } 544 "SharedAndWake" { count (0); return (PARSEOP_SHARETYPE_SHAREDWAKE); } /* ACPI 5.0 */ 545 "ExclusiveAndWake" { count (0); return (PARSEOP_SHARETYPE_EXCLUSIVEWAKE); } /* ACPI 5.0 */ 546 547 /* SlaveModeKeyword: Resource Descriptors (ACPI 5.0) */ 548 549 "ControllerInitiated" { count (0); return (PARSEOP_SLAVEMODE_CONTROLLERINIT); } 550 "DeviceInitiated" { count (0); return (PARSEOP_SLAVEMODE_DEVICEINIT); } 551 552 /* StopBitsKeyword: Resource Descriptors (ACPI 5.0) */ 553 554 "StopBitsOne" { count (0); return (PARSEOP_STOPBITS_ONE); } 555 "StopBitsOnePlusHalf" { count (0); return (PARSEOP_STOPBITS_ONEPLUSHALF); } 556 "StopBitsTwo" { count (0); return (PARSEOP_STOPBITS_TWO); } 557 "StopBitsZero" { count (0); return (PARSEOP_STOPBITS_ZERO); } 558 559 /* TransferWidthKeyword: DMA Widths - Fixed DMA Resource Descriptor (ACPI 5.0) */ 560 561 "Width8bit" { count (0); return (PARSEOP_XFERSIZE_8); } 562 "Width16bit" { count (0); return (PARSEOP_XFERSIZE_16); } 563 "Width32bit" { count (0); return (PARSEOP_XFERSIZE_32); } 564 "Width64bit" { count (0); return (PARSEOP_XFERSIZE_64); } 565 "Width128bit" { count (0); return (PARSEOP_XFERSIZE_128); } 566 "Width256bit" { count (0); return (PARSEOP_XFERSIZE_256); } 567 568 /* TranslationKeyword: Translation Density Types - Resource Descriptors */ 569 570 "SparseTranslation" { count (0); return (PARSEOP_TRANSLATIONTYPE_SPARSE); } 571 "DenseTranslation" { count (0); return (PARSEOP_TRANSLATIONTYPE_DENSE); } 572 573 /* TypeKeyword: Translation Types - Resource Descriptors */ 574 575 "TypeTranslation" { count (0); return (PARSEOP_TYPE_TRANSLATION); } 576 "TypeStatic" { count (0); return (PARSEOP_TYPE_STATIC); } 577 578 /* UpdateRuleKeyword: Field Update Rules */ 579 580 "Preserve" { count (0); return (PARSEOP_UPDATERULE_PRESERVE); } 581 "WriteAsOnes" { count (0); return (PARSEOP_UPDATERULE_ONES); } 582 "WriteAsZeros" { count (0); return (PARSEOP_UPDATERULE_ZEROS); } 583 584 /* WireModeKeyword: SPI Wire Mode - Resource Descriptors (ACPI 5.0) */ 585 586 "FourWireMode" { count (0); return (PARSEOP_WIREMODE_FOUR); } 587 "ThreeWireMode" { count (0); return (PARSEOP_WIREMODE_THREE); } 588 589 /* XferTypeKeyword: DMA Transfer Types */ 590 591 "Transfer8" { count (0); return (PARSEOP_XFERTYPE_8); } 592 "Transfer8_16" { count (0); return (PARSEOP_XFERTYPE_8_16); } 593 "Transfer16" { count (0); return (PARSEOP_XFERTYPE_16); } 594 595 /* Predefined compiler names */ 596 597 "__DATE__" { count (0); return (PARSEOP___DATE__); } 598 "__FILE__" { count (0); return (PARSEOP___FILE__); } 599 "__LINE__" { count (0); return (PARSEOP___LINE__); } 600 "__PATH__" { count (0); return (PARSEOP___PATH__); } 601 602 603 "{" { count (0); return('{'); } 604 "}" { count (0); return('}'); } 605 "," { count (0); return(','); } 606 "(" { count (0); return('('); } 607 ")" { count (0); return(')'); } 608 609 {NameSeg} { char *s; 610 count (0); 611 s=UtStringCacheCalloc (ACPI_NAME_SIZE + 1); 612 if (strcmp (AslCompilertext, "\\")) 613 { 614 strcpy (s, "____"); 615 AcpiUtStrupr (AslCompilertext); 616 } 617 memcpy (s, AslCompilertext, strlen (AslCompilertext)); 618 AslCompilerlval.s = s; 619 DbgPrint (ASL_PARSE_OUTPUT, "NameSeg: %s\n", s); 620 return (PARSEOP_NAMESEG); } 621 622 {NameString} { char *s; 623 count (0); 624 s=UtStringCacheCalloc (strlen (AslCompilertext)+1); 625 AcpiUtStrupr (AslCompilertext); 626 strcpy (s, AslCompilertext); 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 <contrib/dev/acpica/compiler/aslsupport.l> 654