aml_resource.bend checks
raw source on the hub · import bend-osdev-acpi@0.1.2.0/aml_resource.bend as Aml_resource
bend-osdev-acpi, aml_resource.bend: resource data types (ACPI 6.5, section 6.4), what _CRS, _PRS and _SRS buffers hold. A resource template is a run of descriptors ending with an End Tag:
small (bit 7 clear): a byte holding the type (bits 6-3) and the length (bits 2-0), then that many bytes. Read here: IRQ (type 4, 6.4.2.1), DMA (5, 6.4.2.2), I/O port (8, 6.4.2.5), fixed I/O (9, 6.4.2.6), End Tag (15) large (bit 7 set): the type in bits 6-0, a 2-byte length, then that many bytes. Read here: 32-bit memory range (5, 6.4.3.3), 32-bit fixed memory range (6, 6.4.3.4), DWord, Word and QWord address space (7, 8, 10: 6.4.3.5.1-3), extended interrupt (9, 6.4.3.6)
Every other descriptor is kept as AmlROther with its tag and bytes.
5 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 import ./fields.bend as F
Types
type AmlResource source · line 21 · raw
Data
AmlRIrq@mask:U32 -> @flags:U32 -> AmlResource
IRQ: the mask of IRQs 0-15, and the flags byte (0x01 if absent: edge, active high)
AmlRDma@mask:U32 -> @flags:U32 -> AmlResource
AmlRIo@decode:U32 -> @min:U32 -> @max:U32 -> @align:U32 -> @len:U32 -> AmlResource
I/O port: decode (1: 16-bit), minimum and maximum base, alignment, length
AmlRFixedIo@base:U32 -> @len:U32 -> AmlResource
AmlRMem32@writable:U32 -> @min:U32 -> @max:U32 -> @align:U32 -> @len:U32 -> AmlResource
32-bit memory: write status (1: writable), minimum and maximum base, alignment, length
AmlRMem32Fixed@writable:U32 -> @base:U32 -> @len:U32 -> AmlResource
AmlRAddr@width:U32 -> @kind:U32 -> @flags:U32 -> @tflags:U32 -> @range:AmlRange -> AmlResource
an address space descriptor (DWord, Word or QWord: width 32, 16, 64): resource type (0 memory, 1 I/O, 2 bus number), general flags, type specific flags, then granularity, minimum, maximum, translation offset and length, in an address-range record
AmlRExtIrq@flags:U32 -> @irqs:List<&2, U32> -> AmlResource
extended interrupt: flags (bit 0 consumer, 1 edge, 2 active low, 3 shared, 4 wake capable) and the interrupt numbers
AmlROther@tag:U32 -> @data:0x15cc157649e26d54c7c549cb80d4a2a9/bytes.Octets -> AmlResource
type AmlRange source · line 44 · raw
Data
AmlRange@gran:0xea9c6e6209a3ac3fb21596f70f09f650/word64.W64 -> @min:0xea9c6e6209a3ac3fb21596f70f09f650/word64.W64 -> @max:0xea9c6e6209a3ac3fb21596f70f09f650/word64.W64 -> @tra:0xea9c6e6209a3ac3fb21596f70f09f650/word64.W64 -> @len:0xea9c6e6209a3ac3fb21596f70f09f650/word64.W64 -> AmlRange
type AmlResNext source · line 129 · raw
Data
AmlResMore@res:AmlResource -> @rest:0x15cc157649e26d54c7c549cb80d4a2a9/bytes.Octets -> AmlResNext
AmlResEndAmlResNext
Definitions
def res.u.go source · line 50 · raw
@+w:Nat -> @+d:0x15cc157649e26d54c7c549cb80d4a2a9/bytes.Octets -> @+i:Nat -> 0xea9c6e6209a3ac3fb21596f70f09f650/word64.W64
def res.u source · line 59 · raw
@+d:0x15cc157649e26d54c7c549cb80d4a2a9/bytes.Octets -> @+i:Nat -> @+w:Nat -> 0xea9c6e6209a3ac3fb21596f70f09f650/word64.W64
def res.addr source · line 63 · raw
@+bits:U32 -> @+w:Nat -> @+d:0x15cc157649e26d54c7c549cb80d4a2a9/bytes.Octets -> AmlResource
an address space descriptor whose fields are w bytes wide
def res.irqs source · line 66 · raw
@n:Nat -> @+d:0x15cc157649e26d54c7c549cb80d4a2a9/bytes.Octets -> @+i:Nat -> List<&2, U32>
def res.irq.flags.pick source · line 73 · raw
@has:Bool -> @+d:0x15cc157649e26d54c7c549cb80d4a2a9/bytes.Octets -> U32
def res.irq.flags source · line 80 · raw
@+d:0x15cc157649e26d54c7c549cb80d4a2a9/bytes.Octets -> U32
def res.small source · line 83 · raw
@+t:Nat -> @+d:0x15cc157649e26d54c7c549cb80d4a2a9/bytes.Octets -> AmlResource
def res.min.small source · line 97 · raw
@+t:Nat -> Nat
the minimum lengths of the descriptors read
def res.min.large source · line 110 · raw
@+t:Nat -> Nat
def res.small.end source · line 133 · raw
@end:Bool -> @+t:Nat -> @+n:Nat -> @+o:0x15cc157649e26d54c7c549cb80d4a2a9/bytes.Octets -> Result<&2, &2, 0x437a65a35fd0c02411bea19819f9b33f/error.AcpiError, AmlResNext>
def res.small.fit source · line 140 · raw
@ok:Bool -> @+t:Nat -> @+n:Nat -> @+o:0x15cc157649e26d54c7c549cb80d4a2a9/bytes.Octets -> Result<&2, &2, 0x437a65a35fd0c02411bea19819f9b33f/error.AcpiError, AmlResNext>
def res.small.go source · line 147 · raw
@+t:Nat -> @+n:Nat -> @+o:0x15cc157649e26d54c7c549cb80d4a2a9/bytes.Octets -> Result<&2, &2, 0x437a65a35fd0c02411bea19819f9b33f/error.AcpiError, AmlResNext>
def res.show.irqs source · line 152 · raw
@xs:List<&2, U32> -> List<&2, String>
def AmlResource.show source · line 159 · raw
@r:AmlResource -> String
def res.b source · line 183 · raw
@xs:List<&2, U32> -> 0x15cc157649e26d54c7c549cb80d4a2a9/bytes.Octets
def res.w.go source · line 186 · raw
@+n:Nat -> @+v:0xea9c6e6209a3ac3fb21596f70f09f650/word64.W64 -> 0x15cc157649e26d54c7c549cb80d4a2a9/bytes.Octets
def res.w source · line 195 · raw
@+width:U32 -> @+v:0xea9c6e6209a3ac3fb21596f70f09f650/word64.W64 -> 0x15cc157649e26d54c7c549cb80d4a2a9/bytes.Octets
def res.lenc source · line 198 · raw
@+t:U32 -> @+d:0x15cc157649e26d54c7c549cb80d4a2a9/bytes.Octets -> 0x15cc157649e26d54c7c549cb80d4a2a9/bytes.Octets
def res.large source · line 201 · raw
@+t:Nat -> @+d:0x15cc157649e26d54c7c549cb80d4a2a9/bytes.Octets -> AmlResource
def res.large.fit source · line 218 · raw
@ok:Bool -> @+t:Nat -> @+n:Nat -> @+o:0x15cc157649e26d54c7c549cb80d4a2a9/bytes.Octets -> Result<&2, &2, 0x437a65a35fd0c02411bea19819f9b33f/error.AcpiError, AmlResNext>
def res.large.go source · line 225 · raw
@+t:Nat -> @+o:0x15cc157649e26d54c7c549cb80d4a2a9/bytes.Octets -> Result<&2, &2, 0x437a65a35fd0c02411bea19819f9b33f/error.AcpiError, AmlResNext>
def res.tag.pick source · line 229 · raw
@small:Bool -> @+b:U32 -> @+o:0x15cc157649e26d54c7c549cb80d4a2a9/bytes.Octets -> Result<&2, &2, 0x437a65a35fd0c02411bea19819f9b33f/error.AcpiError, AmlResNext>
def res.tag source · line 236 · raw
@+b:U32 -> @+o:0x15cc157649e26d54c7c549cb80d4a2a9/bytes.Octets -> Result<&2, &2, 0x437a65a35fd0c02411bea19819f9b33f/error.AcpiError, AmlResNext>
def res.step.pick source · line 239 · raw
@m:Maybe<&2, U32> -> @+o:0x15cc157649e26d54c7c549cb80d4a2a9/bytes.Octets -> Result<&2, &2, 0x437a65a35fd0c02411bea19819f9b33f/error.AcpiError, AmlResNext>
def res.step source · line 246 · raw
@+o:0x15cc157649e26d54c7c549cb80d4a2a9/bytes.Octets -> Result<&2, &2, 0x437a65a35fd0c02411bea19819f9b33f/error.AcpiError, AmlResNext>
def res.loop source · line 249 · raw
@fuel:Nat -> @r:Result<&2, &2, 0x437a65a35fd0c02411bea19819f9b33f/error.AcpiError, AmlResNext> -> @acc:List<&2, AmlResource> -> Result<&2, &2, 0x437a65a35fd0c02411bea19819f9b33f/error.AcpiError, List<&2, AmlResource>>
def AmlResource.parse source · line 265 · raw
@+o:0x15cc157649e26d54c7c549cb80d4a2a9/bytes.Octets -> Result<&2, &2, 0x437a65a35fd0c02411bea19819f9b33f/error.AcpiError, List<&2, AmlResource>>
the descriptors of a resource template, up to its End Tag (or its end); AcpiBadEntry for a descriptor shorter than its type needs or that runs past the buffer
def res.addr.tag.go source · line 268 · raw
@+n:Nat -> U32
def res.addr.tag source · line 277 · raw
@+width:U32 -> U32
def res.irqs.enc source · line 280 · raw
@xs:List<&2, U32> -> 0x15cc157649e26d54c7c549cb80d4a2a9/bytes.Octets
def res.other source · line 287 · raw
@small:Bool -> @+t:U32 -> @+d:0x15cc157649e26d54c7c549cb80d4a2a9/bytes.Octets -> 0x15cc157649e26d54c7c549cb80d4a2a9/bytes.Octets
def AmlResource.encode source · line 294 · raw
@r:AmlResource -> 0x15cc157649e26d54c7c549cb80d4a2a9/bytes.Octets
def res.enc.all source · line 315 · raw
@rs:List<&2, AmlResource> -> 0x15cc157649e26d54c7c549cb80d4a2a9/bytes.Octets
def AmlResource.template source · line 323 · raw
@rs:List<&2, AmlResource> -> 0x15cc157649e26d54c7c549cb80d4a2a9/bytes.Octets
a resource template: the descriptors, then the End Tag