Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /****************************************************************************** |
| 2 | * |
| 3 | * Module Name: nsxfname - Public interfaces to the ACPI subsystem |
| 4 | * ACPI Namespace oriented interfaces |
| 5 | * |
| 6 | *****************************************************************************/ |
| 7 | |
| 8 | /* |
Bob Moore | 25f044e | 2013-01-25 05:38:56 +0000 | [diff] [blame] | 9 | * Copyright (C) 2000 - 2013, Intel Corp. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 10 | * All rights reserved. |
| 11 | * |
| 12 | * Redistribution and use in source and binary forms, with or without |
| 13 | * modification, are permitted provided that the following conditions |
| 14 | * are met: |
| 15 | * 1. Redistributions of source code must retain the above copyright |
| 16 | * notice, this list of conditions, and the following disclaimer, |
| 17 | * without modification. |
| 18 | * 2. Redistributions in binary form must reproduce at minimum a disclaimer |
| 19 | * substantially similar to the "NO WARRANTY" disclaimer below |
| 20 | * ("Disclaimer") and any redistribution must be conditioned upon |
| 21 | * including a substantially similar Disclaimer requirement for further |
| 22 | * binary redistribution. |
| 23 | * 3. Neither the names of the above-listed copyright holders nor the names |
| 24 | * of any contributors may be used to endorse or promote products derived |
| 25 | * from this software without specific prior written permission. |
| 26 | * |
| 27 | * Alternatively, this software may be distributed under the terms of the |
| 28 | * GNU General Public License ("GPL") version 2 as published by the Free |
| 29 | * Software Foundation. |
| 30 | * |
| 31 | * NO WARRANTY |
| 32 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 33 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 34 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR |
| 35 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 36 | * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
| 37 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
| 38 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
| 39 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, |
| 40 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING |
| 41 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
| 42 | * POSSIBILITY OF SUCH DAMAGES. |
| 43 | */ |
| 44 | |
Paul Gortmaker | 214f2c9 | 2011-10-26 16:22:14 -0400 | [diff] [blame] | 45 | #include <linux/export.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 46 | #include <acpi/acpi.h> |
Len Brown | e2f7a77 | 2009-01-09 00:30:03 -0500 | [diff] [blame] | 47 | #include "accommon.h" |
| 48 | #include "acnamesp.h" |
Lin Ming | b2f7ddc | 2009-05-21 10:42:09 +0800 | [diff] [blame] | 49 | #include "acparser.h" |
| 50 | #include "amlcode.h" |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 51 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 52 | #define _COMPONENT ACPI_NAMESPACE |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 53 | ACPI_MODULE_NAME("nsxfname") |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 54 | |
Bob Moore | 15b8dd5 | 2009-06-29 13:39:29 +0800 | [diff] [blame] | 55 | /* Local prototypes */ |
Lv Zheng | 78e25fe | 2012-10-31 02:25:24 +0000 | [diff] [blame] | 56 | static char *acpi_ns_copy_device_id(struct acpi_pnp_device_id *dest, |
| 57 | struct acpi_pnp_device_id *source, |
Bob Moore | 15b8dd5 | 2009-06-29 13:39:29 +0800 | [diff] [blame] | 58 | char *string_area); |
| 59 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 60 | /****************************************************************************** |
| 61 | * |
| 62 | * FUNCTION: acpi_get_handle |
| 63 | * |
Bob Moore | ba494be | 2012-07-12 09:40:10 +0800 | [diff] [blame] | 64 | * PARAMETERS: parent - Object to search under (search scope). |
| 65 | * pathname - Pointer to an asciiz string containing the |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 66 | * name |
| 67 | * ret_handle - Where the return handle is returned |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 68 | * |
| 69 | * RETURN: Status |
| 70 | * |
| 71 | * DESCRIPTION: This routine will search for a caller specified name in the |
Bob Moore | 73a3090 | 2012-10-31 02:26:55 +0000 | [diff] [blame] | 72 | * name space. The caller can restrict the search region by |
| 73 | * specifying a non NULL parent. The parent value is itself a |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 74 | * namespace handle. |
| 75 | * |
| 76 | ******************************************************************************/ |
Bob Moore | 15b8dd5 | 2009-06-29 13:39:29 +0800 | [diff] [blame] | 77 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 78 | acpi_status |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 79 | acpi_get_handle(acpi_handle parent, |
| 80 | acpi_string pathname, acpi_handle * ret_handle) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 81 | { |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 82 | acpi_status status; |
| 83 | struct acpi_namespace_node *node = NULL; |
| 84 | struct acpi_namespace_node *prefix_node = NULL; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 85 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 86 | ACPI_FUNCTION_ENTRY(); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 87 | |
| 88 | /* Parameter Validation */ |
| 89 | |
| 90 | if (!ret_handle || !pathname) { |
| 91 | return (AE_BAD_PARAMETER); |
| 92 | } |
| 93 | |
| 94 | /* Convert a parent handle to a prefix node */ |
| 95 | |
| 96 | if (parent) { |
Bob Moore | f24b664 | 2009-12-11 14:57:00 +0800 | [diff] [blame] | 97 | prefix_node = acpi_ns_validate_handle(parent); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 98 | if (!prefix_node) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 99 | return (AE_BAD_PARAMETER); |
| 100 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 101 | } |
| 102 | |
| 103 | /* |
Bob Moore | f1c2b1d | 2007-02-02 19:48:22 +0300 | [diff] [blame] | 104 | * Valid cases are: |
| 105 | * 1) Fully qualified pathname |
| 106 | * 2) Parent + Relative pathname |
| 107 | * |
| 108 | * Error for <null Parent + relative path> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 109 | */ |
Bob Moore | 04a81dc | 2012-12-31 00:05:17 +0000 | [diff] [blame] | 110 | if (ACPI_IS_ROOT_PREFIX(pathname[0])) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 111 | |
Bob Moore | f1c2b1d | 2007-02-02 19:48:22 +0300 | [diff] [blame] | 112 | /* Pathname is fully qualified (starts with '\') */ |
| 113 | |
| 114 | /* Special case for root-only, since we can't search for it */ |
| 115 | |
| 116 | if (!ACPI_STRCMP(pathname, ACPI_NS_ROOT_PATH)) { |
| 117 | *ret_handle = |
Bob Moore | f24b664 | 2009-12-11 14:57:00 +0800 | [diff] [blame] | 118 | ACPI_CAST_PTR(acpi_handle, acpi_gbl_root_node); |
Bob Moore | f1c2b1d | 2007-02-02 19:48:22 +0300 | [diff] [blame] | 119 | return (AE_OK); |
| 120 | } |
| 121 | } else if (!prefix_node) { |
| 122 | |
| 123 | /* Relative path with null prefix is disallowed */ |
| 124 | |
| 125 | return (AE_BAD_PARAMETER); |
| 126 | } |
| 127 | |
| 128 | /* Find the Node and convert to a handle */ |
| 129 | |
| 130 | status = |
| 131 | acpi_ns_get_node(prefix_node, pathname, ACPI_NS_NO_UPSEARCH, &node); |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 132 | if (ACPI_SUCCESS(status)) { |
Bob Moore | f24b664 | 2009-12-11 14:57:00 +0800 | [diff] [blame] | 133 | *ret_handle = ACPI_CAST_PTR(acpi_handle, node); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 134 | } |
| 135 | |
| 136 | return (status); |
| 137 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 138 | |
Bob Moore | 8313524 | 2006-10-03 00:00:00 -0400 | [diff] [blame] | 139 | ACPI_EXPORT_SYMBOL(acpi_get_handle) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 140 | |
| 141 | /****************************************************************************** |
| 142 | * |
| 143 | * FUNCTION: acpi_get_name |
| 144 | * |
Bob Moore | ba494be | 2012-07-12 09:40:10 +0800 | [diff] [blame] | 145 | * PARAMETERS: handle - Handle to be converted to a pathname |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 146 | * name_type - Full pathname or single segment |
Bob Moore | ba494be | 2012-07-12 09:40:10 +0800 | [diff] [blame] | 147 | * buffer - Buffer for returned path |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 148 | * |
| 149 | * RETURN: Pointer to a string containing the fully qualified Name. |
| 150 | * |
| 151 | * DESCRIPTION: This routine returns the fully qualified name associated with |
Bob Moore | 73a3090 | 2012-10-31 02:26:55 +0000 | [diff] [blame] | 152 | * the Handle parameter. This and the acpi_pathname_to_handle are |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 153 | * complementary functions. |
| 154 | * |
| 155 | ******************************************************************************/ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 156 | acpi_status |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 157 | acpi_get_name(acpi_handle handle, u32 name_type, struct acpi_buffer * buffer) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 158 | { |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 159 | acpi_status status; |
| 160 | struct acpi_namespace_node *node; |
Jung-uk Kim | bbe707e | 2013-07-17 09:48:58 +0800 | [diff] [blame] | 161 | char *node_name; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 162 | |
| 163 | /* Parameter validation */ |
| 164 | |
| 165 | if (name_type > ACPI_NAME_TYPE_MAX) { |
| 166 | return (AE_BAD_PARAMETER); |
| 167 | } |
| 168 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 169 | status = acpi_ut_validate_buffer(buffer); |
| 170 | if (ACPI_FAILURE(status)) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 171 | return (status); |
| 172 | } |
| 173 | |
| 174 | if (name_type == ACPI_FULL_PATHNAME) { |
Bob Moore | 52fc0b0 | 2006-10-02 00:00:00 -0400 | [diff] [blame] | 175 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 176 | /* Get the full pathname (From the namespace root) */ |
| 177 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 178 | status = acpi_ns_handle_to_pathname(handle, buffer); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 179 | return (status); |
| 180 | } |
| 181 | |
| 182 | /* |
| 183 | * Wants the single segment ACPI name. |
| 184 | * Validate handle and convert to a namespace Node |
| 185 | */ |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 186 | status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); |
| 187 | if (ACPI_FAILURE(status)) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 188 | return (status); |
| 189 | } |
| 190 | |
Bob Moore | f24b664 | 2009-12-11 14:57:00 +0800 | [diff] [blame] | 191 | node = acpi_ns_validate_handle(handle); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 192 | if (!node) { |
| 193 | status = AE_BAD_PARAMETER; |
| 194 | goto unlock_and_exit; |
| 195 | } |
| 196 | |
| 197 | /* Validate/Allocate/Clear caller buffer */ |
| 198 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 199 | status = acpi_ut_initialize_buffer(buffer, ACPI_PATH_SEGMENT_LENGTH); |
| 200 | if (ACPI_FAILURE(status)) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 201 | goto unlock_and_exit; |
| 202 | } |
| 203 | |
| 204 | /* Just copy the ACPI name from the Node and zero terminate it */ |
| 205 | |
Jung-uk Kim | bbe707e | 2013-07-17 09:48:58 +0800 | [diff] [blame] | 206 | node_name = acpi_ut_get_node_name(node); |
| 207 | ACPI_MOVE_NAME(buffer->pointer, node_name); |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 208 | ((char *)buffer->pointer)[ACPI_NAME_SIZE] = 0; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 209 | status = AE_OK; |
| 210 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 211 | unlock_and_exit: |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 212 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 213 | (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 214 | return (status); |
| 215 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 216 | |
Bob Moore | 8313524 | 2006-10-03 00:00:00 -0400 | [diff] [blame] | 217 | ACPI_EXPORT_SYMBOL(acpi_get_name) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 218 | |
| 219 | /****************************************************************************** |
| 220 | * |
Bob Moore | 15b8dd5 | 2009-06-29 13:39:29 +0800 | [diff] [blame] | 221 | * FUNCTION: acpi_ns_copy_device_id |
| 222 | * |
Lv Zheng | 78e25fe | 2012-10-31 02:25:24 +0000 | [diff] [blame] | 223 | * PARAMETERS: dest - Pointer to the destination PNP_DEVICE_ID |
| 224 | * source - Pointer to the source PNP_DEVICE_ID |
Bob Moore | 15b8dd5 | 2009-06-29 13:39:29 +0800 | [diff] [blame] | 225 | * string_area - Pointer to where to copy the dest string |
| 226 | * |
| 227 | * RETURN: Pointer to the next string area |
| 228 | * |
Lv Zheng | 78e25fe | 2012-10-31 02:25:24 +0000 | [diff] [blame] | 229 | * DESCRIPTION: Copy a single PNP_DEVICE_ID, including the string data. |
Bob Moore | 15b8dd5 | 2009-06-29 13:39:29 +0800 | [diff] [blame] | 230 | * |
| 231 | ******************************************************************************/ |
Lv Zheng | 78e25fe | 2012-10-31 02:25:24 +0000 | [diff] [blame] | 232 | static char *acpi_ns_copy_device_id(struct acpi_pnp_device_id *dest, |
| 233 | struct acpi_pnp_device_id *source, |
Bob Moore | 15b8dd5 | 2009-06-29 13:39:29 +0800 | [diff] [blame] | 234 | char *string_area) |
| 235 | { |
Bob Moore | 413fc3f | 2012-10-31 02:28:38 +0000 | [diff] [blame] | 236 | |
Lv Zheng | 78e25fe | 2012-10-31 02:25:24 +0000 | [diff] [blame] | 237 | /* Create the destination PNP_DEVICE_ID */ |
Bob Moore | 15b8dd5 | 2009-06-29 13:39:29 +0800 | [diff] [blame] | 238 | |
| 239 | dest->string = string_area; |
| 240 | dest->length = source->length; |
| 241 | |
| 242 | /* Copy actual string and return a pointer to the next string area */ |
| 243 | |
| 244 | ACPI_MEMCPY(string_area, source->string, source->length); |
| 245 | return (string_area + source->length); |
| 246 | } |
| 247 | |
| 248 | /****************************************************************************** |
| 249 | * |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 250 | * FUNCTION: acpi_get_object_info |
| 251 | * |
Bob Moore | ba494be | 2012-07-12 09:40:10 +0800 | [diff] [blame] | 252 | * PARAMETERS: handle - Object Handle |
Bob Moore | 15b8dd5 | 2009-06-29 13:39:29 +0800 | [diff] [blame] | 253 | * return_buffer - Where the info is returned |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 254 | * |
| 255 | * RETURN: Status |
| 256 | * |
| 257 | * DESCRIPTION: Returns information about an object as gleaned from the |
| 258 | * namespace node and possibly by running several standard |
| 259 | * control methods (Such as in the case of a device.) |
| 260 | * |
Bob Moore | 413fc3f | 2012-10-31 02:28:38 +0000 | [diff] [blame] | 261 | * For Device and Processor objects, run the Device _HID, _UID, _CID, _SUB, |
| 262 | * _STA, _ADR, _sx_w, and _sx_d methods. |
Bob Moore | 15b8dd5 | 2009-06-29 13:39:29 +0800 | [diff] [blame] | 263 | * |
| 264 | * Note: Allocates the return buffer, must be freed by the caller. |
| 265 | * |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 266 | ******************************************************************************/ |
Bob Moore | 15b8dd5 | 2009-06-29 13:39:29 +0800 | [diff] [blame] | 267 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 268 | acpi_status |
Bob Moore | 15b8dd5 | 2009-06-29 13:39:29 +0800 | [diff] [blame] | 269 | acpi_get_object_info(acpi_handle handle, |
| 270 | struct acpi_device_info **return_buffer) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 271 | { |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 272 | struct acpi_namespace_node *node; |
| 273 | struct acpi_device_info *info; |
Lv Zheng | 78e25fe | 2012-10-31 02:25:24 +0000 | [diff] [blame] | 274 | struct acpi_pnp_device_id_list *cid_list = NULL; |
| 275 | struct acpi_pnp_device_id *hid = NULL; |
| 276 | struct acpi_pnp_device_id *uid = NULL; |
Bob Moore | 413fc3f | 2012-10-31 02:28:38 +0000 | [diff] [blame] | 277 | struct acpi_pnp_device_id *sub = NULL; |
Bob Moore | 15b8dd5 | 2009-06-29 13:39:29 +0800 | [diff] [blame] | 278 | char *next_id_string; |
| 279 | acpi_object_type type; |
| 280 | acpi_name name; |
| 281 | u8 param_count = 0; |
| 282 | u8 valid = 0; |
| 283 | u32 info_size; |
| 284 | u32 i; |
| 285 | acpi_status status; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 286 | |
| 287 | /* Parameter validation */ |
| 288 | |
Bob Moore | 15b8dd5 | 2009-06-29 13:39:29 +0800 | [diff] [blame] | 289 | if (!handle || !return_buffer) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 290 | return (AE_BAD_PARAMETER); |
| 291 | } |
| 292 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 293 | status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); |
| 294 | if (ACPI_FAILURE(status)) { |
Bob Moore | ef0b67f | 2012-12-19 05:38:36 +0000 | [diff] [blame] | 295 | return (status); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 296 | } |
| 297 | |
Bob Moore | f24b664 | 2009-12-11 14:57:00 +0800 | [diff] [blame] | 298 | node = acpi_ns_validate_handle(handle); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 299 | if (!node) { |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 300 | (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); |
Bob Moore | 15b8dd5 | 2009-06-29 13:39:29 +0800 | [diff] [blame] | 301 | return (AE_BAD_PARAMETER); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 302 | } |
| 303 | |
Bob Moore | 15b8dd5 | 2009-06-29 13:39:29 +0800 | [diff] [blame] | 304 | /* Get the namespace node data while the namespace is locked */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 305 | |
Bob Moore | 15b8dd5 | 2009-06-29 13:39:29 +0800 | [diff] [blame] | 306 | info_size = sizeof(struct acpi_device_info); |
| 307 | type = node->type; |
| 308 | name = node->name.integer; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 309 | |
Bob Moore | 0a1fbf2 | 2008-07-04 10:53:58 +0800 | [diff] [blame] | 310 | if (node->type == ACPI_TYPE_METHOD) { |
Bob Moore | 15b8dd5 | 2009-06-29 13:39:29 +0800 | [diff] [blame] | 311 | param_count = node->object->method.param_count; |
Bob Moore | 0a1fbf2 | 2008-07-04 10:53:58 +0800 | [diff] [blame] | 312 | } |
| 313 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 314 | status = acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); |
| 315 | if (ACPI_FAILURE(status)) { |
Bob Moore | 15b8dd5 | 2009-06-29 13:39:29 +0800 | [diff] [blame] | 316 | return (status); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 317 | } |
| 318 | |
Bob Moore | 15b8dd5 | 2009-06-29 13:39:29 +0800 | [diff] [blame] | 319 | if ((type == ACPI_TYPE_DEVICE) || (type == ACPI_TYPE_PROCESSOR)) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 320 | /* |
Bob Moore | 15b8dd5 | 2009-06-29 13:39:29 +0800 | [diff] [blame] | 321 | * Get extra info for ACPI Device/Processor objects only: |
Bob Moore | 413fc3f | 2012-10-31 02:28:38 +0000 | [diff] [blame] | 322 | * Run the Device _HID, _UID, _SUB, and _CID methods. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 323 | * |
| 324 | * Note: none of these methods are required, so they may or may |
Bob Moore | 15b8dd5 | 2009-06-29 13:39:29 +0800 | [diff] [blame] | 325 | * not be present for this device. The Info->Valid bitfield is used |
| 326 | * to indicate which methods were found and run successfully. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 327 | */ |
| 328 | |
| 329 | /* Execute the Device._HID method */ |
| 330 | |
Bob Moore | 15b8dd5 | 2009-06-29 13:39:29 +0800 | [diff] [blame] | 331 | status = acpi_ut_execute_HID(node, &hid); |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 332 | if (ACPI_SUCCESS(status)) { |
Bob Moore | 15b8dd5 | 2009-06-29 13:39:29 +0800 | [diff] [blame] | 333 | info_size += hid->length; |
| 334 | valid |= ACPI_VALID_HID; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 335 | } |
| 336 | |
| 337 | /* Execute the Device._UID method */ |
| 338 | |
Bob Moore | 15b8dd5 | 2009-06-29 13:39:29 +0800 | [diff] [blame] | 339 | status = acpi_ut_execute_UID(node, &uid); |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 340 | if (ACPI_SUCCESS(status)) { |
Bob Moore | 15b8dd5 | 2009-06-29 13:39:29 +0800 | [diff] [blame] | 341 | info_size += uid->length; |
| 342 | valid |= ACPI_VALID_UID; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 343 | } |
| 344 | |
Bob Moore | 413fc3f | 2012-10-31 02:28:38 +0000 | [diff] [blame] | 345 | /* Execute the Device._SUB method */ |
| 346 | |
| 347 | status = acpi_ut_execute_SUB(node, &sub); |
| 348 | if (ACPI_SUCCESS(status)) { |
| 349 | info_size += sub->length; |
| 350 | valid |= ACPI_VALID_SUB; |
| 351 | } |
| 352 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 353 | /* Execute the Device._CID method */ |
| 354 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 355 | status = acpi_ut_execute_CID(node, &cid_list); |
| 356 | if (ACPI_SUCCESS(status)) { |
Bob Moore | 15b8dd5 | 2009-06-29 13:39:29 +0800 | [diff] [blame] | 357 | |
| 358 | /* Add size of CID strings and CID pointer array */ |
| 359 | |
| 360 | info_size += |
| 361 | (cid_list->list_size - |
Lv Zheng | 78e25fe | 2012-10-31 02:25:24 +0000 | [diff] [blame] | 362 | sizeof(struct acpi_pnp_device_id_list)); |
Bob Moore | 15b8dd5 | 2009-06-29 13:39:29 +0800 | [diff] [blame] | 363 | valid |= ACPI_VALID_CID; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 364 | } |
Bob Moore | 15b8dd5 | 2009-06-29 13:39:29 +0800 | [diff] [blame] | 365 | } |
| 366 | |
| 367 | /* |
| 368 | * Now that we have the variable-length data, we can allocate the |
| 369 | * return buffer |
| 370 | */ |
| 371 | info = ACPI_ALLOCATE_ZEROED(info_size); |
| 372 | if (!info) { |
| 373 | status = AE_NO_MEMORY; |
| 374 | goto cleanup; |
| 375 | } |
| 376 | |
| 377 | /* Get the fixed-length data */ |
| 378 | |
| 379 | if ((type == ACPI_TYPE_DEVICE) || (type == ACPI_TYPE_PROCESSOR)) { |
| 380 | /* |
| 381 | * Get extra info for ACPI Device/Processor objects only: |
| 382 | * Run the _STA, _ADR and, sx_w, and _sx_d methods. |
| 383 | * |
Bob Moore | a7d5caf | 2013-07-17 09:48:15 +0800 | [diff] [blame] | 384 | * Notes: none of these methods are required, so they may or may |
Bob Moore | 15b8dd5 | 2009-06-29 13:39:29 +0800 | [diff] [blame] | 385 | * not be present for this device. The Info->Valid bitfield is used |
| 386 | * to indicate which methods were found and run successfully. |
Bob Moore | a7d5caf | 2013-07-17 09:48:15 +0800 | [diff] [blame] | 387 | * |
| 388 | * For _STA, if the method does not exist, then (as per the ACPI |
| 389 | * specification), the returned current_status flags will indicate |
| 390 | * that the device is present/functional/enabled. Otherwise, the |
| 391 | * current_status flags reflect the value returned from _STA. |
Bob Moore | 15b8dd5 | 2009-06-29 13:39:29 +0800 | [diff] [blame] | 392 | */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 393 | |
| 394 | /* Execute the Device._STA method */ |
| 395 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 396 | status = acpi_ut_execute_STA(node, &info->current_status); |
| 397 | if (ACPI_SUCCESS(status)) { |
Bob Moore | 15b8dd5 | 2009-06-29 13:39:29 +0800 | [diff] [blame] | 398 | valid |= ACPI_VALID_STA; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 399 | } |
| 400 | |
| 401 | /* Execute the Device._ADR method */ |
| 402 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 403 | status = acpi_ut_evaluate_numeric_object(METHOD_NAME__ADR, node, |
| 404 | &info->address); |
| 405 | if (ACPI_SUCCESS(status)) { |
Bob Moore | 15b8dd5 | 2009-06-29 13:39:29 +0800 | [diff] [blame] | 406 | valid |= ACPI_VALID_ADR; |
| 407 | } |
| 408 | |
| 409 | /* Execute the Device._sx_w methods */ |
| 410 | |
| 411 | status = acpi_ut_execute_power_methods(node, |
| 412 | acpi_gbl_lowest_dstate_names, |
| 413 | ACPI_NUM_sx_w_METHODS, |
| 414 | info->lowest_dstates); |
| 415 | if (ACPI_SUCCESS(status)) { |
| 416 | valid |= ACPI_VALID_SXWS; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 417 | } |
| 418 | |
| 419 | /* Execute the Device._sx_d methods */ |
| 420 | |
Bob Moore | 15b8dd5 | 2009-06-29 13:39:29 +0800 | [diff] [blame] | 421 | status = acpi_ut_execute_power_methods(node, |
| 422 | acpi_gbl_highest_dstate_names, |
| 423 | ACPI_NUM_sx_d_METHODS, |
| 424 | info->highest_dstates); |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 425 | if (ACPI_SUCCESS(status)) { |
Bob Moore | 15b8dd5 | 2009-06-29 13:39:29 +0800 | [diff] [blame] | 426 | valid |= ACPI_VALID_SXDS; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 427 | } |
| 428 | } |
| 429 | |
Bob Moore | 15b8dd5 | 2009-06-29 13:39:29 +0800 | [diff] [blame] | 430 | /* |
| 431 | * Create a pointer to the string area of the return buffer. |
| 432 | * Point to the end of the base struct acpi_device_info structure. |
| 433 | */ |
| 434 | next_id_string = ACPI_CAST_PTR(char, info->compatible_id_list.ids); |
| 435 | if (cid_list) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 436 | |
Lv Zheng | 78e25fe | 2012-10-31 02:25:24 +0000 | [diff] [blame] | 437 | /* Point past the CID PNP_DEVICE_ID array */ |
Bob Moore | 15b8dd5 | 2009-06-29 13:39:29 +0800 | [diff] [blame] | 438 | |
| 439 | next_id_string += |
| 440 | ((acpi_size) cid_list->count * |
Lv Zheng | 78e25fe | 2012-10-31 02:25:24 +0000 | [diff] [blame] | 441 | sizeof(struct acpi_pnp_device_id)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 442 | } |
| 443 | |
Bob Moore | 15b8dd5 | 2009-06-29 13:39:29 +0800 | [diff] [blame] | 444 | /* |
Bob Moore | 413fc3f | 2012-10-31 02:28:38 +0000 | [diff] [blame] | 445 | * Copy the HID, UID, SUB, and CIDs to the return buffer. |
| 446 | * The variable-length strings are copied to the reserved area |
| 447 | * at the end of the buffer. |
Bob Moore | 15b8dd5 | 2009-06-29 13:39:29 +0800 | [diff] [blame] | 448 | * |
| 449 | * For HID and CID, check if the ID is a PCI Root Bridge. |
| 450 | */ |
| 451 | if (hid) { |
| 452 | next_id_string = acpi_ns_copy_device_id(&info->hardware_id, |
| 453 | hid, next_id_string); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 454 | |
Bob Moore | 15b8dd5 | 2009-06-29 13:39:29 +0800 | [diff] [blame] | 455 | if (acpi_ut_is_pci_root_bridge(hid->string)) { |
| 456 | info->flags |= ACPI_PCI_ROOT_BRIDGE; |
| 457 | } |
| 458 | } |
| 459 | |
| 460 | if (uid) { |
| 461 | next_id_string = acpi_ns_copy_device_id(&info->unique_id, |
| 462 | uid, next_id_string); |
| 463 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 464 | |
Bob Moore | 413fc3f | 2012-10-31 02:28:38 +0000 | [diff] [blame] | 465 | if (sub) { |
| 466 | next_id_string = acpi_ns_copy_device_id(&info->subsystem_id, |
| 467 | sub, next_id_string); |
| 468 | } |
| 469 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 470 | if (cid_list) { |
Bob Moore | 15b8dd5 | 2009-06-29 13:39:29 +0800 | [diff] [blame] | 471 | info->compatible_id_list.count = cid_list->count; |
| 472 | info->compatible_id_list.list_size = cid_list->list_size; |
| 473 | |
| 474 | /* Copy each CID */ |
| 475 | |
| 476 | for (i = 0; i < cid_list->count; i++) { |
| 477 | next_id_string = |
| 478 | acpi_ns_copy_device_id(&info->compatible_id_list. |
| 479 | ids[i], &cid_list->ids[i], |
| 480 | next_id_string); |
| 481 | |
| 482 | if (acpi_ut_is_pci_root_bridge(cid_list->ids[i].string)) { |
| 483 | info->flags |= ACPI_PCI_ROOT_BRIDGE; |
| 484 | } |
| 485 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 486 | } |
| 487 | |
Bob Moore | 15b8dd5 | 2009-06-29 13:39:29 +0800 | [diff] [blame] | 488 | /* Copy the fixed-length data */ |
| 489 | |
| 490 | info->info_size = info_size; |
| 491 | info->type = type; |
| 492 | info->name = name; |
| 493 | info->param_count = param_count; |
| 494 | info->valid = valid; |
| 495 | |
| 496 | *return_buffer = info; |
| 497 | status = AE_OK; |
| 498 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 499 | cleanup: |
Bob Moore | 15b8dd5 | 2009-06-29 13:39:29 +0800 | [diff] [blame] | 500 | if (hid) { |
| 501 | ACPI_FREE(hid); |
| 502 | } |
| 503 | if (uid) { |
| 504 | ACPI_FREE(uid); |
| 505 | } |
Bob Moore | 413fc3f | 2012-10-31 02:28:38 +0000 | [diff] [blame] | 506 | if (sub) { |
| 507 | ACPI_FREE(sub); |
| 508 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 509 | if (cid_list) { |
Bob Moore | 8313524 | 2006-10-03 00:00:00 -0400 | [diff] [blame] | 510 | ACPI_FREE(cid_list); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 511 | } |
| 512 | return (status); |
| 513 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 514 | |
Bob Moore | 8313524 | 2006-10-03 00:00:00 -0400 | [diff] [blame] | 515 | ACPI_EXPORT_SYMBOL(acpi_get_object_info) |
Lin Ming | b2f7ddc | 2009-05-21 10:42:09 +0800 | [diff] [blame] | 516 | |
| 517 | /****************************************************************************** |
| 518 | * |
| 519 | * FUNCTION: acpi_install_method |
| 520 | * |
Bob Moore | ba494be | 2012-07-12 09:40:10 +0800 | [diff] [blame] | 521 | * PARAMETERS: buffer - An ACPI table containing one control method |
Lin Ming | b2f7ddc | 2009-05-21 10:42:09 +0800 | [diff] [blame] | 522 | * |
| 523 | * RETURN: Status |
| 524 | * |
| 525 | * DESCRIPTION: Install a control method into the namespace. If the method |
| 526 | * name already exists in the namespace, it is overwritten. The |
| 527 | * input buffer must contain a valid DSDT or SSDT containing a |
| 528 | * single control method. |
| 529 | * |
| 530 | ******************************************************************************/ |
| 531 | acpi_status acpi_install_method(u8 *buffer) |
| 532 | { |
| 533 | struct acpi_table_header *table = |
| 534 | ACPI_CAST_PTR(struct acpi_table_header, buffer); |
| 535 | u8 *aml_buffer; |
| 536 | u8 *aml_start; |
| 537 | char *path; |
| 538 | struct acpi_namespace_node *node; |
| 539 | union acpi_operand_object *method_obj; |
| 540 | struct acpi_parse_state parser_state; |
| 541 | u32 aml_length; |
| 542 | u16 opcode; |
| 543 | u8 method_flags; |
| 544 | acpi_status status; |
| 545 | |
| 546 | /* Parameter validation */ |
| 547 | |
| 548 | if (!buffer) { |
Lv Zheng | 9c0d793 | 2012-12-19 05:37:21 +0000 | [diff] [blame] | 549 | return (AE_BAD_PARAMETER); |
Lin Ming | b2f7ddc | 2009-05-21 10:42:09 +0800 | [diff] [blame] | 550 | } |
| 551 | |
| 552 | /* Table must be a DSDT or SSDT */ |
| 553 | |
| 554 | if (!ACPI_COMPARE_NAME(table->signature, ACPI_SIG_DSDT) && |
| 555 | !ACPI_COMPARE_NAME(table->signature, ACPI_SIG_SSDT)) { |
Lv Zheng | 9c0d793 | 2012-12-19 05:37:21 +0000 | [diff] [blame] | 556 | return (AE_BAD_HEADER); |
Lin Ming | b2f7ddc | 2009-05-21 10:42:09 +0800 | [diff] [blame] | 557 | } |
| 558 | |
| 559 | /* First AML opcode in the table must be a control method */ |
| 560 | |
| 561 | parser_state.aml = buffer + sizeof(struct acpi_table_header); |
| 562 | opcode = acpi_ps_peek_opcode(&parser_state); |
| 563 | if (opcode != AML_METHOD_OP) { |
Lv Zheng | 9c0d793 | 2012-12-19 05:37:21 +0000 | [diff] [blame] | 564 | return (AE_BAD_PARAMETER); |
Lin Ming | b2f7ddc | 2009-05-21 10:42:09 +0800 | [diff] [blame] | 565 | } |
| 566 | |
| 567 | /* Extract method information from the raw AML */ |
| 568 | |
| 569 | parser_state.aml += acpi_ps_get_opcode_size(opcode); |
| 570 | parser_state.pkg_end = acpi_ps_get_next_package_end(&parser_state); |
| 571 | path = acpi_ps_get_next_namestring(&parser_state); |
| 572 | method_flags = *parser_state.aml++; |
| 573 | aml_start = parser_state.aml; |
| 574 | aml_length = ACPI_PTR_DIFF(parser_state.pkg_end, aml_start); |
| 575 | |
| 576 | /* |
| 577 | * Allocate resources up-front. We don't want to have to delete a new |
| 578 | * node from the namespace if we cannot allocate memory. |
| 579 | */ |
| 580 | aml_buffer = ACPI_ALLOCATE(aml_length); |
| 581 | if (!aml_buffer) { |
Lv Zheng | 9c0d793 | 2012-12-19 05:37:21 +0000 | [diff] [blame] | 582 | return (AE_NO_MEMORY); |
Lin Ming | b2f7ddc | 2009-05-21 10:42:09 +0800 | [diff] [blame] | 583 | } |
| 584 | |
| 585 | method_obj = acpi_ut_create_internal_object(ACPI_TYPE_METHOD); |
| 586 | if (!method_obj) { |
| 587 | ACPI_FREE(aml_buffer); |
Lv Zheng | 9c0d793 | 2012-12-19 05:37:21 +0000 | [diff] [blame] | 588 | return (AE_NO_MEMORY); |
Lin Ming | b2f7ddc | 2009-05-21 10:42:09 +0800 | [diff] [blame] | 589 | } |
| 590 | |
| 591 | /* Lock namespace for acpi_ns_lookup, we may be creating a new node */ |
| 592 | |
| 593 | status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); |
| 594 | if (ACPI_FAILURE(status)) { |
| 595 | goto error_exit; |
| 596 | } |
| 597 | |
| 598 | /* The lookup either returns an existing node or creates a new one */ |
| 599 | |
| 600 | status = |
| 601 | acpi_ns_lookup(NULL, path, ACPI_TYPE_METHOD, ACPI_IMODE_LOAD_PASS1, |
| 602 | ACPI_NS_DONT_OPEN_SCOPE | ACPI_NS_ERROR_IF_FOUND, |
| 603 | NULL, &node); |
| 604 | |
| 605 | (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); |
| 606 | |
| 607 | if (ACPI_FAILURE(status)) { /* ns_lookup */ |
| 608 | if (status != AE_ALREADY_EXISTS) { |
| 609 | goto error_exit; |
| 610 | } |
| 611 | |
| 612 | /* Node existed previously, make sure it is a method node */ |
| 613 | |
| 614 | if (node->type != ACPI_TYPE_METHOD) { |
| 615 | status = AE_TYPE; |
| 616 | goto error_exit; |
| 617 | } |
| 618 | } |
| 619 | |
| 620 | /* Copy the method AML to the local buffer */ |
| 621 | |
| 622 | ACPI_MEMCPY(aml_buffer, aml_start, aml_length); |
| 623 | |
| 624 | /* Initialize the method object with the new method's information */ |
| 625 | |
| 626 | method_obj->method.aml_start = aml_buffer; |
| 627 | method_obj->method.aml_length = aml_length; |
| 628 | |
| 629 | method_obj->method.param_count = (u8) |
| 630 | (method_flags & AML_METHOD_ARG_COUNT); |
| 631 | |
Lin Ming | b2f7ddc | 2009-05-21 10:42:09 +0800 | [diff] [blame] | 632 | if (method_flags & AML_METHOD_SERIALIZED) { |
Lin Ming | 2629484 | 2011-01-12 09:19:43 +0800 | [diff] [blame] | 633 | method_obj->method.info_flags = ACPI_METHOD_SERIALIZED; |
| 634 | |
Lin Ming | b2f7ddc | 2009-05-21 10:42:09 +0800 | [diff] [blame] | 635 | method_obj->method.sync_level = (u8) |
| 636 | ((method_flags & AML_METHOD_SYNC_LEVEL) >> 4); |
| 637 | } |
| 638 | |
| 639 | /* |
| 640 | * Now that it is complete, we can attach the new method object to |
| 641 | * the method Node (detaches/deletes any existing object) |
| 642 | */ |
| 643 | status = acpi_ns_attach_object(node, method_obj, ACPI_TYPE_METHOD); |
| 644 | |
| 645 | /* |
| 646 | * Flag indicates AML buffer is dynamic, must be deleted later. |
| 647 | * Must be set only after attach above. |
| 648 | */ |
| 649 | node->flags |= ANOBJ_ALLOCATED_BUFFER; |
| 650 | |
| 651 | /* Remove local reference to the method object */ |
| 652 | |
| 653 | acpi_ut_remove_reference(method_obj); |
Lv Zheng | 9c0d793 | 2012-12-19 05:37:21 +0000 | [diff] [blame] | 654 | return (status); |
Lin Ming | b2f7ddc | 2009-05-21 10:42:09 +0800 | [diff] [blame] | 655 | |
| 656 | error_exit: |
| 657 | |
| 658 | ACPI_FREE(aml_buffer); |
| 659 | ACPI_FREE(method_obj); |
Lv Zheng | 9c0d793 | 2012-12-19 05:37:21 +0000 | [diff] [blame] | 660 | return (status); |
Lin Ming | b2f7ddc | 2009-05-21 10:42:09 +0800 | [diff] [blame] | 661 | } |
| 662 | ACPI_EXPORT_SYMBOL(acpi_install_method) |