mirror of
https://github.com/acpica/acpica/
synced 2025-03-19 20:52:57 +03:00
ACPICA: Split AcpiFormatException into two parts. New function is AcpiUtVerifyException and will be used to verify exception codes returned by user
callback functions.
This commit is contained in:
parent
35666ec273
commit
ed4bb76753
source
@ -1,7 +1,7 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Module Name: utglobal - Global variables for the ACPI subsystem
|
||||
* $Revision: 1.246 $
|
||||
* $Revision: 1.247 $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
@ -126,95 +126,6 @@ ACPI_EXPORT_SYMBOL (AcpiGbl_FADT)
|
||||
ACPI_MODULE_NAME ("utglobal")
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiFormatException
|
||||
*
|
||||
* PARAMETERS: Status - The ACPI_STATUS code to be formatted
|
||||
*
|
||||
* RETURN: A string containing the exception text. A valid pointer is
|
||||
* always returned.
|
||||
*
|
||||
* DESCRIPTION: This function translates an ACPI exception into an ASCII string.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
const char *
|
||||
AcpiFormatException (
|
||||
ACPI_STATUS Status)
|
||||
{
|
||||
ACPI_STATUS SubStatus;
|
||||
const char *Exception = NULL;
|
||||
|
||||
|
||||
ACPI_FUNCTION_ENTRY ();
|
||||
|
||||
|
||||
/*
|
||||
* Status is composed of two parts, a "type" and an actual code
|
||||
*/
|
||||
SubStatus = (Status & ~AE_CODE_MASK);
|
||||
|
||||
switch (Status & AE_CODE_MASK)
|
||||
{
|
||||
case AE_CODE_ENVIRONMENTAL:
|
||||
|
||||
if (SubStatus <= AE_CODE_ENV_MAX)
|
||||
{
|
||||
Exception = AcpiGbl_ExceptionNames_Env [SubStatus];
|
||||
}
|
||||
break;
|
||||
|
||||
case AE_CODE_PROGRAMMER:
|
||||
|
||||
if (SubStatus <= AE_CODE_PGM_MAX)
|
||||
{
|
||||
Exception = AcpiGbl_ExceptionNames_Pgm [SubStatus -1];
|
||||
}
|
||||
break;
|
||||
|
||||
case AE_CODE_ACPI_TABLES:
|
||||
|
||||
if (SubStatus <= AE_CODE_TBL_MAX)
|
||||
{
|
||||
Exception = AcpiGbl_ExceptionNames_Tbl [SubStatus -1];
|
||||
}
|
||||
break;
|
||||
|
||||
case AE_CODE_AML:
|
||||
|
||||
if (SubStatus <= AE_CODE_AML_MAX)
|
||||
{
|
||||
Exception = AcpiGbl_ExceptionNames_Aml [SubStatus -1];
|
||||
}
|
||||
break;
|
||||
|
||||
case AE_CODE_CONTROL:
|
||||
|
||||
if (SubStatus <= AE_CODE_CTRL_MAX)
|
||||
{
|
||||
Exception = AcpiGbl_ExceptionNames_Ctrl [SubStatus -1];
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (!Exception)
|
||||
{
|
||||
/* Exception code was not recognized */
|
||||
|
||||
ACPI_ERROR ((AE_INFO,
|
||||
"Unknown exception code: 0x%8.8X", Status));
|
||||
|
||||
Exception = "UNKNOWN_STATUS_CODE";
|
||||
}
|
||||
|
||||
return (ACPI_CAST_PTR (const char, Exception));
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* Static global variable initialization.
|
||||
@ -272,6 +183,47 @@ const char *AcpiGbl_HighestDstateNames[4] =
|
||||
};
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiFormatException
|
||||
*
|
||||
* PARAMETERS: Status - The ACPI_STATUS code to be formatted
|
||||
*
|
||||
* RETURN: A string containing the exception text. A valid pointer is
|
||||
* always returned.
|
||||
*
|
||||
* DESCRIPTION: This function translates an ACPI exception into an ASCII string
|
||||
* It is here instead of utxface.c so it is always present.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
const char *
|
||||
AcpiFormatException (
|
||||
ACPI_STATUS Status)
|
||||
{
|
||||
const char *Exception = NULL;
|
||||
|
||||
|
||||
ACPI_FUNCTION_ENTRY ();
|
||||
|
||||
|
||||
Exception = AcpiUtValidateException (Status);
|
||||
if (!Exception)
|
||||
{
|
||||
/* Exception code was not recognized */
|
||||
|
||||
ACPI_ERROR ((AE_INFO,
|
||||
"Unknown exception code: 0x%8.8X", Status));
|
||||
|
||||
Exception = "UNKNOWN_STATUS_CODE";
|
||||
}
|
||||
|
||||
return (ACPI_CAST_PTR (const char, Exception));
|
||||
}
|
||||
|
||||
ACPI_EXPORT_SYMBOL (AcpiFormatException)
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* Namespace globals
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*******************************************************************************
|
||||
*
|
||||
* Module Name: utmisc - common utility procedures
|
||||
* $Revision: 1.149 $
|
||||
* $Revision: 1.150 $
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
@ -125,6 +125,86 @@
|
||||
ACPI_MODULE_NAME ("utmisc")
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiUtValidateException
|
||||
*
|
||||
* PARAMETERS: Status - The ACPI_STATUS code to be formatted
|
||||
*
|
||||
* RETURN: A string containing the exception text. NULL if exception is
|
||||
* not valid.
|
||||
*
|
||||
* DESCRIPTION: This function validates and translates an ACPI exception into
|
||||
* an ASCII string.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
const char *
|
||||
AcpiUtValidateException (
|
||||
ACPI_STATUS Status)
|
||||
{
|
||||
ACPI_STATUS SubStatus;
|
||||
const char *Exception = NULL;
|
||||
|
||||
|
||||
ACPI_FUNCTION_ENTRY ();
|
||||
|
||||
|
||||
/*
|
||||
* Status is composed of two parts, a "type" and an actual code
|
||||
*/
|
||||
SubStatus = (Status & ~AE_CODE_MASK);
|
||||
|
||||
switch (Status & AE_CODE_MASK)
|
||||
{
|
||||
case AE_CODE_ENVIRONMENTAL:
|
||||
|
||||
if (SubStatus <= AE_CODE_ENV_MAX)
|
||||
{
|
||||
Exception = AcpiGbl_ExceptionNames_Env [SubStatus];
|
||||
}
|
||||
break;
|
||||
|
||||
case AE_CODE_PROGRAMMER:
|
||||
|
||||
if (SubStatus <= AE_CODE_PGM_MAX)
|
||||
{
|
||||
Exception = AcpiGbl_ExceptionNames_Pgm [SubStatus -1];
|
||||
}
|
||||
break;
|
||||
|
||||
case AE_CODE_ACPI_TABLES:
|
||||
|
||||
if (SubStatus <= AE_CODE_TBL_MAX)
|
||||
{
|
||||
Exception = AcpiGbl_ExceptionNames_Tbl [SubStatus -1];
|
||||
}
|
||||
break;
|
||||
|
||||
case AE_CODE_AML:
|
||||
|
||||
if (SubStatus <= AE_CODE_AML_MAX)
|
||||
{
|
||||
Exception = AcpiGbl_ExceptionNames_Aml [SubStatus -1];
|
||||
}
|
||||
break;
|
||||
|
||||
case AE_CODE_CONTROL:
|
||||
|
||||
if (SubStatus <= AE_CODE_CTRL_MAX)
|
||||
{
|
||||
Exception = AcpiGbl_ExceptionNames_Ctrl [SubStatus -1];
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return (ACPI_CAST_PTR (const char, Exception));
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiUtIsAmlTable
|
||||
|
@ -1,7 +1,7 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Name: acglobal.h - Declarations for global variables
|
||||
* $Revision: 1.189 $
|
||||
* $Revision: 1.190 $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
@ -320,6 +320,14 @@ extern const char *AcpiGbl_HighestDstateNames[4];
|
||||
extern const ACPI_OPCODE_INFO AcpiGbl_AmlOpInfo[AML_NUM_OPCODES];
|
||||
extern const char *AcpiGbl_RegionTypes[ACPI_NUM_PREDEFINED_REGIONS];
|
||||
|
||||
/* Exception codes */
|
||||
|
||||
extern char const *AcpiGbl_ExceptionNames_Env[];
|
||||
extern char const *AcpiGbl_ExceptionNames_Pgm[];
|
||||
extern char const *AcpiGbl_ExceptionNames_Tbl[];
|
||||
extern char const *AcpiGbl_ExceptionNames_Aml[];
|
||||
extern char const *AcpiGbl_ExceptionNames_Ctrl[];
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
*
|
||||
|
@ -1,7 +1,7 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Name: acutils.h -- prototypes for the common (subsystem-wide) procedures
|
||||
* $Revision: 1.197 $
|
||||
* $Revision: 1.198 $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
@ -740,6 +740,10 @@ AcpiUtShortDivide (
|
||||
/*
|
||||
* utmisc
|
||||
*/
|
||||
const char *
|
||||
AcpiUtValidateException (
|
||||
ACPI_STATUS Status);
|
||||
|
||||
BOOLEAN
|
||||
AcpiUtIsAmlTable (
|
||||
ACPI_TABLE_HEADER *Table);
|
||||
|
Loading…
x
Reference in New Issue
Block a user