Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion core/opregion.c
Original file line number Diff line number Diff line change
Expand Up @@ -482,7 +482,17 @@ void lai_write_field_internal(uint8_t *source, lai_nsnode_t *field) {

uint64_t value;
if (write_flag == FIELD_PRESERVE) {
if (field->type == LAI_NAMESPACE_FIELD || field->type == LAI_NAMESPACE_BANKFIELD) {
if (access_size == access_bits) {
// Don't needlessly read from the field if we're going to replace all of the bits.
// This is more in line with ACPICA's behavior, and the additional reads could've
// potentially confused hardware.

// If we're accessing the whole word, we can't start anywhere else.
LAI_ENSURE(bit_offset == 0);

value = 0;
} else if (field->type == LAI_NAMESPACE_FIELD
|| field->type == LAI_NAMESPACE_BANKFIELD) {
value = lai_perform_read(field->fld_region_node, access_size, offset);
} else if (field->type == LAI_NAMESPACE_INDEXFIELD) {
value = lai_perform_indexfield_read(field, access_size, offset);
Expand Down