summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvanjeff <vanjeff@6f19259b-4bc3-4df7-8a09-765794883524>2013-04-04 06:21:07 +0000
committervanjeff <vanjeff@6f19259b-4bc3-4df7-8a09-765794883524>2013-04-04 06:21:07 +0000
commite20152f1e953a3b4dae97a5a2b027ad9b70ad96d (patch)
tree502ea3e0aff47e0b8de2858de3a074643a11e191
parent31d95c506ffe4daa70cdfd51656725cd9fd7cf26 (diff)
downloadedk2-e20152f1e953a3b4dae97a5a2b027ad9b70ad96d.zip
edk2-e20152f1e953a3b4dae97a5a2b027ad9b70ad96d.tar.gz
edk2-e20152f1e953a3b4dae97a5a2b027ad9b70ad96d.tar.bz2
Sync patches r14114, r14142, r14143, r14162, and r14211 from main trunk.
1. Get support languages from "PlatformLangCodes" instead of front page string package. 2. BMP file may has padding data between the bmp header section and the bmp data section, but current code logic not consider this case, so the check is not valid for some bmp file. Refine the logic for this case. 3. Refine the code to avoid error report. 4. Follow UEFI spec, set TimeOut and HwErrRecSupport variable by EFI variable service instead of PcdSet(). 5. Remove BdsLibConnectConsoleVariableWithoutDispatch() and enhance BdsLibConnectDevicePath() to only call gDS->Dispatch() when the current TPL is TPL_APPLICATION. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/branches/UDK2010.SR1@14247 6f19259b-4bc3-4df7-8a09-765794883524
-rw-r--r--IntelFrameworkModulePkg/Bus/Pci/IdeBusDxe/IdeBus.c4
-rw-r--r--IntelFrameworkModulePkg/Include/Library/GenericBdsLib.h26
-rw-r--r--IntelFrameworkModulePkg/IntelFrameworkModulePkg.dec13
-rw-r--r--IntelFrameworkModulePkg/Library/GenericBdsLib/BdsConnect.c49
-rw-r--r--IntelFrameworkModulePkg/Library/GenericBdsLib/BdsConsole.c214
-rw-r--r--IntelFrameworkModulePkg/Library/GenericBdsLib/InternalBdsLib.h26
-rw-r--r--IntelFrameworkModulePkg/Universal/BdsDxe/BdsEntry.c21
-rw-r--r--IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/BootMaint.c11
-rw-r--r--IntelFrameworkModulePkg/Universal/BdsDxe/FrontPage.c157
-rw-r--r--IntelFrameworkModulePkg/Universal/BdsDxe/HwErrRecSupport.c20
-rw-r--r--MdeModulePkg/Bus/Usb/UsbBusDxe/UsbBus.c3
11 files changed, 227 insertions, 317 deletions
diff --git a/IntelFrameworkModulePkg/Bus/Pci/IdeBusDxe/IdeBus.c b/IntelFrameworkModulePkg/Bus/Pci/IdeBusDxe/IdeBus.c
index a386113..54c2ee1 100644
--- a/IntelFrameworkModulePkg/Bus/Pci/IdeBusDxe/IdeBus.c
+++ b/IntelFrameworkModulePkg/Bus/Pci/IdeBusDxe/IdeBus.c
@@ -3,7 +3,7 @@
Child device(Disk, CDROM, etc) enumeration and child handler installation, and
driver stop.
- Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2006 - 2013, 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
@@ -719,6 +719,7 @@ IDEBusDriverBindingStart (
//
for (IdeDevice = BeginningIdeDevice; IdeDevice <= EndIdeDevice; IdeDevice++) {
+ ASSERT (IdeChannel * 2 + IdeDevice < MAX_IDE_DEVICE);
if (IdeBusDriverPrivateData->DeviceProcessed[IdeChannel * 2 + IdeDevice]) {
continue;
}
@@ -738,6 +739,7 @@ IDEBusDriverBindingStart (
continue;
}
+ ASSERT (IdeChannel < IdeMaxChannel && IdeDevice < IdeMaxDevice);
IdeBlkIoDevicePtr = IdeBlkIoDevice[IdeChannel][IdeDevice];
//
diff --git a/IntelFrameworkModulePkg/Include/Library/GenericBdsLib.h b/IntelFrameworkModulePkg/Include/Library/GenericBdsLib.h
index b1887b6..ecd68a0 100644
--- a/IntelFrameworkModulePkg/Include/Library/GenericBdsLib.h
+++ b/IntelFrameworkModulePkg/Include/Library/GenericBdsLib.h
@@ -4,7 +4,7 @@
2) BDS boot device connect interface.
3) BDS Misc interfaces for mainting boot variable, ouput string.
-Copyright (c) 2004 - 2012, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2004 - 2013, 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 that accompanies this distribution.
The full text of the license may be found at
@@ -531,30 +531,6 @@ BdsLibConnectConsoleVariable (
IN CHAR16 *ConVarName
);
-/**
- Connect the console device base on the variable ConVarName, if
- device path of the ConVarName is multi-instance device path and
- anyone of the instances is connected success, then this function
- will return success.
- Dispatch service is not called when the handle associate with one
- device path node can not be created successfully. Here no driver
- dependency is assumed exist, so need not to call this service.
-
- @param ConVarName Console related variable name, ConIn, ConOut,
- ErrOut.
-
- @retval EFI_NOT_FOUND There is not any console devices connected
- success
- @retval EFI_SUCCESS Success connect any one instance of the console
- device path base on the variable ConVarName.
-
-**/
-EFI_STATUS
-EFIAPI
-BdsLibConnectConsoleVariableWithOutDispatch (
- IN CHAR16 *ConVarName
- );
-
//
// Bds device path related lib functions
//
diff --git a/IntelFrameworkModulePkg/IntelFrameworkModulePkg.dec b/IntelFrameworkModulePkg/IntelFrameworkModulePkg.dec
index 10d7567..fb33d2d 100644
--- a/IntelFrameworkModulePkg/IntelFrameworkModulePkg.dec
+++ b/IntelFrameworkModulePkg/IntelFrameworkModulePkg.dec
@@ -2,7 +2,7 @@
# Intel Framework Module Package contains the definitions and module implementation
# which follows Intel EFI Framework Specification.
#
-# Copyright (c) 2007 - 2012, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2007 - 2013, 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
@@ -143,16 +143,19 @@
gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdIsaBusSupportedFeatures|0x05|UINT8|0x00010040
[PcdsDynamic, PcdsDynamicEx]
- ## PCD is used to mark if the machine has complete one boot cycle before.
- # After the complete boot, the variable BootState will be set to TRUE.
+ ## The PCD is used to mark whether the machine is in first boot cycle.
+ # TRUE means the machine is in first boot cycle. After completing the first boot,
+ # the PCD's value will be updated to FALSE.
+ # This PCD should be set as HII type PCD by platform integrator.
gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdBootState|TRUE|BOOLEAN|0x0001002f
## Timeout value for displaying progressing bar in before boot OS.
# According to UEFI 2.0 spec, the default TimeOut should be 0xffff.
+ # This PCD should be set as HII type PCD by platform integrator mapped to variable L"TimeOut" and gEfiGlobalVariableGuid.
gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdPlatformBootTimeOut|0xffff|UINT16|0x40000001
## Error level for hardware recorder. If value 0, platform does not support feature of hardware error record.
- # This PCD should be set as HII type PCD by platform integrator mapped to variable L"HwErrRecSupport"
+ # This PCD should be set as HII type PCD by platform integrator mapped to variable L"HwErrRecSupport" and gEfiGlobalVariableGuid.
gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdHardwareErrorRecordLevel|0|UINT16|0x40000002
[PcdsPatchableInModule, PcdsDynamic, PcdsDynamicEx]
@@ -234,4 +237,4 @@
## This PCD specifies whether to use the optimized timing for best PS2 detection performance.
# Note this PCD could be set to TRUE for best boot performance and set to FALSE for best device compatibility.
- gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdFastPS2Detection|FALSE|BOOLEAN|0x3000000b \ No newline at end of file
+ gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdFastPS2Detection|FALSE|BOOLEAN|0x3000000b
diff --git a/IntelFrameworkModulePkg/Library/GenericBdsLib/BdsConnect.c b/IntelFrameworkModulePkg/Library/GenericBdsLib/BdsConnect.c
index 7d5235d..7ab08eb 100644
--- a/IntelFrameworkModulePkg/Library/GenericBdsLib/BdsConnect.c
+++ b/IntelFrameworkModulePkg/Library/GenericBdsLib/BdsConnect.c
@@ -1,7 +1,7 @@
/** @file
BDS Lib functions which relate with connect the device
-Copyright (c) 2004 - 2012, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2004 - 2013, 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
@@ -65,17 +65,14 @@ BdsLibGenericConnectAll (
BdsLibConnectAllConsoles ();
}
-
/**
This function will create all handles associate with every device
path node. If the handle associate with one device path node can not
- be created successfully, Dispatch service which load the missing drivers
- is called according to input parameter, since in some cases no driver
- dependency is assumed exist, so may need not to call this service.
+ be created successfully, then still give chance to do the dispatch,
+ which load the missing drivers if possible.
@param DevicePathToConnect The device path which will be connected, it can be
a multi-instance device path
- @param NeedDispatch Whether requires dispatch service during connection
@retval EFI_SUCCESS All handles associate with every device path node
have been created
@@ -85,9 +82,9 @@ BdsLibGenericConnectAll (
**/
EFI_STATUS
-ConnectDevicePathInternal (
- IN EFI_DEVICE_PATH_PROTOCOL *DevicePathToConnect,
- IN BOOLEAN NeedDispatch
+EFIAPI
+BdsLibConnectDevicePath (
+ IN EFI_DEVICE_PATH_PROTOCOL *DevicePathToConnect
)
{
EFI_STATUS Status;
@@ -99,11 +96,14 @@ ConnectDevicePathInternal (
EFI_HANDLE Handle;
EFI_HANDLE PreviousHandle;
UINTN Size;
+ EFI_TPL CurrentTpl;
if (DevicePathToConnect == NULL) {
return EFI_SUCCESS;
}
+ CurrentTpl = EfiGetCurrentTpl ();
+
DevicePath = DuplicateDevicePath (DevicePathToConnect);
if (DevicePath == NULL) {
return EFI_OUT_OF_RESOURCES;
@@ -152,7 +152,10 @@ ConnectDevicePathInternal (
// Status == EFI_SUCCESS means a driver was dispatched
// Status == EFI_NOT_FOUND means no new drivers were dispatched
//
- if (NeedDispatch) {
+ if (CurrentTpl == TPL_APPLICATION) {
+ //
+ // Dispatch calls LoadImage/StartImage which cannot run at TPL > TPL_APPLICATION
+ //
Status = gDS->Dispatch ();
} else {
//
@@ -199,32 +202,6 @@ ConnectDevicePathInternal (
return Status;
}
-
-/**
- This function will create all handles associate with every device
- path node. If the handle associate with one device path node can not
- be created successfully, then still give chance to do the dispatch,
- which load the missing drivers if possible.
-
- @param DevicePathToConnect The device path which will be connected, it can be
- a multi-instance device path
-
- @retval EFI_SUCCESS All handles associate with every device path node
- have been created
- @retval EFI_OUT_OF_RESOURCES There is no resource to create new handles
- @retval EFI_NOT_FOUND Create the handle associate with one device path
- node failed
-
-**/
-EFI_STATUS
-EFIAPI
-BdsLibConnectDevicePath (
- IN EFI_DEVICE_PATH_PROTOCOL *DevicePathToConnect
- )
-{
- return ConnectDevicePathInternal(DevicePathToConnect, TRUE);
-}
-
/**
This function will connect all current system handles recursively.
diff --git a/IntelFrameworkModulePkg/Library/GenericBdsLib/BdsConsole.c b/IntelFrameworkModulePkg/Library/GenericBdsLib/BdsConsole.c
index fe6d436..84e4a0e 100644
--- a/IntelFrameworkModulePkg/Library/GenericBdsLib/BdsConsole.c
+++ b/IntelFrameworkModulePkg/Library/GenericBdsLib/BdsConsole.c
@@ -1,7 +1,7 @@
/** @file
BDS Lib functions which contain all the code to connect console device
-Copyright (c) 2004 - 2012, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2004 - 2013, 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
@@ -182,114 +182,6 @@ UpdateSystemTableConsole (
}
/**
- Connect the console device base on the variable ConVarName, if
- device path of the ConVarName is multi-instance device path and
- anyone of the instances is connected success, this function will
- return success.
- Dispatch service is called basing on input when the handle associate
- with one device path node can not be created successfully. Since in
- some cases we assume driver dependency does not exist and do not
- need to call this service.
-
- @param ConVarName Console related variable name, ConIn, ConOut,
- ErrOut.
- @param NeedDispatch Whether requires dispatch service during connection
-
- @retval EFI_NOT_FOUND There is not any console devices connected
- success
- @retval EFI_SUCCESS Success connect any one instance of the console
- device path base on the variable ConVarName.
-
-**/
-EFI_STATUS
-ConnectConsoleVariableInternal (
- IN CHAR16 *ConVarName,
- IN BOOLEAN NeedDispatch
- )
-{
- EFI_STATUS Status;
- EFI_DEVICE_PATH_PROTOCOL *StartDevicePath;
- UINTN VariableSize;
- EFI_DEVICE_PATH_PROTOCOL *Instance;
- EFI_DEVICE_PATH_PROTOCOL *Next;
- EFI_DEVICE_PATH_PROTOCOL *CopyOfDevicePath;
- UINTN Size;
- BOOLEAN DeviceExist;
-
- Status = EFI_SUCCESS;
- DeviceExist = FALSE;
-
- //
- // Check if the console variable exist
- //
- StartDevicePath = BdsLibGetVariableAndSize (
- ConVarName,
- &gEfiGlobalVariableGuid,
- &VariableSize
- );
- if (StartDevicePath == NULL) {
- return EFI_UNSUPPORTED;
- }
-
- CopyOfDevicePath = StartDevicePath;
- do {
- //
- // Check every instance of the console variable
- //
- Instance = GetNextDevicePathInstance (&CopyOfDevicePath, &Size);
- if (Instance == NULL) {
- FreePool (StartDevicePath);
- return EFI_UNSUPPORTED;
- }
-
- Next = Instance;
- while (!IsDevicePathEndType (Next)) {
- Next = NextDevicePathNode (Next);
- }
-
- SetDevicePathEndNode (Next);
- //
- // Connect the USB console
- // USB console device path is a short-form device path that
- // starts with the first element being a USB WWID
- // or a USB Class device path
- //
- if ((DevicePathType (Instance) == MESSAGING_DEVICE_PATH) &&
- ((DevicePathSubType (Instance) == MSG_USB_CLASS_DP)
- || (DevicePathSubType (Instance) == MSG_USB_WWID_DP)
- )) {
- Status = BdsLibConnectUsbDevByShortFormDP (0xFF, Instance);
- if (!EFI_ERROR (Status)) {
- DeviceExist = TRUE;
- }
- } else {
- //
- // Connect the instance device path
- //
- Status = ConnectDevicePathInternal (Instance, NeedDispatch);
-
- if (EFI_ERROR (Status)) {
- //
- // Delete the instance from the console varialbe
- //
- BdsLibUpdateConsoleVariable (ConVarName, NULL, Instance);
- } else {
- DeviceExist = TRUE;
- }
- }
- FreePool(Instance);
- } while (CopyOfDevicePath != NULL);
-
- FreePool (StartDevicePath);
-
- if (!DeviceExist) {
- return EFI_NOT_FOUND;
- }
-
- return EFI_SUCCESS;
-}
-
-/**
This function update console variable based on ConVarName, it can
add or remove one specific console device path from the variable
@@ -447,35 +339,86 @@ BdsLibConnectConsoleVariable (
IN CHAR16 *ConVarName
)
{
- return ConnectConsoleVariableInternal(ConVarName, TRUE);
-}
+ EFI_STATUS Status;
+ EFI_DEVICE_PATH_PROTOCOL *StartDevicePath;
+ UINTN VariableSize;
+ EFI_DEVICE_PATH_PROTOCOL *Instance;
+ EFI_DEVICE_PATH_PROTOCOL *Next;
+ EFI_DEVICE_PATH_PROTOCOL *CopyOfDevicePath;
+ UINTN Size;
+ BOOLEAN DeviceExist;
-/**
- Connect the console device base on the variable ConVarName, if
- device path of the ConVarName is multi-instance device path and
- anyone of the instances is connected success, then this function
- will return success.
- Dispatch service is not called when the handle associate with one
- device path node can not be created successfully. Here no driver
- dependency is assumed exist, so need not to call this service.
+ Status = EFI_SUCCESS;
+ DeviceExist = FALSE;
+ //
+ // Check if the console variable exist
+ //
+ StartDevicePath = BdsLibGetVariableAndSize (
+ ConVarName,
+ &gEfiGlobalVariableGuid,
+ &VariableSize
+ );
+ if (StartDevicePath == NULL) {
+ return EFI_UNSUPPORTED;
+ }
- @param ConVarName Console related variable name, ConIn, ConOut,
- ErrOut.
+ CopyOfDevicePath = StartDevicePath;
+ do {
+ //
+ // Check every instance of the console variable
+ //
+ Instance = GetNextDevicePathInstance (&CopyOfDevicePath, &Size);
+ if (Instance == NULL) {
+ FreePool (StartDevicePath);
+ return EFI_UNSUPPORTED;
+ }
+
+ Next = Instance;
+ while (!IsDevicePathEndType (Next)) {
+ Next = NextDevicePathNode (Next);
+ }
- @retval EFI_NOT_FOUND There is not any console devices connected
- success
- @retval EFI_SUCCESS Success connect any one instance of the console
- device path base on the variable ConVarName.
+ SetDevicePathEndNode (Next);
+ //
+ // Connect the USB console
+ // USB console device path is a short-form device path that
+ // starts with the first element being a USB WWID
+ // or a USB Class device path
+ //
+ if ((DevicePathType (Instance) == MESSAGING_DEVICE_PATH) &&
+ ((DevicePathSubType (Instance) == MSG_USB_CLASS_DP)
+ || (DevicePathSubType (Instance) == MSG_USB_WWID_DP)
+ )) {
+ Status = BdsLibConnectUsbDevByShortFormDP (0xFF, Instance);
+ if (!EFI_ERROR (Status)) {
+ DeviceExist = TRUE;
+ }
+ } else {
+ //
+ // Connect the instance device path
+ //
+ Status = BdsLibConnectDevicePath (Instance);
-**/
-EFI_STATUS
-EFIAPI
-BdsLibConnectConsoleVariableWithOutDispatch (
- IN CHAR16 *ConVarName
- )
-{
- return ConnectConsoleVariableInternal(ConVarName, FALSE);
+ if (EFI_ERROR (Status)) {
+ //
+ // Delete the instance from the console varialbe
+ //
+ BdsLibUpdateConsoleVariable (ConVarName, NULL, Instance);
+ } else {
+ DeviceExist = TRUE;
+ }
+ }
+ FreePool(Instance);
+ } while (CopyOfDevicePath != NULL);
+
+ FreePool (StartDevicePath);
+
+ if (!DeviceExist) {
+ return EFI_NOT_FOUND;
+ }
+
+ return EFI_SUCCESS;
}
/**
@@ -808,7 +751,10 @@ ConvertBmpToGopBlt (
ColorMapNum = 0;
break;
}
- if (BmpHeader->ImageOffset - sizeof (BMP_IMAGE_HEADER) != sizeof (BMP_COLOR_MAP) * ColorMapNum) {
+ //
+ // BMP file may has padding data between the bmp header section and the bmp data section.
+ //
+ if (BmpHeader->ImageOffset - sizeof (BMP_IMAGE_HEADER) < sizeof (BMP_COLOR_MAP) * ColorMapNum) {
return EFI_INVALID_PARAMETER;
}
}
diff --git a/IntelFrameworkModulePkg/Library/GenericBdsLib/InternalBdsLib.h b/IntelFrameworkModulePkg/Library/GenericBdsLib/InternalBdsLib.h
index bcd85b1..f6410a6 100644
--- a/IntelFrameworkModulePkg/Library/GenericBdsLib/InternalBdsLib.h
+++ b/IntelFrameworkModulePkg/Library/GenericBdsLib/InternalBdsLib.h
@@ -1,7 +1,7 @@
/** @file
BDS library definition, include the file and data structure
-Copyright (c) 2004 - 2012, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2004 - 2013, 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
@@ -157,28 +157,4 @@ ValidateOption (
UINTN VariableSize
);
-/**
- This function will create all handles associate with every device
- path node. If the handle associate with one device path node can not
- be created successfully, Dispatch service which load the missing drivers
- is called basing on input parameter, since in some cases no driver
- dependency is assumed exist, so may need not to call this service.
-
- @param DevicePathToConnect The device path which will be connected, it can be
- a multi-instance device path
- @param NeedDispatch Whether requires dispatch service during connection
-
- @retval EFI_SUCCESS All handles associate with every device path node
- have been created
- @retval EFI_OUT_OF_RESOURCES There is no resource to create new handles
- @retval EFI_NOT_FOUND Create the handle associate with one device path
- node failed
-
-**/
-EFI_STATUS
-ConnectDevicePathInternal (
- IN EFI_DEVICE_PATH_PROTOCOL *DevicePathToConnect,
- IN BOOLEAN NeedDispatch
- );
-
#endif // _BDS_LIB_H_
diff --git a/IntelFrameworkModulePkg/Universal/BdsDxe/BdsEntry.c b/IntelFrameworkModulePkg/Universal/BdsDxe/BdsEntry.c
index 5486a5c..2b62ac5 100644
--- a/IntelFrameworkModulePkg/Universal/BdsDxe/BdsEntry.c
+++ b/IntelFrameworkModulePkg/Universal/BdsDxe/BdsEntry.c
@@ -457,6 +457,8 @@ BdsEntry (
LIST_ENTRY BootOptionList;
UINTN BootNextSize;
CHAR16 *FirmwareVendor;
+ EFI_STATUS Status;
+ UINT16 BootTimeOut;
//
// Insert the performance probe
@@ -510,6 +512,25 @@ BdsEntry (
InitializeHwErrRecSupport();
//
+ // Initialize L"Timeout" EFI global variable.
+ //
+ BootTimeOut = PcdGet16 (PcdPlatformBootTimeOut);
+ if (BootTimeOut != 0xFFFF) {
+ //
+ // If time out value equal 0xFFFF, no need set to 0xFFFF to variable area because UEFI specification
+ // define same behavior between no value or 0xFFFF value for L"Timeout".
+ //
+ Status = gRT->SetVariable (
+ L"Timeout",
+ &gEfiGlobalVariableGuid,
+ EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE,
+ sizeof (UINT16),
+ &BootTimeOut
+ );
+ ASSERT_EFI_ERROR(Status);
+ }
+
+ //
// bugbug: platform specific code
// Initialize the platform specific string and language
//
diff --git a/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/BootMaint.c b/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/BootMaint.c
index 1186c0c..d33a52b 100644
--- a/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/BootMaint.c
+++ b/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/BootMaint.c
@@ -1,7 +1,7 @@
/** @file
The functions for Boot Maintainence Main menu.
-Copyright (c) 2004 - 2011, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2004 - 2013, 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
@@ -672,7 +672,14 @@ ApplyChangeHandler (
break;
case FORM_TIME_OUT_ID:
- PcdSet16 (PcdPlatformBootTimeOut, CurrentFakeNVMap->BootTimeOut);
+ Status = gRT->SetVariable (
+ L"Timeout",
+ &gEfiGlobalVariableGuid,
+ EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE,
+ sizeof (UINT16),
+ &(CurrentFakeNVMap->BootTimeOut)
+ );
+ ASSERT_EFI_ERROR(Status);
Private->BmmOldFakeNVData.BootTimeOut = CurrentFakeNVMap->BootTimeOut;
break;
diff --git a/IntelFrameworkModulePkg/Universal/BdsDxe/FrontPage.c b/IntelFrameworkModulePkg/Universal/BdsDxe/FrontPage.c
index 3dad6bd..da0e17b 100644
--- a/IntelFrameworkModulePkg/Universal/BdsDxe/FrontPage.c
+++ b/IntelFrameworkModulePkg/Universal/BdsDxe/FrontPage.c
@@ -1,7 +1,7 @@
/** @file
FrontPage routines to handle the callbacks and browser calls
-Copyright (c) 2004 - 2012, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2004 - 2013, 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
@@ -21,6 +21,7 @@ BOOLEAN mModeInitialized = FALSE;
BOOLEAN gConnectAllHappened = FALSE;
UINTN gCallbackKey;
+CHAR8 *mLanguageString;
//
// Boot video resolution and text mode.
@@ -178,13 +179,10 @@ FrontPageCallback (
OUT EFI_BROWSER_ACTION_REQUEST *ActionRequest
)
{
- CHAR8 *LanguageString;
CHAR8 *LangCode;
CHAR8 *Lang;
UINTN Index;
EFI_STATUS Status;
- CHAR8 *PlatformSupportedLanguages;
- CHAR8 *BestLanguage;
if (Action != EFI_BROWSER_ACTION_CHANGING && Action != EFI_BROWSER_ACTION_CHANGED) {
//
@@ -210,18 +208,13 @@ FrontPageCallback (
case FRONT_PAGE_KEY_LANGUAGE:
//
- // Collect the languages from what our current Language support is based on our VFR
- //
- LanguageString = HiiGetSupportedLanguages (gFrontPagePrivate.HiiHandle);
- ASSERT (LanguageString != NULL);
- //
// Allocate working buffer for RFC 4646 language in supported LanguageString.
//
- Lang = AllocatePool (AsciiStrSize (LanguageString));
- ASSERT (Lang != NULL);
+ Lang = AllocatePool (AsciiStrSize (mLanguageString));
+ ASSERT (Lang != NULL);
Index = 0;
- LangCode = LanguageString;
+ LangCode = mLanguageString;
while (*LangCode != 0) {
GetNextLanguage (&LangCode, Lang);
@@ -232,43 +225,22 @@ FrontPageCallback (
Index++;
}
- GetEfiGlobalVariable2 (L"PlatformLangCodes", (VOID**)&PlatformSupportedLanguages, NULL);
- if (PlatformSupportedLanguages == NULL) {
- PlatformSupportedLanguages = AllocateCopyPool (
- AsciiStrSize ((CHAR8 *) PcdGetPtr (PcdUefiVariableDefaultPlatformLangCodes)),
- (CHAR8 *) PcdGetPtr (PcdUefiVariableDefaultPlatformLangCodes)
- );
- ASSERT (PlatformSupportedLanguages != NULL);
- }
-
- //
- // Select the best language in platform supported Language.
- //
- BestLanguage = GetBestLanguage (
- PlatformSupportedLanguages,
- FALSE,
- Lang,
- NULL
- );
- if (BestLanguage != NULL) {
+ if (Index == Value->u8) {
Status = gRT->SetVariable (
L"PlatformLang",
&gEfiGlobalVariableGuid,
EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,
- AsciiStrSize (BestLanguage),
+ AsciiStrSize (Lang),
Lang
);
ASSERT_EFI_ERROR(Status);
- FreePool (BestLanguage);
} else {
ASSERT (FALSE);
}
*ActionRequest = EFI_BROWSER_ACTION_REQUEST_EXIT;
- FreePool (PlatformSupportedLanguages);
FreePool (Lang);
- FreePool (LanguageString);
break;
default:
@@ -328,11 +300,9 @@ InitializeFrontPage (
)
{
EFI_STATUS Status;
- CHAR8 *LanguageString;
CHAR8 *LangCode;
CHAR8 *Lang;
CHAR8 *CurrentLang;
- CHAR8 *BestLanguage;
UINTN OptionCount;
CHAR16 *StringBuffer;
EFI_HII_HANDLE HiiHandle;
@@ -341,7 +311,11 @@ InitializeFrontPage (
VOID *EndOpCodeHandle;
EFI_IFR_GUID_LABEL *StartLabel;
EFI_IFR_GUID_LABEL *EndLabel;
- BOOLEAN FirstFlag;
+ EFI_HII_STRING_PROTOCOL *HiiString;
+ UINTN StringSize;
+
+ Lang = NULL;
+ StringBuffer = NULL;
if (InitializeHiiData) {
//
@@ -422,62 +396,82 @@ InitializeFrontPage (
// Collect the languages from what our current Language support is based on our VFR
//
HiiHandle = gFrontPagePrivate.HiiHandle;
- LanguageString = HiiGetSupportedLanguages (HiiHandle);
- ASSERT (LanguageString != NULL);
- //
- // Allocate working buffer for RFC 4646 language in supported LanguageString.
- //
- Lang = AllocatePool (AsciiStrSize (LanguageString));
- ASSERT (Lang != NULL);
-
- GetEfiGlobalVariable2 (L"PlatformLang", (VOID**)&CurrentLang, NULL);
- //
- // Select the best language in LanguageString as the default one.
- //
- BestLanguage = GetBestLanguage (
- LanguageString,
- FALSE,
- (CurrentLang != NULL) ? CurrentLang : "",
- (CHAR8 *) PcdGetPtr (PcdUefiVariableDefaultPlatformLang),
- LanguageString,
- NULL
- );
- //
- // BestLanguage must be selected as it is the first language in LanguageString by default
- //
- ASSERT (BestLanguage != NULL);
- OptionCount = 0;
- LangCode = LanguageString;
- FirstFlag = FALSE;
+ CurrentLang = GetEfiGlobalVariable (L"PlatformLang");
if (gFrontPagePrivate.LanguageToken == NULL) {
+ //
+ // Get Support language list from variable.
+ //
+ mLanguageString = GetEfiGlobalVariable (L"PlatformLangCodes");
+ if (mLanguageString == NULL) {
+ mLanguageString = AllocateCopyPool (
+ AsciiStrSize ((CHAR8 *) PcdGetPtr (PcdUefiVariableDefaultPlatformLangCodes)),
+ (CHAR8 *) PcdGetPtr (PcdUefiVariableDefaultPlatformLangCodes)
+ );
+ ASSERT (mLanguageString != NULL);
+ }
+
+ //
+ // Count the language list number.
+ //
+ LangCode = mLanguageString;
+ Lang = AllocatePool (AsciiStrSize (mLanguageString));
+ ASSERT (Lang != NULL);
+ OptionCount = 0;
while (*LangCode != 0) {
GetNextLanguage (&LangCode, Lang);
OptionCount ++;
}
- gFrontPagePrivate.LanguageToken = AllocatePool (OptionCount * sizeof (EFI_STRING_ID));
+
+ //
+ // Allocate extra 1 as the end tag.
+ //
+ gFrontPagePrivate.LanguageToken = AllocateZeroPool ((OptionCount + 1) * sizeof (EFI_STRING_ID));
ASSERT (gFrontPagePrivate.LanguageToken != NULL);
- FirstFlag = TRUE;
- }
- OptionCount = 0;
- LangCode = LanguageString;
- while (*LangCode != 0) {
- GetNextLanguage (&LangCode, Lang);
+ Status = gBS->LocateProtocol (&gEfiHiiStringProtocolGuid, NULL, (VOID **) &HiiString);
+ ASSERT_EFI_ERROR (Status);
- if (FirstFlag) {
- StringBuffer = HiiGetString (HiiHandle, PRINTABLE_LANGUAGE_NAME_STRING_ID, Lang);
- ASSERT (StringBuffer != NULL);
+ LangCode = mLanguageString;
+ OptionCount = 0;
+ while (*LangCode != 0) {
+ GetNextLanguage (&LangCode, Lang);
- //
- // Save the string Id for each language
- //
+ StringSize = 0;
+ Status = HiiString->GetString (HiiString, Lang, HiiHandle, PRINTABLE_LANGUAGE_NAME_STRING_ID, StringBuffer, &StringSize, NULL);
+ if (Status == EFI_BUFFER_TOO_SMALL) {
+ StringBuffer = AllocateZeroPool (StringSize);
+ ASSERT (StringBuffer != NULL);
+ Status = HiiString->GetString (HiiString, Lang, HiiHandle, PRINTABLE_LANGUAGE_NAME_STRING_ID, StringBuffer, &StringSize, NULL);
+ ASSERT_EFI_ERROR (Status);
+ }
+
+ if (EFI_ERROR (Status)) {
+ StringBuffer = AllocatePool (AsciiStrSize (Lang) * sizeof (CHAR16));
+ ASSERT (StringBuffer != NULL);
+ AsciiStrToUnicodeStr (Lang, StringBuffer);
+ }
+
+ ASSERT (StringBuffer != NULL);
gFrontPagePrivate.LanguageToken[OptionCount] = HiiSetString (HiiHandle, 0, StringBuffer, NULL);
FreePool (StringBuffer);
+
+ OptionCount++;
}
+ }
- if (AsciiStrCmp (Lang, BestLanguage) == 0) {
+ ASSERT (gFrontPagePrivate.LanguageToken != NULL);
+ LangCode = mLanguageString;
+ OptionCount = 0;
+ if (Lang == NULL) {
+ Lang = AllocatePool (AsciiStrSize (mLanguageString));
+ ASSERT (Lang != NULL);
+ }
+ while (*LangCode != 0) {
+ GetNextLanguage (&LangCode, Lang);
+
+ if (CurrentLang != NULL && AsciiStrCmp (Lang, CurrentLang) == 0) {
HiiCreateOneOfOptionOpCode (
OptionsOpCodeHandle,
gFrontPagePrivate.LanguageToken[OptionCount],
@@ -501,9 +495,7 @@ InitializeFrontPage (
if (CurrentLang != NULL) {
FreePool (CurrentLang);
}
- FreePool (BestLanguage);
FreePool (Lang);
- FreePool (LanguageString);
HiiCreateOneOfOpCode (
StartOpCodeHandle,
@@ -1229,6 +1221,9 @@ PlatformBdsEnterFrontPage (
} while ((Status == EFI_SUCCESS) && (gCallbackKey != FRONT_PAGE_KEY_CONTINUE));
+ if (mLanguageString != NULL) {
+ FreePool (mLanguageString);
+ }
//
//Will leave browser, check any reset required change is applied? if yes, reset system
//
diff --git a/IntelFrameworkModulePkg/Universal/BdsDxe/HwErrRecSupport.c b/IntelFrameworkModulePkg/Universal/BdsDxe/HwErrRecSupport.c
index ee1763b..ddb2f93 100644
--- a/IntelFrameworkModulePkg/Universal/BdsDxe/HwErrRecSupport.c
+++ b/IntelFrameworkModulePkg/Universal/BdsDxe/HwErrRecSupport.c
@@ -2,7 +2,7 @@
Set the level of support for Hardware Error Record Persistence that is
implemented by the platform.
-Copyright (c) 2007 - 2008, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2007 - 2013, 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
@@ -26,17 +26,23 @@ InitializeHwErrRecSupport (
VOID
)
{
- UINT16 HardwareErrorRecordLevel;
+ EFI_STATUS Status;
+ UINT16 HardwareErrorRecordLevel;
HardwareErrorRecordLevel = PcdGet16 (PcdHardwareErrorRecordLevel);
if (HardwareErrorRecordLevel != 0) {
//
- // Set original value again to make sure this value is stored into variable
- // area but not PCD database.
- // if level value equal 0, no need set to 0 to variable area because UEFI specification
- // define same behavior between no value or 0 value for L"HwErrRecSupport"
+ // If level value equal 0, no need set to 0 to variable area because UEFI specification
+ // define same behavior between no value or 0 value for L"HwErrRecSupport".
//
- PcdSet16 (PcdHardwareErrorRecordLevel, HardwareErrorRecordLevel);
+ Status = gRT->SetVariable (
+ L"HwErrRecSupport",
+ &gEfiGlobalVariableGuid,
+ EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE,
+ sizeof (UINT16),
+ &HardwareErrorRecordLevel
+ );
+ ASSERT_EFI_ERROR(Status);
}
}
diff --git a/MdeModulePkg/Bus/Usb/UsbBusDxe/UsbBus.c b/MdeModulePkg/Bus/Usb/UsbBusDxe/UsbBus.c
index 72702b6..ff6b99c 100644
--- a/MdeModulePkg/Bus/Usb/UsbBusDxe/UsbBus.c
+++ b/MdeModulePkg/Bus/Usb/UsbBusDxe/UsbBus.c
@@ -2,7 +2,7 @@
Usb Bus Driver Binding and Bus IO Protocol.
-Copyright (c) 2004 - 2012, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2004 - 2013, 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
@@ -970,6 +970,7 @@ UsbBusBuildProtocol (
// The EFI_USB2_HC_PROTOCOL is produced for XHCI support.
// Then its max supported devices are 256. Otherwise it's 128.
//
+ ASSERT (UsbBus->Usb2Hc != NULL);
if (UsbBus->Usb2Hc->MajorRevision == 0x3) {
UsbBus->MaxDevices = 256;
}