3 amltag, amlval, amlint, amllen, amlnew, amlinit, amlexit, amlload, amlwalk, amleval, amlenum, amltake, amldrop - ACPI machine language interpreter
5 .\" .ta 0.75i 1.5i 2.25i 3i 3.75i 4.5i
6 .ta 0.7i +0.7i +0.7i +0.7i +0.7i +0.7i +0.7i
14 uvlong amlint(void *);
17 void* amlnew(char tag, int len);
22 int amlload(uchar *data, int len);
23 void* amlwalk(void *dot, char *name);
24 int amleval(void *dot, char *fmt, ...);
25 void amlenum(void *dot, char *seg, int (*proc)(void *, void *), void *arg);
34 The aml library implements a interpreter for the ACPI machine language
37 The interpreter runtime state is initialized by calling
39 and frees all the resources when
42 The runtime state consists of objects organized in a global
43 namespace. The name object refered by
45 is the root of that namespace.
48 populates the namespace with objects parsed from the
54 Objects are dynamically allocated and typed and are passed as
56 pointers. The type tag of an object can be determined with the
58 function. The following table shows the defined tags and ther
62 * b uchar* buffer amllen() returns number of bytes
63 * s char* string amllen() is strlen()
64 * n char* undefined name amllen() is strlen()
66 * p void** package amllen() is # of elements
84 takes a path string (relative or absolute)
85 and returns the final name object of the walk; or
89 recursively enumerates all child name objects of
93 as name; or any name if
103 returns zero, enumeration will continue recursively down
107 returns the value of a name, reference or field object.
110 on any other object yiedls the same object.
113 is defined for variable length objects like buffers, strings and packages.
114 For strings, the number of characters (not including terminating null byte)
115 is returned. For buffers, the size of the buffer in bytes is returned.
116 For packages (arrays), the number of elements is returned. For any other
117 object types, the return value is undefined.
120 returns the integer value of an object. For strings, the string is interpreted
121 as hexadecimal number. For buffers and buffer fields, the binary value is returned.
122 Integers just return ther value. Any other object types yield zero.
124 Integer, buffer, string and package objects can be created with the
128 specific definition of the
130 parameter is the same as in
135 evaluates the name object
137 For method evaluation, the
139 string parameter describes the arguments passed to the evaluated
140 method. Each character in
142 represents a tag for an method argument taken from the
143 variable argument list of
145 and passed to the method.
156 from the variable argument list and create object copies to
165 from the variable argument list and pass them as objects
166 by reference (without conversion or copies).
167 The last variable argument is a pointer to the result
168 object location. When the last parameter is
170 the result is discarded.
177 are subject to garbage collection during method evaluation
178 unless previously maked to be excluded from collection with
180 To remark an object for collection,
183 Objects stay valid as long as they are reachable from
187 extern void* amlalloc(int);
188 extern void amlfree(void*);
194 can be optionaly defined to control dynamic memory allocation
195 providing a way to limit or pool the memory allocated by acpi.
196 If not provided, the library will use the functions
199 for dynamic allocation.
201 The aml library can be linked into userspace programs and
202 and the kernel which have different means of hardware access.
205 extern void amldelay(int);
209 is called by the interpreter with the number of milliseconds it
213 extern int amlmapio(Amlio *io);
214 extern void amlunmapio(Amlio *io);
217 The interpreter calls
221 data structure that needs be filled out.
224 typedef struct Amlio Amlio;
234 int (*read)(Amlio *io, void *data, int len, int off);
235 int (*write)(Amlio *io, void *data, int len, int off);
246 are initialized by the interpreter and describe the I/O region
247 it needs access to. For memory regions,
249 can to be set to the virtual address mapping base by the
251 The interpreter will call the
255 function pointers with a relative offset to the regions
259 pointer can be used freely by the map function to attach its own
260 resources to the I/O region and allows it to free these resources
264 The following region types are defined by ACPI: