MdePkg: Remove UGA support

The Universal Graphics Adapter (UGA) is a graphic abstraction.
The UGA I/O and Draw protocols are deprecated since UEFI 2.0 was
introduced. Cf. the UEFI spec v2.9:
"Appendix L - EFI 1.10 Protocol Changes and Deprecation List"
section L.2 "Deprecated Protocols"

Remove the UGA support.

Signed-off-by: GuoMinJ <newexplorerj@gmail.com>
Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
This commit is contained in:
GuoMinJ
2025-06-12 17:30:22 +02:00
committed by mergify[bot]
parent 4315b1922e
commit c7569abdc4
8 changed files with 0 additions and 462 deletions

View File

@@ -1,159 +0,0 @@
/** @file
UGA Draw protocol from the EFI 1.10 specification.
Abstraction of a very simple graphics device.
Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
**/
#ifndef __UGA_DRAW_H__
#define __UGA_DRAW_H__
#define EFI_UGA_DRAW_PROTOCOL_GUID \
{ \
0x982c298b, 0xf4fa, 0x41cb, {0xb8, 0x38, 0x77, 0xaa, 0x68, 0x8f, 0xb8, 0x39 } \
}
typedef struct _EFI_UGA_DRAW_PROTOCOL EFI_UGA_DRAW_PROTOCOL;
/**
Return the current video mode information.
@param This The EFI_UGA_DRAW_PROTOCOL instance.
@param HorizontalResolution The size of video screen in pixels in the X dimension.
@param VerticalResolution The size of video screen in pixels in the Y dimension.
@param ColorDepth Number of bits per pixel, currently defined to be 32.
@param RefreshRate The refresh rate of the monitor in Hertz.
@retval EFI_SUCCESS Mode information returned.
@retval EFI_NOT_STARTED Video display is not initialized. Call SetMode ()
@retval EFI_INVALID_PARAMETER One of the input args was NULL.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_UGA_DRAW_PROTOCOL_GET_MODE)(
IN EFI_UGA_DRAW_PROTOCOL *This,
OUT UINT32 *HorizontalResolution,
OUT UINT32 *VerticalResolution,
OUT UINT32 *ColorDepth,
OUT UINT32 *RefreshRate
);
/**
Set the current video mode information.
@param This The EFI_UGA_DRAW_PROTOCOL instance.
@param HorizontalResolution The size of video screen in pixels in the X dimension.
@param VerticalResolution The size of video screen in pixels in the Y dimension.
@param ColorDepth Number of bits per pixel, currently defined to be 32.
@param RefreshRate The refresh rate of the monitor in Hertz.
@retval EFI_SUCCESS Mode information returned.
@retval EFI_NOT_STARTED Video display is not initialized. Call SetMode ()
**/
typedef
EFI_STATUS
(EFIAPI *EFI_UGA_DRAW_PROTOCOL_SET_MODE)(
IN EFI_UGA_DRAW_PROTOCOL *This,
IN UINT32 HorizontalResolution,
IN UINT32 VerticalResolution,
IN UINT32 ColorDepth,
IN UINT32 RefreshRate
);
typedef struct {
UINT8 Blue;
UINT8 Green;
UINT8 Red;
UINT8 Reserved;
} EFI_UGA_PIXEL;
typedef union {
EFI_UGA_PIXEL Pixel;
UINT32 Raw;
} EFI_UGA_PIXEL_UNION;
///
/// Enumration value for actions of Blt operations.
///
typedef enum {
EfiUgaVideoFill, ///< Write data from the BltBuffer pixel (SourceX, SourceY)
///< directly to every pixel of the video display rectangle
///< (DestinationX, DestinationY) (DestinationX + Width, DestinationY + Height).
///< Only one pixel will be used from the BltBuffer. Delta is NOT used.
EfiUgaVideoToBltBuffer, ///< Read data from the video display rectangle
///< (SourceX, SourceY) (SourceX + Width, SourceY + Height) and place it in
///< the BltBuffer rectangle (DestinationX, DestinationY )
///< (DestinationX + Width, DestinationY + Height). If DestinationX or
///< DestinationY is not zero then Delta must be set to the length in bytes
///< of a row in the BltBuffer.
EfiUgaBltBufferToVideo, ///< Write data from the BltBuffer rectangle
///< (SourceX, SourceY) (SourceX + Width, SourceY + Height) directly to the
///< video display rectangle (DestinationX, DestinationY)
///< (DestinationX + Width, DestinationY + Height). If SourceX or SourceY is
///< not zero then Delta must be set to the length in bytes of a row in the
///< BltBuffer.
EfiUgaVideoToVideo, ///< Copy from the video display rectangle (SourceX, SourceY)
///< (SourceX + Width, SourceY + Height) .to the video display rectangle
///< (DestinationX, DestinationY) (DestinationX + Width, DestinationY + Height).
///< The BltBuffer and Delta are not used in this mode.
EfiUgaBltMax ///< Maxmimum value for enumration value of Blt operation. If a Blt operation
///< larger or equal to this enumration value, it is invalid.
} EFI_UGA_BLT_OPERATION;
/**
Blt a rectangle of pixels on the graphics screen.
@param[in] This - Protocol instance pointer.
@param[in] BltBuffer - Buffer containing data to blit into video buffer. This
buffer has a size of Width*Height*sizeof(EFI_UGA_PIXEL)
@param[in] BltOperation - Operation to perform on BlitBuffer and video memory
@param[in] SourceX - X coordinate of source for the BltBuffer.
@param[in] SourceY - Y coordinate of source for the BltBuffer.
@param[in] DestinationX - X coordinate of destination for the BltBuffer.
@param[in] DestinationY - Y coordinate of destination for the BltBuffer.
@param[in] Width - Width of rectangle in BltBuffer in pixels.
@param[in] Height - Hight of rectangle in BltBuffer in pixels.
@param[in] Delta - OPTIONAL
@retval EFI_SUCCESS - The Blt operation completed.
@retval EFI_INVALID_PARAMETER - BltOperation is not valid.
@retval EFI_DEVICE_ERROR - A hardware error occurred writting to the video buffer.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_UGA_DRAW_PROTOCOL_BLT)(
IN EFI_UGA_DRAW_PROTOCOL *This,
IN EFI_UGA_PIXEL *BltBuffer OPTIONAL,
IN EFI_UGA_BLT_OPERATION BltOperation,
IN UINTN SourceX,
IN UINTN SourceY,
IN UINTN DestinationX,
IN UINTN DestinationY,
IN UINTN Width,
IN UINTN Height,
IN UINTN Delta OPTIONAL
);
///
/// This protocol provides a basic abstraction to set video modes and
/// copy pixels to and from the graphics controller's frame buffer.
///
struct _EFI_UGA_DRAW_PROTOCOL {
EFI_UGA_DRAW_PROTOCOL_GET_MODE GetMode;
EFI_UGA_DRAW_PROTOCOL_SET_MODE SetMode;
EFI_UGA_DRAW_PROTOCOL_BLT Blt;
};
extern EFI_GUID gEfiUgaDrawProtocolGuid;
#endif

View File

@@ -1,189 +0,0 @@
/** @file
UGA IO protocol from the EFI 1.10 specification.
Abstraction of a very simple graphics device.
Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
**/
#ifndef __UGA_IO_H__
#define __UGA_IO_H__
#define EFI_UGA_IO_PROTOCOL_GUID \
{ 0x61a4d49e, 0x6f68, 0x4f1b, { 0xb9, 0x22, 0xa8, 0x6e, 0xed, 0xb, 0x7, 0xa2 } }
typedef struct _EFI_UGA_IO_PROTOCOL EFI_UGA_IO_PROTOCOL;
typedef UINT32 UGA_STATUS;
typedef enum {
UgaDtParentBus = 1,
UgaDtGraphicsController,
UgaDtOutputController,
UgaDtOutputPort,
UgaDtOther
} UGA_DEVICE_TYPE, *PUGA_DEVICE_TYPE;
typedef UINT32 UGA_DEVICE_ID, *PUGA_DEVICE_ID;
typedef struct {
UGA_DEVICE_TYPE deviceType;
UGA_DEVICE_ID deviceId;
UINT32 ui32DeviceContextSize;
UINT32 ui32SharedContextSize;
} UGA_DEVICE_DATA, *PUGA_DEVICE_DATA;
typedef struct _UGA_DEVICE {
VOID *pvDeviceContext;
VOID *pvSharedContext;
VOID *pvRunTimeContext;
struct _UGA_DEVICE *pParentDevice;
VOID *pvBusIoServices;
VOID *pvStdIoServices;
UGA_DEVICE_DATA deviceData;
} UGA_DEVICE, *PUGA_DEVICE;
typedef enum {
UgaIoGetVersion = 1,
UgaIoGetChildDevice,
UgaIoStartDevice,
UgaIoStopDevice,
UgaIoFlushDevice,
UgaIoResetDevice,
UgaIoGetDeviceState,
UgaIoSetDeviceState,
UgaIoSetPowerState,
UgaIoGetMemoryConfiguration,
UgaIoSetVideoMode,
UgaIoCopyRectangle,
UgaIoGetEdidSegment,
UgaIoDeviceChannelOpen,
UgaIoDeviceChannelClose,
UgaIoDeviceChannelRead,
UgaIoDeviceChannelWrite,
UgaIoGetPersistentDataSize,
UgaIoGetPersistentData,
UgaIoSetPersistentData,
UgaIoGetDevicePropertySize,
UgaIoGetDeviceProperty,
UgaIoBtPrivateInterface
} UGA_IO_REQUEST_CODE, *PUGA_IO_REQUEST_CODE;
typedef struct {
IN UGA_IO_REQUEST_CODE ioRequestCode;
IN VOID *pvInBuffer;
IN UINT64 ui64InBufferSize;
OUT VOID *pvOutBuffer;
IN UINT64 ui64OutBufferSize;
OUT UINT64 ui64BytesReturned;
} UGA_IO_REQUEST, *PUGA_IO_REQUEST;
/**
Dynamically allocate storage for a child UGA_DEVICE.
@param[in] This The EFI_UGA_IO_PROTOCOL instance.
@param[in] ParentDevice ParentDevice specifies a pointer to the parent device of Device.
@param[in] DeviceData A pointer to UGA_DEVICE_DATA returned from a call to DispatchService()
with a UGA_DEVICE of Parent and an IoRequest of type UgaIoGetChildDevice.
@param[in] RunTimeContext Context to associate with Device.
@param[out] Device The Device returns a dynamically allocated child UGA_DEVICE object
for ParentDevice. The caller is responsible for deleting Device.
@retval EFI_SUCCESS Device was returned.
@retval EFI_INVALID_PARAMETER One of the arguments was not valid.
@retval EFI_DEVICE_ERROR The device had an error and could not complete the request.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_UGA_IO_PROTOCOL_CREATE_DEVICE)(
IN EFI_UGA_IO_PROTOCOL *This,
IN UGA_DEVICE *ParentDevice,
IN UGA_DEVICE_DATA *DeviceData,
IN VOID *RunTimeContext,
OUT UGA_DEVICE **Device
);
/**
Delete a dynamically allocated child UGA_DEVICE object that was allocated via CreateDevice().
@param[in] This The EFI_UGA_IO_PROTOCOL instance. Type EFI_UGA_IO_PROTOCOL is
defined in Section 10.7.
@param[in] Device The Device points to a UGA_DEVICE object that was dynamically
allocated via a CreateDevice() call.
@retval EFI_SUCCESS Device was returned.
@retval EFI_INVALID_PARAMETER The Device was not allocated via CreateDevice().
**/
typedef
EFI_STATUS
(EFIAPI *EFI_UGA_IO_PROTOCOL_DELETE_DEVICE)(
IN EFI_UGA_IO_PROTOCOL *This,
IN UGA_DEVICE *Device
);
/**
This is the main UGA service dispatch routine for all UGA_IO_REQUEST s.
@param pDevice pDevice specifies a pointer to a device object associated with a
device enumerated by a pIoRequest->ioRequestCode of type
UgaIoGetChildDevice. The root device for the EFI_UGA_IO_PROTOCOL
is represented by pDevice being set to NULL.
@param pIoRequest
pIoRequest points to a caller allocated buffer that contains data
defined by pIoRequest->ioRequestCode. See Related Definitions for
a definition of UGA_IO_REQUEST_CODE s and their associated data
structures.
@return UGA_STATUS
**/
typedef UGA_STATUS
(EFIAPI *PUGA_FW_SERVICE_DISPATCH)(
IN PUGA_DEVICE pDevice,
IN OUT PUGA_IO_REQUEST pIoRequest
);
///
/// Provides a basic abstraction to send I/O requests to the graphics device and any of its children.
///
struct _EFI_UGA_IO_PROTOCOL {
EFI_UGA_IO_PROTOCOL_CREATE_DEVICE CreateDevice;
EFI_UGA_IO_PROTOCOL_DELETE_DEVICE DeleteDevice;
PUGA_FW_SERVICE_DISPATCH DispatchService;
};
extern EFI_GUID gEfiUgaIoProtocolGuid;
//
// Data structure that is stored in the EFI Configuration Table with the
// EFI_UGA_IO_PROTOCOL_GUID. The option ROMs listed in this table may have
// EBC UGA drivers.
//
typedef struct {
UINT32 Version;
UINT32 HeaderSize;
UINT32 SizeOfEntries;
UINT32 NumberOfEntries;
} EFI_DRIVER_OS_HANDOFF_HEADER;
typedef enum {
EfiUgaDriverFromPciRom,
EfiUgaDriverFromSystem,
EfiDriverHandoffMax
} EFI_DRIVER_HANOFF_ENUM;
typedef struct {
EFI_DRIVER_HANOFF_ENUM Type;
EFI_DEVICE_PATH_PROTOCOL *DevicePath;
VOID *PciRomImage;
UINT64 PciRomSize;
} EFI_DRIVER_OS_HANDOFF;
#endif

