123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504 |
- /*++
- Copyright (c) 2012 Minoca Corp. All Rights Reserved
- Module Name:
- amlos.h
- Abstract:
- This header contains definitions for operating system support functions
- provided to the ACPI AML interpreter and namespace.
- Author:
- Evan Green 13-Nov-2012
- --*/
- //
- // ------------------------------------------------------------------- Includes
- //
- //
- // ---------------------------------------------------------------- Definitions
- //
- //
- // Define ACPI parameter 1 crash codes.
- //
- #define ACPI_CRASH_FATAL_INSTRUCTION 0x00000001
- #define ACPI_CRASH_GLOBAL_LOCK_FAILURE 0x00000002
- //
- // Define the acquire mutex wait value that specifies to wait indefinitely.
- //
- #define ACPI_MUTEX_WAIT_INDEFINITELY 0xFFFF
- //
- // ------------------------------------------------------ Data Type Definitions
- //
- //
- // -------------------------------------------------------------------- Globals
- //
- //
- // -------------------------------------------------------- Function Prototypes
- //
- KSTATUS
- AcpipInitializeOperatingSystemAmlSupport (
- VOID
- );
- /*++
- Routine Description:
- This routine initializes operating system specific support for the AML
- interpreter.
- Arguments:
- None.
- Return Value:
- Status code.
- --*/
- PVOID
- AcpipAllocateMemory (
- ULONG Size
- );
- /*++
- Routine Description:
- This routine allocates memory from the operating system for the ACPI
- interpreter and namespace.
- Arguments:
- Size - Supplies the size of the allocation, in bytes.
- Return Value:
- Returns a pointer to the allocated memory on success.
- NULL on failure.
- --*/
- VOID
- AcpipFreeMemory (
- PVOID Allocation
- );
- /*++
- Routine Description:
- This routine frees memory allocated for the ACPI AML interpreter and
- namespace.
- Arguments:
- Allocation - Supplies a pointer to the allocated memory.
- Return Value:
- None.
- --*/
- VOID
- AcpipFatalError (
- ULONGLONG Parameter1,
- ULONGLONG Parameter2,
- ULONGLONG Parameter3,
- ULONGLONG Parameter4
- );
- /*++
- Routine Description:
- This routine takes the system down as gracefully as possible.
- Arguments:
- Parameter1 - Supplies an optional parameter.
- Parameter2 - Supplies an optional parameter.
- Parameter3 - Supplies an optional parameter.
- Parameter4 - Supplies an optional parameter.
- Return Value:
- This function does not return.
- --*/
- VOID
- AcpipSleep (
- ULONG Milliseconds
- );
- /*++
- Routine Description:
- This routine delays the current thread's execution by at least the given
- number of milliseconds (the delays can be significantly longer). During this
- time, other threads will run.
- Arguments:
- Milliseconds - Supplies the minimum number of milliseconds to delay.
- Return Value:
- None.
- --*/
- VOID
- AcpipBusySpin (
- ULONG Microseconds
- );
- /*++
- Routine Description:
- This routine stalls the current processor by the given number of
- microseconds. This routine busy spins, unless preemption occurs no other
- threads will run during this delay.
- Arguments:
- Microseconds - Supplies the minimum number of microseconds to delay.
- Return Value:
- None.
- --*/
- ULONGLONG
- AcpipGetTimerValue (
- );
- /*++
- Routine Description:
- This routine returns a monotomically non-decreasing value representing the
- number of hundred nanosecond units that have elapsed since some epoch in
- the past (could be system boot).
- Arguments:
- None.
- Return Value:
- Returns the number of hundred nanosecond units (10^-7 seconds) that have
- elapsed.
- --*/
- PVOID
- AcpipCreateMutex (
- ULONG SyncLevel
- );
- /*++
- Routine Description:
- This routine creates an operating system mutex object to back an ACPI mutex
- used in the AML interpreter.
- Arguments:
- SyncLevel - Supplies the ACPI-defined sync level of the mutex.
- Return Value:
- Returns a pointer to the mutex object on success.
- NULL on failure.
- --*/
- VOID
- AcpipDestroyMutex (
- PVOID Mutex
- );
- /*++
- Routine Description:
- This routine destroys an operating system mutex object.
- Arguments:
- Mutex - Supplies a pointer to the OS mutex object returned during the
- create mutex routine.
- Return Value:
- None.
- --*/
- BOOL
- AcpipAcquireMutex (
- PAML_EXECUTION_CONTEXT Context,
- PVOID Mutex,
- ULONG TimeoutInMilliseconds
- );
- /*++
- Routine Description:
- This routine attempts to acquire a mutex object.
- Arguments:
- Context - Supplies a pointer to the execution context.
- Mutex - Supplies a pointer to the mutex to acquire.
- TimeoutInMilliseconds - Supplies the number of milliseconds to wait before
- returning anyway and timing out (failing the acquire).
- Return Value:
- TRUE if the timeout occurred and the mutex was not acquired.
- FALSE if the mutex was successfully acquired.
- --*/
- VOID
- AcpipReleaseMutex (
- PAML_EXECUTION_CONTEXT Context,
- PVOID Mutex
- );
- /*++
- Routine Description:
- This routine releases an acquired mutex object. This object must have been
- successfully acquired using the acquire routine.
- Arguments:
- Context - Supplies a pointer to the execution context.
- Mutex - Supplies a pointer to the mutex to release.
- Return Value:
- None.
- --*/
- PVOID
- AcpipCreateEvent (
- );
- /*++
- Routine Description:
- This routine creates an operating system event object to back an ACPI Event
- used in the AML interpreter.
- Arguments:
- None.
- Return Value:
- Returns a pointer to the event object on success.
- NULL on failure.
- --*/
- VOID
- AcpipDestroyEvent (
- PVOID Event
- );
- /*++
- Routine Description:
- This routine destroys an operating system event object.
- Arguments:
- Event - Supplies a pointer to the OS event object returned during the
- create event routine.
- Return Value:
- None.
- --*/
- BOOL
- AcpipWaitForEvent (
- PVOID Event,
- ULONG TimeoutInMilliseconds
- );
- /*++
- Routine Description:
- This routine waits at least the specified number of milliseconds for the
- given event object.
- Arguments:
- Event - Supplies a pointer to the event to wait for.
- TimeoutInMilliseconds - Supplies the number of milliseconds to wait before
- returning anyway and timing out (failing the wait).
- Return Value:
- TRUE if the timeout occurred and the event was not acquired.
- FALSE if execution continued because the event was signaled.
- --*/
- VOID
- AcpipSignalEvent (
- PVOID Event
- );
- /*++
- Routine Description:
- This routine signals an event, releasing all parties waiting on it.
- Arguments:
- Event - Supplies a pointer to the event to signal.
- Return Value:
- None.
- --*/
- VOID
- AcpipResetEvent (
- PVOID Event
- );
- /*++
- Routine Description:
- This routine resets an event back to its unsignaled state, causing any
- party who subsequently waits on this event to block.
- Arguments:
- Event - Supplies a pointer to the event to unsignal.
- Return Value:
- None.
- --*/
- KSTATUS
- AcpipNotifyOperatingSystem (
- PACPI_OBJECT Object,
- ULONGLONG NotificationValue
- );
- /*++
- Routine Description:
- This routine is called by executing AML code to notify the operating system
- of something.
- Arguments:
- Object - Supplies the object generating the notification. This object will
- be of type Processor, Thermal Zone, or Device.
- NotificationValue - Supplies the type of notification being sent.
- Return Value:
- Status code.
- --*/
- VOID
- AcpipAcquirePciLock (
- );
- /*++
- Routine Description:
- This routine acquires the PCI lock, used to synchronize early access to
- PCI configuration space with the PCI driver actually coming online.
- Arguments:
- None.
- Return Value:
- None.
- --*/
- VOID
- AcpipReleasePciLock (
- );
- /*++
- Routine Description:
- This routine releases the PCI lock, used to synchronize early access to
- PCI configuration space with the PCI driver actually coming online.
- Arguments:
- None.
- Return Value:
- None.
- --*/
|