1 /****************************************************************************** 2 * 3 * Name: acnamesp.h - Namespace subcomponent prototypes and defines 4 * 5 *****************************************************************************/ 6 7 /* 8 * Copyright (C) 2000 - 2013, 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 71 /* Flags for AcpiNsWalkNamespace */ 72 73 #define ACPI_NS_WALK_NO_UNLOCK 0 74 #define ACPI_NS_WALK_UNLOCK 0x01 75 #define ACPI_NS_WALK_TEMP_NODES 0x02 76 77 /* Object is not a package element */ 78 79 #define ACPI_NOT_PACKAGE_ELEMENT ACPI_UINT32_MAX 80 81 /* Always emit warning message, not dependent on node flags */ 82 83 #define ACPI_WARN_ALWAYS 0 84 85 86 /* 87 * nsinit - Namespace initialization 88 */ 89 ACPI_STATUS 90 AcpiNsInitializeObjects ( 91 void); 92 93 ACPI_STATUS 94 AcpiNsInitializeDevices ( 95 void); 96 97 98 /* 99 * nsload - Namespace loading 100 */ 101 ACPI_STATUS 102 AcpiNsLoadNamespace ( 103 void); 104 105 ACPI_STATUS 106 AcpiNsLoadTable ( 107 UINT32 TableIndex, 108 ACPI_NAMESPACE_NODE *Node); 109 110 111 /* 112 * nswalk - walk the namespace 113 */ 114 ACPI_STATUS 115 AcpiNsWalkNamespace ( 116 ACPI_OBJECT_TYPE Type, 117 ACPI_HANDLE StartObject, 118 UINT32 MaxDepth, 119 UINT32 Flags, 120 ACPI_WALK_CALLBACK PreOrderVisit, 121 ACPI_WALK_CALLBACK PostOrderVisit, 122 void *Context, 123 void **ReturnValue); 124 125 ACPI_NAMESPACE_NODE * 126 AcpiNsGetNextNode ( 127 ACPI_NAMESPACE_NODE *Parent, 128 ACPI_NAMESPACE_NODE *Child); 129 130 ACPI_NAMESPACE_NODE * 131 AcpiNsGetNextNodeTyped ( 132 ACPI_OBJECT_TYPE Type, 133 ACPI_NAMESPACE_NODE *Parent, 134 ACPI_NAMESPACE_NODE *Child); 135 136 /* 137 * nsparse - table parsing 138 */ 139 ACPI_STATUS 140 AcpiNsParseTable ( 141 UINT32 TableIndex, 142 ACPI_NAMESPACE_NODE *StartNode); 143 144 ACPI_STATUS 145 AcpiNsOneCompleteParse ( 146 UINT32 PassNumber, 147 UINT32 TableIndex, 148 ACPI_NAMESPACE_NODE *StartNode); 149 150 151 /* 152 * nsaccess - Top-level namespace access 153 */ 154 ACPI_STATUS 155 AcpiNsRootInitialize ( 156 void); 157 158 ACPI_STATUS 159 AcpiNsLookup ( 160 ACPI_GENERIC_STATE *ScopeInfo, 161 char *Name, 162 ACPI_OBJECT_TYPE Type, 163 ACPI_INTERPRETER_MODE InterpreterMode, 164 UINT32 Flags, 165 ACPI_WALK_STATE *WalkState, 166 ACPI_NAMESPACE_NODE **RetNode); 167 168 169 /* 170 * nsalloc - Named object allocation/deallocation 171 */ 172 ACPI_NAMESPACE_NODE * 173 AcpiNsCreateNode ( 174 UINT32 Name); 175 176 void 177 AcpiNsDeleteNode ( 178 ACPI_NAMESPACE_NODE *Node); 179 180 void 181 AcpiNsRemoveNode ( 182 ACPI_NAMESPACE_NODE *Node); 183 184 void 185 AcpiNsDeleteNamespaceSubtree ( 186 ACPI_NAMESPACE_NODE *ParentHandle); 187 188 void 189 AcpiNsDeleteNamespaceByOwner ( 190 ACPI_OWNER_ID OwnerId); 191 192 void 193 AcpiNsDetachObject ( 194 ACPI_NAMESPACE_NODE *Node); 195 196 void 197 AcpiNsDeleteChildren ( 198 ACPI_NAMESPACE_NODE *Parent); 199 200 int 201 AcpiNsCompareNames ( 202 char *Name1, 203 char *Name2); 204 205 206 /* 207 * nsconvert - Dynamic object conversion routines 208 */ 209 ACPI_STATUS 210 AcpiNsConvertToInteger ( 211 ACPI_OPERAND_OBJECT *OriginalObject, 212 ACPI_OPERAND_OBJECT **ReturnObject); 213 214 ACPI_STATUS 215 AcpiNsConvertToString ( 216 ACPI_OPERAND_OBJECT *OriginalObject, 217 ACPI_OPERAND_OBJECT **ReturnObject); 218 219 ACPI_STATUS 220 AcpiNsConvertToBuffer ( 221 ACPI_OPERAND_OBJECT *OriginalObject, 222 ACPI_OPERAND_OBJECT **ReturnObject); 223 224 ACPI_STATUS 225 AcpiNsConvertToUnicode ( 226 ACPI_OPERAND_OBJECT *OriginalObject, 227 ACPI_OPERAND_OBJECT **ReturnObject); 228 229 ACPI_STATUS 230 AcpiNsConvertToResource ( 231 ACPI_OPERAND_OBJECT *OriginalObject, 232 ACPI_OPERAND_OBJECT **ReturnObject); 233 234 235 /* 236 * nsdump - Namespace dump/print utilities 237 */ 238 void 239 AcpiNsDumpTables ( 240 ACPI_HANDLE SearchBase, 241 UINT32 MaxDepth); 242 243 void 244 AcpiNsDumpEntry ( 245 ACPI_HANDLE Handle, 246 UINT32 DebugLevel); 247 248 void 249 AcpiNsDumpPathname ( 250 ACPI_HANDLE Handle, 251 char *Msg, 252 UINT32 Level, 253 UINT32 Component); 254 255 void 256 AcpiNsPrintPathname ( 257 UINT32 NumSegments, 258 char *Pathname); 259 260 ACPI_STATUS 261 AcpiNsDumpOneObject ( 262 ACPI_HANDLE ObjHandle, 263 UINT32 Level, 264 void *Context, 265 void **ReturnValue); 266 267 void 268 AcpiNsDumpObjects ( 269 ACPI_OBJECT_TYPE Type, 270 UINT8 DisplayType, 271 UINT32 MaxDepth, 272 ACPI_OWNER_ID OwnerId, 273 ACPI_HANDLE StartHandle); 274 275 276 /* 277 * nseval - Namespace evaluation functions 278 */ 279 ACPI_STATUS 280 AcpiNsEvaluate ( 281 ACPI_EVALUATE_INFO *Info); 282 283 void 284 AcpiNsExecModuleCodeList ( 285 void); 286 287 288 /* 289 * nsarguments - Argument count/type checking for predefined/reserved names 290 */ 291 void 292 AcpiNsCheckArgumentCount ( 293 char *Pathname, 294 ACPI_NAMESPACE_NODE *Node, 295 UINT32 UserParamCount, 296 const ACPI_PREDEFINED_INFO *Info); 297 298 void 299 AcpiNsCheckAcpiCompliance ( 300 char *Pathname, 301 ACPI_NAMESPACE_NODE *Node, 302 const ACPI_PREDEFINED_INFO *Predefined); 303 304 void 305 AcpiNsCheckArgumentTypes ( 306 ACPI_EVALUATE_INFO *Info); 307 308 309 /* 310 * nspredef - Return value checking for predefined/reserved names 311 */ 312 ACPI_STATUS 313 AcpiNsCheckReturnValue ( 314 ACPI_NAMESPACE_NODE *Node, 315 ACPI_EVALUATE_INFO *Info, 316 UINT32 UserParamCount, 317 ACPI_STATUS ReturnStatus, 318 ACPI_OPERAND_OBJECT **ReturnObject); 319 320 ACPI_STATUS 321 AcpiNsCheckObjectType ( 322 ACPI_EVALUATE_INFO *Info, 323 ACPI_OPERAND_OBJECT **ReturnObjectPtr, 324 UINT32 ExpectedBtypes, 325 UINT32 PackageIndex); 326 327 328 /* 329 * nsprepkg - Validation of predefined name packages 330 */ 331 ACPI_STATUS 332 AcpiNsCheckPackage ( 333 ACPI_EVALUATE_INFO *Info, 334 ACPI_OPERAND_OBJECT **ReturnObjectPtr); 335 336 337 /* 338 * nsnames - Name and Scope manipulation 339 */ 340 UINT32 341 AcpiNsOpensScope ( 342 ACPI_OBJECT_TYPE Type); 343 344 ACPI_STATUS 345 AcpiNsBuildExternalPath ( 346 ACPI_NAMESPACE_NODE *Node, 347 ACPI_SIZE Size, 348 char *NameBuffer); 349 350 char * 351 AcpiNsGetExternalPathname ( 352 ACPI_NAMESPACE_NODE *Node); 353 354 char * 355 AcpiNsNameOfCurrentScope ( 356 ACPI_WALK_STATE *WalkState); 357 358 ACPI_STATUS 359 AcpiNsHandleToPathname ( 360 ACPI_HANDLE TargetHandle, 361 ACPI_BUFFER *Buffer); 362 363 BOOLEAN 364 AcpiNsPatternMatch ( 365 ACPI_NAMESPACE_NODE *ObjNode, 366 char *SearchFor); 367 368 ACPI_STATUS 369 AcpiNsGetNode ( 370 ACPI_NAMESPACE_NODE *PrefixNode, 371 const char *ExternalPathname, 372 UINT32 Flags, 373 ACPI_NAMESPACE_NODE **OutNode); 374 375 ACPI_SIZE 376 AcpiNsGetPathnameLength ( 377 ACPI_NAMESPACE_NODE *Node); 378 379 380 /* 381 * nsobject - Object management for namespace nodes 382 */ 383 ACPI_STATUS 384 AcpiNsAttachObject ( 385 ACPI_NAMESPACE_NODE *Node, 386 ACPI_OPERAND_OBJECT *Object, 387 ACPI_OBJECT_TYPE Type); 388 389 ACPI_OPERAND_OBJECT * 390 AcpiNsGetAttachedObject ( 391 ACPI_NAMESPACE_NODE *Node); 392 393 ACPI_OPERAND_OBJECT * 394 AcpiNsGetSecondaryObject ( 395 ACPI_OPERAND_OBJECT *ObjDesc); 396 397 ACPI_STATUS 398 AcpiNsAttachData ( 399 ACPI_NAMESPACE_NODE *Node, 400 ACPI_OBJECT_HANDLER Handler, 401 void *Data); 402 403 ACPI_STATUS 404 AcpiNsDetachData ( 405 ACPI_NAMESPACE_NODE *Node, 406 ACPI_OBJECT_HANDLER Handler); 407 408 ACPI_STATUS 409 AcpiNsGetAttachedData ( 410 ACPI_NAMESPACE_NODE *Node, 411 ACPI_OBJECT_HANDLER Handler, 412 void **Data); 413 414 415 /* 416 * nsrepair - General return object repair for all 417 * predefined methods/objects 418 */ 419 ACPI_STATUS 420 AcpiNsSimpleRepair ( 421 ACPI_EVALUATE_INFO *Info, 422 UINT32 ExpectedBtypes, 423 UINT32 PackageIndex, 424 ACPI_OPERAND_OBJECT **ReturnObjectPtr); 425 426 ACPI_STATUS 427 AcpiNsWrapWithPackage ( 428 ACPI_EVALUATE_INFO *Info, 429 ACPI_OPERAND_OBJECT *OriginalObject, 430 ACPI_OPERAND_OBJECT **ObjDescPtr); 431 432 ACPI_STATUS 433 AcpiNsRepairNullElement ( 434 ACPI_EVALUATE_INFO *Info, 435 UINT32 ExpectedBtypes, 436 UINT32 PackageIndex, 437 ACPI_OPERAND_OBJECT **ReturnObjectPtr); 438 439 void 440 AcpiNsRemoveNullElements ( 441 ACPI_EVALUATE_INFO *Info, 442 UINT8 PackageType, 443 ACPI_OPERAND_OBJECT *ObjDesc); 444 445 446 /* 447 * nsrepair2 - Return object repair for specific 448 * predefined methods/objects 449 */ 450 ACPI_STATUS 451 AcpiNsComplexRepairs ( 452 ACPI_EVALUATE_INFO *Info, 453 ACPI_NAMESPACE_NODE *Node, 454 ACPI_STATUS ValidateStatus, 455 ACPI_OPERAND_OBJECT **ReturnObjectPtr); 456 457 458 /* 459 * nssearch - Namespace searching and entry 460 */ 461 ACPI_STATUS 462 AcpiNsSearchAndEnter ( 463 UINT32 EntryName, 464 ACPI_WALK_STATE *WalkState, 465 ACPI_NAMESPACE_NODE *Node, 466 ACPI_INTERPRETER_MODE InterpreterMode, 467 ACPI_OBJECT_TYPE Type, 468 UINT32 Flags, 469 ACPI_NAMESPACE_NODE **RetNode); 470 471 ACPI_STATUS 472 AcpiNsSearchOneScope ( 473 UINT32 EntryName, 474 ACPI_NAMESPACE_NODE *Node, 475 ACPI_OBJECT_TYPE Type, 476 ACPI_NAMESPACE_NODE **RetNode); 477 478 void 479 AcpiNsInstallNode ( 480 ACPI_WALK_STATE *WalkState, 481 ACPI_NAMESPACE_NODE *ParentNode, 482 ACPI_NAMESPACE_NODE *Node, 483 ACPI_OBJECT_TYPE Type); 484 485 486 /* 487 * nsutils - Utility functions 488 */ 489 ACPI_OBJECT_TYPE 490 AcpiNsGetType ( 491 ACPI_NAMESPACE_NODE *Node); 492 493 UINT32 494 AcpiNsLocal ( 495 ACPI_OBJECT_TYPE Type); 496 497 void 498 AcpiNsPrintNodePathname ( 499 ACPI_NAMESPACE_NODE *Node, 500 const char *Msg); 501 502 ACPI_STATUS 503 AcpiNsBuildInternalName ( 504 ACPI_NAMESTRING_INFO *Info); 505 506 void 507 AcpiNsGetInternalNameLength ( 508 ACPI_NAMESTRING_INFO *Info); 509 510 ACPI_STATUS 511 AcpiNsInternalizeName ( 512 const char *DottedName, 513 char **ConvertedName); 514 515 ACPI_STATUS 516 AcpiNsExternalizeName ( 517 UINT32 InternalNameLength, 518 const char *InternalName, 519 UINT32 *ConvertedNameLength, 520 char **ConvertedName); 521 522 ACPI_NAMESPACE_NODE * 523 AcpiNsValidateHandle ( 524 ACPI_HANDLE Handle); 525 526 void 527 AcpiNsTerminate ( 528 void); 529 530 #endif /* __ACNAMESP_H__ */ 531