View File

@@ -68,7 +68,6 @@
gEfiGraphicsOutputProtocolGuid ## SOMETIMES_CONSUMES
gEfiHiiFontProtocolGuid ## SOMETIMES_CONSUMES
gEfiSimpleFileSystemProtocolGuid ## SOMETIMES_CONSUMES
gEfiUgaDrawProtocolGuid | gEfiMdePkgTokenSpaceGuid.PcdUgaConsumeSupport ## SOMETIMES_CONSUMES # Consumes if gEfiGraphicsOutputProtocolGuid uninstalled
gEfiComponentNameProtocolGuid | NOT gEfiMdePkgTokenSpaceGuid.PcdComponentNameDisable ## SOMETIMES_PRODUCES # User chooses to produce it
gEfiComponentName2ProtocolGuid | NOT gEfiMdePkgTokenSpaceGuid.PcdComponentName2Disable ## SOMETIMES_PRODUCES # User chooses to produce it
gEfiDriverConfigurationProtocolGuid ## SOMETIMES_PRODUCES # User chooses to produce it
@@ -85,5 +84,4 @@
gEfiMdePkgTokenSpaceGuid.PcdComponentNameDisable ## CONSUMES
gEfiMdePkgTokenSpaceGuid.PcdDriverDiagnostics2Disable ## CONSUMES
gEfiMdePkgTokenSpaceGuid.PcdComponentName2Disable ## CONSUMES
gEfiMdePkgTokenSpaceGuid.PcdUgaConsumeSupport ## CONSUMES

