878ddf1f |
1 | /*++\r |
2 | \r |
3 | Copyright (c) 2006, Intel Corporation \r |
4 | All rights reserved. This program and the accompanying materials \r |
5 | are licensed and made available under the terms and conditions of the BSD License \r |
6 | which accompanies this distribution. The full text of the license may be found at \r |
7 | http://opensource.org/licenses/bsd-license.php \r |
8 | \r |
9 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r |
10 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r |
11 | \r |
12 | Module Name:\r |
13 | \r |
14 | UgaIo.h\r |
15 | \r |
16 | Abstract:\r |
17 | \r |
18 | UGA IO protocol from the EFI 1.1 specification.\r |
19 | \r |
20 | Abstraction of a very simple graphics device.\r |
21 | \r |
22 | --*/\r |
23 | \r |
24 | #ifndef __UGA_IO_H__\r |
25 | #define __UGA_IO_H__\r |
26 | \r |
27 | #define EFI_UGA_IO_PROTOCOL_GUID \\r |
28 | { \\r |
29 | 0x61a4d49e, 0x6f68, 0x4f1b, { 0xb9, 0x22, 0xa8, 0x6e, 0xed, 0xb, 0x7, 0xa2 } \\r |
30 | }\r |
31 | \r |
32 | typedef struct _EFI_UGA_IO_PROTOCOL EFI_UGA_IO_PROTOCOL;\r |
33 | \r |
34 | typedef UINT32 UGA_STATUS;\r |
35 | \r |
36 | typedef enum {\r |
37 | UgaDtParentBus = 1,\r |
38 | UgaDtGraphicsController,\r |
39 | UgaDtOutputController,\r |
40 | UgaDtOutputPort,\r |
41 | UgaDtOther\r |
42 | }\r |
43 | UGA_DEVICE_TYPE, *PUGA_DEVICE_TYPE;\r |
44 | \r |
45 | typedef UINT32 UGA_DEVICE_ID, *PUGA_DEVICE_ID;\r |
46 | \r |
47 | typedef struct {\r |
48 | UGA_DEVICE_TYPE deviceType;\r |
49 | UGA_DEVICE_ID deviceId;\r |
50 | UINT32 ui32DeviceContextSize;\r |
51 | UINT32 ui32SharedContextSize;\r |
52 | }\r |
53 | UGA_DEVICE_DATA, *PUGA_DEVICE_DATA;\r |
54 | \r |
55 | typedef struct _UGA_DEVICE {\r |
56 | VOID *pvDeviceContext;\r |
57 | VOID *pvSharedContext;\r |
58 | VOID *pvRunTimeContext;\r |
59 | struct _UGA_DEVICE *pParentDevice;\r |
60 | VOID *pvBusIoServices;\r |
61 | VOID *pvStdIoServices;\r |
62 | UGA_DEVICE_DATA deviceData;\r |
63 | }\r |
64 | UGA_DEVICE, *PUGA_DEVICE;\r |
65 | \r |
66 | #ifndef UGA_IO_REQUEST_CODE\r |
67 | //\r |
68 | // Prevent conflicts with UGA typedefs.\r |
69 | //\r |
70 | typedef enum {\r |
71 | UgaIoGetVersion = 1,\r |
72 | UgaIoGetChildDevice,\r |
73 | UgaIoStartDevice,\r |
74 | UgaIoStopDevice,\r |
75 | UgaIoFlushDevice,\r |
76 | UgaIoResetDevice,\r |
77 | UgaIoGetDeviceState,\r |
78 | UgaIoSetDeviceState,\r |
79 | UgaIoSetPowerState,\r |
80 | UgaIoGetMemoryConfiguration,\r |
81 | UgaIoSetVideoMode,\r |
82 | UgaIoCopyRectangle,\r |
83 | UgaIoGetEdidSegment,\r |
84 | UgaIoDeviceChannelOpen,\r |
85 | UgaIoDeviceChannelClose,\r |
86 | UgaIoDeviceChannelRead,\r |
87 | UgaIoDeviceChannelWrite,\r |
88 | UgaIoGetPersistentDataSize,\r |
89 | UgaIoGetPersistentData,\r |
90 | UgaIoSetPersistentData,\r |
91 | UgaIoGetDevicePropertySize,\r |
92 | UgaIoGetDeviceProperty,\r |
93 | UgaIoBtPrivateInterface\r |
94 | }\r |
95 | UGA_IO_REQUEST_CODE, *PUGA_IO_REQUEST_CODE;\r |
96 | \r |
97 | #endif\r |
98 | \r |
99 | typedef struct {\r |
100 | IN UGA_IO_REQUEST_CODE ioRequestCode;\r |
101 | IN VOID *pvInBuffer;\r |
102 | IN UINT64 ui64InBufferSize;\r |
103 | OUT VOID *pvOutBuffer;\r |
104 | IN UINT64 ui64OutBufferSize;\r |
105 | OUT UINT64 ui64BytesReturned;\r |
106 | }\r |
107 | UGA_IO_REQUEST, *PUGA_IO_REQUEST;\r |
108 | \r |
109 | typedef\r |
110 | EFI_STATUS\r |
111 | (EFIAPI *EFI_UGA_IO_PROTOCOL_CREATE_DEVICE) (\r |
112 | IN EFI_UGA_IO_PROTOCOL * This,\r |
113 | IN UGA_DEVICE * ParentDevice,\r |
114 | IN UGA_DEVICE_DATA * DeviceData,\r |
115 | IN VOID *RunTimeContext,\r |
116 | OUT UGA_DEVICE **Device\r |
117 | );\r |
118 | \r |
119 | /*++\r |
120 | \r |
121 | Routine Description:\r |
122 | \r |
123 | Dynamically allocate storage for a child UGA_DEVICE .\r |
124 | \r |
125 | Arguments:\r |
126 | \r |
127 | This - The EFI_UGA_IO_PROTOCOL instance. Type EFI_UGA_IO_PROTOCOL is \r |
128 | defined in Section 10.7.\r |
129 | \r |
130 | ParentDevice - ParentDevice specifies a pointer to the parent device of Device.\r |
131 | \r |
132 | DeviceData - A pointer to UGA_DEVICE_DATA returned from a call to DispatchService()\r |
133 | with a UGA_DEVICE of Parent and an IoRequest of type UgaIoGetChildDevice.\r |
134 | \r |
135 | RuntimeContext - Context to associate with Device.\r |
136 | \r |
137 | Device - The Device returns a dynamically allocated child UGA_DEVICE object\r |
138 | for ParentDevice. The caller is responsible for deleting Device.\r |
139 | \r |
140 | Returns:\r |
141 | \r |
142 | EFI_SUCCESS - Device was returned.\r |
143 | \r |
144 | EFI_INVALID_PARAMETER - One of the arguments was not valid.\r |
145 | \r |
146 | EFI_DEVICE_ERROR - The device had an error and could not complete the request.\r |
147 | \r |
148 | --*/\r |
149 | typedef\r |
150 | EFI_STATUS\r |
151 | (EFIAPI *EFI_UGA_IO_PROTOCOL_DELETE_DEVICE) (\r |
152 | IN EFI_UGA_IO_PROTOCOL * This,\r |
153 | IN UGA_DEVICE * Device\r |
154 | );\r |
155 | \r |
156 | /*++\r |
157 | \r |
158 | Routine Description:\r |
159 | \r |
160 | Delete a dynamically allocated child UGA_DEVICE object that was allocated via\r |
161 | CreateDevice() .\r |
162 | \r |
163 | Arguments:\r |
164 | \r |
165 | This - The EFI_UGA_IO_PROTOCOL instance. Type EFI_UGA_IO_PROTOCOL is defined \r |
166 | in Section 10.7.\r |
167 | \r |
168 | Device - The Device points to a UGA_DEVICE object that was dynamically\r |
169 | allocated via a CreateDevice() call.\r |
170 | \r |
171 | Returns:\r |
172 | \r |
173 | EFI_SUCCESS - Device was deleted.\r |
174 | \r |
175 | EFI_INVALID_PARAMETER - The Device was not allocated via CreateDevice()\r |
176 | \r |
177 | --*/\r |
178 | typedef UGA_STATUS (EFIAPI *PUGA_FW_SERVICE_DISPATCH) (IN PUGA_DEVICE pDevice, IN OUT PUGA_IO_REQUEST pIoRequest);\r |
179 | \r |
180 | /*++\r |
181 | \r |
182 | Routine Description:\r |
183 | \r |
184 | This is the main UGA service dispatch routine for all UGA_IO_REQUEST s.\r |
185 | \r |
186 | Arguments:\r |
187 | \r |
188 | pDevice - pDevice specifies a pointer to a device object associated with a \r |
189 | device enumerated by a pIoRequest->ioRequestCode of type \r |
190 | UgaIoGetChildDevice. The root device for the EFI_UGA_IO_PROTOCOL \r |
191 | is represented by pDevice being set to NULL.\r |
192 | \r |
193 | pIoRequest - pIoRequest points to a caller allocated buffer that contains data\r |
194 | defined by pIoRequest->ioRequestCode. See Related Definitions for\r |
195 | a definition of UGA_IO_REQUEST_CODE s and their associated data \r |
196 | structures.\r |
197 | \r |
198 | Returns:\r |
199 | \r |
200 | Varies depending on pIoRequest.\r |
201 | \r |
202 | --*/\r |
203 | struct _EFI_UGA_IO_PROTOCOL {\r |
204 | EFI_UGA_IO_PROTOCOL_CREATE_DEVICE CreateDevice;\r |
205 | EFI_UGA_IO_PROTOCOL_DELETE_DEVICE DeleteDevice;\r |
206 | PUGA_FW_SERVICE_DISPATCH DispatchService;\r |
207 | };\r |
208 | \r |
209 | extern EFI_GUID gEfiUgaIoProtocolGuid;\r |
210 | \r |
211 | //\r |
212 | // Data structure that is stored in the EFI Configuration Table with the\r |
213 | // EFI_UGA_IO_PROTOCOL_GUID. The option ROMs listed in this table may have\r |
214 | // EBC UGA drivers.\r |
215 | //\r |
216 | typedef struct {\r |
217 | UINT32 Version;\r |
218 | UINT32 HeaderSize;\r |
219 | UINT32 SizeOfEntries;\r |
220 | UINT32 NumberOfEntries;\r |
221 | } EFI_DRIVER_OS_HANDOFF_HEADER;\r |
222 | \r |
223 | typedef enum {\r |
224 | EfiUgaDriverFromPciRom,\r |
225 | EfiUgaDriverFromSystem,\r |
226 | EfiDriverHandoffMax\r |
227 | } EFI_DRIVER_HANOFF_ENUM;\r |
228 | \r |
229 | typedef struct {\r |
230 | EFI_DRIVER_HANOFF_ENUM Type;\r |
231 | EFI_DEVICE_PATH_PROTOCOL *DevicePath;\r |
232 | VOID *PciRomImage;\r |
233 | UINT64 PciRomSize;\r |
234 | } EFI_DRIVER_OS_HANDOFF;\r |
235 | \r |
236 | #endif\r |