1
1
/** @file
2
2
Parser for IFR binary encoding.
3
3
4
- Copyright (c) 2007 - 2014 , Intel Corporation. All rights reserved.<BR>
4
+ Copyright (c) 2007 - 2015 , Intel Corporation. All rights reserved.<BR>
5
5
This program and the accompanying materials
6
6
are licensed and made available under the terms and conditions of the BSD License
7
7
which accompanies this distribution. The full text of the license may be found at
@@ -320,20 +320,20 @@ CreateExpression (
320
320
EFI_STATUS
321
321
InitializeConfigHdr (
322
322
IN FORM_BROWSER_FORMSET * FormSet ,
323
- IN OUT BROWSER_STORAGE * Storage
323
+ IN OUT FORMSET_STORAGE * Storage
324
324
)
325
325
{
326
326
CHAR16 * Name ;
327
327
328
- if (Storage -> Type == EFI_HII_VARSTORE_BUFFER ||
329
- Storage -> Type == EFI_HII_VARSTORE_EFI_VARIABLE_BUFFER ) {
330
- Name = Storage -> Name ;
328
+ if (Storage -> BrowserStorage -> Type == EFI_HII_VARSTORE_BUFFER ||
329
+ Storage -> BrowserStorage -> Type == EFI_HII_VARSTORE_EFI_VARIABLE_BUFFER ) {
330
+ Name = Storage -> BrowserStorage -> Name ;
331
331
} else {
332
332
Name = NULL ;
333
333
}
334
334
335
335
Storage -> ConfigHdr = HiiConstructConfigHdr (
336
- & Storage -> Guid ,
336
+ & Storage -> BrowserStorage -> Guid ,
337
337
Name ,
338
338
FormSet -> DriverHandle
339
339
);
@@ -559,29 +559,108 @@ CreateStorage (
559
559
}
560
560
561
561
BrowserStorage -> HiiHandle = FormSet -> HiiHandle ;
562
- InitializeConfigHdr (FormSet , BrowserStorage );
563
562
564
563
BrowserStorage -> Initialized = FALSE;
565
- } else {
566
- if ((StorageType == EFI_HII_VARSTORE_EFI_VARIABLE_BUFFER ) &&
567
- (FormSet -> DriverHandle != NULL ) &&
568
- (!IsDevicePathExist (BrowserStorage -> ConfigHdr ))) {
569
- //
570
- // If this storage not has device path info but new formset has,
571
- // update the device path info.
572
- //
573
- FreePool (BrowserStorage -> ConfigHdr );
574
- InitializeConfigHdr (FormSet , BrowserStorage );
575
- }
576
564
}
577
565
578
566
Storage -> BrowserStorage = BrowserStorage ;
579
- Storage -> ConfigRequest = AllocateCopyPool (StrSize (BrowserStorage -> ConfigHdr ), BrowserStorage -> ConfigHdr );
567
+ InitializeConfigHdr (FormSet , Storage );
568
+ Storage -> ConfigRequest = AllocateCopyPool (StrSize (Storage -> ConfigHdr ), Storage -> ConfigHdr );
580
569
Storage -> SpareStrLen = 0 ;
581
570
582
571
return Storage ;
583
572
}
584
573
574
+ /**
575
+ Get Formset_storage base on the input varstoreid info.
576
+
577
+ @param FormSet Pointer of the current FormSet.
578
+ @param VarStoreId Varstore ID info.
579
+
580
+ @return Pointer to a FORMSET_STORAGE data structure.
581
+
582
+ **/
583
+ FORMSET_STORAGE *
584
+ GetFstStgFromVarId (
585
+ IN FORM_BROWSER_FORMSET * FormSet ,
586
+ IN EFI_VARSTORE_ID VarStoreId
587
+ )
588
+ {
589
+ FORMSET_STORAGE * FormsetStorage ;
590
+ LIST_ENTRY * Link ;
591
+ BOOLEAN Found ;
592
+
593
+ Found = FALSE;
594
+ FormsetStorage = NULL ;
595
+ //
596
+ // Find Formset Storage for this Question
597
+ //
598
+ Link = GetFirstNode (& FormSet -> StorageListHead );
599
+ while (!IsNull (& FormSet -> StorageListHead , Link )) {
600
+ FormsetStorage = FORMSET_STORAGE_FROM_LINK (Link );
601
+
602
+ if (FormsetStorage -> VarStoreId == VarStoreId ) {
603
+ Found = TRUE;
604
+ break ;
605
+ }
606
+
607
+ Link = GetNextNode (& FormSet -> StorageListHead , Link );
608
+ }
609
+
610
+ return Found ? FormsetStorage : NULL ;
611
+ }
612
+
613
+ /**
614
+ Get Formset_storage base on the input browser storage.
615
+
616
+ More than one formsets may share the same browser storage,
617
+ this function just get the first formset storage which
618
+ share the browser storage.
619
+
620
+ @param Storage browser storage info.
621
+
622
+ @return Pointer to a FORMSET_STORAGE data structure.
623
+
624
+
625
+ **/
626
+ FORMSET_STORAGE *
627
+ GetFstStgFromBrsStg (
628
+ IN BROWSER_STORAGE * Storage
629
+ )
630
+ {
631
+ FORMSET_STORAGE * FormsetStorage ;
632
+ LIST_ENTRY * Link ;
633
+ LIST_ENTRY * FormsetLink ;
634
+ FORM_BROWSER_FORMSET * FormSet ;
635
+ BOOLEAN Found ;
636
+
637
+ Found = FALSE;
638
+ FormsetStorage = NULL ;
639
+
640
+ FormsetLink = GetFirstNode (& gBrowserFormSetList );
641
+ while (!IsNull (& gBrowserFormSetList , FormsetLink )) {
642
+ FormSet = FORM_BROWSER_FORMSET_FROM_LINK (FormsetLink );
643
+ FormsetLink = GetNextNode (& gBrowserFormSetList , FormsetLink );
644
+
645
+ Link = GetFirstNode (& FormSet -> StorageListHead );
646
+ while (!IsNull (& FormSet -> StorageListHead , Link )) {
647
+ FormsetStorage = FORMSET_STORAGE_FROM_LINK (Link );
648
+ Link = GetNextNode (& FormSet -> StorageListHead , Link );
649
+
650
+ if (FormsetStorage -> BrowserStorage == Storage ) {
651
+ Found = TRUE;
652
+ break ;
653
+ }
654
+ }
655
+
656
+ if (Found ) {
657
+ break ;
658
+ }
659
+ }
660
+
661
+ return Found ? FormsetStorage : NULL ;
662
+ }
663
+
585
664
/**
586
665
Initialize Request Element of a Question. <RequestElement> ::= '&'<BlockName> | '&'<Label>
587
666
@@ -651,17 +730,7 @@ InitializeRequestElement (
651
730
//
652
731
// Find Formset Storage for this Question
653
732
//
654
- FormsetStorage = NULL ;
655
- Link = GetFirstNode (& FormSet -> StorageListHead );
656
- while (!IsNull (& FormSet -> StorageListHead , Link )) {
657
- FormsetStorage = FORMSET_STORAGE_FROM_LINK (Link );
658
-
659
- if (FormsetStorage -> VarStoreId == Question -> VarStoreId ) {
660
- break ;
661
- }
662
-
663
- Link = GetNextNode (& FormSet -> StorageListHead , Link );
664
- }
733
+ FormsetStorage = GetFstStgFromVarId (FormSet , Question -> VarStoreId );
665
734
ASSERT (FormsetStorage != NULL );
666
735
667
736
//
@@ -695,7 +764,7 @@ InitializeRequestElement (
695
764
while (!IsNull (& Form -> ConfigRequestHead , Link )) {
696
765
ConfigInfo = FORM_BROWSER_CONFIG_REQUEST_FROM_LINK (Link );
697
766
698
- if (ConfigInfo != NULL && ConfigInfo -> Storage == Storage ) {
767
+ if (ConfigInfo != NULL && ConfigInfo -> Storage == FormsetStorage -> BrowserStorage ) {
699
768
Find = TRUE;
700
769
break ;
701
770
}
@@ -707,10 +776,10 @@ InitializeRequestElement (
707
776
ConfigInfo = AllocateZeroPool (sizeof (FORM_BROWSER_CONFIG_REQUEST ));
708
777
ASSERT (ConfigInfo != NULL );
709
778
ConfigInfo -> Signature = FORM_BROWSER_CONFIG_REQUEST_SIGNATURE ;
710
- ConfigInfo -> ConfigRequest = AllocateCopyPool (StrSize (Storage -> ConfigHdr ), Storage -> ConfigHdr );
779
+ ConfigInfo -> ConfigRequest = AllocateCopyPool (StrSize (FormsetStorage -> ConfigHdr ), FormsetStorage -> ConfigHdr );
711
780
ASSERT (ConfigInfo -> ConfigRequest != NULL );
712
781
ConfigInfo -> SpareStrLen = 0 ;
713
- ConfigInfo -> Storage = Storage ;
782
+ ConfigInfo -> Storage = FormsetStorage -> BrowserStorage ;
714
783
InsertTailList (& Form -> ConfigRequestHead , & ConfigInfo -> Link );
715
784
}
716
785
0 commit comments