11da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds/****************************************************************************** 21da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * 31da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * Module Name: nsxfname - Public interfaces to the ACPI subsystem 41da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * ACPI Namespace oriented interfaces 51da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * 61da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds *****************************************************************************/ 71da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 81da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds/* 9fbb7a2dc2be493c87399550bdc2ddaa510cdf450Bob Moore * Copyright (C) 2000 - 2014, Intel Corp. 101da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * All rights reserved. 111da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * 121da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * Redistribution and use in source and binary forms, with or without 131da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * modification, are permitted provided that the following conditions 141da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * are met: 151da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * 1. Redistributions of source code must retain the above copyright 161da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * notice, this list of conditions, and the following disclaimer, 171da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * without modification. 181da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * 2. Redistributions in binary form must reproduce at minimum a disclaimer 191da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * substantially similar to the "NO WARRANTY" disclaimer below 201da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * ("Disclaimer") and any redistribution must be conditioned upon 211da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * including a substantially similar Disclaimer requirement for further 221da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * binary redistribution. 231da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * 3. Neither the names of the above-listed copyright holders nor the names 241da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * of any contributors may be used to endorse or promote products derived 251da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * from this software without specific prior written permission. 261da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * 271da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * Alternatively, this software may be distributed under the terms of the 281da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * GNU General Public License ("GPL") version 2 as published by the Free 291da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * Software Foundation. 301da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * 311da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * NO WARRANTY 321da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 331da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 341da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR 351da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 361da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 371da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 381da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 391da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 401da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 411da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 421da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * POSSIBILITY OF SUCH DAMAGES. 431da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds */ 441da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 45839e928f5bbb695c31ddc23cf3fae3cf1c9e9f20Lv Zheng#define EXPORT_ACPI_INTERFACES 46839e928f5bbb695c31ddc23cf3fae3cf1c9e9f20Lv Zheng 471da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#include <acpi/acpi.h> 48e2f7a7772880458edff1b1cc5a988947229fac26Len Brown#include "accommon.h" 49e2f7a7772880458edff1b1cc5a988947229fac26Len Brown#include "acnamesp.h" 50b2f7ddcfcb9c2436896cb339a7ff70245648f033Lin Ming#include "acparser.h" 51b2f7ddcfcb9c2436896cb339a7ff70245648f033Lin Ming#include "amlcode.h" 521da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 531da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define _COMPONENT ACPI_NAMESPACE 544be44fcd3bf648b782f4460fd06dfae6c42ded4bLen BrownACPI_MODULE_NAME("nsxfname") 551da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 5615b8dd53f5ffaf8e2d9095c423f713423f576c0fBob Moore/* Local prototypes */ 5778e25fef2751434f38c7f711ecbf8762f79f7318Lv Zhengstatic char *acpi_ns_copy_device_id(struct acpi_pnp_device_id *dest, 5878e25fef2751434f38c7f711ecbf8762f79f7318Lv Zheng struct acpi_pnp_device_id *source, 5915b8dd53f5ffaf8e2d9095c423f713423f576c0fBob Moore char *string_area); 6015b8dd53f5ffaf8e2d9095c423f713423f576c0fBob Moore 611da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds/****************************************************************************** 621da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * 631da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * FUNCTION: acpi_get_handle 641da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * 65ba494beeaa69bc0fb01eb89464ad5d57d26e3901Bob Moore * PARAMETERS: parent - Object to search under (search scope). 66ba494beeaa69bc0fb01eb89464ad5d57d26e3901Bob Moore * pathname - Pointer to an asciiz string containing the 6744f6c01242da4e162f28d8e1216a8c7a91174605Robert Moore * name 6844f6c01242da4e162f28d8e1216a8c7a91174605Robert Moore * ret_handle - Where the return handle is returned 691da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * 701da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * RETURN: Status 711da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * 721da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * DESCRIPTION: This routine will search for a caller specified name in the 7373a3090a2160fb01317f5a44af6ee5a064a29625Bob Moore * name space. The caller can restrict the search region by 7473a3090a2160fb01317f5a44af6ee5a064a29625Bob Moore * specifying a non NULL parent. The parent value is itself a 751da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * namespace handle. 761da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * 771da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds ******************************************************************************/ 7815b8dd53f5ffaf8e2d9095c423f713423f576c0fBob Moore 791da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldsacpi_status 804be44fcd3bf648b782f4460fd06dfae6c42ded4bLen Brownacpi_get_handle(acpi_handle parent, 814be44fcd3bf648b782f4460fd06dfae6c42ded4bLen Brown acpi_string pathname, acpi_handle * ret_handle) 821da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds{ 834be44fcd3bf648b782f4460fd06dfae6c42ded4bLen Brown acpi_status status; 844be44fcd3bf648b782f4460fd06dfae6c42ded4bLen Brown struct acpi_namespace_node *node = NULL; 854be44fcd3bf648b782f4460fd06dfae6c42ded4bLen Brown struct acpi_namespace_node *prefix_node = NULL; 861da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 874be44fcd3bf648b782f4460fd06dfae6c42ded4bLen Brown ACPI_FUNCTION_ENTRY(); 881da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 891da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds /* Parameter Validation */ 901da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 911da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds if (!ret_handle || !pathname) { 921da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds return (AE_BAD_PARAMETER); 931da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds } 941da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 951da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds /* Convert a parent handle to a prefix node */ 961da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 971da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds if (parent) { 98f24b664dc44a4ab4df61db2258cea298eeb43a8eBob Moore prefix_node = acpi_ns_validate_handle(parent); 991da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds if (!prefix_node) { 1001da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds return (AE_BAD_PARAMETER); 1011da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds } 102f1c2b1daf040d2feebfbbd4a0cd80cde856fc031Bob Moore } 103f1c2b1daf040d2feebfbbd4a0cd80cde856fc031Bob Moore 104f1c2b1daf040d2feebfbbd4a0cd80cde856fc031Bob Moore /* 105f1c2b1daf040d2feebfbbd4a0cd80cde856fc031Bob Moore * Valid cases are: 106f1c2b1daf040d2feebfbbd4a0cd80cde856fc031Bob Moore * 1) Fully qualified pathname 107f1c2b1daf040d2feebfbbd4a0cd80cde856fc031Bob Moore * 2) Parent + Relative pathname 108f1c2b1daf040d2feebfbbd4a0cd80cde856fc031Bob Moore * 109f1c2b1daf040d2feebfbbd4a0cd80cde856fc031Bob Moore * Error for <null Parent + relative path> 110f1c2b1daf040d2feebfbbd4a0cd80cde856fc031Bob Moore */ 11104a81dce13c672757637b759039de216ed29a536Bob Moore if (ACPI_IS_ROOT_PREFIX(pathname[0])) { 1121da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 113f1c2b1daf040d2feebfbbd4a0cd80cde856fc031Bob Moore /* Pathname is fully qualified (starts with '\') */ 114f1c2b1daf040d2feebfbbd4a0cd80cde856fc031Bob Moore 115f1c2b1daf040d2feebfbbd4a0cd80cde856fc031Bob Moore /* Special case for root-only, since we can't search for it */ 116f1c2b1daf040d2feebfbbd4a0cd80cde856fc031Bob Moore 117f1c2b1daf040d2feebfbbd4a0cd80cde856fc031Bob Moore if (!ACPI_STRCMP(pathname, ACPI_NS_ROOT_PATH)) { 118f1c2b1daf040d2feebfbbd4a0cd80cde856fc031Bob Moore *ret_handle = 119f24b664dc44a4ab4df61db2258cea298eeb43a8eBob Moore ACPI_CAST_PTR(acpi_handle, acpi_gbl_root_node); 120f1c2b1daf040d2feebfbbd4a0cd80cde856fc031Bob Moore return (AE_OK); 1211da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds } 122f1c2b1daf040d2feebfbbd4a0cd80cde856fc031Bob Moore } else if (!prefix_node) { 1231da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 124f1c2b1daf040d2feebfbbd4a0cd80cde856fc031Bob Moore /* Relative path with null prefix is disallowed */ 1251da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 126f1c2b1daf040d2feebfbbd4a0cd80cde856fc031Bob Moore return (AE_BAD_PARAMETER); 1271da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds } 1281da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 129f1c2b1daf040d2feebfbbd4a0cd80cde856fc031Bob Moore /* Find the Node and convert to a handle */ 1301da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 131f1c2b1daf040d2feebfbbd4a0cd80cde856fc031Bob Moore status = 132f1c2b1daf040d2feebfbbd4a0cd80cde856fc031Bob Moore acpi_ns_get_node(prefix_node, pathname, ACPI_NS_NO_UPSEARCH, &node); 1334be44fcd3bf648b782f4460fd06dfae6c42ded4bLen Brown if (ACPI_SUCCESS(status)) { 134f24b664dc44a4ab4df61db2258cea298eeb43a8eBob Moore *ret_handle = ACPI_CAST_PTR(acpi_handle, node); 1351da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds } 1361da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 1371da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds return (status); 1381da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds} 1391da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 1408313524a0d466f451a62709aaedf988d8257b21cBob MooreACPI_EXPORT_SYMBOL(acpi_get_handle) 1411da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 1421da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds/****************************************************************************** 1431da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * 1441da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * FUNCTION: acpi_get_name 1451da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * 146ba494beeaa69bc0fb01eb89464ad5d57d26e3901Bob Moore * PARAMETERS: handle - Handle to be converted to a pathname 1471da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * name_type - Full pathname or single segment 148ba494beeaa69bc0fb01eb89464ad5d57d26e3901Bob Moore * buffer - Buffer for returned path 1491da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * 1501da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * RETURN: Pointer to a string containing the fully qualified Name. 1511da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * 1521da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * DESCRIPTION: This routine returns the fully qualified name associated with 15373a3090a2160fb01317f5a44af6ee5a064a29625Bob Moore * the Handle parameter. This and the acpi_pathname_to_handle are 1541da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * complementary functions. 1551da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * 1561da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds ******************************************************************************/ 1571da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldsacpi_status 1584be44fcd3bf648b782f4460fd06dfae6c42ded4bLen Brownacpi_get_name(acpi_handle handle, u32 name_type, struct acpi_buffer * buffer) 1591da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds{ 1604be44fcd3bf648b782f4460fd06dfae6c42ded4bLen Brown acpi_status status; 1614be44fcd3bf648b782f4460fd06dfae6c42ded4bLen Brown struct acpi_namespace_node *node; 162bbe707eddca7f5d03613f38ad8d6b0253a47f5a8Jung-uk Kim char *node_name; 1631da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 1641da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds /* Parameter validation */ 1651da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 1661da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds if (name_type > ACPI_NAME_TYPE_MAX) { 1671da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds return (AE_BAD_PARAMETER); 1681da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds } 1691da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 1704be44fcd3bf648b782f4460fd06dfae6c42ded4bLen Brown status = acpi_ut_validate_buffer(buffer); 1714be44fcd3bf648b782f4460fd06dfae6c42ded4bLen Brown if (ACPI_FAILURE(status)) { 1721da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds return (status); 1731da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds } 1741da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 1751da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds if (name_type == ACPI_FULL_PATHNAME) { 17652fc0b026e99b5d5d585095148d997d5634bbc25Bob Moore 1771da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds /* Get the full pathname (From the namespace root) */ 1781da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 1794be44fcd3bf648b782f4460fd06dfae6c42ded4bLen Brown status = acpi_ns_handle_to_pathname(handle, buffer); 1801da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds return (status); 1811da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds } 1821da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 1831da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds /* 1841da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * Wants the single segment ACPI name. 1851da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * Validate handle and convert to a namespace Node 1861da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds */ 1874be44fcd3bf648b782f4460fd06dfae6c42ded4bLen Brown status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); 1884be44fcd3bf648b782f4460fd06dfae6c42ded4bLen Brown if (ACPI_FAILURE(status)) { 1891da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds return (status); 1901da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds } 1911da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 192f24b664dc44a4ab4df61db2258cea298eeb43a8eBob Moore node = acpi_ns_validate_handle(handle); 1931da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds if (!node) { 1941da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds status = AE_BAD_PARAMETER; 1951da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds goto unlock_and_exit; 1961da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds } 1971da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 1981da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds /* Validate/Allocate/Clear caller buffer */ 1991da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 2004be44fcd3bf648b782f4460fd06dfae6c42ded4bLen Brown status = acpi_ut_initialize_buffer(buffer, ACPI_PATH_SEGMENT_LENGTH); 2014be44fcd3bf648b782f4460fd06dfae6c42ded4bLen Brown if (ACPI_FAILURE(status)) { 2021da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds goto unlock_and_exit; 2031da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds } 2041da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 2051da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds /* Just copy the ACPI name from the Node and zero terminate it */ 2061da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 207bbe707eddca7f5d03613f38ad8d6b0253a47f5a8Jung-uk Kim node_name = acpi_ut_get_node_name(node); 208bbe707eddca7f5d03613f38ad8d6b0253a47f5a8Jung-uk Kim ACPI_MOVE_NAME(buffer->pointer, node_name); 2094be44fcd3bf648b782f4460fd06dfae6c42ded4bLen Brown ((char *)buffer->pointer)[ACPI_NAME_SIZE] = 0; 2101da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds status = AE_OK; 2111da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 21210622bf8ce432e6a53fd3c37163e99e99c9e43eeLv Zhengunlock_and_exit: 2131da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 2144be44fcd3bf648b782f4460fd06dfae6c42ded4bLen Brown (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); 2151da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds return (status); 2161da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds} 2171da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 2188313524a0d466f451a62709aaedf988d8257b21cBob MooreACPI_EXPORT_SYMBOL(acpi_get_name) 2191da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 2201da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds/****************************************************************************** 2211da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * 22215b8dd53f5ffaf8e2d9095c423f713423f576c0fBob Moore * FUNCTION: acpi_ns_copy_device_id 22315b8dd53f5ffaf8e2d9095c423f713423f576c0fBob Moore * 22478e25fef2751434f38c7f711ecbf8762f79f7318Lv Zheng * PARAMETERS: dest - Pointer to the destination PNP_DEVICE_ID 22578e25fef2751434f38c7f711ecbf8762f79f7318Lv Zheng * source - Pointer to the source PNP_DEVICE_ID 22615b8dd53f5ffaf8e2d9095c423f713423f576c0fBob Moore * string_area - Pointer to where to copy the dest string 22715b8dd53f5ffaf8e2d9095c423f713423f576c0fBob Moore * 22815b8dd53f5ffaf8e2d9095c423f713423f576c0fBob Moore * RETURN: Pointer to the next string area 22915b8dd53f5ffaf8e2d9095c423f713423f576c0fBob Moore * 23078e25fef2751434f38c7f711ecbf8762f79f7318Lv Zheng * DESCRIPTION: Copy a single PNP_DEVICE_ID, including the string data. 23115b8dd53f5ffaf8e2d9095c423f713423f576c0fBob Moore * 23215b8dd53f5ffaf8e2d9095c423f713423f576c0fBob Moore ******************************************************************************/ 23378e25fef2751434f38c7f711ecbf8762f79f7318Lv Zhengstatic char *acpi_ns_copy_device_id(struct acpi_pnp_device_id *dest, 23478e25fef2751434f38c7f711ecbf8762f79f7318Lv Zheng struct acpi_pnp_device_id *source, 23515b8dd53f5ffaf8e2d9095c423f713423f576c0fBob Moore char *string_area) 23615b8dd53f5ffaf8e2d9095c423f713423f576c0fBob Moore{ 237413fc3f592c65977858f8adce2e7af0e82aa1191Bob Moore 23878e25fef2751434f38c7f711ecbf8762f79f7318Lv Zheng /* Create the destination PNP_DEVICE_ID */ 23915b8dd53f5ffaf8e2d9095c423f713423f576c0fBob Moore 24015b8dd53f5ffaf8e2d9095c423f713423f576c0fBob Moore dest->string = string_area; 24115b8dd53f5ffaf8e2d9095c423f713423f576c0fBob Moore dest->length = source->length; 24215b8dd53f5ffaf8e2d9095c423f713423f576c0fBob Moore 24315b8dd53f5ffaf8e2d9095c423f713423f576c0fBob Moore /* Copy actual string and return a pointer to the next string area */ 24415b8dd53f5ffaf8e2d9095c423f713423f576c0fBob Moore 24515b8dd53f5ffaf8e2d9095c423f713423f576c0fBob Moore ACPI_MEMCPY(string_area, source->string, source->length); 24615b8dd53f5ffaf8e2d9095c423f713423f576c0fBob Moore return (string_area + source->length); 24715b8dd53f5ffaf8e2d9095c423f713423f576c0fBob Moore} 24815b8dd53f5ffaf8e2d9095c423f713423f576c0fBob Moore 24915b8dd53f5ffaf8e2d9095c423f713423f576c0fBob Moore/****************************************************************************** 25015b8dd53f5ffaf8e2d9095c423f713423f576c0fBob Moore * 2511da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * FUNCTION: acpi_get_object_info 2521da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * 253ba494beeaa69bc0fb01eb89464ad5d57d26e3901Bob Moore * PARAMETERS: handle - Object Handle 25415b8dd53f5ffaf8e2d9095c423f713423f576c0fBob Moore * return_buffer - Where the info is returned 2551da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * 2561da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * RETURN: Status 2571da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * 2581da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * DESCRIPTION: Returns information about an object as gleaned from the 2591da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * namespace node and possibly by running several standard 2601da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * control methods (Such as in the case of a device.) 2611da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * 262413fc3f592c65977858f8adce2e7af0e82aa1191Bob Moore * For Device and Processor objects, run the Device _HID, _UID, _CID, _SUB, 263413fc3f592c65977858f8adce2e7af0e82aa1191Bob Moore * _STA, _ADR, _sx_w, and _sx_d methods. 26415b8dd53f5ffaf8e2d9095c423f713423f576c0fBob Moore * 26515b8dd53f5ffaf8e2d9095c423f713423f576c0fBob Moore * Note: Allocates the return buffer, must be freed by the caller. 26615b8dd53f5ffaf8e2d9095c423f713423f576c0fBob Moore * 2671da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds ******************************************************************************/ 26815b8dd53f5ffaf8e2d9095c423f713423f576c0fBob Moore 2691da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldsacpi_status 27015b8dd53f5ffaf8e2d9095c423f713423f576c0fBob Mooreacpi_get_object_info(acpi_handle handle, 27115b8dd53f5ffaf8e2d9095c423f713423f576c0fBob Moore struct acpi_device_info **return_buffer) 2721da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds{ 2734be44fcd3bf648b782f4460fd06dfae6c42ded4bLen Brown struct acpi_namespace_node *node; 2744be44fcd3bf648b782f4460fd06dfae6c42ded4bLen Brown struct acpi_device_info *info; 27578e25fef2751434f38c7f711ecbf8762f79f7318Lv Zheng struct acpi_pnp_device_id_list *cid_list = NULL; 27678e25fef2751434f38c7f711ecbf8762f79f7318Lv Zheng struct acpi_pnp_device_id *hid = NULL; 27778e25fef2751434f38c7f711ecbf8762f79f7318Lv Zheng struct acpi_pnp_device_id *uid = NULL; 278413fc3f592c65977858f8adce2e7af0e82aa1191Bob Moore struct acpi_pnp_device_id *sub = NULL; 27915b8dd53f5ffaf8e2d9095c423f713423f576c0fBob Moore char *next_id_string; 28015b8dd53f5ffaf8e2d9095c423f713423f576c0fBob Moore acpi_object_type type; 28115b8dd53f5ffaf8e2d9095c423f713423f576c0fBob Moore acpi_name name; 28215b8dd53f5ffaf8e2d9095c423f713423f576c0fBob Moore u8 param_count = 0; 28315b8dd53f5ffaf8e2d9095c423f713423f576c0fBob Moore u8 valid = 0; 28415b8dd53f5ffaf8e2d9095c423f713423f576c0fBob Moore u32 info_size; 28515b8dd53f5ffaf8e2d9095c423f713423f576c0fBob Moore u32 i; 28615b8dd53f5ffaf8e2d9095c423f713423f576c0fBob Moore acpi_status status; 2871da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 2881da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds /* Parameter validation */ 2891da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 29015b8dd53f5ffaf8e2d9095c423f713423f576c0fBob Moore if (!handle || !return_buffer) { 2911da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds return (AE_BAD_PARAMETER); 2921da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds } 2931da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 2944be44fcd3bf648b782f4460fd06dfae6c42ded4bLen Brown status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); 2954be44fcd3bf648b782f4460fd06dfae6c42ded4bLen Brown if (ACPI_FAILURE(status)) { 296ef0b67fe2db6aad8b604f9f09e1452f421a7b124Bob Moore return (status); 2971da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds } 2981da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 299f24b664dc44a4ab4df61db2258cea298eeb43a8eBob Moore node = acpi_ns_validate_handle(handle); 3001da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds if (!node) { 3014be44fcd3bf648b782f4460fd06dfae6c42ded4bLen Brown (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); 30215b8dd53f5ffaf8e2d9095c423f713423f576c0fBob Moore return (AE_BAD_PARAMETER); 3031da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds } 3041da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 30515b8dd53f5ffaf8e2d9095c423f713423f576c0fBob Moore /* Get the namespace node data while the namespace is locked */ 3061da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 30715b8dd53f5ffaf8e2d9095c423f713423f576c0fBob Moore info_size = sizeof(struct acpi_device_info); 30815b8dd53f5ffaf8e2d9095c423f713423f576c0fBob Moore type = node->type; 30915b8dd53f5ffaf8e2d9095c423f713423f576c0fBob Moore name = node->name.integer; 3101da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 3110a1fbf2db0d275f0f8160bb9c3e51c4df5bafdc2Bob Moore if (node->type == ACPI_TYPE_METHOD) { 31215b8dd53f5ffaf8e2d9095c423f713423f576c0fBob Moore param_count = node->object->method.param_count; 3130a1fbf2db0d275f0f8160bb9c3e51c4df5bafdc2Bob Moore } 3140a1fbf2db0d275f0f8160bb9c3e51c4df5bafdc2Bob Moore 3154be44fcd3bf648b782f4460fd06dfae6c42ded4bLen Brown status = acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); 3164be44fcd3bf648b782f4460fd06dfae6c42ded4bLen Brown if (ACPI_FAILURE(status)) { 31715b8dd53f5ffaf8e2d9095c423f713423f576c0fBob Moore return (status); 3181da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds } 3191da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 32015b8dd53f5ffaf8e2d9095c423f713423f576c0fBob Moore if ((type == ACPI_TYPE_DEVICE) || (type == ACPI_TYPE_PROCESSOR)) { 3211da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds /* 32215b8dd53f5ffaf8e2d9095c423f713423f576c0fBob Moore * Get extra info for ACPI Device/Processor objects only: 323413fc3f592c65977858f8adce2e7af0e82aa1191Bob Moore * Run the Device _HID, _UID, _SUB, and _CID methods. 3241da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * 3251da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * Note: none of these methods are required, so they may or may 32615b8dd53f5ffaf8e2d9095c423f713423f576c0fBob Moore * not be present for this device. The Info->Valid bitfield is used 32715b8dd53f5ffaf8e2d9095c423f713423f576c0fBob Moore * to indicate which methods were found and run successfully. 3281da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds */ 3291da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 3301da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds /* Execute the Device._HID method */ 3311da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 33215b8dd53f5ffaf8e2d9095c423f713423f576c0fBob Moore status = acpi_ut_execute_HID(node, &hid); 3334be44fcd3bf648b782f4460fd06dfae6c42ded4bLen Brown if (ACPI_SUCCESS(status)) { 33415b8dd53f5ffaf8e2d9095c423f713423f576c0fBob Moore info_size += hid->length; 33515b8dd53f5ffaf8e2d9095c423f713423f576c0fBob Moore valid |= ACPI_VALID_HID; 3361da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds } 3371da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 3381da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds /* Execute the Device._UID method */ 3391da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 34015b8dd53f5ffaf8e2d9095c423f713423f576c0fBob Moore status = acpi_ut_execute_UID(node, &uid); 3414be44fcd3bf648b782f4460fd06dfae6c42ded4bLen Brown if (ACPI_SUCCESS(status)) { 34215b8dd53f5ffaf8e2d9095c423f713423f576c0fBob Moore info_size += uid->length; 34315b8dd53f5ffaf8e2d9095c423f713423f576c0fBob Moore valid |= ACPI_VALID_UID; 3441da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds } 3451da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 346413fc3f592c65977858f8adce2e7af0e82aa1191Bob Moore /* Execute the Device._SUB method */ 347413fc3f592c65977858f8adce2e7af0e82aa1191Bob Moore 348413fc3f592c65977858f8adce2e7af0e82aa1191Bob Moore status = acpi_ut_execute_SUB(node, &sub); 349413fc3f592c65977858f8adce2e7af0e82aa1191Bob Moore if (ACPI_SUCCESS(status)) { 350413fc3f592c65977858f8adce2e7af0e82aa1191Bob Moore info_size += sub->length; 351413fc3f592c65977858f8adce2e7af0e82aa1191Bob Moore valid |= ACPI_VALID_SUB; 352413fc3f592c65977858f8adce2e7af0e82aa1191Bob Moore } 353413fc3f592c65977858f8adce2e7af0e82aa1191Bob Moore 3541da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds /* Execute the Device._CID method */ 3551da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 3564be44fcd3bf648b782f4460fd06dfae6c42ded4bLen Brown status = acpi_ut_execute_CID(node, &cid_list); 3574be44fcd3bf648b782f4460fd06dfae6c42ded4bLen Brown if (ACPI_SUCCESS(status)) { 35815b8dd53f5ffaf8e2d9095c423f713423f576c0fBob Moore 35915b8dd53f5ffaf8e2d9095c423f713423f576c0fBob Moore /* Add size of CID strings and CID pointer array */ 36015b8dd53f5ffaf8e2d9095c423f713423f576c0fBob Moore 36115b8dd53f5ffaf8e2d9095c423f713423f576c0fBob Moore info_size += 36215b8dd53f5ffaf8e2d9095c423f713423f576c0fBob Moore (cid_list->list_size - 36378e25fef2751434f38c7f711ecbf8762f79f7318Lv Zheng sizeof(struct acpi_pnp_device_id_list)); 36415b8dd53f5ffaf8e2d9095c423f713423f576c0fBob Moore valid |= ACPI_VALID_CID; 3651da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds } 36615b8dd53f5ffaf8e2d9095c423f713423f576c0fBob Moore } 36715b8dd53f5ffaf8e2d9095c423f713423f576c0fBob Moore 36815b8dd53f5ffaf8e2d9095c423f713423f576c0fBob Moore /* 36915b8dd53f5ffaf8e2d9095c423f713423f576c0fBob Moore * Now that we have the variable-length data, we can allocate the 37015b8dd53f5ffaf8e2d9095c423f713423f576c0fBob Moore * return buffer 37115b8dd53f5ffaf8e2d9095c423f713423f576c0fBob Moore */ 37215b8dd53f5ffaf8e2d9095c423f713423f576c0fBob Moore info = ACPI_ALLOCATE_ZEROED(info_size); 37315b8dd53f5ffaf8e2d9095c423f713423f576c0fBob Moore if (!info) { 37415b8dd53f5ffaf8e2d9095c423f713423f576c0fBob Moore status = AE_NO_MEMORY; 37515b8dd53f5ffaf8e2d9095c423f713423f576c0fBob Moore goto cleanup; 37615b8dd53f5ffaf8e2d9095c423f713423f576c0fBob Moore } 37715b8dd53f5ffaf8e2d9095c423f713423f576c0fBob Moore 37815b8dd53f5ffaf8e2d9095c423f713423f576c0fBob Moore /* Get the fixed-length data */ 37915b8dd53f5ffaf8e2d9095c423f713423f576c0fBob Moore 38015b8dd53f5ffaf8e2d9095c423f713423f576c0fBob Moore if ((type == ACPI_TYPE_DEVICE) || (type == ACPI_TYPE_PROCESSOR)) { 38115b8dd53f5ffaf8e2d9095c423f713423f576c0fBob Moore /* 38215b8dd53f5ffaf8e2d9095c423f713423f576c0fBob Moore * Get extra info for ACPI Device/Processor objects only: 38315b8dd53f5ffaf8e2d9095c423f713423f576c0fBob Moore * Run the _STA, _ADR and, sx_w, and _sx_d methods. 38415b8dd53f5ffaf8e2d9095c423f713423f576c0fBob Moore * 385a7d5caf6d21814a855422df75c2d8c093cb2019aBob Moore * Notes: none of these methods are required, so they may or may 38615b8dd53f5ffaf8e2d9095c423f713423f576c0fBob Moore * not be present for this device. The Info->Valid bitfield is used 38715b8dd53f5ffaf8e2d9095c423f713423f576c0fBob Moore * to indicate which methods were found and run successfully. 388a7d5caf6d21814a855422df75c2d8c093cb2019aBob Moore * 389a7d5caf6d21814a855422df75c2d8c093cb2019aBob Moore * For _STA, if the method does not exist, then (as per the ACPI 390a7d5caf6d21814a855422df75c2d8c093cb2019aBob Moore * specification), the returned current_status flags will indicate 391a7d5caf6d21814a855422df75c2d8c093cb2019aBob Moore * that the device is present/functional/enabled. Otherwise, the 392a7d5caf6d21814a855422df75c2d8c093cb2019aBob Moore * current_status flags reflect the value returned from _STA. 39315b8dd53f5ffaf8e2d9095c423f713423f576c0fBob Moore */ 3941da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 3951da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds /* Execute the Device._STA method */ 3961da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 3974be44fcd3bf648b782f4460fd06dfae6c42ded4bLen Brown status = acpi_ut_execute_STA(node, &info->current_status); 3984be44fcd3bf648b782f4460fd06dfae6c42ded4bLen Brown if (ACPI_SUCCESS(status)) { 39915b8dd53f5ffaf8e2d9095c423f713423f576c0fBob Moore valid |= ACPI_VALID_STA; 4001da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds } 4011da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 4021da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds /* Execute the Device._ADR method */ 4031da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 4044be44fcd3bf648b782f4460fd06dfae6c42ded4bLen Brown status = acpi_ut_evaluate_numeric_object(METHOD_NAME__ADR, node, 4054be44fcd3bf648b782f4460fd06dfae6c42ded4bLen Brown &info->address); 4064be44fcd3bf648b782f4460fd06dfae6c42ded4bLen Brown if (ACPI_SUCCESS(status)) { 40715b8dd53f5ffaf8e2d9095c423f713423f576c0fBob Moore valid |= ACPI_VALID_ADR; 40815b8dd53f5ffaf8e2d9095c423f713423f576c0fBob Moore } 40915b8dd53f5ffaf8e2d9095c423f713423f576c0fBob Moore 41015b8dd53f5ffaf8e2d9095c423f713423f576c0fBob Moore /* Execute the Device._sx_w methods */ 41115b8dd53f5ffaf8e2d9095c423f713423f576c0fBob Moore 41215b8dd53f5ffaf8e2d9095c423f713423f576c0fBob Moore status = acpi_ut_execute_power_methods(node, 41315b8dd53f5ffaf8e2d9095c423f713423f576c0fBob Moore acpi_gbl_lowest_dstate_names, 41415b8dd53f5ffaf8e2d9095c423f713423f576c0fBob Moore ACPI_NUM_sx_w_METHODS, 41515b8dd53f5ffaf8e2d9095c423f713423f576c0fBob Moore info->lowest_dstates); 41615b8dd53f5ffaf8e2d9095c423f713423f576c0fBob Moore if (ACPI_SUCCESS(status)) { 41715b8dd53f5ffaf8e2d9095c423f713423f576c0fBob Moore valid |= ACPI_VALID_SXWS; 4181da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds } 4191da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 4201da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds /* Execute the Device._sx_d methods */ 4211da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 42215b8dd53f5ffaf8e2d9095c423f713423f576c0fBob Moore status = acpi_ut_execute_power_methods(node, 42315b8dd53f5ffaf8e2d9095c423f713423f576c0fBob Moore acpi_gbl_highest_dstate_names, 42415b8dd53f5ffaf8e2d9095c423f713423f576c0fBob Moore ACPI_NUM_sx_d_METHODS, 42515b8dd53f5ffaf8e2d9095c423f713423f576c0fBob Moore info->highest_dstates); 4264be44fcd3bf648b782f4460fd06dfae6c42ded4bLen Brown if (ACPI_SUCCESS(status)) { 42715b8dd53f5ffaf8e2d9095c423f713423f576c0fBob Moore valid |= ACPI_VALID_SXDS; 4281da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds } 4291da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds } 4301da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 43115b8dd53f5ffaf8e2d9095c423f713423f576c0fBob Moore /* 43215b8dd53f5ffaf8e2d9095c423f713423f576c0fBob Moore * Create a pointer to the string area of the return buffer. 43315b8dd53f5ffaf8e2d9095c423f713423f576c0fBob Moore * Point to the end of the base struct acpi_device_info structure. 43415b8dd53f5ffaf8e2d9095c423f713423f576c0fBob Moore */ 43515b8dd53f5ffaf8e2d9095c423f713423f576c0fBob Moore next_id_string = ACPI_CAST_PTR(char, info->compatible_id_list.ids); 43615b8dd53f5ffaf8e2d9095c423f713423f576c0fBob Moore if (cid_list) { 4371da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 43878e25fef2751434f38c7f711ecbf8762f79f7318Lv Zheng /* Point past the CID PNP_DEVICE_ID array */ 43915b8dd53f5ffaf8e2d9095c423f713423f576c0fBob Moore 44015b8dd53f5ffaf8e2d9095c423f713423f576c0fBob Moore next_id_string += 44115b8dd53f5ffaf8e2d9095c423f713423f576c0fBob Moore ((acpi_size) cid_list->count * 44278e25fef2751434f38c7f711ecbf8762f79f7318Lv Zheng sizeof(struct acpi_pnp_device_id)); 4431da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds } 4441da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 44515b8dd53f5ffaf8e2d9095c423f713423f576c0fBob Moore /* 446413fc3f592c65977858f8adce2e7af0e82aa1191Bob Moore * Copy the HID, UID, SUB, and CIDs to the return buffer. 447413fc3f592c65977858f8adce2e7af0e82aa1191Bob Moore * The variable-length strings are copied to the reserved area 448413fc3f592c65977858f8adce2e7af0e82aa1191Bob Moore * at the end of the buffer. 44915b8dd53f5ffaf8e2d9095c423f713423f576c0fBob Moore * 45015b8dd53f5ffaf8e2d9095c423f713423f576c0fBob Moore * For HID and CID, check if the ID is a PCI Root Bridge. 45115b8dd53f5ffaf8e2d9095c423f713423f576c0fBob Moore */ 45215b8dd53f5ffaf8e2d9095c423f713423f576c0fBob Moore if (hid) { 45315b8dd53f5ffaf8e2d9095c423f713423f576c0fBob Moore next_id_string = acpi_ns_copy_device_id(&info->hardware_id, 45415b8dd53f5ffaf8e2d9095c423f713423f576c0fBob Moore hid, next_id_string); 45515b8dd53f5ffaf8e2d9095c423f713423f576c0fBob Moore 45615b8dd53f5ffaf8e2d9095c423f713423f576c0fBob Moore if (acpi_ut_is_pci_root_bridge(hid->string)) { 45715b8dd53f5ffaf8e2d9095c423f713423f576c0fBob Moore info->flags |= ACPI_PCI_ROOT_BRIDGE; 45815b8dd53f5ffaf8e2d9095c423f713423f576c0fBob Moore } 45915b8dd53f5ffaf8e2d9095c423f713423f576c0fBob Moore } 4601da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 46115b8dd53f5ffaf8e2d9095c423f713423f576c0fBob Moore if (uid) { 46215b8dd53f5ffaf8e2d9095c423f713423f576c0fBob Moore next_id_string = acpi_ns_copy_device_id(&info->unique_id, 46315b8dd53f5ffaf8e2d9095c423f713423f576c0fBob Moore uid, next_id_string); 46415b8dd53f5ffaf8e2d9095c423f713423f576c0fBob Moore } 4651da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 466413fc3f592c65977858f8adce2e7af0e82aa1191Bob Moore if (sub) { 467413fc3f592c65977858f8adce2e7af0e82aa1191Bob Moore next_id_string = acpi_ns_copy_device_id(&info->subsystem_id, 468413fc3f592c65977858f8adce2e7af0e82aa1191Bob Moore sub, next_id_string); 469413fc3f592c65977858f8adce2e7af0e82aa1191Bob Moore } 470413fc3f592c65977858f8adce2e7af0e82aa1191Bob Moore 4711da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds if (cid_list) { 47215b8dd53f5ffaf8e2d9095c423f713423f576c0fBob Moore info->compatible_id_list.count = cid_list->count; 47315b8dd53f5ffaf8e2d9095c423f713423f576c0fBob Moore info->compatible_id_list.list_size = cid_list->list_size; 47415b8dd53f5ffaf8e2d9095c423f713423f576c0fBob Moore 47515b8dd53f5ffaf8e2d9095c423f713423f576c0fBob Moore /* Copy each CID */ 47615b8dd53f5ffaf8e2d9095c423f713423f576c0fBob Moore 47715b8dd53f5ffaf8e2d9095c423f713423f576c0fBob Moore for (i = 0; i < cid_list->count; i++) { 47815b8dd53f5ffaf8e2d9095c423f713423f576c0fBob Moore next_id_string = 47915b8dd53f5ffaf8e2d9095c423f713423f576c0fBob Moore acpi_ns_copy_device_id(&info->compatible_id_list. 48015b8dd53f5ffaf8e2d9095c423f713423f576c0fBob Moore ids[i], &cid_list->ids[i], 48115b8dd53f5ffaf8e2d9095c423f713423f576c0fBob Moore next_id_string); 48215b8dd53f5ffaf8e2d9095c423f713423f576c0fBob Moore 48315b8dd53f5ffaf8e2d9095c423f713423f576c0fBob Moore if (acpi_ut_is_pci_root_bridge(cid_list->ids[i].string)) { 48415b8dd53f5ffaf8e2d9095c423f713423f576c0fBob Moore info->flags |= ACPI_PCI_ROOT_BRIDGE; 48515b8dd53f5ffaf8e2d9095c423f713423f576c0fBob Moore } 48615b8dd53f5ffaf8e2d9095c423f713423f576c0fBob Moore } 4871da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds } 4881da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 48915b8dd53f5ffaf8e2d9095c423f713423f576c0fBob Moore /* Copy the fixed-length data */ 49015b8dd53f5ffaf8e2d9095c423f713423f576c0fBob Moore 49115b8dd53f5ffaf8e2d9095c423f713423f576c0fBob Moore info->info_size = info_size; 49215b8dd53f5ffaf8e2d9095c423f713423f576c0fBob Moore info->type = type; 49315b8dd53f5ffaf8e2d9095c423f713423f576c0fBob Moore info->name = name; 49415b8dd53f5ffaf8e2d9095c423f713423f576c0fBob Moore info->param_count = param_count; 49515b8dd53f5ffaf8e2d9095c423f713423f576c0fBob Moore info->valid = valid; 49615b8dd53f5ffaf8e2d9095c423f713423f576c0fBob Moore 49715b8dd53f5ffaf8e2d9095c423f713423f576c0fBob Moore *return_buffer = info; 49815b8dd53f5ffaf8e2d9095c423f713423f576c0fBob Moore status = AE_OK; 49915b8dd53f5ffaf8e2d9095c423f713423f576c0fBob Moore 50010622bf8ce432e6a53fd3c37163e99e99c9e43eeLv Zhengcleanup: 50115b8dd53f5ffaf8e2d9095c423f713423f576c0fBob Moore if (hid) { 50215b8dd53f5ffaf8e2d9095c423f713423f576c0fBob Moore ACPI_FREE(hid); 50315b8dd53f5ffaf8e2d9095c423f713423f576c0fBob Moore } 50415b8dd53f5ffaf8e2d9095c423f713423f576c0fBob Moore if (uid) { 50515b8dd53f5ffaf8e2d9095c423f713423f576c0fBob Moore ACPI_FREE(uid); 50615b8dd53f5ffaf8e2d9095c423f713423f576c0fBob Moore } 507413fc3f592c65977858f8adce2e7af0e82aa1191Bob Moore if (sub) { 508413fc3f592c65977858f8adce2e7af0e82aa1191Bob Moore ACPI_FREE(sub); 509413fc3f592c65977858f8adce2e7af0e82aa1191Bob Moore } 5101da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds if (cid_list) { 5118313524a0d466f451a62709aaedf988d8257b21cBob Moore ACPI_FREE(cid_list); 5121da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds } 5131da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds return (status); 5141da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds} 5151da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 5168313524a0d466f451a62709aaedf988d8257b21cBob MooreACPI_EXPORT_SYMBOL(acpi_get_object_info) 517b2f7ddcfcb9c2436896cb339a7ff70245648f033Lin Ming 518b2f7ddcfcb9c2436896cb339a7ff70245648f033Lin Ming/****************************************************************************** 519b2f7ddcfcb9c2436896cb339a7ff70245648f033Lin Ming * 520b2f7ddcfcb9c2436896cb339a7ff70245648f033Lin Ming * FUNCTION: acpi_install_method 521b2f7ddcfcb9c2436896cb339a7ff70245648f033Lin Ming * 522ba494beeaa69bc0fb01eb89464ad5d57d26e3901Bob Moore * PARAMETERS: buffer - An ACPI table containing one control method 523b2f7ddcfcb9c2436896cb339a7ff70245648f033Lin Ming * 524b2f7ddcfcb9c2436896cb339a7ff70245648f033Lin Ming * RETURN: Status 525b2f7ddcfcb9c2436896cb339a7ff70245648f033Lin Ming * 526b2f7ddcfcb9c2436896cb339a7ff70245648f033Lin Ming * DESCRIPTION: Install a control method into the namespace. If the method 527b2f7ddcfcb9c2436896cb339a7ff70245648f033Lin Ming * name already exists in the namespace, it is overwritten. The 528b2f7ddcfcb9c2436896cb339a7ff70245648f033Lin Ming * input buffer must contain a valid DSDT or SSDT containing a 529b2f7ddcfcb9c2436896cb339a7ff70245648f033Lin Ming * single control method. 530b2f7ddcfcb9c2436896cb339a7ff70245648f033Lin Ming * 531b2f7ddcfcb9c2436896cb339a7ff70245648f033Lin Ming ******************************************************************************/ 532b2f7ddcfcb9c2436896cb339a7ff70245648f033Lin Mingacpi_status acpi_install_method(u8 *buffer) 533b2f7ddcfcb9c2436896cb339a7ff70245648f033Lin Ming{ 534b2f7ddcfcb9c2436896cb339a7ff70245648f033Lin Ming struct acpi_table_header *table = 535b2f7ddcfcb9c2436896cb339a7ff70245648f033Lin Ming ACPI_CAST_PTR(struct acpi_table_header, buffer); 536b2f7ddcfcb9c2436896cb339a7ff70245648f033Lin Ming u8 *aml_buffer; 537b2f7ddcfcb9c2436896cb339a7ff70245648f033Lin Ming u8 *aml_start; 538b2f7ddcfcb9c2436896cb339a7ff70245648f033Lin Ming char *path; 539b2f7ddcfcb9c2436896cb339a7ff70245648f033Lin Ming struct acpi_namespace_node *node; 540b2f7ddcfcb9c2436896cb339a7ff70245648f033Lin Ming union acpi_operand_object *method_obj; 541b2f7ddcfcb9c2436896cb339a7ff70245648f033Lin Ming struct acpi_parse_state parser_state; 542b2f7ddcfcb9c2436896cb339a7ff70245648f033Lin Ming u32 aml_length; 543b2f7ddcfcb9c2436896cb339a7ff70245648f033Lin Ming u16 opcode; 544b2f7ddcfcb9c2436896cb339a7ff70245648f033Lin Ming u8 method_flags; 545b2f7ddcfcb9c2436896cb339a7ff70245648f033Lin Ming acpi_status status; 546b2f7ddcfcb9c2436896cb339a7ff70245648f033Lin Ming 547b2f7ddcfcb9c2436896cb339a7ff70245648f033Lin Ming /* Parameter validation */ 548b2f7ddcfcb9c2436896cb339a7ff70245648f033Lin Ming 549b2f7ddcfcb9c2436896cb339a7ff70245648f033Lin Ming if (!buffer) { 5509c0d793945a343e13d8b0ab20ac825ad5705bcf1Lv Zheng return (AE_BAD_PARAMETER); 551b2f7ddcfcb9c2436896cb339a7ff70245648f033Lin Ming } 552b2f7ddcfcb9c2436896cb339a7ff70245648f033Lin Ming 553b2f7ddcfcb9c2436896cb339a7ff70245648f033Lin Ming /* Table must be a DSDT or SSDT */ 554b2f7ddcfcb9c2436896cb339a7ff70245648f033Lin Ming 555b2f7ddcfcb9c2436896cb339a7ff70245648f033Lin Ming if (!ACPI_COMPARE_NAME(table->signature, ACPI_SIG_DSDT) && 556b2f7ddcfcb9c2436896cb339a7ff70245648f033Lin Ming !ACPI_COMPARE_NAME(table->signature, ACPI_SIG_SSDT)) { 5579c0d793945a343e13d8b0ab20ac825ad5705bcf1Lv Zheng return (AE_BAD_HEADER); 558b2f7ddcfcb9c2436896cb339a7ff70245648f033Lin Ming } 559b2f7ddcfcb9c2436896cb339a7ff70245648f033Lin Ming 560b2f7ddcfcb9c2436896cb339a7ff70245648f033Lin Ming /* First AML opcode in the table must be a control method */ 561b2f7ddcfcb9c2436896cb339a7ff70245648f033Lin Ming 562b2f7ddcfcb9c2436896cb339a7ff70245648f033Lin Ming parser_state.aml = buffer + sizeof(struct acpi_table_header); 563b2f7ddcfcb9c2436896cb339a7ff70245648f033Lin Ming opcode = acpi_ps_peek_opcode(&parser_state); 564b2f7ddcfcb9c2436896cb339a7ff70245648f033Lin Ming if (opcode != AML_METHOD_OP) { 5659c0d793945a343e13d8b0ab20ac825ad5705bcf1Lv Zheng return (AE_BAD_PARAMETER); 566b2f7ddcfcb9c2436896cb339a7ff70245648f033Lin Ming } 567b2f7ddcfcb9c2436896cb339a7ff70245648f033Lin Ming 568b2f7ddcfcb9c2436896cb339a7ff70245648f033Lin Ming /* Extract method information from the raw AML */ 569b2f7ddcfcb9c2436896cb339a7ff70245648f033Lin Ming 570b2f7ddcfcb9c2436896cb339a7ff70245648f033Lin Ming parser_state.aml += acpi_ps_get_opcode_size(opcode); 571b2f7ddcfcb9c2436896cb339a7ff70245648f033Lin Ming parser_state.pkg_end = acpi_ps_get_next_package_end(&parser_state); 572b2f7ddcfcb9c2436896cb339a7ff70245648f033Lin Ming path = acpi_ps_get_next_namestring(&parser_state); 573b2f7ddcfcb9c2436896cb339a7ff70245648f033Lin Ming method_flags = *parser_state.aml++; 574b2f7ddcfcb9c2436896cb339a7ff70245648f033Lin Ming aml_start = parser_state.aml; 575b2f7ddcfcb9c2436896cb339a7ff70245648f033Lin Ming aml_length = ACPI_PTR_DIFF(parser_state.pkg_end, aml_start); 576b2f7ddcfcb9c2436896cb339a7ff70245648f033Lin Ming 577b2f7ddcfcb9c2436896cb339a7ff70245648f033Lin Ming /* 578b2f7ddcfcb9c2436896cb339a7ff70245648f033Lin Ming * Allocate resources up-front. We don't want to have to delete a new 579b2f7ddcfcb9c2436896cb339a7ff70245648f033Lin Ming * node from the namespace if we cannot allocate memory. 580b2f7ddcfcb9c2436896cb339a7ff70245648f033Lin Ming */ 581b2f7ddcfcb9c2436896cb339a7ff70245648f033Lin Ming aml_buffer = ACPI_ALLOCATE(aml_length); 582b2f7ddcfcb9c2436896cb339a7ff70245648f033Lin Ming if (!aml_buffer) { 5839c0d793945a343e13d8b0ab20ac825ad5705bcf1Lv Zheng return (AE_NO_MEMORY); 584b2f7ddcfcb9c2436896cb339a7ff70245648f033Lin Ming } 585b2f7ddcfcb9c2436896cb339a7ff70245648f033Lin Ming 586b2f7ddcfcb9c2436896cb339a7ff70245648f033Lin Ming method_obj = acpi_ut_create_internal_object(ACPI_TYPE_METHOD); 587b2f7ddcfcb9c2436896cb339a7ff70245648f033Lin Ming if (!method_obj) { 588b2f7ddcfcb9c2436896cb339a7ff70245648f033Lin Ming ACPI_FREE(aml_buffer); 5899c0d793945a343e13d8b0ab20ac825ad5705bcf1Lv Zheng return (AE_NO_MEMORY); 590b2f7ddcfcb9c2436896cb339a7ff70245648f033Lin Ming } 591b2f7ddcfcb9c2436896cb339a7ff70245648f033Lin Ming 592b2f7ddcfcb9c2436896cb339a7ff70245648f033Lin Ming /* Lock namespace for acpi_ns_lookup, we may be creating a new node */ 593b2f7ddcfcb9c2436896cb339a7ff70245648f033Lin Ming 594b2f7ddcfcb9c2436896cb339a7ff70245648f033Lin Ming status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); 595b2f7ddcfcb9c2436896cb339a7ff70245648f033Lin Ming if (ACPI_FAILURE(status)) { 596b2f7ddcfcb9c2436896cb339a7ff70245648f033Lin Ming goto error_exit; 597b2f7ddcfcb9c2436896cb339a7ff70245648f033Lin Ming } 598b2f7ddcfcb9c2436896cb339a7ff70245648f033Lin Ming 599b2f7ddcfcb9c2436896cb339a7ff70245648f033Lin Ming /* The lookup either returns an existing node or creates a new one */ 600b2f7ddcfcb9c2436896cb339a7ff70245648f033Lin Ming 601b2f7ddcfcb9c2436896cb339a7ff70245648f033Lin Ming status = 602b2f7ddcfcb9c2436896cb339a7ff70245648f033Lin Ming acpi_ns_lookup(NULL, path, ACPI_TYPE_METHOD, ACPI_IMODE_LOAD_PASS1, 603b2f7ddcfcb9c2436896cb339a7ff70245648f033Lin Ming ACPI_NS_DONT_OPEN_SCOPE | ACPI_NS_ERROR_IF_FOUND, 604b2f7ddcfcb9c2436896cb339a7ff70245648f033Lin Ming NULL, &node); 605b2f7ddcfcb9c2436896cb339a7ff70245648f033Lin Ming 606b2f7ddcfcb9c2436896cb339a7ff70245648f033Lin Ming (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); 607b2f7ddcfcb9c2436896cb339a7ff70245648f033Lin Ming 608b2f7ddcfcb9c2436896cb339a7ff70245648f033Lin Ming if (ACPI_FAILURE(status)) { /* ns_lookup */ 609b2f7ddcfcb9c2436896cb339a7ff70245648f033Lin Ming if (status != AE_ALREADY_EXISTS) { 610b2f7ddcfcb9c2436896cb339a7ff70245648f033Lin Ming goto error_exit; 611b2f7ddcfcb9c2436896cb339a7ff70245648f033Lin Ming } 612b2f7ddcfcb9c2436896cb339a7ff70245648f033Lin Ming 613b2f7ddcfcb9c2436896cb339a7ff70245648f033Lin Ming /* Node existed previously, make sure it is a method node */ 614b2f7ddcfcb9c2436896cb339a7ff70245648f033Lin Ming 615b2f7ddcfcb9c2436896cb339a7ff70245648f033Lin Ming if (node->type != ACPI_TYPE_METHOD) { 616b2f7ddcfcb9c2436896cb339a7ff70245648f033Lin Ming status = AE_TYPE; 617b2f7ddcfcb9c2436896cb339a7ff70245648f033Lin Ming goto error_exit; 618b2f7ddcfcb9c2436896cb339a7ff70245648f033Lin Ming } 619b2f7ddcfcb9c2436896cb339a7ff70245648f033Lin Ming } 620b2f7ddcfcb9c2436896cb339a7ff70245648f033Lin Ming 621b2f7ddcfcb9c2436896cb339a7ff70245648f033Lin Ming /* Copy the method AML to the local buffer */ 622b2f7ddcfcb9c2436896cb339a7ff70245648f033Lin Ming 623b2f7ddcfcb9c2436896cb339a7ff70245648f033Lin Ming ACPI_MEMCPY(aml_buffer, aml_start, aml_length); 624b2f7ddcfcb9c2436896cb339a7ff70245648f033Lin Ming 625b2f7ddcfcb9c2436896cb339a7ff70245648f033Lin Ming /* Initialize the method object with the new method's information */ 626b2f7ddcfcb9c2436896cb339a7ff70245648f033Lin Ming 627b2f7ddcfcb9c2436896cb339a7ff70245648f033Lin Ming method_obj->method.aml_start = aml_buffer; 628b2f7ddcfcb9c2436896cb339a7ff70245648f033Lin Ming method_obj->method.aml_length = aml_length; 629b2f7ddcfcb9c2436896cb339a7ff70245648f033Lin Ming 630b2f7ddcfcb9c2436896cb339a7ff70245648f033Lin Ming method_obj->method.param_count = (u8) 631b2f7ddcfcb9c2436896cb339a7ff70245648f033Lin Ming (method_flags & AML_METHOD_ARG_COUNT); 632b2f7ddcfcb9c2436896cb339a7ff70245648f033Lin Ming 633b2f7ddcfcb9c2436896cb339a7ff70245648f033Lin Ming if (method_flags & AML_METHOD_SERIALIZED) { 634262948428878fb340127faca1791acb17146122eLin Ming method_obj->method.info_flags = ACPI_METHOD_SERIALIZED; 635262948428878fb340127faca1791acb17146122eLin Ming 636b2f7ddcfcb9c2436896cb339a7ff70245648f033Lin Ming method_obj->method.sync_level = (u8) 637b2f7ddcfcb9c2436896cb339a7ff70245648f033Lin Ming ((method_flags & AML_METHOD_SYNC_LEVEL) >> 4); 638b2f7ddcfcb9c2436896cb339a7ff70245648f033Lin Ming } 639b2f7ddcfcb9c2436896cb339a7ff70245648f033Lin Ming 640b2f7ddcfcb9c2436896cb339a7ff70245648f033Lin Ming /* 641b2f7ddcfcb9c2436896cb339a7ff70245648f033Lin Ming * Now that it is complete, we can attach the new method object to 642b2f7ddcfcb9c2436896cb339a7ff70245648f033Lin Ming * the method Node (detaches/deletes any existing object) 643b2f7ddcfcb9c2436896cb339a7ff70245648f033Lin Ming */ 644b2f7ddcfcb9c2436896cb339a7ff70245648f033Lin Ming status = acpi_ns_attach_object(node, method_obj, ACPI_TYPE_METHOD); 645b2f7ddcfcb9c2436896cb339a7ff70245648f033Lin Ming 646b2f7ddcfcb9c2436896cb339a7ff70245648f033Lin Ming /* 647b2f7ddcfcb9c2436896cb339a7ff70245648f033Lin Ming * Flag indicates AML buffer is dynamic, must be deleted later. 648b2f7ddcfcb9c2436896cb339a7ff70245648f033Lin Ming * Must be set only after attach above. 649b2f7ddcfcb9c2436896cb339a7ff70245648f033Lin Ming */ 650b2f7ddcfcb9c2436896cb339a7ff70245648f033Lin Ming node->flags |= ANOBJ_ALLOCATED_BUFFER; 651b2f7ddcfcb9c2436896cb339a7ff70245648f033Lin Ming 652b2f7ddcfcb9c2436896cb339a7ff70245648f033Lin Ming /* Remove local reference to the method object */ 653b2f7ddcfcb9c2436896cb339a7ff70245648f033Lin Ming 654b2f7ddcfcb9c2436896cb339a7ff70245648f033Lin Ming acpi_ut_remove_reference(method_obj); 6559c0d793945a343e13d8b0ab20ac825ad5705bcf1Lv Zheng return (status); 656b2f7ddcfcb9c2436896cb339a7ff70245648f033Lin Ming 657b2f7ddcfcb9c2436896cb339a7ff70245648f033Lin Mingerror_exit: 658b2f7ddcfcb9c2436896cb339a7ff70245648f033Lin Ming 659b2f7ddcfcb9c2436896cb339a7ff70245648f033Lin Ming ACPI_FREE(aml_buffer); 660b2f7ddcfcb9c2436896cb339a7ff70245648f033Lin Ming ACPI_FREE(method_obj); 6619c0d793945a343e13d8b0ab20ac825ad5705bcf1Lv Zheng return (status); 662b2f7ddcfcb9c2436896cb339a7ff70245648f033Lin Ming} 663b2f7ddcfcb9c2436896cb339a7ff70245648f033Lin MingACPI_EXPORT_SYMBOL(acpi_install_method) 664