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