Example #1
0
File: uteval.c Project: 274914765/C
acpi_status acpi_ut_osi_implementation(struct acpi_walk_state *walk_state)
{
    acpi_status status;
    union acpi_operand_object *string_desc;
    union acpi_operand_object *return_desc;
    acpi_native_uint i;

    ACPI_FUNCTION_TRACE(ut_osi_implementation);

    /* Validate the string input argument */

    string_desc = walk_state->arguments[0].object;
    if (!string_desc || (string_desc->common.type != ACPI_TYPE_STRING)) {
        return_ACPI_STATUS(AE_TYPE);
    }

    /* Create a return object */

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

    /* Default return value is SUPPORTED */

    return_desc->integer.value = ACPI_UINT32_MAX;
    walk_state->return_desc = return_desc;

    /* Compare input string to static table of supported interfaces */

    for (i = 0; i < ACPI_ARRAY_LENGTH(acpi_interfaces_supported); i++) {
        if (!ACPI_STRCMP
            (string_desc->string.pointer,
             acpi_interfaces_supported[i])) {

            /* The interface is supported */

            return_ACPI_STATUS(AE_CTRL_TERMINATE);
        }
    }

    /*
     * Did not match the string in the static table, call the host OSL to
     * check for a match with one of the optional strings (such as
     * "Module Device", "3.0 Thermal Model", etc.)
     */
    status = acpi_os_validate_interface(string_desc->string.pointer);
    if (ACPI_SUCCESS(status)) {

        /* The interface is supported */

        return_ACPI_STATUS(AE_CTRL_TERMINATE);
    }

    /* The interface is not supported */

    return_desc->integer.value = 0;
    return_ACPI_STATUS(AE_CTRL_TERMINATE);
}
acpi_status acpi_ut_osi_implementation(struct acpi_walk_state *walk_state)
{
	acpi_status status;
	union acpi_operand_object *string_desc;
	union acpi_operand_object *return_desc;
	u32 return_value;
	u32 i;

	ACPI_FUNCTION_TRACE(ut_osi_implementation);

	/* Validate the string input argument */

	string_desc = walk_state->arguments[0].object;
	if (!string_desc || (string_desc->common.type != ACPI_TYPE_STRING)) {
		return_ACPI_STATUS(AE_TYPE);
	}

	/* Create a return object */

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

	/* Default return value is 0, NOT SUPPORTED */

	return_value = 0;

	/* Compare input string to static table of supported interfaces */

	for (i = 0; i < ACPI_ARRAY_LENGTH(acpi_interfaces_supported); i++) {
		if (!ACPI_STRCMP(string_desc->string.pointer,
				 acpi_interfaces_supported[i].name)) {
			/*
			 * The interface is supported.
			 * Update the osi_data if necessary. We keep track of the latest
			 * version of Windows that has been requested by the BIOS.
			 */
			if (acpi_interfaces_supported[i].value >
			    acpi_gbl_osi_data) {
				acpi_gbl_osi_data =
				    acpi_interfaces_supported[i].value;
			}

			return_value = ACPI_UINT32_MAX;
			goto exit;
		}
	}

	/*
	 * Did not match the string in the static table, call the host OSL to
	 * check for a match with one of the optional strings (such as
	 * "Module Device", "3.0 Thermal Model", etc.)
	 */
	status = acpi_os_validate_interface(string_desc->string.pointer);
	if (ACPI_SUCCESS(status)) {

		/* The interface is supported */

		return_value = ACPI_UINT32_MAX;
	}

exit:
	ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO,
		"ACPI: BIOS _OSI(%s) is %ssupported\n",
		string_desc->string.pointer, return_value == 0 ? "not " : ""));

	/* Complete the return value */

	return_desc->integer.value = return_value;
	walk_state->return_desc = return_desc;
	return_ACPI_STATUS (AE_OK);
}