aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/acpica/nsxfname.c
diff options
context:
space:
mode:
authorJonathan Herman <hermanjl@cs.unc.edu>2013-01-17 16:15:55 -0500
committerJonathan Herman <hermanjl@cs.unc.edu>2013-01-17 16:15:55 -0500
commit8dea78da5cee153b8af9c07a2745f6c55057fe12 (patch)
treea8f4d49d63b1ecc92f2fddceba0655b2472c5bd9 /drivers/acpi/acpica/nsxfname.c
parent406089d01562f1e2bf9f089fd7637009ebaad589 (diff)
Patched in Tegra support.
Diffstat (limited to 'drivers/acpi/acpica/nsxfname.c')
-rw-r--r--drivers/acpi/acpica/nsxfname.c81
1 files changed, 31 insertions, 50 deletions
diff --git a/drivers/acpi/acpica/nsxfname.c b/drivers/acpi/acpica/nsxfname.c
index 811c6f13f47..3fd4526f3db 100644
--- a/drivers/acpi/acpica/nsxfname.c
+++ b/drivers/acpi/acpica/nsxfname.c
@@ -6,7 +6,7 @@
6 *****************************************************************************/ 6 *****************************************************************************/
7 7
8/* 8/*
9 * Copyright (C) 2000 - 2012, Intel Corp. 9 * Copyright (C) 2000 - 2011, Intel Corp.
10 * All rights reserved. 10 * All rights reserved.
11 * 11 *
12 * Redistribution and use in source and binary forms, with or without 12 * Redistribution and use in source and binary forms, with or without
@@ -42,7 +42,6 @@
42 * POSSIBILITY OF SUCH DAMAGES. 42 * POSSIBILITY OF SUCH DAMAGES.
43 */ 43 */
44 44
45#include <linux/export.h>
46#include <acpi/acpi.h> 45#include <acpi/acpi.h>
47#include "accommon.h" 46#include "accommon.h"
48#include "acnamesp.h" 47#include "acnamesp.h"
@@ -53,24 +52,24 @@
53ACPI_MODULE_NAME("nsxfname") 52ACPI_MODULE_NAME("nsxfname")
54 53
55/* Local prototypes */ 54/* Local prototypes */
56static char *acpi_ns_copy_device_id(struct acpi_pnp_device_id *dest, 55static char *acpi_ns_copy_device_id(struct acpica_device_id *dest,
57 struct acpi_pnp_device_id *source, 56 struct acpica_device_id *source,
58 char *string_area); 57 char *string_area);
59 58
60/****************************************************************************** 59/******************************************************************************
61 * 60 *
62 * FUNCTION: acpi_get_handle 61 * FUNCTION: acpi_get_handle
63 * 62 *
64 * PARAMETERS: parent - Object to search under (search scope). 63 * PARAMETERS: Parent - Object to search under (search scope).
65 * pathname - Pointer to an asciiz string containing the 64 * Pathname - Pointer to an asciiz string containing the
66 * name 65 * name
67 * ret_handle - Where the return handle is returned 66 * ret_handle - Where the return handle is returned
68 * 67 *
69 * RETURN: Status 68 * RETURN: Status
70 * 69 *
71 * DESCRIPTION: This routine will search for a caller specified name in the 70 * DESCRIPTION: This routine will search for a caller specified name in the
72 * name space. The caller can restrict the search region by 71 * name space. The caller can restrict the search region by
73 * specifying a non NULL parent. The parent value is itself a 72 * specifying a non NULL parent. The parent value is itself a
74 * namespace handle. 73 * namespace handle.
75 * 74 *
76 ******************************************************************************/ 75 ******************************************************************************/
@@ -142,14 +141,14 @@ ACPI_EXPORT_SYMBOL(acpi_get_handle)
142 * 141 *
143 * FUNCTION: acpi_get_name 142 * FUNCTION: acpi_get_name
144 * 143 *
145 * PARAMETERS: handle - Handle to be converted to a pathname 144 * PARAMETERS: Handle - Handle to be converted to a pathname
146 * name_type - Full pathname or single segment 145 * name_type - Full pathname or single segment
147 * buffer - Buffer for returned path 146 * Buffer - Buffer for returned path
148 * 147 *
149 * RETURN: Pointer to a string containing the fully qualified Name. 148 * RETURN: Pointer to a string containing the fully qualified Name.
150 * 149 *
151 * DESCRIPTION: This routine returns the fully qualified name associated with 150 * DESCRIPTION: This routine returns the fully qualified name associated with
152 * the Handle parameter. This and the acpi_pathname_to_handle are 151 * the Handle parameter. This and the acpi_pathname_to_handle are
153 * complementary functions. 152 * complementary functions.
154 * 153 *
155 ******************************************************************************/ 154 ******************************************************************************/
@@ -202,7 +201,8 @@ acpi_get_name(acpi_handle handle, u32 name_type, struct acpi_buffer * buffer)
202 201
203 /* Just copy the ACPI name from the Node and zero terminate it */ 202 /* Just copy the ACPI name from the Node and zero terminate it */
204 203
205 ACPI_MOVE_NAME(buffer->pointer, acpi_ut_get_node_name(node)); 204 ACPI_STRNCPY(buffer->pointer, acpi_ut_get_node_name(node),
205 ACPI_NAME_SIZE);
206 ((char *)buffer->pointer)[ACPI_NAME_SIZE] = 0; 206 ((char *)buffer->pointer)[ACPI_NAME_SIZE] = 0;
207 status = AE_OK; 207 status = AE_OK;
208 208
@@ -218,21 +218,20 @@ ACPI_EXPORT_SYMBOL(acpi_get_name)
218 * 218 *
219 * FUNCTION: acpi_ns_copy_device_id 219 * FUNCTION: acpi_ns_copy_device_id
220 * 220 *
221 * PARAMETERS: dest - Pointer to the destination PNP_DEVICE_ID 221 * PARAMETERS: Dest - Pointer to the destination DEVICE_ID
222 * source - Pointer to the source PNP_DEVICE_ID 222 * Source - Pointer to the source DEVICE_ID
223 * string_area - Pointer to where to copy the dest string 223 * string_area - Pointer to where to copy the dest string
224 * 224 *
225 * RETURN: Pointer to the next string area 225 * RETURN: Pointer to the next string area
226 * 226 *
227 * DESCRIPTION: Copy a single PNP_DEVICE_ID, including the string data. 227 * DESCRIPTION: Copy a single DEVICE_ID, including the string data.
228 * 228 *
229 ******************************************************************************/ 229 ******************************************************************************/
230static char *acpi_ns_copy_device_id(struct acpi_pnp_device_id *dest, 230static char *acpi_ns_copy_device_id(struct acpica_device_id *dest,
231 struct acpi_pnp_device_id *source, 231 struct acpica_device_id *source,
232 char *string_area) 232 char *string_area)
233{ 233{
234 234 /* Create the destination DEVICE_ID */
235 /* Create the destination PNP_DEVICE_ID */
236 235
237 dest->string = string_area; 236 dest->string = string_area;
238 dest->length = source->length; 237 dest->length = source->length;
@@ -247,7 +246,7 @@ static char *acpi_ns_copy_device_id(struct acpi_pnp_device_id *dest,
247 * 246 *
248 * FUNCTION: acpi_get_object_info 247 * FUNCTION: acpi_get_object_info
249 * 248 *
250 * PARAMETERS: handle - Object Handle 249 * PARAMETERS: Handle - Object Handle
251 * return_buffer - Where the info is returned 250 * return_buffer - Where the info is returned
252 * 251 *
253 * RETURN: Status 252 * RETURN: Status
@@ -256,8 +255,8 @@ static char *acpi_ns_copy_device_id(struct acpi_pnp_device_id *dest,
256 * namespace node and possibly by running several standard 255 * namespace node and possibly by running several standard
257 * control methods (Such as in the case of a device.) 256 * control methods (Such as in the case of a device.)
258 * 257 *
259 * For Device and Processor objects, run the Device _HID, _UID, _CID, _SUB, 258 * For Device and Processor objects, run the Device _HID, _UID, _CID, _STA,
260 * _STA, _ADR, _sx_w, and _sx_d methods. 259 * _ADR, _sx_w, and _sx_d methods.
261 * 260 *
262 * Note: Allocates the return buffer, must be freed by the caller. 261 * Note: Allocates the return buffer, must be freed by the caller.
263 * 262 *
@@ -269,10 +268,9 @@ acpi_get_object_info(acpi_handle handle,
269{ 268{
270 struct acpi_namespace_node *node; 269 struct acpi_namespace_node *node;
271 struct acpi_device_info *info; 270 struct acpi_device_info *info;
272 struct acpi_pnp_device_id_list *cid_list = NULL; 271 struct acpica_device_id_list *cid_list = NULL;
273 struct acpi_pnp_device_id *hid = NULL; 272 struct acpica_device_id *hid = NULL;
274 struct acpi_pnp_device_id *uid = NULL; 273 struct acpica_device_id *uid = NULL;
275 struct acpi_pnp_device_id *sub = NULL;
276 char *next_id_string; 274 char *next_id_string;
277 acpi_object_type type; 275 acpi_object_type type;
278 acpi_name name; 276 acpi_name name;
@@ -317,7 +315,7 @@ acpi_get_object_info(acpi_handle handle,
317 if ((type == ACPI_TYPE_DEVICE) || (type == ACPI_TYPE_PROCESSOR)) { 315 if ((type == ACPI_TYPE_DEVICE) || (type == ACPI_TYPE_PROCESSOR)) {
318 /* 316 /*
319 * Get extra info for ACPI Device/Processor objects only: 317 * Get extra info for ACPI Device/Processor objects only:
320 * Run the Device _HID, _UID, _SUB, and _CID methods. 318 * Run the Device _HID, _UID, and _CID methods.
321 * 319 *
322 * Note: none of these methods are required, so they may or may 320 * Note: none of these methods are required, so they may or may
323 * not be present for this device. The Info->Valid bitfield is used 321 * not be present for this device. The Info->Valid bitfield is used
@@ -340,14 +338,6 @@ acpi_get_object_info(acpi_handle handle,
340 valid |= ACPI_VALID_UID; 338 valid |= ACPI_VALID_UID;
341 } 339 }
342 340
343 /* Execute the Device._SUB method */
344
345 status = acpi_ut_execute_SUB(node, &sub);
346 if (ACPI_SUCCESS(status)) {
347 info_size += sub->length;
348 valid |= ACPI_VALID_SUB;
349 }
350
351 /* Execute the Device._CID method */ 341 /* Execute the Device._CID method */
352 342
353 status = acpi_ut_execute_CID(node, &cid_list); 343 status = acpi_ut_execute_CID(node, &cid_list);
@@ -357,7 +347,7 @@ acpi_get_object_info(acpi_handle handle,
357 347
358 info_size += 348 info_size +=
359 (cid_list->list_size - 349 (cid_list->list_size -
360 sizeof(struct acpi_pnp_device_id_list)); 350 sizeof(struct acpica_device_id_list));
361 valid |= ACPI_VALID_CID; 351 valid |= ACPI_VALID_CID;
362 } 352 }
363 } 353 }
@@ -427,17 +417,16 @@ acpi_get_object_info(acpi_handle handle,
427 next_id_string = ACPI_CAST_PTR(char, info->compatible_id_list.ids); 417 next_id_string = ACPI_CAST_PTR(char, info->compatible_id_list.ids);
428 if (cid_list) { 418 if (cid_list) {
429 419
430 /* Point past the CID PNP_DEVICE_ID array */ 420 /* Point past the CID DEVICE_ID array */
431 421
432 next_id_string += 422 next_id_string +=
433 ((acpi_size) cid_list->count * 423 ((acpi_size) cid_list->count *
434 sizeof(struct acpi_pnp_device_id)); 424 sizeof(struct acpica_device_id));
435 } 425 }
436 426
437 /* 427 /*
438 * Copy the HID, UID, SUB, and CIDs to the return buffer. 428 * Copy the HID, UID, and CIDs to the return buffer. The variable-length
439 * The variable-length strings are copied to the reserved area 429 * strings are copied to the reserved area at the end of the buffer.
440 * at the end of the buffer.
441 * 430 *
442 * For HID and CID, check if the ID is a PCI Root Bridge. 431 * For HID and CID, check if the ID is a PCI Root Bridge.
443 */ 432 */
@@ -455,11 +444,6 @@ acpi_get_object_info(acpi_handle handle,
455 uid, next_id_string); 444 uid, next_id_string);
456 } 445 }
457 446
458 if (sub) {
459 next_id_string = acpi_ns_copy_device_id(&info->subsystem_id,
460 sub, next_id_string);
461 }
462
463 if (cid_list) { 447 if (cid_list) {
464 info->compatible_id_list.count = cid_list->count; 448 info->compatible_id_list.count = cid_list->count;
465 info->compatible_id_list.list_size = cid_list->list_size; 449 info->compatible_id_list.list_size = cid_list->list_size;
@@ -496,9 +480,6 @@ acpi_get_object_info(acpi_handle handle,
496 if (uid) { 480 if (uid) {
497 ACPI_FREE(uid); 481 ACPI_FREE(uid);
498 } 482 }
499 if (sub) {
500 ACPI_FREE(sub);
501 }
502 if (cid_list) { 483 if (cid_list) {
503 ACPI_FREE(cid_list); 484 ACPI_FREE(cid_list);
504 } 485 }
@@ -511,7 +492,7 @@ ACPI_EXPORT_SYMBOL(acpi_get_object_info)
511 * 492 *
512 * FUNCTION: acpi_install_method 493 * FUNCTION: acpi_install_method
513 * 494 *
514 * PARAMETERS: buffer - An ACPI table containing one control method 495 * PARAMETERS: Buffer - An ACPI table containing one control method
515 * 496 *
516 * RETURN: Status 497 * RETURN: Status
517 * 498 *