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

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
...@@ -202,9 +202,10 @@ ...@@ -202,9 +202,10 @@
#define ACPI_RSDP_CHECKSUM_LENGTH 20 #define ACPI_RSDP_CHECKSUM_LENGTH 20
#define ACPI_RSDP_XCHECKSUM_LENGTH 36 #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_SMBUS_BUFFER_SIZE 34
#define ACPI_GSBUS_BUFFER_SIZE 34
#define ACPI_IPMI_BUFFER_SIZE 66 #define ACPI_IPMI_BUFFER_SIZE 66
/* _sx_d and _sx_w control methods */ /* _sx_d and _sx_w control methods */
......
...@@ -466,13 +466,16 @@ typedef enum { ...@@ -466,13 +466,16 @@ typedef enum {
* access_as keyword * access_as keyword
*/ */
typedef enum { typedef enum {
AML_FIELD_ATTRIB_SMB_QUICK = 0x02, AML_FIELD_ATTRIB_QUICK = 0x02,
AML_FIELD_ATTRIB_SMB_SEND_RCV = 0x04, AML_FIELD_ATTRIB_SEND_RCV = 0x04,
AML_FIELD_ATTRIB_SMB_BYTE = 0x06, AML_FIELD_ATTRIB_BYTE = 0x06,
AML_FIELD_ATTRIB_SMB_WORD = 0x08, AML_FIELD_ATTRIB_WORD = 0x08,
AML_FIELD_ATTRIB_SMB_BLOCK = 0x0A, AML_FIELD_ATTRIB_BLOCK = 0x0A,
AML_FIELD_ATTRIB_SMB_WORD_CALL = 0x0C, AML_FIELD_ATTRIB_MULTIBYTE = 0x0B,
AML_FIELD_ATTRIB_SMB_BLOCK_CALL = 0x0D 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; } AML_ACCESS_ATTRIBUTE;
/* Bit fields in the AML method_flags byte */ /* Bit fields in the AML method_flags byte */
......
...@@ -100,18 +100,25 @@ acpi_ex_read_data_from_field(struct acpi_walk_state *walk_state, ...@@ -100,18 +100,25 @@ acpi_ex_read_data_from_field(struct acpi_walk_state *walk_state,
(obj_desc->field.region_obj->region.space_id == (obj_desc->field.region_obj->region.space_id ==
ACPI_ADR_SPACE_SMBUS ACPI_ADR_SPACE_SMBUS
|| obj_desc->field.region_obj->region.space_id == || 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)) {
/* /*
* 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. * 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 == if (obj_desc->field.region_obj->region.space_id ==
ACPI_ADR_SPACE_SMBUS) { ACPI_ADR_SPACE_SMBUS) {
length = ACPI_SMBUS_BUFFER_SIZE; length = ACPI_SMBUS_BUFFER_SIZE;
function = function =
ACPI_READ | (obj_desc->field.attribute << 16); 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 */ } else { /* IPMI */
length = ACPI_IPMI_BUFFER_SIZE; length = ACPI_IPMI_BUFFER_SIZE;
...@@ -248,21 +255,23 @@ acpi_ex_write_data_to_field(union acpi_operand_object *source_desc, ...@@ -248,21 +255,23 @@ acpi_ex_write_data_to_field(union acpi_operand_object *source_desc,
(obj_desc->field.region_obj->region.space_id == (obj_desc->field.region_obj->region.space_id ==
ACPI_ADR_SPACE_SMBUS ACPI_ADR_SPACE_SMBUS
|| obj_desc->field.region_obj->region.space_id == || 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)) {
/* /*
* 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 * mechanism and handoff the buffer directly to the handler. For
* these address spaces, the buffer is bi-directional; on a write, * these address spaces, the buffer is bi-directional; on a write,
* return data is returned in the same buffer. * return data is returned in the same buffer.
* *
* Source must be a buffer of sufficient size: * 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) { if (source_desc->common.type != ACPI_TYPE_BUFFER) {
ACPI_ERROR((AE_INFO, 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))); acpi_ut_get_object_type_name(source_desc)));
return_ACPI_STATUS(AE_AML_OPERAND_TYPE); return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
...@@ -273,6 +282,11 @@ acpi_ex_write_data_to_field(union acpi_operand_object *source_desc, ...@@ -273,6 +282,11 @@ acpi_ex_write_data_to_field(union acpi_operand_object *source_desc,
length = ACPI_SMBUS_BUFFER_SIZE; length = ACPI_SMBUS_BUFFER_SIZE;
function = function =
ACPI_WRITE | (obj_desc->field.attribute << 16); 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 */ } else { /* IPMI */
length = ACPI_IPMI_BUFFER_SIZE; length = ACPI_IPMI_BUFFER_SIZE;
...@@ -281,7 +295,7 @@ acpi_ex_write_data_to_field(union acpi_operand_object *source_desc, ...@@ -281,7 +295,7 @@ acpi_ex_write_data_to_field(union acpi_operand_object *source_desc,
if (source_desc->buffer.length < length) { if (source_desc->buffer.length < length) {
ACPI_ERROR((AE_INFO, 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)); length, source_desc->buffer.length));
return_ACPI_STATUS(AE_AML_BUFFER_LIMIT); return_ACPI_STATUS(AE_AML_BUFFER_LIMIT);
......
...@@ -131,10 +131,11 @@ acpi_ex_setup_region(union acpi_operand_object *obj_desc, ...@@ -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 * address space and the request cannot be directly validated
*/ */
if (space_id == ACPI_ADR_SPACE_SMBUS || if (space_id == ACPI_ADR_SPACE_SMBUS ||
space_id == ACPI_ADR_SPACE_GSBUS ||
space_id == ACPI_ADR_SPACE_IPMI) { space_id == ACPI_ADR_SPACE_IPMI) {
/* SMBus or IPMI has a non-linear address space */ /* SMBus or IPMI has a non-linear address space */
......
...@@ -171,7 +171,9 @@ const char *acpi_gbl_region_types[ACPI_NUM_PREDEFINED_REGIONS] = { ...@@ -171,7 +171,9 @@ const char *acpi_gbl_region_types[ACPI_NUM_PREDEFINED_REGIONS] = {
"SMBus", "SMBus",
"SystemCMOS", "SystemCMOS",
"PCIBARTarget", "PCIBARTarget",
"IPMI" "IPMI",
"GeneralPurposeIo",
"GenericSerialBus"
}; };
char *acpi_ut_get_region_name(u8 space_id) char *acpi_ut_get_region_name(u8 space_id)
......
...@@ -712,8 +712,10 @@ typedef u8 acpi_adr_space_type; ...@@ -712,8 +712,10 @@ typedef u8 acpi_adr_space_type;
#define ACPI_ADR_SPACE_CMOS (acpi_adr_space_type) 5 #define ACPI_ADR_SPACE_CMOS (acpi_adr_space_type) 5
#define ACPI_ADR_SPACE_PCI_BAR_TARGET (acpi_adr_space_type) 6 #define ACPI_ADR_SPACE_PCI_BAR_TARGET (acpi_adr_space_type) 6
#define ACPI_ADR_SPACE_IPMI (acpi_adr_space_type) 7 #define ACPI_ADR_SPACE_IPMI (acpi_adr_space_type) 7
#define ACPI_ADR_SPACE_GPIO (acpi_adr_space_type) 8
#define ACPI_ADR_SPACE_GSBUS (acpi_adr_space_type) 9
#define ACPI_NUM_PREDEFINED_REGIONS 8 #define ACPI_NUM_PREDEFINED_REGIONS 10
/* /*
* Special Address Spaces * Special Address Spaces
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment