ACPICA: Difference between revisions

From OSDev.wiki
Jump to navigation Jump to search
[unchecked revision][unchecked revision]
Content deleted Content added
No edit summary
No edit summary
Line 50: Line 50:
void ACPI_INTERNAL_VAR_XFACE AcpiOsVprintf(const char *Format, va_list Args) {
void ACPI_INTERNAL_VAR_XFACE AcpiOsVprintf(const char *Format, va_list Args) {
printf(Format, 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;
}
}



Revision as of 13:12, 20 May 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;
}

External links