Path: blob/main/sys/contrib/dev/acpica/components/disassembler/dmresrcl.c
48524 views
/*******************************************************************************1*2* Module Name: dmresrcl.c - "Large" Resource Descriptor disassembly3*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,24* make derivatives, distribute, use and display any portion of the Covered25* Code in any form, with the right to sublicense such rights; and26*27* 2.3. Intel grants Licensee a non-exclusive and non-transferable patent28* license (with the right to sublicense), under only those claims of Intel29* patents that are infringed by the Original Intel Code, to make, use, sell,30* offer to sell, and import the Covered Code and derivative works thereof31* solely to the minimum extent necessary to exercise the above copyright32* license, and in no event shall the patent license extend to any additions33* to or modifications of the Original Intel Code. No other license or right34* is granted directly or by implication, estoppel or otherwise;35*36* The above copyright and patent license is granted only if the following37* conditions are met:38*39* 3. Conditions40*41* 3.1. Redistribution of Source with Rights to Further Distribute Source.42* Redistribution of source code of any substantial portion of the Covered43* Code or modification with rights to further distribute source must include44* the above Copyright Notice, the above License, this list of Conditions,45* and the following Disclaimer and Export Compliance provision. In addition,46* Licensee must cause all Covered Code to which Licensee contributes to47* contain a file documenting the changes Licensee made to create that Covered48* Code and the date of any change. Licensee must include in that file the49* documentation of any changes made by any predecessor Licensee. Licensee50* must include a prominent statement that the modification is derived,51* directly or indirectly, from Original Intel Code.52*53* 3.2. Redistribution of Source with no Rights to Further Distribute Source.54* Redistribution of source code of any substantial portion of the Covered55* Code or modification without rights to further distribute source must56* include the following Disclaimer and Export Compliance provision in the57* documentation and/or other materials provided with distribution. In58* addition, Licensee may not authorize further sublicense of source of any59* portion of the Covered Code, and must include terms to the effect that the60* license from Licensee to its licensee is limited to the intellectual61* property embodied in the software Licensee provides to its licensee, and62* not to intellectual property embodied in modifications its licensee may63* make.64*65* 3.3. Redistribution of Executable. Redistribution in executable form of any66* substantial portion of the Covered Code or modification must reproduce the67* above Copyright Notice, and the following Disclaimer and Export Compliance68* provision in the documentation and/or other materials provided with the69* distribution.70*71* 3.4. Intel retains all right, title, and interest in and to the Original72* Intel Code.73*74* 3.5. Neither the name Intel nor any other trademark owned or controlled by75* Intel shall be used in advertising or otherwise to promote the sale, use or76* other dealings in products derived from or relating to the Covered Code77* without prior written authorization from Intel.78*79* 4. Disclaimer and Export Compliance80*81* 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED82* HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE83* IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,84* INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY85* UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY86* IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A87* PARTICULAR PURPOSE.88*89* 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES90* OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR91* COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,92* SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY93* CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL94* HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS95* SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY96* LIMITED REMEDY.97*98* 4.3. Licensee shall not export, either directly or indirectly, any of this99* software or system incorporating such software without first obtaining any100* required license or other approval from the U. S. Department of Commerce or101* any other agency or department of the United States Government. In the102* event Licensee exports any such software from the United States or103* re-exports any such software from a foreign destination, Licensee shall104* ensure that the distribution and export/re-export of the software is in105* compliance with all laws, regulations, orders, or other restrictions of the106* U.S. Export Administration Regulations. Licensee agrees that neither it nor107* any of its subsidiaries will export/re-export any technical data, process,108* software, or service, directly or indirectly, to any country for which the109* United States government or any agency thereof requires an export license,110* other governmental approval, or letter of assurance, without first obtaining111* such license, approval or letter.112*113*****************************************************************************114*115* Alternatively, you may choose to be licensed under the terms of the116* following license:117*118* Redistribution and use in source and binary forms, with or without119* modification, are permitted provided that the following conditions120* are met:121* 1. Redistributions of source code must retain the above copyright122* notice, this list of conditions, and the following disclaimer,123* without modification.124* 2. Redistributions in binary form must reproduce at minimum a disclaimer125* substantially similar to the "NO WARRANTY" disclaimer below126* ("Disclaimer") and any redistribution must be conditioned upon127* including a substantially similar Disclaimer requirement for further128* binary redistribution.129* 3. Neither the names of the above-listed copyright holders nor the names130* of any contributors may be used to endorse or promote products derived131* from this software without specific prior written permission.132*133* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS134* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT135* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR136* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT137* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,138* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT139* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,140* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY141* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT142* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE143* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.144*145* Alternatively, you may choose to be licensed under the terms of the146* GNU General Public License ("GPL") version 2 as published by the Free147* Software Foundation.148*149*****************************************************************************/150151#include <contrib/dev/acpica/include/acpi.h>152#include <contrib/dev/acpica/include/accommon.h>153#include <contrib/dev/acpica/include/acdisasm.h>154155156#define _COMPONENT ACPI_CA_DEBUGGER157ACPI_MODULE_NAME ("dbresrcl")158159160/* Common names for address and memory descriptors */161162static const char *AcpiDmAddressNames[] =163{164"Granularity",165"Range Minimum",166"Range Maximum",167"Translation Offset",168"Length"169};170171static const char *AcpiDmMemoryNames[] =172{173"Range Minimum",174"Range Maximum",175"Alignment",176"Length"177};178179180/* Local prototypes */181182static void183AcpiDmSpaceFlags (184UINT8 Flags);185186static void187AcpiDmIoFlags (188UINT8 Flags);189190static void191AcpiDmIoFlags2 (192UINT8 SpecificFlags);193194static void195AcpiDmMemoryFlags (196UINT8 Flags,197UINT8 SpecificFlags);198199static void200AcpiDmMemoryFlags2 (201UINT8 SpecificFlags);202203static void204AcpiDmResourceSource (205AML_RESOURCE *Resource,206ACPI_SIZE MinimumLength,207UINT32 Length);208209static void210AcpiDmAddressFields (211void *Source,212UINT8 Type,213UINT32 Level);214215static void216AcpiDmAddressPrefix (217UINT8 Type);218219static void220AcpiDmAddressCommon (221AML_RESOURCE *Resource,222UINT8 Type,223UINT32 Level);224225static void226AcpiDmAddressFlags (227AML_RESOURCE *Resource);228229230/*******************************************************************************231*232* FUNCTION: AcpiDmMemoryFields233*234* PARAMETERS: Source - Pointer to the contiguous data fields235* Type - 16 or 32 (bit)236* Level - Current source code indentation level237*238* RETURN: None239*240* DESCRIPTION: Decode fields common to Memory24 and Memory32 descriptors241*242******************************************************************************/243244static void245AcpiDmMemoryFields (246void *Source,247UINT8 Type,248UINT32 Level)249{250UINT32 i;251252253for (i = 0; i < 4; i++)254{255AcpiDmIndent (Level + 1);256257switch (Type)258{259case 16:260261AcpiDmDumpInteger16 (ACPI_CAST_PTR (UINT16, Source)[i],262AcpiDmMemoryNames[i]);263break;264265case 32:266267AcpiDmDumpInteger32 (ACPI_CAST_PTR (UINT32, Source)[i],268AcpiDmMemoryNames[i]);269break;270271default:272273return;274}275}276}277278279/*******************************************************************************280*281* FUNCTION: AcpiDmAddressFields282*283* PARAMETERS: Source - Pointer to the contiguous data fields284* Type - 16, 32, or 64 (bit)285* Level - Current source code indentation level286*287* RETURN: None288*289* DESCRIPTION: Decode fields common to address descriptors290*291******************************************************************************/292293static void294AcpiDmAddressFields (295void *Source,296UINT8 Type,297UINT32 Level)298{299UINT32 i;300301302AcpiOsPrintf ("\n");303304for (i = 0; i < 5; i++)305{306AcpiDmIndent (Level + 1);307308switch (Type)309{310case 16:311312AcpiDmDumpInteger16 (ACPI_CAST_PTR (UINT16, Source)[i],313AcpiDmAddressNames[i]);314break;315316case 32:317318AcpiDmDumpInteger32 (ACPI_CAST_PTR (UINT32, Source)[i],319AcpiDmAddressNames[i]);320break;321322case 64:323324AcpiDmDumpInteger64 (ACPI_CAST_PTR (UINT64, Source)[i],325AcpiDmAddressNames[i]);326break;327328default:329330return;331}332}333}334335336/*******************************************************************************337*338* FUNCTION: AcpiDmAddressPrefix339*340* PARAMETERS: Type - Descriptor type341*342* RETURN: None343*344* DESCRIPTION: Emit name prefix representing the address descriptor type345*346******************************************************************************/347348static void349AcpiDmAddressPrefix (350UINT8 Type)351{352353switch (Type)354{355case ACPI_RESOURCE_TYPE_ADDRESS16:356357AcpiOsPrintf ("Word");358break;359360case ACPI_RESOURCE_TYPE_ADDRESS32:361362AcpiOsPrintf ("DWord");363break;364365case ACPI_RESOURCE_TYPE_ADDRESS64:366367AcpiOsPrintf ("QWord");368break;369370case ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64:371372AcpiOsPrintf ("Extended");373break;374375default:376377return;378}379}380381382/*******************************************************************************383*384* FUNCTION: AcpiDmAddressCommon385*386* PARAMETERS: Resource - Raw AML descriptor387* Type - Descriptor type388* Level - Current source code indentation level389*390* RETURN: None391*392* DESCRIPTION: Emit common name and flag fields common to address descriptors393*394******************************************************************************/395396static void397AcpiDmAddressCommon (398AML_RESOURCE *Resource,399UINT8 Type,400UINT32 Level)401{402UINT8 ResourceType;403UINT8 SpecificFlags;404UINT8 Flags;405406407ResourceType = Resource->Address.ResourceType;408SpecificFlags = Resource->Address.SpecificFlags;409Flags = Resource->Address.Flags;410411AcpiDmIndent (Level);412413/* Validate ResourceType */414415if ((ResourceType > 2) && (ResourceType < 0xC0))416{417AcpiOsPrintf (418"/**** Invalid Resource Type: 0x%X ****/", ResourceType);419return;420}421422/* Prefix is either Word, DWord, QWord, or Extended */423424AcpiDmAddressPrefix (Type);425426/* Resource Types above 0xC0 are vendor-defined */427428if (ResourceType > 2)429{430AcpiOsPrintf ("Space (0x%2.2X, ", ResourceType);431AcpiDmSpaceFlags (Flags);432AcpiOsPrintf (" 0x%2.2X,", SpecificFlags);433return;434}435436/* This is either a Memory, IO, or BusNumber descriptor (0,1,2) */437438AcpiOsPrintf ("%s (",439AcpiGbl_WordDecode [ACPI_GET_2BIT_FLAG (ResourceType)]);440441/* Decode the general and type-specific flags */442443if (ResourceType == ACPI_MEMORY_RANGE)444{445AcpiDmMemoryFlags (Flags, SpecificFlags);446}447else /* IO range or BusNumberRange */448{449AcpiDmIoFlags (Flags);450if (ResourceType == ACPI_IO_RANGE)451{452AcpiOsPrintf (" %s,",453AcpiGbl_RngDecode [ACPI_GET_2BIT_FLAG (SpecificFlags)]);454}455}456}457458459/*******************************************************************************460*461* FUNCTION: AcpiDmAddressFlags462*463* PARAMETERS: Resource - Raw AML descriptor464*465* RETURN: None466*467* DESCRIPTION: Emit flags common to address descriptors468*469******************************************************************************/470471static void472AcpiDmAddressFlags (473AML_RESOURCE *Resource)474{475476if (Resource->Address.ResourceType == ACPI_IO_RANGE)477{478AcpiDmIoFlags2 (Resource->Address.SpecificFlags);479}480else if (Resource->Address.ResourceType == ACPI_MEMORY_RANGE)481{482AcpiDmMemoryFlags2 (Resource->Address.SpecificFlags);483}484}485486487/*******************************************************************************488*489* FUNCTION: AcpiDmSpaceFlags490*491* PARAMETERS: Flags - Flag byte to be decoded492*493* RETURN: None494*495* DESCRIPTION: Decode the flags specific to Space Address space descriptors496*497******************************************************************************/498499static void500AcpiDmSpaceFlags (501UINT8 Flags)502{503504AcpiOsPrintf ("%s, %s, %s, %s,",505AcpiGbl_ConsumeDecode [ACPI_GET_1BIT_FLAG (Flags)],506AcpiGbl_DecDecode [ACPI_EXTRACT_1BIT_FLAG (Flags, 1)],507AcpiGbl_MinDecode [ACPI_EXTRACT_1BIT_FLAG (Flags, 2)],508AcpiGbl_MaxDecode [ACPI_EXTRACT_1BIT_FLAG (Flags, 3)]);509}510511512/*******************************************************************************513*514* FUNCTION: AcpiDmIoFlags515*516* PARAMETERS: Flags - Flag byte to be decoded517*518* RETURN: None519*520* DESCRIPTION: Decode the flags specific to IO Address space descriptors521*522******************************************************************************/523524static void525AcpiDmIoFlags (526UINT8 Flags)527{528AcpiOsPrintf ("%s, %s, %s, %s,",529AcpiGbl_ConsumeDecode [ACPI_GET_1BIT_FLAG (Flags)],530AcpiGbl_MinDecode [ACPI_EXTRACT_1BIT_FLAG (Flags, 2)],531AcpiGbl_MaxDecode [ACPI_EXTRACT_1BIT_FLAG (Flags, 3)],532AcpiGbl_DecDecode [ACPI_EXTRACT_1BIT_FLAG (Flags, 1)]);533}534535536/*******************************************************************************537*538* FUNCTION: AcpiDmIoFlags2539*540* PARAMETERS: SpecificFlags - "Specific" flag byte to be decoded541*542* RETURN: None543*544* DESCRIPTION: Decode the flags specific to IO Address space descriptors545*546******************************************************************************/547548static void549AcpiDmIoFlags2 (550UINT8 SpecificFlags)551{552553/* _TTP */554555AcpiOsPrintf (", %s",556AcpiGbl_TtpDecode [ACPI_EXTRACT_1BIT_FLAG (SpecificFlags, 4)]);557558/*559* TRS is only used if TTP is TypeTranslation. However, the disassembler560* always emits exactly what is in the AML.561*/562AcpiOsPrintf (", %s",563AcpiGbl_TrsDecode [ACPI_EXTRACT_1BIT_FLAG (SpecificFlags, 5)]);564}565566567/*******************************************************************************568*569* FUNCTION: AcpiDmMemoryFlags570*571* PARAMETERS: Flags - Flag byte to be decoded572* SpecificFlags - "Specific" flag byte to be decoded573*574* RETURN: None575*576* DESCRIPTION: Decode flags specific to Memory Address Space descriptors577*578******************************************************************************/579580static void581AcpiDmMemoryFlags (582UINT8 Flags,583UINT8 SpecificFlags)584{585586AcpiOsPrintf ("%s, %s, %s, %s, %s, %s,",587AcpiGbl_ConsumeDecode [ACPI_GET_1BIT_FLAG (Flags)],588AcpiGbl_DecDecode [ACPI_EXTRACT_1BIT_FLAG (Flags, 1)],589AcpiGbl_MinDecode [ACPI_EXTRACT_1BIT_FLAG (Flags, 2)],590AcpiGbl_MaxDecode [ACPI_EXTRACT_1BIT_FLAG (Flags, 3)],591AcpiGbl_MemDecode [ACPI_EXTRACT_2BIT_FLAG (SpecificFlags, 1)],592AcpiGbl_RwDecode [ACPI_GET_1BIT_FLAG (SpecificFlags)]);593}594595596/*******************************************************************************597*598* FUNCTION: AcpiDmMemoryFlags2599*600* PARAMETERS: SpecificFlags - "Specific" flag byte to be decoded601*602* RETURN: None603*604* DESCRIPTION: Decode flags specific to Memory Address Space descriptors605*606******************************************************************************/607608static void609AcpiDmMemoryFlags2 (610UINT8 SpecificFlags)611{612613AcpiOsPrintf (", %s, %s",614AcpiGbl_MtpDecode [ACPI_EXTRACT_2BIT_FLAG (SpecificFlags, 3)],615AcpiGbl_TtpDecode [ACPI_EXTRACT_1BIT_FLAG (SpecificFlags, 5)]);616}617618619/*******************************************************************************620*621* FUNCTION: AcpiDmResourceSource622*623* PARAMETERS: Resource - Raw AML descriptor624* MinimumLength - descriptor length without optional fields625* ResourceLength626*627* RETURN: None628*629* DESCRIPTION: Dump optional ResourceSource fields of an address descriptor630*631******************************************************************************/632633static void634AcpiDmResourceSource (635AML_RESOURCE *Resource,636ACPI_SIZE MinimumTotalLength,637UINT32 ResourceLength)638{639UINT8 *AmlResourceSource;640UINT32 TotalLength;641642643TotalLength = ResourceLength + sizeof (AML_RESOURCE_LARGE_HEADER);644645/* Check if the optional ResourceSource fields are present */646647if (TotalLength <= MinimumTotalLength)648{649/* The two optional fields are not used */650651AcpiOsPrintf (",, ");652return;653}654655/* Get a pointer to the ResourceSource */656657AmlResourceSource = ACPI_ADD_PTR (UINT8, Resource, MinimumTotalLength);658659/*660* Always emit the ResourceSourceIndex (Byte)661*662* NOTE: Some ASL compilers always create a 0 byte (in the AML) for the663* Index even if the String does not exist. Although this is in violation664* of the ACPI specification, it is very important to emit ASL code that665* can be compiled back to the identical AML. There may be fields and/or666* indexes into the resource template buffer that are compiled to absolute667* offsets, and these will be broken if the AML length is changed.668*/669AcpiOsPrintf ("0x%2.2X,", (UINT32) AmlResourceSource[0]);670671/* Make sure that the ResourceSource string exists before dumping it */672673if (TotalLength > (MinimumTotalLength + 1))674{675AcpiOsPrintf (" ");676AcpiUtPrintString ((char *) &AmlResourceSource[1], ACPI_UINT16_MAX);677}678679AcpiOsPrintf (", ");680}681682683/*******************************************************************************684*685* FUNCTION: AcpiDmWordDescriptor686*687* PARAMETERS: Info - Extra resource info688* Resource - Pointer to the resource descriptor689* Length - Length of the descriptor in bytes690* Level - Current source code indentation level691*692* RETURN: None693*694* DESCRIPTION: Decode a Word Address Space descriptor695*696******************************************************************************/697698void699AcpiDmWordDescriptor (700ACPI_OP_WALK_INFO *Info,701AML_RESOURCE *Resource,702UINT32 Length,703UINT32 Level)704{705706/* Dump resource name and flags */707708AcpiDmAddressCommon (Resource, ACPI_RESOURCE_TYPE_ADDRESS16, Level);709710/* Dump the 5 contiguous WORD values */711712AcpiDmAddressFields (&Resource->Address16.Granularity, 16, Level);713714/* The ResourceSource fields are optional */715716AcpiDmIndent (Level + 1);717AcpiDmResourceSource (Resource, sizeof (AML_RESOURCE_ADDRESS16), Length);718719/* Insert a descriptor name */720721AcpiDmDescriptorName ();722723/* Type-specific flags */724725AcpiDmAddressFlags (Resource);726AcpiOsPrintf (")\n");727}728729730/*******************************************************************************731*732* FUNCTION: AcpiDmDwordDescriptor733*734* PARAMETERS: Info - Extra resource info735* Resource - Pointer to the resource descriptor736* Length - Length of the descriptor in bytes737* Level - Current source code indentation level738*739* RETURN: None740*741* DESCRIPTION: Decode a DWord Address Space descriptor742*743******************************************************************************/744745void746AcpiDmDwordDescriptor (747ACPI_OP_WALK_INFO *Info,748AML_RESOURCE *Resource,749UINT32 Length,750UINT32 Level)751{752753/* Dump resource name and flags */754755AcpiDmAddressCommon (Resource, ACPI_RESOURCE_TYPE_ADDRESS32, Level);756757/* Dump the 5 contiguous DWORD values */758759AcpiDmAddressFields (&Resource->Address32.Granularity, 32, Level);760761/* The ResourceSource fields are optional */762763AcpiDmIndent (Level + 1);764AcpiDmResourceSource (Resource, sizeof (AML_RESOURCE_ADDRESS32), Length);765766/* Insert a descriptor name */767768AcpiDmDescriptorName ();769770/* Type-specific flags */771772AcpiDmAddressFlags (Resource);773AcpiOsPrintf (")\n");774}775776777/*******************************************************************************778*779* FUNCTION: AcpiDmQwordDescriptor780*781* PARAMETERS: Info - Extra resource info782* Resource - Pointer to the resource descriptor783* Length - Length of the descriptor in bytes784* Level - Current source code indentation level785*786* RETURN: None787*788* DESCRIPTION: Decode a QWord Address Space descriptor789*790******************************************************************************/791792void793AcpiDmQwordDescriptor (794ACPI_OP_WALK_INFO *Info,795AML_RESOURCE *Resource,796UINT32 Length,797UINT32 Level)798{799800/* Dump resource name and flags */801802AcpiDmAddressCommon (Resource, ACPI_RESOURCE_TYPE_ADDRESS64, Level);803804/* Dump the 5 contiguous QWORD values */805806AcpiDmAddressFields (&Resource->Address64.Granularity, 64, Level);807808/* The ResourceSource fields are optional */809810AcpiDmIndent (Level + 1);811AcpiDmResourceSource (Resource, sizeof (AML_RESOURCE_ADDRESS64), Length);812813/* Insert a descriptor name */814815AcpiDmDescriptorName ();816817/* Type-specific flags */818819AcpiDmAddressFlags (Resource);820AcpiOsPrintf (")\n");821}822823824/*******************************************************************************825*826* FUNCTION: AcpiDmExtendedDescriptor827*828* PARAMETERS: Info - Extra resource info829* Resource - Pointer to the resource descriptor830* Length - Length of the descriptor in bytes831* Level - Current source code indentation level832*833* RETURN: None834*835* DESCRIPTION: Decode a Extended Address Space descriptor836*837******************************************************************************/838839void840AcpiDmExtendedDescriptor (841ACPI_OP_WALK_INFO *Info,842AML_RESOURCE *Resource,843UINT32 Length,844UINT32 Level)845{846847/* Dump resource name and flags */848849AcpiDmAddressCommon (850Resource, ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64, Level);851852/* Dump the 5 contiguous QWORD values */853854AcpiDmAddressFields (&Resource->ExtAddress64.Granularity, 64, Level);855856/* Extra field for this descriptor only */857858AcpiDmIndent (Level + 1);859AcpiDmDumpInteger64 (Resource->ExtAddress64.TypeSpecific,860"Type-Specific Attributes");861862/* Insert a descriptor name */863864AcpiDmIndent (Level + 1);865AcpiDmDescriptorName ();866867/* Type-specific flags */868869AcpiDmAddressFlags (Resource);870AcpiOsPrintf (")\n");871}872873874/*******************************************************************************875*876* FUNCTION: AcpiDmMemory24Descriptor877*878* PARAMETERS: Info - Extra resource info879* Resource - Pointer to the resource descriptor880* Length - Length of the descriptor in bytes881* Level - Current source code indentation level882*883* RETURN: None884*885* DESCRIPTION: Decode a Memory24 descriptor886*887******************************************************************************/888889void890AcpiDmMemory24Descriptor (891ACPI_OP_WALK_INFO *Info,892AML_RESOURCE *Resource,893UINT32 Length,894UINT32 Level)895{896897/* Dump name and read/write flag */898899AcpiDmIndent (Level);900AcpiOsPrintf ("Memory24 (%s,\n",901AcpiGbl_RwDecode [ACPI_GET_1BIT_FLAG (Resource->Memory24.Flags)]);902903/* Dump the 4 contiguous WORD values */904905AcpiDmMemoryFields (&Resource->Memory24.Minimum, 16, Level);906907/* Insert a descriptor name */908909AcpiDmIndent (Level + 1);910AcpiDmDescriptorName ();911AcpiOsPrintf (")\n");912}913914915/*******************************************************************************916*917* FUNCTION: AcpiDmMemory32Descriptor918*919* PARAMETERS: Info - Extra resource info920* Resource - Pointer to the resource descriptor921* Length - Length of the descriptor in bytes922* Level - Current source code indentation level923*924* RETURN: None925*926* DESCRIPTION: Decode a Memory32 descriptor927*928******************************************************************************/929930void931AcpiDmMemory32Descriptor (932ACPI_OP_WALK_INFO *Info,933AML_RESOURCE *Resource,934UINT32 Length,935UINT32 Level)936{937938/* Dump name and read/write flag */939940AcpiDmIndent (Level);941AcpiOsPrintf ("Memory32 (%s,\n",942AcpiGbl_RwDecode [ACPI_GET_1BIT_FLAG (Resource->Memory32.Flags)]);943944/* Dump the 4 contiguous DWORD values */945946AcpiDmMemoryFields (&Resource->Memory32.Minimum, 32, Level);947948/* Insert a descriptor name */949950AcpiDmIndent (Level + 1);951AcpiDmDescriptorName ();952AcpiOsPrintf (")\n");953}954955956/*******************************************************************************957*958* FUNCTION: AcpiDmFixedMemory32Descriptor959*960* PARAMETERS: Info - Extra resource info961* Resource - Pointer to the resource descriptor962* Length - Length of the descriptor in bytes963* Level - Current source code indentation level964*965* RETURN: None966*967* DESCRIPTION: Decode a Fixed Memory32 descriptor968*969******************************************************************************/970971void972AcpiDmFixedMemory32Descriptor (973ACPI_OP_WALK_INFO *Info,974AML_RESOURCE *Resource,975UINT32 Length,976UINT32 Level)977{978979/* Dump name and read/write flag */980981AcpiDmIndent (Level);982AcpiOsPrintf ("Memory32Fixed (%s,\n",983AcpiGbl_RwDecode [ACPI_GET_1BIT_FLAG (Resource->FixedMemory32.Flags)]);984985AcpiDmIndent (Level + 1);986AcpiDmDumpInteger32 (Resource->FixedMemory32.Address,987"Address Base");988989AcpiDmIndent (Level + 1);990AcpiDmDumpInteger32 (Resource->FixedMemory32.AddressLength,991"Address Length");992993/* Insert a descriptor name */994995AcpiDmIndent (Level + 1);996AcpiDmDescriptorName ();997AcpiOsPrintf (")\n");998}99910001001/*******************************************************************************1002*1003* FUNCTION: AcpiDmGenericRegisterDescriptor1004*1005* PARAMETERS: Info - Extra resource info1006* Resource - Pointer to the resource descriptor1007* Length - Length of the descriptor in bytes1008* Level - Current source code indentation level1009*1010* RETURN: None1011*1012* DESCRIPTION: Decode a Generic Register descriptor1013*1014******************************************************************************/10151016void1017AcpiDmGenericRegisterDescriptor (1018ACPI_OP_WALK_INFO *Info,1019AML_RESOURCE *Resource,1020UINT32 Length,1021UINT32 Level)1022{10231024AcpiDmIndent (Level);1025AcpiOsPrintf ("Register (");1026AcpiDmAddressSpace (Resource->GenericReg.AddressSpaceId);1027AcpiOsPrintf ("\n");10281029AcpiDmIndent (Level + 1);1030AcpiDmDumpInteger8 (Resource->GenericReg.BitWidth, "Bit Width");10311032AcpiDmIndent (Level + 1);1033AcpiDmDumpInteger8 (Resource->GenericReg.BitOffset, "Bit Offset");10341035AcpiDmIndent (Level + 1);1036AcpiDmDumpInteger64 (Resource->GenericReg.Address, "Address");10371038/* Optional field for ACPI 3.0 */10391040AcpiDmIndent (Level + 1);1041if (Resource->GenericReg.AccessSize)1042{1043AcpiOsPrintf ("0x%2.2X, // %s\n",1044Resource->GenericReg.AccessSize, "Access Size");1045AcpiDmIndent (Level + 1);1046}1047else1048{1049AcpiOsPrintf (",");1050}10511052/* DescriptorName was added for ACPI 3.0+ */10531054AcpiDmDescriptorName ();1055AcpiOsPrintf (")\n");1056}105710581059/*******************************************************************************1060*1061* FUNCTION: AcpiDmInterruptDescriptor1062*1063* PARAMETERS: Info - Extra resource info1064* Resource - Pointer to the resource descriptor1065* Length - Length of the descriptor in bytes1066* Level - Current source code indentation level1067*1068* RETURN: None1069*1070* DESCRIPTION: Decode a extended Interrupt descriptor1071*1072******************************************************************************/10731074void1075AcpiDmInterruptDescriptor (1076ACPI_OP_WALK_INFO *Info,1077AML_RESOURCE *Resource,1078UINT32 Length,1079UINT32 Level)1080{1081UINT32 i;108210831084AcpiDmIndent (Level);1085AcpiOsPrintf ("Interrupt (%s, %s, %s, %s, ",1086AcpiGbl_ConsumeDecode [ACPI_GET_1BIT_FLAG (Resource->ExtendedIrq.Flags)],1087AcpiGbl_HeDecode [ACPI_EXTRACT_1BIT_FLAG (Resource->ExtendedIrq.Flags, 1)],1088AcpiGbl_LlDecode [ACPI_EXTRACT_1BIT_FLAG (Resource->ExtendedIrq.Flags, 2)],1089AcpiGbl_ShrDecode [ACPI_EXTRACT_2BIT_FLAG (Resource->ExtendedIrq.Flags, 3)]);10901091/*1092* The ResourceSource fields are optional and appear after the interrupt1093* list. Must compute length based on length of the list. First xrupt1094* is included in the struct (reason for -1 below)1095*/1096AcpiDmResourceSource (Resource,1097sizeof (AML_RESOURCE_EXTENDED_IRQ) +1098((UINT32) Resource->ExtendedIrq.InterruptCount - 1) * sizeof (UINT32),1099Resource->ExtendedIrq.ResourceLength);11001101/* Insert a descriptor name */11021103AcpiDmDescriptorName ();1104AcpiOsPrintf (")\n");11051106/* Dump the interrupt list */11071108AcpiDmIndent (Level);1109AcpiOsPrintf ("{\n");1110for (i = 0; i < Resource->ExtendedIrq.InterruptCount; i++)1111{1112AcpiDmIndent (Level + 1);1113AcpiOsPrintf ("0x%8.8X,\n",1114(UINT32) Resource->ExtendedIrq.Interrupts[i]);1115}11161117AcpiDmIndent (Level);1118AcpiOsPrintf ("}\n");1119}112011211122/*******************************************************************************1123*1124* FUNCTION: AcpiDmVendorCommon1125*1126* PARAMETERS: Name - Descriptor name suffix1127* ByteData - Pointer to the vendor byte data1128* Length - Length of the byte data1129* Level - Current source code indentation level1130*1131* RETURN: None1132*1133* DESCRIPTION: Decode a Vendor descriptor, both Large and Small1134*1135******************************************************************************/11361137void1138AcpiDmVendorCommon (1139const char *Name,1140UINT8 *ByteData,1141UINT32 Length,1142UINT32 Level)1143{11441145/* Dump macro name */11461147AcpiDmIndent (Level);1148AcpiOsPrintf ("Vendor%s (", Name);11491150/* Insert a descriptor name */11511152AcpiDmDescriptorName ();1153AcpiOsPrintf (") // Length = 0x%.2X\n", Length);11541155/* Dump the vendor bytes */11561157AcpiDmIndent (Level);1158AcpiOsPrintf ("{\n");11591160AcpiDmDisasmByteList (Level + 1, ByteData, Length);11611162AcpiDmIndent (Level);1163AcpiOsPrintf ("}\n");1164}116511661167/*******************************************************************************1168*1169* FUNCTION: AcpiDmVendorLargeDescriptor1170*1171* PARAMETERS: Info - Extra resource info1172* Resource - Pointer to the resource descriptor1173* Length - Length of the descriptor in bytes1174* Level - Current source code indentation level1175*1176* RETURN: None1177*1178* DESCRIPTION: Decode a Vendor Large descriptor1179*1180******************************************************************************/11811182void1183AcpiDmVendorLargeDescriptor (1184ACPI_OP_WALK_INFO *Info,1185AML_RESOURCE *Resource,1186UINT32 Length,1187UINT32 Level)1188{11891190AcpiDmVendorCommon ("Long ",1191ACPI_ADD_PTR (UINT8, Resource, sizeof (AML_RESOURCE_LARGE_HEADER)),1192Length, Level);1193}119411951196