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