Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2da120b6 authored by Bob Moore's avatar Bob Moore Committed by Len Brown
Browse files

ACPI 5.0: Support for GeneralPurposeIo and GenericSerialBus operation region



Signed-off-by: default avatarBob Moore <robert.moore@intel.com>
Signed-off-by: default avatarLin Ming <ming.m.lin@intel.com>
Signed-off-by: default avatarLen Brown <len.brown@intel.com>
parent 9ce81784
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -202,9 +202,10 @@
#define ACPI_RSDP_CHECKSUM_LENGTH       20
#define ACPI_RSDP_XCHECKSUM_LENGTH      36

/* SMBus and IPMI bidirectional buffer size */
/* SMBus, GSBus and IPMI bidirectional buffer size */

#define ACPI_SMBUS_BUFFER_SIZE          34
#define ACPI_GSBUS_BUFFER_SIZE          34
#define ACPI_IPMI_BUFFER_SIZE           66

/* _sx_d and _sx_w control methods */
+10 −7
Original line number Diff line number Diff line
@@ -466,13 +466,16 @@ typedef enum {
 * access_as keyword
 */
typedef enum {
	AML_FIELD_ATTRIB_SMB_QUICK = 0x02,
	AML_FIELD_ATTRIB_SMB_SEND_RCV = 0x04,
	AML_FIELD_ATTRIB_SMB_BYTE = 0x06,
	AML_FIELD_ATTRIB_SMB_WORD = 0x08,
	AML_FIELD_ATTRIB_SMB_BLOCK = 0x0A,
	AML_FIELD_ATTRIB_SMB_WORD_CALL = 0x0C,
	AML_FIELD_ATTRIB_SMB_BLOCK_CALL = 0x0D
	AML_FIELD_ATTRIB_QUICK = 0x02,
	AML_FIELD_ATTRIB_SEND_RCV = 0x04,
	AML_FIELD_ATTRIB_BYTE = 0x06,
	AML_FIELD_ATTRIB_WORD = 0x08,
	AML_FIELD_ATTRIB_BLOCK = 0x0A,
	AML_FIELD_ATTRIB_MULTIBYTE = 0x0B,
	AML_FIELD_ATTRIB_WORD_CALL = 0x0C,
	AML_FIELD_ATTRIB_BLOCK_CALL = 0x0D,
	AML_FIELD_ATTRIB_RAW_BYTES = 0x0E,
	AML_FIELD_ATTRIB_RAW_PROCESS = 0x0F
} AML_ACCESS_ATTRIBUTE;

/* Bit fields in the AML method_flags byte */
+21 −7
Original line number Diff line number Diff line
@@ -100,18 +100,25 @@ acpi_ex_read_data_from_field(struct acpi_walk_state *walk_state,
		   (obj_desc->field.region_obj->region.space_id ==
		    ACPI_ADR_SPACE_SMBUS
		    || obj_desc->field.region_obj->region.space_id ==
		    ACPI_ADR_SPACE_GSBUS
		    || obj_desc->field.region_obj->region.space_id ==
		    ACPI_ADR_SPACE_IPMI)) {
		/*
		 * This is an SMBus or IPMI read. We must create a buffer to hold
		 * This is an SMBus, GSBus or IPMI read. We must create a buffer to hold
		 * the data and then directly access the region handler.
		 *
		 * Note: Smbus protocol value is passed in upper 16-bits of Function
		 * Note: SMBus and GSBus protocol value is passed in upper 16-bits of Function
		 */
		if (obj_desc->field.region_obj->region.space_id ==
		    ACPI_ADR_SPACE_SMBUS) {
			length = ACPI_SMBUS_BUFFER_SIZE;
			function =
			    ACPI_READ | (obj_desc->field.attribute << 16);
		} else if (obj_desc->field.region_obj->region.space_id ==
			   ACPI_ADR_SPACE_GSBUS) {
			length = ACPI_GSBUS_BUFFER_SIZE;
			function =
			    ACPI_READ | (obj_desc->field.attribute << 16);
		} else {	/* IPMI */

			length = ACPI_IPMI_BUFFER_SIZE;
@@ -248,21 +255,23 @@ acpi_ex_write_data_to_field(union acpi_operand_object *source_desc,
		   (obj_desc->field.region_obj->region.space_id ==
		    ACPI_ADR_SPACE_SMBUS
		    || obj_desc->field.region_obj->region.space_id ==
		    ACPI_ADR_SPACE_GSBUS
		    || obj_desc->field.region_obj->region.space_id ==
		    ACPI_ADR_SPACE_IPMI)) {
		/*
		 * This is an SMBus or IPMI write. We will bypass the entire field
		 * This is an SMBus, GSBus or IPMI write. We will bypass the entire field
		 * mechanism and handoff the buffer directly to the handler. For
		 * these address spaces, the buffer is bi-directional; on a write,
		 * return data is returned in the same buffer.
		 *
		 * Source must be a buffer of sufficient size:
		 * ACPI_SMBUS_BUFFER_SIZE or ACPI_IPMI_BUFFER_SIZE.
		 * ACPI_SMBUS_BUFFER_SIZE, ACPI_GSBUS_BUFFER_SIZE, or ACPI_IPMI_BUFFER_SIZE.
		 *
		 * Note: SMBus protocol type is passed in upper 16-bits of Function
		 * Note: SMBus and GSBus protocol type is passed in upper 16-bits of Function
		 */
		if (source_desc->common.type != ACPI_TYPE_BUFFER) {
			ACPI_ERROR((AE_INFO,
				    "SMBus or IPMI write requires Buffer, found type %s",
				    "SMBus/IPMI/GenericSerialBus write requires Buffer, found type %s",
				    acpi_ut_get_object_type_name(source_desc)));

			return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
@@ -273,6 +282,11 @@ acpi_ex_write_data_to_field(union acpi_operand_object *source_desc,
			length = ACPI_SMBUS_BUFFER_SIZE;
			function =
			    ACPI_WRITE | (obj_desc->field.attribute << 16);
		} else if (obj_desc->field.region_obj->region.space_id ==
			   ACPI_ADR_SPACE_GSBUS) {
			length = ACPI_GSBUS_BUFFER_SIZE;
			function =
			    ACPI_WRITE | (obj_desc->field.attribute << 16);
		} else {	/* IPMI */

			length = ACPI_IPMI_BUFFER_SIZE;
@@ -281,7 +295,7 @@ acpi_ex_write_data_to_field(union acpi_operand_object *source_desc,

		if (source_desc->buffer.length < length) {
			ACPI_ERROR((AE_INFO,
				    "SMBus or IPMI write requires Buffer of length %u, found length %u",
				    "SMBus/IPMI/GenericSerialBus write requires Buffer of length %u, found length %u",
				    length, source_desc->buffer.length));

			return_ACPI_STATUS(AE_AML_BUFFER_LIMIT);
+2 −1
Original line number Diff line number Diff line
@@ -131,10 +131,11 @@ acpi_ex_setup_region(union acpi_operand_object *obj_desc,
	}

	/*
	 * Exit now for SMBus or IPMI address space, it has a non-linear
	 * Exit now for SMBus, GSBus or IPMI address space, it has a non-linear
	 * address space and the request cannot be directly validated
	 */
	if (space_id == ACPI_ADR_SPACE_SMBUS ||
	    space_id == ACPI_ADR_SPACE_GSBUS ||
	    space_id == ACPI_ADR_SPACE_IPMI) {

		/* SMBus or IPMI has a non-linear address space */
+3 −1
Original line number Diff line number Diff line
@@ -171,7 +171,9 @@ const char *acpi_gbl_region_types[ACPI_NUM_PREDEFINED_REGIONS] = {
	"SMBus",
	"SystemCMOS",
	"PCIBARTarget",
	"IPMI"
	"IPMI",
	"GeneralPurposeIo",
	"GenericSerialBus"
};

char *acpi_ut_get_region_name(u8 space_id)
Loading