]> git.proxmox.com Git - mirror_edk2.git/blame - IntelFrameworkModulePkg/Bus/Pci/VgaMiniPortDxe/VgaMiniPort.h
Code scrub for VgaMiniPortDxe.
[mirror_edk2.git] / IntelFrameworkModulePkg / Bus / Pci / VgaMiniPortDxe / VgaMiniPort.h
CommitLineData
733f03aa 1/** @file\r
269e4559 2 Internal include file for VGA Mini Port Driver.\r
733f03aa 3\r
269e4559 4Copyright (c) 2006 - 2009 Intel Corporation. All rights reserved\r
733f03aa 5This 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
12\r
13**/\r
14\r
eeefcb9d 15#ifndef _VGA_MINIPORT_H_\r
16#define _VGA_MINIPORT_H_\r
733f03aa 17\r
18//\r
19// The package level header files this module uses\r
20//\r
21#include <PiDxe.h>\r
22//\r
23// The protocols, PPI and GUID defintions for this module\r
24//\r
25#include <Protocol/PciIo.h>\r
26#include <Protocol/VgaMiniPort.h>\r
27#include <Protocol/ComponentName2.h>\r
28\r
29\r
30//\r
31// The Library classes this module consumes\r
32//\r
33#include <Library/DebugLib.h>\r
34#include <Library/BaseMemoryLib.h>\r
35#include <Library/UefiDriverEntryPoint.h>\r
36#include <Library/UefiBootServicesTableLib.h>\r
37#include <Library/UefiLib.h>\r
269e4559 38#include <Library/MemoryAllocationLib.h>\r
733f03aa 39\r
40#include <IndustryStandard/Pci22.h>\r
41\r
9f6531d1 42//\r
43// Global Variables\r
44//\r
45extern EFI_DRIVER_BINDING_PROTOCOL gPciVgaMiniPortDriverBinding;\r
46extern EFI_COMPONENT_NAME_PROTOCOL gPciVgaMiniPortComponentName;\r
47extern EFI_COMPONENT_NAME2_PROTOCOL gPciVgaMiniPortComponentName2;\r
48\r
733f03aa 49//\r
50// PCI VGA MiniPort Device Structure\r
51//\r
f02bd376 52#define PCI_VGA_MINI_PORT_DEV_SIGNATURE SIGNATURE_32('P','V','M','P')\r
733f03aa 53\r
54typedef struct {\r
55 UINTN Signature;\r
56 EFI_HANDLE Handle;\r
57 EFI_VGA_MINI_PORT_PROTOCOL VgaMiniPort;\r
58 EFI_PCI_IO_PROTOCOL *PciIo;\r
59} PCI_VGA_MINI_PORT_DEV;\r
60\r
61#define PCI_VGA_MINI_PORT_DEV_FROM_THIS(a) CR(a, PCI_VGA_MINI_PORT_DEV, VgaMiniPort, PCI_VGA_MINI_PORT_DEV_SIGNATURE)\r
62\r
733f03aa 63//\r
64// Driver Binding Protocol functions\r
65//\r
eeefcb9d 66/**\r
269e4559 67 Check whether VGA Mini Port driver supports this device.\r
eeefcb9d 68\r
69 @param This The driver binding protocol.\r
70 @param Controller The controller handle to check.\r
71 @param RemainingDevicePath The remaining device path.\r
72\r
73 @retval EFI_SUCCESS The driver supports this controller.\r
74 @retval EFI_UNSUPPORTED This device isn't supported.\r
75\r
76**/\r
733f03aa 77EFI_STATUS\r
eeefcb9d 78EFIAPI\r
733f03aa 79PciVgaMiniPortDriverBindingSupported (\r
80 IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
81 IN EFI_HANDLE Controller,\r
82 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath\r
83 );\r
84\r
eeefcb9d 85/**\r
269e4559 86 Starts the VGA device with this driver.\r
eeefcb9d 87\r
269e4559 88 This function consumes PCI I/O Protocol, and installs VGA Mini Port Protocol\r
89 onto the VGA device handle.\r
eeefcb9d 90\r
91 @param This The driver binding instance.\r
92 @param Controller The controller to check.\r
93 @param RemainingDevicePath The remaining device patch.\r
94\r
95 @retval EFI_SUCCESS The controller is controlled by the driver.\r
96 @retval EFI_ALREADY_STARTED The controller is already controlled by the driver.\r
97 @retval EFI_OUT_OF_RESOURCES Failed to allocate resources.\r
98\r
99**/\r
733f03aa 100EFI_STATUS\r
eeefcb9d 101EFIAPI\r
733f03aa 102PciVgaMiniPortDriverBindingStart (\r
103 IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
104 IN EFI_HANDLE Controller,\r
105 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath\r
106 );\r
107\r
eeefcb9d 108/**\r
269e4559 109 Stop the VGA device with this driver.\r
eeefcb9d 110\r
269e4559 111 This function uninstalls VGA Mini Port Protocol from the VGA device handle,\r
112 and closes PCI I/O Protocol.\r
eeefcb9d 113\r
114 @param This The driver binding protocol.\r
115 @param Controller The controller to release.\r
116 @param NumberOfChildren The child number that opened controller\r
117 BY_CHILD.\r
118 @param ChildHandleBuffer The array of child handle.\r
119\r
120 @retval EFI_SUCCESS The controller or children are stopped.\r
121 @retval EFI_DEVICE_ERROR Failed to stop the driver.\r
122\r
123**/\r
733f03aa 124EFI_STATUS\r
eeefcb9d 125EFIAPI\r
733f03aa 126PciVgaMiniPortDriverBindingStop (\r
127 IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
128 IN EFI_HANDLE Controller,\r
129 IN UINTN NumberOfChildren,\r
130 IN EFI_HANDLE *ChildHandleBuffer\r
131 );\r
132\r
133//\r
269e4559 134// EFI Component Name Functions\r
733f03aa 135//\r
eeefcb9d 136/**\r
269e4559 137 Retrieves a Unicode string that is the user readable name of the driver.\r
138\r
139 This function retrieves the user readable name of a driver in the form of a\r
140 Unicode string. If the driver specified by This has a user readable name in\r
141 the language specified by Language, then a pointer to the driver name is\r
142 returned in DriverName, and EFI_SUCCESS is returned. If the driver specified\r
143 by This does not support the language specified by Language,\r
144 then EFI_UNSUPPORTED is returned.\r
145\r
146 @param This A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or\r
147 EFI_COMPONENT_NAME_PROTOCOL instance.\r
148 @param Language A pointer to a Null-terminated ASCII string\r
149 array indicating the language. This is the\r
150 language of the driver name that the caller is\r
151 requesting, and it must match one of the\r
152 languages specified in SupportedLanguages. The\r
153 number of languages supported by a driver is up\r
154 to the driver writer. Language is specified\r
155 in RFC 4646 or ISO 639-2 language code format.\r
156 @param DriverName A pointer to the Unicode string to return.\r
157 This Unicode string is the name of the\r
158 driver specified by This in the language\r
159 specified by Language.\r
160\r
161 @retval EFI_SUCCESS The Unicode string for the Driver specified by\r
162 This and the language specified by Language was\r
163 returned in DriverName.\r
164 @retval EFI_INVALID_PARAMETER Language is NULL.\r
165 @retval EFI_INVALID_PARAMETER DriverName is NULL.\r
166 @retval EFI_UNSUPPORTED The driver specified by This does not support\r
167 the language specified by Language.\r
168\r
169**/\r
170EFI_STATUS\r
171EFIAPI\r
172PciVgaMiniPortComponentNameGetDriverName (\r
173 IN EFI_COMPONENT_NAME_PROTOCOL *This,\r
174 IN CHAR8 *Language,\r
175 OUT CHAR16 **DriverName\r
176 );\r
eeefcb9d 177\r
269e4559 178/**\r
179 Retrieves a Unicode string that is the user readable name of the controller\r
180 that is being managed by a driver.\r
181\r
182 This function retrieves the user readable name of the controller specified by\r
183 ControllerHandle and ChildHandle in the form of a Unicode string. If the\r
184 driver specified by This has a user readable name in the language specified by\r
185 Language, then a pointer to the controller name is returned in ControllerName,\r
186 and EFI_SUCCESS is returned. If the driver specified by This is not currently\r
187 managing the controller specified by ControllerHandle and ChildHandle,\r
188 then EFI_UNSUPPORTED is returned. If the driver specified by This does not\r
189 support the language specified by Language, then EFI_UNSUPPORTED is returned.\r
190\r
191 @param This A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or\r
192 EFI_COMPONENT_NAME_PROTOCOL instance.\r
193 @param ControllerHandle The handle of a controller that the driver\r
194 specified by This is managing. This handle\r
195 specifies the controller whose name is to be\r
196 returned.\r
197 @param ChildHandle The handle of the child controller to retrieve\r
198 the name of. This is an optional parameter that\r
199 may be NULL. It will be NULL for device\r
200 drivers. It will also be NULL for a bus drivers\r
201 that wish to retrieve the name of the bus\r
202 controller. It will not be NULL for a bus\r
203 driver that wishes to retrieve the name of a\r
204 child controller.\r
205 @param Language A pointer to a Null-terminated ASCII string\r
206 array indicating the language. This is the\r
207 language of the driver name that the caller is\r
208 requesting, and it must match one of the\r
209 languages specified in SupportedLanguages. The\r
210 number of languages supported by a driver is up\r
211 to the driver writer. Language is specified in\r
212 RFC 4646 or ISO 639-2 language code format.\r
213 @param ControllerName A pointer to the Unicode string to return.\r
214 This Unicode string is the name of the\r
215 controller specified by ControllerHandle and\r
216 ChildHandle in the language specified by\r
217 Language from the point of view of the driver\r
218 specified by This.\r
219\r
220 @retval EFI_SUCCESS The Unicode string for the user readable name in\r
221 the language specified by Language for the\r
222 driver specified by This was returned in\r
223 DriverName.\r
224 @retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE.\r
225 @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid\r
226 EFI_HANDLE.\r
227 @retval EFI_INVALID_PARAMETER Language is NULL.\r
228 @retval EFI_INVALID_PARAMETER ControllerName is NULL.\r
229 @retval EFI_UNSUPPORTED The driver specified by This is not currently\r
230 managing the controller specified by\r
231 ControllerHandle and ChildHandle.\r
232 @retval EFI_UNSUPPORTED The driver specified by This does not support\r
233 the language specified by Language.\r
eeefcb9d 234\r
269e4559 235**/\r
236EFI_STATUS\r
237EFIAPI\r
238PciVgaMiniPortComponentNameGetControllerName (\r
239 IN EFI_COMPONENT_NAME_PROTOCOL *This,\r
240 IN EFI_HANDLE ControllerHandle,\r
241 IN EFI_HANDLE ChildHandle OPTIONAL,\r
242 IN CHAR8 *Language,\r
243 OUT CHAR16 **ControllerName\r
244 );\r
eeefcb9d 245\r
269e4559 246//\r
247// VGA Mini Port Protocol functions\r
248//\r
249/**\r
250 Sets the text display mode of a VGA controller.\r
251\r
252 This function implements EFI_VGA_MINI_PORT_PROTOCOL.SetMode().\r
253 If ModeNumber exceeds the valid range, then EFI_UNSUPPORTED is returned.\r
254 Otherwise, EFI_SUCCESS is directly returned without real operation.\r
255 \r
256 @param This Protocol instance pointer.\r
257 @param ModeNumber Mode number. 0 - 80x25 1-80x50\r
258\r
259 @retval EFI_SUCCESS The mode was set\r
260 @retval EFI_UNSUPPORTED ModeNumber is not supported.\r
261 @retval EFI_DEVICE_ERROR The device is not functioning properly.\r
262 \r
eeefcb9d 263**/\r
733f03aa 264EFI_STATUS\r
265EFIAPI\r
266PciVgaMiniPortSetMode (\r
267 IN EFI_VGA_MINI_PORT_PROTOCOL *This,\r
268 IN UINTN ModeNumber\r
269 );\r
270\r
271#endif\r