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