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