Example #1
0
acpi_status
acpi_tb_recognize_table (
    struct acpi_table_desc          *table_info,
    u8                              search_type)
{
    struct acpi_table_header        *table_header;
    acpi_status                     status;


    ACPI_FUNCTION_TRACE ("tb_recognize_table");


    /* Ensure that we have a valid table pointer */

    table_header = (struct acpi_table_header *) table_info->pointer;
    if (!table_header) {
        return_ACPI_STATUS (AE_BAD_PARAMETER);
    }

    /*
     * We only "recognize" a limited number of ACPI tables -- namely, the
     * ones that are used by the subsystem (DSDT, FADT, etc.)
     *
     * An AE_TABLE_NOT_SUPPORTED means that the table was not recognized.
     * This can be any one of many valid ACPI tables, it just isn't one of
     * the tables that is consumed by the core subsystem
     */
    status = acpi_tb_match_signature (table_header->signature, table_info, search_type);
    if (ACPI_FAILURE (status)) {
        return_ACPI_STATUS (status);
    }

    status = acpi_tb_validate_table_header (table_header);
    if (ACPI_FAILURE (status)) {
        return_ACPI_STATUS (status);
    }

    /* Return the table type and length via the info struct */

    table_info->length = (acpi_size) table_header->length;

    return_ACPI_STATUS (status);
}
Example #2
0
acpi_status
acpi_ex_load_table_op(struct acpi_walk_state *walk_state,
		      union acpi_operand_object **return_desc)
{
	acpi_status status;
	union acpi_operand_object **operand = &walk_state->operands[0];
	struct acpi_table_header *table;
	struct acpi_namespace_node *parent_node;
	struct acpi_namespace_node *start_node;
	struct acpi_namespace_node *parameter_node = NULL;
	union acpi_operand_object *ddb_handle;

	ACPI_FUNCTION_TRACE(ex_load_table_op);

#if 0
	/*
	 * Make sure that the signature does not match one of the tables that
	 * is already loaded.
	 */
	status = acpi_tb_match_signature(operand[0]->string.pointer, NULL);
	if (status == AE_OK) {

		/* Signature matched -- don't allow override */

		return_ACPI_STATUS(AE_ALREADY_EXISTS);
	}
#endif

	/* Find the ACPI table */

	status = acpi_tb_find_table(operand[0]->string.pointer,
				    operand[1]->string.pointer,
				    operand[2]->string.pointer, &table);
	if (ACPI_FAILURE(status)) {
		if (status != AE_NOT_FOUND) {
			return_ACPI_STATUS(status);
		}

		/* Table not found, return an Integer=0 and AE_OK */

		ddb_handle = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER);
		if (!ddb_handle) {
			return_ACPI_STATUS(AE_NO_MEMORY);
		}

		ddb_handle->integer.value = 0;
		*return_desc = ddb_handle;

		return_ACPI_STATUS(AE_OK);
	}

	/* Default nodes */

	start_node = walk_state->scope_info->scope.node;
	parent_node = acpi_gbl_root_node;

	/* root_path (optional parameter) */

	if (operand[3]->string.length > 0) {
		/*
		 * Find the node referenced by the root_path_string. This is the
		 * location within the namespace where the table will be loaded.
		 */
		status =
		    acpi_ns_get_node(start_node, operand[3]->string.pointer,
				     ACPI_NS_SEARCH_PARENT, &parent_node);
		if (ACPI_FAILURE(status)) {
			return_ACPI_STATUS(status);
		}
	}

	/* parameter_path (optional parameter) */

	if (operand[4]->string.length > 0) {
		if ((operand[4]->string.pointer[0] != '\\') &&
		    (operand[4]->string.pointer[0] != '^')) {
			/*
			 * Path is not absolute, so it will be relative to the node
			 * referenced by the root_path_string (or the NS root if omitted)
			 */
			start_node = parent_node;
		}

		/* Find the node referenced by the parameter_path_string */

		status =
		    acpi_ns_get_node(start_node, operand[4]->string.pointer,
				     ACPI_NS_SEARCH_PARENT, &parameter_node);
		if (ACPI_FAILURE(status)) {
			return_ACPI_STATUS(status);
		}
	}

	/* Load the table into the namespace */

	status = acpi_ex_add_table(table, parent_node, &ddb_handle);
	if (ACPI_FAILURE(status)) {
		return_ACPI_STATUS(status);
	}

	/* Parameter Data (optional) */

	if (parameter_node) {

		/* Store the parameter data into the optional parameter object */

		status = acpi_ex_store(operand[5],
				       ACPI_CAST_PTR(union acpi_operand_object,
						     parameter_node),
				       walk_state);
		if (ACPI_FAILURE(status)) {
			(void)acpi_ex_unload_table(ddb_handle);
			return_ACPI_STATUS(status);
		}
	}

	ACPI_INFO((AE_INFO,
		   "Dynamic OEM Table Load - [%4.4s] OemId [%6.6s] OemTableId [%8.8s]",
		   table->signature, table->oem_id, table->oem_table_id));

	*return_desc = ddb_handle;
	return_ACPI_STATUS(status);
}