TianoCore EDK2 master
|
#include "DiskIo.h"
Go to the source code of this file.
Variables | |
EFI_DRIVER_BINDING_PROTOCOL | gDiskIoDriverBinding |
DISK_IO_PRIVATE_DATA | gDiskIoPrivateDataTemplate |
DiskIo driver that lays on every BlockIo protocol in the system. DiskIo converts a block oriented device to a byte oriented device.
Disk access may have to handle unaligned request about sector boundaries. There are three cases: UnderRun - The first byte is not on a sector boundary or the read request is less than a sector in length. Aligned - A read of N contiguous sectors. OverRun - The last byte is not on a sector boundary.
Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent
Definition in file DiskIo.c.
EFI_STATUS EFIAPI DiskIo2Cancel | ( | IN EFI_DISK_IO2_PROTOCOL * | This | ) |
Terminate outstanding asynchronous requests to a device.
This | Indicates a pointer to the calling context. |
EFI_SUCCESS | All outstanding requests were successfully terminated. |
EFI_DEVICE_ERROR | The device reported an error while performing the cancel operation. |
EFI_STATUS EFIAPI DiskIo2FlushDiskEx | ( | IN EFI_DISK_IO2_PROTOCOL * | This, |
IN OUT EFI_DISK_IO2_TOKEN * | Token | ||
) |
Flushes all modified data to the physical device.
This | Indicates a pointer to the calling context. |
Token | A pointer to the token associated with the transaction. If this field is NULL, synchronous/blocking IO is performed. |
EFI_SUCCESS | If Event is NULL (blocking I/O): The data was flushed successfully to the device. If Event is not NULL (asynchronous I/O): The request was successfully queued for processing. Event will be signaled upon completion. |
EFI_WRITE_PROTECTED | The device cannot be written to. |
EFI_DEVICE_ERROR | The device reported an error while performing the write operation. |
EFI_NO_MEDIA | There is no medium in the device. |
EFI_OUT_OF_RESOURCES | The request could not be completed due to a lack of resources. |
The callback for the BlockIo2 FlushBlocksEx.
Event | Event whose notification function is being invoked. |
Context | The pointer to the notification function's context, which points to the DISK_IO2_FLUSH_TASK instance. |
The callback for the BlockIo2 ReadBlocksEx/WriteBlocksEx.
Event | Event whose notification function is being invoked. |
Context | The pointer to the notification function's context, which points to the DISK_IO_SUBTASK instance. |
EFI_STATUS EFIAPI DiskIo2ReadDiskEx | ( | IN EFI_DISK_IO2_PROTOCOL * | This, |
IN UINT32 | MediaId, | ||
IN UINT64 | Offset, | ||
IN OUT EFI_DISK_IO2_TOKEN * | Token, | ||
IN UINTN | BufferSize, | ||
OUT VOID * | Buffer | ||
) |
Reads a specified number of bytes from a device.
This | Indicates a pointer to the calling context. |
MediaId | ID of the medium to be read. |
Offset | The starting byte offset on the logical block I/O device to read from. |
Token | A pointer to the token associated with the transaction. If this field is NULL, synchronous/blocking IO is performed. |
BufferSize | The size in bytes of Buffer. The number of bytes to read from the device. |
Buffer | A pointer to the destination buffer for the data. The caller is responsible either having implicit or explicit ownership of the buffer. |
EFI_SUCCESS | If Event is NULL (blocking I/O): The data was read correctly from the device. If Event is not NULL (asynchronous I/O): The request was successfully queued for processing. Event will be signaled upon completion. |
EFI_DEVICE_ERROR | The device reported an error while performing the write. |
EFI_NO_MEDIA | There is no medium in the device. |
EFI_MEDIA_CHNAGED | The MediaId is not for the current medium. |
EFI_INVALID_PARAMETER | The read request contains device addresses that are not valid for the device. |
EFI_OUT_OF_RESOURCES | The request could not be completed due to a lack of resources. |
EFI_STATUS DiskIo2ReadWriteDisk | ( | IN DISK_IO_PRIVATE_DATA * | Instance, |
IN BOOLEAN | Write, | ||
IN UINT32 | MediaId, | ||
IN UINT64 | Offset, | ||
IN EFI_DISK_IO2_TOKEN * | Token, | ||
IN UINTN | BufferSize, | ||
IN UINT8 * | Buffer | ||
) |
Common routine to access the disk.
Instance | Pointer to the DISK_IO_PRIVATE_DATA. |
Write | TRUE: Write operation; FALSE: Read operation. |
MediaId | ID of the medium to access. |
Offset | The starting byte offset on the logical block I/O device to access. |
Token | A pointer to the token associated with the transaction. If this field is NULL, synchronous/blocking IO is performed. |
BufferSize | The size in bytes of Buffer. The number of bytes to read from the device. |
Buffer | A pointer to the destination buffer for the data. The caller is responsible either having implicit or explicit ownership of the buffer. |
BOOLEAN DiskIo2RemoveCompletedTask | ( | IN DISK_IO_PRIVATE_DATA * | Instance | ) |
Remove the completed tasks from Instance->TaskQueue. Completed tasks are those who don't have any subtasks.
Instance | Pointer to the DISK_IO_PRIVATE_DATA. |
TRUE | The Instance->TaskQueue is empty after the completed tasks are removed. |
FALSE | The Instance->TaskQueue is not empty after the completed tasks are removed. |
EFI_STATUS EFIAPI DiskIo2WriteDiskEx | ( | IN EFI_DISK_IO2_PROTOCOL * | This, |
IN UINT32 | MediaId, | ||
IN UINT64 | Offset, | ||
IN OUT EFI_DISK_IO2_TOKEN * | Token, | ||
IN UINTN | BufferSize, | ||
IN VOID * | Buffer | ||
) |
Writes a specified number of bytes to a device.
This | Indicates a pointer to the calling context. |
MediaId | ID of the medium to be written. |
Offset | The starting byte offset on the logical block I/O device to write to. |
Token | A pointer to the token associated with the transaction. If this field is NULL, synchronous/blocking IO is performed. |
BufferSize | The size in bytes of Buffer. The number of bytes to write to the device. |
Buffer | A pointer to the buffer containing the data to be written. |
EFI_SUCCESS | If Event is NULL (blocking I/O): The data was written correctly to the device. If Event is not NULL (asynchronous I/O): The request was successfully queued for processing. Event will be signaled upon completion. |
EFI_WRITE_PROTECTED | The device cannot be written to. |
EFI_DEVICE_ERROR | The device reported an error while performing the write operation. |
EFI_NO_MEDIA | There is no medium in the device. |
EFI_MEDIA_CHNAGED | The MediaId is not for the current medium. |
EFI_INVALID_PARAMETER | The write request contains device addresses that are not valid for the device. |
EFI_OUT_OF_RESOURCES | The request could not be completed due to a lack of resources. |
DISK_IO_SUBTASK * DiskIoCreateSubtask | ( | IN BOOLEAN | Write, |
IN UINT64 | Lba, | ||
IN UINT32 | Offset, | ||
IN UINTN | Length, | ||
IN VOID *WorkingBuffer | OPTIONAL, | ||
IN VOID * | Buffer, | ||
IN BOOLEAN | Blocking | ||
) |
Create the subtask.
Write | TRUE: Write request; FALSE: Read request. |
Lba | The starting logical block address to read from on the device. |
Offset | The starting byte offset to read from the LBA. |
Length | The number of bytes to read from the device. |
WorkingBuffer | The aligned buffer to hold the data for reading or writing. |
Buffer | The buffer to hold the data for reading or writing. |
Blocking | TRUE: Blocking request; FALSE: Non-blocking request. |
BOOLEAN DiskIoCreateSubtaskList | ( | IN DISK_IO_PRIVATE_DATA * | Instance, |
IN BOOLEAN | Write, | ||
IN UINT64 | Offset, | ||
IN UINTN | BufferSize, | ||
IN VOID * | Buffer, | ||
IN BOOLEAN | Blocking, | ||
IN VOID * | SharedWorkingBuffer, | ||
IN OUT LIST_ENTRY * | Subtasks | ||
) |
Create the subtask list.
Instance | Pointer to the DISK_IO_PRIVATE_DATA. |
Write | TRUE: Write request; FALSE: Read request. |
Offset | The starting byte offset to read from the device. |
BufferSize | The size in bytes of Buffer. The number of bytes to read from the device. |
Buffer | A pointer to the buffer for the data. |
Blocking | TRUE: Blocking request; FALSE: Non-blocking request. |
SharedWorkingBuffer | The aligned buffer to hold the data for reading or writing. |
Subtasks | The subtask list header. |
TRUE | The subtask list is created successfully. |
FALSE | The subtask list is not created. |
LIST_ENTRY * DiskIoDestroySubtask | ( | IN DISK_IO_PRIVATE_DATA * | Instance, |
IN DISK_IO_SUBTASK * | Subtask | ||
) |
Destroy the sub task.
Instance | Pointer to the DISK_IO_PRIVATE_DATA. |
Subtask | Subtask. |
EFI_STATUS EFIAPI DiskIoDriverBindingStart | ( | IN EFI_DRIVER_BINDING_PROTOCOL * | This, |
IN EFI_HANDLE | ControllerHandle, | ||
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath | OPTIONAL | ||
) |
Start this driver on ControllerHandle by opening a Block IO protocol and installing a Disk IO protocol on ControllerHandle.
This | Protocol instance pointer. |
ControllerHandle | Handle of device to bind driver to |
RemainingDevicePath | Optional parameter use to pick a specific child device to start. |
EFI_SUCCESS | This driver is added to ControllerHandle |
EFI_ALREADY_STARTED | This driver is already running on ControllerHandle |
other | This driver does not support this device |
EFI_STATUS EFIAPI DiskIoDriverBindingStop | ( | IN EFI_DRIVER_BINDING_PROTOCOL * | This, |
IN EFI_HANDLE | ControllerHandle, | ||
IN UINTN | NumberOfChildren, | ||
IN EFI_HANDLE * | ChildHandleBuffer | ||
) |
Stop this driver on ControllerHandle by removing Disk IO protocol and closing the Block IO protocol on ControllerHandle.
This | Protocol instance pointer. |
ControllerHandle | Handle of device to stop driver on |
NumberOfChildren | Number of Handles in ChildHandleBuffer. If number of children is zero stop the entire bus driver. |
ChildHandleBuffer | List of Child Handles to Stop. |
EFI_SUCCESS | This driver is removed ControllerHandle |
other | This driver was not removed from this device |
EFI_STATUS EFIAPI DiskIoDriverBindingSupported | ( | IN EFI_DRIVER_BINDING_PROTOCOL * | This, |
IN EFI_HANDLE | ControllerHandle, | ||
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath | OPTIONAL | ||
) |
Test to see if this driver supports ControllerHandle.
This | Protocol instance pointer. |
ControllerHandle | Handle of device to test |
RemainingDevicePath | Optional parameter use to pick a specific child device to start. |
EFI_SUCCESS | This driver supports this device |
EFI_ALREADY_STARTED | This driver is already running on this device |
other | This driver does not support this device |
EFI_STATUS EFIAPI DiskIoReadDisk | ( | IN EFI_DISK_IO_PROTOCOL * | This, |
IN UINT32 | MediaId, | ||
IN UINT64 | Offset, | ||
IN UINTN | BufferSize, | ||
OUT VOID * | Buffer | ||
) |
Read BufferSize bytes from Offset into Buffer. Reads may support reads that are not aligned on sector boundaries. There are three cases: UnderRun - The first byte is not on a sector boundary or the read request is less than a sector in length. Aligned - A read of N contiguous sectors. OverRun - The last byte is not on a sector boundary.
This | Protocol instance pointer. |
MediaId | Id of the media, changes every time the media is replaced. |
Offset | The starting byte offset to read from |
BufferSize | Size of Buffer |
Buffer | Buffer containing read data |
EFI_SUCCESS | The data was read correctly from the device. |
EFI_DEVICE_ERROR | The device reported an error while performing the read. |
EFI_NO_MEDIA | There is no media in the device. |
EFI_MEDIA_CHNAGED | The MediaId does not matched the current device. |
EFI_INVALID_PARAMETER | The read request contains device addresses that are not valid for the device. |
EFI_STATUS EFIAPI DiskIoWriteDisk | ( | IN EFI_DISK_IO_PROTOCOL * | This, |
IN UINT32 | MediaId, | ||
IN UINT64 | Offset, | ||
IN UINTN | BufferSize, | ||
IN VOID * | Buffer | ||
) |
Writes BufferSize bytes from Buffer into Offset. Writes may require a read modify write to support writes that are not aligned on sector boundaries. There are three cases: UnderRun - The first byte is not on a sector boundary or the write request is less than a sector in length. Read modify write is required. Aligned - A write of N contiguous sectors. OverRun - The last byte is not on a sector boundary. Read modified write required.
This | Protocol instance pointer. |
MediaId | Id of the media, changes every time the media is replaced. |
Offset | The starting byte offset to read from |
BufferSize | Size of Buffer |
Buffer | Buffer containing read data |
EFI_SUCCESS | The data was written correctly to the device. |
EFI_WRITE_PROTECTED | The device can not be written to. |
EFI_DEVICE_ERROR | The device reported an error while performing the write. |
EFI_NO_MEDIA | There is no media in the device. |
EFI_MEDIA_CHNAGED | The MediaId does not matched the current device. |
EFI_INVALID_PARAMETER | The write request contains device addresses that are not valid for the device. |
EFI_STATUS EFIAPI InitializeDiskIo | ( | IN EFI_HANDLE | ImageHandle, |
IN EFI_SYSTEM_TABLE * | SystemTable | ||
) |
The user Entry Point for module DiskIo. The user code starts with this function.
[in] | ImageHandle | The firmware allocated handle for the EFI image. |
[in] | SystemTable | A pointer to the EFI System Table. |
EFI_SUCCESS | The entry point is executed successfully. |
other | Some error occurs when executing this entry point. |
EFI_DRIVER_BINDING_PROTOCOL gDiskIoDriverBinding |
DISK_IO_PRIVATE_DATA gDiskIoPrivateDataTemplate |