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