2 Internal include file for VGA Mini Port Driver.
4 Copyright (c) 2006 - 2009, 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
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.
15 #ifndef _VGA_MINIPORT_H_
16 #define _VGA_MINIPORT_H_
19 // The package level header files this module uses
23 // The protocols, PPI and GUID defintions for this module
25 #include <Protocol/PciIo.h>
26 #include <Protocol/VgaMiniPort.h>
27 #include <Protocol/ComponentName2.h>
31 // The Library classes this module consumes
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>
40 #include <IndustryStandard/Pci.h>
45 extern EFI_DRIVER_BINDING_PROTOCOL gPciVgaMiniPortDriverBinding
;
46 extern EFI_COMPONENT_NAME_PROTOCOL gPciVgaMiniPortComponentName
;
47 extern EFI_COMPONENT_NAME2_PROTOCOL gPciVgaMiniPortComponentName2
;
50 // PCI VGA MiniPort Device Structure
52 #define PCI_VGA_MINI_PORT_DEV_SIGNATURE SIGNATURE_32('P','V','M','P')
57 EFI_VGA_MINI_PORT_PROTOCOL VgaMiniPort
;
58 EFI_PCI_IO_PROTOCOL
*PciIo
;
59 } PCI_VGA_MINI_PORT_DEV
;
61 #define PCI_VGA_MINI_PORT_DEV_FROM_THIS(a) CR(a, PCI_VGA_MINI_PORT_DEV, VgaMiniPort, PCI_VGA_MINI_PORT_DEV_SIGNATURE)
64 // Driver Binding Protocol functions
67 Check whether VGA Mini Port driver supports this device.
69 @param This The driver binding protocol.
70 @param Controller The controller handle to check.
71 @param RemainingDevicePath The remaining device path.
73 @retval EFI_SUCCESS The driver supports this controller.
74 @retval EFI_UNSUPPORTED This device isn't supported.
79 PciVgaMiniPortDriverBindingSupported (
80 IN EFI_DRIVER_BINDING_PROTOCOL
*This
,
81 IN EFI_HANDLE Controller
,
82 IN EFI_DEVICE_PATH_PROTOCOL
*RemainingDevicePath
86 Starts the VGA device with this driver.
88 This function consumes PCI I/O Protocol, and installs VGA Mini Port Protocol
89 onto the VGA device handle.
91 @param This The driver binding instance.
92 @param Controller The controller to check.
93 @param RemainingDevicePath The remaining device patch.
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.
102 PciVgaMiniPortDriverBindingStart (
103 IN EFI_DRIVER_BINDING_PROTOCOL
*This
,
104 IN EFI_HANDLE Controller
,
105 IN EFI_DEVICE_PATH_PROTOCOL
*RemainingDevicePath
109 Stop the VGA device with this driver.
111 This function uninstalls VGA Mini Port Protocol from the VGA device handle,
112 and closes PCI I/O Protocol.
114 @param This The driver binding protocol.
115 @param Controller The controller to release.
116 @param NumberOfChildren The child number that opened controller
118 @param ChildHandleBuffer The array of child handle.
120 @retval EFI_SUCCESS The controller or children are stopped.
121 @retval EFI_DEVICE_ERROR Failed to stop the driver.
126 PciVgaMiniPortDriverBindingStop (
127 IN EFI_DRIVER_BINDING_PROTOCOL
*This
,
128 IN EFI_HANDLE Controller
,
129 IN UINTN NumberOfChildren
,
130 IN EFI_HANDLE
*ChildHandleBuffer
134 // EFI Component Name Functions
137 Retrieves a Unicode string that is the user readable name of the driver.
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.
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.
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.
172 PciVgaMiniPortComponentNameGetDriverName (
173 IN EFI_COMPONENT_NAME_PROTOCOL
*This
,
175 OUT CHAR16
**DriverName
179 Retrieves a Unicode string that is the user readable name of the controller
180 that is being managed by a driver.
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.
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
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
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
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
224 @retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE.
225 @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid
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.
238 PciVgaMiniPortComponentNameGetControllerName (
239 IN EFI_COMPONENT_NAME_PROTOCOL
*This
,
240 IN EFI_HANDLE ControllerHandle
,
241 IN EFI_HANDLE ChildHandle OPTIONAL
,
243 OUT CHAR16
**ControllerName
247 // VGA Mini Port Protocol functions
250 Sets the text display mode of a VGA controller.
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.
256 @param This Protocol instance pointer.
257 @param ModeNumber Mode number. 0 - 80x25 1-80x50
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.
266 PciVgaMiniPortSetMode (
267 IN EFI_VGA_MINI_PORT_PROTOCOL
*This
,