"en"\r
};\r
\r
-\r
+//\r
+// Driver name table for DiskIo module.\r
+// It is shared by the implementation of ComponentName & ComponentName2 Protocol.\r
+//\r
GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mDiskIoDriverNameTable[] = {\r
{\r
"eng;en",\r
/** @file\r
- DiskIo driver that layers it's self on every Block IO protocol in the system.\r
+ DiskIo driver that lays on every BlockIo protocol in the system.\r
DiskIo converts a block oriented device to a byte oriented device.\r
\r
- ReadDisk may have to do reads that are not aligned on sector boundaries.\r
+ Disk access may have to handle unaligned request about sector boundaries.\r
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
\r
#include "DiskIo.h"\r
\r
+//\r
+// Driver binding protocol implementation for DiskIo driver.\r
+//\r
EFI_DRIVER_BINDING_PROTOCOL gDiskIoDriverBinding = {\r
DiskIoDriverBindingSupported,\r
DiskIoDriverBindingStart,\r
NULL\r
};\r
\r
+//\r
+// Template for DiskIo private data structure.\r
+// The pointer to BlockIo protocol interface is assigned dynamically.\r
+//\r
DISK_IO_PRIVATE_DATA gDiskIoPrivateDataTemplate = {\r
DISK_IO_PRIVATE_DATA_SIGNATURE,\r
{\r
\r
\r
/**\r
- Read BufferSize bytes from Offset into Buffer.\r
+ Writes BufferSize bytes from Buffer into Offset.\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
/** @file\r
- DiskIo driver that layers it's self on every Block IO protocol in the system.\r
- DiskIo converts a block oriented device to a byte oriented device.\r
+ Master header file for DiskIo driver. It includes the module private defininitions.\r
\r
Copyright (c) 2006 - 2008, Intel Corporation. <BR>\r
All rights reserved. This program and the accompanying materials\r
);\r
\r
/**\r
- Read BufferSize bytes from Offset into Buffer.\r
+ Writes BufferSize bytes from Buffer into Offset.\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
#/** @file\r
# \r
-# Component description file for DiskIo module.\r
+# This module lays DiskIo protocol on every blockIo protocol\r
+# to provide byte-oriented access to block media. \r
# \r
# Copyright (c) 2006 - 2008, Intel Corporation. <BR>\r
# All rights reserved. This program and the accompanying materials\r
"en"\r
};\r
\r
-\r
+//\r
+// Driver name table for Partition module.\r
+// It is shared by the implementation of ComponentName & ComponentName2 Protocol.\r
+//\r
GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mPartitionDriverNameTable[] = {\r
{\r
"eng;en",\r
- (CHAR16 *)L"Partition Driver(MBR/GPT/El Torito)"\r
+ L"Partition Driver(MBR/GPT/El Torito)"\r
},\r
{\r
NULL,\r
EFI_PARTITION_ENTRY *PartEntry;\r
EFI_PARTITION_ENTRY_STATUS *PEntryStatus;\r
UINTN Index;\r
- EFI_STATUS GptValid;\r
+ EFI_STATUS GptValidStatus;\r
HARDDRIVE_DEVICE_PATH HdDev;\r
\r
ProtectiveMbr = NULL;\r
DEBUG ((EFI_D_INFO, " BlockSize : %d \n", BlockSize));\r
DEBUG ((EFI_D_INFO, " LastBlock : %x \n", LastBlock));\r
\r
- GptValid = EFI_NOT_FOUND;\r
+ GptValidStatus = EFI_NOT_FOUND;\r
\r
//\r
// Allocate a buffer for the Protective MBR\r
ProtectiveMbr\r
);\r
if (EFI_ERROR (Status)) {\r
- GptValid = Status;\r
+ GptValidStatus = Status;\r
goto Done;\r
}\r
//\r
}\r
\r
BackupHeader = AllocateZeroPool (sizeof (EFI_PARTITION_TABLE_HEADER));\r
-\r
if (BackupHeader == NULL) {\r
goto Done;\r
}\r
PartEntry\r
);\r
if (EFI_ERROR (Status)) {\r
- GptValid = Status;\r
- DEBUG ((EFI_D_INFO, " Partition Entry ReadBlocks error\n"));\r
+ GptValidStatus = Status;\r
+ DEBUG ((EFI_D_ERROR, " Partition Entry ReadBlocks error\n"));\r
goto Done;\r
}\r
\r
//\r
// If we got this far the GPT layout of the disk is valid and we should return true\r
//\r
- GptValid = EFI_SUCCESS;\r
+ GptValidStatus = EFI_SUCCESS;\r
\r
//\r
// Create child device handles\r
HdDev.PartitionSize = PartEntry[Index].EndingLBA - PartEntry[Index].StartingLBA + 1;\r
CopyMem (HdDev.Signature, &PartEntry[Index].UniquePartitionGUID, sizeof (EFI_GUID));\r
\r
- DEBUG ((EFI_D_INFO, " Index : %d\n", Index));\r
- DEBUG ((EFI_D_INFO, " Start LBA : %x\n", HdDev.PartitionStart));\r
- DEBUG ((EFI_D_INFO, " End LBA : %x\n", PartEntry[Index].EndingLBA));\r
- DEBUG ((EFI_D_INFO, " Partition size: %x\n", HdDev.PartitionSize));\r
- DEBUG ((EFI_D_INFO, " Start : %x", MultU64x32 (PartEntry[Index].StartingLBA, BlockSize)));\r
- DEBUG ((EFI_D_INFO, " End : %x\n", MultU64x32 (PartEntry[Index].EndingLBA, BlockSize)));\r
+ DEBUG ((EFI_D_INFO, " Index : %d\n", (UINT32) Index));\r
+ DEBUG ((EFI_D_INFO, " Start LBA : %lx\n", (UINT64) HdDev.PartitionStart));\r
+ DEBUG ((EFI_D_INFO, " End LBA : %lx\n", (UINT64) PartEntry[Index].EndingLBA));\r
+ DEBUG ((EFI_D_INFO, " Partition size: %lx\n", (UINT64) HdDev.PartitionSize));\r
+ DEBUG ((EFI_D_INFO, " Start : %lx", MultU64x32 (PartEntry[Index].StartingLBA, BlockSize)));\r
+ DEBUG ((EFI_D_INFO, " End : %lx\n", MultU64x32 (PartEntry[Index].EndingLBA, BlockSize)));\r
\r
Status = PartitionInstallChildHandle (\r
This,\r
FreePool (PEntryStatus);\r
}\r
\r
- return GptValid;\r
+ return GptValidStatus;\r
}\r
\r
\r
!PartitionCheckCrc (BlockSize, &PartHdr->Header) ||\r
PartHdr->MyLBA != Lba\r
) {\r
- DEBUG ((EFI_D_INFO, " !Valid efi partition table header\n"));\r
+ DEBUG ((EFI_D_INFO, "Invalid efi partition table header\n"));\r
FreePool (PartHdr);\r
return FALSE;\r
}\r
\r
Done:\r
FreePool (PartHdr);\r
- FreePool (Ptr);\r
+\r
+ if (Ptr != NULL) {\r
+ FreePool (Ptr);\r
+ }\r
\r
if (EFI_ERROR (Status)) {\r
return FALSE;\r
@retval FALSE Mbr is not a Valid MBR.\r
\r
**/\r
-STATIC\r
BOOLEAN\r
PartitionValidMbr (\r
IN MASTER_BOOT_RECORD *Mbr,\r
#include "Partition.h"\r
\r
//\r
-// Partition Driver Global Variables\r
+// Partition Driver Global Variables.\r
//\r
EFI_DRIVER_BINDING_PROTOCOL gPartitionDriverBinding = {\r
PartitionDriverBindingSupported,\r
NULL\r
};\r
\r
-STATIC \r
+//\r
+// Priortized function list to detect partition table. \r
+//\r
PARTITION_DETECT_ROUTINE mPartitionDetectRoutineTable[] = {\r
PartitionInstallGptChildHandles,\r
PartitionInstallElToritoChildHandles,\r
// Close the I/O Abstraction(s) used to perform the supported test\r
//\r
gBS->CloseProtocol (\r
- ControllerHandle,\r
- &gEfiDevicePathProtocolGuid,\r
- This->DriverBindingHandle,\r
- ControllerHandle\r
- );\r
+ ControllerHandle,\r
+ &gEfiDevicePathProtocolGuid,\r
+ This->DriverBindingHandle,\r
+ ControllerHandle\r
+ );\r
\r
//\r
// Open the IO Abstraction(s) needed to perform the supported test\r
not be reset.\r
\r
**/\r
-STATIC\r
EFI_STATUS\r
EFIAPI\r
PartitionReset (\r
valid for the device.\r
\r
**/\r
-STATIC\r
EFI_STATUS\r
EFIAPI\r
PartitionReadBlocks (\r
valid for the device.\r
\r
**/\r
-STATIC\r
EFI_STATUS\r
EFIAPI\r
PartitionWriteBlocks (\r
@retval EFI_NO_MEDIA There is no media in the device.\r
\r
**/\r
-STATIC\r
EFI_STATUS\r
EFIAPI\r
PartitionFlushBlocks (\r
'\0'\r
};\r
\r
-STATIC EFI_HANDLE mHandle = NULL;\r
+EFI_HANDLE mHandle = NULL;\r
\r
//\r
// EFI Unicode Collation Protocol supporting ISO 639-2 language code\r