]>
Commit | Line | Data |
---|---|---|
3b2dbece | 1 | /** @file\r |
2 | Header file for SCSI Disk Driver.\r | |
6ad55b15 | 3 | \r |
3cc033c5 | 4 | Copyright (c) 2004 - 2013, Intel Corporation. All rights reserved.<BR>\r |
cd5ebaa0 | 5 | This program and the accompanying materials\r |
3b2dbece | 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 |
9beb888e | 15 | #ifndef _SCSI_DISK_H_\r |
16 | #define _SCSI_DISK_H_\r | |
6ad55b15 | 17 | \r |
18 | \r | |
9beb888e | 19 | #include <Uefi.h>\r |
20 | \r | |
21 | \r | |
22 | #include <Protocol/ScsiIo.h>\r | |
23 | #include <Protocol/ComponentName.h>\r | |
24 | #include <Protocol/BlockIo.h>\r | |
25 | #include <Protocol/DriverBinding.h>\r | |
26 | #include <Protocol/ScsiPassThruExt.h>\r | |
d14faa52 | 27 | #include <Protocol/ScsiPassThru.h>\r |
d716651f | 28 | #include <Protocol/DiskInfo.h>\r |
29 | \r | |
9beb888e | 30 | \r |
31 | #include <Library/DebugLib.h>\r | |
32 | #include <Library/UefiDriverEntryPoint.h>\r | |
33 | #include <Library/UefiLib.h>\r | |
34 | #include <Library/BaseMemoryLib.h>\r | |
94e0fd07 | 35 | #include <Library/MemoryAllocationLib.h>\r |
ae50ee26 | 36 | #include <Library/UefiScsiLib.h>\r |
9beb888e | 37 | #include <Library/UefiBootServicesTableLib.h>\r |
d716651f | 38 | #include <Library/DevicePathLib.h>\r |
9beb888e | 39 | \r |
9cb8724d | 40 | #include <IndustryStandard/Scsi.h>\r |
d716651f | 41 | #include <IndustryStandard/Atapi.h>\r |
6ad55b15 | 42 | \r |
9beb888e | 43 | #define IS_DEVICE_FIXED(a) (a)->FixedDevice ? 1 : 0\r |
6ad55b15 | 44 | \r |
f3f2e05d | 45 | #define SCSI_DISK_DEV_SIGNATURE SIGNATURE_32 ('s', 'c', 'd', 'k')\r |
6ad55b15 | 46 | \r |
47 | typedef struct {\r | |
48 | UINT32 Signature;\r | |
49 | \r | |
50 | EFI_HANDLE Handle;\r | |
51 | \r | |
52 | EFI_BLOCK_IO_PROTOCOL BlkIo;\r | |
53 | EFI_BLOCK_IO_MEDIA BlkIoMedia;\r | |
54 | EFI_SCSI_IO_PROTOCOL *ScsiIo;\r | |
55 | UINT8 DeviceType;\r | |
56 | BOOLEAN FixedDevice;\r | |
57 | UINT16 Reserved;\r | |
58 | \r | |
59 | EFI_SCSI_SENSE_DATA *SenseData;\r | |
60 | UINTN SenseDataNumber;\r | |
61 | EFI_SCSI_INQUIRY_DATA InquiryData;\r | |
62 | \r | |
63 | EFI_UNICODE_STRING_TABLE *ControllerNameTable;\r | |
64 | \r | |
d716651f | 65 | EFI_DISK_INFO_PROTOCOL DiskInfo;\r |
66 | \r | |
67 | //\r | |
68 | // The following fields are only valid for ATAPI/SATA device\r | |
69 | //\r | |
70 | UINT32 Channel;\r | |
71 | UINT32 Device;\r | |
72 | ATAPI_IDENTIFY_DATA IdentifyData;\r | |
f95bc048 | 73 | \r |
74 | //\r | |
75 | // The flag indicates if 16-byte command can be used\r | |
76 | //\r | |
77 | BOOLEAN Cdb16Byte;\r | |
6ad55b15 | 78 | } SCSI_DISK_DEV;\r |
79 | \r | |
80 | #define SCSI_DISK_DEV_FROM_THIS(a) CR (a, SCSI_DISK_DEV, BlkIo, SCSI_DISK_DEV_SIGNATURE)\r | |
81 | \r | |
d716651f | 82 | #define SCSI_DISK_DEV_FROM_DISKINFO(a) CR (a, SCSI_DISK_DEV, DiskInfo, SCSI_DISK_DEV_SIGNATURE)\r |
83 | \r | |
6ad55b15 | 84 | //\r |
85 | // Global Variables\r | |
86 | //\r | |
70da5bc2 | 87 | extern EFI_DRIVER_BINDING_PROTOCOL gScsiDiskDriverBinding;\r |
88 | extern EFI_COMPONENT_NAME_PROTOCOL gScsiDiskComponentName;\r | |
89 | extern EFI_COMPONENT_NAME2_PROTOCOL gScsiDiskComponentName2;\r | |
6ad55b15 | 90 | //\r |
91 | // action code used in detect media process\r | |
92 | //\r | |
93 | #define ACTION_NO_ACTION 0x00\r | |
94 | #define ACTION_READ_CAPACITY 0x01\r | |
95 | #define ACTION_RETRY_COMMAND_LATER 0x02\r | |
96 | \r | |
b96cd313 | 97 | #define SCSI_COMMAND_VERSION_1 0x01\r |
98 | #define SCSI_COMMAND_VERSION_2 0x02\r | |
99 | #define SCSI_COMMAND_VERSION_3 0x03\r | |
100 | \r | |
3cc033c5 FT |
101 | //\r |
102 | // SCSI Disk Timeout Experience Value\r | |
103 | //\r | |
104 | #define SCSI_DISK_TIMEOUT EFI_TIMER_PERIOD_SECONDS (3)\r | |
b96cd313 | 105 | \r |
9beb888e | 106 | /**\r |
107 | Test to see if this driver supports ControllerHandle.\r | |
108 | \r | |
109 | This service is called by the EFI boot service ConnectController(). In order\r | |
110 | to make drivers as small as possible, there are a few calling restrictions for\r | |
111 | this service. ConnectController() must follow these calling restrictions.\r | |
112 | If any other agent wishes to call Supported() it must also follow these\r | |
113 | calling restrictions.\r | |
114 | \r | |
115 | @param This Protocol instance pointer.\r | |
116 | @param ControllerHandle Handle of device to test\r | |
117 | @param RemainingDevicePath Optional parameter use to pick a specific child\r | |
118 | device to start.\r | |
119 | \r | |
120 | @retval EFI_SUCCESS This driver supports this device\r | |
121 | @retval EFI_ALREADY_STARTED This driver is already running on this device\r | |
122 | @retval other This driver does not support this device\r | |
123 | \r | |
124 | **/\r | |
6ad55b15 | 125 | EFI_STATUS\r |
126 | EFIAPI\r | |
127 | ScsiDiskDriverBindingSupported (\r | |
128 | IN EFI_DRIVER_BINDING_PROTOCOL *This,\r | |
129 | IN EFI_HANDLE Controller,\r | |
9beb888e | 130 | IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL\r |
6ad55b15 | 131 | );\r |
132 | \r | |
9beb888e | 133 | /**\r |
134 | Start this driver on ControllerHandle.\r | |
135 | \r | |
136 | This service is called by the EFI boot service ConnectController(). In order\r | |
137 | to make drivers as small as possible, there are a few calling restrictions for\r | |
138 | this service. ConnectController() must follow these calling restrictions. If\r | |
139 | any other agent wishes to call Start() it must also follow these calling\r | |
140 | restrictions.\r | |
141 | \r | |
142 | @param This Protocol instance pointer.\r | |
143 | @param ControllerHandle Handle of device to bind driver to\r | |
144 | @param RemainingDevicePath Optional parameter use to pick a specific child\r | |
145 | device to start.\r | |
146 | \r | |
147 | @retval EFI_SUCCESS This driver is added to ControllerHandle\r | |
148 | @retval EFI_ALREADY_STARTED This driver is already running on ControllerHandle\r | |
149 | @retval other This driver does not support this device\r | |
150 | \r | |
151 | **/\r | |
6ad55b15 | 152 | EFI_STATUS\r |
153 | EFIAPI\r | |
154 | ScsiDiskDriverBindingStart (\r | |
155 | IN EFI_DRIVER_BINDING_PROTOCOL *This,\r | |
156 | IN EFI_HANDLE Controller,\r | |
9beb888e | 157 | IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL\r |
6ad55b15 | 158 | );\r |
159 | \r | |
9beb888e | 160 | /**\r |
161 | Stop this driver on ControllerHandle.\r | |
162 | \r | |
163 | This service is called by the EFI boot service DisconnectController().\r | |
164 | In order to make drivers as small as possible, there are a few calling\r | |
165 | restrictions for this service. DisconnectController() must follow these\r | |
166 | calling restrictions. If any other agent wishes to call Stop() it must\r | |
167 | also follow these calling restrictions.\r | |
168 | \r | |
169 | @param This Protocol instance pointer.\r | |
170 | @param ControllerHandle Handle of device to stop driver on\r | |
171 | @param NumberOfChildren Number of Handles in ChildHandleBuffer. If number of\r | |
172 | children is zero stop the entire bus driver.\r | |
173 | @param ChildHandleBuffer List of Child Handles to Stop.\r | |
174 | \r | |
175 | @retval EFI_SUCCESS This driver is removed ControllerHandle\r | |
176 | @retval other This driver was not removed from this device\r | |
177 | \r | |
178 | **/\r | |
6ad55b15 | 179 | EFI_STATUS\r |
180 | EFIAPI\r | |
181 | ScsiDiskDriverBindingStop (\r | |
182 | IN EFI_DRIVER_BINDING_PROTOCOL *This,\r | |
183 | IN EFI_HANDLE Controller,\r | |
184 | IN UINTN NumberOfChildren,\r | |
9beb888e | 185 | IN EFI_HANDLE *ChildHandleBuffer OPTIONAL\r |
6ad55b15 | 186 | );\r |
187 | \r | |
188 | //\r | |
189 | // EFI Component Name Functions\r | |
190 | //\r | |
70da5bc2 | 191 | /**\r |
192 | Retrieves a Unicode string that is the user readable name of the driver.\r | |
193 | \r | |
194 | This function retrieves the user readable name of a driver in the form of a\r | |
195 | Unicode string. If the driver specified by This has a user readable name in\r | |
196 | the language specified by Language, then a pointer to the driver name is\r | |
197 | returned in DriverName, and EFI_SUCCESS is returned. If the driver specified\r | |
198 | by This does not support the language specified by Language,\r | |
199 | then EFI_UNSUPPORTED is returned.\r | |
200 | \r | |
9beb888e | 201 | @param This A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or\r |
70da5bc2 | 202 | EFI_COMPONENT_NAME_PROTOCOL instance.\r |
203 | \r | |
9beb888e | 204 | @param Language A pointer to a Null-terminated ASCII string\r |
70da5bc2 | 205 | array indicating the language. This is the\r |
206 | language of the driver name that the caller is\r | |
207 | requesting, and it must match one of the\r | |
208 | languages specified in SupportedLanguages. The\r | |
209 | number of languages supported by a driver is up\r | |
210 | to the driver writer. Language is specified\r | |
0254efc0 | 211 | in RFC 4646 or ISO 639-2 language code format.\r |
70da5bc2 | 212 | \r |
9beb888e | 213 | @param DriverName A pointer to the Unicode string to return.\r |
70da5bc2 | 214 | This Unicode string is the name of the\r |
215 | driver specified by This in the language\r | |
216 | specified by Language.\r | |
217 | \r | |
218 | @retval EFI_SUCCESS The Unicode string for the Driver specified by\r | |
219 | This and the language specified by Language was\r | |
220 | returned in DriverName.\r | |
221 | \r | |
222 | @retval EFI_INVALID_PARAMETER Language is NULL.\r | |
223 | \r | |
224 | @retval EFI_INVALID_PARAMETER DriverName is NULL.\r | |
225 | \r | |
226 | @retval EFI_UNSUPPORTED The driver specified by This does not support\r | |
227 | the language specified by Language.\r | |
228 | \r | |
229 | **/\r | |
6ad55b15 | 230 | EFI_STATUS\r |
231 | EFIAPI\r | |
232 | ScsiDiskComponentNameGetDriverName (\r | |
233 | IN EFI_COMPONENT_NAME_PROTOCOL *This,\r | |
234 | IN CHAR8 *Language,\r | |
235 | OUT CHAR16 **DriverName\r | |
236 | );\r | |
237 | \r | |
70da5bc2 | 238 | \r |
239 | /**\r | |
240 | Retrieves a Unicode string that is the user readable name of the controller\r | |
241 | that is being managed by a driver.\r | |
242 | \r | |
243 | This function retrieves the user readable name of the controller specified by\r | |
244 | ControllerHandle and ChildHandle in the form of a Unicode string. If the\r | |
245 | driver specified by This has a user readable name in the language specified by\r | |
246 | Language, then a pointer to the controller name is returned in ControllerName,\r | |
247 | and EFI_SUCCESS is returned. If the driver specified by This is not currently\r | |
248 | managing the controller specified by ControllerHandle and ChildHandle,\r | |
249 | then EFI_UNSUPPORTED is returned. If the driver specified by This does not\r | |
250 | support the language specified by Language, then EFI_UNSUPPORTED is returned.\r | |
251 | \r | |
9beb888e | 252 | @param This A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or\r |
70da5bc2 | 253 | EFI_COMPONENT_NAME_PROTOCOL instance.\r |
254 | \r | |
9beb888e | 255 | @param ControllerHandle The handle of a controller that the driver\r |
70da5bc2 | 256 | specified by This is managing. This handle\r |
257 | specifies the controller whose name is to be\r | |
258 | returned.\r | |
259 | \r | |
9beb888e | 260 | @param ChildHandle The handle of the child controller to retrieve\r |
70da5bc2 | 261 | the name of. This is an optional parameter that\r |
262 | may be NULL. It will be NULL for device\r | |
263 | drivers. It will also be NULL for a bus drivers\r | |
264 | that wish to retrieve the name of the bus\r | |
265 | controller. It will not be NULL for a bus\r | |
266 | driver that wishes to retrieve the name of a\r | |
267 | child controller.\r | |
268 | \r | |
9beb888e | 269 | @param Language A pointer to a Null-terminated ASCII string\r |
70da5bc2 | 270 | array indicating the language. This is the\r |
271 | language of the driver name that the caller is\r | |
272 | requesting, and it must match one of the\r | |
273 | languages specified in SupportedLanguages. The\r | |
274 | number of languages supported by a driver is up\r | |
275 | to the driver writer. Language is specified in\r | |
0254efc0 | 276 | RFC 4646 or ISO 639-2 language code format.\r |
70da5bc2 | 277 | \r |
9beb888e | 278 | @param ControllerName A pointer to the Unicode string to return.\r |
70da5bc2 | 279 | This Unicode string is the name of the\r |
280 | controller specified by ControllerHandle and\r | |
281 | ChildHandle in the language specified by\r | |
282 | Language from the point of view of the driver\r | |
283 | specified by This.\r | |
284 | \r | |
285 | @retval EFI_SUCCESS The Unicode string for the user readable name in\r | |
286 | the language specified by Language for the\r | |
287 | driver specified by This was returned in\r | |
288 | DriverName.\r | |
289 | \r | |
284ee2e8 | 290 | @retval EFI_INVALID_PARAMETER ControllerHandle is NULL.\r |
70da5bc2 | 291 | \r |
292 | @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid\r | |
293 | EFI_HANDLE.\r | |
294 | \r | |
295 | @retval EFI_INVALID_PARAMETER Language is NULL.\r | |
296 | \r | |
297 | @retval EFI_INVALID_PARAMETER ControllerName is NULL.\r | |
298 | \r | |
299 | @retval EFI_UNSUPPORTED The driver specified by This is not currently\r | |
300 | managing the controller specified by\r | |
301 | ControllerHandle and ChildHandle.\r | |
302 | \r | |
303 | @retval EFI_UNSUPPORTED The driver specified by This does not support\r | |
304 | the language specified by Language.\r | |
305 | \r | |
306 | **/\r | |
6ad55b15 | 307 | EFI_STATUS\r |
308 | EFIAPI\r | |
309 | ScsiDiskComponentNameGetControllerName (\r | |
310 | IN EFI_COMPONENT_NAME_PROTOCOL *This,\r | |
311 | IN EFI_HANDLE ControllerHandle,\r | |
312 | IN EFI_HANDLE ChildHandle OPTIONAL,\r | |
313 | IN CHAR8 *Language,\r | |
314 | OUT CHAR16 **ControllerName\r | |
315 | );\r | |
316 | \r | |
9beb888e | 317 | /**\r |
318 | Reset SCSI Disk.\r | |
319 | \r | |
320 | \r | |
321 | @param This The pointer of EFI_BLOCK_IO_PROTOCOL\r | |
322 | @param ExtendedVerification The flag about if extend verificate\r | |
70da5bc2 | 323 | \r |
9beb888e | 324 | @retval EFI_SUCCESS The device was reset.\r |
325 | @retval EFI_DEVICE_ERROR The device is not functioning properly and could\r | |
326 | not be reset.\r | |
327 | @return EFI_STATUS is retured from EFI_SCSI_IO_PROTOCOL.ResetDevice().\r | |
328 | \r | |
329 | **/\r | |
6ad55b15 | 330 | EFI_STATUS\r |
331 | EFIAPI\r | |
332 | ScsiDiskReset (\r | |
333 | IN EFI_BLOCK_IO_PROTOCOL *This,\r | |
334 | IN BOOLEAN ExtendedVerification\r | |
9beb888e | 335 | );\r |
6ad55b15 | 336 | \r |
6ad55b15 | 337 | \r |
9beb888e | 338 | /**\r |
339 | The function is to Read Block from SCSI Disk.\r | |
6ad55b15 | 340 | \r |
9beb888e | 341 | @param This The pointer of EFI_BLOCK_IO_PROTOCOL.\r |
342 | @param MediaId The Id of Media detected\r | |
343 | @param Lba The logic block address\r | |
344 | @param BufferSize The size of Buffer\r | |
345 | @param Buffer The buffer to fill the read out data\r | |
6ad55b15 | 346 | \r |
9beb888e | 347 | @retval EFI_SUCCESS Successfully to read out block.\r |
348 | @retval EFI_DEVICE_ERROR Fail to detect media.\r | |
349 | @retval EFI_NO_MEDIA Media is not present.\r | |
350 | @retval EFI_MEDIA_CHANGED Media has changed.\r | |
351 | @retval EFI_BAD_BUFFER_SIZE The Buffer was not a multiple of the block size of the device.\r | |
352 | @retval EFI_INVALID_PARAMETER Invalid parameter passed in.\r | |
6ad55b15 | 353 | \r |
9beb888e | 354 | **/\r |
6ad55b15 | 355 | EFI_STATUS\r |
356 | EFIAPI\r | |
357 | ScsiDiskReadBlocks (\r | |
358 | IN EFI_BLOCK_IO_PROTOCOL *This,\r | |
359 | IN UINT32 MediaId,\r | |
9beb888e | 360 | IN EFI_LBA Lba,\r |
6ad55b15 | 361 | IN UINTN BufferSize,\r |
362 | OUT VOID *Buffer\r | |
9beb888e | 363 | );\r |
6ad55b15 | 364 | \r |
6ad55b15 | 365 | \r |
9beb888e | 366 | /**\r |
367 | The function is to Write Block to SCSI Disk.\r | |
368 | \r | |
369 | @param This The pointer of EFI_BLOCK_IO_PROTOCOL\r | |
370 | @param MediaId The Id of Media detected\r | |
371 | @param Lba The logic block address\r | |
372 | @param BufferSize The size of Buffer\r | |
373 | @param Buffer The buffer to fill the read out data\r | |
374 | \r | |
375 | @retval EFI_SUCCESS Successfully to read out block.\r | |
376 | @retval EFI_WRITE_PROTECTED The device can not be written to.\r | |
377 | @retval EFI_DEVICE_ERROR Fail to detect media.\r | |
378 | @retval EFI_NO_MEDIA Media is not present.\r | |
379 | @retval EFI_MEDIA_CHNAGED Media has changed.\r | |
380 | @retval EFI_BAD_BUFFER_SIZE The Buffer was not a multiple of the block size of the device.\r | |
381 | @retval EFI_INVALID_PARAMETER Invalid parameter passed in.\r | |
6ad55b15 | 382 | \r |
9beb888e | 383 | **/\r |
6ad55b15 | 384 | EFI_STATUS\r |
385 | EFIAPI\r | |
386 | ScsiDiskWriteBlocks (\r | |
387 | IN EFI_BLOCK_IO_PROTOCOL *This,\r | |
388 | IN UINT32 MediaId,\r | |
9beb888e | 389 | IN EFI_LBA Lba,\r |
6ad55b15 | 390 | IN UINTN BufferSize,\r |
391 | IN VOID *Buffer\r | |
9beb888e | 392 | );\r |
6ad55b15 | 393 | \r |
6ad55b15 | 394 | \r |
9beb888e | 395 | /**\r |
396 | Flush Block to Disk.\r | |
6ad55b15 | 397 | \r |
9beb888e | 398 | EFI_SUCCESS is returned directly.\r |
6ad55b15 | 399 | \r |
9beb888e | 400 | @param This The pointer of EFI_BLOCK_IO_PROTOCOL\r |
6ad55b15 | 401 | \r |
9beb888e | 402 | @retval EFI_SUCCESS All outstanding data was written to the device\r |
6ad55b15 | 403 | \r |
9beb888e | 404 | **/\r |
6ad55b15 | 405 | EFI_STATUS\r |
406 | EFIAPI\r | |
407 | ScsiDiskFlushBlocks (\r | |
408 | IN EFI_BLOCK_IO_PROTOCOL *This\r | |
9beb888e | 409 | );\r |
6ad55b15 | 410 | \r |
d716651f | 411 | \r |
412 | /**\r | |
413 | Provides inquiry information for the controller type.\r | |
414 | \r | |
415 | This function is used by the IDE bus driver to get inquiry data. Data format\r | |
416 | of Identify data is defined by the Interface GUID.\r | |
417 | \r | |
4140a663 | 418 | @param[in] This Pointer to the EFI_DISK_INFO_PROTOCOL instance.\r |
419 | @param[in, out] InquiryData Pointer to a buffer for the inquiry data.\r | |
420 | @param[in, out] InquiryDataSize Pointer to the value for the inquiry data size.\r | |
d716651f | 421 | \r |
422 | @retval EFI_SUCCESS The command was accepted without any errors.\r | |
423 | @retval EFI_NOT_FOUND Device does not support this data class \r | |
424 | @retval EFI_DEVICE_ERROR Error reading InquiryData from device \r | |
425 | @retval EFI_BUFFER_TOO_SMALL InquiryDataSize not big enough \r | |
426 | \r | |
427 | **/\r | |
428 | EFI_STATUS\r | |
429 | EFIAPI\r | |
430 | ScsiDiskInfoInquiry (\r | |
431 | IN EFI_DISK_INFO_PROTOCOL *This,\r | |
432 | IN OUT VOID *InquiryData,\r | |
433 | IN OUT UINT32 *InquiryDataSize\r | |
434 | );\r | |
435 | \r | |
436 | \r | |
437 | /**\r | |
438 | Provides identify information for the controller type.\r | |
439 | \r | |
440 | This function is used by the IDE bus driver to get identify data. Data format\r | |
441 | of Identify data is defined by the Interface GUID.\r | |
442 | \r | |
443 | @param[in] This Pointer to the EFI_DISK_INFO_PROTOCOL \r | |
444 | instance.\r | |
4140a663 | 445 | @param[in, out] IdentifyData Pointer to a buffer for the identify data.\r |
446 | @param[in, out] IdentifyDataSize Pointer to the value for the identify data\r | |
d716651f | 447 | size.\r |
448 | \r | |
449 | @retval EFI_SUCCESS The command was accepted without any errors.\r | |
450 | @retval EFI_NOT_FOUND Device does not support this data class \r | |
451 | @retval EFI_DEVICE_ERROR Error reading IdentifyData from device \r | |
452 | @retval EFI_BUFFER_TOO_SMALL IdentifyDataSize not big enough \r | |
453 | \r | |
454 | **/\r | |
455 | EFI_STATUS\r | |
456 | EFIAPI\r | |
457 | ScsiDiskInfoIdentify (\r | |
458 | IN EFI_DISK_INFO_PROTOCOL *This,\r | |
459 | IN OUT VOID *IdentifyData,\r | |
460 | IN OUT UINT32 *IdentifyDataSize\r | |
461 | );\r | |
462 | \r | |
463 | \r | |
464 | /**\r | |
465 | Provides sense data information for the controller type.\r | |
466 | \r | |
467 | This function is used by the IDE bus driver to get sense data. \r | |
468 | Data format of Sense data is defined by the Interface GUID.\r | |
469 | \r | |
4140a663 | 470 | @param[in] This Pointer to the EFI_DISK_INFO_PROTOCOL instance.\r |
471 | @param[in, out] SenseData Pointer to the SenseData.\r | |
472 | @param[in, out] SenseDataSize Size of SenseData in bytes.\r | |
473 | @param[out] SenseDataNumber Pointer to the value for the sense data size.\r | |
d716651f | 474 | \r |
475 | @retval EFI_SUCCESS The command was accepted without any errors.\r | |
476 | @retval EFI_NOT_FOUND Device does not support this data class.\r | |
477 | @retval EFI_DEVICE_ERROR Error reading SenseData from device.\r | |
478 | @retval EFI_BUFFER_TOO_SMALL SenseDataSize not big enough.\r | |
479 | \r | |
480 | **/\r | |
481 | EFI_STATUS\r | |
482 | EFIAPI\r | |
483 | ScsiDiskInfoSenseData (\r | |
484 | IN EFI_DISK_INFO_PROTOCOL *This,\r | |
485 | IN OUT VOID *SenseData,\r | |
486 | IN OUT UINT32 *SenseDataSize,\r | |
487 | OUT UINT8 *SenseDataNumber\r | |
488 | );\r | |
489 | \r | |
490 | /**\r | |
491 | This function is used by the IDE bus driver to get controller information.\r | |
492 | \r | |
493 | @param[in] This Pointer to the EFI_DISK_INFO_PROTOCOL instance. \r | |
494 | @param[out] IdeChannel Pointer to the Ide Channel number. Primary or secondary.\r | |
495 | @param[out] IdeDevice Pointer to the Ide Device number. Master or slave.\r | |
496 | \r | |
497 | @retval EFI_SUCCESS IdeChannel and IdeDevice are valid.\r | |
498 | @retval EFI_UNSUPPORTED This is not an IDE device.\r | |
499 | \r | |
500 | **/\r | |
501 | EFI_STATUS\r | |
502 | EFIAPI\r | |
503 | ScsiDiskInfoWhichIde (\r | |
504 | IN EFI_DISK_INFO_PROTOCOL *This,\r | |
505 | OUT UINT32 *IdeChannel,\r | |
506 | OUT UINT32 *IdeDevice\r | |
507 | );\r | |
508 | \r | |
509 | \r | |
9beb888e | 510 | /**\r |
d716651f | 511 | Detect Device and read out capacity ,if error occurs, parse the sense key.\r |
6ad55b15 | 512 | \r |
9beb888e | 513 | @param ScsiDiskDevice The pointer of SCSI_DISK_DEV\r |
514 | @param MustReadCapacity The flag about reading device capacity\r | |
515 | @param MediaChange The pointer of flag indicates if media has changed \r | |
6ad55b15 | 516 | \r |
9beb888e | 517 | @retval EFI_DEVICE_ERROR Indicates that error occurs\r |
518 | @retval EFI_SUCCESS Successfully to detect media\r | |
6ad55b15 | 519 | \r |
9beb888e | 520 | **/\r |
6ad55b15 | 521 | EFI_STATUS\r |
522 | ScsiDiskDetectMedia (\r | |
9beb888e | 523 | IN SCSI_DISK_DEV *ScsiDiskDevice,\r |
524 | IN BOOLEAN MustReadCapacity,\r | |
525 | OUT BOOLEAN *MediaChange\r | |
526 | );\r | |
6ad55b15 | 527 | \r |
9beb888e | 528 | /**\r |
d716651f | 529 | To test device.\r |
6ad55b15 | 530 | \r |
9beb888e | 531 | When Test Unit Ready command succeeds, retrieve Sense Keys via Request Sense;\r |
532 | When Test Unit Ready command encounters any error caused by host adapter or\r | |
533 | target, return error without retrieving Sense Keys.\r | |
6ad55b15 | 534 | \r |
9beb888e | 535 | @param ScsiDiskDevice The pointer of SCSI_DISK_DEV\r |
536 | @param NeedRetry The pointer of flag indicates try again\r | |
537 | @param SenseDataArray The pointer of an array of sense data\r | |
538 | @param NumberOfSenseKeys The pointer of the number of sense data array\r | |
6ad55b15 | 539 | \r |
9beb888e | 540 | @retval EFI_DEVICE_ERROR Indicates that error occurs\r |
541 | @retval EFI_SUCCESS Successfully to test unit\r | |
f36d6e66 | 542 | \r |
9beb888e | 543 | **/\r |
6ad55b15 | 544 | EFI_STATUS\r |
545 | ScsiDiskTestUnitReady (\r | |
9beb888e | 546 | IN SCSI_DISK_DEV *ScsiDiskDevice,\r |
547 | OUT BOOLEAN *NeedRetry,\r | |
548 | OUT EFI_SCSI_SENSE_DATA **SenseDataArray,\r | |
549 | OUT UINTN *NumberOfSenseKeys\r | |
550 | );\r | |
6ad55b15 | 551 | \r |
6ad55b15 | 552 | \r |
9beb888e | 553 | /**\r |
554 | Parsing Sense Keys which got from request sense command.\r | |
6ad55b15 | 555 | \r |
9beb888e | 556 | @param ScsiDiskDevice The pointer of SCSI_DISK_DEV\r |
557 | @param SenseData The pointer of EFI_SCSI_SENSE_DATA\r | |
558 | @param NumberOfSenseKeys The number of sense key \r | |
559 | @param Action The pointer of action which indicates what is need to do next\r | |
6ad55b15 | 560 | \r |
9beb888e | 561 | @retval EFI_DEVICE_ERROR Indicates that error occurs\r |
562 | @retval EFI_SUCCESS Successfully to complete the parsing\r | |
6ad55b15 | 563 | \r |
9beb888e | 564 | **/\r |
6ad55b15 | 565 | EFI_STATUS\r |
566 | DetectMediaParsingSenseKeys (\r | |
9beb888e | 567 | OUT SCSI_DISK_DEV *ScsiDiskDevice,\r |
568 | IN EFI_SCSI_SENSE_DATA *SenseData,\r | |
569 | IN UINTN NumberOfSenseKeys,\r | |
570 | OUT UINTN *Action\r | |
571 | );\r | |
6ad55b15 | 572 | \r |
6ad55b15 | 573 | \r |
9beb888e | 574 | /**\r |
575 | Send read capacity command to device and get the device parameter.\r | |
6ad55b15 | 576 | \r |
9beb888e | 577 | @param ScsiDiskDevice The pointer of SCSI_DISK_DEV\r |
578 | @param NeedRetry The pointer of flag indicates if need a retry\r | |
579 | @param SenseDataArray The pointer of an array of sense data\r | |
580 | @param NumberOfSenseKeys The number of sense key\r | |
6ad55b15 | 581 | \r |
9beb888e | 582 | @retval EFI_DEVICE_ERROR Indicates that error occurs\r |
583 | @retval EFI_SUCCESS Successfully to read capacity\r | |
6ad55b15 | 584 | \r |
9beb888e | 585 | **/\r |
6ad55b15 | 586 | EFI_STATUS\r |
587 | ScsiDiskReadCapacity (\r | |
9beb888e | 588 | IN OUT SCSI_DISK_DEV *ScsiDiskDevice,\r |
589 | OUT BOOLEAN *NeedRetry,\r | |
590 | OUT EFI_SCSI_SENSE_DATA **SenseDataArray,\r | |
591 | OUT UINTN *NumberOfSenseKeys\r | |
592 | );\r | |
6ad55b15 | 593 | \r |
9beb888e | 594 | /**\r |
595 | Check the HostAdapter status and re-interpret it in EFI_STATUS.\r | |
6ad55b15 | 596 | \r |
9beb888e | 597 | @param HostAdapterStatus Host Adapter status\r |
6ad55b15 | 598 | \r |
9beb888e | 599 | @retval EFI_SUCCESS Host adapter is OK.\r |
600 | @retval EFI_TIMEOUT Timeout.\r | |
601 | @retval EFI_NOT_READY Adapter NOT ready.\r | |
602 | @retval EFI_DEVICE_ERROR Adapter device error.\r | |
6ad55b15 | 603 | \r |
9beb888e | 604 | **/\r |
6ad55b15 | 605 | EFI_STATUS\r |
606 | CheckHostAdapterStatus (\r | |
9beb888e | 607 | IN UINT8 HostAdapterStatus\r |
608 | );\r | |
6ad55b15 | 609 | \r |
6ad55b15 | 610 | \r |
9beb888e | 611 | /**\r |
612 | Check the target status and re-interpret it in EFI_STATUS.\r | |
6ad55b15 | 613 | \r |
9beb888e | 614 | @param TargetStatus Target status\r |
6ad55b15 | 615 | \r |
9beb888e | 616 | @retval EFI_NOT_READY Device is NOT ready.\r |
617 | @retval EFI_DEVICE_ERROR \r | |
618 | @retval EFI_SUCCESS\r | |
6ad55b15 | 619 | \r |
9beb888e | 620 | **/\r |
6ad55b15 | 621 | EFI_STATUS\r |
622 | CheckTargetStatus (\r | |
9beb888e | 623 | IN UINT8 TargetStatus\r |
624 | );\r | |
6ad55b15 | 625 | \r |
9beb888e | 626 | /**\r |
627 | Retrieve all sense keys from the device.\r | |
6ad55b15 | 628 | \r |
9beb888e | 629 | When encountering error during the process, if retrieve sense keys before\r |
d716651f | 630 | error encountered, it returns the sense keys with return status set to EFI_SUCCESS,\r |
9beb888e | 631 | and NeedRetry set to FALSE; otherwize, return the proper return status.\r |
6ad55b15 | 632 | \r |
9beb888e | 633 | @param ScsiDiskDevice The pointer of SCSI_DISK_DEV\r |
634 | @param NeedRetry The pointer of flag indicates if need a retry\r | |
635 | @param SenseDataArray The pointer of an array of sense data\r | |
636 | @param NumberOfSenseKeys The number of sense key\r | |
637 | @param AskResetIfError The flag indicates if need reset when error occurs\r | |
6ad55b15 | 638 | \r |
9beb888e | 639 | @retval EFI_DEVICE_ERROR Indicates that error occurs\r |
640 | @retval EFI_SUCCESS Successfully to request sense key\r | |
6ad55b15 | 641 | \r |
9beb888e | 642 | **/\r |
6ad55b15 | 643 | EFI_STATUS\r |
644 | ScsiDiskRequestSenseKeys (\r | |
9beb888e | 645 | IN OUT SCSI_DISK_DEV *ScsiDiskDevice,\r |
646 | OUT BOOLEAN *NeedRetry,\r | |
647 | OUT EFI_SCSI_SENSE_DATA **SenseDataArray,\r | |
648 | OUT UINTN *NumberOfSenseKeys,\r | |
649 | IN BOOLEAN AskResetIfError\r | |
650 | );\r | |
6ad55b15 | 651 | \r |
9beb888e | 652 | /**\r |
653 | Send out Inquiry command to Device.\r | |
6ad55b15 | 654 | \r |
9beb888e | 655 | @param ScsiDiskDevice The pointer of SCSI_DISK_DEV\r |
656 | @param NeedRetry Indicates if needs try again when error happens\r | |
6ad55b15 | 657 | \r |
9beb888e | 658 | @retval EFI_DEVICE_ERROR Indicates that error occurs\r |
659 | @retval EFI_SUCCESS Successfully to detect media\r | |
6ad55b15 | 660 | \r |
9beb888e | 661 | **/\r |
6ad55b15 | 662 | EFI_STATUS\r |
663 | ScsiDiskInquiryDevice (\r | |
9beb888e | 664 | IN OUT SCSI_DISK_DEV *ScsiDiskDevice,\r |
665 | OUT BOOLEAN *NeedRetry\r | |
666 | );\r | |
6ad55b15 | 667 | \r |
9beb888e | 668 | /**\r |
669 | Parse Inquiry data.\r | |
6ad55b15 | 670 | \r |
9beb888e | 671 | @param ScsiDiskDevice The pointer of SCSI_DISK_DEV\r |
6ad55b15 | 672 | \r |
9beb888e | 673 | **/\r |
6ad55b15 | 674 | VOID\r |
675 | ParseInquiryData (\r | |
9beb888e | 676 | IN OUT SCSI_DISK_DEV *ScsiDiskDevice\r |
677 | );\r | |
6ad55b15 | 678 | \r |
9beb888e | 679 | /**\r |
680 | Read sector from SCSI Disk.\r | |
6ad55b15 | 681 | \r |
d716651f | 682 | @param ScsiDiskDevice The pointer of SCSI_DISK_DEV\r |
9beb888e | 683 | @param Buffer The buffer to fill in the read out data\r |
684 | @param Lba Logic block address\r | |
685 | @param NumberOfBlocks The number of blocks to read\r | |
6ad55b15 | 686 | \r |
9beb888e | 687 | @retval EFI_DEVICE_ERROR Indicates a device error.\r |
688 | @retval EFI_SUCCESS Operation is successful.\r | |
6ad55b15 | 689 | \r |
9beb888e | 690 | **/\r |
6ad55b15 | 691 | EFI_STATUS\r |
692 | ScsiDiskReadSectors (\r | |
9beb888e | 693 | IN SCSI_DISK_DEV *ScsiDiskDevice,\r |
694 | OUT VOID *Buffer,\r | |
695 | IN EFI_LBA Lba,\r | |
696 | IN UINTN NumberOfBlocks\r | |
697 | );\r | |
6ad55b15 | 698 | \r |
9beb888e | 699 | /**\r |
700 | Write sector to SCSI Disk.\r | |
6ad55b15 | 701 | \r |
d716651f | 702 | @param ScsiDiskDevice The pointer of SCSI_DISK_DEV\r |
9beb888e | 703 | @param Buffer The buffer of data to be written into SCSI Disk\r |
704 | @param Lba Logic block address\r | |
705 | @param NumberOfBlocks The number of blocks to read\r | |
6ad55b15 | 706 | \r |
9beb888e | 707 | @retval EFI_DEVICE_ERROR Indicates a device error.\r |
708 | @retval EFI_SUCCESS Operation is successful.\r | |
6ad55b15 | 709 | \r |
9beb888e | 710 | **/\r |
6ad55b15 | 711 | EFI_STATUS\r |
712 | ScsiDiskWriteSectors (\r | |
9beb888e | 713 | IN SCSI_DISK_DEV *ScsiDiskDevice,\r |
714 | IN VOID *Buffer,\r | |
715 | IN EFI_LBA Lba,\r | |
716 | IN UINTN NumberOfBlocks\r | |
717 | );\r | |
6ad55b15 | 718 | \r |
9beb888e | 719 | /**\r |
d716651f | 720 | Submit Read command.\r |
9beb888e | 721 | \r |
722 | @param ScsiDiskDevice The pointer of ScsiDiskDevice\r | |
723 | @param NeedRetry The pointer of flag indicates if needs retry if error happens\r | |
724 | @param SenseDataArray NOT used yet in this function\r | |
725 | @param NumberOfSenseKeys The number of sense key\r | |
726 | @param Timeout The time to complete the command\r | |
727 | @param DataBuffer The buffer to fill with the read out data\r | |
728 | @param DataLength The length of buffer\r | |
729 | @param StartLba The start logic block address\r | |
730 | @param SectorSize The size of sector\r | |
731 | \r | |
732 | @return EFI_STATUS is returned by calling ScsiRead10Command().\r | |
733 | **/\r | |
6ad55b15 | 734 | EFI_STATUS\r |
735 | ScsiDiskRead10 (\r | |
9beb888e | 736 | IN SCSI_DISK_DEV *ScsiDiskDevice,\r |
737 | OUT BOOLEAN *NeedRetry,\r | |
738 | OUT EFI_SCSI_SENSE_DATA **SenseDataArray, OPTIONAL\r | |
739 | OUT UINTN *NumberOfSenseKeys,\r | |
740 | IN UINT64 Timeout,\r | |
741 | OUT UINT8 *DataBuffer,\r | |
742 | IN OUT UINT32 *DataLength,\r | |
743 | IN UINT32 StartLba,\r | |
744 | IN UINT32 SectorSize\r | |
745 | );\r | |
6ad55b15 | 746 | \r |
9beb888e | 747 | /**\r |
748 | Submit Write Command.\r | |
6ad55b15 | 749 | \r |
9beb888e | 750 | @param ScsiDiskDevice The pointer of ScsiDiskDevice\r |
751 | @param NeedRetry The pointer of flag indicates if needs retry if error happens\r | |
752 | @param SenseDataArray NOT used yet in this function\r | |
753 | @param NumberOfSenseKeys The number of sense key\r | |
754 | @param Timeout The time to complete the command\r | |
755 | @param DataBuffer The buffer to fill with the read out data\r | |
756 | @param DataLength The length of buffer\r | |
757 | @param StartLba The start logic block address\r | |
758 | @param SectorSize The size of sector\r | |
6ad55b15 | 759 | \r |
9beb888e | 760 | @return EFI_STATUS is returned by calling ScsiWrite10Command().\r |
6ad55b15 | 761 | \r |
9beb888e | 762 | **/\r |
6ad55b15 | 763 | EFI_STATUS\r |
764 | ScsiDiskWrite10 (\r | |
9beb888e | 765 | IN SCSI_DISK_DEV *ScsiDiskDevice,\r |
766 | OUT BOOLEAN *NeedRetry,\r | |
767 | OUT EFI_SCSI_SENSE_DATA **SenseDataArray, OPTIONAL\r | |
768 | OUT UINTN *NumberOfSenseKeys,\r | |
769 | IN UINT64 Timeout,\r | |
770 | IN UINT8 *DataBuffer,\r | |
771 | IN OUT UINT32 *DataLength,\r | |
772 | IN UINT32 StartLba,\r | |
773 | IN UINT32 SectorSize\r | |
774 | );\r | |
6ad55b15 | 775 | \r |
a108933e | 776 | /**\r |
777 | Submit Read(16) command.\r | |
778 | \r | |
779 | @param ScsiDiskDevice The pointer of ScsiDiskDevice\r | |
780 | @param NeedRetry The pointer of flag indicates if needs retry if error happens\r | |
781 | @param SenseDataArray NOT used yet in this function\r | |
782 | @param NumberOfSenseKeys The number of sense key\r | |
783 | @param Timeout The time to complete the command\r | |
784 | @param DataBuffer The buffer to fill with the read out data\r | |
785 | @param DataLength The length of buffer\r | |
786 | @param StartLba The start logic block address\r | |
787 | @param SectorSize The size of sector\r | |
788 | \r | |
789 | @return EFI_STATUS is returned by calling ScsiRead10Command().\r | |
790 | **/\r | |
791 | EFI_STATUS\r | |
792 | ScsiDiskRead16 (\r | |
793 | IN SCSI_DISK_DEV *ScsiDiskDevice,\r | |
794 | OUT BOOLEAN *NeedRetry,\r | |
795 | OUT EFI_SCSI_SENSE_DATA **SenseDataArray, OPTIONAL\r | |
796 | OUT UINTN *NumberOfSenseKeys,\r | |
797 | IN UINT64 Timeout,\r | |
798 | OUT UINT8 *DataBuffer,\r | |
799 | IN OUT UINT32 *DataLength,\r | |
800 | IN UINT64 StartLba,\r | |
801 | IN UINT32 SectorSize\r | |
802 | );\r | |
803 | \r | |
804 | /**\r | |
805 | Submit Write(16) Command.\r | |
806 | \r | |
807 | @param ScsiDiskDevice The pointer of ScsiDiskDevice\r | |
808 | @param NeedRetry The pointer of flag indicates if needs retry if error happens\r | |
809 | @param SenseDataArray NOT used yet in this function\r | |
810 | @param NumberOfSenseKeys The number of sense key\r | |
811 | @param Timeout The time to complete the command\r | |
812 | @param DataBuffer The buffer to fill with the read out data\r | |
813 | @param DataLength The length of buffer\r | |
814 | @param StartLba The start logic block address\r | |
815 | @param SectorSize The size of sector\r | |
816 | \r | |
817 | @return EFI_STATUS is returned by calling ScsiWrite10Command().\r | |
818 | \r | |
819 | **/\r | |
820 | EFI_STATUS\r | |
821 | ScsiDiskWrite16 (\r | |
822 | IN SCSI_DISK_DEV *ScsiDiskDevice,\r | |
823 | OUT BOOLEAN *NeedRetry,\r | |
824 | OUT EFI_SCSI_SENSE_DATA **SenseDataArray, OPTIONAL\r | |
825 | OUT UINTN *NumberOfSenseKeys,\r | |
826 | IN UINT64 Timeout,\r | |
827 | IN UINT8 *DataBuffer,\r | |
828 | IN OUT UINT32 *DataLength,\r | |
829 | IN UINT64 StartLba,\r | |
830 | IN UINT32 SectorSize\r | |
831 | ); \r | |
832 | \r | |
9beb888e | 833 | /**\r |
834 | Get information from media read capacity command.\r | |
6ad55b15 | 835 | \r |
9beb888e | 836 | @param ScsiDiskDevice The pointer of SCSI_DISK_DEV\r |
b96cd313 | 837 | @param Capacity10 The pointer of EFI_SCSI_DISK_CAPACITY_DATA\r |
838 | @param Capacity16 The pointer of EFI_SCSI_DISK_CAPACITY_DATA16\r | |
9beb888e | 839 | **/\r |
6ad55b15 | 840 | VOID\r |
841 | GetMediaInfo (\r | |
aa75dfec | 842 | IN OUT SCSI_DISK_DEV *ScsiDiskDevice,\r |
843 | IN EFI_SCSI_DISK_CAPACITY_DATA *Capacity10,\r | |
844 | IN EFI_SCSI_DISK_CAPACITY_DATA16 *Capacity16\r | |
9beb888e | 845 | );\r |
6ad55b15 | 846 | \r |
9beb888e | 847 | /**\r |
848 | Check sense key to find if media presents.\r | |
6ad55b15 | 849 | \r |
9beb888e | 850 | @param SenseData The pointer of EFI_SCSI_SENSE_DATA\r |
851 | @param SenseCounts The number of sense key\r | |
6ad55b15 | 852 | \r |
9beb888e | 853 | @retval TRUE NOT any media\r |
854 | @retval FALSE Media presents\r | |
855 | **/\r | |
6ad55b15 | 856 | BOOLEAN\r |
857 | ScsiDiskIsNoMedia (\r | |
858 | IN EFI_SCSI_SENSE_DATA *SenseData,\r | |
859 | IN UINTN SenseCounts\r | |
9beb888e | 860 | );\r |
6ad55b15 | 861 | \r |
9beb888e | 862 | /**\r |
863 | Parse sense key.\r | |
6ad55b15 | 864 | \r |
9beb888e | 865 | @param SenseData The pointer of EFI_SCSI_SENSE_DATA\r |
866 | @param SenseCounts The number of sense key\r | |
6ad55b15 | 867 | \r |
9beb888e | 868 | @retval TRUE Error\r |
869 | @retval FALSE NOT error\r | |
6ad55b15 | 870 | \r |
9beb888e | 871 | **/\r |
6ad55b15 | 872 | BOOLEAN\r |
873 | ScsiDiskIsMediaError (\r | |
874 | IN EFI_SCSI_SENSE_DATA *SenseData,\r | |
875 | IN UINTN SenseCounts\r | |
9beb888e | 876 | );\r |
6ad55b15 | 877 | \r |
9beb888e | 878 | /**\r |
879 | Check sense key to find if hardware error happens.\r | |
6ad55b15 | 880 | \r |
9beb888e | 881 | @param SenseData The pointer of EFI_SCSI_SENSE_DATA\r |
882 | @param SenseCounts The number of sense key\r | |
6ad55b15 | 883 | \r |
9beb888e | 884 | @retval TRUE Hardware error exits.\r |
885 | @retval FALSE NO error.\r | |
6ad55b15 | 886 | \r |
9beb888e | 887 | **/\r |
6ad55b15 | 888 | BOOLEAN\r |
889 | ScsiDiskIsHardwareError (\r | |
890 | IN EFI_SCSI_SENSE_DATA *SenseData,\r | |
891 | IN UINTN SenseCounts\r | |
9beb888e | 892 | );\r |
6ad55b15 | 893 | \r |
9beb888e | 894 | /**\r |
895 | Check sense key to find if media has changed.\r | |
6ad55b15 | 896 | \r |
9beb888e | 897 | @param SenseData The pointer of EFI_SCSI_SENSE_DATA\r |
898 | @param SenseCounts The number of sense key\r | |
6ad55b15 | 899 | \r |
9beb888e | 900 | @retval TRUE Media is changed.\r |
901 | @retval FALSE Medit is NOT changed.\r | |
902 | **/\r | |
6ad55b15 | 903 | BOOLEAN\r |
904 | ScsiDiskIsMediaChange (\r | |
905 | IN EFI_SCSI_SENSE_DATA *SenseData,\r | |
906 | IN UINTN SenseCounts\r | |
9beb888e | 907 | );\r |
6ad55b15 | 908 | \r |
9beb888e | 909 | /**\r |
910 | Check sense key to find if reset happens.\r | |
6ad55b15 | 911 | \r |
9beb888e | 912 | @param SenseData The pointer of EFI_SCSI_SENSE_DATA\r |
913 | @param SenseCounts The number of sense key\r | |
6ad55b15 | 914 | \r |
9beb888e | 915 | @retval TRUE It is reset before.\r |
916 | @retval FALSE It is NOT reset before.\r | |
6ad55b15 | 917 | \r |
9beb888e | 918 | **/\r |
6ad55b15 | 919 | BOOLEAN\r |
920 | ScsiDiskIsResetBefore (\r | |
921 | IN EFI_SCSI_SENSE_DATA *SenseData,\r | |
922 | IN UINTN SenseCounts\r | |
9beb888e | 923 | );\r |
6ad55b15 | 924 | \r |
9beb888e | 925 | /**\r |
926 | Check sense key to find if the drive is ready.\r | |
6ad55b15 | 927 | \r |
9beb888e | 928 | @param SenseData The pointer of EFI_SCSI_SENSE_DATA\r |
929 | @param SenseCounts The number of sense key\r | |
930 | @param RetryLater The flag means if need a retry \r | |
6ad55b15 | 931 | \r |
9beb888e | 932 | @retval TRUE Drive is ready.\r |
933 | @retval FALSE Drive is NOT ready.\r | |
6ad55b15 | 934 | \r |
9beb888e | 935 | **/\r |
6ad55b15 | 936 | BOOLEAN\r |
937 | ScsiDiskIsDriveReady (\r | |
938 | IN EFI_SCSI_SENSE_DATA *SenseData,\r | |
939 | IN UINTN SenseCounts,\r | |
9beb888e | 940 | OUT BOOLEAN *RetryLater\r |
941 | );\r | |
6ad55b15 | 942 | \r |
9beb888e | 943 | /**\r |
944 | Check sense key to find if it has sense key.\r | |
6ad55b15 | 945 | \r |
9beb888e | 946 | @param SenseData - The pointer of EFI_SCSI_SENSE_DATA\r |
947 | @param SenseCounts - The number of sense key\r | |
6ad55b15 | 948 | \r |
9beb888e | 949 | @retval TRUE It has sense key.\r |
950 | @retval FALSE It has NOT any sense key.\r | |
6ad55b15 | 951 | \r |
9beb888e | 952 | **/\r |
6ad55b15 | 953 | BOOLEAN\r |
954 | ScsiDiskHaveSenseKey (\r | |
955 | IN EFI_SCSI_SENSE_DATA *SenseData,\r | |
956 | IN UINTN SenseCounts\r | |
9beb888e | 957 | );\r |
6ad55b15 | 958 | \r |
9beb888e | 959 | /**\r |
960 | Release resource about disk device.\r | |
6ad55b15 | 961 | \r |
9beb888e | 962 | @param ScsiDiskDevice The pointer of SCSI_DISK_DEV\r |
6ad55b15 | 963 | \r |
9beb888e | 964 | **/\r |
6ad55b15 | 965 | VOID\r |
966 | ReleaseScsiDiskDeviceResources (\r | |
967 | IN SCSI_DISK_DEV *ScsiDiskDevice\r | |
9beb888e | 968 | );\r |
6ad55b15 | 969 | \r |
d14faa52 | 970 | /**\r |
971 | Determine if Block Io should be produced.\r | |
972 | \r | |
973 | \r | |
d716651f | 974 | @param ChildHandle Child Handle to retrieve Parent information.\r |
d14faa52 | 975 | \r |
976 | @retval TRUE Should produce Block Io.\r | |
977 | @retval FALSE Should not produce Block Io.\r | |
978 | \r | |
979 | **/ \r | |
980 | BOOLEAN\r | |
981 | DetermineInstallBlockIo (\r | |
982 | IN EFI_HANDLE ChildHandle\r | |
983 | );\r | |
984 | \r | |
d716651f | 985 | /**\r |
986 | Initialize the installation of DiskInfo protocol.\r | |
987 | \r | |
988 | This function prepares for the installation of DiskInfo protocol on the child handle.\r | |
989 | By default, it installs DiskInfo protocol with SCSI interface GUID. If it further\r | |
990 | detects that the physical device is an ATAPI/AHCI device, it then updates interface GUID\r | |
991 | to be IDE/AHCI interface GUID.\r | |
992 | \r | |
993 | @param ScsiDiskDevice The pointer of SCSI_DISK_DEV.\r | |
994 | @param ChildHandle Child handle to install DiskInfo protocol.\r | |
995 | \r | |
996 | **/ \r | |
997 | VOID\r | |
998 | InitializeInstallDiskInfo (\r | |
999 | IN SCSI_DISK_DEV *ScsiDiskDevice,\r | |
1000 | IN EFI_HANDLE ChildHandle\r | |
1001 | ); \r | |
1002 | \r | |
d14faa52 | 1003 | /**\r |
1004 | Search protocol database and check to see if the protocol\r | |
1005 | specified by ProtocolGuid is present on a ControllerHandle and opened by\r | |
1006 | ChildHandle with an attribute of EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER.\r | |
1007 | If the ControllerHandle is found, then the protocol specified by ProtocolGuid\r | |
1008 | will be opened on it. \r | |
1009 | \r | |
1010 | \r | |
1011 | @param ProtocolGuid ProtocolGuid pointer.\r | |
1012 | @param ChildHandle Child Handle to retrieve Parent information.\r | |
1013 | \r | |
1014 | **/ \r | |
1015 | VOID *\r | |
1016 | EFIAPI\r | |
1017 | GetParentProtocol (\r | |
1018 | IN EFI_GUID *ProtocolGuid,\r | |
1019 | IN EFI_HANDLE ChildHandle\r | |
1020 | );\r | |
1021 | \r | |
6ad55b15 | 1022 | #endif\r |