PatchworkOS  966e257
A non-POSIX operating system.
Loading...
Searching...
No Matches
field_unit.h
Go to the documentation of this file.
1#pragma once
2
4
5#include <stdint.h>
6
7/**
8 * @brief Opregion and Field Access
9 * @defgroup modules_acpi_aml_field Field Access
10 * @ingroup modules_acpi_aml
11 *
12 * This module provides functionality for accessing Opregions and Fields.
13 *
14 * Good luck understanding all the bit shifting and masking, im pretty sure I got it all right but who knows.
15 *
16 * @{
17 */
18
19/**
20 * @brief Read the value stored in a FieldUnit. FieldUnits include Fields, IndexFields and BankFields.
21 *
22 * A IndexField works by having two fields, an index field and a data field. The index field is written to with the
23 * "selector" or "index" of the data to read, and then the data field is read to get the actual data.
24 *
25 * A BankField works similarly to a field, but it has an additional "bank" object which it writes its "BankValue" to
26 * (which is like the BankFields id), before performing any access. Think of this like reconfiguring the opregion to a
27 * different structure before accessing it.
28 *
29 * Will acquire the global mutex if the FieldUnits LockRule is set to `AML_LOCK_RULE_LOCK`.
30 *
31 * @see @ref modules_acpi_aml_evaluate
32 * @see Section 19.6.48, 19.6.64 and 19.6.7 of the ACPI specification for more details.
33 *
34 * @param state Pointer to the current AML state.
35 * @param field The field to read from.
36 * @param out Pointer to the buffer where the result will be stored, will be an integer or a buffer.
37 * @return On success, `0`. On failure, `ERR` and `errno` is set.
38 */
40
41/**
42 * @brief Write a value to a FieldUnit. FieldUnits include Fields, IndexFields and BankFields.
43 *
44 * Will acquire the global mutex if the FieldUnits LockRule is set to `AML_LOCK_RULE_LOCK`.
45 *
46 * @see @ref modules_acpi_aml_evaluate
47 * @see Section 19.6.48, 19.6.64 and 19.6.7 of the ACPI specification for more details.
48 *
49 * @param state Pointer to the current AML state.
50 * @param field The field to write to.
51 * @param in Pointer to the object containing the value to write, must be an integer or a buffer.
52 * @return On success, `0`. On failure, `ERR` and `errno` is set.
53 */
55
56/** @} */
uint64_t aml_field_unit_load(aml_state_t *state, aml_field_unit_t *fieldUnit, aml_object_t *out)
Read the value stored in a FieldUnit. FieldUnits include Fields, IndexFields and BankFields.
Definition field_unit.c:612
uint64_t aml_field_unit_store(aml_state_t *state, aml_field_unit_t *fieldUnit, aml_object_t *in)
Write a value to a FieldUnit. FieldUnits include Fields, IndexFields and BankFields.
Definition field_unit.c:639
__UINT64_TYPE__ uint64_t
Definition stdint.h:17
Data for a field unit object.
Definition object.h:268
ACPI object.
Definition object.h:447
AML State.
Definition state.h:25