OpenCore  1.0.4
OpenCore Bootloader
Loading...
Searching...
No Matches
UserMisc.c File Reference
#include <Uefi.h>
#include <Library/UefiLib.h>
#include <Library/UefiApplicationEntryPoint.h>
#include <Library/DebugLib.h>

Go to the source code of this file.

Functions

VOID EFIAPI CpuBreakpoint (VOID)
 
VOID EFIAPI CpuPause (VOID)
 
VOID EFIAPI DisableInterrupts (VOID)
 
VOID EFIAPI EnableInterrupts (VOID)
 
UINT32 AsmCpuid (IN UINT32 Index, OUT UINT32 *Eax, OPTIONAL OUT UINT32 *Ebx, OPTIONAL OUT UINT32 *Ecx, OPTIONAL OUT UINT32 *Edx OPTIONAL)
 
UINT32 AsmCpuidEx (IN UINT32 Index, IN UINT32 SubIndex, OUT UINT32 *Eax, OPTIONAL OUT UINT32 *Ebx, OPTIONAL OUT UINT32 *Ecx, OPTIONAL OUT UINT32 *Edx OPTIONAL)
 
UINT32 EFIAPI AsmIncrementUint32 (IN volatile UINT32 *Value)
 
UINT32 EFIAPI AsmReadIntelMicrocodeRevision (VOID)
 
UINTN EFIAPI AsmReadCr4 (VOID)
 
UINT16 EFIAPI AsmReadCs (VOID)
 
UINTN EFIAPI AsmReadEflags (VOID)
 
UINT64 EFIAPI AsmReadMsr64 (IN UINT32 Index)
 
UINT64 EFIAPI AsmReadTsc (VOID)
 
UINTN EFIAPI AsmWriteCr4 (UINTN Cr4)
 
UINT64 EFIAPI AsmWriteMsr64 (IN UINT32 Index, IN UINT64 Value)
 
UINT64 EFIAPI AsmMsrAndThenOr64 (IN UINT32 Index, IN UINT64 AndData, IN UINT64 OrData)
 
VOID EFIAPI AsmDisableCache (VOID)
 
VOID EFIAPI AsmEnableCache (VOID)
 
VOID EFIAPI CpuFlushTlb (VOID)
 
UINT8 EFIAPI IoRead8 (IN UINTN Port)
 
UINT8 EFIAPI IoWrite8 (IN UINTN Port, IN UINT8 Value)
 
UINT32 EFIAPI IoRead32 (IN UINTN Port)
 
UINT32 EFIAPI IoWrite32 (IN UINTN Port, IN UINT32 Value)
 
UINT16 EFIAPI MmioAnd16 (IN UINTN Address, IN UINT16 AndData)
 
UINT32 EFIAPI MmioAnd32 (IN UINTN Address, IN UINT16 AndData)
 
UINT8 EFIAPI MmioAnd8 (IN UINTN Address, IN UINT8 AndData)
 
UINT16 EFIAPI MmioAndThenOr16 (IN UINTN Address, IN UINT16 AndData, IN UINT16 OrData)
 
UINT32 EFIAPI MmioAndThenOr32 (IN UINTN Address, IN UINT32 AndData, IN UINT32 OrData)
 
UINT8 EFIAPI MmioAndThenOr8 (IN UINTN Address, IN UINT8 AndData, IN UINT8 OrData)
 
UINT16 EFIAPI MmioBitFieldAnd16 (IN UINTN Address, IN UINTN StartBit, IN UINTN EndBit, IN UINT16 AndData)
 
UINT32 EFIAPI MmioBitFieldAnd32 (IN UINTN Address, IN UINTN StartBit, IN UINTN EndBit, IN UINT32 AndData)
 
UINT8 EFIAPI MmioBitFieldAnd8 (IN UINTN Address, IN UINTN StartBit, IN UINTN EndBit, IN UINT8 AndData)
 
UINT16 EFIAPI MmioBitFieldAndThenOr16 (IN UINTN Address, IN UINTN StartBit, IN UINTN EndBit, IN UINT16 AndData, IN UINT16 OrData)
 
