OpenCore  1.0.4
OpenCore Bootloader
Loading...
Searching...
No Matches
GopUtils.c File Reference
#include "OcConsoleLibInternal.h"
#include <Base.h>
#include <Uefi/UefiBaseType.h>
#include <IndustryStandard/ProcessorInfo.h>
#include <IndustryStandard/VirtualMemory.h>
#include <Library/BaseLib.h>
#include <Library/BaseOverflowLib.h>
#include <Library/DebugLib.h>
#include <Library/MemoryAllocationLib.h>
#include <Library/MtrrLib.h>
#include <Library/OcMemoryLib.h>
#include <Library/OcStringLib.h>
#include <Library/PrintLib.h>
#include <Library/UefiBootServicesTableLib.h>

Go to the source code of this file.

Macros

#define PAT_INDEX_TO_CHANGE   7
 

Functions

EFI_STATUS OcGopModeBytesPerPixel (IN EFI_GRAPHICS_OUTPUT_PROTOCOL_MODE *Mode, OUT UINTN *BytesPerPixel)
 
EFI_STATUS OcGopModeSafeFrameBufferSize (IN EFI_GRAPHICS_OUTPUT_PROTOCOL_MODE *Mode, OUT UINTN *FrameBufferSize)
 
STATIC EFI_STATUS WriteCombineGop (EFI_GRAPHICS_OUTPUT_PROTOCOL *Gop, BOOLEAN SetPatWC)
 
EFI_STATUS OcSetGopBurstMode (VOID)
 

Detailed Description

GOP buffer and pixel size utility methods, and GOP burst mode caching code.

Copyright (C) 2023, Mike Beaton. All rights reserved.
SPDX-License-Identifier: BSD-3-Clause

Definition in file GopUtils.c.

Macro Definition Documentation

◆ PAT_INDEX_TO_CHANGE

#define PAT_INDEX_TO_CHANGE   7

Definition at line 26 of file GopUtils.c.

Function Documentation

◆ OcGopModeBytesPerPixel()

EFI_STATUS OcGopModeBytesPerPixel ( IN EFI_GRAPHICS_OUTPUT_PROTOCOL_MODE * Mode,
OUT UINTN * BytesPerPixel )

Return the bytes per pixel for the current GOP mode.

GOP mode information does not include anything directly containing the bytes per pixel, but there is a defined algorithm for working out this size, even for non-standard pixel masks, and also a defined situation (PixelBltOnly pixel format) where there is no such size.

Parameters
[in]ModeGOP mode.
[in]BytesPerPixelBytes per pixel for the mode in use.
Return values
EFI_SUCCESSSuccess.
EFI_UNSUPPORTEDThere is no frame buffer.
EFI_INVALID_PARAMETERMode info parameters are outside valid ranges.

Definition at line 29 of file GopUtils.c.

◆ OcGopModeSafeFrameBufferSize()

EFI_STATUS OcGopModeSafeFrameBufferSize ( IN EFI_GRAPHICS_OUTPUT_PROTOCOL_MODE * Mode,
OUT UINTN * FrameBufferSize )

Return the frame buffer size in use for the current GOP mode, even where Gop->Mode->FrameBufferSize misreports this.

Occasional GOP implementations report a frame buffer size far larger (e.g. ~100x) than required for the actual mode in use.

Parameters
[in]ModeGOP mode.
[in]FrameBufferSizeFrame buffer size in use.
Return values
EFI_SUCCESSSuccess.
EFI_UNSUPPORTEDThere is no frame buffer.
EFI_INVALID_PARAMETERSize parameters are outside valid ranges.

Definition at line 85 of file GopUtils.c.

◆ OcSetGopBurstMode()

EFI_STATUS OcSetGopBurstMode ( VOID )

Use PAT to enable write-combining caching (burst mode) on GOP memory, when it is suppported but firmware has not set it up.

Return values
EFI_SUCCESSon success.

Definition at line 308 of file GopUtils.c.

◆ WriteCombineGop()

STATIC EFI_STATUS WriteCombineGop ( EFI_GRAPHICS_OUTPUT_PROTOCOL * Gop,
BOOLEAN SetPatWC )

Definition at line 128 of file GopUtils.c.