OpenCore  1.0.4
OpenCore Bootloader
Loading...
Searching...
No Matches
AcpiParser.h File Reference

Go to the source code of this file.

Data Structures

struct  ACPI_PARSER_CONTEXT
 

Macros

#define IDENT_LEN   4
 
#define OPCODE_LEN   8
 
#define MAX_NESTING   1024
 
#define CONTEXT_ENTER(Context, Name)
 
#define PRINT_ACPI_NAME(Str, Name, Length)
 
#define CONTEXT_HAS_WORK(Context)
 
#define CONTEXT_INCREASE_NESTING(Context)
 
#define CONTEXT_DECREASE_NESTING(Context)
 
#define CONTEXT_PEEK_BYTES(Context, Bytes)
 
#define CONTEXT_CONSUME_BYTES(Context, Bytes)
 
#define CONTEXT_ADVANCE_OPCODE(Context)
 

Functions

EFI_STATUS InternalAcpiParseTerm (IN OUT ACPI_PARSER_CONTEXT *Context, OUT UINT8 **Result)
 

Detailed Description

Copyright (c) 2020-2021, Ubsefor & koralexa. All rights reserved. SPDX-License-Identifier: BSD-3-Clause

Definition in file AcpiParser.h.

Macro Definition Documentation

◆ CONTEXT_ADVANCE_OPCODE

#define CONTEXT_ADVANCE_OPCODE ( Context)
Value:
do {\
if ((UINT32) ((Context)->TableEnd - (Context)->CurrentOpcode) <= 1U) { \
return EFI_DEVICE_ERROR; \
} \
++(Context)->CurrentOpcode; \
} while (0)

Advance opcode to call the new parsing code. This one will error as long as there is no new opcode, i.e. one byte after the current one.

Definition at line 141 of file AcpiParser.h.

◆ CONTEXT_CONSUME_BYTES

#define CONTEXT_CONSUME_BYTES ( Context,
Bytes )
Value:
do {\
if ((UINT32) ((Context)->TableEnd - (Context)->CurrentOpcode) < (UINT32) (Bytes)) { \
return EFI_DEVICE_ERROR; \
} \
(Context)->CurrentOpcode += (Bytes); \
} while (0)

Consume the specified amount of bytes.

Definition at line 129 of file AcpiParser.h.

◆ CONTEXT_DECREASE_NESTING

#define CONTEXT_DECREASE_NESTING ( Context)
Value:
do {\
ASSERT ((Context)->Nesting > 0); \
--(Context)->Nesting; \
} while (0)

Exit nesting level. Does not need to be called on error-exit.

Definition at line 112 of file AcpiParser.h.

◆ CONTEXT_ENTER

#define CONTEXT_ENTER ( Context,
Name )
Value:
DEBUG (( \
DEBUG_VERBOSE, \
"%a 0x%x (looking for %c%c%c%c)\n", \
(Name), \
(UINT32) ((Context)->CurrentOpcode - (Context)->TableStart), \
((CHAR8 *) (Context)->CurrentIdentifier)[3], \
((CHAR8 *) (Context)->CurrentIdentifier)[2], \
((CHAR8 *) (Context)->CurrentIdentifier)[1], \
((CHAR8 *) (Context)->CurrentIdentifier)[0] \
));

Print new entry name.

Definition at line 58 of file AcpiParser.h.

◆ CONTEXT_HAS_WORK

#define CONTEXT_HAS_WORK ( Context)
Value:
do {\
ASSERT ((Context) != NULL); \
ASSERT ((Context)->CurrentOpcode != NULL); \
ASSERT ((Context)->TableEnd != NULL); \
ASSERT ((Context)->CurrentOpcode < (Context)->TableEnd); /* Must always have work to do. */ \
ASSERT ((Context)->PathStart != NULL); \
ASSERT ((Context)->PathEnd != NULL); \
ASSERT ((Context)->CurrentIdentifier != NULL); \
ASSERT ((Context)->CurrentIdentifier < (Context)->PathEnd); /* Must always have IDs to parse. */ \
ASSERT ((Context)->RequiredEntry > 0); \
ASSERT ((Context)->EntriesFound < (Context)->RequiredEntry); /* Must have entries to find. */ \
} while (0)

Check that context is valid and has work to do.

Definition at line 85 of file AcpiParser.h.

◆ CONTEXT_INCREASE_NESTING

#define CONTEXT_INCREASE_NESTING ( Context)
Value:
do {\
++(Context)->Nesting; \
if ((Context)->Nesting > MAX_NESTING) { \
return EFI_OUT_OF_RESOURCES; \
} \
} while (0)
#define MAX_NESTING
Definition AcpiParser.h:53

Enter new nesting level.

Definition at line 101 of file AcpiParser.h.

◆ CONTEXT_PEEK_BYTES

#define CONTEXT_PEEK_BYTES ( Context,
Bytes )
Value:
do {\
if ((UINT32) ((Context)->TableEnd - (Context)->CurrentOpcode) < (UINT32) (Bytes)) { \
return EFI_DEVICE_ERROR; \
} \
} while (0)

Check the specified amount of bytes exists.

Definition at line 120 of file AcpiParser.h.

◆ IDENT_LEN

#define IDENT_LEN   4

Definition at line 51 of file AcpiParser.h.

◆ MAX_NESTING

#define MAX_NESTING   1024

Definition at line 53 of file AcpiParser.h.

◆ OPCODE_LEN

#define OPCODE_LEN   8

Definition at line 52 of file AcpiParser.h.

◆ PRINT_ACPI_NAME

#define PRINT_ACPI_NAME ( Str,
Name,
Length )
Value:
DEBUG (( \
DEBUG_VERBOSE, \
"%a %u (%c%c%c%c)\n", \
(Str), \
(Length), \
(Length) > 0 ? (Name)[((Length) - 1) * 4 + 0] : 'Z', \
(Length) > 0 ? (Name)[((Length) - 1) * 4 + 1] : 'Z', \
(Length) > 0 ? (Name)[((Length) - 1) * 4 + 2] : 'Z', \
(Length) > 0 ? (Name)[((Length) - 1) * 4 + 3] : 'Z' \
));
UINT64 Length

Definition at line 70 of file AcpiParser.h.

Function Documentation

◆ InternalAcpiParseTerm()

EFI_STATUS InternalAcpiParseTerm ( IN OUT ACPI_PARSER_CONTEXT * Context,
OUT UINT8 ** Result )

Determines which object to parse (depending on the opcode) and calls the corresponding parser function.

Parameters
[in,out]ContextStructure containing the parser context.
[out]ResultPointer to sought opcode if required entry was found.
Return values
EFI_SUCCESSRequired entry was found (search complete).
EFI_NOT_FOUNDRequired entry was not found (more terms need to be parsed).
EFI_DEVICE_ERRORError occured during parsing (must abort).
EFI_OUT_OF_RESOURCESNesting limit has been reached (must abort).

Definition at line 1728 of file AcpiParser.c.