27.10.2015 Views

Advanced Configuration and Power Interface Specification

ACPI_6.0

ACPI_6.0

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>Advanced</strong> <strong>Configuration</strong> <strong>and</strong> <strong>Power</strong> <strong>Interface</strong> <strong>Specification</strong><br />

Table 5-41 Global Lock Structure within the FACS<br />

Field Bit Length Bit Offset Description<br />

Pending 1 0 Non-zero indicates that a request for ownership of the Global<br />

Lock is pending.<br />

Owned 1 1 Non-zero indicates that the Global Lock is Owned.<br />

Reserved 30 2 Reserved for future use.<br />

The following code sequence is used by both OSPM <strong>and</strong> the firmware to acquire ownership of the<br />

Global Lock. If non-zero is returned by the function, the caller has been granted ownership of the<br />

Global Lock <strong>and</strong> can proceed. If zero is returned by the function, the caller has not been granted<br />

ownership of the Global Lock, the “pending” bit has been set, <strong>and</strong> the caller must wait until it is<br />

signaled by an interrupt event that the lock is available before attempting to acquire access again.<br />

Note: In the examples that follow, the “GlobalLock” variable is a pointer that has been previously<br />

initialized to point to the 32-bit Global Lock location within the FACS.<br />

AcquireGlobalLock:<br />

mov ecx, GlobalLock ; ecx = Address of Global Lock in FACS<br />

acq10: mov eax, [ecx] ; Get current value of Global Lock<br />

mov edx, eax<br />

<strong>and</strong> edx, not 1 ; Clear pending bit<br />

bts edx, 1 ; Check <strong>and</strong> set owner bit<br />

adc edx, 0 ; If owned, set pending bit<br />

lock cmpxchg dword ptr[ecx], edx ; Attempt to set new value<br />

jnz short acq10<br />

; If not set, try again<br />

cmp dl, 3 ; Was it acquired or marked pending?<br />

sbb eax, eax ; acquired = -1, pending = 0<br />

ret<br />

The following code sequence is used by OSPM <strong>and</strong> the firmware to release ownership of the Global<br />

Lock. If non-zero is returned, the caller must raise the appropriate event to the other environment to<br />

signal that the Global Lock is now free. Depending on the environment, this signaling is done by<br />

setting the either the GBL_RLS or BIOS_RLS within their respective hardware register spaces. This<br />

signal only occurs when the other environment attempted to acquire ownership while the lock was<br />

owned.<br />

134 April, 2015 Version 6.0

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!