static u8
acpi_ex_do_match(u32 match_op,
                 union acpi_operand_object *package_obj,
                 union acpi_operand_object *match_obj)
{
    u8 logical_result = TRUE;
    acpi_status status;

    switch (match_op) {
    case MATCH_MTR:



        break;

    case MATCH_MEQ:

        status =
            acpi_ex_do_logical_op(AML_LEQUAL_OP, match_obj, package_obj,
                                  &logical_result);
        if (ACPI_FAILURE(status)) {
            return (FALSE);
        }
        break;

    case MATCH_MLE:

        status =
            acpi_ex_do_logical_op(AML_LLESS_OP, match_obj, package_obj,
                                  &logical_result);
        if (ACPI_FAILURE(status)) {
            return (FALSE);
        }
        logical_result = (u8) ! logical_result;
        break;

    case MATCH_MLT:

        status =
            acpi_ex_do_logical_op(AML_LGREATER_OP, match_obj,
                                  package_obj, &logical_result);
        if (ACPI_FAILURE(status)) {
            return (FALSE);
        }
        break;

    case MATCH_MGE:

        status =
            acpi_ex_do_logical_op(AML_LGREATER_OP, match_obj,
                                  package_obj, &logical_result);
        if (ACPI_FAILURE(status)) {
            return (FALSE);
        }
        logical_result = (u8) ! logical_result;
        break;

    case MATCH_MGT:

        status =
            acpi_ex_do_logical_op(AML_LLESS_OP, match_obj, package_obj,
                                  &logical_result);
        if (ACPI_FAILURE(status)) {
            return (FALSE);
        }
        break;

    default:



        return (FALSE);
    }

    return logical_result;
}
static u8
acpi_ex_do_match(u32 match_op,
                 union acpi_operand_object *package_obj,
                 union acpi_operand_object *match_obj)
{
    u8 logical_result = TRUE;
    acpi_status status;

    /*
     * Note: Since the package_obj/match_obj ordering is opposite to that of
     * the standard logical operators, we have to reverse them when we call
     * do_logical_op in order to make the implicit conversion rules work
     * correctly. However, this means we have to flip the entire equation
     * also. A bit ugly perhaps, but overall, better than fussing the
     * parameters around at runtime, over and over again.
     *
     * Below, P[i] refers to the package element, M refers to the Match object.
     */
    switch (match_op) {
    case MATCH_MTR:

        /* Always true */

        break;

    case MATCH_MEQ:

        /*
         * True if equal: (P[i] == M)
         * Change to:     (M == P[i])
         */
        status =
            acpi_ex_do_logical_op(AML_LEQUAL_OP, match_obj, package_obj,
                                  &logical_result);
        if (ACPI_FAILURE(status)) {
            return (FALSE);
        }
        break;

    case MATCH_MLE:

        /*
         * True if less than or equal: (P[i] <= M) (P[i] not_greater than M)
         * Change to:                  (M >= P[i]) (M not_less than P[i])
         */
        status =
            acpi_ex_do_logical_op(AML_LLESS_OP, match_obj, package_obj,
                                  &logical_result);
        if (ACPI_FAILURE(status)) {
            return (FALSE);
        }
        logical_result = (u8) ! logical_result;
        break;

    case MATCH_MLT:

        /*
         * True if less than: (P[i] < M)
         * Change to:         (M > P[i])
         */
        status =
            acpi_ex_do_logical_op(AML_LGREATER_OP, match_obj,
                                  package_obj, &logical_result);
        if (ACPI_FAILURE(status)) {
            return (FALSE);
        }
        break;

    case MATCH_MGE:

        /*
         * True if greater than or equal: (P[i] >= M) (P[i] not_less than M)
         * Change to:                     (M <= P[i]) (M not_greater than P[i])
         */
        status =
            acpi_ex_do_logical_op(AML_LGREATER_OP, match_obj,
                                  package_obj, &logical_result);
        if (ACPI_FAILURE(status)) {
            return (FALSE);
        }
        logical_result = (u8) ! logical_result;
        break;

    case MATCH_MGT:

        /*
         * True if greater than: (P[i] > M)
         * Change to:            (M < P[i])
         */
        status =
            acpi_ex_do_logical_op(AML_LLESS_OP, match_obj, package_obj,
                                  &logical_result);
        if (ACPI_FAILURE(status)) {
            return (FALSE);
        }
        break;

    default:

        /* Undefined */

        return (FALSE);
    }

    return logical_result;
}
Beispiel #3
0
acpi_status
acpi_ex_opcode_2A_0T_1R (
	acpi_walk_state         *walk_state)
{
	acpi_operand_object     **operand = &walk_state->operands[0];
	acpi_operand_object     *return_desc = NULL;
	acpi_status             status = AE_OK;
	u8                      logical_result = FALSE;


	FUNCTION_TRACE_STR ("Ex_opcode_2A_0T_1R", acpi_ps_get_opcode_name (walk_state->opcode));


	/* Create the internal return object */

	return_desc = acpi_ut_create_internal_object (ACPI_TYPE_INTEGER);
	if (!return_desc) {
		status = AE_NO_MEMORY;
		goto cleanup;
	}

	/*
	 * Execute the Opcode
	 */
	if (walk_state->op_info->flags & AML_LOGICAL) /* Logical_op (Operand0, Operand1) */ {
		logical_result = acpi_ex_do_logical_op (walk_state->opcode,
				 operand[0]->integer.value,
				 operand[1]->integer.value);
		goto store_logical_result;
	}


	switch (walk_state->opcode) {
	case AML_ACQUIRE_OP:            /* Acquire (Mutex_object, Timeout) */

		status = acpi_ex_acquire_mutex (operand[1], operand[0], walk_state);
		if (status == AE_TIME) {
			logical_result = TRUE;      /* TRUE = Acquire timed out */
			status = AE_OK;
		}
		break;


	case AML_WAIT_OP:               /* Wait (Event_object, Timeout) */

		status = acpi_ex_system_wait_event (operand[1], operand[0]);
		if (status == AE_TIME) {
			logical_result = TRUE;      /* TRUE, Wait timed out */
			status = AE_OK;
		}
		break;


	default:

		REPORT_ERROR (("Acpi_ex_opcode_2A_0T_1R: Unknown opcode %X\n", walk_state->opcode));
		status = AE_AML_BAD_OPCODE;
		goto cleanup;
		break;
	}


store_logical_result:
	/*
	 * Set return value to according to Logical_result. logical TRUE (all ones)
	 * Default is FALSE (zero)
	 */
	if (logical_result) {
		return_desc->integer.value = ACPI_INTEGER_MAX;
	}

	walk_state->result_obj = return_desc;


cleanup:

	/* Delete return object on error */

	if (ACPI_FAILURE (status)) {
		acpi_ut_remove_reference (return_desc);
	}

	return_ACPI_STATUS (status);
}