summaryrefslogtreecommitdiff
path: root/MdeModulePkg
diff options
context:
space:
mode:
authorvanjeff <vanjeff@6f19259b-4bc3-4df7-8a09-765794883524>2013-05-09 02:54:01 +0000
committervanjeff <vanjeff@6f19259b-4bc3-4df7-8a09-765794883524>2013-05-09 02:54:01 +0000
commit5be1d046ef90b8b29f90b85d5bdff37e352df55f (patch)
tree7df036edd07f62feb2306bfd2c20941d5e8f49a3 /MdeModulePkg
parent7af87b1e1c6016d6705dd2549c67abbaa19c2de6 (diff)
downloadedk2-5be1d046ef90b8b29f90b85d5bdff37e352df55f.zip
edk2-5be1d046ef90b8b29f90b85d5bdff37e352df55f.tar.gz
edk2-5be1d046ef90b8b29f90b85d5bdff37e352df55f.tar.bz2
Sync patches r13208, r13473, r13563, r13638, r13642, r13647, r13650 and r13656 from main trunk.
1. MdeModulePkg PiSmmCore: Fix a bug in SmmLoadImage() in PiSmmCore that in-correct status codes may be returned. 2. Check whether has storage for date/time opcode, if it has storage, also generate the offset/width info for it. 3. Close the corresponding GUIDed section extraction protocol notify event in CloseSectionStream. 4. Fix incorrect sizeof () usage. 5. Add missing break and add comment to non-necessary break. 6. IntelFrameworkModulePkg/IdeBusDxe: Add error check on the return status of invoking AtaSoftReset(). 7. Enhance the code to make the code logic more clear. 8. Initialize the variable before use it. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/branches/UDK2010.SR1@14330 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'MdeModulePkg')
-rw-r--r--MdeModulePkg/Core/Dxe/SectionExtraction/CoreSectionExtraction.c28
-rw-r--r--MdeModulePkg/Core/PiSmmCore/Dispatcher.c16
-rw-r--r--MdeModulePkg/Universal/Console/TerminalDxe/TerminalConIn.c4
-rw-r--r--MdeModulePkg/Universal/DevicePathDxe/DevicePathFromText.c3
-rw-r--r--MdeModulePkg/Universal/HiiDatabaseDxe/ConfigRouting.c138
-rw-r--r--MdeModulePkg/Universal/HiiDatabaseDxe/String.c3
-rw-r--r--MdeModulePkg/Universal/SetupBrowserDxe/Setup.c4
-rw-r--r--MdeModulePkg/Universal/SetupBrowserDxe/Ui.c7
8 files changed, 179 insertions, 24 deletions
diff --git a/MdeModulePkg/Core/Dxe/SectionExtraction/CoreSectionExtraction.c b/MdeModulePkg/Core/Dxe/SectionExtraction/CoreSectionExtraction.c
index a0d9d69..ad3f58f 100644
--- a/MdeModulePkg/Core/Dxe/SectionExtraction/CoreSectionExtraction.c
+++ b/MdeModulePkg/Core/Dxe/SectionExtraction/CoreSectionExtraction.c
@@ -66,6 +66,11 @@ typedef struct {
//
UINTN EncapsulatedStreamHandle;
EFI_GUID *EncapsulationGuid;
+ //
+ // If the section REQUIRES an extraction protocol, register for RPN
+ // when the required GUIDed extraction protocol becomes available.
+ //
+ EFI_EVENT Event;
} CORE_SECTION_CHILD_NODE;
#define CORE_SECTION_STREAM_SIGNATURE SIGNATURE_32('S','X','S','S')
@@ -91,7 +96,6 @@ typedef struct {
CORE_SECTION_CHILD_NODE *ChildNode;
CORE_SECTION_STREAM_NODE *ParentStream;
VOID *Registration;
- EFI_EVENT Event;
} RPN_EVENT_CONTEXT;
@@ -604,6 +608,7 @@ NotifyGuidedExtraction (
// Close the event when done.
//
gBS->CloseEvent (Event);
+ Context->ChildNode->Event = NULL;
FreePool (Context);
}
@@ -631,13 +636,13 @@ CreateGuidedExtractionRpnEvent (
Context->ChildNode = ChildNode;
Context->ParentStream = ParentStream;
- Context->Event = EfiCreateProtocolNotifyEvent (
- Context->ChildNode->EncapsulationGuid,
- TPL_NOTIFY,
- NotifyGuidedExtraction,
- Context,
- &Context->Registration
- );
+ Context->ChildNode->Event = EfiCreateProtocolNotifyEvent (
+ Context->ChildNode->EncapsulationGuid,
+ TPL_NOTIFY,
+ NotifyGuidedExtraction,
+ Context,
+ &Context->Registration
+ );
}
/**
@@ -692,7 +697,7 @@ CreateChildNode (
//
// Allocate a new node
//
- *ChildNode = AllocatePool (sizeof (CORE_SECTION_CHILD_NODE));
+ *ChildNode = AllocateZeroPool (sizeof (CORE_SECTION_CHILD_NODE));
Node = *ChildNode;
if (Node == NULL) {
return EFI_OUT_OF_RESOURCES;
@@ -1334,6 +1339,11 @@ FreeChildNode (
//
CloseSectionStream (ChildNode->EncapsulatedStreamHandle);
}
+
+ if (ChildNode->Event != NULL) {
+ gBS->CloseEvent (ChildNode->Event);
+ }
+
//
// Last, free the child node itself
//
diff --git a/MdeModulePkg/Core/PiSmmCore/Dispatcher.c b/MdeModulePkg/Core/PiSmmCore/Dispatcher.c
index 3b476f3..b2e3d6a 100644
--- a/MdeModulePkg/Core/PiSmmCore/Dispatcher.c
+++ b/MdeModulePkg/Core/PiSmmCore/Dispatcher.c
@@ -405,7 +405,7 @@ SmmLoadImage (
if (EFI_ERROR (Status)) {
if (Buffer != NULL) {
- Status = gBS->FreePool (Buffer);
+ gBS->FreePool (Buffer);
}
return Status;
}
@@ -453,7 +453,7 @@ SmmLoadImage (
Status = PeCoffLoaderGetImageInfo (&ImageContext);
if (EFI_ERROR (Status)) {
if (Buffer != NULL) {
- Status = gBS->FreePool (Buffer);
+ gBS->FreePool (Buffer);
}
return Status;
}
@@ -489,7 +489,7 @@ SmmLoadImage (
);
if (EFI_ERROR (Status)) {
if (Buffer != NULL) {
- Status = gBS->FreePool (Buffer);
+ gBS->FreePool (Buffer);
}
return Status;
}
@@ -507,7 +507,7 @@ SmmLoadImage (
);
if (EFI_ERROR (Status)) {
if (Buffer != NULL) {
- Status = gBS->FreePool (Buffer);
+ gBS->FreePool (Buffer);
}
return Status;
}
@@ -526,7 +526,7 @@ SmmLoadImage (
Status = PeCoffLoaderLoadImage (&ImageContext);
if (EFI_ERROR (Status)) {
if (Buffer != NULL) {
- Status = gBS->FreePool (Buffer);
+ gBS->FreePool (Buffer);
}
SmmFreePages (DstBuffer, PageCount);
return Status;
@@ -538,7 +538,7 @@ SmmLoadImage (
Status = PeCoffLoaderRelocateImage (&ImageContext);
if (EFI_ERROR (Status)) {
if (Buffer != NULL) {
- Status = gBS->FreePool (Buffer);
+ gBS->FreePool (Buffer);
}
SmmFreePages (DstBuffer, PageCount);
return Status;
@@ -562,7 +562,7 @@ SmmLoadImage (
Status = gBS->AllocatePool (EfiBootServicesData, sizeof (EFI_LOADED_IMAGE_PROTOCOL), (VOID **)&DriverEntry->LoadedImage);
if (EFI_ERROR (Status)) {
if (Buffer != NULL) {
- Status = gBS->FreePool (Buffer);
+ gBS->FreePool (Buffer);
}
SmmFreePages (DstBuffer, PageCount);
return Status;
@@ -583,7 +583,7 @@ SmmLoadImage (
Status = gBS->AllocatePool (EfiBootServicesData, GetDevicePathSize (FilePath), (VOID **)&DriverEntry->LoadedImage->FilePath);
if (EFI_ERROR (Status)) {
if (Buffer != NULL) {
- Status = gBS->FreePool (Buffer);
+ gBS->FreePool (Buffer);
}
SmmFreePages (DstBuffer, PageCount);
return Status;
diff --git a/MdeModulePkg/Universal/Console/TerminalDxe/TerminalConIn.c b/MdeModulePkg/Universal/Console/TerminalDxe/TerminalConIn.c
index 547ef83..c30e3a5 100644
--- a/MdeModulePkg/Universal/Console/TerminalDxe/TerminalConIn.c
+++ b/MdeModulePkg/Universal/Console/TerminalDxe/TerminalConIn.c
@@ -369,7 +369,7 @@ TerminalConInRegisterKeyNotify (
NewNotify->Signature = TERMINAL_CONSOLE_IN_EX_NOTIFY_SIGNATURE;
NewNotify->KeyNotificationFn = KeyNotificationFunction;
NewNotify->NotifyHandle = (EFI_HANDLE) NewNotify;
- CopyMem (&NewNotify->KeyData, KeyData, sizeof (KeyData));
+ CopyMem (&NewNotify->KeyData, KeyData, sizeof (EFI_KEY_DATA));
InsertTailList (&TerminalDevice->NotifyList, &NewNotify->NotifyEntry);
*NotifyHandle = NewNotify->NotifyHandle;
@@ -1458,6 +1458,7 @@ UnicodeToEfiKey (
if (TerminalDevice->TerminalType == PCANSITYPE) {
Key.ScanCode = SCAN_F10;
}
+ break;
case '?':
if (TerminalDevice->TerminalType == VT100TYPE) {
Key.ScanCode = SCAN_PAGE_UP;
@@ -1472,6 +1473,7 @@ UnicodeToEfiKey (
if (TerminalDevice->TerminalType == PCANSITYPE) {
Key.ScanCode = SCAN_F9;
}
+ break;
case '/':
if (TerminalDevice->TerminalType == VT100TYPE) {
Key.ScanCode = SCAN_PAGE_DOWN;
diff --git a/MdeModulePkg/Universal/DevicePathDxe/DevicePathFromText.c b/MdeModulePkg/Universal/DevicePathDxe/DevicePathFromText.c
index 11f5c15..d94e149 100644
--- a/MdeModulePkg/Universal/DevicePathDxe/DevicePathFromText.c
+++ b/MdeModulePkg/Universal/DevicePathDxe/DevicePathFromText.c
@@ -1,7 +1,7 @@
/** @file
DevicePathFromText protocol as defined in the UEFI 2.0 specification.
-Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>
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
@@ -2006,6 +2006,7 @@ DevPathFromTextUart (
case L'S':
Uart->Parity = 5;
+ break;
default:
Uart->Parity = 0xff;
diff --git a/MdeModulePkg/Universal/HiiDatabaseDxe/ConfigRouting.c b/MdeModulePkg/Universal/HiiDatabaseDxe/ConfigRouting.c
index 6f8d84c..1cb754b 100644
--- a/MdeModulePkg/Universal/HiiDatabaseDxe/ConfigRouting.c
+++ b/MdeModulePkg/Universal/HiiDatabaseDxe/ConfigRouting.c
@@ -1,7 +1,7 @@
/** @file
Implementation of interfaces function for EFI_HII_CONFIG_ROUTING_PROTOCOL.
-Copyright (c) 2007 - 2011, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2007 - 2012, Intel Corporation. All rights reserved.<BR>
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
@@ -997,6 +997,8 @@ ParseIfrData (
EFI_IFR_CHECKBOX *IfrCheckBox;
EFI_IFR_PASSWORD *IfrPassword;
EFI_IFR_STRING *IfrString;
+ EFI_IFR_DATE *IfrDate;
+ EFI_IFR_TIME *IfrTime;
IFR_DEFAULT_DATA DefaultData;
IFR_DEFAULT_DATA *DefaultDataPtr;
IFR_BLOCK_DATA *BlockData;
@@ -1505,6 +1507,140 @@ ParseIfrData (
InsertDefaultValue (BlockData, &DefaultData);
break;
+ case EFI_IFR_DATE_OP:
+ //
+ // offset by question header
+ // width MaxSize * sizeof (CHAR16)
+ // no default value, only block array
+ //
+
+ //
+ // Date question is not in IFR Form. This IFR form is not valid.
+ //
+ if (VarStorageData->Size == 0) {
+ Status = EFI_INVALID_PARAMETER;
+ goto Done;
+ }
+ //
+ // Check whether this question is for the requested varstore.
+ //
+ IfrDate = (EFI_IFR_DATE *) IfrOpHdr;
+ if (IfrDate->Question.VarStoreId != VarStorageData->VarStoreId) {
+ break;
+ }
+
+ //
+ // Get Offset/Width by Question header and OneOf Flags
+ //
+ VarOffset = IfrDate->Question.VarStoreInfo.VarOffset;
+ VarWidth = (UINT16) sizeof (EFI_HII_DATE);
+
+ //
+ // Check whether this question is in requested block array.
+ //
+ if (!BlockArrayCheck (RequestBlockArray, VarOffset, VarWidth)) {
+ //
+ // This question is not in the requested array. Skip it.
+ //
+ break;
+ }
+
+ //
+ // Check this var question is in the var storage
+ //
+ if ((VarOffset + VarWidth) > VarStorageData->Size) {
+ Status = EFI_INVALID_PARAMETER;
+ goto Done;
+ }
+
+ //
+ // Set Block Data
+ //
+ BlockData = (IFR_BLOCK_DATA *) AllocateZeroPool (sizeof (IFR_BLOCK_DATA));
+ if (BlockData == NULL) {
+ Status = EFI_OUT_OF_RESOURCES;
+ goto Done;
+ }
+ BlockData->Offset = VarOffset;
+ BlockData->Width = VarWidth;
+ BlockData->QuestionId = IfrDate->Question.QuestionId;
+ BlockData->OpCode = IfrOpHdr->OpCode;
+ BlockData->Scope = IfrOpHdr->Scope;
+ InitializeListHead (&BlockData->DefaultValueEntry);
+
+ //
+ // Add Block Data into VarStorageData BlockEntry
+ //
+ InsertBlockData (&VarStorageData->BlockEntry, &BlockData);
+ break;
+
+ case EFI_IFR_TIME_OP:
+ //
+ // offset by question header
+ // width MaxSize * sizeof (CHAR16)
+ // no default value, only block array
+ //
+
+ //
+ // Time question is not in IFR Form. This IFR form is not valid.
+ //
+ if (VarStorageData->Size == 0) {
+ Status = EFI_INVALID_PARAMETER;
+ goto Done;
+ }
+ //
+ // Check whether this question is for the requested varstore.
+ //
+ IfrTime = (EFI_IFR_TIME *) IfrOpHdr;
+ if (IfrTime->Question.VarStoreId != VarStorageData->VarStoreId) {
+ break;
+ }
+
+ //
+ // Get Offset/Width by Question header and OneOf Flags
+ //
+ VarOffset = IfrTime->Question.VarStoreInfo.VarOffset;
+ VarWidth = (UINT16) sizeof (EFI_HII_TIME);
+
+ //
+ // Check whether this question is in requested block array.
+ //
+ if (!BlockArrayCheck (RequestBlockArray, VarOffset, VarWidth)) {
+ //
+ // This question is not in the requested array. Skip it.
+ //
+ break;
+ }
+
+ //
+ // Check this var question is in the var storage
+ //
+ if ((VarOffset + VarWidth) > VarStorageData->Size) {
+ Status = EFI_INVALID_PARAMETER;
+ goto Done;
+ }
+
+ //
+ // Set Block Data
+ //
+ BlockData = (IFR_BLOCK_DATA *) AllocateZeroPool (sizeof (IFR_BLOCK_DATA));
+ if (BlockData == NULL) {
+ Status = EFI_OUT_OF_RESOURCES;
+ goto Done;
+ }
+ BlockData->Offset = VarOffset;
+ BlockData->Width = VarWidth;
+ BlockData->QuestionId = IfrTime->Question.QuestionId;
+ BlockData->OpCode = IfrOpHdr->OpCode;
+ BlockData->Scope = IfrOpHdr->Scope;
+ InitializeListHead (&BlockData->DefaultValueEntry);
+
+ //
+ // Add Block Data into VarStorageData BlockEntry
+ //
+ InsertBlockData (&VarStorageData->BlockEntry, &BlockData);
+ break;
+
case EFI_IFR_STRING_OP:
//
// offset by question header
diff --git a/MdeModulePkg/Universal/HiiDatabaseDxe/String.c b/MdeModulePkg/Universal/HiiDatabaseDxe/String.c
index a76e5b6..c553058 100644
--- a/MdeModulePkg/Universal/HiiDatabaseDxe/String.c
+++ b/MdeModulePkg/Universal/HiiDatabaseDxe/String.c
@@ -2,7 +2,7 @@
Implementation for EFI_HII_STRING_PROTOCOL.
-Copyright (c) 2007 - 2011, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2007 - 2012, Intel Corporation. All rights reserved.<BR>
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
@@ -899,6 +899,7 @@ SetStringWorker (
EFI_STRING_ID StartStringId;
StartStringId = 0;
+ StringSize = 0;
ASSERT (Private != NULL && StringPackage != NULL && String != NULL);
ASSERT (Private->Signature == HII_DATABASE_PRIVATE_DATA_SIGNATURE);
//
diff --git a/MdeModulePkg/Universal/SetupBrowserDxe/Setup.c b/MdeModulePkg/Universal/SetupBrowserDxe/Setup.c
index 1317b8f..0e743a6 100644
--- a/MdeModulePkg/Universal/SetupBrowserDxe/Setup.c
+++ b/MdeModulePkg/Universal/SetupBrowserDxe/Setup.c
@@ -750,7 +750,7 @@ GetToken (
String = HiiGetString (HiiHandle, Token, NULL);
if (String == NULL) {
- String = AllocateCopyPool (sizeof (mUnknownString), mUnknownString);
+ String = AllocateCopyPool (StrSize (mUnknownString), mUnknownString);
ASSERT (String != NULL);
}
return (CHAR16 *) String;
@@ -3262,7 +3262,7 @@ ExtractDefault (
//
// Initilize Questions' Value
//
- LoadFormSetConfig (NULL, LocalFormSet);
+ Status = LoadFormSetConfig (NULL, LocalFormSet);
if (EFI_ERROR (Status)) {
DestroyFormSet (LocalFormSet);
continue;
diff --git a/MdeModulePkg/Universal/SetupBrowserDxe/Ui.c b/MdeModulePkg/Universal/SetupBrowserDxe/Ui.c
index f302b7c..1688d54 100644
--- a/MdeModulePkg/Universal/SetupBrowserDxe/Ui.c
+++ b/MdeModulePkg/Universal/SetupBrowserDxe/Ui.c
@@ -767,7 +767,9 @@ UiAddMenuOption (
//
MenuOption->GrayOut = TRUE;
}
-
+ //
+ // break skipped on purpose
+ //
default:
MenuOption->IsQuestion = FALSE;
break;
@@ -955,6 +957,9 @@ CreateDialog (
TempString[Index - 1] = CHAR_NULL;
StrCpy (StringBuffer, TempString);
}
+ //
+ // break skipped on purpose
+ //
default:
//