|
PatchworkOS
|
Opregion and Field Access. More...
Functions | |
| uint64_t | aml_field_unit_load (aml_state_t *state, aml_field_unit_obj_t *fieldUnit, aml_object_t *out) |
| Read the value stored in a FieldUnit. FieldUnits include Fields, IndexFields and BankFields. | |
| uint64_t | aml_field_unit_store (aml_state_t *state, aml_field_unit_obj_t *fieldUnit, aml_object_t *in) |
| Write a value to a FieldUnit. FieldUnits include Fields, IndexFields and BankFields. | |
Opregion and Field Access.
This module provides functionality for accessing Opregions and Fields.
Good luck understanding all the bit shifting and masking, im pretty sure I got it all right but who knows.
| uint64_t aml_field_unit_load | ( | aml_state_t * | state, |
| aml_field_unit_obj_t * | fieldUnit, | ||
| aml_object_t * | out | ||
| ) |
Read the value stored in a FieldUnit. FieldUnits include Fields, IndexFields and BankFields.
A IndexField works by having two fields, an index field and a data field. The index field is written to with the "selector" or "index" of the data to read, and then the data field is read to get the actual data.
A BankField works similarly to a field, but it has an additional "bank" object which it writes its "BankValue" to (which is like the BankFields id), before performing any access. Think of this like reconfiguring the opregion to a different structure before accessing it.
Will acquire the global mutex if the FieldUnits LockRule is set to AML_LOCK_RULE_LOCK.
| state | Pointer to the current AML state. |
| field | The field to read from. |
| out | Pointer to the buffer where the result will be stored, will be an integer or a buffer. |
0. On failure, ERR and errno is set. Definition at line 604 of file field_unit.c.
References AML_ACCESS_READ, aml_buffer_set_empty(), aml_field_unit_access(), aml_integer_byte_size(), aml_integer_set(), aml_field_unit_obj_t::bitSize, EINVAL, ERR, errno, and NULL.
Referenced by aml_convert(), and aml_generic_field_read_at().
| uint64_t aml_field_unit_store | ( | aml_state_t * | state, |
| aml_field_unit_obj_t * | fieldUnit, | ||
| aml_object_t * | in | ||
| ) |
Write a value to a FieldUnit. FieldUnits include Fields, IndexFields and BankFields.
Will acquire the global mutex if the FieldUnits LockRule is set to AML_LOCK_RULE_LOCK.
| state | Pointer to the current AML state. |
| field | The field to write to. |
| in | Pointer to the object containing the value to write, must be an integer or a buffer. |
0. On failure, ERR and errno is set. Definition at line 631 of file field_unit.c.
References AML_ACCESS_WRITE, AML_BUFFER, aml_field_unit_access(), AML_INTEGER, aml_type_to_string(), EINVAL, ERR, errno, LOG_ERR, and NULL.
Referenced by aml_copy_object(), aml_field_unit_access(), aml_generic_field_read_at(), aml_generic_field_write_at(), and aml_integer_to_field_unit().