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