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 | Dynamically allocate storage for a child UGA_DEVICE.
|
---|
85 |
|
---|
86 | @param[in] This The EFI_UGA_IO_PROTOCOL instance.
|
---|
87 | @param[in] ParentDevice ParentDevice specifies a pointer to the parent device of Device.
|
---|
88 | @param[in] DeviceData A pointer to UGA_DEVICE_DATA returned from a call to DispatchService()
|
---|
89 | with a UGA_DEVICE of Parent and an IoRequest of type UgaIoGetChildDevice.
|
---|
90 | @param[in] RunTimeContext Context to associate with Device.
|
---|
91 | @param[out] Device The Device returns a dynamically allocated child UGA_DEVICE object
|
---|
92 | for ParentDevice. The caller is responsible for deleting Device.
|
---|
93 |
|
---|
94 |
|
---|
95 | @retval EFI_SUCCESS Device was returned.
|
---|
96 | @retval EFI_INVALID_PARAMETER One of the arguments was not valid.
|
---|
97 | @retval EFI_DEVICE_ERROR The device had an error and could not complete the request.
|
---|
98 |
|
---|
99 | **/
|
---|
100 | typedef
|
---|
101 | EFI_STATUS
|
---|
102 | (EFIAPI *EFI_UGA_IO_PROTOCOL_CREATE_DEVICE)(
|
---|
103 | IN EFI_UGA_IO_PROTOCOL *This,
|
---|
104 | IN UGA_DEVICE *ParentDevice,
|
---|
105 | IN UGA_DEVICE_DATA *DeviceData,
|
---|
106 | IN VOID *RunTimeContext,
|
---|
107 | OUT UGA_DEVICE **Device
|
---|
108 | );
|
---|
109 |
|
---|
110 | /**
|
---|
111 | Delete a dynamically allocated child UGA_DEVICE object that was allocated via CreateDevice().
|
---|
112 |
|
---|
113 | @param[in] This The EFI_UGA_IO_PROTOCOL instance. Type EFI_UGA_IO_PROTOCOL is
|
---|
114 | defined in Section 10.7.
|
---|
115 | @param[in] Device The Device points to a UGA_DEVICE object that was dynamically
|
---|
116 | allocated via a CreateDevice() call.
|
---|
117 |
|
---|
118 |
|
---|
119 | @retval EFI_SUCCESS Device was returned.
|
---|
120 | @retval EFI_INVALID_PARAMETER The Device was not allocated via CreateDevice().
|
---|
121 |
|
---|
122 | **/
|
---|
123 | typedef
|
---|
124 | EFI_STATUS
|
---|
125 | (EFIAPI *EFI_UGA_IO_PROTOCOL_DELETE_DEVICE)(
|
---|
126 | IN EFI_UGA_IO_PROTOCOL *This,
|
---|
127 | IN UGA_DEVICE *Device
|
---|
128 | );
|
---|
129 |
|
---|
130 | /**
|
---|
131 | This is the main UGA service dispatch routine for all UGA_IO_REQUEST s.
|
---|
132 |
|
---|
133 | @param pDevice pDevice specifies a pointer to a device object associated with a
|
---|
134 | device enumerated by a pIoRequest->ioRequestCode of type
|
---|
135 | UgaIoGetChildDevice. The root device for the EFI_UGA_IO_PROTOCOL
|
---|
136 | is represented by pDevice being set to NULL.
|
---|
137 |
|
---|
138 | @param pIoRequest
|
---|
139 | pIoRequest points to a caller allocated buffer that contains data
|
---|
140 | defined by pIoRequest->ioRequestCode. See Related Definitions for
|
---|
141 | a definition of UGA_IO_REQUEST_CODE s and their associated data
|
---|
142 | structures.
|
---|
143 |
|
---|
144 | @return UGA_STATUS
|
---|
145 |
|
---|
146 | **/
|
---|
147 | typedef UGA_STATUS
|
---|
148 | (EFIAPI *PUGA_FW_SERVICE_DISPATCH)(
|
---|
149 | IN PUGA_DEVICE pDevice,
|
---|
150 | IN OUT PUGA_IO_REQUEST pIoRequest
|
---|
151 | );
|
---|
152 |
|
---|
153 | ///
|
---|
154 | /// Provides a basic abstraction to send I/O requests to the graphics device and any of its children.
|
---|
155 | ///
|
---|
156 | struct _EFI_UGA_IO_PROTOCOL {
|
---|
157 | EFI_UGA_IO_PROTOCOL_CREATE_DEVICE CreateDevice;
|
---|
158 | EFI_UGA_IO_PROTOCOL_DELETE_DEVICE DeleteDevice;
|
---|
159 | PUGA_FW_SERVICE_DISPATCH DispatchService;
|
---|
160 | };
|
---|
161 |
|
---|
162 | extern EFI_GUID gEfiUgaIoProtocolGuid;
|
---|
163 |
|
---|
164 | //
|
---|
165 | // Data structure that is stored in the EFI Configuration Table with the
|
---|
166 | // EFI_UGA_IO_PROTOCOL_GUID. The option ROMs listed in this table may have
|
---|
167 | // EBC UGA drivers.
|
---|
168 | //
|
---|
169 | typedef struct {
|
---|
170 | UINT32 Version;
|
---|
171 | UINT32 HeaderSize;
|
---|
172 | UINT32 SizeOfEntries;
|
---|
173 | UINT32 NumberOfEntries;
|
---|
174 | } EFI_DRIVER_OS_HANDOFF_HEADER;
|
---|
175 |
|
---|
176 | typedef enum {
|
---|
177 | EfiUgaDriverFromPciRom,
|
---|
178 | EfiUgaDriverFromSystem,
|
---|
179 | EfiDriverHandoffMax
|
---|
180 | } EFI_DRIVER_HANOFF_ENUM;
|
---|
181 |
|
---|
182 | typedef struct {
|
---|
183 | EFI_DRIVER_HANOFF_ENUM Type;
|
---|
184 | EFI_DEVICE_PATH_PROTOCOL *DevicePath;
|
---|
185 | VOID *PciRomImage;
|
---|
186 | UINT64 PciRomSize;
|
---|
187 | } EFI_DRIVER_OS_HANDOFF;
|
---|
188 |
|
---|
189 | #endif
|
---|