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