Intel Extensible Firmware Interface User Manual

Page 114

Advertising
background image

Extensible Firmware Interface Specification

5-16

12/01/02

Version 1.10

Description

The

RaiseTPL()

function raises the priority of the currently executing task and returns its

previous priority level.

Only three task priority levels are exposed outside of the firmware during EFI boot services
execution. The first is

TPL_APPLICATION

where all normal execution occurs. That level may

be interrupted to perform various asynchronous interrupt style notifications, which occur at the

TPL_CALLBACK

or

TPL_NOTIFY

level. By raising the task priority level to

TPL_NOTIFY

such

notifications are masked until the task priority level is restored, thereby synchronizing execution
with such notifications. Synchronous blocking I/O functions execute at

TPL_NOTIFY

.

TPL_CALLBACK

is the typically used for application level notification functions. Device drivers

will typically use

TPL_CALLBACK

or

TPL_NOTIFY

for their notification functions. Applications

and drivers may also use

TPL_NOTIFY

to protect data structures in critical sections of code.

The caller must restore the task priority level with

RestoreTPL()

to the previous level before

returning.

NOTE

If

NewTpl

is below the current TPL level, then the system behavior is indeterminate. Additionally,

only

TPL_APPLICATION

,

TPL_CALLBACK

,

TPL_NOTIFY

, and

TPL_HIGH_LEVEL

may be

used. All other values are reserved for use by the firmware; using them will result in unpredictable
behavior. Good coding practice dictates that all code should execute at its lowest possible TPL
level, and the use of TPL levels above

TPL_APPLICATION

must be minimized. Executing at TPL

levels above

TPL_APPLICATION

for extended periods of time may also result in unpredictable

behavior.

Status Codes Returned

Unlike other EFI interface functions,

RaiseTPL()

does not return a status code. Instead, it

returns the previous task priority level, which is to be restored later with a matching call to

RestoreTPL()

.

Advertising