Acpi_evaluate_integer of kernel ACPI function API,

Source: Internet
Author: User

Acpi_evaluate_integer of kernel ACPI function API,

Acpi_evaluate_integer of kernel ACPI function API

The acpi_evaluate_integer function is used to obtain the value of a string from the bios. The routine is as follows: status = acpi_evaluate_integer (ac-> device-> handle, "_ PSR", NULL, & ac-> state); if (ACPI_FAILURE (status) {ACPI_EXCEPTION (AE _INFO, status, "Error reading AC Adapter state"); ac-> state = ACPI_AC_STATUS_UNKNOWN; return-ENODEV;}. For example, this routine is used to obtain the value of _ PSR, and then save the value to acpi_statusacpi_evaluate_integer (acpi_handle handle, acpi_string path Name, struct acpi_object_list * arguments, unsigned long * data) {# default return value acpi_status status = AE _ OK; union acpi_object element; struct acpi_buffer buffer = {0, NULL }; # This data is returned as a result. if it is null, The result cannot be saved, and then exit if (! Data) return AE _BAD_PARAMETER; # assign a buffer value to the member variable of acpi_buffer according to acpi spec. length = sizeof (union acpi_object); buffer. pointer = & element; # after passing the following function, the result is saved in the element. status = acpi_evaluate_object (handle, pathname, arguments, & buffer); if (ACPI_FAILURE (status )) {acpi_util_eval_error (handle, pathname, status); return status ;}# here, the type of the value returned by Pan Dan is an integer. If it is not an integer, it indicates that it is not the result we want, errorif (element. type! = ACPI_TYPE_INTEGER) {acpi_util_eval_error (handle, pathname, AE _BAD_DATA); return AE _BAD_DATA ;}#, this sentence shows that the function is actually used to get an integer value from the bios # Here, the value obtained from the bios is saved in the unsigned long data * data = element. integer. value; # The following output ACPI_DEBUG_PRINT (ACPI_DB_INFO, "Return value [% llu] \ n", * data) can be seen through dmesg; return AE _ OK ;}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.