registry.bend checks
raw source on the hub · import bend-osdev-acpi@0.1.1.0/registry.bend as Registry
bend-osdev-acpi, registry.bend: tables by signature. A registry maps each signature to the parser that reads it; AcpiTable.parse checks a table (length, checksum: header.bend) and hands it to the parser its signature names. A new table plugs in two ways: map its signature to AcpiKRaw{} or to one of the parsers here (AcpiRegistry.set), or give it a tag, AcpiKExt{tag}, and pass a parser for it as the template argument of AcpiTable.parse_with, which answers that parser's own type in AcpiTExt.
13 imports
import Base import bend-osdev-bytes@0.1.1.0/bytes.bend as B import ./error.bend as E import ./header.bend as H import ./rsdt.bend as S import ./madt.bend as M import ./fadt.bend as F import ./hpet.bend as P import ./mcfg.bend as C import ./srat.bend as R import ./slit.bend as L import ./bgrt.bend as G import ./dsdt.bend as D
Types
type AcpiKind source · line 23 · raw
Data
the parsers a signature can name
AcpiKRsdtAcpiKind
AcpiKXsdtAcpiKind
AcpiKMadtAcpiKind
AcpiKFadtAcpiKind
AcpiKHpetAcpiKind
AcpiKMcfgAcpiKind
AcpiKSratAcpiKind
AcpiKSlitAcpiKind
AcpiKBgrtAcpiKind
AcpiKAmlAcpiKind
DSDT, SSDT: the AML definition block, as bytes
AcpiKRawAcpiKind
header and body, unread
AcpiKExt@tag:U32 -> AcpiKind
the caller's parser (AcpiTable.parse_with), told this tag
type AcpiRegEntry source · line 40 · raw
Data
AcpiRegEntry@signature:0xe0217e1ab38629fddf738452c1f2a82e/bytes.Octets -> @kind:AcpiKind -> AcpiRegEntry
type AcpiRegistry source · line 43 · raw
Data
AcpiRegistry@entries:List<&2, AcpiRegEntry> -> AcpiRegistry
type AcpiTable source · line 105 · raw
@-X:Data -> Data
A parsed table. X is the type the caller's extension parser answers (AcpiNoExt when there is none).
AcpiTRsdt@-X:Data -> @t:0x62173b4e9e82dde7465c7018262f0baa/rsdt.AcpiSdtList -> AcpiTable<X>
AcpiTXsdt@-X:Data -> @t:0x62173b4e9e82dde7465c7018262f0baa/rsdt.AcpiSdtList -> AcpiTable<X>
AcpiTMadt@-X:Data -> @t:0x62173b4e9e82dde7465c7018262f0baa/madt.AcpiMadt -> AcpiTable<X>
AcpiTFadt@-X:Data -> @t:0x62173b4e9e82dde7465c7018262f0baa/fadt.AcpiFadt -> AcpiTable<X>
AcpiTHpet@-X:Data -> @t:0x62173b4e9e82dde7465c7018262f0baa/hpet.AcpiHpet -> AcpiTable<X>
AcpiTMcfg@-X:Data -> @t:0x62173b4e9e82dde7465c7018262f0baa/mcfg.AcpiMcfg -> AcpiTable<X>
AcpiTSrat@-X:Data -> @t:0x62173b4e9e82dde7465c7018262f0baa/srat.AcpiSrat -> AcpiTable<X>
AcpiTSlit@-X:Data -> @t:0x62173b4e9e82dde7465c7018262f0baa/slit.AcpiSlit -> AcpiTable<X>
AcpiTBgrt@-X:Data -> @t:0x62173b4e9e82dde7465c7018262f0baa/bgrt.AcpiBgrt -> AcpiTable<X>
AcpiTAml@-X:Data -> @t:0x62173b4e9e82dde7465c7018262f0baa/dsdt.AcpiAml -> AcpiTable<X>
AcpiTRaw@-X:Data -> @t:0x62173b4e9e82dde7465c7018262f0baa/header.AcpiSdt -> AcpiTable<X>
AcpiTExt@-X:Data -> @tag:U32 -> @x:X -> AcpiTable<X>
type AcpiNoExt source · line 119 · raw
Data
AcpiNoExtAcpiNoExt
Definitions
def reg.e source · line 46 · raw
@s:String -> @k:AcpiKind -> AcpiRegEntry
def AcpiRegistry.default source · line 50 · raw
AcpiRegistry
every table this package reads
def AcpiRegistry.empty source · line 54 · raw
AcpiRegistry
no parsers: every table raw
def reg.lookup.pick source · line 57 · raw
@hit:Bool -> @k:AcpiKind -> @rest:AcpiKind -> AcpiKind
def reg.lookup source · line 64 · raw
@es:List<&2, AcpiRegEntry> -> @+sig:0xe0217e1ab38629fddf738452c1f2a82e/bytes.Octets -> AcpiKind
def AcpiRegistry.lookup source · line 72 · raw
@r:AcpiRegistry -> @+sig:0xe0217e1ab38629fddf738452c1f2a82e/bytes.Octets -> AcpiKind
the parser for a signature (AcpiKRaw{} if the registry has none)
def reg.keep source · line 77 · raw
@hit:Bool -> @e:AcpiRegEntry -> @rest:List<&2, AcpiRegEntry> -> List<&2, AcpiRegEntry>
def reg.drop source · line 84 · raw
@es:List<&2, AcpiRegEntry> -> @+sig:0xe0217e1ab38629fddf738452c1f2a82e/bytes.Octets -> List<&2, AcpiRegEntry>
def AcpiRegistry.set source · line 92 · raw
@r:AcpiRegistry -> @+sig:0xe0217e1ab38629fddf738452c1f2a82e/bytes.Octets -> @k:AcpiKind -> AcpiRegistry
the registry with sig mapped to k (replacing any earlier mapping)
def AcpiRegistry.remove source · line 98 · raw
@r:AcpiRegistry -> @+sig:0xe0217e1ab38629fddf738452c1f2a82e/bytes.Octets -> AcpiRegistry
the registry without sig (its tables then read raw)
def AcpiNoExt.parse source · line 123 · raw
@tag:U32 -> @t:0x62173b4e9e82dde7465c7018262f0baa/header.AcpiSdt -> Result<&2, &2, 0x62173b4e9e82dde7465c7018262f0baa/error.AcpiError, AcpiNoExt>
the extension parser of AcpiTable.parse: refuses every tag
def AcpiTable.parse source · line 181 · raw
@+reg:AcpiRegistry -> @+o:0xe0217e1ab38629fddf738452c1f2a82e/bytes.Octets -> Result<&2, &2, 0x62173b4e9e82dde7465c7018262f0baa/error.AcpiError, AcpiTable<AcpiNoExt>>
the same without extension parsers
Templates
template reg.wrap source · line 126 · raw
@-X:Data -> @-A:Data -> @-f:(@_:A -> AcpiTable<X>) -> @r:Result<&2, &2, 0x62173b4e9e82dde7465c7018262f0baa/error.AcpiError, A> -> Result<&2, &2, 0x62173b4e9e82dde7465c7018262f0baa/error.AcpiError, AcpiTable<X>>
template reg.ext source · line 133 · raw
@-X:Data -> @+tag:U32 -> @r:Result<&2, &2, 0x62173b4e9e82dde7465c7018262f0baa/error.AcpiError, X> -> Result<&2, &2, 0x62173b4e9e82dde7465c7018262f0baa/error.AcpiError, AcpiTable<X>>
template reg.dispatch source · line 140 · raw
@-X:Data -> @-ext:(@_:U32 -> @_:0x62173b4e9e82dde7465c7018262f0baa/header.AcpiSdt -> Result<&2, &2, 0x62173b4e9e82dde7465c7018262f0baa/error.AcpiError, X>) -> @k:AcpiKind -> @+t:0x62173b4e9e82dde7465c7018262f0baa/header.AcpiSdt -> Result<&2, &2, 0x62173b4e9e82dde7465c7018262f0baa/error.AcpiError, AcpiTable<X>>
template reg.go source · line 167 · raw
@-X:Data -> @-ext:(@_:U32 -> @_:0x62173b4e9e82dde7465c7018262f0baa/header.AcpiSdt -> Result<&2, &2, 0x62173b4e9e82dde7465c7018262f0baa/error.AcpiError, X>) -> @+reg:AcpiRegistry -> @r:Result<&2, &2, 0x62173b4e9e82dde7465c7018262f0baa/error.AcpiError, 0x62173b4e9e82dde7465c7018262f0baa/header.AcpiSdt> -> Result<&2, &2, 0x62173b4e9e82dde7465c7018262f0baa/error.AcpiError, AcpiTable<X>>
template AcpiTable.parse_with source · line 177 · raw
@-X:Data -> @-ext:(@_:U32 -> @_:0x62173b4e9e82dde7465c7018262f0baa/header.AcpiSdt -> Result<&2, &2, 0x62173b4e9e82dde7465c7018262f0baa/error.AcpiError, X>) -> @+reg:AcpiRegistry -> @+o:0xe0217e1ab38629fddf738452c1f2a82e/bytes.Octets -> Result<&2, &2, 0x62173b4e9e82dde7465c7018262f0baa/error.AcpiError, AcpiTable<X>>
the table at the front of o: checked (AcpiSdt.check: length and checksum), then read by the parser the registry names for its signature, with ext for AcpiKExt tags
template AcpiTable.name source · line 185 · raw
@-X:Data -> @t:AcpiTable<X> -> String
the name of the parser that read the table