/** @file\r
Variable operation that will be used by bootmaint\r
\r
-Copyright (c) 2004 - 2012, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2004 - 2014, Intel Corporation. All rights reserved.<BR>\r
This program and the accompanying materials\r
are licensed and made available under the terms and conditions of the BSD License\r
which accompanies this distribution. The full text of the license may be found at\r
BootOrderListSize * sizeof (UINT16),\r
BootOrderList\r
);\r
- if (EFI_ERROR (Status)) {\r
- return Status;\r
- }\r
+ //\r
+ // Changing variable without increasing its size with current variable implementation shouldn't fail.\r
+ //\r
+ ASSERT_EFI_ERROR (Status);\r
}\r
return EFI_SUCCESS;\r
}\r
DriverOrderListSize * sizeof (UINT16),\r
DriverOrderList\r
);\r
- if (EFI_ERROR (Status)) {\r
- return Status;\r
- }\r
+ //\r
+ // Changing variable without increasing its size with current variable implementation shouldn't fail.\r
+ //\r
+ ASSERT_EFI_ERROR (Status);\r
}\r
return EFI_SUCCESS;\r
}\r
GetDevicePathSize (OutDevicePath),\r
OutDevicePath\r
);\r
- ASSERT (!EFI_ERROR (Status));\r
+ //\r
+ // Changing variable without increasing its size with current variable implementation shouldn't fail.\r
+ //\r
+ ASSERT_EFI_ERROR (Status);\r
}\r
\r
if (InpDevicePath != NULL) {\r
GetDevicePathSize (InpDevicePath),\r
InpDevicePath\r
);\r
- ASSERT (!EFI_ERROR (Status));\r
+ //\r
+ // Changing variable without increasing its size with current variable implementation shouldn't fail.\r
+ //\r
+ ASSERT_EFI_ERROR (Status);\r
}\r
\r
if (ErrDevicePath != NULL) {\r
GetDevicePathSize (ErrDevicePath),\r
ErrDevicePath\r
);\r
- ASSERT (!EFI_ERROR (Status));\r
+ //\r
+ // Changing variable without increasing its size with current variable implementation shouldn't fail.\r
+ //\r
+ ASSERT_EFI_ERROR (Status);\r
}\r
}\r
\r
BufferSize,\r
Buffer\r
);\r
- ASSERT_EFI_ERROR (Status);\r
- DriverOrderList = BdsLibGetVariableAndSize (\r
- L"DriverOrder",\r
- &gEfiGlobalVariableGuid,\r
- &DriverOrderListSize\r
- );\r
- NewDriverOrderList = AllocateZeroPool (DriverOrderListSize + sizeof (UINT16));\r
- ASSERT (NewDriverOrderList != NULL);\r
- if (DriverOrderList != NULL) {\r
- CopyMem (NewDriverOrderList, DriverOrderList, DriverOrderListSize);\r
- EfiLibDeleteVariable (L"DriverOrder", &gEfiGlobalVariableGuid);\r
- }\r
- NewDriverOrderList[DriverOrderListSize / sizeof (UINT16)] = Index;\r
+ if (!EFI_ERROR (Status)) {\r
+ DriverOrderList = BdsLibGetVariableAndSize (\r
+ L"DriverOrder",\r
+ &gEfiGlobalVariableGuid,\r
+ &DriverOrderListSize\r
+ );\r
+ NewDriverOrderList = AllocateZeroPool (DriverOrderListSize + sizeof (UINT16));\r
+ ASSERT (NewDriverOrderList != NULL);\r
+ if (DriverOrderList != NULL) {\r
+ CopyMem (NewDriverOrderList, DriverOrderList, DriverOrderListSize);\r
+ EfiLibDeleteVariable (L"DriverOrder", &gEfiGlobalVariableGuid);\r
+ }\r
+ NewDriverOrderList[DriverOrderListSize / sizeof (UINT16)] = Index;\r
\r
- Status = gRT->SetVariable (\r
- L"DriverOrder",\r
- &gEfiGlobalVariableGuid,\r
- EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE,\r
- DriverOrderListSize + sizeof (UINT16),\r
- NewDriverOrderList\r
- );\r
- ASSERT_EFI_ERROR (Status);\r
- if (DriverOrderList != NULL) {\r
- FreePool (DriverOrderList);\r
- }\r
- DriverOrderList = NULL;\r
- FreePool (NewDriverOrderList);\r
- InsertTailList (&DriverOptionMenu.Head, &NewMenuEntry->Link);\r
- DriverOptionMenu.MenuNumber++;\r
+ Status = gRT->SetVariable (\r
+ L"DriverOrder",\r
+ &gEfiGlobalVariableGuid,\r
+ EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE,\r
+ DriverOrderListSize + sizeof (UINT16),\r
+ NewDriverOrderList\r
+ );\r
+ if (DriverOrderList != NULL) {\r
+ FreePool (DriverOrderList);\r
+ }\r
+ DriverOrderList = NULL;\r
+ FreePool (NewDriverOrderList);\r
+ if (!EFI_ERROR (Status)) {\r
+ InsertTailList (&DriverOptionMenu.Head, &NewMenuEntry->Link);\r
+ DriverOptionMenu.MenuNumber++;\r
\r
- *DescriptionData = 0x0000;\r
- *OptionalData = 0x0000;\r
+ *DescriptionData = 0x0000;\r
+ *OptionalData = 0x0000;\r
+ }\r
+ }\r
return EFI_SUCCESS;\r
}\r
\r
BufferSize,\r
Buffer\r
);\r
- ASSERT_EFI_ERROR (Status);\r
+ if (!EFI_ERROR (Status)) {\r
\r
- BootOrderList = BdsLibGetVariableAndSize (\r
+ BootOrderList = BdsLibGetVariableAndSize (\r
+ L"BootOrder",\r
+ &gEfiGlobalVariableGuid,\r
+ &BootOrderListSize\r
+ );\r
+ ASSERT (BootOrderList != NULL);\r
+ NewBootOrderList = AllocateZeroPool (BootOrderListSize + sizeof (UINT16));\r
+ ASSERT (NewBootOrderList != NULL);\r
+ CopyMem (NewBootOrderList, BootOrderList, BootOrderListSize);\r
+ NewBootOrderList[BootOrderListSize / sizeof (UINT16)] = Index;\r
+\r
+ if (BootOrderList != NULL) {\r
+ FreePool (BootOrderList);\r
+ }\r
+\r
+ Status = gRT->SetVariable (\r
L"BootOrder",\r
&gEfiGlobalVariableGuid,\r
- &BootOrderListSize\r
+ EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE,\r
+ BootOrderListSize + sizeof (UINT16),\r
+ NewBootOrderList\r
);\r
- ASSERT (BootOrderList != NULL);\r
- NewBootOrderList = AllocateZeroPool (BootOrderListSize + sizeof (UINT16));\r
- ASSERT (NewBootOrderList != NULL);\r
- CopyMem (NewBootOrderList, BootOrderList, BootOrderListSize);\r
- NewBootOrderList[BootOrderListSize / sizeof (UINT16)] = Index;\r
+ if (!EFI_ERROR (Status)) {\r
\r
- if (BootOrderList != NULL) {\r
- FreePool (BootOrderList);\r
- }\r
+ FreePool (NewBootOrderList);\r
+ NewBootOrderList = NULL;\r
+ InsertTailList (&BootOptionMenu.Head, &NewMenuEntry->Link);\r
+ BootOptionMenu.MenuNumber++;\r
\r
- Status = gRT->SetVariable (\r
- L"BootOrder",\r
- &gEfiGlobalVariableGuid,\r
- EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE,\r
- BootOrderListSize + sizeof (UINT16),\r
- NewBootOrderList\r
- );\r
- ASSERT_EFI_ERROR (Status);\r
-\r
- FreePool (NewBootOrderList);\r
- NewBootOrderList = NULL;\r
- InsertTailList (&BootOptionMenu.Head, &NewMenuEntry->Link);\r
- BootOptionMenu.MenuNumber++;\r
-\r
- NvRamMap->DescriptionData[0] = 0x0000;\r
- NvRamMap->OptionalData[0] = 0x0000;\r
+ NvRamMap->DescriptionData[0] = 0x0000;\r
+ NvRamMap->OptionalData[0] = 0x0000;\r
+ }\r
+ }\r
return EFI_SUCCESS;\r
}\r
\r
BootOrderListSize,\r
BootOrderList\r
);\r
+ //\r
+ // Changing the content without increasing its size with current variable implementation shouldn't fail.\r
+ //\r
+ ASSERT_EFI_ERROR (Status);\r
FreePool (BootOrderList);\r
\r
GroupMultipleLegacyBootOption4SameType ();\r
DriverOrderListSize,\r
NewDriverOrderList\r
);\r
- if (EFI_ERROR (Status)) {\r
- return Status;\r
- }\r
-\r
+ //\r
+ // Changing the content without increasing its size with current variable implementation shouldn't fail.\r
+ //\r
+ ASSERT_EFI_ERROR (Status);\r
+ \r
BOpt_FreeMenu (&DriverOptionMenu);\r
BOpt_GetDriverOptions (CallbackData);\r
return EFI_SUCCESS;\r
OptionSize,\r
BootOptionVar\r
);\r
+ //\r
+ // Changing the content without increasing its size with current variable implementation shouldn't fail.\r
+ //\r
+ ASSERT_EFI_ERROR (Status);\r
\r
FreePool (BootOptionVar);\r
}\r
OptionSize,\r
BootOptionVar\r
);\r
+ //\r
+ // Changing the content without increasing its size with current variable implementation shouldn't fail.\r
+ //\r
+ ASSERT_EFI_ERROR (Status);\r
\r
FreePool (BootOptionVar);\r
}\r