example.bend checks
raw source on the hub · import bend-osdev-acpi@0.1.1.0/example.bend as Example
bend-osdev-acpi, example.bend: AcpiExample, a small x86 machine's tables built with this package's writers, for the tests and as a guide: an RSDP leading to an XSDT (and an RSDT), an FADT, FACS, MADT, HPET, MCFG, SRAT, SLIT, BGRT, an SSDT, and a DSDT in AML that has a PCI host bridge with _HID, _CID, _CRS and _PRT, an LPC bridge whose PIRQ routing registers are a PCI_Config field, a PCI interrupt link device whose _STA and _CRS read them (the CreateWordField pattern), an embedded controller with an EmbeddedControl region and a query method that sends a Notify, a thermal zone, a power button and a processor device. Its shape follows the examples of ACPI 6.5, sections 6.2.13 (_PRT), 6.4 (resource templates) and 11 (thermal zones).
20 imports
import Base import bend-osdev-word64@0.1.1.0/word64.bend as W import bend-osdev-bytes@0.1.1.0/bytes.bend as B import ./header.bend as H import ./rsdp.bend as P import ./rsdt.bend as S import ./fadt.bend as F import ./facs.bend as FS import ./gas.bend as G import ./madt.bend as M import ./hpet.bend as Hp import ./mcfg.bend as Mc import ./srat.bend as Sr import ./slit.bend as Sl import ./bgrt.bend as Bg import ./dsdt.bend as D import ./acpi.bend as A import ./aml_term.bend as T import ./aml_resource.bend as R import ./aml_host.bend as Hs
Types
type AcpiExamplePiece source · line 230 · raw
Data
each table as bytes, with its offset from the base
AcpiExamplePiece@offset:U32 -> @bytes:0xe0217e1ab38629fddf738452c1f2a82e/bytes.Octets -> AcpiExamplePiece
Definitions
def ex.hdr source · line 33 · raw
@s:String -> @r:U32 -> 0x62173b4e9e82dde7465c7018262f0baa/header.AcpiHeader
def ex.i source · line 36 · raw
@v:U32 -> 0x62173b4e9e82dde7465c7018262f0baa/aml_term.AmlTerm
def AcpiExample.rsdp_address source · line 40 · raw
0xea9c6e6209a3ac3fb21596f70f09f650/word64.W64
Physical addresses
def AcpiExample.base source · line 43 · raw
U32
def ex.at source · line 46 · raw
@off:U32 -> U32
def ex.at64 source · line 49 · raw
@+off:U32 -> 0xea9c6e6209a3ac3fb21596f70f09f650/word64.W64
def ex.xsdt source · line 53 · raw
U32
the offsets of the tables from the base
def ex.rsdt source · line 56 · raw
U32
def ex.fadt source · line 59 · raw
U32
def ex.facs source · line 62 · raw
U32
def ex.madt source · line 65 · raw
U32
def ex.hpet source · line 68 · raw
U32
def ex.mcfg source · line 71 · raw
U32
def ex.srat source · line 74 · raw
U32
def ex.slit source · line 77 · raw
U32
def ex.bgrt source · line 80 · raw
U32
def ex.ssdt source · line 83 · raw
U32
def ex.dsdt source · line 86 · raw
U32
def ex.lnk.crs source · line 91 · raw
List<&2, 0x62173b4e9e82dde7465c7018262f0baa/aml_term.AmlTerm>
def ex.lnka source · line 98 · raw
0x62173b4e9e82dde7465c7018262f0baa/aml_term.AmlTerm
def ex.pci.crs source · line 105 · raw
0xe0217e1ab38629fddf738452c1f2a82e/bytes.Octets
def ex.prt source · line 112 · raw
0x62173b4e9e82dde7465c7018262f0baa/aml_term.AmlTerm
def ex.ec source · line 118 · raw
0x62173b4e9e82dde7465c7018262f0baa/aml_term.AmlTerm
def ex.lpcb source · line 127 · raw
0x62173b4e9e82dde7465c7018262f0baa/aml_term.AmlTerm
def ex.pci0 source · line 134 · raw
0x62173b4e9e82dde7465c7018262f0baa/aml_term.AmlTerm
def ex.osys source · line 145 · raw
0x62173b4e9e82dde7465c7018262f0baa/aml_term.AmlTerm
def AcpiExample.dsdt_terms source · line 153 · raw
List<&2, 0x62173b4e9e82dde7465c7018262f0baa/aml_term.AmlTerm>
the DSDT's terms
def AcpiExample.dsdt_aml source · line 173 · raw
0xe0217e1ab38629fddf738452c1f2a82e/bytes.Octets
def AcpiExample.dsdt source · line 176 · raw
0x62173b4e9e82dde7465c7018262f0baa/dsdt.AcpiAml
def AcpiExample.ssdt source · line 180 · raw
0x62173b4e9e82dde7465c7018262f0baa/dsdt.AcpiAml
an SSDT that adds a device to a scope the DSDT defines
def ex.blocks source · line 187 · raw
0x62173b4e9e82dde7465c7018262f0baa/fadt.AcpiFadtBlocks
def ex.lens source · line 190 · raw
0x62173b4e9e82dde7465c7018262f0baa/fadt.AcpiFadtLens
def ex.io source · line 193 · raw
@+port:U32 -> @+len:U32 -> 0x62173b4e9e82dde7465c7018262f0baa/gas.AcpiGas
def AcpiExample.fadt source · line 196 · raw
0x62173b4e9e82dde7465c7018262f0baa/fadt.AcpiFadt
def AcpiExample.facs source · line 202 · raw
0x62173b4e9e82dde7465c7018262f0baa/facs.AcpiFacs
def AcpiExample.madt source · line 205 · raw
0x62173b4e9e82dde7465c7018262f0baa/madt.AcpiMadt
def AcpiExample.hpet source · line 208 · raw
0x62173b4e9e82dde7465c7018262f0baa/hpet.AcpiHpet
def AcpiExample.mcfg source · line 211 · raw
0x62173b4e9e82dde7465c7018262f0baa/mcfg.AcpiMcfg
def AcpiExample.srat source · line 214 · raw
0x62173b4e9e82dde7465c7018262f0baa/srat.AcpiSrat
def AcpiExample.slit source · line 217 · raw
0x62173b4e9e82dde7465c7018262f0baa/slit.AcpiSlit
def AcpiExample.bgrt source · line 220 · raw
0x62173b4e9e82dde7465c7018262f0baa/bgrt.AcpiBgrt
def AcpiExample.rsdp source · line 223 · raw
0x62173b4e9e82dde7465c7018262f0baa/rsdp.AcpiRsdp
def ex.listed source · line 226 · raw
List<&2, 0xea9c6e6209a3ac3fb21596f70f09f650/word64.W64>
def AcpiExample.pieces source · line 233 · raw
List<&2, AcpiExamplePiece>
def ex.lay source · line 248 · raw
@ps:List<&2, AcpiExamplePiece> -> @+at:Nat -> List<&2, 0xe0217e1ab38629fddf738452c1f2a82e/bytes.Octets>
the pieces laid out from offset at, zeros between them
def AcpiExample.region source · line 256 · raw
0xe0217e1ab38629fddf738452c1f2a82e/bytes.Octets
def AcpiExample.memory source · line 260 · raw
0x62173b4e9e82dde7465c7018262f0baa/acpi.AcpiMemImage
physical memory: the RSDP at 0xE0010, the tables from 0x100000
def AcpiExample.host source · line 266 · raw
0x62173b4e9e82dde7465c7018262f0baa/aml_host.AmlMemHost
the host the DSDT runs against: the LPC bridge's PIRQ registers (PCI config space of device 0x1F, from offset 0x60: PIRQA routed to IRQ 11, PIRQB disabled) and the EC's temperature byte (offset 0x10: 30 degrees)