]>
Commit | Line | Data |
---|---|---|
1 | /** @file\r | |
2 | Internal include file for VGA Mini Port Driver.\r | |
3 | \r | |
4 | Copyright (c) 2006 - 2009 Intel Corporation. All rights reserved\r | |
5 | This program and the accompanying materials\r | |
6 | are licensed and made available under the terms and conditions of the BSD License\r | |
7 | which accompanies this distribution. The full text of the license may be found at\r | |
8 | http://opensource.org/licenses/bsd-license.php\r | |
9 | \r | |
10 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r | |
11 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
12 | \r | |
13 | **/\r | |
14 | \r | |
15 | #ifndef _VGA_MINIPORT_H_\r | |
16 | #define _VGA_MINIPORT_H_\r | |
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 | |
38 | #include <Library/MemoryAllocationLib.h>\r | |
39 | \r | |
40 | #include <IndustryStandard/Pci22.h>\r | |
41 | \r | |
42 | //\r | |
43 | // Global Variables\r | |
44 | //\r | |
45 | extern EFI_DRIVER_BINDING_PROTOCOL gPciVgaMiniPortDriverBinding;\r | |
46 | extern EFI_COMPONENT_NAME_PROTOCOL gPciVgaMiniPortComponentName;\r | |
47 | extern EFI_COMPONENT_NAME2_PROTOCOL gPciVgaMiniPortComponentName2;\r | |
48 | \r | |
49 | //\r | |
50 | // PCI VGA MiniPort Device Structure\r | |
51 | //\r | |
52 | #define PCI_VGA_MINI_PORT_DEV_SIGNATURE SIGNATURE_32('P','V','M','P')\r | |
53 | \r | |
54 | typedef 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 | |
63 | //\r | |
64 | // Driver Binding Protocol functions\r | |
65 | //\r | |
66 | /**\r | |
67 | Check whether VGA Mini Port driver supports this device.\r | |
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 | |
77 | EFI_STATUS\r | |
78 | EFIAPI\r | |
79 | PciVgaMiniPortDriverBindingSupported (\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 | |
85 | /**\r | |
86 | Starts the VGA device with this driver.\r | |
87 | \r | |
88 | This function consumes PCI I/O Protocol, and installs VGA Mini Port Protocol\r | |
89 | onto the VGA device handle.\r | |
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 | |
100 | EFI_STATUS\r | |
101 | EFIAPI\r | |
102 | PciVgaMiniPortDriverBindingStart (\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 | |
108 | /**\r | |
109 | Stop the VGA device with this driver.\r | |
110 | \r | |
111 | This function uninstalls VGA Mini Port Protocol from the VGA device handle,\r | |
112 | and closes PCI I/O Protocol.\r | |
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 | |
124 | EFI_STATUS\r | |
125 | EFIAPI\r | |
126 | PciVgaMiniPortDriverBindingStop (\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 | |
134 | // EFI Component Name Functions\r | |
135 | //\r | |
136 | /**\r | |
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 | |
170 | EFI_STATUS\r | |
171 | EFIAPI\r | |
172 | PciVgaMiniPortComponentNameGetDriverName (\r | |
173 | IN EFI_COMPONENT_NAME_PROTOCOL *This,\r | |
174 | IN CHAR8 *Language,\r | |
175 | OUT CHAR16 **DriverName\r | |
176 | );\r | |
177 | \r | |
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 | |
234 | \r | |
235 | **/\r | |
236 | EFI_STATUS\r | |
237 | EFIAPI\r | |
238 | PciVgaMiniPortComponentNameGetControllerName (\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 | |
245 | \r | |
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 | |
263 | **/\r | |
264 | EFI_STATUS\r | |
265 | EFIAPI\r | |
266 | PciVgaMiniPortSetMode (\r | |
267 | IN EFI_VGA_MINI_PORT_PROTOCOL *This,\r | |
268 | IN UINTN ModeNumber\r | |
269 | );\r | |
270 | \r | |
271 | #endif\r |