1 # bend-osdev-acpi, error.bend: why a table, an AML definition block or an 2 # AML evaluation was refused. One constructor per failure, so a caller can 3 # tell them apart. 4 import Base 5 import bend-osdev-word64@0.1.1.1/word64.bend as W 6 import bend-osdev-bytes@0.1.1.1/bytes.bend as B 7 8 type AcpiError is Data: 9 # Tables 10 11 # fewer bytes than the structure needs: need, got 12 AcpiTooShort{need: Nat, got: Nat} 13 # the signature is not the one the parser reads 14 AcpiBadSignature{got: B.Octets} 15 # a table's length field below its header, or past the bytes given 16 AcpiBadLength{length: U32} 17 # the bytes of a table do not sum to 0 mod 256 (the sum, mod 256) 18 AcpiBadChecksum{sum: U32} 19 # the RSDP's first 20 bytes do not sum to 0 mod 256 20 AcpiRsdpBadChecksum{sum: U32} 21 # the RSDP (revision 2 or later) does not sum to 0 mod 256 over its length 22 AcpiRsdpBadExtChecksum{sum: U32} 23 # a revision this parser does not read 24 AcpiBadRevision{revision: U32} 25 # a sub-structure (MADT, SRAT entry) at this offset in the table's body is 26 # shorter than 2 bytes, shorter than its type needs, or runs past the table 27 AcpiBadEntry{offset: Nat, kind: U32} 28 # a table's body does not hold what its fields say (an SLIT matrix that 29 # does not fit, an RSDT/XSDT body that is not a whole number of entries) 30 AcpiBadSize{size: Nat} 31 # the memory reader has no bytes at this physical address 32 AcpiNotMapped{address: W.W64} 33 # no table with this signature 34 AcpiTableMissing{signature: B.Octets} 35 36 # AML 37 38 # the definition block or a package ends inside a term 39 AcpiAmlTruncated{} 40 # an opcode this interpreter does not know (extended opcodes: 0x5B00 + op) 41 AcpiAmlBadOpcode{opcode: U32} 42 # a PkgLength with reserved bits set, or longer than its enclosing package 43 AcpiAmlBadPkgLength{} 44 # a NameString that is not well-formed 45 AcpiAmlBadName{} 46 # a name that does not resolve 47 AcpiAmlUndefined{path: String} 48 # a name defined twice in one scope 49 AcpiAmlDuplicate{path: String} 50 # an operand of the wrong kind (a statement where a value is needed, a 51 # value that cannot be converted, a reference where none can be taken) 52 AcpiAmlBadOperand{opcode: U32} 53 # an operation on an object of a type it does not take 54 AcpiAmlBadType{what: String} 55 # Index past the end of a buffer, string or package; a field outside its 56 # region or buffer 57 AcpiAmlRange{} 58 # Divide or Mod by zero 59 AcpiAmlDivZero{} 60 # Break or Continue outside While, Return outside a method 61 AcpiAmlBadControl{} 62 # a Fatal operator: type, code, argument 63 AcpiAmlFatal{kind: U32, code: U32, arg: W.W64} 64 # a construct this interpreter does not support (named in README.md) 65 AcpiAmlUnsupported{what: String} 66 # the step bound ran out before the evaluation finished 67 AcpiAmlStepLimit{} 68 # the operation-region host refused an access (its own code) 69 AcpiAmlHost{code: U32}