summaryrefslogtreecommitdiff
path: root/EDK/Foundation/Efi/Protocol/UgaIo/UgaIo.h
blob: 9b74b9aea944ff95a74d386439c74fe7f3d7e4bb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
/*++

Copyright (c) 2004, Intel Corporation                                                         
All rights reserved. This program and the accompanying materials                          
are licensed and made available under the terms and conditions of the BSD License         
which accompanies this distribution.  The full text of the license may be found at        
http://opensource.org/licenses/bsd-license.php                                            
                                                                                          
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             

Module Name:

  UgaIo.h

Abstract:

  UGA IO protocol from the EFI 1.1 specification.

  Abstraction of a very simple graphics device.

--*/

#ifndef __UGA_IO_H__
#define __UGA_IO_H__

#define EFI_UGA_IO_PROTOCOL_GUID \
  { \
    0x61a4d49e, 0x6f68, 0x4f1b, 0xb9, 0x22, 0xa8, 0x6e, 0xed, 0xb, 0x7, 0xa2 \
  }

typedef struct _EFI_UGA_IO_PROTOCOL EFI_UGA_IO_PROTOCOL;

typedef UINT32                      UGA_STATUS;

typedef enum {
  UgaDtParentBus          = 1,
  UgaDtGraphicsController,
  UgaDtOutputController,
  UgaDtOutputPort,
  UgaDtOther
}
UGA_DEVICE_TYPE, *PUGA_DEVICE_TYPE;

typedef UINT32 UGA_DEVICE_ID, *PUGA_DEVICE_ID;

typedef struct {
  UGA_DEVICE_TYPE deviceType;
  UGA_DEVICE_ID   deviceId;
  UINT32          ui32DeviceContextSize;
  UINT32          ui32SharedContextSize;
}
UGA_DEVICE_DATA, *PUGA_DEVICE_DATA;

typedef struct _UGA_DEVICE {
  VOID                *pvDeviceContext;
  VOID                *pvSharedContext;
  VOID                *pvRunTimeContext;
  struct _UGA_DEVICE  *pParentDevice;
  VOID                *pvBusIoServices;
  VOID                *pvStdIoServices;
  UGA_DEVICE_DATA     deviceData;
}
UGA_DEVICE, *PUGA_DEVICE;

#ifndef UGA_IO_REQUEST_CODE
//
// Prevent conflicts with UGA typedefs.
//
typedef enum {
  UgaIoGetVersion             = 1,
  UgaIoGetChildDevice,
  UgaIoStartDevice,
  UgaIoStopDevice,
  UgaIoFlushDevice,
  UgaIoResetDevice,
  UgaIoGetDeviceState,
  UgaIoSetDeviceState,
  UgaIoSetPowerState,
  UgaIoGetMemoryConfiguration,
  UgaIoSetVideoMode,
  UgaIoCopyRectangle,
  UgaIoGetEdidSegment,
  UgaIoDeviceChannelOpen,
  UgaIoDeviceChannelClose,
  UgaIoDeviceChannelRead,
  UgaIoDeviceChannelWrite,
  UgaIoGetPersistentDataSize,
  UgaIoGetPersistentData,
  UgaIoSetPersistentData,
  UgaIoGetDevicePropertySize,
  UgaIoGetDeviceProperty,
  UgaIoBtPrivateInterface
}
UGA_IO_REQUEST_CODE, *PUGA_IO_REQUEST_CODE;

#endif

typedef struct {
  IN UGA_IO_REQUEST_CODE  ioRequestCode;
  IN VOID                 *pvInBuffer;
  IN UINT64               ui64InBufferSize;
  OUT VOID                *pvOutBuffer;
  IN UINT64               ui64OutBufferSize;
  OUT UINT64              ui64BytesReturned;
}
UGA_IO_REQUEST, *PUGA_IO_REQUEST;

typedef
EFI_STATUS
(EFIAPI *EFI_UGA_IO_PROTOCOL_CREATE_DEVICE) (
  IN  EFI_UGA_IO_PROTOCOL  * This,
  IN  UGA_DEVICE           * ParentDevice,
  IN  UGA_DEVICE_DATA      * DeviceData,
  IN  VOID                 *RunTimeContext,
  OUT UGA_DEVICE           **Device
  );

