ACPICA: Add argument typechecking for all predefined ACPI names
Fully implements typechecking on all incoming arguments for all predefined names. This ensures that ACPI-related drivers are passing the correct number of arguments, each of the correct object type. Signed-off-by: Bob Moore <robert.moore@intel.com> Signed-off-by: Lv Zheng <lv.zheng@intel.com> Acked-by: Len Brown <len.brown@intel.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
This commit is contained in:

committed by
Rafael J. Wysocki

parent
e1405ca5eb
commit
29a241cc02
@@ -130,7 +130,7 @@ static const struct acpi_simple_repair_info acpi_object_repair_info[] = {
|
||||
*
|
||||
* FUNCTION: acpi_ns_simple_repair
|
||||
*
|
||||
* PARAMETERS: data - Pointer to validation data structure
|
||||
* PARAMETERS: info - Method execution information block
|
||||
* expected_btypes - Object types expected
|
||||
* package_index - Index of object within parent package (if
|
||||
* applicable - ACPI_NOT_PACKAGE_ELEMENT
|
||||
@@ -146,7 +146,7 @@ static const struct acpi_simple_repair_info acpi_object_repair_info[] = {
|
||||
******************************************************************************/
|
||||
|
||||
acpi_status
|
||||
acpi_ns_simple_repair(struct acpi_predefined_data *data,
|
||||
acpi_ns_simple_repair(struct acpi_evaluate_info *info,
|
||||
u32 expected_btypes,
|
||||
u32 package_index,
|
||||
union acpi_operand_object **return_object_ptr)
|
||||
@@ -162,12 +162,12 @@ acpi_ns_simple_repair(struct acpi_predefined_data *data,
|
||||
* Special repairs for certain names that are in the repair table.
|
||||
* Check if this name is in the list of repairable names.
|
||||
*/
|
||||
predefined = acpi_ns_match_simple_repair(data->node,
|
||||
data->return_btype,
|
||||
predefined = acpi_ns_match_simple_repair(info->node,
|
||||
info->return_btype,
|
||||
package_index);
|
||||
if (predefined) {
|
||||
if (!return_object) {
|
||||
ACPI_WARN_PREDEFINED((AE_INFO, data->pathname,
|
||||
ACPI_WARN_PREDEFINED((AE_INFO, info->full_pathname,
|
||||
ACPI_WARN_ALWAYS,
|
||||
"Missing expected return value"));
|
||||
}
|
||||
@@ -191,7 +191,7 @@ acpi_ns_simple_repair(struct acpi_predefined_data *data,
|
||||
* Do not perform simple object repair unless the return type is not
|
||||
* expected.
|
||||
*/
|
||||
if (data->return_btype & expected_btypes) {
|
||||
if (info->return_btype & expected_btypes) {
|
||||
return (AE_OK);
|
||||
}
|
||||
|
||||
@@ -211,7 +211,7 @@ acpi_ns_simple_repair(struct acpi_predefined_data *data,
|
||||
*/
|
||||
if (!return_object) {
|
||||
if (expected_btypes && (!(expected_btypes & ACPI_RTYPE_NONE))) {
|
||||
ACPI_WARN_PREDEFINED((AE_INFO, data->pathname,
|
||||
ACPI_WARN_PREDEFINED((AE_INFO, info->full_pathname,
|
||||
ACPI_WARN_ALWAYS,
|
||||
"Missing expected return value"));
|
||||
|
||||
@@ -247,14 +247,14 @@ acpi_ns_simple_repair(struct acpi_predefined_data *data,
|
||||
* for correct contents (expected object type or types).
|
||||
*/
|
||||
status =
|
||||
acpi_ns_wrap_with_package(data, return_object, &new_object);
|
||||
acpi_ns_wrap_with_package(info, return_object, &new_object);
|
||||
if (ACPI_SUCCESS(status)) {
|
||||
/*
|
||||
* The original object just had its reference count
|
||||
* incremented for being inserted into the new package.
|
||||
*/
|
||||
*return_object_ptr = new_object; /* New Package object */
|
||||
data->flags |= ACPI_OBJECT_REPAIRED;
|
||||
info->return_flags |= ACPI_OBJECT_REPAIRED;
|
||||
return (AE_OK);
|
||||
}
|
||||
}
|
||||
@@ -277,7 +277,7 @@ acpi_ns_simple_repair(struct acpi_predefined_data *data,
|
||||
* package object as part of the repair, we don't need to
|
||||
* change the reference count.
|
||||
*/
|
||||
if (!(data->flags & ACPI_OBJECT_WRAPPED)) {
|
||||
if (!(info->return_flags & ACPI_OBJECT_WRAPPED)) {
|
||||
new_object->common.reference_count =
|
||||
return_object->common.reference_count;
|
||||
|
||||
@@ -288,14 +288,14 @@ acpi_ns_simple_repair(struct acpi_predefined_data *data,
|
||||
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_REPAIR,
|
||||
"%s: Converted %s to expected %s at Package index %u\n",
|
||||
data->pathname,
|
||||
info->full_pathname,
|
||||
acpi_ut_get_object_type_name(return_object),
|
||||
acpi_ut_get_object_type_name(new_object),
|
||||
package_index));
|
||||
} else {
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_REPAIR,
|
||||
"%s: Converted %s to expected %s\n",
|
||||
data->pathname,
|
||||
info->full_pathname,
|
||||
acpi_ut_get_object_type_name(return_object),
|
||||
acpi_ut_get_object_type_name(new_object)));
|
||||
}
|
||||
@@ -304,7 +304,7 @@ acpi_ns_simple_repair(struct acpi_predefined_data *data,
|
||||
|
||||
acpi_ut_remove_reference(return_object);
|
||||
*return_object_ptr = new_object;
|
||||
data->flags |= ACPI_OBJECT_REPAIRED;
|
||||
info->return_flags |= ACPI_OBJECT_REPAIRED;
|
||||
return (AE_OK);
|
||||
}
|
||||
|
||||
@@ -359,7 +359,7 @@ static const struct acpi_simple_repair_info *acpi_ns_match_simple_repair(struct
|
||||
*
|
||||
* FUNCTION: acpi_ns_repair_null_element
|
||||
*
|
||||
* PARAMETERS: data - Pointer to validation data structure
|
||||
* PARAMETERS: info - Method execution information block
|
||||
* expected_btypes - Object types expected
|
||||
* package_index - Index of object within parent package (if
|
||||
* applicable - ACPI_NOT_PACKAGE_ELEMENT
|
||||
@@ -374,7 +374,7 @@ static const struct acpi_simple_repair_info *acpi_ns_match_simple_repair(struct
|
||||
******************************************************************************/
|
||||
|
||||
acpi_status
|
||||
acpi_ns_repair_null_element(struct acpi_predefined_data *data,
|
||||
acpi_ns_repair_null_element(struct acpi_evaluate_info * info,
|
||||
u32 expected_btypes,
|
||||
u32 package_index,
|
||||
union acpi_operand_object **return_object_ptr)
|
||||
@@ -424,16 +424,16 @@ acpi_ns_repair_null_element(struct acpi_predefined_data *data,
|
||||
/* Set the reference count according to the parent Package object */
|
||||
|
||||
new_object->common.reference_count =
|
||||
data->parent_package->common.reference_count;
|
||||
info->parent_package->common.reference_count;
|
||||
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_REPAIR,
|
||||
"%s: Converted NULL package element to expected %s at index %u\n",
|
||||
data->pathname,
|
||||
info->full_pathname,
|
||||
acpi_ut_get_object_type_name(new_object),
|
||||
package_index));
|
||||
|
||||
*return_object_ptr = new_object;
|
||||
data->flags |= ACPI_OBJECT_REPAIRED;
|
||||
info->return_flags |= ACPI_OBJECT_REPAIRED;
|
||||
return (AE_OK);
|
||||
}
|
||||
|
||||
@@ -441,7 +441,7 @@ acpi_ns_repair_null_element(struct acpi_predefined_data *data,
|
||||
*
|
||||
* FUNCTION: acpi_ns_remove_null_elements
|
||||
*
|
||||
* PARAMETERS: data - Pointer to validation data structure
|
||||
* PARAMETERS: info - Method execution information block
|
||||
* package_type - An acpi_return_package_types value
|
||||
* obj_desc - A Package object
|
||||
*
|
||||
@@ -454,7 +454,7 @@ acpi_ns_repair_null_element(struct acpi_predefined_data *data,
|
||||
*****************************************************************************/
|
||||
|
||||
void
|
||||
acpi_ns_remove_null_elements(struct acpi_predefined_data *data,
|
||||
acpi_ns_remove_null_elements(struct acpi_evaluate_info *info,
|
||||
u8 package_type,
|
||||
union acpi_operand_object *obj_desc)
|
||||
{
|
||||
@@ -511,7 +511,7 @@ acpi_ns_remove_null_elements(struct acpi_predefined_data *data,
|
||||
if (new_count < count) {
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_REPAIR,
|
||||
"%s: Found and removed %u NULL elements\n",
|
||||
data->pathname, (count - new_count)));
|
||||
info->full_pathname, (count - new_count)));
|
||||
|
||||
/* NULL terminate list and update the package count */
|
||||
|
||||
@@ -524,7 +524,7 @@ acpi_ns_remove_null_elements(struct acpi_predefined_data *data,
|
||||
*
|
||||
* FUNCTION: acpi_ns_wrap_with_package
|
||||
*
|
||||
* PARAMETERS: data - Pointer to validation data structure
|
||||
* PARAMETERS: info - Method execution information block
|
||||
* original_object - Pointer to the object to repair.
|
||||
* obj_desc_ptr - The new package object is returned here
|
||||
*
|
||||
@@ -545,7 +545,7 @@ acpi_ns_remove_null_elements(struct acpi_predefined_data *data,
|
||||
******************************************************************************/
|
||||
|
||||
acpi_status
|
||||
acpi_ns_wrap_with_package(struct acpi_predefined_data *data,
|
||||
acpi_ns_wrap_with_package(struct acpi_evaluate_info *info,
|
||||
union acpi_operand_object *original_object,
|
||||
union acpi_operand_object **obj_desc_ptr)
|
||||
{
|
||||
@@ -566,12 +566,12 @@ acpi_ns_wrap_with_package(struct acpi_predefined_data *data,
|
||||
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_REPAIR,
|
||||
"%s: Wrapped %s with expected Package object\n",
|
||||
data->pathname,
|
||||
info->full_pathname,
|
||||
acpi_ut_get_object_type_name(original_object)));
|
||||
|
||||
/* Return the new object in the object pointer */
|
||||
|
||||
*obj_desc_ptr = pkg_obj_desc;
|
||||
data->flags |= ACPI_OBJECT_REPAIRED | ACPI_OBJECT_WRAPPED;
|
||||
info->return_flags |= ACPI_OBJECT_REPAIRED | ACPI_OBJECT_WRAPPED;
|
||||
return (AE_OK);
|
||||
}
|
||||
|
Reference in New Issue
Block a user