diff options
author | Jung-uk Kim <jkim@FreeBSD.org> | 2015-11-25 21:04:42 +0000 |
---|---|---|
committer | Jung-uk Kim <jkim@FreeBSD.org> | 2015-11-25 21:04:42 +0000 |
commit | b9098066cd6284319bca922f13e59517f774a103 (patch) | |
tree | f01fd6c9053cb01ed84c00cb42ee789adafceaf5 /source/components/resources | |
parent | 1e24cf365bc9c8df179b145c90d52852724e54ee (diff) |
Notes
Diffstat (limited to 'source/components/resources')
-rw-r--r-- | source/components/resources/rsaddr.c | 27 | ||||
-rw-r--r-- | source/components/resources/rscalc.c | 63 | ||||
-rw-r--r-- | source/components/resources/rscreate.c | 49 | ||||
-rw-r--r-- | source/components/resources/rsdump.c | 15 | ||||
-rw-r--r-- | source/components/resources/rslist.c | 25 | ||||
-rw-r--r-- | source/components/resources/rsmisc.c | 51 | ||||
-rw-r--r-- | source/components/resources/rsutils.c | 65 | ||||
-rw-r--r-- | source/components/resources/rsxface.c | 15 |
8 files changed, 173 insertions, 137 deletions
diff --git a/source/components/resources/rsaddr.c b/source/components/resources/rsaddr.c index 0ec02ef793f57..260f6c2dfd6f7 100644 --- a/source/components/resources/rsaddr.c +++ b/source/components/resources/rsaddr.c @@ -328,30 +328,35 @@ AcpiRsGetAddressCommon ( /* Validate the Resource Type */ - if ((Aml->Address.ResourceType > 2) && (Aml->Address.ResourceType < 0xC0)) + if ((Aml->Address.ResourceType > 2) && + (Aml->Address.ResourceType < 0xC0)) { return (FALSE); } /* Get the Resource Type and General Flags */ - (void) AcpiRsConvertAmlToResource (Resource, Aml, AcpiRsConvertGeneralFlags); + (void) AcpiRsConvertAmlToResource ( + Resource, Aml, AcpiRsConvertGeneralFlags); /* Get the Type-Specific Flags (Memory and I/O descriptors only) */ if (Resource->Data.Address.ResourceType == ACPI_MEMORY_RANGE) { - (void) AcpiRsConvertAmlToResource (Resource, Aml, AcpiRsConvertMemFlags); + (void) AcpiRsConvertAmlToResource ( + Resource, Aml, AcpiRsConvertMemFlags); } else if (Resource->Data.Address.ResourceType == ACPI_IO_RANGE) { - (void) AcpiRsConvertAmlToResource (Resource, Aml, AcpiRsConvertIoFlags); + (void) AcpiRsConvertAmlToResource ( + Resource, Aml, AcpiRsConvertIoFlags); } else { /* Generic resource type, just grab the TypeSpecific byte */ - Resource->Data.Address.Info.TypeSpecific = Aml->Address.SpecificFlags; + Resource->Data.Address.Info.TypeSpecific = + Aml->Address.SpecificFlags; } return (TRUE); @@ -382,22 +387,26 @@ AcpiRsSetAddressCommon ( /* Set the Resource Type and General Flags */ - (void) AcpiRsConvertResourceToAml (Resource, Aml, AcpiRsConvertGeneralFlags); + (void) AcpiRsConvertResourceToAml ( + Resource, Aml, AcpiRsConvertGeneralFlags); /* Set the Type-Specific Flags (Memory and I/O descriptors only) */ if (Resource->Data.Address.ResourceType == ACPI_MEMORY_RANGE) { - (void) AcpiRsConvertResourceToAml (Resource, Aml, AcpiRsConvertMemFlags); + (void) AcpiRsConvertResourceToAml ( + Resource, Aml, AcpiRsConvertMemFlags); } else if (Resource->Data.Address.ResourceType == ACPI_IO_RANGE) { - (void) AcpiRsConvertResourceToAml (Resource, Aml, AcpiRsConvertIoFlags); + (void) AcpiRsConvertResourceToAml ( + Resource, Aml, AcpiRsConvertIoFlags); } else { /* Generic resource type, just copy the TypeSpecific byte */ - Aml->Address.SpecificFlags = Resource->Data.Address.Info.TypeSpecific; + Aml->Address.SpecificFlags = + Resource->Data.Address.Info.TypeSpecific; } } diff --git a/source/components/resources/rscalc.c b/source/components/resources/rscalc.c index d41dfeed78a42..5d3a92efc0d90 100644 --- a/source/components/resources/rscalc.c +++ b/source/components/resources/rscalc.c @@ -164,16 +164,17 @@ AcpiRsStreamOptionLength ( /* - * The ResourceSourceIndex and ResourceSource are optional elements of some - * Large-type resource descriptors. + * The ResourceSourceIndex and ResourceSource are optional elements of + * some Large-type resource descriptors. */ /* - * If the length of the actual resource descriptor is greater than the ACPI - * spec-defined minimum length, it means that a ResourceSourceIndex exists - * and is followed by a (required) null terminated string. The string length - * (including the null terminator) is the resource length minus the minimum - * length, minus one byte for the ResourceSourceIndex itself. + * If the length of the actual resource descriptor is greater than the + * ACPI spec-defined minimum length, it means that a ResourceSourceIndex + * exists and is followed by a (required) null terminated string. The + * string length (including the null terminator) is the resource length + * minus the minimum length, minus one byte for the ResourceSourceIndex + * itself. */ if (ResourceLength > MinimumAmlResourceLength) { @@ -309,9 +310,9 @@ AcpiRsGetAmlLength ( * 16-Bit Address Resource: * Add the size of the optional ResourceSource info */ - TotalSize = (ACPI_RS_LENGTH) - (TotalSize + AcpiRsStructOptionLength ( - &Resource->Data.Address16.ResourceSource)); + TotalSize = (ACPI_RS_LENGTH) (TotalSize + + AcpiRsStructOptionLength ( + &Resource->Data.Address16.ResourceSource)); break; @@ -320,9 +321,9 @@ AcpiRsGetAmlLength ( * 32-Bit Address Resource: * Add the size of the optional ResourceSource info */ - TotalSize = (ACPI_RS_LENGTH) - (TotalSize + AcpiRsStructOptionLength ( - &Resource->Data.Address32.ResourceSource)); + TotalSize = (ACPI_RS_LENGTH) (TotalSize + + AcpiRsStructOptionLength ( + &Resource->Data.Address32.ResourceSource)); break; @@ -331,9 +332,9 @@ AcpiRsGetAmlLength ( * 64-Bit Address Resource: * Add the size of the optional ResourceSource info */ - TotalSize = (ACPI_RS_LENGTH) - (TotalSize + AcpiRsStructOptionLength ( - &Resource->Data.Address64.ResourceSource)); + TotalSize = (ACPI_RS_LENGTH) (TotalSize + + AcpiRsStructOptionLength ( + &Resource->Data.Address64.ResourceSource)); break; @@ -343,8 +344,7 @@ AcpiRsGetAmlLength ( * Add the size of each additional optional interrupt beyond the * required 1 (4 bytes for each UINT32 interrupt number) */ - TotalSize = (ACPI_RS_LENGTH) - (TotalSize + + TotalSize = (ACPI_RS_LENGTH) (TotalSize + ((Resource->Data.ExtendedIrq.InterruptCount - 1) * 4) + /* Add the size of the optional ResourceSource info */ @@ -356,7 +356,8 @@ AcpiRsGetAmlLength ( case ACPI_RESOURCE_TYPE_GPIO: - TotalSize = (ACPI_RS_LENGTH) (TotalSize + (Resource->Data.Gpio.PinTableLength * 2) + + TotalSize = (ACPI_RS_LENGTH) (TotalSize + + (Resource->Data.Gpio.PinTableLength * 2) + Resource->Data.Gpio.ResourceSource.StringLength + Resource->Data.Gpio.VendorLength); @@ -365,7 +366,8 @@ AcpiRsGetAmlLength ( case ACPI_RESOURCE_TYPE_SERIAL_BUS: - TotalSize = AcpiGbl_AmlResourceSerialBusSizes [Resource->Data.CommonSerialBus.Type]; + TotalSize = AcpiGbl_AmlResourceSerialBusSizes [ + Resource->Data.CommonSerialBus.Type]; TotalSize = (ACPI_RS_LENGTH) (TotalSize + Resource->Data.I2cSerialBus.ResourceSource.StringLength + @@ -544,12 +546,15 @@ AcpiRsGetListLength ( if (AmlResource->Gpio.VendorLength) { - ExtraStructBytes += AmlResource->Gpio.VendorOffset - - AmlResource->Gpio.PinTableOffset + AmlResource->Gpio.VendorLength; + ExtraStructBytes += + AmlResource->Gpio.VendorOffset - + AmlResource->Gpio.PinTableOffset + + AmlResource->Gpio.VendorLength; } else { - ExtraStructBytes += AmlResource->LargeHeader.ResourceLength + + ExtraStructBytes += + AmlResource->LargeHeader.ResourceLength + sizeof (AML_RESOURCE_LARGE_HEADER) - AmlResource->Gpio.PinTableOffset; } @@ -559,7 +564,8 @@ AcpiRsGetListLength ( MinimumAmlResourceLength = AcpiGbl_ResourceAmlSerialBusSizes[ AmlResource->CommonSerialBus.Type]; - ExtraStructBytes += AmlResource->CommonSerialBus.ResourceLength - + ExtraStructBytes += + AmlResource->CommonSerialBus.ResourceLength - MinimumAmlResourceLength; break; @@ -574,7 +580,8 @@ AcpiRsGetListLength ( * Important: Round the size up for the appropriate alignment. This * is a requirement on IA64. */ - if (AcpiUtGetResourceType (AmlBuffer) == ACPI_RESOURCE_NAME_SERIAL_BUS) + if (AcpiUtGetResourceType (AmlBuffer) == + ACPI_RESOURCE_NAME_SERIAL_BUS) { BufferSize = AcpiGbl_ResourceStructSerialBusSizes[ AmlResource->CommonSerialBus.Type] + ExtraStructBytes; @@ -582,10 +589,10 @@ AcpiRsGetListLength ( else { BufferSize = AcpiGbl_ResourceStructSizes[ResourceIndex] + - ExtraStructBytes; + ExtraStructBytes; } - BufferSize = (UINT32) ACPI_ROUND_UP_TO_NATIVE_WORD (BufferSize); + BufferSize = (UINT32) ACPI_ROUND_UP_TO_NATIVE_WORD (BufferSize); *SizeNeeded += BufferSize; ACPI_DEBUG_PRINT ((ACPI_DB_RESOURCES, @@ -722,7 +729,7 @@ AcpiRsGetPciRoutingTableLength ( else { TempSizeNeeded += AcpiNsGetPathnameLength ( - (*SubObjectList)->Reference.Node); + (*SubObjectList)->Reference.Node); } } else diff --git a/source/components/resources/rscreate.c b/source/components/resources/rscreate.c index 926d79b768c8e..3107ad43e2e40 100644 --- a/source/components/resources/rscreate.c +++ b/source/components/resources/rscreate.c @@ -86,8 +86,8 @@ AcpiBufferToResource ( /* Get the required length for the converted resource */ - Status = AcpiRsGetListLength (AmlBuffer, AmlBufferLength, - &ListSizeNeeded); + Status = AcpiRsGetListLength ( + AmlBuffer, AmlBufferLength, &ListSizeNeeded); if (Status == AE_AML_NO_RESOURCE_END_TAG) { Status = AE_OK; @@ -109,7 +109,7 @@ AcpiBufferToResource ( /* Perform the AML-to-Resource conversion */ Status = AcpiUtWalkAmlResources (NULL, AmlBuffer, AmlBufferLength, - AcpiRsConvertAmlToResources, &CurrentResourcePtr); + AcpiRsConvertAmlToResources, &CurrentResourcePtr); if (Status == AE_AML_NO_RESOURCE_END_TAG) { Status = AE_OK; @@ -197,14 +197,14 @@ AcpiRsCreateResourceList ( Resource = OutputBuffer->Pointer; Status = AcpiUtWalkAmlResources (NULL, AmlStart, AmlBufferLength, - AcpiRsConvertAmlToResources, &Resource); + AcpiRsConvertAmlToResources, &Resource); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); } ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "OutputBuffer %p Length %X\n", - OutputBuffer->Pointer, (UINT32) OutputBuffer->Length)); + OutputBuffer->Pointer, (UINT32) OutputBuffer->Length)); return_ACPI_STATUS (AE_OK); } @@ -255,8 +255,8 @@ AcpiRsCreatePciRoutingTable ( /* Get the required buffer length */ - Status = AcpiRsGetPciRoutingTableLength (PackageObject, - &BufferSizeNeeded); + Status = AcpiRsGetPciRoutingTableLength ( + PackageObject,&BufferSizeNeeded); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); @@ -278,10 +278,10 @@ AcpiRsCreatePciRoutingTable ( * package that in turn contains an UINT64 Address, a UINT8 Pin, * a Name, and a UINT8 SourceIndex. */ - TopObjectList = PackageObject->Package.Elements; + TopObjectList = PackageObject->Package.Elements; NumberOfElements = PackageObject->Package.Count; - Buffer = OutputBuffer->Pointer; - UserPrt = ACPI_CAST_PTR (ACPI_PCI_ROUTING_TABLE, Buffer); + Buffer = OutputBuffer->Pointer; + UserPrt = ACPI_CAST_PTR (ACPI_PCI_ROUTING_TABLE, Buffer); for (Index = 0; Index < NumberOfElements; Index++) { @@ -295,9 +295,9 @@ AcpiRsCreatePciRoutingTable ( UserPrt = ACPI_CAST_PTR (ACPI_PCI_ROUTING_TABLE, Buffer); /* - * Fill in the Length field with the information we have at this point. - * The minus four is to subtract the size of the UINT8 Source[4] member - * because it is added below. + * Fill in the Length field with the information we have at this + * point. The minus four is to subtract the size of the UINT8 + * Source[4] member because it is added below. */ UserPrt->Length = (sizeof (ACPI_PCI_ROUTING_TABLE) - 4); @@ -323,7 +323,8 @@ AcpiRsCreatePciRoutingTable ( ObjDesc = SubObjectList[0]; if (!ObjDesc || ObjDesc->Common.Type != ACPI_TYPE_INTEGER) { - ACPI_ERROR ((AE_INFO, "(PRT[%u].Address) Need Integer, found %s", + ACPI_ERROR ((AE_INFO, + "(PRT[%u].Address) Need Integer, found %s", Index, AcpiUtGetObjectTypeName (ObjDesc))); return_ACPI_STATUS (AE_BAD_DATA); } @@ -366,12 +367,12 @@ AcpiRsCreatePciRoutingTable ( /* Use *remaining* length of the buffer as max for pathname */ PathBuffer.Length = OutputBuffer->Length - - (UINT32) ((UINT8 *) UserPrt->Source - - (UINT8 *) OutputBuffer->Pointer); + (UINT32) ((UINT8 *) UserPrt->Source - + (UINT8 *) OutputBuffer->Pointer); PathBuffer.Pointer = UserPrt->Source; - Status = AcpiNsHandleToPathname ((ACPI_HANDLE) Node, - &PathBuffer, FALSE); + Status = AcpiNsHandleToPathname ( + (ACPI_HANDLE) Node, &PathBuffer, FALSE); /* +1 to include null terminator */ @@ -391,8 +392,8 @@ AcpiRsCreatePciRoutingTable ( case ACPI_TYPE_INTEGER: /* - * If this is a number, then the Source Name is NULL, since the - * entire buffer was zeroed out, we can leave this alone. + * If this is a number, then the Source Name is NULL, since + * the entire buffer was zeroed out, we can leave this alone. * * Add to the Length field the length of the UINT32 NULL */ @@ -431,7 +432,7 @@ AcpiRsCreatePciRoutingTable ( } ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "OutputBuffer %p Length %X\n", - OutputBuffer->Pointer, (UINT32) OutputBuffer->Length)); + OutputBuffer->Pointer, (UINT32) OutputBuffer->Length)); return_ACPI_STATUS (AE_OK); } @@ -472,8 +473,8 @@ AcpiRsCreateAmlResources ( /* Get the buffer size needed for the AML byte stream */ - Status = AcpiRsGetAmlLength (ResourceList->Pointer, - ResourceList->Length, &AmlSizeNeeded); + Status = AcpiRsGetAmlLength ( + ResourceList->Pointer, ResourceList->Length, &AmlSizeNeeded); ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "AmlSizeNeeded=%X, %s\n", (UINT32) AmlSizeNeeded, AcpiFormatException (Status))); @@ -493,7 +494,7 @@ AcpiRsCreateAmlResources ( /* Do the conversion */ Status = AcpiRsConvertResourcesToAml (ResourceList->Pointer, - AmlSizeNeeded, OutputBuffer->Pointer); + AmlSizeNeeded, OutputBuffer->Pointer); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); diff --git a/source/components/resources/rsdump.c b/source/components/resources/rsdump.c index 6663317283294..04874c74233fd 100644 --- a/source/components/resources/rsdump.c +++ b/source/components/resources/rsdump.c @@ -545,6 +545,7 @@ AcpiRsOutString ( char *Title, char *Value) { + AcpiOsPrintf ("%27s : %s", Title, Value); if (!*Value) { @@ -566,6 +567,7 @@ AcpiRsOutInteger16 ( char *Title, UINT16 Value) { + AcpiOsPrintf ("%27s : %4.4X\n", Title, Value); } @@ -574,6 +576,7 @@ AcpiRsOutInteger32 ( char *Title, UINT32 Value) { + AcpiOsPrintf ("%27s : %8.8X\n", Title, Value); } @@ -582,6 +585,7 @@ AcpiRsOutInteger64 ( char *Title, UINT64 Value) { + AcpiOsPrintf ("%27s : %8.8X%8.8X\n", Title, ACPI_FORMAT_UINT64 (Value)); } @@ -590,6 +594,7 @@ static void AcpiRsOutTitle ( char *Title) { + AcpiOsPrintf ("%27s : ", Title); } @@ -617,8 +622,7 @@ AcpiRsDumpByteList ( for (i = 0; i < Length; i++) { - AcpiOsPrintf ("%25s%2.2X : %2.2X\n", - "Byte", i, Data[i]); + AcpiOsPrintf ("%25s%2.2X : %2.2X\n", "Byte", i, Data[i]); } } @@ -634,6 +638,7 @@ AcpiRsDumpShortByteList ( { AcpiOsPrintf ("%X ", Data[i]); } + AcpiOsPrintf ("\n"); } @@ -647,8 +652,7 @@ AcpiRsDumpDwordList ( for (i = 0; i < Length; i++) { - AcpiOsPrintf ("%25s%2.2X : %8.8X\n", - "Dword", i, Data[i]); + AcpiOsPrintf ("%25s%2.2X : %8.8X\n", "Dword", i, Data[i]); } } @@ -662,7 +666,6 @@ AcpiRsDumpWordList ( for (i = 0; i < Length; i++) { - AcpiOsPrintf ("%25s%2.2X : %4.4X\n", - "Word", i, Data[i]); + AcpiOsPrintf ("%25s%2.2X : %4.4X\n", "Word", i, Data[i]); } } diff --git a/source/components/resources/rslist.c b/source/components/resources/rslist.c index db910acd4c9c0..412835ff3129a 100644 --- a/source/components/resources/rslist.c +++ b/source/components/resources/rslist.c @@ -97,9 +97,12 @@ AcpiRsConvertAmlToResources ( /* Get the appropriate conversion info table */ AmlResource = ACPI_CAST_PTR (AML_RESOURCE, Aml); - if (AcpiUtGetResourceType (Aml) == ACPI_RESOURCE_NAME_SERIAL_BUS) + + if (AcpiUtGetResourceType (Aml) == + ACPI_RESOURCE_NAME_SERIAL_BUS) { - if (AmlResource->CommonSerialBus.Type > AML_RESOURCE_MAX_SERIALBUSTYPE) + if (AmlResource->CommonSerialBus.Type > + AML_RESOURCE_MAX_SERIALBUSTYPE) { ConversionTable = NULL; } @@ -107,15 +110,13 @@ AcpiRsConvertAmlToResources ( { /* This is an I2C, SPI, or UART SerialBus descriptor */ - ConversionTable = - AcpiGbl_ConvertResourceSerialBusDispatch[ - AmlResource->CommonSerialBus.Type]; + ConversionTable = AcpiGbl_ConvertResourceSerialBusDispatch [ + AmlResource->CommonSerialBus.Type]; } } else { - ConversionTable = - AcpiGbl_GetResourceDispatch[ResourceIndex]; + ConversionTable = AcpiGbl_GetResourceDispatch[ResourceIndex]; } if (!ConversionTable) @@ -210,7 +211,8 @@ AcpiRsConvertResourcesToAml ( if (Resource->Type == ACPI_RESOURCE_TYPE_SERIAL_BUS) { - if (Resource->Data.CommonSerialBus.Type > AML_RESOURCE_MAX_SERIALBUSTYPE) + if (Resource->Data.CommonSerialBus.Type > + AML_RESOURCE_MAX_SERIALBUSTYPE) { ConversionTable = NULL; } @@ -236,8 +238,7 @@ AcpiRsConvertResourcesToAml ( } Status = AcpiRsConvertResourceToAml (Resource, - ACPI_CAST_PTR (AML_RESOURCE, Aml), - ConversionTable); + ACPI_CAST_PTR (AML_RESOURCE, Aml), ConversionTable); if (ACPI_FAILURE (Status)) { ACPI_EXCEPTION ((AE_INFO, Status, @@ -248,8 +249,8 @@ AcpiRsConvertResourcesToAml ( /* Perform final sanity check on the new AML resource descriptor */ - Status = AcpiUtValidateResource (NULL, - ACPI_CAST_PTR (AML_RESOURCE, Aml), NULL); + Status = AcpiUtValidateResource ( + NULL, ACPI_CAST_PTR (AML_RESOURCE, Aml), NULL); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); diff --git a/source/components/resources/rsmisc.c b/source/components/resources/rsmisc.c index 83f50aa95dacd..a47a8cce25667 100644 --- a/source/components/resources/rsmisc.c +++ b/source/components/resources/rsmisc.c @@ -121,7 +121,7 @@ AcpiRsConvertAmlToResource ( * Source is the external AML byte stream buffer, * destination is the internal resource descriptor */ - Source = ACPI_ADD_PTR (void, Aml, Info->AmlOffset); + Source = ACPI_ADD_PTR (void, Aml, Info->AmlOffset); Destination = ACPI_ADD_PTR (void, Resource, Info->ResourceOffset); switch (Info->Opcode) @@ -200,8 +200,7 @@ AcpiRsConvertAmlToResource ( ItemCount = ACPI_GET8 (Source); ACPI_SET8 (Destination, ItemCount); - Resource->Length = Resource->Length + - (Info->Value * ItemCount); + Resource->Length = Resource->Length + (Info->Value * ItemCount); break; case ACPI_RSC_COUNT_GPIO_RES: @@ -273,7 +272,7 @@ AcpiRsConvertAmlToResource ( /* Generate and set the PIN data pointer */ Target = (char *) ACPI_ADD_PTR (void, Resource, - (Resource->Length - ItemCount * 2)); + (Resource->Length - ItemCount * 2)); *(UINT16 **) Destination = ACPI_CAST_PTR (UINT16, Target); /* Copy the PIN data */ @@ -287,7 +286,7 @@ AcpiRsConvertAmlToResource ( /* Generate and set the ResourceSource string pointer */ Target = (char *) ACPI_ADD_PTR (void, Resource, - (Resource->Length - ItemCount)); + (Resource->Length - ItemCount)); *(UINT8 **) Destination = ACPI_CAST_PTR (UINT8, Target); /* Copy the ResourceSource string */ @@ -301,7 +300,7 @@ AcpiRsConvertAmlToResource ( /* Generate and set the Vendor Data pointer */ Target = (char *) ACPI_ADD_PTR (void, Resource, - (Resource->Length - ItemCount)); + (Resource->Length - ItemCount)); *(UINT8 **) Destination = ACPI_CAST_PTR (UINT8, Target); /* Copy the Vendor Data */ @@ -315,12 +314,13 @@ AcpiRsConvertAmlToResource ( /* Generate and set the ResourceSource string pointer */ Target = (char *) ACPI_ADD_PTR (void, Resource, - (Resource->Length - ItemCount)); + (Resource->Length - ItemCount)); *(UINT8 **) Destination = ACPI_CAST_PTR (UINT8, Target); /* Copy the ResourceSource string */ - Source = ACPI_ADD_PTR (void, Aml, (ACPI_GET16 (Source) + Info->Value)); + Source = ACPI_ADD_PTR ( + void, Aml, (ACPI_GET16 (Source) + Info->Value)); AcpiRsMoveData (Target, Source, ItemCount, Info->Opcode); break; @@ -442,7 +442,8 @@ Exit: { /* Round the resource struct length up to the next boundary (32 or 64) */ - Resource->Length = (UINT32) ACPI_ROUND_UP_TO_NATIVE_WORD (Resource->Length); + Resource->Length = (UINT32) + ACPI_ROUND_UP_TO_NATIVE_WORD (Resource->Length); } return_ACPI_STATUS (AE_OK); } @@ -498,7 +499,7 @@ AcpiRsConvertResourceToAml ( * Source is the internal resource descriptor, * destination is the external AML byte stream buffer */ - Source = ACPI_ADD_PTR (void, Resource, Info->ResourceOffset); + Source = ACPI_ADD_PTR (void, Resource, Info->ResourceOffset); Destination = ACPI_ADD_PTR (void, Aml, Info->AmlOffset); switch (Info->Opcode) @@ -507,7 +508,8 @@ AcpiRsConvertResourceToAml ( memset (Aml, 0, INIT_RESOURCE_LENGTH (Info)); AmlLength = INIT_RESOURCE_LENGTH (Info); - AcpiRsSetResourceHeader (INIT_RESOURCE_TYPE (Info), AmlLength, Aml); + AcpiRsSetResourceHeader ( + INIT_RESOURCE_TYPE (Info), AmlLength, Aml); break; case ACPI_RSC_INITGET: @@ -549,7 +551,8 @@ AcpiRsConvertResourceToAml ( ItemCount = ACPI_GET8 (Source); ACPI_SET8 (Destination, ItemCount); - AmlLength = (UINT16) (AmlLength + (Info->Value * (ItemCount - 1))); + AmlLength = (UINT16) + (AmlLength + (Info->Value * (ItemCount - 1))); break; case ACPI_RSC_COUNT16: @@ -575,7 +578,8 @@ AcpiRsConvertResourceToAml ( ItemCount = ACPI_GET16 (Source); ACPI_SET16 (Destination, ItemCount); - AmlLength = (UINT16) (AmlLength + (Info->Value * ItemCount)); + AmlLength = (UINT16) ( + AmlLength + (Info->Value * ItemCount)); AcpiRsSetResourceLength (AmlLength, Aml); break; @@ -636,7 +640,7 @@ AcpiRsConvertResourceToAml ( case ACPI_RSC_MOVE_GPIO_PIN: Destination = (char *) ACPI_ADD_PTR (void, Aml, - ACPI_GET16 (Destination)); + ACPI_GET16 (Destination)); Source = * (UINT16 **) Source; AcpiRsMoveData (Destination, Source, ItemCount, Info->Opcode); break; @@ -646,7 +650,7 @@ AcpiRsConvertResourceToAml ( /* Used for both ResourceSource string and VendorData */ Destination = (char *) ACPI_ADD_PTR (void, Aml, - ACPI_GET16 (Destination)); + ACPI_GET16 (Destination)); Source = * (UINT8 **) Source; AcpiRsMoveData (Destination, Source, ItemCount, Info->Opcode); break; @@ -654,7 +658,7 @@ AcpiRsConvertResourceToAml ( case ACPI_RSC_MOVE_SERIAL_VEN: Destination = (char *) ACPI_ADD_PTR (void, Aml, - (AmlLength - ItemCount)); + (AmlLength - ItemCount)); Source = * (UINT8 **) Source; AcpiRsMoveData (Destination, Source, ItemCount, Info->Opcode); break; @@ -662,7 +666,7 @@ AcpiRsConvertResourceToAml ( case ACPI_RSC_MOVE_SERIAL_RES: Destination = (char *) ACPI_ADD_PTR (void, Aml, - (AmlLength - ItemCount)); + (AmlLength - ItemCount)); Source = * (UINT8 **) Source; AcpiRsMoveData (Destination, Source, ItemCount, Info->Opcode); break; @@ -679,7 +683,7 @@ AcpiRsConvertResourceToAml ( * Optional ResourceSource (Index and String) */ AmlLength = AcpiRsSetResourceSource ( - Aml, (ACPI_RS_LENGTH) AmlLength, Source); + Aml, (ACPI_RS_LENGTH) AmlLength, Source); AcpiRsSetResourceLength (AmlLength, Aml); break; @@ -705,8 +709,8 @@ AcpiRsConvertResourceToAml ( /* * 16-bit encoded bitmask (IRQ macro) */ - Temp16 = AcpiRsEncodeBitmask (Source, - *ACPI_ADD_PTR (UINT8, Resource, Info->Value)); + Temp16 = AcpiRsEncodeBitmask ( + Source, *ACPI_ADD_PTR (UINT8, Resource, Info->Value)); ACPI_MOVE_16_TO_16 (Destination, &Temp16); break; @@ -729,7 +733,7 @@ AcpiRsConvertResourceToAml ( case ACPI_RSC_COMPARE_VALUE: if (*ACPI_ADD_PTR (UINT8, Resource, - COMPARE_TARGET (Info)) != COMPARE_VALUE (Info)) + COMPARE_TARGET (Info)) != COMPARE_VALUE (Info)) { goto Exit; } @@ -747,7 +751,7 @@ AcpiRsConvertResourceToAml ( * Control - Exit conversion if equal */ if (*ACPI_ADD_PTR (UINT8, Resource, - COMPARE_TARGET (Info)) == COMPARE_VALUE (Info)) + COMPARE_TARGET (Info)) == COMPARE_VALUE (Info)) { goto Exit; } @@ -771,7 +775,8 @@ Exit: #if 0 /* Previous resource validations */ - if (Aml->ExtAddress64.RevisionID != AML_RESOURCE_EXTENDED_ADDRESS_REVISION) + if (Aml->ExtAddress64.RevisionID != + AML_RESOURCE_EXTENDED_ADDRESS_REVISION) { return_ACPI_STATUS (AE_SUPPORT); } diff --git a/source/components/resources/rsutils.c b/source/components/resources/rsutils.c index a5517c6bff92f..bb48aef5fba80 100644 --- a/source/components/resources/rsutils.c +++ b/source/components/resources/rsutils.c @@ -185,20 +185,23 @@ AcpiRsMoveData ( case ACPI_RSC_MOVE16: case ACPI_RSC_MOVE_GPIO_PIN: - ACPI_MOVE_16_TO_16 (&ACPI_CAST_PTR (UINT16, Destination)[i], - &ACPI_CAST_PTR (UINT16, Source)[i]); + ACPI_MOVE_16_TO_16 ( + &ACPI_CAST_PTR (UINT16, Destination)[i], + &ACPI_CAST_PTR (UINT16, Source)[i]); break; case ACPI_RSC_MOVE32: - ACPI_MOVE_32_TO_32 (&ACPI_CAST_PTR (UINT32, Destination)[i], - &ACPI_CAST_PTR (UINT32, Source)[i]); + ACPI_MOVE_32_TO_32 ( + &ACPI_CAST_PTR (UINT32, Destination)[i], + &ACPI_CAST_PTR (UINT32, Source)[i]); break; case ACPI_RSC_MOVE64: - ACPI_MOVE_64_TO_64 (&ACPI_CAST_PTR (UINT64, Destination)[i], - &ACPI_CAST_PTR (UINT64, Source)[i]); + ACPI_MOVE_64_TO_64 ( + &ACPI_CAST_PTR (UINT64, Destination)[i], + &ACPI_CAST_PTR (UINT64, Source)[i]); break; default: @@ -248,18 +251,18 @@ AcpiRsSetResourceLength ( { /* Large descriptor -- bytes 1-2 contain the 16-bit length */ - ACPI_MOVE_16_TO_16 (&Aml->LargeHeader.ResourceLength, &ResourceLength); + ACPI_MOVE_16_TO_16 ( + &Aml->LargeHeader.ResourceLength, &ResourceLength); } else { - /* Small descriptor -- bits 2:0 of byte 0 contain the length */ - + /* + * Small descriptor -- bits 2:0 of byte 0 contain the length + * Clear any existing length, preserving descriptor type bits + */ Aml->SmallHeader.DescriptorType = (UINT8) - - /* Clear any existing length, preserving descriptor type bits */ - - ((Aml->SmallHeader.DescriptorType & ~ACPI_RESOURCE_NAME_SMALL_LENGTH_MASK) - + ((Aml->SmallHeader.DescriptorType & + ~ACPI_RESOURCE_NAME_SMALL_LENGTH_MASK) | ResourceLength); } } @@ -378,8 +381,8 @@ AcpiRsGetResourceSource ( AmlResourceSource = ACPI_ADD_PTR (UINT8, Aml, MinimumLength); /* - * ResourceSource is present if the length of the descriptor is longer than - * the minimum length. + * ResourceSource is present if the length of the descriptor is longer + * than the minimum length. * * Note: Some resource descriptors will have an additional null, so * we add 1 to the minimum length. @@ -397,8 +400,8 @@ AcpiRsGetResourceSource ( * String destination pointer is not specified; Set the String * pointer to the end of the current ResourceSource structure. */ - ResourceSource->StringPtr = ACPI_ADD_PTR (char, ResourceSource, - sizeof (ACPI_RESOURCE_SOURCE)); + ResourceSource->StringPtr = ACPI_ADD_PTR ( + char, ResourceSource, sizeof (ACPI_RESOURCE_SOURCE)); } /* @@ -410,13 +413,15 @@ AcpiRsGetResourceSource ( */ TotalLength = (UINT32) strlen ( ACPI_CAST_PTR (char, &AmlResourceSource[1])) + 1; + TotalLength = (UINT32) ACPI_ROUND_UP_TO_NATIVE_WORD (TotalLength); memset (ResourceSource->StringPtr, 0, TotalLength); /* Copy the ResourceSource string to the destination */ - ResourceSource->StringLength = AcpiRsStrcpy (ResourceSource->StringPtr, + ResourceSource->StringLength = AcpiRsStrcpy ( + ResourceSource->StringPtr, ACPI_CAST_PTR (char, &AmlResourceSource[1])); return ((ACPI_RS_LENGTH) TotalLength); @@ -484,7 +489,8 @@ AcpiRsSetResourceSource ( * Add the length of the string (+ 1 for null terminator) to the * final descriptor length */ - DescriptorLength += ((ACPI_RSDESC_SIZE) ResourceSource->StringLength + 1); + DescriptorLength += ((ACPI_RSDESC_SIZE) + ResourceSource->StringLength + 1); } /* Return the new total length of the AML descriptor */ @@ -527,8 +533,8 @@ AcpiRsGetPrtMethodData ( /* Execute the method, no parameters */ - Status = AcpiUtEvaluateObject (Node, METHOD_NAME__PRT, - ACPI_BTYPE_PACKAGE, &ObjDesc); + Status = AcpiUtEvaluateObject ( + Node, METHOD_NAME__PRT, ACPI_BTYPE_PACKAGE, &ObjDesc); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); @@ -581,8 +587,8 @@ AcpiRsGetCrsMethodData ( /* Execute the method, no parameters */ - Status = AcpiUtEvaluateObject (Node, METHOD_NAME__CRS, - ACPI_BTYPE_BUFFER, &ObjDesc); + Status = AcpiUtEvaluateObject ( + Node, METHOD_NAME__CRS, ACPI_BTYPE_BUFFER, &ObjDesc); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); @@ -636,8 +642,8 @@ AcpiRsGetPrsMethodData ( /* Execute the method, no parameters */ - Status = AcpiUtEvaluateObject (Node, METHOD_NAME__PRS, - ACPI_BTYPE_BUFFER, &ObjDesc); + Status = AcpiUtEvaluateObject ( + Node, METHOD_NAME__PRS, ACPI_BTYPE_BUFFER, &ObjDesc); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); @@ -691,8 +697,8 @@ AcpiRsGetAeiMethodData ( /* Execute the method, no parameters */ - Status = AcpiUtEvaluateObject (Node, METHOD_NAME__AEI, - ACPI_BTYPE_BUFFER, &ObjDesc); + Status = AcpiUtEvaluateObject ( + Node, METHOD_NAME__AEI, ACPI_BTYPE_BUFFER, &ObjDesc); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); @@ -748,7 +754,8 @@ AcpiRsGetMethodData ( /* Execute the method, no parameters */ - Status = AcpiUtEvaluateObject (ACPI_CAST_PTR (ACPI_NAMESPACE_NODE, Handle), + Status = AcpiUtEvaluateObject ( + ACPI_CAST_PTR (ACPI_NAMESPACE_NODE, Handle), Path, ACPI_BTYPE_BUFFER, &ObjDesc); if (ACPI_FAILURE (Status)) { diff --git a/source/components/resources/rsxface.c b/source/components/resources/rsxface.c index 1008af010ff37..c1a9b1b60b13a 100644 --- a/source/components/resources/rsxface.c +++ b/source/components/resources/rsxface.c @@ -54,7 +54,7 @@ /* Local macros for 16,32-bit to 64-bit conversion */ #define ACPI_COPY_FIELD(Out, In, Field) ((Out)->Field = (In)->Field) -#define ACPI_COPY_ADDRESS(Out, In) \ +#define ACPI_COPY_ADDRESS(Out, In) \ ACPI_COPY_FIELD(Out, In, ResourceType); \ ACPI_COPY_FIELD(Out, In, ProducerConsumer); \ ACPI_COPY_FIELD(Out, In, Decode); \ @@ -433,13 +433,15 @@ AcpiResourceToAddress64 ( { case ACPI_RESOURCE_TYPE_ADDRESS16: - Address16 = ACPI_CAST_PTR (ACPI_RESOURCE_ADDRESS16, &Resource->Data); + Address16 = ACPI_CAST_PTR ( + ACPI_RESOURCE_ADDRESS16, &Resource->Data); ACPI_COPY_ADDRESS (Out, Address16); break; case ACPI_RESOURCE_TYPE_ADDRESS32: - Address32 = ACPI_CAST_PTR (ACPI_RESOURCE_ADDRESS32, &Resource->Data); + Address32 = ACPI_CAST_PTR ( + ACPI_RESOURCE_ADDRESS32, &Resource->Data); ACPI_COPY_ADDRESS (Out, Address32); break; @@ -504,8 +506,8 @@ AcpiGetVendorResource ( /* Walk the _CRS or _PRS resource list for this device */ - Status = AcpiWalkResources (DeviceHandle, Name, AcpiRsMatchVendorResource, - &Info); + Status = AcpiWalkResources ( + DeviceHandle, Name, AcpiRsMatchVendorResource, &Info); if (ACPI_FAILURE (Status)) { return (Status); @@ -624,7 +626,8 @@ AcpiWalkResourceBuffer ( /* Buffer contains the resource list and length */ Resource = ACPI_CAST_PTR (ACPI_RESOURCE, Buffer->Pointer); - ResourceEnd = ACPI_ADD_PTR (ACPI_RESOURCE, Buffer->Pointer, Buffer->Length); + ResourceEnd = ACPI_ADD_PTR ( + ACPI_RESOURCE, Buffer->Pointer, Buffer->Length); /* Walk the resource list until the EndTag is found (or buffer end) */ |