View File

@@ -18,7 +18,6 @@
#include <Protocol/DriverDiagnostics2.h>
#include <Protocol/LoadedImage.h>
#include <Protocol/GraphicsOutput.h>
#include <Protocol/UgaDraw.h>
#include <Protocol/HiiFont.h>
#include <Guid/EventGroup.h>

View File

@@ -352,20 +352,14 @@ InternalPrintGraphic (
EFI_STATUS Status;
UINT32 HorizontalResolution;
UINT32 VerticalResolution;
UINT32 ColorDepth;
UINT32 RefreshRate;
EFI_HII_FONT_PROTOCOL *HiiFont;
EFI_IMAGE_OUTPUT *Blt;
EFI_FONT_DISPLAY_INFO FontInfo;
EFI_HII_ROW_INFO *RowInfoArray;
UINTN RowInfoArraySize;
EFI_GRAPHICS_OUTPUT_PROTOCOL *GraphicsOutput;
EFI_UGA_DRAW_PROTOCOL *UgaDraw;
EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *Sto;
EFI_HANDLE ConsoleHandle;
UINTN Width;
UINTN Height;
UINTN Delta;
HorizontalResolution = 0;
VerticalResolution = 0;
@@ -381,21 +375,6 @@ InternalPrintGraphic (
&gEfiGraphicsOutputProtocolGuid,
(VOID **)&GraphicsOutput
);
UgaDraw = NULL;
if (EFI_ERROR (Status) && FeaturePcdGet (PcdUgaConsumeSupport)) {
//
// If no GOP available, try to open UGA Draw protocol if supported.
//
GraphicsOutput = NULL;
Status = gBS->HandleProtocol (
ConsoleHandle,
&gEfiUgaDrawProtocolGuid,
(VOID **)&UgaDraw
);
}
if (EFI_ERROR (Status)) {
goto Error;
}
@@ -413,8 +392,6 @@ InternalPrintGraphic (
if (GraphicsOutput != NULL) {
HorizontalResolution = GraphicsOutput->Mode->Info->HorizontalResolution;
VerticalResolution = GraphicsOutput->Mode->Info->VerticalResolution;
} else if ((UgaDraw != NULL) && FeaturePcdGet (PcdUgaConsumeSupport)) {
UgaDraw->GetMode (UgaDraw, &HorizontalResolution, &VerticalResolution, &ColorDepth, &RefreshRate);
} else {
goto Error;
}
@@ -478,73 +455,6 @@ InternalPrintGraphic (
if (EFI_ERROR (Status)) {
goto Error;
}
} else if (FeaturePcdGet (PcdUgaConsumeSupport)) {
ASSERT (UgaDraw != NULL);
//
// Ensure Width * Height * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL) doesn't overflow.
//
if (Blt->Width > DivU64x32 (MAX_UINTN, Blt->Height * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL))) {
goto Error;
}
Blt->Image.Bitmap = AllocateZeroPool ((UINT32)Blt->Width * Blt->Height * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL));
ASSERT (Blt->Image.Bitmap != NULL);
//
// StringToImage only support blt'ing image to device using GOP protocol. If GOP is not supported in this platform,
// we ask StringToImage to print the string to blt buffer, then blt to device using UgaDraw.
//
Status = HiiFont->StringToImage (
HiiFont,
EFI_HII_IGNORE_IF_NO_GLYPH | EFI_HII_OUT_FLAG_CLIP |
EFI_HII_OUT_FLAG_CLIP_CLEAN_X | EFI_HII_OUT_FLAG_CLIP_CLEAN_Y |
EFI_HII_IGNORE_LINE_BREAK,
Buffer,
&FontInfo,
&Blt,
PointX,
PointY,
&RowInfoArray,
&RowInfoArraySize,
NULL
);
if (!EFI_ERROR (Status)) {
ASSERT (RowInfoArray != NULL);
//
// Explicit Line break characters are ignored, so the updated parameter RowInfoArraySize by StringToImage will
// always be 1 or 0 (if there is no valid Unicode Char can be printed). ASSERT here to make sure.
//
ASSERT (RowInfoArraySize <= 1);
if (RowInfoArraySize != 0) {
Width = RowInfoArray[0].LineWidth;
Height = RowInfoArray[0].LineHeight;
Delta = Blt->Width * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL);
} else {
Width = 0;
Height = 0;
Delta = 0;
}
Status = UgaDraw->Blt (
UgaDraw,
(EFI_UGA_PIXEL *)Blt->Image.Bitmap,
EfiUgaBltBufferToVideo,
PointX,
PointY,
PointX,
PointY,
Width,
Height,
Delta
);
} else {
goto Error;
}
FreePool (Blt->Image.Bitmap);
} else {
goto Error;
}

