#include "Setup.h"\r
\r
LIST_ENTRY gMenuOption;\r
-LIST_ENTRY gMenuList = INITIALIZE_LIST_HEAD_VARIABLE (gMenuList);\r
+LIST_ENTRY gMenuList;\r
MENU_REFRESH_ENTRY *gMenuRefreshHead; // Menu list used for refresh timer opcode.\r
MENU_REFRESH_ENTRY *gMenuEventGuidRefreshHead; // Menu list used for refresh event guid opcode.\r
\r
\r
\r
/**\r
- Search Menu with given FormId and FormSetGuid in all cached menu list.\r
+ Search Menu with given FormId, FormSetGuid and Handle in all cached menu list.\r
\r
@param Parent The parent of menu to search.\r
+ @param Handle Hii handle related to this formset.\r
@param FormSetGuid The Formset GUID of the menu to search. \r
@param FormId The Form ID of menu to search.\r
\r
UI_MENU_LIST *\r
UiFindChildMenuList (\r
IN UI_MENU_LIST *Parent,\r
+ IN EFI_HII_HANDLE Handle,\r
IN EFI_GUID *FormSetGuid, \r
IN UINT16 FormId\r
)\r
\r
ASSERT (Parent != NULL);\r
\r
- if (Parent->FormId == FormId && CompareGuid (FormSetGuid, &Parent->FormSetGuid)) {\r
+ if (Parent->FormId == FormId && CompareGuid (FormSetGuid, &Parent->FormSetGuid) && Parent->HiiHandle == Handle) {\r
return Parent;\r
}\r
\r
while (!IsNull (&Parent->ChildListHead, Link)) {\r
Child = UI_MENU_LIST_FROM_LINK (Link);\r
\r
- MenuList = UiFindChildMenuList (Child, FormSetGuid, FormId);\r
+ MenuList = UiFindChildMenuList (Child, Handle, FormSetGuid, FormId);\r
if (MenuList != NULL) {\r
return MenuList;\r
}\r
\r
\r
/**\r
- Search Menu with given FormSetGuid and FormId in all cached menu list.\r
+ Search Menu with given Handle, FormSetGuid and FormId in all cached menu list.\r
\r
@param FormSetGuid The Formset GUID of the menu to search.\r
+ @param Handle Hii handle related to this formset.\r
@param FormId The Form ID of menu to search.\r
\r
@return A pointer to menu found or NULL if not found.\r
**/\r
UI_MENU_LIST *\r
UiFindMenuList (\r
+ IN EFI_HII_HANDLE Handle,\r
IN EFI_GUID *FormSetGuid,\r
IN UINT16 FormId\r
)\r
while (!IsNull (&gMenuList, Link)) {\r
MenuList = UI_MENU_LIST_FROM_LINK (Link);\r
\r
- Child = UiFindChildMenuList(MenuList, FormSetGuid, FormId);\r
+ Child = UiFindChildMenuList(MenuList, Handle, FormSetGuid, FormId);\r
if (Child != NULL) {\r
+\r
+ //\r
+ // If this form already in the menu history list,\r
+ // just free the list between old this form.\r
+ //\r
+ UiFreeMenuList(&Child->ChildListHead);\r
return Child;\r
}\r
\r
return NULL;\r
}\r
\r
+/**\r
+ Free Menu list linked list.\r
+\r
+ @param MenuListHead One Menu list point in the menu list.\r
+\r
+**/\r
+VOID\r
+UiFreeMenuList (\r
+ LIST_ENTRY *MenuListHead\r
+ )\r
+{\r
+ UI_MENU_LIST *MenuList;\r
+\r
+ while (!IsListEmpty (MenuListHead)) {\r
+ MenuList = UI_MENU_LIST_FROM_LINK (MenuListHead->ForwardLink);\r
+ RemoveEntryList (&MenuList->Link);\r
+ \r
+ UiFreeMenuList(&MenuList->ChildListHead);\r
+ FreePool (MenuList);\r
+ }\r
+\r
+}\r
\r
/**\r
Free Menu option linked list.\r
FORM_BROWSER_FORM *RefForm;\r
EFI_INPUT_KEY Key;\r
EFI_STATUS Status;\r
- UI_MENU_LIST *MenuList;\r
- BOOLEAN UpdateFormInfo;\r
- \r
- Status = EFI_SUCCESS;\r
- UpdateFormInfo = TRUE;\r
+\r
+ Status = EFI_SUCCESS;\r
StringPtr = NULL;\r
\r
//\r
*NewLine = TRUE;\r
}\r
}\r
- UpdateFormInfo = FALSE;\r
} else {\r
if ((Statement->QuestionFlags & EFI_IFR_FLAG_CALLBACK) != 0) {\r
Selection->Action = UI_ACTION_REFRESH_FORM;\r
}\r
- UpdateFormInfo = FALSE;\r
- }\r
-\r
- if (UpdateFormInfo) {\r
- //\r
- // Link current form so that we can always go back when someone hits the ESC\r
- //\r
- MenuList = UiFindMenuList (&Selection->FormSetGuid, Selection->FormId);\r
- if (MenuList == NULL && Selection->CurrentMenu != NULL) {\r
- MenuList = UiAddMenuList (Selection->CurrentMenu, Selection->Handle, &Selection->FormSetGuid, Selection->FormId);\r
- }\r
}\r
\r
return Status;\r
//\r
// Find current Menu\r
//\r
- CurrentMenu = UiFindMenuList (&Selection->FormSetGuid, Selection->FormId);\r
+ CurrentMenu = UiFindMenuList (Selection->Handle, &Selection->FormSetGuid, Selection->FormId);\r
if (CurrentMenu == NULL) {\r
//\r
// Current menu not found, add it to the menu tree\r
//\r
- CurrentMenu = UiAddMenuList (NULL, Selection->Handle, &Selection->FormSetGuid, Selection->FormId);\r
+ CurrentMenu = UiAddMenuList (Selection->CurrentMenu, Selection->Handle, &Selection->FormSetGuid, Selection->FormId);\r
}\r
ASSERT (CurrentMenu != NULL);\r
Selection->CurrentMenu = CurrentMenu;\r
\r
\r
extern LIST_ENTRY gMenuOption;\r
+extern LIST_ENTRY gMenuList;\r
extern MENU_REFRESH_ENTRY *gMenuRefreshHead;\r
extern UI_MENU_SELECTION *gCurrentSelection;\r
extern BOOLEAN mHiiPackageListUpdated;\r
);\r
\r
/**\r
- Search Menu with given FormId in the parent menu and all its child menus.\r
+ Search Menu with given FormId, FormSetGuid and Handle in all cached menu list.\r
\r
@param Parent The parent of menu to search.\r
+ @param Handle Hii handle related to this formset.\r
@param FormSetGuid The Formset GUID of the menu to search. \r
@param FormId The Form ID of menu to search.\r
\r
UI_MENU_LIST *\r
UiFindChildMenuList (\r
IN UI_MENU_LIST *Parent,\r
+ IN EFI_HII_HANDLE Handle,\r
IN EFI_GUID *FormSetGuid, \r
IN UINT16 FormId\r
);\r
\r
/**\r
- Search Menu with given FormSetGuid and FormId in all cached menu list.\r
+ Search Menu with given Handle, FormSetGuid and FormId in all cached menu list.\r
\r
@param FormSetGuid The Formset GUID of the menu to search.\r
+ @param Handle Hii handle related to this formset.\r
@param FormId The Form ID of menu to search.\r
\r
@return A pointer to menu found or NULL if not found.\r
**/\r
UI_MENU_LIST *\r
UiFindMenuList (\r
+ IN EFI_HII_HANDLE Handle,\r
IN EFI_GUID *FormSetGuid,\r
IN UINT16 FormId\r
);\r
\r
+/**\r
+ Free Menu list linked list.\r
+\r
+ @param MenuListHead One Menu list point in the menu list.\r
+\r
+**/\r
+VOID\r
+UiFreeMenuList (\r
+ LIST_ENTRY *MenuListHead\r
+ );\r
+\r
/**\r
Free Menu option linked list.\r
\r