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