OpenCore
1.0.4
OpenCore Bootloader
|
#include <Uefi.h>
#include <IndustryStandard/Acpi62.h>
#include <Library/OcAcpiLib.h>
#include <Library/BaseMemoryLib.h>
#include <Library/DebugLib.h>
#include <Library/MemoryAllocationLib.h>
#include <Library/UefiLib.h>
#include <Library/UefiApplicationEntryPoint.h>
#include <Library/UefiBootServicesTableLib.h>
#include <IndustryStandard/AcpiAml.h>
#include "AcpiParser.h"
Go to the source code of this file.
Functions | |
STATIC EFI_STATUS | ParseNameString (IN OUT ACPI_PARSER_CONTEXT *Context, IN OUT UINT8 **NamePathStart OPTIONAL, IN OUT UINT8 *PathLength OPTIONAL, IN OUT UINT8 *IsRootPath OPTIONAL) |
STATIC EFI_STATUS | ParsePkgLength (IN OUT ACPI_PARSER_CONTEXT *Context, OUT UINT32 *PkgLength) |
STATIC EFI_STATUS | ParseAlias (IN OUT ACPI_PARSER_CONTEXT *Context) |
STATIC EFI_STATUS | ParseScopeOrDevice (IN OUT ACPI_PARSER_CONTEXT *Context, OUT UINT8 **Result) |
STATIC EFI_STATUS | ParseName (IN OUT ACPI_PARSER_CONTEXT *Context) |
STATIC EFI_STATUS | ParseBankField (IN OUT ACPI_PARSER_CONTEXT *Context, OUT UINT8 **Result) |
STATIC EFI_STATUS | ParseCreateField (IN OUT ACPI_PARSER_CONTEXT *Context, OUT UINT8 **Result) |
STATIC EFI_STATUS | ParseExternal (IN OUT ACPI_PARSER_CONTEXT *Context) |
STATIC EFI_STATUS | ParseOpRegion (IN OUT ACPI_PARSER_CONTEXT *Context) |
STATIC EFI_STATUS | ParsePowerRes (IN OUT ACPI_PARSER_CONTEXT *Context) |
STATIC EFI_STATUS | ParseProcessor (IN OUT ACPI_PARSER_CONTEXT *Context) |
STATIC EFI_STATUS | ParseThermalZone (IN OUT ACPI_PARSER_CONTEXT *Context) |
STATIC EFI_STATUS | ParseMethod (IN OUT ACPI_PARSER_CONTEXT *Context, OUT UINT8 **Result) |
STATIC EFI_STATUS | ParseIfElse (IN OUT ACPI_PARSER_CONTEXT *Context, OUT UINT8 **Result) |
STATIC EFI_STATUS | ParseEvent (IN OUT ACPI_PARSER_CONTEXT *Context) |
STATIC EFI_STATUS | ParseField (IN OUT ACPI_PARSER_CONTEXT *Context, OUT UINT8 **Result) |
STATIC EFI_STATUS | ParseMutex (IN OUT ACPI_PARSER_CONTEXT *Context) |
STATIC EFI_STATUS | ParseIndexField (IN OUT ACPI_PARSER_CONTEXT *Context, OUT UINT8 **Result) |
EFI_STATUS | InternalAcpiParseTerm (IN OUT ACPI_PARSER_CONTEXT *Context, OUT UINT8 **Result) |
EFI_STATUS | TranslateNameToOpcodes (IN CONST CHAR8 *Name, IN CONST CHAR8 *NameEnd, OUT UINT32 *OpcodeName) |
EFI_STATUS | GetOpcodeArray (IN OUT ACPI_PARSER_CONTEXT *Context, IN CONST CHAR8 *PathString) |
VOID | InitContext (OUT ACPI_PARSER_CONTEXT *Context) |
VOID | ClearContext (IN OUT ACPI_PARSER_CONTEXT *Context) |
EFI_STATUS | AcpiFindEntryInMemory (IN UINT8 *Table, IN CONST CHAR8 *PathString, IN UINT8 Entry, OUT UINT32 *Offset, IN UINT32 TableLength OPTIONAL) |
Copyright (c) 2020-2021, Ubsefor & koralexa. All rights reserved. Copyright (c) 2021, vit9696. All rights reserved. SPDX-License-Identifier: BSD-3-Clause
Definition in file AcpiParser.c.
EFI_STATUS AcpiFindEntryInMemory | ( | IN UINT8 * | Table, |
IN CONST CHAR8 * | PathString, | ||
IN UINT8 | Entry, | ||
OUT UINT32 * | Offset, | ||
IN UINT32 TableLength | OPTIONAL ) |
Finds offset of required entry in ACPI table in case it exists.
[in] | Table | Pointer to start of ACPI table. |
[in] | PathString | Path to entry which must be found. |
[in] | Entry | Number of entry which must be found. |
[out] | Offset | Offset of the entry if it was found. |
[out] | TableLength | Length of ACPI table. |
EFI_SUCCESS | Required entry was found. |
EFI_NOT_FOUND | Required entry was not found. |
EFI_DEVICE_ERROR | Error occured during parsing ACPI table. |
EFI_OUT_OF_RESOURCES | Nesting limit has been reached. |
EFI_INVALID_PARAMETER | Got wrong path to the entry. |
Definition at line 2021 of file AcpiParser.c.
VOID ClearContext | ( | IN OUT ACPI_PARSER_CONTEXT * | Context | ) |
Deinitialises ACPI Context parser variable which stores ACPI header.
[in,out] | Context | Address to a context structure, containing the parser context. |
Definition at line 2008 of file AcpiParser.c.
EFI_STATUS GetOpcodeArray | ( | IN OUT ACPI_PARSER_CONTEXT * | Context, |
IN CONST CHAR8 * | PathString ) |
Translates path (one or more identifiers) to AML opcodes.
[in,out] | Context | Structure containing the parser context. |
[in] | PathString | Original path. |
EFI_SUCCESS | Path was translated successfuly. |
EFI_INVALID_PARAMETER | Path can't be translated to opcodes. |
Definition at line 1917 of file AcpiParser.c.
VOID InitContext | ( | OUT ACPI_PARSER_CONTEXT * | Context | ) |
Initializes ACPI Context parser variable which stores ACPI header.
[out] | Context | Address to a context structure, containing the parser context. |
Definition at line 1993 of file AcpiParser.c.
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.
[in,out] | Context | Structure containing the parser context. |
[out] | Result | Pointer to sought opcode if required entry was found. |
EFI_SUCCESS | Required entry was found (search complete). |
EFI_NOT_FOUND | Required entry was not found (more terms need to be parsed). |
EFI_DEVICE_ERROR | Error occured during parsing (must abort). |
EFI_OUT_OF_RESOURCES | Nesting limit has been reached (must abort). |
Definition at line 1728 of file AcpiParser.c.
STATIC EFI_STATUS ParseAlias | ( | IN OUT ACPI_PARSER_CONTEXT * | Context | ) |
Parses alias section to skip it correctly.
[in,out] | Context | Structure containing the parser context. |
EFI_NOT_FOUND | Alias was parsed and skipped successfuly. |
EFI_DEVICE_ERROR | Error occured during parsing alias. |
EFI_OUT_OF_RESOURCES | Nesting limit has been reached. |
Definition at line 172 of file AcpiParser.c.
STATIC EFI_STATUS ParseBankField | ( | IN OUT ACPI_PARSER_CONTEXT * | Context, |
OUT UINT8 ** | Result ) |
Parses bank field section. In case it's name is suitable returns pointer to it's opcode. Otherwise skips this section.
[in,out] | Context | Structure containing the parser context. |
[out] | Result | Pointer to sought opcode if required entry was found. |
EFI_SUCCESS | Required entry was found. |
EFI_NOT_FOUND | Bank field was parsed and skipped successfuly. |
EFI_DEVICE_ERROR | Error occured during parsing bank field. |
EFI_OUT_OF_RESOURCES | Nesting limit has been reached. |
Definition at line 456 of file AcpiParser.c.
STATIC EFI_STATUS ParseCreateField | ( | IN OUT ACPI_PARSER_CONTEXT * | Context, |
OUT UINT8 ** | Result ) |
Parses create field section (any of CreateDwordField, CreateWordField, CreateByteField, CreateBitField, CreateQWordField, CreateField sections). In case it's name is suitable returns pointer to it's opcode. Otherwise skips this section.
[in,out] | Context | Structure containing the parser context. |
[out] | Result | Pointer to sought opcode if required entry was found. |
EFI_SUCCESS | Required entry was found. |
EFI_NOT_FOUND | Field was parsed and skipped successfuly. |
EFI_DEVICE_ERROR | Error occured during parsing field. |
EFI_OUT_OF_RESOURCES | Nesting limit has been reached. |
Definition at line 603 of file AcpiParser.c.
STATIC EFI_STATUS ParseEvent | ( | IN OUT ACPI_PARSER_CONTEXT * | Context | ) |
Parses event section to skip it correctly.
[in,out] | Context | Structure containing the parser context. |
EFI_NOT_FOUND | Event was parsed and skipped successfuly. |
EFI_DEVICE_ERROR | Error occured during parsing event. |
EFI_OUT_OF_RESOURCES | Nesting limit has been reached. |
Definition at line 1416 of file AcpiParser.c.
STATIC EFI_STATUS ParseExternal | ( | IN OUT ACPI_PARSER_CONTEXT * | Context | ) |
Parses external section to correctly skip it.
[in,out] | Context | Structure containing the parser context. |
EFI_NOT_FOUND | External was parsed and skipped successfuly. |
EFI_DEVICE_ERROR | Error occured during parsing external. |
EFI_OUT_OF_RESOURCES | Nesting limit has been reached. |
Definition at line 767 of file AcpiParser.c.
STATIC EFI_STATUS ParseField | ( | IN OUT ACPI_PARSER_CONTEXT * | Context, |
OUT UINT8 ** | Result ) |
Parses field section. In case it's name is suitable returns pointer to it's opcode. Otherwise skips this section.
[in,out] | Context | Structure containing the parser context. |
[out] | Result | Pointer to sought opcode if required entry was found. |
EFI_SUCCESS | Required entry was found. |
EFI_NOT_FOUND | Field was parsed and skipped successfuly. |
EFI_DEVICE_ERROR | Error occured during parsing field. |
EFI_OUT_OF_RESOURCES | Nesting limit has been reached. |
Definition at line 1453 of file AcpiParser.c.
STATIC EFI_STATUS ParseIfElse | ( | IN OUT ACPI_PARSER_CONTEXT * | Context, |
OUT UINT8 ** | Result ) |
Parses if-else section. Looks for other sections inside it.
[in,out] | Context | Structure containing the parser context. |
[out] | Result | Pointer to sought opcode if required entry was found. |
EFI_SUCCESS | Required entry was found. |
EFI_NOT_FOUND | If-else section was parsed and skipped successfuly. |
EFI_DEVICE_ERROR | Error occured during parsing if-else section. |
EFI_OUT_OF_RESOURCES | Nesting limit has been reached. |
Definition at line 1300 of file AcpiParser.c.
STATIC EFI_STATUS ParseIndexField | ( | IN OUT ACPI_PARSER_CONTEXT * | Context, |
OUT UINT8 ** | Result ) |
Parses index field section. In case it's name is suitable returns pointer to it's opcode. Otherwise skips this section.
[in,out] | Context | Structure containing the parser context. |
[out] | Result | Pointer to sought opcode if required entry was found. |
EFI_SUCCESS | Required entry was found. |
EFI_NOT_FOUND | Index field was parsed and skipped successfuly. |
EFI_DEVICE_ERROR | Error occured during parsing index field. |
EFI_OUT_OF_RESOURCES | Nesting limit has been reached. |
Definition at line 1597 of file AcpiParser.c.
STATIC EFI_STATUS ParseMethod | ( | IN OUT ACPI_PARSER_CONTEXT * | Context, |
OUT UINT8 ** | Result ) |
Parses method section. In case it's name is suitable returns pointer to it's opcode. Otherwise skips this section.
[in,out] | Context | Structure containing the parser context. |
[out] | Result | Pointer to sought opcode if required entry was found. |
EFI_SUCCESS | Required entry was found. |
EFI_NOT_FOUND | Method was parsed and skipped successfuly. |
EFI_DEVICE_ERROR | Error occured during parsing method. |
EFI_OUT_OF_RESOURCES | Nesting limit has been reached. |
Definition at line 1190 of file AcpiParser.c.
STATIC EFI_STATUS ParseMutex | ( | IN OUT ACPI_PARSER_CONTEXT * | Context | ) |
Parses mutex to correctly skip it.
[in,out] | Context | Structure containing the parser context. |
EFI_NOT_FOUND | Mutex was parsed and skipped successfuly. |
EFI_DEVICE_ERROR | Error occured during parsing mutex. |
EFI_OUT_OF_RESOURCES | Nesting limit has been reached. |
Definition at line 1559 of file AcpiParser.c.
STATIC EFI_STATUS ParseName | ( | IN OUT ACPI_PARSER_CONTEXT * | Context | ) |
Parses name section to correctly skip it.
[in,out] | Context | Structure containing the parser context. |
EFI_NOT_FOUND | Name was parsed and skipped successfuly. |
EFI_DEVICE_ERROR | Error occured during parsing name. |
EFI_OUT_OF_RESOURCES | Nesting limit has been reached. |
Definition at line 354 of file AcpiParser.c.
STATIC EFI_STATUS ParseNameString | ( | IN OUT ACPI_PARSER_CONTEXT * | Context, |
IN OUT UINT8 **NamePathStart | OPTIONAL, | ||
IN OUT UINT8 *PathLength | OPTIONAL, | ||
IN OUT UINT8 *IsRootPath | OPTIONAL ) |
Parses identifier or path (several identifiers). Returns info about the identifier / path if necessary.
[in,out] | Context | Structure containing the parser context. |
[in,out] | NamePathStart | Pointer to first opcode of identifier / path. |
[in,out] | PathLength | Quantity of identifiers in path. |
[in,out] | IsRootPath | 1 if parsed path was a root path, 0 otherwise. |
EFI_SUCCESS | Name was parsed successfuly. |
EFI_DEVICE_ERROR | Error occured during parsing. |
EFI_OUT_OF_RESOURCES | Nesting limit has been reached. |
Definition at line 35 of file AcpiParser.c.
STATIC EFI_STATUS ParseOpRegion | ( | IN OUT ACPI_PARSER_CONTEXT * | Context | ) |
Parses operation region to skip it correctly.
[in,out] | Context | Structure containing the parser context. |
EFI_NOT_FOUND | OpRegion was parsed and skipped successfuly. |
EFI_DEVICE_ERROR | Error occured during parsing OpRegion. |
EFI_OUT_OF_RESOURCES | Nesting limit has been reached. |
Definition at line 801 of file AcpiParser.c.
STATIC EFI_STATUS ParsePkgLength | ( | IN OUT ACPI_PARSER_CONTEXT * | Context, |
OUT UINT32 * | PkgLength ) |
Parses package length (length of current section).
[in,out] | Context | Structure containing the parser context. |
[out] | PkgLength | Total length of section. |
EFI_SUCCESS | Length was parsed successfuly. |
EFI_DEVICE_ERROR | Error occured during parsing length. |
EFI_OUT_OF_RESOURCES | Nesting limit has been reached. |
Definition at line 123 of file AcpiParser.c.
STATIC EFI_STATUS ParsePowerRes | ( | IN OUT ACPI_PARSER_CONTEXT * | Context | ) |
Parses PowerRes to skip it correctly.
[in,out] | Context | Structure containing the parser context. |
EFI_NOT_FOUND | PowerRes was parsed and skipped successfuly. |
EFI_DEVICE_ERROR | Error occured during parsing PowerRes. |
EFI_OUT_OF_RESOURCES | Nesting limit has been reached. |
Definition at line 1072 of file AcpiParser.c.
STATIC EFI_STATUS ParseProcessor | ( | IN OUT ACPI_PARSER_CONTEXT * | Context | ) |
Parses processor section to skip it correctly.
[in,out] | Context | Structure containing the parser context. |
EFI_NOT_FOUND | Processor was parsed and skipped successfuly. |
EFI_DEVICE_ERROR | Error occured during parsing processor. |
EFI_OUT_OF_RESOURCES | Nesting limit has been reached. |
Definition at line 1110 of file AcpiParser.c.
STATIC EFI_STATUS ParseScopeOrDevice | ( | IN OUT ACPI_PARSER_CONTEXT * | Context, |
OUT UINT8 ** | Result ) |
Parses scope or device section. In case it's name is suitable parses elements inside it, or returns pointer to it's opcode if this scope / device was sought. Otherwise skips this section.
[in,out] | Context | Structure containing the parser context. |
[out] | Result | Pointer to sought opcode if required entry was found. |
EFI_SUCCESS | Required entry was found. |
EFI_NOT_FOUND | Scope / device was parsed and skipped successfuly. |
EFI_DEVICE_ERROR | Error occured during parsing scope / device. |
EFI_OUT_OF_RESOURCES | Nesting limit has been reached. |
Definition at line 221 of file AcpiParser.c.
STATIC EFI_STATUS ParseThermalZone | ( | IN OUT ACPI_PARSER_CONTEXT * | Context | ) |
Parses thermal zone to skip it correctly.
[in,out] | Context | Structure containing the parser context. |
EFI_NOT_FOUND | Processor was parsed and skipped successfuly. |
EFI_DEVICE_ERROR | Error occured during parsing processor. |
EFI_OUT_OF_RESOURCES | Nesting limit has been reached. |
Definition at line 1148 of file AcpiParser.c.
EFI_STATUS TranslateNameToOpcodes | ( | IN CONST CHAR8 * | Name, |
IN CONST CHAR8 * | NameEnd, | ||
OUT UINT32 * | OpcodeName ) |
Translates one identifier to AML opcodes. Complements it with '_' opcodes if identifier length is under 4.
[in] | Name | Pointer to the start of the identifier. |
[in] | NameEnd | Pointer to the end of the identifier. |
[out] | OpcodeName | Identifier translated to opcodes. |
EFI_SUCCESS | Identifier was translated successfuly. |
EFI_INVALID_PARAMETER | Identifier can't be translated to opcodes. |
Definition at line 1860 of file AcpiParser.c.