]> git.proxmox.com Git - mirror_edk2.git/blobdiff - IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/BootMaint.c
Enhance BDS to support Boot/Driver option whose option number >= 0xFF.
[mirror_edk2.git] / IntelFrameworkModulePkg / Universal / BdsDxe / BootMaint / BootMaint.c
index 48035298d3d6ba2f23ce8799de5bc3edf7098b4c..6e15e096a68fd33d2635f30f69f68f7c6eda9750 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   The functions for Boot Maintainence Main menu.\r
 \r
-Copyright (c) 2004 - 2010, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2004 - 2011, 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
@@ -678,11 +678,11 @@ ApplyChangeHandler (
 \r
   case FORM_BOOT_DEL_ID:\r
     for (Index = 0; \r
-         ((Index < BootOptionMenu.MenuNumber) && (Index < (sizeof (CurrentFakeNVMap->BootOptionDel) / sizeof (UINT8)))); \r
+         ((Index < BootOptionMenu.MenuNumber) && (Index < (sizeof (CurrentFakeNVMap->OptionDel) / sizeof (CurrentFakeNVMap->OptionDel[0])))); \r
          Index ++) {\r
       NewMenuEntry            = BOpt_GetMenuEntry (&BootOptionMenu, Index);\r
       NewLoadContext          = (BM_LOAD_CONTEXT *) NewMenuEntry->VariableContext;\r
-      NewLoadContext->Deleted = CurrentFakeNVMap->BootOptionDel[Index];\r
+      NewLoadContext->Deleted = CurrentFakeNVMap->OptionDel[Index];\r
     }\r
 \r
     Var_DelBootOption ();\r
@@ -690,11 +690,11 @@ ApplyChangeHandler (
 \r
   case FORM_DRV_DEL_ID:\r
     for (Index = 0; \r
-         ((Index < DriverOptionMenu.MenuNumber) && (Index < (sizeof (CurrentFakeNVMap->DriverOptionDel) / sizeof (UINT8)))); \r
+         ((Index < DriverOptionMenu.MenuNumber) && (Index < (sizeof (CurrentFakeNVMap->OptionDel) / sizeof (CurrentFakeNVMap->OptionDel[0])))); \r
          Index++) {\r
       NewMenuEntry            = BOpt_GetMenuEntry (&DriverOptionMenu, Index);\r
       NewLoadContext          = (BM_LOAD_CONTEXT *) NewMenuEntry->VariableContext;\r
-      NewLoadContext->Deleted = CurrentFakeNVMap->DriverOptionDel[Index];\r
+      NewLoadContext->Deleted = CurrentFakeNVMap->OptionDel[Index];\r
     }\r
 \r
     Var_DelDriverOption ();\r
@@ -757,14 +757,14 @@ ApplyChangeHandler (
     for (Index = 0; Index < ConsoleInpMenu.MenuNumber; Index++) {\r
       NewMenuEntry                = BOpt_GetMenuEntry (&ConsoleInpMenu, Index);\r
       NewConsoleContext           = (BM_CONSOLE_CONTEXT *) NewMenuEntry->VariableContext;\r
-         ASSERT (Index < MAX_MENU_NUMBER);\r
+      ASSERT (Index < MAX_MENU_NUMBER);\r
       NewConsoleContext->IsActive = CurrentFakeNVMap->ConsoleCheck[Index];\r
     }\r
 \r
     for (Index = 0; Index < TerminalMenu.MenuNumber; Index++) {\r
       NewMenuEntry                = BOpt_GetMenuEntry (&TerminalMenu, Index);\r
       NewTerminalContext          = (BM_TERMINAL_CONTEXT *) NewMenuEntry->VariableContext;\r
-         ASSERT (Index + ConsoleInpMenu.MenuNumber < MAX_MENU_NUMBER);\r
+      ASSERT (Index + ConsoleInpMenu.MenuNumber < MAX_MENU_NUMBER);\r
       NewTerminalContext->IsConIn = CurrentFakeNVMap->ConsoleCheck[Index + ConsoleInpMenu.MenuNumber];\r
     }\r
 \r
@@ -775,14 +775,14 @@ ApplyChangeHandler (
     for (Index = 0; Index < ConsoleOutMenu.MenuNumber; Index++) {\r
       NewMenuEntry                = BOpt_GetMenuEntry (&ConsoleOutMenu, Index);\r
       NewConsoleContext           = (BM_CONSOLE_CONTEXT *) NewMenuEntry->VariableContext;\r
-         ASSERT (Index < MAX_MENU_NUMBER);\r
+      ASSERT (Index < MAX_MENU_NUMBER);\r
       NewConsoleContext->IsActive = CurrentFakeNVMap->ConsoleCheck[Index];\r
     }\r
 \r
     for (Index = 0; Index < TerminalMenu.MenuNumber; Index++) {\r
       NewMenuEntry                  = BOpt_GetMenuEntry (&TerminalMenu, Index);\r
       NewTerminalContext            = (BM_TERMINAL_CONTEXT *) NewMenuEntry->VariableContext;\r
-         ASSERT (Index + ConsoleOutMenu.MenuNumber < MAX_MENU_NUMBER);\r
+      ASSERT (Index + ConsoleOutMenu.MenuNumber < MAX_MENU_NUMBER);\r
       NewTerminalContext->IsConOut  = CurrentFakeNVMap->ConsoleCheck[Index + ConsoleOutMenu.MenuNumber];\r
     }\r
 \r
@@ -793,14 +793,14 @@ ApplyChangeHandler (
     for (Index = 0; Index < ConsoleErrMenu.MenuNumber; Index++) {\r
       NewMenuEntry                = BOpt_GetMenuEntry (&ConsoleErrMenu, Index);\r
       NewConsoleContext           = (BM_CONSOLE_CONTEXT *) NewMenuEntry->VariableContext;\r
-         ASSERT (Index < MAX_MENU_NUMBER);\r
+      ASSERT (Index < MAX_MENU_NUMBER);\r
       NewConsoleContext->IsActive = CurrentFakeNVMap->ConsoleCheck[Index];\r
     }\r
 \r
     for (Index = 0; Index < TerminalMenu.MenuNumber; Index++) {\r
       NewMenuEntry                  = BOpt_GetMenuEntry (&TerminalMenu, Index);\r
       NewTerminalContext            = (BM_TERMINAL_CONTEXT *) NewMenuEntry->VariableContext;\r
-         ASSERT (Index + ConsoleErrMenu.MenuNumber < MAX_MENU_NUMBER);\r
+      ASSERT (Index + ConsoleErrMenu.MenuNumber < MAX_MENU_NUMBER);\r
       NewTerminalContext->IsStdErr  = CurrentFakeNVMap->ConsoleCheck[Index + ConsoleErrMenu.MenuNumber];\r
     }\r
 \r
@@ -850,20 +850,20 @@ DiscardChangeHandler (
   switch (Private->BmmPreviousPageId) {\r
   case FORM_BOOT_CHG_ID:\r
   case FORM_DRV_CHG_ID:\r
-    CopyMem (CurrentFakeNVMap->OptionOrder, Private->BmmOldFakeNVData.OptionOrder, 100);\r
+    CopyMem (CurrentFakeNVMap->OptionOrder, Private->BmmOldFakeNVData.OptionOrder, sizeof (CurrentFakeNVMap->OptionOrder));\r
     break;\r
 \r
   case FORM_BOOT_DEL_ID:\r
-    ASSERT (BootOptionMenu.MenuNumber <= (sizeof (CurrentFakeNVMap->BootOptionDel) / sizeof (CurrentFakeNVMap->BootOptionDel[0])));\r
+    ASSERT (BootOptionMenu.MenuNumber <= (sizeof (CurrentFakeNVMap->OptionDel) / sizeof (CurrentFakeNVMap->OptionDel[0])));\r
     for (Index = 0; Index < BootOptionMenu.MenuNumber; Index++) {\r
-      CurrentFakeNVMap->BootOptionDel[Index] = 0x00;\r
+      CurrentFakeNVMap->OptionDel[Index] = FALSE;\r
     }\r
     break;\r
 \r
   case FORM_DRV_DEL_ID:\r
-    ASSERT (DriverOptionMenu.MenuNumber <= (sizeof (CurrentFakeNVMap->DriverOptionDel) / sizeof (CurrentFakeNVMap->DriverOptionDel[0])));\r
+    ASSERT (DriverOptionMenu.MenuNumber <= (sizeof (CurrentFakeNVMap->OptionDel) / sizeof (CurrentFakeNVMap->OptionDel[0])));\r
     for (Index = 0; Index < DriverOptionMenu.MenuNumber; Index++) {\r
-      CurrentFakeNVMap->DriverOptionDel[Index] = 0x00;\r
+      CurrentFakeNVMap->OptionDel[Index] = FALSE;\r
     }\r
     break;\r
 \r