AML(2)                                                     AML(2)

     NAME
          amltag, amlval, amlint, amllen, amlinit, amlexit, amlload,
          amlwalk, amleval, amlenum, amlalloc, amlfree - ACPI
          interprter

     SYNOPSIS
          #include <u.h>
          #include <aml.h>

          int     amltag(void *p)
          void*   amlval(void *p)
          uvlong  amlint(void *p)
          int     amllen(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*);

     DESCRIPTION
          Aml implements an interpreter for the ACPI machine language,
          AML.  ACPI is supposed to supplant older configuration meth-
          ods such as the MP tables and older power-management methods
          such as APM.  AML is used by 386 and AMD64 platform BIOS to
          things that are not part of the ACPI fixed description
          tables, such as interrupts.  When used, the aml interperter
          must run in the kernel to parse interrupts, etc. at boot
          time.

          Aml provides access to the following AML object types.

               L       L   L -       -   - LFB     L   L.
               tag     type      name b       uchar*    buffer
               s       char*     string 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, kernel provides #P/acpitbls.

          amlexit()
               Terminate the interperter and free its resources

          amlalloc(nbytes)

     Page 1                       Plan 9            (printed 12/21/24)

     AML(2)                                                     AML(2)

               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.

          amlwalk(dot, name)
               Walk the aml heirarchy to name from the current posi-
               tion, 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.

     SEE ALSO
     BUGS
          A 32-bit little-endian machine is assumed.

     Page 2                       Plan 9            (printed 12/21/24)