ACPICA: Add predefined names found in the SMBus sepcification

Affects run-time (kernel) ACPICA, iASL, and acpi_help. The "SMBus
Control Method Interface Specification, Version 1.0, December 10,
1999" containes predefined names: _SBA _SBI _SBR _SBT _SBW. This was
done outside of the ACPI specification. This commit adds support for
ACPICA to recognize these named objects as predefined named objects.

ACPICA commit 2fe13bd7ba9f97d3bf25488bf1bb1b2329427093

Link: https://github.com/acpica/acpica/commit/2fe13bd7
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Erik Kaneda <erik.kaneda@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
This commit is contained in:
Bob Moore 2020-10-07 19:53:58 -07:00 committed by Rafael J. Wysocki
parent 465e490d29
commit 4d58403726
4 changed files with 39 additions and 7 deletions

View File

@ -101,7 +101,7 @@ enum acpi_return_package_types {
/* Support macros for users of the predefined info table */ /* Support macros for users of the predefined info table */
#define METHOD_PREDEF_ARGS_MAX 4 #define METHOD_PREDEF_ARGS_MAX 5
#define METHOD_ARG_BIT_WIDTH 3 #define METHOD_ARG_BIT_WIDTH 3
#define METHOD_ARG_MASK 0x0007 #define METHOD_ARG_MASK 0x0007
#define ARG_COUNT_IS_MINIMUM 0x8000 #define ARG_COUNT_IS_MINIMUM 0x8000
@ -117,6 +117,7 @@ enum acpi_return_package_types {
#define METHOD_2ARGS(a1,a2) (2 | (a1 << 3) | (a2 << 6)) #define METHOD_2ARGS(a1,a2) (2 | (a1 << 3) | (a2 << 6))
#define METHOD_3ARGS(a1,a2,a3) (3 | (a1 << 3) | (a2 << 6) | (a3 << 9)) #define METHOD_3ARGS(a1,a2,a3) (3 | (a1 << 3) | (a2 << 6) | (a3 << 9))
#define METHOD_4ARGS(a1,a2,a3,a4) (4 | (a1 << 3) | (a2 << 6) | (a3 << 9) | (a4 << 12)) #define METHOD_4ARGS(a1,a2,a3,a4) (4 | (a1 << 3) | (a2 << 6) | (a3 << 9) | (a4 << 12))
#define METHOD_5ARGS(a1,a2,a3,a4,a5) (5 | (a1 << 3) | (a2 << 6) | (a3 << 9) | (a4 << 12) | (a5 << 15))
#define METHOD_RETURNS(type) (type) #define METHOD_RETURNS(type) (type)
#define METHOD_NO_RETURN_VALUE 0 #define METHOD_NO_RETURN_VALUE 0
@ -902,9 +903,39 @@ const union acpi_predefined_info acpi_gbl_predefined_methods[] = {
{{"_S4W", METHOD_0ARGS, {{"_S4W", METHOD_0ARGS,
METHOD_RETURNS(ACPI_RTYPE_INTEGER)}}, METHOD_RETURNS(ACPI_RTYPE_INTEGER)}},
{{"_SBA", METHOD_0ARGS,
METHOD_RETURNS(ACPI_RTYPE_PACKAGE)}}, /* Fixed-length (4 Int) */
PACKAGE_INFO(ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 4, 0, 0, 0),
{{"_SBI", METHOD_0ARGS,
METHOD_RETURNS(ACPI_RTYPE_PACKAGE)}}, /* Fixed-length (1 Int, 1 Buf) */
PACKAGE_INFO(ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 1,
ACPI_RTYPE_BUFFER, 1, 0),
{{"_SBR",
METHOD_3ARGS(ACPI_TYPE_INTEGER, ACPI_TYPE_INTEGER,
ACPI_TYPE_INTEGER),
METHOD_RETURNS(ACPI_RTYPE_PACKAGE)}}, /* Fixed-length (2 Int) */
PACKAGE_INFO(ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 2,
ACPI_RTYPE_BUFFER | ACPI_RTYPE_INTEGER, 1, 0),
{{"_SBS", METHOD_0ARGS, {{"_SBS", METHOD_0ARGS,
METHOD_RETURNS(ACPI_RTYPE_INTEGER)}}, METHOD_RETURNS(ACPI_RTYPE_INTEGER)}},
{{"_SBT",
METHOD_4ARGS(ACPI_TYPE_INTEGER, ACPI_TYPE_INTEGER, ACPI_TYPE_INTEGER,
ACPI_TYPE_ANY),
METHOD_RETURNS(ACPI_RTYPE_PACKAGE)}}, /* Fixed-length (2 Int, 1 Buf | Int) */
PACKAGE_INFO(ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 2,
ACPI_RTYPE_BUFFER | ACPI_RTYPE_INTEGER, 1, 0),
{{"_SBW",
METHOD_5ARGS(ACPI_TYPE_INTEGER, ACPI_TYPE_INTEGER, ACPI_TYPE_INTEGER,
ACPI_TYPE_INTEGER, ACPI_TYPE_ANY),
METHOD_RETURNS(ACPI_RTYPE_PACKAGE)}},
PACKAGE_INFO(ACPI_PTYPE1_FIXED, ACPI_RTYPE_BUFFER | ACPI_RTYPE_INTEGER,
1, 0, 0, 0),
{{"_SCP", METHOD_1ARGS(ACPI_TYPE_INTEGER) | ARG_COUNT_IS_MINIMUM, {{"_SCP", METHOD_1ARGS(ACPI_TYPE_INTEGER) | ARG_COUNT_IS_MINIMUM,
METHOD_NO_RETURN_VALUE}}, /* Acpi 1.0 allowed 1 integer arg. Acpi 3.0 expanded to 3 args. Allow both. */ METHOD_NO_RETURN_VALUE}}, /* Acpi 1.0 allowed 1 integer arg. Acpi 3.0 expanded to 3 args. Allow both. */

View File

@ -55,7 +55,9 @@ void acpi_ns_check_argument_types(struct acpi_evaluate_info *info)
arg_type = METHOD_GET_NEXT_TYPE(arg_type_list); arg_type = METHOD_GET_NEXT_TYPE(arg_type_list);
user_arg_type = info->parameters[i]->common.type; user_arg_type = info->parameters[i]->common.type;
if (user_arg_type != arg_type) { /* No typechecking for ACPI_TYPE_ANY */
if ((user_arg_type != arg_type) && (arg_type != ACPI_TYPE_ANY)) {
ACPI_WARN_PREDEFINED((AE_INFO, info->full_pathname, ACPI_WARN_PREDEFINED((AE_INFO, info->full_pathname,
ACPI_WARN_ALWAYS, ACPI_WARN_ALWAYS,
"Argument #%u type mismatch - " "Argument #%u type mismatch - "

View File

@ -508,8 +508,8 @@ acpi_status acpi_ps_parse_aml(struct acpi_walk_state *walk_state)
} }
/* /*
* If the transfer to the new method method call worked * If the transfer to the new method method call worked,
*, a new walk state was created -- get it * a new walk state was created -- get it
*/ */
walk_state = acpi_ds_get_current_walk_state(thread); walk_state = acpi_ds_get_current_walk_state(thread);
continue; continue;

View File

@ -151,7 +151,7 @@ static u32 acpi_ut_get_argument_types(char *buffer, u16 argument_types);
static const char *ut_external_type_names[] = /* Indexed by ACPI_TYPE_* */ static const char *ut_external_type_names[] = /* Indexed by ACPI_TYPE_* */
{ {
", UNSUPPORTED-TYPE", ", Type_ANY",
", Integer", ", Integer",
", String", ", String",
", Buffer", ", Buffer",
@ -311,8 +311,7 @@ static u32 acpi_ut_get_argument_types(char *buffer, u16 argument_types)
for (i = 0; i < arg_count; i++) { for (i = 0; i < arg_count; i++) {
this_argument_type = METHOD_GET_NEXT_TYPE(argument_types); this_argument_type = METHOD_GET_NEXT_TYPE(argument_types);
if (!this_argument_type if (this_argument_type > METHOD_MAX_ARG_TYPE) {
|| (this_argument_type > METHOD_MAX_ARG_TYPE)) {
printf("**** Invalid argument type (%u) " printf("**** Invalid argument type (%u) "
"in predefined info structure\n", "in predefined info structure\n",
this_argument_type); this_argument_type);