ReactOS 0.4.15-dev-5667-ged97270
utcksum.c File Reference
#include "acpi.h"
#include "accommon.h"
#include "acdisasm.h"
#include "acutils.h"
Include dependency graph for utcksum.c:

Go to the source code of this file.

Macros

#define _COMPONENT   ACPI_CA_DISASSEMBLER
 

Functions

ACPI_STATUS AcpiUtVerifyChecksum (ACPI_TABLE_HEADER *Table, UINT32 Length)
 
ACPI_STATUS AcpiUtVerifyCdatChecksum (ACPI_TABLE_CDAT *CdatTable, UINT32 Length)
 
UINT8 AcpiUtGenerateChecksum (void *Table, UINT32 Length, UINT8 OriginalChecksum)
 
UINT8 AcpiUtChecksum (UINT8 *Buffer, UINT32 Length)
 

Macro Definition Documentation

◆ _COMPONENT

#define _COMPONENT   ACPI_CA_DISASSEMBLER

Definition at line 52 of file utcksum.c.

Function Documentation

◆ AcpiUtChecksum()

UINT8 AcpiUtChecksum ( UINT8 Buffer,
UINT32  Length 
)

Definition at line 213 of file utcksum.c.

216{
217 UINT8 Sum = 0;
218 UINT8 *End = Buffer + Length;
219
220
221 while (Buffer < End)
222 {
223 Sum = (UINT8) (Sum + *(Buffer++));
224 }
225
226 return (Sum);
227}
unsigned char UINT8
Definition: bufpool.h:45
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:102

Referenced by AcpiTbValidateRsdp(), and AcpiUtGenerateChecksum().

◆ AcpiUtGenerateChecksum()

UINT8 AcpiUtGenerateChecksum ( void Table,
UINT32  Length,
UINT8  OriginalChecksum 
)

Definition at line 176 of file utcksum.c.

180{
181 UINT8 Checksum;
182
183
184 /* Sum the entire table as-is */
185
186 Checksum = AcpiUtChecksum ((UINT8 *) Table, Length);
187
188 /* Subtract off the existing checksum value in the table */
189
190 Checksum = (UINT8) (Checksum - OriginalChecksum);
191
192 /* Compute and return the final checksum */
193
194 Checksum = (UINT8) (0 - Checksum);
195 return (Checksum);
196}
ASMGENDATA Table[]
Definition: genincdata.c:61
UINT8 AcpiUtChecksum(UINT8 *Buffer, UINT32 Length)
Definition: utcksum.c:213

Referenced by AcpiUtVerifyCdatChecksum(), and AcpiUtVerifyChecksum().

◆ AcpiUtVerifyCdatChecksum()

ACPI_STATUS AcpiUtVerifyCdatChecksum ( ACPI_TABLE_CDAT CdatTable,
UINT32  Length 
)

Definition at line 130 of file utcksum.c.

133{
134 UINT8 Checksum;
135
136
137 /* Compute the checksum on the table */
138
139 Checksum = AcpiUtGenerateChecksum (ACPI_CAST_PTR (UINT8, CdatTable),
140 CdatTable->Length, CdatTable->Checksum);
141
142 /* Computed checksum matches table? */
143
144 if (Checksum != CdatTable->Checksum)
145 {
147 "Incorrect checksum in table [%4.4s] - 0x%2.2X, "
148 "should be 0x%2.2X",
149 AcpiGbl_CDAT, CdatTable->Checksum, Checksum));
150
151#if (ACPI_CHECKSUM_ABORT)
152 return (AE_BAD_CHECKSUM);
153#endif
154 }
155
156 CdatTable->Checksum = Checksum;
157 return (AE_OK);
158}
#define AE_BAD_CHECKSUM
Definition: acexcep.h:169
#define AE_OK
Definition: acexcep.h:97
#define ACPI_BIOS_WARNING(plist)
Definition: acoutput.h:241
#define AE_INFO
Definition: acoutput.h:230
#define ACPI_CAST_PTR(t, p)
Definition: actypes.h:544
UINT8 Checksum
Definition: actbl1.h:405
UINT32 Length
Definition: actbl1.h:403
UINT8 AcpiUtGenerateChecksum(void *Table, UINT32 Length, UINT8 OriginalChecksum)
Definition: utcksum.c:176

◆ AcpiUtVerifyChecksum()

ACPI_STATUS AcpiUtVerifyChecksum ( ACPI_TABLE_HEADER Table,
UINT32  Length 
)

Definition at line 74 of file utcksum.c.

77{
78 UINT8 Checksum;
79
80
81 /*
82 * FACS/S3PT:
83 * They are the odd tables, have no standard ACPI header and no checksum
84 */
85 if (ACPI_COMPARE_NAMESEG (Table->Signature, ACPI_SIG_S3PT) ||
87 {
88 return (AE_OK);
89 }
90
91 /* Compute the checksum on the table */
92
93 Length = Table->Length;
94 Checksum = AcpiUtGenerateChecksum (ACPI_CAST_PTR (UINT8, Table), Length, Table->Checksum);
95
96 /* Computed checksum matches table? */
97
98 if (Checksum != Table->Checksum)
99 {
101 "Incorrect checksum in table [%4.4s] - 0x%2.2X, "
102 "should be 0x%2.2X",
103 Table->Signature, Table->Checksum,
104 Table->Checksum - Checksum));
105
106#if (ACPI_CHECKSUM_ABORT)
107 return (AE_BAD_CHECKSUM);
108#endif
109 }
110
111 return (AE_OK);
112}
#define ACPI_SIG_S3PT
Definition: actbl1.h:86
#define ACPI_SIG_FACS
Definition: actbl.h:69
#define ACPI_COMPARE_NAMESEG(a, b)
Definition: actypes.h:564

Referenced by AcpiTbParseFadt(), AcpiTbParseRootTable(), and AcpiTbVerifyTempTable().