EDK2 doxygen online documents - Firmware Encoding Index 1
EDK2 doxygen online documents - Firmware Encoding Index
Data Structures | Defines | Typedefs | Functions | Variables

MdeModulePkg/Universal/Disk/PartitionDxe/Partition.h File Reference

#include <Uefi.h>
#include <Protocol/BlockIo.h>
#include <Protocol/BlockIo2.h>
#include <Guid/Gpt.h>
#include <Protocol/ComponentName.h>
#include <Protocol/DevicePath.h>
#include <Protocol/DriverBinding.h>
#include <Protocol/DiskIo.h>
#include <Library/DebugLib.h>
#include <Library/UefiDriverEntryPoint.h>
#include <Library/BaseLib.h>
#include <Library/UefiLib.h>
#include <Library/BaseMemoryLib.h>
#include <Library/MemoryAllocationLib.h>
#include <Library/UefiBootServicesTableLib.h>
#include <Library/DevicePathLib.h>
#include <IndustryStandard/Mbr.h>
#include <IndustryStandard/ElTorito.h>

Go to the source code of this file.

Data Structures

struct  PARTITION_PRIVATE_DATA
struct  EFI_PARTITION_ENTRY_STATUS

Defines

#define PARTITION_PRIVATE_DATA_SIGNATURE   SIGNATURE_32 ('P', 'a', 'r', 't')
#define PARTITION_DEVICE_FROM_BLOCK_IO_THIS(a)   CR (a, PARTITION_PRIVATE_DATA, BlockIo, PARTITION_PRIVATE_DATA_SIGNATURE)
#define PARTITION_DEVICE_FROM_BLOCK_IO2_THIS(a)   CR (a, PARTITION_PRIVATE_DATA, BlockIo2, PARTITION_PRIVATE_DATA_SIGNATURE)
#define UNPACK_INT32(a)
#define UNPACK_UINT32(a)

Typedefs

typedef EFI_STATUS(* PARTITION_DETECT_ROUTINE )(IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE Handle, IN EFI_DISK_IO_PROTOCOL *DiskIo, IN EFI_BLOCK_IO_PROTOCOL *BlockIo, IN EFI_BLOCK_IO2_PROTOCOL *BlockIo2, IN EFI_DEVICE_PATH_PROTOCOL *DevicePath)

Functions

EFI_STATUS EFIAPI PartitionDriverBindingSupported (IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE ControllerHandle, IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath)
EFI_STATUS EFIAPI PartitionDriverBindingStart (IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE ControllerHandle, IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath)
EFI_STATUS EFIAPI PartitionDriverBindingStop (IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE ControllerHandle, IN UINTN NumberOfChildren, IN EFI_HANDLE *ChildHandleBuffer)
EFI_STATUS EFIAPI PartitionComponentNameGetDriverName (IN EFI_COMPONENT_NAME_PROTOCOL *This, IN CHAR8 *Language, OUT CHAR16 **DriverName)
EFI_STATUS EFIAPI PartitionComponentNameGetControllerName (IN EFI_COMPONENT_NAME_PROTOCOL *This, IN EFI_HANDLE ControllerHandle, IN EFI_HANDLE ChildHandle OPTIONAL, IN CHAR8 *Language, OUT CHAR16 **ControllerName)
EFI_STATUS PartitionInstallChildHandle (IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE ParentHandle, IN EFI_DISK_IO_PROTOCOL *ParentDiskIo, 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_LBA Start, IN EFI_LBA End, IN UINT32 BlockSize, IN BOOLEAN InstallEspGuid)
EFI_STATUS PartitionInstallGptChildHandles (IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE Handle, IN EFI_DISK_IO_PROTOCOL *DiskIo, IN EFI_BLOCK_IO_PROTOCOL *BlockIo, IN EFI_BLOCK_IO2_PROTOCOL *BlockIo2, IN EFI_DEVICE_PATH_PROTOCOL *DevicePath)
EFI_STATUS PartitionInstallElToritoChildHandles (IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE Handle, IN EFI_DISK_IO_PROTOCOL *DiskIo, IN EFI_BLOCK_IO_PROTOCOL *BlockIo, IN EFI_BLOCK_IO2_PROTOCOL *BlockIo2, IN EFI_DEVICE_PATH_PROTOCOL *DevicePath)
EFI_STATUS PartitionInstallMbrChildHandles (IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE Handle, IN EFI_DISK_IO_PROTOCOL *DiskIo, IN EFI_BLOCK_IO_PROTOCOL *BlockIo, IN EFI_BLOCK_IO2_PROTOCOL *BlockIo2, IN EFI_DEVICE_PATH_PROTOCOL *DevicePath)

