diff options
author | Jung-uk Kim <jkim@FreeBSD.org> | 2009-06-25 23:20:50 +0000 |
---|---|---|
committer | Jung-uk Kim <jkim@FreeBSD.org> | 2009-06-25 23:20:50 +0000 |
commit | 22724f14194b3fe80a6a7848da104f7916536a52 (patch) | |
tree | 90ff140546ac1c8f9223f343715887361e86492a /executer | |
parent | e83ee77d7b009e11006d75946be388f7b99f9990 (diff) | |
download | src-22724f14194b3fe80a6a7848da104f7916536a52.tar.gz src-22724f14194b3fe80a6a7848da104f7916536a52.zip |
Import ACPICA 20090625vendor/acpica/20090625
Notes
Notes:
svn path=/vendor-sys/acpica/dist/; revision=195013
svn path=/vendor-sys/acpica/20090625/; revision=195014; tag=vendor/acpica/20090625
Diffstat (limited to 'executer')
-rw-r--r-- | executer/exfield.c | 77 | ||||
-rw-r--r-- | executer/exfldio.c | 7 | ||||
-rw-r--r-- | executer/exutils.c | 59 |
3 files changed, 96 insertions, 47 deletions
diff --git a/executer/exfield.c b/executer/exfield.c index 0065bb51840f..0ee522c572a4 100644 --- a/executer/exfield.c +++ b/executer/exfield.c @@ -151,6 +151,7 @@ AcpiExReadDataFromField ( ACPI_OPERAND_OBJECT *BufferDesc; ACPI_SIZE Length; void *Buffer; + UINT32 Function; ACPI_FUNCTION_TRACE_PTR (ExReadDataFromField, ObjDesc); @@ -183,13 +184,27 @@ AcpiExReadDataFromField ( } } else if ((ObjDesc->Common.Type == ACPI_TYPE_LOCAL_REGION_FIELD) && - (ObjDesc->Field.RegionObj->Region.SpaceId == ACPI_ADR_SPACE_SMBUS)) + (ObjDesc->Field.RegionObj->Region.SpaceId == ACPI_ADR_SPACE_SMBUS || + ObjDesc->Field.RegionObj->Region.SpaceId == ACPI_ADR_SPACE_IPMI)) { /* - * This is an SMBus read. We must create a buffer to hold the data - * and directly access the region handler. + * This is an SMBus 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 */ - BufferDesc = AcpiUtCreateBufferObject (ACPI_SMBUS_BUFFER_SIZE); + if (ObjDesc->Field.RegionObj->Region.SpaceId == ACPI_ADR_SPACE_SMBUS) + { + Length = ACPI_SMBUS_BUFFER_SIZE; + Function = ACPI_READ | (ObjDesc->Field.Attribute << 16); + } + else /* IPMI */ + { + Length = ACPI_IPMI_BUFFER_SIZE; + Function = ACPI_READ; + } + + BufferDesc = AcpiUtCreateBufferObject (Length); if (!BufferDesc) { return_ACPI_STATUS (AE_NO_MEMORY); @@ -199,13 +214,11 @@ AcpiExReadDataFromField ( AcpiExAcquireGlobalLock (ObjDesc->CommonField.FieldFlags); - /* - * Perform the read. - * Note: Smbus protocol value is passed in upper 16-bits of Function - */ + /* Call the region handler for the read */ + Status = AcpiExAccessRegion (ObjDesc, 0, ACPI_CAST_PTR (ACPI_INTEGER, BufferDesc->Buffer.Pointer), - ACPI_READ | (ObjDesc->Field.Attribute << 16)); + Function); AcpiExReleaseGlobalLock (ObjDesc->CommonField.FieldFlags); goto Exit; } @@ -304,6 +317,7 @@ AcpiExWriteDataToField ( UINT32 Length; void *Buffer; ACPI_OPERAND_OBJECT *BufferDesc; + UINT32 Function; ACPI_FUNCTION_TRACE_PTR (ExWriteDataToField, ObjDesc); @@ -332,40 +346,59 @@ AcpiExWriteDataToField ( } } else if ((ObjDesc->Common.Type == ACPI_TYPE_LOCAL_REGION_FIELD) && - (ObjDesc->Field.RegionObj->Region.SpaceId == ACPI_ADR_SPACE_SMBUS)) + (ObjDesc->Field.RegionObj->Region.SpaceId == ACPI_ADR_SPACE_SMBUS || + ObjDesc->Field.RegionObj->Region.SpaceId == ACPI_ADR_SPACE_IPMI)) { /* - * This is an SMBus write. We will bypass the entire field mechanism - * and handoff the buffer directly to the handler. + * This is an SMBus 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. * - * Source must be a buffer of sufficient size (ACPI_SMBUS_BUFFER_SIZE). + * Note: SMBus protocol type is passed in upper 16-bits of Function */ if (SourceDesc->Common.Type != ACPI_TYPE_BUFFER) { - ACPI_ERROR ((AE_INFO, "SMBus write requires Buffer, found type %s", + ACPI_ERROR ((AE_INFO, + "SMBus or IPMI write requires Buffer, found type %s", AcpiUtGetObjectTypeName (SourceDesc))); return_ACPI_STATUS (AE_AML_OPERAND_TYPE); } - if (SourceDesc->Buffer.Length < ACPI_SMBUS_BUFFER_SIZE) + if (ObjDesc->Field.RegionObj->Region.SpaceId == ACPI_ADR_SPACE_SMBUS) + { + Length = ACPI_SMBUS_BUFFER_SIZE; + Function = ACPI_WRITE | (ObjDesc->Field.Attribute << 16); + } + else /* IPMI */ + { + Length = ACPI_IPMI_BUFFER_SIZE; + Function = ACPI_WRITE; + } + + if (SourceDesc->Buffer.Length < Length) { ACPI_ERROR ((AE_INFO, - "SMBus write requires Buffer of length %X, found length %X", - ACPI_SMBUS_BUFFER_SIZE, SourceDesc->Buffer.Length)); + "SMBus or IPMI write requires Buffer of length %X, found length %X", + Length, SourceDesc->Buffer.Length)); return_ACPI_STATUS (AE_AML_BUFFER_LIMIT); } - BufferDesc = AcpiUtCreateBufferObject (ACPI_SMBUS_BUFFER_SIZE); + /* Create the bi-directional buffer */ + + BufferDesc = AcpiUtCreateBufferObject (Length); if (!BufferDesc) { return_ACPI_STATUS (AE_NO_MEMORY); } Buffer = BufferDesc->Buffer.Pointer; - ACPI_MEMCPY (Buffer, SourceDesc->Buffer.Pointer, - ACPI_SMBUS_BUFFER_SIZE); + ACPI_MEMCPY (Buffer, SourceDesc->Buffer.Pointer, Length); /* Lock entire transaction if requested */ @@ -374,11 +407,9 @@ AcpiExWriteDataToField ( /* * Perform the write (returns status and perhaps data in the * same buffer) - * Note: SMBus protocol type is passed in upper 16-bits of Function. */ Status = AcpiExAccessRegion (ObjDesc, 0, - (ACPI_INTEGER *) Buffer, - ACPI_WRITE | (ObjDesc->Field.Attribute << 16)); + (ACPI_INTEGER *) Buffer, Function); AcpiExReleaseGlobalLock (ObjDesc->CommonField.FieldFlags); *ResultDesc = BufferDesc; diff --git a/executer/exfldio.c b/executer/exfldio.c index cfb02213aa9c..37a678655172 100644 --- a/executer/exfldio.c +++ b/executer/exfldio.c @@ -202,12 +202,13 @@ AcpiExSetupRegion ( } /* - * Exit now for SMBus address space, it has a non-linear address space + * Exit now for SMBus or IPMI address space, it has a non-linear address space * and the request cannot be directly validated */ - if (RgnDesc->Region.SpaceId == ACPI_ADR_SPACE_SMBUS) + if (RgnDesc->Region.SpaceId == ACPI_ADR_SPACE_SMBUS || + RgnDesc->Region.SpaceId == ACPI_ADR_SPACE_IPMI) { - /* SMBus has a non-linear address space */ + /* SMBus or IPMI has a non-linear address space */ return_ACPI_STATUS (AE_OK); } diff --git a/executer/exutils.c b/executer/exutils.c index 45b35a0c2571..1f5e861b68cb 100644 --- a/executer/exutils.c +++ b/executer/exutils.c @@ -482,59 +482,76 @@ AcpiExDigitsNeeded ( * * FUNCTION: AcpiExEisaIdToString * - * PARAMETERS: NumericId - EISA ID to be converted + * PARAMETERS: CompressedId - EISAID to be converted * OutString - Where to put the converted string (8 bytes) * * RETURN: None * - * DESCRIPTION: Convert a numeric EISA ID to string representation + * DESCRIPTION: Convert a numeric EISAID to string representation. Return + * buffer must be large enough to hold the string. The string + * returned is always exactly of length ACPI_EISAID_STRING_SIZE + * (includes null terminator). The EISAID is always 32 bits. * ******************************************************************************/ void AcpiExEisaIdToString ( - UINT32 NumericId, - char *OutString) + char *OutString, + ACPI_INTEGER CompressedId) { - UINT32 EisaId; + UINT32 SwappedId; ACPI_FUNCTION_ENTRY (); + /* The EISAID should be a 32-bit integer */ + + if (CompressedId > ACPI_UINT32_MAX) + { + ACPI_WARNING ((AE_INFO, + "Expected EISAID is larger than 32 bits: 0x%8.8X%8.8X, truncating", + ACPI_FORMAT_UINT64 (CompressedId))); + } + /* Swap ID to big-endian to get contiguous bits */ - EisaId = AcpiUtDwordByteSwap (NumericId); + SwappedId = AcpiUtDwordByteSwap ((UINT32) CompressedId); - OutString[0] = (char) ('@' + (((unsigned long) EisaId >> 26) & 0x1f)); - OutString[1] = (char) ('@' + ((EisaId >> 21) & 0x1f)); - OutString[2] = (char) ('@' + ((EisaId >> 16) & 0x1f)); - OutString[3] = AcpiUtHexToAsciiChar ((ACPI_INTEGER) EisaId, 12); - OutString[4] = AcpiUtHexToAsciiChar ((ACPI_INTEGER) EisaId, 8); - OutString[5] = AcpiUtHexToAsciiChar ((ACPI_INTEGER) EisaId, 4); - OutString[6] = AcpiUtHexToAsciiChar ((ACPI_INTEGER) EisaId, 0); + /* First 3 bytes are uppercase letters. Next 4 bytes are hexadecimal */ + + OutString[0] = (char) (0x40 + (((unsigned long) SwappedId >> 26) & 0x1F)); + OutString[1] = (char) (0x40 + ((SwappedId >> 21) & 0x1F)); + OutString[2] = (char) (0x40 + ((SwappedId >> 16) & 0x1F)); + OutString[3] = AcpiUtHexToAsciiChar ((ACPI_INTEGER) SwappedId, 12); + OutString[4] = AcpiUtHexToAsciiChar ((ACPI_INTEGER) SwappedId, 8); + OutString[5] = AcpiUtHexToAsciiChar ((ACPI_INTEGER) SwappedId, 4); + OutString[6] = AcpiUtHexToAsciiChar ((ACPI_INTEGER) SwappedId, 0); OutString[7] = 0; } /******************************************************************************* * - * FUNCTION: AcpiExUnsignedIntegerToString + * FUNCTION: AcpiExIntegerToString * - * PARAMETERS: Value - Value to be converted - * OutString - Where to put the converted string (8 bytes) + * PARAMETERS: OutString - Where to put the converted string. At least + * 21 bytes are needed to hold the largest + * possible 64-bit integer. + * Value - Value to be converted * * RETURN: None, string * - * DESCRIPTION: Convert a number to string representation. Assumes string - * buffer is large enough to hold the string. + * DESCRIPTION: Convert a 64-bit integer to decimal string representation. + * Assumes string buffer is large enough to hold the string. The + * largest string is (ACPI_MAX64_DECIMAL_DIGITS + 1). * ******************************************************************************/ void -AcpiExUnsignedIntegerToString ( - ACPI_INTEGER Value, - char *OutString) +AcpiExIntegerToString ( + char *OutString, + ACPI_INTEGER Value) { UINT32 Count; UINT32 DigitsNeeded; |