UINT32 EFIAPI MmioBitFieldAndThenOr32 (IN UINTN Address, IN UINTN StartBit, IN UINTN EndBit, IN UINT32 AndData, IN UINT32 OrData)
 
UINT8 EFIAPI MmioBitFieldAndThenOr8 (IN UINTN Address, IN UINTN StartBit, IN UINTN EndBit, IN UINT8 AndData, IN UINT8 OrData)
 
UINT16 EFIAPI MmioBitFieldOr16 (IN UINTN Address, IN UINTN StartBit, IN UINTN EndBit, IN UINT16 OrData)
 
UINT32 EFIAPI MmioBitFieldOr32 (IN UINTN Address, IN UINTN StartBit, IN UINTN EndBit, IN UINT32 OrData)
 
UINT8 EFIAPI MmioBitFieldOr8 (IN UINTN Address, IN UINTN StartBit, IN UINTN EndBit, IN UINT8 OrData)
 
UINT16 EFIAPI MmioBitFieldRead16 (IN UINTN Address, IN UINTN StartBit, IN UINTN EndBit)
 
UINT32 EFIAPI MmioBitFieldRead32 (IN UINTN Address, IN UINTN StartBit, IN UINTN EndBit)
 
UINT8 EFIAPI MmioBitFieldRead8 (IN UINTN Address, IN UINTN StartBit, IN UINTN EndBit)
 
UINT16 EFIAPI MmioBitFieldWrite16 (IN UINTN Address, IN UINTN StartBit, IN UINTN EndBit, IN UINT16 Value)
 
UINT32 EFIAPI MmioBitFieldWrite32 (IN UINTN Address, IN UINTN StartBit, IN UINTN EndBit, IN UINT32 Value)
 
UINT8 EFIAPI MmioBitFieldWrite8 (IN UINTN Address, IN UINTN StartBit, IN UINTN EndBit, IN UINT8 Value)
 
UINT16 EFIAPI MmioOr16 (IN UINTN Address, IN UINT16 OrData)
 
UINT32 EFIAPI MmioOr32 (IN UINTN Address, IN UINT32 OrData)
 
UINT8 EFIAPI MmioOr8 (IN UINTN Address, IN UINT8 OrData)
 
UINT16 EFIAPI MmioRead16 (IN UINTN Address)
 
UINT32 EFIAPI MmioRead32 (IN UINTN Address)
 
UINT8 EFIAPI MmioRead8 (IN UINTN Address)
 
UINT16 EFIAPI MmioWrite16 (IN UINTN Address, IN UINT16 Value)
 
UINT32 EFIAPI MmioWrite32 (IN UINTN Address, IN UINT32 Value)
 
UINT8 EFIAPI MmioWrite8 (IN UINTN Address, IN UINT8 Value)
 
VOID *EFIAPI GetFirstGuidHob (IN CONST EFI_GUID *Guid)
 
EFI_DEVICE_PATH_PROTOCOL *EFIAPI DevicePathFromHandle (IN EFI_HANDLE Handle)
 
EFI_FILE_PROTOCOL * OcLocateRootVolume (IN EFI_HANDLE DeviceHandle OPTIONAL, IN EFI_DEVICE_PATH_PROTOCOL *FilePath OPTIONAL)
 
UINTN GetSerialRegisterBase (VOID)
 

Detailed Description

Copyright (c) 2020, PMheart. All rights reserved. SPDX-License-Identifier: BSD-3-Clause

Definition in file UserMisc.c.

Function Documentation

◆ AsmCpuid()

UINT32 AsmCpuid ( IN UINT32 Index,
OUT UINT32 * Eax,
OPTIONAL OUT UINT32 * Ebx,
OPTIONAL OUT UINT32 * Ecx,
OPTIONAL OUT UINT32 *Edx OPTIONAL )

Definition at line 45 of file UserMisc.c.

◆ AsmCpuidEx()