Variables

EFI_DRIVER_BINDING_PROTOCOL gPartitionDriverBinding
EFI_COMPONENT_NAME_PROTOCOL gPartitionComponentName
EFI_COMPONENT_NAME2_PROTOCOL gPartitionComponentName2

Detailed Description

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", Legacy MBR, and GPT partition schemes are supported.

Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at http://opensource.org/licenses/bsd-license.php

THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.

Definition in file Partition.h.


Define Documentation

#define PARTITION_DEVICE_FROM_BLOCK_IO2_THIS (   a)    CR (a, PARTITION_PRIVATE_DATA, BlockIo2, PARTITION_PRIVATE_DATA_SIGNATURE)

Definition at line 68 of file Partition.h.

#define PARTITION_DEVICE_FROM_BLOCK_IO_THIS (   a)    CR (a, PARTITION_PRIVATE_DATA, BlockIo, PARTITION_PRIVATE_DATA_SIGNATURE)

Definition at line 67 of file Partition.h.

#define PARTITION_PRIVATE_DATA_SIGNATURE   SIGNATURE_32 ('P', 'a', 'r', 't')

Definition at line 45 of file Partition.h.

#define UNPACK_INT32 (   a)
Value:
(INT32)( (((UINT8 *) a)[0] <<  0) |    \
                                 (((UINT8 *) a)[1] <<  8) |    \
                                 (((UINT8 *) a)[2] << 16) |    \
                                 (((UINT8 *) a)[3] << 24) )

Definition at line 80 of file Partition.h.

#define UNPACK_UINT32 (   a)
Value:
(UINT32)( (((UINT8 *) a)[0] <<  0) |    \
                                   (((UINT8 *) a)[1] <<  8) |    \
                                   (((UINT8 *) a)[2] << 16) |    \
                                   (((UINT8 *) a)[3] << 24) )

Definition at line 88 of file Partition.h.


Typedef Documentation

Definition at line 418 of file Partition.h.


Function Documentation

EFI_STATUS EFIAPI PartitionComponentNameGetControllerName ( IN EFI_COMPONENT_NAME_PROTOCOL This,
IN EFI_HANDLE  ControllerHandle,
IN EFI_HANDLE ChildHandle  OPTIONAL,
IN CHAR8 Language,
OUT CHAR16 **  ControllerName 
)

Retrieves a Unicode string that is the user readable name of the controller that is being managed by a driver.

This function retrieves the user readable name of the controller specified by ControllerHandle and ChildHandle in the form of a Unicode string. If the driver specified by This has a user readable name in the language specified by Language, then a pointer to the controller name is returned in ControllerName, and EFI_SUCCESS is returned. If the driver specified by This is not currently managing the controller specified by ControllerHandle and ChildHandle, then EFI_UNSUPPORTED is returned. If the driver specified by This does not support the language specified by Language, then EFI_UNSUPPORTED is returned.

