NAME

amlalloc, amldrop, amlenum, amleval, amlexit, amlfree, amlinit, amlint, amllen, amlload, amlmapio, amlmicrodelay, amlnew, amltag, amltake, amlunmapio, amlval, amlwalk – ACPI interprter

SYNOPSIS

#include <u.h>
#include <aml.h>
enum {
MemSpace    = 0,
IoSpace          = 1,
PcicfgSpace      = 2,
EbctlSpace       = 3,
SmbusSpace       = 4,
CmosSpace = 5,
PcibarSpace      = 6,
IpmiSpace = 7,
};
typedef struct Amlio Amlio;
struct Amlio {
int    space;
uvlong      off;
uvlong      len;
void*       name;
uchar*      a;
void *aux;
int    (*read)(Amlio *io, void *data, int len, int off);
int    (*write)(Amlio *io, void *data, int len, int off);
};
int       amltag(void *p)
void*     amlval(void *p)
uvlong    amlint(void *p)
int       amllen(void *p)
void      amlnew(char type, int size)
void      amltake(void *p)
void      amldrop(void *p)
void      amlinit(void)
void      amlexit(void)
int       amlload(uchar *data, int len)
void*     amlwalk(void *dot, char *name)
int       amleval(void *dot, char *fmt, ...)
void      amlenum(void *dot, char *seg,
int (*proc)(void *, void *), void *arg)
void*     amlalloc(usize)
void      amlfree(void*)
void      amlmicrodelay(int µs)
int       amlmapio(Amlio *io)
void      amlunmapio(Amlio *io)

DESCRIPTION

Aml implements an interpreter for the ACPI Machine Language. ACPI is supposed to supplant older configuration and power management methods such as MP tables and APM. AML is used by 386 and AMD64 platform BIOS for things that are not part of the ACPI fixed description tables, such as interrupts. The aml interpreter usually runs in the kernel at boot time to parse interrupts, and other non–fixed configuration.
Aml provides access to the following AML object types.
L         L     L    –         –     –    LFB       L     L.    tag        type name    b         uchar*     buffer    s         char* string    n         char* undefined    name    i         uvlong*     integer    p         void**      package    r         void* region    f         void* field u         void* bufferfield N         void* name R         void* reference
amlload(data, len)
Start the interperter with the given AML code. For userspace, the kernel provides #P/acpitbls.
amlexit()
Terminate the interperter and free its resources
amlalloc(nbytes)
Provided by the caller. Allocate and clear nbytes.
amlfree(p)
Provided by the caller. Free memory allocated with amlalloc.
amltag(p)
Return the “tag” of the given AML object.
amlval(p)
Evaluate one level of indirection on AML object p.
amlint(p)
Return the value of the integer pointed to by p. P may have tag i or s. Objects of tag s are converted with strtoull (see atof(2)).
amllen(p)
Return the number of elements in p.
amlnew(type, size)
Create a new aml object of the given size and type.
amltake(p)
Exclude object from garbage collection.
amldrop(p)
Include previously excluded object in garbage collection.
amlwalk(dot, name)
Walk the aml heirarchy to name from the current position, dot.
amleval(dot, name)
Evaluate the method name from the corrent position, IR dot.
amlenum(dot, seg, procfn, arg)
Call function procfn(arg) for each matching object under dot.
amlmicrodelay(µs)
Delay for the given number of microseconds.
amlmapio(io)
Map the given region, and set function pointers for reading and writing.
amlunmapio(io)
Discard the previously mapped region.

SEE ALSO

http://www.acpi.info/DOWNLOADS/ACPIspec50.pdf

BUGS

A 32–bit little–endian machine is assumed.