Skip to content

Commit

Permalink
ACPICA: Add support for FFH Opregion special context data
Browse files Browse the repository at this point in the history
ACPICA commit fad527b6e76babc7527c41325bfbef6bd1a1132b

FFH(Fixed Function Hardware) Opregion is approved to be added in ACPI 6.5 via
code first approach [1]. It requires special context data similar to GPIO and
Generic Serial Bus as it needs to know platform specific offset and length.

Add support for the special context data needed by FFH Opregion.

FFH op_region enables advanced use of FFH on some architectures. For example,
it could be used to easily proxy AML code to architecture-specific behavior
(to ensure it is OS initiated)

Actual behavior of FFH is ofcourse architecture specific and depends on
the FFH bindings. The offset and length could have arch specific meaning
or usage.

Link: https://bugzilla.tianocore.org/show_bug.cgi?id=3598 # [1]
Link: https://github.com/acpica/acpica/commit/fad527b6
Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
  • Loading branch information
Sudeep Holla authored and Rafael J. Wysocki committed Oct 28, 2022
1 parent e92e4a4 commit ee64b82
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 2 deletions.
9 changes: 9 additions & 0 deletions drivers/acpi/acpica/evregion.c
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,15 @@ acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj,
ctx->subspace_id = (u8)region_obj->region.address;
}

if (region_obj->region.space_id ==
ACPI_ADR_SPACE_FIXED_HARDWARE) {
struct acpi_ffh_info *ctx =
handler_desc->address_space.context;

ctx->length = region_obj->region.length;
ctx->offset = region_obj->region.address;
}

/*
* We must exit the interpreter because the region setup will
* potentially execute control methods (for example, the _REG method
Expand Down
8 changes: 6 additions & 2 deletions drivers/acpi/acpica/exfield.c
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,9 @@ acpi_ex_read_data_from_field(struct acpi_walk_state *walk_state,
|| obj_desc->field.region_obj->region.space_id ==
ACPI_ADR_SPACE_IPMI
|| obj_desc->field.region_obj->region.space_id ==
ACPI_ADR_SPACE_PLATFORM_RT)) {
ACPI_ADR_SPACE_PLATFORM_RT
|| obj_desc->field.region_obj->region.space_id ==
ACPI_ADR_SPACE_FIXED_HARDWARE)) {

/* SMBus, GSBus, IPMI serial */

Expand Down Expand Up @@ -305,7 +307,9 @@ acpi_ex_write_data_to_field(union acpi_operand_object *source_desc,
|| obj_desc->field.region_obj->region.space_id ==
ACPI_ADR_SPACE_IPMI
|| obj_desc->field.region_obj->region.space_id ==
ACPI_ADR_SPACE_PLATFORM_RT)) {
ACPI_ADR_SPACE_PLATFORM_RT
|| obj_desc->field.region_obj->region.space_id ==
ACPI_ADR_SPACE_FIXED_HARDWARE)) {

/* SMBus, GSBus, IPMI serial */

Expand Down
6 changes: 6 additions & 0 deletions drivers/acpi/acpica/exserial.c
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,12 @@ acpi_ex_write_serial_bus(union acpi_operand_object *source_desc,
function = ACPI_WRITE;
break;

case ACPI_ADR_SPACE_FIXED_HARDWARE:

buffer_length = ACPI_FFH_INPUT_BUFFER_SIZE;
function = ACPI_WRITE;
break;

default:
return_ACPI_STATUS(AE_AML_INVALID_SPACE_ID);
}
Expand Down
2 changes: 2 additions & 0 deletions include/acpi/acconfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,8 @@

#define ACPI_PRM_INPUT_BUFFER_SIZE 26

#define ACPI_FFH_INPUT_BUFFER_SIZE 256

/* _sx_d and _sx_w control methods */

#define ACPI_NUM_sx_d_METHODS 4
Expand Down
7 changes: 7 additions & 0 deletions include/acpi/actypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -1116,6 +1116,13 @@ struct acpi_pcc_info {
u8 *internal_buffer;
};

/* Special Context data for FFH Opregion (ACPI 6.5) */

struct acpi_ffh_info {
u64 offset;
u64 length;
};

typedef
acpi_status (*acpi_adr_space_setup) (acpi_handle region_handle,
u32 function,
Expand Down

0 comments on commit ee64b82

Please sign in to comment.