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.

ACPI Software Programming Model<br />

5.5.2 Control Method Execution<br />

OSPM evaluates control method objects as necessary to either interrogate or adjust the system-level<br />

hardware state. This is called an invocation.<br />

A control method can use other internal, or well defined, control methods to accomplish the task at<br />

h<strong>and</strong>, which can include defined control methods provided by the operating software. Control<br />

Methods can reference any objects anywhere in the Namespace. Interpretation of a Control Method<br />

is not preemptive, but it can block. When a control method does block, OSPM can initiate or<br />

continue the execution of a different control method. A control method can only assume that access<br />

to global objects is exclusive for any period the control method does not block.<br />

Global objects are those NameSpace objects created at table load time.<br />

5.5.2.1 Arguments<br />

Up to seven arguments can be passed to a control method. Each argument is an object that in turn<br />

could be a “package” style object that refers to other objects. Access to the argument objects is<br />

provided via the ASL ArgTerm (ArgX) language elements. The number of arguments passed to any<br />

control method is fixed <strong>and</strong> is defined when the control method package is created.<br />

Method arguments can take one of the following forms:<br />

• An ACPI name or namepath that refers to a named object. This includes the LocalX <strong>and</strong> ArgX<br />

names. In this case, the object associated with the name is passed as the argument.<br />

• An ACPI name or namepath that refers to another control method. In this case, the method is<br />

invoked <strong>and</strong> the return value of the method is passed as the argument. A fatal error occurs if no<br />

object is returned from the method. If the object is not used after the method invocation it is<br />

automatically deleted.<br />

• A valid ASL expression. In the case, the expression is evaluated <strong>and</strong> the object that results from<br />

this evaluation is passed as the argument. If this object is not used after the method invocation it<br />

is automatically deleted.<br />

5.5.2.2 Method Calling Convention<br />

The calling convention for control methods can best be described as call-by-reference-constant. In<br />

this convention, objects passed as arguments are passed by “reference”, meaning that they are not<br />

copied to new objects as they are passed to the called control method (A calling convention that<br />

copies objects or object wrappers during a call is known as call-by-value or call-by-copy).<br />

This call-by-reference-constant convention allows internal objects to be shared across each method<br />

invocation, therefore reducing the number of object copies that must be performed as well as the<br />

number of buffers that must be copied. This calling convention is appropriate to the low-level nature<br />

of the ACPI subsystem within the kernel of the host operating system where non-paged dynamic<br />

memory is typically at a premium. The ASL programmer must be aware of the calling convention<br />

<strong>and</strong> the related side effects.<br />

However, unlike a pure call-by-reference convention, the ability of the called control method to<br />

modify arguments is extremely limited. This reduces aliasing issues such as when a called method<br />

unexpectedly modifies a object or variable that has been passed as an argument by the caller. In<br />

effect, the arguments that are passed to control methods are passed as constants that cannot be<br />

modified except under specific controlled circumstances.<br />

Version 6.0 219

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

Saved successfully!

Ooh no, something went wrong!