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