ReactOS 0.4.15-dev-8102-g108db8f
guicons.c File Reference
#include "bl.h"
Include dependency graph for guicons.c:

Go to the source code of this file.

Functions

VOID ConsoleFirmwareGraphicalClose (_In_ PBL_GRAPHICS_CONSOLE GraphicsConsole)
 
NTSTATUS ConsoleEfiGraphicalOpenProtocol (_In_ PBL_GRAPHICS_CONSOLE GraphicsConsole, _In_ BL_GRAPHICS_CONSOLE_TYPE Type)
 
NTSTATUS ConsoleFirmwareGraphicalClear (_In_ PBL_GRAPHICS_CONSOLE Console, _In_ ULONG Color)
 
NTSTATUS ConsoleFirmwareGraphicalEnable (_In_ PBL_GRAPHICS_CONSOLE GraphicsConsole)
 
VOID ConsoleFirmwareGraphicalDisable (_In_ PBL_GRAPHICS_CONSOLE GraphicsConsole)
 

Function Documentation

◆ ConsoleEfiGraphicalOpenProtocol()

NTSTATUS ConsoleEfiGraphicalOpenProtocol ( _In_ PBL_GRAPHICS_CONSOLE  GraphicsConsole,
_In_ BL_GRAPHICS_CONSOLE_TYPE  Type 
)

Definition at line 34 of file guicons.c.

38{
39 ULONG HandleIndex, HandleCount;
40 EFI_HANDLE* HandleArray;
44
45 /* Find a device handle that implements either GOP or UGA */
46 HandleCount = 0;
47 HandleArray = NULL;
49 (Type == BlGopConsole) ?
52 &HandleCount,
53 &HandleArray);
54 if (!NT_SUCCESS(Status))
55 {
56 /* Nothing supports this (no video card?) */
57 EfiPrintf(L"Status: %lx Count: %d\r\n", Status, HandleCount);
59 }
60
61 /* Scan through the handles we received */
62 for (HandleIndex = 0; HandleIndex < HandleCount; HandleIndex++)
63 {
64 /* Try to open each one */
65 GraphicsConsole->Handle = HandleArray[HandleIndex];
66 Handle = HandleArray[HandleIndex];
68 if (NT_SUCCESS(Status))
69 {
70 /* Test worked, close the protocol */
72
73 /* Now open the real protocol we want, either UGA or GOP */
74 Status = Type ? ConsoleEfiUgaOpen(GraphicsConsole) :
75 ConsoleEfiGopOpen(GraphicsConsole);
76 if (NT_SUCCESS(Status))
77 {
78 /* It worked -- store the type of console this is */
79 GraphicsConsole->Type = Type;
80 return STATUS_SUCCESS;
81 }
82 }
83 }
84
85 /* We failed to find a working GOP/UGA protocol provider */
87}
Type
Definition: Type.h:7
@ ByProtocol
Definition: UefiSpec.h:1428
LONG NTSTATUS
Definition: precomp.h:26
EFI_GUID EfiGraphicsOutputProtocol
Definition: firmware.c:28
NTSTATUS EfiCloseProtocol(_In_ EFI_HANDLE Handle, _In_ EFI_GUID *Protocol)
Definition: firmware.c:581
VOID EfiPrintf(_In_ PWCHAR Format,...)
Definition: firmware.c:126
EFI_GUID EfiDevicePathProtocol
Definition: firmware.c:31
NTSTATUS EfiOpenProtocol(_In_ EFI_HANDLE Handle, _In_ EFI_GUID *Protocol, _Out_ PVOID *Interface)
@ BlGopConsole
Definition: bl.h:1140
NTSTATUS ConsoleEfiGopOpen(_In_ PBL_GRAPHICS_CONSOLE GraphicsConsole)
Definition: gop.c:198
EFI_GUID EfiUgaDrawProtocol
Definition: firmware.c:29
NTSTATUS ConsoleEfiUgaOpen(_In_ PBL_GRAPHICS_CONSOLE GraphicsConsole)
Definition: uga.c:18
NTSTATUS EfiLocateHandleBuffer(_In_ EFI_LOCATE_SEARCH_TYPE SearchType, _In_ EFI_GUID *Protocol, _Inout_ PULONG HandleCount, _Inout_ EFI_HANDLE **Buffer)
Definition: firmware.c:1399
#define NULL
Definition: types.h:112
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
ULONG Handle
Definition: gdb_input.c:15
Status
Definition: gdiplustypes.h:25
#define L(x)
Definition: ntvdm.h:50
#define STATUS_SUCCESS
Definition: shellext.h:65
uint32_t ULONG
Definition: typedefs.h:59
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
_Must_inspect_result_ _In_ WDFDEVICE _In_ LPCGUID _Out_ PINTERFACE Interface
Definition: wdffdo.h:465

Referenced by ConsoleGraphicalConstruct().

◆ ConsoleFirmwareGraphicalClear()

