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