Perfected MSA files.
[mirror_edk2.git] / EdkModulePkg / Bus / Scsi / ScsiDisk / Dxe / ScsiDisk.h
1 /*++
2
3 Copyright (c) 2006, Intel Corporation
4 All rights reserved. This program and the accompanying materials
5 are licensed and made available under the terms and conditions of the BSD License
6 which accompanies this distribution. The full text of the license may be found at
7 http://opensource.org/licenses/bsd-license.php
8
9 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
10 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
11
12 Module Name:
13
14 ScsiDisk.h
15
16 Abstract:
17
18 Header file for SCSI Disk Driver.
19
20 --*/
21
22 #ifndef _SCSI_DISK_H
23 #define _SCSI_DISK_H
24
25
26 #include <IndustryStandard/scsi.h>
27
28 #define IsDeviceFixed(a) (a)->FixedDevice ? 1 : 0
29
30 #define SCSI_DISK_DEV_SIGNATURE EFI_SIGNATURE_32 ('s', 'c', 'd', 'k')
31
32 typedef struct {
33 UINT32 Signature;
34
35 EFI_HANDLE Handle;
36
37 EFI_BLOCK_IO_PROTOCOL BlkIo;
38 EFI_BLOCK_IO_MEDIA BlkIoMedia;
39 EFI_SCSI_IO_PROTOCOL *ScsiIo;
40 UINT8 DeviceType;
41 BOOLEAN FixedDevice;
42 UINT16 Reserved;
43
44 EFI_SCSI_SENSE_DATA *SenseData;
45 UINTN SenseDataNumber;
46 EFI_SCSI_INQUIRY_DATA InquiryData;
47
48 EFI_UNICODE_STRING_TABLE *ControllerNameTable;
49
50 } SCSI_DISK_DEV;
51
52 #define SCSI_DISK_DEV_FROM_THIS(a) CR (a, SCSI_DISK_DEV, BlkIo, SCSI_DISK_DEV_SIGNATURE)
53
54 //
55 // Global Variables
56 //
57 extern EFI_DRIVER_BINDING_PROTOCOL gScsiDiskDriverBinding;
58 extern EFI_COMPONENT_NAME_PROTOCOL gScsiDiskComponentName;
59 //
60 // action code used in detect media process
61 //
62 #define ACTION_NO_ACTION 0x00
63 #define ACTION_READ_CAPACITY 0x01
64 #define ACTION_RETRY_COMMAND_LATER 0x02
65
66 EFI_STATUS
67 EFIAPI
68 ScsiDiskDriverBindingSupported (
69 IN EFI_DRIVER_BINDING_PROTOCOL *This,
70 IN EFI_HANDLE Controller,
71 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
72 );
73
74 EFI_STATUS
75 EFIAPI
76 ScsiDiskDriverBindingStart (
77 IN EFI_DRIVER_BINDING_PROTOCOL *This,
78 IN EFI_HANDLE Controller,
79 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
80 );
81
82 EFI_STATUS
83 EFIAPI
84 ScsiDiskDriverBindingStop (
85 IN EFI_DRIVER_BINDING_PROTOCOL *This,
86 IN EFI_HANDLE Controller,
87 IN UINTN NumberOfChildren,
88 IN EFI_HANDLE *ChildHandleBuffer
89 );
90
91 //
92 // EFI Component Name Functions
93 //
94 EFI_STATUS
95 EFIAPI
96 ScsiDiskComponentNameGetDriverName (
97 IN EFI_COMPONENT_NAME_PROTOCOL *This,
98 IN CHAR8 *Language,
99 OUT CHAR16 **DriverName
100 );
101
102 EFI_STATUS
103 EFIAPI
104 ScsiDiskComponentNameGetControllerName (
105 IN EFI_COMPONENT_NAME_PROTOCOL *This,
106 IN EFI_HANDLE ControllerHandle,
107 IN EFI_HANDLE ChildHandle OPTIONAL,
108 IN CHAR8 *Language,
109 OUT CHAR16 **ControllerName
110 );
111
112 EFI_STATUS
113 EFIAPI
114 ScsiDiskReset (
115 IN EFI_BLOCK_IO_PROTOCOL *This,
116 IN BOOLEAN ExtendedVerification
117 )
118 /*++
119
120 Routine Description:
121
122 TODO: Add function description
123
124 Arguments:
125
126 This - TODO: add argument description
127 ExtendedVerification - TODO: add argument description
128
129 Returns:
130
131 TODO: add return values
132
133 --*/
134 ;
135
136 EFI_STATUS
137 EFIAPI
138 ScsiDiskReadBlocks (
139 IN EFI_BLOCK_IO_PROTOCOL *This,
140 IN UINT32 MediaId,
141 IN EFI_LBA LBA,
142 IN UINTN BufferSize,
143 OUT VOID *Buffer
144 )
145 /*++
146
147 Routine Description:
148
149 TODO: Add function description
150
151 Arguments:
152
153 This - TODO: add argument description
154 MediaId - TODO: add argument description
155 LBA - TODO: add argument description
156 BufferSize - TODO: add argument description
157 Buffer - TODO: add argument description
158
159 Returns:
160
161 TODO: add return values
162
163 --*/
164 ;
165
166 EFI_STATUS
167 EFIAPI
168 ScsiDiskWriteBlocks (
169 IN EFI_BLOCK_IO_PROTOCOL *This,
170 IN UINT32 MediaId,
171 IN EFI_LBA LBA,
172 IN UINTN BufferSize,
173 IN VOID *Buffer
174 )
175 /*++
176
177 Routine Description:
178
179 TODO: Add function description
180
181 Arguments:
182
183 This - TODO: add argument description
184 MediaId - TODO: add argument description
185 LBA - TODO: add argument description
186 BufferSize - TODO: add argument description
187 Buffer - TODO: add argument description
188
189 Returns:
190
191 TODO: add return values
192
193 --*/
194 ;
195
196 EFI_STATUS
197 EFIAPI
198 ScsiDiskFlushBlocks (
199 IN EFI_BLOCK_IO_PROTOCOL *This
200 )
201 /*++
202
203 Routine Description:
204
205 TODO: Add function description
206
207 Arguments:
208
209 This - TODO: add argument description
210
211 Returns:
212
213 TODO: add return values
214
215 --*/
216 ;
217
218 EFI_STATUS
219 ScsiDiskDetectMedia (
220 SCSI_DISK_DEV *ScsiDiskDevice,
221 BOOLEAN MustReadCap,
222 BOOLEAN *MediaChange
223 )
224 /*++
225
226 Routine Description:
227
228 TODO: Add function description
229
230 Arguments:
231
232 ScsiDiskDevice - TODO: add argument description
233 MustReadCap - TODO: add argument description
234 MediaChange - TODO: add argument description
235
236 Returns:
237
238 TODO: add return values
239
240 --*/
241 ;
242
243 EFI_STATUS
244 ScsiDiskTestUnitReady (
245 SCSI_DISK_DEV *ScsiDiskDevice,
246 BOOLEAN *NeedRetry,
247 EFI_SCSI_SENSE_DATA **SenseDataArray,
248 UINTN *NumberOfSenseKeys
249 )
250 /*++
251
252 Routine Description:
253
254 TODO: Add function description
255
256 Arguments:
257
258 ScsiDiskDevice - TODO: add argument description
259 NeedRetry - TODO: add argument description
260 SenseDataArray - TODO: add argument description
261 NumberOfSenseKeys - TODO: add argument description
262
263 Returns:
264
265 TODO: add return values
266
267 --*/
268 ;
269
270 EFI_STATUS
271 DetectMediaParsingSenseKeys (
272 SCSI_DISK_DEV *ScsiDiskDevice,
273 EFI_SCSI_SENSE_DATA *SenseData,
274 UINTN NumberOfSenseKeys,
275 UINTN *Action
276 )
277 /*++
278
279 Routine Description:
280
281 TODO: Add function description
282
283 Arguments:
284
285 ScsiDiskDevice - TODO: add argument description
286 SenseData - TODO: add argument description
287 NumberOfSenseKeys - TODO: add argument description
288 Action - TODO: add argument description
289
290 Returns:
291
292 TODO: add return values
293
294 --*/
295 ;
296
297 EFI_STATUS
298 ScsiDiskReadCapacity (
299 SCSI_DISK_DEV *ScsiDiskDevice,
300 BOOLEAN *NeedRetry,
301 EFI_SCSI_SENSE_DATA **SenseDataArray,
302 UINTN *NumberOfSenseKeys
303 )
304 /*++
305
306 Routine Description:
307
308 TODO: Add function description
309
310 Arguments:
311
312 ScsiDiskDevice - TODO: add argument description
313 NeedRetry - TODO: add argument description
314 SenseDataArray - TODO: add argument description
315 NumberOfSenseKeys - TODO: add argument description
316
317 Returns:
318
319 TODO: add return values
320
321 --*/
322 ;
323
324 EFI_STATUS
325 CheckHostAdapterStatus (
326 UINT8 HostAdapterStatus
327 )
328 /*++
329
330 Routine Description:
331
332 TODO: Add function description
333
334 Arguments:
335
336 HostAdapterStatus - TODO: add argument description
337
338 Returns:
339
340 TODO: add return values
341
342 --*/
343 ;
344
345 EFI_STATUS
346 CheckTargetStatus (
347 UINT8 TargetStatus
348 )
349 /*++
350
351 Routine Description:
352
353 TODO: Add function description
354
355 Arguments:
356
357 TargetStatus - TODO: add argument description
358
359 Returns:
360
361 TODO: add return values
362
363 --*/
364 ;
365
366 EFI_STATUS
367 ScsiDiskRequestSenseKeys (
368 SCSI_DISK_DEV *ScsiDiskDevice,
369 BOOLEAN *NeedRetry,
370 EFI_SCSI_SENSE_DATA **SenseDataArray,
371 UINTN *NumberOfSenseKeys,
372 BOOLEAN AskResetIfError
373 )
374 /*++
375
376 Routine Description:
377
378 TODO: Add function description
379
380 Arguments:
381
382 ScsiDiskDevice - TODO: add argument description
383 NeedRetry - TODO: add argument description
384 SenseDataArray - TODO: add argument description
385 NumberOfSenseKeys - TODO: add argument description
386 AskResetIfError - TODO: add argument description
387
388 Returns:
389
390 TODO: add return values
391
392 --*/
393 ;
394
395 EFI_STATUS
396 ScsiDiskInquiryDevice (
397 SCSI_DISK_DEV *ScsiDiskDevice,
398 BOOLEAN *NeedRetry
399 )
400 /*++
401
402 Routine Description:
403
404 TODO: Add function description
405
406 Arguments:
407
408 ScsiDiskDevice - TODO: add argument description
409 NeedRetry - TODO: add argument description
410
411 Returns:
412
413 TODO: add return values
414
415 --*/
416 ;
417
418 VOID
419 ParseInquiryData (
420 SCSI_DISK_DEV *ScsiDiskDevice
421 )
422 /*++
423
424 Routine Description:
425
426 TODO: Add function description
427
428 Arguments:
429
430 ScsiDiskDevice - TODO: add argument description
431
432 Returns:
433
434 TODO: add return values
435
436 --*/
437 ;
438
439 EFI_STATUS
440 ScsiDiskReadSectors (
441 SCSI_DISK_DEV *ScsiDiskDevice,
442 VOID *Buffer,
443 EFI_LBA Lba,
444 UINTN NumberOfBlocks
445 )
446 /*++
447
448 Routine Description:
449
450 TODO: Add function description
451
452 Arguments:
453
454 ScsiDiskDevice - TODO: add argument description
455 Buffer - TODO: add argument description
456 Lba - TODO: add argument description
457 NumberOfBlocks - TODO: add argument description
458
459 Returns:
460
461 TODO: add return values
462
463 --*/
464 ;
465
466 EFI_STATUS
467 ScsiDiskWriteSectors (
468 SCSI_DISK_DEV *ScsiDiskDevice,
469 VOID *Buffer,
470 EFI_LBA Lba,
471 UINTN NumberOfBlocks
472 )
473 /*++
474
475 Routine Description:
476
477 TODO: Add function description
478
479 Arguments:
480
481 ScsiDiskDevice - TODO: add argument description
482 Buffer - TODO: add argument description
483 Lba - TODO: add argument description
484 NumberOfBlocks - TODO: add argument description
485
486 Returns:
487
488 TODO: add return values
489
490 --*/
491 ;
492
493 EFI_STATUS
494 ScsiDiskRead10 (
495 SCSI_DISK_DEV *ScsiDiskDevice,
496 BOOLEAN *NeedRetry,
497 EFI_SCSI_SENSE_DATA **SenseDataArray,
498 UINTN *NumberOfSenseKeys,
499 UINT64 Timeout,
500 UINT8 *DataBuffer,
501 UINT32 *DataLength,
502 UINT32 StartLba,
503 UINT32 SectorSize
504 )
505 /*++
506
507 Routine Description:
508
509 TODO: Add function description
510
511 Arguments:
512
513 ScsiDiskDevice - TODO: add argument description
514 NeedRetry - TODO: add argument description
515 SenseDataArray - TODO: add argument description
516 NumberOfSenseKeys - TODO: add argument description
517 Timeout - TODO: add argument description
518 DataBuffer - TODO: add argument description
519 DataLength - TODO: add argument description
520 StartLba - TODO: add argument description
521 SectorSize - TODO: add argument description
522
523 Returns:
524
525 TODO: add return values
526
527 --*/
528 ;
529
530 EFI_STATUS
531 ScsiDiskWrite10 (
532 SCSI_DISK_DEV *ScsiDiskDevice,
533 BOOLEAN *NeedRetry,
534 EFI_SCSI_SENSE_DATA **SenseDataArray,
535 UINTN *NumberOfSenseKeys,
536 UINT64 Timeout,
537 UINT8 *DataBuffer,
538 UINT32 *DataLength,
539 UINT32 StartLba,
540 UINT32 SectorSize
541 )
542 /*++
543
544 Routine Description:
545
546 TODO: Add function description
547
548 Arguments:
549
550 ScsiDiskDevice - TODO: add argument description
551 NeedRetry - TODO: add argument description
552 SenseDataArray - TODO: add argument description
553 NumberOfSenseKeys - TODO: add argument description
554 Timeout - TODO: add argument description
555 DataBuffer - TODO: add argument description
556 DataLength - TODO: add argument description
557 StartLba - TODO: add argument description
558 SectorSize - TODO: add argument description
559
560 Returns:
561
562 TODO: add return values
563
564 --*/
565 ;
566
567 VOID
568 GetMediaInfo (
569 SCSI_DISK_DEV *ScsiDiskDevice,
570 EFI_SCSI_DISK_CAPACITY_DATA *Capacity
571 )
572 /*++
573
574 Routine Description:
575
576 TODO: Add function description
577
578 Arguments:
579
580 ScsiDiskDevice - TODO: add argument description
581 Capacity - TODO: add argument description
582
583 Returns:
584
585 TODO: add return values
586
587 --*/
588 ;
589
590 BOOLEAN
591 ScsiDiskIsNoMedia (
592 IN EFI_SCSI_SENSE_DATA *SenseData,
593 IN UINTN SenseCounts
594 )
595 /*++
596
597 Routine Description:
598
599 TODO: Add function description
600
601 Arguments:
602
603 SenseData - TODO: add argument description
604 SenseCounts - TODO: add argument description
605
606 Returns:
607
608 TODO: add return values
609
610 --*/
611 ;
612
613 BOOLEAN
614 ScsiDiskIsMediaError (
615 IN EFI_SCSI_SENSE_DATA *SenseData,
616 IN UINTN SenseCounts
617 )
618 /*++
619
620 Routine Description:
621
622 TODO: Add function description
623
624 Arguments:
625
626 SenseData - TODO: add argument description
627 SenseCounts - TODO: add argument description
628
629 Returns:
630
631 TODO: add return values
632
633 --*/
634 ;
635
636 BOOLEAN
637 ScsiDiskIsHardwareError (
638 IN EFI_SCSI_SENSE_DATA *SenseData,
639 IN UINTN SenseCounts
640 )
641 /*++
642
643 Routine Description:
644
645 TODO: Add function description
646
647 Arguments:
648
649 SenseData - TODO: add argument description
650 SenseCounts - TODO: add argument description
651
652 Returns:
653
654 TODO: add return values
655
656 --*/
657 ;
658
659 BOOLEAN
660 ScsiDiskIsMediaChange (
661 IN EFI_SCSI_SENSE_DATA *SenseData,
662 IN UINTN SenseCounts
663 )
664 /*++
665
666 Routine Description:
667
668 TODO: Add function description
669
670 Arguments:
671
672 SenseData - TODO: add argument description
673 SenseCounts - TODO: add argument description
674
675 Returns:
676
677 TODO: add return values
678
679 --*/
680 ;
681
682 BOOLEAN
683 ScsiDiskIsResetBefore (
684 IN EFI_SCSI_SENSE_DATA *SenseData,
685 IN UINTN SenseCounts
686 )
687 /*++
688
689 Routine Description:
690
691 TODO: Add function description
692
693 Arguments:
694
695 SenseData - TODO: add argument description
696 SenseCounts - TODO: add argument description
697
698 Returns:
699
700 TODO: add return values
701
702 --*/
703 ;
704
705 BOOLEAN
706 ScsiDiskIsDriveReady (
707 IN EFI_SCSI_SENSE_DATA *SenseData,
708 IN UINTN SenseCounts,
709 OUT BOOLEAN *NeedRetry
710 )
711 /*++
712
713 Routine Description:
714
715 TODO: Add function description
716
717 Arguments:
718
719 SenseData - TODO: add argument description
720 SenseCounts - TODO: add argument description
721 NeedRetry - TODO: add argument description
722
723 Returns:
724
725 TODO: add return values
726
727 --*/
728 ;
729
730 BOOLEAN
731 ScsiDiskHaveSenseKey (
732 IN EFI_SCSI_SENSE_DATA *SenseData,
733 IN UINTN SenseCounts
734 )
735 /*++
736
737 Routine Description:
738
739 TODO: Add function description
740
741 Arguments:
742
743 SenseData - TODO: add argument description
744 SenseCounts - TODO: add argument description
745
746 Returns:
747
748 TODO: add return values
749
750 --*/
751 ;
752
753 VOID
754 ReleaseScsiDiskDeviceResources (
755 IN SCSI_DISK_DEV *ScsiDiskDevice
756 )
757 /*++
758
759 Routine Description:
760
761 TODO: Add function description
762
763 Arguments:
764
765 ScsiDiskDevice - TODO: add argument description
766
767 Returns:
768
769 TODO: add return values
770
771 --*/
772 ;
773
774 #endif