/*++

  Routine Description:

    Dynamically allocate storage for a child UGA_DEVICE .

  Arguments:

    This           - The EFI_UGA_IO_PROTOCOL instance. Type EFI_UGA_IO_PROTOCOL is 
                     defined in Section 10.7.

    ParentDevice   - ParentDevice specifies a pointer to the parent device of Device.

    DeviceData     - A pointer to UGA_DEVICE_DATA returned from a call to DispatchService()
                     with a UGA_DEVICE of Parent and an IoRequest of type UgaIoGetChildDevice.

    RuntimeContext - Context to associate with Device.

    Device         - The Device returns a dynamically allocated child UGA_DEVICE object
                     for ParentDevice. The caller is responsible for deleting Device.
      
  Returns:

    EFI_SUCCESS           - Device was returned.

    EFI_INVALID_PARAMETER - One of the arguments was not valid.

    EFI_DEVICE_ERROR      - The device had an error and could not complete the request.

--*/
typedef
EFI_STATUS
(EFIAPI *EFI_UGA_IO_PROTOCOL_DELETE_DEVICE) (
  IN EFI_UGA_IO_PROTOCOL  * This,
  IN UGA_DEVICE           * Device
  );

/*++

  Routine Description:

    Delete a dynamically allocated child UGA_DEVICE object that was allocated via
    CreateDevice() .

  Arguments:

    This   - The EFI_UGA_IO_PROTOCOL instance. Type EFI_UGA_IO_PROTOCOL is defined 
             in Section 10.7.

    Device - The Device points to a UGA_DEVICE object that was dynamically
             allocated via a CreateDevice() call.

  Returns:

    EFI_SUCCESS           - Device was deleted.

    EFI_INVALID_PARAMETER - The Device was not allocated via CreateDevice()

--*/
typedef UGA_STATUS (EFIAPI *PUGA_FW_SERVICE_DISPATCH) (IN PUGA_DEVICE pDevice, IN OUT PUGA_IO_REQUEST pIoRequest);

/*++

  Routine Description:

    This is the main UGA service dispatch routine for all UGA_IO_REQUEST s.

  Arguments:

    pDevice    - pDevice specifies a pointer to a device object associated with a 
                 device enumerated by a pIoRequest->ioRequestCode of type 
                 UgaIoGetChildDevice. The root device for the EFI_UGA_IO_PROTOCOL 
                 is represented by pDevice being set to NULL.

    pIoRequest - pIoRequest points to a caller allocated buffer that contains data
                 defined by pIoRequest->ioRequestCode. See Related Definitions for
                 a definition of UGA_IO_REQUEST_CODE s and their associated data 
                 structures.

  Returns:

  Varies depending on pIoRequest.

--*/
typedef struct _EFI_UGA_IO_PROTOCOL {
  EFI_UGA_IO_PROTOCOL_CREATE_DEVICE CreateDevice;
  EFI_UGA_IO_PROTOCOL_DELETE_DEVICE DeleteDevice;
  PUGA_FW_SERVICE_DISPATCH          DispatchService;
} EFI_UGA_IO_PROTOCOL;

extern EFI_GUID gEfiUgaIoProtocolGuid;

//
// Data structure that is stored in the EFI Configuration Table with the
// EFI_UGA_IO_PROTOCOL_GUID.  The option ROMs listed in this table may have
// EBC UGA drivers.
//
typedef struct {
  UINT32  Version;
  UINT32  HeaderSize;
  UINT32  SizeOfEntries;
  UINT32  NumberOfEntries;
} EFI_DRIVER_OS_HANDOFF_HEADER;

typedef enum {
  EfiUgaDriverFromPciRom,
  EfiUgaDriverFromSystem,
  EfiDriverHandoffMax
} EFI_DRIVER_HANOFF_ENUM;

typedef struct {
  EFI_DRIVER_HANOFF_ENUM    Type;
  EFI_DEVICE_PATH_PROTOCOL  *DevicePath;
  VOID                      *PciRomImage;
  UINT64                    PciRomSize;
} EFI_DRIVER_OS_HANDOFF;

#endif