Path: blob/main/sys/contrib/dev/acpica/include/acresrc.h
48286 views
/******************************************************************************1*2* Name: acresrc.h - Resource Manager function prototypes3*4*****************************************************************************/56/******************************************************************************7*8* 1. Copyright Notice9*10* Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp.11* All rights reserved.12*13* 2. License14*15* 2.1. This is your license from Intel Corp. under its intellectual property16* rights. You may have additional license terms from the party that provided17* you this software, covering your right to use that party's intellectual18* property rights.19*20* 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a21* copy of the source code appearing in this file ("Covered Code") an22* irrevocable, perpetual, worldwide license under Intel's copyrights in the23* base code distributed originally by Intel ("Original Intel Code") to copy,2425* make derivatives, distribute, use and display any portion of the Covered26* Code in any form, with the right to sublicense such rights; and27*28* 2.3. Intel grants Licensee a non-exclusive and non-transferable patent29* license (with the right to sublicense), under only those claims of Intel30* patents that are infringed by the Original Intel Code, to make, use, sell,31* offer to sell, and import the Covered Code and derivative works thereof32* solely to the minimum extent necessary to exercise the above copyright33* license, and in no event shall the patent license extend to any additions34* to or modifications of the Original Intel Code. No other license or right35* is granted directly or by implication, estoppel or otherwise;36*37* The above copyright and patent license is granted only if the following38* conditions are met:39*40* 3. Conditions41*42* 3.1. Redistribution of Source with Rights to Further Distribute Source.43* Redistribution of source code of any substantial portion of the Covered44* Code or modification with rights to further distribute source must include45* the above Copyright Notice, the above License, this list of Conditions,46* and the following Disclaimer and Export Compliance provision. In addition,47* Licensee must cause all Covered Code to which Licensee contributes to48* contain a file documenting the changes Licensee made to create that Covered49* Code and the date of any change. Licensee must include in that file the50* documentation of any changes made by any predecessor Licensee. Licensee51* must include a prominent statement that the modification is derived,52* directly or indirectly, from Original Intel Code.53*54* 3.2. Redistribution of Source with no Rights to Further Distribute Source.55* Redistribution of source code of any substantial portion of the Covered56* Code or modification without rights to further distribute source must57* include the following Disclaimer and Export Compliance provision in the58* documentation and/or other materials provided with distribution. In59* addition, Licensee may not authorize further sublicense of source of any60* portion of the Covered Code, and must include terms to the effect that the61* license from Licensee to its licensee is limited to the intellectual62* property embodied in the software Licensee provides to its licensee, and63* not to intellectual property embodied in modifications its licensee may64* make.65*66* 3.3. Redistribution of Executable. Redistribution in executable form of any67* substantial portion of the Covered Code or modification must reproduce the68* above Copyright Notice, and the following Disclaimer and Export Compliance69* provision in the documentation and/or other materials provided with the70* distribution.71*72* 3.4. Intel retains all right, title, and interest in and to the Original73* Intel Code.74*75* 3.5. Neither the name Intel nor any other trademark owned or controlled by76* Intel shall be used in advertising or otherwise to promote the sale, use or77* other dealings in products derived from or relating to the Covered Code78* without prior written authorization from Intel.79*80* 4. Disclaimer and Export Compliance81*82* 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED83* HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE84* IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,85* INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY86* UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY87* IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A88* PARTICULAR PURPOSE.89*90* 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES91* OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR92* COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,93* SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY94* CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL95* HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS96* SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY97* LIMITED REMEDY.98*99* 4.3. Licensee shall not export, either directly or indirectly, any of this100* software or system incorporating such software without first obtaining any101* required license or other approval from the U. S. Department of Commerce or102* any other agency or department of the United States Government. In the103* event Licensee exports any such software from the United States or104* re-exports any such software from a foreign destination, Licensee shall105* ensure that the distribution and export/re-export of the software is in106* compliance with all laws, regulations, orders, or other restrictions of the107* U.S. Export Administration Regulations. Licensee agrees that neither it nor108* any of its subsidiaries will export/re-export any technical data, process,109* software, or service, directly or indirectly, to any country for which the110* United States government or any agency thereof requires an export license,111* other governmental approval, or letter of assurance, without first obtaining112* such license, approval or letter.113*114*****************************************************************************115*116* Alternatively, you may choose to be licensed under the terms of the117* following license:118*119* Redistribution and use in source and binary forms, with or without120* modification, are permitted provided that the following conditions121* are met:122* 1. Redistributions of source code must retain the above copyright123* notice, this list of conditions, and the following disclaimer,124* without modification.125* 2. Redistributions in binary form must reproduce at minimum a disclaimer126* substantially similar to the "NO WARRANTY" disclaimer below127* ("Disclaimer") and any redistribution must be conditioned upon128* including a substantially similar Disclaimer requirement for further129* binary redistribution.130* 3. Neither the names of the above-listed copyright holders nor the names131* of any contributors may be used to endorse or promote products derived132* from this software without specific prior written permission.133*134* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS135* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT136* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR137* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT138* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,139* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT140* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,141* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY142* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT143* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE144* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.145*146* Alternatively, you may choose to be licensed under the terms of the147* GNU General Public License ("GPL") version 2 as published by the Free148* Software Foundation.149*150*****************************************************************************/151152#ifndef __ACRESRC_H__153#define __ACRESRC_H__154155/* Need the AML resource descriptor structs */156157#include <contrib/dev/acpica/include/amlresrc.h>158159160/*161* If possible, pack the following structures to byte alignment, since we162* don't care about performance for debug output. Two cases where we cannot163* pack the structures:164*165* 1) Hardware does not support misaligned memory transfers166* 2) Compiler does not support pointers within packed structures167*/168#if (!defined(ACPI_MISALIGNMENT_NOT_SUPPORTED) && !defined(ACPI_PACKED_POINTERS_NOT_SUPPORTED))169#pragma pack(1)170#endif171172/*173* Individual entry for the resource conversion tables174*/175typedef const struct acpi_rsconvert_info176{177UINT8 Opcode;178UINT8 ResourceOffset;179UINT8 AmlOffset;180UINT8 Value;181182} ACPI_RSCONVERT_INFO;183184/* Resource conversion opcodes */185186typedef enum187{188ACPI_RSC_INITGET = 0,189ACPI_RSC_INITSET,190ACPI_RSC_FLAGINIT,191ACPI_RSC_1BITFLAG,192ACPI_RSC_2BITFLAG,193ACPI_RSC_3BITFLAG,194ACPI_RSC_6BITFLAG,195ACPI_RSC_ADDRESS,196ACPI_RSC_BITMASK,197ACPI_RSC_BITMASK16,198ACPI_RSC_COUNT,199ACPI_RSC_COUNT16,200ACPI_RSC_COUNT_GPIO_PIN,201ACPI_RSC_COUNT_GPIO_RES,202ACPI_RSC_COUNT_GPIO_VEN,203ACPI_RSC_COUNT_SERIAL_RES,204ACPI_RSC_COUNT_SERIAL_VEN,205ACPI_RSC_DATA8,206ACPI_RSC_EXIT_EQ,207ACPI_RSC_EXIT_LE,208ACPI_RSC_EXIT_NE,209ACPI_RSC_LENGTH,210ACPI_RSC_MOVE_GPIO_PIN,211ACPI_RSC_MOVE_GPIO_RES,212ACPI_RSC_MOVE_SERIAL_RES,213ACPI_RSC_MOVE_SERIAL_VEN,214ACPI_RSC_MOVE8,215ACPI_RSC_MOVE16,216ACPI_RSC_MOVE32,217ACPI_RSC_MOVE64,218ACPI_RSC_SET8,219ACPI_RSC_SOURCE,220ACPI_RSC_SOURCEX221222} ACPI_RSCONVERT_OPCODES;223224/* Resource Conversion sub-opcodes */225226#define ACPI_RSC_COMPARE_AML_LENGTH 0227#define ACPI_RSC_COMPARE_VALUE 1228229#define ACPI_RSC_TABLE_SIZE(d) (sizeof (d) / sizeof (ACPI_RSCONVERT_INFO))230231#define ACPI_RS_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_RESOURCE,f)232#define AML_OFFSET(f) (UINT8) ACPI_OFFSET (AML_RESOURCE,f)233234235/*236* Individual entry for the resource dump tables237*/238typedef const struct acpi_rsdump_info239{240UINT8 Opcode;241UINT8 Offset;242const char *Name;243const char **Pointer;244245} ACPI_RSDUMP_INFO;246247/* Values for the Opcode field above */248249typedef enum250{251ACPI_RSD_TITLE = 0,252ACPI_RSD_1BITFLAG,253ACPI_RSD_2BITFLAG,254ACPI_RSD_3BITFLAG,255ACPI_RSD_6BITFLAG,256ACPI_RSD_ADDRESS,257ACPI_RSD_DWORDLIST,258ACPI_RSD_LITERAL,259ACPI_RSD_LONGLIST,260ACPI_RSD_SHORTLIST,261ACPI_RSD_SHORTLISTX,262ACPI_RSD_SOURCE,263ACPI_RSD_STRING,264ACPI_RSD_UINT8,265ACPI_RSD_UINT16,266ACPI_RSD_UINT32,267ACPI_RSD_UINT64,268ACPI_RSD_WORDLIST,269ACPI_RSD_LABEL,270ACPI_RSD_SOURCE_LABEL,271272} ACPI_RSDUMP_OPCODES;273274/* restore default alignment */275276#pragma pack()277278279/* Resource tables indexed by internal resource type */280281extern const UINT8 AcpiGbl_AmlResourceSizes[];282extern const UINT8 AcpiGbl_AmlResourceSerialBusSizes[];283extern ACPI_RSCONVERT_INFO *AcpiGbl_SetResourceDispatch[];284285/* Resource tables indexed by raw AML resource descriptor type */286287extern const UINT8 AcpiGbl_ResourceStructSizes[];288extern const UINT8 AcpiGbl_ResourceStructSerialBusSizes[];289extern ACPI_RSCONVERT_INFO *AcpiGbl_GetResourceDispatch[];290291extern ACPI_RSCONVERT_INFO *AcpiGbl_ConvertResourceSerialBusDispatch[];292293typedef struct acpi_vendor_walk_info294{295ACPI_VENDOR_UUID *Uuid;296ACPI_BUFFER *Buffer;297ACPI_STATUS Status;298299} ACPI_VENDOR_WALK_INFO;300301302/*303* rscreate304*/305ACPI_STATUS306AcpiRsCreateResourceList (307ACPI_OPERAND_OBJECT *AmlBuffer,308ACPI_BUFFER *OutputBuffer);309310ACPI_STATUS311AcpiRsCreateAmlResources (312ACPI_BUFFER *ResourceList,313ACPI_BUFFER *OutputBuffer);314315ACPI_STATUS316AcpiRsCreatePciRoutingTable (317ACPI_OPERAND_OBJECT *PackageObject,318ACPI_BUFFER *OutputBuffer);319320321/*322* rsutils323*/324ACPI_STATUS325AcpiRsGetPrtMethodData (326ACPI_NAMESPACE_NODE *Node,327ACPI_BUFFER *RetBuffer);328329ACPI_STATUS330AcpiRsGetCrsMethodData (331ACPI_NAMESPACE_NODE *Node,332ACPI_BUFFER *RetBuffer);333334ACPI_STATUS335AcpiRsGetPrsMethodData (336ACPI_NAMESPACE_NODE *Node,337ACPI_BUFFER *RetBuffer);338339ACPI_STATUS340AcpiRsGetMethodData (341ACPI_HANDLE Handle,342const char *Path,343ACPI_BUFFER *RetBuffer);344345ACPI_STATUS346AcpiRsSetSrsMethodData (347ACPI_NAMESPACE_NODE *Node,348ACPI_BUFFER *RetBuffer);349350ACPI_STATUS351AcpiRsGetAeiMethodData (352ACPI_NAMESPACE_NODE *Node,353ACPI_BUFFER *RetBuffer);354355/*356* rscalc357*/358ACPI_STATUS359AcpiRsGetListLength (360UINT8 *AmlBuffer,361UINT32 AmlBufferLength,362ACPI_SIZE *SizeNeeded);363364ACPI_STATUS365AcpiRsGetAmlLength (366ACPI_RESOURCE *ResourceList,367ACPI_SIZE ResourceListSize,368ACPI_SIZE *SizeNeeded);369370ACPI_STATUS371AcpiRsGetPciRoutingTableLength (372ACPI_OPERAND_OBJECT *PackageObject,373ACPI_SIZE *BufferSizeNeeded);374375ACPI_STATUS376AcpiRsConvertAmlToResources (377UINT8 *Aml,378UINT32 Length,379UINT32 Offset,380UINT8 ResourceIndex,381void **Context);382383ACPI_STATUS384AcpiRsConvertResourcesToAml (385ACPI_RESOURCE *Resource,386ACPI_SIZE AmlSizeNeeded,387UINT8 *OutputBuffer);388389390/*391* rsaddr392*/393void394AcpiRsSetAddressCommon (395AML_RESOURCE *Aml,396ACPI_RESOURCE *Resource);397398BOOLEAN399AcpiRsGetAddressCommon (400ACPI_RESOURCE *Resource,401AML_RESOURCE *Aml);402403404/*405* rsmisc406*/407ACPI_STATUS408AcpiRsConvertAmlToResource (409ACPI_RESOURCE *Resource,410AML_RESOURCE *Aml,411ACPI_RSCONVERT_INFO *Info);412413ACPI_STATUS414AcpiRsConvertResourceToAml (415ACPI_RESOURCE *Resource,416AML_RESOURCE *Aml,417ACPI_RSCONVERT_INFO *Info);418419420/*421* rsutils422*/423void424AcpiRsMoveData (425void *Destination,426void *Source,427UINT16 ItemCount,428UINT8 MoveType);429430UINT8431AcpiRsDecodeBitmask (432UINT16 Mask,433UINT8 *List);434435UINT16436AcpiRsEncodeBitmask (437UINT8 *List,438UINT8 Count);439440ACPI_RS_LENGTH441AcpiRsGetResourceSource (442ACPI_RS_LENGTH ResourceLength,443ACPI_RS_LENGTH MinimumLength,444ACPI_RESOURCE_SOURCE *ResourceSource,445AML_RESOURCE *Aml,446char *StringPtr);447448ACPI_RSDESC_SIZE449AcpiRsSetResourceSource (450AML_RESOURCE *Aml,451ACPI_RS_LENGTH MinimumLength,452ACPI_RESOURCE_SOURCE *ResourceSource);453454void455AcpiRsSetResourceHeader (456UINT8 DescriptorType,457ACPI_RSDESC_SIZE TotalLength,458AML_RESOURCE *Aml);459460void461AcpiRsSetResourceLength (462ACPI_RSDESC_SIZE TotalLength,463AML_RESOURCE *Aml);464465466/*467* rsdump - Debugger support468*/469#ifdef ACPI_DEBUGGER470void471AcpiRsDumpResourceList (472ACPI_RESOURCE *Resource);473474void475AcpiRsDumpIrqList (476UINT8 *RouteTable);477#endif478479480/*481* Resource conversion tables482*/483extern ACPI_RSCONVERT_INFO AcpiRsConvertDma[];484extern ACPI_RSCONVERT_INFO AcpiRsConvertEndDpf[];485extern ACPI_RSCONVERT_INFO AcpiRsConvertIo[];486extern ACPI_RSCONVERT_INFO AcpiRsConvertFixedIo[];487extern ACPI_RSCONVERT_INFO AcpiRsConvertEndTag[];488extern ACPI_RSCONVERT_INFO AcpiRsConvertMemory24[];489extern ACPI_RSCONVERT_INFO AcpiRsConvertGenericReg[];490extern ACPI_RSCONVERT_INFO AcpiRsConvertMemory32[];491extern ACPI_RSCONVERT_INFO AcpiRsConvertFixedMemory32[];492extern ACPI_RSCONVERT_INFO AcpiRsConvertAddress32[];493extern ACPI_RSCONVERT_INFO AcpiRsConvertAddress16[];494extern ACPI_RSCONVERT_INFO AcpiRsConvertExtIrq[];495extern ACPI_RSCONVERT_INFO AcpiRsConvertAddress64[];496extern ACPI_RSCONVERT_INFO AcpiRsConvertExtAddress64[];497extern ACPI_RSCONVERT_INFO AcpiRsConvertGpio[];498extern ACPI_RSCONVERT_INFO AcpiRsConvertFixedDma[];499extern ACPI_RSCONVERT_INFO AcpiRsConvertCsi2SerialBus[];500extern ACPI_RSCONVERT_INFO AcpiRsConvertI2cSerialBus[];501extern ACPI_RSCONVERT_INFO AcpiRsConvertSpiSerialBus[];502extern ACPI_RSCONVERT_INFO AcpiRsConvertUartSerialBus[];503extern ACPI_RSCONVERT_INFO AcpiRsConvertPinFunction[];504extern ACPI_RSCONVERT_INFO AcpiRsConvertPinConfig[];505extern ACPI_RSCONVERT_INFO AcpiRsConvertPinGroup[];506extern ACPI_RSCONVERT_INFO AcpiRsConvertPinGroupFunction[];507extern ACPI_RSCONVERT_INFO AcpiRsConvertPinGroupConfig[];508extern ACPI_RSCONVERT_INFO AcpiRsConvertClockInput[];509510/* These resources require separate get/set tables */511512extern ACPI_RSCONVERT_INFO AcpiRsGetIrq[];513extern ACPI_RSCONVERT_INFO AcpiRsGetStartDpf[];514extern ACPI_RSCONVERT_INFO AcpiRsGetVendorSmall[];515extern ACPI_RSCONVERT_INFO AcpiRsGetVendorLarge[];516517extern ACPI_RSCONVERT_INFO AcpiRsSetIrq[];518extern ACPI_RSCONVERT_INFO AcpiRsSetStartDpf[];519extern ACPI_RSCONVERT_INFO AcpiRsSetVendor[];520521522#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)523/*524* rsinfo525*/526extern ACPI_RSDUMP_INFO *AcpiGbl_DumpResourceDispatch[];527extern ACPI_RSDUMP_INFO *AcpiGbl_DumpSerialBusDispatch[];528529/*530* rsdumpinfo531*/532extern ACPI_RSDUMP_INFO AcpiRsDumpIrq[];533extern ACPI_RSDUMP_INFO AcpiRsDumpPrt[];534extern ACPI_RSDUMP_INFO AcpiRsDumpDma[];535extern ACPI_RSDUMP_INFO AcpiRsDumpStartDpf[];536extern ACPI_RSDUMP_INFO AcpiRsDumpEndDpf[];537extern ACPI_RSDUMP_INFO AcpiRsDumpIo[];538extern ACPI_RSDUMP_INFO AcpiRsDumpIoFlags[];539extern ACPI_RSDUMP_INFO AcpiRsDumpFixedIo[];540extern ACPI_RSDUMP_INFO AcpiRsDumpVendor[];541extern ACPI_RSDUMP_INFO AcpiRsDumpEndTag[];542extern ACPI_RSDUMP_INFO AcpiRsDumpMemory24[];543extern ACPI_RSDUMP_INFO AcpiRsDumpMemory32[];544extern ACPI_RSDUMP_INFO AcpiRsDumpMemoryFlags[];545extern ACPI_RSDUMP_INFO AcpiRsDumpFixedMemory32[];546extern ACPI_RSDUMP_INFO AcpiRsDumpAddress16[];547extern ACPI_RSDUMP_INFO AcpiRsDumpAddress32[];548extern ACPI_RSDUMP_INFO AcpiRsDumpAddress64[];549extern ACPI_RSDUMP_INFO AcpiRsDumpExtAddress64[];550extern ACPI_RSDUMP_INFO AcpiRsDumpExtIrq[];551extern ACPI_RSDUMP_INFO AcpiRsDumpGenericReg[];552extern ACPI_RSDUMP_INFO AcpiRsDumpGpio[];553extern ACPI_RSDUMP_INFO AcpiRsDumpPinFunction[];554extern ACPI_RSDUMP_INFO AcpiRsDumpFixedDma[];555extern ACPI_RSDUMP_INFO AcpiRsDumpCommonSerialBus[];556extern ACPI_RSDUMP_INFO AcpiRsDumpCsi2SerialBus[];557extern ACPI_RSDUMP_INFO AcpiRsDumpI2cSerialBus[];558extern ACPI_RSDUMP_INFO AcpiRsDumpSpiSerialBus[];559extern ACPI_RSDUMP_INFO AcpiRsDumpUartSerialBus[];560extern ACPI_RSDUMP_INFO AcpiRsDumpGeneralFlags[];561extern ACPI_RSDUMP_INFO AcpiRsDumpPinConfig[];562extern ACPI_RSDUMP_INFO AcpiRsDumpPinGroup[];563extern ACPI_RSDUMP_INFO AcpiRsDumpPinGroupFunction[];564extern ACPI_RSDUMP_INFO AcpiRsDumpPinGroupConfig[];565extern ACPI_RSDUMP_INFO AcpiRsDumpClockInput[];566#endif567568#endif /* __ACRESRC_H__ */569570571