diff options
Diffstat (limited to 'drivers/acpi/acpica/uteval.c')
-rw-r--r-- | drivers/acpi/acpica/uteval.c | 98 |
1 files changed, 62 insertions, 36 deletions
diff --git a/drivers/acpi/acpica/uteval.c b/drivers/acpi/acpica/uteval.c index 9c9897dbe907..006b16c26017 100644 --- a/drivers/acpi/acpica/uteval.c +++ b/drivers/acpi/acpica/uteval.c | |||
@@ -59,26 +59,35 @@ acpi_ut_translate_one_cid(union acpi_operand_object *obj_desc, | |||
59 | 59 | ||
60 | /* | 60 | /* |
61 | * Strings supported by the _OSI predefined (internal) method. | 61 | * Strings supported by the _OSI predefined (internal) method. |
62 | * | ||
63 | * March 2009: Removed "Linux" as this host no longer wants to respond true | ||
64 | * for this string. Basically, the only safe OS strings are windows-related | ||
65 | * and in many or most cases represent the only test path within the | ||
66 | * BIOS-provided ASL code. | ||
67 | * | ||
68 | * The second element of each entry is used to track the newest version of | ||
69 | * Windows that the BIOS has requested. | ||
62 | */ | 70 | */ |
63 | static char *acpi_interfaces_supported[] = { | 71 | static struct acpi_interface_info acpi_interfaces_supported[] = { |
64 | /* Operating System Vendor Strings */ | 72 | /* Operating System Vendor Strings */ |
65 | 73 | ||
66 | "Windows 2000", /* Windows 2000 */ | 74 | {"Windows 2000", ACPI_OSI_WIN_2000}, /* Windows 2000 */ |
67 | "Windows 2001", /* Windows XP */ | 75 | {"Windows 2001", ACPI_OSI_WIN_XP}, /* Windows XP */ |
68 | "Windows 2001 SP1", /* Windows XP SP1 */ | 76 | {"Windows 2001 SP1", ACPI_OSI_WIN_XP_SP1}, /* Windows XP SP1 */ |
69 | "Windows 2001 SP2", /* Windows XP SP2 */ | 77 | {"Windows 2001.1", ACPI_OSI_WINSRV_2003}, /* Windows Server 2003 */ |
70 | "Windows 2001.1", /* Windows Server 2003 */ | 78 | {"Windows 2001 SP2", ACPI_OSI_WIN_XP_SP2}, /* Windows XP SP2 */ |
71 | "Windows 2001.1 SP1", /* Windows Server 2003 SP1 - Added 03/2006 */ | 79 | {"Windows 2001.1 SP1", ACPI_OSI_WINSRV_2003_SP1}, /* Windows Server 2003 SP1 - Added 03/2006 */ |
72 | "Windows 2006", /* Windows Vista - Added 03/2006 */ | 80 | {"Windows 2006", ACPI_OSI_WIN_VISTA}, /* Windows Vista - Added 03/2006 */ |
73 | 81 | ||
74 | /* Feature Group Strings */ | 82 | /* Feature Group Strings */ |
75 | 83 | ||
76 | "Extended Address Space Descriptor" | 84 | {"Extended Address Space Descriptor", 0} |
77 | /* | 85 | |
78 | * All "optional" feature group strings (features that are implemented | 86 | /* |
79 | * by the host) should be implemented in the host version of | 87 | * All "optional" feature group strings (features that are implemented |
80 | * acpi_os_validate_interface and should not be added here. | 88 | * by the host) should be implemented in the host version of |
81 | */ | 89 | * acpi_os_validate_interface and should not be added here. |
90 | */ | ||
82 | }; | 91 | }; |
83 | 92 | ||
84 | /******************************************************************************* | 93 | /******************************************************************************* |
@@ -98,6 +107,7 @@ acpi_status acpi_ut_osi_implementation(struct acpi_walk_state *walk_state) | |||
98 | acpi_status status; | 107 | acpi_status status; |
99 | union acpi_operand_object *string_desc; | 108 | union acpi_operand_object *string_desc; |
100 | union acpi_operand_object *return_desc; | 109 | union acpi_operand_object *return_desc; |
110 | u32 return_value; | ||
101 | u32 i; | 111 | u32 i; |
102 | 112 | ||
103 | ACPI_FUNCTION_TRACE(ut_osi_implementation); | 113 | ACPI_FUNCTION_TRACE(ut_osi_implementation); |
@@ -116,19 +126,28 @@ acpi_status acpi_ut_osi_implementation(struct acpi_walk_state *walk_state) | |||
116 | return_ACPI_STATUS(AE_NO_MEMORY); | 126 | return_ACPI_STATUS(AE_NO_MEMORY); |
117 | } | 127 | } |
118 | 128 | ||
119 | /* Default return value is 0, NOT-SUPPORTED */ | 129 | /* Default return value is 0, NOT SUPPORTED */ |
120 | 130 | ||
121 | return_desc->integer.value = 0; | 131 | return_value = 0; |
122 | walk_state->return_desc = return_desc; | ||
123 | 132 | ||
124 | /* Compare input string to static table of supported interfaces */ | 133 | /* Compare input string to static table of supported interfaces */ |
125 | 134 | ||
126 | for (i = 0; i < ACPI_ARRAY_LENGTH(acpi_interfaces_supported); i++) { | 135 | for (i = 0; i < ACPI_ARRAY_LENGTH(acpi_interfaces_supported); i++) { |
127 | if (!ACPI_STRCMP | 136 | if (!ACPI_STRCMP(string_desc->string.pointer, |
128 | (string_desc->string.pointer, | 137 | acpi_interfaces_supported[i].name)) { |
129 | acpi_interfaces_supported[i])) { | 138 | /* |
130 | return_desc->integer.value = ACPI_UINT32_MAX; | 139 | * The interface is supported. |
131 | goto done; | 140 | * Update the osi_data if necessary. We keep track of the latest |
141 | * version of Windows that has been requested by the BIOS. | ||
142 | */ | ||
143 | if (acpi_interfaces_supported[i].value > | ||
144 | acpi_gbl_osi_data) { | ||
145 | acpi_gbl_osi_data = | ||
146 | acpi_interfaces_supported[i].value; | ||
147 | } | ||
148 | |||
149 | return_value = ACPI_UINT32_MAX; | ||
150 | goto exit; | ||
132 | } | 151 | } |
133 | } | 152 | } |
134 | 153 | ||
@@ -139,15 +158,22 @@ acpi_status acpi_ut_osi_implementation(struct acpi_walk_state *walk_state) | |||
139 | */ | 158 | */ |
140 | status = acpi_os_validate_interface(string_desc->string.pointer); | 159 | status = acpi_os_validate_interface(string_desc->string.pointer); |
141 | if (ACPI_SUCCESS(status)) { | 160 | if (ACPI_SUCCESS(status)) { |
142 | return_desc->integer.value = ACPI_UINT32_MAX; | 161 | |
162 | /* The interface is supported */ | ||
163 | |||
164 | return_value = ACPI_UINT32_MAX; | ||
143 | } | 165 | } |
144 | 166 | ||
145 | done: | 167 | exit: |
146 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_INFO, "ACPI: BIOS _OSI(%s) %ssupported\n", | 168 | ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, |
147 | string_desc->string.pointer, | 169 | "ACPI: BIOS _OSI(%s) is %ssupported\n", |
148 | return_desc->integer.value == 0 ? "not-" : "")); | 170 | string_desc->string.pointer, return_value == 0 ? "not " : "")); |
149 | 171 | ||
150 | return_ACPI_STATUS(AE_OK); | 172 | /* Complete the return value */ |
173 | |||
174 | return_desc->integer.value = return_value; | ||
175 | walk_state->return_desc = return_desc; | ||
176 | return_ACPI_STATUS (AE_OK); | ||
151 | } | 177 | } |
152 | 178 | ||
153 | /******************************************************************************* | 179 | /******************************************************************************* |
@@ -167,8 +193,8 @@ acpi_status acpi_osi_invalidate(char *interface) | |||
167 | int i; | 193 | int i; |
168 | 194 | ||
169 | for (i = 0; i < ACPI_ARRAY_LENGTH(acpi_interfaces_supported); i++) { | 195 | for (i = 0; i < ACPI_ARRAY_LENGTH(acpi_interfaces_supported); i++) { |
170 | if (!ACPI_STRCMP(interface, acpi_interfaces_supported[i])) { | 196 | if (!ACPI_STRCMP(interface, acpi_interfaces_supported[i].name)) { |
171 | *acpi_interfaces_supported[i] = '\0'; | 197 | *acpi_interfaces_supported[i].name = '\0'; |
172 | return AE_OK; | 198 | return AE_OK; |
173 | } | 199 | } |
174 | } | 200 | } |
@@ -248,7 +274,7 @@ acpi_ut_evaluate_object(struct acpi_namespace_node *prefix_node, | |||
248 | 274 | ||
249 | /* Map the return object type to the bitmapped type */ | 275 | /* Map the return object type to the bitmapped type */ |
250 | 276 | ||
251 | switch (ACPI_GET_OBJECT_TYPE(info->return_object)) { | 277 | switch ((info->return_object)->common.type) { |
252 | case ACPI_TYPE_INTEGER: | 278 | case ACPI_TYPE_INTEGER: |
253 | return_btype = ACPI_BTYPE_INTEGER; | 279 | return_btype = ACPI_BTYPE_INTEGER; |
254 | break; | 280 | break; |
@@ -418,7 +444,7 @@ acpi_ut_execute_HID(struct acpi_namespace_node *device_node, | |||
418 | return_ACPI_STATUS(status); | 444 | return_ACPI_STATUS(status); |
419 | } | 445 | } |
420 | 446 | ||
421 | if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_INTEGER) { | 447 | if (obj_desc->common.type == ACPI_TYPE_INTEGER) { |
422 | 448 | ||
423 | /* Convert the Numeric HID to string */ | 449 | /* Convert the Numeric HID to string */ |
424 | 450 | ||
@@ -459,7 +485,7 @@ acpi_ut_translate_one_cid(union acpi_operand_object *obj_desc, | |||
459 | struct acpi_compatible_id *one_cid) | 485 | struct acpi_compatible_id *one_cid) |
460 | { | 486 | { |
461 | 487 | ||
462 | switch (ACPI_GET_OBJECT_TYPE(obj_desc)) { | 488 | switch (obj_desc->common.type) { |
463 | case ACPI_TYPE_INTEGER: | 489 | case ACPI_TYPE_INTEGER: |
464 | 490 | ||
465 | /* Convert the Numeric CID to string */ | 491 | /* Convert the Numeric CID to string */ |
@@ -527,7 +553,7 @@ acpi_ut_execute_CID(struct acpi_namespace_node * device_node, | |||
527 | /* Get the number of _CIDs returned */ | 553 | /* Get the number of _CIDs returned */ |
528 | 554 | ||
529 | count = 1; | 555 | count = 1; |
530 | if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_PACKAGE) { | 556 | if (obj_desc->common.type == ACPI_TYPE_PACKAGE) { |
531 | count = obj_desc->package.count; | 557 | count = obj_desc->package.count; |
532 | } | 558 | } |
533 | 559 | ||
@@ -555,7 +581,7 @@ acpi_ut_execute_CID(struct acpi_namespace_node * device_node, | |||
555 | 581 | ||
556 | /* The _CID object can be either a single CID or a package (list) of CIDs */ | 582 | /* The _CID object can be either a single CID or a package (list) of CIDs */ |
557 | 583 | ||
558 | if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_PACKAGE) { | 584 | if (obj_desc->common.type == ACPI_TYPE_PACKAGE) { |
559 | 585 | ||
560 | /* Translate each package element */ | 586 | /* Translate each package element */ |
561 | 587 | ||
@@ -620,7 +646,7 @@ acpi_ut_execute_UID(struct acpi_namespace_node *device_node, | |||
620 | return_ACPI_STATUS(status); | 646 | return_ACPI_STATUS(status); |
621 | } | 647 | } |
622 | 648 | ||
623 | if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_INTEGER) { | 649 | if (obj_desc->common.type == ACPI_TYPE_INTEGER) { |
624 | 650 | ||
625 | /* Convert the Numeric UID to string */ | 651 | /* Convert the Numeric UID to string */ |
626 | 652 | ||