aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/acpica/utids.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/acpi/acpica/utids.c')
-rw-r--r--drivers/acpi/acpica/utids.c104
1 files changed, 87 insertions, 17 deletions
diff --git a/drivers/acpi/acpica/utids.c b/drivers/acpi/acpica/utids.c
index 5d84e1954575..774c3aefbf5d 100644
--- a/drivers/acpi/acpica/utids.c
+++ b/drivers/acpi/acpica/utids.c
@@ -67,10 +67,10 @@ ACPI_MODULE_NAME("utids")
67 ******************************************************************************/ 67 ******************************************************************************/
68acpi_status 68acpi_status
69acpi_ut_execute_HID(struct acpi_namespace_node *device_node, 69acpi_ut_execute_HID(struct acpi_namespace_node *device_node,
70 struct acpica_device_id **return_id) 70 struct acpi_pnp_device_id **return_id)
71{ 71{
72 union acpi_operand_object *obj_desc; 72 union acpi_operand_object *obj_desc;
73 struct acpica_device_id *hid; 73 struct acpi_pnp_device_id *hid;
74 u32 length; 74 u32 length;
75 acpi_status status; 75 acpi_status status;
76 76
@@ -94,16 +94,17 @@ acpi_ut_execute_HID(struct acpi_namespace_node *device_node,
94 /* Allocate a buffer for the HID */ 94 /* Allocate a buffer for the HID */
95 95
96 hid = 96 hid =
97 ACPI_ALLOCATE_ZEROED(sizeof(struct acpica_device_id) + 97 ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_pnp_device_id) +
98 (acpi_size) length); 98 (acpi_size) length);
99 if (!hid) { 99 if (!hid) {
100 status = AE_NO_MEMORY; 100 status = AE_NO_MEMORY;
101 goto cleanup; 101 goto cleanup;
102 } 102 }
103 103
104 /* Area for the string starts after DEVICE_ID struct */ 104 /* Area for the string starts after PNP_DEVICE_ID struct */
105 105
106 hid->string = ACPI_ADD_PTR(char, hid, sizeof(struct acpica_device_id)); 106 hid->string =
107 ACPI_ADD_PTR(char, hid, sizeof(struct acpi_pnp_device_id));
107 108
108 /* Convert EISAID to a string or simply copy existing string */ 109 /* Convert EISAID to a string or simply copy existing string */
109 110
@@ -126,6 +127,73 @@ cleanup:
126 127
127/******************************************************************************* 128/*******************************************************************************
128 * 129 *
130 * FUNCTION: acpi_ut_execute_SUB
131 *
132 * PARAMETERS: device_node - Node for the device
133 * return_id - Where the _SUB is returned
134 *
135 * RETURN: Status
136 *
137 * DESCRIPTION: Executes the _SUB control method that returns the subsystem
138 * ID of the device. The _SUB value is always a string containing
139 * either a valid PNP or ACPI ID.
140 *
141 * NOTE: Internal function, no parameter validation
142 *
143 ******************************************************************************/
144
145acpi_status
146acpi_ut_execute_SUB(struct acpi_namespace_node *device_node,
147 struct acpi_pnp_device_id **return_id)
148{
149 union acpi_operand_object *obj_desc;
150 struct acpi_pnp_device_id *sub;
151 u32 length;
152 acpi_status status;
153
154 ACPI_FUNCTION_TRACE(ut_execute_SUB);
155
156 status = acpi_ut_evaluate_object(device_node, METHOD_NAME__SUB,
157 ACPI_BTYPE_STRING, &obj_desc);
158 if (ACPI_FAILURE(status)) {
159 return_ACPI_STATUS(status);
160 }
161
162 /* Get the size of the String to be returned, includes null terminator */
163
164 length = obj_desc->string.length + 1;
165
166 /* Allocate a buffer for the SUB */
167
168 sub =
169 ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_pnp_device_id) +
170 (acpi_size) length);
171 if (!sub) {
172 status = AE_NO_MEMORY;
173 goto cleanup;
174 }
175
176 /* Area for the string starts after PNP_DEVICE_ID struct */
177
178 sub->string =
179 ACPI_ADD_PTR(char, sub, sizeof(struct acpi_pnp_device_id));
180
181 /* Simply copy existing string */
182
183 ACPI_STRCPY(sub->string, obj_desc->string.pointer);
184 sub->length = length;
185 *return_id = sub;
186
187 cleanup:
188
189 /* On exit, we must delete the return object */
190
191 acpi_ut_remove_reference(obj_desc);
192 return_ACPI_STATUS(status);
193}
194
195/*******************************************************************************
196 *
129 * FUNCTION: acpi_ut_execute_UID 197 * FUNCTION: acpi_ut_execute_UID
130 * 198 *
131 * PARAMETERS: device_node - Node for the device 199 * PARAMETERS: device_node - Node for the device
@@ -144,10 +212,10 @@ cleanup:
144 212
145acpi_status 213acpi_status
146acpi_ut_execute_UID(struct acpi_namespace_node *device_node, 214acpi_ut_execute_UID(struct acpi_namespace_node *device_node,
147 struct acpica_device_id **return_id) 215 struct acpi_pnp_device_id **return_id)
148{ 216{
149 union acpi_operand_object *obj_desc; 217 union acpi_operand_object *obj_desc;
150 struct acpica_device_id *uid; 218 struct acpi_pnp_device_id *uid;
151 u32 length; 219 u32 length;
152 acpi_status status; 220 acpi_status status;
153 221
@@ -171,16 +239,17 @@ acpi_ut_execute_UID(struct acpi_namespace_node *device_node,
171 /* Allocate a buffer for the UID */ 239 /* Allocate a buffer for the UID */
172 240
173 uid = 241 uid =
174 ACPI_ALLOCATE_ZEROED(sizeof(struct acpica_device_id) + 242 ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_pnp_device_id) +
175 (acpi_size) length); 243 (acpi_size) length);
176 if (!uid) { 244 if (!uid) {
177 status = AE_NO_MEMORY; 245 status = AE_NO_MEMORY;
178 goto cleanup; 246 goto cleanup;
179 } 247 }
180 248
181 /* Area for the string starts after DEVICE_ID struct */ 249 /* Area for the string starts after PNP_DEVICE_ID struct */
182 250
183 uid->string = ACPI_ADD_PTR(char, uid, sizeof(struct acpica_device_id)); 251 uid->string =
252 ACPI_ADD_PTR(char, uid, sizeof(struct acpi_pnp_device_id));
184 253
185 /* Convert an Integer to string, or just copy an existing string */ 254 /* Convert an Integer to string, or just copy an existing string */
186 255
@@ -226,11 +295,11 @@ cleanup:
226 295
227acpi_status 296acpi_status
228acpi_ut_execute_CID(struct acpi_namespace_node *device_node, 297acpi_ut_execute_CID(struct acpi_namespace_node *device_node,
229 struct acpica_device_id_list **return_cid_list) 298 struct acpi_pnp_device_id_list **return_cid_list)
230{ 299{
231 union acpi_operand_object **cid_objects; 300 union acpi_operand_object **cid_objects;
232 union acpi_operand_object *obj_desc; 301 union acpi_operand_object *obj_desc;
233 struct acpica_device_id_list *cid_list; 302 struct acpi_pnp_device_id_list *cid_list;
234 char *next_id_string; 303 char *next_id_string;
235 u32 string_area_size; 304 u32 string_area_size;
236 u32 length; 305 u32 length;
@@ -288,11 +357,12 @@ acpi_ut_execute_CID(struct acpi_namespace_node *device_node,
288 /* 357 /*
289 * Now that we know the length of the CIDs, allocate return buffer: 358 * Now that we know the length of the CIDs, allocate return buffer:
290 * 1) Size of the base structure + 359 * 1) Size of the base structure +
291 * 2) Size of the CID DEVICE_ID array + 360 * 2) Size of the CID PNP_DEVICE_ID array +
292 * 3) Size of the actual CID strings 361 * 3) Size of the actual CID strings
293 */ 362 */
294 cid_list_size = sizeof(struct acpica_device_id_list) + 363 cid_list_size = sizeof(struct acpi_pnp_device_id_list) +
295 ((count - 1) * sizeof(struct acpica_device_id)) + string_area_size; 364 ((count - 1) * sizeof(struct acpi_pnp_device_id)) +
365 string_area_size;
296 366
297 cid_list = ACPI_ALLOCATE_ZEROED(cid_list_size); 367 cid_list = ACPI_ALLOCATE_ZEROED(cid_list_size);
298 if (!cid_list) { 368 if (!cid_list) {
@@ -300,10 +370,10 @@ acpi_ut_execute_CID(struct acpi_namespace_node *device_node,
300 goto cleanup; 370 goto cleanup;
301 } 371 }
302 372
303 /* Area for CID strings starts after the CID DEVICE_ID array */ 373 /* Area for CID strings starts after the CID PNP_DEVICE_ID array */
304 374
305 next_id_string = ACPI_CAST_PTR(char, cid_list->ids) + 375 next_id_string = ACPI_CAST_PTR(char, cid_list->ids) +
306 ((acpi_size) count * sizeof(struct acpica_device_id)); 376 ((acpi_size) count * sizeof(struct acpi_pnp_device_id));
307 377
308 /* Copy/convert the CIDs to the return buffer */ 378 /* Copy/convert the CIDs to the return buffer */
309 379