OpenCore  1.0.4
OpenCore Bootloader
Loading...
Searching...
No Matches
OcAcpiLib.c File Reference
#include <Uefi.h>
#include <Library/BaseLib.h>
#include <Library/BaseMemoryLib.h>
#include <Library/OcDebugLogLib.h>
#include <Library/MemoryAllocationLib.h>
#include <Library/UefiLib.h>
#include <Library/UefiBootServicesTableLib.h>
#include <Library/OcMemoryLib.h>
#include <Library/OcMiscLib.h>
#include <Library/PciLib.h>
#include <IndustryStandard/AcpiAml.h>
#include <IndustryStandard/Acpi.h>
#include <Guid/Acpi.h>
#include <Library/OcAcpiLib.h>

Go to the source code of this file.

Macros

#define PCI_VENDOR_NVIDIA   0x10DE
 

Functions

STATIC EFI_ACPI_6_2_ROOT_SYSTEM_DESCRIPTION_POINTER * AcpiFindLegacyRsdp (VOID)
 
STATIC EFI_ACPI_6_2_ROOT_SYSTEM_DESCRIPTION_POINTER * AcpiFindRsdp (VOID)
 
STATIC UINT32 AcpiReadSignature (IN CONST EFI_ACPI_COMMON_HEADER *Common)
 
STATIC UINT64 AcpiReadOemTableId (IN CONST EFI_ACPI_COMMON_HEADER *Common)
 
STATIC BOOLEAN AcpiReadName (IN CONST UINT8 *Data, OUT CHAR8 *Name, OUT UINT32 *NameOffset OPTIONAL)
 
STATIC UINT32 AcpiFindName (IN CONST UINT8 *Data, IN UINT32 Length, IN CONST CHAR8 *Name)
 
STATIC VOID AcpiRefreshTableChecksum (IN EFI_ACPI_DESCRIPTION_HEADER *Table)
 
STATIC BOOLEAN AcpiIsTableWritable (IN EFI_ACPI_COMMON_HEADER *Table)
 
STATIC EFI_STATUS AcpiAllocateCopyTable (IN EFI_ACPI_COMMON_HEADER *Table, IN UINT32 NewSize OPTIONAL, OUT EFI_ACPI_COMMON_HEADER **NewTable)
 
STATIC EFI_STATUS AcpiAllocateCopyFadt (IN OUT OC_ACPI_CONTEXT *Context, IN UINT32 NewSize)
 
STATIC EFI_STATUS AcpiAllocateCopyDsdt (IN OUT OC_ACPI_CONTEXT *Context, IN EFI_ACPI_DESCRIPTION_HEADER *NewDsdt OPTIONAL)
 
STATIC EFI_STATUS AcpiLoadTableRegions (IN OUT OC_ACPI_CONTEXT *Context, IN EFI_ACPI_COMMON_HEADER *Table)
 
STATIC VOID AcpiRelocateTableRegions (IN OUT OC_ACPI_CONTEXT *Context, IN EFI_ACPI_COMMON_HEADER *Table)
 
STATIC BOOLEAN AcpiNormalizeTableHeaders (IN EFI_ACPI_DESCRIPTION_HEADER *Table)
 
STATIC BOOLEAN AcpiNormalizeRsdp (IN EFI_ACPI_6_2_ROOT_SYSTEM_DESCRIPTION_POINTER *Rsdp, IN BOOLEAN HasXsdt)
 
EFI_STATUS AcpiInitContext (IN OUT OC_ACPI_CONTEXT *Context)
 
VOID AcpiFreeContext (IN OUT OC_ACPI_CONTEXT *Context)
 
EFI_STATUS AcpiApplyContext (IN OUT OC_ACPI_CONTEXT *Context)
 
EFI_STATUS AcpiDeleteTable (IN OUT OC_ACPI_CONTEXT *Context, IN UINT32 Signature, IN UINT32 Length, IN UINT64 OemTableId, IN BOOLEAN All)
 
