1 /****************************************************************************** 2 * 3 * Name: acnamesp.h - Namespace subcomponent prototypes and defines 4 * 5 *****************************************************************************/ 6 7 /* 8 * Copyright (C) 2000 - 2016, Intel Corp. 9 * All rights reserved. 10 * 11 * Redistribution and use in source and binary forms, with or without 12 * modification, are permitted provided that the following conditions 13 * are met: 14 * 1. Redistributions of source code must retain the above copyright 15 * notice, this list of conditions, and the following disclaimer, 16 * without modification. 17 * 2. Redistributions in binary form must reproduce at minimum a disclaimer 18 * substantially similar to the "NO WARRANTY" disclaimer below 19 * ("Disclaimer") and any redistribution must be conditioned upon 20 * including a substantially similar Disclaimer requirement for further 21 * binary redistribution. 22 * 3. Neither the names of the above-listed copyright holders nor the names 23 * of any contributors may be used to endorse or promote products derived 24 * from this software without specific prior written permission. 25 * 26 * Alternatively, this software may be distributed under the terms of the 27 * GNU General Public License ("GPL") version 2 as published by the Free 28 * Software Foundation. 29 * 30 * NO WARRANTY 31 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 32 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 33 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR 34 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 35 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 36 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 37 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 38 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 39 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 40 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 41 * POSSIBILITY OF SUCH DAMAGES. 42 */ 43 44 #ifndef __ACNAMESP_H__ 45 #define __ACNAMESP_H__ 46 47 48 /* To search the entire name space, pass this as SearchBase */ 49 50 #define ACPI_NS_ALL ((ACPI_HANDLE)0) 51 52 /* 53 * Elements of AcpiNsProperties are bit significant 54 * and should be one-to-one with values of ACPI_OBJECT_TYPE 55 */ 56 #define ACPI_NS_NORMAL 0 57 #define ACPI_NS_NEWSCOPE 1 /* a definition of this type opens a name scope */ 58 #define ACPI_NS_LOCAL 2 /* suppress search of enclosing scopes */ 59 60 /* Flags for AcpiNsLookup, AcpiNsSearchAndEnter */ 61 62 #define ACPI_NS_NO_UPSEARCH 0 63 #define ACPI_NS_SEARCH_PARENT 0x01 64 #define ACPI_NS_DONT_OPEN_SCOPE 0x02 65 #define ACPI_NS_NO_PEER_SEARCH 0x04 66 #define ACPI_NS_ERROR_IF_FOUND 0x08 67 #define ACPI_NS_PREFIX_IS_SCOPE 0x10 68 #define ACPI_NS_EXTERNAL 0x20 69 #define ACPI_NS_TEMPORARY 0x40 70 #define ACPI_NS_OVERRIDE_IF_FOUND 0x80 71 72 /* Flags for AcpiNsWalkNamespace */ 73 74 #define ACPI_NS_WALK_NO_UNLOCK 0 75 #define ACPI_NS_WALK_UNLOCK 0x01 76 #define ACPI_NS_WALK_TEMP_NODES 0x02 77 78 /* Object is not a package element */ 79 80 #define ACPI_NOT_PACKAGE_ELEMENT ACPI_UINT32_MAX 81 #define ACPI_ALL_PACKAGE_ELEMENTS (ACPI_UINT32_MAX-1) 82 83 /* Always emit warning message, not dependent on node flags */ 84 85 #define ACPI_WARN_ALWAYS 0 86 87 88 /* 89 * nsinit - Namespace initialization 90 */ 91 ACPI_STATUS 92 AcpiNsInitializeObjects ( 93 void); 94 95 ACPI_STATUS 96 AcpiNsInitializeDevices ( 97 UINT32 Flags); 98 99 100 /* 101 * nsload - Namespace loading 102 */ 103 ACPI_STATUS 104 AcpiNsLoadNamespace ( 105 void); 106 107 ACPI_STATUS 108 AcpiNsLoadTable ( 109 UINT32 TableIndex, 110 ACPI_NAMESPACE_NODE *Node); 111 112 113 /* 114 * nswalk - walk the namespace 115 */ 116 ACPI_STATUS 117 AcpiNsWalkNamespace ( 118 ACPI_OBJECT_TYPE Type, 119 ACPI_HANDLE StartObject, 120 UINT32 MaxDepth, 121 UINT32 Flags, 122 ACPI_WALK_CALLBACK DescendingCallback, 123 ACPI_WALK_CALLBACK AscendingCallback, 124 void *Context, 125 void **ReturnValue); 126 127 ACPI_NAMESPACE_NODE * 128 AcpiNsGetNextNode ( 129 ACPI_NAMESPACE_NODE *Parent, 130 ACPI_NAMESPACE_NODE *Child); 131 132 ACPI_NAMESPACE_NODE * 133 AcpiNsGetNextNodeTyped ( 134 ACPI_OBJECT_TYPE Type, 135 ACPI_NAMESPACE_NODE *Parent, 136 ACPI_NAMESPACE_NODE *Child); 137 138 /* 139 * nsparse - table parsing 140 */ 141 ACPI_STATUS 142 AcpiNsParseTable ( 143 UINT32 TableIndex, 144 ACPI_NAMESPACE_NODE *StartNode); 145 146 ACPI_STATUS 147 AcpiNsExecuteTable ( 148 UINT32 TableIndex, 149 ACPI_NAMESPACE_NODE *StartNode); 150 151 ACPI_STATUS 152 AcpiNsOneCompleteParse ( 153 UINT32 PassNumber, 154 UINT32 TableIndex, 155 ACPI_NAMESPACE_NODE *StartNode); 156 157 158 /* 159 * nsaccess - Top-level namespace access 160 */ 161 ACPI_STATUS 162 AcpiNsRootInitialize ( 163 void); 164 165 ACPI_STATUS 166 AcpiNsLookup ( 167 ACPI_GENERIC_STATE *ScopeInfo, 168 char *Name, 169 ACPI_OBJECT_TYPE Type, 170 ACPI_INTERPRETER_MODE InterpreterMode, 171 UINT32 Flags, 172 ACPI_WALK_STATE *WalkState, 173 ACPI_NAMESPACE_NODE **RetNode); 174 175 176 /* 177 * nsalloc - Named object allocation/deallocation 178 */ 179 ACPI_NAMESPACE_NODE * 180 AcpiNsCreateNode ( 181 UINT32 Name); 182 183 void 184 AcpiNsDeleteNode ( 185 ACPI_NAMESPACE_NODE *Node); 186 187 void 188 AcpiNsRemoveNode ( 189 ACPI_NAMESPACE_NODE *Node); 190 191 void 192 AcpiNsDeleteNamespaceSubtree ( 193 ACPI_NAMESPACE_NODE *ParentHandle); 194 195 void 196 AcpiNsDeleteNamespaceByOwner ( 197 ACPI_OWNER_ID OwnerId); 198 199 void 200 AcpiNsDetachObject ( 201 ACPI_NAMESPACE_NODE *Node); 202 203 void 204 AcpiNsDeleteChildren ( 205 ACPI_NAMESPACE_NODE *Parent); 206 207 int 208 AcpiNsCompareNames ( 209 char *Name1, 210 char *Name2); 211 212 213 /* 214 * nsconvert - Dynamic object conversion routines 215 */ 216 ACPI_STATUS 217 AcpiNsConvertToInteger ( 218 ACPI_OPERAND_OBJECT *OriginalObject, 219 ACPI_OPERAND_OBJECT **ReturnObject); 220 221 ACPI_STATUS 222 AcpiNsConvertToString ( 223 ACPI_OPERAND_OBJECT *OriginalObject, 224 ACPI_OPERAND_OBJECT **ReturnObject); 225 226 ACPI_STATUS 227 AcpiNsConvertToBuffer ( 228 ACPI_OPERAND_OBJECT *OriginalObject, 229 ACPI_OPERAND_OBJECT **ReturnObject); 230 231 ACPI_STATUS 232 AcpiNsConvertToUnicode ( 233 ACPI_NAMESPACE_NODE *Scope, 234 ACPI_OPERAND_OBJECT *OriginalObject, 235 ACPI_OPERAND_OBJECT **ReturnObject); 236 237 ACPI_STATUS 238 AcpiNsConvertToResource ( 239 ACPI_NAMESPACE_NODE *Scope, 240 ACPI_OPERAND_OBJECT *OriginalObject, 241 ACPI_OPERAND_OBJECT **ReturnObject); 242 243 ACPI_STATUS 244 AcpiNsConvertToReference ( 245 ACPI_NAMESPACE_NODE *Scope, 246 ACPI_OPERAND_OBJECT *OriginalObject, 247 ACPI_OPERAND_OBJECT **ReturnObject); 248 249 250 /* 251 * nsdump - Namespace dump/print utilities 252 */ 253 void 254 AcpiNsDumpTables ( 255 ACPI_HANDLE SearchBase, 256 UINT32 MaxDepth); 257 258 void 259 AcpiNsDumpEntry ( 260 ACPI_HANDLE Handle, 261 UINT32 DebugLevel); 262 263 void 264 AcpiNsDumpPathname ( 265 ACPI_HANDLE Handle, 266 const char *Msg, 267 UINT32 Level, 268 UINT32 Component); 269 270 void 271 AcpiNsPrintPathname ( 272 UINT32 NumSegments, 273 const char *Pathname); 274 275 ACPI_STATUS 276 AcpiNsDumpOneObject ( 277 ACPI_HANDLE ObjHandle, 278 UINT32 Level, 279 void *Context, 280 void **ReturnValue); 281 282 void 283 AcpiNsDumpObjects ( 284 ACPI_OBJECT_TYPE Type, 285 UINT8 DisplayType, 286 UINT32 MaxDepth, 287 ACPI_OWNER_ID OwnerId, 288 ACPI_HANDLE StartHandle); 289 290 void 291 AcpiNsDumpObjectPaths ( 292 ACPI_OBJECT_TYPE Type, 293 UINT8 DisplayType, 294 UINT32 MaxDepth, 295 ACPI_OWNER_ID OwnerId, 296 ACPI_HANDLE StartHandle); 297 298 299 /* 300 * nseval - Namespace evaluation functions 301 */ 302 ACPI_STATUS 303 AcpiNsEvaluate ( 304 ACPI_EVALUATE_INFO *Info); 305 306 void 307 AcpiNsExecModuleCodeList ( 308 void); 309 310 311 /* 312 * nsarguments - Argument count/type checking for predefined/reserved names 313 */ 314 void 315 AcpiNsCheckArgumentCount ( 316 char *Pathname, 317 ACPI_NAMESPACE_NODE *Node, 318 UINT32 UserParamCount, 319 const ACPI_PREDEFINED_INFO *Info); 320 321 void 322 AcpiNsCheckAcpiCompliance ( 323 char *Pathname, 324 ACPI_NAMESPACE_NODE *Node, 325 const ACPI_PREDEFINED_INFO *Predefined); 326 327 void 328 AcpiNsCheckArgumentTypes ( 329 ACPI_EVALUATE_INFO *Info); 330 331 332 /* 333 * nspredef - Return value checking for predefined/reserved names 334 */ 335 ACPI_STATUS 336 AcpiNsCheckReturnValue ( 337 ACPI_NAMESPACE_NODE *Node, 338 ACPI_EVALUATE_INFO *Info, 339 UINT32 UserParamCount, 340 ACPI_STATUS ReturnStatus, 341 ACPI_OPERAND_OBJECT **ReturnObject); 342 343 ACPI_STATUS 344 AcpiNsCheckObjectType ( 345 ACPI_EVALUATE_INFO *Info, 346 ACPI_OPERAND_OBJECT **ReturnObjectPtr, 347 UINT32 ExpectedBtypes, 348 UINT32 PackageIndex); 349 350 351 /* 352 * nsprepkg - Validation of predefined name packages 353 */ 354 ACPI_STATUS 355 AcpiNsCheckPackage ( 356 ACPI_EVALUATE_INFO *Info, 357 ACPI_OPERAND_OBJECT **ReturnObjectPtr); 358 359 360 /* 361 * nsnames - Name and Scope manipulation 362 */ 363 UINT32 364 AcpiNsOpensScope ( 365 ACPI_OBJECT_TYPE Type); 366 367 char * 368 AcpiNsGetExternalPathname ( 369 ACPI_NAMESPACE_NODE *Node); 370 371 UINT32 372 AcpiNsBuildNormalizedPath ( 373 ACPI_NAMESPACE_NODE *Node, 374 char *FullPath, 375 UINT32 PathSize, 376 BOOLEAN NoTrailing); 377 378 char * 379 AcpiNsGetNormalizedPathname ( 380 ACPI_NAMESPACE_NODE *Node, 381 BOOLEAN NoTrailing); 382 383 char * 384 AcpiNsNameOfCurrentScope ( 385 ACPI_WALK_STATE *WalkState); 386 387 ACPI_STATUS 388 AcpiNsHandleToPathname ( 389 ACPI_HANDLE TargetHandle, 390 ACPI_BUFFER *Buffer, 391 BOOLEAN NoTrailing); 392 393 BOOLEAN 394 AcpiNsPatternMatch ( 395 ACPI_NAMESPACE_NODE *ObjNode, 396 char *SearchFor); 397 398 ACPI_STATUS 399 AcpiNsGetNodeUnlocked ( 400 ACPI_NAMESPACE_NODE *PrefixNode, 401 const char *ExternalPathname, 402 UINT32 Flags, 403 ACPI_NAMESPACE_NODE **OutNode); 404 405 ACPI_STATUS 406 AcpiNsGetNode ( 407 ACPI_NAMESPACE_NODE *PrefixNode, 408 const char *ExternalPathname, 409 UINT32 Flags, 410 ACPI_NAMESPACE_NODE **OutNode); 411 412 ACPI_SIZE 413 AcpiNsGetPathnameLength ( 414 ACPI_NAMESPACE_NODE *Node); 415 416 417 /* 418 * nsobject - Object management for namespace nodes 419 */ 420 ACPI_STATUS 421 AcpiNsAttachObject ( 422 ACPI_NAMESPACE_NODE *Node, 423 ACPI_OPERAND_OBJECT *Object, 424 ACPI_OBJECT_TYPE Type); 425 426 ACPI_OPERAND_OBJECT * 427 AcpiNsGetAttachedObject ( 428 ACPI_NAMESPACE_NODE *Node); 429 430 ACPI_OPERAND_OBJECT * 431 AcpiNsGetSecondaryObject ( 432 ACPI_OPERAND_OBJECT *ObjDesc); 433 434 ACPI_STATUS 435 AcpiNsAttachData ( 436 ACPI_NAMESPACE_NODE *Node, 437 ACPI_OBJECT_HANDLER Handler, 438 void *Data); 439 440 ACPI_STATUS 441 AcpiNsDetachData ( 442 ACPI_NAMESPACE_NODE *Node, 443 ACPI_OBJECT_HANDLER Handler); 444 445 ACPI_STATUS 446 AcpiNsGetAttachedData ( 447 ACPI_NAMESPACE_NODE *Node, 448 ACPI_OBJECT_HANDLER Handler, 449 void **Data); 450 451 452 /* 453 * nsrepair - General return object repair for all 454 * predefined methods/objects 455 */ 456 ACPI_STATUS 457 AcpiNsSimpleRepair ( 458 ACPI_EVALUATE_INFO *Info, 459 UINT32 ExpectedBtypes, 460 UINT32 PackageIndex, 461 ACPI_OPERAND_OBJECT **ReturnObjectPtr); 462 463 ACPI_STATUS 464 AcpiNsWrapWithPackage ( 465 ACPI_EVALUATE_INFO *Info, 466 ACPI_OPERAND_OBJECT *OriginalObject, 467 ACPI_OPERAND_OBJECT **ObjDescPtr); 468 469 ACPI_STATUS 470 AcpiNsRepairNullElement ( 471 ACPI_EVALUATE_INFO *Info, 472 UINT32 ExpectedBtypes, 473 UINT32 PackageIndex, 474 ACPI_OPERAND_OBJECT **ReturnObjectPtr); 475 476 void 477 AcpiNsRemoveNullElements ( 478 ACPI_EVALUATE_INFO *Info, 479 UINT8 PackageType, 480 ACPI_OPERAND_OBJECT *ObjDesc); 481 482 483 /* 484 * nsrepair2 - Return object repair for specific 485 * predefined methods/objects 486 */ 487 ACPI_STATUS 488 AcpiNsComplexRepairs ( 489 ACPI_EVALUATE_INFO *Info, 490 ACPI_NAMESPACE_NODE *Node, 491 ACPI_STATUS ValidateStatus, 492 ACPI_OPERAND_OBJECT **ReturnObjectPtr); 493 494 495 /* 496 * nssearch - Namespace searching and entry 497 */ 498 ACPI_STATUS 499 AcpiNsSearchAndEnter ( 500 UINT32 EntryName, 501 ACPI_WALK_STATE *WalkState, 502 ACPI_NAMESPACE_NODE *Node, 503 ACPI_INTERPRETER_MODE InterpreterMode, 504 ACPI_OBJECT_TYPE Type, 505 UINT32 Flags, 506 ACPI_NAMESPACE_NODE **RetNode); 507 508 ACPI_STATUS 509 AcpiNsSearchOneScope ( 510 UINT32 EntryName, 511 ACPI_NAMESPACE_NODE *Node, 512 ACPI_OBJECT_TYPE Type, 513 ACPI_NAMESPACE_NODE **RetNode); 514 515 void 516 AcpiNsInstallNode ( 517 ACPI_WALK_STATE *WalkState, 518 ACPI_NAMESPACE_NODE *ParentNode, 519 ACPI_NAMESPACE_NODE *Node, 520 ACPI_OBJECT_TYPE Type); 521 522 523 /* 524 * nsutils - Utility functions 525 */ 526 ACPI_OBJECT_TYPE 527 AcpiNsGetType ( 528 ACPI_NAMESPACE_NODE *Node); 529 530 UINT32 531 AcpiNsLocal ( 532 ACPI_OBJECT_TYPE Type); 533 534 void 535 AcpiNsPrintNodePathname ( 536 ACPI_NAMESPACE_NODE *Node, 537 const char *Msg); 538 539 ACPI_STATUS 540 AcpiNsBuildInternalName ( 541 ACPI_NAMESTRING_INFO *Info); 542 543 void 544 AcpiNsGetInternalNameLength ( 545 ACPI_NAMESTRING_INFO *Info); 546 547 ACPI_STATUS 548 AcpiNsInternalizeName ( 549 const char *DottedName, 550 char **ConvertedName); 551 552 ACPI_STATUS 553 AcpiNsExternalizeName ( 554 UINT32 InternalNameLength, 555 const char *InternalName, 556 UINT32 *ConvertedNameLength, 557 char **ConvertedName); 558 559 ACPI_NAMESPACE_NODE * 560 AcpiNsValidateHandle ( 561 ACPI_HANDLE Handle); 562 563 void 564 AcpiNsTerminate ( 565 void); 566 567 #endif /* __ACNAMESP_H__ */ 568