]>
Commit | Line | Data |
---|---|---|
3b2dbece | 1 | /** @file\r |
2 | Header file for SCSI Disk Driver.\r | |
6ad55b15 | 3 | \r |
ac81789c | 4 | Copyright (c) 2004 - 2019, Intel Corporation. All rights reserved.<BR>\r |
52199bf5 | 5 | Copyright (c) 1985 - 2022, American Megatrends International LLC.<BR>\r |
9d510e61 | 6 | SPDX-License-Identifier: BSD-2-Clause-Patent\r |
6ad55b15 | 7 | \r |
3b2dbece | 8 | **/\r |
6ad55b15 | 9 | \r |
9beb888e | 10 | #ifndef _SCSI_DISK_H_\r |
11 | #define _SCSI_DISK_H_\r | |
6ad55b15 | 12 | \r |
9beb888e | 13 | #include <Uefi.h>\r |
14 | \r | |
9beb888e | 15 | #include <Protocol/ScsiIo.h>\r |
16 | #include <Protocol/ComponentName.h>\r | |
17 | #include <Protocol/BlockIo.h>\r | |
d670bf53 | 18 | #include <Protocol/BlockIo2.h>\r |
b6e5da19 | 19 | #include <Protocol/EraseBlock.h>\r |
9beb888e | 20 | #include <Protocol/DriverBinding.h>\r |
21 | #include <Protocol/ScsiPassThruExt.h>\r | |
d14faa52 | 22 | #include <Protocol/ScsiPassThru.h>\r |
d716651f | 23 | #include <Protocol/DiskInfo.h>\r |
ac81789c | 24 | #include <Protocol/StorageSecurityCommand.h>\r |
d716651f | 25 | \r |
9beb888e | 26 | #include <Library/DebugLib.h>\r |
27 | #include <Library/UefiDriverEntryPoint.h>\r | |
28 | #include <Library/UefiLib.h>\r | |
29 | #include <Library/BaseMemoryLib.h>\r | |
94e0fd07 | 30 | #include <Library/MemoryAllocationLib.h>\r |
ae50ee26 | 31 | #include <Library/UefiScsiLib.h>\r |
9beb888e | 32 | #include <Library/UefiBootServicesTableLib.h>\r |
d716651f | 33 | #include <Library/DevicePathLib.h>\r |
52199bf5 | 34 | #include <Library/PrintLib.h>\r |
9beb888e | 35 | \r |
9cb8724d | 36 | #include <IndustryStandard/Scsi.h>\r |
d716651f | 37 | #include <IndustryStandard/Atapi.h>\r |
6ad55b15 | 38 | \r |
1436aea4 | 39 | #define IS_DEVICE_FIXED(a) (a)->FixedDevice ? 1 : 0\r |
6ad55b15 | 40 | \r |
1436aea4 | 41 | #define IS_ALIGNED(addr, size) (((UINTN) (addr) & (size - 1)) == 0)\r |
ac81789c | 42 | \r |
1436aea4 | 43 | #define UFS_WLUN_RPMB 0xC4\r |
ac81789c | 44 | \r |
b6e5da19 | 45 | typedef struct {\r |
1436aea4 MK |
46 | UINT32 MaxLbaCnt;\r |
47 | UINT32 MaxBlkDespCnt;\r | |
48 | UINT32 GranularityAlignment;\r | |
b6e5da19 HW |
49 | } SCSI_UNMAP_PARAM_INFO;\r |
50 | \r | |
1436aea4 | 51 | #define SCSI_DISK_DEV_SIGNATURE SIGNATURE_32 ('s', 'c', 'd', 'k')\r |
6ad55b15 | 52 | \r |
53 | typedef struct {\r | |
1436aea4 | 54 | UINT32 Signature;\r |
6ad55b15 | 55 | \r |
1436aea4 | 56 | EFI_HANDLE Handle;\r |
6ad55b15 | 57 | \r |
1436aea4 | 58 | EFI_STORAGE_SECURITY_COMMAND_PROTOCOL StorageSecurity;\r |
ac81789c | 59 | \r |
1436aea4 MK |
60 | EFI_BLOCK_IO_PROTOCOL BlkIo;\r |
61 | EFI_BLOCK_IO2_PROTOCOL BlkIo2;\r | |
62 | EFI_BLOCK_IO_MEDIA BlkIoMedia;\r | |
63 | EFI_ERASE_BLOCK_PROTOCOL EraseBlock;\r | |
64 | EFI_SCSI_IO_PROTOCOL *ScsiIo;\r | |
65 | UINT8 DeviceType;\r | |
66 | BOOLEAN FixedDevice;\r | |
67 | UINT16 Reserved;\r | |
6ad55b15 | 68 | \r |
1436aea4 MK |
69 | EFI_SCSI_SENSE_DATA *SenseData;\r |
70 | UINTN SenseDataNumber;\r | |
71 | EFI_SCSI_INQUIRY_DATA InquiryData;\r | |
6ad55b15 | 72 | \r |
1436aea4 | 73 | EFI_UNICODE_STRING_TABLE *ControllerNameTable;\r |
6ad55b15 | 74 | \r |
1436aea4 | 75 | EFI_DISK_INFO_PROTOCOL DiskInfo;\r |
d716651f | 76 | \r |
77 | //\r | |
78 | // The following fields are only valid for ATAPI/SATA device\r | |
79 | //\r | |
1436aea4 MK |
80 | UINT32 Channel;\r |
81 | UINT32 Device;\r | |
82 | ATAPI_IDENTIFY_DATA IdentifyData;\r | |
b6e5da19 HW |
83 | \r |
84 | //\r | |
85 | // Scsi UNMAP command parameters information\r | |
86 | //\r | |
1436aea4 MK |
87 | SCSI_UNMAP_PARAM_INFO UnmapInfo;\r |
88 | BOOLEAN BlockLimitsVpdSupported;\r | |
d1102dba | 89 | \r |
f95bc048 | 90 | //\r |
91 | // The flag indicates if 16-byte command can be used\r | |
92 | //\r | |
1436aea4 | 93 | BOOLEAN Cdb16Byte;\r |
d670bf53 HW |
94 | \r |
95 | //\r | |
b6e5da19 | 96 | // The queue for asynchronous task requests\r |
d670bf53 | 97 | //\r |
1436aea4 | 98 | LIST_ENTRY AsyncTaskQueue;\r |
6ad55b15 | 99 | } SCSI_DISK_DEV;\r |
100 | \r | |
1436aea4 MK |
101 | #define SCSI_DISK_DEV_FROM_BLKIO(a) CR (a, SCSI_DISK_DEV, BlkIo, SCSI_DISK_DEV_SIGNATURE)\r |
102 | #define SCSI_DISK_DEV_FROM_BLKIO2(a) CR (a, SCSI_DISK_DEV, BlkIo2, SCSI_DISK_DEV_SIGNATURE)\r | |
b6e5da19 | 103 | #define SCSI_DISK_DEV_FROM_ERASEBLK(a) CR (a, SCSI_DISK_DEV, EraseBlock, SCSI_DISK_DEV_SIGNATURE)\r |
1436aea4 | 104 | #define SCSI_DISK_DEV_FROM_STORSEC(a) CR (a, SCSI_DISK_DEV, StorageSecurity, SCSI_DISK_DEV_SIGNATURE)\r |
6ad55b15 | 105 | \r |
1436aea4 | 106 | #define SCSI_DISK_DEV_FROM_DISKINFO(a) CR (a, SCSI_DISK_DEV, DiskInfo, SCSI_DISK_DEV_SIGNATURE)\r |
d716651f | 107 | \r |
d670bf53 HW |
108 | //\r |
109 | // Asynchronous I/O request\r | |
110 | //\r | |
111 | //\r | |
112 | // Private data structure for a BlockIo2 request\r | |
113 | //\r | |
114 | typedef struct {\r | |
1436aea4 | 115 | EFI_BLOCK_IO2_TOKEN *Token;\r |
d670bf53 | 116 | //\r |
a717086c HW |
117 | // The flag indicates if the last Scsi Read/Write sub-task for a BlockIo2\r |
118 | // request is sent to device\r | |
119 | //\r | |
1436aea4 | 120 | BOOLEAN LastScsiRW;\r |
a717086c HW |
121 | \r |
122 | //\r | |
123 | // The queue for Scsi Read/Write sub-tasks of a BlockIo2 request\r | |
d670bf53 | 124 | //\r |
1436aea4 | 125 | LIST_ENTRY ScsiRWQueue;\r |
d670bf53 | 126 | \r |
1436aea4 | 127 | LIST_ENTRY Link;\r |
d670bf53 HW |
128 | } SCSI_BLKIO2_REQUEST;\r |
129 | \r | |
130 | //\r | |
131 | // Private data structure for a SCSI Read/Write request\r | |
132 | //\r | |
133 | typedef struct {\r | |
1436aea4 MK |
134 | SCSI_DISK_DEV *ScsiDiskDevice;\r |
135 | UINT64 Timeout;\r | |
136 | EFI_SCSI_SENSE_DATA *SenseData;\r | |
137 | UINT8 SenseDataLength;\r | |
138 | UINT8 HostAdapterStatus;\r | |
139 | UINT8 TargetStatus;\r | |
140 | UINT8 *InBuffer;\r | |
141 | UINT8 *OutBuffer;\r | |
142 | UINT32 DataLength;\r | |
143 | UINT64 StartLba;\r | |
144 | UINT32 SectorCount;\r | |
145 | UINT8 TimesRetry;\r | |
d670bf53 HW |
146 | \r |
147 | //\r | |
148 | // The BlockIo2 request this SCSI command belongs to\r | |
149 | //\r | |
1436aea4 | 150 | SCSI_BLKIO2_REQUEST *BlkIo2Req;\r |
d670bf53 | 151 | \r |
1436aea4 | 152 | LIST_ENTRY Link;\r |
d670bf53 HW |
153 | } SCSI_ASYNC_RW_REQUEST;\r |
154 | \r | |
b6e5da19 HW |
155 | //\r |
156 | // Private data structure for an EraseBlock request\r | |
157 | //\r | |
158 | typedef struct {\r | |
1436aea4 | 159 | EFI_ERASE_BLOCK_TOKEN *Token;\r |
b6e5da19 | 160 | \r |
1436aea4 | 161 | EFI_SCSI_IO_SCSI_REQUEST_PACKET CommandPacket;\r |
b6e5da19 | 162 | \r |
1436aea4 | 163 | LIST_ENTRY Link;\r |
b6e5da19 HW |
164 | } SCSI_ERASEBLK_REQUEST;\r |
165 | \r | |
6ad55b15 | 166 | //\r |
167 | // Global Variables\r | |
168 | //\r | |
70da5bc2 | 169 | extern EFI_DRIVER_BINDING_PROTOCOL gScsiDiskDriverBinding;\r |
170 | extern EFI_COMPONENT_NAME_PROTOCOL gScsiDiskComponentName;\r | |
171 | extern EFI_COMPONENT_NAME2_PROTOCOL gScsiDiskComponentName2;\r | |
6ad55b15 | 172 | //\r |
173 | // action code used in detect media process\r | |
174 | //\r | |
1436aea4 MK |
175 | #define ACTION_NO_ACTION 0x00\r |
176 | #define ACTION_READ_CAPACITY 0x01\r | |
177 | #define ACTION_RETRY_COMMAND_LATER 0x02\r | |
178 | #define ACTION_RETRY_WITH_BACKOFF_ALGO 0x03\r | |
6ad55b15 | 179 | \r |
1436aea4 MK |
180 | #define SCSI_COMMAND_VERSION_1 0x01\r |
181 | #define SCSI_COMMAND_VERSION_2 0x02\r | |
182 | #define SCSI_COMMAND_VERSION_3 0x03\r | |
b96cd313 | 183 | \r |
52199bf5 CG |
184 | // Per SCSI spec, EFI_SCSI_INQUIRY_DATA.Reserved_5_95[3 - 10] has the Vendor identification\r |
185 | // EFI_SCSI_INQUIRY_DATA.Reserved_5_95[11 - 26] has the product identification\r | |
186 | #define VENDOR_IDENTIFICATION_OFFSET 3\r | |
187 | #define VENDOR_IDENTIFICATION_LENGTH 8\r | |
188 | #define PRODUCT_IDENTIFICATION_OFFSET 11\r | |
189 | #define PRODUCT_IDENTIFICATION_LENGTH 16\r | |
190 | \r | |
3cc033c5 FT |
191 | //\r |
192 | // SCSI Disk Timeout Experience Value\r | |
193 | //\r | |
cc530cd1 | 194 | // As ScsiDisk and ScsiBus driver are used to manage SCSI or ATAPI devices, the timeout\r |
1d3fa1bd FT |
195 | // value is updated to 30s to follow ATA/ATAPI spec in which the device may take up to 30s\r |
196 | // to respond command.\r | |
197 | //\r | |
1436aea4 | 198 | #define SCSI_DISK_TIMEOUT EFI_TIMER_PERIOD_SECONDS (30)\r |
b96cd313 | 199 | \r |
9beb888e | 200 | /**\r |
201 | Test to see if this driver supports ControllerHandle.\r | |
202 | \r | |
203 | This service is called by the EFI boot service ConnectController(). In order\r | |
204 | to make drivers as small as possible, there are a few calling restrictions for\r | |
205 | this service. ConnectController() must follow these calling restrictions.\r | |
206 | If any other agent wishes to call Supported() it must also follow these\r | |
207 | calling restrictions.\r | |
208 | \r | |
209 | @param This Protocol instance pointer.\r | |
210 | @param ControllerHandle Handle of device to test\r | |
211 | @param RemainingDevicePath Optional parameter use to pick a specific child\r | |
212 | device to start.\r | |
213 | \r | |
214 | @retval EFI_SUCCESS This driver supports this device\r | |
215 | @retval EFI_ALREADY_STARTED This driver is already running on this device\r | |
216 | @retval other This driver does not support this device\r | |
217 | \r | |
218 | **/\r | |
6ad55b15 | 219 | EFI_STATUS\r |
220 | EFIAPI\r | |
221 | ScsiDiskDriverBindingSupported (\r | |
222 | IN EFI_DRIVER_BINDING_PROTOCOL *This,\r | |
223 | IN EFI_HANDLE Controller,\r | |
9beb888e | 224 | IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL\r |
6ad55b15 | 225 | );\r |
226 | \r | |
9beb888e | 227 | /**\r |
228 | Start this driver on ControllerHandle.\r | |
229 | \r | |
230 | This service is called by the EFI boot service ConnectController(). In order\r | |
231 | to make drivers as small as possible, there are a few calling restrictions for\r | |
232 | this service. ConnectController() must follow these calling restrictions. If\r | |
233 | any other agent wishes to call Start() it must also follow these calling\r | |
234 | restrictions.\r | |
235 | \r | |
236 | @param This Protocol instance pointer.\r | |
237 | @param ControllerHandle Handle of device to bind driver to\r | |
238 | @param RemainingDevicePath Optional parameter use to pick a specific child\r | |
239 | device to start.\r | |
240 | \r | |
241 | @retval EFI_SUCCESS This driver is added to ControllerHandle\r | |
242 | @retval EFI_ALREADY_STARTED This driver is already running on ControllerHandle\r | |
243 | @retval other This driver does not support this device\r | |
244 | \r | |
245 | **/\r | |
6ad55b15 | 246 | EFI_STATUS\r |
247 | EFIAPI\r | |
248 | ScsiDiskDriverBindingStart (\r | |
249 | IN EFI_DRIVER_BINDING_PROTOCOL *This,\r | |
250 | IN EFI_HANDLE Controller,\r | |
9beb888e | 251 | IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL\r |
6ad55b15 | 252 | );\r |
253 | \r | |
9beb888e | 254 | /**\r |
255 | Stop this driver on ControllerHandle.\r | |
256 | \r | |
257 | This service is called by the EFI boot service DisconnectController().\r | |
258 | In order to make drivers as small as possible, there are a few calling\r | |
259 | restrictions for this service. DisconnectController() must follow these\r | |
260 | calling restrictions. If any other agent wishes to call Stop() it must\r | |
261 | also follow these calling restrictions.\r | |
d1102dba | 262 | \r |
9beb888e | 263 | @param This Protocol instance pointer.\r |
264 | @param ControllerHandle Handle of device to stop driver on\r | |
265 | @param NumberOfChildren Number of Handles in ChildHandleBuffer. If number of\r | |
266 | children is zero stop the entire bus driver.\r | |
267 | @param ChildHandleBuffer List of Child Handles to Stop.\r | |
268 | \r | |
269 | @retval EFI_SUCCESS This driver is removed ControllerHandle\r | |
270 | @retval other This driver was not removed from this device\r | |
271 | \r | |
272 | **/\r | |
6ad55b15 | 273 | EFI_STATUS\r |
274 | EFIAPI\r | |
275 | ScsiDiskDriverBindingStop (\r | |
1436aea4 MK |
276 | IN EFI_DRIVER_BINDING_PROTOCOL *This,\r |
277 | IN EFI_HANDLE Controller,\r | |
278 | IN UINTN NumberOfChildren,\r | |
279 | IN EFI_HANDLE *ChildHandleBuffer OPTIONAL\r | |
6ad55b15 | 280 | );\r |
281 | \r | |
282 | //\r | |
283 | // EFI Component Name Functions\r | |
284 | //\r | |
1436aea4 | 285 | \r |
70da5bc2 | 286 | /**\r |
287 | Retrieves a Unicode string that is the user readable name of the driver.\r | |
288 | \r | |
289 | This function retrieves the user readable name of a driver in the form of a\r | |
290 | Unicode string. If the driver specified by This has a user readable name in\r | |
291 | the language specified by Language, then a pointer to the driver name is\r | |
292 | returned in DriverName, and EFI_SUCCESS is returned. If the driver specified\r | |
293 | by This does not support the language specified by Language,\r | |
294 | then EFI_UNSUPPORTED is returned.\r | |
295 | \r | |
9beb888e | 296 | @param This A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or\r |
70da5bc2 | 297 | EFI_COMPONENT_NAME_PROTOCOL instance.\r |
298 | \r | |
9beb888e | 299 | @param Language A pointer to a Null-terminated ASCII string\r |
70da5bc2 | 300 | array indicating the language. This is the\r |
301 | language of the driver name that the caller is\r | |
302 | requesting, and it must match one of the\r | |
303 | languages specified in SupportedLanguages. The\r | |
304 | number of languages supported by a driver is up\r | |
305 | to the driver writer. Language is specified\r | |
0254efc0 | 306 | in RFC 4646 or ISO 639-2 language code format.\r |
70da5bc2 | 307 | \r |
9beb888e | 308 | @param DriverName A pointer to the Unicode string to return.\r |
70da5bc2 | 309 | This Unicode string is the name of the\r |
310 | driver specified by This in the language\r | |
311 | specified by Language.\r | |
312 | \r | |
313 | @retval EFI_SUCCESS The Unicode string for the Driver specified by\r | |
314 | This and the language specified by Language was\r | |
315 | returned in DriverName.\r | |
316 | \r | |
317 | @retval EFI_INVALID_PARAMETER Language is NULL.\r | |
318 | \r | |
319 | @retval EFI_INVALID_PARAMETER DriverName is NULL.\r | |
320 | \r | |
321 | @retval EFI_UNSUPPORTED The driver specified by This does not support\r | |
322 | the language specified by Language.\r | |
323 | \r | |
324 | **/\r | |
6ad55b15 | 325 | EFI_STATUS\r |
326 | EFIAPI\r | |
327 | ScsiDiskComponentNameGetDriverName (\r | |
328 | IN EFI_COMPONENT_NAME_PROTOCOL *This,\r | |
329 | IN CHAR8 *Language,\r | |
330 | OUT CHAR16 **DriverName\r | |
331 | );\r | |
332 | \r | |
70da5bc2 | 333 | /**\r |
334 | Retrieves a Unicode string that is the user readable name of the controller\r | |
335 | that is being managed by a driver.\r | |
336 | \r | |
337 | This function retrieves the user readable name of the controller specified by\r | |
338 | ControllerHandle and ChildHandle in the form of a Unicode string. If the\r | |
339 | driver specified by This has a user readable name in the language specified by\r | |
340 | Language, then a pointer to the controller name is returned in ControllerName,\r | |
341 | and EFI_SUCCESS is returned. If the driver specified by This is not currently\r | |
342 | managing the controller specified by ControllerHandle and ChildHandle,\r | |
343 | then EFI_UNSUPPORTED is returned. If the driver specified by This does not\r | |
344 | support the language specified by Language, then EFI_UNSUPPORTED is returned.\r | |
345 | \r | |
9beb888e | 346 | @param This A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or\r |
70da5bc2 | 347 | EFI_COMPONENT_NAME_PROTOCOL instance.\r |
348 | \r | |
9beb888e | 349 | @param ControllerHandle The handle of a controller that the driver\r |
70da5bc2 | 350 | specified by This is managing. This handle\r |
351 | specifies the controller whose name is to be\r | |
352 | returned.\r | |
353 | \r | |
9beb888e | 354 | @param ChildHandle The handle of the child controller to retrieve\r |
70da5bc2 | 355 | the name of. This is an optional parameter that\r |
356 | may be NULL. It will be NULL for device\r | |
357 | drivers. It will also be NULL for a bus drivers\r | |
358 | that wish to retrieve the name of the bus\r | |
359 | controller. It will not be NULL for a bus\r | |
360 | driver that wishes to retrieve the name of a\r | |
361 | child controller.\r | |
362 | \r | |
9beb888e | 363 | @param Language A pointer to a Null-terminated ASCII string\r |
70da5bc2 | 364 | array indicating the language. This is the\r |
365 | language of the driver name that the caller is\r | |
366 | requesting, and it must match one of the\r | |
367 | languages specified in SupportedLanguages. The\r | |
368 | number of languages supported by a driver is up\r | |
369 | to the driver writer. Language is specified in\r | |
0254efc0 | 370 | RFC 4646 or ISO 639-2 language code format.\r |
70da5bc2 | 371 | \r |
9beb888e | 372 | @param ControllerName A pointer to the Unicode string to return.\r |
70da5bc2 | 373 | This Unicode string is the name of the\r |
374 | controller specified by ControllerHandle and\r | |
375 | ChildHandle in the language specified by\r | |
376 | Language from the point of view of the driver\r | |
377 | specified by This.\r | |
378 | \r | |
379 | @retval EFI_SUCCESS The Unicode string for the user readable name in\r | |
380 | the language specified by Language for the\r | |
381 | driver specified by This was returned in\r | |
382 | DriverName.\r | |
383 | \r | |
284ee2e8 | 384 | @retval EFI_INVALID_PARAMETER ControllerHandle is NULL.\r |
70da5bc2 | 385 | \r |
386 | @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid\r | |
387 | EFI_HANDLE.\r | |
388 | \r | |
389 | @retval EFI_INVALID_PARAMETER Language is NULL.\r | |
390 | \r | |
391 | @retval EFI_INVALID_PARAMETER ControllerName is NULL.\r | |
392 | \r | |
393 | @retval EFI_UNSUPPORTED The driver specified by This is not currently\r | |
394 | managing the controller specified by\r | |
395 | ControllerHandle and ChildHandle.\r | |
396 | \r | |
397 | @retval EFI_UNSUPPORTED The driver specified by This does not support\r | |
398 | the language specified by Language.\r | |
399 | \r | |
400 | **/\r | |
6ad55b15 | 401 | EFI_STATUS\r |
402 | EFIAPI\r | |
403 | ScsiDiskComponentNameGetControllerName (\r | |
1436aea4 MK |
404 | IN EFI_COMPONENT_NAME_PROTOCOL *This,\r |
405 | IN EFI_HANDLE ControllerHandle,\r | |
406 | IN EFI_HANDLE ChildHandle OPTIONAL,\r | |
407 | IN CHAR8 *Language,\r | |
408 | OUT CHAR16 **ControllerName\r | |
6ad55b15 | 409 | );\r |
410 | \r | |
9beb888e | 411 | /**\r |
412 | Reset SCSI Disk.\r | |
413 | \r | |
414 | \r | |
415 | @param This The pointer of EFI_BLOCK_IO_PROTOCOL\r | |
416 | @param ExtendedVerification The flag about if extend verificate\r | |
70da5bc2 | 417 | \r |
9beb888e | 418 | @retval EFI_SUCCESS The device was reset.\r |
419 | @retval EFI_DEVICE_ERROR The device is not functioning properly and could\r | |
420 | not be reset.\r | |
cc530cd1 | 421 | @return EFI_STATUS is returned from EFI_SCSI_IO_PROTOCOL.ResetDevice().\r |
9beb888e | 422 | \r |
423 | **/\r | |
6ad55b15 | 424 | EFI_STATUS\r |
425 | EFIAPI\r | |
426 | ScsiDiskReset (\r | |
1436aea4 MK |
427 | IN EFI_BLOCK_IO_PROTOCOL *This,\r |
428 | IN BOOLEAN ExtendedVerification\r | |
9beb888e | 429 | );\r |
6ad55b15 | 430 | \r |
9beb888e | 431 | /**\r |
432 | The function is to Read Block from SCSI Disk.\r | |
6ad55b15 | 433 | \r |
9beb888e | 434 | @param This The pointer of EFI_BLOCK_IO_PROTOCOL.\r |
435 | @param MediaId The Id of Media detected\r | |
436 | @param Lba The logic block address\r | |
437 | @param BufferSize The size of Buffer\r | |
438 | @param Buffer The buffer to fill the read out data\r | |
6ad55b15 | 439 | \r |
9beb888e | 440 | @retval EFI_SUCCESS Successfully to read out block.\r |
441 | @retval EFI_DEVICE_ERROR Fail to detect media.\r | |
442 | @retval EFI_NO_MEDIA Media is not present.\r | |
443 | @retval EFI_MEDIA_CHANGED Media has changed.\r | |
444 | @retval EFI_BAD_BUFFER_SIZE The Buffer was not a multiple of the block size of the device.\r | |
445 | @retval EFI_INVALID_PARAMETER Invalid parameter passed in.\r | |
6ad55b15 | 446 | \r |
9beb888e | 447 | **/\r |
6ad55b15 | 448 | EFI_STATUS\r |
449 | EFIAPI\r | |
450 | ScsiDiskReadBlocks (\r | |
1436aea4 MK |
451 | IN EFI_BLOCK_IO_PROTOCOL *This,\r |
452 | IN UINT32 MediaId,\r | |
453 | IN EFI_LBA Lba,\r | |
454 | IN UINTN BufferSize,\r | |
455 | OUT VOID *Buffer\r | |
9beb888e | 456 | );\r |
6ad55b15 | 457 | \r |
9beb888e | 458 | /**\r |
459 | The function is to Write Block to SCSI Disk.\r | |
460 | \r | |
461 | @param This The pointer of EFI_BLOCK_IO_PROTOCOL\r | |
462 | @param MediaId The Id of Media detected\r | |
463 | @param Lba The logic block address\r | |
464 | @param BufferSize The size of Buffer\r | |
465 | @param Buffer The buffer to fill the read out data\r | |
466 | \r | |
467 | @retval EFI_SUCCESS Successfully to read out block.\r | |
468 | @retval EFI_WRITE_PROTECTED The device can not be written to.\r | |
469 | @retval EFI_DEVICE_ERROR Fail to detect media.\r | |
470 | @retval EFI_NO_MEDIA Media is not present.\r | |
cc530cd1 | 471 | @retval EFI_MEDIA_CHANGED Media has changed.\r |
9beb888e | 472 | @retval EFI_BAD_BUFFER_SIZE The Buffer was not a multiple of the block size of the device.\r |
473 | @retval EFI_INVALID_PARAMETER Invalid parameter passed in.\r | |
6ad55b15 | 474 | \r |
9beb888e | 475 | **/\r |
6ad55b15 | 476 | EFI_STATUS\r |
477 | EFIAPI\r | |
478 | ScsiDiskWriteBlocks (\r | |
1436aea4 MK |
479 | IN EFI_BLOCK_IO_PROTOCOL *This,\r |
480 | IN UINT32 MediaId,\r | |
481 | IN EFI_LBA Lba,\r | |
482 | IN UINTN BufferSize,\r | |
483 | IN VOID *Buffer\r | |
9beb888e | 484 | );\r |
6ad55b15 | 485 | \r |
9beb888e | 486 | /**\r |
487 | Flush Block to Disk.\r | |
6ad55b15 | 488 | \r |
9beb888e | 489 | EFI_SUCCESS is returned directly.\r |
6ad55b15 | 490 | \r |
9beb888e | 491 | @param This The pointer of EFI_BLOCK_IO_PROTOCOL\r |
6ad55b15 | 492 | \r |
9beb888e | 493 | @retval EFI_SUCCESS All outstanding data was written to the device\r |
6ad55b15 | 494 | \r |
9beb888e | 495 | **/\r |
6ad55b15 | 496 | EFI_STATUS\r |
497 | EFIAPI\r | |
498 | ScsiDiskFlushBlocks (\r | |
1436aea4 | 499 | IN EFI_BLOCK_IO_PROTOCOL *This\r |
9beb888e | 500 | );\r |
6ad55b15 | 501 | \r |
d670bf53 HW |
502 | /**\r |
503 | Reset SCSI Disk.\r | |
504 | \r | |
505 | @param This The pointer of EFI_BLOCK_IO2_PROTOCOL.\r | |
506 | @param ExtendedVerification The flag about if extend verificate.\r | |
507 | \r | |
508 | @retval EFI_SUCCESS The device was reset.\r | |
509 | @retval EFI_DEVICE_ERROR The device is not functioning properly and could\r | |
510 | not be reset.\r | |
511 | @return EFI_STATUS is returned from EFI_SCSI_IO_PROTOCOL.ResetDevice().\r | |
512 | \r | |
513 | **/\r | |
514 | EFI_STATUS\r | |
515 | EFIAPI\r | |
516 | ScsiDiskResetEx (\r | |
517 | IN EFI_BLOCK_IO2_PROTOCOL *This,\r | |
518 | IN BOOLEAN ExtendedVerification\r | |
519 | );\r | |
520 | \r | |
521 | /**\r | |
522 | The function is to Read Block from SCSI Disk.\r | |
523 | \r | |
524 | @param This The pointer of EFI_BLOCK_IO_PROTOCOL.\r | |
525 | @param MediaId The Id of Media detected.\r | |
526 | @param Lba The logic block address.\r | |
527 | @param Token A pointer to the token associated with the transaction.\r | |
528 | @param BufferSize The size of Buffer.\r | |
529 | @param Buffer The buffer to fill the read out data.\r | |
530 | \r | |
531 | @retval EFI_SUCCESS The read request was queued if Token-> Event is\r | |
532 | not NULL. The data was read correctly from the\r | |
533 | device if theToken-> Event is NULL.\r | |
534 | @retval EFI_DEVICE_ERROR The device reported an error while attempting\r | |
535 | to perform the read operation.\r | |
536 | @retval EFI_NO_MEDIA There is no media in the device.\r | |
537 | @retval EFI_MEDIA_CHANGED The MediaId is not for the current media.\r | |
538 | @retval EFI_BAD_BUFFER_SIZE The BufferSize parameter is not a multiple of\r | |
539 | the intrinsic block size of the device.\r | |
540 | @retval EFI_INVALID_PARAMETER The read request contains LBAs that are not\r | |
541 | valid, or the buffer is not on proper\r | |
542 | alignment.\r | |
543 | @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a\r | |
544 | lack of resources.\r | |
545 | \r | |
546 | **/\r | |
547 | EFI_STATUS\r | |
548 | EFIAPI\r | |
549 | ScsiDiskReadBlocksEx (\r | |
1436aea4 MK |
550 | IN EFI_BLOCK_IO2_PROTOCOL *This,\r |
551 | IN UINT32 MediaId,\r | |
552 | IN EFI_LBA Lba,\r | |
553 | IN OUT EFI_BLOCK_IO2_TOKEN *Token,\r | |
554 | IN UINTN BufferSize,\r | |
555 | OUT VOID *Buffer\r | |
d670bf53 HW |
556 | );\r |
557 | \r | |
558 | /**\r | |
559 | The function is to Write Block to SCSI Disk.\r | |
560 | \r | |
561 | @param This The pointer of EFI_BLOCK_IO_PROTOCOL.\r | |
562 | @param MediaId The Id of Media detected.\r | |
563 | @param Lba The logic block address.\r | |
564 | @param Token A pointer to the token associated with the transaction.\r | |
565 | @param BufferSize The size of Buffer.\r | |
566 | @param Buffer The buffer to fill the read out data.\r | |
567 | \r | |
568 | @retval EFI_SUCCESS The data were written correctly to the device.\r | |
569 | @retval EFI_WRITE_PROTECTED The device cannot be written to.\r | |
570 | @retval EFI_NO_MEDIA There is no media in the device.\r | |
571 | @retval EFI_MEDIA_CHANGED The MediaId is not for the current media.\r | |
572 | @retval EFI_DEVICE_ERROR The device reported an error while attempting\r | |
573 | to perform the write operation.\r | |
574 | @retval EFI_BAD_BUFFER_SIZE The BufferSize parameter is not a multiple of\r | |
575 | the intrinsic block size of the device.\r | |
576 | @retval EFI_INVALID_PARAMETER The write request contains LBAs that are not\r | |
577 | valid, or the buffer is not on proper\r | |
578 | alignment.\r | |
579 | \r | |
580 | **/\r | |
581 | EFI_STATUS\r | |
582 | EFIAPI\r | |
583 | ScsiDiskWriteBlocksEx (\r | |
1436aea4 MK |
584 | IN EFI_BLOCK_IO2_PROTOCOL *This,\r |
585 | IN UINT32 MediaId,\r | |
586 | IN EFI_LBA Lba,\r | |
587 | IN OUT EFI_BLOCK_IO2_TOKEN *Token,\r | |
588 | IN UINTN BufferSize,\r | |
589 | IN VOID *Buffer\r | |
d670bf53 HW |
590 | );\r |
591 | \r | |
592 | /**\r | |
593 | Flush the Block Device.\r | |
594 | \r | |
595 | @param This Indicates a pointer to the calling context.\r | |
596 | @param Token A pointer to the token associated with the transaction.\r | |
597 | \r | |
7013e088 HW |
598 | @retval EFI_SUCCESS All outstanding data was written to the device.\r |
599 | @retval EFI_DEVICE_ERROR The device reported an error while attempting to\r | |
600 | write data.\r | |
601 | @retval EFI_WRITE_PROTECTED The device cannot be written to.\r | |
602 | @retval EFI_NO_MEDIA There is no media in the device.\r | |
603 | @retval EFI_MEDIA_CHANGED The MediaId is not for the current media.\r | |
d670bf53 HW |
604 | \r |
605 | **/\r | |
606 | EFI_STATUS\r | |
607 | EFIAPI\r | |
608 | ScsiDiskFlushBlocksEx (\r | |
609 | IN EFI_BLOCK_IO2_PROTOCOL *This,\r | |
610 | IN OUT EFI_BLOCK_IO2_TOKEN *Token\r | |
611 | );\r | |
612 | \r | |
b6e5da19 HW |
613 | /**\r |
614 | Erase a specified number of device blocks.\r | |
615 | \r | |
616 | @param[in] This Indicates a pointer to the calling context.\r | |
617 | @param[in] MediaId The media ID that the erase request is for.\r | |
618 | @param[in] Lba The starting logical block address to be\r | |
619 | erased. The caller is responsible for erasing\r | |
620 | only legitimate locations.\r | |
621 | @param[in, out] Token A pointer to the token associated with the\r | |
622 | transaction.\r | |
623 | @param[in] Size The size in bytes to be erased. This must be\r | |
624 | a multiple of the physical block size of the\r | |
625 | device.\r | |
626 | \r | |
627 | @retval EFI_SUCCESS The erase request was queued if Event is not\r | |
628 | NULL. The data was erased correctly to the\r | |
629 | device if the Event is NULL.to the device.\r | |
630 | @retval EFI_WRITE_PROTECTED The device cannot be erased due to write\r | |
631 | protection.\r | |
632 | @retval EFI_DEVICE_ERROR The device reported an error while attempting\r | |
633 | to perform the erase operation.\r | |
634 | @retval EFI_INVALID_PARAMETER The erase request contains LBAs that are not\r | |
635 | valid.\r | |
636 | @retval EFI_NO_MEDIA There is no media in the device.\r | |
637 | @retval EFI_MEDIA_CHANGED The MediaId is not for the current media.\r | |
638 | \r | |
639 | **/\r | |
640 | EFI_STATUS\r | |
641 | EFIAPI\r | |
642 | ScsiDiskEraseBlocks (\r | |
1436aea4 MK |
643 | IN EFI_ERASE_BLOCK_PROTOCOL *This,\r |
644 | IN UINT32 MediaId,\r | |
645 | IN EFI_LBA Lba,\r | |
646 | IN OUT EFI_ERASE_BLOCK_TOKEN *Token,\r | |
647 | IN UINTN Size\r | |
b6e5da19 HW |
648 | );\r |
649 | \r | |
ac81789c CZ |
650 | /**\r |
651 | Send a security protocol command to a device that receives data and/or the result\r | |
652 | of one or more commands sent by SendData.\r | |
653 | \r | |
654 | The ReceiveData function sends a security protocol command to the given MediaId.\r | |
655 | The security protocol command sent is defined by SecurityProtocolId and contains\r | |
656 | the security protocol specific data SecurityProtocolSpecificData. The function\r | |
657 | returns the data from the security protocol command in PayloadBuffer.\r | |
658 | \r | |
659 | For devices supporting the SCSI command set, the security protocol command is sent\r | |
660 | using the SECURITY PROTOCOL IN command defined in SPC-4.\r | |
661 | \r | |
662 | If PayloadBufferSize is too small to store the available data from the security\r | |
663 | protocol command, the function shall copy PayloadBufferSize bytes into the\r | |
664 | PayloadBuffer and return EFI_WARN_BUFFER_TOO_SMALL.\r | |
665 | \r | |
666 | If PayloadBuffer or PayloadTransferSize is NULL and PayloadBufferSize is non-zero,\r | |
667 | the function shall return EFI_INVALID_PARAMETER.\r | |
668 | \r | |
669 | If the given MediaId does not support security protocol commands, the function shall\r | |
670 | return EFI_UNSUPPORTED. If there is no media in the device, the function returns\r | |
671 | EFI_NO_MEDIA. If the MediaId is not the ID for the current media in the device,\r | |
672 | the function returns EFI_MEDIA_CHANGED.\r | |
673 | \r | |
674 | If the security protocol fails to complete within the Timeout period, the function\r | |
675 | shall return EFI_TIMEOUT.\r | |
676 | \r | |
677 | If the security protocol command completes without an error, the function shall\r | |
678 | return EFI_SUCCESS. If the security protocol command completes with an error, the\r | |
679 | function shall return EFI_DEVICE_ERROR.\r | |
680 | \r | |
681 | @param This Indicates a pointer to the calling context.\r | |
682 | @param MediaId ID of the medium to receive data from.\r | |
683 | @param Timeout The timeout, in 100ns units, to use for the execution\r | |
684 | of the security protocol command. A Timeout value of 0\r | |
685 | means that this function will wait indefinitely for the\r | |
686 | security protocol command to execute. If Timeout is greater\r | |
687 | than zero, then this function will return EFI_TIMEOUT if the\r | |
688 | time required to execute the receive data command is greater than Timeout.\r | |
689 | @param SecurityProtocolId The value of the "Security Protocol" parameter of\r | |
690 | the security protocol command to be sent.\r | |
691 | @param SecurityProtocolSpecificData The value of the "Security Protocol Specific" parameter\r | |
692 | of the security protocol command to be sent.\r | |
693 | @param PayloadBufferSize Size in bytes of the payload data buffer.\r | |
694 | @param PayloadBuffer A pointer to a destination buffer to store the security\r | |
695 | protocol command specific payload data for the security\r | |
696 | protocol command. The caller is responsible for having\r | |
697 | either implicit or explicit ownership of the buffer.\r | |
698 | @param PayloadTransferSize A pointer to a buffer to store the size in bytes of the\r | |
699 | data written to the payload data buffer.\r | |
700 | \r | |
701 | @retval EFI_SUCCESS The security protocol command completed successfully.\r | |
702 | @retval EFI_WARN_BUFFER_TOO_SMALL The PayloadBufferSize was too small to store the available\r | |
703 | data from the device. The PayloadBuffer contains the truncated data.\r | |
704 | @retval EFI_UNSUPPORTED The given MediaId does not support security protocol commands.\r | |
705 | @retval EFI_DEVICE_ERROR The security protocol command completed with an error.\r | |
706 | @retval EFI_NO_MEDIA There is no media in the device.\r | |
707 | @retval EFI_MEDIA_CHANGED The MediaId is not for the current media.\r | |
708 | @retval EFI_INVALID_PARAMETER The PayloadBuffer or PayloadTransferSize is NULL and\r | |
709 | PayloadBufferSize is non-zero.\r | |
710 | @retval EFI_TIMEOUT A timeout occurred while waiting for the security\r | |
711 | protocol command to execute.\r | |
712 | \r | |
713 | **/\r | |
714 | EFI_STATUS\r | |
715 | EFIAPI\r | |
716 | ScsiDiskReceiveData (\r | |
1436aea4 MK |
717 | IN EFI_STORAGE_SECURITY_COMMAND_PROTOCOL *This,\r |
718 | IN UINT32 MediaId OPTIONAL,\r | |
719 | IN UINT64 Timeout,\r | |
720 | IN UINT8 SecurityProtocolId,\r | |
721 | IN UINT16 SecurityProtocolSpecificData,\r | |
722 | IN UINTN PayloadBufferSize,\r | |
723 | OUT VOID *PayloadBuffer,\r | |
724 | OUT UINTN *PayloadTransferSize\r | |
ac81789c CZ |
725 | );\r |
726 | \r | |
727 | /**\r | |
728 | Send a security protocol command to a device.\r | |
729 | \r | |
730 | The SendData function sends a security protocol command containing the payload\r | |
731 | PayloadBuffer to the given MediaId. The security protocol command sent is\r | |
732 | defined by SecurityProtocolId and contains the security protocol specific data\r | |
733 | SecurityProtocolSpecificData. If the underlying protocol command requires a\r | |
734 | specific padding for the command payload, the SendData function shall add padding\r | |
735 | bytes to the command payload to satisfy the padding requirements.\r | |
736 | \r | |
737 | For devices supporting the SCSI command set, the security protocol command is sent\r | |
738 | using the SECURITY PROTOCOL OUT command defined in SPC-4.\r | |
739 | \r | |
740 | If PayloadBuffer is NULL and PayloadBufferSize is non-zero, the function shall\r | |
741 | return EFI_INVALID_PARAMETER.\r | |
742 | \r | |
743 | If the given MediaId does not support security protocol commands, the function\r | |
744 | shall return EFI_UNSUPPORTED. If there is no media in the device, the function\r | |
745 | returns EFI_NO_MEDIA. If the MediaId is not the ID for the current media in the\r | |
746 | device, the function returns EFI_MEDIA_CHANGED.\r | |
747 | \r | |
748 | If the security protocol fails to complete within the Timeout period, the function\r | |
749 | shall return EFI_TIMEOUT.\r | |
750 | \r | |
751 | If the security protocol command completes without an error, the function shall return\r | |
752 | EFI_SUCCESS. If the security protocol command completes with an error, the function\r | |
753 | shall return EFI_DEVICE_ERROR.\r | |
754 | \r | |
755 | @param This Indicates a pointer to the calling context.\r | |
756 | @param MediaId ID of the medium to receive data from.\r | |
757 | @param Timeout The timeout, in 100ns units, to use for the execution\r | |
758 | of the security protocol command. A Timeout value of 0\r | |
759 | means that this function will wait indefinitely for the\r | |
760 | security protocol command to execute. If Timeout is greater\r | |
761 | than zero, then this function will return EFI_TIMEOUT if the\r | |
762 | time required to execute the receive data command is greater than Timeout.\r | |
763 | @param SecurityProtocolId The value of the "Security Protocol" parameter of\r | |
764 | the security protocol command to be sent.\r | |
765 | @param SecurityProtocolSpecificData The value of the "Security Protocol Specific" parameter\r | |
766 | of the security protocol command to be sent.\r | |
767 | @param PayloadBufferSize Size in bytes of the payload data buffer.\r | |
768 | @param PayloadBuffer A pointer to a destination buffer to store the security\r | |
769 | protocol command specific payload data for the security\r | |
770 | protocol command.\r | |
771 | \r | |
772 | @retval EFI_SUCCESS The security protocol command completed successfully.\r | |
773 | @retval EFI_UNSUPPORTED The given MediaId does not support security protocol commands.\r | |
774 | @retval EFI_DEVICE_ERROR The security protocol command completed with an error.\r | |
775 | @retval EFI_NO_MEDIA There is no media in the device.\r | |
776 | @retval EFI_MEDIA_CHANGED The MediaId is not for the current media.\r | |
777 | @retval EFI_INVALID_PARAMETER The PayloadBuffer is NULL and PayloadBufferSize is non-zero.\r | |
778 | @retval EFI_TIMEOUT A timeout occurred while waiting for the security\r | |
779 | protocol command to execute.\r | |
780 | \r | |
781 | **/\r | |
782 | EFI_STATUS\r | |
783 | EFIAPI\r | |
784 | ScsiDiskSendData (\r | |
1436aea4 MK |
785 | IN EFI_STORAGE_SECURITY_COMMAND_PROTOCOL *This,\r |
786 | IN UINT32 MediaId OPTIONAL,\r | |
787 | IN UINT64 Timeout,\r | |
788 | IN UINT8 SecurityProtocolId,\r | |
789 | IN UINT16 SecurityProtocolSpecificData,\r | |
790 | IN UINTN PayloadBufferSize,\r | |
791 | OUT VOID *PayloadBuffer\r | |
ac81789c CZ |
792 | );\r |
793 | \r | |
d716651f | 794 | /**\r |
795 | Provides inquiry information for the controller type.\r | |
d1102dba | 796 | \r |
d716651f | 797 | This function is used by the IDE bus driver to get inquiry data. Data format\r |
798 | of Identify data is defined by the Interface GUID.\r | |
799 | \r | |
4140a663 | 800 | @param[in] This Pointer to the EFI_DISK_INFO_PROTOCOL instance.\r |
801 | @param[in, out] InquiryData Pointer to a buffer for the inquiry data.\r | |
802 | @param[in, out] InquiryDataSize Pointer to the value for the inquiry data size.\r | |
d716651f | 803 | \r |
804 | @retval EFI_SUCCESS The command was accepted without any errors.\r | |
d1102dba LG |
805 | @retval EFI_NOT_FOUND Device does not support this data class\r |
806 | @retval EFI_DEVICE_ERROR Error reading InquiryData from device\r | |
807 | @retval EFI_BUFFER_TOO_SMALL InquiryDataSize not big enough\r | |
d716651f | 808 | \r |
809 | **/\r | |
810 | EFI_STATUS\r | |
811 | EFIAPI\r | |
812 | ScsiDiskInfoInquiry (\r | |
1436aea4 MK |
813 | IN EFI_DISK_INFO_PROTOCOL *This,\r |
814 | IN OUT VOID *InquiryData,\r | |
815 | IN OUT UINT32 *InquiryDataSize\r | |
d716651f | 816 | );\r |
817 | \r | |
d716651f | 818 | /**\r |
819 | Provides identify information for the controller type.\r | |
820 | \r | |
821 | This function is used by the IDE bus driver to get identify data. Data format\r | |
822 | of Identify data is defined by the Interface GUID.\r | |
823 | \r | |
d1102dba | 824 | @param[in] This Pointer to the EFI_DISK_INFO_PROTOCOL\r |
d716651f | 825 | instance.\r |
4140a663 | 826 | @param[in, out] IdentifyData Pointer to a buffer for the identify data.\r |
827 | @param[in, out] IdentifyDataSize Pointer to the value for the identify data\r | |
d716651f | 828 | size.\r |
829 | \r | |
830 | @retval EFI_SUCCESS The command was accepted without any errors.\r | |
d1102dba LG |
831 | @retval EFI_NOT_FOUND Device does not support this data class\r |
832 | @retval EFI_DEVICE_ERROR Error reading IdentifyData from device\r | |
833 | @retval EFI_BUFFER_TOO_SMALL IdentifyDataSize not big enough\r | |
d716651f | 834 | \r |
835 | **/\r | |
836 | EFI_STATUS\r | |
837 | EFIAPI\r | |
838 | ScsiDiskInfoIdentify (\r | |
1436aea4 MK |
839 | IN EFI_DISK_INFO_PROTOCOL *This,\r |
840 | IN OUT VOID *IdentifyData,\r | |
841 | IN OUT UINT32 *IdentifyDataSize\r | |
d716651f | 842 | );\r |
843 | \r | |
d716651f | 844 | /**\r |
845 | Provides sense data information for the controller type.\r | |
d1102dba LG |
846 | \r |
847 | This function is used by the IDE bus driver to get sense data.\r | |
d716651f | 848 | Data format of Sense data is defined by the Interface GUID.\r |
849 | \r | |
4140a663 | 850 | @param[in] This Pointer to the EFI_DISK_INFO_PROTOCOL instance.\r |
851 | @param[in, out] SenseData Pointer to the SenseData.\r | |
852 | @param[in, out] SenseDataSize Size of SenseData in bytes.\r | |
853 | @param[out] SenseDataNumber Pointer to the value for the sense data size.\r | |
d716651f | 854 | \r |
855 | @retval EFI_SUCCESS The command was accepted without any errors.\r | |
856 | @retval EFI_NOT_FOUND Device does not support this data class.\r | |
857 | @retval EFI_DEVICE_ERROR Error reading SenseData from device.\r | |
858 | @retval EFI_BUFFER_TOO_SMALL SenseDataSize not big enough.\r | |
859 | \r | |
860 | **/\r | |
861 | EFI_STATUS\r | |
862 | EFIAPI\r | |
863 | ScsiDiskInfoSenseData (\r | |
1436aea4 MK |
864 | IN EFI_DISK_INFO_PROTOCOL *This,\r |
865 | IN OUT VOID *SenseData,\r | |
866 | IN OUT UINT32 *SenseDataSize,\r | |
867 | OUT UINT8 *SenseDataNumber\r | |
d716651f | 868 | );\r |
869 | \r | |
870 | /**\r | |
871 | This function is used by the IDE bus driver to get controller information.\r | |
872 | \r | |
d1102dba | 873 | @param[in] This Pointer to the EFI_DISK_INFO_PROTOCOL instance.\r |
d716651f | 874 | @param[out] IdeChannel Pointer to the Ide Channel number. Primary or secondary.\r |
875 | @param[out] IdeDevice Pointer to the Ide Device number. Master or slave.\r | |
876 | \r | |
877 | @retval EFI_SUCCESS IdeChannel and IdeDevice are valid.\r | |
878 | @retval EFI_UNSUPPORTED This is not an IDE device.\r | |
879 | \r | |
880 | **/\r | |
881 | EFI_STATUS\r | |
882 | EFIAPI\r | |
883 | ScsiDiskInfoWhichIde (\r | |
1436aea4 MK |
884 | IN EFI_DISK_INFO_PROTOCOL *This,\r |
885 | OUT UINT32 *IdeChannel,\r | |
886 | OUT UINT32 *IdeDevice\r | |
d716651f | 887 | );\r |
888 | \r | |
9beb888e | 889 | /**\r |
d716651f | 890 | Detect Device and read out capacity ,if error occurs, parse the sense key.\r |
6ad55b15 | 891 | \r |
9beb888e | 892 | @param ScsiDiskDevice The pointer of SCSI_DISK_DEV\r |
893 | @param MustReadCapacity The flag about reading device capacity\r | |
d1102dba | 894 | @param MediaChange The pointer of flag indicates if media has changed\r |
6ad55b15 | 895 | \r |
9beb888e | 896 | @retval EFI_DEVICE_ERROR Indicates that error occurs\r |
897 | @retval EFI_SUCCESS Successfully to detect media\r | |
6ad55b15 | 898 | \r |
9beb888e | 899 | **/\r |
6ad55b15 | 900 | EFI_STATUS\r |
901 | ScsiDiskDetectMedia (\r | |
1436aea4 MK |
902 | IN SCSI_DISK_DEV *ScsiDiskDevice,\r |
903 | IN BOOLEAN MustReadCapacity,\r | |
904 | OUT BOOLEAN *MediaChange\r | |
9beb888e | 905 | );\r |
6ad55b15 | 906 | \r |
9beb888e | 907 | /**\r |
d716651f | 908 | To test device.\r |
6ad55b15 | 909 | \r |
9beb888e | 910 | When Test Unit Ready command succeeds, retrieve Sense Keys via Request Sense;\r |
911 | When Test Unit Ready command encounters any error caused by host adapter or\r | |
912 | target, return error without retrieving Sense Keys.\r | |
6ad55b15 | 913 | \r |
9beb888e | 914 | @param ScsiDiskDevice The pointer of SCSI_DISK_DEV\r |
915 | @param NeedRetry The pointer of flag indicates try again\r | |
916 | @param SenseDataArray The pointer of an array of sense data\r | |
917 | @param NumberOfSenseKeys The pointer of the number of sense data array\r | |
6ad55b15 | 918 | \r |
9beb888e | 919 | @retval EFI_DEVICE_ERROR Indicates that error occurs\r |
920 | @retval EFI_SUCCESS Successfully to test unit\r | |
f36d6e66 | 921 | \r |
9beb888e | 922 | **/\r |
6ad55b15 | 923 | EFI_STATUS\r |
924 | ScsiDiskTestUnitReady (\r | |
1436aea4 MK |
925 | IN SCSI_DISK_DEV *ScsiDiskDevice,\r |
926 | OUT BOOLEAN *NeedRetry,\r | |
927 | OUT EFI_SCSI_SENSE_DATA **SenseDataArray,\r | |
928 | OUT UINTN *NumberOfSenseKeys\r | |
9beb888e | 929 | );\r |
6ad55b15 | 930 | \r |
9beb888e | 931 | /**\r |
932 | Parsing Sense Keys which got from request sense command.\r | |
6ad55b15 | 933 | \r |
9beb888e | 934 | @param ScsiDiskDevice The pointer of SCSI_DISK_DEV\r |
935 | @param SenseData The pointer of EFI_SCSI_SENSE_DATA\r | |
d1102dba | 936 | @param NumberOfSenseKeys The number of sense key\r |
9beb888e | 937 | @param Action The pointer of action which indicates what is need to do next\r |
6ad55b15 | 938 | \r |
9beb888e | 939 | @retval EFI_DEVICE_ERROR Indicates that error occurs\r |
940 | @retval EFI_SUCCESS Successfully to complete the parsing\r | |
6ad55b15 | 941 | \r |
9beb888e | 942 | **/\r |
6ad55b15 | 943 | EFI_STATUS\r |
944 | DetectMediaParsingSenseKeys (\r | |
1436aea4 MK |
945 | OUT SCSI_DISK_DEV *ScsiDiskDevice,\r |
946 | IN EFI_SCSI_SENSE_DATA *SenseData,\r | |
947 | IN UINTN NumberOfSenseKeys,\r | |
948 | OUT UINTN *Action\r | |
9beb888e | 949 | );\r |
6ad55b15 | 950 | \r |
9beb888e | 951 | /**\r |
952 | Send read capacity command to device and get the device parameter.\r | |
6ad55b15 | 953 | \r |
9beb888e | 954 | @param ScsiDiskDevice The pointer of SCSI_DISK_DEV\r |
955 | @param NeedRetry The pointer of flag indicates if need a retry\r | |
956 | @param SenseDataArray The pointer of an array of sense data\r | |
957 | @param NumberOfSenseKeys The number of sense key\r | |
6ad55b15 | 958 | \r |
9beb888e | 959 | @retval EFI_DEVICE_ERROR Indicates that error occurs\r |
960 | @retval EFI_SUCCESS Successfully to read capacity\r | |
6ad55b15 | 961 | \r |
9beb888e | 962 | **/\r |
6ad55b15 | 963 | EFI_STATUS\r |
964 | ScsiDiskReadCapacity (\r | |
1436aea4 MK |
965 | IN OUT SCSI_DISK_DEV *ScsiDiskDevice,\r |
966 | OUT BOOLEAN *NeedRetry,\r | |
967 | OUT EFI_SCSI_SENSE_DATA **SenseDataArray,\r | |
968 | OUT UINTN *NumberOfSenseKeys\r | |
9beb888e | 969 | );\r |
6ad55b15 | 970 | \r |
9beb888e | 971 | /**\r |
972 | Check the HostAdapter status and re-interpret it in EFI_STATUS.\r | |
6ad55b15 | 973 | \r |
9beb888e | 974 | @param HostAdapterStatus Host Adapter status\r |
6ad55b15 | 975 | \r |
9beb888e | 976 | @retval EFI_SUCCESS Host adapter is OK.\r |
977 | @retval EFI_TIMEOUT Timeout.\r | |
978 | @retval EFI_NOT_READY Adapter NOT ready.\r | |
979 | @retval EFI_DEVICE_ERROR Adapter device error.\r | |
6ad55b15 | 980 | \r |
9beb888e | 981 | **/\r |
6ad55b15 | 982 | EFI_STATUS\r |
983 | CheckHostAdapterStatus (\r | |
1436aea4 | 984 | IN UINT8 HostAdapterStatus\r |
9beb888e | 985 | );\r |
6ad55b15 | 986 | \r |
9beb888e | 987 | /**\r |
988 | Check the target status and re-interpret it in EFI_STATUS.\r | |
6ad55b15 | 989 | \r |
9beb888e | 990 | @param TargetStatus Target status\r |
6ad55b15 | 991 | \r |
9beb888e | 992 | @retval EFI_NOT_READY Device is NOT ready.\r |
d1102dba | 993 | @retval EFI_DEVICE_ERROR\r |
9beb888e | 994 | @retval EFI_SUCCESS\r |
6ad55b15 | 995 | \r |
9beb888e | 996 | **/\r |
6ad55b15 | 997 | EFI_STATUS\r |
998 | CheckTargetStatus (\r | |
1436aea4 | 999 | IN UINT8 TargetStatus\r |
9beb888e | 1000 | );\r |
6ad55b15 | 1001 | \r |
9beb888e | 1002 | /**\r |
1003 | Retrieve all sense keys from the device.\r | |
6ad55b15 | 1004 | \r |
9beb888e | 1005 | When encountering error during the process, if retrieve sense keys before\r |
d716651f | 1006 | error encountered, it returns the sense keys with return status set to EFI_SUCCESS,\r |
cc530cd1 | 1007 | and NeedRetry set to FALSE; otherwise, return the proper return status.\r |
6ad55b15 | 1008 | \r |
9beb888e | 1009 | @param ScsiDiskDevice The pointer of SCSI_DISK_DEV\r |
1010 | @param NeedRetry The pointer of flag indicates if need a retry\r | |
1011 | @param SenseDataArray The pointer of an array of sense data\r | |
1012 | @param NumberOfSenseKeys The number of sense key\r | |
1013 | @param AskResetIfError The flag indicates if need reset when error occurs\r | |
6ad55b15 | 1014 | \r |
9beb888e | 1015 | @retval EFI_DEVICE_ERROR Indicates that error occurs\r |
1016 | @retval EFI_SUCCESS Successfully to request sense key\r | |
6ad55b15 | 1017 | \r |
9beb888e | 1018 | **/\r |
6ad55b15 | 1019 | EFI_STATUS\r |
1020 | ScsiDiskRequestSenseKeys (\r | |
1436aea4 MK |
1021 | IN OUT SCSI_DISK_DEV *ScsiDiskDevice,\r |
1022 | OUT BOOLEAN *NeedRetry,\r | |
1023 | OUT EFI_SCSI_SENSE_DATA **SenseDataArray,\r | |
1024 | OUT UINTN *NumberOfSenseKeys,\r | |
1025 | IN BOOLEAN AskResetIfError\r | |
9beb888e | 1026 | );\r |
6ad55b15 | 1027 | \r |
9beb888e | 1028 | /**\r |
1029 | Send out Inquiry command to Device.\r | |
6ad55b15 | 1030 | \r |
9beb888e | 1031 | @param ScsiDiskDevice The pointer of SCSI_DISK_DEV\r |
1032 | @param NeedRetry Indicates if needs try again when error happens\r | |
6ad55b15 | 1033 | \r |
9beb888e | 1034 | @retval EFI_DEVICE_ERROR Indicates that error occurs\r |
1035 | @retval EFI_SUCCESS Successfully to detect media\r | |
6ad55b15 | 1036 | \r |
9beb888e | 1037 | **/\r |
6ad55b15 | 1038 | EFI_STATUS\r |
1039 | ScsiDiskInquiryDevice (\r | |
1436aea4 MK |
1040 | IN OUT SCSI_DISK_DEV *ScsiDiskDevice,\r |
1041 | OUT BOOLEAN *NeedRetry\r | |
9beb888e | 1042 | );\r |
6ad55b15 | 1043 | \r |
9beb888e | 1044 | /**\r |
1045 | Parse Inquiry data.\r | |
6ad55b15 | 1046 | \r |
9beb888e | 1047 | @param ScsiDiskDevice The pointer of SCSI_DISK_DEV\r |
6ad55b15 | 1048 | \r |
9beb888e | 1049 | **/\r |
6ad55b15 | 1050 | VOID\r |
1051 | ParseInquiryData (\r | |
1436aea4 | 1052 | IN OUT SCSI_DISK_DEV *ScsiDiskDevice\r |
9beb888e | 1053 | );\r |
6ad55b15 | 1054 | \r |
9beb888e | 1055 | /**\r |
1056 | Read sector from SCSI Disk.\r | |
6ad55b15 | 1057 | \r |
d716651f | 1058 | @param ScsiDiskDevice The pointer of SCSI_DISK_DEV\r |
9beb888e | 1059 | @param Buffer The buffer to fill in the read out data\r |
1060 | @param Lba Logic block address\r | |
1061 | @param NumberOfBlocks The number of blocks to read\r | |
6ad55b15 | 1062 | \r |
9beb888e | 1063 | @retval EFI_DEVICE_ERROR Indicates a device error.\r |
1064 | @retval EFI_SUCCESS Operation is successful.\r | |
6ad55b15 | 1065 | \r |
9beb888e | 1066 | **/\r |
6ad55b15 | 1067 | EFI_STATUS\r |
1068 | ScsiDiskReadSectors (\r | |
1436aea4 MK |
1069 | IN SCSI_DISK_DEV *ScsiDiskDevice,\r |
1070 | OUT VOID *Buffer,\r | |
1071 | IN EFI_LBA Lba,\r | |
1072 | IN UINTN NumberOfBlocks\r | |
9beb888e | 1073 | );\r |
6ad55b15 | 1074 | \r |
9beb888e | 1075 | /**\r |
1076 | Write sector to SCSI Disk.\r | |
6ad55b15 | 1077 | \r |
d716651f | 1078 | @param ScsiDiskDevice The pointer of SCSI_DISK_DEV\r |
9beb888e | 1079 | @param Buffer The buffer of data to be written into SCSI Disk\r |
1080 | @param Lba Logic block address\r | |
1081 | @param NumberOfBlocks The number of blocks to read\r | |
6ad55b15 | 1082 | \r |
9beb888e | 1083 | @retval EFI_DEVICE_ERROR Indicates a device error.\r |
1084 | @retval EFI_SUCCESS Operation is successful.\r | |
6ad55b15 | 1085 | \r |
9beb888e | 1086 | **/\r |
6ad55b15 | 1087 | EFI_STATUS\r |
1088 | ScsiDiskWriteSectors (\r | |
1436aea4 MK |
1089 | IN SCSI_DISK_DEV *ScsiDiskDevice,\r |
1090 | IN VOID *Buffer,\r | |
1091 | IN EFI_LBA Lba,\r | |
1092 | IN UINTN NumberOfBlocks\r | |
9beb888e | 1093 | );\r |
6ad55b15 | 1094 | \r |
d670bf53 HW |
1095 | /**\r |
1096 | Asynchronously read sector from SCSI Disk.\r | |
1097 | \r | |
1098 | @param ScsiDiskDevice The pointer of SCSI_DISK_DEV.\r | |
1099 | @param Buffer The buffer to fill in the read out data.\r | |
1100 | @param Lba Logic block address.\r | |
1101 | @param NumberOfBlocks The number of blocks to read.\r | |
1102 | @param Token A pointer to the token associated with the\r | |
1103 | non-blocking read request.\r | |
1104 | \r | |
1105 | @retval EFI_INVALID_PARAMETER Token is NULL or Token->Event is NULL.\r | |
1106 | @retval EFI_DEVICE_ERROR Indicates a device error.\r | |
1107 | @retval EFI_SUCCESS Operation is successful.\r | |
1108 | \r | |
1109 | **/\r | |
1110 | EFI_STATUS\r | |
1111 | ScsiDiskAsyncReadSectors (\r | |
1436aea4 MK |
1112 | IN SCSI_DISK_DEV *ScsiDiskDevice,\r |
1113 | OUT VOID *Buffer,\r | |
1114 | IN EFI_LBA Lba,\r | |
1115 | IN UINTN NumberOfBlocks,\r | |
1116 | IN EFI_BLOCK_IO2_TOKEN *Token\r | |
d670bf53 HW |
1117 | );\r |
1118 | \r | |
1119 | /**\r | |
1120 | Asynchronously write sector to SCSI Disk.\r | |
1121 | \r | |
1122 | @param ScsiDiskDevice The pointer of SCSI_DISK_DEV.\r | |
1123 | @param Buffer The buffer of data to be written into SCSI Disk.\r | |
1124 | @param Lba Logic block address.\r | |
1125 | @param NumberOfBlocks The number of blocks to read.\r | |
1126 | @param Token A pointer to the token associated with the\r | |
1127 | non-blocking read request.\r | |
1128 | \r | |
1129 | @retval EFI_INVALID_PARAMETER Token is NULL or Token->Event is NULL\r | |
1130 | @retval EFI_DEVICE_ERROR Indicates a device error.\r | |
1131 | @retval EFI_SUCCESS Operation is successful.\r | |
1132 | \r | |
1133 | **/\r | |
1134 | EFI_STATUS\r | |
1135 | ScsiDiskAsyncWriteSectors (\r | |
1436aea4 MK |
1136 | IN SCSI_DISK_DEV *ScsiDiskDevice,\r |
1137 | IN VOID *Buffer,\r | |
1138 | IN EFI_LBA Lba,\r | |
1139 | IN UINTN NumberOfBlocks,\r | |
1140 | IN EFI_BLOCK_IO2_TOKEN *Token\r | |
d670bf53 HW |
1141 | );\r |
1142 | \r | |
9beb888e | 1143 | /**\r |
73a9e822 | 1144 | Submit Read(10) command.\r |
9beb888e | 1145 | \r |
1146 | @param ScsiDiskDevice The pointer of ScsiDiskDevice\r | |
1147 | @param NeedRetry The pointer of flag indicates if needs retry if error happens\r | |
9beb888e | 1148 | @param Timeout The time to complete the command\r |
1149 | @param DataBuffer The buffer to fill with the read out data\r | |
1150 | @param DataLength The length of buffer\r | |
1151 | @param StartLba The start logic block address\r | |
73a9e822 | 1152 | @param SectorCount The number of blocks to read\r |
9beb888e | 1153 | \r |
1154 | @return EFI_STATUS is returned by calling ScsiRead10Command().\r | |
1155 | **/\r | |
6ad55b15 | 1156 | EFI_STATUS\r |
1157 | ScsiDiskRead10 (\r | |
1436aea4 MK |
1158 | IN SCSI_DISK_DEV *ScsiDiskDevice,\r |
1159 | OUT BOOLEAN *NeedRetry,\r | |
1160 | IN UINT64 Timeout,\r | |
1161 | OUT UINT8 *DataBuffer,\r | |
1162 | IN OUT UINT32 *DataLength,\r | |
1163 | IN UINT32 StartLba,\r | |
1164 | IN UINT32 SectorCount\r | |
9beb888e | 1165 | );\r |
6ad55b15 | 1166 | \r |
9beb888e | 1167 | /**\r |
73a9e822 | 1168 | Submit Write(10) Command.\r |
6ad55b15 | 1169 | \r |
9beb888e | 1170 | @param ScsiDiskDevice The pointer of ScsiDiskDevice\r |
1171 | @param NeedRetry The pointer of flag indicates if needs retry if error happens\r | |
9beb888e | 1172 | @param Timeout The time to complete the command\r |
1173 | @param DataBuffer The buffer to fill with the read out data\r | |
1174 | @param DataLength The length of buffer\r | |
1175 | @param StartLba The start logic block address\r | |
73a9e822 | 1176 | @param SectorCount The number of blocks to write\r |
6ad55b15 | 1177 | \r |
9beb888e | 1178 | @return EFI_STATUS is returned by calling ScsiWrite10Command().\r |
6ad55b15 | 1179 | \r |
9beb888e | 1180 | **/\r |
6ad55b15 | 1181 | EFI_STATUS\r |
1182 | ScsiDiskWrite10 (\r | |
1436aea4 MK |
1183 | IN SCSI_DISK_DEV *ScsiDiskDevice,\r |
1184 | OUT BOOLEAN *NeedRetry,\r | |
1185 | IN UINT64 Timeout,\r | |
1186 | IN UINT8 *DataBuffer,\r | |
1187 | IN OUT UINT32 *DataLength,\r | |
1188 | IN UINT32 StartLba,\r | |
1189 | IN UINT32 SectorCount\r | |
9beb888e | 1190 | );\r |
6ad55b15 | 1191 | \r |
a108933e | 1192 | /**\r |
1193 | Submit Read(16) command.\r | |
1194 | \r | |
1195 | @param ScsiDiskDevice The pointer of ScsiDiskDevice\r | |
1196 | @param NeedRetry The pointer of flag indicates if needs retry if error happens\r | |
a108933e | 1197 | @param Timeout The time to complete the command\r |
1198 | @param DataBuffer The buffer to fill with the read out data\r | |
1199 | @param DataLength The length of buffer\r | |
1200 | @param StartLba The start logic block address\r | |
73a9e822 | 1201 | @param SectorCount The number of blocks to read\r |
a108933e | 1202 | \r |
73a9e822 | 1203 | @return EFI_STATUS is returned by calling ScsiRead16Command().\r |
a108933e | 1204 | **/\r |
1205 | EFI_STATUS\r | |
1206 | ScsiDiskRead16 (\r | |
1436aea4 MK |
1207 | IN SCSI_DISK_DEV *ScsiDiskDevice,\r |
1208 | OUT BOOLEAN *NeedRetry,\r | |
1209 | IN UINT64 Timeout,\r | |
1210 | OUT UINT8 *DataBuffer,\r | |
1211 | IN OUT UINT32 *DataLength,\r | |
1212 | IN UINT64 StartLba,\r | |
1213 | IN UINT32 SectorCount\r | |
a108933e | 1214 | );\r |
d1102dba | 1215 | \r |
a108933e | 1216 | /**\r |
1217 | Submit Write(16) Command.\r | |
1218 | \r | |
1219 | @param ScsiDiskDevice The pointer of ScsiDiskDevice\r | |
1220 | @param NeedRetry The pointer of flag indicates if needs retry if error happens\r | |
a108933e | 1221 | @param Timeout The time to complete the command\r |
1222 | @param DataBuffer The buffer to fill with the read out data\r | |
1223 | @param DataLength The length of buffer\r | |
1224 | @param StartLba The start logic block address\r | |
73a9e822 | 1225 | @param SectorCount The number of blocks to write\r |
a108933e | 1226 | \r |
73a9e822 | 1227 | @return EFI_STATUS is returned by calling ScsiWrite16Command().\r |
a108933e | 1228 | \r |
1229 | **/\r | |
1230 | EFI_STATUS\r | |
1231 | ScsiDiskWrite16 (\r | |
1436aea4 MK |
1232 | IN SCSI_DISK_DEV *ScsiDiskDevice,\r |
1233 | OUT BOOLEAN *NeedRetry,\r | |
1234 | IN UINT64 Timeout,\r | |
1235 | IN UINT8 *DataBuffer,\r | |
1236 | IN OUT UINT32 *DataLength,\r | |
1237 | IN UINT64 StartLba,\r | |
1238 | IN UINT32 SectorCount\r | |
d1102dba | 1239 | );\r |
a108933e | 1240 | \r |
d670bf53 HW |
1241 | /**\r |
1242 | Submit Async Read(10) command.\r | |
1243 | \r | |
1244 | @param ScsiDiskDevice The pointer of ScsiDiskDevice.\r | |
1245 | @param Timeout The time to complete the command.\r | |
032800ec | 1246 | @param TimesRetry The number of times the command has been retried.\r |
d670bf53 HW |
1247 | @param DataBuffer The buffer to fill with the read out data.\r |
1248 | @param DataLength The length of buffer.\r | |
1249 | @param StartLba The start logic block address.\r | |
1250 | @param SectorCount The number of blocks to read.\r | |
1251 | @param BlkIo2Req The upstream BlockIo2 request.\r | |
1252 | @param Token The pointer to the token associated with the\r | |
1253 | non-blocking read request.\r | |
1254 | \r | |
1255 | @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a\r | |
1256 | lack of resources.\r | |
1257 | @return others Status returned by calling\r | |
1258 | ScsiRead10CommandEx().\r | |
1259 | \r | |
1260 | **/\r | |
1261 | EFI_STATUS\r | |
1262 | ScsiDiskAsyncRead10 (\r | |
1436aea4 MK |
1263 | IN SCSI_DISK_DEV *ScsiDiskDevice,\r |
1264 | IN UINT64 Timeout,\r | |
1265 | IN UINT8 TimesRetry,\r | |
1266 | OUT UINT8 *DataBuffer,\r | |
1267 | IN UINT32 DataLength,\r | |
1268 | IN UINT32 StartLba,\r | |
1269 | IN UINT32 SectorCount,\r | |
1270 | IN OUT SCSI_BLKIO2_REQUEST *BlkIo2Req,\r | |
1271 | IN EFI_BLOCK_IO2_TOKEN *Token\r | |
d670bf53 HW |
1272 | );\r |
1273 | \r | |
1274 | /**\r | |
1275 | Submit Async Write(10) command.\r | |
1276 | \r | |
1277 | @param ScsiDiskDevice The pointer of ScsiDiskDevice.\r | |
1278 | @param Timeout The time to complete the command.\r | |
032800ec | 1279 | @param TimesRetry The number of times the command has been retried.\r |
d670bf53 HW |
1280 | @param DataBuffer The buffer contains the data to write.\r |
1281 | @param DataLength The length of buffer.\r | |
1282 | @param StartLba The start logic block address.\r | |
1283 | @param SectorCount The number of blocks to write.\r | |
1284 | @param BlkIo2Req The upstream BlockIo2 request.\r | |
1285 | @param Token The pointer to the token associated with the\r | |
1286 | non-blocking read request.\r | |
1287 | \r | |
1288 | @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a\r | |
1289 | lack of resources.\r | |
1290 | @return others Status returned by calling\r | |
1291 | ScsiWrite10CommandEx().\r | |
1292 | \r | |
1293 | **/\r | |
1294 | EFI_STATUS\r | |
1295 | ScsiDiskAsyncWrite10 (\r | |
1436aea4 MK |
1296 | IN SCSI_DISK_DEV *ScsiDiskDevice,\r |
1297 | IN UINT64 Timeout,\r | |
1298 | IN UINT8 TimesRetry,\r | |
1299 | IN UINT8 *DataBuffer,\r | |
1300 | IN UINT32 DataLength,\r | |
1301 | IN UINT32 StartLba,\r | |
1302 | IN UINT32 SectorCount,\r | |
1303 | IN OUT SCSI_BLKIO2_REQUEST *BlkIo2Req,\r | |
1304 | IN EFI_BLOCK_IO2_TOKEN *Token\r | |
d670bf53 HW |
1305 | );\r |
1306 | \r | |
1307 | /**\r | |
1308 | Submit Async Read(16) command.\r | |
1309 | \r | |
1310 | @param ScsiDiskDevice The pointer of ScsiDiskDevice.\r | |
1311 | @param Timeout The time to complete the command.\r | |
032800ec | 1312 | @param TimesRetry The number of times the command has been retried.\r |
d670bf53 HW |
1313 | @param DataBuffer The buffer to fill with the read out data.\r |
1314 | @param DataLength The length of buffer.\r | |
1315 | @param StartLba The start logic block address.\r | |
1316 | @param SectorCount The number of blocks to read.\r | |
1317 | @param BlkIo2Req The upstream BlockIo2 request.\r | |
1318 | @param Token The pointer to the token associated with the\r | |
1319 | non-blocking read request.\r | |
1320 | \r | |
1321 | @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a\r | |
1322 | lack of resources.\r | |
1323 | @return others Status returned by calling\r | |
1324 | ScsiRead16CommandEx().\r | |
1325 | \r | |
1326 | **/\r | |
1327 | EFI_STATUS\r | |
1328 | ScsiDiskAsyncRead16 (\r | |
1436aea4 MK |
1329 | IN SCSI_DISK_DEV *ScsiDiskDevice,\r |
1330 | IN UINT64 Timeout,\r | |
1331 | IN UINT8 TimesRetry,\r | |
1332 | OUT UINT8 *DataBuffer,\r | |
1333 | IN UINT32 DataLength,\r | |
1334 | IN UINT64 StartLba,\r | |
1335 | IN UINT32 SectorCount,\r | |
1336 | IN OUT SCSI_BLKIO2_REQUEST *BlkIo2Req,\r | |
1337 | IN EFI_BLOCK_IO2_TOKEN *Token\r | |
d670bf53 HW |
1338 | );\r |
1339 | \r | |
1340 | /**\r | |
1341 | Submit Async Write(16) command.\r | |
1342 | \r | |
1343 | @param ScsiDiskDevice The pointer of ScsiDiskDevice.\r | |
1344 | @param Timeout The time to complete the command.\r | |
032800ec | 1345 | @param TimesRetry The number of times the command has been retried.\r |
d670bf53 HW |
1346 | @param DataBuffer The buffer contains the data to write.\r |
1347 | @param DataLength The length of buffer.\r | |
1348 | @param StartLba The start logic block address.\r | |
1349 | @param SectorCount The number of blocks to write.\r | |
1350 | @param BlkIo2Req The upstream BlockIo2 request.\r | |
1351 | @param Token The pointer to the token associated with the\r | |
1352 | non-blocking read request.\r | |
1353 | \r | |
1354 | @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a\r | |
1355 | lack of resources.\r | |
1356 | @return others Status returned by calling\r | |
1357 | ScsiWrite16CommandEx().\r | |
1358 | \r | |
1359 | **/\r | |
1360 | EFI_STATUS\r | |
1361 | ScsiDiskAsyncWrite16 (\r | |
1436aea4 MK |
1362 | IN SCSI_DISK_DEV *ScsiDiskDevice,\r |
1363 | IN UINT64 Timeout,\r | |
1364 | IN UINT8 TimesRetry,\r | |
1365 | IN UINT8 *DataBuffer,\r | |
1366 | IN UINT32 DataLength,\r | |
1367 | IN UINT64 StartLba,\r | |
1368 | IN UINT32 SectorCount,\r | |
1369 | IN OUT SCSI_BLKIO2_REQUEST *BlkIo2Req,\r | |
1370 | IN EFI_BLOCK_IO2_TOKEN *Token\r | |
d670bf53 HW |
1371 | );\r |
1372 | \r | |
9beb888e | 1373 | /**\r |
1374 | Get information from media read capacity command.\r | |
6ad55b15 | 1375 | \r |
9beb888e | 1376 | @param ScsiDiskDevice The pointer of SCSI_DISK_DEV\r |
b96cd313 | 1377 | @param Capacity10 The pointer of EFI_SCSI_DISK_CAPACITY_DATA\r |
1378 | @param Capacity16 The pointer of EFI_SCSI_DISK_CAPACITY_DATA16\r | |
9beb888e | 1379 | **/\r |
6ad55b15 | 1380 | VOID\r |
1381 | GetMediaInfo (\r | |
aa75dfec | 1382 | IN OUT SCSI_DISK_DEV *ScsiDiskDevice,\r |
1383 | IN EFI_SCSI_DISK_CAPACITY_DATA *Capacity10,\r | |
1384 | IN EFI_SCSI_DISK_CAPACITY_DATA16 *Capacity16\r | |
9beb888e | 1385 | );\r |
6ad55b15 | 1386 | \r |
9beb888e | 1387 | /**\r |
1388 | Check sense key to find if media presents.\r | |
6ad55b15 | 1389 | \r |
9beb888e | 1390 | @param SenseData The pointer of EFI_SCSI_SENSE_DATA\r |
1391 | @param SenseCounts The number of sense key\r | |
6ad55b15 | 1392 | \r |
9beb888e | 1393 | @retval TRUE NOT any media\r |
1394 | @retval FALSE Media presents\r | |
1395 | **/\r | |
6ad55b15 | 1396 | BOOLEAN\r |
1397 | ScsiDiskIsNoMedia (\r | |
1436aea4 MK |
1398 | IN EFI_SCSI_SENSE_DATA *SenseData,\r |
1399 | IN UINTN SenseCounts\r | |
9beb888e | 1400 | );\r |
6ad55b15 | 1401 | \r |
9beb888e | 1402 | /**\r |
1403 | Parse sense key.\r | |
6ad55b15 | 1404 | \r |
9beb888e | 1405 | @param SenseData The pointer of EFI_SCSI_SENSE_DATA\r |
1406 | @param SenseCounts The number of sense key\r | |
6ad55b15 | 1407 | \r |
9beb888e | 1408 | @retval TRUE Error\r |
1409 | @retval FALSE NOT error\r | |
6ad55b15 | 1410 | \r |
9beb888e | 1411 | **/\r |
6ad55b15 | 1412 | BOOLEAN\r |
1413 | ScsiDiskIsMediaError (\r | |
1436aea4 MK |
1414 | IN EFI_SCSI_SENSE_DATA *SenseData,\r |
1415 | IN UINTN SenseCounts\r | |
9beb888e | 1416 | );\r |
6ad55b15 | 1417 | \r |
9beb888e | 1418 | /**\r |
1419 | Check sense key to find if hardware error happens.\r | |
6ad55b15 | 1420 | \r |
9beb888e | 1421 | @param SenseData The pointer of EFI_SCSI_SENSE_DATA\r |
1422 | @param SenseCounts The number of sense key\r | |
6ad55b15 | 1423 | \r |
9beb888e | 1424 | @retval TRUE Hardware error exits.\r |
1425 | @retval FALSE NO error.\r | |
6ad55b15 | 1426 | \r |
9beb888e | 1427 | **/\r |
6ad55b15 | 1428 | BOOLEAN\r |
1429 | ScsiDiskIsHardwareError (\r | |
1436aea4 MK |
1430 | IN EFI_SCSI_SENSE_DATA *SenseData,\r |
1431 | IN UINTN SenseCounts\r | |
9beb888e | 1432 | );\r |
6ad55b15 | 1433 | \r |
9beb888e | 1434 | /**\r |
1435 | Check sense key to find if media has changed.\r | |
6ad55b15 | 1436 | \r |
9beb888e | 1437 | @param SenseData The pointer of EFI_SCSI_SENSE_DATA\r |
1438 | @param SenseCounts The number of sense key\r | |
6ad55b15 | 1439 | \r |
9beb888e | 1440 | @retval TRUE Media is changed.\r |
cc530cd1 | 1441 | @retval FALSE Media is NOT changed.\r |
9beb888e | 1442 | **/\r |
6ad55b15 | 1443 | BOOLEAN\r |
1444 | ScsiDiskIsMediaChange (\r | |
1436aea4 MK |
1445 | IN EFI_SCSI_SENSE_DATA *SenseData,\r |
1446 | IN UINTN SenseCounts\r | |
9beb888e | 1447 | );\r |
6ad55b15 | 1448 | \r |
9beb888e | 1449 | /**\r |
1450 | Check sense key to find if reset happens.\r | |
6ad55b15 | 1451 | \r |
9beb888e | 1452 | @param SenseData The pointer of EFI_SCSI_SENSE_DATA\r |
1453 | @param SenseCounts The number of sense key\r | |
6ad55b15 | 1454 | \r |
9beb888e | 1455 | @retval TRUE It is reset before.\r |
1456 | @retval FALSE It is NOT reset before.\r | |
6ad55b15 | 1457 | \r |
9beb888e | 1458 | **/\r |
6ad55b15 | 1459 | BOOLEAN\r |
1460 | ScsiDiskIsResetBefore (\r | |
1436aea4 MK |
1461 | IN EFI_SCSI_SENSE_DATA *SenseData,\r |
1462 | IN UINTN SenseCounts\r | |
9beb888e | 1463 | );\r |
6ad55b15 | 1464 | \r |
9beb888e | 1465 | /**\r |
1466 | Check sense key to find if the drive is ready.\r | |
6ad55b15 | 1467 | \r |
9beb888e | 1468 | @param SenseData The pointer of EFI_SCSI_SENSE_DATA\r |
1469 | @param SenseCounts The number of sense key\r | |
d1102dba | 1470 | @param RetryLater The flag means if need a retry\r |
6ad55b15 | 1471 | \r |
9beb888e | 1472 | @retval TRUE Drive is ready.\r |
1473 | @retval FALSE Drive is NOT ready.\r | |
6ad55b15 | 1474 | \r |
9beb888e | 1475 | **/\r |
6ad55b15 | 1476 | BOOLEAN\r |
1477 | ScsiDiskIsDriveReady (\r | |
1436aea4 MK |
1478 | IN EFI_SCSI_SENSE_DATA *SenseData,\r |
1479 | IN UINTN SenseCounts,\r | |
1480 | OUT BOOLEAN *RetryLater\r | |
9beb888e | 1481 | );\r |
6ad55b15 | 1482 | \r |
9beb888e | 1483 | /**\r |
1484 | Check sense key to find if it has sense key.\r | |
6ad55b15 | 1485 | \r |
9beb888e | 1486 | @param SenseData - The pointer of EFI_SCSI_SENSE_DATA\r |
1487 | @param SenseCounts - The number of sense key\r | |
6ad55b15 | 1488 | \r |
9beb888e | 1489 | @retval TRUE It has sense key.\r |
1490 | @retval FALSE It has NOT any sense key.\r | |
6ad55b15 | 1491 | \r |
9beb888e | 1492 | **/\r |
6ad55b15 | 1493 | BOOLEAN\r |
1494 | ScsiDiskHaveSenseKey (\r | |
1436aea4 MK |
1495 | IN EFI_SCSI_SENSE_DATA *SenseData,\r |
1496 | IN UINTN SenseCounts\r | |
9beb888e | 1497 | );\r |
6ad55b15 | 1498 | \r |
9beb888e | 1499 | /**\r |
1500 | Release resource about disk device.\r | |
6ad55b15 | 1501 | \r |
9beb888e | 1502 | @param ScsiDiskDevice The pointer of SCSI_DISK_DEV\r |
6ad55b15 | 1503 | \r |
9beb888e | 1504 | **/\r |
6ad55b15 | 1505 | VOID\r |
1506 | ReleaseScsiDiskDeviceResources (\r | |
1436aea4 | 1507 | IN SCSI_DISK_DEV *ScsiDiskDevice\r |
9beb888e | 1508 | );\r |
6ad55b15 | 1509 | \r |
d14faa52 | 1510 | /**\r |
1511 | Determine if Block Io should be produced.\r | |
d1102dba | 1512 | \r |
d14faa52 | 1513 | \r |
d716651f | 1514 | @param ChildHandle Child Handle to retrieve Parent information.\r |
d1102dba | 1515 | \r |
d14faa52 | 1516 | @retval TRUE Should produce Block Io.\r |
1517 | @retval FALSE Should not produce Block Io.\r | |
1518 | \r | |
d1102dba | 1519 | **/\r |
d14faa52 | 1520 | BOOLEAN\r |
1521 | DetermineInstallBlockIo (\r | |
1436aea4 | 1522 | IN EFI_HANDLE ChildHandle\r |
d14faa52 | 1523 | );\r |
1524 | \r | |
d716651f | 1525 | /**\r |
1526 | Initialize the installation of DiskInfo protocol.\r | |
1527 | \r | |
1528 | This function prepares for the installation of DiskInfo protocol on the child handle.\r | |
1529 | By default, it installs DiskInfo protocol with SCSI interface GUID. If it further\r | |
1530 | detects that the physical device is an ATAPI/AHCI device, it then updates interface GUID\r | |
1531 | to be IDE/AHCI interface GUID.\r | |
1532 | \r | |
1533 | @param ScsiDiskDevice The pointer of SCSI_DISK_DEV.\r | |
1534 | @param ChildHandle Child handle to install DiskInfo protocol.\r | |
d1102dba LG |
1535 | \r |
1536 | **/\r | |
d716651f | 1537 | VOID\r |
1538 | InitializeInstallDiskInfo (\r | |
1436aea4 MK |
1539 | IN SCSI_DISK_DEV *ScsiDiskDevice,\r |
1540 | IN EFI_HANDLE ChildHandle\r | |
d1102dba | 1541 | );\r |
d716651f | 1542 | \r |
d14faa52 | 1543 | /**\r |
1544 | Search protocol database and check to see if the protocol\r | |
1545 | specified by ProtocolGuid is present on a ControllerHandle and opened by\r | |
1546 | ChildHandle with an attribute of EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER.\r | |
1547 | If the ControllerHandle is found, then the protocol specified by ProtocolGuid\r | |
d1102dba LG |
1548 | will be opened on it.\r |
1549 | \r | |
d14faa52 | 1550 | \r |
1551 | @param ProtocolGuid ProtocolGuid pointer.\r | |
1552 | @param ChildHandle Child Handle to retrieve Parent information.\r | |
d1102dba LG |
1553 | \r |
1554 | **/\r | |
d14faa52 | 1555 | VOID *\r |
1556 | EFIAPI\r | |
1557 | GetParentProtocol (\r | |
1436aea4 MK |
1558 | IN EFI_GUID *ProtocolGuid,\r |
1559 | IN EFI_HANDLE ChildHandle\r | |
d14faa52 | 1560 | );\r |
1561 | \r | |
b6e5da19 HW |
1562 | /**\r |
1563 | Determine if EFI Erase Block Protocol should be produced.\r | |
1564 | \r | |
1565 | @param ScsiDiskDevice The pointer of SCSI_DISK_DEV.\r | |
1566 | @param ChildHandle Handle of device.\r | |
1567 | \r | |
1568 | @retval TRUE Should produce EFI Erase Block Protocol.\r | |
1569 | @retval FALSE Should not produce EFI Erase Block Protocol.\r | |
1570 | \r | |
1571 | **/\r | |
1572 | BOOLEAN\r | |
1573 | DetermineInstallEraseBlock (\r | |
1436aea4 MK |
1574 | IN SCSI_DISK_DEV *ScsiDiskDevice,\r |
1575 | IN EFI_HANDLE ChildHandle\r | |
b6e5da19 HW |
1576 | );\r |
1577 | \r | |
ac81789c CZ |
1578 | /**\r |
1579 | Determine if EFI Storage Security Command Protocol should be produced.\r | |
1580 | \r | |
1581 | @param ScsiDiskDevice The pointer of SCSI_DISK_DEV.\r | |
1582 | @param ChildHandle Handle of device.\r | |
1583 | \r | |
1584 | @retval TRUE Should produce EFI Storage Security Command Protocol.\r | |
1585 | @retval FALSE Should not produce EFI Storage Security Command Protocol.\r | |
1586 | \r | |
1587 | **/\r | |
1588 | BOOLEAN\r | |
1589 | DetermineInstallStorageSecurity (\r | |
1436aea4 MK |
1590 | IN SCSI_DISK_DEV *ScsiDiskDevice,\r |
1591 | IN EFI_HANDLE ChildHandle\r | |
ac81789c CZ |
1592 | );\r |
1593 | \r | |
6ad55b15 | 1594 | #endif\r |