UINT32 AsmCpuidEx ( IN UINT32 Index,
IN UINT32 SubIndex,
OUT UINT32 * Eax,
OPTIONAL OUT UINT32 * Ebx,
OPTIONAL OUT UINT32 * Ecx,
OPTIONAL OUT UINT32 *Edx OPTIONAL )

Definition at line 109 of file UserMisc.c.

◆ AsmDisableCache()

VOID EFIAPI AsmDisableCache ( VOID )

Definition at line 274 of file UserMisc.c.

◆ AsmEnableCache()

VOID EFIAPI AsmEnableCache ( VOID )

Definition at line 282 of file UserMisc.c.

◆ AsmIncrementUint32()

UINT32 EFIAPI AsmIncrementUint32 ( IN volatile UINT32 * Value)

Atomically increment 32-bit integer. This is required to be locally implemented as we cannot use SynchronizationLib, which depends on TimerLib, and our TimerLib depends on this library.

Parameters
[in]ValuePointer to 32-bit integer to increment.
Return values
valueafter incrementing.

Definition at line 176 of file UserMisc.c.

◆ AsmMsrAndThenOr64()

UINT64 EFIAPI AsmMsrAndThenOr64 ( IN UINT32 Index,
IN UINT64 AndData,
IN UINT64 OrData )

Definition at line 260 of file UserMisc.c.

◆ AsmReadCr4()

UINTN EFIAPI AsmReadCr4 ( VOID )

Definition at line 196 of file UserMisc.c.

◆ AsmReadCs()

UINT16 EFIAPI AsmReadCs ( VOID )

Definition at line 205 of file UserMisc.c.

◆ AsmReadEflags()

UINTN EFIAPI AsmReadEflags ( VOID )

Definition at line 214 of file UserMisc.c.

◆ AsmReadIntelMicrocodeRevision()

UINT32 EFIAPI AsmReadIntelMicrocodeRevision ( VOID )

Returns microcode revision for Intel CPUs.

Return values
microcoderevision.

Definition at line 187 of file UserMisc.c.

◆ AsmReadMsr64()

UINT64 EFIAPI AsmReadMsr64 ( IN UINT32 Index)

Definition at line 223 of file UserMisc.c.

◆ AsmReadTsc()

UINT64 EFIAPI AsmReadTsc ( VOID )

Definition at line 232 of file UserMisc.c.

◆ AsmWriteCr4()

UINTN EFIAPI AsmWriteCr4 ( UINTN Cr4)

Definition at line 241 of file UserMisc.c.

◆ AsmWriteMsr64()

UINT64 EFIAPI AsmWriteMsr64 ( IN UINT32 Index,
IN UINT64 Value )

Definition at line 250 of file UserMisc.c.

◆ CpuBreakpoint()

VOID EFIAPI CpuBreakpoint ( VOID )

Definition at line 13 of file UserMisc.c.

◆ CpuFlushTlb()

VOID EFIAPI CpuFlushTlb ( VOID )

Definition at line 290 of file UserMisc.c.

◆ CpuPause()

VOID EFIAPI CpuPause ( VOID )

Definition at line 22 of file UserMisc.c.

◆ DevicePathFromHandle()

EFI_DEVICE_PATH_PROTOCOL *EFIAPI DevicePathFromHandle ( IN EFI_HANDLE Handle)

Definition at line 680 of file UserMisc.c.

◆ DisableInterrupts()

VOID EFIAPI DisableInterrupts ( VOID )

Definition at line 30 of file UserMisc.c.

◆ EnableInterrupts()

VOID EFIAPI EnableInterrupts ( VOID )

Definition at line 38 of file UserMisc.c.

◆ GetFirstGuidHob()

VOID *EFIAPI GetFirstGuidHob ( IN CONST EFI_GUID * Guid)

Definition at line 671 of file UserMisc.c.

◆ GetSerialRegisterBase()

UINTN GetSerialRegisterBase ( VOID )

Retrieve the I/O or MMIO base address register for the PCI UART device. This function assumes Root Bus Numer is Zero, and enables I/O and MMIO in PCI UART Device if they are not already enabled.

Returns
The base address register of the UART device.

