ACPICA: Difference between revisions
[unchecked revision] | [unchecked revision] |
No edit summary |
talk about integration of ACPICA |
||
Line 71: | Line 71: | ||
return AE_OK; |
return AE_OK; |
||
} |
} |
||
== Using ACPICA in your OS == |
|||
I didn't find any good description of integrating the ACPICA source code into an operating system, and the released package is basically just a bundle of C files with little organization. This is what I ended up having to do: |
|||
# I copied the C files from dispatcher/, events/, executer/, hardware/, parser/, namespace/, utilities/, tables/, and resources/ into a single acpi folder. |
|||
# I copied the header files from include/ |
|||
# I created my own header file based on aclinux.h where I ripped out all of the userspace stuff, then I changed around the rest to be appropriate to my OS's definitions. |
|||
# I edited the include/platform/acenv.h file to remove the inclusion of aclinux.h and included my header file instead. |
|||
# I copied over acenv.h, acgcc.h, and my header file over to my include/platform/ folder. |
|||
This is in addition to writing an AcpiOs interface layer, and it is not well indicated by the reference manual that you have to actually edit header files. Many of the macros defined in the headers are documented, though. |
|||
== External links == |
== External links == |
Revision as of 01:43, 20 July 2009
The ACPI Component Architecture ACPICA provides an operating system (OS)-independent reference implementation of the Advanced Configuration and Power Interface. It can be adapted to any host OS. The ACPICA code is meant to be directly integrated into the host OS, as a kernel-resident subsystem. Hosting the ACPICA requires no changes to the core ACPICA code. However, it does require a small OS-specific interface layer, which must be written specifically for each host OS.
The complexity of the ACPI specification leads to a lengthy and difficult implementation in OS software. The purpose of the ACPI Component Architecture is to simplify ACPI implementations for operating system vendors (OSVs) by providing major portions of an ACPI implementation in OS-independent ACPI modules that can be easily integrated into any OS.
As said before you need to implement yourself few functions that are part of the OS interface layer. Here are those functions:
OS Layer
There are about 25-30 functions to be implemented:
AcpiOsAllocate
Prototype
void *AcpiOsAllocate(ACPI_SIZE Size);
Description
Dinamically allocate memory in the heap. Return NULL on error or end of memory.
Example
void *AcpiOsAllocate(ACPI_SIZE Size) { return malloc(Size); }
AcpiOsFree
Prototype
void AcpiOsFree(void *Memory);
Description
Free previously dinamically allocated memory
Example
void AcpiOsFree(void *Memory) { free(Memory); }
AcpiOsPrintf
Prototype
void ACPI_INTERNAL_VAR_XFACE AcpiOsPrintf(const char *Format, ...);
Description
Print formatted string
Example
void ACPI_INTERNAL_VAR_XFACE AcpiOsPrintf(const char *Format, ...) { va_list args; va_start(args, Format); printf(Format, args); va_end(args); }
AcpiOsPrintf
Prototype
void ACPI_INTERNAL_VAR_XFACE AcpiOsVprintf(const char *Format, va_list Args);
Description
Print formatted using va_list as argument list.
Example
void ACPI_INTERNAL_VAR_XFACE AcpiOsVprintf(const char *Format, va_list Args) { printf(Format, Args); }
AcpiOsInitialize
Prototype
ACPI_STATUS AcpiOsInitialize(void);
Description
This is called by the ACPI Subsystem during initialization.
Example
ACPI_STATUS AcpiOsInitialize() { return AE_OK; }
AcpiOsTerminate
Prototype
ACPI_STATUS AcpiOsTerminate(void);
Description
This is called by the ACPI Subsystem during termination.
Example
ACPI_STATUS AcpiOsTerminate() { return AE_OK; }
Using ACPICA in your OS
I didn't find any good description of integrating the ACPICA source code into an operating system, and the released package is basically just a bundle of C files with little organization. This is what I ended up having to do:
- I copied the C files from dispatcher/, events/, executer/, hardware/, parser/, namespace/, utilities/, tables/, and resources/ into a single acpi folder.
- I copied the header files from include/
- I created my own header file based on aclinux.h where I ripped out all of the userspace stuff, then I changed around the rest to be appropriate to my OS's definitions.
- I edited the include/platform/acenv.h file to remove the inclusion of aclinux.h and included my header file instead.
- I copied over acenv.h, acgcc.h, and my header file over to my include/platform/ folder.
This is in addition to writing an AcpiOs interface layer, and it is not well indicated by the reference manual that you have to actually edit header files. Many of the macros defined in the headers are documented, though.
External links
- ACPICA Website
- ACPICA Programmer Reference. Explains how to integrate it in your OS.