EFI_STATUS AcpiInsertTable (IN OUT OC_ACPI_CONTEXT *Context, IN CONST UINT8 *Data, IN UINT32 Length)
 
VOID AcpiNormalizeHeaders (IN OUT OC_ACPI_CONTEXT *Context)
 
EFI_STATUS AcpiApplyPatch (IN OUT OC_ACPI_CONTEXT *Context, IN OC_ACPI_PATCH *Patch)
 
EFI_STATUS AcpiLoadRegions (IN OUT OC_ACPI_CONTEXT *Context)
 
VOID AcpiRelocateRegions (IN OUT OC_ACPI_CONTEXT *Context)
 
EFI_STATUS AcpiFadtEnableReset (IN OUT OC_ACPI_CONTEXT *Context)
 
VOID AcpiResetLogoStatus (IN OUT OC_ACPI_CONTEXT *Context)
 
VOID AcpiSyncTableIds (IN OUT OC_ACPI_CONTEXT *Context)
 
VOID AcpiHandleHardwareSignature (IN OUT OC_ACPI_CONTEXT *Context, IN BOOLEAN Reset)
 

Detailed Description

Copyright (C) 2016, The HermitCrabs Lab. All rights reserved.

All rights reserved.

This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at http://opensource.org/licenses/bsd-license.php

THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.

Definition in file OcAcpiLib.c.

Macro Definition Documentation

◆ PCI_VENDOR_NVIDIA

#define PCI_VENDOR_NVIDIA   0x10DE

Definition at line 33 of file OcAcpiLib.c.

Function Documentation

◆ AcpiAllocateCopyDsdt()

STATIC EFI_STATUS AcpiAllocateCopyDsdt ( IN OUT OC_ACPI_CONTEXT * Context,
IN EFI_ACPI_DESCRIPTION_HEADER *NewDsdt OPTIONAL )

Definition at line 396 of file OcAcpiLib.c.

◆ AcpiAllocateCopyFadt()

STATIC EFI_STATUS AcpiAllocateCopyFadt ( IN OUT OC_ACPI_CONTEXT * Context,
IN UINT32 NewSize )

Definition at line 362 of file OcAcpiLib.c.

◆ AcpiAllocateCopyTable()

STATIC EFI_STATUS AcpiAllocateCopyTable ( IN EFI_ACPI_COMMON_HEADER * Table,
IN UINT32 NewSize OPTIONAL,
OUT EFI_ACPI_COMMON_HEADER ** NewTable )

Definition at line 311 of file OcAcpiLib.c.

◆ AcpiApplyContext()

EFI_STATUS AcpiApplyContext ( IN OUT OC_ACPI_CONTEXT * Context)

Apply ACPI context to this system.

Parameters
[in,out]ContextACPI library context.

Definition at line 900 of file OcAcpiLib.c.

◆ AcpiApplyPatch()

EFI_STATUS AcpiApplyPatch ( IN OUT OC_ACPI_CONTEXT * Context,
IN OC_ACPI_PATCH * Patch )

Patch ACPI tables.

Parameters
[in,out]ContextACPI library context.
[in]PatchACPI patch.

Definition at line 1247 of file OcAcpiLib.c.

◆ AcpiDeleteTable()

EFI_STATUS AcpiDeleteTable ( IN OUT OC_ACPI_CONTEXT * Context,
IN UINT32 Signature,
IN UINT32 Length,
IN UINT64 OemTableId,
IN BOOLEAN All )

Delete one ACPI table.

Parameters
[in,out]ContextACPI library context.
[in]SignatureTable signature or 0.
[in]LengthTable length or 0.
[in]OemTableIdTable Id or 0.
[in]AllDelete all tables or first matched.

Definition at line 1015 of file OcAcpiLib.c.

◆ AcpiFadtEnableReset()

EFI_STATUS AcpiFadtEnableReset ( IN OUT OC_ACPI_CONTEXT * Context)

