diff options
Diffstat (limited to 'sys/contrib/dev/acpica/rscalc.c')
-rw-r--r-- | sys/contrib/dev/acpica/rscalc.c | 114 |
1 files changed, 48 insertions, 66 deletions
diff --git a/sys/contrib/dev/acpica/rscalc.c b/sys/contrib/dev/acpica/rscalc.c index 1b36dbd..be27c94 100644 --- a/sys/contrib/dev/acpica/rscalc.c +++ b/sys/contrib/dev/acpica/rscalc.c @@ -1,7 +1,7 @@ /******************************************************************************* * * Module Name: rscalc - Calculate stream and list lengths - * $Revision: 50 $ + * $Revision: 52 $ * ******************************************************************************/ @@ -148,7 +148,6 @@ AcpiRsGetByteStreamLength ( { ACPI_SIZE ByteStreamSizeNeeded = 0; ACPI_SIZE SegmentSize; - ACPI_RESOURCE_EXT_IRQ *ExIrq = NULL; BOOLEAN Done = FALSE; @@ -167,8 +166,8 @@ AcpiRsGetByteStreamLength ( case ACPI_RSTYPE_IRQ: /* * IRQ Resource - * For an IRQ Resource, Byte 3, although optional, will - * always be created - it holds IRQ information. + * For an IRQ Resource, Byte 3, although optional, will always be + * created - it holds IRQ information. */ SegmentSize = 4; break; @@ -184,8 +183,8 @@ AcpiRsGetByteStreamLength ( case ACPI_RSTYPE_START_DPF: /* * Start Dependent Functions Resource - * For a StartDependentFunctions Resource, Byte 1, - * although optional, will always be created. + * For a StartDependentFunctions Resource, Byte 1, although + * optional, will always be created. */ SegmentSize = 2; break; @@ -217,10 +216,9 @@ AcpiRsGetByteStreamLength ( case ACPI_RSTYPE_VENDOR: /* * Vendor Defined Resource - * For a Vendor Specific resource, if the Length is - * between 1 and 7 it will be created as a Small - * Resource data type, otherwise it is a Large - * Resource data type. + * For a Vendor Specific resource, if the Length is between 1 and 7 + * it will be created as a Small Resource data type, otherwise it + * is a Large Resource data type. */ if (LinkedList->Data.VendorSpecific.Length > 7) { @@ -269,10 +267,9 @@ AcpiRsGetByteStreamLength ( case ACPI_RSTYPE_ADDRESS16: /* * 16-Bit Address Resource - * The base size of this byte stream is 16. If a - * Resource Source string is not NULL, add 1 for - * the Index + the length of the null terminated - * string Resource Source + 1 for the null. + * The base size of this byte stream is 16. If a Resource Source + * string is not NULL, add 1 for the Index + the length of the null + * terminated string Resource Source + 1 for the null. */ SegmentSize = 16; @@ -303,10 +300,9 @@ AcpiRsGetByteStreamLength ( case ACPI_RSTYPE_ADDRESS64: /* * 64-Bit Address Resource - * The base size of this byte stream is 46. If a Resource - * Source string is not NULL, add 1 for the Index + the - * length of the null terminated string Resource Source + - * 1 for the null. + * The base size of this byte stream is 46. If a ResourceSource + * string is not NULL, add 1 for the Index + the length of the null + * terminated string Resource Source + 1 for the null. */ SegmentSize = 46; @@ -320,9 +316,8 @@ AcpiRsGetByteStreamLength ( case ACPI_RSTYPE_EXT_IRQ: /* * Extended IRQ Resource - * The base size of this byte stream is 9. This is for an - * Interrupt table length of 1. For each additional - * interrupt, add 4. + * The base size of this byte stream is 9. This is for an Interrupt + * table length of 1. For each additional interrupt, add 4. * If a Resource Source string is not NULL, add 1 for the * Index + the length of the null terminated string * Resource Source + 1 for the null. @@ -330,7 +325,7 @@ AcpiRsGetByteStreamLength ( SegmentSize = 9 + (((ACPI_SIZE) LinkedList->Data.ExtendedIrq.NumberOfInterrupts - 1) * 4); - if (ExIrq && ExIrq->ResourceSource.StringPtr) + if (LinkedList->Data.ExtendedIrq.ResourceSource.StringPtr) { SegmentSize += LinkedList->Data.ExtendedIrq.ResourceSource.StringLength; SegmentSize++; @@ -339,8 +334,7 @@ AcpiRsGetByteStreamLength ( default: /* - * If we get here, everything is out of sync, - * so exit with an error + * If we get here, everything is out of sync, exit with error */ return_ACPI_STATUS (AE_AML_INVALID_RESOURCE_TYPE); @@ -450,7 +444,6 @@ AcpiRsGetListLength ( /* * 32-Bit Memory Range Resource */ - BytesConsumed = 20; StructureSize = ACPI_SIZEOF_RESOURCE (ACPI_RESOURCE_MEM32); @@ -479,14 +472,12 @@ AcpiRsGetListLength ( BytesConsumed = Temp16 + 3; /* - * Resource Source Index and Resource Source are - * optional elements. Check the length of the - * Bytestream. If it is greater than 43, that - * means that an Index exists and is followed by - * a null termininated string. Therefore, set - * the temp variable to the length minus the minimum - * byte stream length plus the byte for the Index to - * determine the size of the NULL terminiated string. + * Resource Source Index and Resource Source are optional elements. + * Check the length of the Bytestream. If it is greater than 43, + * that means that an Index exists and is followed by a null + * terminated string. Therefore, set the temp variable to the + * length minus the minimum byte stream length plus the byte for + * the Index to determine the size of the NULL terminated string. */ if (43 < Temp16) { @@ -519,14 +510,12 @@ AcpiRsGetListLength ( BytesConsumed = Temp16 + 3; /* - * Resource Source Index and Resource Source are - * optional elements. Check the length of the - * Bytestream. If it is greater than 23, that - * means that an Index exists and is followed by - * a null termininated string. Therefore, set - * the temp variable to the length minus the minimum - * byte stream length plus the byte for the Index to - * determine the size of the NULL terminiated string. + * Resource Source Index and Resource Source are optional elements. + * Check the length of the Bytestream. If it is greater than 23, + * that means that an Index exists and is followed by a null + * terminated string. Therefore, set the temp variable to the + * length minus the minimum byte stream length plus the byte for + * the Index to determine the size of the NULL terminated string. */ if (23 < Temp16) { @@ -559,14 +548,12 @@ AcpiRsGetListLength ( BytesConsumed = Temp16 + 3; /* - * Resource Source Index and Resource Source are - * optional elements. Check the length of the - * Bytestream. If it is greater than 13, that - * means that an Index exists and is followed by - * a null termininated string. Therefore, set - * the temp variable to the length minus the minimum - * byte stream length plus the byte for the Index to - * determine the size of the NULL terminiated string. + * Resource Source Index and Resource Source are optional elements. + * Check the length of the Bytestream. If it is greater than 13, + * that means that an Index exists and is followed by a null + * terminated string. Therefore, set the temp variable to the + * length minus the minimum byte stream length plus the byte for + * the Index to determine the size of the NULL terminated string. */ if (13 < Temp16) { @@ -599,9 +586,8 @@ AcpiRsGetListLength ( BytesConsumed = Temp16 + 3; /* - * Point past the length field and the - * Interrupt vector flags to save off the - * Interrupt table length to the Temp8 variable. + * Point past the length field and the Interrupt vector flags to + * save off the Interrupt table length to the Temp8 variable. */ Buffer += 3; Temp8 = *Buffer; @@ -613,14 +599,12 @@ AcpiRsGetListLength ( AdditionalBytes = (UINT8) ((Temp8 - 1) * 4); /* - * Resource Source Index and Resource Source are - * optional elements. Check the length of the - * Bytestream. If it is greater than 9, that - * means that an Index exists and is followed by - * a null termininated string. Therefore, set - * the temp variable to the length minus the minimum - * byte stream length plus the byte for the Index to - * determine the size of the NULL terminiated string. + * Resource Source Index and Resource Source are optional elements. + * Check the length of the Bytestream. If it is greater than 9, + * that means that an Index exists and is followed by a null + * terminated string. Therefore, set the temp variable to the + * length minus the minimum byte stream length plus the byte for + * the Index to determine the size of the NULL terminated string. */ if (9 + AdditionalBytes < Temp16) { @@ -659,9 +643,8 @@ AcpiRsGetListLength ( BytesConsumed = 3; } - /* - * Point past the descriptor - */ + /* Point past the descriptor */ + ++Buffer; /* @@ -691,9 +674,8 @@ AcpiRsGetListLength ( Buffer = ByteStreamBuffer; BytesConsumed = 3; - /* - * Point past the descriptor - */ + /* Point past the descriptor */ + ++Buffer; /* |