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 an interpreter for the ACPI machine language
37 \f5amlinit() \f5amlexit()
38 The interpreter runtime state is initialized by calling
40 and frees all the resources when
43 The runtime state consists of objects organized in a global
44 namespace. The name object referred to by
46 is the root of that namespace.
48 .BI amlload( data , len )
50 populates the namespace with objects parsed from the
55 The pc kernel provides access to the ACPI tables through the
62 Objects are dynamically allocated and typed and are passed as
64 pointers. The type tag of an object can be determined with the
66 function. The following table shows the defined tags and ther
70 * b uchar* buffer amllen() returns number of bytes
71 * s char* string amllen() is strlen()
72 * n char* undefined name amllen() is strlen()
74 * p void** package amllen() is # of elements
83 .BI amlwalk( dot , name )
85 takes a path string (relative to
89 and returns the final name object of the walk; or
93 \f5amlenum(\fIdot\f5,\fIseg\f5,\fIproc\f5,\fIarg\f5)
95 recursively enumerates all child name objects of
99 as name; or any name if
109 returns zero, enumeration will continue recursively down
114 returns the value of a name, reference or field object.
117 on any other object yields the same object.
121 is defined for variable length objects like buffers, strings and packages.
122 For strings, the number of characters (not including the terminating null byte)
123 is returned. For buffers, the size of the buffer in bytes is returned.
124 For packages (arrays), the number of elements is returned. For any other
125 object types, the return value is undefined.
129 returns the integer value of an object. For strings, the string is interpreted
130 as an hexadecimal number. For buffers and buffer fields, the binary value is returned.
131 Integers just return their value. Any other object types yield zero.
133 .BI amlnew( tag , len )
134 Integer, buffer, string and package objects can be created with the
138 specific definition of the
140 parameter is the same as in
144 \f5amleval(\fIdot\f5,\fIfmt\f5,\fI...\f5)
146 evaluates the name object
148 For method evaluation, the
150 string parameter describes the arguments passed to the evaluated
151 method. Each character in
153 represents a tag for an method argument taken from the
154 variable argument list of
156 and passed to the method.
167 from the variable argument list and create object copies to
176 from the variable argument list and pass them as objects
177 by reference (without conversion or copies).
178 The last variable argument is a pointer to the result
179 object location. When the last parameter is
181 the result is discarded.
183 \f5amltake(\fIp\f5) \f5amldrop(\fIp\f5)
189 are subject to garbage collection during method evaluation
190 unless previously maked to be excluded from collection with
192 To remark an object for collection,
195 Objects stay valid as long as they are reachable from
199 The aml library can be linked into userspace programs and
200 and the kernel which have different means of hardware access
201 and memory constraints.
205 data structure defines access to a hardware space.
219 typedef struct Amlio Amlio;
229 int (*read)(Amlio *io, void *data, int len, int off);
230 int (*write)(Amlio *io, void *data, int len, int off);
241 are initialized by the interpreter and describe the I/O region
242 it needs access to. For memory regions,
244 can to be set to the virtual address mapping base by the
246 The interpreter will call the
250 function pointers with a relative offset to the regions
254 pointer can be used freely by the map function to attach its own
255 resources to the I/O region and allows it to free these resources
259 \f5amlmapio(\fIio\f5) \f5amlunmapio(\fIio\f5)
260 The interpreter calls
264 data structure that is to be filled out. When finished, the
267 with the same data structure to allow freeing resources.
271 is called by the interpreter with the number of microseconds
274 \f5amlalloc(\fIn\f5) \f5amlfree(\fIp\f5)
278 can be optionally defined to control dynamic memory allocation
279 providing a way to limit or pool the memory allocated by acpi.
280 If not provided, the library will use the functions
283 for dynamic allocation.