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