1 /******************************************************************************
3 * Module Name: cmeval - Object evaluation
6 *****************************************************************************/
9 * Copyright (C) 2000 R. Byron Moore
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
32 #define _COMPONENT MISCELLANEOUS
33 MODULE_NAME ("cmeval")
36 /****************************************************************************
38 * FUNCTION: Acpi_cm_evaluate_numeric_object
40 * PARAMETERS: *Object_name - Object name to be evaluated
41 * Device_node - Node for the device
42 * *Address - Where the value is returned
46 * DESCRIPTION: evaluates a numeric namespace object for a selected device
47 * and stores results in *Address.
49 * NOTE: Internal function, no parameter validation
51 ***************************************************************************/
54 acpi_cm_evaluate_numeric_object (
55 NATIVE_CHAR
*object_name
,
56 ACPI_NAMESPACE_NODE
*device_node
,
57 ACPI_INTEGER
*address
)
59 ACPI_OPERAND_OBJECT
*obj_desc
;
63 /* Execute the method */
65 status
= acpi_ns_evaluate_relative (device_node
, object_name
, NULL
, &obj_desc
);
66 if (ACPI_FAILURE (status
)) {
72 /* Did we get a return object? */
78 /* Is the return object of the correct type? */
80 if (obj_desc
->common
.type
!= ACPI_TYPE_NUMBER
) {
85 * Since the structure is a union, setting any field will set all
86 * of the variables in the union
88 *address
= obj_desc
->number
.value
;
91 /* On exit, we must delete the return object */
93 acpi_cm_remove_reference (obj_desc
);
99 /****************************************************************************
101 * FUNCTION: Acpi_cm_execute_HID
103 * PARAMETERS: Device_node - Node for the device
104 * *Hid - Where the HID is returned
108 * DESCRIPTION: Executes the _HID control method that returns the hardware
111 * NOTE: Internal function, no parameter validation
113 ***************************************************************************/
116 acpi_cm_execute_HID (
117 ACPI_NAMESPACE_NODE
*device_node
,
120 ACPI_OPERAND_OBJECT
*obj_desc
;
124 /* Execute the method */
126 status
= acpi_ns_evaluate_relative (device_node
,
127 METHOD_NAME__HID
, NULL
, &obj_desc
);
128 if (ACPI_FAILURE (status
)) {
134 /* Did we get a return object? */
141 * A _HID can return either a Number (32 bit compressed EISA ID) or
145 if ((obj_desc
->common
.type
!= ACPI_TYPE_NUMBER
) &&
146 (obj_desc
->common
.type
!= ACPI_TYPE_STRING
))
152 if (obj_desc
->common
.type
== ACPI_TYPE_NUMBER
) {
153 /* Convert the Numeric HID to string */
155 acpi_aml_eisa_id_to_string ((u32
) obj_desc
->number
.value
, hid
->buffer
);
159 /* Copy the String HID from the returned object */
161 STRNCPY(hid
->buffer
, obj_desc
->string
.pointer
, sizeof(hid
->buffer
));
166 /* On exit, we must delete the return object */
168 acpi_cm_remove_reference (obj_desc
);
174 /****************************************************************************
176 * FUNCTION: Acpi_cm_execute_UID
178 * PARAMETERS: Device_node - Node for the device
179 * *Uid - Where the UID is returned
183 * DESCRIPTION: Executes the _UID control method that returns the hardware
186 * NOTE: Internal function, no parameter validation
188 ***************************************************************************/
191 acpi_cm_execute_UID (
192 ACPI_NAMESPACE_NODE
*device_node
,
195 ACPI_OPERAND_OBJECT
*obj_desc
;
199 /* Execute the method */
201 status
= acpi_ns_evaluate_relative (device_node
,
202 METHOD_NAME__UID
, NULL
, &obj_desc
);
203 if (ACPI_FAILURE (status
)) {
209 /* Did we get a return object? */
216 * A _UID can return either a Number (32 bit compressed EISA ID) or
220 if ((obj_desc
->common
.type
!= ACPI_TYPE_NUMBER
) &&
221 (obj_desc
->common
.type
!= ACPI_TYPE_STRING
))
227 if (obj_desc
->common
.type
== ACPI_TYPE_NUMBER
) {
228 /* Convert the Numeric UID to string */
230 acpi_aml_unsigned_integer_to_string (obj_desc
->number
.value
, uid
->buffer
);
234 /* Copy the String UID from the returned object */
236 STRNCPY(uid
->buffer
, obj_desc
->string
.pointer
, sizeof(uid
->buffer
));
241 /* On exit, we must delete the return object */
243 acpi_cm_remove_reference (obj_desc
);
248 /****************************************************************************
250 * FUNCTION: Acpi_cm_execute_STA
252 * PARAMETERS: Device_node - Node for the device
253 * *Flags - Where the status flags are returned
257 * DESCRIPTION: Executes _STA for selected device and stores results in
260 * NOTE: Internal function, no parameter validation
262 ***************************************************************************/
265 acpi_cm_execute_STA (
266 ACPI_NAMESPACE_NODE
*device_node
,
269 ACPI_OPERAND_OBJECT
*obj_desc
;
273 /* Execute the method */
275 status
= acpi_ns_evaluate_relative (device_node
,
276 METHOD_NAME__STA
, NULL
, &obj_desc
);
277 if (AE_NOT_FOUND
== status
) {
284 /* Did we get a return object? */
290 /* Is the return object of the correct type? */
292 if (obj_desc
->common
.type
!= ACPI_TYPE_NUMBER
) {
297 /* Extract the status flags */
299 *flags
= (u32
) obj_desc
->number
.value
;
302 /* On exit, we must delete the return object */
304 acpi_cm_remove_reference (obj_desc
);