Page 1 of 1

ACPICA Table Early Access

Posted: Thu Jan 28, 2016 6:26 am
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.

Re: ACPICA Table Early Access

Posted: Thu Jan 28, 2016 7:02 am
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.