~/bend-docscommunity

registry.bend checks

raw source on the hub · import bend-osdev-acpi@0.1.0.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.0.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

type AcpiRegEntry source · line 40 · raw

Data

type AcpiRegistry source · line 43 · raw

Data

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).

type AcpiNoExt source · line 119 · raw

Data

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:0x9df7f91779a4a1c215bfa96cd0864601/bytes.Octets -> AcpiKind

def AcpiRegistry.lookup source · line 72 · raw

@r:AcpiRegistry -> @+sig:0x9df7f91779a4a1c215bfa96cd0864601/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:0x9df7f91779a4a1c215bfa96cd0864601/bytes.Octets -> List<&2, AcpiRegEntry>

def AcpiRegistry.set source · line 92 · raw

@r:AcpiRegistry -> @+sig:0x9df7f91779a4a1c215bfa96cd0864601/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:0x9df7f91779a4a1c215bfa96cd0864601/bytes.Octets -> AcpiRegistry

the registry without sig (its tables then read raw)

def AcpiNoExt.parse source · line 123 · raw

@tag:U32 -> @t:0x29fa0aa629b7afe02bc50bfd713bc39b/header.AcpiSdt -> Result<&2, &2, 0x29fa0aa629b7afe02bc50bfd713bc39b/error.AcpiError, AcpiNoExt>

the extension parser of AcpiTable.parse: refuses every tag

def AcpiTable.parse source · line 181 · raw

@+reg:AcpiRegistry -> @+o:0x9df7f91779a4a1c215bfa96cd0864601/bytes.Octets -> Result<&2, &2, 0x29fa0aa629b7afe02bc50bfd713bc39b/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, 0x29fa0aa629b7afe02bc50bfd713bc39b/error.AcpiError, A> -> Result<&2, &2, 0x29fa0aa629b7afe02bc50bfd713bc39b/error.AcpiError, AcpiTable<X>>

template reg.ext source · line 133 · raw

@-X:Data -> @+tag:U32 -> @r:Result<&2, &2, 0x29fa0aa629b7afe02bc50bfd713bc39b/error.AcpiError, X> -> Result<&2, &2, 0x29fa0aa629b7afe02bc50bfd713bc39b/error.AcpiError, AcpiTable<X>>

template reg.dispatch source · line 140 · raw

@-X:Data -> @-ext:(@_:U32 -> @_:0x29fa0aa629b7afe02bc50bfd713bc39b/header.AcpiSdt -> Result<&2, &2, 0x29fa0aa629b7afe02bc50bfd713bc39b/error.AcpiError, X>) -> @k:AcpiKind -> @+t:0x29fa0aa629b7afe02bc50bfd713bc39b/header.AcpiSdt -> Result<&2, &2, 0x29fa0aa629b7afe02bc50bfd713bc39b/error.AcpiError, AcpiTable<X>>

template reg.go source · line 167 · raw

@-X:Data -> @-ext:(@_:U32 -> @_:0x29fa0aa629b7afe02bc50bfd713bc39b/header.AcpiSdt -> Result<&2, &2, 0x29fa0aa629b7afe02bc50bfd713bc39b/error.AcpiError, X>) -> @+reg:AcpiRegistry -> @r:Result<&2, &2, 0x29fa0aa629b7afe02bc50bfd713bc39b/error.AcpiError, 0x29fa0aa629b7afe02bc50bfd713bc39b/header.AcpiSdt> -> Result<&2, &2, 0x29fa0aa629b7afe02bc50bfd713bc39b/error.AcpiError, AcpiTable<X>>

template AcpiTable.parse_with source · line 177 · raw

@-X:Data -> @-ext:(@_:U32 -> @_:0x29fa0aa629b7afe02bc50bfd713bc39b/header.AcpiSdt -> Result<&2, &2, 0x29fa0aa629b7afe02bc50bfd713bc39b/error.AcpiError, X>) -> @+reg:AcpiRegistry -> @+o:0x9df7f91779a4a1c215bfa96cd0864601/bytes.Octets -> Result<&2, &2, 0x29fa0aa629b7afe02bc50bfd713bc39b/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