4 * This file contains examples of the extended error checking and
5 * typechecking capabilities of the iASL compiler. Other ASL compilers
6 * may ignore these errors completely. Note - this is not an exhaustive
7 * list of errors detected by iASL, it shows many of the errors that
8 * are not detected by other ASL compilers.
14 * Compilation complete. 45 Errors, 22 Warnings, 3 Remarks, 16 Optimizations
17 DefinitionBlock ("badcode.aml", "DSDT", 1, "Intel", "Example", 0x00000001)
20 Name (BUF1, Buffer() {0,1,2,3})
23 // Invalid SyncLevel in Mutex declaration
27 // Integer beyond the table integer size (32 bits)
29 Name (BIG, 0x1234567887654321)
31 // CPackage length does not match initializer list length
33 Name (PKG1, Package(5) {0,1})
35 // Inadvertent use of single backslash in a string
37 Name (PATH, Buffer() {"\_SB_.PCI2._CRS"})
39 // Invalid hex escape sequence
41 Name (ESC1, "abcdefg\x00hijklmn")
43 // Field access beyond region bounds
45 OperationRegion (OPR1, SystemMemory, 0x2000, 6)
46 Field (OPR1, DWordAcc, NoLock, Preserve)
52 // Some address spaces support only ByteAcc or BufferAcc
54 OperationRegion (OPR2, EmbeddedControl, 0x4000, 8)
55 Field (OPR2, DWordAcc, NoLock, Preserve)
59 OperationRegion (OPR3, SMBus, 0x8000, 16)
60 Field (OPR3, WordAcc, NoLock, Preserve)
65 // Invalid SyncLevel in method declaration
67 Method (MTH1, 0, NotSerialized, 32)
69 // Invalid arguments and uninitialized locals
72 Store (Local1, Local2)
74 // Parameter typechecking (MTX1 is invalid type)
76 Subtract (MTX1, 4, Local3)
78 // Various invalid parameters
80 CreateField (BUF1, 0, Subtract (4, 4), FLD1)
82 // Unchecked mutex and event timeouts
87 // Result from operation is not used - statement has no effect
99 // Switch with no Case statements
101 Switch (ToInteger (INT1))
108 if (LEqual (INT1, 0))
113 // Fallthrough exit path does not return a value
118 // Method MTH2 above does not always return a value
120 Store (MTH2 (), Local0)
123 // Method MTH4 does not explicitly return a value
126 Method (MTH5) {Store (MTH4(), Local0)}
128 // Invalid _HID values
132 Name (_HID, "*PNP0C0A") // Illegal leading asterisk
136 Name (_HID, "PNP") // Too short, must be 7 or 8 chars
140 Name (_HID, "MYDEVICE01") // Too long, must be 7 or 8 chars
144 Name (_HID, "acpi0001") // non-hex chars must be uppercase
148 Name (_HID, "PNP-123") // HID must be alphanumeric
152 Name (_HID, "") // Illegal Null HID
153 Name (_CID, "") // Illegal Null CID
156 // Predefined Name typechecking
159 Name (_FDI, Buffer () {0})
161 // Predefined Name argument count validation
162 // and return value validation
168 // Predefined Names that must be implemented as control methods
177 // GPE methods that cause type collision (L vs. E)
189 // Predefined names that should not have a return value
193 Return (Buffer(1){0x33})
197 Return ("Unexpected Return Value")
200 // _REG must have a corresponding Operation Region declaration
201 // within the same scope
211 * Resource Descriptor error checking
213 Name (RSC1, ResourceTemplate ()
215 // Illegal nested StartDependent macros
217 StartDependentFn (0, 0)
219 StartDependentFn (0, 0)
224 // Missing EndDependentFn macro
227 Name (RSC2, ResourceTemplate ()
229 // AddressMin is larger than AddressMax
231 0x07D0, // Range Minimum
232 0x03E8, // Range Maximum
237 // Length larger than Min/Max window size
239 0x00001000, // Range Minimum
240 0x00002000, // Range Maximum
241 0x00000004, // Alignment
242 0x00002000, // Length
245 // Min and Max not multiples of alignment value
247 0x00001001, // Range Minimum
248 0x00002002, // Range Maximum
249 0x00000004, // Alignment
250 0x00000200, // Length
253 // 10-bit ISA I/O address has a max of 0x3FF
259 // Invalid AccessSize parameter
263 0x0000000000000100, // Address
267 // Invalid ResourceType (0xB0)
268 QWordSpace (0xB0, ResourceConsumer, PosDecode, MinFixed, MaxFixed, 0xA5,
269 0x0000, // Granularity
270 0xA000, // Range Minimum
271 0xBFFF, // Range Maximum
272 0x0000, // Translation Offset
276 // AddressMin is larger than AddressMax
277 WordIO (ResourceProducer, MinFixed, MaxFixed, PosDecode, EntireRange,
278 0x0000, // Granularity
279 0x0200, // Range Minimum
280 0x0100, // Range Maximum
281 0x0000, // Translation Offset
285 // Length larger than Min/Max window size
286 DWordSpace (0xC3, ResourceConsumer, PosDecode, MinFixed, MaxFixed, 0xA5,
287 0x00000000, // Granularity
288 0x000C8000, // Range Minimum
289 0x000C9000, // Range Maximum
290 0x00000000, // Translation Offset
291 0x00001002, // Length
294 // Granularity must be (power-of-two -1)
295 DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxNotFixed, NonCacheable, ReadWrite,
302 // Address Min (with zero length) not on granularity boundary
303 QWordIO (ResourceProducer, MinFixed, MaxNotFixed, PosDecode, EntireRange,
304 0x0000000000000003, // Granularity
305 0x0000000000000B02, // Range Minimum
306 0x0000000000000C00, // Range Maximum
307 0x0000000000000000, // Translation Offset
308 0x0000000000000000, // Length
311 // Address Max (with zero length) not on (granularity boundary -1)
312 QWordMemory (ResourceProducer, PosDecode, MinNotFixed, MaxFixed, Cacheable, ReadWrite,
313 0x0000000000000001, // Granularity
314 0x0000000000100000, // Range Minimum
315 0x00000000002FFFFE, // Range Maximum
316 0x0000000000000000, // Translation Offset
317 0x0000000000000000, // Length
318 ,, , AddressRangeMemory, TypeStatic)
320 // Invalid combination: zero length, both Min and Max are fixed
321 DWordIO (ResourceProducer, MinFixed, MaxFixed, PosDecode, EntireRange,
322 0x00000000, // Granularity
323 0x000C8000, // Range Minimum
324 0x000C8FFF, // Range Maximum
325 0x00000000, // Translation Offset
326 0x00000000, // Length
329 // Invalid combination: non-zero length, Min Fixed, Max not fixed
330 DWordIO (ResourceProducer, MinFixed, MaxNotFixed, PosDecode, EntireRange,
331 0x00000001, // Granularity
332 0x000C8000, // Range Minimum
333 0x000C8FFF, // Range Maximum
334 0x00000000, // Translation Offset
335 0x00000100, // Length
338 // Invalid combination: non-zero length, Min not Fixed, Max fixed
339 DWordIO (ResourceProducer, MinNotFixed, MaxFixed, PosDecode, EntireRange,
340 0x00000001, // Granularity
341 0x000C8000, // Range Minimum
342 0x000C8FFF, // Range Maximum
343 0x00000000, // Translation Offset
344 0x00000200, // Length
347 // Granularity must be zero if non-zero length, min/max fixed
348 DWordIO (ResourceProducer, MinFixed, MaxFixed, PosDecode, EntireRange,
349 0x0000000F, // Granularity
350 0x000C8000, // Range Minimum
351 0x000C8FFF, // Range Maximum
352 0x00000000, // Translation Offset
353 0x00001000, // Length
356 // Null descriptor (intended to be modified at runtime) must
357 // have a resource tag (to allow it to be modified at runtime)
358 DWordIO (ResourceProducer, MinFixed, MaxFixed, PosDecode, EntireRange,
359 0x00000000, // Granularity
360 0x00000000, // Range Minimum
361 0x00000000, // Range Maximum
362 0x00000000, // Translation Offset
363 0x00000000, // Length
366 // Missing StartDependentFn macro
371 // Test descriptor for CreateXxxxField operators in REM1 below
373 Name (RSC3, ResourceTemplate ()
375 DWordIO (ResourceProducer, MinFixed, MaxFixed, PosDecode, EntireRange,
376 0x00000000, // Granularity
377 0x000C8000, // Range Minimum
378 0x000C8FFF, // Range Maximum
379 0x00000000, // Translation Offset
380 0x00001000, // Length
386 // Tagged resource field larger than field being created
388 CreateWordField (RSC3, \DWI1._LEN, LEN)
389 CreateByteField (RSC3, \DWI1._MIN, MIN)
390 CreateBitField (RSC3, \DWI1._RNG, RNG1)
392 // Tagged resource field smaller than field being created
394 CreateQWordField (RSC3, \DWI1._MAX, MAX)
395 CreateBitField (RSC3, \DWI1._GRA, GRA)
396 CreateField (RSC3, \DWI1._MIF, 5, MIF)
397 CreateField (RSC3, \DWI1._RNG, 3, RNG2)
402 /* Method Local is set but never used */