1*95b482a8SLen Brown 2*95b482a8SLen Brown /****************************************************************************** 3*95b482a8SLen Brown * 4*95b482a8SLen Brown * Module Name: exnames - interpreter/scanner name load/execute 5*95b482a8SLen Brown * 6*95b482a8SLen Brown *****************************************************************************/ 7*95b482a8SLen Brown 8*95b482a8SLen Brown /* 9*95b482a8SLen Brown * Copyright (C) 2000 - 2008, Intel Corp. 10*95b482a8SLen Brown * All rights reserved. 11*95b482a8SLen Brown * 12*95b482a8SLen Brown * Redistribution and use in source and binary forms, with or without 13*95b482a8SLen Brown * modification, are permitted provided that the following conditions 14*95b482a8SLen Brown * are met: 15*95b482a8SLen Brown * 1. Redistributions of source code must retain the above copyright 16*95b482a8SLen Brown * notice, this list of conditions, and the following disclaimer, 17*95b482a8SLen Brown * without modification. 18*95b482a8SLen Brown * 2. Redistributions in binary form must reproduce at minimum a disclaimer 19*95b482a8SLen Brown * substantially similar to the "NO WARRANTY" disclaimer below 20*95b482a8SLen Brown * ("Disclaimer") and any redistribution must be conditioned upon 21*95b482a8SLen Brown * including a substantially similar Disclaimer requirement for further 22*95b482a8SLen Brown * binary redistribution. 23*95b482a8SLen Brown * 3. Neither the names of the above-listed copyright holders nor the names 24*95b482a8SLen Brown * of any contributors may be used to endorse or promote products derived 25*95b482a8SLen Brown * from this software without specific prior written permission. 26*95b482a8SLen Brown * 27*95b482a8SLen Brown * Alternatively, this software may be distributed under the terms of the 28*95b482a8SLen Brown * GNU General Public License ("GPL") version 2 as published by the Free 29*95b482a8SLen Brown * Software Foundation. 30*95b482a8SLen Brown * 31*95b482a8SLen Brown * NO WARRANTY 32*95b482a8SLen Brown * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 33*95b482a8SLen Brown * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 34*95b482a8SLen Brown * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR 35*95b482a8SLen Brown * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 36*95b482a8SLen Brown * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 37*95b482a8SLen Brown * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 38*95b482a8SLen Brown * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 39*95b482a8SLen Brown * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 40*95b482a8SLen Brown * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 41*95b482a8SLen Brown * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 42*95b482a8SLen Brown * POSSIBILITY OF SUCH DAMAGES. 43*95b482a8SLen Brown */ 44*95b482a8SLen Brown 45*95b482a8SLen Brown #include <acpi/acpi.h> 46*95b482a8SLen Brown #include <acpi/accommon.h> 47*95b482a8SLen Brown #include <acpi/acinterp.h> 48*95b482a8SLen Brown #include <acpi/amlcode.h> 49*95b482a8SLen Brown 50*95b482a8SLen Brown #define _COMPONENT ACPI_EXECUTER 51*95b482a8SLen Brown ACPI_MODULE_NAME("exnames") 52*95b482a8SLen Brown 53*95b482a8SLen Brown /* Local prototypes */ 54*95b482a8SLen Brown static char *acpi_ex_allocate_name_string(u32 prefix_count, u32 num_name_segs); 55*95b482a8SLen Brown 56*95b482a8SLen Brown static acpi_status 57*95b482a8SLen Brown acpi_ex_name_segment(u8 ** in_aml_address, char *name_string); 58*95b482a8SLen Brown 59*95b482a8SLen Brown /******************************************************************************* 60*95b482a8SLen Brown * 61*95b482a8SLen Brown * FUNCTION: acpi_ex_allocate_name_string 62*95b482a8SLen Brown * 63*95b482a8SLen Brown * PARAMETERS: prefix_count - Count of parent levels. Special cases: 64*95b482a8SLen Brown * (-1)==root, 0==none 65*95b482a8SLen Brown * num_name_segs - count of 4-character name segments 66*95b482a8SLen Brown * 67*95b482a8SLen Brown * RETURN: A pointer to the allocated string segment. This segment must 68*95b482a8SLen Brown * be deleted by the caller. 69*95b482a8SLen Brown * 70*95b482a8SLen Brown * DESCRIPTION: Allocate a buffer for a name string. Ensure allocated name 71*95b482a8SLen Brown * string is long enough, and set up prefix if any. 72*95b482a8SLen Brown * 73*95b482a8SLen Brown ******************************************************************************/ 74*95b482a8SLen Brown 75*95b482a8SLen Brown static char *acpi_ex_allocate_name_string(u32 prefix_count, u32 num_name_segs) 76*95b482a8SLen Brown { 77*95b482a8SLen Brown char *temp_ptr; 78*95b482a8SLen Brown char *name_string; 79*95b482a8SLen Brown u32 size_needed; 80*95b482a8SLen Brown 81*95b482a8SLen Brown ACPI_FUNCTION_TRACE(ex_allocate_name_string); 82*95b482a8SLen Brown 83*95b482a8SLen Brown /* 84*95b482a8SLen Brown * Allow room for all \ and ^ prefixes, all segments and a multi_name_prefix. 85*95b482a8SLen Brown * Also, one byte for the null terminator. 86*95b482a8SLen Brown * This may actually be somewhat longer than needed. 87*95b482a8SLen Brown */ 88*95b482a8SLen Brown if (prefix_count == ACPI_UINT32_MAX) { 89*95b482a8SLen Brown 90*95b482a8SLen Brown /* Special case for root */ 91*95b482a8SLen Brown 92*95b482a8SLen Brown size_needed = 1 + (ACPI_NAME_SIZE * num_name_segs) + 2 + 1; 93*95b482a8SLen Brown } else { 94*95b482a8SLen Brown size_needed = 95*95b482a8SLen Brown prefix_count + (ACPI_NAME_SIZE * num_name_segs) + 2 + 1; 96*95b482a8SLen Brown } 97*95b482a8SLen Brown 98*95b482a8SLen Brown /* 99*95b482a8SLen Brown * Allocate a buffer for the name. 100*95b482a8SLen Brown * This buffer must be deleted by the caller! 101*95b482a8SLen Brown */ 102*95b482a8SLen Brown name_string = ACPI_ALLOCATE(size_needed); 103*95b482a8SLen Brown if (!name_string) { 104*95b482a8SLen Brown ACPI_ERROR((AE_INFO, 105*95b482a8SLen Brown "Could not allocate size %d", size_needed)); 106*95b482a8SLen Brown return_PTR(NULL); 107*95b482a8SLen Brown } 108*95b482a8SLen Brown 109*95b482a8SLen Brown temp_ptr = name_string; 110*95b482a8SLen Brown 111*95b482a8SLen Brown /* Set up Root or Parent prefixes if needed */ 112*95b482a8SLen Brown 113*95b482a8SLen Brown if (prefix_count == ACPI_UINT32_MAX) { 114*95b482a8SLen Brown *temp_ptr++ = AML_ROOT_PREFIX; 115*95b482a8SLen Brown } else { 116*95b482a8SLen Brown while (prefix_count--) { 117*95b482a8SLen Brown *temp_ptr++ = AML_PARENT_PREFIX; 118*95b482a8SLen Brown } 119*95b482a8SLen Brown } 120*95b482a8SLen Brown 121*95b482a8SLen Brown /* Set up Dual or Multi prefixes if needed */ 122*95b482a8SLen Brown 123*95b482a8SLen Brown if (num_name_segs > 2) { 124*95b482a8SLen Brown 125*95b482a8SLen Brown /* Set up multi prefixes */ 126*95b482a8SLen Brown 127*95b482a8SLen Brown *temp_ptr++ = AML_MULTI_NAME_PREFIX_OP; 128*95b482a8SLen Brown *temp_ptr++ = (char)num_name_segs; 129*95b482a8SLen Brown } else if (2 == num_name_segs) { 130*95b482a8SLen Brown 131*95b482a8SLen Brown /* Set up dual prefixes */ 132*95b482a8SLen Brown 133*95b482a8SLen Brown *temp_ptr++ = AML_DUAL_NAME_PREFIX; 134*95b482a8SLen Brown } 135*95b482a8SLen Brown 136*95b482a8SLen Brown /* 137*95b482a8SLen Brown * Terminate string following prefixes. acpi_ex_name_segment() will 138*95b482a8SLen Brown * append the segment(s) 139*95b482a8SLen Brown */ 140*95b482a8SLen Brown *temp_ptr = 0; 141*95b482a8SLen Brown 142*95b482a8SLen Brown return_PTR(name_string); 143*95b482a8SLen Brown } 144*95b482a8SLen Brown 145*95b482a8SLen Brown /******************************************************************************* 146*95b482a8SLen Brown * 147*95b482a8SLen Brown * FUNCTION: acpi_ex_name_segment 148*95b482a8SLen Brown * 149*95b482a8SLen Brown * PARAMETERS: in_aml_address - Pointer to the name in the AML code 150*95b482a8SLen Brown * name_string - Where to return the name. The name is appended 151*95b482a8SLen Brown * to any existing string to form a namepath 152*95b482a8SLen Brown * 153*95b482a8SLen Brown * RETURN: Status 154*95b482a8SLen Brown * 155*95b482a8SLen Brown * DESCRIPTION: Extract an ACPI name (4 bytes) from the AML byte stream 156*95b482a8SLen Brown * 157*95b482a8SLen Brown ******************************************************************************/ 158*95b482a8SLen Brown 159*95b482a8SLen Brown static acpi_status acpi_ex_name_segment(u8 ** in_aml_address, char *name_string) 160*95b482a8SLen Brown { 161*95b482a8SLen Brown char *aml_address = (void *)*in_aml_address; 162*95b482a8SLen Brown acpi_status status = AE_OK; 163*95b482a8SLen Brown u32 index; 164*95b482a8SLen Brown char char_buf[5]; 165*95b482a8SLen Brown 166*95b482a8SLen Brown ACPI_FUNCTION_TRACE(ex_name_segment); 167*95b482a8SLen Brown 168*95b482a8SLen Brown /* 169*95b482a8SLen Brown * If first character is a digit, then we know that we aren't looking at a 170*95b482a8SLen Brown * valid name segment 171*95b482a8SLen Brown */ 172*95b482a8SLen Brown char_buf[0] = *aml_address; 173*95b482a8SLen Brown 174*95b482a8SLen Brown if ('0' <= char_buf[0] && char_buf[0] <= '9') { 175*95b482a8SLen Brown ACPI_ERROR((AE_INFO, "Invalid leading digit: %c", char_buf[0])); 176*95b482a8SLen Brown return_ACPI_STATUS(AE_CTRL_PENDING); 177*95b482a8SLen Brown } 178*95b482a8SLen Brown 179*95b482a8SLen Brown ACPI_DEBUG_PRINT((ACPI_DB_LOAD, "Bytes from stream:\n")); 180*95b482a8SLen Brown 181*95b482a8SLen Brown for (index = 0; (index < ACPI_NAME_SIZE) 182*95b482a8SLen Brown && (acpi_ut_valid_acpi_char(*aml_address, 0)); index++) { 183*95b482a8SLen Brown char_buf[index] = *aml_address++; 184*95b482a8SLen Brown ACPI_DEBUG_PRINT((ACPI_DB_LOAD, "%c\n", char_buf[index])); 185*95b482a8SLen Brown } 186*95b482a8SLen Brown 187*95b482a8SLen Brown /* Valid name segment */ 188*95b482a8SLen Brown 189*95b482a8SLen Brown if (index == 4) { 190*95b482a8SLen Brown 191*95b482a8SLen Brown /* Found 4 valid characters */ 192*95b482a8SLen Brown 193*95b482a8SLen Brown char_buf[4] = '\0'; 194*95b482a8SLen Brown 195*95b482a8SLen Brown if (name_string) { 196*95b482a8SLen Brown ACPI_STRCAT(name_string, char_buf); 197*95b482a8SLen Brown ACPI_DEBUG_PRINT((ACPI_DB_NAMES, 198*95b482a8SLen Brown "Appended to - %s\n", name_string)); 199*95b482a8SLen Brown } else { 200*95b482a8SLen Brown ACPI_DEBUG_PRINT((ACPI_DB_NAMES, 201*95b482a8SLen Brown "No Name string - %s\n", char_buf)); 202*95b482a8SLen Brown } 203*95b482a8SLen Brown } else if (index == 0) { 204*95b482a8SLen Brown /* 205*95b482a8SLen Brown * First character was not a valid name character, 206*95b482a8SLen Brown * so we are looking at something other than a name. 207*95b482a8SLen Brown */ 208*95b482a8SLen Brown ACPI_DEBUG_PRINT((ACPI_DB_INFO, 209*95b482a8SLen Brown "Leading character is not alpha: %02Xh (not a name)\n", 210*95b482a8SLen Brown char_buf[0])); 211*95b482a8SLen Brown status = AE_CTRL_PENDING; 212*95b482a8SLen Brown } else { 213*95b482a8SLen Brown /* 214*95b482a8SLen Brown * Segment started with one or more valid characters, but fewer than 215*95b482a8SLen Brown * the required 4 216*95b482a8SLen Brown */ 217*95b482a8SLen Brown status = AE_AML_BAD_NAME; 218*95b482a8SLen Brown ACPI_ERROR((AE_INFO, 219*95b482a8SLen Brown "Bad character %02x in name, at %p", 220*95b482a8SLen Brown *aml_address, aml_address)); 221*95b482a8SLen Brown } 222*95b482a8SLen Brown 223*95b482a8SLen Brown *in_aml_address = ACPI_CAST_PTR(u8, aml_address); 224*95b482a8SLen Brown return_ACPI_STATUS(status); 225*95b482a8SLen Brown } 226*95b482a8SLen Brown 227*95b482a8SLen Brown /******************************************************************************* 228*95b482a8SLen Brown * 229*95b482a8SLen Brown * FUNCTION: acpi_ex_get_name_string 230*95b482a8SLen Brown * 231*95b482a8SLen Brown * PARAMETERS: data_type - Object type to be associated with this 232*95b482a8SLen Brown * name 233*95b482a8SLen Brown * in_aml_address - Pointer to the namestring in the AML code 234*95b482a8SLen Brown * out_name_string - Where the namestring is returned 235*95b482a8SLen Brown * out_name_length - Length of the returned string 236*95b482a8SLen Brown * 237*95b482a8SLen Brown * RETURN: Status, namestring and length 238*95b482a8SLen Brown * 239*95b482a8SLen Brown * DESCRIPTION: Extract a full namepath from the AML byte stream, 240*95b482a8SLen Brown * including any prefixes. 241*95b482a8SLen Brown * 242*95b482a8SLen Brown ******************************************************************************/ 243*95b482a8SLen Brown 244*95b482a8SLen Brown acpi_status 245*95b482a8SLen Brown acpi_ex_get_name_string(acpi_object_type data_type, 246*95b482a8SLen Brown u8 * in_aml_address, 247*95b482a8SLen Brown char **out_name_string, u32 * out_name_length) 248*95b482a8SLen Brown { 249*95b482a8SLen Brown acpi_status status = AE_OK; 250*95b482a8SLen Brown u8 *aml_address = in_aml_address; 251*95b482a8SLen Brown char *name_string = NULL; 252*95b482a8SLen Brown u32 num_segments; 253*95b482a8SLen Brown u32 prefix_count = 0; 254*95b482a8SLen Brown u8 has_prefix = FALSE; 255*95b482a8SLen Brown 256*95b482a8SLen Brown ACPI_FUNCTION_TRACE_PTR(ex_get_name_string, aml_address); 257*95b482a8SLen Brown 258*95b482a8SLen Brown if (ACPI_TYPE_LOCAL_REGION_FIELD == data_type || 259*95b482a8SLen Brown ACPI_TYPE_LOCAL_BANK_FIELD == data_type || 260*95b482a8SLen Brown ACPI_TYPE_LOCAL_INDEX_FIELD == data_type) { 261*95b482a8SLen Brown 262*95b482a8SLen Brown /* Disallow prefixes for types associated with field_unit names */ 263*95b482a8SLen Brown 264*95b482a8SLen Brown name_string = acpi_ex_allocate_name_string(0, 1); 265*95b482a8SLen Brown if (!name_string) { 266*95b482a8SLen Brown status = AE_NO_MEMORY; 267*95b482a8SLen Brown } else { 268*95b482a8SLen Brown status = 269*95b482a8SLen Brown acpi_ex_name_segment(&aml_address, name_string); 270*95b482a8SLen Brown } 271*95b482a8SLen Brown } else { 272*95b482a8SLen Brown /* 273*95b482a8SLen Brown * data_type is not a field name. 274*95b482a8SLen Brown * Examine first character of name for root or parent prefix operators 275*95b482a8SLen Brown */ 276*95b482a8SLen Brown switch (*aml_address) { 277*95b482a8SLen Brown case AML_ROOT_PREFIX: 278*95b482a8SLen Brown 279*95b482a8SLen Brown ACPI_DEBUG_PRINT((ACPI_DB_LOAD, 280*95b482a8SLen Brown "RootPrefix(\\) at %p\n", 281*95b482a8SLen Brown aml_address)); 282*95b482a8SLen Brown 283*95b482a8SLen Brown /* 284*95b482a8SLen Brown * Remember that we have a root_prefix -- 285*95b482a8SLen Brown * see comment in acpi_ex_allocate_name_string() 286*95b482a8SLen Brown */ 287*95b482a8SLen Brown aml_address++; 288*95b482a8SLen Brown prefix_count = ACPI_UINT32_MAX; 289*95b482a8SLen Brown has_prefix = TRUE; 290*95b482a8SLen Brown break; 291*95b482a8SLen Brown 292*95b482a8SLen Brown case AML_PARENT_PREFIX: 293*95b482a8SLen Brown 294*95b482a8SLen Brown /* Increment past possibly multiple parent prefixes */ 295*95b482a8SLen Brown 296*95b482a8SLen Brown do { 297*95b482a8SLen Brown ACPI_DEBUG_PRINT((ACPI_DB_LOAD, 298*95b482a8SLen Brown "ParentPrefix (^) at %p\n", 299*95b482a8SLen Brown aml_address)); 300*95b482a8SLen Brown 301*95b482a8SLen Brown aml_address++; 302*95b482a8SLen Brown prefix_count++; 303*95b482a8SLen Brown 304*95b482a8SLen Brown } while (*aml_address == AML_PARENT_PREFIX); 305*95b482a8SLen Brown 306*95b482a8SLen Brown has_prefix = TRUE; 307*95b482a8SLen Brown break; 308*95b482a8SLen Brown 309*95b482a8SLen Brown default: 310*95b482a8SLen Brown 311*95b482a8SLen Brown /* Not a prefix character */ 312*95b482a8SLen Brown 313*95b482a8SLen Brown break; 314*95b482a8SLen Brown } 315*95b482a8SLen Brown 316*95b482a8SLen Brown /* Examine first character of name for name segment prefix operator */ 317*95b482a8SLen Brown 318*95b482a8SLen Brown switch (*aml_address) { 319*95b482a8SLen Brown case AML_DUAL_NAME_PREFIX: 320*95b482a8SLen Brown 321*95b482a8SLen Brown ACPI_DEBUG_PRINT((ACPI_DB_LOAD, 322*95b482a8SLen Brown "DualNamePrefix at %p\n", 323*95b482a8SLen Brown aml_address)); 324*95b482a8SLen Brown 325*95b482a8SLen Brown aml_address++; 326*95b482a8SLen Brown name_string = 327*95b482a8SLen Brown acpi_ex_allocate_name_string(prefix_count, 2); 328*95b482a8SLen Brown if (!name_string) { 329*95b482a8SLen Brown status = AE_NO_MEMORY; 330*95b482a8SLen Brown break; 331*95b482a8SLen Brown } 332*95b482a8SLen Brown 333*95b482a8SLen Brown /* Indicate that we processed a prefix */ 334*95b482a8SLen Brown 335*95b482a8SLen Brown has_prefix = TRUE; 336*95b482a8SLen Brown 337*95b482a8SLen Brown status = 338*95b482a8SLen Brown acpi_ex_name_segment(&aml_address, name_string); 339*95b482a8SLen Brown if (ACPI_SUCCESS(status)) { 340*95b482a8SLen Brown status = 341*95b482a8SLen Brown acpi_ex_name_segment(&aml_address, 342*95b482a8SLen Brown name_string); 343*95b482a8SLen Brown } 344*95b482a8SLen Brown break; 345*95b482a8SLen Brown 346*95b482a8SLen Brown case AML_MULTI_NAME_PREFIX_OP: 347*95b482a8SLen Brown 348*95b482a8SLen Brown ACPI_DEBUG_PRINT((ACPI_DB_LOAD, 349*95b482a8SLen Brown "MultiNamePrefix at %p\n", 350*95b482a8SLen Brown aml_address)); 351*95b482a8SLen Brown 352*95b482a8SLen Brown /* Fetch count of segments remaining in name path */ 353*95b482a8SLen Brown 354*95b482a8SLen Brown aml_address++; 355*95b482a8SLen Brown num_segments = *aml_address; 356*95b482a8SLen Brown 357*95b482a8SLen Brown name_string = 358*95b482a8SLen Brown acpi_ex_allocate_name_string(prefix_count, 359*95b482a8SLen Brown num_segments); 360*95b482a8SLen Brown if (!name_string) { 361*95b482a8SLen Brown status = AE_NO_MEMORY; 362*95b482a8SLen Brown break; 363*95b482a8SLen Brown } 364*95b482a8SLen Brown 365*95b482a8SLen Brown /* Indicate that we processed a prefix */ 366*95b482a8SLen Brown 367*95b482a8SLen Brown aml_address++; 368*95b482a8SLen Brown has_prefix = TRUE; 369*95b482a8SLen Brown 370*95b482a8SLen Brown while (num_segments && 371*95b482a8SLen Brown (status = 372*95b482a8SLen Brown acpi_ex_name_segment(&aml_address, 373*95b482a8SLen Brown name_string)) == AE_OK) { 374*95b482a8SLen Brown num_segments--; 375*95b482a8SLen Brown } 376*95b482a8SLen Brown 377*95b482a8SLen Brown break; 378*95b482a8SLen Brown 379*95b482a8SLen Brown case 0: 380*95b482a8SLen Brown 381*95b482a8SLen Brown /* null_name valid as of 8-12-98 ASL/AML Grammar Update */ 382*95b482a8SLen Brown 383*95b482a8SLen Brown if (prefix_count == ACPI_UINT32_MAX) { 384*95b482a8SLen Brown ACPI_DEBUG_PRINT((ACPI_DB_EXEC, 385*95b482a8SLen Brown "NameSeg is \"\\\" followed by NULL\n")); 386*95b482a8SLen Brown } 387*95b482a8SLen Brown 388*95b482a8SLen Brown /* Consume the NULL byte */ 389*95b482a8SLen Brown 390*95b482a8SLen Brown aml_address++; 391*95b482a8SLen Brown name_string = 392*95b482a8SLen Brown acpi_ex_allocate_name_string(prefix_count, 0); 393*95b482a8SLen Brown if (!name_string) { 394*95b482a8SLen Brown status = AE_NO_MEMORY; 395*95b482a8SLen Brown break; 396*95b482a8SLen Brown } 397*95b482a8SLen Brown 398*95b482a8SLen Brown break; 399*95b482a8SLen Brown 400*95b482a8SLen Brown default: 401*95b482a8SLen Brown 402*95b482a8SLen Brown /* Name segment string */ 403*95b482a8SLen Brown 404*95b482a8SLen Brown name_string = 405*95b482a8SLen Brown acpi_ex_allocate_name_string(prefix_count, 1); 406*95b482a8SLen Brown if (!name_string) { 407*95b482a8SLen Brown status = AE_NO_MEMORY; 408*95b482a8SLen Brown break; 409*95b482a8SLen Brown } 410*95b482a8SLen Brown 411*95b482a8SLen Brown status = 412*95b482a8SLen Brown acpi_ex_name_segment(&aml_address, name_string); 413*95b482a8SLen Brown break; 414*95b482a8SLen Brown } 415*95b482a8SLen Brown } 416*95b482a8SLen Brown 417*95b482a8SLen Brown if (AE_CTRL_PENDING == status && has_prefix) { 418*95b482a8SLen Brown 419*95b482a8SLen Brown /* Ran out of segments after processing a prefix */ 420*95b482a8SLen Brown 421*95b482a8SLen Brown ACPI_ERROR((AE_INFO, "Malformed Name at %p", name_string)); 422*95b482a8SLen Brown status = AE_AML_BAD_NAME; 423*95b482a8SLen Brown } 424*95b482a8SLen Brown 425*95b482a8SLen Brown if (ACPI_FAILURE(status)) { 426*95b482a8SLen Brown if (name_string) { 427*95b482a8SLen Brown ACPI_FREE(name_string); 428*95b482a8SLen Brown } 429*95b482a8SLen Brown return_ACPI_STATUS(status); 430*95b482a8SLen Brown } 431*95b482a8SLen Brown 432*95b482a8SLen Brown *out_name_string = name_string; 433*95b482a8SLen Brown *out_name_length = (u32) (aml_address - in_aml_address); 434*95b482a8SLen Brown 435*95b482a8SLen Brown return_ACPI_STATUS(status); 436*95b482a8SLen Brown } 437