acutils.h revision 249112
167754Smsmith/****************************************************************************** 267754Smsmith * 377424Smsmith * Name: acutils.h -- prototypes for the common (subsystem-wide) procedures 467754Smsmith * 567754Smsmith *****************************************************************************/ 667754Smsmith 7217365Sjkim/* 8245582Sjkim * Copyright (C) 2000 - 2013, Intel Corp. 970243Smsmith * All rights reserved. 1067754Smsmith * 11217365Sjkim * Redistribution and use in source and binary forms, with or without 12217365Sjkim * modification, are permitted provided that the following conditions 13217365Sjkim * are met: 14217365Sjkim * 1. Redistributions of source code must retain the above copyright 15217365Sjkim * notice, this list of conditions, and the following disclaimer, 16217365Sjkim * without modification. 17217365Sjkim * 2. Redistributions in binary form must reproduce at minimum a disclaimer 18217365Sjkim * substantially similar to the "NO WARRANTY" disclaimer below 19217365Sjkim * ("Disclaimer") and any redistribution must be conditioned upon 20217365Sjkim * including a substantially similar Disclaimer requirement for further 21217365Sjkim * binary redistribution. 22217365Sjkim * 3. Neither the names of the above-listed copyright holders nor the names 23217365Sjkim * of any contributors may be used to endorse or promote products derived 24217365Sjkim * from this software without specific prior written permission. 2567754Smsmith * 26217365Sjkim * Alternatively, this software may be distributed under the terms of the 27217365Sjkim * GNU General Public License ("GPL") version 2 as published by the Free 28217365Sjkim * Software Foundation. 2967754Smsmith * 30217365Sjkim * NO WARRANTY 31217365Sjkim * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 32217365Sjkim * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 33217365Sjkim * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR 34217365Sjkim * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 35217365Sjkim * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 36217365Sjkim * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 37217365Sjkim * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 38217365Sjkim * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 39217365Sjkim * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 40217365Sjkim * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 41217365Sjkim * POSSIBILITY OF SUCH DAMAGES. 42217365Sjkim */ 4367754Smsmith 4477424Smsmith#ifndef _ACUTILS_H 4577424Smsmith#define _ACUTILS_H 4667754Smsmith 4767754Smsmith 48167802Sjkimextern const UINT8 AcpiGbl_ResourceAmlSizes[]; 49228110Sjkimextern const UINT8 AcpiGbl_ResourceAmlSerialBusSizes[]; 50167802Sjkim 51167802Sjkim/* Strings used by the disassembler and debugger resource dump routines */ 52167802Sjkim 53167802Sjkim#if defined(ACPI_DISASSEMBLER) || defined (ACPI_DEBUGGER) 54167802Sjkim 55167802Sjkimextern const char *AcpiGbl_BmDecode[]; 56167802Sjkimextern const char *AcpiGbl_ConfigDecode[]; 57167802Sjkimextern const char *AcpiGbl_ConsumeDecode[]; 58167802Sjkimextern const char *AcpiGbl_DecDecode[]; 59167802Sjkimextern const char *AcpiGbl_HeDecode[]; 60167802Sjkimextern const char *AcpiGbl_IoDecode[]; 61167802Sjkimextern const char *AcpiGbl_LlDecode[]; 62167802Sjkimextern const char *AcpiGbl_MaxDecode[]; 63167802Sjkimextern const char *AcpiGbl_MemDecode[]; 64167802Sjkimextern const char *AcpiGbl_MinDecode[]; 65167802Sjkimextern const char *AcpiGbl_MtpDecode[]; 66167802Sjkimextern const char *AcpiGbl_RngDecode[]; 67167802Sjkimextern const char *AcpiGbl_RwDecode[]; 68167802Sjkimextern const char *AcpiGbl_ShrDecode[]; 69167802Sjkimextern const char *AcpiGbl_SizDecode[]; 70167802Sjkimextern const char *AcpiGbl_TrsDecode[]; 71167802Sjkimextern const char *AcpiGbl_TtpDecode[]; 72167802Sjkimextern const char *AcpiGbl_TypDecode[]; 73228110Sjkimextern const char *AcpiGbl_PpcDecode[]; 74228110Sjkimextern const char *AcpiGbl_IorDecode[]; 75228110Sjkimextern const char *AcpiGbl_DtsDecode[]; 76228110Sjkimextern const char *AcpiGbl_CtDecode[]; 77228110Sjkimextern const char *AcpiGbl_SbtDecode[]; 78228110Sjkimextern const char *AcpiGbl_AmDecode[]; 79228110Sjkimextern const char *AcpiGbl_SmDecode[]; 80228110Sjkimextern const char *AcpiGbl_WmDecode[]; 81228110Sjkimextern const char *AcpiGbl_CphDecode[]; 82228110Sjkimextern const char *AcpiGbl_CpoDecode[]; 83228110Sjkimextern const char *AcpiGbl_DpDecode[]; 84228110Sjkimextern const char *AcpiGbl_EdDecode[]; 85228110Sjkimextern const char *AcpiGbl_BpbDecode[]; 86228110Sjkimextern const char *AcpiGbl_SbDecode[]; 87228110Sjkimextern const char *AcpiGbl_FcDecode[]; 88228110Sjkimextern const char *AcpiGbl_PtDecode[]; 89167802Sjkim#endif 90167802Sjkim 91167802Sjkim/* Types for Resource descriptor entries */ 92167802Sjkim 93167802Sjkim#define ACPI_INVALID_RESOURCE 0 94167802Sjkim#define ACPI_FIXED_LENGTH 1 95167802Sjkim#define ACPI_VARIABLE_LENGTH 2 96167802Sjkim#define ACPI_SMALL_VARIABLE_LENGTH 3 97167802Sjkim 9873561Smsmithtypedef 99167802SjkimACPI_STATUS (*ACPI_WALK_AML_CALLBACK) ( 100167802Sjkim UINT8 *Aml, 101167802Sjkim UINT32 Length, 102167802Sjkim UINT32 Offset, 103167802Sjkim UINT8 ResourceIndex, 104245582Sjkim void **Context); 105167802Sjkim 106167802Sjkimtypedef 10773561SmsmithACPI_STATUS (*ACPI_PKG_CALLBACK) ( 10873561Smsmith UINT8 ObjectType, 10973561Smsmith ACPI_OPERAND_OBJECT *SourceObject, 11073561Smsmith ACPI_GENERIC_STATE *State, 11173561Smsmith void *Context); 11273561Smsmith 11373561Smsmithtypedef struct acpi_pkg_info 11473561Smsmith{ 11573561Smsmith UINT8 *FreeSpace; 11691116Smsmith ACPI_SIZE Length; 11773561Smsmith UINT32 ObjectSpace; 11873561Smsmith UINT32 NumPackages; 119114237Snjl 12073561Smsmith} ACPI_PKG_INFO; 12173561Smsmith 122249112Sjkim/* Object reference counts */ 123249112Sjkim 12467754Smsmith#define REF_INCREMENT (UINT16) 0 12567754Smsmith#define REF_DECREMENT (UINT16) 1 12667754Smsmith 12777424Smsmith/* AcpiUtDumpBuffer */ 12867754Smsmith 12967754Smsmith#define DB_BYTE_DISPLAY 1 13067754Smsmith#define DB_WORD_DISPLAY 2 13167754Smsmith#define DB_DWORD_DISPLAY 4 13267754Smsmith#define DB_QWORD_DISPLAY 8 13367754Smsmith 13467754Smsmith/* 135151937Sjkim * utglobal - Global data structures and procedures 13667754Smsmith */ 137193267SjkimACPI_STATUS 138151937SjkimAcpiUtInitGlobals ( 13967754Smsmith void); 14067754Smsmith 141102550Siwasaki#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) 14269746Smsmith 143114237Snjlchar * 14477424SmsmithAcpiUtGetMutexName ( 14567754Smsmith UINT32 MutexId); 14667754Smsmith 147193267Sjkimconst char * 148193267SjkimAcpiUtGetNotifyName ( 149193267Sjkim UINT32 NotifyValue); 150193267Sjkim 151100966Siwasaki#endif 152100966Siwasaki 153114237Snjlchar * 15477424SmsmithAcpiUtGetTypeName ( 15591116Smsmith ACPI_OBJECT_TYPE Type); 15667754Smsmith 157114237Snjlchar * 158123315SnjlAcpiUtGetNodeName ( 159123315Snjl void *Object); 160123315Snjl 161123315Snjlchar * 162123315SnjlAcpiUtGetDescriptorName ( 163123315Snjl void *Object); 164123315Snjl 165193267Sjkimconst char * 166193267SjkimAcpiUtGetReferenceName ( 167193267Sjkim ACPI_OPERAND_OBJECT *Object); 168193267Sjkim 169123315Snjlchar * 17099679SiwasakiAcpiUtGetObjectTypeName ( 17199679Siwasaki ACPI_OPERAND_OBJECT *ObjDesc); 17299679Siwasaki 173114237Snjlchar * 17477424SmsmithAcpiUtGetRegionName ( 17569746Smsmith UINT8 SpaceId); 17669746Smsmith 177114237Snjlchar * 17891116SmsmithAcpiUtGetEventName ( 17991116Smsmith UINT32 EventId); 18069746Smsmith 18199679Siwasakichar 18282367SmsmithAcpiUtHexToAsciiChar ( 183202771Sjkim UINT64 Integer, 18482367Smsmith UINT32 Position); 18582367Smsmith 18667754SmsmithBOOLEAN 18777424SmsmithAcpiUtValidObjectType ( 18891116Smsmith ACPI_OBJECT_TYPE Type); 18967754Smsmith 19067754Smsmith 191151937Sjkim/* 192151937Sjkim * utinit - miscellaneous initialization and shutdown 193151937Sjkim */ 194151937SjkimACPI_STATUS 195151937SjkimAcpiUtHardwareInitialize ( 196151937Sjkim void); 19767754Smsmith 198151937Sjkimvoid 199151937SjkimAcpiUtSubsystemShutdown ( 200151937Sjkim void); 201151937Sjkim 202151937Sjkim 20367754Smsmith/* 204151937Sjkim * utclib - Local implementations of C library functions 20567754Smsmith */ 20671867Smsmith#ifndef ACPI_USE_SYSTEM_CLIBRARY 20771867Smsmith 208104470SiwasakiACPI_SIZE 20977424SmsmithAcpiUtStrlen ( 210114237Snjl const char *String); 21167754Smsmith 212114237Snjlchar * 21377424SmsmithAcpiUtStrcpy ( 214114237Snjl char *DstString, 215114237Snjl const char *SrcString); 21667754Smsmith 217114237Snjlchar * 21877424SmsmithAcpiUtStrncpy ( 219114237Snjl char *DstString, 220114237Snjl const char *SrcString, 221104470Siwasaki ACPI_SIZE Count); 22267754Smsmith 22399679Siwasakiint 224138287SmarksAcpiUtMemcmp ( 225138287Smarks const char *Buffer1, 226138287Smarks const char *Buffer2, 227138287Smarks ACPI_SIZE Count); 228138287Smarks 229138287Smarksint 23077424SmsmithAcpiUtStrncmp ( 231114237Snjl const char *String1, 232114237Snjl const char *String2, 233104470Siwasaki ACPI_SIZE Count); 23467754Smsmith 235104470Siwasakiint 23677424SmsmithAcpiUtStrcmp ( 237114237Snjl const char *String1, 238114237Snjl const char *String2); 23967754Smsmith 240114237Snjlchar * 24177424SmsmithAcpiUtStrcat ( 242114237Snjl char *DstString, 243114237Snjl const char *SrcString); 24467754Smsmith 245114237Snjlchar * 24677424SmsmithAcpiUtStrncat ( 247114237Snjl char *DstString, 248114237Snjl const char *SrcString, 249104470Siwasaki ACPI_SIZE Count); 25067754Smsmith 25167754SmsmithUINT32 25277424SmsmithAcpiUtStrtoul ( 253114237Snjl const char *String, 254114237Snjl char **Terminator, 25577424Smsmith UINT32 Base); 25667754Smsmith 257114237Snjlchar * 25877424SmsmithAcpiUtStrstr ( 259114237Snjl char *String1, 260114237Snjl char *String2); 26167754Smsmith 26267754Smsmithvoid * 26377424SmsmithAcpiUtMemcpy ( 26467754Smsmith void *Dest, 26567754Smsmith const void *Src, 266104470Siwasaki ACPI_SIZE Count); 26767754Smsmith 26867754Smsmithvoid * 26977424SmsmithAcpiUtMemset ( 27067754Smsmith void *Dest, 271193267Sjkim UINT8 Value, 272104470Siwasaki ACPI_SIZE Count); 27367754Smsmith 27499679Siwasakiint 27577424SmsmithAcpiUtToUpper ( 27699679Siwasaki int c); 27767754Smsmith 27899679Siwasakiint 27977424SmsmithAcpiUtToLower ( 28099679Siwasaki int c); 28167754Smsmith 28299679Siwasakiextern const UINT8 _acpi_ctype[]; 28399679Siwasaki 28499679Siwasaki#define _ACPI_XA 0x00 /* extra alphabetic - not supported */ 28599679Siwasaki#define _ACPI_XS 0x40 /* extra space */ 28699679Siwasaki#define _ACPI_BB 0x00 /* BEL, BS, etc. - not supported */ 28799679Siwasaki#define _ACPI_CN 0x20 /* CR, FF, HT, NL, VT */ 28899679Siwasaki#define _ACPI_DI 0x04 /* '0'-'9' */ 28999679Siwasaki#define _ACPI_LO 0x02 /* 'a'-'z' */ 29099679Siwasaki#define _ACPI_PU 0x10 /* punctuation */ 29199679Siwasaki#define _ACPI_SP 0x08 /* space */ 29299679Siwasaki#define _ACPI_UP 0x01 /* 'A'-'Z' */ 29399679Siwasaki#define _ACPI_XD 0x80 /* '0'-'9', 'A'-'F', 'a'-'f' */ 29499679Siwasaki 29599679Siwasaki#define ACPI_IS_DIGIT(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_DI)) 29699679Siwasaki#define ACPI_IS_SPACE(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_SP)) 29799679Siwasaki#define ACPI_IS_XDIGIT(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_XD)) 29899679Siwasaki#define ACPI_IS_UPPER(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_UP)) 29999679Siwasaki#define ACPI_IS_LOWER(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_LO)) 300100966Siwasaki#define ACPI_IS_PRINT(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_LO | _ACPI_UP | _ACPI_DI | _ACPI_SP | _ACPI_PU)) 301100966Siwasaki#define ACPI_IS_ALPHA(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_LO | _ACPI_UP)) 30299679Siwasaki 303193267Sjkim#endif /* !ACPI_USE_SYSTEM_CLIBRARY */ 30467754Smsmith 305193267Sjkim#define ACPI_IS_ASCII(c) ((c) < 0x80) 306151937Sjkim 307193267Sjkim 30867754Smsmith/* 309151937Sjkim * utcopy - Object construction and conversion interfaces 31067754Smsmith */ 31167754SmsmithACPI_STATUS 31277424SmsmithAcpiUtBuildSimpleObject( 31367754Smsmith ACPI_OPERAND_OBJECT *Obj, 31467754Smsmith ACPI_OBJECT *UserObj, 31567754Smsmith UINT8 *DataSpace, 31667754Smsmith UINT32 *BufferSpaceUsed); 31767754Smsmith 31867754SmsmithACPI_STATUS 31977424SmsmithAcpiUtBuildPackageObject ( 32067754Smsmith ACPI_OPERAND_OBJECT *Obj, 32167754Smsmith UINT8 *Buffer, 32267754Smsmith UINT32 *SpaceUsed); 32367754Smsmith 32467754SmsmithACPI_STATUS 32577424SmsmithAcpiUtCopyIobjectToEobject ( 32667754Smsmith ACPI_OPERAND_OBJECT *Obj, 32767754Smsmith ACPI_BUFFER *RetBuffer); 32867754Smsmith 32967754SmsmithACPI_STATUS 33077424SmsmithAcpiUtCopyEobjectToIobject ( 33167754Smsmith ACPI_OBJECT *Obj, 33284491Smsmith ACPI_OPERAND_OBJECT **InternalObj); 33367754Smsmith 33467754SmsmithACPI_STATUS 33577424SmsmithAcpiUtCopyISimpleToIsimple ( 33667754Smsmith ACPI_OPERAND_OBJECT *SourceObj, 33767754Smsmith ACPI_OPERAND_OBJECT *DestObj); 33867754Smsmith 33967754SmsmithACPI_STATUS 34091116SmsmithAcpiUtCopyIobjectToIobject ( 34191116Smsmith ACPI_OPERAND_OBJECT *SourceDesc, 34291116Smsmith ACPI_OPERAND_OBJECT **DestDesc, 34391116Smsmith ACPI_WALK_STATE *WalkState); 34491116Smsmith 34591116Smsmith 34667754Smsmith/* 347151937Sjkim * utcreate - Object creation 34867754Smsmith */ 34967754SmsmithACPI_STATUS 35077424SmsmithAcpiUtUpdateObjectReference ( 35167754Smsmith ACPI_OPERAND_OBJECT *Object, 35267754Smsmith UINT16 Action); 35367754Smsmith 35467754Smsmith 35567754Smsmith/* 356151937Sjkim * utdebug - Debug interfaces 35767754Smsmith */ 35883174Smsmithvoid 35983174SmsmithAcpiUtInitStackPtrTrace ( 36067754Smsmith void); 36167754Smsmith 36267754Smsmithvoid 36383174SmsmithAcpiUtTrackStackPtr ( 36483174Smsmith void); 36567754Smsmith 36667754Smsmithvoid 36783174SmsmithAcpiUtTrace ( 36867754Smsmith UINT32 LineNumber, 369151937Sjkim const char *FunctionName, 370193267Sjkim const char *ModuleName, 371151937Sjkim UINT32 ComponentId); 37267754Smsmith 37367754Smsmithvoid 37483174SmsmithAcpiUtTracePtr ( 37567754Smsmith UINT32 LineNumber, 376151937Sjkim const char *FunctionName, 377193267Sjkim const char *ModuleName, 378151937Sjkim UINT32 ComponentId, 37967754Smsmith void *Pointer); 38067754Smsmith 38167754Smsmithvoid 38283174SmsmithAcpiUtTraceU32 ( 38367754Smsmith UINT32 LineNumber, 384151937Sjkim const char *FunctionName, 385193267Sjkim const char *ModuleName, 386151937Sjkim UINT32 ComponentId, 38767754Smsmith UINT32 Integer); 38867754Smsmith 38967754Smsmithvoid 39083174SmsmithAcpiUtTraceStr ( 39167754Smsmith UINT32 LineNumber, 392151937Sjkim const char *FunctionName, 393193267Sjkim const char *ModuleName, 394151937Sjkim UINT32 ComponentId, 395114237Snjl char *String); 39667754Smsmith 39767754Smsmithvoid 39883174SmsmithAcpiUtExit ( 39967754Smsmith UINT32 LineNumber, 400151937Sjkim const char *FunctionName, 401193267Sjkim const char *ModuleName, 402151937Sjkim UINT32 ComponentId); 40367754Smsmith 40467754Smsmithvoid 40583174SmsmithAcpiUtStatusExit ( 40667754Smsmith UINT32 LineNumber, 407151937Sjkim const char *FunctionName, 408193267Sjkim const char *ModuleName, 409151937Sjkim UINT32 ComponentId, 41067754Smsmith ACPI_STATUS Status); 41167754Smsmith 41267754Smsmithvoid 41383174SmsmithAcpiUtValueExit ( 41467754Smsmith UINT32 LineNumber, 415151937Sjkim const char *FunctionName, 416193267Sjkim const char *ModuleName, 417151937Sjkim UINT32 ComponentId, 418202771Sjkim UINT64 Value); 41967754Smsmith 42067754Smsmithvoid 42183174SmsmithAcpiUtPtrExit ( 42267754Smsmith UINT32 LineNumber, 423151937Sjkim const char *FunctionName, 424193267Sjkim const char *ModuleName, 425151937Sjkim UINT32 ComponentId, 42667754Smsmith UINT8 *Ptr); 42767754Smsmith 42867754Smsmithvoid 429241973SjkimAcpiUtDebugDumpBuffer ( 430167802Sjkim UINT8 *Buffer, 431167802Sjkim UINT32 Count, 432167802Sjkim UINT32 Display, 433237412Sjkim UINT32 ComponentId); 43467754Smsmith 43567754Smsmithvoid 436241973SjkimAcpiUtDumpBuffer ( 437167802Sjkim UINT8 *Buffer, 438167802Sjkim UINT32 Count, 439241973Sjkim UINT32 Display, 440241973Sjkim UINT32 Offset); 441167802Sjkim 442167802Sjkimvoid 44383174SmsmithAcpiUtReportError ( 444114237Snjl char *ModuleName, 445167802Sjkim UINT32 LineNumber); 44667754Smsmith 44767754Smsmithvoid 448167802SjkimAcpiUtReportInfo ( 449114237Snjl char *ModuleName, 450167802Sjkim UINT32 LineNumber); 45167754Smsmith 45267754Smsmithvoid 453167802SjkimAcpiUtReportWarning ( 454167802Sjkim char *ModuleName, 455167802Sjkim UINT32 LineNumber); 45667754Smsmith 45767754Smsmith/* 458151937Sjkim * utdelete - Object deletion and reference counts 45967754Smsmith */ 460151937Sjkimvoid 461151937SjkimAcpiUtAddReference ( 462151937Sjkim ACPI_OPERAND_OBJECT *Object); 46367754Smsmith 46467754Smsmithvoid 465151937SjkimAcpiUtRemoveReference ( 46667754Smsmith ACPI_OPERAND_OBJECT *Object); 46767754Smsmith 46867754Smsmithvoid 46977424SmsmithAcpiUtDeleteInternalPackageObject ( 47067754Smsmith ACPI_OPERAND_OBJECT *Object); 47167754Smsmith 47267754Smsmithvoid 47377424SmsmithAcpiUtDeleteInternalSimpleObject ( 47467754Smsmith ACPI_OPERAND_OBJECT *Object); 47567754Smsmith 47699679Siwasakivoid 47777424SmsmithAcpiUtDeleteInternalObjectList ( 47867754Smsmith ACPI_OPERAND_OBJECT **ObjList); 47967754Smsmith 48067754Smsmith 48167754Smsmith/* 482151937Sjkim * uteval - object evaluation 48367754Smsmith */ 48467754SmsmithACPI_STATUS 485114237SnjlAcpiUtEvaluateObject ( 486114237Snjl ACPI_NAMESPACE_NODE *PrefixNode, 487114237Snjl char *Path, 488114237Snjl UINT32 ExpectedReturnBtypes, 489114237Snjl ACPI_OPERAND_OBJECT **ReturnDesc); 490114237Snjl 491114237SnjlACPI_STATUS 49277424SmsmithAcpiUtEvaluateNumericObject ( 493114237Snjl char *ObjectName, 49467754Smsmith ACPI_NAMESPACE_NODE *DeviceNode, 495202771Sjkim UINT64 *Value); 49667754Smsmith 49767754SmsmithACPI_STATUS 498197104SjkimAcpiUtExecute_STA ( 49967754Smsmith ACPI_NAMESPACE_NODE *DeviceNode, 500197104Sjkim UINT32 *StatusFlags); 50167754Smsmith 50267754SmsmithACPI_STATUS 503197104SjkimAcpiUtExecutePowerMethods ( 50487031Smsmith ACPI_NAMESPACE_NODE *DeviceNode, 505197104Sjkim const char **MethodNames, 506197104Sjkim UINT8 MethodCount, 507197104Sjkim UINT8 *OutValues); 50887031Smsmith 509197104Sjkim 510197104Sjkim/* 511197104Sjkim * utids - device ID support 512197104Sjkim */ 51387031SmsmithACPI_STATUS 514197104SjkimAcpiUtExecute_HID ( 51567754Smsmith ACPI_NAMESPACE_NODE *DeviceNode, 516241973Sjkim ACPI_PNP_DEVICE_ID **ReturnId); 51767754Smsmith 51867754SmsmithACPI_STATUS 51977424SmsmithAcpiUtExecute_UID ( 52067754Smsmith ACPI_NAMESPACE_NODE *DeviceNode, 521241973Sjkim ACPI_PNP_DEVICE_ID **ReturnId); 52267754Smsmith 523126372SnjlACPI_STATUS 524241973SjkimAcpiUtExecute_SUB ( 525241973Sjkim ACPI_NAMESPACE_NODE *DeviceNode, 526241973Sjkim ACPI_PNP_DEVICE_ID **ReturnId); 527241973Sjkim 528241973SjkimACPI_STATUS 529197104SjkimAcpiUtExecute_CID ( 530126372Snjl ACPI_NAMESPACE_NODE *DeviceNode, 531241973Sjkim ACPI_PNP_DEVICE_ID_LIST **ReturnCidList); 53267754Smsmith 533197104Sjkim 534193267Sjkim/* 535193267Sjkim * utlock - reader/writer locks 536193267Sjkim */ 537193267SjkimACPI_STATUS 538193267SjkimAcpiUtCreateRwLock ( 539193267Sjkim ACPI_RW_LOCK *Lock); 54067754Smsmith 541193267Sjkimvoid 542193267SjkimAcpiUtDeleteRwLock ( 543193267Sjkim ACPI_RW_LOCK *Lock); 544193267Sjkim 545193267SjkimACPI_STATUS 546193267SjkimAcpiUtAcquireReadLock ( 547193267Sjkim ACPI_RW_LOCK *Lock); 548193267Sjkim 549193267SjkimACPI_STATUS 550193267SjkimAcpiUtReleaseReadLock ( 551193267Sjkim ACPI_RW_LOCK *Lock); 552193267Sjkim 553193267SjkimACPI_STATUS 554193267SjkimAcpiUtAcquireWriteLock ( 555193267Sjkim ACPI_RW_LOCK *Lock); 556193267Sjkim 557193267Sjkimvoid 558193267SjkimAcpiUtReleaseWriteLock ( 559193267Sjkim ACPI_RW_LOCK *Lock); 560193267Sjkim 561193267Sjkim 56267754Smsmith/* 563151937Sjkim * utobject - internal object create/delete/cache routines 56467754Smsmith */ 56583174SmsmithACPI_OPERAND_OBJECT * 56683174SmsmithAcpiUtCreateInternalObjectDbg ( 567193267Sjkim const char *ModuleName, 56883174Smsmith UINT32 LineNumber, 56983174Smsmith UINT32 ComponentId, 57091116Smsmith ACPI_OBJECT_TYPE Type); 57183174Smsmith 57267754Smsmithvoid * 57383174SmsmithAcpiUtAllocateObjectDescDbg ( 574193267Sjkim const char *ModuleName, 57567754Smsmith UINT32 LineNumber, 57667754Smsmith UINT32 ComponentId); 57767754Smsmith 578151937Sjkim#define AcpiUtCreateInternalObject(t) AcpiUtCreateInternalObjectDbg (_AcpiModuleName,__LINE__,_COMPONENT,t) 579151937Sjkim#define AcpiUtAllocateObjectDesc() AcpiUtAllocateObjectDescDbg (_AcpiModuleName,__LINE__,_COMPONENT) 58067754Smsmith 58167754Smsmithvoid 58277424SmsmithAcpiUtDeleteObjectDesc ( 58367754Smsmith ACPI_OPERAND_OBJECT *Object); 58467754Smsmith 58567754SmsmithBOOLEAN 58677424SmsmithAcpiUtValidInternalObject ( 58767754Smsmith void *Object); 58867754Smsmith 589107325SiwasakiACPI_OPERAND_OBJECT * 590193267SjkimAcpiUtCreatePackageObject ( 591193267Sjkim UINT32 Count); 592193267Sjkim 593193267SjkimACPI_OPERAND_OBJECT * 594199337SjkimAcpiUtCreateIntegerObject ( 595199337Sjkim UINT64 Value); 596199337Sjkim 597199337SjkimACPI_OPERAND_OBJECT * 598107325SiwasakiAcpiUtCreateBufferObject ( 599107325Siwasaki ACPI_SIZE BufferSize); 60067754Smsmith 601138287SmarksACPI_OPERAND_OBJECT * 602138287SmarksAcpiUtCreateStringObject ( 603138287Smarks ACPI_SIZE StringSize); 604107325Siwasaki 60567754SmsmithACPI_STATUS 60677424SmsmithAcpiUtGetObjectSize( 60767754Smsmith ACPI_OPERAND_OBJECT *Obj, 60891116Smsmith ACPI_SIZE *ObjLength); 60967754Smsmith 61067754Smsmith 61167754Smsmith/* 612210976Sjkim * utosi - Support for the _OSI predefined control method 613210976Sjkim */ 614210976SjkimACPI_STATUS 615210976SjkimAcpiUtInitializeInterfaces ( 616210976Sjkim void); 617210976Sjkim 618249112SjkimACPI_STATUS 619210976SjkimAcpiUtInterfaceTerminate ( 620210976Sjkim void); 621210976Sjkim 622210976SjkimACPI_STATUS 623210976SjkimAcpiUtInstallInterface ( 624210976Sjkim ACPI_STRING InterfaceName); 625210976Sjkim 626210976SjkimACPI_STATUS 627210976SjkimAcpiUtRemoveInterface ( 628210976Sjkim ACPI_STRING InterfaceName); 629210976Sjkim 630210976SjkimACPI_INTERFACE_INFO * 631210976SjkimAcpiUtGetInterface ( 632210976Sjkim ACPI_STRING InterfaceName); 633210976Sjkim 634210976SjkimACPI_STATUS 635210976SjkimAcpiUtOsiImplementation ( 636210976Sjkim ACPI_WALK_STATE *WalkState); 637210976Sjkim 638210976Sjkim 639210976Sjkim/* 640249112Sjkim * utpredef - support for predefined names 641249112Sjkim */ 642249112Sjkimconst ACPI_PREDEFINED_INFO * 643249112SjkimAcpiUtGetNextPredefinedMethod ( 644249112Sjkim const ACPI_PREDEFINED_INFO *ThisName); 645249112Sjkim 646249112Sjkimconst ACPI_PREDEFINED_INFO * 647249112SjkimAcpiUtMatchPredefinedMethod ( 648249112Sjkim char *Name); 649249112Sjkim 650249112Sjkimconst ACPI_PREDEFINED_INFO * 651249112SjkimAcpiUtMatchResourceName ( 652249112Sjkim char *Name); 653249112Sjkim 654249112Sjkimvoid 655249112SjkimAcpiUtDisplayPredefinedMethod ( 656249112Sjkim char *Buffer, 657249112Sjkim const ACPI_PREDEFINED_INFO *ThisName, 658249112Sjkim BOOLEAN MultiLine); 659249112Sjkim 660249112Sjkimvoid 661249112SjkimAcpiUtGetExpectedReturnTypes ( 662249112Sjkim char *Buffer, 663249112Sjkim UINT32 ExpectedBtypes); 664249112Sjkim 665249112SjkimUINT32 666249112SjkimAcpiUtGetResourceBitWidth ( 667249112Sjkim char *Buffer, 668249112Sjkim UINT16 Types); 669249112Sjkim 670249112Sjkim 671249112Sjkim/* 672151937Sjkim * utstate - Generic state creation/cache routines 67367754Smsmith */ 67467754Smsmithvoid 67577424SmsmithAcpiUtPushGenericState ( 67667754Smsmith ACPI_GENERIC_STATE **ListHead, 67767754Smsmith ACPI_GENERIC_STATE *State); 67867754Smsmith 67967754SmsmithACPI_GENERIC_STATE * 68077424SmsmithAcpiUtPopGenericState ( 68167754Smsmith ACPI_GENERIC_STATE **ListHead); 68267754Smsmith 68367754Smsmith 68467754SmsmithACPI_GENERIC_STATE * 68577424SmsmithAcpiUtCreateGenericState ( 68667754Smsmith void); 68767754Smsmith 68887031SmsmithACPI_THREAD_STATE * 68987031SmsmithAcpiUtCreateThreadState ( 69087031Smsmith void); 69187031Smsmith 69267754SmsmithACPI_GENERIC_STATE * 69377424SmsmithAcpiUtCreateUpdateState ( 69467754Smsmith ACPI_OPERAND_OBJECT *Object, 69567754Smsmith UINT16 Action); 69667754Smsmith 69773561SmsmithACPI_GENERIC_STATE * 69877424SmsmithAcpiUtCreatePkgState ( 69973561Smsmith void *InternalObject, 70073561Smsmith void *ExternalObject, 70173561Smsmith UINT16 Index); 70273561Smsmith 70367754SmsmithACPI_STATUS 70477424SmsmithAcpiUtCreateUpdateStateAndPush ( 70567754Smsmith ACPI_OPERAND_OBJECT *Object, 70667754Smsmith UINT16 Action, 70767754Smsmith ACPI_GENERIC_STATE **StateList); 70867754Smsmith 70973561SmsmithACPI_STATUS 71077424SmsmithAcpiUtCreatePkgStateAndPush ( 71173561Smsmith void *InternalObject, 71273561Smsmith void *ExternalObject, 71373561Smsmith UINT16 Index, 71473561Smsmith ACPI_GENERIC_STATE **StateList); 71573561Smsmith 71667754SmsmithACPI_GENERIC_STATE * 71777424SmsmithAcpiUtCreateControlState ( 71867754Smsmith void); 71967754Smsmith 72067754Smsmithvoid 72177424SmsmithAcpiUtDeleteGenericState ( 72267754Smsmith ACPI_GENERIC_STATE *State); 72367754Smsmith 72467754Smsmith 72567754Smsmith/* 726151937Sjkim * utmath 72767754Smsmith */ 72884491SmsmithACPI_STATUS 72984491SmsmithAcpiUtDivide ( 730202771Sjkim UINT64 InDividend, 731202771Sjkim UINT64 InDivisor, 732202771Sjkim UINT64 *OutQuotient, 733202771Sjkim UINT64 *OutRemainder); 73484491Smsmith 73584491SmsmithACPI_STATUS 73684491SmsmithAcpiUtShortDivide ( 737202771Sjkim UINT64 InDividend, 73884491Smsmith UINT32 Divisor, 739202771Sjkim UINT64 *OutQuotient, 74084491Smsmith UINT32 *OutRemainder); 74184491Smsmith 742246849Sjkim 743151937Sjkim/* 744151937Sjkim * utmisc 745151937Sjkim */ 746246849Sjkimconst ACPI_EXCEPTION_INFO * 747167802SjkimAcpiUtValidateException ( 748167802Sjkim ACPI_STATUS Status); 749167802Sjkim 750167802SjkimBOOLEAN 751197104SjkimAcpiUtIsPciRootBridge ( 752197104Sjkim char *Id); 753197104Sjkim 754197104SjkimBOOLEAN 755167802SjkimAcpiUtIsAmlTable ( 756167802Sjkim ACPI_TABLE_HEADER *Table); 757167802Sjkim 758151937SjkimACPI_STATUS 759151937SjkimAcpiUtWalkPackageTree ( 760151937Sjkim ACPI_OPERAND_OBJECT *SourceObject, 761151937Sjkim void *TargetObject, 762151937Sjkim ACPI_PKG_CALLBACK WalkCallback, 763151937Sjkim void *Context); 764151937Sjkim 765151937Sjkim 766138287Smarks/* Values for Base above (16=Hex, 10=Decimal) */ 767138287Smarks 768138287Smarks#define ACPI_ANY_BASE 0 769138287Smarks 770151937SjkimUINT32 77199679SiwasakiAcpiUtDwordByteSwap ( 77299679Siwasaki UINT32 Value); 77399679Siwasaki 77499679Siwasakivoid 77599679SiwasakiAcpiUtSetIntegerWidth ( 77699679Siwasaki UINT8 Revision); 77799679Siwasaki 778102550Siwasaki#ifdef ACPI_DEBUG_OUTPUT 77973561Smsmithvoid 78077424SmsmithAcpiUtDisplayInitPathname ( 781114237Snjl UINT8 Type, 782114237Snjl ACPI_NAMESPACE_NODE *ObjHandle, 78373561Smsmith char *Path); 78473561Smsmith#endif 78573561Smsmith 78673561Smsmith 78767754Smsmith/* 788245582Sjkim * utownerid - Support for Table/Method Owner IDs 789245582Sjkim */ 790245582SjkimACPI_STATUS 791245582SjkimAcpiUtAllocateOwnerId ( 792245582Sjkim ACPI_OWNER_ID *OwnerId); 793245582Sjkim 794245582Sjkimvoid 795245582SjkimAcpiUtReleaseOwnerId ( 796245582Sjkim ACPI_OWNER_ID *OwnerId); 797245582Sjkim 798245582Sjkim 799245582Sjkim/* 800167802Sjkim * utresrc 801167802Sjkim */ 802167802SjkimACPI_STATUS 803167802SjkimAcpiUtWalkAmlResources ( 804243347Sjkim ACPI_WALK_STATE *WalkState, 805167802Sjkim UINT8 *Aml, 806167802Sjkim ACPI_SIZE AmlLength, 807167802Sjkim ACPI_WALK_AML_CALLBACK UserFunction, 808245582Sjkim void **Context); 809167802Sjkim 810167802SjkimACPI_STATUS 811167802SjkimAcpiUtValidateResource ( 812243347Sjkim ACPI_WALK_STATE *WalkState, 813167802Sjkim void *Aml, 814167802Sjkim UINT8 *ReturnIndex); 815167802Sjkim 816167802SjkimUINT32 817167802SjkimAcpiUtGetDescriptorLength ( 818167802Sjkim void *Aml); 819167802Sjkim 820167802SjkimUINT16 821167802SjkimAcpiUtGetResourceLength ( 822167802Sjkim void *Aml); 823167802Sjkim 824167802SjkimUINT8 825167802SjkimAcpiUtGetResourceHeaderLength ( 826167802Sjkim void *Aml); 827167802Sjkim 828167802SjkimUINT8 829167802SjkimAcpiUtGetResourceType ( 830167802Sjkim void *Aml); 831167802Sjkim 832167802SjkimACPI_STATUS 833167802SjkimAcpiUtGetResourceEndTag ( 834167802Sjkim ACPI_OPERAND_OBJECT *ObjDesc, 835167802Sjkim UINT8 **EndTag); 836167802Sjkim 837167802Sjkim 838167802Sjkim/* 839245582Sjkim * utstring - String and character utilities 840245582Sjkim */ 841245582Sjkimvoid 842245582SjkimAcpiUtStrupr ( 843245582Sjkim char *SrcString); 844245582Sjkim 845245582Sjkimvoid 846245582SjkimAcpiUtStrlwr ( 847245582Sjkim char *SrcString); 848245582Sjkim 849245582Sjkimint 850245582SjkimAcpiUtStricmp ( 851245582Sjkim char *String1, 852245582Sjkim char *String2); 853245582Sjkim 854245582SjkimACPI_STATUS 855245582SjkimAcpiUtStrtoul64 ( 856245582Sjkim char *String, 857245582Sjkim UINT32 Base, 858245582Sjkim UINT64 *RetInteger); 859245582Sjkim 860245582Sjkimvoid 861245582SjkimAcpiUtPrintString ( 862245582Sjkim char *String, 863245582Sjkim UINT8 MaxLength); 864245582Sjkim 865245582Sjkimvoid 866245582SjkimUtConvertBackslashes ( 867245582Sjkim char *Pathname); 868245582Sjkim 869245582SjkimBOOLEAN 870245582SjkimAcpiUtValidAcpiName ( 871245582Sjkim UINT32 Name); 872245582Sjkim 873245582SjkimBOOLEAN 874245582SjkimAcpiUtValidAcpiChar ( 875245582Sjkim char Character, 876245582Sjkim UINT32 Position); 877245582Sjkim 878245582Sjkimvoid 879245582SjkimAcpiUtRepairName ( 880245582Sjkim char *Name); 881245582Sjkim 882245582Sjkim 883245582Sjkim/* 884151937Sjkim * utmutex - mutex support 88567754Smsmith */ 886151937SjkimACPI_STATUS 887151937SjkimAcpiUtMutexInitialize ( 888151937Sjkim void); 88967754Smsmith 89082367Smsmithvoid 891151937SjkimAcpiUtMutexTerminate ( 892151937Sjkim void); 89382367Smsmith 894151937SjkimACPI_STATUS 895151937SjkimAcpiUtAcquireMutex ( 896151937Sjkim ACPI_MUTEX_HANDLE MutexId); 89782367Smsmith 89891116SmsmithACPI_STATUS 899151937SjkimAcpiUtReleaseMutex ( 900151937Sjkim ACPI_MUTEX_HANDLE MutexId); 901151937Sjkim 902151937Sjkim 903151937Sjkim/* 904151937Sjkim * utalloc - memory allocation and object caching 905151937Sjkim */ 906151937SjkimACPI_STATUS 907151937SjkimAcpiUtCreateCaches ( 908151937Sjkim void); 909151937Sjkim 910151937SjkimACPI_STATUS 911151937SjkimAcpiUtDeleteCaches ( 912151937Sjkim void); 913151937Sjkim 914151937SjkimACPI_STATUS 91591116SmsmithAcpiUtValidateBuffer ( 91691116Smsmith ACPI_BUFFER *Buffer); 91782367Smsmith 91891116SmsmithACPI_STATUS 91991116SmsmithAcpiUtInitializeBuffer ( 92091116Smsmith ACPI_BUFFER *Buffer, 92191116Smsmith ACPI_SIZE RequiredLength); 92282367Smsmith 92382367Smsmithvoid * 92480062SmsmithAcpiUtAllocate ( 92591116Smsmith ACPI_SIZE Size, 92667754Smsmith UINT32 Component, 927193267Sjkim const char *Module, 92867754Smsmith UINT32 Line); 92967754Smsmith 93067754Smsmithvoid * 931167802SjkimAcpiUtAllocateZeroed ( 93291116Smsmith ACPI_SIZE Size, 93367754Smsmith UINT32 Component, 934193267Sjkim const char *Module, 93567754Smsmith UINT32 Line); 93667754Smsmith 93791116Smsmith#ifdef ACPI_DBG_TRACK_ALLOCATIONS 93891116Smsmithvoid * 93991116SmsmithAcpiUtAllocateAndTrack ( 94091116Smsmith ACPI_SIZE Size, 94191116Smsmith UINT32 Component, 942193267Sjkim const char *Module, 94391116Smsmith UINT32 Line); 94491116Smsmith 94591116Smsmithvoid * 946167802SjkimAcpiUtAllocateZeroedAndTrack ( 94791116Smsmith ACPI_SIZE Size, 94891116Smsmith UINT32 Component, 949193267Sjkim const char *Module, 95091116Smsmith UINT32 Line); 95191116Smsmith 95267754Smsmithvoid 95391116SmsmithAcpiUtFreeAndTrack ( 95467754Smsmith void *Address, 95567754Smsmith UINT32 Component, 956193267Sjkim const char *Module, 95767754Smsmith UINT32 Line); 95899679Siwasaki 95967754Smsmithvoid 96077424SmsmithAcpiUtDumpAllocationInfo ( 96167754Smsmith void); 96267754Smsmith 96367754Smsmithvoid 96484491SmsmithAcpiUtDumpAllocations ( 96567754Smsmith UINT32 Component, 966193267Sjkim const char *Module); 967167802Sjkim 968167802SjkimACPI_STATUS 969167802SjkimAcpiUtCreateList ( 970167802Sjkim char *ListName, 971167802Sjkim UINT16 ObjectSize, 972167802Sjkim ACPI_MEMORY_LIST **ReturnCache); 973167802Sjkim 974212761Sjkim#endif /* ACPI_DBG_TRACK_ALLOCATIONS */ 975167802Sjkim 976229989Sjkim/* 977229989Sjkim * utaddress - address range check 978229989Sjkim */ 979229989SjkimACPI_STATUS 980229989SjkimAcpiUtAddAddressRange ( 981229989Sjkim ACPI_ADR_SPACE_TYPE SpaceId, 982229989Sjkim ACPI_PHYSICAL_ADDRESS Address, 983229989Sjkim UINT32 Length, 984229989Sjkim ACPI_NAMESPACE_NODE *RegionNode); 98567754Smsmith 986229989Sjkimvoid 987229989SjkimAcpiUtRemoveAddressRange ( 988229989Sjkim ACPI_ADR_SPACE_TYPE SpaceId, 989229989Sjkim ACPI_NAMESPACE_NODE *RegionNode); 990229989Sjkim 991229989SjkimUINT32 992229989SjkimAcpiUtCheckAddressRange ( 993229989Sjkim ACPI_ADR_SPACE_TYPE SpaceId, 994229989Sjkim ACPI_PHYSICAL_ADDRESS Address, 995229989Sjkim UINT32 Length, 996229989Sjkim BOOLEAN Warn); 997229989Sjkim 998229989Sjkimvoid 999229989SjkimAcpiUtDeleteAddressLists ( 1000229989Sjkim void); 1001229989Sjkim 1002212761Sjkim/* 1003212761Sjkim * utxferror - various error/warning output functions 1004212761Sjkim */ 1005212761Sjkimvoid ACPI_INTERNAL_VAR_XFACE 1006212761SjkimAcpiUtPredefinedWarning ( 1007212761Sjkim const char *ModuleName, 1008212761Sjkim UINT32 LineNumber, 1009212761Sjkim char *Pathname, 1010212761Sjkim UINT8 NodeFlags, 1011212761Sjkim const char *Format, 1012212761Sjkim ...); 1013212761Sjkim 1014212761Sjkimvoid ACPI_INTERNAL_VAR_XFACE 1015212761SjkimAcpiUtPredefinedInfo ( 1016212761Sjkim const char *ModuleName, 1017212761Sjkim UINT32 LineNumber, 1018212761Sjkim char *Pathname, 1019212761Sjkim UINT8 NodeFlags, 1020212761Sjkim const char *Format, 1021212761Sjkim ...); 1022212761Sjkim 1023212761Sjkimvoid 1024212761SjkimAcpiUtNamespaceError ( 1025212761Sjkim const char *ModuleName, 1026212761Sjkim UINT32 LineNumber, 1027212761Sjkim const char *InternalName, 1028212761Sjkim ACPI_STATUS LookupStatus); 1029212761Sjkim 1030212761Sjkimvoid 1031212761SjkimAcpiUtMethodError ( 1032212761Sjkim const char *ModuleName, 1033212761Sjkim UINT32 LineNumber, 1034212761Sjkim const char *Message, 1035212761Sjkim ACPI_NAMESPACE_NODE *Node, 1036212761Sjkim const char *Path, 1037212761Sjkim ACPI_STATUS LookupStatus); 1038212761Sjkim 103977424Smsmith#endif /* _ACUTILS_H */ 1040