~/bend-docscommunity

example.bend checks

raw source on the hub · import bend-osdev-acpi@0.1.2.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.1/word64.bend as W
import bend-osdev-bytes@0.1.1.1/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

Definitions

def ex.hdr source · line 33 · raw

@s:String -> @r:U32 -> 0x437a65a35fd0c02411bea19819f9b33f/header.AcpiHeader

def ex.i source · line 36 · raw

@v:U32 -> 0x437a65a35fd0c02411bea19819f9b33f/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, 0x437a65a35fd0c02411bea19819f9b33f/aml_term.AmlTerm>

def ex.lnka source · line 98 · raw

0x437a65a35fd0c02411bea19819f9b33f/aml_term.AmlTerm

def ex.pci.crs source · line 105 · raw

0x15cc157649e26d54c7c549cb80d4a2a9/bytes.Octets

def ex.prt source · line 112 · raw

0x437a65a35fd0c02411bea19819f9b33f/aml_term.AmlTerm

def ex.ec source · line 118 · raw

0x437a65a35fd0c02411bea19819f9b33f/aml_term.AmlTerm

def ex.lpcb source · line 127 · raw

0x437a65a35fd0c02411bea19819f9b33f/aml_term.AmlTerm

def ex.pci0 source · line 134 · raw

0x437a65a35fd0c02411bea19819f9b33f/aml_term.AmlTerm

def ex.osys source · line 145 · raw

0x437a65a35fd0c02411bea19819f9b33f/aml_term.AmlTerm

def AcpiExample.dsdt_terms source · line 153 · raw

List<&2, 0x437a65a35fd0c02411bea19819f9b33f/aml_term.AmlTerm>

the DSDT's terms

def AcpiExample.dsdt_aml source · line 173 · raw

0x15cc157649e26d54c7c549cb80d4a2a9/bytes.Octets

def AcpiExample.dsdt source · line 176 · raw

0x437a65a35fd0c02411bea19819f9b33f/dsdt.AcpiAml

def AcpiExample.ssdt source · line 180 · raw

0x437a65a35fd0c02411bea19819f9b33f/dsdt.AcpiAml

an SSDT that adds a device to a scope the DSDT defines

def ex.blocks source · line 187 · raw

0x437a65a35fd0c02411bea19819f9b33f/fadt.AcpiFadtBlocks

def ex.lens source · line 190 · raw

0x437a65a35fd0c02411bea19819f9b33f/fadt.AcpiFadtLens

def ex.io source · line 193 · raw

@+port:U32 -> @+len:U32 -> 0x437a65a35fd0c02411bea19819f9b33f/gas.AcpiGas

def AcpiExample.fadt source · line 196 · raw

0x437a65a35fd0c02411bea19819f9b33f/fadt.AcpiFadt

def AcpiExample.facs source · line 202 · raw

0x437a65a35fd0c02411bea19819f9b33f/facs.AcpiFacs

def AcpiExample.madt source · line 205 · raw

0x437a65a35fd0c02411bea19819f9b33f/madt.AcpiMadt

def AcpiExample.hpet source · line 208 · raw

0x437a65a35fd0c02411bea19819f9b33f/hpet.AcpiHpet

def AcpiExample.mcfg source · line 211 · raw

0x437a65a35fd0c02411bea19819f9b33f/mcfg.AcpiMcfg

def AcpiExample.srat source · line 214 · raw

0x437a65a35fd0c02411bea19819f9b33f/srat.AcpiSrat

def AcpiExample.slit source · line 217 · raw

0x437a65a35fd0c02411bea19819f9b33f/slit.AcpiSlit

def AcpiExample.bgrt source · line 220 · raw

0x437a65a35fd0c02411bea19819f9b33f/bgrt.AcpiBgrt

def AcpiExample.rsdp source · line 223 · raw

0x437a65a35fd0c02411bea19819f9b33f/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, 0x15cc157649e26d54c7c549cb80d4a2a9/bytes.Octets>

the pieces laid out from offset at, zeros between them

def AcpiExample.region source · line 256 · raw

0x15cc157649e26d54c7c549cb80d4a2a9/bytes.Octets

def AcpiExample.memory source · line 260 · raw

0x437a65a35fd0c02411bea19819f9b33f/acpi.AcpiMemImage

physical memory: the RSDP at 0xE0010, the tables from 0x100000

def AcpiExample.host source · line 266 · raw

0x437a65a35fd0c02411bea19819f9b33f/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)