View File

@@ -1582,12 +1582,6 @@
## Include/Protocol/EdidOverride.h
gEfiEdidOverrideProtocolGuid = { 0x48ECB431, 0xFB72, 0x45C0, { 0xA9, 0x22, 0xF4, 0x58, 0xFE, 0x04, 0x0B, 0xD5 }}
## Include/Protocol/UgaIo.h
gEfiUgaIoProtocolGuid = { 0x61A4D49E, 0x6F68, 0x4F1B, { 0xB9, 0x22, 0xA8, 0x6E, 0xED, 0x0B, 0x07, 0xA2 }}
## Include/Protocol/UgaDraw.h
gEfiUgaDrawProtocolGuid = { 0x982C298B, 0xF4FA, 0x41CB, { 0xB8, 0x38, 0x77, 0xAA, 0x68, 0x8F, 0xB8, 0x39 }}
## Include/Protocol/LoadedImage.h
gEfiLoadedImageProtocolGuid = { 0x5B1B31A1, 0x9562, 0x11D2, { 0x8E, 0x3F, 0x00, 0xA0, 0xC9, 0x69, 0x72, 0x3B }}
@@ -2078,12 +2072,6 @@
# @Prompt Deprecate Global Variable LangCodes.
gEfiMdePkgTokenSpaceGuid.PcdUefiVariableDefaultLangDeprecate|FALSE|BOOLEAN|0x00000012
## Indicates if UGA Draw Protocol is still consumed.<BR><BR>
# TRUE - Consume UGA Draw protocol.<BR>
# FALSE - Does not consume UGA Draw protocol.<BR>
# @Prompt Consume UGA Draw Protocol.
gEfiMdePkgTokenSpaceGuid.PcdUgaConsumeSupport|TRUE|BOOLEAN|0x00000027
## Indicates if a check will be made to see if a specified node is a member of linked list
# in the following BaseLib functions: GetNextNode(), IsNull(), IsNodeAtEnd(), SwapListEntries().<BR><BR>
# TRUE - Verify a specified node is a member of linked list.<BR>