Definition at line 697 of file UserMisc.c.

◆ IoRead32()

UINT32 EFIAPI IoRead32 ( IN UINTN Port)

Definition at line 318 of file UserMisc.c.

◆ IoRead8()

UINT8 EFIAPI IoRead8 ( IN UINTN Port)

Definition at line 298 of file UserMisc.c.

◆ IoWrite32()

UINT32 EFIAPI IoWrite32 ( IN UINTN Port,
IN UINT32 Value )

Definition at line 329 of file UserMisc.c.

◆ IoWrite8()

UINT8 EFIAPI IoWrite8 ( IN UINTN Port,
IN UINT8 Value )

Definition at line 307 of file UserMisc.c.

◆ MmioAnd16()

UINT16 EFIAPI MmioAnd16 ( IN UINTN Address,
IN UINT16 AndData )

Definition at line 341 of file UserMisc.c.

◆ MmioAnd32()

UINT32 EFIAPI MmioAnd32 ( IN UINTN Address,
IN UINT16 AndData )

Definition at line 351 of file UserMisc.c.

◆ MmioAnd8()

UINT8 EFIAPI MmioAnd8 ( IN UINTN Address,
IN UINT8 AndData )

Definition at line 361 of file UserMisc.c.

◆ MmioAndThenOr16()

UINT16 EFIAPI MmioAndThenOr16 ( IN UINTN Address,
IN UINT16 AndData,
IN UINT16 OrData )

Definition at line 371 of file UserMisc.c.

◆ MmioAndThenOr32()

UINT32 EFIAPI MmioAndThenOr32 ( IN UINTN Address,
IN UINT32 AndData,
IN UINT32 OrData )

Definition at line 382 of file UserMisc.c.

◆ MmioAndThenOr8()

UINT8 EFIAPI MmioAndThenOr8 ( IN UINTN Address,
IN UINT8 AndData,
IN UINT8 OrData )

Definition at line 393 of file UserMisc.c.

◆ MmioBitFieldAnd16()

UINT16 EFIAPI MmioBitFieldAnd16 ( IN UINTN Address,
IN UINTN StartBit,
IN UINTN EndBit,
IN UINT16 AndData )

Definition at line 404 of file UserMisc.c.

◆ MmioBitFieldAnd32()

UINT32 EFIAPI MmioBitFieldAnd32 ( IN UINTN Address,
IN UINTN StartBit,
IN UINTN EndBit,
IN UINT32 AndData )

Definition at line 416 of file UserMisc.c.

◆ MmioBitFieldAnd8()

UINT8 EFIAPI MmioBitFieldAnd8 ( IN UINTN Address,
IN UINTN StartBit,
IN UINTN EndBit,
IN UINT8 AndData )

Definition at line 428 of file UserMisc.c.

◆ MmioBitFieldAndThenOr16()

UINT16 EFIAPI MmioBitFieldAndThenOr16 ( IN UINTN Address,
IN UINTN StartBit,
IN UINTN EndBit,
IN UINT16 AndData,
IN UINT16 OrData )

Definition at line 440 of file UserMisc.c.

◆ MmioBitFieldAndThenOr32()

UINT32 EFIAPI MmioBitFieldAndThenOr32 ( IN UINTN Address,
IN UINTN StartBit,
IN UINTN EndBit,
IN UINT32 AndData,
IN UINT32 OrData )

Definition at line 453 of file UserMisc.c.

◆ MmioBitFieldAndThenOr8()

UINT8 EFIAPI MmioBitFieldAndThenOr8 ( IN UINTN Address,
IN UINTN StartBit,
IN UINTN EndBit,
IN UINT8 AndData,
IN UINT8 OrData )

Definition at line 466 of file UserMisc.c.

◆ MmioBitFieldOr16()

UINT16 EFIAPI MmioBitFieldOr16 ( IN UINTN Address,
IN UINTN StartBit,
IN UINTN EndBit,
IN UINT16 OrData )

Definition at line 479 of file UserMisc.c.

◆ MmioBitFieldOr32()

