]> git.proxmox.com Git - mirror_edk2.git/blame - IntelFrameworkModulePkg/Universal/Console/VgaClassDxe/VgaClass.h
if module doesn't explicitly depend on specific Pci spec, it should include IndustryS...
[mirror_edk2.git] / IntelFrameworkModulePkg / Universal / Console / VgaClassDxe / VgaClass.h
CommitLineData
55a1bb43 1/** @file\r
2 Internal include file of the VGA Class Driver.\r
e081218d 3\r
55a1bb43 4Copyright (c) 2006 - 2009, Intel Corporation \r
3db51098 5All rights reserved. This program and the accompanying materials \r
6are licensed and made available under the terms and conditions of the BSD License \r
7which accompanies this distribution. The full text of the license may be found at \r
8http://opensource.org/licenses/bsd-license.php \r
9 \r
10THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
11WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r
e081218d 12\r
3db51098 13**/\r
e081218d 14\r
e081218d 15\r
55a1bb43 16#ifndef _VGA_CLASS_H__\r
17#define _VGA_CLASS_H__\r
e081218d 18\r
e081218d 19#include <FrameworkDxe.h>\r
ed7748fe 20\r
e081218d 21#include <Protocol/SimpleTextOut.h>\r
22#include <Protocol/PciIo.h>\r
23#include <Protocol/VgaMiniPort.h>\r
24#include <Protocol/DevicePath.h>\r
ed7748fe 25\r
e081218d 26#include <Library/DebugLib.h>\r
27#include <Library/UefiDriverEntryPoint.h>\r
e081218d 28#include <Library/UefiLib.h>\r
e081218d 29#include <Library/MemoryAllocationLib.h>\r
30#include <Library/UefiBootServicesTableLib.h>\r
31#include <Library/ReportStatusCodeLib.h>\r
32\r
9910cfe7 33#include <IndustryStandard/Pci.h>\r
55a1bb43 34\r
9f6531d1 35//\r
36// Global Variables\r
37//\r
38extern EFI_DRIVER_BINDING_PROTOCOL gVgaClassDriverBinding;\r
39extern EFI_COMPONENT_NAME_PROTOCOL gVgaClassComponentName;\r
40extern EFI_COMPONENT_NAME2_PROTOCOL gVgaClassComponentName2;\r
41\r
42\r
55a1bb43 43//\r
44// Structure for tuple containing mapping among uniocde, PC Ansi and ASCII code.\r
45//\r
46typedef struct {\r
47 CHAR16 Unicode;\r
48 CHAR8 PcAnsi;\r
49 CHAR8 Ascii;\r
50} UNICODE_TO_CHAR;\r
e081218d 51\r
52//\r
53// VGA specific registers\r
54//\r
55#define CRTC_CURSOR_START 0xA\r
56#define CRTC_CURSOR_END 0xB\r
57\r
58#define CRTC_CURSOR_LOCATION_HIGH 0xE\r
59#define CRTC_CURSOR_LOCATION_LOW 0xF\r
60\r
61#define EFI_MAX_ATTRIBUTE 0x7f\r
62\r
63//\r
64// VGA Class Device Structure\r
65//\r
f02bd376 66#define VGA_CLASS_DEV_SIGNATURE SIGNATURE_32 ('V', 'G', 'A', 'C')\r
e081218d 67\r
68typedef struct {\r
55a1bb43 69 UINTN Signature;\r
70 EFI_HANDLE Handle;\r
e081218d 71 EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL SimpleTextOut;\r
55a1bb43 72 EFI_SIMPLE_TEXT_OUTPUT_MODE SimpleTextOutputMode;\r
73 EFI_VGA_MINI_PORT_PROTOCOL *VgaMiniPort;\r
74 EFI_PCI_IO_PROTOCOL *PciIo;\r
75 EFI_DEVICE_PATH_PROTOCOL *DevicePath;\r
e081218d 76} VGA_CLASS_DEV;\r
77\r
78#define VGA_CLASS_DEV_FROM_THIS(a) CR (a, VGA_CLASS_DEV, SimpleTextOut, VGA_CLASS_DEV_SIGNATURE)\r
79\r
e081218d 80//\r
81// Driver Binding Protocol functions\r
82//\r
e081218d 83\r
55a1bb43 84/**\r
85 Tests to see if this driver supports a given controller.\r
e081218d 86\r
55a1bb43 87 This function implments EFI_DRIVER_BINDING_PROTOCOL.Supported().\r
88 It Checks if this driver supports the controller specified. Any Controller\r
89 with VgaMiniPort Protocol and Pci I/O protocol can be supported.\r
e081218d 90\r
55a1bb43 91 @param This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.\r
92 @param ControllerHandle Handle of device to test\r
93 @param RemainingDevicePath Optional parameter use to pick a specific child\r
94 device to start.\r
e081218d 95\r
55a1bb43 96 @retval EFI_SUCCESS This driver supports this device.\r
97 @retval EFI_ALREADY_STARTED This driver is already running on this device.\r
98 @retval EFI_UNSUPPORTED This driver does not support this device.\r
e081218d 99\r
bcd70414 100**/\r
e081218d 101EFI_STATUS\r
102EFIAPI\r
55a1bb43 103VgaClassDriverBindingSupported (\r
104 IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
105 IN EFI_HANDLE Controller,\r
106 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL\r
107 );\r
108\r
bcd70414 109/**\r
55a1bb43 110 Starts the device controller.\r
111\r
112 This function implments EFI_DRIVER_BINDING_PROTOCOL.Start().\r
113 It starts the device specified by Controller with the driver based on PCI I/O Protocol\r
114 and VgaMiniPort Protocol. It creates context for device instance and install EFI_SIMPLE_TEXT_OUT_PROTOCOL.\r
e081218d 115\r
55a1bb43 116 @param This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.\r
117 @param ControllerHandle Handle of device to bind driver to\r
118 @param RemainingDevicePath Optional parameter use to pick a specific child\r
119 device to start.\r
e081218d 120\r
55a1bb43 121 @retval EFI_SUCCESS The device was started.\r
122 @retval other Fail to start the device.\r
e081218d 123\r
55a1bb43 124**/\r
125EFI_STATUS\r
126EFIAPI\r
127VgaClassDriverBindingStart (\r
128 IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
129 IN EFI_HANDLE Controller,\r
130 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL\r
131 );\r
e081218d 132\r
55a1bb43 133/**\r
134 Starts the device controller.\r
135 \r
136 This function implments EFI_DRIVER_BINDING_PROTOCOL.Stop().\r
137 It stops this driver on Controller. Support stoping any child handles\r
138 created by this driver.\r
e081218d 139\r
55a1bb43 140 @param This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.\r
141 @param ControllerHandle A handle to the device being stopped.\r
142 @param NumberOfChildren The number of child device handles in ChildHandleBuffer.\r
143 @param ChildHandleBuffer An array of child handles to be freed.\r
e081218d 144\r
55a1bb43 145 @retval EFI_SUCCESS This driver is removed ControllerHandle\r
146 @retval other This driver was not removed from this device\r
e081218d 147\r
bcd70414 148**/\r
e081218d 149EFI_STATUS\r
150EFIAPI\r
151VgaClassDriverBindingStop (\r
55a1bb43 152 IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
153 IN EFI_HANDLE Controller,\r
154 IN UINTN NumberOfChildren,\r
155 IN EFI_HANDLE *ChildHandleBuffer OPTIONAL\r
156 );\r
e081218d 157\r
55a1bb43 158//\r
159// EFI Component Name Functions\r
160//\r
e081218d 161\r
55a1bb43 162/**\r
163 Retrieves a Unicode string that is the user readable name of the driver.\r
164\r
165 This function retrieves the user readable name of a driver in the form of a\r
166 Unicode string. If the driver specified by This has a user readable name in\r
167 the language specified by Language, then a pointer to the driver name is\r
168 returned in DriverName, and EFI_SUCCESS is returned. If the driver specified\r
169 by This does not support the language specified by Language,\r
170 then EFI_UNSUPPORTED is returned.\r
171\r
172 @param This A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or\r
173 EFI_COMPONENT_NAME_PROTOCOL instance.\r
174 @param Language A pointer to a Null-terminated ASCII string\r
175 array indicating the language. This is the\r
176 language of the driver name that the caller is\r
177 requesting, and it must match one of the\r
178 languages specified in SupportedLanguages. The\r
179 number of languages supported by a driver is up\r
180 to the driver writer. Language is specified\r
4bca47e1 181 in RFC 4646 or ISO 639-2 language code format.\r
55a1bb43 182 @param DriverName A pointer to the Unicode string to return.\r
183 This Unicode string is the name of the\r
184 driver specified by This in the language\r
185 specified by Language.\r
186\r
187 @retval EFI_SUCCESS The Unicode string for the Driver specified by\r
188 This and the language specified by Language was\r
189 returned in DriverName.\r
190 @retval EFI_INVALID_PARAMETER Language is NULL.\r
191 @retval EFI_INVALID_PARAMETER DriverName is NULL.\r
192 @retval EFI_UNSUPPORTED The driver specified by This does not support\r
193 the language specified by Language.\r
e081218d 194\r
55a1bb43 195**/\r
196EFI_STATUS\r
197EFIAPI\r
198VgaClassComponentNameGetDriverName (\r
199 IN EFI_COMPONENT_NAME_PROTOCOL *This,\r
200 IN CHAR8 *Language,\r
201 OUT CHAR16 **DriverName\r
202 );\r
e081218d 203\r
55a1bb43 204/**\r
205 Retrieves a Unicode string that is the user readable name of the controller\r
206 that is being managed by a driver.\r
207\r
208 This function retrieves the user readable name of the controller specified by\r
209 ControllerHandle and ChildHandle in the form of a Unicode string. If the\r
210 driver specified by This has a user readable name in the language specified by\r
211 Language, then a pointer to the controller name is returned in ControllerName,\r
212 and EFI_SUCCESS is returned. If the driver specified by This is not currently\r
213 managing the controller specified by ControllerHandle and ChildHandle,\r
214 then EFI_UNSUPPORTED is returned. If the driver specified by This does not\r
215 support the language specified by Language, then EFI_UNSUPPORTED is returned.\r
216\r
217 @param This A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or\r
218 EFI_COMPONENT_NAME_PROTOCOL instance.\r
219 @param ControllerHandle The handle of a controller that the driver\r
220 specified by This is managing. This handle\r
221 specifies the controller whose name is to be\r
222 returned.\r
223 @param ChildHandle The handle of the child controller to retrieve\r
224 the name of. This is an optional parameter that\r
225 may be NULL. It will be NULL for device\r
226 drivers. It will also be NULL for a bus drivers\r
227 that wish to retrieve the name of the bus\r
228 controller. It will not be NULL for a bus\r
229 driver that wishes to retrieve the name of a\r
230 child controller.\r
231 @param Language A pointer to a Null-terminated ASCII string\r
232 array indicating the language. This is the\r
233 language of the driver name that the caller is\r
234 requesting, and it must match one of the\r
235 languages specified in SupportedLanguages. The\r
236 number of languages supported by a driver is up\r
237 to the driver writer. Language is specified in\r
4bca47e1 238 RFC 4646 or ISO 639-2 language code format.\r
55a1bb43 239 @param ControllerName A pointer to the Unicode string to return.\r
240 This Unicode string is the name of the\r
241 controller specified by ControllerHandle and\r
242 ChildHandle in the language specified by\r
243 Language from the point of view of the driver\r
244 specified by This.\r
245\r
246 @retval EFI_SUCCESS The Unicode string for the user readable name in\r
247 the language specified by Language for the\r
248 driver specified by This was returned in\r
249 DriverName.\r
250 @retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE.\r
251 @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid\r
252 EFI_HANDLE.\r
253 @retval EFI_INVALID_PARAMETER Language is NULL.\r
254 @retval EFI_INVALID_PARAMETER ControllerName is NULL.\r
255 @retval EFI_UNSUPPORTED The driver specified by This is not currently\r
256 managing the controller specified by\r
257 ControllerHandle and ChildHandle.\r
258 @retval EFI_UNSUPPORTED The driver specified by This does not support\r
259 the language specified by Language.\r
e081218d 260\r
bcd70414 261**/\r
55a1bb43 262EFI_STATUS\r
263EFIAPI\r
264VgaClassComponentNameGetControllerName (\r
265 IN EFI_COMPONENT_NAME_PROTOCOL *This,\r
266 IN EFI_HANDLE ControllerHandle,\r
267 IN EFI_HANDLE ChildHandle OPTIONAL,\r
268 IN CHAR8 *Language,\r
269 OUT CHAR16 **ControllerName\r
270 );\r
e081218d 271\r
272//\r
273// Simple Text Output Protocol functions\r
274//\r
bcd70414 275/**\r
55a1bb43 276 Resets the text output device hardware.\r
e081218d 277\r
55a1bb43 278 This function implements EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL.Reset().\r
279 It resets the text output device hardware. The cursor position is set to (0, 0),\r
280 and the screen is cleared to the default background color for the output device.\r
281 \r
282 @param This Pointer to EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL instance.\r
283 @param ExtendedVerification Indicates that the driver may perform a more exhaustive\r
284 verification operation of the device during reset.\r
e081218d 285\r
55a1bb43 286 @retval EFI_SUCCESS The text output device was reset.\r
287 @retval EFI_DEVICE_ERROR The text output device is not functioning correctly and could not be reset.\r
e081218d 288\r
bcd70414 289**/\r
55a1bb43 290EFI_STATUS\r
291EFIAPI\r
292VgaClassReset (\r
293 IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,\r
294 IN BOOLEAN ExtendedVerification\r
295 );\r
e081218d 296\r
55a1bb43 297/**\r
298 Writes a Unicode string to the output device.\r
299 \r
300 This function implements EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL.OutputString().\r
301 It writes a Unicode string to the output device. This is the most basic output mechanism\r
302 on an output device.\r
303\r
304 @param This Pointer to EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL instance.\r
305 @param String The Null-terminated Unicode string to be displayed on the output device(s).\r
306\r
307 @retval EFI_SUCCESS The string was output to the device.\r
308 @retval EFI_DEVICE_ERROR The device reported an error while attempting to output the text.\r
309