View File

@@ -24,9 +24,6 @@
!include MdePkg/MdeLibs.dsc.inc
[PcdsFeatureFlag]
gEfiMdePkgTokenSpaceGuid.PcdUgaConsumeSupport|TRUE
[PcdsFixedAtBuild]
gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask|0x0f
gEfiMdePkgTokenSpaceGuid.PcdDebugPrintErrorLevel|0x80000000

View File

@@ -379,12 +379,6 @@
"TRUE - Deprecate global variable LangCodes.<BR>\n"
"FALSE - Does not deprecate global variable LangCodes.<BR>"
#string STR_gEfiMdePkgTokenSpaceGuid_PcdUgaConsumeSupport_PROMPT #language en-US "Consume UGA Draw Protocol"
#string STR_gEfiMdePkgTokenSpaceGuid_PcdUgaConsumeSupport_HELP #language en-US "Indicates if UGA Draw Protocol is still consumed.<BR><BR>\n"
"TRUE - Consume UGA Draw protocol.<BR>\n"
"FALSE - Does not consume UGA Draw protocol.<BR>"
#string STR_gEfiMdePkgTokenSpaceGuid_PcdVerifyNodeInList_PROMPT #language en-US "Verify Node In List"
#string STR_gEfiMdePkgTokenSpaceGuid_PcdVerifyNodeInList_HELP #language en-US "Indicates if a check will be made to see if a specified node is a member of linked list in the following BaseLib functions: GetNextNode(), IsNull(), IsNodeAtEnd(), SwapListEntries().<BR><BR>\n"