UINT32 EFIAPI MmioBitFieldOr32 ( IN UINTN Address,
IN UINTN StartBit,
IN UINTN EndBit,
IN UINT32 OrData )

Definition at line 491 of file UserMisc.c.

◆ MmioBitFieldOr8()

UINT8 EFIAPI MmioBitFieldOr8 ( IN UINTN Address,
IN UINTN StartBit,
IN UINTN EndBit,
IN UINT8 OrData )

Definition at line 503 of file UserMisc.c.

◆ MmioBitFieldRead16()

UINT16 EFIAPI MmioBitFieldRead16 ( IN UINTN Address,
IN UINTN StartBit,
IN UINTN EndBit )

Definition at line 515 of file UserMisc.c.

◆ MmioBitFieldRead32()

UINT32 EFIAPI MmioBitFieldRead32 ( IN UINTN Address,
IN UINTN StartBit,
IN UINTN EndBit )

Definition at line 526 of file UserMisc.c.

◆ MmioBitFieldRead8()

UINT8 EFIAPI MmioBitFieldRead8 ( IN UINTN Address,
IN UINTN StartBit,
IN UINTN EndBit )

Definition at line 537 of file UserMisc.c.

◆ MmioBitFieldWrite16()

UINT16 EFIAPI MmioBitFieldWrite16 ( IN UINTN Address,
IN UINTN StartBit,
IN UINTN EndBit,
IN UINT16 Value )

Definition at line 548 of file UserMisc.c.

◆ MmioBitFieldWrite32()

UINT32 EFIAPI MmioBitFieldWrite32 ( IN UINTN Address,
IN UINTN StartBit,
IN UINTN EndBit,
IN UINT32 Value )

Definition at line 560 of file UserMisc.c.

◆ MmioBitFieldWrite8()

UINT8 EFIAPI MmioBitFieldWrite8 ( IN UINTN Address,
IN UINTN StartBit,
IN UINTN EndBit,
IN UINT8 Value )

Definition at line 572 of file UserMisc.c.

◆ MmioOr16()

UINT16 EFIAPI MmioOr16 ( IN UINTN Address,
IN UINT16 OrData )

Definition at line 584 of file UserMisc.c.

◆ MmioOr32()

UINT32 EFIAPI MmioOr32 ( IN UINTN Address,
IN UINT32 OrData )

Definition at line 594 of file UserMisc.c.

◆ MmioOr8()

UINT8 EFIAPI MmioOr8 ( IN UINTN Address,
IN UINT8 OrData )

Definition at line 604 of file UserMisc.c.

◆ MmioRead16()

UINT16 EFIAPI MmioRead16 ( IN UINTN Address)

Definition at line 614 of file UserMisc.c.

◆ MmioRead32()

UINT32 EFIAPI MmioRead32 ( IN UINTN Address)

Definition at line 623 of file UserMisc.c.

◆ MmioRead8()

UINT8 EFIAPI MmioRead8 ( IN UINTN Address)

Definition at line 632 of file UserMisc.c.

◆ MmioWrite16()

UINT16 EFIAPI MmioWrite16 ( IN UINTN Address,
IN UINT16 Value )

Definition at line 641 of file UserMisc.c.

◆ MmioWrite32()

UINT32 EFIAPI MmioWrite32 ( IN UINTN Address,
IN UINT32 Value )

Definition at line 651 of file UserMisc.c.

◆ MmioWrite8()

UINT8 EFIAPI MmioWrite8 ( IN UINTN Address,
IN UINT8 Value )

Definition at line 661 of file UserMisc.c.

◆ OcLocateRootVolume()

EFI_FILE_PROTOCOL * OcLocateRootVolume ( IN EFI_HANDLE DeviceHandle OPTIONAL,
IN EFI_DEVICE_PATH_PROTOCOL *FilePath OPTIONAL )

Locate root volume from Device handle or path.

Parameters
[in]DeviceHandleDevice handle.
[in]FilePathDevice path.
Return values
openedfile protocol or NULL.

Definition at line 688 of file UserMisc.c.