Upgrade FADT to support reset register needed on very old legacy hardware.

Parameters
[in,out]ContextACPI library context.
Returns
EFI_SUCCESS if successful or not needed.

Definition at line 1510 of file OcAcpiLib.c.

◆ AcpiFindLegacyRsdp()

STATIC EFI_ACPI_6_2_ROOT_SYSTEM_DESCRIPTION_POINTER * AcpiFindLegacyRsdp ( VOID )

Find RSD_PTR Table In Legacy Area

Return values
EFI_ACPI_6_0_ROOT_SYSTEM_DESCRIPTION_POINTER

Definition at line 42 of file OcAcpiLib.c.

◆ AcpiFindName()

STATIC UINT32 AcpiFindName ( IN CONST UINT8 * Data,
IN UINT32 Length,
IN CONST CHAR8 * Name )

Find ACPI name declaration in data.

Parameters
DataACPI table data.
LengthACPI table data length.
NameACPI name of at least OC_ACPI_NAME_SIZE bytes.
Returns
offset > 0 for valid names.

Definition at line 241 of file OcAcpiLib.c.

◆ AcpiFindRsdp()

STATIC EFI_ACPI_6_2_ROOT_SYSTEM_DESCRIPTION_POINTER * AcpiFindRsdp ( VOID )

Find RSD_PTR Table From System Configuration Tables

Return values
EFI_ACPI_6_0_ROOT_SYSTEM_DESCRIPTION_POINTER

Definition at line 87 of file OcAcpiLib.c.

◆ AcpiFreeContext()

VOID AcpiFreeContext ( IN OUT OC_ACPI_CONTEXT * Context)

Free ACPI context dynamic resources.

Parameters
[in,out]ContextACPI library context.

Definition at line 884 of file OcAcpiLib.c.

◆ AcpiHandleHardwareSignature()

VOID AcpiHandleHardwareSignature ( IN OUT OC_ACPI_CONTEXT * Context,
IN BOOLEAN Reset )

Log and reset FACS hardware signature.

Parameters
[in,out]ContextACPI library context.
[in]ResetPerform reset.

Definition at line 1700 of file OcAcpiLib.c.

◆ AcpiInitContext()

EFI_STATUS AcpiInitContext ( IN OUT OC_ACPI_CONTEXT * Context)

Find ACPI System Tables for later table configuration.

Parameters
[in,out]ContextACPI library context.
Returns
EFI_SUCCESS when Rsdp and Xsdt or Rsdt are found.

Definition at line 738 of file OcAcpiLib.c.

◆ AcpiInsertTable()

EFI_STATUS AcpiInsertTable ( IN OUT OC_ACPI_CONTEXT * Context,
IN CONST UINT8 * Data,
IN UINT32 Length )

Install one ACPI table. For DSDT this performs table replacement.

Parameters
[in,out]ContextACPI library context.
[in]DataTable data.
[in]LengthTable length.

Definition at line 1082 of file OcAcpiLib.c.

◆ AcpiIsTableWritable()

STATIC BOOLEAN AcpiIsTableWritable ( IN EFI_ACPI_COMMON_HEADER * Table)

Definition at line 292 of file OcAcpiLib.c.

◆ AcpiLoadRegions()

EFI_STATUS AcpiLoadRegions ( IN OUT OC_ACPI_CONTEXT * Context)

Try to load ACPI regions.

Parameters
[in,out]ContextACPI library context.

Definition at line 1421 of file OcAcpiLib.c.

◆ AcpiLoadTableRegions()

STATIC EFI_STATUS AcpiLoadTableRegions ( IN OUT OC_ACPI_CONTEXT * Context,
IN EFI_ACPI_COMMON_HEADER * Table )

Load ACPI table regions.

Parameters
ContextACPI library context.
TableACPI table.
Returns
EFI_SUCCESS unless memory allocation failure.

Definition at line 446 of file OcAcpiLib.c.

◆ AcpiNormalizeHeaders()