Parameters:
This[in]A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or EFI_COMPONENT_NAME_PROTOCOL instance.
ControllerHandle[in]The handle of a controller that the driver specified by This is managing. This handle specifies the controller whose name is to be returned.
ChildHandle[in]The handle of the child controller to retrieve the name of. This is an optional parameter that may be NULL. It will be NULL for device drivers. It will also be NULL for a bus drivers that wish to retrieve the name of the bus controller. It will not be NULL for a bus driver that wishes to retrieve the name of a child controller.
Language[in]A pointer to a Null-terminated ASCII string array indicating the language. This is the language of the driver name that the caller is requesting, and it must match one of the languages specified in SupportedLanguages. The number of languages supported by a driver is up to the driver writer. Language is specified in RFC 4646 or ISO 639-2 language code format.
ControllerName[out]A pointer to the Unicode string to return. This Unicode string is the name of the controller specified by ControllerHandle and ChildHandle in the language specified by Language from the point of view of the driver specified by This.
Return values:
EFI_SUCCESSThe Unicode string for the user readable name in the language specified by Language for the driver specified by This was returned in DriverName.
EFI_INVALID_PARAMETERControllerHandle is not a valid EFI_HANDLE.
EFI_INVALID_PARAMETERChildHandle is not NULL and it is not a valid EFI_HANDLE.
EFI_INVALID_PARAMETERLanguage is NULL.
EFI_INVALID_PARAMETERControllerName is NULL.
EFI_UNSUPPORTEDThe driver specified by This is not currently managing the controller specified by ControllerHandle and ChildHandle.
EFI_UNSUPPORTEDThe driver specified by This does not support the language specified by Language.

Retrieves a Unicode string that is the user readable name of the controller that is being managed by a driver.

This function retrieves the user readable name of the controller specified by ControllerHandle and ChildHandle in the form of a Unicode string. If the driver specified by This has a user readable name in the language specified by Language, then a pointer to the controller name is returned in ControllerName, and EFI_SUCCESS is returned. If the driver specified by This is not currently managing the controller specified by ControllerHandle and ChildHandle, then EFI_UNSUPPORTED is returned. If the driver specified by This does not support the language specified by Language, then EFI_UNSUPPORTED is returned.

Parameters:
This[in]A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or EFI_COMPONENT_NAME_PROTOCOL instance.
ControllerHandle[in]The handle of a controller that the driver specified by This is managing. This handle specifies the controller whose name is to be returned.
ChildHandle[in]The handle of the child controller to retrieve the name of. This is an optional parameter that may be NULL. It will be NULL for device drivers. It will also be NULL for a bus drivers that wish to retrieve the name of the bus controller. It will not be NULL for a bus driver that wishes to retrieve the name of a child controller.
Language[in]A pointer to a Null-terminated ASCII string array indicating the language. This is the language of the driver name that the caller is requesting, and it must match one of the languages specified in SupportedLanguages. The number of languages supported by a driver is up to the driver writer. Language is specified in RFC 4646 or ISO 639-2 language code format.
ControllerName[out]A pointer to the Unicode string to return. This Unicode string is the name of the controller specified by ControllerHandle and ChildHandle in the language specified by Language from the point of view of the driver specified by This.
Return values:
EFI_SUCCESSThe Unicode string for the user readable name in the language specified by Language for the driver specified by This was returned in DriverName.
EFI_INVALID_PARAMETERControllerHandle is NULL.
EFI_INVALID_PARAMETERChildHandle is not NULL and it is not a valid EFI_HANDLE.
EFI_INVALID_PARAMETERLanguage is NULL.
EFI_INVALID_PARAMETERControllerName is NULL.
EFI_UNSUPPORTEDThe driver specified by This is not currently managing the controller specified by ControllerHandle and ChildHandle.
EFI_UNSUPPORTEDThe driver specified by This does not support the language specified by Language.

Definition at line 179 of file ComponentName.c.

EFI_STATUS EFIAPI PartitionComponentNameGetDriverName ( IN EFI_COMPONENT_NAME_PROTOCOL This,
IN CHAR8 Language,
OUT CHAR16 **  DriverName 
)

Retrieves a Unicode string that is the user readable name of the driver.

This function retrieves the user readable name of a driver in the form of a Unicode string. If the driver specified by This has a user readable name in the language specified by Language, then a pointer to the driver name is returned in DriverName, and EFI_SUCCESS is returned. If the driver specified by This does not support the language specified by Language, then EFI_UNSUPPORTED is returned.

