ACPICA Table Early Access

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
songziming
Member
Member
Posts: 71
Joined: Fri Jun 28, 2013 1:48 am
Contact:

ACPICA Table Early Access

Post by songziming »

I compiled ACPICA into my kernel, and I'm using it to access ACPI tables during bootup, but I'm confused about memory allocation.

According to ''ACPICA Reference 1.7'', function AcpiInitializeTables can be used to initialize table component, using either pre-allocated buffer or dynamic memory.

Since my kernel init multiprocessor first and then dynamic memory, I have to statically allocate memory, my solution is:

Code: Select all

bool initialize_acpi_tables() {
    ACPI_TABLE_DESC acpi_tables[16];
    ACPI_STATUS status = AcpiInitializeTables(acpi_tables, 16, FALSE);
    if (ACPI_FAILURE(status)) {
        return false;
    }
    return true;
}
But is 16 entries enough (the demo code in ACPICA document uses 16 as size)? Besides, in my code ''acpi_tables'' is local variable, which is deleted after the function exists. However, my kernel can still locate MADT and HPET using ''AcpiGetTable'', I don't know why.
Reinventing the Wheel, code: https://github.com/songziming/wheel
User avatar
SpyderTL
Member
Member
Posts: 1074
Joined: Sun Sep 19, 2010 10:05 pm

Re: ACPICA Table Early Access

Post by SpyderTL »

My guess is because AcpiGetTable does not use your acpi_tables variable. It appears to be able to find tables on its own.
Project: OZone
Source: GitHub
Current Task: LIB/OBJ file support
"The more they overthink the plumbing, the easier it is to stop up the drain." - Montgomery Scott
Post Reply