]> git.proxmox.com Git - mirror_edk2.git/blob - IntelFrameworkModulePkg/Bus/Pci/IdeBusDxe/idebus.h
Add missing packages dependency.
[mirror_edk2.git] / IntelFrameworkModulePkg / Bus / Pci / IdeBusDxe / idebus.h
1 /** @file
2 Header file for IDE Bus Driver.
3
4 Copyright (c) 2006 - 2007 Intel Corporation. <BR>
5 All rights reserved. This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
9
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
12
13 **/
14
15 #ifndef _IDE_BUS_H
16 #define _IDE_BUS_H
17
18
19
20 #include <FrameworkDxe.h>
21
22 #include <Protocol/IdeControllerInit.h>
23 #include <Protocol/BlockIo.h>
24 #include <Protocol/PciIo.h>
25 #include <Protocol/DiskInfo.h>
26 #include <Protocol/DevicePath.h>
27
28 #include <Library/DebugLib.h>
29 #include <Library/UefiDriverEntryPoint.h>
30 #include <Library/BaseLib.h>
31 #include <Library/UefiLib.h>
32 #include <Library/BaseMemoryLib.h>
33 #include <Library/ReportStatusCodeLib.h>
34 #include <Library/MemoryAllocationLib.h>
35 #include <Library/PerformanceLib.h>
36 #include <Library/UefiBootServicesTableLib.h>
37 #include <Library/UefiRuntimeServicesTableLib.h>
38 #include <Library/DevicePathLib.h>
39
40 #include <IndustryStandard/pci22.h>
41 #include "idedata.h"
42
43 //
44 // Extra Definition to porting
45 //
46 #define MAX_IDE_DEVICE 4
47 #define MAX_IDE_CHANNELS 2
48 #define MAX_IDE_DRIVES 2
49
50 #define INVALID_DEVICE_TYPE 0xff
51 #define ATA_DEVICE_TYPE 0x00
52 #define ATAPI_DEVICE_TYPE 0x01
53
54 #define EFI_IOB_ATA_BUS_SMART_ENABLE (EFI_SUBCLASS_SPECIFIC | 0x00000000)
55 #define EFI_IOB_ATA_BUS_SMART_DISABLE (EFI_SUBCLASS_SPECIFIC | 0x00000001)
56 #define EFI_IOB_ATA_BUS_SMART_OVERTHRESHOLD (EFI_SUBCLASS_SPECIFIC | 0x00000002)
57 #define EFI_IOB_ATA_BUS_SMART_UNDERTHRESHOLD (EFI_SUBCLASS_SPECIFIC | 0x00000003)
58
59 typedef struct {
60 BOOLEAN HaveScannedDevice[MAX_IDE_DEVICE];
61 BOOLEAN DeviceFound[MAX_IDE_DEVICE];
62 BOOLEAN DeviceProcessed[MAX_IDE_DEVICE];
63 } IDE_BUS_DRIVER_PRIVATE_DATA;
64
65 #define IDE_BLK_IO_DEV_SIGNATURE EFI_SIGNATURE_32 ('i', 'b', 'i', 'd')
66
67 typedef struct {
68 UINT32 Signature;
69
70 EFI_HANDLE Handle;
71 EFI_BLOCK_IO_PROTOCOL BlkIo;
72 EFI_BLOCK_IO_MEDIA BlkMedia;
73 EFI_DISK_INFO_PROTOCOL DiskInfo;
74 EFI_DEVICE_PATH_PROTOCOL *DevicePath;
75 EFI_PCI_IO_PROTOCOL *PciIo;
76 IDE_BUS_DRIVER_PRIVATE_DATA *IdeBusDriverPrivateData;
77
78 //
79 // Local Data for IDE interface goes here
80 //
81 EFI_IDE_CHANNEL Channel;
82 EFI_IDE_DEVICE Device;
83 UINT16 Lun;
84 IDE_DEVICE_TYPE Type;
85
86 IDE_BASE_REGISTERS *IoPort;
87 UINT16 AtapiError;
88
89 ATAPI_INQUIRY_DATA *pInquiryData;
90 EFI_IDENTIFY_DATA *pIdData;
91 ATA_PIO_MODE PioMode;
92 EFI_ATA_MODE UdmaMode;
93 CHAR8 ModelName[41];
94 ATAPI_REQUEST_SENSE_DATA *SenseData;
95 UINT8 SenseDataNumber;
96 UINT8 *Cache;
97
98 //
99 // ExitBootService Event, it is used to clear pending IDE interrupt
100 //
101 EFI_EVENT ExitBootServiceEvent;
102
103 EFI_UNICODE_STRING_TABLE *ControllerNameTable;
104 } IDE_BLK_IO_DEV;
105
106 #include "ComponentName.h"
107
108 #define IDE_BLOCK_IO_DEV_FROM_THIS(a) CR (a, IDE_BLK_IO_DEV, BlkIo, IDE_BLK_IO_DEV_SIGNATURE)
109 #define IDE_BLOCK_IO_DEV_FROM_DISK_INFO_THIS(a) CR (a, IDE_BLK_IO_DEV, DiskInfo, IDE_BLK_IO_DEV_SIGNATURE)
110
111 //
112 // Global Variables
113 //
114 extern EFI_DRIVER_BINDING_PROTOCOL gIDEBusDriverBinding;
115
116 #include "ide.h"
117
118 //
119 // Prototypes
120 // Driver model protocol interface
121 //
122 /**
123 TODO: Add function description
124
125 @param ImageHandle TODO: add argument description
126 @param SystemTable TODO: add argument description
127
128 TODO: add return values
129
130 **/
131 EFI_STATUS
132 EFIAPI
133 IDEBusControllerDriverEntryPoint (
134 IN EFI_HANDLE ImageHandle,
135 IN EFI_SYSTEM_TABLE *SystemTable
136 )
137 ;
138
139 /**
140 TODO: Add function description
141
142 @param This TODO: add argument description
143 @param Controller TODO: add argument description
144 @param RemainingDevicePath TODO: add argument description
145
146 TODO: add return values
147
148 **/
149 EFI_STATUS
150 EFIAPI
151 IDEBusDriverBindingSupported (
152 IN EFI_DRIVER_BINDING_PROTOCOL *This,
153 IN EFI_HANDLE Controller,
154 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
155 )
156 ;
157
158 /**
159 TODO: Add function description
160
161 @param This TODO: add argument description
162 @param Controller TODO: add argument description
163 @param RemainingDevicePath TODO: add argument description
164
165 TODO: add return values
166
167 **/
168 EFI_STATUS
169 EFIAPI
170 IDEBusDriverBindingStart (
171 IN EFI_DRIVER_BINDING_PROTOCOL *This,
172 IN EFI_HANDLE Controller,
173 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
174 )
175 ;
176
177 /**
178 TODO: Add function description
179
180 @param This TODO: add argument description
181 @param Controller TODO: add argument description
182 @param NumberOfChildren TODO: add argument description
183 @param ChildHandleBuffer TODO: add argument description
184
185 TODO: add return values
186
187 **/
188 EFI_STATUS
189 EFIAPI
190 IDEBusDriverBindingStop (
191 IN EFI_DRIVER_BINDING_PROTOCOL *This,
192 IN EFI_HANDLE Controller,
193 IN UINTN NumberOfChildren,
194 IN EFI_HANDLE *ChildHandleBuffer
195 )
196 ;
197
198 //
199 // EFI Driver Configuration Functions
200 //
201 EFI_STATUS
202 IDEBusDriverConfigurationSetOptions (
203 IN EFI_DRIVER_CONFIGURATION_PROTOCOL *This,
204 IN EFI_HANDLE ControllerHandle,
205 IN EFI_HANDLE ChildHandle OPTIONAL,
206 IN CHAR8 *Language,
207 OUT EFI_DRIVER_CONFIGURATION_ACTION_REQUIRED *ActionRequired
208 );
209
210 EFI_STATUS
211 IDEBusDriverConfigurationOptionsValid (
212 IN EFI_DRIVER_CONFIGURATION_PROTOCOL *This,
213 IN EFI_HANDLE ControllerHandle,
214 IN EFI_HANDLE ChildHandle OPTIONAL
215 );
216
217 EFI_STATUS
218 IDEBusDriverConfigurationForceDefaults (
219 IN EFI_DRIVER_CONFIGURATION_PROTOCOL *This,
220 IN EFI_HANDLE ControllerHandle,
221 IN EFI_HANDLE ChildHandle OPTIONAL,
222 IN UINT32 DefaultType,
223 OUT EFI_DRIVER_CONFIGURATION_ACTION_REQUIRED *ActionRequired
224 );
225
226 //
227 // EFI Driver Diagnostics Functions
228 //
229 EFI_STATUS
230 IDEBusDriverDiagnosticsRunDiagnostics (
231 IN EFI_DRIVER_DIAGNOSTICS_PROTOCOL *This,
232 IN EFI_HANDLE ControllerHandle,
233 IN EFI_HANDLE ChildHandle OPTIONAL,
234 IN EFI_DRIVER_DIAGNOSTIC_TYPE DiagnosticType,
235 IN CHAR8 *Language,
236 OUT EFI_GUID **ErrorType,
237 OUT UINTN *BufferSize,
238 OUT CHAR16 **Buffer
239 );
240
241 //
242 // Block I/O Protocol Interface
243 //
244 /**
245 TODO: Add function description
246
247 @param This TODO: add argument description
248 @param ExtendedVerification TODO: add argument description
249
250 TODO: add return values
251
252 **/
253 EFI_STATUS
254 EFIAPI
255 IDEBlkIoReset (
256 IN EFI_BLOCK_IO_PROTOCOL *This,
257 IN BOOLEAN ExtendedVerification
258 )
259 ;
260
261 /**
262 TODO: Add function description
263
264 @param This TODO: add argument description
265 @param MediaId TODO: add argument description
266 @param LBA TODO: add argument description
267 @param BufferSize TODO: add argument description
268 @param Buffer TODO: add argument description
269
270 TODO: add return values
271
272 **/
273 EFI_STATUS
274 EFIAPI
275 IDEBlkIoReadBlocks (
276 IN EFI_BLOCK_IO_PROTOCOL *This,
277 IN UINT32 MediaId,
278 IN EFI_LBA LBA,
279 IN UINTN BufferSize,
280 OUT VOID *Buffer
281 )
282 ;
283
284 /**
285 TODO: Add function description
286
287 @param This TODO: add argument description
288 @param MediaId TODO: add argument description
289 @param LBA TODO: add argument description
290 @param BufferSize TODO: add argument description
291 @param Buffer TODO: add argument description
292
293 TODO: add return values
294
295 **/
296 EFI_STATUS
297 EFIAPI
298 IDEBlkIoWriteBlocks (
299 IN EFI_BLOCK_IO_PROTOCOL *This,
300 IN UINT32 MediaId,
301 IN EFI_LBA LBA,
302 IN UINTN BufferSize,
303 IN VOID *Buffer
304 )
305 ;
306
307 /**
308 TODO: Add function description
309
310 @param This TODO: add argument description
311
312 TODO: add return values
313
314 **/
315 EFI_STATUS
316 EFIAPI
317 IDEBlkIoFlushBlocks (
318 IN EFI_BLOCK_IO_PROTOCOL *This
319 )
320 ;
321
322 /**
323 TODO: Add function description
324
325 @param PciIo TODO: add argument description
326 @param Enable TODO: add argument description
327
328 TODO: add return values
329
330 **/
331 EFI_STATUS
332 IDERegisterDecodeEnableorDisable (
333 IN EFI_PCI_IO_PROTOCOL *PciIo,
334 IN BOOLEAN Enable
335 )
336 ;
337
338 /**
339 TODO: Add function description
340
341 @param This TODO: add argument description
342 @param InquiryData TODO: add argument description
343 @param IntquiryDataSize TODO: add argument description
344
345 TODO: add return values
346
347 **/
348 EFI_STATUS
349 EFIAPI
350 IDEDiskInfoInquiry (
351 IN EFI_DISK_INFO_PROTOCOL *This,
352 IN OUT VOID *InquiryData,
353 IN OUT UINT32 *IntquiryDataSize
354 )
355 ;
356
357 /**
358 TODO: Add function description
359
360 @param This TODO: add argument description
361 @param IdentifyData TODO: add argument description
362 @param IdentifyDataSize TODO: add argument description
363
364 TODO: add return values
365
366 **/
367 EFI_STATUS
368 EFIAPI
369 IDEDiskInfoIdentify (
370 IN EFI_DISK_INFO_PROTOCOL *This,
371 IN OUT VOID *IdentifyData,
372 IN OUT UINT32 *IdentifyDataSize
373 )
374 ;
375
376 /**
377 TODO: Add function description
378
379 @param This TODO: add argument description
380 @param SenseData TODO: add argument description
381 @param SenseDataSize TODO: add argument description
382 @param SenseDataNumber TODO: add argument description
383
384 TODO: add return values
385
386 **/
387 EFI_STATUS
388 EFIAPI
389 IDEDiskInfoSenseData (
390 IN EFI_DISK_INFO_PROTOCOL *This,
391 IN OUT VOID *SenseData,
392 IN OUT UINT32 *SenseDataSize,
393 OUT UINT8 *SenseDataNumber
394 )
395 ;
396
397 /**
398 TODO: Add function description
399
400 @param This TODO: add argument description
401 @param IdeChannel TODO: add argument description
402 @param IdeDevice TODO: add argument description
403
404 TODO: add return values
405
406 **/
407 EFI_STATUS
408 EFIAPI
409 IDEDiskInfoWhichIde (
410 IN EFI_DISK_INFO_PROTOCOL *This,
411 OUT UINT32 *IdeChannel,
412 OUT UINT32 *IdeDevice
413 )
414 ;
415
416 #endif