Parameters:
This[in]A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or EFI_COMPONENT_NAME_PROTOCOL instance.
Language[in]A pointer to a Null-terminated ASCII string array indicating the language. This is the language of the driver name that the caller is requesting, and it must match one of the languages specified in SupportedLanguages. The number of languages supported by a driver is up to the driver writer. Language is specified in RFC 4646 or ISO 639-2 language code format.
DriverName[out]A pointer to the Unicode string to return. This Unicode string is the name of the driver specified by This in the language specified by Language.
Return values:
EFI_SUCCESSThe Unicode string for the Driver specified by This and the language specified by Language was returned in DriverName.
EFI_INVALID_PARAMETERLanguage is NULL.
EFI_INVALID_PARAMETERDriverName is NULL.
EFI_UNSUPPORTEDThe driver specified by This does not support the language specified by Language.

Definition at line 93 of file ComponentName.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 and Disk IO protocol, reading Device Path, and creating a child handle with a Disk IO and device path protocol.

Parameters:
ThisProtocol instance pointer.
ControllerHandleHandle of device to bind driver to
RemainingDevicePathOptional parameter use to pick a specific child device to start.
Return values:
EFI_SUCCESSThis driver is added to ControllerHandle
EFI_ALREADY_STARTEDThis driver is already running on ControllerHandle
otherThis driver does not support this device

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.

Parameters:
[in]ThisProtocol instance pointer.
[in]ControllerHandleHandle of device to bind driver to
[in]RemainingDevicePathOptional parameter use to pick a specific child device to start.
Return values:
EFI_SUCCESSThis driver is added to ControllerHandle
EFI_ALREADY_STARTEDThis driver is already running on ControllerHandle
otherThis driver does not support this device

Definition at line 209 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.

Parameters:
ThisProtocol instance pointer.
ControllerHandleHandle of device to stop driver on
NumberOfChildrenNumber of Handles in ChildHandleBuffer. If number of children is zero stop the entire bus driver.
ChildHandleBufferList of Child Handles to Stop.
Return values:
EFI_SUCCESSThis driver is removed ControllerHandle
otherThis driver was not removed from this device

Definition at line 398 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 can be supported.

Parameters:
ThisProtocol instance pointer.
ControllerHandleHandle of device to test
RemainingDevicePathOptional parameter use to pick a specific child device to start.
Return values:
EFI_SUCCESSThis driver supports this device
EFI_ALREADY_STARTEDThis driver is already running on this device
otherThis driver does not support this device

Test to see if this driver supports ControllerHandle. Any ControllerHandle than contains a BlockIo and DiskIo protocol or a BlockIo2 protocol can be supported.

Parameters:
[in]ThisProtocol instance pointer.
[in]ControllerHandleHandle of device to test.
[in]RemainingDevicePathOptional parameter use to pick a specific child device to start.
Return values:
EFI_SUCCESSThis driver supports this device
EFI_ALREADY_STARTEDThis driver is already running on this device
otherThis driver does not support this device

Definition at line 68 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_BLOCK_IO_PROTOCOL ParentBlockIo,
IN EFI_BLOCK_IO2_PROTOCOL ParentBlockIo2,
IN EFI_DEVICE_PATH_PROTOCOL ParentDevicePath,
IN EFI_DEVICE_PATH_PROTOCOL DevicePathNode,
IN EFI_LBA  Start,
IN EFI_LBA  End,
IN UINT32  BlockSize,
IN BOOLEAN  InstallEspGuid 
)

Create a child handle for a logical block device that represents the bytes Start to End of the Parent Block IO device.

Parameters:
[in]ThisProtocol instance pointer.
[in]ParentHandleParent Handle for new child.
[in]ParentDiskIoParent DiskIo interface.
[in]ParentBlockIoParent BlockIo interface.
[in]ParentBlockIo2Parent BlockIo2 interface.
[in]ParentDevicePathParent Device Path.
[in]DevicePathNodeChild Device Path node.
[in]StartStart Block.
[in]EndEnd Block.
[in]BlockSizeChild block size.
[in]InstallEspGuidFlag to install EFI System Partition GUID on handle.
Return values:
EFI_SUCCESSA child handle was added.
otherA child handle was not added.

