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