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