Definition at line 1022 of file Partition.c.

EFI_STATUS PartitionInstallElToritoChildHandles ( IN EFI_DRIVER_BINDING_PROTOCOL This,
IN EFI_HANDLE  Handle,
IN EFI_DISK_IO_PROTOCOL DiskIo,
IN EFI_BLOCK_IO_PROTOCOL BlockIo,
IN EFI_BLOCK_IO2_PROTOCOL BlockIo2,
IN EFI_DEVICE_PATH_PROTOCOL DevicePath 
)

Install child handles if the Handle supports El Torito format.

Parameters:
[in]ThisCalling context.
[in]HandleParent Handle.
[in]DiskIoParent DiskIo interface.
[in]BlockIoParent BlockIo interface.
[in]BlockIo2Parent BlockIo2 interface.
[in]DevicePathParent Device Path
Return values:
EFI_SUCCESSChild handle(s) was added.
EFI_MEDIA_CHANGEDMedia changed Detected.
otherno child handle was added.

Definition at line 36 of file ElTorito.c.

EFI_STATUS PartitionInstallGptChildHandles ( IN EFI_DRIVER_BINDING_PROTOCOL This,
IN EFI_HANDLE  Handle,
IN EFI_DISK_IO_PROTOCOL DiskIo,
IN EFI_BLOCK_IO_PROTOCOL BlockIo,
IN EFI_BLOCK_IO2_PROTOCOL BlockIo2,
IN EFI_DEVICE_PATH_PROTOCOL DevicePath 
)

Install child handles if the Handle supports GPT partition structure.

Parameters:
[in]ThisCalling context.
[in]HandleParent Handle.
[in]DiskIoParent DiskIo interface.
[in]BlockIoParent BlockIo interface.
[in]BlockIo2Parent BlockIo2 interface.
[in]DevicePathParent Device Path.
Return values:
EFI_SUCCESSValid GPT disk.
EFI_MEDIA_CHANGEDMedia changed Detected.
EFI_INVALID_PARAMETERIf both BlockIo and BlockIo2 are NULL;
otherNot a valid GPT disk.

Install child handles if the Handle supports GPT partition structure.

Parameters:
[in]ThisCalling context.
[in]HandleParent Handle.
[in]DiskIoParent DiskIo interface.
[in]BlockIoParent BlockIo interface.
[in]BlockIo2Parent BlockIo2 interface.
[in]DevicePathParent Device Path.
Return values:
EFI_SUCCESSValid GPT disk.
EFI_MEDIA_CHANGEDMedia changed Detected.
otherNot a valid GPT disk.

Definition at line 174 of file Gpt.c.

EFI_STATUS PartitionInstallMbrChildHandles ( IN EFI_DRIVER_BINDING_PROTOCOL This,
IN EFI_HANDLE  Handle,
IN EFI_DISK_IO_PROTOCOL DiskIo,
IN EFI_BLOCK_IO_PROTOCOL BlockIo,
IN EFI_BLOCK_IO2_PROTOCOL BlockIo2,
IN EFI_DEVICE_PATH_PROTOCOL DevicePath 
)

Install child handles if the Handle supports MBR format.

Parameters:
[in]ThisCalling context.
[in]HandleParent Handle.
[in]DiskIoParent DiskIo interface.
[in]BlockIoParent BlockIo interface.
[in]BlockIo2Parent BlockIo2 interface.
[in]DevicePathParent Device Path.
Return values:
EFI_SUCCESSA child handle was added.
EFI_MEDIA_CHANGEDMedia change was detected.
OthersMBR partition was not found.

Definition at line 117 of file Mbr.c.


Variable Documentation

Definition at line 20 of file ComponentName.c.

Definition at line 29 of file ComponentName.c.

Definition at line 24 of file Partition.c.

 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Defines