ReactOS  0.4.14-dev-115-g4576127
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);
58  return STATUS_UNSUCCESSFUL;
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 */
86  return STATUS_UNSUCCESSFUL;
87 }
NTSTATUS EfiLocateHandleBuffer(_In_ EFI_LOCATE_SEARCH_TYPE SearchType, _In_ EFI_GUID *Protocol, _Inout_ PULONG HandleCount, _Inout_ EFI_HANDLE **Buffer)
Definition: firmware.c:1399
Type
Definition: Type.h:6
LONG NTSTATUS
Definition: precomp.h:26
EFI_GUID EfiUgaDrawProtocol
Definition: firmware.c:29
NTSTATUS ConsoleEfiUgaOpen(_In_ PBL_GRAPHICS_CONSOLE GraphicsConsole)
Definition: uga.c:18
NTSTATUS EfiOpenProtocol(_In_ EFI_HANDLE Handle, _In_ EFI_GUID *Protocol, _Out_ PVOID *Interface)
smooth NULL
Definition: ftsmooth.c:416
NTSTATUS EfiCloseProtocol(_In_ EFI_HANDLE Handle, _In_ EFI_GUID *Protocol)
Definition: firmware.c:581
_In_ HANDLE Handle
Definition: extypes.h:390
IN PVOID IN PVOID IN USHORT IN USHORT IN PINTERFACE Interface
Definition: pci.h:359
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
static const WCHAR L[]
Definition: oid.c:1250
EFI_GUID EfiDevicePathProtocol
Definition: firmware.c:31
Status
Definition: gdiplustypes.h:24
EFI_GUID EfiGraphicsOutputProtocol
Definition: firmware.c:28
VOID EfiPrintf(_In_ PWCHAR Format,...)
Definition: firmware.c:126
NTSTATUS ConsoleEfiGopOpen(_In_ PBL_GRAPHICS_CONSOLE GraphicsConsole)
Definition: gop.c:198
unsigned int ULONG
Definition: retypes.h:1
return STATUS_SUCCESS
Definition: btrfs.c:2966

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 }
#define STATUS_NOT_IMPLEMENTED
Definition: ntstatus.h:225
LONG NTSTATUS
Definition: precomp.h:26
NTSTATUS ConsolepConvertColorToPixel(_In_ BL_COLOR Color, _Out_ PUCHAR Pixel)
Definition: guicons.c:174
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
unsigned char UCHAR
Definition: xmlstorage.h:181
static const WCHAR L[]
Definition: oid.c:1250
VOID ConsolepClearBuffer(_In_ PUCHAR FrameBuffer, _In_ ULONG Width, _In_ PUCHAR FillColor, _In_ ULONG Height, _In_ ULONG ScanlineWidth, _In_ ULONG PixelDepth)
Definition: guicons.c:109
Status
Definition: gdiplustypes.h:24
VOID EfiPrintf(_In_ PWCHAR Format,...)
Definition: firmware.c:126
CConsole Console
return STATUS_SUCCESS
Definition: btrfs.c:2966

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 ConsoleEfiGopClose(_In_ PBL_GRAPHICS_CONSOLE GraphicsConsole)
Definition: gop.c:177
VOID ConsoleEfiUgaClose(_In_ PBL_GRAPHICS_CONSOLE GraphicsConsole)
Definition: uga.c:27

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
LONG NTSTATUS
Definition: precomp.h:26
Status
Definition: gdiplustypes.h:24
NTSTATUS ConsoleEfiGopEnable(_In_ PBL_GRAPHICS_CONSOLE GraphicsConsole)
Definition: gop.c:88

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