Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 27526993 authored by Bob Moore's avatar Bob Moore Committed by Len Brown
Browse files

ACPICA: Add repair for bad _BIF/_BIX packages

Add a repair for the "Oem Information" field which is often
mistakenly returned as an integer. It should always be a string.
ACPICA BZ 807.

http://www.acpica.org/bugzilla/show_bug.cgi?id=807



Signed-off-by: default avatarBob Moore <robert.moore@intel.com>
Signed-off-by: default avatarLin Ming <ming.m.lin@intel.com>
Signed-off-by: default avatarLen Brown <len.brown@intel.com>
parent 648f4e3e
Loading
Loading
Loading
Loading
+65 −26
Original line number Original line Diff line number Diff line
@@ -77,6 +77,11 @@ acpi_ns_repair_object(struct acpi_predefined_data *data,
	union acpi_operand_object *new_object;
	union acpi_operand_object *new_object;
	acpi_size length;
	acpi_size length;


	/*
	 * At this point, we know that the type of the returned object was not
	 * one of the expected types for this predefined name. Attempt to
	 * repair the object. Only a limited number of repairs are possible.
	 */
	switch (return_object->common.type) {
	switch (return_object->common.type) {
	case ACPI_TYPE_BUFFER:
	case ACPI_TYPE_BUFFER:


@@ -111,6 +116,41 @@ acpi_ns_repair_object(struct acpi_predefined_data *data,
		 */
		 */
		ACPI_MEMCPY(new_object->string.pointer,
		ACPI_MEMCPY(new_object->string.pointer,
			    return_object->buffer.pointer, length);
			    return_object->buffer.pointer, length);
		break;

	case ACPI_TYPE_INTEGER:

		/* Does the method/object legally return a string? */

		if (expected_btypes & ACPI_RTYPE_STRING) {
			/*
			 * The only supported Integer-to-String conversion is to convert
			 * an integer of value 0 to a NULL string. The last element of
			 * _BIF and _BIX packages occasionally need this fix.
			 */
			if (return_object->integer.value != 0) {
				return (AE_AML_OPERAND_TYPE);
			}

			/* Allocate a new NULL string object */

			new_object = acpi_ut_create_string_object(0);
			if (!new_object) {
				return (AE_NO_MEMORY);
			}
		} else {
			return (AE_AML_OPERAND_TYPE);
		}
		break;

	default:

		/* We cannot repair this object */

		return (AE_AML_OPERAND_TYPE);
	}

	/* Object was successfully repaired */


	/*
	/*
	 * If the original object is a package element, we need to:
	 * If the original object is a package element, we need to:
@@ -126,14 +166,19 @@ acpi_ns_repair_object(struct acpi_predefined_data *data,
			return_object->common.reference_count--;
			return_object->common.reference_count--;
		}
		}


			ACPI_WARN_PREDEFINED((AE_INFO, data->pathname,
		ACPI_WARN_PREDEFINED((AE_INFO, data->pathname, data->node_flags,
					      data->node_flags,
				      "Converted %s to expected %s at index %u",
					      "Converted Buffer to expected String at index %u",
				      acpi_ut_get_object_type_name
				      (return_object),
				      acpi_ut_get_object_type_name(new_object),
				      package_index));
				      package_index));
	} else {
	} else {
			ACPI_WARN_PREDEFINED((AE_INFO, data->pathname,
		ACPI_WARN_PREDEFINED((AE_INFO, data->pathname, data->node_flags,
					      data->node_flags,
				      "Converted %s to expected %s",
					      "Converted Buffer to expected String"));
				      acpi_ut_get_object_type_name
				      (return_object),
				      acpi_ut_get_object_type_name
				      (new_object)));
	}
	}


	/* Delete old object, install the new return object */
	/* Delete old object, install the new return object */
@@ -142,12 +187,6 @@ acpi_ns_repair_object(struct acpi_predefined_data *data,
	*return_object_ptr = new_object;
	*return_object_ptr = new_object;
	data->flags |= ACPI_OBJECT_REPAIRED;
	data->flags |= ACPI_OBJECT_REPAIRED;
	return (AE_OK);
	return (AE_OK);

	default:
		break;
	}

	return (AE_AML_OPERAND_TYPE);
}
}


/*******************************************************************************
/*******************************************************************************