aml_value.bend checks
raw source on the hub · import bend-osdev-acpi@0.1.2.0/aml_value.bend as Aml_value
bend-osdev-acpi, aml_value.bend: the values AML computes with (ACPI 6.5, section 19.3.5, ASL Data Types, and 19.3.5.7, Data Type Conversion Rules): integers (64 bits, or 32 in a definition block of revision below 2), strings, buffers, packages, and object references.
4 imports
import Base import bend-osdev-word64@0.1.1.1/word64.bend as W import bend-osdev-bytes@0.1.1.1/bytes.bend as B import ./error.bend as E
Types
type AmlLoc source · line 11 · raw
Data
Where a value lives, for Store, RefOf and Index
AmlLName@path:String -> AmlLoc
a named object, by its absolute path ("\_SB_.PCI0.FOO_")
AmlLLocal@i:Nat -> AmlLoc
AmlLArg@i:Nat -> AmlLoc
AmlLIndex@base:AmlLoc -> @i:Nat -> AmlLoc
element i of the buffer, string or package at a location
AmlLElem@v:AmlValue -> @i:Nat -> AmlLoc
element i of a value that has no location (Index of a temporary)
AmlLDebugAmlLoc
AmlLNoneAmlLoc
the NullName target: results stored there are dropped
type AmlValue source · line 24 · raw
Data
AmlUninitAmlValue
AmlInt@v:0xea9c6e6209a3ac3fb21596f70f09f650/word64.W64 -> AmlValue
AmlStr@s:0x15cc157649e26d54c7c549cb80d4a2a9/bytes.Octets -> AmlValue
a String (without its NUL)
AmlBuf@b:0x15cc157649e26d54c7c549cb80d4a2a9/bytes.Octets -> AmlValue
AmlPkg@xs:List<&2, AmlValue> -> AmlValue
AmlRef@loc:AmlLoc -> AmlValue
an object reference: RefOf, Index, or a name inside a package
AmlObj@path:String -> @kind:U32 -> AmlValue
a named object that holds no data (a device, a method, a region, ...) used as an operand: its path and ObjectType code
Definitions
def AmlValue.type source · line 41 · raw
@v:AmlValue -> U32
ObjectType codes (chapter 19, ObjectType): 0 uninitialized, 1 integer, 2 string, 3 buffer, 4 package, 5 field unit, 6 device, 7 event, 8 method, 9 mutex, 10 operation region, 11 power resource, 12 processor, 13 thermal zone, 14 buffer field, 16 debug object
def AmlInt.fit source · line 61 · raw
@wide:Bool -> @+v:0xea9c6e6209a3ac3fb21596f70f09f650/word64.W64 -> 0xea9c6e6209a3ac3fb21596f70f09f650/word64.W64
the low 32 bits only, when the block is 32-bit
def AmlInt.ones source · line 68 · raw
@wide:Bool -> 0xea9c6e6209a3ac3fb21596f70f09f650/word64.W64
def AmlInt.of_bool source · line 72 · raw
@+wide:Bool -> @b:Bool -> 0xea9c6e6209a3ac3fb21596f70f09f650/word64.W64
AML's True is Ones, False is Zero
def AmlInt.width_bytes source · line 79 · raw
@wide:Bool -> Nat
def val.le.go source · line 89 · raw
@n:Nat -> @xs:List<&2, U32> -> @+sh:Nat -> @acc:0xea9c6e6209a3ac3fb21596f70f09f650/word64.W64 -> 0xea9c6e6209a3ac3fb21596f70f09f650/word64.W64
up to n bytes, little-endian
def val.hexdig.pick source · line 100 · raw
@d:Bool -> @u:Bool -> @l:Bool -> @+c:U32 -> Maybe<&2, U32>
def val.hexdig source · line 115 · raw
@+c:U32 -> Maybe<&2, U32>
def val.decdig source · line 118 · raw
@+c:U32 -> Maybe<&2, U32>
def val.dig.head source · line 121 · raw
@hex:Bool -> @xs:List<&2, U32> -> Maybe<&2, U32>
def val.base source · line 130 · raw
@hex:Bool -> 0xea9c6e6209a3ac3fb21596f70f09f650/word64.W64
def val.digits source · line 140 · raw
@n:Nat -> @xs:List<&2, U32> -> @m:Maybe<&2, U32> -> @acc:0xea9c6e6209a3ac3fb21596f70f09f650/word64.W64 -> @+hex:Bool -> 0xea9c6e6209a3ac3fb21596f70f09f650/word64.W64
digits from the front of a string, up to the first other character or n digits; m: the first character's digit value
def val.hex.parse source · line 155 · raw
@+wide:Bool -> @+xs:List<&2, U32> -> 0xea9c6e6209a3ac3fb21596f70f09f650/word64.W64
def val.has0x source · line 158 · raw
@xs:List<&2, U32> -> Bool
def val.parse_int.pick source · line 165 · raw
@hex:Bool -> @+wide:Bool -> @+xs:List<&2, U32> -> 0xea9c6e6209a3ac3fb21596f70f09f650/word64.W64
def AmlValue.parse_int source · line 177 · raw
@+wide:Bool -> @+xs:List<&2, U32> -> 0xea9c6e6209a3ac3fb21596f70f09f650/word64.W64
a String as an Integer, as ToInteger reads it: hexadecimal after 0x, decimal otherwise
def AmlValue.to_int source · line 180 · raw
@+wide:Bool -> @v:AmlValue -> Result<&2, &2, 0x437a65a35fd0c02411bea19819f9b33f/error.AcpiError, 0xea9c6e6209a3ac3fb21596f70f09f650/word64.W64>
def val.int.bytes source · line 197 · raw
@wide:Bool -> @+x:0xea9c6e6209a3ac3fb21596f70f09f650/word64.W64 -> 0x15cc157649e26d54c7c549cb80d4a2a9/bytes.Octets
def AmlValue.to_buf source · line 206 · raw
@+wide:Bool -> @v:AmlValue -> Result<&2, &2, 0x437a65a35fd0c02411bea19819f9b33f/error.AcpiError, 0x15cc157649e26d54c7c549cb80d4a2a9/bytes.Octets>
the implicit conversion to Buffer: an integer's 8 (or 4) bytes, little-endian; a string's bytes and its NUL
def val.hex.digit.pick source · line 217 · raw
@lt:Bool -> @+d:U32 -> U32
def val.hex.digit source · line 226 · raw
@+d:U32 -> U32
def val.hex.text source · line 229 · raw
@n:Nat -> @+x:0xea9c6e6209a3ac3fb21596f70f09f650/word64.W64 -> @acc:List<&2, U32> -> List<&2, U32>
def val.buf.text source · line 236 · raw
@xs:List<&2, U32> -> @first:Bool -> List<&2, U32>
def AmlValue.to_str source · line 249 · raw
@+wide:Bool -> @v:AmlValue -> Result<&2, &2, 0x437a65a35fd0c02411bea19819f9b33f/error.AcpiError, 0x15cc157649e26d54c7c549cb80d4a2a9/bytes.Octets>
the implicit conversion to String: an integer as 16 (or 8) hex digits; a buffer as two hex digits per byte, separated by spaces
def val.cmp.then source · line 263 · raw
@prev:Cmp -> @c:Cmp -> Cmp
def val.cmp.go source · line 272 · raw
@xs:List<&2, U32> -> @ys:List<&2, U32> -> @prev:Cmp -> Cmp
def val.bytes.cmp source · line 283 · raw
@xs:List<&2, U32> -> @ys:List<&2, U32> -> Cmp
def AmlValue.compare source · line 287 · raw
@+wide:Bool -> @a:AmlValue -> @+b:AmlValue -> Result<&2, &2, 0x437a65a35fd0c02411bea19819f9b33f/error.AcpiError, Cmp>
the comparison of a with b, b converted to a's type
def val.lz.z source · line 301 · raw
@xs:List<&2, U32> -> Bool
def val.lz source · line 309 · raw
@xs:List<&2, U32> -> @still:Bool -> @z:Bool -> List<&2, U32>
leading zeros dropped (one kept); z: the head is a zero with more after it
def val.lower.pick source · line 324 · raw
@up:Bool -> @+h:U32 -> U32
def val.lower source · line 331 · raw
@xs:List<&2, U32> -> List<&2, U32>
def AmlValue.show_int source · line 338 · raw
@+x:0xea9c6e6209a3ac3fb21596f70f09f650/word64.W64 -> String
def val.sep source · line 342 · raw
@first:Bool -> String
def val.ref.show source · line 349 · raw
@l:AmlLoc -> String
def val.show.list source · line 366 · raw
@vs:List<&2, AmlValue> -> @+first:Bool -> String
def AmlValue.show source · line 387 · raw
@v:AmlValue -> String