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);
35 The aml library implements an interpreter for the ACPI machine language
38 \f5amlinit() \f5amlexit()
39 The interpreter runtime state is initialized by calling
41 and frees all the resources when
44 The runtime state consists of objects organized in a global
45 namespace. The name object referred to by
47 is the root of that namespace.
49 The width of integers is defined by the global variable
51 which should be initialized to 0xFFFFFFFF for
53 revision <= 1 or 0xFFFFFFFFFFFFFFFF for
56 .BI amlload( data , len )
58 populates the namespace with objects parsed from the
63 The pc kernel provides access to the ACPI tables through the
70 Objects are dynamically allocated and typed and are passed as
72 pointers. The type tag of an object can be determined with the
74 function. The following table shows the defined tags and ther
78 * b uchar* buffer amllen() returns number of bytes
79 * s char* string amllen() is strlen()
80 * n char* undefined name amllen() is strlen()
82 * p void** package amllen() is # of elements
91 .BI amlwalk( dot , name )
93 takes a path string (relative to
97 and returns the final name object of the walk; or
101 \f5amlenum(\fIdot\f5,\fIseg\f5,\fIproc\f5,\fIarg\f5)
103 recursively enumerates all child name objects of
107 as name; or any name if
117 returns zero, enumeration will continue recursively down
122 returns the value of a name, reference or field object.
125 on any other object yields the same object.
129 is defined for variable length objects like buffers, strings and packages.
130 For strings, the number of characters (not including the terminating null byte)
131 is returned. For buffers, the size of the buffer in bytes is returned.
132 For packages (arrays), the number of elements is returned. For any other
133 object types, the return value is undefined.
137 returns the integer value of an object. For strings, the string is interpreted
138 as an hexadecimal number. For buffers and buffer fields, the binary value is returned.
139 Integers just return their value. Any other object types yield zero.
141 .BI amlnew( tag , len )
142 Integer, buffer, string and package objects can be created with the
146 specific definition of the
148 parameter is the same as in
152 \f5amleval(\fIdot\f5,\fIfmt\f5,\fI...\f5)
154 evaluates the name object
156 For method evaluation, the
158 string parameter describes the arguments passed to the evaluated
159 method. Each character in
161 represents a tag for an method argument taken from the
162 variable argument list of
164 and passed to the method.
175 from the variable argument list and create object copies to
184 from the variable argument list and pass them as objects
185 by reference (without conversion or copies).
186 The last variable argument is a pointer to the result
187 object location. When the last parameter is
189 the result is discarded.
191 \f5amltake(\fIp\f5) \f5amldrop(\fIp\f5)
197 are subject to garbage collection during method evaluation
198 unless previously maked to be excluded from collection with
200 To remark an object for collection,
203 Objects stay valid as long as they are reachable from
207 The aml library can be linked into userspace programs
208 and the kernel which have different means of hardware access
209 and memory constraints.
213 data structure defines access to a hardware space.
227 typedef struct Amlio Amlio;
237 int (*read)(Amlio *io, void *data, int len, int off);
238 int (*write)(Amlio *io, void *data, int len, int off);
249 are initialized by the interpreter and describe the I/O region
250 it needs access to. For memory regions,
252 can to be set to the virtual address mapping base by the
254 The interpreter will call the
258 function pointers with a relative offset to the regions
262 pointer can be used freely by the map function to attach its own
263 resources to the I/O region and allows it to free these resources
267 \f5amlmapio(\fIio\f5) \f5amlunmapio(\fIio\f5)
268 The interpreter calls
272 data structure that is to be filled out. When finished, the
275 with the same data structure to allow freeing resources.
279 is called by the interpreter with the number of microseconds
282 \f5amlalloc(\fIn\f5) \f5amlfree(\fIp\f5)
286 can be optionally defined to control dynamic memory allocation
287 providing a way to limit or pool the memory allocated by acpi.
288 If not provided, the library will use the functions
291 for dynamic allocation.