Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 46359
b: refs/heads/master
c: 84fb2c9
h: refs/heads/master
i:
  46357: 51b4e59
  46355: 5d4b925
  46351: c99b49f
v: v3
  • Loading branch information
Bob Moore authored and Len Brown committed Feb 3, 2007
1 parent a4ca5e8 commit f9b4462
Show file tree
Hide file tree
Showing 5 changed files with 120 additions and 83 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 69874165ab953a62f9adb3096ccd84ed2561a602
refs/heads/master: 84fb2c97731c1631c5548c15f3698ad82c274245
118 changes: 36 additions & 82 deletions trunk/drivers/acpi/utilities/utglobal.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,87 +50,6 @@ ACPI_EXPORT_SYMBOL(acpi_gbl_FADT)
#define _COMPONENT ACPI_UTILITIES
ACPI_MODULE_NAME("utglobal")

/*******************************************************************************
*
* FUNCTION: acpi_format_exception
*
* 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 *acpi_format_exception(acpi_status status)
{
acpi_status sub_status;
const char *exception = NULL;

ACPI_FUNCTION_ENTRY();

/*
* Status is composed of two parts, a "type" and an actual code
*/
sub_status = (status & ~AE_CODE_MASK);

switch (status & AE_CODE_MASK) {
case AE_CODE_ENVIRONMENTAL:

if (sub_status <= AE_CODE_ENV_MAX) {
exception = acpi_gbl_exception_names_env[sub_status];
}
break;

case AE_CODE_PROGRAMMER:

if (sub_status <= AE_CODE_PGM_MAX) {
exception =
acpi_gbl_exception_names_pgm[sub_status - 1];
}
break;

case AE_CODE_ACPI_TABLES:

if (sub_status <= AE_CODE_TBL_MAX) {
exception =
acpi_gbl_exception_names_tbl[sub_status - 1];
}
break;

case AE_CODE_AML:

if (sub_status <= AE_CODE_AML_MAX) {
exception =
acpi_gbl_exception_names_aml[sub_status - 1];
}
break;

case AE_CODE_CONTROL:

if (sub_status <= AE_CODE_CTRL_MAX) {
exception =
acpi_gbl_exception_names_ctrl[sub_status - 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.
Expand Down Expand Up @@ -182,10 +101,45 @@ const char *acpi_gbl_highest_dstate_names[4] = {

/*******************************************************************************
*
* Namespace globals
* FUNCTION: acpi_format_exception
*
* 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 *acpi_format_exception(acpi_status status)
{
const char *exception = NULL;

ACPI_FUNCTION_ENTRY();

exception = acpi_ut_validate_exception(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(acpi_format_exception)

/*******************************************************************************
*
* Namespace globals
*
******************************************************************************/
/*
* Predefined ACPI Names (Built-in to the Interpreter)
*
Expand Down
73 changes: 73 additions & 0 deletions trunk/drivers/acpi/utilities/utmisc.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,78 @@
#define _COMPONENT ACPI_UTILITIES
ACPI_MODULE_NAME("utmisc")

/*******************************************************************************
*
* FUNCTION: acpi_ut_validate_exception
*
* 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 *acpi_ut_validate_exception(acpi_status status)
{
acpi_status sub_status;
const char *exception = NULL;

ACPI_FUNCTION_ENTRY();

/*
* Status is composed of two parts, a "type" and an actual code
*/
sub_status = (status & ~AE_CODE_MASK);

switch (status & AE_CODE_MASK) {
case AE_CODE_ENVIRONMENTAL:

if (sub_status <= AE_CODE_ENV_MAX) {
exception = acpi_gbl_exception_names_env[sub_status];
}
break;

case AE_CODE_PROGRAMMER:

if (sub_status <= AE_CODE_PGM_MAX) {
exception =
acpi_gbl_exception_names_pgm[sub_status - 1];
}
break;

case AE_CODE_ACPI_TABLES:

if (sub_status <= AE_CODE_TBL_MAX) {
exception =
acpi_gbl_exception_names_tbl[sub_status - 1];
}
break;

case AE_CODE_AML:

if (sub_status <= AE_CODE_AML_MAX) {
exception =
acpi_gbl_exception_names_aml[sub_status - 1];
}
break;

case AE_CODE_CONTROL:

if (sub_status <= AE_CODE_CTRL_MAX) {
exception =
acpi_gbl_exception_names_ctrl[sub_status - 1];
}
break;

default:
break;
}

return (ACPI_CAST_PTR(const char, exception));
}

/*******************************************************************************
*
* FUNCTION: acpi_ut_is_aml_table
Expand All @@ -62,6 +134,7 @@ ACPI_MODULE_NAME("utmisc")
* data tables that do not contain AML code.
*
******************************************************************************/

u8 acpi_ut_is_aml_table(struct acpi_table_header *table)
{

Expand Down
8 changes: 8 additions & 0 deletions trunk/include/acpi/acglobal.h
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,14 @@ extern const char *acpi_gbl_highest_dstate_names[4];
extern const struct acpi_opcode_info acpi_gbl_aml_op_info[AML_NUM_OPCODES];
extern const char *acpi_gbl_region_types[ACPI_NUM_PREDEFINED_REGIONS];

/* Exception codes */

extern char const *acpi_gbl_exception_names_env[];
extern char const *acpi_gbl_exception_names_pgm[];
extern char const *acpi_gbl_exception_names_tbl[];
extern char const *acpi_gbl_exception_names_aml[];
extern char const *acpi_gbl_exception_names_ctrl[];

/*****************************************************************************
*
* Namespace globals
Expand Down
2 changes: 2 additions & 0 deletions trunk/include/acpi/acutils.h
Original file line number Diff line number Diff line change
Expand Up @@ -453,6 +453,8 @@ acpi_ut_short_divide(acpi_integer in_dividend,
/*
* utmisc
*/
const char *acpi_ut_validate_exception(acpi_status status);

u8 acpi_ut_is_aml_table(struct acpi_table_header *table);

acpi_status acpi_ut_allocate_owner_id(acpi_owner_id * owner_id);
Expand Down

0 comments on commit f9b4462

Please sign in to comment.