Exemple #1
0
u8 *
acpi_ps_get_next_package_end (
	ACPI_PARSE_STATE        *parser_state)
{
	u8                      *start = parser_state->aml;
	NATIVE_UINT             length;


	length = (NATIVE_UINT) acpi_ps_get_next_package_length (parser_state);

	return (start + length); /* end of package */
}
u8 *acpi_ps_get_next_package_end(struct acpi_parse_state *parser_state)
{
	u8 *start = parser_state->aml;
	acpi_native_uint length;

	ACPI_FUNCTION_TRACE("ps_get_next_package_end");

	/* Function below changes parser_state->Aml */

	length =
	    (acpi_native_uint) acpi_ps_get_next_package_length(parser_state);

	return_PTR(start + length);	/* end of package */
}
static union acpi_parse_object *acpi_ps_get_next_field(struct acpi_parse_state
						       *parser_state)
{
	u32 aml_offset = (u32)
	    ACPI_PTR_DIFF(parser_state->aml,
			  parser_state->aml_start);
	union acpi_parse_object *field;
	u16 opcode;
	u32 name;

	ACPI_FUNCTION_TRACE("ps_get_next_field");

	/* Determine field type */

	switch (ACPI_GET8(parser_state->aml)) {
	default:

		opcode = AML_INT_NAMEDFIELD_OP;
		break;

	case 0x00:

		opcode = AML_INT_RESERVEDFIELD_OP;
		parser_state->aml++;
		break;

	case 0x01:

		opcode = AML_INT_ACCESSFIELD_OP;
		parser_state->aml++;
		break;
	}

	/* Allocate a new field op */

	field = acpi_ps_alloc_op(opcode);
	if (!field) {
		return_PTR(NULL);
	}

	field->common.aml_offset = aml_offset;

	/* Decode the field type */

	switch (opcode) {
	case AML_INT_NAMEDFIELD_OP:

		/* Get the 4-character name */

		ACPI_MOVE_32_TO_32(&name, parser_state->aml);
		acpi_ps_set_name(field, name);
		parser_state->aml += ACPI_NAME_SIZE;

		/* Get the length which is encoded as a package length */

		field->common.value.size =
		    acpi_ps_get_next_package_length(parser_state);
		break;

	case AML_INT_RESERVEDFIELD_OP:

		/* Get the length which is encoded as a package length */

		field->common.value.size =
		    acpi_ps_get_next_package_length(parser_state);
		break;

	case AML_INT_ACCESSFIELD_OP:

		/*
		 * Get access_type and access_attrib and merge into the field Op
		 * access_type is first operand, access_attribute is second
		 */
		field->common.value.integer =
		    (ACPI_GET8(parser_state->aml) << 8);
		parser_state->aml++;
		field->common.value.integer |= ACPI_GET8(parser_state->aml);
		parser_state->aml++;
		break;

	default:

		/* Opcode was set in previous switch */
		break;
	}

	return_PTR(field);
}
Exemple #4
0
ACPI_PARSE_OBJECT *
acpi_ps_get_next_field (
	ACPI_PARSE_STATE        *parser_state)
{
	ACPI_PTRDIFF            aml_offset = parser_state->aml -
			 parser_state->aml_start;
	ACPI_PARSE_OBJECT       *field;
	u16                     opcode;
	u32                     name;


	/* determine field type */

	switch (GET8 (parser_state->aml))
	{

	default:

		opcode = AML_NAMEDFIELD_OP;
		break;


	case 0x00:

		opcode = AML_RESERVEDFIELD_OP;
		parser_state->aml++;
		break;


	case 0x01:

		opcode = AML_ACCESSFIELD_OP;
		parser_state->aml++;
		break;
	}


	/* Allocate a new field op */

	field = acpi_ps_alloc_op (opcode);
	if (field) {
		field->aml_offset = aml_offset;

		/* Decode the field type */

		switch (opcode)
		{
		case AML_NAMEDFIELD_OP:

			/* Get the 4-character name */

			MOVE_UNALIGNED32_TO_32 (&name, parser_state->aml);
			acpi_ps_set_name (field, name);
			parser_state->aml += 4;

			/* Get the length which is encoded as a package length */

			field->value.size = acpi_ps_get_next_package_length (parser_state);
			break;


		case AML_RESERVEDFIELD_OP:

			/* Get the length which is encoded as a package length */

			field->value.size = acpi_ps_get_next_package_length (parser_state);
			break;


		case AML_ACCESSFIELD_OP:

			/* Get Access_type and Access_atrib and merge into the field Op */

			field->value.integer = ((GET8 (parser_state->aml) << 8) |
					  GET8 (parser_state->aml));
			parser_state->aml += 2;
			break;
		}
	}

	return (field);
}