def in.store.obj

bend-osdev-acpi@0.1.1.0 · aml_interp.bend:734

import bend-osdev-acpi@0.1.1.0/aml_interp.bend as AmlInterp
import Base
import bend-osdev-acpi@0.1.1.0/error.bend as E
import bend-osdev-acpi@0.1.1.0/aml_value.bend as V
import bend-osdev-acpi@0.1.1.0/aml_ns.bend as S
import bend-osdev-acpi@0.1.1.0/aml_host.bend as Hs

734# Store to a named object (chapter 19, Store): a Name converted to its type, a field
735# unit written through the host, a buffer field into its buffer
736def in.store.obj(~H: Data, ~io: H -> Hs.AmlHostOp -> Result<&2, &2, E.AcpiError, Hs.AmlHostAns<H>>, +w: AmlWorld<H>, +p: String, o: Maybe<&2, S.AmlObject>, +v: V.AmlValue) -> Result<&2, &2, E.AcpiError, AmlWorld<H>>:
737  match o:
738    case None{}:
739      Fail{E.AcpiAmlUndefined{p}}
740    case Some{S.AmlOData{old}}:
741      in.set.data(H, w, p, in.convert(in.wide(H, w), old, v))
742    case Some{S.AmlOField{r, +off, +bits, +flags}}:
743      in.field.wr(~H, ~io, Nat.is_le(bits, 64n), w, in.desc(AmlWorld.ns(H, w), r, off, bits, flags), v)
744    case Some{S.AmlOIndexField{i, d, +off, +bits, +flags}}:
745      in.ixfield.wr(~H, ~io, in.fdesc(S.AmlNs.get(AmlWorld.ns(H, w), i), AmlWorld.ns(H, w)), in.fdesc(S.AmlNs.get(AmlWorld.ns(H, w), d), AmlWorld.ns(H, w)), V.AmlValue.to_int(in.wide(H, w), v), in.ix.desc(AmlWorld.ns(H, w), off, bits, flags), w)
746    case Some{S.AmlOBufField{+l, +off, +bits}}:
747      in.bf.wr(H, w, l, in.read_data(H, w, l), off, bits, v)
748    case Some{obj}:
749      Fail{E.AcpiAmlBadType{"Store to an object that holds no data"}}

Uses (23)

Used by (2)