NTSTATUS ConsoleFirmwareGraphicalClear ( _In_ PBL_GRAPHICS_CONSOLE  Console,
_In_ ULONG  Color 
)

Definition at line 90 of file guicons.c.

94{
96 UCHAR Pixel[4] = { 0 };
97
98 /* Convert the standard color to a firmware pixel color */
100 if (!NT_SUCCESS(Status))
101 {
102 return Status;
103 }
104
105 /* Check if this is GOP or UGA */
106 if (Console->Type == BlUgaConsole)
107 {
108 EfiPrintf(L"Uga not supported\r\n");
110 }
111 else
112 {
113 /* For GOP, just fill the screen */
114 ConsolepClearBuffer(Console->FrameBuffer,
115 Console->DisplayMode.HRes,
116 Pixel,
117 Console->DisplayMode.VRes,
118 Console->PixelsPerScanLine,
119 Console->PixelDepth);
121 }
122
123 /* All clear */
124 return Status;
125}
CConsole Console
NTSTATUS ConsolepConvertColorToPixel(_In_ BL_COLOR Color, _Out_ PUCHAR Pixel)
Definition: guicons.c:174
@ BlUgaConsole
Definition: bl.h:1141
VOID ConsolepClearBuffer(_In_ PUCHAR FrameBuffer, _In_ ULONG Width, _In_ PUCHAR FillColor, _In_ ULONG Height, _In_ ULONG ScanlineWidth, _In_ ULONG PixelDepth)
Definition: guicons.c:109
#define STATUS_NOT_IMPLEMENTED
Definition: ntstatus.h:239
unsigned char UCHAR
Definition: xmlstorage.h:181

Referenced by ConsoleGraphicalClearPixels().

◆ ConsoleFirmwareGraphicalClose()

VOID ConsoleFirmwareGraphicalClose ( _In_ PBL_GRAPHICS_CONSOLE  GraphicsConsole)

Definition at line 18 of file guicons.c.

21{
22 /* Call the correct close routine based on the console mode */
23 if (GraphicsConsole->Type == BlUgaConsole)
24 {
25 ConsoleEfiUgaClose(GraphicsConsole);
26 }
27 else
28 {
29 ConsoleEfiGopClose(GraphicsConsole);
30 }
31}
VOID ConsoleEfiUgaClose(_In_ PBL_GRAPHICS_CONSOLE GraphicsConsole)
Definition: uga.c:27
VOID ConsoleEfiGopClose(_In_ PBL_GRAPHICS_CONSOLE GraphicsConsole)
Definition: gop.c:177

Referenced by ConsoleGraphicalConstruct(), and ConsoleGraphicalDestruct().

◆ ConsoleFirmwareGraphicalDisable()

VOID ConsoleFirmwareGraphicalDisable ( _In_ PBL_GRAPHICS_CONSOLE  GraphicsConsole)

Definition at line 153 of file guicons.c.

156{
157 /* Is this a GOP console? */
158 if (GraphicsConsole->Type == BlGopConsole)
159 {
160 /* Did we map a framebuffer? */
161 if (GraphicsConsole->FrameBuffer)
162 {
163 /* Unmap it */
164 BlMmUnmapVirtualAddressEx(GraphicsConsole->FrameBuffer,
165 GraphicsConsole->FrameBufferSize);
166 }
167 }
168}
NTSTATUS BlMmUnmapVirtualAddressEx(_In_ PVOID VirtualAddress, _In_ ULONGLONG Size)
Definition: mm.c:487

Referenced by ConsoleGraphicalDestruct(), ConsoleGraphicalEnable(), and ConsoleGraphicalReinitialize().

◆ ConsoleFirmwareGraphicalEnable()

NTSTATUS ConsoleFirmwareGraphicalEnable ( _In_ PBL_GRAPHICS_CONSOLE  GraphicsConsole)

Definition at line 128 of file guicons.c.

131{
133
134 /* Check what type of console this is */
135 if (GraphicsConsole->Type == BlUgaConsole)
136 {
137 /* Handle UGA */
138 Status = ConsoleEfiUgaSetResolution(GraphicsConsole,
139 &GraphicsConsole->DisplayMode,
140 1);
141 }
142 else
143 {
144 /* Handle GOP */
145 Status = ConsoleEfiGopEnable(GraphicsConsole);
146 }
147
148 /* Return back to caller */
149 return Status;
150}
NTSTATUS ConsoleEfiUgaSetResolution(_In_ PBL_GRAPHICS_CONSOLE GraphicsConsole, _In_ PBL_DISPLAY_MODE DisplayMode, _In_ ULONG DisplayModeCount)
Definition: uga.c:35
NTSTATUS ConsoleEfiGopEnable(_In_ PBL_GRAPHICS_CONSOLE GraphicsConsole)
Definition: gop.c:88

Referenced by ConsoleGraphicalConstruct(), ConsoleGraphicalEnable(), and ConsoleGraphicalReinitialize().