forked from xt-sys/exectos
Rework AcpChecksumTable() routine into AcpValidateAcpiTable()
This commit is contained in:
parent
54b7e46f1b
commit
db5d6c42c9
@ -159,7 +159,7 @@ AcGetAcpiTable(IN CONST UINT Signature,
|
|||||||
if(TableHeader->Signature != ACPI_FADT_SIGNATURE || TableHeader->Revision > 2)
|
if(TableHeader->Signature != ACPI_FADT_SIGNATURE || TableHeader->Revision > 2)
|
||||||
{
|
{
|
||||||
/* Validate table checksum */
|
/* Validate table checksum */
|
||||||
if(AcpChecksumTable(TableHeader, TableHeader->Length) != 0)
|
if(!AcpValidateAcpiTable(TableHeader, TableHeader->Length))
|
||||||
{
|
{
|
||||||
/* Checksum mismatch, return error */
|
/* Checksum mismatch, return error */
|
||||||
return STATUS_EFI_CRC_ERROR;
|
return STATUS_EFI_CRC_ERROR;
|
||||||
@ -230,7 +230,7 @@ AcGetRsdpTable(OUT PVOID *AcpiTable)
|
|||||||
|
|
||||||
/* Get RSDP (ACPI 1.0) table from system configuration tables */
|
/* Get RSDP (ACPI 1.0) table from system configuration tables */
|
||||||
Status = XtLdrProtocol->Util.GetConfigurationTable(&AcpiGuid, &RsdpTable);
|
Status = XtLdrProtocol->Util.GetConfigurationTable(&AcpiGuid, &RsdpTable);
|
||||||
if(Status != STATUS_EFI_SUCCESS || AcpChecksumTable(RsdpTable, 20) != 0)
|
if(Status != STATUS_EFI_SUCCESS || !AcpValidateAcpiTable(RsdpTable, 20))
|
||||||
{
|
{
|
||||||
/* RSDP not found or checksum mismatch */
|
/* RSDP not found or checksum mismatch */
|
||||||
*AcpiTable = NULL;
|
*AcpiTable = NULL;
|
||||||
@ -262,7 +262,7 @@ AcGetSMBiosTable(OUT PVOID *SmBiosTable)
|
|||||||
|
|
||||||
/* Get SMBIOS table from system configuration tables */
|
/* Get SMBIOS table from system configuration tables */
|
||||||
Status = XtLdrProtocol->Util.GetConfigurationTable(&SmBiosGuid, (PVOID)&SmBios);
|
Status = XtLdrProtocol->Util.GetConfigurationTable(&SmBiosGuid, (PVOID)&SmBios);
|
||||||
if(Status != STATUS_EFI_SUCCESS || AcpChecksumTable(SmBios, SmBios->Length) != 0)
|
if(Status != STATUS_EFI_SUCCESS || !AcpValidateAcpiTable(SmBios, SmBios->Length))
|
||||||
{
|
{
|
||||||
/* SMBIOS not found or checksum mismatch */
|
/* SMBIOS not found or checksum mismatch */
|
||||||
*SmBiosTable = NULL;
|
*SmBiosTable = NULL;
|
||||||
@ -294,7 +294,7 @@ AcGetSMBios3Table(OUT PVOID *SmBiosTable)
|
|||||||
|
|
||||||
/* Get SMBIOS3 table from system configuration tables */
|
/* Get SMBIOS3 table from system configuration tables */
|
||||||
Status = XtLdrProtocol->Util.GetConfigurationTable(&SmBios3Guid, (PVOID)&SmBios);
|
Status = XtLdrProtocol->Util.GetConfigurationTable(&SmBios3Guid, (PVOID)&SmBios);
|
||||||
if(Status != STATUS_EFI_SUCCESS || AcpChecksumTable(SmBios, SmBios->Length) != 0)
|
if(Status != STATUS_EFI_SUCCESS || !AcpValidateAcpiTable(SmBios, SmBios->Length))
|
||||||
{
|
{
|
||||||
/* SMBIOS3 not found or checksum mismatch */
|
/* SMBIOS3 not found or checksum mismatch */
|
||||||
*SmBiosTable = NULL;
|
*SmBiosTable = NULL;
|
||||||
@ -326,7 +326,7 @@ AcGetXsdpTable(OUT PVOID *AcpiTable)
|
|||||||
|
|
||||||
/* Get XSDP (ACPI 2.0) from system configuration tables */
|
/* Get XSDP (ACPI 2.0) from system configuration tables */
|
||||||
Status = XtLdrProtocol->Util.GetConfigurationTable(&AcpiGuid, &XsdpTable);
|
Status = XtLdrProtocol->Util.GetConfigurationTable(&AcpiGuid, &XsdpTable);
|
||||||
if(Status != STATUS_EFI_SUCCESS || AcpChecksumTable(XsdpTable, 36) != 0)
|
if(Status != STATUS_EFI_SUCCESS || !AcpValidateAcpiTable(XsdpTable, 36))
|
||||||
{
|
{
|
||||||
/* XSDP not found or checksum mismatch */
|
/* XSDP not found or checksum mismatch */
|
||||||
*AcpiTable = NULL;
|
*AcpiTable = NULL;
|
||||||
@ -339,7 +339,7 @@ AcGetXsdpTable(OUT PVOID *AcpiTable)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checksums a given ACPI table.
|
* Validates given ACPI table by calculating its checksum.
|
||||||
*
|
*
|
||||||
* @param Buffer
|
* @param Buffer
|
||||||
* Supplies a pointer to the table to checksum.
|
* Supplies a pointer to the table to checksum.
|
||||||
@ -347,11 +347,11 @@ AcGetXsdpTable(OUT PVOID *AcpiTable)
|
|||||||
* @param Size
|
* @param Size
|
||||||
* Supplies the size of the table, in bytes.
|
* Supplies the size of the table, in bytes.
|
||||||
*
|
*
|
||||||
* @return This routine returns the calculated checksum.
|
* @return This routine returns TRUE if the table is valid, or FALSE otherwise.
|
||||||
*/
|
*/
|
||||||
XTCDECL
|
XTCDECL
|
||||||
UCHAR
|
BOOLEAN
|
||||||
AcpChecksumTable(IN PVOID Buffer,
|
AcpValidateAcpiTable(IN PVOID Buffer,
|
||||||
IN UINT_PTR Size)
|
IN UINT_PTR Size)
|
||||||
{
|
{
|
||||||
PUCHAR Pointer;
|
PUCHAR Pointer;
|
||||||
@ -370,7 +370,7 @@ AcpChecksumTable(IN PVOID Buffer,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Return calculated checksum */
|
/* Return calculated checksum */
|
||||||
return Sum;
|
return (Sum == 0) ? TRUE : FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -45,8 +45,8 @@ EFI_STATUS
|
|||||||
AcGetXsdpTable(OUT PVOID *AcpiTable);
|
AcGetXsdpTable(OUT PVOID *AcpiTable);
|
||||||
|
|
||||||
XTCDECL
|
XTCDECL
|
||||||
UCHAR
|
BOOLEAN
|
||||||
AcpChecksumTable(IN PVOID Buffer,
|
AcpValidateAcpiTable(IN PVOID Buffer,
|
||||||
IN UINT_PTR Size);
|
IN UINT_PTR Size);
|
||||||
|
|
||||||
XTCDECL
|
XTCDECL
|
||||||
|
Loading…
Reference in New Issue
Block a user