VOID AcpiNormalizeHeaders ( IN OUT OC_ACPI_CONTEXT * Context)

Normalise ACPI headers to contain 7-bit ASCII.

Parameters
[in,out]ContextACPI library context.

Definition at line 1164 of file OcAcpiLib.c.

◆ AcpiNormalizeRsdp()

STATIC BOOLEAN AcpiNormalizeRsdp ( IN EFI_ACPI_6_2_ROOT_SYSTEM_DESCRIPTION_POINTER * Rsdp,
IN BOOLEAN HasXsdt )

Cleanup RSDP table from unprintable symbols. Reference: https://alextjam.es/debugging-appleacpiplatform/.

Parameters
RsdpRSDP table.
HasXsdtRSDP has XSDT and is extended.

Definition at line 695 of file OcAcpiLib.c.

◆ AcpiNormalizeTableHeaders()

STATIC BOOLEAN AcpiNormalizeTableHeaders ( IN EFI_ACPI_DESCRIPTION_HEADER * Table)

Cleanup ACPI table from unprintable symbols. Reference: https://alextjam.es/debugging-appleacpiplatform/.

Parameters
TableACPI table.

Definition at line 629 of file OcAcpiLib.c.

◆ AcpiReadName()

STATIC BOOLEAN AcpiReadName ( IN CONST UINT8 * Data,
OUT CHAR8 * Name,
OUT UINT32 *NameOffset OPTIONAL )

Extract and verify ACPI name from data.

Parameters
DataData of at least OC_ACPI_NAME_SIZE+1 bytes to read name from.
NameName buffer of at least OC_ACPI_NAME_SIZE+1 bytes.
NameOffsetName offset from original data (1 if '\' and 0 otherwise).
Returns
TRUE for valid names.

Definition at line 196 of file OcAcpiLib.c.

◆ AcpiReadOemTableId()

STATIC UINT64 AcpiReadOemTableId ( IN CONST EFI_ACPI_COMMON_HEADER * Common)

Extract and verify ACPI OemTableId from common header.

Parameters
CommonACPI common header.
Returns
OemTableId or 0.

Definition at line 174 of file OcAcpiLib.c.

◆ AcpiReadSignature()

STATIC UINT32 AcpiReadSignature ( IN CONST EFI_ACPI_COMMON_HEADER * Common)

Extract and verify ACPI signature from common header.

Parameters
CommonACPI common header.
Returns
Signature.

Definition at line 145 of file OcAcpiLib.c.

◆ AcpiRefreshTableChecksum()

STATIC VOID AcpiRefreshTableChecksum ( IN EFI_ACPI_DESCRIPTION_HEADER * Table)

Definition at line 272 of file OcAcpiLib.c.

◆ AcpiRelocateRegions()

VOID AcpiRelocateRegions ( IN OUT OC_ACPI_CONTEXT * Context)

Attempt to relocate ACPI regions based on loaded ones.

Parameters
[in,out]ContextACPI library context.

Definition at line 1465 of file OcAcpiLib.c.

◆ AcpiRelocateTableRegions()

STATIC VOID AcpiRelocateTableRegions ( IN OUT OC_ACPI_CONTEXT * Context,
IN EFI_ACPI_COMMON_HEADER * Table )

Relocate ACPI table regions.

Parameters
ContextACPI library context.
TableACPI table.

Definition at line 534 of file OcAcpiLib.c.

◆ AcpiResetLogoStatus()

VOID AcpiResetLogoStatus ( IN OUT OC_ACPI_CONTEXT * Context)

Reset BGRT Displayed status.

Parameters
[in,out]ContextACPI library context.

Definition at line 1596 of file OcAcpiLib.c.

◆ AcpiSyncTableIds()

VOID AcpiSyncTableIds ( IN OUT OC_ACPI_CONTEXT * Context)

Sync ACPI table identifiers with SLIC.

Parameters
[in,out]ContextACPI library context.

Definition at line 1640 of file OcAcpiLib.c.