mirror of https://github.com/acidanthera/audk.git
DynamicTablesPkg: Add AmlRdSetEndTagChecksum()
Add AmlRdSetEndTagChecksum(), setting the CheckSum value contained in a Resource Data element. ACPI 6.4, s6.4.2.9 "End Tag": "This checksum is generated such that adding it to the sum of all the data bytes will produce a zero sum." "If the checksum field is zero, the resource data is treated as if the checksum operation succeeded. Configuration proceeds normally." Reviewed-by: Sami Mujawar <sami.mujawar@arm.com> Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com>
This commit is contained in:
parent
bfaf7c8b9e
commit
28b2df475f
|
@ -101,3 +101,36 @@ AmlRdGetSize (
|
|||
return ((ACPI_SMALL_RESOURCE_HEADER*)Header)->Bits.Length +
|
||||
sizeof (ACPI_SMALL_RESOURCE_HEADER);
|
||||
}
|
||||
|
||||
/** Set the Checksum of an EndTag resource data.
|
||||
|
||||
ACPI 6.4, s6.4.2.9 "End Tag":
|
||||
"This checksum is generated such that adding it to the sum of all the data
|
||||
bytes will produce a zero sum."
|
||||
"If the checksum field is zero, the resource data is treated as if the
|
||||
checksum operation succeeded. Configuration proceeds normally."
|
||||
|
||||
@param [in] Header Pointer to the first byte of a resource data.
|
||||
@param [in] CheckSum Checksum value to set.
|
||||
|
||||
@retval EFI_SUCCESS The function completed successfully.
|
||||
@retval EFI_INVALID_PARAMETER Invalid parameter.
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
AmlRdSetEndTagChecksum (
|
||||
IN CONST AML_RD_HEADER * Header,
|
||||
IN UINT8 CheckSum
|
||||
)
|
||||
{
|
||||
if ((Header == NULL) ||
|
||||
!AmlRdCompareDescId (
|
||||
Header,
|
||||
AML_RD_BUILD_SMALL_DESC_ID (ACPI_SMALL_END_TAG_DESCRIPTOR_NAME))) {
|
||||
ASSERT (0);
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
((EFI_ACPI_END_TAG_DESCRIPTOR*)Header)->Checksum = CheckSum;
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
|
|
@ -171,4 +171,25 @@ AmlRdGetSize (
|
|||
IN CONST AML_RD_HEADER * Header
|
||||
);
|
||||
|
||||
/** Set the Checksum of an EndTag resource data.
|
||||
|
||||
ACPI 6.4, s6.4.2.9 "End Tag":
|
||||
"This checksum is generated such that adding it to the sum of all the data
|
||||
bytes will produce a zero sum."
|
||||
"If the checksum field is zero, the resource data is treated as if the
|
||||
checksum operation succeeded. Configuration proceeds normally."
|
||||
|
||||
@param [in] Header Pointer to the first byte of a resource data.
|
||||
@param [in] CheckSum Checksum value to set.
|
||||
|
||||
@retval EFI_SUCCESS The function completed successfully.
|
||||
@retval EFI_INVALID_PARAMETER Invalid parameter.
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
AmlRdSetEndTagChecksum (
|
||||
IN CONST AML_RD_HEADER * Header,
|
||||
IN UINT8 CheckSum
|
||||
);
|
||||
|
||||
#endif // AML_RESOURCE_DATA_H_
|
||||
|
|
Loading…
Reference in New Issue