/*******************************************************************************
*
* Module Name: dmresrcl.c - "Large" Resource Descriptor disassembly
*
******************************************************************************/
/*
* Copyright (C) 2000 - 2016, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions, and the following disclaimer,
* without modification.
* 2. Redistributions in binary form must reproduce at minimum a disclaimer
* substantially similar to the "NO WARRANTY" disclaimer below
* ("Disclaimer") and any redistribution must be conditioned upon
* including a substantially similar Disclaimer requirement for further
* binary redistribution.
* 3. Neither the names of the above-listed copyright holders nor the names
* of any contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* Alternatively, this software may be distributed under the terms of the
* GNU General Public License ("GPL") version 2 as published by the Free
* Software Foundation.
*
* NO WARRANTY
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGES.
*/
#include "acpi.h"
#include "accommon.h"
#include "acdisasm.h"
ACPI_MODULE_NAME ("dbresrcl")
/* Common names for address and memory descriptors */
static const char *AcpiDmAddressNames[] =
{
"Granularity",
"Range Minimum",
"Range Maximum",
"Translation Offset",
"Length"
};
static const char *AcpiDmMemoryNames[] =
{
"Range Minimum",
"Range Maximum",
"Alignment",
"Length"
};
/* Local prototypes */
static void
static void
static void
static void
static void
static void
static void
void *Source,
static void
static void
static void
/*******************************************************************************
*
* FUNCTION: AcpiDmMemoryFields
*
* PARAMETERS: Source - Pointer to the contiguous data fields
* Type - 16 or 32 (bit)
* Level - Current source code indentation level
*
* RETURN: None
*
* DESCRIPTION: Decode fields common to Memory24 and Memory32 descriptors
*
******************************************************************************/
static void
void *Source,
{
UINT32 i;
for (i = 0; i < 4; i++)
{
switch (Type)
{
case 16:
AcpiDmMemoryNames[i]);
break;
case 32:
AcpiDmMemoryNames[i]);
break;
default:
return;
}
}
}
/*******************************************************************************
*
* FUNCTION: AcpiDmAddressFields
*
* PARAMETERS: Source - Pointer to the contiguous data fields
* Type - 16, 32, or 64 (bit)
* Level - Current source code indentation level
*
* RETURN: None
*
* DESCRIPTION: Decode fields common to address descriptors
*
******************************************************************************/
static void
void *Source,
{
UINT32 i;
AcpiOsPrintf ("\n");
for (i = 0; i < 5; i++)
{
switch (Type)
{
case 16:
AcpiDmAddressNames[i]);
break;
case 32:
AcpiDmAddressNames[i]);
break;
case 64:
AcpiDmAddressNames[i]);
break;
default:
return;
}
}
}
/*******************************************************************************
*
* FUNCTION: AcpiDmAddressPrefix
*
* PARAMETERS: Type - Descriptor type
*
* RETURN: None
*
* DESCRIPTION: Emit name prefix representing the address descriptor type
*
******************************************************************************/
static void
{
switch (Type)
{
AcpiOsPrintf ("Word");
break;
AcpiOsPrintf ("DWord");
break;
AcpiOsPrintf ("QWord");
break;
AcpiOsPrintf ("Extended");
break;
default:
return;
}
}
/*******************************************************************************
*
* FUNCTION: AcpiDmAddressCommon
*
* PARAMETERS: Resource - Raw AML descriptor
* Type - Descriptor type
* Level - Current source code indentation level
*
* RETURN: None
*
* DESCRIPTION: Emit common name and flag fields common to address descriptors
*
******************************************************************************/
static void
{
/* Validate ResourceType */
{
"/**** Invalid Resource Type: 0x%X ****/", ResourceType);
return;
}
/* Prefix is either Word, DWord, QWord, or Extended */
/* Resource Types above 0xC0 are vendor-defined */
if (ResourceType > 2)
{
return;
}
/* This is either a Memory, IO, or BusNumber descriptor (0,1,2) */
AcpiOsPrintf ("%s (",
/* Decode the general and type-specific flags */
if (ResourceType == ACPI_MEMORY_RANGE)
{
}
else /* IO range or BusNumberRange */
{
if (ResourceType == ACPI_IO_RANGE)
{
AcpiOsPrintf (" %s,",
}
}
}
/*******************************************************************************
*
* FUNCTION: AcpiDmAddressFlags
*
* PARAMETERS: Resource - Raw AML descriptor
*
* RETURN: None
*
* DESCRIPTION: Emit flags common to address descriptors
*
******************************************************************************/
static void
{
{
}
{
}
}
/*******************************************************************************
*
* FUNCTION: AcpiDmSpaceFlags
*
* PARAMETERS: Flags - Flag byte to be decoded
*
* RETURN: None
*
* DESCRIPTION: Decode the flags specific to Space Address space descriptors
*
******************************************************************************/
static void
{
AcpiOsPrintf ("%s, %s, %s, %s,",
}
/*******************************************************************************
*
* FUNCTION: AcpiDmIoFlags
*
* PARAMETERS: Flags - Flag byte to be decoded
*
* RETURN: None
*
* DESCRIPTION: Decode the flags specific to IO Address space descriptors
*
******************************************************************************/
static void
{
AcpiOsPrintf ("%s, %s, %s, %s,",
}
/*******************************************************************************
*
* FUNCTION: AcpiDmIoFlags2
*
* PARAMETERS: SpecificFlags - "Specific" flag byte to be decoded
*
* RETURN: None
*
* DESCRIPTION: Decode the flags specific to IO Address space descriptors
*
******************************************************************************/
static void
{
AcpiOsPrintf (", %s",
/* TRS is only used if TTP is TypeTranslation */
if (SpecificFlags & 0x10)
{
AcpiOsPrintf (", %s",
}
}
/*******************************************************************************
*
* FUNCTION: AcpiDmMemoryFlags
*
* PARAMETERS: Flags - Flag byte to be decoded
* SpecificFlags - "Specific" flag byte to be decoded
*
* RETURN: None
*
* DESCRIPTION: Decode flags specific to Memory Address Space descriptors
*
******************************************************************************/
static void
{
AcpiOsPrintf ("%s, %s, %s, %s, %s, %s,",
}
/*******************************************************************************
*
* FUNCTION: AcpiDmMemoryFlags2
*
* PARAMETERS: SpecificFlags - "Specific" flag byte to be decoded
*
* RETURN: None
*
* DESCRIPTION: Decode flags specific to Memory Address Space descriptors
*
******************************************************************************/
static void
{
AcpiOsPrintf (", %s, %s",
}
/*******************************************************************************
*
* FUNCTION: AcpiDmResourceSource
*
* PARAMETERS: Resource - Raw AML descriptor
* MinimumLength - descriptor length without optional fields
* ResourceLength
*
* RETURN: None
*
* DESCRIPTION: Dump optional ResourceSource fields of an address descriptor
*
******************************************************************************/
static void
{
/* Check if the optional ResourceSource fields are present */
if (TotalLength <= MinimumTotalLength)
{
/* The two optional fields are not used */
AcpiOsPrintf (",, ");
return;
}
/* Get a pointer to the ResourceSource */
/*
* Always emit the ResourceSourceIndex (Byte)
*
* NOTE: Some ASL compilers always create a 0 byte (in the AML) for the
* Index even if the String does not exist. Although this is in violation
* of the ACPI specification, it is very important to emit ASL code that
* indexes into the resource template buffer that are compiled to absolute
* offsets, and these will be broken if the AML length is changed.
*/
/* Make sure that the ResourceSource string exists before dumping it */
{
AcpiOsPrintf (" ");
}
AcpiOsPrintf (", ");
}
/*******************************************************************************
*
* FUNCTION: AcpiDmWordDescriptor
*
* PARAMETERS: Info - Extra resource info
* Resource - Pointer to the resource descriptor
* Length - Length of the descriptor in bytes
* Level - Current source code indentation level
*
* RETURN: None
*
* DESCRIPTION: Decode a Word Address Space descriptor
*
******************************************************************************/
void
{
/* Dump resource name and flags */
/* Dump the 5 contiguous WORD values */
/* The ResourceSource fields are optional */
/* Insert a descriptor name */
/* Type-specific flags */
AcpiOsPrintf (")\n");
}
/*******************************************************************************
*
* FUNCTION: AcpiDmDwordDescriptor
*
* PARAMETERS: Info - Extra resource info
* Resource - Pointer to the resource descriptor
* Length - Length of the descriptor in bytes
* Level - Current source code indentation level
*
* RETURN: None
*
* DESCRIPTION: Decode a DWord Address Space descriptor
*
******************************************************************************/
void
{
/* Dump resource name and flags */
/* Dump the 5 contiguous DWORD values */
/* The ResourceSource fields are optional */
/* Insert a descriptor name */
/* Type-specific flags */
AcpiOsPrintf (")\n");
}
/*******************************************************************************
*
* FUNCTION: AcpiDmQwordDescriptor
*
* PARAMETERS: Info - Extra resource info
* Resource - Pointer to the resource descriptor
* Length - Length of the descriptor in bytes
* Level - Current source code indentation level
*
* RETURN: None
*
* DESCRIPTION: Decode a QWord Address Space descriptor
*
******************************************************************************/
void
{
/* Dump resource name and flags */
/* Dump the 5 contiguous QWORD values */
/* The ResourceSource fields are optional */
/* Insert a descriptor name */
/* Type-specific flags */
AcpiOsPrintf (")\n");
}
/*******************************************************************************
*
* FUNCTION: AcpiDmExtendedDescriptor
*
* PARAMETERS: Info - Extra resource info
* Resource - Pointer to the resource descriptor
* Length - Length of the descriptor in bytes
* Level - Current source code indentation level
*
* RETURN: None
*
* DESCRIPTION: Decode a Extended Address Space descriptor
*
******************************************************************************/
void
{
/* Dump resource name and flags */
/* Dump the 5 contiguous QWORD values */
/* Extra field for this descriptor only */
"Type-Specific Attributes");
/* Insert a descriptor name */
/* Type-specific flags */
AcpiOsPrintf (")\n");
}
/*******************************************************************************
*
* FUNCTION: AcpiDmMemory24Descriptor
*
* PARAMETERS: Info - Extra resource info
* Resource - Pointer to the resource descriptor
* Length - Length of the descriptor in bytes
* Level - Current source code indentation level
*
* RETURN: None
*
* DESCRIPTION: Decode a Memory24 descriptor
*
******************************************************************************/
void
{
AcpiOsPrintf ("Memory24 (%s,\n",
/* Dump the 4 contiguous WORD values */
/* Insert a descriptor name */
AcpiOsPrintf (")\n");
}
/*******************************************************************************
*
* FUNCTION: AcpiDmMemory32Descriptor
*
* PARAMETERS: Info - Extra resource info
* Resource - Pointer to the resource descriptor
* Length - Length of the descriptor in bytes
* Level - Current source code indentation level
*
* RETURN: None
*
* DESCRIPTION: Decode a Memory32 descriptor
*
******************************************************************************/
void
{
AcpiOsPrintf ("Memory32 (%s,\n",
/* Dump the 4 contiguous DWORD values */
/* Insert a descriptor name */
AcpiOsPrintf (")\n");
}
/*******************************************************************************
*
* FUNCTION: AcpiDmFixedMemory32Descriptor
*
* PARAMETERS: Info - Extra resource info
* Resource - Pointer to the resource descriptor
* Length - Length of the descriptor in bytes
* Level - Current source code indentation level
*
* RETURN: None
*
* DESCRIPTION: Decode a Fixed Memory32 descriptor
*
******************************************************************************/
void
{
AcpiOsPrintf ("Memory32Fixed (%s,\n",
"Address Base");
"Address Length");
/* Insert a descriptor name */
AcpiOsPrintf (")\n");
}
/*******************************************************************************
*
* FUNCTION: AcpiDmGenericRegisterDescriptor
*
* PARAMETERS: Info - Extra resource info
* Resource - Pointer to the resource descriptor
* Length - Length of the descriptor in bytes
* Level - Current source code indentation level
*
* RETURN: None
*
* DESCRIPTION: Decode a Generic Register descriptor
*
******************************************************************************/
void
{
AcpiOsPrintf ("Register (");
AcpiOsPrintf ("\n");
/* Optional field for ACPI 3.0 */
{
AcpiOsPrintf ("0x%2.2X, // %s\n",
}
else
{
AcpiOsPrintf (",");
}
/* DescriptorName was added for ACPI 3.0+ */
AcpiOsPrintf (")\n");
}
/*******************************************************************************
*
* FUNCTION: AcpiDmInterruptDescriptor
*
* PARAMETERS: Info - Extra resource info
* Resource - Pointer to the resource descriptor
* Length - Length of the descriptor in bytes
* Level - Current source code indentation level
*
* RETURN: None
*
* DESCRIPTION: Decode a extended Interrupt descriptor
*
******************************************************************************/
void
{
UINT32 i;
AcpiOsPrintf ("Interrupt (%s, %s, %s, %s, ",
/*
* The ResourceSource fields are optional and appear after the interrupt
* list. Must compute length based on length of the list. First xrupt
* is included in the struct (reason for -1 below)
*/
sizeof (AML_RESOURCE_EXTENDED_IRQ) +
/* Insert a descriptor name */
AcpiOsPrintf (")\n");
/* Dump the interrupt list */
AcpiOsPrintf ("{\n");
{
AcpiOsPrintf ("0x%8.8X,\n",
}
AcpiOsPrintf ("}\n");
}
/*******************************************************************************
*
* FUNCTION: AcpiDmVendorCommon
*
* PARAMETERS: Name - Descriptor name suffix
* ByteData - Pointer to the vendor byte data
* Length - Length of the byte data
* Level - Current source code indentation level
*
* RETURN: None
*
* DESCRIPTION: Decode a Vendor descriptor, both Large and Small
*
******************************************************************************/
void
const char *Name,
{
/* Dump macro name */
/* Insert a descriptor name */
/* Dump the vendor bytes */
AcpiOsPrintf ("{\n");
AcpiOsPrintf ("}\n");
}
/*******************************************************************************
*
* FUNCTION: AcpiDmVendorLargeDescriptor
*
* PARAMETERS: Info - Extra resource info
* Resource - Pointer to the resource descriptor
* Length - Length of the descriptor in bytes
* Level - Current source code indentation level
*
* RETURN: None
*
* DESCRIPTION: Decode a Vendor Large descriptor
*
******************************************************************************/
void
{
AcpiDmVendorCommon ("Long ",
}