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