Print this page
update to acpica-unix2-20131115
acpica-unix2-20130823
PANKOVs restructure

*** 3,13 **** * Module Name: rscalc - Calculate stream and list lengths * ******************************************************************************/ /* ! * Copyright (C) 2000 - 2011, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: --- 3,13 ---- * Module Name: rscalc - Calculate stream and list lengths * ******************************************************************************/ /* ! * Copyright (C) 2000 - 2013, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met:
*** 195,204 **** --- 195,205 ---- /******************************************************************************* * * FUNCTION: AcpiRsGetAmlLength * * PARAMETERS: Resource - Pointer to the resource linked list + * ResourceListSize - Size of the resource linked list * SizeNeeded - Where the required size is returned * * RETURN: Status * * DESCRIPTION: Takes a linked list of internal resource descriptors and
*** 208,237 **** ******************************************************************************/ ACPI_STATUS AcpiRsGetAmlLength ( ACPI_RESOURCE *Resource, ACPI_SIZE *SizeNeeded) { ACPI_SIZE AmlSizeNeeded = 0; ACPI_RS_LENGTH TotalSize; ACPI_FUNCTION_TRACE (RsGetAmlLength); /* Traverse entire list of internal resource descriptors */ ! while (Resource) { /* Validate the descriptor type */ if (Resource->Type > ACPI_RESOURCE_TYPE_MAX) { return_ACPI_STATUS (AE_AML_INVALID_RESOURCE_TYPE); } /* Get the base size of the (external stream) resource descriptor */ TotalSize = AcpiGbl_AmlResourceSizes [Resource->Type]; /* --- 209,248 ---- ******************************************************************************/ ACPI_STATUS AcpiRsGetAmlLength ( ACPI_RESOURCE *Resource, + ACPI_SIZE ResourceListSize, ACPI_SIZE *SizeNeeded) { ACPI_SIZE AmlSizeNeeded = 0; + ACPI_RESOURCE *ResourceEnd; ACPI_RS_LENGTH TotalSize; ACPI_FUNCTION_TRACE (RsGetAmlLength); /* Traverse entire list of internal resource descriptors */ ! ResourceEnd = ACPI_ADD_PTR (ACPI_RESOURCE, Resource, ResourceListSize); ! while (Resource < ResourceEnd) { /* Validate the descriptor type */ if (Resource->Type > ACPI_RESOURCE_TYPE_MAX) { return_ACPI_STATUS (AE_AML_INVALID_RESOURCE_TYPE); } + /* Sanity check the length. It must not be zero, or we loop forever */ + + if (!Resource->Length) + { + return_ACPI_STATUS (AE_AML_BAD_RESOURCE_LENGTH); + } + /* Get the base size of the (external stream) resource descriptor */ TotalSize = AcpiGbl_AmlResourceSizes [Resource->Type]; /*
*** 343,353 **** --- 354,384 ---- AcpiRsStructOptionLength ( &Resource->Data.ExtendedIrq.ResourceSource)); break; + case ACPI_RESOURCE_TYPE_GPIO: + + TotalSize = (ACPI_RS_LENGTH) (TotalSize + (Resource->Data.Gpio.PinTableLength * 2) + + Resource->Data.Gpio.ResourceSource.StringLength + + Resource->Data.Gpio.VendorLength); + + break; + + + case ACPI_RESOURCE_TYPE_SERIAL_BUS: + + TotalSize = AcpiGbl_AmlResourceSerialBusSizes [Resource->Data.CommonSerialBus.Type]; + + TotalSize = (ACPI_RS_LENGTH) (TotalSize + + Resource->Data.I2cSerialBus.ResourceSource.StringLength + + Resource->Data.I2cSerialBus.VendorLength); + + break; + default: + break; } /* Update the total */
*** 393,422 **** UINT16 Temp16; UINT16 ResourceLength; UINT32 ExtraStructBytes; UINT8 ResourceIndex; UINT8 MinimumAmlResourceLength; ACPI_FUNCTION_TRACE (RsGetListLength); ! *SizeNeeded = 0; EndAml = AmlBuffer + AmlBufferLength; /* Walk the list of AML resource descriptors */ while (AmlBuffer < EndAml) { /* Validate the Resource Type and Resource Length */ ! Status = AcpiUtValidateResource (AmlBuffer, &ResourceIndex); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); } /* Get the resource length and base (minimum) AML size */ ResourceLength = AcpiUtGetResourceLength (AmlBuffer); MinimumAmlResourceLength = AcpiGbl_ResourceAmlSizes[ResourceIndex]; --- 424,460 ---- UINT16 Temp16; UINT16 ResourceLength; UINT32 ExtraStructBytes; UINT8 ResourceIndex; UINT8 MinimumAmlResourceLength; + AML_RESOURCE *AmlResource; ACPI_FUNCTION_TRACE (RsGetListLength); ! *SizeNeeded = ACPI_RS_SIZE_MIN; /* Minimum size is one EndTag */ EndAml = AmlBuffer + AmlBufferLength; /* Walk the list of AML resource descriptors */ while (AmlBuffer < EndAml) { /* Validate the Resource Type and Resource Length */ ! Status = AcpiUtValidateResource (NULL, AmlBuffer, &ResourceIndex); if (ACPI_FAILURE (Status)) { + /* + * Exit on failure. Cannot continue because the descriptor length + * may be bogus also. + */ return_ACPI_STATUS (Status); } + AmlResource = (void *) AmlBuffer; + /* Get the resource length and base (minimum) AML size */ ResourceLength = AcpiUtGetResourceLength (AmlBuffer); MinimumAmlResourceLength = AcpiGbl_ResourceAmlSizes[ResourceIndex];
*** 453,471 **** /* * Vendor Resource: * Get the number of vendor data bytes */ ExtraStructBytes = ResourceLength; break; case ACPI_RESOURCE_NAME_END_TAG: /* ! * End Tag: ! * This is the normal exit, add size of EndTag */ - *SizeNeeded += ACPI_RS_SIZE_MIN; return_ACPI_STATUS (AE_OK); case ACPI_RESOURCE_NAME_ADDRESS32: case ACPI_RESOURCE_NAME_ADDRESS16: --- 491,517 ---- /* * Vendor Resource: * Get the number of vendor data bytes */ ExtraStructBytes = ResourceLength; + + /* + * There is already one byte included in the minimum + * descriptor size. If there are extra struct bytes, + * subtract one from the count. + */ + if (ExtraStructBytes) + { + ExtraStructBytes--; + } break; case ACPI_RESOURCE_NAME_END_TAG: /* ! * End Tag: This is the normal exit */ return_ACPI_STATUS (AE_OK); case ACPI_RESOURCE_NAME_ADDRESS32: case ACPI_RESOURCE_NAME_ADDRESS16:
*** 492,514 **** --- 538,593 ---- ExtraStructBytes += AcpiRsStreamOptionLength ( ResourceLength - ExtraStructBytes, MinimumAmlResourceLength); break; + case ACPI_RESOURCE_NAME_GPIO: + /* Vendor data is optional */ + + if (AmlResource->Gpio.VendorLength) + { + ExtraStructBytes += AmlResource->Gpio.VendorOffset - + AmlResource->Gpio.PinTableOffset + AmlResource->Gpio.VendorLength; + } + else + { + ExtraStructBytes += AmlResource->LargeHeader.ResourceLength + + sizeof (AML_RESOURCE_LARGE_HEADER) - + AmlResource->Gpio.PinTableOffset; + } + break; + + case ACPI_RESOURCE_NAME_SERIAL_BUS: + + MinimumAmlResourceLength = AcpiGbl_ResourceAmlSerialBusSizes[ + AmlResource->CommonSerialBus.Type]; + ExtraStructBytes += AmlResource->CommonSerialBus.ResourceLength - + MinimumAmlResourceLength; + break; + default: + break; } /* * Update the required buffer size for the internal descriptor structs * * Important: Round the size up for the appropriate alignment. This * is a requirement on IA64. */ + if (AcpiUtGetResourceType (AmlBuffer) == ACPI_RESOURCE_NAME_SERIAL_BUS) + { + BufferSize = AcpiGbl_ResourceStructSerialBusSizes[ + AmlResource->CommonSerialBus.Type] + ExtraStructBytes; + } + else + { BufferSize = AcpiGbl_ResourceStructSizes[ResourceIndex] + ExtraStructBytes; + } BufferSize = (UINT32) ACPI_ROUND_UP_TO_NATIVE_WORD (BufferSize); *SizeNeeded += BufferSize; ACPI_DEBUG_PRINT ((ACPI_DB_RESOURCES,
*** 600,610 **** /* Scan the IrqTableElements for the Source Name String */ NameFound = FALSE; ! for (TableIndex = 0; TableIndex < 4 && !NameFound; TableIndex++) { if (*SubObjectList && /* Null object allowed */ ((ACPI_TYPE_STRING == (*SubObjectList)->Common.Type) || --- 679,691 ---- /* Scan the IrqTableElements for the Source Name String */ NameFound = FALSE; ! for (TableIndex = 0; ! TableIndex < PackageElement->Package.Count && !NameFound; ! TableIndex++) { if (*SubObjectList && /* Null object allowed */ ((ACPI_TYPE_STRING == (*SubObjectList)->Common.Type) ||