]> git.proxmox.com Git - mirror_edk2.git/blob - IntelFrameworkModulePkg/Bus/Pci/IdeBusDxe/IdeBus.h
eece09ad0255f9e0a97524cd961fa5104a306c5c
[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 extern EFI_DRIVER_DIAGNOSTICS_PROTOCOL gIDEBusDriverDiagnostics;
116 extern EFI_DRIVER_DIAGNOSTICS2_PROTOCOL gIDEBusDriverDiagnostics2;
117
118 #include "Ide.h"
119
120 //
121 // Prototypes
122 // Driver model protocol interface
123 //
124 /**
125 TODO: Add function description
126
127 @param ImageHandle TODO: add argument description
128 @param SystemTable TODO: add argument description
129
130 TODO: add return values
131
132 **/
133 EFI_STATUS
134 EFIAPI
135 IDEBusControllerDriverEntryPoint (
136 IN EFI_HANDLE ImageHandle,
137 IN EFI_SYSTEM_TABLE *SystemTable
138 )
139 ;
140
141 /**
142 TODO: Add function description
143
144 @param This TODO: add argument description
145 @param Controller TODO: add argument description
146 @param RemainingDevicePath TODO: add argument description
147
148 TODO: add return values
149
150 **/
151 EFI_STATUS
152 EFIAPI
153 IDEBusDriverBindingSupported (
154 IN EFI_DRIVER_BINDING_PROTOCOL *This,
155 IN EFI_HANDLE Controller,
156 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
157 )
158 ;
159
160 /**
161 TODO: Add function description
162
163 @param This TODO: add argument description
164 @param Controller TODO: add argument description
165 @param RemainingDevicePath TODO: add argument description
166
167 TODO: add return values
168
169 **/
170 EFI_STATUS
171 EFIAPI
172 IDEBusDriverBindingStart (
173 IN EFI_DRIVER_BINDING_PROTOCOL *This,
174 IN EFI_HANDLE Controller,
175 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
176 )
177 ;
178
179 /**
180 TODO: Add function description
181
182 @param This TODO: add argument description
183 @param Controller TODO: add argument description
184 @param NumberOfChildren TODO: add argument description
185 @param ChildHandleBuffer TODO: add argument description
186
187 TODO: add return values
188
189 **/
190 EFI_STATUS
191 EFIAPI
192 IDEBusDriverBindingStop (
193 IN EFI_DRIVER_BINDING_PROTOCOL *This,
194 IN EFI_HANDLE Controller,
195 IN UINTN NumberOfChildren,
196 IN EFI_HANDLE *ChildHandleBuffer
197 )
198 ;
199
200 //
201 // EFI Driver Configuration Functions
202 //
203 EFI_STATUS
204 IDEBusDriverConfigurationSetOptions (
205 IN EFI_DRIVER_CONFIGURATION_PROTOCOL *This,
206 IN EFI_HANDLE ControllerHandle,
207 IN EFI_HANDLE ChildHandle OPTIONAL,
208 IN CHAR8 *Language,
209 OUT EFI_DRIVER_CONFIGURATION_ACTION_REQUIRED *ActionRequired
210 );
211
212 EFI_STATUS
213 IDEBusDriverConfigurationOptionsValid (
214 IN EFI_DRIVER_CONFIGURATION_PROTOCOL *This,
215 IN EFI_HANDLE ControllerHandle,
216 IN EFI_HANDLE ChildHandle OPTIONAL
217 );
218
219 EFI_STATUS
220 IDEBusDriverConfigurationForceDefaults (
221 IN EFI_DRIVER_CONFIGURATION_PROTOCOL *This,
222 IN EFI_HANDLE ControllerHandle,
223 IN EFI_HANDLE ChildHandle OPTIONAL,
224 IN UINT32 DefaultType,
225 OUT EFI_DRIVER_CONFIGURATION_ACTION_REQUIRED *ActionRequired
226 );
227
228 //
229 // EFI Driver Diagnostics Functions
230 //
231 EFI_STATUS
232 IDEBusDriverDiagnosticsRunDiagnostics (
233 IN EFI_DRIVER_DIAGNOSTICS_PROTOCOL *This,
234 IN EFI_HANDLE ControllerHandle,
235 IN EFI_HANDLE ChildHandle OPTIONAL,
236 IN EFI_DRIVER_DIAGNOSTIC_TYPE DiagnosticType,
237 IN CHAR8 *Language,
238 OUT EFI_GUID **ErrorType,
239 OUT UINTN *BufferSize,
240 OUT CHAR16 **Buffer
241 );
242
243 //
244 // Block I/O Protocol Interface
245 //
246 /**
247 TODO: Add function description
248
249 @param This TODO: add argument description
250 @param ExtendedVerification TODO: add argument description
251
252 TODO: add return values
253
254 **/
255 EFI_STATUS
256 EFIAPI
257 IDEBlkIoReset (
258 IN EFI_BLOCK_IO_PROTOCOL *This,
259 IN BOOLEAN ExtendedVerification
260 )
261 ;
262
263 /**
264 TODO: Add function description
265
266 @param This TODO: add argument description
267 @param MediaId TODO: add argument description
268 @param LBA TODO: add argument description
269 @param BufferSize TODO: add argument description
270 @param Buffer TODO: add argument description
271
272 TODO: add return values
273
274 **/
275 EFI_STATUS
276 EFIAPI
277 IDEBlkIoReadBlocks (
278 IN EFI_BLOCK_IO_PROTOCOL *This,
279 IN UINT32 MediaId,
280 IN EFI_LBA LBA,
281 IN UINTN BufferSize,
282 OUT VOID *Buffer
283 )
284 ;
285
286 /**
287 TODO: Add function description
288
289 @param This TODO: add argument description
290 @param MediaId TODO: add argument description
291 @param LBA TODO: add argument description
292 @param BufferSize TODO: add argument description
293 @param Buffer TODO: add argument description
294
295 TODO: add return values
296
297 **/
298 EFI_STATUS
299 EFIAPI
300 IDEBlkIoWriteBlocks (
301 IN EFI_BLOCK_IO_PROTOCOL *This,
302 IN UINT32 MediaId,
303 IN EFI_LBA LBA,
304 IN UINTN BufferSize,
305 IN VOID *Buffer
306 )
307 ;
308
309 /**
310 TODO: Add function description
311
312 @param This TODO: add argument description
313
314 TODO: add return values
315
316 **/
317 EFI_STATUS
318 EFIAPI
319 IDEBlkIoFlushBlocks (
320 IN EFI_BLOCK_IO_PROTOCOL *This
321 )
322 ;
323
324 /**
325 TODO: Add function description
326
327 @param PciIo TODO: add argument description
328 @param Enable TODO: add argument description
329
330 TODO: add return values
331
332 **/
333 EFI_STATUS
334 IDERegisterDecodeEnableorDisable (
335 IN EFI_PCI_IO_PROTOCOL *PciIo,
336 IN BOOLEAN Enable
337 )
338 ;
339
340 /**
341 TODO: Add function description
342
343 @param This TODO: add argument description
344 @param InquiryData TODO: add argument description
345 @param IntquiryDataSize TODO: add argument description
346
347 TODO: add return values
348
349 **/
350 EFI_STATUS
351 EFIAPI
352 IDEDiskInfoInquiry (
353 IN EFI_DISK_INFO_PROTOCOL *This,
354 IN OUT VOID *InquiryData,
355 IN OUT UINT32 *IntquiryDataSize
356 )
357 ;
358
359 /**
360 TODO: Add function description
361
362 @param This TODO: add argument description
363 @param IdentifyData TODO: add argument description
364 @param IdentifyDataSize TODO: add argument description
365
366 TODO: add return values
367
368 **/
369 EFI_STATUS
370 EFIAPI
371 IDEDiskInfoIdentify (
372 IN EFI_DISK_INFO_PROTOCOL *This,
373 IN OUT VOID *IdentifyData,
374 IN OUT UINT32 *IdentifyDataSize
375 )
376 ;
377
378 /**
379 TODO: Add function description
380
381 @param This TODO: add argument description
382 @param SenseData TODO: add argument description
383 @param SenseDataSize TODO: add argument description
384 @param SenseDataNumber TODO: add argument description
385
386 TODO: add return values
387
388 **/
389 EFI_STATUS
390 EFIAPI
391 IDEDiskInfoSenseData (
392 IN EFI_DISK_INFO_PROTOCOL *This,
393 IN OUT VOID *SenseData,
394 IN OUT UINT32 *SenseDataSize,
395 OUT UINT8 *SenseDataNumber
396 )
397 ;
398
399 /**
400 TODO: Add function description
401
402 @param This TODO: add argument description
403 @param IdeChannel TODO: add argument description
404 @param IdeDevice TODO: add argument description
405
406 TODO: add return values
407
408 **/
409 EFI_STATUS
410 EFIAPI
411 IDEDiskInfoWhichIde (
412 IN EFI_DISK_INFO_PROTOCOL *This,
413 OUT UINT32 *IdeChannel,
414 OUT UINT32 *IdeDevice
415 )
416 ;
417
418 #endif