ACPICA: Difference between revisions
[unchecked revision] | [unchecked revision] |
Content deleted Content added
No edit summary |
|||
(18 intermediate revisions by 4 users not shown) | |||
Line 1:
{{ACPI}}
The ACPI Component Architecture '''ACPICA''' provides an operating system (OS)-independent reference implementation of the [[ACPI|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.
Line 21 ⟶ 23:
ACPI_PHYSICAL_ADDRESS AcpiOsGetRootPointer()
{
ACPI_PHYSICAL_ADDRESS
AcpiFindRootPointer(&Ret);
return Ret;
Line 48 ⟶ 49:
==== AcpiOsUnmapMemory ====
void AcpiOsUnmapMemory(void *where, ACPI_SIZE length)
Unmap pages mapped using AcpiOsMapMemory.
'''Note:''' for the last two functions you might need a separated heap.
==== AcpiOsGetPhysicalAddress ====
ACPI_STATUS AcpiOsGetPhysicalAddress(void *LogicalAddress, ACPI_PHYSICAL_ADDRESS *PhysicalAddress)
Line 71 ⟶ 73:
#define ACPI_USE_LOCAL_CACHE 1
=== Multithreading and Scheduling Services ===
To use all the features of ACPICA you need Scheduling support too.
==== AcpiOsGetThreadId ====
ACPI_THREAD_ID AcpiOsGetThreadId()
Line 78 ⟶ 80:
==== AcpiOsExecute ====
ACPI_STATUS AcpiOsExecute(ACPI_EXECUTE_TYPE Type, ACPI_OSD_EXEC_CALLBACK Function, void *Context)
Create a new
Function(Context);
==== AcpiOsSleep ====
void AcpiOsSleep(UINT64 Milliseconds)
Line 86 ⟶ 89:
void AcpiOsStall(UINT32 Microseconds)
Stall the thread for ''n'' microseconds. Note: this should not put the thread in the sleep queue. The thread should keep on running. Just looping.
=== Mutual Exclusion and Synchronization ===
Yes, you need Spinlocks, Mutexes and Semaphores too. Nobody said it was easy. :)
==== AcpiOsCreateMutex ====
ACPI_STATUS AcpiOsCreateMutex(ACPI_MUTEX *OutHandle)
Create space for a new
==== AcpiOsDeleteMutex ====
void AcpiOsDeleteMutex(ACPI_MUTEX Handle)
Line 97 ⟶ 102:
ACPI_STATUS AcpiOsAcquireMutex(ACPI_MUTEX Handle, UINT16 Timeout)
This would be silly too if not for the Timeout parameter. Timeout can be one of:
* 0: acquire the
* 1 - +inf: acquire the
* -1 (0xFFFF): acquire the
==== AcpiOsReleaseMutex ====
void AcpiOsReleaseMutex(ACPI_MUTEX Handle)
Line 105 ⟶ 111:
==== AcpiOsCreateSemaphore ====
ACPI_STATUS AcpiOsCreateSemaphore(UINT32 MaxUnits, UINT32 InitialUnits, ACPI_SEMAPHORE *OutHandle)
Create a new
==== AcpiOsDeleteSemaphore ====
ACPI_STATUS AcpiOsDeleteSemaphore(ACPI_SEMAPHORE Handle)
-_-
==== AcpiOsWaitSemaphore ====
ACPI_STATUS AcpiOsWaitSemaphore(ACPI_SEMAPHORE Handle, UINT32 Units, UINT16 Timeout)
Line 117 ⟶ 125:
==== AcpiOsCreateLock ====
ACPI_STATUS AcpiOsCreateLock(ACPI_SPINLOCK *OutHandle)
Create a new spinlock and put its address in *OutHandle. Spinlock should disable interrupts on the current
==== AcpiOsDeleteLock ====
void AcpiOsDeleteLock(ACPI_HANDLE Handle)
Line 126 ⟶ 135:
void AcpiOsReleaseLock(ACPI_SPINLOCK Handle, ACPI_CPU_FLAGS Flags)
Release the lock. ''Flags'' is the return value of AcquireLock. If you used this to store the interrupt state, now is the moment to use it.
=== Interrupt Handling ===
==== AcpiOsInstallInterruptHandler ====
Line 132 ⟶ 142:
If you're lucky, your IRQ manager uses handlers of this form:
uint32_t handler(void *);
In this case just assign the handler to the
#include <Irq.h>
ACPI_OSD_HANDLER ServiceRout;
Line 152 ⟶ 162:
==== AcpiOsRemoveInterruptHandler ====
ACPI_STATUS AcpiOsRemoveInterruptHandler(UINT32 InterruptNumber, ACPI_OSD_HANDLER Handler)
Just UnregisterIrq (InterruptNumber). Handler is provided in case you have an
== Using ACPICA in your OS ==
Line 166 ⟶ 177:
=== Visual Studio experience ===
From Visual Studio, although there is little organization in the files, it is relatively easy to port. In the provided
== Code Examples ==
Line 179 ⟶ 190:
== External links ==
*[
*[
[[Category:ACPI]]
|