/** @file\r
Parser for IFR binary encoding.\r
\r
-Copyright (c) 2007 - 2015, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2007 - 2016, 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
INTN ConditionalExprCount;\r
BOOLEAN InUnknownScope;\r
UINT8 UnknownDepth;\r
+ FORMSET_DEFAULTSTORE *PreDefaultStore;\r
+ LIST_ENTRY *DefaultLink;\r
+ BOOLEAN HaveInserted;\r
\r
SuppressForQuestion = FALSE;\r
SuppressForOption = FALSE;\r
// DefaultStore\r
//\r
case EFI_IFR_DEFAULTSTORE_OP:\r
+ HaveInserted = FALSE;\r
DefaultStore = AllocateZeroPool (sizeof (FORMSET_DEFAULTSTORE));\r
ASSERT (DefaultStore != NULL);\r
DefaultStore->Signature = FORMSET_DEFAULTSTORE_SIGNATURE;\r
\r
CopyMem (&DefaultStore->DefaultId, &((EFI_IFR_DEFAULTSTORE *) OpCodeData)->DefaultId, sizeof (UINT16));\r
CopyMem (&DefaultStore->DefaultName, &((EFI_IFR_DEFAULTSTORE *) OpCodeData)->DefaultName, sizeof (EFI_STRING_ID));\r
-\r
//\r
- // Insert to DefaultStore list of this Formset\r
+ // Insert it to the DefaultStore list of this Formset with ascending order.\r
//\r
- InsertTailList (&FormSet->DefaultStoreListHead, &DefaultStore->Link);\r
+ if (!IsListEmpty (&FormSet->DefaultStoreListHead)) {\r
+ DefaultLink = GetFirstNode (&FormSet->DefaultStoreListHead);\r
+ while (!IsNull (&FormSet->DefaultStoreListHead, DefaultLink)) {\r
+ PreDefaultStore = FORMSET_DEFAULTSTORE_FROM_LINK(DefaultLink);\r
+ DefaultLink = GetNextNode (&FormSet->DefaultStoreListHead, DefaultLink);\r
+ if (DefaultStore->DefaultId < PreDefaultStore->DefaultId) {\r
+ InsertTailList (&PreDefaultStore->Link, &DefaultStore->Link);\r
+ HaveInserted = TRUE;\r
+ break;\r
+ }\r
+ }\r
+ }\r
+ if (!HaveInserted) {\r
+ InsertTailList (&FormSet->DefaultStoreListHead, &DefaultStore->Link);\r
+ }\r
break;\r
\r
//\r