summaryrefslogtreecommitdiff
path: root/MdeModulePkg/Universal/Disk
diff options
context:
space:
mode:
authorqhuang8 <qhuang8@6f19259b-4bc3-4df7-8a09-765794883524>2008-07-18 09:49:25 +0000
committerqhuang8 <qhuang8@6f19259b-4bc3-4df7-8a09-765794883524>2008-07-18 09:49:25 +0000
commitff61847ddc91285a9ef8be00b89304870c493ef8 (patch)
tree34aff9a0a604c67a02eaf7eebb3d0ffe0b2c341c /MdeModulePkg/Universal/Disk
parentab76200c050f3196386dc3637dd58547eef1f519 (diff)
downloadedk2-ff61847ddc91285a9ef8be00b89304870c493ef8.zip
edk2-ff61847ddc91285a9ef8be00b89304870c493ef8.tar.gz
edk2-ff61847ddc91285a9ef8be00b89304870c493ef8.tar.bz2
Code scrub for DiskIo, Partition & Unicode Collation
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@5519 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'MdeModulePkg/Universal/Disk')
-rw-r--r--MdeModulePkg/Universal/Disk/DiskIoDxe/ComponentName.c5
-rw-r--r--MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIo.c13
-rw-r--r--MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIo.h5
-rw-r--r--MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIoDxe.inf3
-rw-r--r--MdeModulePkg/Universal/Disk/PartitionDxe/ComponentName.c7
-rw-r--r--MdeModulePkg/Universal/Disk/PartitionDxe/Gpt.c34
-rw-r--r--MdeModulePkg/Universal/Disk/PartitionDxe/Mbr.c1
-rw-r--r--MdeModulePkg/Universal/Disk/PartitionDxe/Partition.c20
-rw-r--r--MdeModulePkg/Universal/Disk/UnicodeCollation/EnglishDxe/UnicodeCollationEng.c2
9 files changed, 51 insertions, 39 deletions
diff --git a/MdeModulePkg/Universal/Disk/DiskIoDxe/ComponentName.c b/MdeModulePkg/Universal/Disk/DiskIoDxe/ComponentName.c
index a340274..b136430 100644
--- a/MdeModulePkg/Universal/Disk/DiskIoDxe/ComponentName.c
+++ b/MdeModulePkg/Universal/Disk/DiskIoDxe/ComponentName.c
@@ -32,7 +32,10 @@ GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME2_PROTOCOL gDiskIoComponentName2
"en"
};
-
+//
+// Driver name table for DiskIo module.
+// It is shared by the implementation of ComponentName & ComponentName2 Protocol.
+//
GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mDiskIoDriverNameTable[] = {
{
"eng;en",
diff --git a/MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIo.c b/MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIo.c
index 710d042..ec1d68f 100644
--- a/MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIo.c
+++ b/MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIo.c
@@ -1,8 +1,8 @@
/** @file
- DiskIo driver that layers it's self on every Block IO protocol in the system.
+ DiskIo driver that lays on every BlockIo protocol in the system.
DiskIo converts a block oriented device to a byte oriented device.
- ReadDisk may have to do reads that are not aligned on sector boundaries.
+ 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.
@@ -22,6 +22,9 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#include "DiskIo.h"
+//
+// Driver binding protocol implementation for DiskIo driver.
+//
EFI_DRIVER_BINDING_PROTOCOL gDiskIoDriverBinding = {
DiskIoDriverBindingSupported,
DiskIoDriverBindingStart,
@@ -31,6 +34,10 @@ EFI_DRIVER_BINDING_PROTOCOL gDiskIoDriverBinding = {
NULL
};
+//
+// Template for DiskIo private data structure.
+// The pointer to BlockIo protocol interface is assigned dynamically.
+//
DISK_IO_PRIVATE_DATA gDiskIoPrivateDataTemplate = {
DISK_IO_PRIVATE_DATA_SIGNATURE,
{
@@ -459,7 +466,7 @@ Done:
/**
- Read BufferSize bytes from Offset into 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
diff --git a/MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIo.h b/MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIo.h
index f4a3781..cedda09 100644
--- a/MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIo.h
+++ b/MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIo.h
@@ -1,6 +1,5 @@
/** @file
- DiskIo driver that layers it's self on every Block IO protocol in the system.
- DiskIo converts a block oriented device to a byte oriented device.
+ Master header file for DiskIo driver. It includes the module private defininitions.
Copyright (c) 2006 - 2008, Intel Corporation. <BR>
All rights reserved. This program and the accompanying materials
@@ -156,7 +155,7 @@ DiskIoReadDisk (
);
/**
- Read BufferSize bytes from Offset into 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
diff --git a/MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIoDxe.inf b/MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIoDxe.inf
index 5cef9b4..61a2c4f 100644
--- a/MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIoDxe.inf
+++ b/MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIoDxe.inf
@@ -1,6 +1,7 @@
#/** @file
#
-# Component description file for DiskIo module.
+# This module lays DiskIo protocol on every blockIo protocol
+# to provide byte-oriented access to block media.
#
# Copyright (c) 2006 - 2008, Intel Corporation. <BR>
# All rights reserved. This program and the accompanying materials
diff --git a/MdeModulePkg/Universal/Disk/PartitionDxe/ComponentName.c b/MdeModulePkg/Universal/Disk/PartitionDxe/ComponentName.c
index 8065f6b..4d1a6fe 100644
--- a/MdeModulePkg/Universal/Disk/PartitionDxe/ComponentName.c
+++ b/MdeModulePkg/Universal/Disk/PartitionDxe/ComponentName.c
@@ -32,11 +32,14 @@ GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME2_PROTOCOL gPartitionComponentNa
"en"
};
-
+//
+// Driver name table for Partition module.
+// It is shared by the implementation of ComponentName & ComponentName2 Protocol.
+//
GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mPartitionDriverNameTable[] = {
{
"eng;en",
- (CHAR16 *)L"Partition Driver(MBR/GPT/El Torito)"
+ L"Partition Driver(MBR/GPT/El Torito)"
},
{
NULL,
diff --git a/MdeModulePkg/Universal/Disk/PartitionDxe/Gpt.c b/MdeModulePkg/Universal/Disk/PartitionDxe/Gpt.c
index 6d3abae..cdace18 100644
--- a/MdeModulePkg/Universal/Disk/PartitionDxe/Gpt.c
+++ b/MdeModulePkg/Universal/Disk/PartitionDxe/Gpt.c
@@ -189,7 +189,7 @@ PartitionInstallGptChildHandles (
EFI_PARTITION_ENTRY *PartEntry;
EFI_PARTITION_ENTRY_STATUS *PEntryStatus;
UINTN Index;
- EFI_STATUS GptValid;
+ EFI_STATUS GptValidStatus;
HARDDRIVE_DEVICE_PATH HdDev;
ProtectiveMbr = NULL;
@@ -204,7 +204,7 @@ PartitionInstallGptChildHandles (
DEBUG ((EFI_D_INFO, " BlockSize : %d \n", BlockSize));
DEBUG ((EFI_D_INFO, " LastBlock : %x \n", LastBlock));
- GptValid = EFI_NOT_FOUND;
+ GptValidStatus = EFI_NOT_FOUND;
//
// Allocate a buffer for the Protective MBR
@@ -225,7 +225,7 @@ PartitionInstallGptChildHandles (
ProtectiveMbr
);
if (EFI_ERROR (Status)) {
- GptValid = Status;
+ GptValidStatus = Status;
goto Done;
}
//
@@ -247,7 +247,6 @@ PartitionInstallGptChildHandles (
}
BackupHeader = AllocateZeroPool (sizeof (EFI_PARTITION_TABLE_HEADER));
-
if (BackupHeader == NULL) {
goto Done;
}
@@ -304,8 +303,8 @@ PartitionInstallGptChildHandles (
PartEntry
);
if (EFI_ERROR (Status)) {
- GptValid = Status;
- DEBUG ((EFI_D_INFO, " Partition Entry ReadBlocks error\n"));
+ GptValidStatus = Status;
+ DEBUG ((EFI_D_ERROR, " Partition Entry ReadBlocks error\n"));
goto Done;
}
@@ -327,7 +326,7 @@ PartitionInstallGptChildHandles (
//
// If we got this far the GPT layout of the disk is valid and we should return true
//
- GptValid = EFI_SUCCESS;
+ GptValidStatus = EFI_SUCCESS;
//
// Create child device handles
@@ -355,12 +354,12 @@ PartitionInstallGptChildHandles (
HdDev.PartitionSize = PartEntry[Index].EndingLBA - PartEntry[Index].StartingLBA + 1;
CopyMem (HdDev.Signature, &PartEntry[Index].UniquePartitionGUID, sizeof (EFI_GUID));
- DEBUG ((EFI_D_INFO, " Index : %d\n", Index));
- DEBUG ((EFI_D_INFO, " Start LBA : %x\n", HdDev.PartitionStart));
- DEBUG ((EFI_D_INFO, " End LBA : %x\n", PartEntry[Index].EndingLBA));
- DEBUG ((EFI_D_INFO, " Partition size: %x\n", HdDev.PartitionSize));
- DEBUG ((EFI_D_INFO, " Start : %x", MultU64x32 (PartEntry[Index].StartingLBA, BlockSize)));
- DEBUG ((EFI_D_INFO, " End : %x\n", MultU64x32 (PartEntry[Index].EndingLBA, BlockSize)));
+ DEBUG ((EFI_D_INFO, " Index : %d\n", (UINT32) Index));
+ DEBUG ((EFI_D_INFO, " Start LBA : %lx\n", (UINT64) HdDev.PartitionStart));
+ DEBUG ((EFI_D_INFO, " End LBA : %lx\n", (UINT64) PartEntry[Index].EndingLBA));
+ DEBUG ((EFI_D_INFO, " Partition size: %lx\n", (UINT64) HdDev.PartitionSize));
+ DEBUG ((EFI_D_INFO, " Start : %lx", MultU64x32 (PartEntry[Index].StartingLBA, BlockSize)));
+ DEBUG ((EFI_D_INFO, " End : %lx\n", MultU64x32 (PartEntry[Index].EndingLBA, BlockSize)));
Status = PartitionInstallChildHandle (
This,
@@ -395,7 +394,7 @@ Done:
FreePool (PEntryStatus);
}
- return GptValid;
+ return GptValidStatus;
}
@@ -450,7 +449,7 @@ PartitionValidGptTable (
!PartitionCheckCrc (BlockSize, &PartHdr->Header) ||
PartHdr->MyLBA != Lba
) {
- DEBUG ((EFI_D_INFO, " !Valid efi partition table header\n"));
+ DEBUG ((EFI_D_INFO, "Invalid efi partition table header\n"));
FreePool (PartHdr);
return FALSE;
}
@@ -608,7 +607,10 @@ PartitionRestoreGptTable (
Done:
FreePool (PartHdr);
- FreePool (Ptr);
+
+ if (Ptr != NULL) {
+ FreePool (Ptr);
+ }
if (EFI_ERROR (Status)) {
return FALSE;
diff --git a/MdeModulePkg/Universal/Disk/PartitionDxe/Mbr.c b/MdeModulePkg/Universal/Disk/PartitionDxe/Mbr.c
index 68b389a..51fdca4 100644
--- a/MdeModulePkg/Universal/Disk/PartitionDxe/Mbr.c
+++ b/MdeModulePkg/Universal/Disk/PartitionDxe/Mbr.c
@@ -34,7 +34,6 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
@retval FALSE Mbr is not a Valid MBR.
**/
-STATIC
BOOLEAN
PartitionValidMbr (
IN MASTER_BOOT_RECORD *Mbr,
diff --git a/MdeModulePkg/Universal/Disk/PartitionDxe/Partition.c b/MdeModulePkg/Universal/Disk/PartitionDxe/Partition.c
index 66fa950..15061be 100644
--- a/MdeModulePkg/Universal/Disk/PartitionDxe/Partition.c
+++ b/MdeModulePkg/Universal/Disk/PartitionDxe/Partition.c
@@ -19,7 +19,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#include "Partition.h"
//
-// Partition Driver Global Variables
+// Partition Driver Global Variables.
//
EFI_DRIVER_BINDING_PROTOCOL gPartitionDriverBinding = {
PartitionDriverBindingSupported,
@@ -30,7 +30,9 @@ EFI_DRIVER_BINDING_PROTOCOL gPartitionDriverBinding = {
NULL
};
-STATIC
+//
+// Priortized function list to detect partition table.
+//
PARTITION_DETECT_ROUTINE mPartitionDetectRoutineTable[] = {
PartitionInstallGptChildHandles,
PartitionInstallElToritoChildHandles,
@@ -98,11 +100,11 @@ PartitionDriverBindingSupported (
// Close the I/O Abstraction(s) used to perform the supported test
//
gBS->CloseProtocol (
- ControllerHandle,
- &gEfiDevicePathProtocolGuid,
- This->DriverBindingHandle,
- ControllerHandle
- );
+ ControllerHandle,
+ &gEfiDevicePathProtocolGuid,
+ This->DriverBindingHandle,
+ ControllerHandle
+ );
//
// Open the IO Abstraction(s) needed to perform the supported test
@@ -402,7 +404,6 @@ PartitionDriverBindingStop (
not be reset.
**/
-STATIC
EFI_STATUS
EFIAPI
PartitionReset (
@@ -440,7 +441,6 @@ PartitionReset (
valid for the device.
**/
-STATIC
EFI_STATUS
EFIAPI
PartitionReadBlocks (
@@ -492,7 +492,6 @@ PartitionReadBlocks (
valid for the device.
**/
-STATIC
EFI_STATUS
EFIAPI
PartitionWriteBlocks (
@@ -535,7 +534,6 @@ PartitionWriteBlocks (
@retval EFI_NO_MEDIA There is no media in the device.
**/
-STATIC
EFI_STATUS
EFIAPI
PartitionFlushBlocks (
diff --git a/MdeModulePkg/Universal/Disk/UnicodeCollation/EnglishDxe/UnicodeCollationEng.c b/MdeModulePkg/Universal/Disk/UnicodeCollation/EnglishDxe/UnicodeCollationEng.c
index 67f1db1..e8c5bd9 100644
--- a/MdeModulePkg/Universal/Disk/UnicodeCollation/EnglishDxe/UnicodeCollationEng.c
+++ b/MdeModulePkg/Universal/Disk/UnicodeCollation/EnglishDxe/UnicodeCollationEng.c
@@ -51,7 +51,7 @@ CHAR8 mOtherChars[] = {
'\0'
};
-STATIC EFI_HANDLE mHandle = NULL;
+EFI_HANDLE mHandle = NULL;
//
// EFI Unicode Collation Protocol supporting ISO 639-2 language code