// Prototypes\r
// Driver model protocol interface\r
//\r
+/**\r
+ Test to see if this driver supports ControllerHandle. \r
+\r
+ @param This Protocol instance pointer.\r
+ @param ControllerHandle Handle of device to test\r
+ @param RemainingDevicePath Optional parameter use to pick a specific child\r
+ device to start.\r
+\r
+ @retval EFI_SUCCESS This driver supports this device\r
+ @retval EFI_ALREADY_STARTED This driver is already running on this device\r
+ @retval other This driver does not support this device\r
+\r
+**/\r
EFI_STATUS\r
EFIAPI\r
DiskIoDriverBindingSupported (\r
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath\r
);\r
\r
+/**\r
+ Start this driver on ControllerHandle by opening a Block IO protocol and\r
+ installing a Disk IO protocol on ControllerHandle.\r
+\r
+ @param This Protocol instance pointer.\r
+ @param ControllerHandle Handle of device to bind driver to\r
+ @param RemainingDevicePath Optional parameter use to pick a specific child\r
+ device to start.\r
+\r
+ @retval EFI_SUCCESS This driver is added to ControllerHandle\r
+ @retval EFI_ALREADY_STARTED This driver is already running on ControllerHandle\r
+ @retval other This driver does not support this device\r
+\r
+**/\r
EFI_STATUS\r
EFIAPI\r
DiskIoDriverBindingStart (\r
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath\r
);\r
\r
+/**\r
+ Stop this driver on ControllerHandle by removing Disk IO protocol and closing\r
+ the Block IO protocol on ControllerHandle.\r
+\r
+ @param This Protocol instance pointer.\r
+ @param ControllerHandle Handle of device to stop driver on\r
+ @param NumberOfChildren Number of Handles in ChildHandleBuffer. If number of\r
+ children is zero stop the entire bus driver.\r
+ @param ChildHandleBuffer List of Child Handles to Stop.\r
+\r
+ @retval EFI_SUCCESS This driver is removed ControllerHandle\r
+ @retval other This driver was not removed from this device\r
+\r
+**/\r
EFI_STATUS\r
EFIAPI\r
DiskIoDriverBindingStop (\r
//\r
// Disk I/O Protocol Interface\r
//\r
+/**\r
+ Read BufferSize bytes from Offset into Buffer.\r
+ Reads may support reads that are not aligned on\r
+ sector boundaries. There are three cases:\r
+ UnderRun - The first byte is not on a sector boundary or the read request is\r
+ less than a sector in length.\r
+ Aligned - A read of N contiguous sectors.\r
+ OverRun - The last byte is not on a sector boundary.\r
+\r
+ @param This Protocol instance pointer.\r
+ @param MediaId Id of the media, changes every time the media is replaced.\r
+ @param Offset The starting byte offset to read from\r
+ @param BufferSize Size of Buffer\r
+ @param Buffer Buffer containing read data\r
+\r
+ @retval EFI_SUCCESS The data was read correctly from the device.\r
+ @retval EFI_DEVICE_ERROR The device reported an error while performing the read.\r
+ @retval EFI_NO_MEDIA There is no media in the device.\r
+ @retval EFI_MEDIA_CHNAGED The MediaId does not matched the current device.\r
+ @retval EFI_INVALID_PARAMETER The read request contains device addresses that are not\r
+ valid for the device.\r
+\r
+**/\r
EFI_STATUS\r
EFIAPI\r
DiskIoReadDisk (\r
OUT VOID *Buffer\r
);\r
\r
+/**\r
+ Read BufferSize bytes from Offset into Buffer.\r
+ Writes may require a read modify write to support writes that are not\r
+ aligned on sector boundaries. There are three cases:\r
+ UnderRun - The first byte is not on a sector boundary or the write request\r
+ is less than a sector in length. Read modify write is required.\r
+ Aligned - A write of N contiguous sectors.\r
+ OverRun - The last byte is not on a sector boundary. Read modified write\r
+ required.\r
+\r
+ @param This Protocol instance pointer.\r
+ @param MediaId Id of the media, changes every time the media is replaced.\r
+ @param Offset The starting byte offset to read from\r
+ @param BufferSize Size of Buffer\r
+ @param Buffer Buffer containing read data\r
+\r
+ @retval EFI_SUCCESS The data was written correctly to the device.\r
+ @retval EFI_WRITE_PROTECTED The device can not be written to.\r
+ @retval EFI_DEVICE_ERROR The device reported an error while performing the write.\r
+ @retval EFI_NO_MEDIA There is no media in the device.\r
+ @retval EFI_MEDIA_CHNAGED The MediaId does not matched the current device.\r
+ @retval EFI_INVALID_PARAMETER The write request contains device addresses that are not\r
+ valid for the device.\r
+\r
+**/\r
EFI_STATUS\r
EFIAPI\r
DiskIoWriteDisk (\r
#include "Partition.h"\r
\r
\r
+/**\r
+ Install child handles if the Handle supports GPT partition structure.\r
+\r
+ @param[in] BlockIo Parent BlockIo interface\r
+ @param[in] DiskIo Disk Io protocol.\r
+ @param[in] Lba The starting Lba of the Partition Table\r
+ @param[out] PartHeader Stores the partition table that is read\r
+\r
+ @retval TRUE The partition table is valid\r
+ @retval FALSE The partition table is not valid\r
+\r
+**/\r
BOOLEAN\r
PartitionValidGptTable (\r
IN EFI_BLOCK_IO_PROTOCOL *BlockIo,\r
);\r
\r
\r
+/**\r
+ Check if the CRC field in the Partition table header is valid\r
+ for Partition entry array.\r
+\r
+ @param[in] BlockIo Parent BlockIo interface\r
+ @param[in] DiskIo Disk Io Protocol.\r
+ @param[in] PartHeader Partition table header structure\r
+\r
+ @retval TRUE the CRC is valid\r
+ @retval FALSE the CRC is invalid\r
+\r
+**/\r
BOOLEAN\r
PartitionCheckGptEntryArrayCRC (\r
IN EFI_BLOCK_IO_PROTOCOL *BlockIo,\r
);\r
\r
\r
+/**\r
+ Restore Partition Table to its alternate place\r
+ (Primary -> Backup or Backup -> Primary)\r
+\r
+ @param[in] BlockIo Parent BlockIo interface\r
+ @param[in] DiskIo Disk Io Protocol.\r
+ @param[in] PartHeader Partition table header structure\r
+\r
+ @retval TRUE Restoring succeeds\r
+ @retval FALSE Restoring failed\r
+\r
+**/\r
BOOLEAN\r
PartitionRestoreGptTable (\r
IN EFI_BLOCK_IO_PROTOCOL *BlockIo,\r
);\r
\r
\r
+/**\r
+ Restore Partition Table to its alternate place\r
+ (Primary -> Backup or Backup -> Primary)\r
+\r
+ @param[in] PartHeader Partition table header structure\r
+ @param[in] PartEntry The partition entry array\r
+ @param[out] PEntryStatus the partition entry status array \r
+ recording the status of each partition\r
+\r
+**/\r
VOID\r
PartitionCheckGptEntry (\r
IN EFI_PARTITION_TABLE_HEADER *PartHeader,\r
);\r
\r
\r
+/**\r
+ Checks the CRC32 value in the table header\r
+\r
+ @param MaxSize Max Size limit\r
+ @param Size The size of the table\r
+ @param Hdr Table to check\r
+\r
+ @return TRUE CRC Valid\r
+ @return FALSE CRC Invalid\r
+\r
+**/\r
BOOLEAN\r
PartitionCheckCrcAltSize (\r
IN UINTN MaxSize,\r
);\r
\r
\r
+/**\r
+ Checks the CRC32 value in the table header\r
+\r
+ @param MaxSize Max Size limit\r
+ @param Hdr Table to check\r
+\r
+ @return TRUE CRC Valid\r
+ @return FALSE CRC Invalid\r
+\r
+**/\r
BOOLEAN\r
PartitionCheckCrc (\r
IN UINTN MaxSize,\r
);\r
\r
\r
+/**\r
+ Updates the CRC32 value in the table header\r
+\r
+ @param Size The size of the table\r
+ @param Hdr Table to update\r
+\r
+**/\r
VOID\r
PartitionSetCrcAltSize (\r
IN UINTN Size,\r
);\r
\r
\r
+/**\r
+ Updates the CRC32 value in the table header\r
+\r
+ @param Hdr Table to update\r
+\r
+**/\r
VOID\r
PartitionSetCrc (\r
IN OUT EFI_TABLE_HEADER *Hdr\r
@param[in] BlockIo Parent BlockIo interface\r
@param[in] DiskIo Disk Io protocol.\r
@param[in] Lba The starting Lba of the Partition Table\r
- @param[in] PartHeader Stores the partition table that is read\r
+ @param[out] PartHeader Stores the partition table that is read\r
\r
@retval TRUE The partition table is valid\r
@retval FALSE The partition table is not valid\r
@param[in] PartEntry The partition entry array\r
@param[out] PEntryStatus the partition entry status array \r
recording the status of each partition\r
+\r
**/\r
VOID\r
PartitionCheckGptEntry (\r
/**\r
Updates the CRC32 value in the table header\r
\r
- @param[in,out] Hdr Table to update\r
+ @param Hdr Table to update\r
\r
**/\r
VOID\r
/**\r
Updates the CRC32 value in the table header\r
\r
- @param[in] Size The size of the table\r
- @param[in,out] Hdr Table to update\r
+ @param Size The size of the table\r
+ @param Hdr Table to update\r
\r
**/\r
VOID\r
/**\r
Checks the CRC32 value in the table header\r
\r
- @param[in] MaxSize Max Size limit\r
- @param[in,out] Hdr Table to check\r
+ @param MaxSize Max Size limit\r
+ @param Hdr Table to check\r
\r
- @return TRUE CRC Valid\r
- @return FALSE CRC Invalid\r
+ @return TRUE CRC Valid\r
+ @return FALSE CRC Invalid\r
\r
**/\r
BOOLEAN\r
/**\r
Checks the CRC32 value in the table header\r
\r
- @param[in] MaxSize Max Size limit\r
- @param[in] Size The size of the table\r
- @param[in,out] Hdr Table to check\r
+ @param MaxSize Max Size limit\r
+ @param Size The size of the table\r
+ @param Hdr Table to check\r
\r
@return TRUE CRC Valid\r
@return FALSE CRC Invalid\r
\r
#include "Partition.h"\r
\r
+/**\r
+ Test to see if the Mbr buffer is a valid MBR.\r
+\r
+ @param Mbr Parent Handle.\r
+ @param LastLba Last Lba address on the device.\r
+ \r
+ @retval TRUE Mbr is a Valid MBR.\r
+ @retval FALSE Mbr is not a Valid MBR.\r
+\r
+**/\r
STATIC\r
BOOLEAN\r
PartitionValidMbr (\r
IN MASTER_BOOT_RECORD *Mbr,\r
IN EFI_LBA LastLba\r
)\r
-/*++\r
-\r
-Routine Description:\r
- Test to see if the Mbr buffer is a valid MBR\r
-\r
-Arguments: \r
- Mbr - Parent Handle \r
- LastLba - Last Lba address on the device.\r
-\r
-Returns:\r
- TRUE - Mbr is a Valid MBR\r
- FALSE - Mbr is not a Valid MBR\r
-\r
---*/\r
{\r
UINT32 StartingLBA;\r
UINT32 EndingLBA;\r
return MbrValid;\r
}\r
\r
+\r
+/**\r
+ Install child handles if the Handle supports MBR format.\r
+\r
+ @param This Calling context.\r
+ @param Handle Parent Handle.\r
+ @param DiskIo Parent DiskIo interface.\r
+ @param BlockIo Parent BlockIo interface.\r
+ @param DevicePath Parent Device Path.\r
+ \r
+ @retval EFI_SUCCESS A child handle was added.\r
+ @retval EFI_MEDIA_CHANGED Media change was detected.\r
+ @retval Others MBR partition was not found.\r
+\r
+**/\r
EFI_STATUS\r
PartitionInstallMbrChildHandles (\r
IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
IN EFI_BLOCK_IO_PROTOCOL *BlockIo,\r
IN EFI_DEVICE_PATH_PROTOCOL *DevicePath\r
)\r
-/*++\r
-\r
-Routine Description:\r
- Install child handles if the Handle supports MBR format.\r
-\r
-Arguments: \r
- This - Calling context.\r
- Handle - Parent Handle \r
- DiskIo - Parent DiskIo interface\r
- BlockIo - Parent BlockIo interface\r
- DevicePath - Parent Device Path\r
-\r
-Returns:\r
- EFI_SUCCESS - If a child handle was added\r
- EFI_MEDIA_CHANGED - Media changed Detected\r
- !EFI_SUCCESS - Not found MBR partition.\r
-\r
---*/\r
{\r
EFI_STATUS Status;\r
MASTER_BOOT_RECORD *Mbr;\r
Create a child handle for a logical block device that represents the\r
bytes Start to End of the Parent Block IO device.\r
\r
- @param[in] This Protocol instance pointer.\r
- @param[in] This Calling context.\r
+ @param[in] This Protocol instance pointer\r
@param[in] ParentHandle Parent Handle for new child\r
@param[in] ParentDiskIo Parent DiskIo interface\r
@param[in] ParentBlockIo Parent BlockIo interface\r
//\r
// Function Prototypes\r
//\r
+/**\r
+ Test to see if this driver supports ControllerHandle. Any ControllerHandle\r
+ than contains a BlockIo and DiskIo protocol can be supported.\r
+\r
+ @param This Protocol instance pointer.\r
+ @param ControllerHandle Handle of device to test\r
+ @param RemainingDevicePath Optional parameter use to pick a specific child\r
+ device to start.\r
+\r
+ @retval EFI_SUCCESS This driver supports this device\r
+ @retval EFI_ALREADY_STARTED This driver is already running on this device\r
+ @retval other This driver does not support this device\r
+\r
+**/\r
EFI_STATUS\r
EFIAPI\r
PartitionDriverBindingSupported (\r
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath\r
);\r
\r
+/**\r
+ Start this driver on ControllerHandle by opening a Block IO and Disk IO\r
+ protocol, reading Device Path, and creating a child handle with a\r
+ Disk IO and device path protocol.\r
+\r
+ @param This Protocol instance pointer.\r
+ @param ControllerHandle Handle of device to bind driver to\r
+ @param RemainingDevicePath Optional parameter use to pick a specific child\r
+ device to start.\r
+\r
+ @retval EFI_SUCCESS This driver is added to ControllerHandle\r
+ @retval EFI_ALREADY_STARTED This driver is already running on ControllerHandle\r
+ @retval other This driver does not support this device\r
+\r
+**/\r
EFI_STATUS\r
EFIAPI\r
PartitionDriverBindingStart (\r
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath\r
);\r
\r
+/**\r
+ Stop this driver on ControllerHandle. Support stoping any child handles\r
+ created by this driver.\r
+\r
+ @param This Protocol instance pointer.\r
+ @param ControllerHandle Handle of device to stop driver on\r
+ @param NumberOfChildren Number of Handles in ChildHandleBuffer. If number of\r
+ children is zero stop the entire bus driver.\r
+ @param ChildHandleBuffer List of Child Handles to Stop.\r
+\r
+ @retval EFI_SUCCESS This driver is removed ControllerHandle\r
+ @retval other This driver was not removed from this device\r
+\r
+**/\r
EFI_STATUS\r
EFIAPI\r
PartitionDriverBindingStop (\r
);\r
\r
\r
+/**\r
+ Create a child handle for a logical block device that represents the\r
+ bytes Start to End of the Parent Block IO device.\r
+\r
+ @param[in] This Protocol instance pointer\r
+ @param[in] ParentHandle Parent Handle for new child\r
+ @param[in] ParentDiskIo Parent DiskIo interface\r
+ @param[in] ParentBlockIo Parent BlockIo interface\r
+ @param[in] ParentDevicePath Parent Device Path\r
+ @param[in] DevicePathNode Child Device Path node\r
+ @param[in] Start Start Block\r
+ @param[in] End End Block\r
+ @param[in] BlockSize Child block size\r
+ @param[in] InstallEspGuid Flag to install EFI System Partition GUID on handle\r
+\r
+ @retval EFI_SUCCESS A child handle was added\r
+ @retval other A child handle was not added\r
+\r
+**/\r
EFI_STATUS\r
PartitionInstallChildHandle (\r
IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
)\r
;\r
\r
+/**\r
+ Install child handles if the Handle supports GPT partition structure.\r
+\r
+ @param[in] This - Calling context.\r
+ @param[in] Handle - Parent Handle\r
+ @param[in] DiskIo - Parent DiskIo interface\r
+ @param[in] BlockIo - Parent BlockIo interface\r
+ @param[in] DevicePath - Parent Device Path\r
+\r
+ @retval EFI_SUCCESS Valid GPT disk\r
+ @retval EFI_MEDIA_CHANGED Media changed Detected\r
+ @retval other Not a valid GPT disk\r
+\r
+**/\r
EFI_STATUS\r
PartitionInstallGptChildHandles (\r
IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
)\r
;\r
\r
+/**\r
+ Install child handles if the Handle supports El Torito format.\r
+\r
+ @param[in] This Calling context.\r
+ @param[in] Handle Parent Handle\r
+ @param[in] DiskIo Parent DiskIo interface\r
+ @param[in] BlockIo Parent BlockIo interface\r
+ @param[in] DevicePath Parent Device Path\r
+\r
+\r
+ @retval EFI_SUCCESS Child handle(s) was added\r
+ @retval EFI_MEDIA_CHANGED Media changed Detected\r
+ @retval other no child handle was added\r
+\r
+**/\r
EFI_STATUS\r
PartitionInstallElToritoChildHandles (\r
IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
)\r
;\r
\r
+/**\r
+ Install child handles if the Handle supports MBR format.\r
+\r
+ @param This Calling context.\r
+ @param Handle Parent Handle.\r
+ @param DiskIo Parent DiskIo interface.\r
+ @param BlockIo Parent BlockIo interface.\r
+ @param DevicePath Parent Device Path.\r
+ \r
+ @retval EFI_SUCCESS A child handle was added.\r
+ @retval EFI_MEDIA_CHANGED Media change was detected.\r
+ @retval Others MBR partition was not found.\r
+\r
+**/\r
EFI_STATUS\r
PartitionInstallMbrChildHandles (\r
IN EFI_DRIVER_BINDING_PROTOCOL *This,\r