Search code examples
operating-systemacpi

How can I compile, run AML with ACPI, or how should I utilize ACPI functions?


I'm trying to write a kernel and plan to use ACPI on some issues (e.g. identify interrupt source on APIC).

However, I'm really a beginner on this, I read the related documentation and still do not have any clue on how to configure and use ACPI functions.

I have some basic understanding that:

1, there are some ACPI tables will be mapped in memory space, within which DSDT and SSDT will provide some definition blocks.

2, The definition block are AML code

3, I can retrieve some information directly from ACPI tables (e.g. I/O APIC base address)

4, Further information some times need to run ACPI objects.

These are basically my understanding about ACPI. However, how should I use AML code, how should I run ACPI objects. I do not have a clue.

So if any one can provide a basic structure of how this mechanism works, how some basic functions provided by ACPI can be realized by OS??

Thanks a lot! I'll keep reading the documentation and try to find some thing that can help me on understanding it.


Solution

  • If you are working with linux, try the following (as root), it will give you a good start (you should install the distro relevant package, like acpica-tools):

    $acpidump > dump.bin
    
    $acpixtract -x dump.bin
    

    (this will create a binary file for each table in the initial dump file. lots of ".dat" file)

    $iasl -d *dat
    

    (this will disassemble the binary files to human readable format)

    you can also download intel's implementation for the iasl compiler from github (look it up. it is very easy to compile)