aslmapoutput.c revision 199767f8919635c4928607450d9e0abb932109ce
/******************************************************************************
*
* Module Name: aslmapoutput - Output/emit the resource descriptor/device maps
*
*****************************************************************************/
/*
* Copyright (C) 2000 - 2015, 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 "aslcompiler.y.h"
/* This module used for application-level code only */
#define _COMPONENT ACPI_COMPILER
ACPI_MODULE_NAME ("aslmapoutput")
/* Local prototypes */
static void
void);
static void
void);
static void
void);
static ACPI_STATUS
void *Context,
void **ReturnValue);
static void
static ACPI_STATUS
void *Context);
/* Strings used to decode flag bits */
const char *DirectionDecode[] =
{
"Both I/O ",
"InputOnly ",
"OutputOnly ",
"Preserve "
};
const char *PolarityDecode[] =
{
"ActiveHigh",
"ActiveLow ",
"ActiveBoth",
"Reserved "
};
/*******************************************************************************
*
* FUNCTION: MpEmitMappingInfo
*
* PARAMETERS: None
*
* RETURN: None
*
* DESCRIPTION: External interface.
* Map file has already been opened. Emit all of the collected
* hardware mapping information. Includes: GPIO information,
* Serial information, and a dump of the entire ACPI device tree.
*
******************************************************************************/
void
void)
{
/* Mapfile option enabled? */
if (!Gbl_MapfileFlag)
{
return;
}
if (!Gbl_GpioList)
{
"\nNo GPIO devices found\n");
}
if (!Gbl_SerialList)
{
}
if (!Gbl_GpioList && !Gbl_SerialList)
{
return;
}
/* Headers */
/* Emit GPIO and Serial descriptors, then entire ACPI device tree */
MpEmitGpioInfo ();
MpEmitSerialInfo ();
MpEmitDeviceTree ();
/* Clear the lists - no need to free memory here */
Gbl_GpioList = NULL;
}
/*******************************************************************************
*
* FUNCTION: MpEmitGpioInfo
*
* PARAMETERS: None
*
* RETURN: None
*
* DESCRIPTION: Emit the info about all GPIO devices found during the
* compile or disassembly.
*
******************************************************************************/
static void
void)
{
char *Type;
char *PrevDeviceName = NULL;
const char *Direction;
const char *Polarity;
char *ParentPathname;
const char *Description;
char *HidString;
const AH_DEVICE_ID *HidInfo;
/* Walk the GPIO descriptor list */
Info = Gbl_GpioList;
while (Info)
{
/* Print header info for the controller itself */
if (!PrevDeviceName ||
{
"\n\nGPIO Controller: %-8s %-28s",
if (HidInfo)
{
}
"\n\nPin Type Direction Polarity"
" Dest _HID Destination\n");
}
/* Setup various strings based upon the type (GpioInt or GpioIo) */
{
Type = "GpioInt";
Direction = "-Interrupt-";
break;
Type = "GpioIo ";
Polarity = " ";
break;
default:
continue;
}
/* Emit the GPIO info */
if (HidString)
{
/*
* This is a Connection() field
* Attempt to find all references to the field.
*/
}
else
{
/*
* For Devices, attempt to get the _HID description string.
* Failing that (many _HIDs are not recognized), attempt to
* get the _DDN description string.
*/
/* Get the _HID description or _DDN string */
if (HidInfo)
{
}
{
}
}
}
}
/*******************************************************************************
*
* FUNCTION: MpEmitSerialInfo
*
* PARAMETERS: None
*
* RETURN: None
*
* DESCRIPTION: Emit the info about all Serial devices found during the
* compile or disassembly.
*
******************************************************************************/
static void
void)
{
char *Type;
char *ParentPathname;
char *PrevDeviceName = NULL;
char *HidString;
const AH_DEVICE_ID *HidInfo;
const char *Description;
/* Walk the constructed serial descriptor list */
while (Info)
{
{
Type = "I2C ";
break;
Type = "SPI ";
break;
Type = "UART";
break;
default:
Type = "UNKN";
break;
}
/* Print header info for the controller itself */
if (!PrevDeviceName ||
{
Type);
if (HidInfo)
{
}
"Type Address Speed Dest _HID Destination\n");
}
if (HidString)
{
/*
* This is a Connection() field
* Attempt to find all references to the field.
*/
}
else
{
/* Normal resource template */
/* Get the _HID description or _DDN string */
if (HidInfo)
{
}
{
}
}
}
}
/*******************************************************************************
*
* FUNCTION: MpEmitDeviceTree
*
* PARAMETERS: None
*
* RETURN: None
*
* DESCRIPTION: Emit information about all devices within the ACPI namespace.
*
******************************************************************************/
static void
void)
{
"_HID Description\n\n");
/* Walk the namespace from the root */
}
/*******************************************************************************
*
* FUNCTION: MpEmitOneDevice
*
* PARAMETERS: ACPI_NAMESPACE_WALK callback
*
* RETURN: Status
*
* DESCRIPTION: Emit information about one ACPI device in the namespace. Used
* during dump of all device objects within the namespace.
*
******************************************************************************/
static ACPI_STATUS
void *Context,
void **ReturnValue)
{
char *DevicePathname;
char *DdnString;
char *HidString;
const AH_DEVICE_ID *HidInfo;
/* Device pathname */
/* _HID or _DDN */
if (HidInfo)
{
}
{
}
return (AE_OK);
}
/*******************************************************************************
*
* FUNCTION: MpXrefDevices
*
* PARAMETERS: Info - A GPIO Info block
*
* RETURN: None
*
* DESCRIPTION: Cross-reference the parse tree and find all references to the
* specified GPIO device.
*
******************************************************************************/
static void
{
/* Walk the entire parse tree */
if (!Info->References)
{
}
}
/*******************************************************************************
*
* FUNCTION: MpNamespaceXrefBegin
*
* PARAMETERS: WALK_PARSE_TREE callback
*
* RETURN: Status
*
* DESCRIPTION: Walk parse tree callback used to cross-reference GPIO pins.
*
******************************************************************************/
static ACPI_STATUS
void *Context)
{
const ACPI_OPCODE_INFO *OpInfo;
char *DevicePathname;
char *HidString;
/*
* If this node is the actual declaration of a name
* [such as the XXXX name in "Method (XXXX)"],
* we are not interested in it here. We only care about names that
* are references to other objects within the namespace and the
* parent objects of name declarations
*/
{
return (AE_OK);
}
/* We are only interested in opcodes that have an associated name */
{
return (AE_OK);
}
{
return (AE_OK);
}
{
return (AE_OK);
}
{
return (AE_OK);
}
{
{
}
if (ParentOp)
{
if (!Info->References)
{
}
Info->References++;
}
}
return (AE_OK);
}