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