1 /*++ 2 3 Copyright (c) 2004, Intel Corporation. All rights reserved.<BR> 4 This program and the accompanying materials 5 are licensed and made available under the terms and conditions of the BSD License 6 which accompanies this distribution. The full text of the license may be found at 7 http://opensource.org/licenses/bsd-license.php 8 9 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 10 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 11 12 Module Name: 13 14 UgaIo.h 15 16 Abstract: 17 18 UGA IO protocol from the EFI 1.1 specification. 19 20 Abstraction of a very simple graphics device. 21 22 --*/ 23 24 #ifndef __UGA_IO_H__ 25 #define __UGA_IO_H__ 26 27 #define EFI_UGA_IO_PROTOCOL_GUID \ 28 { \ 29 0x61a4d49e, 0x6f68, 0x4f1b, {0xb9, 0x22, 0xa8, 0x6e, 0xed, 0xb, 0x7, 0xa2} \ 30 } 31 32 typedef struct _EFI_UGA_IO_PROTOCOL EFI_UGA_IO_PROTOCOL; 33 34 typedef UINT32 UGA_STATUS; 35 36 typedef enum { 37 UgaDtParentBus = 1, 38 UgaDtGraphicsController, 39 UgaDtOutputController, 40 UgaDtOutputPort, 41 UgaDtOther 42 } 43 UGA_DEVICE_TYPE, *PUGA_DEVICE_TYPE; 44 45 typedef UINT32 UGA_DEVICE_ID, *PUGA_DEVICE_ID; 46 47 typedef struct { 48 UGA_DEVICE_TYPE deviceType; 49 UGA_DEVICE_ID deviceId; 50 UINT32 ui32DeviceContextSize; 51 UINT32 ui32SharedContextSize; 52 } 53 UGA_DEVICE_DATA, *PUGA_DEVICE_DATA; 54 55 typedef struct _UGA_DEVICE { 56 VOID *pvDeviceContext; 57 VOID *pvSharedContext; 58 VOID *pvRunTimeContext; 59 struct _UGA_DEVICE *pParentDevice; 60 VOID *pvBusIoServices; 61 VOID *pvStdIoServices; 62 UGA_DEVICE_DATA deviceData; 63 } 64 UGA_DEVICE, *PUGA_DEVICE; 65 66 #ifndef UGA_IO_REQUEST_CODE 67 // 68 // Prevent conflicts with UGA typedefs. 69 // 70 typedef enum { 71 UgaIoGetVersion = 1, 72 UgaIoGetChildDevice, 73 UgaIoStartDevice, 74 UgaIoStopDevice, 75 UgaIoFlushDevice, 76 UgaIoResetDevice, 77 UgaIoGetDeviceState, 78 UgaIoSetDeviceState, 79 UgaIoSetPowerState, 80 UgaIoGetMemoryConfiguration, 81 UgaIoSetVideoMode, 82 UgaIoCopyRectangle, 83 UgaIoGetEdidSegment, 84 UgaIoDeviceChannelOpen, 85 UgaIoDeviceChannelClose, 86 UgaIoDeviceChannelRead, 87 UgaIoDeviceChannelWrite, 88 UgaIoGetPersistentDataSize, 89 UgaIoGetPersistentData, 90 UgaIoSetPersistentData, 91 UgaIoGetDevicePropertySize, 92 UgaIoGetDeviceProperty, 93 UgaIoBtPrivateInterface 94 } 95 UGA_IO_REQUEST_CODE, *PUGA_IO_REQUEST_CODE; 96 97 #endif 98 99 typedef struct { 100 IN UGA_IO_REQUEST_CODE ioRequestCode; 101 IN VOID *pvInBuffer; 102 IN UINT64 ui64InBufferSize; 103 OUT VOID *pvOutBuffer; 104 IN UINT64 ui64OutBufferSize; 105 OUT UINT64 ui64BytesReturned; 106 } 107 UGA_IO_REQUEST, *PUGA_IO_REQUEST; 108 109 typedef 110 EFI_STATUS 111 (EFIAPI *EFI_UGA_IO_PROTOCOL_CREATE_DEVICE) ( 112 IN EFI_UGA_IO_PROTOCOL * This, 113 IN UGA_DEVICE * ParentDevice, 114 IN UGA_DEVICE_DATA * DeviceData, 115 IN VOID *RunTimeContext, 116 OUT UGA_DEVICE **Device 117 ); 118 119 /*++ 120 121 Routine Description: 122 123 Dynamically allocate storage for a child UGA_DEVICE . 124 125 Arguments: 126 127 This - The EFI_UGA_IO_PROTOCOL instance. Type EFI_UGA_IO_PROTOCOL is 128 defined in Section 10.7. 129 130 ParentDevice - ParentDevice specifies a pointer to the parent device of Device. 131 132 DeviceData - A pointer to UGA_DEVICE_DATA returned from a call to DispatchService() 133 with a UGA_DEVICE of Parent and an IoRequest of type UgaIoGetChildDevice. 134 135 RuntimeContext - Context to associate with Device. 136 137 Device - The Device returns a dynamically allocated child UGA_DEVICE object 138 for ParentDevice. The caller is responsible for deleting Device. 139 140 Returns: 141 142 EFI_SUCCESS - Device was returned. 143 144 EFI_INVALID_PARAMETER - One of the arguments was not valid. 145 146 EFI_DEVICE_ERROR - The device had an error and could not complete the request. 147 148 --*/ 149 typedef 150 EFI_STATUS 151 (EFIAPI *EFI_UGA_IO_PROTOCOL_DELETE_DEVICE) ( 152 IN EFI_UGA_IO_PROTOCOL * This, 153 IN UGA_DEVICE * Device 154 ); 155 156 /*++ 157 158 Routine Description: 159 160 Delete a dynamically allocated child UGA_DEVICE object that was allocated via 161 CreateDevice() . 162 163 Arguments: 164 165 This - The EFI_UGA_IO_PROTOCOL instance. Type EFI_UGA_IO_PROTOCOL is defined 166 in Section 10.7. 167 168 Device - The Device points to a UGA_DEVICE object that was dynamically 169 allocated via a CreateDevice() call. 170 171 Returns: 172 173 EFI_SUCCESS - Device was deleted. 174 175 EFI_INVALID_PARAMETER - The Device was not allocated via CreateDevice() 176 177 --*/ 178 typedef UGA_STATUS (EFIAPI *PUGA_FW_SERVICE_DISPATCH) (IN PUGA_DEVICE pDevice, IN OUT PUGA_IO_REQUEST pIoRequest); 179 180 /*++ 181 182 Routine Description: 183 184 This is the main UGA service dispatch routine for all UGA_IO_REQUEST s. 185 186 Arguments: 187 188 pDevice - pDevice specifies a pointer to a device object associated with a 189 device enumerated by a pIoRequest->ioRequestCode of type 190 UgaIoGetChildDevice. The root device for the EFI_UGA_IO_PROTOCOL 191 is represented by pDevice being set to NULL. 192 193 pIoRequest - pIoRequest points to a caller allocated buffer that contains data 194 defined by pIoRequest->ioRequestCode. See Related Definitions for 195 a definition of UGA_IO_REQUEST_CODE s and their associated data 196 structures. 197 198 Returns: 199 200 Varies depending on pIoRequest. 201 202 --*/ 203 struct _EFI_UGA_IO_PROTOCOL { 204 EFI_UGA_IO_PROTOCOL_CREATE_DEVICE CreateDevice; 205 EFI_UGA_IO_PROTOCOL_DELETE_DEVICE DeleteDevice; 206 PUGA_FW_SERVICE_DISPATCH DispatchService; 207 }; 208 209 extern EFI_GUID gEfiUgaIoProtocolGuid; 210 211 // 212 // Data structure that is stored in the EFI Configuration Table with the 213 // EFI_UGA_IO_PROTOCOL_GUID. The option ROMs listed in this table may have 214 // EBC UGA drivers. 215 // 216 typedef struct { 217 UINT32 Version; 218 UINT32 HeaderSize; 219 UINT32 SizeOfEntries; 220 UINT32 NumberOfEntries; 221 } EFI_DRIVER_OS_HANDOFF_HEADER; 222 223 typedef enum { 224 EfiUgaDriverFromPciRom, 225 EfiUgaDriverFromSystem, 226 EfiDriverHandoffMax 227 } EFI_DRIVER_HANOFF_ENUM; 228 229 typedef struct { 230 EFI_DRIVER_HANOFF_ENUM Type; 231 EFI_DEVICE_PATH_PROTOCOL *DevicePath; 232 VOID *PciRomImage; 233 UINT64 PciRomSize; 234 } EFI_DRIVER_OS_HANDOFF; 235 236 #endif 237