Skip to content

Commit

Permalink
ACPICA: Add support for PlatformRtMechanism OperationRegion handler
Browse files Browse the repository at this point in the history
ACPICA commit cdf48b141d7da38e47fe4020310033ddd1971f9e

Writing a buffer to a PlatformRtMechanism FieldUnit invokes a
bidirectional transaction. The input buffer contains 26 bytes
containing 9 bytes of status, a command byte and a 16-byte UUID.
This change will will simply pass this incoming buffer to a handler
registered by the OS.

Link: https://github.com/acpica/acpica/commit/cdf48b14
Signed-off-by: Erik Kaneda <erik.kaneda@intel.com>
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
  • Loading branch information
Erik Kaneda authored and Rafael J. Wysocki committed Jun 7, 2021
1 parent d71df85 commit 04da290
Show file tree
Hide file tree
Showing 5 changed files with 63 additions and 2 deletions.
2 changes: 2 additions & 0 deletions drivers/acpi/acpica/acutils.h
Original file line number Diff line number Diff line change
Expand Up @@ -737,6 +737,8 @@ const char *acpi_ah_match_uuid(u8 *data);
*/
#if (defined ACPI_ASL_COMPILER || defined ACPI_EXEC_APP || defined ACPI_HELP_APP)
void acpi_ut_convert_string_to_uuid(char *in_string, u8 *uuid_buffer);

acpi_status acpi_ut_convert_uuid_to_string(char *uuid_buffer, char *out_string);
#endif

#endif /* _ACUTILS_H */
8 changes: 6 additions & 2 deletions drivers/acpi/acpica/exfield.c
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,9 @@ acpi_ex_read_data_from_field(struct acpi_walk_state *walk_state,
|| obj_desc->field.region_obj->region.space_id ==
ACPI_ADR_SPACE_GSBUS
|| obj_desc->field.region_obj->region.space_id ==
ACPI_ADR_SPACE_IPMI)) {
ACPI_ADR_SPACE_IPMI
|| obj_desc->field.region_obj->region.space_id ==
ACPI_ADR_SPACE_PLATFORM_RT)) {

/* SMBus, GSBus, IPMI serial */

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

/* SMBus, GSBus, IPMI serial */

Expand Down
12 changes: 12 additions & 0 deletions drivers/acpi/acpica/exserial.c
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,12 @@ acpi_ex_read_serial_bus(union acpi_operand_object *obj_desc,
function = ACPI_READ | (accessor_type << 16);
break;

case ACPI_ADR_SPACE_PLATFORM_RT:

buffer_length = ACPI_PRM_INPUT_BUFFER_SIZE;
function = ACPI_READ;
break;

default:
return_ACPI_STATUS(AE_AML_INVALID_SPACE_ID);
}
Expand Down Expand Up @@ -311,6 +317,12 @@ acpi_ex_write_serial_bus(union acpi_operand_object *source_desc,
function = ACPI_WRITE | (accessor_type << 16);
break;

case ACPI_ADR_SPACE_PLATFORM_RT:

buffer_length = ACPI_PRM_INPUT_BUFFER_SIZE;
function = ACPI_WRITE;
break;

default:
return_ACPI_STATUS(AE_AML_INVALID_SPACE_ID);
}
Expand Down
41 changes: 41 additions & 0 deletions drivers/acpi/acpica/utuuid.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,45 @@ void acpi_ut_convert_string_to_uuid(char *in_string, u8 *uuid_buffer)
1]);
}
}

/*******************************************************************************
*
* FUNCTION: acpi_ut_convert_uuid_to_string
*
* PARAMETERS: uuid_buffer - 16-byte UUID buffer
* out_string - 36-byte formatted UUID string
*
* RETURN: Status
*
* DESCRIPTION: Convert 16-byte UUID buffer to 36-byte formatted UUID string
* out_string must be 37 bytes to include null terminator.
*
******************************************************************************/

acpi_status acpi_ut_convert_uuid_to_string(char *uuid_buffer, char *out_string)
{
u32 i;

if (!uuid_buffer || !out_string) {
return (AE_BAD_PARAMETER);
}

for (i = 0; i < UUID_BUFFER_LENGTH; i++) {
out_string[acpi_gbl_map_to_uuid_offset[i]] =
acpi_ut_hex_to_ascii_char(uuid_buffer[i], 4);

out_string[acpi_gbl_map_to_uuid_offset[i] + 1] =
acpi_ut_hex_to_ascii_char(uuid_buffer[i], 0);
}

/* Insert required hyphens (dashes) */

out_string[UUID_HYPHEN1_OFFSET] =
out_string[UUID_HYPHEN2_OFFSET] =
out_string[UUID_HYPHEN3_OFFSET] =
out_string[UUID_HYPHEN4_OFFSET] = '-';

out_string[UUID_STRING_LENGTH] = 0; /* Null terminate */
return (AE_OK);
}
#endif
2 changes: 2 additions & 0 deletions include/acpi/acconfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,8 @@
#define ACPI_MAX_GSBUS_DATA_SIZE 255
#define ACPI_MAX_GSBUS_BUFFER_SIZE ACPI_SERIAL_HEADER_SIZE + ACPI_MAX_GSBUS_DATA_SIZE

#define ACPI_PRM_INPUT_BUFFER_SIZE 26

/* _sx_d and _sx_w control methods */

#define ACPI_NUM_sx_d_METHODS 4
Expand Down

0 comments on commit 04da290

Please sign in to comment.