9#include <Uefi/UefiBaseType.h>
10#include <Library/BaseMemoryLib.h>
11#include <Library/BaseOverflowLib.h>
12#include <Library/MemoryAllocationLib.h>
13#include <Library/DebugLib.h>
14#include <IndustryStandard/Acpi.h>
16#include <IndustryStandard/AcpiAml.h>
34 case EFI_INVALID_PARAMETER:
35 DEBUG ((DEBUG_ERROR,
"EXIT: Invalid parameter!\n"));
38 case EFI_DEVICE_ERROR:
39 DEBUG ((DEBUG_ERROR,
"EXIT: ACPI table is incorrect or not supported by parser!\n"));
43 DEBUG ((DEBUG_ERROR,
"EXIT: No entry found in the table.\n"));
46 case EFI_OUT_OF_RESOURCES:
47 DEBUG ((DEBUG_ERROR,
"EXIT: ACPI table has too much nesting!\n"));
51 DEBUG ((DEBUG_ERROR,
"EXIT: File error in table file!\n"));
55 DEBUG ((DEBUG_ERROR,
"EXIT: Unknown error!\n"));
79 IN CONST CHAR8 *FileName,
80 IN CONST CHAR8 *PathString,
90 if (TableStart == NULL) {
91 DEBUG ((DEBUG_INFO,
"No file %a\n", FileName));
92 return EFI_LOAD_ERROR;
97 FreePool (TableStart);
120 UINT32 ReturnedOffset;
123 #if defined (VERBOSE) && !defined (FUZZING_TEST)
124 PcdGet32 (PcdFixedDebugPrintErrorLevel) |= DEBUG_VERBOSE | DEBUG_INFO;
125 PcdGet32 (PcdDebugPrintErrorLevel) |= DEBUG_VERBOSE | DEBUG_INFO;
130 if (((argv[1][0] ==
'-') && (argv[1][1] ==
'f')) || ((argv[1][0] ==
'-') && (argv[1][1] ==
'a'))) {
133 if ((argv[1][0] ==
'-') && (argv[1][1] ==
'f')) {
134 DEBUG ((DEBUG_VERBOSE,
"Entered main (file)\n"));
142 if (!EFI_ERROR (Status)) {
143 DEBUG ((DEBUG_ERROR,
"Returned offset: %d\n", ReturnedOffset));
151 DEBUG ((DEBUG_VERBOSE,
"Entered main (address)\n"));
159 if (!EFI_ERROR (Status)) {
160 DEBUG ((DEBUG_ERROR,
"Returned offset: %d\n", ReturnedOffset));
168 DEBUG ((DEBUG_ERROR,
"Usage: ACPIe -f *file* *search path* [number of occurance]\n"));
174 if (((argv[1][0] ==
'-') && (argv[1][1] ==
'f')) || ((argv[1][0] ==
'-') && (argv[1][1] ==
'a'))) {
175 if ((argv[1][0] ==
'-') && (argv[1][1] ==
'f')) {
176 DEBUG ((DEBUG_VERBOSE,
"Entered main (file)\n"));
184 if (!EFI_ERROR (Status)) {
185 DEBUG ((DEBUG_ERROR,
"Returned offset: %d\n", ReturnedOffset));
193 DEBUG ((DEBUG_VERBOSE,
"Entered main (address)\n"));
201 if (!EFI_ERROR (Status)) {
202 DEBUG ((DEBUG_ERROR,
"Returned offset: %d\n", ReturnedOffset));
210 DEBUG ((DEBUG_ERROR,
"Usage: ACPIe -f *file* *search path* [number of occurance]\n"));
216 DEBUG ((DEBUG_ERROR,
"Usage: ACPIe -f *file* *search path* [number of occurance]\n"));
int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size)
STATIC VOID PrintParserError(IN EFI_STATUS Status)
STATIC EFI_STATUS AcpiFindEntryInFile(IN CONST CHAR8 *FileName, IN CONST CHAR8 *PathString, IN UINT8 Entry, OUT UINT32 *Offset)
EFI_STATUS AcpiFindEntryInMemory(IN UINT8 *Table, IN CONST CHAR8 *PathString, IN UINT8 Entry, OUT UINT32 *Offset, IN UINT32 TableLength OPTIONAL)
DMG_SIZE_DEVICE_PATH Size
UINT8 * UserReadFile(IN CONST CHAR8 *FileName, OUT UINT32 *Size)