TianoCore EDK2 master
|
#include "Partition.h"
Go to the source code of this file.
Variables | |
EFI_DRIVER_BINDING_PROTOCOL | gPartitionDriverBinding |
PARTITION_DETECT_ROUTINE | mPartitionDetectRoutineTable [] |
Partition driver that produces logical BlockIo devices from a physical BlockIo device. The logical BlockIo devices are based on the format of the raw block devices media. Currently "El Torito CD-ROM", UDF, Legacy MBR, and GPT partition schemes are supported.
Copyright (c) 2018 Qualcomm Datacenter Technologies, Inc. Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent
Definition in file Partition.c.
BOOLEAN HasChildren | ( | IN EFI_HANDLE | ControllerHandle | ) |
Test to see if there is any child on ControllerHandle.
[in] | ControllerHandle | Handle of device to test. |
TRUE | There are children on the ControllerHandle. |
FALSE | No child is on the ControllerHandle. |
Definition at line 1355 of file Partition.c.
EFI_STATUS EFIAPI InitializePartition | ( | IN EFI_HANDLE | ImageHandle, |
IN EFI_SYSTEM_TABLE * | SystemTable | ||
) |
The user Entry Point for module Partition. 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. |
Definition at line 1322 of file Partition.c.
PARTITION_ACCESS_TASK * PartitionCreateAccessTask | ( | IN EFI_BLOCK_IO2_TOKEN * | Token | ) |
Create a new PARTITION_ACCESS_TASK instance.
Token | Pointer to the EFI_BLOCK_IO2_TOKEN. |
Definition at line 875 of file Partition.c.
EFI_STATUS EFIAPI PartitionDriverBindingStart | ( | IN EFI_DRIVER_BINDING_PROTOCOL * | This, |
IN EFI_HANDLE | ControllerHandle, | ||
IN EFI_DEVICE_PATH_PROTOCOL * | RemainingDevicePath | ||
) |
Start this driver on ControllerHandle by opening a Block IO or a Block IO2 or both, and Disk IO protocol, reading Device Path, and creating a child handle with a Disk IO and device path protocol.
[in] | This | Protocol instance pointer. |
[in] | ControllerHandle | Handle of device to bind driver to |
[in] | 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 |
Definition at line 194 of file Partition.c.
EFI_STATUS EFIAPI PartitionDriverBindingStop | ( | IN EFI_DRIVER_BINDING_PROTOCOL * | This, |
IN EFI_HANDLE | ControllerHandle, | ||
IN UINTN | NumberOfChildren, | ||
IN EFI_HANDLE * | ChildHandleBuffer | ||
) |
Stop this driver on ControllerHandle. Support stopping any child handles created by this driver.
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 |
Definition at line 399 of file Partition.c.
EFI_STATUS EFIAPI PartitionDriverBindingSupported | ( | IN EFI_DRIVER_BINDING_PROTOCOL * | This, |
IN EFI_HANDLE | ControllerHandle, | ||
IN EFI_DEVICE_PATH_PROTOCOL * | RemainingDevicePath | ||
) |
Test to see if this driver supports ControllerHandle. Any ControllerHandle than contains a BlockIo and DiskIo protocol or a BlockIo2 protocol can be supported.
[in] | This | Protocol instance pointer. |
[in] | ControllerHandle | Handle of device to test. |
[in] | 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 |
Definition at line 70 of file Partition.c.
EFI_STATUS EFIAPI PartitionFlushBlocks | ( | IN EFI_BLOCK_IO_PROTOCOL * | This | ) |
Flush the parent Block Device.
This | Protocol instance pointer. |
EFI_SUCCESS | All outstanding data was written to the device |
EFI_DEVICE_ERROR | The device reported an error while writting back the data |
EFI_NO_MEDIA | There is no media in the device. |
Definition at line 766 of file Partition.c.
EFI_STATUS EFIAPI PartitionFlushBlocksEx | ( | IN EFI_BLOCK_IO2_PROTOCOL * | This, |
IN OUT EFI_BLOCK_IO2_TOKEN * | Token | ||
) |
Flush the Block Device.
If EFI_DEVICE_ERROR, EFI_NO_MEDIA,_EFI_WRITE_PROTECTED or EFI_MEDIA_CHANGED is returned and non-blocking I/O is being used, the Event associated with this request will not be signaled.
[in] | This | Indicates a pointer to the calling context. |
[in,out] | Token | A pointer to the token associated with the transaction |
EFI_SUCCESS | The flush request was queued if Event is not NULL. All outstanding data was written correctly to the device if the Event is NULL. |
EFI_DEVICE_ERROR | The device reported an error while writting back the data. |
EFI_WRITE_PROTECTED | The device cannot be written to. |
EFI_NO_MEDIA | There is no media in the device. |
EFI_MEDIA_CHANGED | The MediaId is not for the current media. |
EFI_OUT_OF_RESOURCES | The request could not be completed due to a lack of resources. |
Definition at line 1082 of file Partition.c.
EFI_STATUS PartitionInstallChildHandle | ( | IN EFI_DRIVER_BINDING_PROTOCOL * | This, |
IN EFI_HANDLE | ParentHandle, | ||
IN EFI_DISK_IO_PROTOCOL * | ParentDiskIo, | ||
IN EFI_DISK_IO2_PROTOCOL * | ParentDiskIo2, | ||
IN EFI_BLOCK_IO_PROTOCOL * | ParentBlockIo, | ||
IN EFI_BLOCK_IO2_PROTOCOL * | ParentBlockIo2, | ||
IN EFI_DEVICE_PATH_PROTOCOL * | ParentDevicePath, | ||
IN EFI_DEVICE_PATH_PROTOCOL * | DevicePathNode, | ||
IN EFI_PARTITION_INFO_PROTOCOL * | PartitionInfo, | ||
IN EFI_LBA | Start, | ||
IN EFI_LBA | End, | ||
IN UINT32 | BlockSize, | ||
IN EFI_GUID * | TypeGuid | ||
) |
Create a child handle for a logical block device that represents the bytes Start to End of the Parent Block IO device.
[in] | This | Protocol instance pointer. |
[in] | ParentHandle | Parent Handle for new child. |
[in] | ParentDiskIo | Parent DiskIo interface. |
[in] | ParentDiskIo2 | Parent DiskIo2 interface. |
[in] | ParentBlockIo | Parent BlockIo interface. |
[in] | ParentBlockIo2 | Parent BlockIo2 interface. |
[in] | ParentDevicePath | Parent Device Path. |
[in] | DevicePathNode | Child Device Path node. |
[in] | PartitionInfo | Child Partition Information interface. |
[in] | Start | Start Block. |
[in] | End | End Block. |
[in] | BlockSize | Child block size. |
[in] | TypeGuid | Partition GUID Type. |
EFI_SUCCESS | A child handle was added. |
other | A child handle was not added. |
Definition at line 1134 of file Partition.c.
The general callback for the DiskIo2 interfaces.
Event | Event whose notification function is being invoked. |
Context | The pointer to the notification function's context, which points to the PARTITION_ACCESS_TASK instance. |
Definition at line 850 of file Partition.c.
EFI_STATUS EFIAPI PartitionReadBlocks | ( | IN EFI_BLOCK_IO_PROTOCOL * | This, |
IN UINT32 | MediaId, | ||
IN EFI_LBA | Lba, | ||
IN UINTN | BufferSize, | ||
OUT VOID * | Buffer | ||
) |
Read by using the Disk IO protocol on the parent device. Lba addresses must be converted to byte offsets.
This | Protocol instance pointer. |
MediaId | Id of the media, changes every time the media is replaced. |
Lba | The starting Logical Block Address to read from |
BufferSize | Size of Buffer, must be a multiple of device block size. |
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_CHANGED | The MediaId does not matched the current device. |
EFI_BAD_BUFFER_SIZE | The Buffer was not a multiple of the block size of the device. |
EFI_INVALID_PARAMETER | The read request contains device addresses that are not valid for the device. |
Definition at line 672 of file Partition.c.
EFI_STATUS EFIAPI PartitionReadBlocksEx | ( | IN EFI_BLOCK_IO2_PROTOCOL * | This, |
IN UINT32 | MediaId, | ||
IN EFI_LBA | Lba, | ||
IN OUT EFI_BLOCK_IO2_TOKEN * | Token, | ||
IN UINTN | BufferSize, | ||
OUT VOID * | Buffer | ||
) |
Read BufferSize bytes from Lba into Buffer.
This function reads the requested number of blocks from the device. All the blocks are read, or an error is returned. If EFI_DEVICE_ERROR, EFI_NO_MEDIA,_or EFI_MEDIA_CHANGED is returned and non-blocking I/O is being used, the Event associated with this request will not be signaled.
[in] | This | Indicates a pointer to the calling context. |
[in] | MediaId | Id of the media, changes every time the media is replaced. |
[in] | Lba | The starting Logical Block Address to read from. |
[in,out] | Token | A pointer to the token associated with the transaction. |
[in] | BufferSize | Size of Buffer, must be a multiple of device block size. |
[out] | Buffer | A pointer to the destination buffer for the data. The caller is responsible for either having implicit or explicit ownership of the buffer. |
EFI_SUCCESS | The read request was queued if Token->Event is not NULL.The data was read correctly from the device if the Token->Event is NULL. |
EFI_DEVICE_ERROR | The device reported an error while performing the read. |
EFI_NO_MEDIA | There is no media in the device. |
EFI_MEDIA_CHANGED | The MediaId is not for the current media. |
EFI_BAD_BUFFER_SIZE | The BufferSize parameter is not a multiple of the intrinsic block size of the device. |
EFI_INVALID_PARAMETER | The read request contains LBAs that are not valid, or the buffer is not on proper alignment. |
EFI_OUT_OF_RESOURCES | The request could not be completed due to a lack of resources. |
Definition at line 939 of file Partition.c.
EFI_STATUS EFIAPI PartitionReset | ( | IN EFI_BLOCK_IO_PROTOCOL * | This, |
IN BOOLEAN | ExtendedVerification | ||
) |
Reset the Block Device.
This | Protocol instance pointer. |
ExtendedVerification | Driver may perform diagnostics on reset. |
EFI_SUCCESS | The device was reset. |
EFI_DEVICE_ERROR | The device is not functioning properly and could not be reset. |
Definition at line 599 of file Partition.c.
EFI_STATUS EFIAPI PartitionResetEx | ( | IN EFI_BLOCK_IO2_PROTOCOL * | This, |
IN BOOLEAN | ExtendedVerification | ||
) |
Reset the Block Device throught Block I/O2 protocol.
This | Protocol instance pointer. |
ExtendedVerification | Driver may perform diagnostics on reset. |
EFI_SUCCESS | The device was reset. |
EFI_DEVICE_ERROR | The device is not functioning properly and could not be reset. |
Definition at line 827 of file Partition.c.
EFI_STATUS EFIAPI PartitionWriteBlocks | ( | IN EFI_BLOCK_IO_PROTOCOL * | This, |
IN UINT32 | MediaId, | ||
IN EFI_LBA | Lba, | ||
IN UINTN | BufferSize, | ||
IN VOID * | Buffer | ||
) |
Write by using the Disk IO protocol on the parent device. Lba addresses must be converted to byte offsets.
[in] | This | Protocol instance pointer. |
[in] | MediaId | Id of the media, changes every time the media is replaced. |
[in] | Lba | The starting Logical Block Address to read from |
[in] | BufferSize | Size of Buffer, must be a multiple of device block size. |
[in] | Buffer | Buffer containing data to be written to device. |
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_BAD_BUFFER_SIZE | The Buffer was not a multiple of the block size of the device. |
EFI_INVALID_PARAMETER | The write request contains a LBA that is not valid for the device. |
Definition at line 724 of file Partition.c.
EFI_STATUS EFIAPI PartitionWriteBlocksEx | ( | IN EFI_BLOCK_IO2_PROTOCOL * | This, |
IN UINT32 | MediaId, | ||
IN EFI_LBA | Lba, | ||
IN OUT EFI_BLOCK_IO2_TOKEN * | Token, | ||
IN UINTN | BufferSize, | ||
IN VOID * | Buffer | ||
) |
Write BufferSize bytes from Lba into Buffer.
This function writes the requested number of blocks to the device. All blocks are written, or an error is returned.If EFI_DEVICE_ERROR, EFI_NO_MEDIA, EFI_WRITE_PROTECTED or EFI_MEDIA_CHANGED is returned and non-blocking I/O is being used, the Event associated with this request will not be signaled.
[in] | This | Indicates a pointer to the calling context. |
[in] | MediaId | The media ID that the write request is for. |
[in] | Lba | The starting logical block address to be written. The caller is responsible for writing to only legitimate locations. |
[in,out] | Token | A pointer to the token associated with the transaction. |
[in] | BufferSize | Size of Buffer, must be a multiple of device block size. |
[in] | Buffer | A pointer to the source buffer for the data. |
EFI_SUCCESS | The write request was queued if Event is not NULL. The data was written correctly to the device if the Event is NULL. |
EFI_WRITE_PROTECTED | The device can not be written to. |
EFI_NO_MEDIA | There is no media in the device. |
EFI_MEDIA_CHNAGED | The MediaId does not matched the current device. |
EFI_DEVICE_ERROR | The device reported an error while performing the write. |
EFI_BAD_BUFFER_SIZE | The Buffer was not a multiple of the block size of the device. |
EFI_INVALID_PARAMETER | The write request contains LBAs that are not valid, or the buffer is not on proper alignment. |
EFI_OUT_OF_RESOURCES | The request could not be completed due to a lack of resources. |
Definition at line 1015 of file Partition.c.
EFI_STATUS ProbeMediaStatus | ( | IN EFI_DISK_IO_PROTOCOL * | DiskIo, |
IN UINT32 | MediaId, | ||
IN EFI_STATUS | DefaultStatus | ||
) |
Probe the media status and return EFI_NO_MEDIA or EFI_MEDIA_CHANGED for no media or media change case. Otherwise DefaultStatus is returned.
DiskIo | Pointer to the DiskIo instance. |
MediaId | Id of the media, changes every time the media is replaced. |
DefaultStatus | The default status to return when it's not the no media or media change case. |
EFI_NO_MEDIA | There is no media. |
EFI_MEDIA_CHANGED | The media was changed. |
others | The default status to return. |
Definition at line 628 of file Partition.c.
EFI_STATUS ProbeMediaStatusEx | ( | IN EFI_DISK_IO2_PROTOCOL * | DiskIo2, |
IN UINT32 | MediaId, | ||
IN EFI_STATUS | DefaultStatus | ||
) |
Probe the media status and return EFI_NO_MEDIA or EFI_MEDIA_CHANGED for no media or media change case. Otherwise DefaultStatus is returned.
DiskIo2 | Pointer to the DiskIo2 instance. |
MediaId | Id of the media, changes every time the media is replaced. |
DefaultStatus | The default status to return when it's not the no media or media change case. |
EFI_NO_MEDIA | There is no media. |
EFI_MEDIA_CHANGED | The media was changed. |
others | The default status to return. |
Definition at line 791 of file Partition.c.
EFI_DRIVER_BINDING_PROTOCOL gPartitionDriverBinding |
Definition at line 18 of file Partition.c.
PARTITION_DETECT_ROUTINE mPartitionDetectRoutineTable[] |
Definition at line 46 of file Partition.c.