Compare commits
	
		
			97 Commits
		
	
	
		
			edk2-stabl
			...
			bonw14-dis
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 
						 | 
					f6a483461c | ||
| 
						 | 
					1966ffb1c3 | ||
| 
						 | 
					27585e73da | ||
| 
						 | 
					42a443d5cd | ||
| 
						 | 
					c466cc2ca5 | ||
| 
						 | 
					5c49aca613 | ||
| 
						 | 
					99891bd41e | ||
| 
						 | 
					3485d55709 | ||
| 
						 | 
					c1a7127e01 | ||
| 
						 | 
					2f21eddfb8 | ||
| 
						 | 
					860c29c923 | ||
| 
						 | 
					8cfead2839 | ||
| 
						 | 
					30f6b2f3c7 | ||
| 
						 | 
					4de32568fa | ||
| 
						 | 
					ff91020528 | ||
| 
						 | 
					943773983d | ||
| 
						 | 
					e91ea5561d | ||
| 
						 | 
					5e86b202de | ||
| 
						 | 
					b764882195 | ||
| 
						 | 
					a2abc5e15f | ||
| 
						 | 
					a618e43977 | ||
| 
						 | 
					bbc04972bc | ||
| 
						 | 
					61a7f360d9 | ||
| 
						 | 
					fc1c47ccad | ||
| 
						 | 
					fec64b04eb | ||
| 
						 | 
					05aa27ef23 | ||
| 
						 | 
					06cc698885 | ||
| 
						 | 
					cb870a1ce9 | ||
| 
						 | 
					90e04a7e31 | ||
| 
						 | 
					1d01d2a9a7 | ||
| 
						 | 
					70e9b22f5c | ||
| 
						 | 
					e9d6369050 | ||
| 
						 | 
					58d6aae969 | ||
| 
						 | 
					4e0fcaba18 | ||
| 
						 | 
					2d04a62512 | ||
| 
						 | 
					8a0955dfa8 | ||
| 
						 | 
					06f4583ea5 | ||
| 
						 | 
					9daa69a59e | ||
| 
						 | 
					9030464a1b | ||
| 
						 | 
					bcfe7a54aa | ||
| 
						 | 
					600c565eb2 | ||
| 
						 | 
					aae506ce44 | ||
| 
						 | 
					bf2ca74bb6 | ||
| 
						 | 
					654e5958cd | ||
| 
						 | 
					9657bbe08f | ||
| 
						 | 
					10cbbe06d3 | ||
| 
						 | 
					802391f1fe | ||
| 
						 | 
					db04386fd9 | ||
| 
						 | 
					7d5abcd016 | ||
| 
						 | 
					d296a36cc4 | ||
| 
						 | 
					bdb15bf9ba | ||
| 
						 | 
					25af751320 | ||
| 
						 | 
					7f99fae217 | ||
| 
						 | 
					c134065066 | ||
| 
						 | 
					eec38fd383 | ||
| 
						 | 
					b9564773f1 | ||
| 
						 | 
					8c767bb014 | ||
| 
						 | 
					7386ad5ae3 | ||
| 
						 | 
					e727453a97 | ||
| 
						 | 
					553bda4d8e | ||
| 
						 | 
					3e7febc83c | ||
| 
						 | 
					b664a5352c | ||
| 
						 | 
					b376a7d60f | ||
| 
						 | 
					3fb944f925 | ||
| 
						 | 
					1d70aa7a9b | ||
| 
						 | 
					0bef9ccd43 | ||
| 
						 | 
					d3b38ea28a | ||
| 
						 | 
					69ae47ba5d | ||
| 
						 | 
					95c492569f | ||
| 
						 | 
					d996a4bc9f | ||
| 
						 | 
					9f528fb4c0 | ||
| 
						 | 
					bbab5b95b4 | ||
| 
						 | 
					5e84cc0714 | ||
| 
						 | 
					2af54dd5bd | ||
| 
						 | 
					00283317d8 | ||
| 
						 | 
					232f661f99 | ||
| 
						 | 
					552ca5cc88 | ||
| 
						 | 
					94e7cfc7e7 | ||
| 
						 | 
					de7030ed26 | ||
| 
						 | 
					587653cd8b | ||
| 
						 | 
					e167ed1a3d | ||
| 
						 | 
					003534f8f0 | ||
| 
						 | 
					a363907bc9 | ||
| 
						 | 
					530cc53f96 | ||
| 
						 | 
					112268c70d | ||
| 
						 | 
					726280b214 | ||
| 
						 | 
					b1ab82d4c8 | ||
| 
						 | 
					2e16857f3d | ||
| 
						 | 
					308f9a49b0 | ||
| 
						 | 
					7ab09015b1 | ||
| 
						 | 
					d1c0828262 | ||
| 
						 | 
					b4dd94c217 | ||
| 
						 | 
					f428f538b6 | ||
| 
						 | 
					75b91c0b9f | ||
| 
						 | 
					9f1dd0acb1 | ||
| 
						 | 
					6db1a5555a | ||
| 
						 | 
					72f8b9d80b | 
 Submodule BaseTools/Source/C/BrotliCompress/brotli updated: 666c3280cc...aa7b018dcb
									
								
							@@ -13,6 +13,14 @@ OBJECTS = DevicePath.o UefiDevicePathLib.o DevicePathFromText.o  DevicePathUtili
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
include $(MAKEROOT)/Makefiles/app.makefile
 | 
					include $(MAKEROOT)/Makefiles/app.makefile
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					GCCVERSION = $(shell gcc -dumpversion | awk -F'.' '{print $$1}')
 | 
				
			||||||
 | 
					ifneq ("$(GCCVERSION)", "5")
 | 
				
			||||||
 | 
					ifneq ($(CXX), llvm)
 | 
				
			||||||
 | 
					# gcc 12 trips over device path handling
 | 
				
			||||||
 | 
					BUILD_CFLAGS += -Wno-error=stringop-overflow
 | 
				
			||||||
 | 
					endif
 | 
				
			||||||
 | 
					endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
LIBS = -lCommon
 | 
					LIBS = -lCommon
 | 
				
			||||||
ifeq ($(CYGWIN), CYGWIN)
 | 
					ifeq ($(CYGWIN), CYGWIN)
 | 
				
			||||||
  LIBS += -L/lib/e2fsprogs -luuid
 | 
					  LIBS += -L/lib/e2fsprogs -luuid
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -542,7 +542,7 @@ GetAlignmentFromFile(char *InFile, UINT32 *Alignment)
 | 
				
			|||||||
  PeFileBuffer = (UINT8 *) malloc (PeFileSize);
 | 
					  PeFileBuffer = (UINT8 *) malloc (PeFileSize);
 | 
				
			||||||
  if (PeFileBuffer == NULL) {
 | 
					  if (PeFileBuffer == NULL) {
 | 
				
			||||||
    fclose (InFileHandle);
 | 
					    fclose (InFileHandle);
 | 
				
			||||||
    Error(NULL, 0, 4001, "Resource", "memory cannot be allocated  of %s", InFileHandle);
 | 
					    Error(NULL, 0, 4001, "Resource", "memory cannot be allocated for %s", InFile);
 | 
				
			||||||
    return EFI_OUT_OF_RESOURCES;
 | 
					    return EFI_OUT_OF_RESOURCES;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  fread (PeFileBuffer, sizeof (UINT8), PeFileSize, InFileHandle);
 | 
					  fread (PeFileBuffer, sizeof (UINT8), PeFileSize, InFileHandle);
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1062,7 +1062,7 @@ GetAlignmentFromFile(char *InFile, UINT32 *Alignment)
 | 
				
			|||||||
  PeFileBuffer = (UINT8 *) malloc (PeFileSize);
 | 
					  PeFileBuffer = (UINT8 *) malloc (PeFileSize);
 | 
				
			||||||
  if (PeFileBuffer == NULL) {
 | 
					  if (PeFileBuffer == NULL) {
 | 
				
			||||||
    fclose (InFileHandle);
 | 
					    fclose (InFileHandle);
 | 
				
			||||||
    Error(NULL, 0, 4001, "Resource", "memory cannot be allocated  of %s", InFileHandle);
 | 
					    Error(NULL, 0, 4001, "Resource", "memory cannot be allocated for %s", InFile);
 | 
				
			||||||
    return EFI_OUT_OF_RESOURCES;
 | 
					    return EFI_OUT_OF_RESOURCES;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  fread (PeFileBuffer, sizeof (UINT8), PeFileSize, InFileHandle);
 | 
					  fread (PeFileBuffer, sizeof (UINT8), PeFileSize, InFileHandle);
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -2825,12 +2825,13 @@ SRes LzmaEnc_CodeOneMemBlock(CLzmaEncHandle pp, BoolInt reInit,
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  nowPos64 = p->nowPos64;
 | 
					  nowPos64 = p->nowPos64;
 | 
				
			||||||
  RangeEnc_Init(&p->rc);
 | 
					  RangeEnc_Init(&p->rc);
 | 
				
			||||||
  p->rc.outStream = &outStream.vt;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
  if (desiredPackSize == 0)
 | 
					  if (desiredPackSize == 0)
 | 
				
			||||||
    return SZ_ERROR_OUTPUT_EOF;
 | 
					    return SZ_ERROR_OUTPUT_EOF;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  p->rc.outStream = &outStream.vt;
 | 
				
			||||||
  res = LzmaEnc_CodeOneBlock(p, desiredPackSize, *unpackSize);
 | 
					  res = LzmaEnc_CodeOneBlock(p, desiredPackSize, *unpackSize);
 | 
				
			||||||
 | 
					  p->rc.outStream = NULL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  *unpackSize = (UInt32)(p->nowPos64 - nowPos64);
 | 
					  *unpackSize = (UInt32)(p->nowPos64 - nowPos64);
 | 
				
			||||||
  *destLen -= outStream.rem;
 | 
					  *destLen -= outStream.rem;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -152,11 +152,11 @@ class CompressedImage(Image):
 | 
				
			|||||||
        try:
 | 
					        try:
 | 
				
			||||||
            TmpData = DeCompress('Efi', self[self._HEADER_SIZE_:])
 | 
					            TmpData = DeCompress('Efi', self[self._HEADER_SIZE_:])
 | 
				
			||||||
            DecData = array('B')
 | 
					            DecData = array('B')
 | 
				
			||||||
            DecData.fromstring(TmpData)
 | 
					            DecData.frombytes(TmpData)
 | 
				
			||||||
        except:
 | 
					        except:
 | 
				
			||||||
            TmpData = DeCompress('Framework', self[self._HEADER_SIZE_:])
 | 
					            TmpData = DeCompress('Framework', self[self._HEADER_SIZE_:])
 | 
				
			||||||
            DecData = array('B')
 | 
					            DecData = array('B')
 | 
				
			||||||
            DecData.fromstring(TmpData)
 | 
					            DecData.frombytes(TmpData)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        SectionList = []
 | 
					        SectionList = []
 | 
				
			||||||
        Offset = 0
 | 
					        Offset = 0
 | 
				
			||||||
@@ -196,7 +196,7 @@ class Ui(Image):
 | 
				
			|||||||
        return len(self)
 | 
					        return len(self)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def _GetUiString(self):
 | 
					    def _GetUiString(self):
 | 
				
			||||||
        return codecs.utf_16_decode(self[0:-2].tostring())[0]
 | 
					        return codecs.utf_16_decode(self[0:-2].tobytes())[0]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    String = property(_GetUiString)
 | 
					    String = property(_GetUiString)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -738,7 +738,7 @@ class GuidDefinedImage(Image):
 | 
				
			|||||||
                Offset = self.DataOffset - 4
 | 
					                Offset = self.DataOffset - 4
 | 
				
			||||||
                TmpData = DeCompress('Framework', self[self.Offset:])
 | 
					                TmpData = DeCompress('Framework', self[self.Offset:])
 | 
				
			||||||
                DecData = array('B')
 | 
					                DecData = array('B')
 | 
				
			||||||
                DecData.fromstring(TmpData)
 | 
					                DecData.frombytes(TmpData)
 | 
				
			||||||
                Offset = 0
 | 
					                Offset = 0
 | 
				
			||||||
                while Offset < len(DecData):
 | 
					                while Offset < len(DecData):
 | 
				
			||||||
                    Sec = Section()
 | 
					                    Sec = Section()
 | 
				
			||||||
@@ -759,7 +759,7 @@ class GuidDefinedImage(Image):
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
                TmpData = DeCompress('Lzma', self[self.Offset:])
 | 
					                TmpData = DeCompress('Lzma', self[self.Offset:])
 | 
				
			||||||
                DecData = array('B')
 | 
					                DecData = array('B')
 | 
				
			||||||
                DecData.fromstring(TmpData)
 | 
					                DecData.frombytes(TmpData)
 | 
				
			||||||
                Offset = 0
 | 
					                Offset = 0
 | 
				
			||||||
                while Offset < len(DecData):
 | 
					                while Offset < len(DecData):
 | 
				
			||||||
                    Sec = Section()
 | 
					                    Sec = Section()
 | 
				
			||||||
 
 | 
				
			|||||||
 Submodule CryptoPkg/Library/OpensslLib/openssl updated: 52c587d60b...e2e09d9fba
									
								
							
							
								
								
									
										47
									
								
								FSDrivers/IA32/LICENSE.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										47
									
								
								FSDrivers/IA32/LICENSE.txt
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,47 @@
 | 
				
			|||||||
 | 
					Licensing for the filesystem drivers is complex. Three different licenses
 | 
				
			||||||
 | 
					apply to various parts of the code:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					* Christoph Pfisterer's original file system wrapper (FSW) code is covered
 | 
				
			||||||
 | 
					  by a BSD-style license. Many of the source files with names that take the
 | 
				
			||||||
 | 
					  form fsw_*.[ch] are so licensed, but this is NOT generally true of
 | 
				
			||||||
 | 
					  filesystem-specific files (e.g., fsw_ext2.c or fsw_btrfs.c).
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					* Certain filesystem drivers are licensed under the GPLv2, either because
 | 
				
			||||||
 | 
					  they borrow code from the Linux kernel or because a developer (typically
 | 
				
			||||||
 | 
					  Oracle) applied the GPLv2 license to them. This is true of the ext2fs,
 | 
				
			||||||
 | 
					  ext4fs, ReiserFS, HFS+, and ISO-9660 drivers.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					* At least one filesystem driver (Btrfs) uses code taken from GRUB, and so
 | 
				
			||||||
 | 
					  uses the GPLv3 (or later) license.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Note that the GPLv2 and GPLv3 are, ironically, not compatible licenses.
 | 
				
			||||||
 | 
					Thus, code from GPLv2 and GPLv3 projects should not be mixed. The BSD
 | 
				
			||||||
 | 
					license used by Pfisterer's original code is compatible with both versions
 | 
				
			||||||
 | 
					of the GPL, so the fact that both GPLv2 and GPLv3 drivers is built upon it
 | 
				
			||||||
 | 
					is OK. If you intend to contribute to this project's drivers or use the
 | 
				
			||||||
 | 
					code yourself, please keep this fact in mind.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					The below was written by Christoph Pfisterer with respect to his original
 | 
				
			||||||
 | 
					code:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 File System Wrapper License
 | 
				
			||||||
 | 
					=============================
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					The various parts of the File System Wrapper source code come from
 | 
				
			||||||
 | 
					different sources and may carry different licenses. Here's a quick
 | 
				
			||||||
 | 
					account of the situation:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 * The core code was written from scratch and is covered by a
 | 
				
			||||||
 | 
					   BSD-style license.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 * The EFI host driver was written from scratch, possibly using code
 | 
				
			||||||
 | 
					   from the TianoCore project and Intel's EFI Application Toolkit. It
 | 
				
			||||||
 | 
					   is covered by a BSD-style license.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 * The ext2 and reiserfs file system drivers use definitions from the
 | 
				
			||||||
 | 
					   Linux kernel source. The actual code was written from scratch,
 | 
				
			||||||
 | 
					   using multiple sources for reference. These drivers are covered by
 | 
				
			||||||
 | 
					   the GNU GPL.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					For more details, see each file's boilerplate comment. The full text
 | 
				
			||||||
 | 
					of the GNU GPL is in the file LICENSE_GPL.txt.
 | 
				
			||||||
							
								
								
									
										340
									
								
								FSDrivers/IA32/LICENSE_GPL.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										340
									
								
								FSDrivers/IA32/LICENSE_GPL.txt
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,340 @@
 | 
				
			|||||||
 | 
							    GNU GENERAL PUBLIC LICENSE
 | 
				
			||||||
 | 
							       Version 2, June 1991
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 Copyright (C) 1989, 1991 Free Software Foundation, Inc.
 | 
				
			||||||
 | 
					     59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 | 
				
			||||||
 | 
					 Everyone is permitted to copy and distribute verbatim copies
 | 
				
			||||||
 | 
					 of this license document, but changing it is not allowed.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								    Preamble
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  The licenses for most software are designed to take away your
 | 
				
			||||||
 | 
					freedom to share and change it.  By contrast, the GNU General Public
 | 
				
			||||||
 | 
					License is intended to guarantee your freedom to share and change free
 | 
				
			||||||
 | 
					software--to make sure the software is free for all its users.  This
 | 
				
			||||||
 | 
					General Public License applies to most of the Free Software
 | 
				
			||||||
 | 
					Foundation's software and to any other program whose authors commit to
 | 
				
			||||||
 | 
					using it.  (Some other Free Software Foundation software is covered by
 | 
				
			||||||
 | 
					the GNU Library General Public License instead.)  You can apply it to
 | 
				
			||||||
 | 
					your programs, too.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  When we speak of free software, we are referring to freedom, not
 | 
				
			||||||
 | 
					price.  Our General Public Licenses are designed to make sure that you
 | 
				
			||||||
 | 
					have the freedom to distribute copies of free software (and charge for
 | 
				
			||||||
 | 
					this service if you wish), that you receive source code or can get it
 | 
				
			||||||
 | 
					if you want it, that you can change the software or use pieces of it
 | 
				
			||||||
 | 
					in new free programs; and that you know you can do these things.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  To protect your rights, we need to make restrictions that forbid
 | 
				
			||||||
 | 
					anyone to deny you these rights or to ask you to surrender the rights.
 | 
				
			||||||
 | 
					These restrictions translate to certain responsibilities for you if you
 | 
				
			||||||
 | 
					distribute copies of the software, or if you modify it.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  For example, if you distribute copies of such a program, whether
 | 
				
			||||||
 | 
					gratis or for a fee, you must give the recipients all the rights that
 | 
				
			||||||
 | 
					you have.  You must make sure that they, too, receive or can get the
 | 
				
			||||||
 | 
					source code.  And you must show them these terms so they know their
 | 
				
			||||||
 | 
					rights.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  We protect your rights with two steps: (1) copyright the software, and
 | 
				
			||||||
 | 
					(2) offer you this license which gives you legal permission to copy,
 | 
				
			||||||
 | 
					distribute and/or modify the software.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  Also, for each author's protection and ours, we want to make certain
 | 
				
			||||||
 | 
					that everyone understands that there is no warranty for this free
 | 
				
			||||||
 | 
					software.  If the software is modified by someone else and passed on, we
 | 
				
			||||||
 | 
					want its recipients to know that what they have is not the original, so
 | 
				
			||||||
 | 
					that any problems introduced by others will not reflect on the original
 | 
				
			||||||
 | 
					authors' reputations.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  Finally, any free program is threatened constantly by software
 | 
				
			||||||
 | 
					patents.  We wish to avoid the danger that redistributors of a free
 | 
				
			||||||
 | 
					program will individually obtain patent licenses, in effect making the
 | 
				
			||||||
 | 
					program proprietary.  To prevent this, we have made it clear that any
 | 
				
			||||||
 | 
					patent must be licensed for everyone's free use or not licensed at all.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  The precise terms and conditions for copying, distribution and
 | 
				
			||||||
 | 
					modification follow.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							    GNU GENERAL PUBLIC LICENSE
 | 
				
			||||||
 | 
					   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  0. This License applies to any program or other work which contains
 | 
				
			||||||
 | 
					a notice placed by the copyright holder saying it may be distributed
 | 
				
			||||||
 | 
					under the terms of this General Public License.  The "Program", below,
 | 
				
			||||||
 | 
					refers to any such program or work, and a "work based on the Program"
 | 
				
			||||||
 | 
					means either the Program or any derivative work under copyright law:
 | 
				
			||||||
 | 
					that is to say, a work containing the Program or a portion of it,
 | 
				
			||||||
 | 
					either verbatim or with modifications and/or translated into another
 | 
				
			||||||
 | 
					language.  (Hereinafter, translation is included without limitation in
 | 
				
			||||||
 | 
					the term "modification".)  Each licensee is addressed as "you".
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Activities other than copying, distribution and modification are not
 | 
				
			||||||
 | 
					covered by this License; they are outside its scope.  The act of
 | 
				
			||||||
 | 
					running the Program is not restricted, and the output from the Program
 | 
				
			||||||
 | 
					is covered only if its contents constitute a work based on the
 | 
				
			||||||
 | 
					Program (independent of having been made by running the Program).
 | 
				
			||||||
 | 
					Whether that is true depends on what the Program does.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  1. You may copy and distribute verbatim copies of the Program's
 | 
				
			||||||
 | 
					source code as you receive it, in any medium, provided that you
 | 
				
			||||||
 | 
					conspicuously and appropriately publish on each copy an appropriate
 | 
				
			||||||
 | 
					copyright notice and disclaimer of warranty; keep intact all the
 | 
				
			||||||
 | 
					notices that refer to this License and to the absence of any warranty;
 | 
				
			||||||
 | 
					and give any other recipients of the Program a copy of this License
 | 
				
			||||||
 | 
					along with the Program.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					You may charge a fee for the physical act of transferring a copy, and
 | 
				
			||||||
 | 
					you may at your option offer warranty protection in exchange for a fee.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  2. You may modify your copy or copies of the Program or any portion
 | 
				
			||||||
 | 
					of it, thus forming a work based on the Program, and copy and
 | 
				
			||||||
 | 
					distribute such modifications or work under the terms of Section 1
 | 
				
			||||||
 | 
					above, provided that you also meet all of these conditions:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    a) You must cause the modified files to carry prominent notices
 | 
				
			||||||
 | 
					    stating that you changed the files and the date of any change.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    b) You must cause any work that you distribute or publish, that in
 | 
				
			||||||
 | 
					    whole or in part contains or is derived from the Program or any
 | 
				
			||||||
 | 
					    part thereof, to be licensed as a whole at no charge to all third
 | 
				
			||||||
 | 
					    parties under the terms of this License.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    c) If the modified program normally reads commands interactively
 | 
				
			||||||
 | 
					    when run, you must cause it, when started running for such
 | 
				
			||||||
 | 
					    interactive use in the most ordinary way, to print or display an
 | 
				
			||||||
 | 
					    announcement including an appropriate copyright notice and a
 | 
				
			||||||
 | 
					    notice that there is no warranty (or else, saying that you provide
 | 
				
			||||||
 | 
					    a warranty) and that users may redistribute the program under
 | 
				
			||||||
 | 
					    these conditions, and telling the user how to view a copy of this
 | 
				
			||||||
 | 
					    License.  (Exception: if the Program itself is interactive but
 | 
				
			||||||
 | 
					    does not normally print such an announcement, your work based on
 | 
				
			||||||
 | 
					    the Program is not required to print an announcement.)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					These requirements apply to the modified work as a whole.  If
 | 
				
			||||||
 | 
					identifiable sections of that work are not derived from the Program,
 | 
				
			||||||
 | 
					and can be reasonably considered independent and separate works in
 | 
				
			||||||
 | 
					themselves, then this License, and its terms, do not apply to those
 | 
				
			||||||
 | 
					sections when you distribute them as separate works.  But when you
 | 
				
			||||||
 | 
					distribute the same sections as part of a whole which is a work based
 | 
				
			||||||
 | 
					on the Program, the distribution of the whole must be on the terms of
 | 
				
			||||||
 | 
					this License, whose permissions for other licensees extend to the
 | 
				
			||||||
 | 
					entire whole, and thus to each and every part regardless of who wrote it.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Thus, it is not the intent of this section to claim rights or contest
 | 
				
			||||||
 | 
					your rights to work written entirely by you; rather, the intent is to
 | 
				
			||||||
 | 
					exercise the right to control the distribution of derivative or
 | 
				
			||||||
 | 
					collective works based on the Program.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					In addition, mere aggregation of another work not based on the Program
 | 
				
			||||||
 | 
					with the Program (or with a work based on the Program) on a volume of
 | 
				
			||||||
 | 
					a storage or distribution medium does not bring the other work under
 | 
				
			||||||
 | 
					the scope of this License.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  3. You may copy and distribute the Program (or a work based on it,
 | 
				
			||||||
 | 
					under Section 2) in object code or executable form under the terms of
 | 
				
			||||||
 | 
					Sections 1 and 2 above provided that you also do one of the following:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    a) Accompany it with the complete corresponding machine-readable
 | 
				
			||||||
 | 
					    source code, which must be distributed under the terms of Sections
 | 
				
			||||||
 | 
					    1 and 2 above on a medium customarily used for software interchange; or,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    b) Accompany it with a written offer, valid for at least three
 | 
				
			||||||
 | 
					    years, to give any third party, for a charge no more than your
 | 
				
			||||||
 | 
					    cost of physically performing source distribution, a complete
 | 
				
			||||||
 | 
					    machine-readable copy of the corresponding source code, to be
 | 
				
			||||||
 | 
					    distributed under the terms of Sections 1 and 2 above on a medium
 | 
				
			||||||
 | 
					    customarily used for software interchange; or,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    c) Accompany it with the information you received as to the offer
 | 
				
			||||||
 | 
					    to distribute corresponding source code.  (This alternative is
 | 
				
			||||||
 | 
					    allowed only for noncommercial distribution and only if you
 | 
				
			||||||
 | 
					    received the program in object code or executable form with such
 | 
				
			||||||
 | 
					    an offer, in accord with Subsection b above.)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					The source code for a work means the preferred form of the work for
 | 
				
			||||||
 | 
					making modifications to it.  For an executable work, complete source
 | 
				
			||||||
 | 
					code means all the source code for all modules it contains, plus any
 | 
				
			||||||
 | 
					associated interface definition files, plus the scripts used to
 | 
				
			||||||
 | 
					control compilation and installation of the executable.  However, as a
 | 
				
			||||||
 | 
					special exception, the source code distributed need not include
 | 
				
			||||||
 | 
					anything that is normally distributed (in either source or binary
 | 
				
			||||||
 | 
					form) with the major components (compiler, kernel, and so on) of the
 | 
				
			||||||
 | 
					operating system on which the executable runs, unless that component
 | 
				
			||||||
 | 
					itself accompanies the executable.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					If distribution of executable or object code is made by offering
 | 
				
			||||||
 | 
					access to copy from a designated place, then offering equivalent
 | 
				
			||||||
 | 
					access to copy the source code from the same place counts as
 | 
				
			||||||
 | 
					distribution of the source code, even though third parties are not
 | 
				
			||||||
 | 
					compelled to copy the source along with the object code.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  4. You may not copy, modify, sublicense, or distribute the Program
 | 
				
			||||||
 | 
					except as expressly provided under this License.  Any attempt
 | 
				
			||||||
 | 
					otherwise to copy, modify, sublicense or distribute the Program is
 | 
				
			||||||
 | 
					void, and will automatically terminate your rights under this License.
 | 
				
			||||||
 | 
					However, parties who have received copies, or rights, from you under
 | 
				
			||||||
 | 
					this License will not have their licenses terminated so long as such
 | 
				
			||||||
 | 
					parties remain in full compliance.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  5. You are not required to accept this License, since you have not
 | 
				
			||||||
 | 
					signed it.  However, nothing else grants you permission to modify or
 | 
				
			||||||
 | 
					distribute the Program or its derivative works.  These actions are
 | 
				
			||||||
 | 
					prohibited by law if you do not accept this License.  Therefore, by
 | 
				
			||||||
 | 
					modifying or distributing the Program (or any work based on the
 | 
				
			||||||
 | 
					Program), you indicate your acceptance of this License to do so, and
 | 
				
			||||||
 | 
					all its terms and conditions for copying, distributing or modifying
 | 
				
			||||||
 | 
					the Program or works based on it.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  6. Each time you redistribute the Program (or any work based on the
 | 
				
			||||||
 | 
					Program), the recipient automatically receives a license from the
 | 
				
			||||||
 | 
					original licensor to copy, distribute or modify the Program subject to
 | 
				
			||||||
 | 
					these terms and conditions.  You may not impose any further
 | 
				
			||||||
 | 
					restrictions on the recipients' exercise of the rights granted herein.
 | 
				
			||||||
 | 
					You are not responsible for enforcing compliance by third parties to
 | 
				
			||||||
 | 
					this License.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  7. If, as a consequence of a court judgment or allegation of patent
 | 
				
			||||||
 | 
					infringement or for any other reason (not limited to patent issues),
 | 
				
			||||||
 | 
					conditions are imposed on you (whether by court order, agreement or
 | 
				
			||||||
 | 
					otherwise) that contradict the conditions of this License, they do not
 | 
				
			||||||
 | 
					excuse you from the conditions of this License.  If you cannot
 | 
				
			||||||
 | 
					distribute so as to satisfy simultaneously your obligations under this
 | 
				
			||||||
 | 
					License and any other pertinent obligations, then as a consequence you
 | 
				
			||||||
 | 
					may not distribute the Program at all.  For example, if a patent
 | 
				
			||||||
 | 
					license would not permit royalty-free redistribution of the Program by
 | 
				
			||||||
 | 
					all those who receive copies directly or indirectly through you, then
 | 
				
			||||||
 | 
					the only way you could satisfy both it and this License would be to
 | 
				
			||||||
 | 
					refrain entirely from distribution of the Program.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					If any portion of this section is held invalid or unenforceable under
 | 
				
			||||||
 | 
					any particular circumstance, the balance of the section is intended to
 | 
				
			||||||
 | 
					apply and the section as a whole is intended to apply in other
 | 
				
			||||||
 | 
					circumstances.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					It is not the purpose of this section to induce you to infringe any
 | 
				
			||||||
 | 
					patents or other property right claims or to contest validity of any
 | 
				
			||||||
 | 
					such claims; this section has the sole purpose of protecting the
 | 
				
			||||||
 | 
					integrity of the free software distribution system, which is
 | 
				
			||||||
 | 
					implemented by public license practices.  Many people have made
 | 
				
			||||||
 | 
					generous contributions to the wide range of software distributed
 | 
				
			||||||
 | 
					through that system in reliance on consistent application of that
 | 
				
			||||||
 | 
					system; it is up to the author/donor to decide if he or she is willing
 | 
				
			||||||
 | 
					to distribute software through any other system and a licensee cannot
 | 
				
			||||||
 | 
					impose that choice.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					This section is intended to make thoroughly clear what is believed to
 | 
				
			||||||
 | 
					be a consequence of the rest of this License.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  8. If the distribution and/or use of the Program is restricted in
 | 
				
			||||||
 | 
					certain countries either by patents or by copyrighted interfaces, the
 | 
				
			||||||
 | 
					original copyright holder who places the Program under this License
 | 
				
			||||||
 | 
					may add an explicit geographical distribution limitation excluding
 | 
				
			||||||
 | 
					those countries, so that distribution is permitted only in or among
 | 
				
			||||||
 | 
					countries not thus excluded.  In such case, this License incorporates
 | 
				
			||||||
 | 
					the limitation as if written in the body of this License.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  9. The Free Software Foundation may publish revised and/or new versions
 | 
				
			||||||
 | 
					of the General Public License from time to time.  Such new versions will
 | 
				
			||||||
 | 
					be similar in spirit to the present version, but may differ in detail to
 | 
				
			||||||
 | 
					address new problems or concerns.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Each version is given a distinguishing version number.  If the Program
 | 
				
			||||||
 | 
					specifies a version number of this License which applies to it and "any
 | 
				
			||||||
 | 
					later version", you have the option of following the terms and conditions
 | 
				
			||||||
 | 
					either of that version or of any later version published by the Free
 | 
				
			||||||
 | 
					Software Foundation.  If the Program does not specify a version number of
 | 
				
			||||||
 | 
					this License, you may choose any version ever published by the Free Software
 | 
				
			||||||
 | 
					Foundation.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  10. If you wish to incorporate parts of the Program into other free
 | 
				
			||||||
 | 
					programs whose distribution conditions are different, write to the author
 | 
				
			||||||
 | 
					to ask for permission.  For software which is copyrighted by the Free
 | 
				
			||||||
 | 
					Software Foundation, write to the Free Software Foundation; we sometimes
 | 
				
			||||||
 | 
					make exceptions for this.  Our decision will be guided by the two goals
 | 
				
			||||||
 | 
					of preserving the free status of all derivatives of our free software and
 | 
				
			||||||
 | 
					of promoting the sharing and reuse of software generally.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								    NO WARRANTY
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
 | 
				
			||||||
 | 
					FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN
 | 
				
			||||||
 | 
					OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
 | 
				
			||||||
 | 
					PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
 | 
				
			||||||
 | 
					OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
 | 
				
			||||||
 | 
					MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS
 | 
				
			||||||
 | 
					TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE
 | 
				
			||||||
 | 
					PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
 | 
				
			||||||
 | 
					REPAIR OR CORRECTION.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
 | 
				
			||||||
 | 
					WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
 | 
				
			||||||
 | 
					REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
 | 
				
			||||||
 | 
					INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
 | 
				
			||||||
 | 
					OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
 | 
				
			||||||
 | 
					TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
 | 
				
			||||||
 | 
					YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
 | 
				
			||||||
 | 
					PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
 | 
				
			||||||
 | 
					POSSIBILITY OF SUCH DAMAGES.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							     END OF TERMS AND CONDITIONS
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						    How to Apply These Terms to Your New Programs
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  If you develop a new program, and you want it to be of the greatest
 | 
				
			||||||
 | 
					possible use to the public, the best way to achieve this is to make it
 | 
				
			||||||
 | 
					free software which everyone can redistribute and change under these terms.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  To do so, attach the following notices to the program.  It is safest
 | 
				
			||||||
 | 
					to attach them to the start of each source file to most effectively
 | 
				
			||||||
 | 
					convey the exclusion of warranty; and each file should have at least
 | 
				
			||||||
 | 
					the "copyright" line and a pointer to where the full notice is found.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    <one line to give the program's name and a brief idea of what it does.>
 | 
				
			||||||
 | 
					    Copyright (C) <year>  <name of author>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    This program is free software; you can redistribute it and/or modify
 | 
				
			||||||
 | 
					    it under the terms of the GNU General Public License as published by
 | 
				
			||||||
 | 
					    the Free Software Foundation; either version 2 of the License, or
 | 
				
			||||||
 | 
					    (at your option) any later version.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    This program is distributed in the hope that it will be useful,
 | 
				
			||||||
 | 
					    but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
				
			||||||
 | 
					    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 | 
				
			||||||
 | 
					    GNU General Public License for more details.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    You should have received a copy of the GNU General Public License
 | 
				
			||||||
 | 
					    along with this program; if not, write to the Free Software
 | 
				
			||||||
 | 
					    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Also add information on how to contact you by electronic and paper mail.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					If the program is interactive, make it output a short notice like this
 | 
				
			||||||
 | 
					when it starts in an interactive mode:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    Gnomovision version 69, Copyright (C) year  name of author
 | 
				
			||||||
 | 
					    Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
 | 
				
			||||||
 | 
					    This is free software, and you are welcome to redistribute it
 | 
				
			||||||
 | 
					    under certain conditions; type `show c' for details.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					The hypothetical commands `show w' and `show c' should show the appropriate
 | 
				
			||||||
 | 
					parts of the General Public License.  Of course, the commands you use may
 | 
				
			||||||
 | 
					be called something other than `show w' and `show c'; they could even be
 | 
				
			||||||
 | 
					mouse-clicks or menu items--whatever suits your program.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					You should also get your employer (if you work as a programmer) or your
 | 
				
			||||||
 | 
					school, if any, to sign a "copyright disclaimer" for the program, if
 | 
				
			||||||
 | 
					necessary.  Here is a sample; alter the names:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  Yoyodyne, Inc., hereby disclaims all copyright interest in the program
 | 
				
			||||||
 | 
					  `Gnomovision' (which makes passes at compilers) written by James Hacker.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  <signature of Ty Coon>, 1 April 1989
 | 
				
			||||||
 | 
					  Ty Coon, President of Vice
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					This General Public License does not permit incorporating your program into
 | 
				
			||||||
 | 
					proprietary programs.  If your program is a subroutine library, you may
 | 
				
			||||||
 | 
					consider it more useful to permit linking proprietary applications with the
 | 
				
			||||||
 | 
					library.  If this is what you want to do, use the GNU Library General
 | 
				
			||||||
 | 
					Public License instead of this License.
 | 
				
			||||||
							
								
								
									
										
											BIN
										
									
								
								FSDrivers/IA32/exfat_ia32.efi
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								FSDrivers/IA32/exfat_ia32.efi
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								FSDrivers/IA32/ext2_ia32.efi
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								FSDrivers/IA32/ext2_ia32.efi
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								FSDrivers/IA32/ext4_ia32.efi
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								FSDrivers/IA32/ext4_ia32.efi
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								FSDrivers/IA32/ntfs_ia32.efi
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								FSDrivers/IA32/ntfs_ia32.efi
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										47
									
								
								FSDrivers/X64/LICENSE.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										47
									
								
								FSDrivers/X64/LICENSE.txt
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,47 @@
 | 
				
			|||||||
 | 
					Licensing for the filesystem drivers is complex. Three different licenses
 | 
				
			||||||
 | 
					apply to various parts of the code:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					* Christoph Pfisterer's original file system wrapper (FSW) code is covered
 | 
				
			||||||
 | 
					  by a BSD-style license. Many of the source files with names that take the
 | 
				
			||||||
 | 
					  form fsw_*.[ch] are so licensed, but this is NOT generally true of
 | 
				
			||||||
 | 
					  filesystem-specific files (e.g., fsw_ext2.c or fsw_btrfs.c).
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					* Certain filesystem drivers are licensed under the GPLv2, either because
 | 
				
			||||||
 | 
					  they borrow code from the Linux kernel or because a developer (typically
 | 
				
			||||||
 | 
					  Oracle) applied the GPLv2 license to them. This is true of the ext2fs,
 | 
				
			||||||
 | 
					  ext4fs, ReiserFS, HFS+, and ISO-9660 drivers.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					* At least one filesystem driver (Btrfs) uses code taken from GRUB, and so
 | 
				
			||||||
 | 
					  uses the GPLv3 (or later) license.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Note that the GPLv2 and GPLv3 are, ironically, not compatible licenses.
 | 
				
			||||||
 | 
					Thus, code from GPLv2 and GPLv3 projects should not be mixed. The BSD
 | 
				
			||||||
 | 
					license used by Pfisterer's original code is compatible with both versions
 | 
				
			||||||
 | 
					of the GPL, so the fact that both GPLv2 and GPLv3 drivers is built upon it
 | 
				
			||||||
 | 
					is OK. If you intend to contribute to this project's drivers or use the
 | 
				
			||||||
 | 
					code yourself, please keep this fact in mind.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					The below was written by Christoph Pfisterer with respect to his original
 | 
				
			||||||
 | 
					code:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 File System Wrapper License
 | 
				
			||||||
 | 
					=============================
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					The various parts of the File System Wrapper source code come from
 | 
				
			||||||
 | 
					different sources and may carry different licenses. Here's a quick
 | 
				
			||||||
 | 
					account of the situation:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 * The core code was written from scratch and is covered by a
 | 
				
			||||||
 | 
					   BSD-style license.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 * The EFI host driver was written from scratch, possibly using code
 | 
				
			||||||
 | 
					   from the TianoCore project and Intel's EFI Application Toolkit. It
 | 
				
			||||||
 | 
					   is covered by a BSD-style license.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 * The ext2 and reiserfs file system drivers use definitions from the
 | 
				
			||||||
 | 
					   Linux kernel source. The actual code was written from scratch,
 | 
				
			||||||
 | 
					   using multiple sources for reference. These drivers are covered by
 | 
				
			||||||
 | 
					   the GNU GPL.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					For more details, see each file's boilerplate comment. The full text
 | 
				
			||||||
 | 
					of the GNU GPL is in the file LICENSE_GPL.txt.
 | 
				
			||||||
							
								
								
									
										340
									
								
								FSDrivers/X64/LICENSE_GPL.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										340
									
								
								FSDrivers/X64/LICENSE_GPL.txt
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,340 @@
 | 
				
			|||||||
 | 
							    GNU GENERAL PUBLIC LICENSE
 | 
				
			||||||
 | 
							       Version 2, June 1991
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 Copyright (C) 1989, 1991 Free Software Foundation, Inc.
 | 
				
			||||||
 | 
					     59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 | 
				
			||||||
 | 
					 Everyone is permitted to copy and distribute verbatim copies
 | 
				
			||||||
 | 
					 of this license document, but changing it is not allowed.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								    Preamble
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  The licenses for most software are designed to take away your
 | 
				
			||||||
 | 
					freedom to share and change it.  By contrast, the GNU General Public
 | 
				
			||||||
 | 
					License is intended to guarantee your freedom to share and change free
 | 
				
			||||||
 | 
					software--to make sure the software is free for all its users.  This
 | 
				
			||||||
 | 
					General Public License applies to most of the Free Software
 | 
				
			||||||
 | 
					Foundation's software and to any other program whose authors commit to
 | 
				
			||||||
 | 
					using it.  (Some other Free Software Foundation software is covered by
 | 
				
			||||||
 | 
					the GNU Library General Public License instead.)  You can apply it to
 | 
				
			||||||
 | 
					your programs, too.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  When we speak of free software, we are referring to freedom, not
 | 
				
			||||||
 | 
					price.  Our General Public Licenses are designed to make sure that you
 | 
				
			||||||
 | 
					have the freedom to distribute copies of free software (and charge for
 | 
				
			||||||
 | 
					this service if you wish), that you receive source code or can get it
 | 
				
			||||||
 | 
					if you want it, that you can change the software or use pieces of it
 | 
				
			||||||
 | 
					in new free programs; and that you know you can do these things.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  To protect your rights, we need to make restrictions that forbid
 | 
				
			||||||
 | 
					anyone to deny you these rights or to ask you to surrender the rights.
 | 
				
			||||||
 | 
					These restrictions translate to certain responsibilities for you if you
 | 
				
			||||||
 | 
					distribute copies of the software, or if you modify it.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  For example, if you distribute copies of such a program, whether
 | 
				
			||||||
 | 
					gratis or for a fee, you must give the recipients all the rights that
 | 
				
			||||||
 | 
					you have.  You must make sure that they, too, receive or can get the
 | 
				
			||||||
 | 
					source code.  And you must show them these terms so they know their
 | 
				
			||||||
 | 
					rights.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  We protect your rights with two steps: (1) copyright the software, and
 | 
				
			||||||
 | 
					(2) offer you this license which gives you legal permission to copy,
 | 
				
			||||||
 | 
					distribute and/or modify the software.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  Also, for each author's protection and ours, we want to make certain
 | 
				
			||||||
 | 
					that everyone understands that there is no warranty for this free
 | 
				
			||||||
 | 
					software.  If the software is modified by someone else and passed on, we
 | 
				
			||||||
 | 
					want its recipients to know that what they have is not the original, so
 | 
				
			||||||
 | 
					that any problems introduced by others will not reflect on the original
 | 
				
			||||||
 | 
					authors' reputations.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  Finally, any free program is threatened constantly by software
 | 
				
			||||||
 | 
					patents.  We wish to avoid the danger that redistributors of a free
 | 
				
			||||||
 | 
					program will individually obtain patent licenses, in effect making the
 | 
				
			||||||
 | 
					program proprietary.  To prevent this, we have made it clear that any
 | 
				
			||||||
 | 
					patent must be licensed for everyone's free use or not licensed at all.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  The precise terms and conditions for copying, distribution and
 | 
				
			||||||
 | 
					modification follow.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							    GNU GENERAL PUBLIC LICENSE
 | 
				
			||||||
 | 
					   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  0. This License applies to any program or other work which contains
 | 
				
			||||||
 | 
					a notice placed by the copyright holder saying it may be distributed
 | 
				
			||||||
 | 
					under the terms of this General Public License.  The "Program", below,
 | 
				
			||||||
 | 
					refers to any such program or work, and a "work based on the Program"
 | 
				
			||||||
 | 
					means either the Program or any derivative work under copyright law:
 | 
				
			||||||
 | 
					that is to say, a work containing the Program or a portion of it,
 | 
				
			||||||
 | 
					either verbatim or with modifications and/or translated into another
 | 
				
			||||||
 | 
					language.  (Hereinafter, translation is included without limitation in
 | 
				
			||||||
 | 
					the term "modification".)  Each licensee is addressed as "you".
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Activities other than copying, distribution and modification are not
 | 
				
			||||||
 | 
					covered by this License; they are outside its scope.  The act of
 | 
				
			||||||
 | 
					running the Program is not restricted, and the output from the Program
 | 
				
			||||||
 | 
					is covered only if its contents constitute a work based on the
 | 
				
			||||||
 | 
					Program (independent of having been made by running the Program).
 | 
				
			||||||
 | 
					Whether that is true depends on what the Program does.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  1. You may copy and distribute verbatim copies of the Program's
 | 
				
			||||||
 | 
					source code as you receive it, in any medium, provided that you
 | 
				
			||||||
 | 
					conspicuously and appropriately publish on each copy an appropriate
 | 
				
			||||||
 | 
					copyright notice and disclaimer of warranty; keep intact all the
 | 
				
			||||||
 | 
					notices that refer to this License and to the absence of any warranty;
 | 
				
			||||||
 | 
					and give any other recipients of the Program a copy of this License
 | 
				
			||||||
 | 
					along with the Program.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					You may charge a fee for the physical act of transferring a copy, and
 | 
				
			||||||
 | 
					you may at your option offer warranty protection in exchange for a fee.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  2. You may modify your copy or copies of the Program or any portion
 | 
				
			||||||
 | 
					of it, thus forming a work based on the Program, and copy and
 | 
				
			||||||
 | 
					distribute such modifications or work under the terms of Section 1
 | 
				
			||||||
 | 
					above, provided that you also meet all of these conditions:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    a) You must cause the modified files to carry prominent notices
 | 
				
			||||||
 | 
					    stating that you changed the files and the date of any change.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    b) You must cause any work that you distribute or publish, that in
 | 
				
			||||||
 | 
					    whole or in part contains or is derived from the Program or any
 | 
				
			||||||
 | 
					    part thereof, to be licensed as a whole at no charge to all third
 | 
				
			||||||
 | 
					    parties under the terms of this License.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    c) If the modified program normally reads commands interactively
 | 
				
			||||||
 | 
					    when run, you must cause it, when started running for such
 | 
				
			||||||
 | 
					    interactive use in the most ordinary way, to print or display an
 | 
				
			||||||
 | 
					    announcement including an appropriate copyright notice and a
 | 
				
			||||||
 | 
					    notice that there is no warranty (or else, saying that you provide
 | 
				
			||||||
 | 
					    a warranty) and that users may redistribute the program under
 | 
				
			||||||
 | 
					    these conditions, and telling the user how to view a copy of this
 | 
				
			||||||
 | 
					    License.  (Exception: if the Program itself is interactive but
 | 
				
			||||||
 | 
					    does not normally print such an announcement, your work based on
 | 
				
			||||||
 | 
					    the Program is not required to print an announcement.)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					These requirements apply to the modified work as a whole.  If
 | 
				
			||||||
 | 
					identifiable sections of that work are not derived from the Program,
 | 
				
			||||||
 | 
					and can be reasonably considered independent and separate works in
 | 
				
			||||||
 | 
					themselves, then this License, and its terms, do not apply to those
 | 
				
			||||||
 | 
					sections when you distribute them as separate works.  But when you
 | 
				
			||||||
 | 
					distribute the same sections as part of a whole which is a work based
 | 
				
			||||||
 | 
					on the Program, the distribution of the whole must be on the terms of
 | 
				
			||||||
 | 
					this License, whose permissions for other licensees extend to the
 | 
				
			||||||
 | 
					entire whole, and thus to each and every part regardless of who wrote it.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Thus, it is not the intent of this section to claim rights or contest
 | 
				
			||||||
 | 
					your rights to work written entirely by you; rather, the intent is to
 | 
				
			||||||
 | 
					exercise the right to control the distribution of derivative or
 | 
				
			||||||
 | 
					collective works based on the Program.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					In addition, mere aggregation of another work not based on the Program
 | 
				
			||||||
 | 
					with the Program (or with a work based on the Program) on a volume of
 | 
				
			||||||
 | 
					a storage or distribution medium does not bring the other work under
 | 
				
			||||||
 | 
					the scope of this License.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  3. You may copy and distribute the Program (or a work based on it,
 | 
				
			||||||
 | 
					under Section 2) in object code or executable form under the terms of
 | 
				
			||||||
 | 
					Sections 1 and 2 above provided that you also do one of the following:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    a) Accompany it with the complete corresponding machine-readable
 | 
				
			||||||
 | 
					    source code, which must be distributed under the terms of Sections
 | 
				
			||||||
 | 
					    1 and 2 above on a medium customarily used for software interchange; or,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    b) Accompany it with a written offer, valid for at least three
 | 
				
			||||||
 | 
					    years, to give any third party, for a charge no more than your
 | 
				
			||||||
 | 
					    cost of physically performing source distribution, a complete
 | 
				
			||||||
 | 
					    machine-readable copy of the corresponding source code, to be
 | 
				
			||||||
 | 
					    distributed under the terms of Sections 1 and 2 above on a medium
 | 
				
			||||||
 | 
					    customarily used for software interchange; or,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    c) Accompany it with the information you received as to the offer
 | 
				
			||||||
 | 
					    to distribute corresponding source code.  (This alternative is
 | 
				
			||||||
 | 
					    allowed only for noncommercial distribution and only if you
 | 
				
			||||||
 | 
					    received the program in object code or executable form with such
 | 
				
			||||||
 | 
					    an offer, in accord with Subsection b above.)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					The source code for a work means the preferred form of the work for
 | 
				
			||||||
 | 
					making modifications to it.  For an executable work, complete source
 | 
				
			||||||
 | 
					code means all the source code for all modules it contains, plus any
 | 
				
			||||||
 | 
					associated interface definition files, plus the scripts used to
 | 
				
			||||||
 | 
					control compilation and installation of the executable.  However, as a
 | 
				
			||||||
 | 
					special exception, the source code distributed need not include
 | 
				
			||||||
 | 
					anything that is normally distributed (in either source or binary
 | 
				
			||||||
 | 
					form) with the major components (compiler, kernel, and so on) of the
 | 
				
			||||||
 | 
					operating system on which the executable runs, unless that component
 | 
				
			||||||
 | 
					itself accompanies the executable.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					If distribution of executable or object code is made by offering
 | 
				
			||||||
 | 
					access to copy from a designated place, then offering equivalent
 | 
				
			||||||
 | 
					access to copy the source code from the same place counts as
 | 
				
			||||||
 | 
					distribution of the source code, even though third parties are not
 | 
				
			||||||
 | 
					compelled to copy the source along with the object code.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  4. You may not copy, modify, sublicense, or distribute the Program
 | 
				
			||||||
 | 
					except as expressly provided under this License.  Any attempt
 | 
				
			||||||
 | 
					otherwise to copy, modify, sublicense or distribute the Program is
 | 
				
			||||||
 | 
					void, and will automatically terminate your rights under this License.
 | 
				
			||||||
 | 
					However, parties who have received copies, or rights, from you under
 | 
				
			||||||
 | 
					this License will not have their licenses terminated so long as such
 | 
				
			||||||
 | 
					parties remain in full compliance.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  5. You are not required to accept this License, since you have not
 | 
				
			||||||
 | 
					signed it.  However, nothing else grants you permission to modify or
 | 
				
			||||||
 | 
					distribute the Program or its derivative works.  These actions are
 | 
				
			||||||
 | 
					prohibited by law if you do not accept this License.  Therefore, by
 | 
				
			||||||
 | 
					modifying or distributing the Program (or any work based on the
 | 
				
			||||||
 | 
					Program), you indicate your acceptance of this License to do so, and
 | 
				
			||||||
 | 
					all its terms and conditions for copying, distributing or modifying
 | 
				
			||||||
 | 
					the Program or works based on it.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  6. Each time you redistribute the Program (or any work based on the
 | 
				
			||||||
 | 
					Program), the recipient automatically receives a license from the
 | 
				
			||||||
 | 
					original licensor to copy, distribute or modify the Program subject to
 | 
				
			||||||
 | 
					these terms and conditions.  You may not impose any further
 | 
				
			||||||
 | 
					restrictions on the recipients' exercise of the rights granted herein.
 | 
				
			||||||
 | 
					You are not responsible for enforcing compliance by third parties to
 | 
				
			||||||
 | 
					this License.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  7. If, as a consequence of a court judgment or allegation of patent
 | 
				
			||||||
 | 
					infringement or for any other reason (not limited to patent issues),
 | 
				
			||||||
 | 
					conditions are imposed on you (whether by court order, agreement or
 | 
				
			||||||
 | 
					otherwise) that contradict the conditions of this License, they do not
 | 
				
			||||||
 | 
					excuse you from the conditions of this License.  If you cannot
 | 
				
			||||||
 | 
					distribute so as to satisfy simultaneously your obligations under this
 | 
				
			||||||
 | 
					License and any other pertinent obligations, then as a consequence you
 | 
				
			||||||
 | 
					may not distribute the Program at all.  For example, if a patent
 | 
				
			||||||
 | 
					license would not permit royalty-free redistribution of the Program by
 | 
				
			||||||
 | 
					all those who receive copies directly or indirectly through you, then
 | 
				
			||||||
 | 
					the only way you could satisfy both it and this License would be to
 | 
				
			||||||
 | 
					refrain entirely from distribution of the Program.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					If any portion of this section is held invalid or unenforceable under
 | 
				
			||||||
 | 
					any particular circumstance, the balance of the section is intended to
 | 
				
			||||||
 | 
					apply and the section as a whole is intended to apply in other
 | 
				
			||||||
 | 
					circumstances.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					It is not the purpose of this section to induce you to infringe any
 | 
				
			||||||
 | 
					patents or other property right claims or to contest validity of any
 | 
				
			||||||
 | 
					such claims; this section has the sole purpose of protecting the
 | 
				
			||||||
 | 
					integrity of the free software distribution system, which is
 | 
				
			||||||
 | 
					implemented by public license practices.  Many people have made
 | 
				
			||||||
 | 
					generous contributions to the wide range of software distributed
 | 
				
			||||||
 | 
					through that system in reliance on consistent application of that
 | 
				
			||||||
 | 
					system; it is up to the author/donor to decide if he or she is willing
 | 
				
			||||||
 | 
					to distribute software through any other system and a licensee cannot
 | 
				
			||||||
 | 
					impose that choice.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					This section is intended to make thoroughly clear what is believed to
 | 
				
			||||||
 | 
					be a consequence of the rest of this License.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  8. If the distribution and/or use of the Program is restricted in
 | 
				
			||||||
 | 
					certain countries either by patents or by copyrighted interfaces, the
 | 
				
			||||||
 | 
					original copyright holder who places the Program under this License
 | 
				
			||||||
 | 
					may add an explicit geographical distribution limitation excluding
 | 
				
			||||||
 | 
					those countries, so that distribution is permitted only in or among
 | 
				
			||||||
 | 
					countries not thus excluded.  In such case, this License incorporates
 | 
				
			||||||
 | 
					the limitation as if written in the body of this License.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  9. The Free Software Foundation may publish revised and/or new versions
 | 
				
			||||||
 | 
					of the General Public License from time to time.  Such new versions will
 | 
				
			||||||
 | 
					be similar in spirit to the present version, but may differ in detail to
 | 
				
			||||||
 | 
					address new problems or concerns.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Each version is given a distinguishing version number.  If the Program
 | 
				
			||||||
 | 
					specifies a version number of this License which applies to it and "any
 | 
				
			||||||
 | 
					later version", you have the option of following the terms and conditions
 | 
				
			||||||
 | 
					either of that version or of any later version published by the Free
 | 
				
			||||||
 | 
					Software Foundation.  If the Program does not specify a version number of
 | 
				
			||||||
 | 
					this License, you may choose any version ever published by the Free Software
 | 
				
			||||||
 | 
					Foundation.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  10. If you wish to incorporate parts of the Program into other free
 | 
				
			||||||
 | 
					programs whose distribution conditions are different, write to the author
 | 
				
			||||||
 | 
					to ask for permission.  For software which is copyrighted by the Free
 | 
				
			||||||
 | 
					Software Foundation, write to the Free Software Foundation; we sometimes
 | 
				
			||||||
 | 
					make exceptions for this.  Our decision will be guided by the two goals
 | 
				
			||||||
 | 
					of preserving the free status of all derivatives of our free software and
 | 
				
			||||||
 | 
					of promoting the sharing and reuse of software generally.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								    NO WARRANTY
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
 | 
				
			||||||
 | 
					FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN
 | 
				
			||||||
 | 
					OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
 | 
				
			||||||
 | 
					PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
 | 
				
			||||||
 | 
					OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
 | 
				
			||||||
 | 
					MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS
 | 
				
			||||||
 | 
					TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE
 | 
				
			||||||
 | 
					PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
 | 
				
			||||||
 | 
					REPAIR OR CORRECTION.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
 | 
				
			||||||
 | 
					WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
 | 
				
			||||||
 | 
					REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
 | 
				
			||||||
 | 
					INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
 | 
				
			||||||
 | 
					OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
 | 
				
			||||||
 | 
					TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
 | 
				
			||||||
 | 
					YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
 | 
				
			||||||
 | 
					PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
 | 
				
			||||||
 | 
					POSSIBILITY OF SUCH DAMAGES.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							     END OF TERMS AND CONDITIONS
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						    How to Apply These Terms to Your New Programs
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  If you develop a new program, and you want it to be of the greatest
 | 
				
			||||||
 | 
					possible use to the public, the best way to achieve this is to make it
 | 
				
			||||||
 | 
					free software which everyone can redistribute and change under these terms.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  To do so, attach the following notices to the program.  It is safest
 | 
				
			||||||
 | 
					to attach them to the start of each source file to most effectively
 | 
				
			||||||
 | 
					convey the exclusion of warranty; and each file should have at least
 | 
				
			||||||
 | 
					the "copyright" line and a pointer to where the full notice is found.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    <one line to give the program's name and a brief idea of what it does.>
 | 
				
			||||||
 | 
					    Copyright (C) <year>  <name of author>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    This program is free software; you can redistribute it and/or modify
 | 
				
			||||||
 | 
					    it under the terms of the GNU General Public License as published by
 | 
				
			||||||
 | 
					    the Free Software Foundation; either version 2 of the License, or
 | 
				
			||||||
 | 
					    (at your option) any later version.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    This program is distributed in the hope that it will be useful,
 | 
				
			||||||
 | 
					    but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
				
			||||||
 | 
					    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 | 
				
			||||||
 | 
					    GNU General Public License for more details.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    You should have received a copy of the GNU General Public License
 | 
				
			||||||
 | 
					    along with this program; if not, write to the Free Software
 | 
				
			||||||
 | 
					    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Also add information on how to contact you by electronic and paper mail.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					If the program is interactive, make it output a short notice like this
 | 
				
			||||||
 | 
					when it starts in an interactive mode:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    Gnomovision version 69, Copyright (C) year  name of author
 | 
				
			||||||
 | 
					    Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
 | 
				
			||||||
 | 
					    This is free software, and you are welcome to redistribute it
 | 
				
			||||||
 | 
					    under certain conditions; type `show c' for details.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					The hypothetical commands `show w' and `show c' should show the appropriate
 | 
				
			||||||
 | 
					parts of the General Public License.  Of course, the commands you use may
 | 
				
			||||||
 | 
					be called something other than `show w' and `show c'; they could even be
 | 
				
			||||||
 | 
					mouse-clicks or menu items--whatever suits your program.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					You should also get your employer (if you work as a programmer) or your
 | 
				
			||||||
 | 
					school, if any, to sign a "copyright disclaimer" for the program, if
 | 
				
			||||||
 | 
					necessary.  Here is a sample; alter the names:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  Yoyodyne, Inc., hereby disclaims all copyright interest in the program
 | 
				
			||||||
 | 
					  `Gnomovision' (which makes passes at compilers) written by James Hacker.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  <signature of Ty Coon>, 1 April 1989
 | 
				
			||||||
 | 
					  Ty Coon, President of Vice
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					This General Public License does not permit incorporating your program into
 | 
				
			||||||
 | 
					proprietary programs.  If your program is a subroutine library, you may
 | 
				
			||||||
 | 
					consider it more useful to permit linking proprietary applications with the
 | 
				
			||||||
 | 
					library.  If this is what you want to do, use the GNU Library General
 | 
				
			||||||
 | 
					Public License instead of this License.
 | 
				
			||||||
							
								
								
									
										
											BIN
										
									
								
								FSDrivers/X64/exfat_ia32.efi
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								FSDrivers/X64/exfat_ia32.efi
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								FSDrivers/X64/exfat_x64.efi
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								FSDrivers/X64/exfat_x64.efi
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								FSDrivers/X64/ext2_x64.efi
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								FSDrivers/X64/ext2_x64.efi
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								FSDrivers/X64/ext4_x64.efi
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								FSDrivers/X64/ext4_x64.efi
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								FSDrivers/X64/ntfs_x64.efi
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								FSDrivers/X64/ntfs_x64.efi
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										27
									
								
								FSDrivers/exfat.inf
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										27
									
								
								FSDrivers/exfat.inf
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,27 @@
 | 
				
			|||||||
 | 
					# ReadOnly exFAT filesystem driver
 | 
				
			||||||
 | 
					# From https://efi.akeo.ie/ v1.5
 | 
				
			||||||
 | 
					##
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					[Defines]
 | 
				
			||||||
 | 
					  INF_VERSION                    = 0x00010005
 | 
				
			||||||
 | 
					  BASE_NAME                      = exfat
 | 
				
			||||||
 | 
					  FILE_GUID                      = CB683001-379F-48C7-B7B6-707D29454BF5
 | 
				
			||||||
 | 
					  MODULE_TYPE                    = UEFI_DRIVER
 | 
				
			||||||
 | 
					  VERSION_STRING                 = 1.0
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#
 | 
				
			||||||
 | 
					# The following information is for reference only and not required by the build tools.
 | 
				
			||||||
 | 
					#
 | 
				
			||||||
 | 
					#  VALID_ARCHITECTURES           = IA32 X64 IPF EBC
 | 
				
			||||||
 | 
					#
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					VALID_ARCHITECTURES           = X64 IA32
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					[Binaries.X64]
 | 
				
			||||||
 | 
					  PE32|X64/exfat_x64.efi|*
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					[Binaries.IA32]
 | 
				
			||||||
 | 
					  PE32|IA32/exfat_ia32.efi|*
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
							
								
								
									
										25
									
								
								FSDrivers/ext2.inf
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										25
									
								
								FSDrivers/ext2.inf
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,25 @@
 | 
				
			|||||||
 | 
					# EXT2 filesystem driver. See */LICENSE.txt for details.
 | 
				
			||||||
 | 
					# https://www.rodsbooks.com/refind/ v0.12
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					[Defines]
 | 
				
			||||||
 | 
					  INF_VERSION                    = 0x00010005
 | 
				
			||||||
 | 
					  BASE_NAME                      = ext2
 | 
				
			||||||
 | 
					  FILE_GUID                      = 8EC49C43-D1C4-4E6C-98BF-232CA5D89A1B
 | 
				
			||||||
 | 
					  MODULE_TYPE                    = UEFI_DRIVER
 | 
				
			||||||
 | 
					  VERSION_STRING                 = 1.0
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#
 | 
				
			||||||
 | 
					# The following information is for reference only and not required by the build tools.
 | 
				
			||||||
 | 
					#
 | 
				
			||||||
 | 
					#  VALID_ARCHITECTURES           = IA32 X64 IPF EBC
 | 
				
			||||||
 | 
					#
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					VALID_ARCHITECTURES           = X64 IA32
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					[Binaries.X64]
 | 
				
			||||||
 | 
					  PE32|X64/ext2_x64.efi|*
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					[Binaries.IA32]
 | 
				
			||||||
 | 
					  PE32|IA32/ext2_ia32.efi|*
 | 
				
			||||||
 | 
					
 | 
				
			||||||
							
								
								
									
										25
									
								
								FSDrivers/ext4.inf
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										25
									
								
								FSDrivers/ext4.inf
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,25 @@
 | 
				
			|||||||
 | 
					# EXT4 filesystem driver. See */LICENSE.txt for details.
 | 
				
			||||||
 | 
					# https://www.rodsbooks.com/refind/ v0.12
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					[Defines]
 | 
				
			||||||
 | 
					  INF_VERSION                    = 0x00010005
 | 
				
			||||||
 | 
					  BASE_NAME                      = ext4
 | 
				
			||||||
 | 
					  FILE_GUID                      = 9d380387-a15a-4053-ae19-ff3495b6d0d5
 | 
				
			||||||
 | 
					  MODULE_TYPE                    = UEFI_DRIVER
 | 
				
			||||||
 | 
					  VERSION_STRING                 = 1.0
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#
 | 
				
			||||||
 | 
					# The following information is for reference only and not required by the build tools.
 | 
				
			||||||
 | 
					#
 | 
				
			||||||
 | 
					#  VALID_ARCHITECTURES           = IA32 X64 IPF EBC
 | 
				
			||||||
 | 
					#
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					VALID_ARCHITECTURES           = X64 IA32
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					[Binaries.X64]
 | 
				
			||||||
 | 
					  PE32|X64/ext4_x64.efi|*
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					[Binaries.IA32]
 | 
				
			||||||
 | 
					  PE32|IA32/ext4_ia32.efi|*
 | 
				
			||||||
 | 
					
 | 
				
			||||||
							
								
								
									
										27
									
								
								FSDrivers/ntfs.inf
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										27
									
								
								FSDrivers/ntfs.inf
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,27 @@
 | 
				
			|||||||
 | 
					# ReadOnly NTFS filesystem driver
 | 
				
			||||||
 | 
					# From https://efi.akeo.ie/ v1.5
 | 
				
			||||||
 | 
					##
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					[Defines]
 | 
				
			||||||
 | 
					  INF_VERSION                    = 0x00010005
 | 
				
			||||||
 | 
					  BASE_NAME                      = ntfs
 | 
				
			||||||
 | 
					  FILE_GUID                      = 2282efd0-678b-4753-8d06-200d5940285d
 | 
				
			||||||
 | 
					  MODULE_TYPE                    = UEFI_DRIVER
 | 
				
			||||||
 | 
					  VERSION_STRING                 = 1.0
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#
 | 
				
			||||||
 | 
					# The following information is for reference only and not required by the build tools.
 | 
				
			||||||
 | 
					#
 | 
				
			||||||
 | 
					#  VALID_ARCHITECTURES           = IA32 X64 IPF EBC
 | 
				
			||||||
 | 
					#
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					VALID_ARCHITECTURES           = X64 IA32
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					[Binaries.X64]
 | 
				
			||||||
 | 
					  PE32|X64/ntfs_x64.efi|*
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					[Binaries.IA32]
 | 
				
			||||||
 | 
					  PE32|IA32/ntfs_ia32.efi|*
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -7,6 +7,14 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
**/
 | 
					**/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include <IndustryStandard/Pci.h>
 | 
				
			||||||
 | 
					#include <Protocol/PciIo.h>
 | 
				
			||||||
 | 
					#include <Protocol/PciRootBridgeIo.h>
 | 
				
			||||||
 | 
					#include <Protocol/UsbIo.h>
 | 
				
			||||||
 | 
					#include <Register/Amd/Cpuid.h>
 | 
				
			||||||
 | 
					#include <Register/Intel/Cpuid.h>
 | 
				
			||||||
 | 
					#include <Register/Intel/Msr.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "FrontPage.h"
 | 
					#include "FrontPage.h"
 | 
				
			||||||
#include "FrontPageCustomizedUi.h"
 | 
					#include "FrontPageCustomizedUi.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -17,7 +25,6 @@ EFI_GUID   mFrontPageGuid      = FRONT_PAGE_FORMSET_GUID;
 | 
				
			|||||||
BOOLEAN   mResetRequired  = FALSE;
 | 
					BOOLEAN   mResetRequired  = FALSE;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
EFI_FORM_BROWSER2_PROTOCOL      *gFormBrowser2;
 | 
					EFI_FORM_BROWSER2_PROTOCOL      *gFormBrowser2;
 | 
				
			||||||
CHAR8     *mLanguageString;
 | 
					 | 
				
			||||||
BOOLEAN   mModeInitialized = FALSE;
 | 
					BOOLEAN   mModeInitialized = FALSE;
 | 
				
			||||||
//
 | 
					//
 | 
				
			||||||
// Boot video resolution and text mode.
 | 
					// Boot video resolution and text mode.
 | 
				
			||||||
@@ -34,11 +41,12 @@ UINT32    mSetupTextModeRow            = 0;
 | 
				
			|||||||
UINT32    mSetupHorizontalResolution   = 0;
 | 
					UINT32    mSetupHorizontalResolution   = 0;
 | 
				
			||||||
UINT32    mSetupVerticalResolution     = 0;
 | 
					UINT32    mSetupVerticalResolution     = 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					EFI_SYSTEM_TABLE * gSystemTable = NULL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
FRONT_PAGE_CALLBACK_DATA  gFrontPagePrivate = {
 | 
					FRONT_PAGE_CALLBACK_DATA  gFrontPagePrivate = {
 | 
				
			||||||
  FRONT_PAGE_CALLBACK_DATA_SIGNATURE,
 | 
					  FRONT_PAGE_CALLBACK_DATA_SIGNATURE,
 | 
				
			||||||
  NULL,
 | 
					  NULL,
 | 
				
			||||||
  NULL,
 | 
					  NULL,
 | 
				
			||||||
  NULL,
 | 
					 | 
				
			||||||
  {
 | 
					  {
 | 
				
			||||||
    FakeExtractConfig,
 | 
					    FakeExtractConfig,
 | 
				
			||||||
    FakeRouteConfig,
 | 
					    FakeRouteConfig,
 | 
				
			||||||
@@ -211,7 +219,7 @@ UpdateFrontPageForm (
 | 
				
			|||||||
  //
 | 
					  //
 | 
				
			||||||
  StartGuidLabel = (EFI_IFR_GUID_LABEL *) HiiCreateGuidOpCode (StartOpCodeHandle, &gEfiIfrTianoGuid, NULL, sizeof (EFI_IFR_GUID_LABEL));
 | 
					  StartGuidLabel = (EFI_IFR_GUID_LABEL *) HiiCreateGuidOpCode (StartOpCodeHandle, &gEfiIfrTianoGuid, NULL, sizeof (EFI_IFR_GUID_LABEL));
 | 
				
			||||||
  StartGuidLabel->ExtendOpCode = EFI_IFR_EXTEND_OP_LABEL;
 | 
					  StartGuidLabel->ExtendOpCode = EFI_IFR_EXTEND_OP_LABEL;
 | 
				
			||||||
  StartGuidLabel->Number       = LABEL_FRANTPAGE_INFORMATION;
 | 
					  StartGuidLabel->Number       = LABEL_FRONTPAGE_INFORMATION;
 | 
				
			||||||
  //
 | 
					  //
 | 
				
			||||||
  // Create Hii Extend Label OpCode as the end opcode
 | 
					  // Create Hii Extend Label OpCode as the end opcode
 | 
				
			||||||
  //
 | 
					  //
 | 
				
			||||||
@@ -239,6 +247,124 @@ UpdateFrontPageForm (
 | 
				
			|||||||
  HiiFreeOpCodeHandle (EndOpCodeHandle);
 | 
					  HiiFreeOpCodeHandle (EndOpCodeHandle);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// FIXME: Copied from Device Manager; clean up
 | 
				
			||||||
 | 
					void ShowSecureBootConfig(void)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    void *StartHandle;
 | 
				
			||||||
 | 
					    void *EndHandle;
 | 
				
			||||||
 | 
					    EFI_IFR_GUID_LABEL *StartLabel;
 | 
				
			||||||
 | 
					    EFI_IFR_GUID_LABEL *EndLabel;
 | 
				
			||||||
 | 
					    EFI_HII_HANDLE *HiiHandles;
 | 
				
			||||||
 | 
					    EFI_HII_HANDLE HiiHandle = gFrontPagePrivate.HiiHandle;
 | 
				
			||||||
 | 
					    UINTN Index;
 | 
				
			||||||
 | 
					    EFI_STRING String;
 | 
				
			||||||
 | 
					    EFI_STRING_ID Token;
 | 
				
			||||||
 | 
					    EFI_STRING_ID TokenHelp;
 | 
				
			||||||
 | 
					    EFI_IFR_FORM_SET *Buffer = NULL;
 | 
				
			||||||
 | 
					    UINTN BufferSize = 0;
 | 
				
			||||||
 | 
					    UINT8 ClassGuidNum;
 | 
				
			||||||
 | 
					    EFI_GUID *ClassGuid;
 | 
				
			||||||
 | 
					    UINTN TempSize = 0;
 | 
				
			||||||
 | 
					    UINT8 *Ptr;
 | 
				
			||||||
 | 
					    EFI_STATUS Status;
 | 
				
			||||||
 | 
					    // XXX: Copied from SecureBootConfigDxe
 | 
				
			||||||
 | 
					    EFI_GUID SecureBootConfigGuid = { 0x5daf50a5, 0xea81, 0x4de2, {0x8f, 0x9b, 0xca, 0xbd, 0xa9, 0xcf, 0x5c, 0x14}};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    StartHandle = HiiAllocateOpCodeHandle();
 | 
				
			||||||
 | 
					    ASSERT(StartHandle != NULL);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    EndHandle = HiiAllocateOpCodeHandle();
 | 
				
			||||||
 | 
					    ASSERT(EndHandle != NULL);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    StartLabel = (EFI_IFR_GUID_LABEL *)HiiCreateGuidOpCode(StartHandle, &gEfiIfrTianoGuid, NULL, sizeof(*StartLabel));
 | 
				
			||||||
 | 
					    StartLabel->ExtendOpCode = EFI_IFR_EXTEND_OP_LABEL;
 | 
				
			||||||
 | 
					    StartLabel->Number = LABEL_DEVICES_LIST;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    EndLabel = (EFI_IFR_GUID_LABEL *)HiiCreateGuidOpCode(EndHandle, &gEfiIfrTianoGuid, NULL, sizeof(*EndLabel));
 | 
				
			||||||
 | 
					    EndLabel->ExtendOpCode = EFI_IFR_EXTEND_OP_LABEL;
 | 
				
			||||||
 | 
					    EndLabel->Number = LABEL_END;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    // Get SecureBootConfig handle
 | 
				
			||||||
 | 
					    HiiHandles = HiiGetHiiHandles(&SecureBootConfigGuid);
 | 
				
			||||||
 | 
					    ASSERT(HiiHandles != NULL);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    // Search for formset of each class type
 | 
				
			||||||
 | 
					    for (Index = 0; HiiHandles[Index] != NULL; Index++) {
 | 
				
			||||||
 | 
					        Status = HiiGetFormSetFromHiiHandle(HiiHandles[Index], &Buffer, &BufferSize);
 | 
				
			||||||
 | 
					        if (EFI_ERROR(Status)) {
 | 
				
			||||||
 | 
					            continue;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        Ptr = (UINT8 *)Buffer;
 | 
				
			||||||
 | 
					        while (TempSize < BufferSize) {
 | 
				
			||||||
 | 
					            TempSize += ((EFI_IFR_OP_HEADER *)Ptr)->Length;
 | 
				
			||||||
 | 
					            if (((EFI_IFR_OP_HEADER *)Ptr)->Length <= OFFSET_OF (EFI_IFR_FORM_SET, Flags)) {
 | 
				
			||||||
 | 
					                Ptr += ((EFI_IFR_OP_HEADER *)Ptr)->Length;
 | 
				
			||||||
 | 
					                continue;
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            ClassGuidNum = (UINT8)(((EFI_IFR_FORM_SET *)Ptr)->Flags & 0x3);
 | 
				
			||||||
 | 
					            ClassGuid = (EFI_GUID *)(VOID *)(Ptr + sizeof(EFI_IFR_FORM_SET));
 | 
				
			||||||
 | 
					            while (ClassGuidNum-- > 0) {
 | 
				
			||||||
 | 
					                if (CompareGuid(&gEfiHiiPlatformSetupFormsetGuid, ClassGuid) == 0) {
 | 
				
			||||||
 | 
					                    ClassGuid++;
 | 
				
			||||||
 | 
					                    continue;
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                String = HiiGetString(HiiHandles[Index], ((EFI_IFR_FORM_SET *)Ptr)->FormSetTitle, NULL);
 | 
				
			||||||
 | 
					                if (String == NULL) {
 | 
				
			||||||
 | 
					                    String = HiiGetString(HiiHandle, STRING_TOKEN (STR_MISSING_STRING), NULL);
 | 
				
			||||||
 | 
					                    ASSERT (String != NULL);
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                Token = HiiSetString(HiiHandle, 0, String, NULL);
 | 
				
			||||||
 | 
					                FreePool(String);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                String = HiiGetString(HiiHandles[Index], ((EFI_IFR_FORM_SET *)Ptr)->Help, NULL);
 | 
				
			||||||
 | 
					                if (String == NULL) {
 | 
				
			||||||
 | 
					                    String = HiiGetString(HiiHandle, STRING_TOKEN (STR_MISSING_STRING), NULL);
 | 
				
			||||||
 | 
					                    ASSERT(String != NULL);
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                TokenHelp = HiiSetString(HiiHandle, 0, String, NULL);
 | 
				
			||||||
 | 
					                FreePool(String);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                HiiCreateGotoExOpCode(
 | 
				
			||||||
 | 
					                    StartHandle,
 | 
				
			||||||
 | 
					                    0,
 | 
				
			||||||
 | 
					                    Token,
 | 
				
			||||||
 | 
					                    TokenHelp,
 | 
				
			||||||
 | 
					                    0,
 | 
				
			||||||
 | 
					                    0,
 | 
				
			||||||
 | 
					                    0,
 | 
				
			||||||
 | 
					                    &SecureBootConfigGuid,
 | 
				
			||||||
 | 
					                    0
 | 
				
			||||||
 | 
					                );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                break;
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            Ptr += ((EFI_IFR_OP_HEADER *)Ptr)->Length;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        FreePool (Buffer);
 | 
				
			||||||
 | 
					        Buffer     = NULL;
 | 
				
			||||||
 | 
					        TempSize   = 0;
 | 
				
			||||||
 | 
					        BufferSize = 0;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    HiiUpdateForm(
 | 
				
			||||||
 | 
					        HiiHandle,
 | 
				
			||||||
 | 
					        &mFrontPageGuid,
 | 
				
			||||||
 | 
					        FRONT_PAGE_FORM_ID,
 | 
				
			||||||
 | 
					        StartHandle,
 | 
				
			||||||
 | 
					        EndHandle
 | 
				
			||||||
 | 
					    );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    HiiFreeOpCodeHandle(StartHandle);
 | 
				
			||||||
 | 
					    HiiFreeOpCodeHandle(EndHandle);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
  Initialize HII information for the FrontPage
 | 
					  Initialize HII information for the FrontPage
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -297,6 +423,8 @@ InitializeFrontPage (
 | 
				
			|||||||
  //
 | 
					  //
 | 
				
			||||||
  UpdateFrontPageForm();
 | 
					  UpdateFrontPageForm();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  ShowSecureBootConfig();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  return Status;
 | 
					  return Status;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -367,10 +495,6 @@ FreeFrontPage(
 | 
				
			|||||||
  // Publish our HII data
 | 
					  // Publish our HII data
 | 
				
			||||||
  //
 | 
					  //
 | 
				
			||||||
  HiiRemovePackages (gFrontPagePrivate.HiiHandle);
 | 
					  HiiRemovePackages (gFrontPagePrivate.HiiHandle);
 | 
				
			||||||
  if (gFrontPagePrivate.LanguageToken != NULL) {
 | 
					 | 
				
			||||||
    FreePool (gFrontPagePrivate.LanguageToken);
 | 
					 | 
				
			||||||
    gFrontPagePrivate.LanguageToken = NULL;
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
@@ -492,6 +616,462 @@ GetOptionalStringByIndex (
 | 
				
			|||||||
  return EFI_SUCCESS;
 | 
					  return EFI_SUCCESS;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					UINT16 SmbiosTableLength (SMBIOS_STRUCTURE_POINTER SmbiosTableN)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					  CHAR8  *AChar;
 | 
				
			||||||
 | 
					  UINT16  Length;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  AChar = (CHAR8 *)(SmbiosTableN.Raw + SmbiosTableN.Hdr->Length);
 | 
				
			||||||
 | 
					  while ((*AChar != 0) || (*(AChar + 1) != 0)) {
 | 
				
			||||||
 | 
					    AChar ++; //stop at 00 - first 0
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					  Length = (UINT16)((UINTN)AChar - (UINTN)SmbiosTableN.Raw + 2); //length includes 00
 | 
				
			||||||
 | 
					  return Length;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					SMBIOS_STRUCTURE_POINTER GetSmbiosTableFromType (
 | 
				
			||||||
 | 
					  SMBIOS_TABLE_ENTRY_POINT *SmbiosPoint, UINT8 SmbiosType, UINTN IndexTable)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					  SMBIOS_STRUCTURE_POINTER SmbiosTableN;
 | 
				
			||||||
 | 
					  UINTN                    SmbiosTypeIndex;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  SmbiosTypeIndex = 0;
 | 
				
			||||||
 | 
					  SmbiosTableN.Raw = (UINT8 *)((UINTN)SmbiosPoint->TableAddress);
 | 
				
			||||||
 | 
					  if (SmbiosTableN.Raw == NULL) {
 | 
				
			||||||
 | 
					    return SmbiosTableN;
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					  while ((SmbiosTypeIndex != IndexTable) || (SmbiosTableN.Hdr->Type != SmbiosType)) {
 | 
				
			||||||
 | 
					    if (SmbiosTableN.Hdr->Type == SMBIOS_TYPE_END_OF_TABLE) {
 | 
				
			||||||
 | 
					      SmbiosTableN.Raw = NULL;
 | 
				
			||||||
 | 
					      return SmbiosTableN;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    if (SmbiosTableN.Hdr->Type == SmbiosType) {
 | 
				
			||||||
 | 
					      SmbiosTypeIndex++;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    SmbiosTableN.Raw = (UINT8 *)(SmbiosTableN.Raw + SmbiosTableLength (SmbiosTableN));
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					  return SmbiosTableN;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					STATIC
 | 
				
			||||||
 | 
					VOID
 | 
				
			||||||
 | 
					WarnNoBootableMedia (
 | 
				
			||||||
 | 
					  VOID
 | 
				
			||||||
 | 
					  )
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					  CHAR16                        *String;
 | 
				
			||||||
 | 
					  EFI_STRING_ID                 Token;
 | 
				
			||||||
 | 
					  EFI_BOOT_MANAGER_LOAD_OPTION  *BootOption;
 | 
				
			||||||
 | 
					  UINTN                         BootOptionCount;
 | 
				
			||||||
 | 
					  UINTN                         Index;
 | 
				
			||||||
 | 
					  UINTN                         Count = 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  String = AllocateZeroPool (0x60);
 | 
				
			||||||
 | 
					  BootOption = EfiBootManagerGetLoadOptions (&BootOptionCount, LoadOptionTypeBoot);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  for (Index = 0; Index < BootOptionCount; Index++) {
 | 
				
			||||||
 | 
					    //
 | 
				
			||||||
 | 
					    // Don't count the hidden/inactive boot option
 | 
				
			||||||
 | 
					    //
 | 
				
			||||||
 | 
					    if (((BootOption[Index].Attributes & LOAD_OPTION_HIDDEN) != 0) || ((BootOption[Index].Attributes & LOAD_OPTION_ACTIVE) == 0)) {
 | 
				
			||||||
 | 
					      continue;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    Count++;
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  EfiBootManagerFreeLoadOptions (BootOption, BootOptionCount);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  if (Count == 0) {
 | 
				
			||||||
 | 
					    StrCatS (String, 0x60 / sizeof (CHAR16), L"Warning: No bootable media found");
 | 
				
			||||||
 | 
					  } else {
 | 
				
			||||||
 | 
					    StrCatS (String, 0x60 / sizeof (CHAR16), L"");
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  Token = STRING_TOKEN (STR_NO_BOOTABLE_MEDIA);
 | 
				
			||||||
 | 
					  HiiSetString (gFrontPagePrivate.HiiHandle, Token, String, NULL);
 | 
				
			||||||
 | 
					  FreePool(String);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					BOOLEAN
 | 
				
			||||||
 | 
					StandardSignatureIsAuthenticAMD (
 | 
				
			||||||
 | 
					  VOID
 | 
				
			||||||
 | 
					  )
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					  UINT32  RegEbx;
 | 
				
			||||||
 | 
					  UINT32  RegEcx;
 | 
				
			||||||
 | 
					  UINT32  RegEdx;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  AsmCpuid (CPUID_SIGNATURE, NULL, &RegEbx, &RegEcx, &RegEdx);
 | 
				
			||||||
 | 
					  return (RegEbx == CPUID_SIGNATURE_AUTHENTIC_AMD_EBX &&
 | 
				
			||||||
 | 
					          RegEcx == CPUID_SIGNATURE_AUTHENTIC_AMD_ECX &&
 | 
				
			||||||
 | 
					          RegEdx == CPUID_SIGNATURE_AUTHENTIC_AMD_EDX);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					BOOLEAN
 | 
				
			||||||
 | 
					StandardSignatureIsGenuineIntel (
 | 
				
			||||||
 | 
					  VOID
 | 
				
			||||||
 | 
					  )
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					  UINT32  RegEbx;
 | 
				
			||||||
 | 
					  UINT32  RegEcx;
 | 
				
			||||||
 | 
					  UINT32  RegEdx;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  AsmCpuid (CPUID_SIGNATURE, NULL, &RegEbx, &RegEcx, &RegEdx);
 | 
				
			||||||
 | 
					  return (RegEbx == CPUID_SIGNATURE_GENUINE_INTEL_EBX &&
 | 
				
			||||||
 | 
					          RegEcx == CPUID_SIGNATURE_GENUINE_INTEL_ECX &&
 | 
				
			||||||
 | 
					          RegEdx == CPUID_SIGNATURE_GENUINE_INTEL_EDX);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					typedef struct {
 | 
				
			||||||
 | 
					  CHAR8     Signature[8];
 | 
				
			||||||
 | 
					  UINT8     Checksum;
 | 
				
			||||||
 | 
					  CHAR8     OemId[6];
 | 
				
			||||||
 | 
					  UINT8     Revision;
 | 
				
			||||||
 | 
					  UINT32    RsdtAddress;
 | 
				
			||||||
 | 
					} ACPI_RSDP;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					CHAR8 RSDP_SIGNATURE[8] = {'R', 'S', 'D', ' ', 'P', 'T', 'R', ' '};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					typedef struct {
 | 
				
			||||||
 | 
					  CHAR8     Signature[4];
 | 
				
			||||||
 | 
					  UINT32    Length;
 | 
				
			||||||
 | 
					  UINT8     Revision;
 | 
				
			||||||
 | 
					  UINT8     Checksum;
 | 
				
			||||||
 | 
					  CHAR8     OemId[6];
 | 
				
			||||||
 | 
					  CHAR8     OemTableId[8];
 | 
				
			||||||
 | 
					  UINT32    OemRevision;
 | 
				
			||||||
 | 
					  UINT32    CreatorId;
 | 
				
			||||||
 | 
					  UINT32    CreatorRevision;
 | 
				
			||||||
 | 
					} ACPI_SDT_HEADER;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					CHAR8 RSDT_SIGNATURE[4] = {'R', 'S', 'D', 'T'};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					STATIC ACPI_SDT_HEADER* FindAcpiTable(CHAR8 Name[4]) {
 | 
				
			||||||
 | 
					  UINTN                    Index;
 | 
				
			||||||
 | 
					  EFI_CONFIGURATION_TABLE* ConfigurationTable;
 | 
				
			||||||
 | 
					  UINTN                    RsdpPtr;
 | 
				
			||||||
 | 
					  ACPI_RSDP*               Rsdp;
 | 
				
			||||||
 | 
					  UINTN                    RsdtPtr;
 | 
				
			||||||
 | 
					  ACPI_SDT_HEADER*         Rsdt;
 | 
				
			||||||
 | 
					  UINTN                    TablePtr;
 | 
				
			||||||
 | 
					  ACPI_SDT_HEADER*         Table;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  DEBUG ((EFI_D_INFO, "FindAcpiTable: '%c%c%c%c'\n",
 | 
				
			||||||
 | 
					    Name[0],
 | 
				
			||||||
 | 
					    Name[1],
 | 
				
			||||||
 | 
					    Name[2],
 | 
				
			||||||
 | 
					    Name[3]
 | 
				
			||||||
 | 
					  ));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  if (gSystemTable == NULL) {
 | 
				
			||||||
 | 
					      DEBUG ((EFI_D_INFO, "  System Table missing\n"));
 | 
				
			||||||
 | 
					      return NULL;
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  // Search the table for an entry that matches the ACPI Table Guid
 | 
				
			||||||
 | 
					  for (Index = 0; Index < gSystemTable->NumberOfTableEntries; Index++) {
 | 
				
			||||||
 | 
					    if (CompareGuid (&gEfiAcpiTableGuid, &(gSystemTable->ConfigurationTable[Index].VendorGuid))) {
 | 
				
			||||||
 | 
					      ConfigurationTable = &gSystemTable->ConfigurationTable[Index];
 | 
				
			||||||
 | 
					      break;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  if (ConfigurationTable == NULL) {
 | 
				
			||||||
 | 
					      DEBUG ((EFI_D_INFO, "  ACPI Configuration Table missing\n"));
 | 
				
			||||||
 | 
					      return NULL;
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  RsdpPtr = (UINTN)ConfigurationTable->VendorTable;
 | 
				
			||||||
 | 
					  DEBUG ((EFI_D_INFO, "  RSDP 0x%x\n", RsdpPtr));
 | 
				
			||||||
 | 
					  Rsdp = (ACPI_RSDP*)RsdpPtr;
 | 
				
			||||||
 | 
					  DEBUG ((EFI_D_INFO, "    Signature: '%c%c%c%c%c%c%c%c'\n",
 | 
				
			||||||
 | 
					    Rsdp->Signature[0],
 | 
				
			||||||
 | 
					    Rsdp->Signature[1],
 | 
				
			||||||
 | 
					    Rsdp->Signature[2],
 | 
				
			||||||
 | 
					    Rsdp->Signature[3],
 | 
				
			||||||
 | 
					    Rsdp->Signature[4],
 | 
				
			||||||
 | 
					    Rsdp->Signature[5],
 | 
				
			||||||
 | 
					    Rsdp->Signature[6],
 | 
				
			||||||
 | 
					    Rsdp->Signature[7]
 | 
				
			||||||
 | 
					  ));
 | 
				
			||||||
 | 
					  if (CompareMem(Rsdp->Signature, RSDP_SIGNATURE, 8) != 0) {
 | 
				
			||||||
 | 
					      DEBUG ((EFI_D_INFO, "    RSDP invalid signature\n"));
 | 
				
			||||||
 | 
					      return NULL;
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					  DEBUG ((EFI_D_INFO, "    Revision: 0x%x\n", Rsdp->Revision));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  RsdtPtr = (UINTN)Rsdp->RsdtAddress;
 | 
				
			||||||
 | 
					  DEBUG ((EFI_D_INFO, "  RSDT 0x%x\n", RsdpPtr));
 | 
				
			||||||
 | 
					  Rsdt = (ACPI_SDT_HEADER*)RsdtPtr;
 | 
				
			||||||
 | 
					  DEBUG ((EFI_D_INFO, "    Signature: '%c%c%c%c'\n",
 | 
				
			||||||
 | 
					    Rsdt->Signature[0],
 | 
				
			||||||
 | 
					    Rsdt->Signature[1],
 | 
				
			||||||
 | 
					    Rsdt->Signature[2],
 | 
				
			||||||
 | 
					    Rsdt->Signature[3]
 | 
				
			||||||
 | 
					  ));
 | 
				
			||||||
 | 
					  if (CompareMem(Rsdt->Signature, RSDT_SIGNATURE, 4) != 0) {
 | 
				
			||||||
 | 
					      DEBUG ((EFI_D_INFO, "    RSDT invalid signature\n"));
 | 
				
			||||||
 | 
					      return NULL;
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					  DEBUG ((EFI_D_INFO, "    Revision: 0x%x\n", Rsdt->Revision));
 | 
				
			||||||
 | 
					  DEBUG ((EFI_D_INFO, "    Length: 0x%x\n", Rsdt->Length));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  for (Index = sizeof(ACPI_SDT_HEADER); Index < Rsdt->Length; Index += 4) {
 | 
				
			||||||
 | 
					      TablePtr = (UINTN)(*(UINT32*)(RsdtPtr + Index));
 | 
				
			||||||
 | 
					      DEBUG ((EFI_D_INFO, "  Table %d: 0x%x\n", Index, TablePtr));
 | 
				
			||||||
 | 
					      Table = (ACPI_SDT_HEADER*)TablePtr;
 | 
				
			||||||
 | 
					      DEBUG ((EFI_D_INFO, "    Signature: '%c%c%c%c'\n",
 | 
				
			||||||
 | 
					        Table->Signature[0],
 | 
				
			||||||
 | 
					        Table->Signature[1],
 | 
				
			||||||
 | 
					        Table->Signature[2],
 | 
				
			||||||
 | 
					        Table->Signature[3]
 | 
				
			||||||
 | 
					      ));
 | 
				
			||||||
 | 
					      DEBUG ((EFI_D_INFO, "    Revision: 0x%x\n", Table->Revision));
 | 
				
			||||||
 | 
					      DEBUG ((EFI_D_INFO, "    Length: 0x%x\n", Table->Length));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      if (CompareMem(Table->Signature, Name, 4) == 0) {
 | 
				
			||||||
 | 
					          DEBUG ((EFI_D_INFO, "  Match found\n"));
 | 
				
			||||||
 | 
					          return Table;
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  DEBUG ((EFI_D_INFO, "  No match found\n"));
 | 
				
			||||||
 | 
					  return NULL;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// From PciBusDxe
 | 
				
			||||||
 | 
					STATIC
 | 
				
			||||||
 | 
					EFI_STATUS
 | 
				
			||||||
 | 
					PciDevicePresent(
 | 
				
			||||||
 | 
					    OUT PCI_TYPE00  *Pci,
 | 
				
			||||||
 | 
					    IN  UINT8       Bus,
 | 
				
			||||||
 | 
					    IN  UINT8       Device,
 | 
				
			||||||
 | 
					    IN  UINT8       Func
 | 
				
			||||||
 | 
					    )
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    UINT64 Address = EFI_PCI_ADDRESS(Bus, Device, Func, 0);
 | 
				
			||||||
 | 
					    EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *PciRootBridgeIo;
 | 
				
			||||||
 | 
					    EFI_STATUS Status;
 | 
				
			||||||
 | 
					    EFI_HANDLE *PciIoBuffer;
 | 
				
			||||||
 | 
					    UINTN PciIoHandleCount = 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    Status = gBS->LocateHandleBuffer(
 | 
				
			||||||
 | 
					        ByProtocol,
 | 
				
			||||||
 | 
					        &gEfiPciRootBridgeIoProtocolGuid,
 | 
				
			||||||
 | 
					        NULL,
 | 
				
			||||||
 | 
					        &PciIoHandleCount,
 | 
				
			||||||
 | 
					        &PciIoBuffer
 | 
				
			||||||
 | 
					    );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if (EFI_ERROR(Status)) {
 | 
				
			||||||
 | 
					        DEBUG((EFI_D_INFO, "%a: Failed to get PciRootBridgeIo handles: %r\n", __FUNCTION__, Status));
 | 
				
			||||||
 | 
					        return Status;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    for (UINTN Index = 0; Index < PciIoHandleCount; Index++) {
 | 
				
			||||||
 | 
					        Status = gBS->OpenProtocol(
 | 
				
			||||||
 | 
					            PciIoBuffer[Index],
 | 
				
			||||||
 | 
					            &gEfiPciRootBridgeIoProtocolGuid,
 | 
				
			||||||
 | 
					            (VOID *)&PciRootBridgeIo,
 | 
				
			||||||
 | 
					            NULL,
 | 
				
			||||||
 | 
					            NULL,
 | 
				
			||||||
 | 
					            EFI_OPEN_PROTOCOL_GET_PROTOCOL
 | 
				
			||||||
 | 
					        );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if (EFI_ERROR(Status)) {
 | 
				
			||||||
 | 
					            DEBUG((EFI_D_INFO, "%a: Failed to open PciRootBridgeIo protocol: %r\n", __FUNCTION__, Status));
 | 
				
			||||||
 | 
					            continue;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        // Read the Vendor ID register
 | 
				
			||||||
 | 
					        Status = PciRootBridgeIo->Pci.Read(
 | 
				
			||||||
 | 
					            PciRootBridgeIo,
 | 
				
			||||||
 | 
					            EfiPciWidthUint32,
 | 
				
			||||||
 | 
					            Address,
 | 
				
			||||||
 | 
					            1,
 | 
				
			||||||
 | 
					            Pci
 | 
				
			||||||
 | 
					        );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if (EFI_ERROR(Status)) {
 | 
				
			||||||
 | 
					            DEBUG((EFI_D_INFO, "%a: Failed to read vendor ID: %r\n", __FUNCTION__, Status));
 | 
				
			||||||
 | 
					            continue;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        // Read the entire config header for the device
 | 
				
			||||||
 | 
					        Status = PciRootBridgeIo->Pci.Read(
 | 
				
			||||||
 | 
					            PciRootBridgeIo,
 | 
				
			||||||
 | 
					            EfiPciWidthUint32,
 | 
				
			||||||
 | 
					            Address,
 | 
				
			||||||
 | 
					            sizeof(PCI_TYPE00) / sizeof(UINT32),
 | 
				
			||||||
 | 
					            Pci
 | 
				
			||||||
 | 
					        );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        FreePool(PciIoBuffer);
 | 
				
			||||||
 | 
					        return Status;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    FreePool(PciIoBuffer);
 | 
				
			||||||
 | 
					    return EFI_NOT_FOUND;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/*
 | 
				
			||||||
 | 
					 * Check for Intel device with class [0780] at 00:16.0.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					STATIC
 | 
				
			||||||
 | 
					BOOLEAN
 | 
				
			||||||
 | 
					HasCsmeDevice(VOID)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    PCI_TYPE00 Pci;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if (!EFI_ERROR(PciDevicePresent(&Pci, 0x00, 0x16, 0x00))) {
 | 
				
			||||||
 | 
					        DEBUG((EFI_D_INFO, "%a: vid=0x%04X, class=[%02X,%02X,%02X]\n", __FUNCTION__,
 | 
				
			||||||
 | 
					            Pci.Hdr.VendorId, Pci.Hdr.ClassCode[0], Pci.Hdr.ClassCode[1], Pci.Hdr.ClassCode[2]));
 | 
				
			||||||
 | 
					        return Pci.Hdr.VendorId == 0x8086 &&
 | 
				
			||||||
 | 
					            Pci.Hdr.ClassCode[2] == PCI_CLASS_SCC &&
 | 
				
			||||||
 | 
					            Pci.Hdr.ClassCode[1] == PCI_SUBCLASS_SCC_OTHER;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    return FALSE;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					STATIC VOID FirmwareConfigurationInformation(VOID) {
 | 
				
			||||||
 | 
					    EFI_STRING_ID Token;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    Token = STRING_TOKEN (STR_VIRTUALIZATION);
 | 
				
			||||||
 | 
					    if (StandardSignatureIsGenuineIntel()) {
 | 
				
			||||||
 | 
					        HiiSetString (gFrontPagePrivate.HiiHandle, Token, L"Intel Virtualization", NULL);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        Token = STRING_TOKEN (STR_VIRTUALIZATION_STATUS);
 | 
				
			||||||
 | 
					        CPUID_VERSION_INFO_ECX VersionInfoEcx;
 | 
				
			||||||
 | 
					        AsmCpuid (CPUID_VERSION_INFO, NULL, NULL, &VersionInfoEcx.Uint32, NULL);
 | 
				
			||||||
 | 
					        if (VersionInfoEcx.Bits.VMX) {
 | 
				
			||||||
 | 
					            HiiSetString (gFrontPagePrivate.HiiHandle, Token, L"VT-x: Active", NULL);
 | 
				
			||||||
 | 
					        } else {
 | 
				
			||||||
 | 
					            HiiSetString (gFrontPagePrivate.HiiHandle, Token, L"VT-x: Deactivated", NULL);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        Token = STRING_TOKEN (STR_IOMMU_STATUS);
 | 
				
			||||||
 | 
					        CHAR8 TableName[4] = {'D', 'M', 'A', 'R'};
 | 
				
			||||||
 | 
					        if (FindAcpiTable(TableName)) {
 | 
				
			||||||
 | 
					            HiiSetString (gFrontPagePrivate.HiiHandle, Token, L"VT-d: Active", NULL);
 | 
				
			||||||
 | 
					        } else {
 | 
				
			||||||
 | 
					            HiiSetString (gFrontPagePrivate.HiiHandle, Token, L"VT-d: Deactivated", NULL);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        Token = STRING_TOKEN(STR_ME_STATUS);
 | 
				
			||||||
 | 
					        if (HasCsmeDevice()) {
 | 
				
			||||||
 | 
					            HiiSetString (gFrontPagePrivate.HiiHandle, Token, L"The Intel Management Engine is enabled.", NULL);
 | 
				
			||||||
 | 
					        } else {
 | 
				
			||||||
 | 
					            HiiSetString (gFrontPagePrivate.HiiHandle, Token, L"The Intel Management Engine is disabled at runtime to increase security.", NULL);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    } else if (StandardSignatureIsAuthenticAMD()) {
 | 
				
			||||||
 | 
					        //TODO: verify AMD tests
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        HiiSetString (gFrontPagePrivate.HiiHandle, Token, L"AMD Virtualization", NULL);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        Token = STRING_TOKEN (STR_VIRTUALIZATION_STATUS);
 | 
				
			||||||
 | 
					        CPUID_AMD_EXTENDED_CPU_SIG_ECX AmdExtendedCpuSigEcx;
 | 
				
			||||||
 | 
					        AsmCpuid (CPUID_EXTENDED_CPU_SIG, NULL, NULL, &AmdExtendedCpuSigEcx.Uint32, NULL);
 | 
				
			||||||
 | 
					        if (AmdExtendedCpuSigEcx.Bits.SVM) {
 | 
				
			||||||
 | 
					            HiiSetString (gFrontPagePrivate.HiiHandle, Token, L"AMD-V: Active", NULL);
 | 
				
			||||||
 | 
					        } else {
 | 
				
			||||||
 | 
					            HiiSetString (gFrontPagePrivate.HiiHandle, Token, L"AMD-V: Deactivated", NULL);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        Token = STRING_TOKEN (STR_IOMMU_STATUS);
 | 
				
			||||||
 | 
					        //TODO: proper test for AMD IOMMU
 | 
				
			||||||
 | 
					        BOOLEAN iommu_active = FALSE;
 | 
				
			||||||
 | 
					        if (iommu_active) {
 | 
				
			||||||
 | 
					            HiiSetString (gFrontPagePrivate.HiiHandle, Token, L"AMD-Vi: Active", NULL);
 | 
				
			||||||
 | 
					        } else {
 | 
				
			||||||
 | 
					            HiiSetString (gFrontPagePrivate.HiiHandle, Token, L"AMD-Vi: Deactivated", NULL);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    Token = STRING_TOKEN (STR_TPM_STATUS);
 | 
				
			||||||
 | 
					    CHAR8 TableName[4] = {'T', 'P', 'M', '2'};
 | 
				
			||||||
 | 
					    if (FindAcpiTable(TableName)) {
 | 
				
			||||||
 | 
					        HiiSetString (gFrontPagePrivate.HiiHandle, Token, L"Trusted Platform Module: Active", NULL);
 | 
				
			||||||
 | 
					    } else {
 | 
				
			||||||
 | 
					        HiiSetString (gFrontPagePrivate.HiiHandle, Token, L"Trusted Platform Module: Deactivated", NULL);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					VOID WebcamStatus(VOID) {
 | 
				
			||||||
 | 
					  EFI_STATUS                    Status;
 | 
				
			||||||
 | 
					  UINTN                         UsbIoHandleCount;
 | 
				
			||||||
 | 
					  EFI_HANDLE                    *UsbIoBuffer;
 | 
				
			||||||
 | 
					  UINTN                         Index;
 | 
				
			||||||
 | 
					  EFI_USB_IO_PROTOCOL           *UsbIo;
 | 
				
			||||||
 | 
					  EFI_USB_DEVICE_DESCRIPTOR     DevDesc;
 | 
				
			||||||
 | 
					  EFI_USB_INTERFACE_DESCRIPTOR  IntfDesc;
 | 
				
			||||||
 | 
					  UINTN                         Webcams;
 | 
				
			||||||
 | 
					  EFI_STRING_ID                 Token;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  //
 | 
				
			||||||
 | 
					  // Get all Usb IO handles in system
 | 
				
			||||||
 | 
					  //
 | 
				
			||||||
 | 
					  UsbIoHandleCount = 0;
 | 
				
			||||||
 | 
					  Status = gBS->LocateHandleBuffer (ByProtocol, &gEfiUsbIoProtocolGuid, NULL, &UsbIoHandleCount, &UsbIoBuffer);
 | 
				
			||||||
 | 
					  if (EFI_ERROR(Status)) {
 | 
				
			||||||
 | 
					    DEBUG ((EFI_D_INFO, "Failed to read UsbIo handles: 0x%x\n", Status));
 | 
				
			||||||
 | 
					    return;
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  Webcams = 0;
 | 
				
			||||||
 | 
					  for (Index = 0; Index < UsbIoHandleCount; Index++) {
 | 
				
			||||||
 | 
					    DEBUG ((EFI_D_INFO, "UsbIo Handle %d\n", Index));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    //
 | 
				
			||||||
 | 
					    // Get the child Usb IO interface
 | 
				
			||||||
 | 
					    //
 | 
				
			||||||
 | 
					    Status = gBS->HandleProtocol(
 | 
				
			||||||
 | 
					                     UsbIoBuffer[Index],
 | 
				
			||||||
 | 
					                     &gEfiUsbIoProtocolGuid,
 | 
				
			||||||
 | 
					                     (VOID **) &UsbIo
 | 
				
			||||||
 | 
					                     );
 | 
				
			||||||
 | 
					    if (EFI_ERROR (Status)) {
 | 
				
			||||||
 | 
					      DEBUG ((EFI_D_INFO, "  Failed to find UsbIo protocol\n"));
 | 
				
			||||||
 | 
					      continue;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    Status = UsbIo->UsbGetDeviceDescriptor (UsbIo, &DevDesc);
 | 
				
			||||||
 | 
					    if (EFI_ERROR (Status)) {
 | 
				
			||||||
 | 
					      DEBUG ((EFI_D_INFO, "  Failed to get device descriptor\n"));
 | 
				
			||||||
 | 
					      continue;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    DEBUG ((EFI_D_INFO, "  ID: 0x%04X:0x%04X\n", DevDesc.IdVendor, DevDesc.IdProduct));
 | 
				
			||||||
 | 
					    DEBUG ((EFI_D_INFO, "  DeviceClass: %d\n", DevDesc.DeviceClass));
 | 
				
			||||||
 | 
					    DEBUG ((EFI_D_INFO, "  DeviceSubClass: %d\n", DevDesc.DeviceSubClass));
 | 
				
			||||||
 | 
					    DEBUG ((EFI_D_INFO, "  DeviceProtocol: %d\n", DevDesc.DeviceProtocol));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    Status = UsbIo->UsbGetInterfaceDescriptor (UsbIo, &IntfDesc);
 | 
				
			||||||
 | 
					    if (EFI_ERROR (Status)) {
 | 
				
			||||||
 | 
					      DEBUG ((EFI_D_INFO, "  Failed to get interface descriptor\n"));
 | 
				
			||||||
 | 
					      continue;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    DEBUG ((EFI_D_INFO, "  Interface: %d\n", IntfDesc.InterfaceNumber));
 | 
				
			||||||
 | 
					    DEBUG ((EFI_D_INFO, "  InterfaceClass: %d\n", IntfDesc.InterfaceClass));
 | 
				
			||||||
 | 
					    DEBUG ((EFI_D_INFO, "  InterfaceSubClass: %d\n", IntfDesc.InterfaceSubClass));
 | 
				
			||||||
 | 
					    DEBUG ((EFI_D_INFO, "  InterfaceProtocol: %d\n", IntfDesc.InterfaceProtocol));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if (IntfDesc.InterfaceClass == 14 && IntfDesc.InterfaceSubClass == 1) {
 | 
				
			||||||
 | 
					        DEBUG ((EFI_D_INFO, "  Detected Video Control interface\n"));
 | 
				
			||||||
 | 
					        Webcams++;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  FreePool (UsbIoBuffer);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  //TODO: logic for not showing the warning on desktops
 | 
				
			||||||
 | 
					  Token = STRING_TOKEN (STR_WEBCAM_STATUS);
 | 
				
			||||||
 | 
					  if (Webcams == 0) {
 | 
				
			||||||
 | 
					    HiiSetString (gFrontPagePrivate.HiiHandle, Token, L"Info: Webcam Module Disconnected", NULL);
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -503,154 +1083,86 @@ UpdateFrontPageBannerStrings (
 | 
				
			|||||||
  VOID
 | 
					  VOID
 | 
				
			||||||
  )
 | 
					  )
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  UINT8                             StrIndex;
 | 
					 | 
				
			||||||
  CHAR16                            *NewString;
 | 
					 | 
				
			||||||
  CHAR16                            *FirmwareVersionString;
 | 
					 | 
				
			||||||
  EFI_STATUS                        Status;
 | 
					  EFI_STATUS                        Status;
 | 
				
			||||||
  EFI_SMBIOS_HANDLE                 SmbiosHandle;
 | 
					  EFI_STRING_ID                     TokenToUpdate;
 | 
				
			||||||
  EFI_SMBIOS_PROTOCOL               *Smbios;
 | 
					  EFI_PHYSICAL_ADDRESS              *Table;
 | 
				
			||||||
  SMBIOS_TABLE_TYPE0                *Type0Record;
 | 
					  SMBIOS_TABLE_ENTRY_POINT          *EntryPoint;
 | 
				
			||||||
  SMBIOS_TABLE_TYPE1                *Type1Record;
 | 
					  SMBIOS_STRUCTURE_POINTER          SmbiosTable;
 | 
				
			||||||
  SMBIOS_TABLE_TYPE4                *Type4Record;
 | 
					 | 
				
			||||||
  SMBIOS_TABLE_TYPE19               *Type19Record;
 | 
					 | 
				
			||||||
  EFI_SMBIOS_TABLE_HEADER           *Record;
 | 
					 | 
				
			||||||
  UINT64                            InstalledMemory;
 | 
					 | 
				
			||||||
  BOOLEAN                           FoundCpu;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
  InstalledMemory = 0;
 | 
					  FirmwareConfigurationInformation();
 | 
				
			||||||
  FoundCpu = 0;
 | 
					  WarnNoBootableMedia ();
 | 
				
			||||||
 | 
					  WebcamStatus();
 | 
				
			||||||
  //
 | 
					 | 
				
			||||||
  // Update default banner string.
 | 
					 | 
				
			||||||
  //
 | 
					 | 
				
			||||||
  NewString = HiiGetString (gFrontPagePrivate.HiiHandle, STRING_TOKEN (STR_CUSTOMIZE_BANNER_LINE4_LEFT), NULL);
 | 
					 | 
				
			||||||
  UiCustomizeFrontPageBanner (4, TRUE, &NewString);
 | 
					 | 
				
			||||||
  HiiSetString (gFrontPagePrivate.HiiHandle, STRING_TOKEN (STR_CUSTOMIZE_BANNER_LINE4_LEFT), NewString, NULL);
 | 
					 | 
				
			||||||
  FreePool (NewString);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  NewString = HiiGetString (gFrontPagePrivate.HiiHandle, STRING_TOKEN (STR_CUSTOMIZE_BANNER_LINE4_RIGHT), NULL);
 | 
					 | 
				
			||||||
  UiCustomizeFrontPageBanner (4, FALSE, &NewString);
 | 
					 | 
				
			||||||
  HiiSetString (gFrontPagePrivate.HiiHandle, STRING_TOKEN (STR_CUSTOMIZE_BANNER_LINE4_RIGHT), NewString, NULL);
 | 
					 | 
				
			||||||
  FreePool (NewString);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  NewString = HiiGetString (gFrontPagePrivate.HiiHandle, STRING_TOKEN (STR_CUSTOMIZE_BANNER_LINE5_LEFT), NULL);
 | 
					 | 
				
			||||||
  UiCustomizeFrontPageBanner (5, TRUE, &NewString);
 | 
					 | 
				
			||||||
  HiiSetString (gFrontPagePrivate.HiiHandle, STRING_TOKEN (STR_CUSTOMIZE_BANNER_LINE5_LEFT), NewString, NULL);
 | 
					 | 
				
			||||||
  FreePool (NewString);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  NewString = HiiGetString (gFrontPagePrivate.HiiHandle, STRING_TOKEN (STR_CUSTOMIZE_BANNER_LINE5_RIGHT), NULL);
 | 
					 | 
				
			||||||
  UiCustomizeFrontPageBanner (5, FALSE, &NewString);
 | 
					 | 
				
			||||||
  HiiSetString (gFrontPagePrivate.HiiHandle, STRING_TOKEN (STR_CUSTOMIZE_BANNER_LINE5_RIGHT), NewString, NULL);
 | 
					 | 
				
			||||||
  FreePool (NewString);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  //
 | 
					 | 
				
			||||||
  // Update Front Page banner strings base on SmBios Table.
 | 
					 | 
				
			||||||
  //
 | 
					 | 
				
			||||||
  Status = gBS->LocateProtocol (&gEfiSmbiosProtocolGuid, NULL, (VOID **) &Smbios);
 | 
					 | 
				
			||||||
  if (EFI_ERROR (Status)) {
 | 
					 | 
				
			||||||
    //
 | 
					 | 
				
			||||||
    // Smbios protocol not found, get the default value.
 | 
					 | 
				
			||||||
    //
 | 
					 | 
				
			||||||
    NewString = HiiGetString (gFrontPagePrivate.HiiHandle, STRING_TOKEN (STR_FRONT_PAGE_COMPUTER_MODEL), NULL);
 | 
					 | 
				
			||||||
    UiCustomizeFrontPageBanner (1, TRUE, &NewString);
 | 
					 | 
				
			||||||
    HiiSetString (gFrontPagePrivate.HiiHandle, STRING_TOKEN (STR_FRONT_PAGE_COMPUTER_MODEL), NewString, NULL);
 | 
					 | 
				
			||||||
    FreePool (NewString);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    NewString = HiiGetString (gFrontPagePrivate.HiiHandle, STRING_TOKEN (STR_FRONT_PAGE_CPU_MODEL), NULL);
 | 
					 | 
				
			||||||
    UiCustomizeFrontPageBanner (2, TRUE, &NewString);
 | 
					 | 
				
			||||||
    HiiSetString (gFrontPagePrivate.HiiHandle, STRING_TOKEN (STR_FRONT_PAGE_CPU_MODEL), NewString, NULL);
 | 
					 | 
				
			||||||
    FreePool (NewString);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    NewString = HiiGetString (gFrontPagePrivate.HiiHandle, STRING_TOKEN (STR_FRONT_PAGE_CPU_SPEED), NULL);
 | 
					 | 
				
			||||||
    UiCustomizeFrontPageBanner (2, FALSE, &NewString);
 | 
					 | 
				
			||||||
    HiiSetString (gFrontPagePrivate.HiiHandle, STRING_TOKEN (STR_FRONT_PAGE_CPU_SPEED), NewString, NULL);
 | 
					 | 
				
			||||||
    FreePool (NewString);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    NewString = HiiGetString (gFrontPagePrivate.HiiHandle, STRING_TOKEN (STR_FRONT_PAGE_BIOS_VERSION), NULL);
 | 
					 | 
				
			||||||
    UiCustomizeFrontPageBanner (3, TRUE, &NewString);
 | 
					 | 
				
			||||||
    HiiSetString (gFrontPagePrivate.HiiHandle, STRING_TOKEN (STR_FRONT_PAGE_BIOS_VERSION), NewString, NULL);
 | 
					 | 
				
			||||||
    FreePool (NewString);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    NewString = HiiGetString (gFrontPagePrivate.HiiHandle, STRING_TOKEN (STR_FRONT_PAGE_MEMORY_SIZE), NULL);
 | 
					 | 
				
			||||||
    UiCustomizeFrontPageBanner (3, FALSE, &NewString);
 | 
					 | 
				
			||||||
    HiiSetString (gFrontPagePrivate.HiiHandle, STRING_TOKEN (STR_FRONT_PAGE_MEMORY_SIZE), NewString, NULL);
 | 
					 | 
				
			||||||
    FreePool (NewString);
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  Status = EfiGetSystemConfigurationTable (&gEfiSmbiosTableGuid, (VOID **)  &Table);
 | 
				
			||||||
 | 
					  if (EFI_ERROR (Status) || Table == NULL) {
 | 
				
			||||||
    return;
 | 
					    return;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  SmbiosHandle = SMBIOS_HANDLE_PI_RESERVED;
 | 
					  EntryPoint = (SMBIOS_TABLE_ENTRY_POINT*)Table;
 | 
				
			||||||
  Status = Smbios->GetNext (Smbios, &SmbiosHandle, NULL, &Record, NULL);
 | 
					 | 
				
			||||||
  while (!EFI_ERROR(Status)) {
 | 
					 | 
				
			||||||
    if (Record->Type == SMBIOS_TYPE_BIOS_INFORMATION) {
 | 
					 | 
				
			||||||
      Type0Record = (SMBIOS_TABLE_TYPE0 *) Record;
 | 
					 | 
				
			||||||
      StrIndex = Type0Record->BiosVersion;
 | 
					 | 
				
			||||||
      GetOptionalStringByIndex ((CHAR8*)((UINT8*)Type0Record + Type0Record->Hdr.Length), StrIndex, &NewString);
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
      FirmwareVersionString = (CHAR16 *) PcdGetPtr (PcdFirmwareVersionString);
 | 
					  SmbiosTable = GetSmbiosTableFromType (EntryPoint, EFI_SMBIOS_TYPE_BIOS_INFORMATION , 0);
 | 
				
			||||||
      if (*FirmwareVersionString != 0x0000 ) {
 | 
					  if (SmbiosTable.Raw != NULL) {
 | 
				
			||||||
        FreePool (NewString);
 | 
					    CHAR16 *FwVersion;
 | 
				
			||||||
        NewString = (CHAR16 *) PcdGetPtr (PcdFirmwareVersionString);
 | 
					    CHAR16 *TmpBuffer;
 | 
				
			||||||
        UiCustomizeFrontPageBanner (3, TRUE, &NewString);
 | 
					    UINT8 VersionIdx;
 | 
				
			||||||
        HiiSetString (gFrontPagePrivate.HiiHandle, STRING_TOKEN (STR_FRONT_PAGE_BIOS_VERSION), NewString, NULL);
 | 
					
 | 
				
			||||||
      } else {
 | 
					    TmpBuffer = AllocateZeroPool (0x60);
 | 
				
			||||||
        UiCustomizeFrontPageBanner (3, TRUE, &NewString);
 | 
					
 | 
				
			||||||
        HiiSetString (gFrontPagePrivate.HiiHandle, STRING_TOKEN (STR_FRONT_PAGE_BIOS_VERSION), NewString, NULL);
 | 
					    VersionIdx = SmbiosTable.Type0->BiosVersion;
 | 
				
			||||||
        FreePool (NewString);
 | 
					    GetOptionalStringByIndex ((CHAR8*)((UINT8*)SmbiosTable.Raw + SmbiosTable.Hdr->Length), VersionIdx, &FwVersion);
 | 
				
			||||||
      }
 | 
					
 | 
				
			||||||
 | 
					    StrCatS (TmpBuffer, 0x60 / sizeof (CHAR16), L"Version: ");
 | 
				
			||||||
 | 
					    StrCatS (TmpBuffer, 0x60 / sizeof (CHAR16), FwVersion);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    TokenToUpdate = STRING_TOKEN (STR_FRONT_PAGE_BIOS_VERSION);
 | 
				
			||||||
 | 
					    HiiSetString (gFrontPagePrivate.HiiHandle, TokenToUpdate, TmpBuffer, NULL);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    FreePool (FwVersion);
 | 
				
			||||||
 | 
					    FreePool (TmpBuffer);
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (Record->Type == SMBIOS_TYPE_SYSTEM_INFORMATION) {
 | 
					  SmbiosTable = GetSmbiosTableFromType (EntryPoint, SMBIOS_TYPE_SYSTEM_INFORMATION , 0);
 | 
				
			||||||
      Type1Record = (SMBIOS_TABLE_TYPE1 *) Record;
 | 
					  if (SmbiosTable.Raw != NULL) {
 | 
				
			||||||
      StrIndex = Type1Record->ProductName;
 | 
					    CHAR16 *Manufacturer;
 | 
				
			||||||
      GetOptionalStringByIndex ((CHAR8*)((UINT8*)Type1Record + Type1Record->Hdr.Length), StrIndex, &NewString);
 | 
					    CHAR16 *ProductName;
 | 
				
			||||||
      UiCustomizeFrontPageBanner (1, TRUE, &NewString);
 | 
					    CHAR16 *ProductVersion;
 | 
				
			||||||
      HiiSetString (gFrontPagePrivate.HiiHandle, STRING_TOKEN (STR_FRONT_PAGE_COMPUTER_MODEL), NewString, NULL);
 | 
					    CHAR16 *Title;
 | 
				
			||||||
      FreePool (NewString);
 | 
					    CHAR16 *Model;
 | 
				
			||||||
    }
 | 
					    UINT8 ModelIdx;
 | 
				
			||||||
 | 
					    UINT8 ManIdx;
 | 
				
			||||||
 | 
					    UINT8 VersionIdx;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if ((Record->Type == SMBIOS_TYPE_PROCESSOR_INFORMATION) && !FoundCpu) {
 | 
					    Title = AllocateZeroPool (0x60);
 | 
				
			||||||
      Type4Record = (SMBIOS_TABLE_TYPE4 *) Record;
 | 
					    Model = AllocateZeroPool (0x60);
 | 
				
			||||||
      //
 | 
					 | 
				
			||||||
      // The information in the record should be only valid when the CPU Socket is populated.
 | 
					 | 
				
			||||||
      //
 | 
					 | 
				
			||||||
      if ((Type4Record->Status & SMBIOS_TYPE4_CPU_SOCKET_POPULATED) == SMBIOS_TYPE4_CPU_SOCKET_POPULATED) {
 | 
					 | 
				
			||||||
        StrIndex = Type4Record->ProcessorVersion;
 | 
					 | 
				
			||||||
        GetOptionalStringByIndex ((CHAR8*)((UINT8*)Type4Record + Type4Record->Hdr.Length), StrIndex, &NewString);
 | 
					 | 
				
			||||||
        UiCustomizeFrontPageBanner (2, TRUE, &NewString);
 | 
					 | 
				
			||||||
        HiiSetString (gFrontPagePrivate.HiiHandle, STRING_TOKEN (STR_FRONT_PAGE_CPU_MODEL), NewString, NULL);
 | 
					 | 
				
			||||||
        FreePool (NewString);
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
        ConvertProcessorToString(Type4Record->CurrentSpeed, 6, &NewString);
 | 
					    ManIdx = SmbiosTable.Type1->Manufacturer;
 | 
				
			||||||
        UiCustomizeFrontPageBanner (2, FALSE, &NewString);
 | 
					    ModelIdx = SmbiosTable.Type1->ProductName;
 | 
				
			||||||
        HiiSetString (gFrontPagePrivate.HiiHandle, STRING_TOKEN (STR_FRONT_PAGE_CPU_SPEED), NewString, NULL);
 | 
					 | 
				
			||||||
        FreePool (NewString);
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
        FoundCpu = TRUE;
 | 
					    GetOptionalStringByIndex ((CHAR8*)((UINT8*)SmbiosTable.Raw + SmbiosTable.Hdr->Length), ModelIdx, &ProductName);
 | 
				
			||||||
      }
 | 
					    GetOptionalStringByIndex ((CHAR8*)((UINT8*)SmbiosTable.Raw + SmbiosTable.Hdr->Length), ManIdx, &Manufacturer);
 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if ( Record->Type == SMBIOS_TYPE_MEMORY_ARRAY_MAPPED_ADDRESS ) {
 | 
					    StrCatS (Title, 0x60 / sizeof (CHAR16), Manufacturer);
 | 
				
			||||||
      Type19Record = (SMBIOS_TABLE_TYPE19 *) Record;
 | 
					    StrCatS (Title, 0x60 / sizeof (CHAR16), L" ");
 | 
				
			||||||
      if (Type19Record->StartingAddress != 0xFFFFFFFF ) {
 | 
					    StrCatS (Title, 0x60 / sizeof (CHAR16), ProductName);
 | 
				
			||||||
        InstalledMemory += RShiftU64(Type19Record->EndingAddress -
 | 
					 | 
				
			||||||
                                     Type19Record->StartingAddress + 1, 10);
 | 
					 | 
				
			||||||
      } else {
 | 
					 | 
				
			||||||
        InstalledMemory += RShiftU64(Type19Record->ExtendedEndingAddress -
 | 
					 | 
				
			||||||
                                     Type19Record->ExtendedStartingAddress + 1, 20);
 | 
					 | 
				
			||||||
      }
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    Status = Smbios->GetNext (Smbios, &SmbiosHandle, NULL, &Record, NULL);
 | 
					    TokenToUpdate = STRING_TOKEN (STR_FRONT_PAGE_TITLE);
 | 
				
			||||||
  }
 | 
					    HiiSetString (gFrontPagePrivate.HiiHandle, TokenToUpdate, Title, NULL);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  //
 | 
					    VersionIdx = SmbiosTable.Type1->Version;
 | 
				
			||||||
  // Now update the total installed RAM size
 | 
					    GetOptionalStringByIndex ((CHAR8*)((UINT8*)SmbiosTable.Raw + SmbiosTable.Hdr->Length), VersionIdx, &ProductVersion);
 | 
				
			||||||
  //
 | 
					
 | 
				
			||||||
  ConvertMemorySizeToString ((UINT32)InstalledMemory, &NewString );
 | 
					    StrCatS (Model, 0x60 / sizeof (CHAR16), L"Model: ");
 | 
				
			||||||
  UiCustomizeFrontPageBanner (3, FALSE, &NewString);
 | 
					    StrCatS (Model, 0x60 / sizeof (CHAR16), ProductVersion);
 | 
				
			||||||
  HiiSetString (gFrontPagePrivate.HiiHandle, STRING_TOKEN (STR_FRONT_PAGE_MEMORY_SIZE), NewString, NULL);
 | 
					
 | 
				
			||||||
  FreePool (NewString);
 | 
					    TokenToUpdate = STRING_TOKEN (STR_FRONT_PAGE_COMPUTER_MODEL);
 | 
				
			||||||
 | 
					    HiiSetString (gFrontPagePrivate.HiiHandle, TokenToUpdate, Model, NULL);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    FreePool (Model);
 | 
				
			||||||
 | 
					    FreePool (Title);
 | 
				
			||||||
 | 
					    FreePool (ProductVersion);
 | 
				
			||||||
 | 
					    FreePool (ProductName);
 | 
				
			||||||
 | 
					    FreePool (Manufacturer);
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
@@ -892,6 +1404,8 @@ InitializeUserInterface (
 | 
				
			|||||||
  UINTN                              BootTextColumn;
 | 
					  UINTN                              BootTextColumn;
 | 
				
			||||||
  UINTN                              BootTextRow;
 | 
					  UINTN                              BootTextRow;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  gSystemTable = SystemTable;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  if (!mModeInitialized) {
 | 
					  if (!mModeInitialized) {
 | 
				
			||||||
    //
 | 
					    //
 | 
				
			||||||
    // After the console is ready, get current video resolution
 | 
					    // After the console is ready, get current video resolution
 | 
				
			||||||
@@ -1017,11 +1531,6 @@ UiEntry (
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  FreeFrontPage ();
 | 
					  FreeFrontPage ();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  if (mLanguageString != NULL) {
 | 
					 | 
				
			||||||
    FreePool (mLanguageString);
 | 
					 | 
				
			||||||
    mLanguageString = NULL;
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  //
 | 
					  //
 | 
				
			||||||
  //Will leave browser, check any reset required change is applied? if yes, reset system
 | 
					  //Will leave browser, check any reset required change is applied? if yes, reset system
 | 
				
			||||||
  //
 | 
					  //
 | 
				
			||||||
@@ -1034,10 +1543,6 @@ UiEntry (
 | 
				
			|||||||
//  user change any option setting which needs a reset to be effective, and  the reset will be applied according to  the user selection.
 | 
					//  user change any option setting which needs a reset to be effective, and  the reset will be applied according to  the user selection.
 | 
				
			||||||
//
 | 
					//
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
  Record the info that  a reset is required.
 | 
					  Record the info that  a reset is required.
 | 
				
			||||||
  A  module boolean variable is used to record whether a reset is required.
 | 
					  A  module boolean variable is used to record whether a reset is required.
 | 
				
			||||||
@@ -1052,10 +1557,6 @@ EnableResetRequired (
 | 
				
			|||||||
  mResetRequired = TRUE;
 | 
					  mResetRequired = TRUE;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
  Check if  user changed any option setting which needs a system reset to be effective.
 | 
					  Check if  user changed any option setting which needs a system reset to be effective.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -1110,4 +1611,3 @@ SetupResetReminder (
 | 
				
			|||||||
    gRT->ResetSystem (EfiResetCold, EFI_SUCCESS, 0, NULL);
 | 
					    gRT->ResetSystem (EfiResetCold, EFI_SUCCESS, 0, NULL);
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					 | 
				
			||||||
 
 | 
				
			|||||||
@@ -32,9 +32,11 @@ extern EFI_FORM_BROWSER2_PROTOCOL      *gFormBrowser2;
 | 
				
			|||||||
//
 | 
					//
 | 
				
			||||||
// These are defined as the same with vfr file
 | 
					// These are defined as the same with vfr file
 | 
				
			||||||
//
 | 
					//
 | 
				
			||||||
#define FRONT_PAGE_FORM_ID             0x1000
 | 
					#define FRONT_PAGE_FORM_ID             0x7600
 | 
				
			||||||
 | 
					#define FIRMWARE_INFO_FORM_ID          0x7601
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define LABEL_FRANTPAGE_INFORMATION    0x1000
 | 
					#define LABEL_FRONTPAGE_INFORMATION    0x1000
 | 
				
			||||||
 | 
					#define LABEL_DEVICES_LIST             0x2000
 | 
				
			||||||
#define LABEL_END                      0xffff
 | 
					#define LABEL_END                      0xffff
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define FRONT_PAGE_FORMSET_GUID \
 | 
					#define FRONT_PAGE_FORMSET_GUID \
 | 
				
			||||||
@@ -52,7 +54,6 @@ typedef struct {
 | 
				
			|||||||
  //
 | 
					  //
 | 
				
			||||||
  EFI_HII_HANDLE                  HiiHandle;
 | 
					  EFI_HII_HANDLE                  HiiHandle;
 | 
				
			||||||
  EFI_HANDLE                      DriverHandle;
 | 
					  EFI_HANDLE                      DriverHandle;
 | 
				
			||||||
  EFI_STRING_ID                   *LanguageToken;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
  //
 | 
					  //
 | 
				
			||||||
  // Produced protocols
 | 
					  // Produced protocols
 | 
				
			||||||
@@ -210,4 +211,3 @@ ExtractDevicePathFromHiiHandle (
 | 
				
			|||||||
  );
 | 
					  );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#endif // _FRONT_PAGE_H_
 | 
					#endif // _FRONT_PAGE_H_
 | 
				
			||||||
 | 
					 | 
				
			||||||
 
 | 
				
			|||||||
@@ -29,35 +29,15 @@ UiCustomizeFrontPage (
 | 
				
			|||||||
  IN VOID            *StartOpCodeHandle
 | 
					  IN VOID            *StartOpCodeHandle
 | 
				
			||||||
  )
 | 
					  )
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  //
 | 
					 | 
				
			||||||
  // Create "Select Language" menu with Oneof opcode.
 | 
					 | 
				
			||||||
  //
 | 
					 | 
				
			||||||
  UiCreateLanguageMenu (HiiHandle, StartOpCodeHandle);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  //
 | 
					 | 
				
			||||||
  // Create empty line.
 | 
					 | 
				
			||||||
  //
 | 
					 | 
				
			||||||
  UiCreateEmptyLine(HiiHandle, StartOpCodeHandle);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  //
 | 
					 | 
				
			||||||
  // Find third party drivers which need to be shown in the front page.
 | 
					 | 
				
			||||||
  //
 | 
					 | 
				
			||||||
  UiListThirdPartyDrivers (HiiHandle, &gEfiIfrFrontPageGuid, NULL, StartOpCodeHandle);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  //
 | 
					 | 
				
			||||||
  // Create empty line.
 | 
					 | 
				
			||||||
  //
 | 
					 | 
				
			||||||
  UiCreateEmptyLine(HiiHandle, StartOpCodeHandle);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  //
 | 
					  //
 | 
				
			||||||
  // Create "Continue" menu.
 | 
					  // Create "Continue" menu.
 | 
				
			||||||
  //
 | 
					  //
 | 
				
			||||||
  UiCreateContinueMenu(HiiHandle, StartOpCodeHandle);
 | 
					  UiCreateContinueMenu(HiiHandle, StartOpCodeHandle);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  //
 | 
					  //
 | 
				
			||||||
  // Create reset menu.
 | 
					  // Find third party drivers which need to be shown in the front page.
 | 
				
			||||||
  //
 | 
					  //
 | 
				
			||||||
  UiCreateResetMenu(HiiHandle, StartOpCodeHandle);
 | 
					  UiListThirdPartyDrivers (HiiHandle, &gEfiIfrFrontPageGuid, NULL, StartOpCodeHandle);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
@@ -96,44 +76,3 @@ UiFrontPageCallbackHandler (
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  return EFI_UNSUPPORTED;
 | 
					  return EFI_UNSUPPORTED;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					 | 
				
			||||||
/**
 | 
					 | 
				
			||||||
  Update the banner string in the front page.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  Current layout for the banner string like below:
 | 
					 | 
				
			||||||
  PS: Totally only 5 lines of banner supported.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  Line 1: Left BannerStr                           RightBannerStr
 | 
					 | 
				
			||||||
  Line 2: Left BannerStr                           RightBannerStr
 | 
					 | 
				
			||||||
  Line 3: Left BannerStr                           RightBannerStr
 | 
					 | 
				
			||||||
  Line 4: Left BannerStr                           RightBannerStr
 | 
					 | 
				
			||||||
  Line 5: Left BannerStr                           RightBannerStr
 | 
					 | 
				
			||||||
  <EmptyLine>
 | 
					 | 
				
			||||||
  First menu in front page.
 | 
					 | 
				
			||||||
  ...
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  @param  LineIndex         The line index of the banner need to check.
 | 
					 | 
				
			||||||
  @param  LeftOrRight       The left or right banner need to check.
 | 
					 | 
				
			||||||
  @param  BannerStr         Banner string need to update.
 | 
					 | 
				
			||||||
                            Input the current string and user can update
 | 
					 | 
				
			||||||
                            it and return the new string.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
**/
 | 
					 | 
				
			||||||
VOID
 | 
					 | 
				
			||||||
UiCustomizeFrontPageBanner (
 | 
					 | 
				
			||||||
  IN     UINTN          LineIndex,
 | 
					 | 
				
			||||||
  IN     BOOLEAN        LeftOrRight,
 | 
					 | 
				
			||||||
  IN OUT EFI_STRING     *BannerStr
 | 
					 | 
				
			||||||
  )
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
  if ((LineIndex == 5) && LeftOrRight) {
 | 
					 | 
				
			||||||
    // Update STR_CUSTOMIZE_BANNER_LINE5_LEFT
 | 
					 | 
				
			||||||
    if (PcdGetBool(PcdTestKeyUsed)) {
 | 
					 | 
				
			||||||
      if (BannerStr != NULL) {
 | 
					 | 
				
			||||||
        FreePool(*BannerStr);
 | 
					 | 
				
			||||||
      }
 | 
					 | 
				
			||||||
      *BannerStr = HiiGetString(gFrontPagePrivate.HiiHandle, STRING_TOKEN(STR_TEST_KEY_USED), NULL);
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
  return;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 
 | 
				
			|||||||
@@ -9,35 +9,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 | 
				
			|||||||
#ifndef __FRONTPAGE_CUSTOMIZED_UI_H__
 | 
					#ifndef __FRONTPAGE_CUSTOMIZED_UI_H__
 | 
				
			||||||
#define __FRONTPAGE_CUSTOMIZED_UI_H__
 | 
					#define __FRONTPAGE_CUSTOMIZED_UI_H__
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					 | 
				
			||||||
  Update the banner string in the front page.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  Current layout for the banner string like below:
 | 
					 | 
				
			||||||
  PS: Totally only 5 lines of banner supported.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  Line 1: Left BannerStr                           RightBannerStr
 | 
					 | 
				
			||||||
  Line 2: Left BannerStr                           RightBannerStr
 | 
					 | 
				
			||||||
  Line 3: Left BannerStr                           RightBannerStr
 | 
					 | 
				
			||||||
  Line 4: Left BannerStr                           RightBannerStr
 | 
					 | 
				
			||||||
  Line 5: Left BannerStr                           RightBannerStr
 | 
					 | 
				
			||||||
  <EmptyLine>
 | 
					 | 
				
			||||||
  First menu in front page.
 | 
					 | 
				
			||||||
  ...
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  @param  LineIndex         The line index of the banner need to check.
 | 
					 | 
				
			||||||
  @param  LeftOrRight       The left or right banner need to check.
 | 
					 | 
				
			||||||
  @param  BannerStr         Banner string need to update.
 | 
					 | 
				
			||||||
                            Input the current string and user can update
 | 
					 | 
				
			||||||
                            it and return the new string.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
**/
 | 
					 | 
				
			||||||
VOID
 | 
					 | 
				
			||||||
UiCustomizeFrontPageBanner (
 | 
					 | 
				
			||||||
  IN     UINTN          LineIndex,
 | 
					 | 
				
			||||||
  IN     BOOLEAN        LeftOrRight,
 | 
					 | 
				
			||||||
  IN OUT EFI_STRING     *BannerStr
 | 
					 | 
				
			||||||
  );
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
  Customize menus in the page.
 | 
					  Customize menus in the page.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -35,8 +35,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 | 
				
			|||||||
#define UI_HII_DRIVER_LIST_SIZE               0x8
 | 
					#define UI_HII_DRIVER_LIST_SIZE               0x8
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define FRONT_PAGE_KEY_CONTINUE               0x1000
 | 
					#define FRONT_PAGE_KEY_CONTINUE               0x1000
 | 
				
			||||||
#define FRONT_PAGE_KEY_RESET                  0x1001
 | 
					 | 
				
			||||||
#define FRONT_PAGE_KEY_LANGUAGE               0x1002
 | 
					 | 
				
			||||||
#define FRONT_PAGE_KEY_DRIVER                 0x2000
 | 
					#define FRONT_PAGE_KEY_DRIVER                 0x2000
 | 
				
			||||||
 | 
					
 | 
				
			||||||
typedef struct {
 | 
					typedef struct {
 | 
				
			||||||
@@ -47,112 +45,10 @@ typedef struct {
 | 
				
			|||||||
  BOOLEAN         EmptyLineAfter;
 | 
					  BOOLEAN         EmptyLineAfter;
 | 
				
			||||||
} UI_HII_DRIVER_INSTANCE;
 | 
					} UI_HII_DRIVER_INSTANCE;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
CHAR8                        *gLanguageString;
 | 
					 | 
				
			||||||
EFI_STRING_ID                *gLanguageToken;
 | 
					 | 
				
			||||||
UI_HII_DRIVER_INSTANCE       *gHiiDriverList;
 | 
					UI_HII_DRIVER_INSTANCE       *gHiiDriverList;
 | 
				
			||||||
extern EFI_HII_HANDLE        gStringPackHandle;
 | 
					extern EFI_HII_HANDLE        gStringPackHandle;
 | 
				
			||||||
UINT8                        gCurrentLanguageIndex;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					 | 
				
			||||||
  Get next language from language code list (with separator ';').
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  If LangCode is NULL, then ASSERT.
 | 
					 | 
				
			||||||
  If Lang is NULL, then ASSERT.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  @param  LangCode    On input: point to first language in the list. On
 | 
					 | 
				
			||||||
                                 output: point to next language in the list, or
 | 
					 | 
				
			||||||
                                 NULL if no more language in the list.
 | 
					 | 
				
			||||||
  @param  Lang           The first language in the list.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
**/
 | 
					 | 
				
			||||||
VOID
 | 
					 | 
				
			||||||
GetNextLanguage (
 | 
					 | 
				
			||||||
  IN OUT CHAR8      **LangCode,
 | 
					 | 
				
			||||||
  OUT CHAR8         *Lang
 | 
					 | 
				
			||||||
  )
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
  UINTN  Index;
 | 
					 | 
				
			||||||
  CHAR8  *StringPtr;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  ASSERT (LangCode != NULL);
 | 
					 | 
				
			||||||
  ASSERT (*LangCode != NULL);
 | 
					 | 
				
			||||||
  ASSERT (Lang != NULL);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  Index = 0;
 | 
					 | 
				
			||||||
  StringPtr = *LangCode;
 | 
					 | 
				
			||||||
  while (StringPtr[Index] != 0 && StringPtr[Index] != ';') {
 | 
					 | 
				
			||||||
    Index++;
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  CopyMem (Lang, StringPtr, Index);
 | 
					 | 
				
			||||||
  Lang[Index] = 0;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  if (StringPtr[Index] == ';') {
 | 
					 | 
				
			||||||
    Index++;
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
  *LangCode = StringPtr + Index;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/**
 | 
					 | 
				
			||||||
  This function processes the language changes in configuration.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  @param Value           A pointer to the data being sent to the original exporting driver.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  @retval  TRUE          The callback successfully handled the action.
 | 
					 | 
				
			||||||
  @retval  FALSE         The callback not supported in this handler.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
**/
 | 
					 | 
				
			||||||
EFI_STATUS
 | 
					 | 
				
			||||||
LanguageChangeHandler (
 | 
					 | 
				
			||||||
  IN  EFI_IFR_TYPE_VALUE                     *Value
 | 
					 | 
				
			||||||
  )
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
  CHAR8                         *LangCode;
 | 
					 | 
				
			||||||
  CHAR8                         *Lang;
 | 
					 | 
				
			||||||
  UINTN                         Index;
 | 
					 | 
				
			||||||
  EFI_STATUS                    Status;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  //
 | 
					 | 
				
			||||||
  // Allocate working buffer for RFC 4646 language in supported LanguageString.
 | 
					 | 
				
			||||||
  //
 | 
					 | 
				
			||||||
  Lang = AllocatePool (AsciiStrSize (gLanguageString));
 | 
					 | 
				
			||||||
  ASSERT (Lang != NULL);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  Index = 0;
 | 
					 | 
				
			||||||
  LangCode = gLanguageString;
 | 
					 | 
				
			||||||
  while (*LangCode != 0) {
 | 
					 | 
				
			||||||
    GetNextLanguage (&LangCode, Lang);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    if (Index == Value->u8) {
 | 
					 | 
				
			||||||
      gCurrentLanguageIndex = Value->u8;
 | 
					 | 
				
			||||||
      break;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    Index++;
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  if (Index == Value->u8) {
 | 
					 | 
				
			||||||
    Status = gRT->SetVariable (
 | 
					 | 
				
			||||||
                    L"PlatformLang",
 | 
					 | 
				
			||||||
                    &gEfiGlobalVariableGuid,
 | 
					 | 
				
			||||||
                    EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,
 | 
					 | 
				
			||||||
                    AsciiStrSize (Lang),
 | 
					 | 
				
			||||||
                    Lang
 | 
					 | 
				
			||||||
                    );
 | 
					 | 
				
			||||||
    if (EFI_ERROR (Status)) {
 | 
					 | 
				
			||||||
      FreePool (Lang);
 | 
					 | 
				
			||||||
      return EFI_DEVICE_ERROR;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
  } else {
 | 
					 | 
				
			||||||
    ASSERT (FALSE);
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
  FreePool (Lang);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  return EFI_SUCCESS;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
  This function processes the results of changes in configuration.
 | 
					  This function processes the results of changes in configuration.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -181,19 +77,12 @@ UiSupportLibCallbackHandler (
 | 
				
			|||||||
  OUT EFI_STATUS                             *Status
 | 
					  OUT EFI_STATUS                             *Status
 | 
				
			||||||
  )
 | 
					  )
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  if (QuestionId != FRONT_PAGE_KEY_CONTINUE &&
 | 
					  if (QuestionId != FRONT_PAGE_KEY_CONTINUE) {
 | 
				
			||||||
      QuestionId != FRONT_PAGE_KEY_RESET &&
 | 
					 | 
				
			||||||
      QuestionId != FRONT_PAGE_KEY_LANGUAGE) {
 | 
					 | 
				
			||||||
    return FALSE;
 | 
					    return FALSE;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  if (Action == EFI_BROWSER_ACTION_RETRIEVE) {
 | 
					  if (Action == EFI_BROWSER_ACTION_RETRIEVE) {
 | 
				
			||||||
    if (QuestionId == FRONT_PAGE_KEY_LANGUAGE) {
 | 
					 | 
				
			||||||
      Value->u8 = gCurrentLanguageIndex;
 | 
					 | 
				
			||||||
      *Status = EFI_SUCCESS;
 | 
					 | 
				
			||||||
    } else {
 | 
					 | 
				
			||||||
    *Status = EFI_UNSUPPORTED;
 | 
					    *Status = EFI_UNSUPPORTED;
 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
    return TRUE;
 | 
					    return TRUE;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -220,17 +109,6 @@ UiSupportLibCallbackHandler (
 | 
				
			|||||||
      *ActionRequest = EFI_BROWSER_ACTION_REQUEST_EXIT;
 | 
					      *ActionRequest = EFI_BROWSER_ACTION_REQUEST_EXIT;
 | 
				
			||||||
      break;
 | 
					      break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    case FRONT_PAGE_KEY_LANGUAGE:
 | 
					 | 
				
			||||||
      *Status = LanguageChangeHandler(Value);
 | 
					 | 
				
			||||||
      break;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    case FRONT_PAGE_KEY_RESET:
 | 
					 | 
				
			||||||
      //
 | 
					 | 
				
			||||||
      // Reset
 | 
					 | 
				
			||||||
      //
 | 
					 | 
				
			||||||
      gRT->ResetSystem (EfiResetCold, EFI_SUCCESS, 0, NULL);
 | 
					 | 
				
			||||||
      *Status = EFI_UNSUPPORTED;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    default:
 | 
					    default:
 | 
				
			||||||
      break;
 | 
					      break;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
@@ -239,156 +117,6 @@ UiSupportLibCallbackHandler (
 | 
				
			|||||||
  return TRUE;
 | 
					  return TRUE;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					 | 
				
			||||||
  Create Select language menu in the front page with oneof opcode.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  @param[in]    HiiHandle           The hii handle for the Uiapp driver.
 | 
					 | 
				
			||||||
  @param[in]    StartOpCodeHandle   The opcode handle to save the new opcode.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
**/
 | 
					 | 
				
			||||||
VOID
 | 
					 | 
				
			||||||
UiCreateLanguageMenu (
 | 
					 | 
				
			||||||
  IN EFI_HII_HANDLE              HiiHandle,
 | 
					 | 
				
			||||||
  IN VOID                        *StartOpCodeHandle
 | 
					 | 
				
			||||||
  )
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
  CHAR8                       *LangCode;
 | 
					 | 
				
			||||||
  CHAR8                       *Lang;
 | 
					 | 
				
			||||||
  UINTN                       LangSize;
 | 
					 | 
				
			||||||
  CHAR8                       *CurrentLang;
 | 
					 | 
				
			||||||
  UINTN                       OptionCount;
 | 
					 | 
				
			||||||
  CHAR16                      *StringBuffer;
 | 
					 | 
				
			||||||
  VOID                        *OptionsOpCodeHandle;
 | 
					 | 
				
			||||||
  UINTN                       StringSize;
 | 
					 | 
				
			||||||
  EFI_STATUS                  Status;
 | 
					 | 
				
			||||||
  EFI_HII_STRING_PROTOCOL     *HiiString;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  Lang         = NULL;
 | 
					 | 
				
			||||||
  StringBuffer = NULL;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  //
 | 
					 | 
				
			||||||
  // Init OpCode Handle and Allocate space for creation of UpdateData Buffer
 | 
					 | 
				
			||||||
  //
 | 
					 | 
				
			||||||
  OptionsOpCodeHandle = HiiAllocateOpCodeHandle ();
 | 
					 | 
				
			||||||
  ASSERT (OptionsOpCodeHandle != NULL);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  GetEfiGlobalVariable2 (L"PlatformLang", (VOID**)&CurrentLang, NULL);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  //
 | 
					 | 
				
			||||||
  // Get Support language list from variable.
 | 
					 | 
				
			||||||
  //
 | 
					 | 
				
			||||||
  GetEfiGlobalVariable2 (L"PlatformLangCodes", (VOID**)&gLanguageString, NULL);
 | 
					 | 
				
			||||||
  if (gLanguageString == NULL) {
 | 
					 | 
				
			||||||
    gLanguageString = AllocateCopyPool (
 | 
					 | 
				
			||||||
                               AsciiStrSize ((CHAR8 *) PcdGetPtr (PcdUefiVariableDefaultPlatformLangCodes)),
 | 
					 | 
				
			||||||
                               (CHAR8 *) PcdGetPtr (PcdUefiVariableDefaultPlatformLangCodes)
 | 
					 | 
				
			||||||
                               );
 | 
					 | 
				
			||||||
    ASSERT (gLanguageString != NULL);
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  if (gLanguageToken == NULL) {
 | 
					 | 
				
			||||||
    //
 | 
					 | 
				
			||||||
    // Count the language list number.
 | 
					 | 
				
			||||||
    //
 | 
					 | 
				
			||||||
    LangCode = gLanguageString;
 | 
					 | 
				
			||||||
    Lang = AllocatePool (AsciiStrSize (gLanguageString));
 | 
					 | 
				
			||||||
    ASSERT (Lang != NULL);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    OptionCount = 0;
 | 
					 | 
				
			||||||
    while (*LangCode != 0) {
 | 
					 | 
				
			||||||
      GetNextLanguage (&LangCode, Lang);
 | 
					 | 
				
			||||||
      OptionCount ++;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    //
 | 
					 | 
				
			||||||
    // Allocate extra 1 as the end tag.
 | 
					 | 
				
			||||||
    //
 | 
					 | 
				
			||||||
    gLanguageToken = AllocateZeroPool ((OptionCount + 1) * sizeof (EFI_STRING_ID));
 | 
					 | 
				
			||||||
    ASSERT (gLanguageToken != NULL);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    Status = gBS->LocateProtocol (&gEfiHiiStringProtocolGuid, NULL, (VOID **) &HiiString);
 | 
					 | 
				
			||||||
    ASSERT_EFI_ERROR (Status);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    LangCode     = gLanguageString;
 | 
					 | 
				
			||||||
    OptionCount  = 0;
 | 
					 | 
				
			||||||
    while (*LangCode != 0) {
 | 
					 | 
				
			||||||
      GetNextLanguage (&LangCode, Lang);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      StringSize = 0;
 | 
					 | 
				
			||||||
      Status = HiiString->GetString (HiiString, Lang, HiiHandle, PRINTABLE_LANGUAGE_NAME_STRING_ID, StringBuffer, &StringSize, NULL);
 | 
					 | 
				
			||||||
      if (Status == EFI_BUFFER_TOO_SMALL) {
 | 
					 | 
				
			||||||
        StringBuffer = AllocateZeroPool (StringSize);
 | 
					 | 
				
			||||||
        ASSERT (StringBuffer != NULL);
 | 
					 | 
				
			||||||
        Status = HiiString->GetString (HiiString, Lang, HiiHandle, PRINTABLE_LANGUAGE_NAME_STRING_ID, StringBuffer, &StringSize, NULL);
 | 
					 | 
				
			||||||
        ASSERT_EFI_ERROR (Status);
 | 
					 | 
				
			||||||
      }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      if (EFI_ERROR (Status)) {
 | 
					 | 
				
			||||||
        LangSize = AsciiStrSize (Lang);
 | 
					 | 
				
			||||||
        StringBuffer = AllocatePool (LangSize * sizeof (CHAR16));
 | 
					 | 
				
			||||||
        ASSERT (StringBuffer != NULL);
 | 
					 | 
				
			||||||
        AsciiStrToUnicodeStrS (Lang, StringBuffer, LangSize);
 | 
					 | 
				
			||||||
      }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      ASSERT (StringBuffer != NULL);
 | 
					 | 
				
			||||||
      gLanguageToken[OptionCount] = HiiSetString (HiiHandle, 0, StringBuffer, NULL);
 | 
					 | 
				
			||||||
      FreePool (StringBuffer);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      OptionCount++;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  ASSERT (gLanguageToken != NULL);
 | 
					 | 
				
			||||||
  LangCode = gLanguageString;
 | 
					 | 
				
			||||||
  OptionCount = 0;
 | 
					 | 
				
			||||||
  if (Lang == NULL) {
 | 
					 | 
				
			||||||
    Lang = AllocatePool (AsciiStrSize (gLanguageString));
 | 
					 | 
				
			||||||
    ASSERT (Lang != NULL);
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
  while (*LangCode != 0) {
 | 
					 | 
				
			||||||
    GetNextLanguage (&LangCode, Lang);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    if (CurrentLang != NULL && AsciiStrCmp (Lang, CurrentLang) == 0) {
 | 
					 | 
				
			||||||
      HiiCreateOneOfOptionOpCode (
 | 
					 | 
				
			||||||
        OptionsOpCodeHandle,
 | 
					 | 
				
			||||||
        gLanguageToken[OptionCount],
 | 
					 | 
				
			||||||
        EFI_IFR_OPTION_DEFAULT,
 | 
					 | 
				
			||||||
        EFI_IFR_NUMERIC_SIZE_1,
 | 
					 | 
				
			||||||
        (UINT8) OptionCount
 | 
					 | 
				
			||||||
        );
 | 
					 | 
				
			||||||
      gCurrentLanguageIndex = (UINT8) OptionCount;
 | 
					 | 
				
			||||||
    } else {
 | 
					 | 
				
			||||||
      HiiCreateOneOfOptionOpCode (
 | 
					 | 
				
			||||||
        OptionsOpCodeHandle,
 | 
					 | 
				
			||||||
        gLanguageToken[OptionCount],
 | 
					 | 
				
			||||||
        0,
 | 
					 | 
				
			||||||
        EFI_IFR_NUMERIC_SIZE_1,
 | 
					 | 
				
			||||||
        (UINT8) OptionCount
 | 
					 | 
				
			||||||
        );
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    OptionCount++;
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  if (CurrentLang != NULL) {
 | 
					 | 
				
			||||||
    FreePool (CurrentLang);
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
  FreePool (Lang);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  HiiCreateOneOfOpCode (
 | 
					 | 
				
			||||||
    StartOpCodeHandle,
 | 
					 | 
				
			||||||
    FRONT_PAGE_KEY_LANGUAGE,
 | 
					 | 
				
			||||||
    0,
 | 
					 | 
				
			||||||
    0,
 | 
					 | 
				
			||||||
    STRING_TOKEN (STR_LANGUAGE_SELECT),
 | 
					 | 
				
			||||||
    STRING_TOKEN (STR_LANGUAGE_SELECT_HELP),
 | 
					 | 
				
			||||||
    EFI_IFR_FLAG_CALLBACK,
 | 
					 | 
				
			||||||
    EFI_IFR_NUMERIC_SIZE_1,
 | 
					 | 
				
			||||||
    OptionsOpCodeHandle,
 | 
					 | 
				
			||||||
    NULL
 | 
					 | 
				
			||||||
    );
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
  Create continue menu in the front page.
 | 
					  Create continue menu in the front page.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -405,8 +133,8 @@ UiCreateContinueMenu (
 | 
				
			|||||||
  HiiCreateActionOpCode (
 | 
					  HiiCreateActionOpCode (
 | 
				
			||||||
    StartOpCodeHandle,
 | 
					    StartOpCodeHandle,
 | 
				
			||||||
    FRONT_PAGE_KEY_CONTINUE,
 | 
					    FRONT_PAGE_KEY_CONTINUE,
 | 
				
			||||||
    STRING_TOKEN (STR_CONTINUE_PROMPT),
 | 
					    STRING_TOKEN (STR_BOOT_DEFAULT_PROMPT),
 | 
				
			||||||
    STRING_TOKEN (STR_CONTINUE_PROMPT),
 | 
					    STRING_TOKEN (STR_BOOT_DEFAULT_HELP),
 | 
				
			||||||
    EFI_IFR_FLAG_CALLBACK,
 | 
					    EFI_IFR_FLAG_CALLBACK,
 | 
				
			||||||
    0
 | 
					    0
 | 
				
			||||||
    );
 | 
					    );
 | 
				
			||||||
@@ -425,30 +153,7 @@ UiCreateEmptyLine (
 | 
				
			|||||||
  IN VOID                        *StartOpCodeHandle
 | 
					  IN VOID                        *StartOpCodeHandle
 | 
				
			||||||
  )
 | 
					  )
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  HiiCreateSubTitleOpCode (StartOpCodeHandle, STRING_TOKEN (STR_NULL_STRING), 0, 0, 0);
 | 
					  HiiCreateSubTitleOpCode (StartOpCodeHandle, STRING_TOKEN (STR_EMPTY_STRING), 0, 0, 0);
 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/**
 | 
					 | 
				
			||||||
  Create Reset menu in the front page.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  @param[in]    HiiHandle           The hii handle for the Uiapp driver.
 | 
					 | 
				
			||||||
  @param[in]    StartOpCodeHandle   The opcode handle to save the new opcode.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
**/
 | 
					 | 
				
			||||||
VOID
 | 
					 | 
				
			||||||
UiCreateResetMenu (
 | 
					 | 
				
			||||||
  IN EFI_HII_HANDLE              HiiHandle,
 | 
					 | 
				
			||||||
  IN VOID                        *StartOpCodeHandle
 | 
					 | 
				
			||||||
  )
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
  HiiCreateActionOpCode (
 | 
					 | 
				
			||||||
    StartOpCodeHandle,
 | 
					 | 
				
			||||||
    FRONT_PAGE_KEY_RESET,
 | 
					 | 
				
			||||||
    STRING_TOKEN (STR_RESET_STRING),
 | 
					 | 
				
			||||||
    STRING_TOKEN (STR_RESET_STRING),
 | 
					 | 
				
			||||||
    EFI_IFR_FLAG_CALLBACK,
 | 
					 | 
				
			||||||
    0
 | 
					 | 
				
			||||||
    );
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -35,32 +35,6 @@ UiCreateEmptyLine (
 | 
				
			|||||||
  IN VOID                        *StartOpCodeHandle
 | 
					  IN VOID                        *StartOpCodeHandle
 | 
				
			||||||
  );
 | 
					  );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					 | 
				
			||||||
  Create Select language menu in the front page with oneof opcode.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  @param[in]    HiiHandle           The hii handle for the Uiapp driver.
 | 
					 | 
				
			||||||
  @param[in]    StartOpCodeHandle   The opcode handle to save the new opcode.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
**/
 | 
					 | 
				
			||||||
VOID
 | 
					 | 
				
			||||||
UiCreateLanguageMenu (
 | 
					 | 
				
			||||||
  IN EFI_HII_HANDLE              HiiHandle,
 | 
					 | 
				
			||||||
  IN VOID                        *StartOpCodeHandle
 | 
					 | 
				
			||||||
  );
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/**
 | 
					 | 
				
			||||||
  Create Reset menu.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  @param[in]    HiiHandle           The hii handle for the Uiapp driver.
 | 
					 | 
				
			||||||
  @param[in]    StartOpCodeHandle   The opcode handle to save the new opcode.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
**/
 | 
					 | 
				
			||||||
VOID
 | 
					 | 
				
			||||||
UiCreateResetMenu (
 | 
					 | 
				
			||||||
  IN EFI_HII_HANDLE              HiiHandle,
 | 
					 | 
				
			||||||
  IN VOID                        *StartOpCodeHandle
 | 
					 | 
				
			||||||
  );
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
  Rename the driver name if necessary.
 | 
					  Rename the driver name if necessary.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -10,59 +10,19 @@
 | 
				
			|||||||
/=#
 | 
					/=#
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#langdef   en-US "English"
 | 
					#langdef   en-US "English"
 | 
				
			||||||
#langdef   fr-FR "Français"
 | 
					 | 
				
			||||||
#langdef   en    "Standard English"
 | 
					 | 
				
			||||||
#langdef   fr    "Standard Français"
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
#string STR_FRONT_PAGE_TITLE           #language en-US  "Front Page"
 | 
					#string STR_FRONT_PAGE_TITLE           #language en-US  "Front Page"
 | 
				
			||||||
                                       #language fr-FR  "Front Page"
 | 
					#string STR_FRONT_PAGE_COMPUTER_MODEL  #language en-US  "<model>"
 | 
				
			||||||
#string STR_FRONT_PAGE_COMPUTER_MODEL  #language en-US  ""
 | 
					#string STR_FRONT_PAGE_BIOS_VERSION    #language en-US  "<bios>"
 | 
				
			||||||
                                       #language fr-FR  ""
 | 
					#string STR_FIRMWARE_INFO              #language en-US  "Firmware Configuration Information"
 | 
				
			||||||
#string STR_FRONT_PAGE_CPU_MODEL       #language en-US  ""
 | 
					#string STR_BOOT_DEFAULT_PROMPT        #language en-US  "Boot Default"
 | 
				
			||||||
                                       #language fr-FR  ""
 | 
					#string STR_BOOT_DEFAULT_HELP          #language en-US  "Boot the default entry"
 | 
				
			||||||
#string STR_FRONT_PAGE_CPU_SPEED       #language en-US  ""
 | 
					 | 
				
			||||||
                                       #language fr-FR  ""
 | 
					 | 
				
			||||||
#string STR_FRONT_PAGE_MEMORY_SIZE     #language en-US  ""
 | 
					 | 
				
			||||||
                                       #language fr-FR  ""
 | 
					 | 
				
			||||||
#string STR_FRONT_PAGE_BIOS_VERSION    #language en-US  ""
 | 
					 | 
				
			||||||
                                       #language fr-FR  ""
 | 
					 | 
				
			||||||
#string STR_FRONT_PAGE_BANNER_0_LEFT   #language en-US  "Wonder Computer Model 1000Z  Manufactured by Intel®"
 | 
					 | 
				
			||||||
                                       #language fr-FR  "Demander le Modèle d'Ordinateur 1000Z A Fabriqué par Intel®"
 | 
					 | 
				
			||||||
#string STR_FRONT_PAGE_BANNER_0_RIGHT  #language en-US  "OK"
 | 
					 | 
				
			||||||
                                       #language fr-FR  "Bon"
 | 
					 | 
				
			||||||
#string STR_FRONT_PAGE_BANNER_1_LEFT   #language en-US  "2 Pentium® X Xeon processors running at 800Thz"
 | 
					 | 
				
			||||||
                                       #language fr-FR  "2 processeurs Pentium® X Xeon tournants à 800Thz"
 | 
					 | 
				
			||||||
#string STR_FRONT_PAGE_BANNER_1_RIGHT  #language en-US  "24 TB System RAM"
 | 
					 | 
				
			||||||
                                       #language fr-FR  "24 TB RAM de Système"
 | 
					 | 
				
			||||||
#string STR_FRONT_PAGE_BANNER_2_LEFT   #language en-US  "ACME® EFI BIOS Version 13.5 Release 1039.92"
 | 
					 | 
				
			||||||
                                       #language fr-FR  "ACME® EFI BIOS Version 13.5 Release 1039.92"
 | 
					 | 
				
			||||||
#string STR_FRONT_PAGE_BANNER_3_LEFT   #language en-US  "Serial Number: 1Z123456789MARMAR (Need SMBIOS entries)"
 | 
					 | 
				
			||||||
                                       #language fr-FR  "Numéro de série: 1Z123456789MARMAR (Les entrées de SMBIOS de besoin)"
 | 
					 | 
				
			||||||
#string STR_CONTINUE_PROMPT            #language en-US  "Continue"
 | 
					 | 
				
			||||||
                                       #language fr-FR  "Continuer"
 | 
					 | 
				
			||||||
#string STR_CONTINUE_HELP              #language en-US  "This selection will direct the system to continue to booting process"
 | 
					 | 
				
			||||||
                                       #language fr-FR  "Cette sélection dirigera le système pour continuer au processus d'amorçage"
 | 
					 | 
				
			||||||
#string STR_LANGUAGE_SELECT            #language en-US  "Select Language"
 | 
					 | 
				
			||||||
                                       #language fr-FR  "Choisir la Langue"
 | 
					 | 
				
			||||||
#string STR_LANGUAGE_SELECT_HELP       #language en-US  "This is the option one adjusts to change the language for the current system"
 | 
					 | 
				
			||||||
                                       #language fr-FR  "Ceci est l'option qu'on ajuste pour changer la langue pour le système actuel"
 | 
					 | 
				
			||||||
#string STR_MISSING_STRING             #language en-US  "Missing String"
 | 
					#string STR_MISSING_STRING             #language en-US  "Missing String"
 | 
				
			||||||
                                       #language fr-FR  "Missing String"
 | 
					#string STR_NO_BOOTABLE_MEDIA          #language en-US  ""
 | 
				
			||||||
 | 
					#string STR_WEBCAM_STATUS              #language en-US  ""
 | 
				
			||||||
#string STR_EMPTY_STRING               #language en-US  ""
 | 
					#string STR_EMPTY_STRING               #language en-US  ""
 | 
				
			||||||
                                       #language fr-FR  ""
 | 
					#string STR_VIRTUALIZATION             #language en-US  ""
 | 
				
			||||||
#string STR_RESET_STRING               #language en-US  "Reset"
 | 
					#string STR_VIRTUALIZATION_STATUS      #language en-US  ""
 | 
				
			||||||
                                       #language fr-FR  "Reset"
 | 
					#string STR_IOMMU_STATUS               #language en-US  ""
 | 
				
			||||||
#string STR_RESET_STRING_HELP          #language en-US  "Reset the current setting."
 | 
					#string STR_TPM_STATUS                 #language en-US  ""
 | 
				
			||||||
                                       #language fr-FR  "Reset the current setting."
 | 
					#string STR_ME_STATUS                  #language en-US  ""
 | 
				
			||||||
#string STR_CUSTOMIZE_BANNER_LINE4_LEFT  #language en-US  ""
 | 
					 | 
				
			||||||
                                         #language fr-FR  ""
 | 
					 | 
				
			||||||
#string STR_CUSTOMIZE_BANNER_LINE4_RIGHT #language en-US  ""
 | 
					 | 
				
			||||||
                                         #language fr-FR  ""
 | 
					 | 
				
			||||||
#string STR_CUSTOMIZE_BANNER_LINE5_LEFT  #language en-US  ""
 | 
					 | 
				
			||||||
                                         #language fr-FR  ""
 | 
					 | 
				
			||||||
#string STR_CUSTOMIZE_BANNER_LINE5_RIGHT #language en-US  ""
 | 
					 | 
				
			||||||
                                         #language fr-FR  ""
 | 
					 | 
				
			||||||
#string STR_TEST_KEY_USED                #language en-US  "WARNING: Test key detected."
 | 
					 | 
				
			||||||
                                         #language fr-FR  "WARNING: Test key detected."
 | 
					 | 
				
			||||||
#string STR_NULL_STRING                #language en-US  " "
 | 
					 | 
				
			||||||
                                       #language fr-FR  " "
 | 
					 | 
				
			||||||
 
 | 
				
			|||||||
@@ -9,9 +9,11 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
#define FORMSET_GUID  { 0x9e0c30bc, 0x3f06, 0x4ba6, 0x82, 0x88, 0x9, 0x17, 0x9b, 0x85, 0x5d, 0xbe }
 | 
					#define FORMSET_GUID  { 0x9e0c30bc, 0x3f06, 0x4ba6, 0x82, 0x88, 0x9, 0x17, 0x9b, 0x85, 0x5d, 0xbe }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define FRONT_PAGE_FORM_ID             0x1000
 | 
					#define FRONT_PAGE_FORM_ID             0x7600
 | 
				
			||||||
 | 
					#define FIRMWARE_INFO_FORM_ID          0x7601
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define LABEL_FRANTPAGE_INFORMATION    0x1000
 | 
					#define LABEL_FRONTPAGE_INFORMATION    0x1000
 | 
				
			||||||
 | 
					#define LABEL_DEVICES_LIST             0x2000
 | 
				
			||||||
#define LABEL_END                      0xffff
 | 
					#define LABEL_END                      0xffff
 | 
				
			||||||
 | 
					
 | 
				
			||||||
formset
 | 
					formset
 | 
				
			||||||
@@ -23,58 +25,45 @@ formset
 | 
				
			|||||||
  form formid = FRONT_PAGE_FORM_ID,
 | 
					  form formid = FRONT_PAGE_FORM_ID,
 | 
				
			||||||
    title  = STRING_TOKEN(STR_FRONT_PAGE_TITLE);
 | 
					    title  = STRING_TOKEN(STR_FRONT_PAGE_TITLE);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    banner
 | 
					    subtitle text = STRING_TOKEN(STR_FRONT_PAGE_COMPUTER_MODEL);
 | 
				
			||||||
      title = STRING_TOKEN(STR_FRONT_PAGE_COMPUTER_MODEL),
 | 
					    subtitle text = STRING_TOKEN(STR_FRONT_PAGE_BIOS_VERSION);
 | 
				
			||||||
      line  1,
 | 
					    subtitle text = STRING_TOKEN(STR_EMPTY_STRING);
 | 
				
			||||||
      align left;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    banner
 | 
					    label LABEL_FRONTPAGE_INFORMATION;
 | 
				
			||||||
      title = STRING_TOKEN(STR_FRONT_PAGE_CPU_MODEL),
 | 
					 | 
				
			||||||
      line  2,
 | 
					 | 
				
			||||||
      align left;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    banner
 | 
					 | 
				
			||||||
      title = STRING_TOKEN(STR_FRONT_PAGE_CPU_SPEED),
 | 
					 | 
				
			||||||
      line  2,
 | 
					 | 
				
			||||||
      align right;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    banner
 | 
					 | 
				
			||||||
      title = STRING_TOKEN(STR_FRONT_PAGE_BIOS_VERSION),
 | 
					 | 
				
			||||||
      line  3,
 | 
					 | 
				
			||||||
      align left;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    banner
 | 
					 | 
				
			||||||
      title = STRING_TOKEN(STR_FRONT_PAGE_MEMORY_SIZE),
 | 
					 | 
				
			||||||
      line  3,
 | 
					 | 
				
			||||||
      align right;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    banner
 | 
					 | 
				
			||||||
      title = STRING_TOKEN(STR_CUSTOMIZE_BANNER_LINE4_LEFT),
 | 
					 | 
				
			||||||
      line  4,
 | 
					 | 
				
			||||||
      align left;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    banner
 | 
					 | 
				
			||||||
      title = STRING_TOKEN(STR_CUSTOMIZE_BANNER_LINE4_RIGHT),
 | 
					 | 
				
			||||||
      line  4,
 | 
					 | 
				
			||||||
      align right;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    banner
 | 
					 | 
				
			||||||
      title = STRING_TOKEN(STR_CUSTOMIZE_BANNER_LINE5_LEFT),
 | 
					 | 
				
			||||||
      line  5,
 | 
					 | 
				
			||||||
      align left;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    banner
 | 
					 | 
				
			||||||
      title = STRING_TOKEN(STR_CUSTOMIZE_BANNER_LINE5_RIGHT),
 | 
					 | 
				
			||||||
      line  5,
 | 
					 | 
				
			||||||
      align right;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    label LABEL_FRANTPAGE_INFORMATION;
 | 
					 | 
				
			||||||
    //
 | 
					    //
 | 
				
			||||||
    // This is where we will dynamically add a Action type op-code to show
 | 
					    // This is where we will dynamically add a Action type op-code to show
 | 
				
			||||||
    // the platform information.
 | 
					    // the platform information.
 | 
				
			||||||
    //
 | 
					    //
 | 
				
			||||||
    label LABEL_END;
 | 
					    label LABEL_END;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    subtitle text = STRING_TOKEN(STR_EMPTY_STRING);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    label LABEL_DEVICES_LIST;
 | 
				
			||||||
 | 
					    label LABEL_END;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    subtitle text = STRING_TOKEN(STR_EMPTY_STRING);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    goto FIRMWARE_INFO_FORM_ID,
 | 
				
			||||||
 | 
					      prompt = STRING_TOKEN(STR_FIRMWARE_INFO),
 | 
				
			||||||
 | 
					      help = STRING_TOKEN(STR_EMPTY_STRING);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    subtitle text = STRING_TOKEN(STR_EMPTY_STRING);
 | 
				
			||||||
 | 
					    subtitle text = STRING_TOKEN(STR_NO_BOOTABLE_MEDIA);
 | 
				
			||||||
 | 
					    subtitle text = STRING_TOKEN(STR_WEBCAM_STATUS);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  endform;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  form formid = FIRMWARE_INFO_FORM_ID,
 | 
				
			||||||
 | 
					    title = STRING_TOKEN(STR_FIRMWARE_INFO);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    subtitle text = STRING_TOKEN(STR_VIRTUALIZATION);
 | 
				
			||||||
 | 
					    subtitle text = STRING_TOKEN(STR_VIRTUALIZATION_STATUS);
 | 
				
			||||||
 | 
					    subtitle text = STRING_TOKEN(STR_IOMMU_STATUS);
 | 
				
			||||||
 | 
					    subtitle text = STRING_TOKEN(STR_EMPTY_STRING);
 | 
				
			||||||
 | 
					    subtitle text = STRING_TOKEN(STR_TPM_STATUS);
 | 
				
			||||||
 | 
					    subtitle text = STRING_TOKEN(STR_EMPTY_STRING);
 | 
				
			||||||
 | 
					    subtitle text = STRING_TOKEN(STR_ME_STATUS);
 | 
				
			||||||
 | 
					    subtitle text = STRING_TOKEN(STR_EMPTY_STRING);
 | 
				
			||||||
  endform;
 | 
					  endform;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
endformset;
 | 
					endformset;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -56,8 +56,11 @@
 | 
				
			|||||||
  UefiBootManagerLib
 | 
					  UefiBootManagerLib
 | 
				
			||||||
 | 
					
 | 
				
			||||||
[Guids]
 | 
					[Guids]
 | 
				
			||||||
 | 
					  gEfiAcpiTableGuid                             ## CONSUMES ## GUID
 | 
				
			||||||
  gEfiIfrTianoGuid                              ## CONSUMES ## GUID (Extended IFR Guid Opcode)
 | 
					  gEfiIfrTianoGuid                              ## CONSUMES ## GUID (Extended IFR Guid Opcode)
 | 
				
			||||||
  gEfiIfrFrontPageGuid                          ## CONSUMES ## GUID
 | 
					  gEfiIfrFrontPageGuid                          ## CONSUMES ## GUID
 | 
				
			||||||
 | 
					  gEfiSmbiosTableGuid                           ## CONSUMES ## GUID
 | 
				
			||||||
 | 
					  gEfiHiiPlatformSetupFormsetGuid               ## CONSUMES ## GUID
 | 
				
			||||||
 | 
					
 | 
				
			||||||
[Protocols]
 | 
					[Protocols]
 | 
				
			||||||
  gEfiSmbiosProtocolGuid                        ## CONSUMES
 | 
					  gEfiSmbiosProtocolGuid                        ## CONSUMES
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1709,13 +1709,7 @@ InitKeyboard (
 | 
				
			|||||||
    //
 | 
					    //
 | 
				
			||||||
    // wait for BAT completion code
 | 
					    // wait for BAT completion code
 | 
				
			||||||
    //
 | 
					    //
 | 
				
			||||||
    mWaitForValueTimeOut  = KEYBOARD_BAT_TIMEOUT;
 | 
					    KeyboardWaitForValue (ConsoleIn, KEYBOARD_8048_RETURN_8042_BAT_SUCCESS);
 | 
				
			||||||
 | 
					 | 
				
			||||||
    Status                = KeyboardWaitForValue (ConsoleIn, KEYBOARD_8048_RETURN_8042_BAT_SUCCESS);
 | 
					 | 
				
			||||||
    if (EFI_ERROR (Status)) {
 | 
					 | 
				
			||||||
      KeyboardError (ConsoleIn, L"Keyboard self test failed!\n\r");
 | 
					 | 
				
			||||||
      goto Done;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    mWaitForValueTimeOut = KEYBOARD_WAITFORVALUE_TIMEOUT;
 | 
					    mWaitForValueTimeOut = KEYBOARD_WAITFORVALUE_TIMEOUT;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -2551,10 +2551,12 @@ PciEnumeratorLight (
 | 
				
			|||||||
      //
 | 
					      //
 | 
				
			||||||
      RemoveRejectedPciDevices (RootBridgeDev->Handle, RootBridgeDev);
 | 
					      RemoveRejectedPciDevices (RootBridgeDev->Handle, RootBridgeDev);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      if (!PcdGetBool (PcdPciDisableBusEnumeration)) {
 | 
				
			||||||
        //
 | 
					        //
 | 
				
			||||||
        // Process option rom light
 | 
					        // Process option rom light
 | 
				
			||||||
        //
 | 
					        //
 | 
				
			||||||
        ProcessOptionRomLight (RootBridgeDev);
 | 
					        ProcessOptionRomLight (RootBridgeDev);
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      //
 | 
					      //
 | 
				
			||||||
      // Determine attributes for all devices under this root bridge
 | 
					      // Determine attributes for all devices under this root bridge
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -521,16 +521,35 @@ EmmcTuningClkForHs200 (
 | 
				
			|||||||
  if (EFI_ERROR (Status)) {
 | 
					  if (EFI_ERROR (Status)) {
 | 
				
			||||||
    return Status;
 | 
					    return Status;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  if(BhtHostPciSupport(PciIo)) {
 | 
				
			||||||
 | 
					    //set data transfer with 4bit
 | 
				
			||||||
 | 
					    Status = SdMmcHcSetBusWidth (PciIo, Slot, 4);
 | 
				
			||||||
 | 
					    //enable hardware tuning
 | 
				
			||||||
 | 
					    HostCtrl2 = (UINT8)(~0x10);
 | 
				
			||||||
 | 
					    Status = SdMmcHcAndMmio (PciIo, Slot, 0x110,sizeof (HostCtrl2), &HostCtrl2);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    Status = EmmcSendTuningBlk (PassThru, Slot, 4);
 | 
				
			||||||
 | 
					    if (EFI_ERROR (Status)) {
 | 
				
			||||||
 | 
					      DEBUG ((DEBUG_ERROR, "EmmcTuningClkForHs200: Send tuning block fails with %r\n", Status));
 | 
				
			||||||
 | 
					      return Status;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  //
 | 
					  //
 | 
				
			||||||
  // Ask the device to send a sequence of tuning blocks till the tuning procedure is done.
 | 
					  // Ask the device to send a sequence of tuning blocks till the tuning procedure is done.
 | 
				
			||||||
  //
 | 
					  //
 | 
				
			||||||
  Retry = 0;
 | 
					  Retry = 0;
 | 
				
			||||||
  do {
 | 
					  do {
 | 
				
			||||||
 | 
					    if(!BhtHostPciSupport(PciIo)) {
 | 
				
			||||||
      Status = EmmcSendTuningBlk (PassThru, Slot, BusWidth);
 | 
					      Status = EmmcSendTuningBlk (PassThru, Slot, BusWidth);
 | 
				
			||||||
      if (EFI_ERROR (Status)) {
 | 
					      if (EFI_ERROR (Status)) {
 | 
				
			||||||
        DEBUG ((DEBUG_ERROR, "EmmcTuningClkForHs200: Send tuning block fails with %r\n", Status));
 | 
					        DEBUG ((DEBUG_ERROR, "EmmcTuningClkForHs200: Send tuning block fails with %r\n", Status));
 | 
				
			||||||
        return Status;
 | 
					        return Status;
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
 | 
					    } else {
 | 
				
			||||||
 | 
					      gBS->Stall(5000);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    Status = SdMmcHcRwMmio (PciIo, Slot, SD_MMC_HC_HOST_CTRL2, TRUE, sizeof (HostCtrl2), &HostCtrl2);
 | 
					    Status = SdMmcHcRwMmio (PciIo, Slot, SD_MMC_HC_HOST_CTRL2, TRUE, sizeof (HostCtrl2), &HostCtrl2);
 | 
				
			||||||
    if (EFI_ERROR (Status)) {
 | 
					    if (EFI_ERROR (Status)) {
 | 
				
			||||||
@@ -542,6 +561,10 @@ EmmcTuningClkForHs200 (
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if ((HostCtrl2 & (BIT6 | BIT7)) == BIT7) {
 | 
					    if ((HostCtrl2 & (BIT6 | BIT7)) == BIT7) {
 | 
				
			||||||
 | 
					      if(BhtHostPciSupport(PciIo)) {
 | 
				
			||||||
 | 
					        //set data transfer with default
 | 
				
			||||||
 | 
					        Status = SdMmcHcSetBusWidth (PciIo, Slot, BusWidth);
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
      return EFI_SUCCESS;
 | 
					      return EFI_SUCCESS;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
  } while (++Retry < 40);
 | 
					  } while (++Retry < 40);
 | 
				
			||||||
@@ -874,10 +897,54 @@ EmmcSwitchToHS200 (
 | 
				
			|||||||
    return Status;
 | 
					    return Status;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  if (BhtHostPciSupport(PciIo)){
 | 
				
			||||||
 | 
					    BusMode->BusTiming = SdMmcMmcHs200;
 | 
				
			||||||
 | 
					    Status = EmmcSwitchBusTiming (PciIo, PassThru, Slot, Rca, BusMode->DriverStrength, 
 | 
				
			||||||
 | 
					                BusMode->BusTiming, BusMode->ClockFreq);
 | 
				
			||||||
 | 
					    if (EFI_ERROR (Status)) {
 | 
				
			||||||
 | 
					      return Status;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    Status = SdMmcHcWaitMmioSet (
 | 
				
			||||||
 | 
					        PciIo,
 | 
				
			||||||
 | 
					        Slot,
 | 
				
			||||||
 | 
					        0x1cc,
 | 
				
			||||||
 | 
					        sizeof (Rca),
 | 
				
			||||||
 | 
					        BIT14,
 | 
				
			||||||
 | 
					        BIT14,
 | 
				
			||||||
 | 
					        SD_MMC_HC_GENERIC_TIMEOUT
 | 
				
			||||||
 | 
					      );
 | 
				
			||||||
 | 
					    if (EFI_ERROR (Status)) {
 | 
				
			||||||
 | 
					      return Status;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    //Wait 2nd Card Detect debounce Finished by wait twice of debounce max time
 | 
				
			||||||
 | 
					    UINT32 value32;
 | 
				
			||||||
 | 
					    while (1) {
 | 
				
			||||||
 | 
						  Status = SdMmcHcRwMmio (PciIo, Slot, SD_MMC_HC_PRESENT_STATE, TRUE, sizeof(value32), &value32);
 | 
				
			||||||
 | 
					  	  if (((value32 >> 18) & 0x01) == ((value32 >> 16) & 0x01)) {
 | 
				
			||||||
 | 
						      break;
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    Status = SdMmcHcWaitMmioSet (
 | 
				
			||||||
 | 
					        PciIo,
 | 
				
			||||||
 | 
					        Slot,
 | 
				
			||||||
 | 
					        0x1cc,
 | 
				
			||||||
 | 
					        sizeof (Rca),
 | 
				
			||||||
 | 
					        BIT11,
 | 
				
			||||||
 | 
					        BIT11,
 | 
				
			||||||
 | 
					        SD_MMC_CLOCK_STABLE_TIMEOUT
 | 
				
			||||||
 | 
					        );
 | 
				
			||||||
 | 
					    if (EFI_ERROR(Status)) {
 | 
				
			||||||
 | 
					      return Status;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					  } else {
 | 
				
			||||||
    Status = EmmcSwitchBusTiming (PciIo, PassThru, Slot, Rca, BusMode->DriverStrength, BusMode->BusTiming, BusMode->ClockFreq);
 | 
					    Status = EmmcSwitchBusTiming (PciIo, PassThru, Slot, Rca, BusMode->DriverStrength, BusMode->BusTiming, BusMode->ClockFreq);
 | 
				
			||||||
    if (EFI_ERROR (Status)) {
 | 
					    if (EFI_ERROR (Status)) {
 | 
				
			||||||
      return Status;
 | 
					      return Status;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  Status = EmmcTuningClkForHs200 (PciIo, PassThru, Slot, BusMode->BusWidth);
 | 
					  Status = EmmcTuningClkForHs200 (PciIo, PassThru, Slot, BusMode->BusWidth);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -1263,10 +1330,89 @@ EmmcSetBusMode (
 | 
				
			|||||||
  DEBUG ((DEBUG_INFO, "EmmcSetBusMode: Target bus mode: timing = %d, width = %d, clock freq = %d, driver strength = %d\n",
 | 
					  DEBUG ((DEBUG_INFO, "EmmcSetBusMode: Target bus mode: timing = %d, width = %d, clock freq = %d, driver strength = %d\n",
 | 
				
			||||||
                          BusMode.BusTiming, BusMode.BusWidth, BusMode.ClockFreq, BusMode.DriverStrength.Emmc));
 | 
					                          BusMode.BusTiming, BusMode.BusWidth, BusMode.ClockFreq, BusMode.DriverStrength.Emmc));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  if (BhtHostPciSupport(PciIo)) {
 | 
				
			||||||
 | 
					    UINT8	EmmcVar;
 | 
				
			||||||
 | 
					    UINTN 	EmmcVarSize;
 | 
				
			||||||
 | 
					    Status = gRT->GetVariable (
 | 
				
			||||||
 | 
					                 L"EMMC_FORCE_CARD_MODE",
 | 
				
			||||||
 | 
					                 &gEfiGenericVariableGuid,
 | 
				
			||||||
 | 
					                 NULL,
 | 
				
			||||||
 | 
					                 &EmmcVarSize,
 | 
				
			||||||
 | 
					                 &EmmcVar
 | 
				
			||||||
 | 
					               );
 | 
				
			||||||
 | 
					    if (!EFI_ERROR(Status) && EmmcVar <= 2) {
 | 
				
			||||||
 | 
					      if (EmmcVar == 2) {
 | 
				
			||||||
 | 
					        BusMode.BusTiming  = SdMmcMmcHs200;
 | 
				
			||||||
 | 
					        BusMode.ClockFreq = 200;
 | 
				
			||||||
 | 
					      } else if (EmmcVar == 1) {
 | 
				
			||||||
 | 
					        BusMode.BusTiming	= SdMmcMmcHs200;
 | 
				
			||||||
 | 
					        BusMode.ClockFreq = 100;
 | 
				
			||||||
 | 
					      } else {
 | 
				
			||||||
 | 
					        BusMode.BusTiming  = SdMmcMmcHsSdr;
 | 
				
			||||||
 | 
					        BusMode.ClockFreq = 52;
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
 | 
					    } else {
 | 
				
			||||||
 | 
					      BusMode.BusTiming  = SdMmcMmcHsSdr;
 | 
				
			||||||
 | 
					      BusMode.ClockFreq = 52;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  if (BusMode.BusTiming == SdMmcMmcHs400) {
 | 
					  if (BusMode.BusTiming == SdMmcMmcHs400) {
 | 
				
			||||||
 | 
					    //
 | 
				
			||||||
 | 
					    // Execute HS400 timing switch procedure
 | 
				
			||||||
 | 
					    //
 | 
				
			||||||
    Status = EmmcSwitchToHS400 (PciIo, PassThru, Slot, Rca, &BusMode);
 | 
					    Status = EmmcSwitchToHS400 (PciIo, PassThru, Slot, Rca, &BusMode);
 | 
				
			||||||
  } else if (BusMode.BusTiming == SdMmcMmcHs200) {
 | 
					  } else if (BusMode.BusTiming == SdMmcMmcHs200) {
 | 
				
			||||||
 | 
					    //
 | 
				
			||||||
 | 
					    // Execute HS200 timing switch procedure
 | 
				
			||||||
 | 
					    //
 | 
				
			||||||
    Status = EmmcSwitchToHS200 (PciIo, PassThru, Slot, Rca, &BusMode);
 | 
					    Status = EmmcSwitchToHS200 (PciIo, PassThru, Slot, Rca, &BusMode);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if (EFI_ERROR(Status)) {
 | 
				
			||||||
 | 
					      if (BhtHostPciSupport(PciIo)) {
 | 
				
			||||||
 | 
					        UINT32 val32;
 | 
				
			||||||
 | 
					        UINT16	EmmcVar;
 | 
				
			||||||
 | 
					        UINTN 	EmmcVarSize;
 | 
				
			||||||
 | 
					#if !defined(HS100_ALLPASS_PHASE) || HS100_ALLPASS_PHASE > 10 || HS100_ALLPASS_PHASE < 0
 | 
				
			||||||
 | 
					#error "HS100_ALLPASS_PHASE is undefined or value is invalid"
 | 
				
			||||||
 | 
					#else
 | 
				
			||||||
 | 
					        val32 = PciBhtRead32(PciIo, 0x300);
 | 
				
			||||||
 | 
					        val32 &= 0xFF0FFFFF;
 | 
				
			||||||
 | 
					        EmmcVarSize = sizeof(EmmcVar);
 | 
				
			||||||
 | 
					        Status = gRT->GetVariable (
 | 
				
			||||||
 | 
					                  L"EMMC_HS100_ALLPASS_PHASE",
 | 
				
			||||||
 | 
					                  &gEfiGenericVariableGuid,
 | 
				
			||||||
 | 
					                  NULL,
 | 
				
			||||||
 | 
					                  &EmmcVarSize,
 | 
				
			||||||
 | 
					                  &EmmcVar
 | 
				
			||||||
 | 
					                );
 | 
				
			||||||
 | 
					        if (EFI_ERROR(Status) || EmmcVar > 10)
 | 
				
			||||||
 | 
					          EmmcVar = HS100_ALLPASS_PHASE;
 | 
				
			||||||
 | 
					        val32 |= (EmmcVar << 20);
 | 
				
			||||||
 | 
					        PciBhtWrite32(PciIo, 0x300, 0x21000033 | val32);
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					        BusMode.ClockFreq = 100;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        SdMmcHcRwMmio (PciIo, Slot, 0x3C, TRUE, sizeof(val32), &val32);
 | 
				
			||||||
 | 
					        val32 &= ~BIT22;
 | 
				
			||||||
 | 
					        SdMmcHcRwMmio (PciIo, Slot, 0x3C, FALSE, sizeof(val32), &val32);
 | 
				
			||||||
 | 
					        val32 = (BIT26 | BIT25);
 | 
				
			||||||
 | 
					        SdMmcHcOrMmio (PciIo, Slot, 0x2C, sizeof(val32), &val32);
 | 
				
			||||||
 | 
					      
 | 
				
			||||||
 | 
					        Status = EmmcSwitchToHS200 (PciIo, PassThru, Slot, Rca, &BusMode);
 | 
				
			||||||
 | 
					        if (EFI_ERROR(Status)) {
 | 
				
			||||||
 | 
					          if (((ExtCsd.DeviceType & BIT1)  != 0) && (Private->Capability[Slot].HighSpeed != 0)) {
 | 
				
			||||||
 | 
					            BusMode.BusTiming  = SdMmcMmcHsSdr;
 | 
				
			||||||
 | 
					            BusMode.ClockFreq = 52;
 | 
				
			||||||
 | 
					            Status = EmmcSwitchToHighSpeed (PciIo, PassThru, Slot, Rca, &BusMode);
 | 
				
			||||||
 | 
					          } else if (((ExtCsd.DeviceType & BIT0)  != 0) && (Private->Capability[Slot].HighSpeed != 0)) {
 | 
				
			||||||
 | 
					            BusMode.BusTiming  = SdMmcMmcHsSdr;
 | 
				
			||||||
 | 
					            BusMode.ClockFreq = 26;
 | 
				
			||||||
 | 
					            Status = EmmcSwitchToHighSpeed (PciIo, PassThru, Slot, Rca, &BusMode);
 | 
				
			||||||
 | 
					          }
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
  } else {
 | 
					  } else {
 | 
				
			||||||
    //
 | 
					    //
 | 
				
			||||||
    // Note that EmmcSwitchToHighSpeed is also called for SdMmcMmcLegacy
 | 
					    // Note that EmmcSwitchToHighSpeed is also called for SdMmcMmcLegacy
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -305,6 +305,13 @@ SdMmcPciHcEnumerateDevice (
 | 
				
			|||||||
          continue;
 | 
					          continue;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if (BhtHostPciSupport(Private->PciIo)) {
 | 
				
			||||||
 | 
					          Status = SdMmcHcGetCapability (Private->PciIo, Slot, &Private->Capability[Slot]);
 | 
				
			||||||
 | 
					          if (EFI_ERROR (Status)) {
 | 
				
			||||||
 | 
					            continue;
 | 
				
			||||||
 | 
					          }
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        Private->Slot[Slot].MediaPresent = TRUE;
 | 
					        Private->Slot[Slot].MediaPresent = TRUE;
 | 
				
			||||||
        Private->Slot[Slot].Initialized  = TRUE;
 | 
					        Private->Slot[Slot].Initialized  = TRUE;
 | 
				
			||||||
        RoutineNum = sizeof (mCardTypeDetectRoutineTable) / sizeof (CARD_TYPE_DETECT_ROUTINE);
 | 
					        RoutineNum = sizeof (mCardTypeDetectRoutineTable) / sizeof (CARD_TYPE_DETECT_ROUTINE);
 | 
				
			||||||
@@ -321,6 +328,7 @@ SdMmcPciHcEnumerateDevice (
 | 
				
			|||||||
        // This card doesn't get initialized correctly.
 | 
					        // This card doesn't get initialized correctly.
 | 
				
			||||||
        //
 | 
					        //
 | 
				
			||||||
        if (Index == RoutineNum) {
 | 
					        if (Index == RoutineNum) {
 | 
				
			||||||
 | 
					          DEBUG ((DEBUG_INFO, "Load driver failure\n"));
 | 
				
			||||||
          Private->Slot[Slot].Initialized = FALSE;
 | 
					          Private->Slot[Slot].Initialized = FALSE;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -541,6 +549,8 @@ SdMmcPciHcDriverBindingStart (
 | 
				
			|||||||
  UINT32                          RoutineNum;
 | 
					  UINT32                          RoutineNum;
 | 
				
			||||||
  BOOLEAN                         MediaPresent;
 | 
					  BOOLEAN                         MediaPresent;
 | 
				
			||||||
  BOOLEAN                         Support64BitDma;
 | 
					  BOOLEAN                         Support64BitDma;
 | 
				
			||||||
 | 
					  UINT16                          IntStatus;
 | 
				
			||||||
 | 
					  UINT32                          value;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  DEBUG ((DEBUG_INFO, "SdMmcPciHcDriverBindingStart: Start\n"));
 | 
					  DEBUG ((DEBUG_INFO, "SdMmcPciHcDriverBindingStart: Start\n"));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -735,6 +745,13 @@ SdMmcPciHcDriverBindingStart (
 | 
				
			|||||||
      continue;
 | 
					      continue;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if (BhtHostPciSupport(PciIo)) {
 | 
				
			||||||
 | 
					      Status = SdMmcHcGetCapability (PciIo, Slot, &Private->Capability[Slot]);
 | 
				
			||||||
 | 
					        if (EFI_ERROR (Status)) {
 | 
				
			||||||
 | 
					          continue;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    Private->Slot[Slot].MediaPresent = TRUE;
 | 
					    Private->Slot[Slot].MediaPresent = TRUE;
 | 
				
			||||||
    Private->Slot[Slot].Initialized  = TRUE;
 | 
					    Private->Slot[Slot].Initialized  = TRUE;
 | 
				
			||||||
    RoutineNum = sizeof (mCardTypeDetectRoutineTable) / sizeof (CARD_TYPE_DETECT_ROUTINE);
 | 
					    RoutineNum = sizeof (mCardTypeDetectRoutineTable) / sizeof (CARD_TYPE_DETECT_ROUTINE);
 | 
				
			||||||
@@ -751,9 +768,25 @@ SdMmcPciHcDriverBindingStart (
 | 
				
			|||||||
    // This card doesn't get initialized correctly.
 | 
					    // This card doesn't get initialized correctly.
 | 
				
			||||||
    //
 | 
					    //
 | 
				
			||||||
    if (Index == RoutineNum) {
 | 
					    if (Index == RoutineNum) {
 | 
				
			||||||
 | 
					      DEBUG ((DEBUG_INFO, "Load driver failure\n"));
 | 
				
			||||||
      Private->Slot[Slot].Initialized = FALSE;
 | 
					      Private->Slot[Slot].Initialized = FALSE;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					  if (BhtHostPciSupport(Private->PciIo)) {
 | 
				
			||||||
 | 
					    SdMmcHcRwMmio (Private->PciIo,0,0x110,TRUE,sizeof (value),&value);
 | 
				
			||||||
 | 
					    SdMmcHcRwMmio (Private->PciIo,0,0x114,TRUE,sizeof (value),&value);
 | 
				
			||||||
 | 
					    SdMmcHcRwMmio (Private->PciIo,0,0x1a8,TRUE,sizeof (value),&value);
 | 
				
			||||||
 | 
					    SdMmcHcRwMmio (Private->PciIo,0,0x1ac,TRUE,sizeof (value),&value);
 | 
				
			||||||
 | 
					    SdMmcHcRwMmio (Private->PciIo,0,0x1B0,TRUE,sizeof (value),&value);
 | 
				
			||||||
 | 
					    SdMmcHcRwMmio (Private->PciIo,0,0x1CC,TRUE,sizeof (value),&value);
 | 
				
			||||||
 | 
					    SdMmcHcRwMmio (Private->PciIo,0,0x040,TRUE,sizeof (value),&value);
 | 
				
			||||||
 | 
					    SdMmcHcRwMmio (Private->PciIo,0,SD_MMC_HC_PRESENT_STATE,TRUE,sizeof (value),&value);
 | 
				
			||||||
 | 
					    SdMmcHcRwMmio (Private->PciIo,0,SD_MMC_HC_HOST_CTRL1,TRUE,sizeof (IntStatus),&IntStatus);
 | 
				
			||||||
 | 
					    SdMmcHcRwMmio (Private->PciIo,0,SD_MMC_HC_CLOCK_CTRL,TRUE,sizeof (IntStatus),&IntStatus);
 | 
				
			||||||
 | 
					    SdMmcHcRwMmio (Private->PciIo,0,SD_MMC_HC_TIMEOUT_CTRL,TRUE,sizeof (IntStatus),&IntStatus);
 | 
				
			||||||
 | 
					    SdMmcHcRwMmio (Private->PciIo,0,SD_MMC_HC_NOR_INT_STS,TRUE,sizeof (value),&value);
 | 
				
			||||||
 | 
					    SdMmcHcRwMmio (Private->PciIo,0,SD_MMC_HC_HOST_CTRL2,TRUE,sizeof (IntStatus),&IntStatus);
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  //
 | 
					  //
 | 
				
			||||||
  // Enable 64-bit DMA support in the PCI layer if this controller
 | 
					  // Enable 64-bit DMA support in the PCI layer if this controller
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -20,6 +20,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 | 
				
			|||||||
#include <Library/UefiDriverEntryPoint.h>
 | 
					#include <Library/UefiDriverEntryPoint.h>
 | 
				
			||||||
#include <Library/DebugLib.h>
 | 
					#include <Library/DebugLib.h>
 | 
				
			||||||
#include <Library/UefiBootServicesTableLib.h>
 | 
					#include <Library/UefiBootServicesTableLib.h>
 | 
				
			||||||
 | 
					#include <Library/UefiRuntimeServicesTableLib.h>
 | 
				
			||||||
#include <Library/BaseMemoryLib.h>
 | 
					#include <Library/BaseMemoryLib.h>
 | 
				
			||||||
#include <Library/MemoryAllocationLib.h>
 | 
					#include <Library/MemoryAllocationLib.h>
 | 
				
			||||||
#include <Library/UefiLib.h>
 | 
					#include <Library/UefiLib.h>
 | 
				
			||||||
@@ -33,6 +34,8 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 | 
				
			|||||||
#include <Protocol/SdMmcOverride.h>
 | 
					#include <Protocol/SdMmcOverride.h>
 | 
				
			||||||
#include <Protocol/SdMmcPassThru.h>
 | 
					#include <Protocol/SdMmcPassThru.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include <Guid/DebugMask.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "SdMmcPciHci.h"
 | 
					#include "SdMmcPciHci.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
extern EFI_COMPONENT_NAME_PROTOCOL  gSdMmcPciHcComponentName;
 | 
					extern EFI_COMPONENT_NAME_PROTOCOL  gSdMmcPciHcComponentName;
 | 
				
			||||||
@@ -46,10 +49,16 @@ extern EDKII_SD_MMC_OVERRIDE        *mOverride;
 | 
				
			|||||||
#define SD_MMC_HC_PRIVATE_FROM_THIS(a) \
 | 
					#define SD_MMC_HC_PRIVATE_FROM_THIS(a) \
 | 
				
			||||||
    CR(a, SD_MMC_HC_PRIVATE_DATA, PassThru, SD_MMC_HC_PRIVATE_SIGNATURE)
 | 
					    CR(a, SD_MMC_HC_PRIVATE_DATA, PassThru, SD_MMC_HC_PRIVATE_SIGNATURE)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#define HOST_CLK_DRIVE_STRENGTH    2
 | 
				
			||||||
 | 
					#define HOST_DAT_DRIVE_STRENGTH    2
 | 
				
			||||||
 | 
					#define HS200_ALLPASS_PHASE        0
 | 
				
			||||||
 | 
					#define HS100_ALLPASS_PHASE        6
 | 
				
			||||||
 | 
					
 | 
				
			||||||
//
 | 
					//
 | 
				
			||||||
// Generic time out value, 1 microsecond as unit.
 | 
					// Generic time out value, 1 microsecond as unit.
 | 
				
			||||||
//
 | 
					//
 | 
				
			||||||
#define SD_MMC_HC_GENERIC_TIMEOUT     1 * 1000 * 1000
 | 
					#define SD_MMC_HC_GENERIC_TIMEOUT     1 * 1000 * 100
 | 
				
			||||||
 | 
					#define SD_MMC_CLOCK_STABLE_TIMEOUT   3 * 1000
 | 
				
			||||||
 | 
					
 | 
				
			||||||
//
 | 
					//
 | 
				
			||||||
// SD/MMC async transfer timer interval, set by experience.
 | 
					// SD/MMC async transfer timer interval, set by experience.
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -14,12 +14,12 @@
 | 
				
			|||||||
##
 | 
					##
 | 
				
			||||||
 | 
					
 | 
				
			||||||
[Defines]
 | 
					[Defines]
 | 
				
			||||||
  INF_VERSION                    = 0x00010005
 | 
					  INF_VERSION                    = 0x00010007
 | 
				
			||||||
  BASE_NAME                      = SdMmcPciHcDxe
 | 
					  BASE_NAME                      = SdMmcPciHcDxe
 | 
				
			||||||
  MODULE_UNI_FILE                = SdMmcPciHcDxe.uni
 | 
					  MODULE_UNI_FILE                = SdMmcPciHcDxe.uni
 | 
				
			||||||
  FILE_GUID                      = 8E325979-3FE1-4927-AAE2-8F5C4BD2AF0D
 | 
					  FILE_GUID                      = 8E325979-3FE1-4927-AAE2-8F5C4BD2AF0D
 | 
				
			||||||
  MODULE_TYPE                    = UEFI_DRIVER
 | 
					  MODULE_TYPE                    = UEFI_DRIVER
 | 
				
			||||||
  VERSION_STRING                 = 1.0
 | 
					  VERSION_STRING                 = 1.5.4
 | 
				
			||||||
  ENTRY_POINT                    = InitializeSdMmcPciHcDxe
 | 
					  ENTRY_POINT                    = InitializeSdMmcPciHcDxe
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#
 | 
					#
 | 
				
			||||||
@@ -63,6 +63,9 @@
 | 
				
			|||||||
  gEfiPciIoProtocolGuid                         ## TO_START
 | 
					  gEfiPciIoProtocolGuid                         ## TO_START
 | 
				
			||||||
  gEfiSdMmcPassThruProtocolGuid                 ## BY_START
 | 
					  gEfiSdMmcPassThruProtocolGuid                 ## BY_START
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					[Guids]
 | 
				
			||||||
 | 
					  gEfiGenericVariableGuid
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# [Event]
 | 
					# [Event]
 | 
				
			||||||
# EVENT_TYPE_PERIODIC_TIMER ## SOMETIMES_CONSUMES
 | 
					# EVENT_TYPE_PERIODIC_TIMER ## SOMETIMES_CONSUMES
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -14,6 +14,9 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
#include "SdMmcPciHcDxe.h"
 | 
					#include "SdMmcPciHcDxe.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					int g_deviceId = 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
  Dump the content of SD/MMC host controller's Capability Register.
 | 
					  Dump the content of SD/MMC host controller's Capability Register.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -1145,6 +1148,15 @@ SdMmcHcInitPowerVoltage (
 | 
				
			|||||||
  // Set SD Bus Voltage Select and SD Bus Power fields in Power Control Register
 | 
					  // Set SD Bus Voltage Select and SD Bus Power fields in Power Control Register
 | 
				
			||||||
  //
 | 
					  //
 | 
				
			||||||
  Status = SdMmcHcPowerControl (PciIo, Slot, MaxVoltage);
 | 
					  Status = SdMmcHcPowerControl (PciIo, Slot, MaxVoltage);
 | 
				
			||||||
 | 
					  if (BhtHostPciSupport(PciIo)){
 | 
				
			||||||
 | 
					    // 1.8V signaling enable
 | 
				
			||||||
 | 
					    HostCtrl2  = BIT3;
 | 
				
			||||||
 | 
					    Status = SdMmcHcOrMmio (PciIo, Slot, SD_MMC_HC_HOST_CTRL2, sizeof (HostCtrl2), &HostCtrl2);
 | 
				
			||||||
 | 
					    gBS->Stall (5000);
 | 
				
			||||||
 | 
					    if (EFI_ERROR (Status)) {
 | 
				
			||||||
 | 
					      return Status;
 | 
				
			||||||
 | 
					    }	  
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  return Status;
 | 
					  return Status;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@@ -1196,6 +1208,7 @@ SdMmcHcInitHost (
 | 
				
			|||||||
  EFI_STATUS                Status;
 | 
					  EFI_STATUS                Status;
 | 
				
			||||||
  EFI_PCI_IO_PROTOCOL       *PciIo;
 | 
					  EFI_PCI_IO_PROTOCOL       *PciIo;
 | 
				
			||||||
  SD_MMC_HC_SLOT_CAP        Capability;
 | 
					  SD_MMC_HC_SLOT_CAP        Capability;
 | 
				
			||||||
 | 
					  UINT32                    value32;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  //
 | 
					  //
 | 
				
			||||||
  // Notify the SD/MMC override protocol that we are about to initialize
 | 
					  // Notify the SD/MMC override protocol that we are about to initialize
 | 
				
			||||||
@@ -1218,10 +1231,192 @@ SdMmcHcInitHost (
 | 
				
			|||||||
  PciIo = Private->PciIo;
 | 
					  PciIo = Private->PciIo;
 | 
				
			||||||
  Capability = Private->Capability[Slot];
 | 
					  Capability = Private->Capability[Slot];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  if (BhtHostPciSupport(PciIo)){
 | 
				
			||||||
 | 
					    UINT8   CardMode;
 | 
				
			||||||
 | 
					    UINT16	EmmcVar;
 | 
				
			||||||
 | 
					    UINTN 	EmmcVarSize;
 | 
				
			||||||
 | 
					    UINT64  Cap;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    //unlock PCR write protect
 | 
				
			||||||
 | 
					#ifdef DISABLE_L1_2
 | 
				
			||||||
 | 
					    PciBhtAnd32(PciIo, 0xd0, ~(BIT31));
 | 
				
			||||||
 | 
					    PciBhtAnd32(PciIo, 0x90, ~(BIT1 | BIT0));
 | 
				
			||||||
 | 
							
 | 
				
			||||||
 | 
					    value32 = PciBhtRead32(PciIo, 0xe0);
 | 
				
			||||||
 | 
					    value32 &= ~(BIT31 | BIT30 | BIT29 | BIT28);
 | 
				
			||||||
 | 
					    value32 |= (BIT29 | BIT28);
 | 
				
			||||||
 | 
					    PciBhtWrite32(PciIo, 0xe0, value32);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    value32 = PciBhtRead32(PciIo, 0xfc);
 | 
				
			||||||
 | 
					    value32 &= ~(BIT19 | BIT18 | BIT17 | BIT16);
 | 
				
			||||||
 | 
					    value32 |= (BIT19);
 | 
				
			||||||
 | 
					    PciBhtWrite32(PciIo, 0xfc, value32);
 | 
				
			||||||
 | 
							
 | 
				
			||||||
 | 
					    value32 = PciBhtRead32(PciIo, 0x3f4);
 | 
				
			||||||
 | 
					    value32 &= ~(BIT3 | BIT2 | BIT1 | BIT0);
 | 
				
			||||||
 | 
					    value32 |= (BIT3 | BIT1);
 | 
				
			||||||
 | 
					    PciBhtWrite32(PciIo, 0x3f4, value32);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    value32 = PciBhtRead32(PciIo, 0x248);
 | 
				
			||||||
 | 
					    value32 &= ~(BIT3 | BIT2 | BIT1 | BIT0);
 | 
				
			||||||
 | 
					    value32 |= (BIT3 | BIT1);
 | 
				
			||||||
 | 
					    PciBhtWrite32(PciIo, 0x248, value32);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    value32 = PciBhtRead32(PciIo, 0x90);
 | 
				
			||||||
 | 
					    value32 &= ~(BIT1 | BIT0);
 | 
				
			||||||
 | 
					    value32 |= (BIT1);
 | 
				
			||||||
 | 
					    PciBhtWrite32(PciIo, 0x90, value32);
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /* FET on */
 | 
				
			||||||
 | 
					    PciBhtOr32(PciIo, 0xEC, 0x3);
 | 
				
			||||||
 | 
					    /* Led on */
 | 
				
			||||||
 | 
					    //PciBhtAnd32(PciIo, 0x334, (UINT32)~BIT13);
 | 
				
			||||||
 | 
					    PciBhtOr32(PciIo, 0xD4, BIT6);
 | 
				
			||||||
 | 
					    /* Set 1.8v emmc signaling flag */
 | 
				
			||||||
 | 
					    PciBhtOr32(PciIo, 0x308, BIT4);
 | 
				
			||||||
 | 
					    /* Set 200MBaseClock */
 | 
				
			||||||
 | 
					    value32 = PciBhtRead32(PciIo, 0x304);
 | 
				
			||||||
 | 
					    value32 &= 0x0000FFFF;
 | 
				
			||||||
 | 
					    value32 |= 0x25100000;
 | 
				
			||||||
 | 
					#if !defined(HOST_CLK_DRIVE_STRENGTH) || HOST_CLK_DRIVE_STRENGTH > 7 || HOST_CLK_DRIVE_STRENGTH < 0
 | 
				
			||||||
 | 
					#error "HOST_CMD_DRIVE_STRENGTH is undefined or value is invalid"
 | 
				
			||||||
 | 
					#else
 | 
				
			||||||
 | 
					    EmmcVarSize = sizeof(EmmcVar);
 | 
				
			||||||
 | 
					    Status = gRT->GetVariable (
 | 
				
			||||||
 | 
					          L"EMMC_CLK_DRIVER_STRENGTH",
 | 
				
			||||||
 | 
					          &gEfiGenericVariableGuid,
 | 
				
			||||||
 | 
					          NULL,
 | 
				
			||||||
 | 
					          &EmmcVarSize,
 | 
				
			||||||
 | 
					          &EmmcVar
 | 
				
			||||||
 | 
					        );
 | 
				
			||||||
 | 
					    if (EFI_ERROR(Status)) {
 | 
				
			||||||
 | 
					      EmmcVar = HOST_CLK_DRIVE_STRENGTH;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    value32 &= 0xFFFFFF8F;
 | 
				
			||||||
 | 
					    value32 |= ((EmmcVar & 0x7) << 4);
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					#if !defined(HOST_DAT_DRIVE_STRENGTH) || HOST_DAT_DRIVE_STRENGTH > 7 || HOST_DAT_DRIVE_STRENGTH < 0
 | 
				
			||||||
 | 
					#error "HOST_DATA_DRIVE_STRENGTH is undefined or value is invalid"
 | 
				
			||||||
 | 
					#else
 | 
				
			||||||
 | 
					    EmmcVarSize = sizeof(EmmcVar);
 | 
				
			||||||
 | 
					    Status = gRT->GetVariable (
 | 
				
			||||||
 | 
					          L"EMMC_DATA_DRIVER_STRENGTH",
 | 
				
			||||||
 | 
					          &gEfiGenericVariableGuid,
 | 
				
			||||||
 | 
					          NULL,
 | 
				
			||||||
 | 
					          &EmmcVarSize,
 | 
				
			||||||
 | 
					          &EmmcVar
 | 
				
			||||||
 | 
					        );
 | 
				
			||||||
 | 
					    if (EFI_ERROR(Status)) {
 | 
				
			||||||
 | 
					      EmmcVar = HOST_DAT_DRIVE_STRENGTH;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    value32 &= 0xFFFFFFF1;
 | 
				
			||||||
 | 
					    value32 |= ((EmmcVar & 0x7) << 1);
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					    PciBhtWrite32(PciIo, 0x304, value32);
 | 
				
			||||||
 | 
					    PciBhtOr32(PciIo, 0x3E4, BIT22);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    EmmcVarSize = sizeof(CardMode);
 | 
				
			||||||
 | 
					    Status = gRT->GetVariable (
 | 
				
			||||||
 | 
					                 L"EMMC_FORCE_CARD_MODE",
 | 
				
			||||||
 | 
					                 &gEfiGenericVariableGuid,
 | 
				
			||||||
 | 
					                 NULL,
 | 
				
			||||||
 | 
					                 &EmmcVarSize,
 | 
				
			||||||
 | 
					                 &CardMode
 | 
				
			||||||
 | 
					               );
 | 
				
			||||||
 | 
					    if (EFI_ERROR(Status) || CardMode > 2) {
 | 
				
			||||||
 | 
					      CardMode = 0;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if (CardMode == 1) {
 | 
				
			||||||
 | 
					#if !defined(HS100_ALLPASS_PHASE) || HS100_ALLPASS_PHASE > 10 || HS100_ALLPASS_PHASE < 0
 | 
				
			||||||
 | 
					#error "HS200_ALLPASS_PHASE is undefined or value is invalid"
 | 
				
			||||||
 | 
					#else
 | 
				
			||||||
 | 
					      EmmcVarSize = sizeof(EmmcVar);
 | 
				
			||||||
 | 
					      Status = gRT->GetVariable (
 | 
				
			||||||
 | 
					            L"EMMC_HS100_ALLPASS_PHASE",
 | 
				
			||||||
 | 
					            &gEfiGenericVariableGuid,
 | 
				
			||||||
 | 
					            NULL,
 | 
				
			||||||
 | 
					            &EmmcVarSize,
 | 
				
			||||||
 | 
					            &EmmcVar
 | 
				
			||||||
 | 
					          );
 | 
				
			||||||
 | 
					    if (EFI_ERROR(Status) || EmmcVar > 10) {
 | 
				
			||||||
 | 
					      EmmcVar = HS100_ALLPASS_PHASE;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					#endif		
 | 
				
			||||||
 | 
					    } else if (CardMode == 2) {
 | 
				
			||||||
 | 
					#if !defined(HS200_ALLPASS_PHASE) || HS200_ALLPASS_PHASE > 10 || HS200_ALLPASS_PHASE < 0
 | 
				
			||||||
 | 
					#error "HS200_ALLPASS_PHASE is undefined or value is invalid"
 | 
				
			||||||
 | 
					#else
 | 
				
			||||||
 | 
					      EmmcVarSize = sizeof(EmmcVar);
 | 
				
			||||||
 | 
					      Status = gRT->GetVariable (
 | 
				
			||||||
 | 
					            L"EMMC_HS200_ALLPASS_PHASE",
 | 
				
			||||||
 | 
					            &gEfiGenericVariableGuid,
 | 
				
			||||||
 | 
					            NULL,
 | 
				
			||||||
 | 
					            &EmmcVarSize,
 | 
				
			||||||
 | 
					            &EmmcVar
 | 
				
			||||||
 | 
					          );
 | 
				
			||||||
 | 
					      if (EFI_ERROR(Status) || EmmcVar > 10) {
 | 
				
			||||||
 | 
					        EmmcVar = HS200_ALLPASS_PHASE;
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    value32 = 0x21000033 | (EmmcVar << 20);
 | 
				
			||||||
 | 
					    PciBhtWrite32(PciIo, 0x300, value32);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    //enable internal clk
 | 
				
			||||||
 | 
					    value32 = BIT0;
 | 
				
			||||||
 | 
					    Status = SdMmcHcOrMmio (PciIo, Slot, SD_MMC_HC_CLOCK_CTRL,sizeof(value32), &value32);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    //reset pll start	
 | 
				
			||||||
 | 
					    Status = SdMmcHcRwMmio (PciIo, Slot, 0x1CC, TRUE, sizeof(value32), &value32);
 | 
				
			||||||
 | 
					    value32 |= BIT12;	  
 | 
				
			||||||
 | 
					    Status = SdMmcHcRwMmio (PciIo, Slot, 0x1CC, FALSE, sizeof(value32), &value32);		  
 | 
				
			||||||
 | 
					    gBS->Stall(1);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    //reset pll end
 | 
				
			||||||
 | 
					    Status = SdMmcHcRwMmio (PciIo, Slot, 0x1CC, TRUE,sizeof(value32), &value32);
 | 
				
			||||||
 | 
					    value32 &= ~BIT12;
 | 
				
			||||||
 | 
					    value32 |= BIT18;
 | 
				
			||||||
 | 
					    Status = SdMmcHcRwMmio (PciIo, Slot, 0x1CC, FALSE, sizeof(value32), &value32);
 | 
				
			||||||
 | 
							
 | 
				
			||||||
 | 
					    //wait BaseClk stable 0x1CC bit14	
 | 
				
			||||||
 | 
					    Status = SdMmcHcRwMmio (PciIo, Slot, 0x1CC, TRUE, sizeof(value32), &value32);
 | 
				
			||||||
 | 
					    while(!(value32&BIT14)){
 | 
				
			||||||
 | 
					      gBS->Stall(100);
 | 
				
			||||||
 | 
					      Status = SdMmcHcRwMmio (PciIo, Slot, 0x1CC, TRUE, sizeof(value32), &value32);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if (value32 & BIT18) {
 | 
				
			||||||
 | 
					      //Wait 2nd Card Detect debounce Finished by wait twice of debounce max time
 | 
				
			||||||
 | 
					      while (1) {
 | 
				
			||||||
 | 
					        Status = SdMmcHcRwMmio (PciIo, Slot, SD_MMC_HC_PRESENT_STATE, TRUE, sizeof(value32), &value32);
 | 
				
			||||||
 | 
					        if (((value32 >> 16) & 0x01) == ((value32 >> 18) & 0x01))
 | 
				
			||||||
 | 
					          break;
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
 | 
					      //force pll active end
 | 
				
			||||||
 | 
					      Status = SdMmcHcRwMmio (PciIo, Slot, 0x1CC, TRUE, sizeof(value32), &value32);		
 | 
				
			||||||
 | 
					      value32 &= ~BIT18;
 | 
				
			||||||
 | 
					      Status = SdMmcHcRwMmio (PciIo, Slot, 0x1CC, FALSE, sizeof(value32), &value32);				
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    Status = SdMmcHcRwMmio (PciIo, Slot, SD_MMC_HC_CAP, TRUE, sizeof (Cap), &Cap);
 | 
				
			||||||
 | 
					    if (EFI_ERROR (Status)) {
 | 
				
			||||||
 | 
					      return Status;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    CopyMem (&Capability, &Cap, sizeof (Cap));
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
					    Status = SdMmcHcInitPowerVoltage (PciIo, Slot, Capability);
 | 
				
			||||||
 | 
					    if (EFI_ERROR (Status)) {
 | 
				
			||||||
 | 
					      return Status;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					  } else {
 | 
				
			||||||
      Status = SdMmcHcInitV4Enhancements (PciIo, Slot, Capability, Private->ControllerVersion[Slot]);
 | 
					      Status = SdMmcHcInitV4Enhancements (PciIo, Slot, Capability, Private->ControllerVersion[Slot]);
 | 
				
			||||||
      if (EFI_ERROR (Status)) {
 | 
					      if (EFI_ERROR (Status)) {
 | 
				
			||||||
        return Status;
 | 
					        return Status;
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  //
 | 
					  //
 | 
				
			||||||
  // Perform first time clock setup with 400 KHz frequency.
 | 
					  // Perform first time clock setup with 400 KHz frequency.
 | 
				
			||||||
@@ -1235,10 +1430,12 @@ SdMmcHcInitHost (
 | 
				
			|||||||
    return Status;
 | 
					    return Status;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  if (!BhtHostPciSupport(PciIo)){
 | 
				
			||||||
      Status = SdMmcHcInitPowerVoltage (PciIo, Slot, Capability);
 | 
					      Status = SdMmcHcInitPowerVoltage (PciIo, Slot, Capability);
 | 
				
			||||||
      if (EFI_ERROR (Status)) {
 | 
					      if (EFI_ERROR (Status)) {
 | 
				
			||||||
        return Status;
 | 
					        return Status;
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  Status = SdMmcHcInitTimeoutCtrl (PciIo, Slot);
 | 
					  Status = SdMmcHcInitTimeoutCtrl (PciIo, Slot);
 | 
				
			||||||
  if (EFI_ERROR (Status)) {
 | 
					  if (EFI_ERROR (Status)) {
 | 
				
			||||||
@@ -2836,3 +3033,279 @@ SdMmcWaitTrbResult (
 | 
				
			|||||||
  return EFI_TIMEOUT;
 | 
					  return EFI_TIMEOUT;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					BOOLEAN BhtHostPciSupport(EFI_PCI_IO_PROTOCOL *PciIo)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					  PCI_TYPE00		Pci;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  PciIo->Pci.Read (PciIo, EfiPciIoWidthUint32,		
 | 
				
			||||||
 | 
					          0, sizeof Pci / sizeof (UINT32), &Pci);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  DEBUG ((DEBUG_INFO, "check device %04x:%04x\n", Pci.Hdr.VendorId, Pci.Hdr.DeviceId));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  if (Pci.Hdr.VendorId != 0x1217)
 | 
				
			||||||
 | 
					    goto end;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  switch (Pci.Hdr.DeviceId)
 | 
				
			||||||
 | 
					  {
 | 
				
			||||||
 | 
					    case 0x8420:	//PCI_DEV_ID_SDS0
 | 
				
			||||||
 | 
					    case 0x8421:	//PCI_DEV_ID_SDS1
 | 
				
			||||||
 | 
					    case 0x8520:	//PCI_DEV_ID_FJ2
 | 
				
			||||||
 | 
					    case 0x8620:	//PCI_DEV_ID_SB0
 | 
				
			||||||
 | 
					    case 0x8621:	//PCI_DEV_ID_SB1
 | 
				
			||||||
 | 
					      g_deviceId = Pci.Hdr.DeviceId;
 | 
				
			||||||
 | 
					      return 1;
 | 
				
			||||||
 | 
					    default:
 | 
				
			||||||
 | 
					      break;
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  end:
 | 
				
			||||||
 | 
					  return 0;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void DbgNull(IN CONST CHAR16 * fmt, ...)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					UINT32 bht_readl(EFI_PCI_IO_PROTOCOL *PciIo, UINT32 offset)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					  UINT32 arg;
 | 
				
			||||||
 | 
					  PciIo->Mem.Read(PciIo,EfiPciIoWidthUint32,1,offset,1,&arg);
 | 
				
			||||||
 | 
					  return arg;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void bht_writel(EFI_PCI_IO_PROTOCOL *PciIo, UINT32 offset, UINT32 value)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					  PciIo->Mem.Write(PciIo,EfiPciIoWidthUint32,1,offset,1,&value);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					UINT32 PciBhtRead32(EFI_PCI_IO_PROTOCOL *PciIo, UINT32 offset)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					  UINT32 i = 0;
 | 
				
			||||||
 | 
					  UINT32 tmp[3] = {0};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  if((g_deviceId == PCI_DEV_ID_SDS0) ||
 | 
				
			||||||
 | 
					      (g_deviceId == PCI_DEV_ID_SDS1) ||
 | 
				
			||||||
 | 
					      (g_deviceId == PCI_DEV_ID_FJ2) ||
 | 
				
			||||||
 | 
					      (g_deviceId == PCI_DEV_ID_SB0) ||
 | 
				
			||||||
 | 
					      (g_deviceId == PCI_DEV_ID_SB1))
 | 
				
			||||||
 | 
					  {
 | 
				
			||||||
 | 
					    // For Sandstorm, HW implement a mapping method by memory space reg to access PCI reg.
 | 
				
			||||||
 | 
					    // Enable mapping
 | 
				
			||||||
 | 
					  
 | 
				
			||||||
 | 
					    // Check function conflict
 | 
				
			||||||
 | 
					    if((g_deviceId == PCI_DEV_ID_SDS0) ||
 | 
				
			||||||
 | 
					        (g_deviceId == PCI_DEV_ID_FJ2) ||
 | 
				
			||||||
 | 
					        (g_deviceId == PCI_DEV_ID_SB0) ||
 | 
				
			||||||
 | 
					        (g_deviceId == PCI_DEV_ID_SB1))
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					      i = 0;
 | 
				
			||||||
 | 
					      bht_writel(PciIo, BHT_PCIRMappingEn, 0x40000000);
 | 
				
			||||||
 | 
					      while((bht_readl(PciIo, BHT_PCIRMappingEn) & 0x40000000) == 0)
 | 
				
			||||||
 | 
					      {
 | 
				
			||||||
 | 
					        if(i == 5)
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					          goto RD_DIS_MAPPING;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					            gBS->Stall(1000);
 | 
				
			||||||
 | 
					        i++;
 | 
				
			||||||
 | 
					          bht_writel(PciIo, BHT_PCIRMappingEn, 0x40000000);
 | 
				
			||||||
 | 
					  
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    else if(g_deviceId == PCI_DEV_ID_SDS1)
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					      i = 0;
 | 
				
			||||||
 | 
					      bht_writel(PciIo, BHT_PCIRMappingEn, 0x20000000);
 | 
				
			||||||
 | 
					      while((bht_readl(PciIo, BHT_PCIRMappingEn) & 0x20000000) == 0)
 | 
				
			||||||
 | 
					      {
 | 
				
			||||||
 | 
					        if(i == 5)
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					          //DbgErr((DRIVERNAME " - %s() function 1 can't lock!\n", __FUNCTION__));
 | 
				
			||||||
 | 
					          goto RD_DIS_MAPPING;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        gBS->Stall(1000);
 | 
				
			||||||
 | 
					        i++;
 | 
				
			||||||
 | 
					        bht_writel(PciIo, BHT_PCIRMappingEn, 0x20000000);
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					  
 | 
				
			||||||
 | 
					    // Check last operation is complete
 | 
				
			||||||
 | 
					    i = 0;
 | 
				
			||||||
 | 
					    while(bht_readl(PciIo, BHT_PCIRMappingCtl) & 0xc0000000)
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					      if(i == 5)
 | 
				
			||||||
 | 
					      {
 | 
				
			||||||
 | 
					        //DbgErr((DRIVERNAME " - [204] = 0x%x\n", RegisterRead32(ELN_dPCIRMappingCtl)));
 | 
				
			||||||
 | 
					        //DbgErr((DRIVERNAME " - [208] = 0x%x\n", RegisterRead32(ELN_dPCIRMappingEn)));
 | 
				
			||||||
 | 
					        //DbgErr((DRIVERNAME " - %s() check last operation complete timeout!!!\n", __FUNCTION__));
 | 
				
			||||||
 | 
					        goto RD_DIS_MAPPING;
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
 | 
					      gBS->Stall(1000);
 | 
				
			||||||
 | 
					      i += 1;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					  
 | 
				
			||||||
 | 
					    // Set register address
 | 
				
			||||||
 | 
					    tmp[0] |= 0x40000000;
 | 
				
			||||||
 | 
					    tmp[0] |= offset;
 | 
				
			||||||
 | 
					    bht_writel(PciIo, BHT_PCIRMappingCtl, tmp[0]);
 | 
				
			||||||
 | 
					  
 | 
				
			||||||
 | 
					    // Check read is complete
 | 
				
			||||||
 | 
					    i = 0;
 | 
				
			||||||
 | 
					    while(bht_readl(PciIo, BHT_PCIRMappingCtl) & 0x40000000)
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					      if(i == 5)
 | 
				
			||||||
 | 
					      {
 | 
				
			||||||
 | 
					        //DbgErr((DRIVERNAME " - %s() check read operation complete timeout!!!\n", __FUNCTION__));
 | 
				
			||||||
 | 
					        goto RD_DIS_MAPPING;
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
 | 
					      gBS->Stall(1000);
 | 
				
			||||||
 | 
					      i += 1;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					  
 | 
				
			||||||
 | 
					    // Get PCIR value
 | 
				
			||||||
 | 
					    tmp[1] = bht_readl(PciIo, BHT_PCIRMappingVal);
 | 
				
			||||||
 | 
					  
 | 
				
			||||||
 | 
					RD_DIS_MAPPING:
 | 
				
			||||||
 | 
					    // Disable mapping
 | 
				
			||||||
 | 
					    bht_writel(PciIo, BHT_PCIRMappingEn, 0x80000000);
 | 
				
			||||||
 | 
					  
 | 
				
			||||||
 | 
					    //DbgDebug(L"%s offset=%x Value:%x\n", __FUNCTION__, offset, tmp[1]);
 | 
				
			||||||
 | 
					    return tmp[1];
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					  
 | 
				
			||||||
 | 
					  //DbgDebug(L"%s offset=%x Value:%x\n", __FUNCTION__, offset, tmp[0]);
 | 
				
			||||||
 | 
					  return tmp[0];	
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void PciBhtWrite32(EFI_PCI_IO_PROTOCOL *PciIo, UINT32 offset, UINT32 value)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					  UINT32 tmp = 0;
 | 
				
			||||||
 | 
					    UINT32 i = 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  if((g_deviceId == PCI_DEV_ID_SDS0) ||
 | 
				
			||||||
 | 
					      (g_deviceId == PCI_DEV_ID_SDS1) ||
 | 
				
			||||||
 | 
					      (g_deviceId == PCI_DEV_ID_FJ2) ||
 | 
				
			||||||
 | 
					      (g_deviceId == PCI_DEV_ID_SB0) ||
 | 
				
			||||||
 | 
					      (g_deviceId == PCI_DEV_ID_SB1))
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        // For Sandstorm, HW implement a mapping method by memory space reg to access PCI reg.
 | 
				
			||||||
 | 
					        // Upper caller doesn't need to set 0xD0.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        // Enable mapping
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        // Check function conflict
 | 
				
			||||||
 | 
					    if((g_deviceId == PCI_DEV_ID_SDS0) ||
 | 
				
			||||||
 | 
					        (g_deviceId == PCI_DEV_ID_FJ2) ||
 | 
				
			||||||
 | 
					        (g_deviceId == PCI_DEV_ID_SB0) ||
 | 
				
			||||||
 | 
					        (g_deviceId == PCI_DEV_ID_SB1))
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            i = 0;
 | 
				
			||||||
 | 
					            bht_writel(PciIo, BHT_PCIRMappingEn, 0x40000000);
 | 
				
			||||||
 | 
					            while((bht_readl(PciIo, BHT_PCIRMappingEn) & 0x40000000) == 0)
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                if(i == 5)
 | 
				
			||||||
 | 
					                {
 | 
				
			||||||
 | 
					                    //DbgErr((DRIVERNAME " - %s() function 0 can't lock!\n", __FUNCTION__));
 | 
				
			||||||
 | 
					                    goto WR_DIS_MAPPING;
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                gBS->Stall(1000);
 | 
				
			||||||
 | 
					                i++;
 | 
				
			||||||
 | 
					                bht_writel(PciIo, BHT_PCIRMappingEn, 0x40000000);
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        else if(g_deviceId == PCI_DEV_ID_SDS1)
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            i = 0;
 | 
				
			||||||
 | 
					            bht_writel(PciIo, BHT_PCIRMappingEn, 0x20000000);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            while((bht_readl(PciIo, BHT_PCIRMappingEn) & 0x20000000) == 0)
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                if(i == 5)
 | 
				
			||||||
 | 
					                {
 | 
				
			||||||
 | 
					                    //DbgErr((DRIVERNAME " - %s() function 0 can't lock!\n", __FUNCTION__));
 | 
				
			||||||
 | 
					                    goto WR_DIS_MAPPING;
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                gBS->Stall(1000);
 | 
				
			||||||
 | 
					                i++;
 | 
				
			||||||
 | 
					                bht_writel(PciIo, BHT_PCIRMappingEn, 0x20000000);
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        // Enable MEM access
 | 
				
			||||||
 | 
					        bht_writel(PciIo, BHT_PCIRMappingVal, 0x80000000);
 | 
				
			||||||
 | 
					        bht_writel(PciIo, BHT_PCIRMappingCtl, 0x800000D0);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        // Check last operation is complete
 | 
				
			||||||
 | 
					        i = 0;
 | 
				
			||||||
 | 
					        while(bht_readl(PciIo, BHT_PCIRMappingCtl) & 0xc0000000)
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            if(i == 5)
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                //DbgErr((DRIVERNAME " - %s() check last operation complete timeout!!!\n", __FUNCTION__));
 | 
				
			||||||
 | 
					                goto WR_DIS_MAPPING;
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            gBS->Stall(1000);
 | 
				
			||||||
 | 
					            i += 1;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        // Set write value
 | 
				
			||||||
 | 
					        bht_writel(PciIo, BHT_PCIRMappingVal, value);
 | 
				
			||||||
 | 
					        // Set register address
 | 
				
			||||||
 | 
					        tmp |= 0x80000000;
 | 
				
			||||||
 | 
					        tmp |= offset;
 | 
				
			||||||
 | 
					        bht_writel(PciIo, BHT_PCIRMappingCtl, tmp);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        // Check write is complete
 | 
				
			||||||
 | 
					        i = 0;
 | 
				
			||||||
 | 
					        while(bht_readl(PciIo, BHT_PCIRMappingCtl) & 0x80000000)
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            if(i == 5)
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                //DbgErr((DRIVERNAME " - %s() check write operation complete timeout!!!\n", __FUNCTION__));
 | 
				
			||||||
 | 
					                goto WR_DIS_MAPPING;
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            gBS->Stall(1000);
 | 
				
			||||||
 | 
					            i += 1;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					WR_DIS_MAPPING:
 | 
				
			||||||
 | 
					        // Disable MEM access
 | 
				
			||||||
 | 
					        bht_writel(PciIo, BHT_PCIRMappingVal, 0x80000001);
 | 
				
			||||||
 | 
					        bht_writel(PciIo, BHT_PCIRMappingCtl, 0x800000D0);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        // Check last operation is complete
 | 
				
			||||||
 | 
					        i = 0;
 | 
				
			||||||
 | 
					        while(bht_readl(PciIo, BHT_PCIRMappingCtl) & 0xc0000000)
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            if(i == 5)
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                //DbgErr((DRIVERNAME " - %s() check last operation complete timeout!!!\n", __FUNCTION__));
 | 
				
			||||||
 | 
					                break;
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            gBS->Stall(1000);
 | 
				
			||||||
 | 
					            i += 1;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        // Disable function conflict
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        // Disable mapping
 | 
				
			||||||
 | 
					        bht_writel(PciIo, BHT_PCIRMappingEn, 0x80000000);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void PciBhtOr32(EFI_PCI_IO_PROTOCOL *PciIo, UINT32 offset, UINT32 value)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					  UINT32 arg;
 | 
				
			||||||
 | 
					  arg = PciBhtRead32(PciIo, offset);
 | 
				
			||||||
 | 
					  PciBhtWrite32(PciIo, offset, value | arg);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void PciBhtAnd32(EFI_PCI_IO_PROTOCOL *PciIo, UINT32 offset, UINT32 value)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					  UINT32 arg;
 | 
				
			||||||
 | 
					  arg = PciBhtRead32(PciIo, offset);
 | 
				
			||||||
 | 
					  PciBhtWrite32(PciIo, offset, value & arg);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -607,4 +607,33 @@ SdMmcSetDriverStrength (
 | 
				
			|||||||
  IN SD_DRIVER_STRENGTH_TYPE  DriverStrength
 | 
					  IN SD_DRIVER_STRENGTH_TYPE  DriverStrength
 | 
				
			||||||
  );
 | 
					  );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					BOOLEAN 
 | 
				
			||||||
 | 
					BhtHostPciSupport(EFI_PCI_IO_PROTOCOL *PciIo);
 | 
				
			||||||
 | 
					UINT32 
 | 
				
			||||||
 | 
					PciBhtRead32(EFI_PCI_IO_PROTOCOL *PciIo, UINT32 offset);
 | 
				
			||||||
 | 
					void 
 | 
				
			||||||
 | 
					PciBhtWrite32(EFI_PCI_IO_PROTOCOL *PciIo, UINT32 offset, UINT32 value);
 | 
				
			||||||
 | 
					void 
 | 
				
			||||||
 | 
					PciBhtOr32(EFI_PCI_IO_PROTOCOL *PciIo, UINT32 offset, UINT32 value);
 | 
				
			||||||
 | 
					void 
 | 
				
			||||||
 | 
					PciBhtAnd32(EFI_PCI_IO_PROTOCOL *PciIo, UINT32 offset, UINT32 value);
 | 
				
			||||||
 | 
					extern void 
 | 
				
			||||||
 | 
					DbgNull(IN CONST CHAR16 * fmt, ...);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#define PCI_DEV_ID_RJ      0x8320
 | 
				
			||||||
 | 
					#define PCI_DEV_ID_SDS0    0x8420
 | 
				
			||||||
 | 
					#define PCI_DEV_ID_SDS1    0x8421
 | 
				
			||||||
 | 
					#define PCI_DEV_ID_FJ2     0x8520
 | 
				
			||||||
 | 
					#define PCI_DEV_ID_SB0     0x8620
 | 
				
			||||||
 | 
					#define PCI_DEV_ID_SB1     0x8621
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// O2/BHT add BAR1 for PCIR mapping registers
 | 
				
			||||||
 | 
					// These registers is defined by O2/BHT, but we may follow name definition rule.
 | 
				
			||||||
 | 
					#define	BHT_PCIRMappingVal    (0x200) /* PCI CFG Space Register Mapping Value Register */
 | 
				
			||||||
 | 
					#define	BHT_PCIRMappingCtl    (0x204) /* PCI CFG Space Register Mapping Control Register */
 | 
				
			||||||
 | 
					#define	BHT_PCIRMappingEn     (0x208) /* PCI CFG Space Register Mapping Enable Register */
 | 
				
			||||||
 | 
					#define	BHT_GPIOCTL           (0x210) /* GPIO control register*/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -801,10 +801,7 @@ InitUSBKeyboard (
 | 
				
			|||||||
  IN OUT USB_KB_DEV   *UsbKeyboardDevice
 | 
					  IN OUT USB_KB_DEV   *UsbKeyboardDevice
 | 
				
			||||||
  )
 | 
					  )
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  UINT16              ConfigValue;
 | 
					 | 
				
			||||||
  UINT8               Protocol;
 | 
					 | 
				
			||||||
  EFI_STATUS          Status;
 | 
					  EFI_STATUS          Status;
 | 
				
			||||||
  UINT32              TransferResult;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
  REPORT_STATUS_CODE_WITH_DEVICE_PATH (
 | 
					  REPORT_STATUS_CODE_WITH_DEVICE_PATH (
 | 
				
			||||||
    EFI_PROGRESS_CODE,
 | 
					    EFI_PROGRESS_CODE,
 | 
				
			||||||
@@ -817,27 +814,17 @@ InitUSBKeyboard (
 | 
				
			|||||||
  InitQueue (&UsbKeyboardDevice->EfiKeyQueueForNotify, sizeof (EFI_KEY_DATA));
 | 
					  InitQueue (&UsbKeyboardDevice->EfiKeyQueueForNotify, sizeof (EFI_KEY_DATA));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  //
 | 
					  //
 | 
				
			||||||
  // Use the config out of the descriptor
 | 
					  // Set boot protocol for the USB Keyboard.
 | 
				
			||||||
  // Assumed the first config is the correct one and this is not always the case
 | 
					  // This driver only supports boot protocol.
 | 
				
			||||||
  //
 | 
					  //
 | 
				
			||||||
  Status = UsbGetConfiguration (
 | 
					  Status = UsbSetProtocolRequest (
 | 
				
			||||||
             UsbKeyboardDevice->UsbIo,
 | 
					             UsbKeyboardDevice->UsbIo,
 | 
				
			||||||
             &ConfigValue,
 | 
					             UsbKeyboardDevice->InterfaceDescriptor.InterfaceNumber,
 | 
				
			||||||
             &TransferResult
 | 
					             BOOT_PROTOCOL
 | 
				
			||||||
             );
 | 
					 | 
				
			||||||
  if (EFI_ERROR (Status)) {
 | 
					 | 
				
			||||||
    ConfigValue = 0x01;
 | 
					 | 
				
			||||||
    //
 | 
					 | 
				
			||||||
    // Uses default configuration to configure the USB Keyboard device.
 | 
					 | 
				
			||||||
    //
 | 
					 | 
				
			||||||
    Status = UsbSetConfiguration (
 | 
					 | 
				
			||||||
               UsbKeyboardDevice->UsbIo,
 | 
					 | 
				
			||||||
               ConfigValue,
 | 
					 | 
				
			||||||
               &TransferResult
 | 
					 | 
				
			||||||
             );
 | 
					             );
 | 
				
			||||||
  if (EFI_ERROR (Status)) {
 | 
					  if (EFI_ERROR (Status)) {
 | 
				
			||||||
    //
 | 
					    //
 | 
				
			||||||
      // If configuration could not be set here, it means
 | 
					    // If protocol could not be set here, it means
 | 
				
			||||||
    // the keyboard interface has some errors and could
 | 
					    // the keyboard interface has some errors and could
 | 
				
			||||||
    // not be initialized
 | 
					    // not be initialized
 | 
				
			||||||
    //
 | 
					    //
 | 
				
			||||||
@@ -849,24 +836,6 @@ InitUSBKeyboard (
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    return EFI_DEVICE_ERROR;
 | 
					    return EFI_DEVICE_ERROR;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  UsbGetProtocolRequest (
 | 
					 | 
				
			||||||
    UsbKeyboardDevice->UsbIo,
 | 
					 | 
				
			||||||
    UsbKeyboardDevice->InterfaceDescriptor.InterfaceNumber,
 | 
					 | 
				
			||||||
    &Protocol
 | 
					 | 
				
			||||||
    );
 | 
					 | 
				
			||||||
  //
 | 
					 | 
				
			||||||
  // Set boot protocol for the USB Keyboard.
 | 
					 | 
				
			||||||
  // This driver only supports boot protocol.
 | 
					 | 
				
			||||||
  //
 | 
					 | 
				
			||||||
  if (Protocol != BOOT_PROTOCOL) {
 | 
					 | 
				
			||||||
    UsbSetProtocolRequest (
 | 
					 | 
				
			||||||
      UsbKeyboardDevice->UsbIo,
 | 
					 | 
				
			||||||
      UsbKeyboardDevice->InterfaceDescriptor.InterfaceNumber,
 | 
					 | 
				
			||||||
      BOOT_PROTOCOL
 | 
					 | 
				
			||||||
      );
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
  UsbKeyboardDevice->CtrlOn     = FALSE;
 | 
					  UsbKeyboardDevice->CtrlOn     = FALSE;
 | 
				
			||||||
  UsbKeyboardDevice->AltOn      = FALSE;
 | 
					  UsbKeyboardDevice->AltOn      = FALSE;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -70,6 +70,10 @@ CoreRemoveInterfaceFromProtocol (
 | 
				
			|||||||
    for(Link = ProtEntry->Notify.ForwardLink; Link != &ProtEntry->Notify; Link=Link->ForwardLink) {
 | 
					    for(Link = ProtEntry->Notify.ForwardLink; Link != &ProtEntry->Notify; Link=Link->ForwardLink) {
 | 
				
			||||||
      ProtNotify = CR(Link, PROTOCOL_NOTIFY, Link, PROTOCOL_NOTIFY_SIGNATURE);
 | 
					      ProtNotify = CR(Link, PROTOCOL_NOTIFY, Link, PROTOCOL_NOTIFY_SIGNATURE);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      // Signal notify events before removing the protocol too.
 | 
				
			||||||
 | 
					      // XXX: What effect does this have on other code?
 | 
				
			||||||
 | 
					      CoreSignalEvent (ProtNotify->Event);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      if (ProtNotify->Position == &Prot->ByProtocol) {
 | 
					      if (ProtNotify->Position == &Prot->ByProtocol) {
 | 
				
			||||||
        ProtNotify->Position = Prot->ByProtocol.BackLink;
 | 
					        ProtNotify->Position = Prot->ByProtocol.BackLink;
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -61,4 +61,14 @@ BootLogoUpdateProgress (
 | 
				
			|||||||
  IN UINTN                         PreviousValue
 | 
					  IN UINTN                         PreviousValue
 | 
				
			||||||
  );
 | 
					  );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  Install Boot Logo into BGRT table
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					**/
 | 
				
			||||||
 | 
					VOID
 | 
				
			||||||
 | 
					AddBGRT (
 | 
				
			||||||
 | 
					  VOID
 | 
				
			||||||
 | 
					  );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -213,7 +213,7 @@ TranslateBmpToGopBlt (
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  if ((BmpHeader->Size != BmpImageSize) ||
 | 
					  if ((BmpHeader->Size != BmpImageSize) ||
 | 
				
			||||||
      (BmpHeader->Size < BmpHeader->ImageOffset) ||
 | 
					      (BmpHeader->Size < BmpHeader->ImageOffset) ||
 | 
				
			||||||
      (BmpHeader->Size - BmpHeader->ImageOffset != DataSize)) {
 | 
					      (BmpHeader->Size - BmpHeader->ImageOffset < DataSize)) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    DEBUG ((DEBUG_ERROR, "TranslateBmpToGopBlt: invalid BmpImage... \n"));
 | 
					    DEBUG ((DEBUG_ERROR, "TranslateBmpToGopBlt: invalid BmpImage... \n"));
 | 
				
			||||||
    DEBUG ((DEBUG_ERROR, "   BmpHeader->Size: 0x%x\n", BmpHeader->Size));
 | 
					    DEBUG ((DEBUG_ERROR, "   BmpHeader->Size: 0x%x\n", BmpHeader->Size));
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										283
									
								
								MdeModulePkg/Library/BootLogoLib/Bgrt.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										283
									
								
								MdeModulePkg/Library/BootLogoLib/Bgrt.c
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,283 @@
 | 
				
			|||||||
 | 
					#include <IndustryStandard/Acpi.h>
 | 
				
			||||||
 | 
					#include <IndustryStandard/Bmp.h>
 | 
				
			||||||
 | 
					#include <Library/BaseLib.h>
 | 
				
			||||||
 | 
					#include <Library/BaseMemoryLib.h>
 | 
				
			||||||
 | 
					#include <Library/BootLogoLib.h>
 | 
				
			||||||
 | 
					#include <Library/DebugLib.h>
 | 
				
			||||||
 | 
					#include <Library/UefiBootServicesTableLib.h>
 | 
				
			||||||
 | 
					#include <Protocol/FirmwareVolume2.h>
 | 
				
			||||||
 | 
					#include <Protocol/SimpleFileSystem.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/** RSDP (Root System Description Pointer) */
 | 
				
			||||||
 | 
					typedef struct {
 | 
				
			||||||
 | 
					  CHAR8  signature[8];
 | 
				
			||||||
 | 
					  UINT8  checksum;
 | 
				
			||||||
 | 
					  CHAR8  oem_id[6];
 | 
				
			||||||
 | 
					  UINT8  revision;
 | 
				
			||||||
 | 
					  UINT32 rsdt_address;
 | 
				
			||||||
 | 
					  UINT32 length;
 | 
				
			||||||
 | 
					  UINT64 xsdt_address;
 | 
				
			||||||
 | 
					  UINT8  extended_checksum;
 | 
				
			||||||
 | 
					  UINT8  reserved[3];
 | 
				
			||||||
 | 
					} ACPI_20_RSDP;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/** SDT (System Description Table) entry header */
 | 
				
			||||||
 | 
					typedef struct {
 | 
				
			||||||
 | 
					    CHAR8  signature[4];
 | 
				
			||||||
 | 
					    UINT32 length;
 | 
				
			||||||
 | 
					    UINT8  revision;
 | 
				
			||||||
 | 
					    UINT8  checksum;
 | 
				
			||||||
 | 
					    CHAR8  oem_id[6];
 | 
				
			||||||
 | 
					    CHAR8  oem_table_id[8];
 | 
				
			||||||
 | 
					    UINT32 oem_revision;
 | 
				
			||||||
 | 
					    UINT32 asl_compiler_id;
 | 
				
			||||||
 | 
					    UINT32 asl_compiler_revision;
 | 
				
			||||||
 | 
					} ACPI_SDT_HEADER;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/** BGRT structure */
 | 
				
			||||||
 | 
					typedef struct {
 | 
				
			||||||
 | 
					    ACPI_SDT_HEADER header;
 | 
				
			||||||
 | 
					    UINT16 version;
 | 
				
			||||||
 | 
					    UINT8  status;
 | 
				
			||||||
 | 
					    UINT8  image_type;
 | 
				
			||||||
 | 
					    UINT64 image_address;
 | 
				
			||||||
 | 
					    UINT32 image_offset_x;
 | 
				
			||||||
 | 
					    UINT32 image_offset_y;
 | 
				
			||||||
 | 
					} ACPI_BGRT;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					EFI_STATUS
 | 
				
			||||||
 | 
					EFIAPI
 | 
				
			||||||
 | 
					LoadBmp(
 | 
				
			||||||
 | 
					    OUT EFI_PHYSICAL_ADDRESS *BmpAddress,
 | 
				
			||||||
 | 
					    OUT UINT32 *BmpSize
 | 
				
			||||||
 | 
					)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					  EFI_STATUS                    Status;
 | 
				
			||||||
 | 
					  UINTN                         FvProtocolCount;
 | 
				
			||||||
 | 
					  EFI_HANDLE                    *FvHandles;
 | 
				
			||||||
 | 
					  EFI_FIRMWARE_VOLUME2_PROTOCOL  *Fv;
 | 
				
			||||||
 | 
					  UINTN                         Index;
 | 
				
			||||||
 | 
					  UINT32                        AuthenticationStatus;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  UINT8                         *Buffer;
 | 
				
			||||||
 | 
					  UINTN                         BmpBufferSize;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  Buffer = 0;
 | 
				
			||||||
 | 
					  FvHandles       = NULL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  Status = gBS->LocateHandleBuffer (
 | 
				
			||||||
 | 
					    ByProtocol,
 | 
				
			||||||
 | 
					    &gEfiFirmwareVolume2ProtocolGuid,
 | 
				
			||||||
 | 
					    NULL,
 | 
				
			||||||
 | 
					    &FvProtocolCount,
 | 
				
			||||||
 | 
					    &FvHandles
 | 
				
			||||||
 | 
					    );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  if (!EFI_ERROR (Status)) {
 | 
				
			||||||
 | 
					    for (Index = 0; Index < FvProtocolCount; Index++) {
 | 
				
			||||||
 | 
					      Status = gBS->HandleProtocol (
 | 
				
			||||||
 | 
					                      FvHandles[Index],
 | 
				
			||||||
 | 
					                      &gEfiFirmwareVolume2ProtocolGuid,
 | 
				
			||||||
 | 
					                      (VOID **) &Fv
 | 
				
			||||||
 | 
					                      );
 | 
				
			||||||
 | 
					      BmpBufferSize = 0;
 | 
				
			||||||
 | 
					      Status = Fv->ReadSection (
 | 
				
			||||||
 | 
					                     Fv,
 | 
				
			||||||
 | 
					                     (EFI_GUID *)PcdGetPtr(PcdLogoFile),
 | 
				
			||||||
 | 
					                     EFI_SECTION_RAW,
 | 
				
			||||||
 | 
					                     0,
 | 
				
			||||||
 | 
					                    (void **)&Buffer,
 | 
				
			||||||
 | 
					                     &BmpBufferSize,
 | 
				
			||||||
 | 
					                     &AuthenticationStatus
 | 
				
			||||||
 | 
					                     );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      if (!EFI_ERROR (Status)) {
 | 
				
			||||||
 | 
					        *BmpAddress = (EFI_PHYSICAL_ADDRESS)(UINTN)Buffer;
 | 
				
			||||||
 | 
					        *BmpSize = (UINT32)BmpBufferSize;
 | 
				
			||||||
 | 
					        Status = EFI_SUCCESS;
 | 
				
			||||||
 | 
					        break;
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					  } else {
 | 
				
			||||||
 | 
					    Status = EFI_NOT_FOUND;
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  if (FvHandles != NULL) {
 | 
				
			||||||
 | 
					    gBS->FreePool (FvHandles);
 | 
				
			||||||
 | 
					    FvHandles = NULL;
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  return Status;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					UINT8 SumBytes(const UINT8* arr, UINTN size) {
 | 
				
			||||||
 | 
					  UINT8 sum = 0;
 | 
				
			||||||
 | 
					  UINTN i;
 | 
				
			||||||
 | 
					  for (i = 0; i < size; ++i) {
 | 
				
			||||||
 | 
					    sum += arr[i];
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					  return sum;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					int VerifyAcpiRsdp2Checksums(const void* data) {
 | 
				
			||||||
 | 
					  const UINT8* arr = data;
 | 
				
			||||||
 | 
					  UINTN size = *(const UINT32*)&arr[20];
 | 
				
			||||||
 | 
					  return SumBytes(arr, 20) == 0 && SumBytes(arr, size) == 0;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void SetAcpiRsdp2Checksums(void* data) {
 | 
				
			||||||
 | 
					  UINT8* arr = data;
 | 
				
			||||||
 | 
					  UINTN size = *(const UINT32*)&arr[20];
 | 
				
			||||||
 | 
					  arr[9] = 0;
 | 
				
			||||||
 | 
					  arr[32] = 0;
 | 
				
			||||||
 | 
					  arr[9] = -SumBytes(arr, 20);
 | 
				
			||||||
 | 
					  arr[32] = -SumBytes(arr, size);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					int VerifyAcpiSdtChecksum(const void* data) {
 | 
				
			||||||
 | 
					  const UINT8* arr = data;
 | 
				
			||||||
 | 
					  UINTN size = *(const UINT32*)&arr[4];
 | 
				
			||||||
 | 
					  return SumBytes(arr, size) == 0;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void SetAcpiSdtChecksum(void* data) {
 | 
				
			||||||
 | 
					  UINT8* arr = data;
 | 
				
			||||||
 | 
					  UINTN size = *(const UINT32*)&arr[4];
 | 
				
			||||||
 | 
					  arr[9] = 0;
 | 
				
			||||||
 | 
					  arr[9] = -SumBytes(arr, size);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					const CHAR16* TmpStr(CHAR8 *src, int length) {
 | 
				
			||||||
 | 
					  static CHAR16 arr[4][16];
 | 
				
			||||||
 | 
					  static int j;
 | 
				
			||||||
 | 
					  CHAR16* dest = arr[j = (j+1) % 4];
 | 
				
			||||||
 | 
					  int i;
 | 
				
			||||||
 | 
					  for (i = 0; i < length && i < 16-1 && src[i]; ++i) {
 | 
				
			||||||
 | 
					    dest[i] = src[i];
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					  dest[i] = 0;
 | 
				
			||||||
 | 
					  return dest;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static UINT32 min(UINT32 first, UINT32 second){
 | 
				
			||||||
 | 
					  if (first < second)
 | 
				
			||||||
 | 
					    return first;
 | 
				
			||||||
 | 
					  return second;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					ACPI_SDT_HEADER* CreateXsdt(ACPI_SDT_HEADER* xsdt0, UINTN entries) {
 | 
				
			||||||
 | 
					  ACPI_SDT_HEADER* xsdt = 0;
 | 
				
			||||||
 | 
					  UINT32 xsdt_len = (UINT32)(sizeof(ACPI_SDT_HEADER) + entries * sizeof(UINT64));
 | 
				
			||||||
 | 
					  gBS->AllocatePool(EfiACPIReclaimMemory, xsdt_len, (void**)&xsdt);
 | 
				
			||||||
 | 
					  if (!xsdt) {
 | 
				
			||||||
 | 
					    DEBUG ((EFI_D_INFO, "HackBGRT: Failed to allocate memory for XSDT.\n"));
 | 
				
			||||||
 | 
					    return 0;
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					  ZeroMem(xsdt, xsdt_len);
 | 
				
			||||||
 | 
					  CopyMem(xsdt, xsdt0, min(xsdt0->length, xsdt_len));
 | 
				
			||||||
 | 
					  xsdt->length = xsdt_len;
 | 
				
			||||||
 | 
					  SetAcpiSdtChecksum(xsdt);
 | 
				
			||||||
 | 
					  return xsdt;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static ACPI_BGRT* HandleAcpiTables(ACPI_BGRT* bgrt) {
 | 
				
			||||||
 | 
					  int i;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  for (i = 0; i < gST->NumberOfTableEntries; i++) {
 | 
				
			||||||
 | 
					    EFI_GUID* vendor_guid = &gST->ConfigurationTable[i].VendorGuid;
 | 
				
			||||||
 | 
					    ACPI_20_RSDP *rsdp;
 | 
				
			||||||
 | 
					    ACPI_SDT_HEADER *xsdt;
 | 
				
			||||||
 | 
					    UINT64 *entry_arr;
 | 
				
			||||||
 | 
					    UINT32 entry_arr_length;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if (!CompareGuid(vendor_guid, &gEfiAcpiTableGuid) && !CompareGuid(vendor_guid, &gEfiAcpi20TableGuid)) {
 | 
				
			||||||
 | 
					      continue;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    rsdp = (ACPI_20_RSDP *) gST->ConfigurationTable[i].VendorTable;
 | 
				
			||||||
 | 
					    if (CompareMem(rsdp->signature, "RSD PTR ", 8) != 0 || rsdp->revision < 2 || !VerifyAcpiRsdp2Checksums(rsdp)) {
 | 
				
			||||||
 | 
					      continue;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    DEBUG ((EFI_D_INFO, "RSDP: revision = %d, OEM ID = %s\n", rsdp->revision, TmpStr(rsdp->oem_id, 6)));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    xsdt = (ACPI_SDT_HEADER *) (UINTN) rsdp->xsdt_address;
 | 
				
			||||||
 | 
					    if (!xsdt || CompareMem(xsdt->signature, "XSDT", 4) != 0 || !VerifyAcpiSdtChecksum(xsdt)) {
 | 
				
			||||||
 | 
					      DEBUG ((EFI_D_INFO, "* XSDT: missing or invalid\n"));
 | 
				
			||||||
 | 
					      continue;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    entry_arr = (UINT64*)&xsdt[1];
 | 
				
			||||||
 | 
					    entry_arr_length = (xsdt->length - sizeof(*xsdt)) / sizeof(UINT64);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    DEBUG ((EFI_D_INFO, "* XSDT: OEM ID = %s, entry count = %d\n", TmpStr(xsdt->oem_id, 6), entry_arr_length));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if (bgrt) {
 | 
				
			||||||
 | 
					      DEBUG ((EFI_D_INFO, " - Adding missing BGRT.\n"));
 | 
				
			||||||
 | 
					      xsdt = CreateXsdt(xsdt, entry_arr_length + 1);
 | 
				
			||||||
 | 
					      entry_arr = (UINT64*)&xsdt[1];
 | 
				
			||||||
 | 
					      entry_arr[entry_arr_length++] = (UINTN) bgrt;
 | 
				
			||||||
 | 
					      rsdp->xsdt_address = (UINTN) xsdt;
 | 
				
			||||||
 | 
					      SetAcpiRsdp2Checksums(rsdp);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    SetAcpiSdtChecksum(xsdt);
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					  return bgrt;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					VOID
 | 
				
			||||||
 | 
					AddBGRT (
 | 
				
			||||||
 | 
					  VOID
 | 
				
			||||||
 | 
					  )
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					  EFI_STATUS                         Status;
 | 
				
			||||||
 | 
					  ACPI_BGRT                          *bgrt;
 | 
				
			||||||
 | 
					  EFI_GRAPHICS_OUTPUT_PROTOCOL       *GraphicsOutput;
 | 
				
			||||||
 | 
					  EFI_PHYSICAL_ADDRESS               BmpAddress;
 | 
				
			||||||
 | 
					  UINT32                             BmpSize;
 | 
				
			||||||
 | 
					  BMP_IMAGE_HEADER                   *BmpHeader;
 | 
				
			||||||
 | 
					  const char data[0x38] =
 | 
				
			||||||
 | 
					    "BGRT" "\x38\x00\x00\x00" "\x00" "\xd6" "INTEL " "    EDK2"
 | 
				
			||||||
 | 
					    "\x20\x17\x00\x00" "PTL " "\x02\x00\x00\x00"
 | 
				
			||||||
 | 
					    "\x01\x00" "\x00" "\x00";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  BmpAddress = 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  DEBUG ((EFI_D_INFO, "HackBGRT Start\n"));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  Status = gBS->HandleProtocol (
 | 
				
			||||||
 | 
					    gST->ConsoleOutHandle,
 | 
				
			||||||
 | 
					    &gEfiGraphicsOutputProtocolGuid,
 | 
				
			||||||
 | 
					    (VOID**)&GraphicsOutput
 | 
				
			||||||
 | 
					    );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  // Replace missing = allocate new.
 | 
				
			||||||
 | 
					  gBS->AllocatePool(EfiACPIReclaimMemory, sizeof(*bgrt), (void**)&bgrt);
 | 
				
			||||||
 | 
					  if (!bgrt) {
 | 
				
			||||||
 | 
					    DEBUG ((EFI_D_INFO, "HackBGRT MEM ERR\n"));
 | 
				
			||||||
 | 
					    return;
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  DEBUG ((EFI_D_INFO, "HackBGRT Load Bmp\n"));
 | 
				
			||||||
 | 
					  Status = LoadBmp(&BmpAddress, &BmpSize);
 | 
				
			||||||
 | 
					  if (EFI_ERROR(Status)){
 | 
				
			||||||
 | 
					    DEBUG ((EFI_D_INFO, "HackBGRT BMP Load ERR\n"));
 | 
				
			||||||
 | 
					    return;
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  DEBUG ((EFI_D_INFO, "HackBGRT Set Table; BMP Size: %d\n", BmpSize));
 | 
				
			||||||
 | 
					  // Clear the BGRT.
 | 
				
			||||||
 | 
					  CopyMem(bgrt, data, sizeof(data));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  if (GraphicsOutput != NULL && GraphicsOutput->Mode != NULL && GraphicsOutput->Mode->Info != NULL) 
 | 
				
			||||||
 | 
					  {
 | 
				
			||||||
 | 
					      BmpHeader = (BMP_IMAGE_HEADER *)BmpAddress;
 | 
				
			||||||
 | 
					      bgrt->image_address = (UINTN)BmpAddress;
 | 
				
			||||||
 | 
					      bgrt->image_offset_x = (GraphicsOutput->Mode->Info->HorizontalResolution - BmpHeader->PixelWidth) / 2;
 | 
				
			||||||
 | 
					      bgrt->image_offset_y = ((GraphicsOutput->Mode->Info->VerticalResolution * 382) / 1000) -
 | 
				
			||||||
 | 
					                             (BmpHeader->PixelHeight / 2);
 | 
				
			||||||
 | 
					      DEBUG ((EFI_D_INFO, "HackBGRT Set checksum\n"));
 | 
				
			||||||
 | 
					      SetAcpiSdtChecksum(bgrt);
 | 
				
			||||||
 | 
					      DEBUG ((EFI_D_INFO, "HackBGRT Add Table\n"));
 | 
				
			||||||
 | 
					      HandleAcpiTables(bgrt);
 | 
				
			||||||
 | 
					  } else {
 | 
				
			||||||
 | 
					      DEBUG ((EFI_D_INFO, "HackBGRT no display connected, skip adding table\n"));
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@@ -175,7 +175,7 @@ BootLogoEnableLogo (
 | 
				
			|||||||
      break;
 | 
					      break;
 | 
				
			||||||
    case EdkiiPlatformLogoDisplayAttributeCenter:
 | 
					    case EdkiiPlatformLogoDisplayAttributeCenter:
 | 
				
			||||||
      DestX = (SizeOfX - Image.Width) / 2;
 | 
					      DestX = (SizeOfX - Image.Width) / 2;
 | 
				
			||||||
      DestY = (SizeOfY - Image.Height) / 2;
 | 
					      DestY = (SizeOfY * 382) / 1000 - Image.Height / 2;
 | 
				
			||||||
      break;
 | 
					      break;
 | 
				
			||||||
    case EdkiiPlatformLogoDisplayAttributeCenterRight:
 | 
					    case EdkiiPlatformLogoDisplayAttributeCenterRight:
 | 
				
			||||||
      DestX = SizeOfX - Image.Width;
 | 
					      DestX = SizeOfX - Image.Width;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -24,6 +24,7 @@
 | 
				
			|||||||
#
 | 
					#
 | 
				
			||||||
 | 
					
 | 
				
			||||||
[Sources]
 | 
					[Sources]
 | 
				
			||||||
 | 
					  Bgrt.c
 | 
				
			||||||
  BootLogoLib.c
 | 
					  BootLogoLib.c
 | 
				
			||||||
 | 
					
 | 
				
			||||||
[Packages]
 | 
					[Packages]
 | 
				
			||||||
@@ -48,5 +49,12 @@
 | 
				
			|||||||
  gEfiUserManagerProtocolGuid                   ## CONSUMES
 | 
					  gEfiUserManagerProtocolGuid                   ## CONSUMES
 | 
				
			||||||
  gEdkiiPlatformLogoProtocolGuid                ## CONSUMES
 | 
					  gEdkiiPlatformLogoProtocolGuid                ## CONSUMES
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					[Guids]
 | 
				
			||||||
 | 
					  gEfiAcpiTableGuid                             ## CONSUMES ## GUID
 | 
				
			||||||
 | 
					  gEfiAcpi20TableGuid                           ## CONSUMES ## GUID
 | 
				
			||||||
 | 
					
 | 
				
			||||||
[FeaturePcd]
 | 
					[FeaturePcd]
 | 
				
			||||||
  gEfiMdePkgTokenSpaceGuid.PcdUgaConsumeSupport ## CONSUMES
 | 
					  gEfiMdePkgTokenSpaceGuid.PcdUgaConsumeSupport ## CONSUMES
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					[Pcd]
 | 
				
			||||||
 | 
					  gEfiMdeModulePkgTokenSpaceGuid.PcdLogoFile    ## CONSUMES
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -722,6 +722,7 @@ BootMaintExtractConfig (
 | 
				
			|||||||
    *Progress = Request + StrLen (Request);
 | 
					    *Progress = Request + StrLen (Request);
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  DEBUG ((EFI_D_INFO, "%a complete: %r\n", __FUNCTION__, Status));
 | 
				
			||||||
  return Status;
 | 
					  return Status;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -1033,6 +1034,7 @@ BootMaintRouteConfig (
 | 
				
			|||||||
  //
 | 
					  //
 | 
				
			||||||
  CopyMem (OldBmmData, NewBmmData, sizeof (BMM_FAKE_NV_DATA));
 | 
					  CopyMem (OldBmmData, NewBmmData, sizeof (BMM_FAKE_NV_DATA));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  DEBUG ((EFI_D_INFO, "%a complete: %r\n", __FUNCTION__, Status));
 | 
				
			||||||
  return EFI_SUCCESS;
 | 
					  return EFI_SUCCESS;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Exit:
 | 
					Exit:
 | 
				
			||||||
@@ -1093,6 +1095,8 @@ BootMaintCallback (
 | 
				
			|||||||
  Private        = BMM_CALLBACK_DATA_FROM_THIS (This);
 | 
					  Private        = BMM_CALLBACK_DATA_FROM_THIS (This);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  if (Action == EFI_BROWSER_ACTION_FORM_OPEN) {
 | 
					  if (Action == EFI_BROWSER_ACTION_FORM_OPEN) {
 | 
				
			||||||
 | 
					    DEBUG ((EFI_D_INFO, "EFI_BROWSER_ACTION_FORM_OPEN: 0x%0X\n", QuestionId));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (QuestionId == KEY_VALUE_TRIGGER_FORM_OPEN_ACTION) {
 | 
					    if (QuestionId == KEY_VALUE_TRIGGER_FORM_OPEN_ACTION) {
 | 
				
			||||||
      if (!mFirstEnterBMMForm) {
 | 
					      if (!mFirstEnterBMMForm) {
 | 
				
			||||||
        //
 | 
					        //
 | 
				
			||||||
@@ -1104,7 +1108,9 @@ BootMaintCallback (
 | 
				
			|||||||
        // 1. Update the menus (including legacy munu) show in BootMiantenanceManager page.
 | 
					        // 1. Update the menus (including legacy munu) show in BootMiantenanceManager page.
 | 
				
			||||||
        // 2. Re-scan the BootOption menus (including the legacy boot option).
 | 
					        // 2. Re-scan the BootOption menus (including the legacy boot option).
 | 
				
			||||||
        //
 | 
					        //
 | 
				
			||||||
        CustomizeMenus ();
 | 
					        //CustomizeMenus ();
 | 
				
			||||||
 | 
					        UpdatePageId (Private, FORM_BOOT_CHG_ID);
 | 
				
			||||||
 | 
					        UpdatePageBody (FORM_BOOT_CHG_ID, Private);
 | 
				
			||||||
        EfiBootManagerRefreshAllBootOption ();
 | 
					        EfiBootManagerRefreshAllBootOption ();
 | 
				
			||||||
        BOpt_GetBootOptions (Private);
 | 
					        BOpt_GetBootOptions (Private);
 | 
				
			||||||
        mFirstEnterBMMForm = TRUE;
 | 
					        mFirstEnterBMMForm = TRUE;
 | 
				
			||||||
@@ -1119,6 +1125,8 @@ BootMaintCallback (
 | 
				
			|||||||
  HiiGetBrowserData (&mBootMaintGuid, mBootMaintStorageName, sizeof (BMM_FAKE_NV_DATA), (UINT8 *) CurrentFakeNVMap);
 | 
					  HiiGetBrowserData (&mBootMaintGuid, mBootMaintStorageName, sizeof (BMM_FAKE_NV_DATA), (UINT8 *) CurrentFakeNVMap);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  if (Action == EFI_BROWSER_ACTION_CHANGING) {
 | 
					  if (Action == EFI_BROWSER_ACTION_CHANGING) {
 | 
				
			||||||
 | 
					    DEBUG ((EFI_D_INFO, "EFI_BROWSER_ACTION_CHANGING: 0x%0X\n", QuestionId));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (Value == NULL) {
 | 
					    if (Value == NULL) {
 | 
				
			||||||
      return EFI_INVALID_PARAMETER;
 | 
					      return EFI_INVALID_PARAMETER;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
@@ -1204,6 +1212,8 @@ BootMaintCallback (
 | 
				
			|||||||
      ChooseFile (NULL, L".efi", BootFromFile, &File);
 | 
					      ChooseFile (NULL, L".efi", BootFromFile, &File);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
  } else if (Action == EFI_BROWSER_ACTION_CHANGED) {
 | 
					  } else if (Action == EFI_BROWSER_ACTION_CHANGED) {
 | 
				
			||||||
 | 
					    DEBUG ((EFI_D_INFO, "EFI_BROWSER_ACTION_CHANGED: 0x%0X\n", QuestionId));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if ((Value == NULL) || (ActionRequest == NULL)) {
 | 
					    if ((Value == NULL) || (ActionRequest == NULL)) {
 | 
				
			||||||
      return EFI_INVALID_PARAMETER;
 | 
					      return EFI_INVALID_PARAMETER;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
@@ -1243,6 +1253,11 @@ BootMaintCallback (
 | 
				
			|||||||
      CurrentFakeNVMap->DriverOptionChanged = TRUE;
 | 
					      CurrentFakeNVMap->DriverOptionChanged = TRUE;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if (QuestionId == BOOT_OPTION_ORDER_QUESTION_ID) {
 | 
				
			||||||
 | 
					        // Save BootOrder on list update
 | 
				
			||||||
 | 
					        *ActionRequest = EFI_BROWSER_ACTION_REQUEST_FORM_APPLY;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if ((QuestionId >= BOOT_OPTION_DEL_QUESTION_ID) && (QuestionId < BOOT_OPTION_DEL_QUESTION_ID + MAX_MENU_NUMBER)) {
 | 
					    if ((QuestionId >= BOOT_OPTION_DEL_QUESTION_ID) && (QuestionId < BOOT_OPTION_DEL_QUESTION_ID + MAX_MENU_NUMBER)) {
 | 
				
			||||||
      if (Value->b){
 | 
					      if (Value->b){
 | 
				
			||||||
        //
 | 
					        //
 | 
				
			||||||
@@ -1306,6 +1321,7 @@ BootMaintCallback (
 | 
				
			|||||||
  //
 | 
					  //
 | 
				
			||||||
  HiiSetBrowserData (&mBootMaintGuid, mBootMaintStorageName, sizeof (BMM_FAKE_NV_DATA), (UINT8 *) CurrentFakeNVMap, NULL);
 | 
					  HiiSetBrowserData (&mBootMaintGuid, mBootMaintStorageName, sizeof (BMM_FAKE_NV_DATA), (UINT8 *) CurrentFakeNVMap, NULL);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  DEBUG ((EFI_D_INFO, "%a complete: %r\n", __FUNCTION__, EFI_SUCCESS));
 | 
				
			||||||
  return EFI_SUCCESS;
 | 
					  return EFI_SUCCESS;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -1630,6 +1646,28 @@ BmmInitialBootModeInfo (
 | 
				
			|||||||
  mBmmModeInitialized           = TRUE;
 | 
					  mBmmModeInitialized           = TRUE;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					STATIC
 | 
				
			||||||
 | 
					EFI_STATUS
 | 
				
			||||||
 | 
					UnregisterHotKeys(VOID)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					  EFI_STATUS Status;
 | 
				
			||||||
 | 
					  EFI_INPUT_KEY HotKey;
 | 
				
			||||||
 | 
					  EDKII_FORM_BROWSER_EXTENSION2_PROTOCOL *FormBrowserEx2;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  Status = gBS->LocateProtocol (&gEdkiiFormBrowserEx2ProtocolGuid, NULL, (VOID **) &FormBrowserEx2);
 | 
				
			||||||
 | 
					  if (!EFI_ERROR (Status)) {
 | 
				
			||||||
 | 
					    HotKey.UnicodeChar = CHAR_NULL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    HotKey.ScanCode = SCAN_F9;
 | 
				
			||||||
 | 
					    FormBrowserEx2->RegisterHotKey(&HotKey, BROWSER_ACTION_UNREGISTER, 0, NULL);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    HotKey.ScanCode = SCAN_F10;
 | 
				
			||||||
 | 
					    FormBrowserEx2->RegisterHotKey(&HotKey, BROWSER_ACTION_UNREGISTER, 0, NULL);
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  return Status;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  Install Boot Maintenance Manager Menu driver.
 | 
					  Install Boot Maintenance Manager Menu driver.
 | 
				
			||||||
@@ -1705,8 +1743,8 @@ BootMaintenanceManagerUiLibConstructor (
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  mBmmCallbackInfo->MenuEntry     = (BM_MENU_ENTRY *) Ptr;
 | 
					  mBmmCallbackInfo->MenuEntry     = (BM_MENU_ENTRY *) Ptr;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  mBmmCallbackInfo->BmmPreviousPageId  = FORM_MAIN_ID;
 | 
					  mBmmCallbackInfo->BmmPreviousPageId  = FORM_BOOT_CHG_ID;
 | 
				
			||||||
  mBmmCallbackInfo->BmmCurrentPageId   = FORM_MAIN_ID;
 | 
					  mBmmCallbackInfo->BmmCurrentPageId   = FORM_BOOT_CHG_ID;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  InitAllMenu (mBmmCallbackInfo);
 | 
					  InitAllMenu (mBmmCallbackInfo);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -1718,6 +1756,11 @@ BootMaintenanceManagerUiLibConstructor (
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  BmmInitialBootModeInfo();
 | 
					  BmmInitialBootModeInfo();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  //
 | 
				
			||||||
 | 
					  // Remove the F9 and F10 hotkeys
 | 
				
			||||||
 | 
					  //
 | 
				
			||||||
 | 
					  UnregisterHotKeys();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  return EFI_SUCCESS;
 | 
					  return EFI_SUCCESS;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -19,8 +19,9 @@ formset
 | 
				
			|||||||
    name = BmmData,
 | 
					    name = BmmData,
 | 
				
			||||||
    guid = BOOT_MAINT_FORMSET_GUID;
 | 
					    guid = BOOT_MAINT_FORMSET_GUID;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  form formid = FORM_MAIN_ID,
 | 
					  form formid = FORM_BOOT_CHG_ID,
 | 
				
			||||||
       title = STRING_TOKEN(STR_FORM_MAIN_TITLE);
 | 
					    title = STRING_TOKEN(STR_FORM_BOOT_CHG_TITLE);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    //
 | 
					    //
 | 
				
			||||||
    // Add this invisible text in order to indicate enter Boot Maintenance Manager form.
 | 
					    // Add this invisible text in order to indicate enter Boot Maintenance Manager form.
 | 
				
			||||||
    // To trigger the form open action.
 | 
					    // To trigger the form open action.
 | 
				
			||||||
@@ -33,6 +34,14 @@ formset
 | 
				
			|||||||
        key   = KEY_VALUE_TRIGGER_FORM_OPEN_ACTION;
 | 
					        key   = KEY_VALUE_TRIGGER_FORM_OPEN_ACTION;
 | 
				
			||||||
    endif;
 | 
					    endif;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    label FORM_BOOT_CHG_ID;
 | 
				
			||||||
 | 
					    label LABEL_END;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  endform;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  form formid = FORM_MAIN_ID,
 | 
				
			||||||
 | 
					       title = STRING_TOKEN(STR_FORM_MAIN_TITLE);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    label LABEL_FORM_MAIN_START;
 | 
					    label LABEL_FORM_MAIN_START;
 | 
				
			||||||
    //
 | 
					    //
 | 
				
			||||||
    // This is where we will dynamically add a Action type op-code to show
 | 
					    // This is where we will dynamically add a Action type op-code to show
 | 
				
			||||||
@@ -148,14 +157,6 @@ formset
 | 
				
			|||||||
       label LABEL_END;
 | 
					       label LABEL_END;
 | 
				
			||||||
  endform;
 | 
					  endform;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  form formid = FORM_BOOT_CHG_ID,
 | 
					 | 
				
			||||||
       title = STRING_TOKEN(STR_FORM_BOOT_CHG_TITLE);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
       label FORM_BOOT_CHG_ID;
 | 
					 | 
				
			||||||
       label LABEL_END;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  endform;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  form formid = FORM_DRV_ADD_ID,
 | 
					  form formid = FORM_DRV_ADD_ID,
 | 
				
			||||||
       title = STRING_TOKEN(STR_FORM_DRV_ADD_TITLE);
 | 
					       title = STRING_TOKEN(STR_FORM_DRV_ADD_TITLE);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -17,11 +17,11 @@
 | 
				
			|||||||
                                       #language fr-FR  "NONE"
 | 
					                                       #language fr-FR  "NONE"
 | 
				
			||||||
#string STR_MISSING_STRING             #language en-US  "Missing String"
 | 
					#string STR_MISSING_STRING             #language en-US  "Missing String"
 | 
				
			||||||
                                       #language fr-FR  "Missing String"
 | 
					                                       #language fr-FR  "Missing String"
 | 
				
			||||||
#string STR_FORM_MAIN_TITLE            #language en-US  "Boot Maintenance Manager"
 | 
					#string STR_FORM_MAIN_TITLE            #language en-US  "Change Boot Order"
 | 
				
			||||||
                                       #language fr-FR  "Boot Maintenance Manager"
 | 
					                                       #language fr-FR  "Boot Maintenance Manager"
 | 
				
			||||||
#string STR_FORM_BOOT_SETUP_TITLE      #language en-US  "Boot Options"
 | 
					#string STR_FORM_BOOT_SETUP_TITLE      #language en-US  "Boot Options"
 | 
				
			||||||
                                       #language fr-FR  "Boot Options"
 | 
					                                       #language fr-FR  "Boot Options"
 | 
				
			||||||
#string STR_BOOT_MAINT_MANAGER_HELP    #language en-US  "This selection will take you to the Boot Maintenance Manager"
 | 
					#string STR_BOOT_MAINT_MANAGER_HELP    #language en-US  "Change the order of boot entries"
 | 
				
			||||||
                                       #language fr-FR  "This selection will take you to the Boot Maintenance Manager"
 | 
					                                       #language fr-FR  "This selection will take you to the Boot Maintenance Manager"
 | 
				
			||||||
#string STR_FORM_BOOT_SETUP_HELP       #language en-US  "Modify system boot options"
 | 
					#string STR_FORM_BOOT_SETUP_HELP       #language en-US  "Modify system boot options"
 | 
				
			||||||
                                       #language fr-FR  "Modify system boot options"
 | 
					                                       #language fr-FR  "Modify system boot options"
 | 
				
			||||||
@@ -251,7 +251,7 @@
 | 
				
			|||||||
                                       #language fr-FR  "Boot system from a file or device"
 | 
					                                       #language fr-FR  "Boot system from a file or device"
 | 
				
			||||||
#string STR_OPTIONAL_DATA              #language en-US  "Input Optional Data"
 | 
					#string STR_OPTIONAL_DATA              #language en-US  "Input Optional Data"
 | 
				
			||||||
                                       #language fr-FR  "Input Optional Data"
 | 
					                                       #language fr-FR  "Input Optional Data"
 | 
				
			||||||
#string STR_CHANGE_ORDER               #language en-US  "Change the order"
 | 
					#string STR_CHANGE_ORDER               #language en-US  "Change Boot Order"
 | 
				
			||||||
                                       #language fr-FR  "Change the order"
 | 
					                                       #language fr-FR  "Change the order"
 | 
				
			||||||
#string STR_BOOT_LEGACY                #language en-US  "Boot Legacy System"
 | 
					#string STR_BOOT_LEGACY                #language en-US  "Boot Legacy System"
 | 
				
			||||||
                                       #language fr-FR  "Boot Legacy System"
 | 
					                                       #language fr-FR  "Boot Legacy System"
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -112,40 +112,6 @@ UpdatePageEnd (
 | 
				
			|||||||
  IN BMM_CALLBACK_DATA                *CallbackData
 | 
					  IN BMM_CALLBACK_DATA                *CallbackData
 | 
				
			||||||
  )
 | 
					  )
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  //
 | 
					 | 
				
			||||||
  // Create the "Apply changes" and "Discard changes" tags.
 | 
					 | 
				
			||||||
  //
 | 
					 | 
				
			||||||
  if (CallbackData->BmmAskSaveOrNot) {
 | 
					 | 
				
			||||||
    HiiCreateSubTitleOpCode (
 | 
					 | 
				
			||||||
      mStartOpCodeHandle,
 | 
					 | 
				
			||||||
      STRING_TOKEN (STR_NULL_STRING),
 | 
					 | 
				
			||||||
      0,
 | 
					 | 
				
			||||||
      0,
 | 
					 | 
				
			||||||
      0
 | 
					 | 
				
			||||||
      );
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    HiiCreateActionOpCode (
 | 
					 | 
				
			||||||
      mStartOpCodeHandle,
 | 
					 | 
				
			||||||
      KEY_VALUE_SAVE_AND_EXIT,
 | 
					 | 
				
			||||||
      STRING_TOKEN (STR_SAVE_AND_EXIT),
 | 
					 | 
				
			||||||
      STRING_TOKEN (STR_NULL_STRING),
 | 
					 | 
				
			||||||
      EFI_IFR_FLAG_CALLBACK,
 | 
					 | 
				
			||||||
      0
 | 
					 | 
				
			||||||
      );
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  //
 | 
					 | 
				
			||||||
  // Ensure user can return to the main page.
 | 
					 | 
				
			||||||
  //
 | 
					 | 
				
			||||||
  HiiCreateActionOpCode (
 | 
					 | 
				
			||||||
    mStartOpCodeHandle,
 | 
					 | 
				
			||||||
    KEY_VALUE_NO_SAVE_AND_EXIT,
 | 
					 | 
				
			||||||
    STRING_TOKEN (STR_NO_SAVE_AND_EXIT),
 | 
					 | 
				
			||||||
    STRING_TOKEN (STR_NULL_STRING),
 | 
					 | 
				
			||||||
    EFI_IFR_FLAG_CALLBACK,
 | 
					 | 
				
			||||||
    0
 | 
					 | 
				
			||||||
    );
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  HiiUpdateForm (
 | 
					  HiiUpdateForm (
 | 
				
			||||||
    CallbackData->BmmHiiHandle,
 | 
					    CallbackData->BmmHiiHandle,
 | 
				
			||||||
    &mBootMaintGuid,
 | 
					    &mBootMaintGuid,
 | 
				
			||||||
@@ -642,7 +608,7 @@ UpdateOrderPage (
 | 
				
			|||||||
      VarOffset,                                   // Offset in Buffer Storage
 | 
					      VarOffset,                                   // Offset in Buffer Storage
 | 
				
			||||||
      STRING_TOKEN (STR_CHANGE_ORDER),             // Question prompt text
 | 
					      STRING_TOKEN (STR_CHANGE_ORDER),             // Question prompt text
 | 
				
			||||||
      STRING_TOKEN (STR_CHANGE_ORDER),             // Question help text
 | 
					      STRING_TOKEN (STR_CHANGE_ORDER),             // Question help text
 | 
				
			||||||
      0,                                           // Question flag
 | 
					      EFI_IFR_FLAG_CALLBACK,                       // Question flag
 | 
				
			||||||
      0,                                           // Ordered list flag, e.g. EFI_IFR_UNIQUE_SET
 | 
					      0,                                           // Ordered list flag, e.g. EFI_IFR_UNIQUE_SET
 | 
				
			||||||
      EFI_IFR_TYPE_NUM_SIZE_32,                    // Data type of Question value
 | 
					      EFI_IFR_TYPE_NUM_SIZE_32,                    // Data type of Question value
 | 
				
			||||||
      100,                                         // Maximum container
 | 
					      100,                                         // Maximum container
 | 
				
			||||||
@@ -1143,8 +1109,8 @@ UpdatePageId (
 | 
				
			|||||||
    NewPageId = FORM_CON_COM_SETUP_ID;
 | 
					    NewPageId = FORM_CON_COM_SETUP_ID;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  if ((NewPageId > 0) && (NewPageId < MAXIMUM_FORM_ID)) {
 | 
					  //if ((NewPageId > 0) && (NewPageId < MAXIMUM_FORM_ID)) {
 | 
				
			||||||
    Private->BmmPreviousPageId  = Private->BmmCurrentPageId;
 | 
					  //  Private->BmmPreviousPageId  = Private->BmmCurrentPageId;
 | 
				
			||||||
    Private->BmmCurrentPageId   = NewPageId;
 | 
					  //  Private->BmmCurrentPageId   = NewPageId;
 | 
				
			||||||
  }
 | 
					  //}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -631,6 +631,7 @@ Var_UpdateBootOrder (
 | 
				
			|||||||
  BOpt_FreeMenu (&BootOptionMenu);
 | 
					  BOpt_FreeMenu (&BootOptionMenu);
 | 
				
			||||||
  BOpt_GetBootOptions (CallbackData);
 | 
					  BOpt_GetBootOptions (CallbackData);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  DEBUG ((EFI_D_INFO, "Updated BootOrder: %r\n", Status));
 | 
				
			||||||
  return Status;
 | 
					  return Status;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -8,6 +8,8 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
#include "BootManager.h"
 | 
					#include "BootManager.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include <Protocol/BlockIo.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
UINT16             mKeyInput;
 | 
					UINT16             mKeyInput;
 | 
				
			||||||
EFI_GUID           mBootManagerGuid = BOOT_MANAGER_FORMSET_GUID;
 | 
					EFI_GUID           mBootManagerGuid = BOOT_MANAGER_FORMSET_GUID;
 | 
				
			||||||
//
 | 
					//
 | 
				
			||||||
@@ -27,6 +29,10 @@ UINT32    mBmSetupVerticalResolution     = 0;
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
BOOLEAN   mBmModeInitialized             = FALSE;
 | 
					BOOLEAN   mBmModeInitialized             = FALSE;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					STATIC EFI_EVENT mBmRefreshEvent;
 | 
				
			||||||
 | 
					STATIC CONST EFI_GUID mBmRefreshGuid = BOOT_MANAGER_REFRESH_GUID;
 | 
				
			||||||
 | 
					STATIC VOID *mBlockIoRegistration; // Unused
 | 
				
			||||||
 | 
					
 | 
				
			||||||
CHAR16             *mDeviceTypeStr[] = {
 | 
					CHAR16             *mDeviceTypeStr[] = {
 | 
				
			||||||
  L"Legacy BEV",
 | 
					  L"Legacy BEV",
 | 
				
			||||||
  L"Legacy Floppy",
 | 
					  L"Legacy Floppy",
 | 
				
			||||||
@@ -484,22 +490,10 @@ UpdateBootManager (
 | 
				
			|||||||
  BOOLEAN                       IsLegacyOption;
 | 
					  BOOLEAN                       IsLegacyOption;
 | 
				
			||||||
  BOOLEAN                       NeedEndOp;
 | 
					  BOOLEAN                       NeedEndOp;
 | 
				
			||||||
  UINTN                         MaxLen;
 | 
					  UINTN                         MaxLen;
 | 
				
			||||||
 | 
					  UINTN                         OptionCount = 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  DeviceType = (UINT16) -1;
 | 
					  DeviceType = (UINT16) -1;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  //
 | 
					 | 
				
			||||||
  // for better user experience
 | 
					 | 
				
			||||||
  // 1. User changes HD configuration (e.g.: unplug HDD), here we have a chance to remove the HDD boot option
 | 
					 | 
				
			||||||
  // 2. User enables/disables UEFI PXE, here we have a chance to add/remove EFI Network boot option
 | 
					 | 
				
			||||||
  //
 | 
					 | 
				
			||||||
  EfiBootManagerRefreshAllBootOption ();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  //
 | 
					 | 
				
			||||||
  // BdsDxe doesn't group the legacy boot options for the same device type
 | 
					 | 
				
			||||||
  // It's UI's choice.
 | 
					 | 
				
			||||||
  //
 | 
					 | 
				
			||||||
  GroupMultipleLegacyBootOption4SameType ();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  BootOption = EfiBootManagerGetLoadOptions (&BootOptionCount, LoadOptionTypeBoot);
 | 
					  BootOption = EfiBootManagerGetLoadOptions (&BootOptionCount, LoadOptionTypeBoot);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  HiiHandle = gBootManagerPrivate.HiiHandle;
 | 
					  HiiHandle = gBootManagerPrivate.HiiHandle;
 | 
				
			||||||
@@ -526,6 +520,7 @@ UpdateBootManager (
 | 
				
			|||||||
  EndLabel = (EFI_IFR_GUID_LABEL *) HiiCreateGuidOpCode (EndOpCodeHandle, &gEfiIfrTianoGuid, NULL, sizeof (EFI_IFR_GUID_LABEL));
 | 
					  EndLabel = (EFI_IFR_GUID_LABEL *) HiiCreateGuidOpCode (EndOpCodeHandle, &gEfiIfrTianoGuid, NULL, sizeof (EFI_IFR_GUID_LABEL));
 | 
				
			||||||
  EndLabel->ExtendOpCode = EFI_IFR_EXTEND_OP_LABEL;
 | 
					  EndLabel->ExtendOpCode = EFI_IFR_EXTEND_OP_LABEL;
 | 
				
			||||||
  EndLabel->Number       = LABEL_BOOT_OPTION_END;
 | 
					  EndLabel->Number       = LABEL_BOOT_OPTION_END;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  mKeyInput = 0;
 | 
					  mKeyInput = 0;
 | 
				
			||||||
  NeedEndOp = FALSE;
 | 
					  NeedEndOp = FALSE;
 | 
				
			||||||
  for (Index = 0; Index < BootOptionCount; Index++) {
 | 
					  for (Index = 0; Index < BootOptionCount; Index++) {
 | 
				
			||||||
@@ -541,6 +536,8 @@ UpdateBootManager (
 | 
				
			|||||||
      continue;
 | 
					      continue;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    OptionCount++;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    //
 | 
					    //
 | 
				
			||||||
    // Group the legacy boot option in the sub title created dynamically
 | 
					    // Group the legacy boot option in the sub title created dynamically
 | 
				
			||||||
    //
 | 
					    //
 | 
				
			||||||
@@ -596,6 +593,10 @@ UpdateBootManager (
 | 
				
			|||||||
      );
 | 
					      );
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  if (OptionCount == 0) {
 | 
				
			||||||
 | 
					    HiiCreateSubTitleOpCode (StartOpCodeHandle, STRING_TOKEN (STR_NO_BOOTABLE_MEDIA), 0, 0, 0);
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  if (NeedEndOp) {
 | 
					  if (NeedEndOp) {
 | 
				
			||||||
    HiiCreateEndOpCode (StartOpCodeHandle);
 | 
					    HiiCreateEndOpCode (StartOpCodeHandle);
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
@@ -787,7 +788,6 @@ BootManagerCallback (
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
  EFI_BOOT_MANAGER_LOAD_OPTION *BootOption;
 | 
					  EFI_BOOT_MANAGER_LOAD_OPTION *BootOption;
 | 
				
			||||||
  UINTN                        BootOptionCount;
 | 
					  UINTN                        BootOptionCount;
 | 
				
			||||||
  EFI_INPUT_KEY                Key;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
  if (Action == EFI_BROWSER_ACTION_FORM_OPEN) {
 | 
					  if (Action == EFI_BROWSER_ACTION_FORM_OPEN) {
 | 
				
			||||||
    //
 | 
					    //
 | 
				
			||||||
@@ -831,19 +831,31 @@ BootManagerCallback (
 | 
				
			|||||||
  EfiBootManagerBoot (&BootOption[QuestionId - 1]);
 | 
					  EfiBootManagerBoot (&BootOption[QuestionId - 1]);
 | 
				
			||||||
  BmSetConsoleMode (TRUE);
 | 
					  BmSetConsoleMode (TRUE);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  if (EFI_ERROR (BootOption[QuestionId - 1].Status)) {
 | 
					 | 
				
			||||||
    gST->ConOut->OutputString (
 | 
					 | 
				
			||||||
                  gST->ConOut,
 | 
					 | 
				
			||||||
                  HiiGetString (gBootManagerPrivate.HiiHandle, STRING_TOKEN (STR_ANY_KEY_CONTINUE), NULL)
 | 
					 | 
				
			||||||
                  );
 | 
					 | 
				
			||||||
    gST->ConIn->ReadKeyStroke (gST->ConIn, &Key);
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  EfiBootManagerFreeLoadOptions (BootOption, BootOptionCount);
 | 
					  EfiBootManagerFreeLoadOptions (BootOption, BootOptionCount);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  return EFI_SUCCESS;
 | 
					  return EFI_SUCCESS;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					STATIC
 | 
				
			||||||
 | 
					VOID
 | 
				
			||||||
 | 
					EFIAPI
 | 
				
			||||||
 | 
					RefreshBootOptions(
 | 
				
			||||||
 | 
					  IN  EFI_EVENT   Event,
 | 
				
			||||||
 | 
					  IN  VOID        *Context
 | 
				
			||||||
 | 
					  )
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					  EFI_TPL OldTpl = gBS->RaiseTPL(TPL_CALLBACK);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  EfiBootManagerRefreshAllBootOption();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  // BdsDxe doesn't group the legacy boot options for the same device type. It's UI's choice.
 | 
				
			||||||
 | 
					  GroupMultipleLegacyBootOption4SameType();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  UpdateBootManager();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  gBS->RestoreTPL (OldTpl);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  Install Boot Manager Menu driver.
 | 
					  Install Boot Manager Menu driver.
 | 
				
			||||||
@@ -892,6 +904,23 @@ BootManagerUiLibConstructor (
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  BmInitialBootModeInfo ();
 | 
					  BmInitialBootModeInfo ();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  Status = gBS->CreateEventEx(
 | 
				
			||||||
 | 
					      EVT_NOTIFY_SIGNAL,
 | 
				
			||||||
 | 
					      TPL_CALLBACK,
 | 
				
			||||||
 | 
					      RefreshBootOptions,
 | 
				
			||||||
 | 
					      NULL,
 | 
				
			||||||
 | 
					      &mBmRefreshGuid,
 | 
				
			||||||
 | 
					      &mBmRefreshEvent
 | 
				
			||||||
 | 
					      );
 | 
				
			||||||
 | 
					  ASSERT_EFI_ERROR(Status);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  Status = gBS->RegisterProtocolNotify (
 | 
				
			||||||
 | 
					      &gEfiBlockIoProtocolGuid,
 | 
				
			||||||
 | 
					      mBmRefreshEvent,
 | 
				
			||||||
 | 
					      &mBlockIoRegistration
 | 
				
			||||||
 | 
					      );
 | 
				
			||||||
 | 
					  ASSERT_EFI_ERROR (Status);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  return EFI_SUCCESS;
 | 
					  return EFI_SUCCESS;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -912,6 +941,8 @@ BootManagerUiLibDestructor (
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
  EFI_STATUS    Status;
 | 
					  EFI_STATUS    Status;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  gBS->CloseEvent(mBmRefreshEvent);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  Status = gBS->UninstallMultipleProtocolInterfaces (
 | 
					  Status = gBS->UninstallMultipleProtocolInterfaces (
 | 
				
			||||||
                  gBootManagerPrivate.DriverHandle,
 | 
					                  gBootManagerPrivate.DriverHandle,
 | 
				
			||||||
                  &gEfiDevicePathProtocolGuid,
 | 
					                  &gEfiDevicePathProtocolGuid,
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -46,7 +46,12 @@ typedef struct {
 | 
				
			|||||||
  0x847bc3fe, 0xb974, 0x446d, {0x94, 0x49, 0x5a, 0xd5, 0x41, 0x2e, 0x99, 0x3b} \
 | 
					  0x847bc3fe, 0xb974, 0x446d, {0x94, 0x49, 0x5a, 0xd5, 0x41, 0x2e, 0x99, 0x3b} \
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define BOOT_MANAGER_FORM_ID     0x1000
 | 
					#define BOOT_MANAGER_REFRESH_GUID \
 | 
				
			||||||
 | 
					  { \
 | 
				
			||||||
 | 
					    0x7648C827, 0xBE32, 0x44D2, { 0xA1, 0x33, 0xF1, 0x7F, 0x93, 0x76, 0xC7, 0x00 } \
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#define BOOT_MANAGER_FORM_ID     0x1030
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define LABEL_BOOT_OPTION        0x00
 | 
					#define LABEL_BOOT_OPTION        0x00
 | 
				
			||||||
#define LABEL_BOOT_OPTION_END    0x01
 | 
					#define LABEL_BOOT_OPTION_END    0x01
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -17,20 +17,9 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
/=#
 | 
					/=#
 | 
				
			||||||
#langdef   en-US "English"
 | 
					#langdef   en-US "English"
 | 
				
			||||||
#langdef   fr-FR "Français"
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
#string STR_BM_BANNER                  #language en-US  "Boot Manager"
 | 
					#string STR_BM_BANNER                  #language en-US  "One Time Boot"
 | 
				
			||||||
                                       #language fr-FR  "Boot Manager"
 | 
					#string STR_BOOT_MANAGER_HELP          #language en-US  "Boot an entry one time"
 | 
				
			||||||
#string STR_BOOT_MANAGER_HELP          #language en-US  "This selection will take you to the Boot Manager"
 | 
					 | 
				
			||||||
                                       #language fr-FR  "This selection will take you to the Boot Manager"
 | 
					 | 
				
			||||||
#string STR_HELP_FOOTER                #language en-US  "Use the <↑> and <↓> keys to choose a boot option, the <Enter> key to select a boot option, and the <Esc> key to exit the Boot Manager Menu."
 | 
					 | 
				
			||||||
                                       #language fr-FR  "<↑> pour <↓> changer l'option, <ENTRER> choisir une option, <ESC> pour sortir"
 | 
					 | 
				
			||||||
#string STR_AND                        #language en-US  " and "
 | 
					 | 
				
			||||||
                                       #language fr-FR  " et "
 | 
					 | 
				
			||||||
#string STR_BOOT_OPTION_BANNER         #language en-US  "Boot Manager Menu"
 | 
					 | 
				
			||||||
                                       #language fr-FR  "le Menu d'Option de Botte"
 | 
					 | 
				
			||||||
#string STR_ANY_KEY_CONTINUE           #language en-US  "Press any key to continue..."
 | 
					#string STR_ANY_KEY_CONTINUE           #language en-US  "Press any key to continue..."
 | 
				
			||||||
                                       #language fr-FR  "Appuie n'importe quelle pour continuer..."
 | 
					#string STR_NO_BOOTABLE_MEDIA          #language en-US  "No bootable media found"
 | 
				
			||||||
#string STR_LAST_STRING                #language en-US  ""
 | 
					#string STR_EMPTY_STRING               #language en-US  ""
 | 
				
			||||||
                                       #language fr-FR  ""
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 
 | 
				
			|||||||
@@ -51,6 +51,7 @@
 | 
				
			|||||||
  gEfiHiiConfigAccessProtocolGuid               ## CONSUMES
 | 
					  gEfiHiiConfigAccessProtocolGuid               ## CONSUMES
 | 
				
			||||||
  gEfiDevicePathToTextProtocolGuid              ## CONSUMES
 | 
					  gEfiDevicePathToTextProtocolGuid              ## CONSUMES
 | 
				
			||||||
  gEdkiiFormBrowserEx2ProtocolGuid              ## CONSUMES
 | 
					  gEdkiiFormBrowserEx2ProtocolGuid              ## CONSUMES
 | 
				
			||||||
 | 
					  gEfiBlockIoProtocolGuid
 | 
				
			||||||
 | 
					
 | 
				
			||||||
[FeaturePcd]
 | 
					[FeaturePcd]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -7,8 +7,9 @@
 | 
				
			|||||||
//
 | 
					//
 | 
				
			||||||
//**/
 | 
					//**/
 | 
				
			||||||
#define FORMSET_GUID  { 0x847bc3fe, 0xb974, 0x446d, 0x94, 0x49, 0x5a, 0xd5, 0x41, 0x2e, 0x99, 0x3b }
 | 
					#define FORMSET_GUID  { 0x847bc3fe, 0xb974, 0x446d, 0x94, 0x49, 0x5a, 0xd5, 0x41, 0x2e, 0x99, 0x3b }
 | 
				
			||||||
 | 
					#define BOOT_MANAGER_REFRESH_GUID { 0x7648C827, 0xBE32, 0x44D2, { 0xA1, 0x33, 0xF1, 0x7F, 0x93, 0x76, 0xC7, 0x00 }}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define BOOT_MANAGER_FORM_ID     0x1000
 | 
					#define BOOT_MANAGER_FORM_ID     0x1030
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define LABEL_BOOT_OPTION        0x00
 | 
					#define LABEL_BOOT_OPTION        0x00
 | 
				
			||||||
#define LABEL_BOOT_OPTION_END    0x01
 | 
					#define LABEL_BOOT_OPTION_END    0x01
 | 
				
			||||||
@@ -21,18 +22,15 @@ formset
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  form formid = BOOT_MANAGER_FORM_ID,
 | 
					  form formid = BOOT_MANAGER_FORM_ID,
 | 
				
			||||||
    title  = STRING_TOKEN(STR_BM_BANNER);
 | 
					    title  = STRING_TOKEN(STR_BM_BANNER);
 | 
				
			||||||
 | 
					    refreshguid = BOOT_MANAGER_REFRESH_GUID;
 | 
				
			||||||
    subtitle text = STRING_TOKEN(STR_LAST_STRING);
 | 
					 | 
				
			||||||
    subtitle text = STRING_TOKEN(STR_BOOT_OPTION_BANNER);
 | 
					 | 
				
			||||||
    subtitle text = STRING_TOKEN(STR_LAST_STRING);
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    //
 | 
					    //
 | 
				
			||||||
    //Add this invisable text in order to indicate enter Boot Manager form.
 | 
					    //Add this invisable text in order to indicate enter Boot Manager form.
 | 
				
			||||||
    //
 | 
					    //
 | 
				
			||||||
    suppressif TRUE;
 | 
					    suppressif TRUE;
 | 
				
			||||||
      text
 | 
					      text
 | 
				
			||||||
              help  = STRING_TOKEN(STR_LAST_STRING ),
 | 
					        help  = STRING_TOKEN(STR_EMPTY_STRING),
 | 
				
			||||||
              text  = STRING_TOKEN(STR_LAST_STRING ),
 | 
					        text  = STRING_TOKEN(STR_EMPTY_STRING),
 | 
				
			||||||
        flags = INTERACTIVE,
 | 
					        flags = INTERACTIVE,
 | 
				
			||||||
        key   = 0x1212;
 | 
					        key   = 0x1212;
 | 
				
			||||||
    endif;
 | 
					    endif;
 | 
				
			||||||
@@ -43,9 +41,6 @@ formset
 | 
				
			|||||||
    label LABEL_BOOT_OPTION;
 | 
					    label LABEL_BOOT_OPTION;
 | 
				
			||||||
    label LABEL_BOOT_OPTION_END;
 | 
					    label LABEL_BOOT_OPTION_END;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    subtitle text = STRING_TOKEN(STR_LAST_STRING);
 | 
					 | 
				
			||||||
    subtitle text = STRING_TOKEN(STR_HELP_FOOTER);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  endform;
 | 
					  endform;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
endformset;
 | 
					endformset;
 | 
				
			||||||
 
 | 
				
			|||||||
 Submodule MdeModulePkg/Library/BrotliCustomDecompressLib/brotli updated: 666c3280cc...aa7b018dcb
									
								
							@@ -1779,6 +1779,9 @@ EfiBootManagerBoot (
 | 
				
			|||||||
  UINTN                     FileSize;
 | 
					  UINTN                     FileSize;
 | 
				
			||||||
  EFI_BOOT_LOGO_PROTOCOL    *BootLogo;
 | 
					  EFI_BOOT_LOGO_PROTOCOL    *BootLogo;
 | 
				
			||||||
  EFI_EVENT                 LegacyBootEvent;
 | 
					  EFI_EVENT                 LegacyBootEvent;
 | 
				
			||||||
 | 
					  EFI_INPUT_KEY             Key;
 | 
				
			||||||
 | 
					  UINTN                     Index;
 | 
				
			||||||
 | 
					  UINT8                     *SecureBoot;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  if (BootOption == NULL) {
 | 
					  if (BootOption == NULL) {
 | 
				
			||||||
    return;
 | 
					    return;
 | 
				
			||||||
@@ -1914,6 +1917,38 @@ EfiBootManagerBoot (
 | 
				
			|||||||
      //
 | 
					      //
 | 
				
			||||||
      BmReportLoadFailure (EFI_SW_DXE_BS_EC_BOOT_OPTION_LOAD_ERROR, Status);
 | 
					      BmReportLoadFailure (EFI_SW_DXE_BS_EC_BOOT_OPTION_LOAD_ERROR, Status);
 | 
				
			||||||
      BootOption->Status = Status;
 | 
					      BootOption->Status = Status;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      if (gST->ConOut != NULL) {
 | 
				
			||||||
 | 
					        gST->ConOut->ClearScreen (gST->ConOut);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        //
 | 
				
			||||||
 | 
					        // When UEFI Secure Boot is enabled, unsigned modules won't load.
 | 
				
			||||||
 | 
					        //
 | 
				
			||||||
 | 
					        SecureBoot = NULL;
 | 
				
			||||||
 | 
					        GetEfiGlobalVariable2 (EFI_SECURE_BOOT_MODE_NAME, (VOID**)&SecureBoot, NULL);
 | 
				
			||||||
 | 
					        if ((SecureBoot != NULL) && (*SecureBoot == SECURE_BOOT_MODE_ENABLE)) {
 | 
				
			||||||
 | 
					          AsciiPrint ("SecureBoot is enabled.\n");
 | 
				
			||||||
 | 
					        } else {
 | 
				
			||||||
 | 
					          AsciiPrint ("SecureBoot is disabled.\n");
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if (SecureBoot != NULL) {
 | 
				
			||||||
 | 
					          FreePool (SecureBoot);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        AsciiPrint (
 | 
				
			||||||
 | 
					            "Booting from '%s' failed; verify it contains a 64-bit UEFI OS.\n"
 | 
				
			||||||
 | 
					            "\nPress any key to continue booting...\n",
 | 
				
			||||||
 | 
					            BootOption->Description);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
 | 
					      if (gST->ConIn != NULL) {
 | 
				
			||||||
 | 
					        Status = gBS->WaitForEvent (1, &gST->ConIn->WaitForKey, &Index);
 | 
				
			||||||
 | 
					        ASSERT_EFI_ERROR (Status);
 | 
				
			||||||
 | 
					        ASSERT (Index == 0);
 | 
				
			||||||
 | 
					        while (!EFI_ERROR (gST->ConIn->ReadKeyStroke (gST->ConIn, &Key))) {}
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      return;
 | 
					      return;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
@@ -2116,12 +2151,14 @@ BmEnumerateBootOptions (
 | 
				
			|||||||
  EFI_BLOCK_IO_PROTOCOL                 *BlkIo;
 | 
					  EFI_BLOCK_IO_PROTOCOL                 *BlkIo;
 | 
				
			||||||
  UINTN                                 Removable;
 | 
					  UINTN                                 Removable;
 | 
				
			||||||
  UINTN                                 Index;
 | 
					  UINTN                                 Index;
 | 
				
			||||||
 | 
					  UINTN                                 EmmcCount;
 | 
				
			||||||
  CHAR16                                *Description;
 | 
					  CHAR16                                *Description;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  ASSERT (BootOptionCount != NULL);
 | 
					  ASSERT (BootOptionCount != NULL);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  *BootOptionCount = 0;
 | 
					  *BootOptionCount = 0;
 | 
				
			||||||
  BootOptions      = NULL;
 | 
					  BootOptions      = NULL;
 | 
				
			||||||
 | 
					  EmmcCount        = 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  //
 | 
					  //
 | 
				
			||||||
  // Parse removable block io followed by fixed block io
 | 
					  // Parse removable block io followed by fixed block io
 | 
				
			||||||
@@ -2160,6 +2197,17 @@ BmEnumerateBootOptions (
 | 
				
			|||||||
      }
 | 
					      }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      Description = BmGetBootDescription (Handles[Index]);
 | 
					      Description = BmGetBootDescription (Handles[Index]);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      //
 | 
				
			||||||
 | 
					      // Skip secondary entries for internal eMMC devices
 | 
				
			||||||
 | 
					      //
 | 
				
			||||||
 | 
					      if (StrCmp(Description, L"eMMC Device") == 0) {
 | 
				
			||||||
 | 
					        EmmcCount++;
 | 
				
			||||||
 | 
					        if (EmmcCount > 1) {
 | 
				
			||||||
 | 
					          continue;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      BootOptions = ReallocatePool (
 | 
					      BootOptions = ReallocatePool (
 | 
				
			||||||
                      sizeof (EFI_BOOT_MANAGER_LOAD_OPTION) * (*BootOptionCount),
 | 
					                      sizeof (EFI_BOOT_MANAGER_LOAD_OPTION) * (*BootOptionCount),
 | 
				
			||||||
                      sizeof (EFI_BOOT_MANAGER_LOAD_OPTION) * (*BootOptionCount + 1),
 | 
					                      sizeof (EFI_BOOT_MANAGER_LOAD_OPTION) * (*BootOptionCount + 1),
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -15,7 +15,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 | 
				
			|||||||
#define PRODUCT_IDENTIFICATION_LENGTH    16
 | 
					#define PRODUCT_IDENTIFICATION_LENGTH    16
 | 
				
			||||||
 | 
					
 | 
				
			||||||
CONST UINT16 mBmUsbLangId    = 0x0409; // English
 | 
					CONST UINT16 mBmUsbLangId    = 0x0409; // English
 | 
				
			||||||
CHAR16       mBmUefiPrefix[] = L"UEFI ";
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
LIST_ENTRY mPlatformBootDescriptionHandlers = INITIALIZE_LIST_HEAD_VARIABLE (mPlatformBootDescriptionHandlers);
 | 
					LIST_ENTRY mPlatformBootDescriptionHandlers = INITIALIZE_LIST_HEAD_VARIABLE (mPlatformBootDescriptionHandlers);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -144,9 +143,8 @@ BmGetDescriptionFromDiskInfo (
 | 
				
			|||||||
  EFI_ATAPI_IDENTIFY_DATA      IdentifyData;
 | 
					  EFI_ATAPI_IDENTIFY_DATA      IdentifyData;
 | 
				
			||||||
  EFI_SCSI_INQUIRY_DATA        InquiryData;
 | 
					  EFI_SCSI_INQUIRY_DATA        InquiryData;
 | 
				
			||||||
  CHAR16                       *Description;
 | 
					  CHAR16                       *Description;
 | 
				
			||||||
  UINTN                        Length;
 | 
					  CHAR16                       *DescTemp;
 | 
				
			||||||
  CONST UINTN                  ModelNameLength    = 40;
 | 
					  CONST UINTN                  ModelNameLength    = 40;
 | 
				
			||||||
  CONST UINTN                  SerialNumberLength = 20;
 | 
					 | 
				
			||||||
  CHAR8                        *StrPtr;
 | 
					  CHAR8                        *StrPtr;
 | 
				
			||||||
  UINT8                        Temp;
 | 
					  UINT8                        Temp;
 | 
				
			||||||
  EFI_DEVICE_PATH_PROTOCOL     *DevicePath;
 | 
					  EFI_DEVICE_PATH_PROTOCOL     *DevicePath;
 | 
				
			||||||
@@ -171,25 +169,19 @@ BmGetDescriptionFromDiskInfo (
 | 
				
			|||||||
                         &BufferSize
 | 
					                         &BufferSize
 | 
				
			||||||
                         );
 | 
					                         );
 | 
				
			||||||
    if (!EFI_ERROR (Status)) {
 | 
					    if (!EFI_ERROR (Status)) {
 | 
				
			||||||
      Description = AllocateZeroPool ((ModelNameLength + SerialNumberLength + 2) * sizeof (CHAR16));
 | 
					      Description = AllocateZeroPool (ModelNameLength * sizeof (CHAR16));
 | 
				
			||||||
      ASSERT (Description != NULL);
 | 
					      ASSERT (Description != NULL);
 | 
				
			||||||
      for (Index = 0; Index + 1 < ModelNameLength; Index += 2) {
 | 
					      for (Index = 0; Index + 1 < ModelNameLength; Index += 2) {
 | 
				
			||||||
        Description[Index]     = (CHAR16) IdentifyData.ModelName[Index + 1];
 | 
					        Description[Index]     = (CHAR16) IdentifyData.ModelName[Index + 1];
 | 
				
			||||||
        Description[Index + 1] = (CHAR16) IdentifyData.ModelName[Index];
 | 
					        Description[Index + 1] = (CHAR16) IdentifyData.ModelName[Index];
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
 | 
					      Description[Index] = L'\0';
 | 
				
			||||||
      Length = Index;
 | 
					 | 
				
			||||||
      Description[Length++] = L' ';
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      for (Index = 0; Index + 1 < SerialNumberLength; Index += 2) {
 | 
					 | 
				
			||||||
        Description[Length + Index]     = (CHAR16) IdentifyData.SerialNo[Index + 1];
 | 
					 | 
				
			||||||
        Description[Length + Index + 1] = (CHAR16) IdentifyData.SerialNo[Index];
 | 
					 | 
				
			||||||
      }
 | 
					 | 
				
			||||||
      Length += Index;
 | 
					 | 
				
			||||||
      Description[Length++] = L'\0';
 | 
					 | 
				
			||||||
      ASSERT (Length == ModelNameLength + SerialNumberLength + 2);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      BmEliminateExtraSpaces (Description);
 | 
					      BmEliminateExtraSpaces (Description);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      DescTemp = AllocateZeroPool (0x60);
 | 
				
			||||||
 | 
					      StrCatS (DescTemp, 0x60 / sizeof (CHAR16), Description);
 | 
				
			||||||
 | 
					      StrCpyS(Description, StrSize (DescTemp) / sizeof (CHAR16), DescTemp);
 | 
				
			||||||
 | 
					      FreePool (DescTemp);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
  } else if (CompareGuid (&DiskInfo->Interface, &gEfiDiskInfoScsiInterfaceGuid)) {
 | 
					  } else if (CompareGuid (&DiskInfo->Interface, &gEfiDiskInfoScsiInterfaceGuid)) {
 | 
				
			||||||
    BufferSize   = sizeof (EFI_SCSI_INQUIRY_DATA);
 | 
					    BufferSize   = sizeof (EFI_SCSI_INQUIRY_DATA);
 | 
				
			||||||
@@ -268,7 +260,6 @@ BmGetUsbDescription (
 | 
				
			|||||||
  CHAR16                       NullChar;
 | 
					  CHAR16                       NullChar;
 | 
				
			||||||
  CHAR16                       *Manufacturer;
 | 
					  CHAR16                       *Manufacturer;
 | 
				
			||||||
  CHAR16                       *Product;
 | 
					  CHAR16                       *Product;
 | 
				
			||||||
  CHAR16                       *SerialNumber;
 | 
					 | 
				
			||||||
  CHAR16                       *Description;
 | 
					  CHAR16                       *Description;
 | 
				
			||||||
  EFI_USB_DEVICE_DESCRIPTOR    DevDesc;
 | 
					  EFI_USB_DEVICE_DESCRIPTOR    DevDesc;
 | 
				
			||||||
  UINTN                        DescMaxSize;
 | 
					  UINTN                        DescMaxSize;
 | 
				
			||||||
@@ -309,24 +300,12 @@ BmGetUsbDescription (
 | 
				
			|||||||
    Product = &NullChar;
 | 
					    Product = &NullChar;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  Status = UsbIo->UsbGetStringDescriptor (
 | 
					 | 
				
			||||||
                    UsbIo,
 | 
					 | 
				
			||||||
                    mBmUsbLangId,
 | 
					 | 
				
			||||||
                    DevDesc.StrSerialNumber,
 | 
					 | 
				
			||||||
                    &SerialNumber
 | 
					 | 
				
			||||||
                    );
 | 
					 | 
				
			||||||
  if (EFI_ERROR (Status)) {
 | 
					 | 
				
			||||||
    SerialNumber = &NullChar;
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  if ((Manufacturer == &NullChar) &&
 | 
					  if ((Manufacturer == &NullChar) &&
 | 
				
			||||||
      (Product == &NullChar) &&
 | 
					      (Product == &NullChar)) {
 | 
				
			||||||
      (SerialNumber == &NullChar)
 | 
					 | 
				
			||||||
      ) {
 | 
					 | 
				
			||||||
    return NULL;
 | 
					    return NULL;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  DescMaxSize = StrSize (Manufacturer) + StrSize (Product) + StrSize (SerialNumber);
 | 
					  DescMaxSize = StrSize (Manufacturer) + StrSize (Product);
 | 
				
			||||||
  Description = AllocateZeroPool (DescMaxSize);
 | 
					  Description = AllocateZeroPool (DescMaxSize);
 | 
				
			||||||
  ASSERT (Description != NULL);
 | 
					  ASSERT (Description != NULL);
 | 
				
			||||||
  StrCatS (Description, DescMaxSize/sizeof(CHAR16), Manufacturer);
 | 
					  StrCatS (Description, DescMaxSize/sizeof(CHAR16), Manufacturer);
 | 
				
			||||||
@@ -335,17 +314,12 @@ BmGetUsbDescription (
 | 
				
			|||||||
  StrCatS (Description, DescMaxSize/sizeof(CHAR16), Product);
 | 
					  StrCatS (Description, DescMaxSize/sizeof(CHAR16), Product);
 | 
				
			||||||
  StrCatS (Description, DescMaxSize/sizeof(CHAR16), L" ");
 | 
					  StrCatS (Description, DescMaxSize/sizeof(CHAR16), L" ");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  StrCatS (Description, DescMaxSize/sizeof(CHAR16), SerialNumber);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  if (Manufacturer != &NullChar) {
 | 
					  if (Manufacturer != &NullChar) {
 | 
				
			||||||
    FreePool (Manufacturer);
 | 
					    FreePool (Manufacturer);
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  if (Product != &NullChar) {
 | 
					  if (Product != &NullChar) {
 | 
				
			||||||
    FreePool (Product);
 | 
					    FreePool (Product);
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  if (SerialNumber != &NullChar) {
 | 
					 | 
				
			||||||
    FreePool (SerialNumber);
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
  BmEliminateExtraSpaces (Description);
 | 
					  BmEliminateExtraSpaces (Description);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -564,6 +538,7 @@ BmGetNvmeDescription (
 | 
				
			|||||||
  EFI_NVM_EXPRESS_COMPLETION               Completion;
 | 
					  EFI_NVM_EXPRESS_COMPLETION               Completion;
 | 
				
			||||||
  NVME_ADMIN_CONTROLLER_DATA               ControllerData;
 | 
					  NVME_ADMIN_CONTROLLER_DATA               ControllerData;
 | 
				
			||||||
  CHAR16                                   *Description;
 | 
					  CHAR16                                   *Description;
 | 
				
			||||||
 | 
					  CHAR16                                   *DescTemp;
 | 
				
			||||||
  CHAR16                                   *Char;
 | 
					  CHAR16                                   *Char;
 | 
				
			||||||
  UINTN                                    Index;
 | 
					  UINTN                                    Index;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -630,16 +605,11 @@ BmGetNvmeDescription (
 | 
				
			|||||||
    for (Index = 0; Index < ARRAY_SIZE (ControllerData.Mn); Index++) {
 | 
					    for (Index = 0; Index < ARRAY_SIZE (ControllerData.Mn); Index++) {
 | 
				
			||||||
      *(Char++) = (CHAR16) ControllerData.Mn[Index];
 | 
					      *(Char++) = (CHAR16) ControllerData.Mn[Index];
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    *(Char++) = L' ';
 | 
					 | 
				
			||||||
    for (Index = 0; Index < ARRAY_SIZE (ControllerData.Sn); Index++) {
 | 
					 | 
				
			||||||
      *(Char++) = (CHAR16) ControllerData.Sn[Index];
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
    *(Char++) = L' ';
 | 
					 | 
				
			||||||
    UnicodeValueToStringS (
 | 
					 | 
				
			||||||
      Char, sizeof (CHAR16) * (MAXIMUM_VALUE_CHARACTERS + 1),
 | 
					 | 
				
			||||||
      0, DevicePath.NvmeNamespace->NamespaceId, 0
 | 
					 | 
				
			||||||
      );
 | 
					 | 
				
			||||||
    BmEliminateExtraSpaces (Description);
 | 
					    BmEliminateExtraSpaces (Description);
 | 
				
			||||||
 | 
					    DescTemp = AllocateZeroPool (0x60);
 | 
				
			||||||
 | 
					    StrCatS (DescTemp, 0x60 / sizeof (CHAR16), Description);
 | 
				
			||||||
 | 
					    StrCpyS(Description, StrSize (DescTemp) / sizeof (CHAR16), DescTemp);
 | 
				
			||||||
 | 
					    FreePool (DescTemp);
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  return Description;
 | 
					  return Description;
 | 
				
			||||||
@@ -771,7 +741,6 @@ BmGetBootDescription (
 | 
				
			|||||||
  BM_BOOT_DESCRIPTION_ENTRY      *Entry;
 | 
					  BM_BOOT_DESCRIPTION_ENTRY      *Entry;
 | 
				
			||||||
  CHAR16                         *Description;
 | 
					  CHAR16                         *Description;
 | 
				
			||||||
  CHAR16                         *DefaultDescription;
 | 
					  CHAR16                         *DefaultDescription;
 | 
				
			||||||
  CHAR16                         *Temp;
 | 
					 | 
				
			||||||
  UINTN                          Index;
 | 
					  UINTN                          Index;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  //
 | 
					  //
 | 
				
			||||||
@@ -781,16 +750,6 @@ BmGetBootDescription (
 | 
				
			|||||||
  for (Index = 0; Index < ARRAY_SIZE (mBmBootDescriptionHandlers); Index++) {
 | 
					  for (Index = 0; Index < ARRAY_SIZE (mBmBootDescriptionHandlers); Index++) {
 | 
				
			||||||
    DefaultDescription = mBmBootDescriptionHandlers[Index] (Handle);
 | 
					    DefaultDescription = mBmBootDescriptionHandlers[Index] (Handle);
 | 
				
			||||||
    if (DefaultDescription != NULL) {
 | 
					    if (DefaultDescription != NULL) {
 | 
				
			||||||
      //
 | 
					 | 
				
			||||||
      // Avoid description confusion between UEFI & Legacy boot option by adding "UEFI " prefix
 | 
					 | 
				
			||||||
      // ONLY for core provided boot description handler.
 | 
					 | 
				
			||||||
      //
 | 
					 | 
				
			||||||
      Temp = AllocatePool (StrSize (DefaultDescription) + sizeof (mBmUefiPrefix));
 | 
					 | 
				
			||||||
      ASSERT (Temp != NULL);
 | 
					 | 
				
			||||||
      StrCpyS (Temp, (StrSize (DefaultDescription) + sizeof (mBmUefiPrefix)) / sizeof (CHAR16), mBmUefiPrefix);
 | 
					 | 
				
			||||||
      StrCatS (Temp, (StrSize (DefaultDescription) + sizeof (mBmUefiPrefix)) / sizeof (CHAR16), DefaultDescription);
 | 
					 | 
				
			||||||
      FreePool (DefaultDescription);
 | 
					 | 
				
			||||||
      DefaultDescription = Temp;
 | 
					 | 
				
			||||||
      break;
 | 
					      break;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -44,6 +44,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 | 
				
			|||||||
#include <Protocol/DeferredImageLoad.h>
 | 
					#include <Protocol/DeferredImageLoad.h>
 | 
				
			||||||
#include <Protocol/PlatformBootManager.h>
 | 
					#include <Protocol/PlatformBootManager.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include <Guid/ImageAuthentication.h>
 | 
				
			||||||
#include <Guid/MemoryTypeInformation.h>
 | 
					#include <Guid/MemoryTypeInformation.h>
 | 
				
			||||||
#include <Guid/FileInfo.h>
 | 
					#include <Guid/FileInfo.h>
 | 
				
			||||||
#include <Guid/GlobalVariable.h>
 | 
					#include <Guid/GlobalVariable.h>
 | 
				
			||||||
 
 | 
				
			|||||||
										
											Binary file not shown.
										
									
								
							| 
		 Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 315 KiB  | 
@@ -2159,3 +2159,8 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
[UserExtensions.TianoCore."ExtraFiles"]
 | 
					[UserExtensions.TianoCore."ExtraFiles"]
 | 
				
			||||||
  MdeModulePkgExtra.uni
 | 
					  MdeModulePkgExtra.uni
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					[PcdsFixedAtBuild, PcdsPatchableInModule]
 | 
				
			||||||
 | 
					  ## FFS filename to find the default BMP Logo file.
 | 
				
			||||||
 | 
					  # @Prompt FFS Name of Boot Logo File
 | 
				
			||||||
 | 
					  gEfiMdeModulePkgTokenSpaceGuid.PcdLogoFile |{ 0x99, 0x8b, 0xB2, 0x7B, 0xBB, 0x61, 0xD5, 0x11, 0x9A, 0x5D, 0x00, 0x90, 0x27, 0x3F, 0xC1, 0x4D }|VOID*|0x40000003
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -326,7 +326,8 @@ BdsWait (
 | 
				
			|||||||
                    //         Can be removed after all keyboard drivers invoke callback in timer callback.
 | 
					                    //         Can be removed after all keyboard drivers invoke callback in timer callback.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (HotkeyTriggered != NULL) {
 | 
					    if (HotkeyTriggered != NULL) {
 | 
				
			||||||
      Status = BdsWaitForSingleEvent (HotkeyTriggered, EFI_TIMER_PERIOD_SECONDS (1));
 | 
					      //Status = BdsWaitForSingleEvent (HotkeyTriggered, EFI_TIMER_PERIOD_SECONDS (1));
 | 
				
			||||||
 | 
					      Status = BdsWaitForSingleEvent (gST->ConIn->WaitForKey, EFI_TIMER_PERIOD_SECONDS (1));
 | 
				
			||||||
      if (!EFI_ERROR (Status)) {
 | 
					      if (!EFI_ERROR (Status)) {
 | 
				
			||||||
        break;
 | 
					        break;
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
@@ -1024,7 +1025,7 @@ BdsEntry (
 | 
				
			|||||||
    //
 | 
					    //
 | 
				
			||||||
    // BdsReadKeys() can be removed after all keyboard drivers invoke callback in timer callback.
 | 
					    // BdsReadKeys() can be removed after all keyboard drivers invoke callback in timer callback.
 | 
				
			||||||
    //
 | 
					    //
 | 
				
			||||||
    BdsReadKeys ();
 | 
					    //BdsReadKeys ();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    EfiBootManagerHotkeyBoot ();
 | 
					    EfiBootManagerHotkeyBoot ();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -499,19 +499,6 @@ GraphicsConsoleControllerDriverStart (
 | 
				
			|||||||
        }
 | 
					        }
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    if (ModeNumber != Private->GraphicsOutput->Mode->Mode) {
 | 
					 | 
				
			||||||
      //
 | 
					 | 
				
			||||||
      // Current graphics mode is not set or is not set to the mode which we have found,
 | 
					 | 
				
			||||||
      // set the new graphic mode.
 | 
					 | 
				
			||||||
      //
 | 
					 | 
				
			||||||
      Status = Private->GraphicsOutput->SetMode (Private->GraphicsOutput, ModeNumber);
 | 
					 | 
				
			||||||
      if (EFI_ERROR (Status)) {
 | 
					 | 
				
			||||||
        //
 | 
					 | 
				
			||||||
        // The mode set operation failed
 | 
					 | 
				
			||||||
        //
 | 
					 | 
				
			||||||
        goto Error;
 | 
					 | 
				
			||||||
      }
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
  } else if (FeaturePcdGet (PcdUgaConsumeSupport)) {
 | 
					  } else if (FeaturePcdGet (PcdUgaConsumeSupport)) {
 | 
				
			||||||
    //
 | 
					    //
 | 
				
			||||||
    // At first try to set user-defined resolution
 | 
					    // At first try to set user-defined resolution
 | 
				
			||||||
@@ -780,23 +767,6 @@ CheckModeSupported (
 | 
				
			|||||||
                       &Info
 | 
					                       &Info
 | 
				
			||||||
                       );
 | 
					                       );
 | 
				
			||||||
    if (!EFI_ERROR (Status)) {
 | 
					    if (!EFI_ERROR (Status)) {
 | 
				
			||||||
      if ((Info->HorizontalResolution == HorizontalResolution) &&
 | 
					 | 
				
			||||||
          (Info->VerticalResolution == VerticalResolution)) {
 | 
					 | 
				
			||||||
        if ((GraphicsOutput->Mode->Info->HorizontalResolution == HorizontalResolution) &&
 | 
					 | 
				
			||||||
            (GraphicsOutput->Mode->Info->VerticalResolution == VerticalResolution)) {
 | 
					 | 
				
			||||||
          //
 | 
					 | 
				
			||||||
          // If video device has been set to this mode, we do not need to SetMode again
 | 
					 | 
				
			||||||
          //
 | 
					 | 
				
			||||||
          FreePool (Info);
 | 
					 | 
				
			||||||
          break;
 | 
					 | 
				
			||||||
        } else {
 | 
					 | 
				
			||||||
          Status = GraphicsOutput->SetMode (GraphicsOutput, ModeNumber);
 | 
					 | 
				
			||||||
          if (!EFI_ERROR (Status)) {
 | 
					 | 
				
			||||||
            FreePool (Info);
 | 
					 | 
				
			||||||
            break;
 | 
					 | 
				
			||||||
          }
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
      }
 | 
					 | 
				
			||||||
      FreePool (Info);
 | 
					      FreePool (Info);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
@@ -1922,7 +1892,8 @@ FlushCursor (
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  CurrentMode = This->Mode;
 | 
					  CurrentMode = This->Mode;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  if (!CurrentMode->CursorVisible) {
 | 
					  if (!CurrentMode->CursorVisible ||
 | 
				
			||||||
 | 
					      (CurrentMode->CursorColumn == 0 && CurrentMode->CursorRow == 0 )) {
 | 
				
			||||||
    return EFI_SUCCESS;
 | 
					    return EFI_SUCCESS;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -25,7 +25,7 @@ typedef struct {
 | 
				
			|||||||
} DEFERRED_3RD_PARTY_IMAGE_TABLE;
 | 
					} DEFERRED_3RD_PARTY_IMAGE_TABLE;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
BOOLEAN                          mImageLoadedAfterEndOfDxe   = FALSE;
 | 
					BOOLEAN                          mImageLoadedAfterEndOfDxe   = FALSE;
 | 
				
			||||||
BOOLEAN                          mEndOfDxe                   = FALSE;
 | 
					BOOLEAN                          mEndOfDxe                   = TRUE;
 | 
				
			||||||
DEFERRED_3RD_PARTY_IMAGE_TABLE   mDeferred3rdPartyImage = {
 | 
					DEFERRED_3RD_PARTY_IMAGE_TABLE   mDeferred3rdPartyImage = {
 | 
				
			||||||
  0,       // Deferred image count
 | 
					  0,       // Deferred image count
 | 
				
			||||||
  NULL     // The deferred image info
 | 
					  NULL     // The deferred image info
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -6378,7 +6378,11 @@ typedef union {
 | 
				
			|||||||
    /// [Bit 11] Execute Disable Bit Enable: IA32_EFER.NXE (R/W).
 | 
					    /// [Bit 11] Execute Disable Bit Enable: IA32_EFER.NXE (R/W).
 | 
				
			||||||
    ///
 | 
					    ///
 | 
				
			||||||
    UINT32  NXE:1;
 | 
					    UINT32  NXE:1;
 | 
				
			||||||
    UINT32  Reserved3:20;
 | 
					    ///
 | 
				
			||||||
 | 
					    /// [ Bit 12] Secure Virtual Machine Enable (AMD only)
 | 
				
			||||||
 | 
					    ///
 | 
				
			||||||
 | 
					    UINT32  SVME:1;
 | 
				
			||||||
 | 
					    UINT32  Reserved3:19;
 | 
				
			||||||
    UINT32  Reserved4:32;
 | 
					    UINT32  Reserved4:32;
 | 
				
			||||||
  } Bits;
 | 
					  } Bits;
 | 
				
			||||||
  ///
 | 
					  ///
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										29
									
								
								OvmfPkg/Include/Library/Tcg2PhysicalPresencePlatformLib.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										29
									
								
								OvmfPkg/Include/Library/Tcg2PhysicalPresencePlatformLib.h
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,29 @@
 | 
				
			|||||||
 | 
					/** @file
 | 
				
			||||||
 | 
					  Returns the platform specific Physical Presence configuration.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  Copyright (C) 2020 9elements GmbH
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  SPDX-License-Identifier: BSD-2-Clause-Patent
 | 
				
			||||||
 | 
					**/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#ifndef __TCG2_PHYSICAL_PRESENCE_PLATFORM_LIB_H__
 | 
				
			||||||
 | 
					#define __TCG2_PHYSICAL_PRESENCE_PLATFORM_LIB_H__
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include <IndustryStandard/QemuTpm.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					  Reads the platform specific Physical Presence configuration.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  @param[out]  The Config structure to read to.
 | 
				
			||||||
 | 
					  @param[out]  The PPIinMMIO is True when the PPI is in MMIO memory space
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  @retval EFI_SUCCESS           Operation completed successfully.
 | 
				
			||||||
 | 
					  @retval EFI_PROTOCOL_ERROR    Invalid fw_cfg entry size.
 | 
				
			||||||
 | 
					**/
 | 
				
			||||||
 | 
					EFI_STATUS
 | 
				
			||||||
 | 
					TpmPPIPlatformReadConfig (
 | 
				
			||||||
 | 
					  OUT QEMU_FWCFG_TPM_CONFIG *Config,
 | 
				
			||||||
 | 
					  OUT BOOLEAN               *PPIinMMIO
 | 
				
			||||||
 | 
					  );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
@@ -27,8 +27,8 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 | 
				
			|||||||
#include <Library/HobLib.h>
 | 
					#include <Library/HobLib.h>
 | 
				
			||||||
#include <Library/MemoryAllocationLib.h>
 | 
					#include <Library/MemoryAllocationLib.h>
 | 
				
			||||||
#include <Library/PrintLib.h>
 | 
					#include <Library/PrintLib.h>
 | 
				
			||||||
#include <Library/QemuFwCfgLib.h>
 | 
					 | 
				
			||||||
#include <Library/Tpm2CommandLib.h>
 | 
					#include <Library/Tpm2CommandLib.h>
 | 
				
			||||||
 | 
					#include <Library/Tcg2PhysicalPresencePlatformLib.h>
 | 
				
			||||||
#include <Library/UefiBootServicesTableLib.h>
 | 
					#include <Library/UefiBootServicesTableLib.h>
 | 
				
			||||||
#include <Library/UefiLib.h>
 | 
					#include <Library/UefiLib.h>
 | 
				
			||||||
#include <Library/UefiRuntimeServicesTableLib.h>
 | 
					#include <Library/UefiRuntimeServicesTableLib.h>
 | 
				
			||||||
@@ -37,46 +37,15 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
#define CONFIRM_BUFFER_SIZE         4096
 | 
					#define CONFIRM_BUFFER_SIZE         4096
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/* Wait 3 minutes for user input */
 | 
				
			||||||
 | 
					#define TIMEOUT                     (1000 * 1000 * 60 * 3)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
EFI_HII_HANDLE mTcg2PpStringPackHandle;
 | 
					EFI_HII_HANDLE mTcg2PpStringPackHandle;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define TPM_PPI_FLAGS (QEMU_TPM_PPI_FUNC_ALLOWED_USR_REQ)
 | 
					#define TPM_PPI_FLAGS (QEMU_TPM_PPI_FUNC_ALLOWED_USR_REQ)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
STATIC volatile QEMU_TPM_PPI *mPpi;
 | 
					STATIC volatile QEMU_TPM_PPI *mPpi;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
/**
 | 
					 | 
				
			||||||
  Reads QEMU PPI config from fw_cfg.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  @param[out]  The Config structure to read to.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  @retval EFI_SUCCESS           Operation completed successfully.
 | 
					 | 
				
			||||||
  @retval EFI_PROTOCOL_ERROR    Invalid fw_cfg entry size.
 | 
					 | 
				
			||||||
**/
 | 
					 | 
				
			||||||
STATIC
 | 
					 | 
				
			||||||
EFI_STATUS
 | 
					 | 
				
			||||||
QemuTpmReadConfig (
 | 
					 | 
				
			||||||
  OUT QEMU_FWCFG_TPM_CONFIG *Config
 | 
					 | 
				
			||||||
  )
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
  EFI_STATUS           Status;
 | 
					 | 
				
			||||||
  FIRMWARE_CONFIG_ITEM FwCfgItem;
 | 
					 | 
				
			||||||
  UINTN                FwCfgSize;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  Status = QemuFwCfgFindFile ("etc/tpm/config", &FwCfgItem, &FwCfgSize);
 | 
					 | 
				
			||||||
  if (EFI_ERROR (Status)) {
 | 
					 | 
				
			||||||
    return Status;
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  if (FwCfgSize != sizeof (*Config)) {
 | 
					 | 
				
			||||||
    return EFI_PROTOCOL_ERROR;
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  QemuFwCfgSelectItem (FwCfgItem);
 | 
					 | 
				
			||||||
  QemuFwCfgReadBytes (sizeof (*Config), Config);
 | 
					 | 
				
			||||||
  return EFI_SUCCESS;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
  Initializes QEMU PPI memory region.
 | 
					  Initializes QEMU PPI memory region.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -91,6 +60,7 @@ QemuTpmInitPPI (
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
  EFI_STATUS                      Status;
 | 
					  EFI_STATUS                      Status;
 | 
				
			||||||
  QEMU_FWCFG_TPM_CONFIG           Config;
 | 
					  QEMU_FWCFG_TPM_CONFIG           Config;
 | 
				
			||||||
 | 
					  BOOLEAN                         PPIinMMIO;
 | 
				
			||||||
  EFI_PHYSICAL_ADDRESS            PpiAddress64;
 | 
					  EFI_PHYSICAL_ADDRESS            PpiAddress64;
 | 
				
			||||||
  EFI_GCD_MEMORY_SPACE_DESCRIPTOR Descriptor;
 | 
					  EFI_GCD_MEMORY_SPACE_DESCRIPTOR Descriptor;
 | 
				
			||||||
  UINTN                           Idx;
 | 
					  UINTN                           Idx;
 | 
				
			||||||
@@ -99,7 +69,7 @@ QemuTpmInitPPI (
 | 
				
			|||||||
    return EFI_SUCCESS;
 | 
					    return EFI_SUCCESS;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  Status = QemuTpmReadConfig (&Config);
 | 
					  Status = TpmPPIPlatformReadConfig (&Config, &PPIinMMIO);
 | 
				
			||||||
  if (EFI_ERROR (Status)) {
 | 
					  if (EFI_ERROR (Status)) {
 | 
				
			||||||
    return Status;
 | 
					    return Status;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
@@ -123,12 +93,22 @@ QemuTpmInitPPI (
 | 
				
			|||||||
    ASSERT_EFI_ERROR (Status);
 | 
					    ASSERT_EFI_ERROR (Status);
 | 
				
			||||||
    goto InvalidPpiAddress;
 | 
					    goto InvalidPpiAddress;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					  if (PPIinMMIO) {
 | 
				
			||||||
    if (!EFI_ERROR (Status) &&
 | 
					    if (!EFI_ERROR (Status) &&
 | 
				
			||||||
        (Descriptor.GcdMemoryType != EfiGcdMemoryTypeMemoryMappedIo &&
 | 
					        (Descriptor.GcdMemoryType != EfiGcdMemoryTypeMemoryMappedIo &&
 | 
				
			||||||
        Descriptor.GcdMemoryType != EfiGcdMemoryTypeNonExistent)) {
 | 
					        Descriptor.GcdMemoryType != EfiGcdMemoryTypeNonExistent)) {
 | 
				
			||||||
      DEBUG ((DEBUG_ERROR, "[TPM2PP] mPpi has an invalid memory type\n"));
 | 
					      DEBUG ((DEBUG_ERROR, "[TPM2PP] mPpi has an invalid memory type\n"));
 | 
				
			||||||
      goto InvalidPpiAddress;
 | 
					      goto InvalidPpiAddress;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					  } else {
 | 
				
			||||||
 | 
					    if (!EFI_ERROR (Status) &&
 | 
				
			||||||
 | 
					      (Descriptor.GcdMemoryType != EfiGcdMemoryTypeReserved &&
 | 
				
			||||||
 | 
					       Descriptor.GcdMemoryType != EfiGcdMemoryTypeSystemMemory)) {
 | 
				
			||||||
 | 
					      DEBUG ((DEBUG_ERROR, "[TPM2PP] mPpi has an invalid memory type\n"));
 | 
				
			||||||
 | 
					      goto InvalidPpiAddress;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  for (Idx = 0; Idx < ARRAY_SIZE (mPpi->Func); Idx++) {
 | 
					  for (Idx = 0; Idx < ARRAY_SIZE (mPpi->Func); Idx++) {
 | 
				
			||||||
    mPpi->Func[Idx] = 0;
 | 
					    mPpi->Func[Idx] = 0;
 | 
				
			||||||
@@ -360,12 +340,16 @@ Tcg2ExecutePhysicalPresence (
 | 
				
			|||||||
STATIC
 | 
					STATIC
 | 
				
			||||||
BOOLEAN
 | 
					BOOLEAN
 | 
				
			||||||
Tcg2ReadUserKey (
 | 
					Tcg2ReadUserKey (
 | 
				
			||||||
  IN     BOOLEAN                    CautionKey
 | 
					  IN     BOOLEAN                    CautionKey,
 | 
				
			||||||
 | 
					  IN     UINTN                      Timeout
 | 
				
			||||||
  )
 | 
					  )
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  EFI_STATUS                        Status;
 | 
					  EFI_STATUS                        Status;
 | 
				
			||||||
  EFI_INPUT_KEY                     Key;
 | 
					  EFI_INPUT_KEY                     Key;
 | 
				
			||||||
  UINT16                            InputKey;
 | 
					  UINT16                            InputKey;
 | 
				
			||||||
 | 
					  UINTN                             Delay;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  Delay = Timeout / 50;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  InputKey = 0;
 | 
					  InputKey = 0;
 | 
				
			||||||
  do {
 | 
					  do {
 | 
				
			||||||
@@ -382,7 +366,13 @@ Tcg2ReadUserKey (
 | 
				
			|||||||
        InputKey = Key.ScanCode;
 | 
					        InputKey = Key.ScanCode;
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
  } while (InputKey == 0);
 | 
					    gBS->Stall (50);
 | 
				
			||||||
 | 
					    Delay--;
 | 
				
			||||||
 | 
					  } while (InputKey == 0 && Delay > 0);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  if (Delay == 0) {
 | 
				
			||||||
 | 
					    return FALSE;
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  if (InputKey != SCAN_ESC) {
 | 
					  if (InputKey != SCAN_ESC) {
 | 
				
			||||||
    return TRUE;
 | 
					    return TRUE;
 | 
				
			||||||
@@ -638,7 +628,7 @@ Tcg2UserConfirm (
 | 
				
			|||||||
  FreePool (ConfirmText);
 | 
					  FreePool (ConfirmText);
 | 
				
			||||||
  HiiRemovePackages (mTcg2PpStringPackHandle);
 | 
					  HiiRemovePackages (mTcg2PpStringPackHandle);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  if (Tcg2ReadUserKey (CautionKey)) {
 | 
					  if (Tcg2ReadUserKey (CautionKey, TIMEOUT)) {
 | 
				
			||||||
    return TRUE;
 | 
					    return TRUE;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -57,11 +57,11 @@
 | 
				
			|||||||
  HobLib
 | 
					  HobLib
 | 
				
			||||||
  MemoryAllocationLib
 | 
					  MemoryAllocationLib
 | 
				
			||||||
  PrintLib
 | 
					  PrintLib
 | 
				
			||||||
  QemuFwCfgLib
 | 
					 | 
				
			||||||
  Tpm2CommandLib
 | 
					  Tpm2CommandLib
 | 
				
			||||||
  UefiBootServicesTableLib
 | 
					  UefiBootServicesTableLib
 | 
				
			||||||
  UefiLib
 | 
					  UefiLib
 | 
				
			||||||
  UefiRuntimeServicesTableLib
 | 
					  UefiRuntimeServicesTableLib
 | 
				
			||||||
 | 
					  Tcg2PhysicalPresencePlatformLib
 | 
				
			||||||
 | 
					
 | 
				
			||||||
[Protocols]
 | 
					[Protocols]
 | 
				
			||||||
  gEfiTcg2ProtocolGuid                 ## SOMETIMES_CONSUMES
 | 
					  gEfiTcg2ProtocolGuid                 ## SOMETIMES_CONSUMES
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -0,0 +1,56 @@
 | 
				
			|||||||
 | 
					/** @file
 | 
				
			||||||
 | 
					  Returns the platform specific configuration for the QEMU PPI.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  Caution: This module requires additional review when modified.
 | 
				
			||||||
 | 
					  This driver will have external input - variable.
 | 
				
			||||||
 | 
					  This external input must be validated carefully to avoid security issue.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Copyright (C) 2018, Red Hat, Inc.
 | 
				
			||||||
 | 
					Copyright (c) 2018, IBM Corporation. All rights reserved.<BR>
 | 
				
			||||||
 | 
					Copyright (c) 2013 - 2016, Intel Corporation. All rights reserved.<BR>
 | 
				
			||||||
 | 
					SPDX-License-Identifier: BSD-2-Clause-Patent
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					**/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include <PiDxe.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include <IndustryStandard/QemuTpm.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include <Library/QemuFwCfgLib.h>
 | 
				
			||||||
 | 
					#include <Library/Tcg2PhysicalPresencePlatformLib.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					  Reads QEMU PPI config from fw_cfg.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  @param[out]  The Config structure to read to.
 | 
				
			||||||
 | 
					  @param[out]  The PPIinMMIO is True when the PPI is in MMIO memory space
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  @retval EFI_SUCCESS           Operation completed successfully.
 | 
				
			||||||
 | 
					  @retval EFI_PROTOCOL_ERROR    Invalid fw_cfg entry size.
 | 
				
			||||||
 | 
					**/
 | 
				
			||||||
 | 
					EFI_STATUS
 | 
				
			||||||
 | 
					TpmPPIPlatformReadConfig (
 | 
				
			||||||
 | 
					  OUT QEMU_FWCFG_TPM_CONFIG *Config,
 | 
				
			||||||
 | 
					  OUT BOOLEAN               *PPIinMMIO
 | 
				
			||||||
 | 
					  )
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					  EFI_STATUS           Status;
 | 
				
			||||||
 | 
					  FIRMWARE_CONFIG_ITEM FwCfgItem;
 | 
				
			||||||
 | 
					  UINTN                FwCfgSize;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  Status = QemuFwCfgFindFile ("etc/tpm/config", &FwCfgItem, &FwCfgSize);
 | 
				
			||||||
 | 
					  if (EFI_ERROR (Status)) {
 | 
				
			||||||
 | 
					    return Status;
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  if (FwCfgSize != sizeof (*Config)) {
 | 
				
			||||||
 | 
					    return EFI_PROTOCOL_ERROR;
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  QemuFwCfgSelectItem (FwCfgItem);
 | 
				
			||||||
 | 
					  QemuFwCfgReadBytes (sizeof (*Config), Config);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  *PPIinMMIO = TRUE;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  return EFI_SUCCESS;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@@ -0,0 +1,36 @@
 | 
				
			|||||||
 | 
					## @file
 | 
				
			||||||
 | 
					# Returns the platform specific configuration for the QEMU PPI.
 | 
				
			||||||
 | 
					#
 | 
				
			||||||
 | 
					#  Caution: This module requires additional review when modified.
 | 
				
			||||||
 | 
					#  This driver will have external input - variable.
 | 
				
			||||||
 | 
					#  This external input must be validated carefully to avoid security issue.
 | 
				
			||||||
 | 
					#
 | 
				
			||||||
 | 
					# Copyright (C) 2018, Red Hat, Inc.
 | 
				
			||||||
 | 
					# Copyright (c) 2013 - 2018, Intel Corporation. All rights reserved.<BR>
 | 
				
			||||||
 | 
					# SPDX-License-Identifier: BSD-2-Clause-Patent
 | 
				
			||||||
 | 
					#
 | 
				
			||||||
 | 
					##
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					[Defines]
 | 
				
			||||||
 | 
					  INF_VERSION                    = 0x00010005
 | 
				
			||||||
 | 
					  BASE_NAME                      = Tcg2PhysicalPresencePlatformLibQemu
 | 
				
			||||||
 | 
					  FILE_GUID                      = 9336E7F0-6CA1-4E6D-A0E9-DFE5F077AA02
 | 
				
			||||||
 | 
					  MODULE_TYPE                    = DXE_DRIVER
 | 
				
			||||||
 | 
					  VERSION_STRING                 = 1.0
 | 
				
			||||||
 | 
					  LIBRARY_CLASS                  = Tcg2PhysicalPresencePlatformLib|DXE_DRIVER DXE_RUNTIME_DRIVER UEFI_APPLICATION UEFI_DRIVER
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#
 | 
				
			||||||
 | 
					# The following information is for reference only and not required by the build tools.
 | 
				
			||||||
 | 
					#
 | 
				
			||||||
 | 
					#  VALID_ARCHITECTURES           = IA32 X64 EBC
 | 
				
			||||||
 | 
					#
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					[Sources]
 | 
				
			||||||
 | 
					  DxeTcg2PhysicalPresencePlatformLib.c
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					[Packages]
 | 
				
			||||||
 | 
					  OvmfPkg/OvmfPkg.dec
 | 
				
			||||||
 | 
					  MdePkg/MdePkg.dec
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					[LibraryClasses]
 | 
				
			||||||
 | 
					  QemuFwCfgLib
 | 
				
			||||||
@@ -233,6 +233,7 @@
 | 
				
			|||||||
  Tpm12CommandLib|SecurityPkg/Library/Tpm12CommandLib/Tpm12CommandLib.inf
 | 
					  Tpm12CommandLib|SecurityPkg/Library/Tpm12CommandLib/Tpm12CommandLib.inf
 | 
				
			||||||
  Tpm2CommandLib|SecurityPkg/Library/Tpm2CommandLib/Tpm2CommandLib.inf
 | 
					  Tpm2CommandLib|SecurityPkg/Library/Tpm2CommandLib/Tpm2CommandLib.inf
 | 
				
			||||||
  Tcg2PhysicalPresenceLib|OvmfPkg/Library/Tcg2PhysicalPresenceLibQemu/DxeTcg2PhysicalPresenceLib.inf
 | 
					  Tcg2PhysicalPresenceLib|OvmfPkg/Library/Tcg2PhysicalPresenceLibQemu/DxeTcg2PhysicalPresenceLib.inf
 | 
				
			||||||
 | 
					  Tcg2PhysicalPresencePlatformLib|OvmfPkg/Library/Tcg2PhysicalPresencePlatformLibQemu/DxeTcg2PhysicalPresencePlatformLib.inf
 | 
				
			||||||
  Tcg2PpVendorLib|SecurityPkg/Library/Tcg2PpVendorLibNull/Tcg2PpVendorLibNull.inf
 | 
					  Tcg2PpVendorLib|SecurityPkg/Library/Tcg2PpVendorLibNull/Tcg2PpVendorLibNull.inf
 | 
				
			||||||
  TpmMeasurementLib|SecurityPkg/Library/DxeTpmMeasurementLib/DxeTpmMeasurementLib.inf
 | 
					  TpmMeasurementLib|SecurityPkg/Library/DxeTpmMeasurementLib/DxeTpmMeasurementLib.inf
 | 
				
			||||||
!else
 | 
					!else
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -237,6 +237,7 @@
 | 
				
			|||||||
  Tpm12CommandLib|SecurityPkg/Library/Tpm12CommandLib/Tpm12CommandLib.inf
 | 
					  Tpm12CommandLib|SecurityPkg/Library/Tpm12CommandLib/Tpm12CommandLib.inf
 | 
				
			||||||
  Tpm2CommandLib|SecurityPkg/Library/Tpm2CommandLib/Tpm2CommandLib.inf
 | 
					  Tpm2CommandLib|SecurityPkg/Library/Tpm2CommandLib/Tpm2CommandLib.inf
 | 
				
			||||||
  Tcg2PhysicalPresenceLib|OvmfPkg/Library/Tcg2PhysicalPresenceLibQemu/DxeTcg2PhysicalPresenceLib.inf
 | 
					  Tcg2PhysicalPresenceLib|OvmfPkg/Library/Tcg2PhysicalPresenceLibQemu/DxeTcg2PhysicalPresenceLib.inf
 | 
				
			||||||
 | 
					  Tcg2PhysicalPresencePlatformLib|OvmfPkg/Library/Tcg2PhysicalPresencePlatformLibQemu/DxeTcg2PhysicalPresencePlatformLib.inf
 | 
				
			||||||
  Tcg2PpVendorLib|SecurityPkg/Library/Tcg2PpVendorLibNull/Tcg2PpVendorLibNull.inf
 | 
					  Tcg2PpVendorLib|SecurityPkg/Library/Tcg2PpVendorLibNull/Tcg2PpVendorLibNull.inf
 | 
				
			||||||
  TpmMeasurementLib|SecurityPkg/Library/DxeTpmMeasurementLib/DxeTpmMeasurementLib.inf
 | 
					  TpmMeasurementLib|SecurityPkg/Library/DxeTpmMeasurementLib/DxeTpmMeasurementLib.inf
 | 
				
			||||||
!else
 | 
					!else
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -237,6 +237,7 @@
 | 
				
			|||||||
  Tpm12CommandLib|SecurityPkg/Library/Tpm12CommandLib/Tpm12CommandLib.inf
 | 
					  Tpm12CommandLib|SecurityPkg/Library/Tpm12CommandLib/Tpm12CommandLib.inf
 | 
				
			||||||
  Tpm2CommandLib|SecurityPkg/Library/Tpm2CommandLib/Tpm2CommandLib.inf
 | 
					  Tpm2CommandLib|SecurityPkg/Library/Tpm2CommandLib/Tpm2CommandLib.inf
 | 
				
			||||||
  Tcg2PhysicalPresenceLib|OvmfPkg/Library/Tcg2PhysicalPresenceLibQemu/DxeTcg2PhysicalPresenceLib.inf
 | 
					  Tcg2PhysicalPresenceLib|OvmfPkg/Library/Tcg2PhysicalPresenceLibQemu/DxeTcg2PhysicalPresenceLib.inf
 | 
				
			||||||
 | 
					  Tcg2PhysicalPresencePlatformLib|OvmfPkg/Library/Tcg2PhysicalPresencePlatformLibQemu/DxeTcg2PhysicalPresencePlatformLib.inf
 | 
				
			||||||
  Tcg2PpVendorLib|SecurityPkg/Library/Tcg2PpVendorLibNull/Tcg2PpVendorLibNull.inf
 | 
					  Tcg2PpVendorLib|SecurityPkg/Library/Tcg2PpVendorLibNull/Tcg2PpVendorLibNull.inf
 | 
				
			||||||
  TpmMeasurementLib|SecurityPkg/Library/DxeTpmMeasurementLib/DxeTpmMeasurementLib.inf
 | 
					  TpmMeasurementLib|SecurityPkg/Library/DxeTpmMeasurementLib/DxeTpmMeasurementLib.inf
 | 
				
			||||||
!else
 | 
					!else
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -19,6 +19,7 @@
 | 
				
			|||||||
#include <Library/UefiRuntimeServicesTableLib.h>
 | 
					#include <Library/UefiRuntimeServicesTableLib.h>
 | 
				
			||||||
#include <Library/SecureBootVariableLib.h>
 | 
					#include <Library/SecureBootVariableLib.h>
 | 
				
			||||||
#include <Library/SecureBootVariableProvisionLib.h>
 | 
					#include <Library/SecureBootVariableProvisionLib.h>
 | 
				
			||||||
 | 
					#include <Library/DxeServicesLib.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
  Enroll a key/certificate based on a default variable.
 | 
					  Enroll a key/certificate based on a default variable.
 | 
				
			||||||
@@ -111,6 +112,7 @@ SecureBootInitPKDefault (
 | 
				
			|||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  if (EFI_ERROR (Status) && (Status != EFI_NOT_FOUND)) {
 | 
					  if (EFI_ERROR (Status) && (Status != EFI_NOT_FOUND)) {
 | 
				
			||||||
 | 
					    DEBUG ((DEBUG_INFO, "Variable %s read error.\n", EFI_PK_DEFAULT_VARIABLE_NAME));
 | 
				
			||||||
    return Status;
 | 
					    return Status;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -259,10 +261,10 @@ SecureBootInitDbxDefault (
 | 
				
			|||||||
  IN VOID
 | 
					  IN VOID
 | 
				
			||||||
  )
 | 
					  )
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  EFI_SIGNATURE_LIST *EfiSig;
 | 
					  UINTN               Size;
 | 
				
			||||||
  UINTN               SigListsSize;
 | 
					 | 
				
			||||||
  EFI_STATUS          Status;
 | 
					  EFI_STATUS          Status;
 | 
				
			||||||
  UINT8              *Data;
 | 
					  UINT8              *Data;
 | 
				
			||||||
 | 
					  VOID               *Buffer;
 | 
				
			||||||
  UINTN               DataSize;
 | 
					  UINTN               DataSize;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  //
 | 
					  //
 | 
				
			||||||
@@ -284,7 +286,13 @@ SecureBootInitDbxDefault (
 | 
				
			|||||||
  //
 | 
					  //
 | 
				
			||||||
  DEBUG ((DEBUG_INFO, "Variable %s does not exist.\n", EFI_DBX_DEFAULT_VARIABLE_NAME));
 | 
					  DEBUG ((DEBUG_INFO, "Variable %s does not exist.\n", EFI_DBX_DEFAULT_VARIABLE_NAME));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  Status = SecureBootFetchData (&gDefaultdbxFileGuid, &SigListsSize, &EfiSig);
 | 
					  Status = GetSectionFromAnyFv (
 | 
				
			||||||
 | 
					             &gDefaultdbxFileGuid,
 | 
				
			||||||
 | 
					             EFI_SECTION_RAW,
 | 
				
			||||||
 | 
					             0,
 | 
				
			||||||
 | 
					             &Buffer,
 | 
				
			||||||
 | 
					             &Size
 | 
				
			||||||
 | 
					             );
 | 
				
			||||||
  if (EFI_ERROR (Status)) {
 | 
					  if (EFI_ERROR (Status)) {
 | 
				
			||||||
    DEBUG ((DEBUG_INFO, "Content for %s not found\n", EFI_DBX_DEFAULT_VARIABLE_NAME));
 | 
					    DEBUG ((DEBUG_INFO, "Content for %s not found\n", EFI_DBX_DEFAULT_VARIABLE_NAME));
 | 
				
			||||||
    return Status;
 | 
					    return Status;
 | 
				
			||||||
@@ -294,15 +302,13 @@ SecureBootInitDbxDefault (
 | 
				
			|||||||
                  EFI_DBX_DEFAULT_VARIABLE_NAME,
 | 
					                  EFI_DBX_DEFAULT_VARIABLE_NAME,
 | 
				
			||||||
                  &gEfiGlobalVariableGuid,
 | 
					                  &gEfiGlobalVariableGuid,
 | 
				
			||||||
                  EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_BOOTSERVICE_ACCESS,
 | 
					                  EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_BOOTSERVICE_ACCESS,
 | 
				
			||||||
                  SigListsSize,
 | 
					                  Size,
 | 
				
			||||||
                  (VOID *)EfiSig
 | 
					                  (VOID *)Buffer
 | 
				
			||||||
                  );
 | 
					                  );
 | 
				
			||||||
  if (EFI_ERROR (Status)) {
 | 
					  if (EFI_ERROR (Status)) {
 | 
				
			||||||
    DEBUG ((DEBUG_INFO, "Failed to set %s\n", EFI_DBX_DEFAULT_VARIABLE_NAME));
 | 
					    DEBUG ((DEBUG_INFO, "Failed to set %s\n", EFI_DBX_DEFAULT_VARIABLE_NAME));
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  FreePool (EfiSig);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  return Status;
 | 
					  return Status;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -2740,6 +2740,15 @@ DriverEntry (
 | 
				
			|||||||
  DEBUG ((EFI_D_INFO, "Tcg2.NumberOfPCRBanks      - 0x%08x\n", mTcgDxeData.BsCap.NumberOfPCRBanks));
 | 
					  DEBUG ((EFI_D_INFO, "Tcg2.NumberOfPCRBanks      - 0x%08x\n", mTcgDxeData.BsCap.NumberOfPCRBanks));
 | 
				
			||||||
  DEBUG ((EFI_D_INFO, "Tcg2.ActivePcrBanks        - 0x%08x\n", mTcgDxeData.BsCap.ActivePcrBanks));
 | 
					  DEBUG ((EFI_D_INFO, "Tcg2.ActivePcrBanks        - 0x%08x\n", mTcgDxeData.BsCap.ActivePcrBanks));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  // HACK: This is usually done in Tcg2Pei
 | 
				
			||||||
 | 
					  UINT32                            Tpm2PcrMask;
 | 
				
			||||||
 | 
					  Tpm2PcrMask = PcdGet32 (PcdTpm2HashMask);
 | 
				
			||||||
 | 
					  if (Tpm2PcrMask != mTcgDxeData.BsCap.HashAlgorithmBitmap) {
 | 
				
			||||||
 | 
					    Tpm2PcrMask &= mTcgDxeData.BsCap.HashAlgorithmBitmap;
 | 
				
			||||||
 | 
					    Status = PcdSet32S (PcdTpm2HashMask, Tpm2PcrMask);
 | 
				
			||||||
 | 
					    ASSERT_EFI_ERROR (Status);
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  if (mTcgDxeData.BsCap.TPMPresentFlag) {
 | 
					  if (mTcgDxeData.BsCap.TPMPresentFlag) {
 | 
				
			||||||
    //
 | 
					    //
 | 
				
			||||||
    // Setup the log area and copy event log from hob list to it
 | 
					    // Setup the log area and copy event log from hob list to it
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -107,6 +107,7 @@
 | 
				
			|||||||
  gEfiSecurityPkgTokenSpaceGuid.PcdTpm2AcpiTableLaml                        ## PRODUCES
 | 
					  gEfiSecurityPkgTokenSpaceGuid.PcdTpm2AcpiTableLaml                        ## PRODUCES
 | 
				
			||||||
  gEfiSecurityPkgTokenSpaceGuid.PcdTpm2AcpiTableLasa                        ## PRODUCES
 | 
					  gEfiSecurityPkgTokenSpaceGuid.PcdTpm2AcpiTableLasa                        ## PRODUCES
 | 
				
			||||||
  gEfiMdeModulePkgTokenSpaceGuid.PcdTcgPfpMeasurementRevision               ## CONSUMES
 | 
					  gEfiMdeModulePkgTokenSpaceGuid.PcdTcgPfpMeasurementRevision               ## CONSUMES
 | 
				
			||||||
 | 
					  gEfiSecurityPkgTokenSpaceGuid.PcdTpm2HashMask                             ## PRODUCES
 | 
				
			||||||
 | 
					
 | 
				
			||||||
[Depex]
 | 
					[Depex]
 | 
				
			||||||
  # According to PcdTpm2AcpiTableRev definition in SecurityPkg.dec
 | 
					  # According to PcdTpm2AcpiTableRev definition in SecurityPkg.dec
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,10 +1,6 @@
 | 
				
			|||||||
/** @file
 | 
					// SPDX-License-Identifier: BSD-2-Clause-Patent
 | 
				
			||||||
  VFR file used by the SecureBoot configuration component.
 | 
					// SPDX-FileCopyrightText: Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>
 | 
				
			||||||
 | 
					// SPDX-FileCopyrightText: 2023 System76 <info@system76.com>
 | 
				
			||||||
Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>
 | 
					 | 
				
			||||||
SPDX-License-Identifier: BSD-2-Clause-Patent
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
**/
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "SecureBootConfigNvData.h"
 | 
					#include "SecureBootConfigNvData.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -19,34 +15,19 @@ formset
 | 
				
			|||||||
    name = SECUREBOOT_CONFIGURATION,
 | 
					    name = SECUREBOOT_CONFIGURATION,
 | 
				
			||||||
    guid = SECUREBOOT_CONFIG_FORM_SET_GUID;
 | 
					    guid = SECUREBOOT_CONFIG_FORM_SET_GUID;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  //
 | 
					 | 
				
			||||||
  // ##1 Form "Secure Boot Configuration"
 | 
					 | 
				
			||||||
  //
 | 
					 | 
				
			||||||
  form formid = SECUREBOOT_CONFIGURATION_FORM_ID,
 | 
					  form formid = SECUREBOOT_CONFIGURATION_FORM_ID,
 | 
				
			||||||
    title = STRING_TOKEN(STR_SECUREBOOT_TITLE);
 | 
					    title = STRING_TOKEN(STR_SECUREBOOT_TITLE);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    subtitle text = STRING_TOKEN(STR_NULL);
 | 
					    // FIXME: firmware-setup doesn't handle EFI_IFR_TEXT.
 | 
				
			||||||
 | 
					    //text
 | 
				
			||||||
 | 
					    //  help = STRING_TOKEN(STR_SECURE_BOOT_STATE_HELP),
 | 
				
			||||||
 | 
					    //  text = STRING_TOKEN(STR_SECURE_BOOT_STATE_PROMPT),
 | 
				
			||||||
 | 
					    //  text = STRING_TOKEN(STR_SECURE_BOOT_STATE_CONTENT);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    text
 | 
					    subtitle text = STRING_TOKEN(STR_SECURE_BOOT_STATE_PROMPT);
 | 
				
			||||||
      help   = STRING_TOKEN(STR_SECURE_BOOT_STATE_HELP),
 | 
					 | 
				
			||||||
      text   = STRING_TOKEN(STR_SECURE_BOOT_STATE_PROMPT),
 | 
					 | 
				
			||||||
        text   = STRING_TOKEN(STR_SECURE_BOOT_STATE_CONTENT);
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    //
 | 
					    // XXX: Needed for "Secure Boot status" string to update.
 | 
				
			||||||
    // Display of Check Box: Attempt Secure Boot
 | 
					    suppressif TRUE;
 | 
				
			||||||
    //
 | 
					 | 
				
			||||||
    grayoutif ideqval SECUREBOOT_CONFIGURATION.HideSecureBoot == 1 OR NOT ideqval SECUREBOOT_CONFIGURATION.PhysicalPresent == 1;
 | 
					 | 
				
			||||||
    checkbox varid = SECUREBOOT_CONFIGURATION.AttemptSecureBoot,
 | 
					 | 
				
			||||||
          questionid = KEY_SECURE_BOOT_ENABLE,
 | 
					 | 
				
			||||||
          prompt = STRING_TOKEN(STR_SECURE_BOOT_PROMPT),
 | 
					 | 
				
			||||||
          help   = STRING_TOKEN(STR_SECURE_BOOT_HELP),
 | 
					 | 
				
			||||||
          flags  = INTERACTIVE | RESET_REQUIRED,
 | 
					 | 
				
			||||||
    endcheckbox;
 | 
					 | 
				
			||||||
    endif;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    //
 | 
					 | 
				
			||||||
    // Display of Oneof: 'Secure Boot Mode'
 | 
					 | 
				
			||||||
    //
 | 
					 | 
				
			||||||
    oneof name = SecureBootMode,
 | 
					    oneof name = SecureBootMode,
 | 
				
			||||||
      questionid = KEY_SECURE_BOOT_MODE,
 | 
					      questionid = KEY_SECURE_BOOT_MODE,
 | 
				
			||||||
      prompt = STRING_TOKEN(STR_SECURE_BOOT_MODE_PROMPT),
 | 
					      prompt = STRING_TOKEN(STR_SECURE_BOOT_MODE_PROMPT),
 | 
				
			||||||
@@ -55,557 +36,97 @@ formset
 | 
				
			|||||||
      option text = STRING_TOKEN(STR_STANDARD_MODE),    value = SECURE_BOOT_MODE_STANDARD, flags = DEFAULT;
 | 
					      option text = STRING_TOKEN(STR_STANDARD_MODE),    value = SECURE_BOOT_MODE_STANDARD, flags = DEFAULT;
 | 
				
			||||||
      option text = STRING_TOKEN(STR_CUSTOM_MODE),      value = SECURE_BOOT_MODE_CUSTOM,   flags = 0;
 | 
					      option text = STRING_TOKEN(STR_CUSTOM_MODE),      value = SECURE_BOOT_MODE_CUSTOM,   flags = 0;
 | 
				
			||||||
    endoneof;
 | 
					    endoneof;
 | 
				
			||||||
 | 
					    endif;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    //
 | 
					    suppressif ideqval SECUREBOOT_CONFIGURATION.AttemptSecureBoot == 0;
 | 
				
			||||||
    // Display of 'Current Secure Boot Mode'
 | 
					      goto FORMID_SECURE_BOOT_DISABLE,
 | 
				
			||||||
    //
 | 
					        prompt = STRING_TOKEN(STR_SECURE_BOOT_DISABLE_PROMPT),
 | 
				
			||||||
    suppressif questionref(SecureBootMode) == SECURE_BOOT_MODE_STANDARD;
 | 
					        help = STRING_TOKEN(STR_NULL);
 | 
				
			||||||
    grayoutif NOT ideqval SECUREBOOT_CONFIGURATION.PhysicalPresent == 1;
 | 
					 | 
				
			||||||
    goto FORMID_SECURE_BOOT_OPTION_FORM,
 | 
					 | 
				
			||||||
         prompt = STRING_TOKEN(STR_SECURE_BOOT_OPTION),
 | 
					 | 
				
			||||||
         help   = STRING_TOKEN(STR_SECURE_BOOT_OPTION_HELP),
 | 
					 | 
				
			||||||
         flags  = INTERACTIVE,
 | 
					 | 
				
			||||||
         key    = KEY_SECURE_BOOT_OPTION;
 | 
					 | 
				
			||||||
    endif;
 | 
					    endif;
 | 
				
			||||||
 | 
					    suppressif ideqval SECUREBOOT_CONFIGURATION.AttemptSecureBoot == 1;
 | 
				
			||||||
 | 
					      goto FORMID_SECURE_BOOT_ENABLE,
 | 
				
			||||||
 | 
					        prompt = STRING_TOKEN(STR_SECURE_BOOT_ENABLE_PROMPT),
 | 
				
			||||||
 | 
					        help = STRING_TOKEN(STR_NULL);
 | 
				
			||||||
    endif;
 | 
					    endif;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    subtitle text = STRING_TOKEN(STR_NULL);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    goto FORMID_DELETE_KEYS,
 | 
				
			||||||
 | 
					      prompt = STRING_TOKEN(STR_DELETE_KEYS_PROMPT),
 | 
				
			||||||
 | 
					      help = STRING_TOKEN(STR_NULL);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    goto FORMID_RESTORE_KEYS,
 | 
				
			||||||
 | 
					      prompt = STRING_TOKEN(STR_RESTORE_KEYS_PROMPT),
 | 
				
			||||||
 | 
					      help = STRING_TOKEN(STR_NULL);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  endform;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  form formid = FORMID_SECURE_BOOT_ENABLE,
 | 
				
			||||||
 | 
					    title = STRING_TOKEN(STR_SECUREBOOT_TITLE);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    subtitle text = STRING_TOKEN(STR_ENABLE_NOTICE);
 | 
				
			||||||
 | 
					    subtitle text = STRING_TOKEN(STR_NULL);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    text
 | 
					    text
 | 
				
			||||||
      help   = STRING_TOKEN(STR_SECURE_RESET_TO_DEFAULTS_HELP),
 | 
					      help = STRING_TOKEN(STR_NULL),
 | 
				
			||||||
      text   = STRING_TOKEN(STR_SECURE_RESET_TO_DEFAULTS),
 | 
					      text = STRING_TOKEN(STR_ENABLE_SELECTION),
 | 
				
			||||||
      flags = INTERACTIVE,
 | 
					      flags = INTERACTIVE,
 | 
				
			||||||
      key    = KEY_SECURE_BOOT_RESET_TO_DEFAULT;
 | 
					      key = KEY_SECURE_BOOT_STATE_ENABLE;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    goto SECUREBOOT_CONFIGURATION_FORM_ID,
 | 
				
			||||||
 | 
					      prompt = STRING_TOKEN(STR_CANCEL),
 | 
				
			||||||
 | 
					      help = STRING_TOKEN(STR_NULL);
 | 
				
			||||||
  endform;
 | 
					  endform;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  //
 | 
					  form formid = FORMID_SECURE_BOOT_DISABLE,
 | 
				
			||||||
  // ##2 Form: 'Custom Secure Boot Options'
 | 
					    title = STRING_TOKEN(STR_SECUREBOOT_TITLE);
 | 
				
			||||||
  //
 | 
					 | 
				
			||||||
  form formid = FORMID_SECURE_BOOT_OPTION_FORM,
 | 
					 | 
				
			||||||
    title  = STRING_TOKEN(STR_SECURE_BOOT_OPTION_TITLE);
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    subtitle text = STRING_TOKEN(STR_DISABLE_NOTICE);
 | 
				
			||||||
    subtitle text = STRING_TOKEN(STR_NULL);
 | 
					    subtitle text = STRING_TOKEN(STR_NULL);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    goto FORMID_SECURE_BOOT_PK_OPTION_FORM,
 | 
					 | 
				
			||||||
         prompt = STRING_TOKEN(STR_SECURE_BOOT_PK_OPTION),
 | 
					 | 
				
			||||||
         help   = STRING_TOKEN(STR_SECURE_BOOT_PK_OPTION_HELP),
 | 
					 | 
				
			||||||
         flags  = INTERACTIVE,
 | 
					 | 
				
			||||||
         key    = KEY_SECURE_BOOT_PK_OPTION;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    subtitle text = STRING_TOKEN(STR_NULL);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    goto FORMID_SECURE_BOOT_KEK_OPTION_FORM,
 | 
					 | 
				
			||||||
         prompt = STRING_TOKEN(STR_SECURE_BOOT_KEK_OPTION),
 | 
					 | 
				
			||||||
         help   = STRING_TOKEN(STR_SECURE_BOOT_KEK_OPTION_HELP),
 | 
					 | 
				
			||||||
         flags  = INTERACTIVE,
 | 
					 | 
				
			||||||
         key    = KEY_SECURE_BOOT_KEK_OPTION;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    subtitle text = STRING_TOKEN(STR_NULL);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    goto FORMID_SECURE_BOOT_DB_OPTION_FORM,
 | 
					 | 
				
			||||||
         prompt = STRING_TOKEN(STR_SECURE_BOOT_DB_OPTION),
 | 
					 | 
				
			||||||
         help   = STRING_TOKEN(STR_SECURE_BOOT_DB_OPTION_HELP),
 | 
					 | 
				
			||||||
         flags  = INTERACTIVE,
 | 
					 | 
				
			||||||
         key    = KEY_SECURE_BOOT_DB_OPTION;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    subtitle text = STRING_TOKEN(STR_NULL);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    goto FORMID_SECURE_BOOT_DBX_OPTION_FORM,
 | 
					 | 
				
			||||||
         prompt = STRING_TOKEN(STR_SECURE_BOOT_DBX_OPTION),
 | 
					 | 
				
			||||||
         help   = STRING_TOKEN(STR_SECURE_BOOT_DBX_OPTION_HELP),
 | 
					 | 
				
			||||||
         flags  = INTERACTIVE,
 | 
					 | 
				
			||||||
         key    = KEY_SECURE_BOOT_DBX_OPTION;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    subtitle text = STRING_TOKEN(STR_NULL);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    goto FORMID_SECURE_BOOT_DBT_OPTION_FORM,
 | 
					 | 
				
			||||||
         prompt = STRING_TOKEN(STR_SECURE_BOOT_DBT_OPTION),
 | 
					 | 
				
			||||||
         help   = STRING_TOKEN(STR_SECURE_BOOT_DBT_OPTION_HELP),
 | 
					 | 
				
			||||||
         flags  = INTERACTIVE,
 | 
					 | 
				
			||||||
         key    = KEY_SECURE_BOOT_DBT_OPTION;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  endform;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  //
 | 
					 | 
				
			||||||
  // ##3 Form: 'PK Options'
 | 
					 | 
				
			||||||
  //
 | 
					 | 
				
			||||||
  form formid = FORMID_SECURE_BOOT_PK_OPTION_FORM,
 | 
					 | 
				
			||||||
    title  = STRING_TOKEN(STR_SECURE_BOOT_PK_OPTION);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    subtitle text = STRING_TOKEN(STR_NULL);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    //
 | 
					 | 
				
			||||||
    // Display of 'Enroll PK'
 | 
					 | 
				
			||||||
    //
 | 
					 | 
				
			||||||
    grayoutif ideqval SECUREBOOT_CONFIGURATION.HasPk == 1;
 | 
					 | 
				
			||||||
    goto FORMID_ENROLL_PK_FORM,
 | 
					 | 
				
			||||||
         prompt = STRING_TOKEN(STR_ENROLL_PK),
 | 
					 | 
				
			||||||
         help   = STRING_TOKEN(STR_ENROLL_PK_HELP),
 | 
					 | 
				
			||||||
         flags  = INTERACTIVE,
 | 
					 | 
				
			||||||
         key    = KEY_ENROLL_PK;
 | 
					 | 
				
			||||||
    endif;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    subtitle text = STRING_TOKEN(STR_NULL);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    //
 | 
					 | 
				
			||||||
    // Display of Check Box: 'Delete Pk'
 | 
					 | 
				
			||||||
    //
 | 
					 | 
				
			||||||
    grayoutif ideqval SECUREBOOT_CONFIGURATION.HideSecureBoot == 1;
 | 
					 | 
				
			||||||
    checkbox varid = SECUREBOOT_CONFIGURATION.DeletePk,
 | 
					 | 
				
			||||||
          questionid = KEY_SECURE_BOOT_DELETE_PK,
 | 
					 | 
				
			||||||
          prompt = STRING_TOKEN(STR_DELETE_PK),
 | 
					 | 
				
			||||||
          help   = STRING_TOKEN(STR_DELETE_PK_HELP),
 | 
					 | 
				
			||||||
          flags  = INTERACTIVE | RESET_REQUIRED,
 | 
					 | 
				
			||||||
    endcheckbox;
 | 
					 | 
				
			||||||
    endif;
 | 
					 | 
				
			||||||
  endform;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  //
 | 
					 | 
				
			||||||
  // ##4 Form: 'Enroll PK'
 | 
					 | 
				
			||||||
  //
 | 
					 | 
				
			||||||
  form formid = FORMID_ENROLL_PK_FORM,
 | 
					 | 
				
			||||||
    title  = STRING_TOKEN(STR_ENROLL_PK);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    subtitle text = STRING_TOKEN(STR_NULL);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    goto FORMID_ENROLL_PK_FORM,
 | 
					 | 
				
			||||||
         prompt = STRING_TOKEN(STR_SECURE_BOOT_ENROLL_PK_FILE),
 | 
					 | 
				
			||||||
         help = STRING_TOKEN(STR_SECURE_BOOT_ENROLL_PK_FILE),
 | 
					 | 
				
			||||||
         flags = INTERACTIVE,
 | 
					 | 
				
			||||||
         key = FORMID_ENROLL_PK_FORM;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    subtitle text = STRING_TOKEN(STR_NULL);
 | 
					 | 
				
			||||||
    label FORMID_ENROLL_PK_FORM;
 | 
					 | 
				
			||||||
    label LABEL_END;
 | 
					 | 
				
			||||||
    subtitle text = STRING_TOKEN(STR_NULL);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    goto FORMID_SECURE_BOOT_OPTION_FORM,
 | 
					 | 
				
			||||||
      prompt = STRING_TOKEN(STR_SAVE_AND_EXIT),
 | 
					 | 
				
			||||||
      help   = STRING_TOKEN(STR_SAVE_AND_EXIT),
 | 
					 | 
				
			||||||
      flags  = INTERACTIVE| RESET_REQUIRED,
 | 
					 | 
				
			||||||
      key    = KEY_VALUE_SAVE_AND_EXIT_PK;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    goto FORMID_SECURE_BOOT_OPTION_FORM,
 | 
					 | 
				
			||||||
      prompt = STRING_TOKEN(STR_NO_SAVE_AND_EXIT),
 | 
					 | 
				
			||||||
      help   = STRING_TOKEN(STR_NO_SAVE_AND_EXIT),
 | 
					 | 
				
			||||||
      flags  = INTERACTIVE,
 | 
					 | 
				
			||||||
      key    = KEY_VALUE_NO_SAVE_AND_EXIT_PK;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  endform;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  //
 | 
					 | 
				
			||||||
  // ##5 Form: 'KEK Options'
 | 
					 | 
				
			||||||
  //
 | 
					 | 
				
			||||||
  form formid = FORMID_SECURE_BOOT_KEK_OPTION_FORM,
 | 
					 | 
				
			||||||
    title  = STRING_TOKEN(STR_SECURE_BOOT_KEK_OPTION);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    //
 | 
					 | 
				
			||||||
    // Display of 'Enroll KEK'
 | 
					 | 
				
			||||||
    //
 | 
					 | 
				
			||||||
    goto FORMID_ENROLL_KEK_FORM,
 | 
					 | 
				
			||||||
         prompt = STRING_TOKEN(STR_ENROLL_KEK),
 | 
					 | 
				
			||||||
         help   = STRING_TOKEN(STR_ENROLL_KEK_HELP),
 | 
					 | 
				
			||||||
         flags  = INTERACTIVE;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    subtitle text = STRING_TOKEN(STR_NULL);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    //
 | 
					 | 
				
			||||||
    // Display of 'Delete KEK'
 | 
					 | 
				
			||||||
    //
 | 
					 | 
				
			||||||
    goto FORMID_DELETE_KEK_FORM,
 | 
					 | 
				
			||||||
         prompt = STRING_TOKEN(STR_DELETE_KEK),
 | 
					 | 
				
			||||||
         help   = STRING_TOKEN(STR_DELETE_KEK_HELP),
 | 
					 | 
				
			||||||
         flags  = INTERACTIVE,
 | 
					 | 
				
			||||||
         key    = KEY_DELETE_KEK;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    subtitle text = STRING_TOKEN(STR_NULL);
 | 
					 | 
				
			||||||
  endform;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  //
 | 
					 | 
				
			||||||
  // ##6 Form: 'Enroll KEK'
 | 
					 | 
				
			||||||
  //
 | 
					 | 
				
			||||||
  form formid = FORMID_ENROLL_KEK_FORM,
 | 
					 | 
				
			||||||
    title = STRING_TOKEN(STR_ENROLL_KEK_TITLE);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    subtitle text = STRING_TOKEN(STR_NULL);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    goto FORMID_ENROLL_KEK_FORM,
 | 
					 | 
				
			||||||
         prompt = STRING_TOKEN(STR_FORM_ENROLL_KEK_FROM_FILE_TITLE),
 | 
					 | 
				
			||||||
         help   = STRING_TOKEN(STR_FORM_ENROLL_KEK_FROM_FILE_TITLE_HELP),
 | 
					 | 
				
			||||||
         flags  = INTERACTIVE,
 | 
					 | 
				
			||||||
         key    = FORMID_ENROLL_KEK_FORM;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    subtitle text = STRING_TOKEN(STR_NULL);
 | 
					 | 
				
			||||||
    label FORMID_ENROLL_KEK_FORM;
 | 
					 | 
				
			||||||
    label LABEL_END;
 | 
					 | 
				
			||||||
    subtitle text = STRING_TOKEN(STR_NULL);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    string  varid   = SECUREBOOT_CONFIGURATION.SignatureGuid,
 | 
					 | 
				
			||||||
            prompt  = STRING_TOKEN(STR_SECURE_BOOT_SIGNATURE_GUID),
 | 
					 | 
				
			||||||
            help    = STRING_TOKEN(STR_SECURE_BOOT_SIGNATURE_GUID_HELP),
 | 
					 | 
				
			||||||
            flags   = INTERACTIVE,
 | 
					 | 
				
			||||||
            key     = KEY_SECURE_BOOT_KEK_GUID,
 | 
					 | 
				
			||||||
            minsize = SECURE_BOOT_GUID_SIZE,
 | 
					 | 
				
			||||||
            maxsize = SECURE_BOOT_GUID_SIZE,
 | 
					 | 
				
			||||||
    endstring;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    subtitle text = STRING_TOKEN(STR_NULL);
 | 
					 | 
				
			||||||
    subtitle text = STRING_TOKEN(STR_NULL);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    goto FORMID_SECURE_BOOT_OPTION_FORM,
 | 
					 | 
				
			||||||
      prompt = STRING_TOKEN(STR_SAVE_AND_EXIT),
 | 
					 | 
				
			||||||
      help   = STRING_TOKEN(STR_SAVE_AND_EXIT),
 | 
					 | 
				
			||||||
      flags  = INTERACTIVE,
 | 
					 | 
				
			||||||
      key    = KEY_VALUE_SAVE_AND_EXIT_KEK;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    goto FORMID_SECURE_BOOT_OPTION_FORM,
 | 
					 | 
				
			||||||
      prompt = STRING_TOKEN(STR_NO_SAVE_AND_EXIT),
 | 
					 | 
				
			||||||
      help   = STRING_TOKEN(STR_NO_SAVE_AND_EXIT),
 | 
					 | 
				
			||||||
      flags  = INTERACTIVE,
 | 
					 | 
				
			||||||
      key    = KEY_VALUE_NO_SAVE_AND_EXIT_KEK;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  endform;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  //
 | 
					 | 
				
			||||||
  // ##7 Form: 'Delete KEK'
 | 
					 | 
				
			||||||
  //
 | 
					 | 
				
			||||||
  form formid = FORMID_DELETE_KEK_FORM,
 | 
					 | 
				
			||||||
    title  = STRING_TOKEN(STR_DELETE_KEK_TITLE);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    label LABEL_KEK_DELETE;
 | 
					 | 
				
			||||||
    label LABEL_END;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    subtitle text = STRING_TOKEN(STR_NULL);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  endform;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  //
 | 
					 | 
				
			||||||
  // ##8 Form: 'DB Options'
 | 
					 | 
				
			||||||
  //
 | 
					 | 
				
			||||||
  form formid = FORMID_SECURE_BOOT_DB_OPTION_FORM,
 | 
					 | 
				
			||||||
    title = STRING_TOKEN(STR_SECURE_BOOT_DB_OPTION);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    subtitle text = STRING_TOKEN(STR_NULL);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    goto SECUREBOOT_ENROLL_SIGNATURE_TO_DB,
 | 
					 | 
				
			||||||
    prompt = STRING_TOKEN (STR_SECURE_BOOT_ENROLL_SIGNATURE),
 | 
					 | 
				
			||||||
    help   = STRING_TOKEN (STR_SECURE_BOOT_ENROLL_SIGNATURE),
 | 
					 | 
				
			||||||
    flags  = 0;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    subtitle text = STRING_TOKEN(STR_NULL);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    goto SECUREBOOT_DELETE_SIGNATURE_FROM_DB,
 | 
					 | 
				
			||||||
    prompt = STRING_TOKEN (STR_SECURE_BOOT_DELETE_SIGNATURE),
 | 
					 | 
				
			||||||
    help   = STRING_TOKEN (STR_SECURE_BOOT_DELETE_SIGNATURE),
 | 
					 | 
				
			||||||
    flags  = INTERACTIVE,
 | 
					 | 
				
			||||||
    key    = SECUREBOOT_DELETE_SIGNATURE_FROM_DB;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  endform;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  //
 | 
					 | 
				
			||||||
  // ##9 Form: 'DBX Options'
 | 
					 | 
				
			||||||
  //
 | 
					 | 
				
			||||||
  form formid = FORMID_SECURE_BOOT_DBX_OPTION_FORM,
 | 
					 | 
				
			||||||
    title = STRING_TOKEN(STR_SECURE_BOOT_DBX_OPTION);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    subtitle text = STRING_TOKEN(STR_NULL);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    goto SECUREBOOT_ENROLL_SIGNATURE_TO_DBX,
 | 
					 | 
				
			||||||
    prompt = STRING_TOKEN (STR_SECURE_BOOT_ENROLL_SIGNATURE),
 | 
					 | 
				
			||||||
    help   = STRING_TOKEN (STR_SECURE_BOOT_ENROLL_SIGNATURE),
 | 
					 | 
				
			||||||
    flags  = 0;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    subtitle text = STRING_TOKEN(STR_NULL);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    goto SECUREBOOT_DELETE_SIGNATURE_LIST_FORM,
 | 
					 | 
				
			||||||
    prompt = STRING_TOKEN (STR_SECURE_BOOT_DELETE_SIGNATURE),
 | 
					 | 
				
			||||||
    help   = STRING_TOKEN (STR_SECURE_BOOT_DELETE_SIGNATURE),
 | 
					 | 
				
			||||||
    flags  = INTERACTIVE,
 | 
					 | 
				
			||||||
    key    = KEY_VALUE_FROM_DBX_TO_LIST_FORM;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  endform;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  //
 | 
					 | 
				
			||||||
  // ##9 Form: 'DBT Options'
 | 
					 | 
				
			||||||
  //
 | 
					 | 
				
			||||||
  form formid = FORMID_SECURE_BOOT_DBT_OPTION_FORM,
 | 
					 | 
				
			||||||
    title = STRING_TOKEN(STR_SECURE_BOOT_DBT_OPTION);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    subtitle text = STRING_TOKEN(STR_NULL);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    goto SECUREBOOT_ENROLL_SIGNATURE_TO_DBT,
 | 
					 | 
				
			||||||
    prompt = STRING_TOKEN (STR_SECURE_BOOT_ENROLL_SIGNATURE),
 | 
					 | 
				
			||||||
    help   = STRING_TOKEN (STR_SECURE_BOOT_ENROLL_SIGNATURE),
 | 
					 | 
				
			||||||
    flags  = 0;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    subtitle text = STRING_TOKEN(STR_NULL);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    goto SECUREBOOT_DELETE_SIGNATURE_FROM_DBT,
 | 
					 | 
				
			||||||
    prompt = STRING_TOKEN (STR_SECURE_BOOT_DELETE_SIGNATURE),
 | 
					 | 
				
			||||||
    help   = STRING_TOKEN (STR_SECURE_BOOT_DELETE_SIGNATURE),
 | 
					 | 
				
			||||||
    flags  = INTERACTIVE,
 | 
					 | 
				
			||||||
    key    = SECUREBOOT_DELETE_SIGNATURE_FROM_DBT;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  endform;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  //
 | 
					 | 
				
			||||||
  // Form: 'Delete Signature' for DB Options.
 | 
					 | 
				
			||||||
  //
 | 
					 | 
				
			||||||
  form formid = SECUREBOOT_DELETE_SIGNATURE_FROM_DB,
 | 
					 | 
				
			||||||
    title  = STRING_TOKEN(STR_SECURE_BOOT_DELETE_SIGNATURE);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    label LABEL_DB_DELETE;
 | 
					 | 
				
			||||||
    label LABEL_END;
 | 
					 | 
				
			||||||
    subtitle text = STRING_TOKEN(STR_NULL);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  endform;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  //
 | 
					 | 
				
			||||||
  // Form: Display Signature List.
 | 
					 | 
				
			||||||
  //
 | 
					 | 
				
			||||||
  form formid = SECUREBOOT_DELETE_SIGNATURE_LIST_FORM,
 | 
					 | 
				
			||||||
    title  = STRING_TOKEN(STR_SECURE_BOOT_DELETE_LIST_FORM);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    subtitle text = STRING_TOKEN(STR_NULL);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    grayoutif ideqval SECUREBOOT_CONFIGURATION.ListCount == 0;
 | 
					 | 
				
			||||||
      label LABEL_DELETE_ALL_LIST_BUTTON;
 | 
					 | 
				
			||||||
      //
 | 
					 | 
				
			||||||
      // Will create a goto button dynamically here.
 | 
					 | 
				
			||||||
      //
 | 
					 | 
				
			||||||
      label LABEL_END;
 | 
					 | 
				
			||||||
   endif;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
   subtitle text = STRING_TOKEN(STR_NULL);
 | 
					 | 
				
			||||||
   label LABEL_SIGNATURE_LIST_START;
 | 
					 | 
				
			||||||
   label LABEL_END;
 | 
					 | 
				
			||||||
   subtitle text = STRING_TOKEN(STR_NULL);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  endform;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  //
 | 
					 | 
				
			||||||
  // Form: Display Signature Data.
 | 
					 | 
				
			||||||
  //
 | 
					 | 
				
			||||||
  form formid = SECUREBOOT_DELETE_SIGNATURE_DATA_FORM,
 | 
					 | 
				
			||||||
    title = STRING_TOKEN(STR_SECURE_BOOT_DELETE_DATA_FORM);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    subtitle text = STRING_TOKEN(STR_NULL);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    goto SECUREBOOT_DELETE_SIGNATURE_LIST_FORM,
 | 
					 | 
				
			||||||
      prompt = STRING_TOKEN(STR_SECURE_BOOT_DELETE_ALL_DATA),
 | 
					 | 
				
			||||||
      help   = STRING_TOKEN(STR_SECURE_BOOT_DELETE_ALL_DATA_HELP),
 | 
					 | 
				
			||||||
      flags  = INTERACTIVE,
 | 
					 | 
				
			||||||
      key    = KEY_SECURE_BOOT_DELETE_ALL_DATA;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    grayoutif ideqval SECUREBOOT_CONFIGURATION.CheckedDataCount == 0;
 | 
					 | 
				
			||||||
      goto SECUREBOOT_DELETE_SIGNATURE_LIST_FORM,
 | 
					 | 
				
			||||||
        prompt = STRING_TOKEN(STR_SECURE_BOOT_DELETE_CHECK_DATA),
 | 
					 | 
				
			||||||
        help   = STRING_TOKEN(STR_SECURE_BOOT_DELETE_CHECK_DATA_HELP),
 | 
					 | 
				
			||||||
        flags  = INTERACTIVE,
 | 
					 | 
				
			||||||
        key    = KEY_SECURE_BOOT_DELETE_CHECK_DATA;
 | 
					 | 
				
			||||||
    endif;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    subtitle text = STRING_TOKEN(STR_NULL);
 | 
					 | 
				
			||||||
    label LABEL_SIGNATURE_DATA_START;
 | 
					 | 
				
			||||||
    label LABEL_END;
 | 
					 | 
				
			||||||
    subtitle text = STRING_TOKEN(STR_NULL);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  endform;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  //
 | 
					 | 
				
			||||||
  // Form: 'Delete Signature' for DBT Options.
 | 
					 | 
				
			||||||
  //
 | 
					 | 
				
			||||||
  form formid = SECUREBOOT_DELETE_SIGNATURE_FROM_DBT,
 | 
					 | 
				
			||||||
    title  = STRING_TOKEN(STR_SECURE_BOOT_DELETE_SIGNATURE);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    label LABEL_DBT_DELETE;
 | 
					 | 
				
			||||||
    label LABEL_END;
 | 
					 | 
				
			||||||
    subtitle text = STRING_TOKEN(STR_NULL);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  endform;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  //
 | 
					 | 
				
			||||||
  // Form: 'Enroll Signature' for DB options.
 | 
					 | 
				
			||||||
  //
 | 
					 | 
				
			||||||
  form formid = SECUREBOOT_ENROLL_SIGNATURE_TO_DB,
 | 
					 | 
				
			||||||
    title = STRING_TOKEN(STR_SECURE_BOOT_ENROLL_SIGNATURE);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    subtitle text = STRING_TOKEN(STR_NULL);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    goto SECUREBOOT_ENROLL_SIGNATURE_TO_DB,
 | 
					 | 
				
			||||||
         prompt = STRING_TOKEN(STR_SECURE_BOOT_ADD_SIGNATURE_FILE),
 | 
					 | 
				
			||||||
         help = STRING_TOKEN(STR_SECURE_BOOT_ADD_SIGNATURE_FILE),
 | 
					 | 
				
			||||||
         flags = INTERACTIVE,
 | 
					 | 
				
			||||||
         key = SECUREBOOT_ENROLL_SIGNATURE_TO_DB;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    subtitle text = STRING_TOKEN(STR_NULL);
 | 
					 | 
				
			||||||
    label SECUREBOOT_ENROLL_SIGNATURE_TO_DB;
 | 
					 | 
				
			||||||
    label LABEL_END;
 | 
					 | 
				
			||||||
    subtitle text = STRING_TOKEN(STR_NULL);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    string  varid   = SECUREBOOT_CONFIGURATION.SignatureGuid,
 | 
					 | 
				
			||||||
            prompt  = STRING_TOKEN(STR_SECURE_BOOT_SIGNATURE_GUID),
 | 
					 | 
				
			||||||
            help    = STRING_TOKEN(STR_SECURE_BOOT_SIGNATURE_GUID_HELP),
 | 
					 | 
				
			||||||
            flags   = INTERACTIVE,
 | 
					 | 
				
			||||||
            key     = KEY_SECURE_BOOT_SIGNATURE_GUID_DB,
 | 
					 | 
				
			||||||
            minsize = SECURE_BOOT_GUID_SIZE,
 | 
					 | 
				
			||||||
            maxsize = SECURE_BOOT_GUID_SIZE,
 | 
					 | 
				
			||||||
    endstring;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    subtitle text = STRING_TOKEN(STR_NULL);
 | 
					 | 
				
			||||||
    subtitle text = STRING_TOKEN(STR_NULL);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    goto FORMID_SECURE_BOOT_OPTION_FORM,
 | 
					 | 
				
			||||||
         prompt = STRING_TOKEN(STR_SAVE_AND_EXIT),
 | 
					 | 
				
			||||||
         help   = STRING_TOKEN(STR_SAVE_AND_EXIT),
 | 
					 | 
				
			||||||
         flags  = INTERACTIVE,
 | 
					 | 
				
			||||||
         key    = KEY_VALUE_SAVE_AND_EXIT_DB;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    goto FORMID_SECURE_BOOT_OPTION_FORM,
 | 
					 | 
				
			||||||
         prompt = STRING_TOKEN(STR_NO_SAVE_AND_EXIT),
 | 
					 | 
				
			||||||
         help   = STRING_TOKEN(STR_NO_SAVE_AND_EXIT),
 | 
					 | 
				
			||||||
         flags  = INTERACTIVE,
 | 
					 | 
				
			||||||
         key    = KEY_VALUE_NO_SAVE_AND_EXIT_DB;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  endform;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  //
 | 
					 | 
				
			||||||
  // Form: 'Enroll Signature' for DBX options.
 | 
					 | 
				
			||||||
  //
 | 
					 | 
				
			||||||
  form formid = SECUREBOOT_ENROLL_SIGNATURE_TO_DBX,
 | 
					 | 
				
			||||||
    title = STRING_TOKEN(STR_SECURE_BOOT_ENROLL_SIGNATURE);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    subtitle text = STRING_TOKEN(STR_NULL);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    goto SECUREBOOT_ENROLL_SIGNATURE_TO_DBX,
 | 
					 | 
				
			||||||
         prompt = STRING_TOKEN(STR_SECURE_BOOT_ADD_SIGNATURE_FILE),
 | 
					 | 
				
			||||||
         help = STRING_TOKEN(STR_SECURE_BOOT_ADD_SIGNATURE_FILE),
 | 
					 | 
				
			||||||
         flags = INTERACTIVE,
 | 
					 | 
				
			||||||
         key = SECUREBOOT_ENROLL_SIGNATURE_TO_DBX;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    label SECUREBOOT_ENROLL_SIGNATURE_TO_DBX;
 | 
					 | 
				
			||||||
    label LABEL_END;
 | 
					 | 
				
			||||||
    subtitle text = STRING_TOKEN(STR_NULL);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    grayoutif ideqval SECUREBOOT_CONFIGURATION.FileEnrollType == 3;
 | 
					 | 
				
			||||||
      string  varid   = SECUREBOOT_CONFIGURATION.SignatureGuid,
 | 
					 | 
				
			||||||
              prompt  = STRING_TOKEN(STR_SECURE_BOOT_SIGNATURE_GUID),
 | 
					 | 
				
			||||||
              help    = STRING_TOKEN(STR_SECURE_BOOT_SIGNATURE_GUID_HELP),
 | 
					 | 
				
			||||||
              flags   = INTERACTIVE,
 | 
					 | 
				
			||||||
              key     = KEY_SECURE_BOOT_SIGNATURE_GUID_DBX,
 | 
					 | 
				
			||||||
              minsize = SECURE_BOOT_GUID_SIZE,
 | 
					 | 
				
			||||||
              maxsize = SECURE_BOOT_GUID_SIZE,
 | 
					 | 
				
			||||||
      endstring;
 | 
					 | 
				
			||||||
    endif;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    disableif NOT ideqval SECUREBOOT_CONFIGURATION.FileEnrollType == 1;
 | 
					 | 
				
			||||||
      oneof name = X509SignatureFormatInDbx,
 | 
					 | 
				
			||||||
            varid       = SECUREBOOT_CONFIGURATION.CertificateFormat,
 | 
					 | 
				
			||||||
            prompt      = STRING_TOKEN(STR_DBX_CERTIFICATE_FORMAT_PROMPT),
 | 
					 | 
				
			||||||
            help        = STRING_TOKEN(STR_DBX_CERTIFICATE_FORMAT_HELP),
 | 
					 | 
				
			||||||
            option text = STRING_TOKEN(STR_DBX_CERTIFICATE_FORMAT_SHA256), value = 0x1, flags = DEFAULT;
 | 
					 | 
				
			||||||
            option text = STRING_TOKEN(STR_DBX_CERTIFICATE_FORMAT_SHA384), value = 0x2, flags = 0;
 | 
					 | 
				
			||||||
            option text = STRING_TOKEN(STR_DBX_CERTIFICATE_FORMAT_SHA512), value = 0x3, flags = 0;
 | 
					 | 
				
			||||||
            option text = STRING_TOKEN(STR_DBX_CERTIFICATE_FORMAT_RAW), value = 0x4, flags = 0;
 | 
					 | 
				
			||||||
      endoneof;
 | 
					 | 
				
			||||||
    endif;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    disableif NOT ideqval SECUREBOOT_CONFIGURATION.FileEnrollType == 2;
 | 
					 | 
				
			||||||
    text
 | 
					    text
 | 
				
			||||||
        help   = STRING_TOKEN(STR_DBX_PE_IMAGE_FORMAT_HELP),          // Help string
 | 
					      help = STRING_TOKEN(STR_NULL),
 | 
				
			||||||
        text   = STRING_TOKEN(STR_DBX_CERTIFICATE_FORMAT_PROMPT),     // Prompt string
 | 
					      text = STRING_TOKEN(STR_DISABLE_SELECTION),
 | 
				
			||||||
        text   = STRING_TOKEN(STR_DBX_PE_FORMAT_SHA256);              // PE image type
 | 
					 | 
				
			||||||
    endif;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    disableif NOT ideqval SECUREBOOT_CONFIGURATION.FileEnrollType == 3;
 | 
					 | 
				
			||||||
      text
 | 
					 | 
				
			||||||
        help   = STRING_TOKEN(STR_DBX_AUTH_2_FORMAT_HELP),            // Help string
 | 
					 | 
				
			||||||
        text   = STRING_TOKEN(STR_DBX_CERTIFICATE_FORMAT_PROMPT),     // Prompt string
 | 
					 | 
				
			||||||
        text   = STRING_TOKEN(STR_DBX_AUTH_2_FORMAT);                 // AUTH_2 image type
 | 
					 | 
				
			||||||
    endif;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    suppressif ideqval SECUREBOOT_CONFIGURATION.CertificateFormat == 4;
 | 
					 | 
				
			||||||
        checkbox varid  = SECUREBOOT_CONFIGURATION.AlwaysRevocation,
 | 
					 | 
				
			||||||
               prompt = STRING_TOKEN(STR_ALWAYS_CERTIFICATE_REVOCATION_PROMPT),
 | 
					 | 
				
			||||||
               help   = STRING_TOKEN(STR_ALWAYS_CERTIFICATE_REVOCATION_HELP),
 | 
					 | 
				
			||||||
      flags = INTERACTIVE,
 | 
					      flags = INTERACTIVE,
 | 
				
			||||||
        endcheckbox;
 | 
					      key = KEY_SECURE_BOOT_STATE_DISABLE;
 | 
				
			||||||
 | 
					 | 
				
			||||||
        suppressif ideqval SECUREBOOT_CONFIGURATION.AlwaysRevocation == 1;
 | 
					 | 
				
			||||||
            date  varid  = SECUREBOOT_CONFIGURATION.RevocationDate,
 | 
					 | 
				
			||||||
                  prompt = STRING_TOKEN(STR_CERTIFICATE_REVOCATION_DATE_PROMPT),
 | 
					 | 
				
			||||||
                  help   = STRING_TOKEN(STR_CERTIFICATE_REVOCATION_DATE_HELP),
 | 
					 | 
				
			||||||
                  flags  = STORAGE_NORMAL,
 | 
					 | 
				
			||||||
            enddate;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            time varid   = SECUREBOOT_CONFIGURATION.RevocationTime,
 | 
					 | 
				
			||||||
                 prompt  = STRING_TOKEN(STR_CERTIFICATE_REVOCATION_TIME_PROMPT),
 | 
					 | 
				
			||||||
                 help    = STRING_TOKEN(STR_CERTIFICATE_REVOCATION_TIME_HELP),
 | 
					 | 
				
			||||||
                 flags   = STORAGE_NORMAL,
 | 
					 | 
				
			||||||
            endtime;
 | 
					 | 
				
			||||||
        endif;
 | 
					 | 
				
			||||||
    endif;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    subtitle text = STRING_TOKEN(STR_NULL);
 | 
					 | 
				
			||||||
    subtitle text = STRING_TOKEN(STR_NULL);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    goto FORMID_SECURE_BOOT_OPTION_FORM,
 | 
					 | 
				
			||||||
         prompt = STRING_TOKEN(STR_SAVE_AND_EXIT),
 | 
					 | 
				
			||||||
         help   = STRING_TOKEN(STR_SAVE_AND_EXIT),
 | 
					 | 
				
			||||||
         flags  = INTERACTIVE,
 | 
					 | 
				
			||||||
         key    = KEY_VALUE_SAVE_AND_EXIT_DBX;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    goto FORMID_SECURE_BOOT_OPTION_FORM,
 | 
					 | 
				
			||||||
         prompt = STRING_TOKEN(STR_NO_SAVE_AND_EXIT),
 | 
					 | 
				
			||||||
         help   = STRING_TOKEN(STR_NO_SAVE_AND_EXIT),
 | 
					 | 
				
			||||||
         flags  = INTERACTIVE,
 | 
					 | 
				
			||||||
         key    = KEY_VALUE_NO_SAVE_AND_EXIT_DBX;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    goto SECUREBOOT_CONFIGURATION_FORM_ID,
 | 
				
			||||||
 | 
					      prompt = STRING_TOKEN(STR_CANCEL),
 | 
				
			||||||
 | 
					      help = STRING_TOKEN(STR_NULL);
 | 
				
			||||||
  endform;
 | 
					  endform;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  //
 | 
					  form formid = FORMID_DELETE_KEYS,
 | 
				
			||||||
  // Form: 'Enroll Signature' for DBT options.
 | 
					    title = STRING_TOKEN(STR_SECUREBOOT_TITLE);
 | 
				
			||||||
  //
 | 
					 | 
				
			||||||
  form formid = SECUREBOOT_ENROLL_SIGNATURE_TO_DBT,
 | 
					 | 
				
			||||||
    title = STRING_TOKEN(STR_SECURE_BOOT_ENROLL_SIGNATURE);
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    subtitle text = STRING_TOKEN(STR_DELETE_KEYS_NOTICE);
 | 
				
			||||||
    subtitle text = STRING_TOKEN(STR_NULL);
 | 
					    subtitle text = STRING_TOKEN(STR_NULL);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    goto SECUREBOOT_ENROLL_SIGNATURE_TO_DBT,
 | 
					    text
 | 
				
			||||||
         prompt = STRING_TOKEN(STR_SECURE_BOOT_ADD_SIGNATURE_FILE),
 | 
					      help = STRING_TOKEN(STR_NULL),
 | 
				
			||||||
         help = STRING_TOKEN(STR_SECURE_BOOT_ADD_SIGNATURE_FILE),
 | 
					      text = STRING_TOKEN(STR_DELETE_KEYS_SELECTION),
 | 
				
			||||||
      flags = INTERACTIVE,
 | 
					      flags = INTERACTIVE,
 | 
				
			||||||
         key = SECUREBOOT_ENROLL_SIGNATURE_TO_DBT;
 | 
					      key = KEY_SECURE_BOOT_DELETE_PK;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    subtitle text = STRING_TOKEN(STR_NULL);
 | 
					    goto SECUREBOOT_CONFIGURATION_FORM_ID,
 | 
				
			||||||
    label SECUREBOOT_ENROLL_SIGNATURE_TO_DBT;
 | 
					      prompt = STRING_TOKEN(STR_CANCEL),
 | 
				
			||||||
    label LABEL_END;
 | 
					      help = STRING_TOKEN(STR_NULL);
 | 
				
			||||||
 | 
					  endform;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  form formid = FORMID_RESTORE_KEYS,
 | 
				
			||||||
 | 
					    title = STRING_TOKEN(STR_SECUREBOOT_TITLE);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    subtitle text = STRING_TOKEN(STR_RESTORE_KEYS_NOTICE);
 | 
				
			||||||
    subtitle text = STRING_TOKEN(STR_NULL);
 | 
					    subtitle text = STRING_TOKEN(STR_NULL);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    string  varid   = SECUREBOOT_CONFIGURATION.SignatureGuid,
 | 
					    text
 | 
				
			||||||
            prompt  = STRING_TOKEN(STR_SECURE_BOOT_SIGNATURE_GUID),
 | 
					      help = STRING_TOKEN(STR_NULL),
 | 
				
			||||||
            help    = STRING_TOKEN(STR_SECURE_BOOT_SIGNATURE_GUID_HELP),
 | 
					      text = STRING_TOKEN(STR_RESTORE_KEYS_SELECTION),
 | 
				
			||||||
      flags = INTERACTIVE,
 | 
					      flags = INTERACTIVE,
 | 
				
			||||||
            key     = KEY_SECURE_BOOT_SIGNATURE_GUID_DBT,
 | 
					      key = KEY_RESTORE_KEYS;
 | 
				
			||||||
            minsize = SECURE_BOOT_GUID_SIZE,
 | 
					 | 
				
			||||||
            maxsize = SECURE_BOOT_GUID_SIZE,
 | 
					 | 
				
			||||||
    endstring;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    subtitle text = STRING_TOKEN(STR_NULL);
 | 
					 | 
				
			||||||
    subtitle text = STRING_TOKEN(STR_NULL);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    goto FORMID_SECURE_BOOT_OPTION_FORM,
 | 
					 | 
				
			||||||
         prompt = STRING_TOKEN(STR_SAVE_AND_EXIT),
 | 
					 | 
				
			||||||
         help   = STRING_TOKEN(STR_SAVE_AND_EXIT),
 | 
					 | 
				
			||||||
         flags  = INTERACTIVE,
 | 
					 | 
				
			||||||
         key    = KEY_VALUE_SAVE_AND_EXIT_DBT;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    goto FORMID_SECURE_BOOT_OPTION_FORM,
 | 
					 | 
				
			||||||
         prompt = STRING_TOKEN(STR_NO_SAVE_AND_EXIT),
 | 
					 | 
				
			||||||
         help   = STRING_TOKEN(STR_NO_SAVE_AND_EXIT),
 | 
					 | 
				
			||||||
         flags  = INTERACTIVE,
 | 
					 | 
				
			||||||
         key    = KEY_VALUE_NO_SAVE_AND_EXIT_DBT;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    goto SECUREBOOT_CONFIGURATION_FORM_ID,
 | 
				
			||||||
 | 
					      prompt = STRING_TOKEN(STR_CANCEL),
 | 
				
			||||||
 | 
					      help = STRING_TOKEN(STR_NULL);
 | 
				
			||||||
  endform;
 | 
					  endform;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
endformset;
 | 
					endformset;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -3142,9 +3142,9 @@ UpdateSecureBootString(
 | 
				
			|||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  if (*SecureBoot == SECURE_BOOT_MODE_ENABLE) {
 | 
					  if (*SecureBoot == SECURE_BOOT_MODE_ENABLE) {
 | 
				
			||||||
    HiiSetString (Private->HiiHandle, STRING_TOKEN (STR_SECURE_BOOT_STATE_CONTENT), L"Enabled", NULL);
 | 
					    HiiSetString (Private->HiiHandle, STRING_TOKEN (STR_SECURE_BOOT_STATE_PROMPT), L"Secure Boot state: Enabled", NULL);
 | 
				
			||||||
  } else {
 | 
					  } else {
 | 
				
			||||||
    HiiSetString (Private->HiiHandle, STRING_TOKEN (STR_SECURE_BOOT_STATE_CONTENT), L"Disabled", NULL);
 | 
					    HiiSetString (Private->HiiHandle, STRING_TOKEN (STR_SECURE_BOOT_STATE_PROMPT), L"Secure Boot state: Disabled", NULL);
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  FreePool(SecureBoot);
 | 
					  FreePool(SecureBoot);
 | 
				
			||||||
@@ -4324,7 +4324,7 @@ SecureBootCallback (
 | 
				
			|||||||
  UINT8                           *SecureBootEnable;
 | 
					  UINT8                           *SecureBootEnable;
 | 
				
			||||||
  UINT8                           *Pk;
 | 
					  UINT8                           *Pk;
 | 
				
			||||||
  UINT8                           *SecureBootMode;
 | 
					  UINT8                           *SecureBootMode;
 | 
				
			||||||
  UINT8                           *SetupMode;
 | 
					  //UINT8                           *SetupMode;
 | 
				
			||||||
  CHAR16                          PromptString[100];
 | 
					  CHAR16                          PromptString[100];
 | 
				
			||||||
  EFI_DEVICE_PATH_PROTOCOL        *File;
 | 
					  EFI_DEVICE_PATH_PROTOCOL        *File;
 | 
				
			||||||
  UINTN                           NameLength;
 | 
					  UINTN                           NameLength;
 | 
				
			||||||
@@ -4332,13 +4332,11 @@ SecureBootCallback (
 | 
				
			|||||||
  SECUREBOOT_CONFIG_PRIVATE_DATA  *PrivateData;
 | 
					  SECUREBOOT_CONFIG_PRIVATE_DATA  *PrivateData;
 | 
				
			||||||
  BOOLEAN                         GetBrowserDataResult;
 | 
					  BOOLEAN                         GetBrowserDataResult;
 | 
				
			||||||
  ENROLL_KEY_ERROR                EnrollKeyErrorCode;
 | 
					  ENROLL_KEY_ERROR                EnrollKeyErrorCode;
 | 
				
			||||||
  EFI_HII_POPUP_PROTOCOL          *HiiPopup;
 | 
					 | 
				
			||||||
  EFI_HII_POPUP_SELECTION         UserSelection;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
  Status             = EFI_SUCCESS;
 | 
					  Status             = EFI_SUCCESS;
 | 
				
			||||||
  SecureBootEnable   = NULL;
 | 
					  SecureBootEnable   = NULL;
 | 
				
			||||||
  SecureBootMode     = NULL;
 | 
					  SecureBootMode     = NULL;
 | 
				
			||||||
  SetupMode          = NULL;
 | 
					  //SetupMode          = NULL;
 | 
				
			||||||
  File               = NULL;
 | 
					  File               = NULL;
 | 
				
			||||||
  EnrollKeyErrorCode = None_Error;
 | 
					  EnrollKeyErrorCode = None_Error;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -4414,27 +4412,14 @@ SecureBootCallback (
 | 
				
			|||||||
  if (Action == EFI_BROWSER_ACTION_CHANGING) {
 | 
					  if (Action == EFI_BROWSER_ACTION_CHANGING) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    switch (QuestionId) {
 | 
					    switch (QuestionId) {
 | 
				
			||||||
    case KEY_SECURE_BOOT_ENABLE:
 | 
					    //case KEY_SECURE_BOOT_ENABLE:
 | 
				
			||||||
 | 
					    case KEY_SECURE_BOOT_STATE_ENABLE:
 | 
				
			||||||
      GetVariable2 (EFI_SECURE_BOOT_ENABLE_NAME, &gEfiSecureBootEnableDisableGuid, (VOID**)&SecureBootEnable, NULL);
 | 
					      GetVariable2 (EFI_SECURE_BOOT_ENABLE_NAME, &gEfiSecureBootEnableDisableGuid, (VOID**)&SecureBootEnable, NULL);
 | 
				
			||||||
      if (NULL != SecureBootEnable) {
 | 
					      Status = SaveSecureBootVariable(1);
 | 
				
			||||||
        FreePool (SecureBootEnable);
 | 
					      break;
 | 
				
			||||||
        if (EFI_ERROR (SaveSecureBootVariable (Value->u8))) {
 | 
					    case KEY_SECURE_BOOT_STATE_DISABLE:
 | 
				
			||||||
          CreatePopUp (
 | 
					      GetVariable2 (EFI_SECURE_BOOT_ENABLE_NAME, &gEfiSecureBootEnableDisableGuid, (VOID**)&SecureBootEnable, NULL);
 | 
				
			||||||
            EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE,
 | 
					      Status = SaveSecureBootVariable(0);
 | 
				
			||||||
            &Key,
 | 
					 | 
				
			||||||
            L"Only Physical Presence User could disable secure boot!",
 | 
					 | 
				
			||||||
            NULL
 | 
					 | 
				
			||||||
            );
 | 
					 | 
				
			||||||
          Status = EFI_UNSUPPORTED;
 | 
					 | 
				
			||||||
        } else {
 | 
					 | 
				
			||||||
          CreatePopUp (
 | 
					 | 
				
			||||||
            EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE,
 | 
					 | 
				
			||||||
            &Key,
 | 
					 | 
				
			||||||
            L"Configuration changed, please reset the platform to take effect!",
 | 
					 | 
				
			||||||
            NULL
 | 
					 | 
				
			||||||
            );
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
      }
 | 
					 | 
				
			||||||
      break;
 | 
					      break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    case KEY_SECURE_BOOT_KEK_OPTION:
 | 
					    case KEY_SECURE_BOOT_KEK_OPTION:
 | 
				
			||||||
@@ -4534,26 +4519,7 @@ SecureBootCallback (
 | 
				
			|||||||
      break;
 | 
					      break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    case KEY_SECURE_BOOT_DELETE_PK:
 | 
					    case KEY_SECURE_BOOT_DELETE_PK:
 | 
				
			||||||
      if (Value->u8) {
 | 
					 | 
				
			||||||
        CreatePopUp (
 | 
					 | 
				
			||||||
          EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE,
 | 
					 | 
				
			||||||
          &Key,
 | 
					 | 
				
			||||||
          L"Are you sure you want to delete PK? Secure boot will be disabled!",
 | 
					 | 
				
			||||||
          L"Press 'Y' to delete PK and exit, 'N' to discard change and return",
 | 
					 | 
				
			||||||
          NULL
 | 
					 | 
				
			||||||
          );
 | 
					 | 
				
			||||||
        if (Key.UnicodeChar == 'y' || Key.UnicodeChar == 'Y') {
 | 
					 | 
				
			||||||
      Status = DeletePlatformKey();
 | 
					      Status = DeletePlatformKey();
 | 
				
			||||||
          if (EFI_ERROR (Status)) {
 | 
					 | 
				
			||||||
            CreatePopUp (
 | 
					 | 
				
			||||||
              EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE,
 | 
					 | 
				
			||||||
              &Key,
 | 
					 | 
				
			||||||
              L"Only Physical Presence User could delete PK in custom mode!",
 | 
					 | 
				
			||||||
              NULL
 | 
					 | 
				
			||||||
              );
 | 
					 | 
				
			||||||
          }
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
      }
 | 
					 | 
				
			||||||
      break;
 | 
					      break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    case KEY_DELETE_KEK:
 | 
					    case KEY_DELETE_KEK:
 | 
				
			||||||
@@ -4850,8 +4816,12 @@ SecureBootCallback (
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
  } else if (Action == EFI_BROWSER_ACTION_CHANGED) {
 | 
					  } else if (Action == EFI_BROWSER_ACTION_CHANGED) {
 | 
				
			||||||
    switch (QuestionId) {
 | 
					    switch (QuestionId) {
 | 
				
			||||||
    case KEY_SECURE_BOOT_ENABLE:
 | 
					    //case KEY_SECURE_BOOT_ENABLE:
 | 
				
			||||||
 | 
					    case KEY_SECURE_BOOT_STATE_ENABLE:
 | 
				
			||||||
 | 
					    case KEY_SECURE_BOOT_STATE_DISABLE:
 | 
				
			||||||
      *ActionRequest = EFI_BROWSER_ACTION_REQUEST_FORM_APPLY;
 | 
					      *ActionRequest = EFI_BROWSER_ACTION_REQUEST_FORM_APPLY;
 | 
				
			||||||
 | 
					      // XXX: Is this safe?
 | 
				
			||||||
 | 
					      gRT->ResetSystem(EfiResetCold, Status, 0, NULL);
 | 
				
			||||||
      break;
 | 
					      break;
 | 
				
			||||||
    case KEY_SECURE_BOOT_MODE:
 | 
					    case KEY_SECURE_BOOT_MODE:
 | 
				
			||||||
      mIsEnterSecureBootForm = FALSE;
 | 
					      mIsEnterSecureBootForm = FALSE;
 | 
				
			||||||
@@ -4870,45 +4840,33 @@ SecureBootCallback (
 | 
				
			|||||||
      *ActionRequest = EFI_BROWSER_ACTION_REQUEST_FORM_APPLY;
 | 
					      *ActionRequest = EFI_BROWSER_ACTION_REQUEST_FORM_APPLY;
 | 
				
			||||||
      break;
 | 
					      break;
 | 
				
			||||||
    case KEY_SECURE_BOOT_DELETE_PK:
 | 
					    case KEY_SECURE_BOOT_DELETE_PK:
 | 
				
			||||||
      GetVariable2 (EFI_SETUP_MODE_NAME, &gEfiGlobalVariableGuid, (VOID**)&SetupMode, NULL);
 | 
					      //GetVariable2 (EFI_SETUP_MODE_NAME, &gEfiGlobalVariableGuid, (VOID**)&SetupMode, NULL);
 | 
				
			||||||
      if (SetupMode == NULL || (*SetupMode) == SETUP_MODE) {
 | 
					      //if (SetupMode == NULL || (*SetupMode) == SETUP_MODE) {
 | 
				
			||||||
        IfrNvData->DeletePk = TRUE;
 | 
					      //  IfrNvData->DeletePk = TRUE;
 | 
				
			||||||
        IfrNvData->HasPk    = FALSE;
 | 
					      //  IfrNvData->HasPk    = FALSE;
 | 
				
			||||||
        *ActionRequest = EFI_BROWSER_ACTION_REQUEST_SUBMIT;
 | 
					      //  *ActionRequest = EFI_BROWSER_ACTION_REQUEST_SUBMIT;
 | 
				
			||||||
      } else  {
 | 
					      //} else  {
 | 
				
			||||||
        IfrNvData->DeletePk = FALSE;
 | 
					      //  IfrNvData->DeletePk = FALSE;
 | 
				
			||||||
        IfrNvData->HasPk    = TRUE;
 | 
					      //  IfrNvData->HasPk    = TRUE;
 | 
				
			||||||
        *ActionRequest = EFI_BROWSER_ACTION_REQUEST_FORM_APPLY;
 | 
					      //  *ActionRequest = EFI_BROWSER_ACTION_REQUEST_FORM_APPLY;
 | 
				
			||||||
      }
 | 
					      //}
 | 
				
			||||||
      if (SetupMode != NULL) {
 | 
					      //if (SetupMode != NULL) {
 | 
				
			||||||
        FreePool (SetupMode);
 | 
					      //  FreePool (SetupMode);
 | 
				
			||||||
      }
 | 
					      //}
 | 
				
			||||||
 | 
					      // XXX: Is this safe?
 | 
				
			||||||
 | 
					      gRT->ResetSystem(EfiResetCold, Status, 0, NULL);
 | 
				
			||||||
      break;
 | 
					      break;
 | 
				
			||||||
    case KEY_SECURE_BOOT_RESET_TO_DEFAULT:
 | 
					    //case KEY_SECURE_BOOT_RESET_TO_DEFAULT:
 | 
				
			||||||
    {
 | 
					    case KEY_RESTORE_KEYS:
 | 
				
			||||||
      Status = gBS->LocateProtocol (&gEfiHiiPopupProtocolGuid, NULL, (VOID **) &HiiPopup);
 | 
					 | 
				
			||||||
      if (EFI_ERROR (Status)) {
 | 
					 | 
				
			||||||
        return Status;
 | 
					 | 
				
			||||||
      }
 | 
					 | 
				
			||||||
      Status = HiiPopup->CreatePopup (
 | 
					 | 
				
			||||||
                           HiiPopup,
 | 
					 | 
				
			||||||
                           EfiHiiPopupStyleInfo,
 | 
					 | 
				
			||||||
                           EfiHiiPopupTypeYesNo,
 | 
					 | 
				
			||||||
                           Private->HiiHandle,
 | 
					 | 
				
			||||||
                           STRING_TOKEN (STR_RESET_TO_DEFAULTS_POPUP),
 | 
					 | 
				
			||||||
                           &UserSelection
 | 
					 | 
				
			||||||
                           );
 | 
					 | 
				
			||||||
      if (UserSelection == EfiHiiPopupSelectionYes) {
 | 
					 | 
				
			||||||
      Status = KeyEnrollReset();
 | 
					      Status = KeyEnrollReset();
 | 
				
			||||||
      }
 | 
					 | 
				
			||||||
      //
 | 
					 | 
				
			||||||
      // Update secure boot strings after key reset
 | 
					      // Update secure boot strings after key reset
 | 
				
			||||||
      //
 | 
					 | 
				
			||||||
      if (Status == EFI_SUCCESS) {
 | 
					      if (Status == EFI_SUCCESS) {
 | 
				
			||||||
        Status = UpdateSecureBootString(Private);
 | 
					        Status = UpdateSecureBootString(Private);
 | 
				
			||||||
        SecureBootExtractConfigFromVariable(Private, IfrNvData);
 | 
					        SecureBootExtractConfigFromVariable(Private, IfrNvData);
 | 
				
			||||||
 | 
					        // XXX: Is this safe?
 | 
				
			||||||
 | 
					        gRT->ResetSystem(EfiResetCold, Status, 0, NULL);
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
    }
 | 
					      break;
 | 
				
			||||||
    default:
 | 
					    default:
 | 
				
			||||||
      break;
 | 
					      break;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -119,6 +119,15 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 | 
				
			|||||||
#define PE_IMAGE_FILE_TYPE                    2
 | 
					#define PE_IMAGE_FILE_TYPE                    2
 | 
				
			||||||
#define AUTHENTICATION_2_FILE_TYPE            3
 | 
					#define AUTHENTICATION_2_FILE_TYPE            3
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#define FORMID_SECURE_BOOT_ENABLE           0x101
 | 
				
			||||||
 | 
					#define FORMID_SECURE_BOOT_DISABLE          0x102
 | 
				
			||||||
 | 
					#define FORMID_DELETE_KEYS                  0x103
 | 
				
			||||||
 | 
					#define FORMID_RESTORE_KEYS                 0x104
 | 
				
			||||||
 | 
					#define KEY_SECURE_BOOT_STATE_ENABLE        0x1120
 | 
				
			||||||
 | 
					#define KEY_SECURE_BOOT_STATE_DISABLE       0x1121
 | 
				
			||||||
 | 
					#define KEY_DELETE_KEYS                     0x1122
 | 
				
			||||||
 | 
					#define KEY_RESTORE_KEYS                    0x1123
 | 
				
			||||||
 | 
					
 | 
				
			||||||
//
 | 
					//
 | 
				
			||||||
// Nv Data structure referenced by IFR
 | 
					// Nv Data structure referenced by IFR
 | 
				
			||||||
//
 | 
					//
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -138,3 +138,18 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 | 
				
			|||||||
#string STR_SIGNATURE_DATA_HELP_FORMAT_TIME       #language en-US "Revocation Time:\n%s"
 | 
					#string STR_SIGNATURE_DATA_HELP_FORMAT_TIME       #language en-US "Revocation Time:\n%s"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#string STR_SIGNATURE_DELETE_ALL_CONFIRM          #language en-US "Press 'Y' to delete all signature List."
 | 
					#string STR_SIGNATURE_DELETE_ALL_CONFIRM          #language en-US "Press 'Y' to delete all signature List."
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#string STR_SECURE_BOOT_ENABLE_PROMPT           #language en-US "Enable Secure Boot"
 | 
				
			||||||
 | 
					#string STR_SECURE_BOOT_DISABLE_PROMPT          #language en-US "Disable Secure Boot"
 | 
				
			||||||
 | 
					#string STR_DELETE_KEYS_PROMPT                  #language en-US "Delete System76 and Microsoft keys (Use your own)"
 | 
				
			||||||
 | 
					#string STR_RESTORE_KEYS_PROMPT                 #language en-US "Restore System76 and Microsoft keys"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#string STR_ENABLE_NOTICE               #language en-US "An operating system that includes Secure Boot support is required.\r\nDisable Secure Boot if your operating system does not boot."
 | 
				
			||||||
 | 
					#string STR_ENABLE_SELECTION            #language en-US "Enable Secure Boot and reboot"
 | 
				
			||||||
 | 
					#string STR_DISABLE_NOTICE              #language en-US "Disabling Secure Boot allows non-verified operating systems to boot\r\nand may disable some operating system security features."
 | 
				
			||||||
 | 
					#string STR_DISABLE_SELECTION           #language en-US "Disable Secure Boot and reboot"
 | 
				
			||||||
 | 
					#string STR_DELETE_KEYS_NOTICE          #language en-US "System and Microsoft keys will be deleted. Enroll custom keys from your\r\noperating system. Check your OS documentation for details. To facilitate\nsetup, Secure Boot is disabled until you manually activate it."
 | 
				
			||||||
 | 
					#string STR_DELETE_KEYS_SELECTION       #language en-US "Delete System76 and Microsoft keys and restart"
 | 
				
			||||||
 | 
					#string STR_RESTORE_KEYS_NOTICE         #language en-US "Restoring System76 and Microsoft keys will remove any custom keys you\r\nhave installed and may make your OS unbootable. Disable Secure Boot if\nyour operating system does not boot."
 | 
				
			||||||
 | 
					#string STR_RESTORE_KEYS_SELECTION      #language en-US "Restore System76 and Microsoft keys and restart"
 | 
				
			||||||
 | 
					#string STR_CANCEL                      #language en-US "Cancel"
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -587,11 +587,16 @@ UefiMain (
 | 
				
			|||||||
        ConInHandle   = NULL;
 | 
					        ConInHandle   = NULL;
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      if (!EFI_ERROR(Status) && PcdGet8(PcdShellSupportLevel) >= 1) {
 | 
					      if (FALSE && !EFI_ERROR(Status) && PcdGet8(PcdShellSupportLevel) >= 1) {
 | 
				
			||||||
        //
 | 
					        //
 | 
				
			||||||
        // process the startup script or launch the called app.
 | 
					        // process the startup script or launch the called app.
 | 
				
			||||||
        //
 | 
					        //
 | 
				
			||||||
        Status = DoStartupScript(ShellInfoObject.ImageDevPath, ShellInfoObject.FileDevPath);
 | 
					        Status = DoStartupScript(ShellInfoObject.ImageDevPath, ShellInfoObject.FileDevPath);
 | 
				
			||||||
 | 
					      } else {
 | 
				
			||||||
 | 
					        //
 | 
				
			||||||
 | 
					        // show welcome notice
 | 
				
			||||||
 | 
					        //
 | 
				
			||||||
 | 
					        ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_SHELL_WELCOME), ShellInfoObject.HiiHandle);
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      if (!ShellInfoObject.ShellInitSettings.BitUnion.Bits.Exit && !ShellCommandGetExit() && (PcdGet8(PcdShellSupportLevel) >= 3 || PcdGetBool(PcdShellForceConsole)) && !EFI_ERROR(Status) && !ShellInfoObject.ShellInitSettings.BitUnion.Bits.NoConsoleIn) {
 | 
					      if (!ShellInfoObject.ShellInitSettings.BitUnion.Bits.Exit && !ShellCommandGetExit() && (PcdGet8(PcdShellSupportLevel) >= 3 || PcdGetBool(PcdShellForceConsole)) && !EFI_ERROR(Status) && !ShellInfoObject.ShellInitSettings.BitUnion.Bits.NoConsoleIn) {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -50,3 +50,4 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
#string STR_SHELL_IMAGE_NOT_APP       #language en-US "The image is not an application.\r\n"
 | 
					#string STR_SHELL_IMAGE_NOT_APP       #language en-US "The image is not an application.\r\n"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#string STR_SHELL_WELCOME             #language en-US "\r\nWelcome to the UEFI Shell!\r\n\r\nIf you wound up here by mistake, just type 'exit' to return to the UEFI Options Menu.\r\n\r\n"
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -2680,6 +2680,10 @@ IsMtrrSupported (
 | 
				
			|||||||
  CPUID_VERSION_INFO_EDX    Edx;
 | 
					  CPUID_VERSION_INFO_EDX    Edx;
 | 
				
			||||||
  MSR_IA32_MTRRCAP_REGISTER MtrrCap;
 | 
					  MSR_IA32_MTRRCAP_REGISTER MtrrCap;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  if (PcdGetBool(PcdCpuDisableMtrrProgramming)) {
 | 
				
			||||||
 | 
					    return FALSE;
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  //
 | 
					  //
 | 
				
			||||||
  // Check CPUID(1).EDX[12] for MTRR capability
 | 
					  // Check CPUID(1).EDX[12] for MTRR capability
 | 
				
			||||||
  //
 | 
					  //
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -37,4 +37,4 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
[Pcd]
 | 
					[Pcd]
 | 
				
			||||||
  gUefiCpuPkgTokenSpaceGuid.PcdCpuNumberOfReservedVariableMtrrs   ## SOMETIMES_CONSUMES
 | 
					  gUefiCpuPkgTokenSpaceGuid.PcdCpuNumberOfReservedVariableMtrrs   ## SOMETIMES_CONSUMES
 | 
				
			||||||
 | 
					  gUefiCpuPkgTokenSpaceGuid.PcdCpuDisableMtrrProgramming ## CONSUMES
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -217,6 +217,10 @@
 | 
				
			|||||||
  # @Prompt SMM Code Access Check.
 | 
					  # @Prompt SMM Code Access Check.
 | 
				
			||||||
  gUefiCpuPkgTokenSpaceGuid.PcdCpuSmmCodeAccessCheckEnable|TRUE|BOOLEAN|0x60000013
 | 
					  gUefiCpuPkgTokenSpaceGuid.PcdCpuSmmCodeAccessCheckEnable|TRUE|BOOLEAN|0x60000013
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  ## Disables MTRR programming in case it's already programmed by FSB.
 | 
				
			||||||
 | 
					  # @Prompt Disable MTRR programming.
 | 
				
			||||||
 | 
					  gUefiCpuPkgTokenSpaceGuid.PcdCpuDisableMtrrProgramming|FALSE|BOOLEAN|0x00000017
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  ## Specifies the number of variable MTRRs reserved for OS use. The default number of
 | 
					  ## Specifies the number of variable MTRRs reserved for OS use. The default number of
 | 
				
			||||||
  #  MTRRs reserved for OS use is 2.
 | 
					  #  MTRRs reserved for OS use is 2.
 | 
				
			||||||
  # @Prompt Number of reserved variable MTRRs.
 | 
					  # @Prompt Number of reserved variable MTRRs.
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -140,9 +140,13 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
#string STR_gUefiCpuPkgTokenSpaceGuid_PcdCpuHotPlugDataAddress_HELP  #language en-US "Contains the pointer to a CPU Hot Plug Data structure if CPU hot-plug is supported."
 | 
					#string STR_gUefiCpuPkgTokenSpaceGuid_PcdCpuHotPlugDataAddress_HELP  #language en-US "Contains the pointer to a CPU Hot Plug Data structure if CPU hot-plug is supported."
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#string STR_gUefiCpuPkgTokenSpaceGuid_PcdCpuNumberOfReservedVariableMtrrs_PROMPT  #language en-US "Number of reserved variable MTRRs"
 | 
					#string STR_gUefiCpuPkgTokenSpaceGuid_PcdCpuDisableMtrrProgramming_PROMPT  #language en-US "Number of reserved variable MTRRs"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#string STR_gUefiCpuPkgTokenSpaceGuid_PcdCpuNumberOfReservedVariableMtrrs_HELP  #language en-US "Specifies the number of variable MTRRs reserved for OS use."
 | 
					#string STR_gUefiCpuPkgTokenSpaceGuid_PcdCpuDisableMtrrProgramming_HELP  #language en-US "Specifies the number of variable MTRRs reserved for OS use."
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#string STR_gUefiCpuPkgTokenSpaceGuid_PcdCpuNumberOfReservedVariableMtrrs_PROMPT  #language en-US "Disable MTRR programming."
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#string STR_gUefiCpuPkgTokenSpaceGuid_PcdCpuNumberOfReservedVariableMtrrs_HELP  #language en-US "Disables MTRR programming in case it's already programmed by FSB."
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#string STR_gUefiCpuPkgTokenSpaceGuid_PcdCpuApLoopMode_PROMPT  #language en-US "The AP wait loop state"
 | 
					#string STR_gUefiCpuPkgTokenSpaceGuid_PcdCpuApLoopMode_PROMPT  #language en-US "The AP wait loop state"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										329
									
								
								UefiPayloadPkg/BlSMMStoreDxe/BlSMMStoreDxe.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										329
									
								
								UefiPayloadPkg/BlSMMStoreDxe/BlSMMStoreDxe.c
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,329 @@
 | 
				
			|||||||
 | 
					/** @file  BlSMMStoreDxe.c
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  Copyright (c) 2020, 9elements Agency GmbH<BR>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  SPDX-License-Identifier: BSD-2-Clause-Patent
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					**/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include <Library/UefiLib.h>
 | 
				
			||||||
 | 
					#include <Library/BaseMemoryLib.h>
 | 
				
			||||||
 | 
					#include <Library/MemoryAllocationLib.h>
 | 
				
			||||||
 | 
					#include <Library/DxeServicesTableLib.h>
 | 
				
			||||||
 | 
					#include <Library/UefiBootServicesTableLib.h>
 | 
				
			||||||
 | 
					#include <Library/PcdLib.h>
 | 
				
			||||||
 | 
					#include <Library/SMMStoreLib.h>
 | 
				
			||||||
 | 
					#include <Library/HobLib.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include "BlSMMStoreDxe.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					STATIC EFI_EVENT mSMMStoreVirtualAddrChangeEvent;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					//
 | 
				
			||||||
 | 
					// Global variable declarations
 | 
				
			||||||
 | 
					//
 | 
				
			||||||
 | 
					SMMSTORE_INSTANCE *mSMMStoreInstance;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					SMMSTORE_INSTANCE  mSMMStoreInstanceTemplate = {
 | 
				
			||||||
 | 
					  SMMSTORE_SIGNATURE, // Signature
 | 
				
			||||||
 | 
					  NULL, // Handle ... NEED TO BE FILLED
 | 
				
			||||||
 | 
					  {
 | 
				
			||||||
 | 
					    0, // MediaId ... NEED TO BE FILLED
 | 
				
			||||||
 | 
					    FALSE, // RemovableMedia
 | 
				
			||||||
 | 
					    TRUE, // MediaPresent
 | 
				
			||||||
 | 
					    FALSE, // LogicalPartition
 | 
				
			||||||
 | 
					    FALSE, // ReadOnly
 | 
				
			||||||
 | 
					    FALSE, // WriteCaching;
 | 
				
			||||||
 | 
					    0, // BlockSize ... NEED TO BE FILLED
 | 
				
			||||||
 | 
					    4, //  IoAlign
 | 
				
			||||||
 | 
					    0, // LastBlock ... NEED TO BE FILLED
 | 
				
			||||||
 | 
					    0, // LowestAlignedLba
 | 
				
			||||||
 | 
					    1, // LogicalBlocksPerPhysicalBlock
 | 
				
			||||||
 | 
					  }, //Media;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  {
 | 
				
			||||||
 | 
					    FvbGetAttributes, // GetAttributes
 | 
				
			||||||
 | 
					    FvbSetAttributes, // SetAttributes
 | 
				
			||||||
 | 
					    FvbGetPhysicalAddress,  // GetPhysicalAddress
 | 
				
			||||||
 | 
					    FvbGetBlockSize,  // GetBlockSize
 | 
				
			||||||
 | 
					    FvbRead,  // Read
 | 
				
			||||||
 | 
					    FvbWrite, // Write
 | 
				
			||||||
 | 
					    FvbEraseBlocks, // EraseBlocks
 | 
				
			||||||
 | 
					    NULL, //ParentHandle
 | 
				
			||||||
 | 
					  }, //  FvbProtoccol;
 | 
				
			||||||
 | 
					  {
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					      {
 | 
				
			||||||
 | 
					        HARDWARE_DEVICE_PATH,
 | 
				
			||||||
 | 
					        HW_VENDOR_DP,
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					          (UINT8)(OFFSET_OF (NOR_FLASH_DEVICE_PATH, End)),
 | 
				
			||||||
 | 
					          (UINT8)(OFFSET_OF (NOR_FLASH_DEVICE_PATH, End) >> 8)
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					      },
 | 
				
			||||||
 | 
					      { 0x0, 0x0, 0x0, { 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 } }, // GUID ... NEED TO BE FILLED
 | 
				
			||||||
 | 
					    },
 | 
				
			||||||
 | 
					    0, // Index
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					      END_DEVICE_PATH_TYPE,
 | 
				
			||||||
 | 
					      END_ENTIRE_DEVICE_PATH_SUBTYPE,
 | 
				
			||||||
 | 
					      { sizeof (EFI_DEVICE_PATH_PROTOCOL), 0 }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    } // DevicePath
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					STATIC
 | 
				
			||||||
 | 
					EFI_STATUS
 | 
				
			||||||
 | 
					SMMStoreCreateInstance (
 | 
				
			||||||
 | 
					  IN UINTN                  NumberofBlocks,
 | 
				
			||||||
 | 
					  IN UINTN                  BlockSize,
 | 
				
			||||||
 | 
					  OUT SMMSTORE_INSTANCE**  SMMStoreInstance
 | 
				
			||||||
 | 
					  )
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					  EFI_STATUS Status;
 | 
				
			||||||
 | 
					  SMMSTORE_INSTANCE* Instance;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  ASSERT(SMMStoreInstance != NULL);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  Instance = AllocateRuntimeCopyPool (sizeof(SMMSTORE_INSTANCE),&mSMMStoreInstanceTemplate);
 | 
				
			||||||
 | 
					  if (Instance == NULL) {
 | 
				
			||||||
 | 
					    return EFI_OUT_OF_RESOURCES;
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  Instance->Media.MediaId = 0;
 | 
				
			||||||
 | 
					  Instance->Media.BlockSize = BlockSize;
 | 
				
			||||||
 | 
					  Instance->Media.LastBlock = NumberofBlocks - 1;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  CopyGuid (&Instance->DevicePath.Vendor.Guid, &gEfiCallerIdGuid);
 | 
				
			||||||
 | 
					  Instance->DevicePath.Index = (UINT8)0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  Status = SMMStoreFvbInitialize (Instance);
 | 
				
			||||||
 | 
					  if (EFI_ERROR(Status)) {
 | 
				
			||||||
 | 
					    FreePool (Instance);
 | 
				
			||||||
 | 
					    return Status;
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  Status = gBS->InstallMultipleProtocolInterfaces (
 | 
				
			||||||
 | 
					                &Instance->Handle,
 | 
				
			||||||
 | 
					                &gEfiDevicePathProtocolGuid, &Instance->DevicePath,
 | 
				
			||||||
 | 
					                &gEfiFirmwareVolumeBlockProtocolGuid, &Instance->FvbProtocol,
 | 
				
			||||||
 | 
					                NULL
 | 
				
			||||||
 | 
					                );
 | 
				
			||||||
 | 
					  if (EFI_ERROR(Status)) {
 | 
				
			||||||
 | 
					    FreePool (Instance);
 | 
				
			||||||
 | 
					    return Status;
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  DEBUG((DEBUG_INFO, "%a: Created a new instance\n", __FUNCTION__));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  *SMMStoreInstance = Instance;
 | 
				
			||||||
 | 
					  return Status;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					  Fixup internal data so that EFI can be call in virtual mode.
 | 
				
			||||||
 | 
					  Call the passed in Child Notify event and convert any pointers in
 | 
				
			||||||
 | 
					  lib to virtual mode.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  @param[in]    Event   The Event that is being processed
 | 
				
			||||||
 | 
					  @param[in]    Context Event Context
 | 
				
			||||||
 | 
					**/
 | 
				
			||||||
 | 
					VOID
 | 
				
			||||||
 | 
					EFIAPI
 | 
				
			||||||
 | 
					BlSMMStoreVirtualNotifyEvent (
 | 
				
			||||||
 | 
					  IN EFI_EVENT        Event,
 | 
				
			||||||
 | 
					  IN VOID             *Context
 | 
				
			||||||
 | 
					  )
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					  // Convert Fvb
 | 
				
			||||||
 | 
					  EfiConvertPointer (0x0, (VOID**)&mSMMStoreInstance->FvbProtocol.EraseBlocks);
 | 
				
			||||||
 | 
					  EfiConvertPointer (0x0, (VOID**)&mSMMStoreInstance->FvbProtocol.GetAttributes);
 | 
				
			||||||
 | 
					  EfiConvertPointer (0x0, (VOID**)&mSMMStoreInstance->FvbProtocol.GetBlockSize);
 | 
				
			||||||
 | 
					  EfiConvertPointer (0x0, (VOID**)&mSMMStoreInstance->FvbProtocol.GetPhysicalAddress);
 | 
				
			||||||
 | 
					  EfiConvertPointer (0x0, (VOID**)&mSMMStoreInstance->FvbProtocol.Read);
 | 
				
			||||||
 | 
					  EfiConvertPointer (0x0, (VOID**)&mSMMStoreInstance->FvbProtocol.SetAttributes);
 | 
				
			||||||
 | 
					  EfiConvertPointer (0x0, (VOID**)&mSMMStoreInstance->FvbProtocol.Write);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  SMMStoreVirtualNotifyEvent (Event, Context);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  return;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					EFI_STATUS
 | 
				
			||||||
 | 
					EFIAPI
 | 
				
			||||||
 | 
					BlSMMSTOREInitialise (
 | 
				
			||||||
 | 
					  IN EFI_HANDLE         ImageHandle,
 | 
				
			||||||
 | 
					  IN EFI_SYSTEM_TABLE   *SystemTable
 | 
				
			||||||
 | 
					  )
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					  EFI_STATUS                              Status;
 | 
				
			||||||
 | 
					  VOID                                    *ComBuf;
 | 
				
			||||||
 | 
					  VOID                                    *GuidHob;
 | 
				
			||||||
 | 
					  SMMSTORE_INFO                           *SMMStoreInfoHob;
 | 
				
			||||||
 | 
					  EFI_GCD_MEMORY_SPACE_DESCRIPTOR         GcdDescriptor;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  if (PcdGetBool (PcdEmuVariableNvModeEnable)) {
 | 
				
			||||||
 | 
					    DEBUG ((DEBUG_WARN, "Variable emulation is active! Skipping driver init.\n"));
 | 
				
			||||||
 | 
					    return EFI_SUCCESS;
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  //
 | 
				
			||||||
 | 
					  // Find the SMMSTORE information guid hob
 | 
				
			||||||
 | 
					  //
 | 
				
			||||||
 | 
					  GuidHob = GetFirstGuidHob (&gEfiSMMSTOREInfoHobGuid);
 | 
				
			||||||
 | 
					  if (GuidHob == NULL) {
 | 
				
			||||||
 | 
					    DEBUG ((DEBUG_WARN, "SMMSTORE not supported! Skipping driver init.\n"));
 | 
				
			||||||
 | 
					    PcdSetBoolS (PcdEmuVariableNvModeEnable, TRUE);
 | 
				
			||||||
 | 
					    return EFI_SUCCESS;
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  //
 | 
				
			||||||
 | 
					  // Allocate Communication Buffer for arguments to pass to SMM
 | 
				
			||||||
 | 
					  //
 | 
				
			||||||
 | 
					  ComBuf = AllocateRuntimePool (SMMSTORE_COMBUF_SIZE);
 | 
				
			||||||
 | 
					  if (!ComBuf) {
 | 
				
			||||||
 | 
					    PcdSetBoolS (PcdEmuVariableNvModeEnable, TRUE);
 | 
				
			||||||
 | 
					    return EFI_OUT_OF_RESOURCES;
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  //
 | 
				
			||||||
 | 
					  // Place SMMSTORE information hob in a runtime buffer
 | 
				
			||||||
 | 
					  //
 | 
				
			||||||
 | 
					  SMMStoreInfoHob = AllocateRuntimePool (GET_GUID_HOB_DATA_SIZE(GuidHob));
 | 
				
			||||||
 | 
					  if (!SMMStoreInfoHob) {
 | 
				
			||||||
 | 
					    FreePool(ComBuf);
 | 
				
			||||||
 | 
					    PcdSetBoolS (PcdEmuVariableNvModeEnable, TRUE);
 | 
				
			||||||
 | 
					    return EFI_OUT_OF_RESOURCES;
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  CopyMem(SMMStoreInfoHob, GET_GUID_HOB_DATA (GuidHob), GET_GUID_HOB_DATA_SIZE(GuidHob));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  if (!SMMStoreInfoHob->MmioAddress ||
 | 
				
			||||||
 | 
					      !SMMStoreInfoHob->ComBuffer ||
 | 
				
			||||||
 | 
					      !SMMStoreInfoHob->BlockSize ||
 | 
				
			||||||
 | 
					      !SMMStoreInfoHob->NumBlocks) {
 | 
				
			||||||
 | 
					    DEBUG((DEBUG_ERROR, "%a: Invalid data in SMMStore Info hob\n", __FUNCTION__));
 | 
				
			||||||
 | 
					    FreePool(ComBuf);
 | 
				
			||||||
 | 
					    FreePool(SMMStoreInfoHob);
 | 
				
			||||||
 | 
					    PcdSetBoolS (PcdEmuVariableNvModeEnable, TRUE);
 | 
				
			||||||
 | 
					    return EFI_WRITE_PROTECTED;
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  //
 | 
				
			||||||
 | 
					  // Update PCDs for VariableRuntimeDxe
 | 
				
			||||||
 | 
					  // Can't do it later as VariableRuntimeDxe has no Depex
 | 
				
			||||||
 | 
					  //
 | 
				
			||||||
 | 
					  PcdSet32S (PcdFlashNvStorageVariableBase,
 | 
				
			||||||
 | 
					    PcdGet32 (PcdFlashNvStorageVariableBase) + SMMStoreInfoHob->MmioAddress);
 | 
				
			||||||
 | 
					  PcdSet32S (PcdFlashNvStorageFtwWorkingBase,
 | 
				
			||||||
 | 
					    PcdGet32 (PcdFlashNvStorageFtwWorkingBase) + SMMStoreInfoHob->MmioAddress);
 | 
				
			||||||
 | 
					  PcdSet32S (PcdFlashNvStorageFtwSpareBase,
 | 
				
			||||||
 | 
					    PcdGet32 (PcdFlashNvStorageFtwSpareBase) + SMMStoreInfoHob->MmioAddress);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  Status = SMMStoreInitialize(ComBuf, SMMStoreInfoHob);
 | 
				
			||||||
 | 
					  if (EFI_ERROR(Status)) {
 | 
				
			||||||
 | 
					    DEBUG((DEBUG_ERROR,"%a: Failed to initialize SMMStore\n",
 | 
				
			||||||
 | 
					      __FUNCTION__));
 | 
				
			||||||
 | 
					    FreePool(ComBuf);
 | 
				
			||||||
 | 
					    FreePool(SMMStoreInfoHob);
 | 
				
			||||||
 | 
					    PcdSetBoolS (PcdEmuVariableNvModeEnable, TRUE);
 | 
				
			||||||
 | 
					    return Status;
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  mSMMStoreInstance = AllocateRuntimePool (sizeof(SMMSTORE_INSTANCE*));
 | 
				
			||||||
 | 
					  if (!mSMMStoreInstance) {
 | 
				
			||||||
 | 
					    DEBUG((DEBUG_ERROR, "%a: Out of resources\n", __FUNCTION__));
 | 
				
			||||||
 | 
					    FreePool(ComBuf);
 | 
				
			||||||
 | 
					    FreePool(SMMStoreInfoHob);
 | 
				
			||||||
 | 
					    PcdSetBoolS (PcdEmuVariableNvModeEnable, TRUE);
 | 
				
			||||||
 | 
					    return EFI_OUT_OF_RESOURCES;
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  Status = SMMStoreCreateInstance (
 | 
				
			||||||
 | 
					    SMMStoreInfoHob->NumBlocks,
 | 
				
			||||||
 | 
					    SMMStoreInfoHob->BlockSize,
 | 
				
			||||||
 | 
					    &mSMMStoreInstance
 | 
				
			||||||
 | 
					  );
 | 
				
			||||||
 | 
					  if (EFI_ERROR(Status)) {
 | 
				
			||||||
 | 
					    DEBUG((DEBUG_ERROR, "%a: Fail to create instance for SMMStore\n",
 | 
				
			||||||
 | 
					      __FUNCTION__));
 | 
				
			||||||
 | 
					    FreePool(ComBuf);
 | 
				
			||||||
 | 
					    FreePool(SMMStoreInfoHob);
 | 
				
			||||||
 | 
					    PcdSetBoolS (PcdEmuVariableNvModeEnable, TRUE);
 | 
				
			||||||
 | 
					    return Status;
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  //
 | 
				
			||||||
 | 
					  // Register for the virtual address change event
 | 
				
			||||||
 | 
					  //
 | 
				
			||||||
 | 
					  Status = gBS->CreateEventEx (
 | 
				
			||||||
 | 
					                  EVT_NOTIFY_SIGNAL,
 | 
				
			||||||
 | 
					                  TPL_NOTIFY,
 | 
				
			||||||
 | 
					                  BlSMMStoreVirtualNotifyEvent,
 | 
				
			||||||
 | 
					                  NULL,
 | 
				
			||||||
 | 
					                  &gEfiEventVirtualAddressChangeGuid,
 | 
				
			||||||
 | 
					                  &mSMMStoreVirtualAddrChangeEvent
 | 
				
			||||||
 | 
					                  );
 | 
				
			||||||
 | 
					  ASSERT_EFI_ERROR (Status);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  //
 | 
				
			||||||
 | 
					  // Finally mark the SMM communication buffer provided by CB or SBL as runtime memory
 | 
				
			||||||
 | 
					  //
 | 
				
			||||||
 | 
					  Status      = gDS->GetMemorySpaceDescriptor (SMMStoreInfoHob->ComBuffer, &GcdDescriptor);
 | 
				
			||||||
 | 
					  if (EFI_ERROR (Status) || GcdDescriptor.GcdMemoryType != EfiGcdMemoryTypeReserved) {
 | 
				
			||||||
 | 
					    DEBUG((DEBUG_INFO, "%a: No reserved memory space descriptor for com buffer found\n",
 | 
				
			||||||
 | 
					      __FUNCTION__));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    //
 | 
				
			||||||
 | 
					    // Add a new entry if not covered by existing mapping
 | 
				
			||||||
 | 
					    //
 | 
				
			||||||
 | 
					    Status = gDS->AddMemorySpace (
 | 
				
			||||||
 | 
					        EfiGcdMemoryTypeReserved,
 | 
				
			||||||
 | 
					        SMMStoreInfoHob->ComBuffer, SMMStoreInfoHob->ComBufferSize,
 | 
				
			||||||
 | 
					        EFI_MEMORY_WB | EFI_MEMORY_RUNTIME
 | 
				
			||||||
 | 
					        );
 | 
				
			||||||
 | 
					    ASSERT_EFI_ERROR (Status);
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  //
 | 
				
			||||||
 | 
					  // Mark as runtime service
 | 
				
			||||||
 | 
					  //
 | 
				
			||||||
 | 
					  Status = gDS->SetMemorySpaceAttributes (
 | 
				
			||||||
 | 
					                  SMMStoreInfoHob->ComBuffer,
 | 
				
			||||||
 | 
					                  SMMStoreInfoHob->ComBufferSize,
 | 
				
			||||||
 | 
					                  EFI_MEMORY_RUNTIME
 | 
				
			||||||
 | 
					                  );
 | 
				
			||||||
 | 
					  ASSERT_EFI_ERROR (Status);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  //
 | 
				
			||||||
 | 
					  // Mark the memory mapped store as MMIO memory
 | 
				
			||||||
 | 
					  //
 | 
				
			||||||
 | 
					  Status      = gDS->GetMemorySpaceDescriptor (SMMStoreInfoHob->MmioAddress, &GcdDescriptor);
 | 
				
			||||||
 | 
					  if (EFI_ERROR (Status) || GcdDescriptor.GcdMemoryType != EfiGcdMemoryTypeMemoryMappedIo) {
 | 
				
			||||||
 | 
					    DEBUG((DEBUG_INFO, "%a: No MMIO memory space descriptor for com buffer found\n",
 | 
				
			||||||
 | 
					      __FUNCTION__));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    //
 | 
				
			||||||
 | 
					    // Add a new entry if not covered by existing mapping
 | 
				
			||||||
 | 
					    //
 | 
				
			||||||
 | 
					    Status = gDS->AddMemorySpace (
 | 
				
			||||||
 | 
					        EfiGcdMemoryTypeMemoryMappedIo,
 | 
				
			||||||
 | 
					        SMMStoreInfoHob->MmioAddress,
 | 
				
			||||||
 | 
					        SMMStoreInfoHob->NumBlocks * SMMStoreInfoHob->BlockSize,
 | 
				
			||||||
 | 
					        EFI_MEMORY_UC | EFI_MEMORY_RUNTIME
 | 
				
			||||||
 | 
					        );
 | 
				
			||||||
 | 
					    ASSERT_EFI_ERROR (Status);
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  //
 | 
				
			||||||
 | 
					  // Mark as runtime service
 | 
				
			||||||
 | 
					  //
 | 
				
			||||||
 | 
					  Status = gDS->SetMemorySpaceAttributes (
 | 
				
			||||||
 | 
					                  SMMStoreInfoHob->MmioAddress,
 | 
				
			||||||
 | 
					                  SMMStoreInfoHob->NumBlocks * SMMStoreInfoHob->BlockSize,
 | 
				
			||||||
 | 
					                  EFI_MEMORY_RUNTIME
 | 
				
			||||||
 | 
					                  );
 | 
				
			||||||
 | 
					  ASSERT_EFI_ERROR (Status);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  return Status;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
							
								
								
									
										118
									
								
								UefiPayloadPkg/BlSMMStoreDxe/BlSMMStoreDxe.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										118
									
								
								UefiPayloadPkg/BlSMMStoreDxe/BlSMMStoreDxe.h
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,118 @@
 | 
				
			|||||||
 | 
					/** @file  BlSMMStoreDxe.h
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  Copyright (c) 2020, 9elements Agency GmbH<BR>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  SPDX-License-Identifier: BSD-2-Clause-Patent
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					**/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#ifndef __COREBOOT_SMM_STORE_DXE_H__
 | 
				
			||||||
 | 
					#define __COREBOOT_SMM_STORE_DXE_H__
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include <Base.h>
 | 
				
			||||||
 | 
					#include <PiDxe.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include <Guid/EventGroup.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include <Protocol/BlockIo.h>
 | 
				
			||||||
 | 
					#include <Protocol/DiskIo.h>
 | 
				
			||||||
 | 
					#include <Protocol/FirmwareVolumeBlock.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include <Library/DebugLib.h>
 | 
				
			||||||
 | 
					#include <Library/IoLib.h>
 | 
				
			||||||
 | 
					#include <Library/UefiLib.h>
 | 
				
			||||||
 | 
					#include <Library/UefiRuntimeLib.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#define SMMSTORE_SIGNATURE                       SIGNATURE_32('S', 'M', 'M', 'S')
 | 
				
			||||||
 | 
					#define INSTANCE_FROM_FVB_THIS(a)                CR(a, SMMSTORE_INSTANCE, FvbProtocol, SMMSTORE_SIGNATURE)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					typedef struct _SMMSTORE_INSTANCE                SMMSTORE_INSTANCE;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#pragma pack (1)
 | 
				
			||||||
 | 
					typedef struct {
 | 
				
			||||||
 | 
					  VENDOR_DEVICE_PATH                  Vendor;
 | 
				
			||||||
 | 
					  UINT8                               Index;
 | 
				
			||||||
 | 
					  EFI_DEVICE_PATH_PROTOCOL            End;
 | 
				
			||||||
 | 
					} NOR_FLASH_DEVICE_PATH;
 | 
				
			||||||
 | 
					#pragma pack ()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					struct _SMMSTORE_INSTANCE {
 | 
				
			||||||
 | 
					  UINT32                              Signature;
 | 
				
			||||||
 | 
					  EFI_HANDLE                          Handle;
 | 
				
			||||||
 | 
					  EFI_BLOCK_IO_MEDIA                  Media;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  EFI_FIRMWARE_VOLUME_BLOCK2_PROTOCOL FvbProtocol;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  NOR_FLASH_DEVICE_PATH               DevicePath;
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					//
 | 
				
			||||||
 | 
					// BlSMMStoreFvbDxe.c
 | 
				
			||||||
 | 
					//
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					EFI_STATUS
 | 
				
			||||||
 | 
					EFIAPI
 | 
				
			||||||
 | 
					SMMStoreFvbInitialize (
 | 
				
			||||||
 | 
					  IN SMMSTORE_INSTANCE*                            Instance
 | 
				
			||||||
 | 
					  );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					EFI_STATUS
 | 
				
			||||||
 | 
					EFIAPI
 | 
				
			||||||
 | 
					FvbGetAttributes(
 | 
				
			||||||
 | 
					  IN CONST  EFI_FIRMWARE_VOLUME_BLOCK2_PROTOCOL     *This,
 | 
				
			||||||
 | 
					  OUT       EFI_FVB_ATTRIBUTES_2                    *Attributes
 | 
				
			||||||
 | 
					  );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					EFI_STATUS
 | 
				
			||||||
 | 
					EFIAPI
 | 
				
			||||||
 | 
					FvbSetAttributes(
 | 
				
			||||||
 | 
					  IN CONST  EFI_FIRMWARE_VOLUME_BLOCK2_PROTOCOL     *This,
 | 
				
			||||||
 | 
					  IN OUT    EFI_FVB_ATTRIBUTES_2                    *Attributes
 | 
				
			||||||
 | 
					  );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					EFI_STATUS
 | 
				
			||||||
 | 
					EFIAPI
 | 
				
			||||||
 | 
					FvbGetPhysicalAddress(
 | 
				
			||||||
 | 
					  IN CONST  EFI_FIRMWARE_VOLUME_BLOCK2_PROTOCOL     *This,
 | 
				
			||||||
 | 
					  OUT       EFI_PHYSICAL_ADDRESS                    *Address
 | 
				
			||||||
 | 
					  );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					EFI_STATUS
 | 
				
			||||||
 | 
					EFIAPI
 | 
				
			||||||
 | 
					FvbGetBlockSize(
 | 
				
			||||||
 | 
					  IN CONST  EFI_FIRMWARE_VOLUME_BLOCK2_PROTOCOL     *This,
 | 
				
			||||||
 | 
					  IN        EFI_LBA                                 Lba,
 | 
				
			||||||
 | 
					  OUT       UINTN                                   *BlockSize,
 | 
				
			||||||
 | 
					  OUT       UINTN                                   *NumberOfBlocks
 | 
				
			||||||
 | 
					  );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					EFI_STATUS
 | 
				
			||||||
 | 
					EFIAPI
 | 
				
			||||||
 | 
					FvbRead(
 | 
				
			||||||
 | 
					  IN CONST  EFI_FIRMWARE_VOLUME_BLOCK2_PROTOCOL     *This,
 | 
				
			||||||
 | 
					  IN        EFI_LBA                                 Lba,
 | 
				
			||||||
 | 
					  IN        UINTN                                   Offset,
 | 
				
			||||||
 | 
					  IN OUT    UINTN                                   *NumBytes,
 | 
				
			||||||
 | 
					  IN OUT    UINT8                                   *Buffer
 | 
				
			||||||
 | 
					  );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					EFI_STATUS
 | 
				
			||||||
 | 
					EFIAPI
 | 
				
			||||||
 | 
					FvbWrite(
 | 
				
			||||||
 | 
					  IN CONST  EFI_FIRMWARE_VOLUME_BLOCK2_PROTOCOL     *This,
 | 
				
			||||||
 | 
					  IN        EFI_LBA                                 Lba,
 | 
				
			||||||
 | 
					  IN        UINTN                                   Offset,
 | 
				
			||||||
 | 
					  IN OUT    UINTN                                   *NumBytes,
 | 
				
			||||||
 | 
					  IN        UINT8                                   *Buffer
 | 
				
			||||||
 | 
					  );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					EFI_STATUS
 | 
				
			||||||
 | 
					EFIAPI
 | 
				
			||||||
 | 
					FvbEraseBlocks(
 | 
				
			||||||
 | 
					  IN CONST  EFI_FIRMWARE_VOLUME_BLOCK2_PROTOCOL     *This,
 | 
				
			||||||
 | 
					  ...
 | 
				
			||||||
 | 
					  );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#endif /* __COREBOOT_SMM_STORE_DXE_H__ */
 | 
				
			||||||
							
								
								
									
										62
									
								
								UefiPayloadPkg/BlSMMStoreDxe/BlSMMStoreDxe.inf
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										62
									
								
								UefiPayloadPkg/BlSMMStoreDxe/BlSMMStoreDxe.inf
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,62 @@
 | 
				
			|||||||
 | 
					#/** @file
 | 
				
			||||||
 | 
					#
 | 
				
			||||||
 | 
					#  Component description file for SMMSTORE module
 | 
				
			||||||
 | 
					#
 | 
				
			||||||
 | 
					#  Copyright (c) 2020, 9elements Agency GmbH<BR>
 | 
				
			||||||
 | 
					#
 | 
				
			||||||
 | 
					#  SPDX-License-Identifier: BSD-2-Clause-Patent
 | 
				
			||||||
 | 
					#
 | 
				
			||||||
 | 
					#**/
 | 
				
			||||||
 | 
					[Defines]
 | 
				
			||||||
 | 
					  INF_VERSION                    = 0x00010005
 | 
				
			||||||
 | 
					  BASE_NAME                      = UefiPayloadBlSMMStoreDxe
 | 
				
			||||||
 | 
					  FILE_GUID                      = A0402FCA-6B25-4CEA-B7DD-C08F99714B29
 | 
				
			||||||
 | 
					  MODULE_TYPE                    = DXE_RUNTIME_DRIVER
 | 
				
			||||||
 | 
					  VERSION_STRING                 = 1.0
 | 
				
			||||||
 | 
					  ENTRY_POINT                    = BlSMMSTOREInitialise
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					[Sources.common]
 | 
				
			||||||
 | 
					  BlSMMStoreDxe.h
 | 
				
			||||||
 | 
					  BlSMMStoreDxe.c
 | 
				
			||||||
 | 
					  BlSMMStoreFvbDxe.c
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					[Packages]
 | 
				
			||||||
 | 
					  MdePkg/MdePkg.dec
 | 
				
			||||||
 | 
					  MdeModulePkg/MdeModulePkg.dec
 | 
				
			||||||
 | 
					  EmbeddedPkg/EmbeddedPkg.dec
 | 
				
			||||||
 | 
					  UefiPayloadPkg/UefiPayloadPkg.dec
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					[LibraryClasses]
 | 
				
			||||||
 | 
					  BaseLib
 | 
				
			||||||
 | 
					  DebugLib
 | 
				
			||||||
 | 
					  HobLib
 | 
				
			||||||
 | 
					  SmmStoreLib
 | 
				
			||||||
 | 
					  UefiLib
 | 
				
			||||||
 | 
					  UefiDriverEntryPoint
 | 
				
			||||||
 | 
					  UefiBootServicesTableLib
 | 
				
			||||||
 | 
					  UefiRuntimeLib
 | 
				
			||||||
 | 
					  DxeServicesTableLib
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					[Guids]
 | 
				
			||||||
 | 
					  gEfiSystemNvDataFvGuid
 | 
				
			||||||
 | 
					  gEfiVariableGuid
 | 
				
			||||||
 | 
					  gEfiAuthenticatedVariableGuid
 | 
				
			||||||
 | 
					  gEfiEventVirtualAddressChangeGuid
 | 
				
			||||||
 | 
					  gEdkiiNvVarStoreFormattedGuid     ## PRODUCES ## PROTOCOL
 | 
				
			||||||
 | 
					  gEfiSMMSTOREInfoHobGuid           ## CONSUMES
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					[Protocols]
 | 
				
			||||||
 | 
					  gEfiDevicePathProtocolGuid          ## BY_START
 | 
				
			||||||
 | 
					  gEfiFirmwareVolumeBlockProtocolGuid ## BY_START
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					[Pcd]
 | 
				
			||||||
 | 
					  gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase
 | 
				
			||||||
 | 
					  gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableSize
 | 
				
			||||||
 | 
					  gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingBase
 | 
				
			||||||
 | 
					  gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingSize
 | 
				
			||||||
 | 
					  gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareBase
 | 
				
			||||||
 | 
					  gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareSize
 | 
				
			||||||
 | 
					  gEfiMdeModulePkgTokenSpaceGuid.PcdEmuVariableNvModeEnable
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					[Depex]
 | 
				
			||||||
 | 
					  BEFORE gVariableRuntimeDxeFileGuid
 | 
				
			||||||
							
								
								
									
										817
									
								
								UefiPayloadPkg/BlSMMStoreDxe/BlSMMStoreFvbDxe.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										817
									
								
								UefiPayloadPkg/BlSMMStoreDxe/BlSMMStoreFvbDxe.c
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,817 @@
 | 
				
			|||||||
 | 
					/*++ @file  BlSMMStoreFvbDxe.c
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 Copyright (c) 2020, 9elements Agency GmbH<BR>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 SPDX-License-Identifier: BSD-2-Clause-Patent
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 --*/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include <PiDxe.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include <Library/PcdLib.h>
 | 
				
			||||||
 | 
					#include <Library/BaseLib.h>
 | 
				
			||||||
 | 
					#include <Library/HobLib.h>
 | 
				
			||||||
 | 
					#include <Library/UefiLib.h>
 | 
				
			||||||
 | 
					#include <Library/BaseMemoryLib.h>
 | 
				
			||||||
 | 
					#include <Library/MemoryAllocationLib.h>
 | 
				
			||||||
 | 
					#include <Library/DxeServicesTableLib.h>
 | 
				
			||||||
 | 
					#include <Library/UefiBootServicesTableLib.h>
 | 
				
			||||||
 | 
					#include <Library/SMMStoreLib.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include <Guid/VariableFormat.h>
 | 
				
			||||||
 | 
					#include <Guid/SystemNvDataGuid.h>
 | 
				
			||||||
 | 
					#include <Guid/NvVarStoreFormatted.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include "BlSMMStoreDxe.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					STATIC EFI_EVENT mFvbVirtualAddrChangeEvent;
 | 
				
			||||||
 | 
					STATIC UINTN     mFlashNvStorageVariableBase;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					///
 | 
				
			||||||
 | 
					/// The Firmware Volume Block Protocol is the low-level interface
 | 
				
			||||||
 | 
					/// to a firmware volume. File-level access to a firmware volume
 | 
				
			||||||
 | 
					/// should not be done using the Firmware Volume Block Protocol.
 | 
				
			||||||
 | 
					/// Normal access to a firmware volume must use the Firmware
 | 
				
			||||||
 | 
					/// Volume Protocol. Typically, only the file system driver that
 | 
				
			||||||
 | 
					/// produces the Firmware Volume Protocol will bind to the
 | 
				
			||||||
 | 
					/// Firmware Volume Block Protocol.
 | 
				
			||||||
 | 
					///
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					  Initialises the FV Header and Variable Store Header
 | 
				
			||||||
 | 
					  to support variable operations.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  @param[in]  Ptr - Location to initialise the headers
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					**/
 | 
				
			||||||
 | 
					EFI_STATUS
 | 
				
			||||||
 | 
					InitializeFvAndVariableStoreHeaders (
 | 
				
			||||||
 | 
					  IN SMMSTORE_INSTANCE *Instance
 | 
				
			||||||
 | 
					  )
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					  EFI_STATUS                          Status;
 | 
				
			||||||
 | 
					  VOID*                               Headers;
 | 
				
			||||||
 | 
					  UINTN                               HeadersLength;
 | 
				
			||||||
 | 
					  EFI_FIRMWARE_VOLUME_HEADER          *FirmwareVolumeHeader;
 | 
				
			||||||
 | 
					  VARIABLE_STORE_HEADER               *VariableStoreHeader;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  HeadersLength = sizeof(EFI_FIRMWARE_VOLUME_HEADER) + sizeof(EFI_FV_BLOCK_MAP_ENTRY) + sizeof(VARIABLE_STORE_HEADER);
 | 
				
			||||||
 | 
					  Headers = AllocateZeroPool(HeadersLength);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  // FirmwareVolumeHeader->FvLength is declared to have the Variable area AND the FTW working area AND the FTW Spare contiguous.
 | 
				
			||||||
 | 
					  ASSERT(PcdGet32(PcdFlashNvStorageVariableBase) + PcdGet32(PcdFlashNvStorageVariableSize) == PcdGet32(PcdFlashNvStorageFtwWorkingBase));
 | 
				
			||||||
 | 
					  ASSERT(PcdGet32(PcdFlashNvStorageFtwWorkingBase) + PcdGet32(PcdFlashNvStorageFtwWorkingSize) == PcdGet32(PcdFlashNvStorageFtwSpareBase));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  // Check if the size of the area is at least one block size
 | 
				
			||||||
 | 
					  ASSERT((PcdGet32(PcdFlashNvStorageVariableSize) > 0) && (PcdGet32(PcdFlashNvStorageVariableSize) / Instance->Media.BlockSize > 0));
 | 
				
			||||||
 | 
					  ASSERT((PcdGet32(PcdFlashNvStorageFtwWorkingSize) > 0) && (PcdGet32(PcdFlashNvStorageFtwWorkingSize) / Instance->Media.BlockSize > 0));
 | 
				
			||||||
 | 
					  ASSERT((PcdGet32(PcdFlashNvStorageFtwSpareSize) > 0) && (PcdGet32(PcdFlashNvStorageFtwSpareSize) / Instance->Media.BlockSize > 0));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  // Ensure the Variable area Base Addresses are aligned on a block size boundaries
 | 
				
			||||||
 | 
					  ASSERT(PcdGet32(PcdFlashNvStorageVariableBase) % Instance->Media.BlockSize == 0);
 | 
				
			||||||
 | 
					  ASSERT(PcdGet32(PcdFlashNvStorageFtwWorkingBase) % Instance->Media.BlockSize == 0);
 | 
				
			||||||
 | 
					  ASSERT(PcdGet32(PcdFlashNvStorageFtwSpareBase) % Instance->Media.BlockSize == 0);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  //
 | 
				
			||||||
 | 
					  // EFI_FIRMWARE_VOLUME_HEADER
 | 
				
			||||||
 | 
					  //
 | 
				
			||||||
 | 
					  FirmwareVolumeHeader = (EFI_FIRMWARE_VOLUME_HEADER*)Headers;
 | 
				
			||||||
 | 
					  CopyGuid (&FirmwareVolumeHeader->FileSystemGuid, &gEfiSystemNvDataFvGuid);
 | 
				
			||||||
 | 
					  FirmwareVolumeHeader->FvLength =
 | 
				
			||||||
 | 
					      PcdGet32(PcdFlashNvStorageVariableSize) +
 | 
				
			||||||
 | 
					      PcdGet32(PcdFlashNvStorageFtwWorkingSize) +
 | 
				
			||||||
 | 
					      PcdGet32(PcdFlashNvStorageFtwSpareSize);
 | 
				
			||||||
 | 
					  FirmwareVolumeHeader->Signature = EFI_FVH_SIGNATURE;
 | 
				
			||||||
 | 
					  FirmwareVolumeHeader->Attributes = (EFI_FVB_ATTRIBUTES_2) (
 | 
				
			||||||
 | 
					                                          EFI_FVB2_READ_ENABLED_CAP   | // Reads may be enabled
 | 
				
			||||||
 | 
					                                          EFI_FVB2_READ_STATUS        | // Reads are currently enabled
 | 
				
			||||||
 | 
					                                          EFI_FVB2_STICKY_WRITE       | // A block erase is required to flip bits into EFI_FVB2_ERASE_POLARITY
 | 
				
			||||||
 | 
					                                          EFI_FVB2_MEMORY_MAPPED      | // It is memory mapped
 | 
				
			||||||
 | 
					                                          EFI_FVB2_ERASE_POLARITY     | // After erasure all bits take this value (i.e. '1')
 | 
				
			||||||
 | 
					                                          EFI_FVB2_WRITE_STATUS       | // Writes are currently enabled
 | 
				
			||||||
 | 
					                                          EFI_FVB2_WRITE_ENABLED_CAP    // Writes may be enabled
 | 
				
			||||||
 | 
					                                      );
 | 
				
			||||||
 | 
					  FirmwareVolumeHeader->HeaderLength = sizeof(EFI_FIRMWARE_VOLUME_HEADER) + sizeof(EFI_FV_BLOCK_MAP_ENTRY);
 | 
				
			||||||
 | 
					  FirmwareVolumeHeader->Revision = EFI_FVH_REVISION;
 | 
				
			||||||
 | 
					  FirmwareVolumeHeader->BlockMap[0].NumBlocks = Instance->Media.LastBlock + 1;
 | 
				
			||||||
 | 
					  FirmwareVolumeHeader->BlockMap[0].Length      = Instance->Media.BlockSize;
 | 
				
			||||||
 | 
					  FirmwareVolumeHeader->BlockMap[1].NumBlocks = 0;
 | 
				
			||||||
 | 
					  FirmwareVolumeHeader->BlockMap[1].Length      = 0;
 | 
				
			||||||
 | 
					  FirmwareVolumeHeader->Checksum = CalculateCheckSum16 ((UINT16*)FirmwareVolumeHeader,FirmwareVolumeHeader->HeaderLength);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  //
 | 
				
			||||||
 | 
					  // VARIABLE_STORE_HEADER
 | 
				
			||||||
 | 
					  //
 | 
				
			||||||
 | 
					  VariableStoreHeader = (VARIABLE_STORE_HEADER*)((UINTN)Headers + FirmwareVolumeHeader->HeaderLength);
 | 
				
			||||||
 | 
					  //
 | 
				
			||||||
 | 
					  // Should be gEfiVariableGuid as SMM doesn't authenticate, but userspace does 
 | 
				
			||||||
 | 
					  // Must be gEfiAuthenticatedVariableGuid for SecureBoot
 | 
				
			||||||
 | 
					  //
 | 
				
			||||||
 | 
					  CopyGuid (&VariableStoreHeader->Signature, &gEfiAuthenticatedVariableGuid);
 | 
				
			||||||
 | 
					  VariableStoreHeader->Size = PcdGet32(PcdFlashNvStorageVariableSize) - FirmwareVolumeHeader->HeaderLength;
 | 
				
			||||||
 | 
					  VariableStoreHeader->Format            = VARIABLE_STORE_FORMATTED;
 | 
				
			||||||
 | 
					  VariableStoreHeader->State             = VARIABLE_STORE_HEALTHY;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  // Install the combined super-header in the store
 | 
				
			||||||
 | 
					  Status = FvbWrite (&Instance->FvbProtocol, 0, 0, &HeadersLength, Headers);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  FreePool (Headers);
 | 
				
			||||||
 | 
					  return Status;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					  Check the integrity of firmware volume header.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  @param[in] FwVolHeader - A pointer to a firmware volume header
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  @retval  EFI_SUCCESS   - The firmware volume is consistent
 | 
				
			||||||
 | 
					  @retval  EFI_NOT_FOUND - The firmware volume has been corrupted.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					**/
 | 
				
			||||||
 | 
					EFI_STATUS
 | 
				
			||||||
 | 
					ValidateFvHeader (
 | 
				
			||||||
 | 
					  IN  SMMSTORE_INSTANCE *Instance
 | 
				
			||||||
 | 
					  )
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					  UINT16                      Checksum;
 | 
				
			||||||
 | 
					  EFI_FIRMWARE_VOLUME_HEADER  *FwVolHeader;
 | 
				
			||||||
 | 
					  VARIABLE_STORE_HEADER       *VariableStoreHeader;
 | 
				
			||||||
 | 
					  UINTN                       VariableStoreLength;
 | 
				
			||||||
 | 
					  UINTN                       FvLength;
 | 
				
			||||||
 | 
					  EFI_STATUS                  TempStatus;
 | 
				
			||||||
 | 
					  UINTN                       BufferSize;
 | 
				
			||||||
 | 
					  UINTN                       BufferSizeReqested;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  BufferSizeReqested = sizeof(EFI_FIRMWARE_VOLUME_HEADER);
 | 
				
			||||||
 | 
					  FwVolHeader = (EFI_FIRMWARE_VOLUME_HEADER*)AllocatePool(BufferSizeReqested);
 | 
				
			||||||
 | 
					  if (!FwVolHeader) {
 | 
				
			||||||
 | 
					    return EFI_OUT_OF_RESOURCES;
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					  BufferSize = BufferSizeReqested;
 | 
				
			||||||
 | 
					  TempStatus = SMMStoreRead (0, 0, &BufferSize, (UINT8 *)FwVolHeader);
 | 
				
			||||||
 | 
					  if (EFI_ERROR (TempStatus) || BufferSizeReqested != BufferSize) {
 | 
				
			||||||
 | 
					    FreePool (FwVolHeader);
 | 
				
			||||||
 | 
					    return EFI_DEVICE_ERROR;
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  FvLength = PcdGet32(PcdFlashNvStorageVariableSize) + PcdGet32(PcdFlashNvStorageFtwWorkingSize) +
 | 
				
			||||||
 | 
					      PcdGet32(PcdFlashNvStorageFtwSpareSize);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  //
 | 
				
			||||||
 | 
					  // Verify the header revision, header signature, length
 | 
				
			||||||
 | 
					  // Length of FvBlock cannot be 2**64-1
 | 
				
			||||||
 | 
					  // HeaderLength cannot be an odd number
 | 
				
			||||||
 | 
					  //
 | 
				
			||||||
 | 
					  if (   (FwVolHeader->Revision  != EFI_FVH_REVISION)
 | 
				
			||||||
 | 
					      || (FwVolHeader->Signature != EFI_FVH_SIGNATURE)
 | 
				
			||||||
 | 
					      || (FwVolHeader->FvLength  != FvLength)
 | 
				
			||||||
 | 
					      )
 | 
				
			||||||
 | 
					  {
 | 
				
			||||||
 | 
					    DEBUG ((DEBUG_INFO, "%a: No Firmware Volume header present\n",
 | 
				
			||||||
 | 
					      __FUNCTION__));
 | 
				
			||||||
 | 
					    FreePool (FwVolHeader);
 | 
				
			||||||
 | 
					    return EFI_NOT_FOUND;
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  // Check the Firmware Volume Guid
 | 
				
			||||||
 | 
					  if( CompareGuid (&FwVolHeader->FileSystemGuid, &gEfiSystemNvDataFvGuid) == FALSE ) {
 | 
				
			||||||
 | 
					    DEBUG ((DEBUG_INFO, "%a: Firmware Volume Guid non-compatible\n",
 | 
				
			||||||
 | 
					      __FUNCTION__));
 | 
				
			||||||
 | 
					    FreePool (FwVolHeader);
 | 
				
			||||||
 | 
					    return EFI_NOT_FOUND;
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  BufferSizeReqested = FwVolHeader->HeaderLength;
 | 
				
			||||||
 | 
					  FreePool (FwVolHeader);
 | 
				
			||||||
 | 
					  FwVolHeader = (EFI_FIRMWARE_VOLUME_HEADER*)AllocatePool(BufferSizeReqested);
 | 
				
			||||||
 | 
					  if (!FwVolHeader) {
 | 
				
			||||||
 | 
					    return EFI_OUT_OF_RESOURCES;
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					  BufferSize = BufferSizeReqested;
 | 
				
			||||||
 | 
					  TempStatus = SMMStoreRead (0, 0, &BufferSize, (UINT8 *)FwVolHeader);
 | 
				
			||||||
 | 
					  if (EFI_ERROR (TempStatus) || BufferSizeReqested != BufferSize) {
 | 
				
			||||||
 | 
					    FreePool (FwVolHeader);
 | 
				
			||||||
 | 
					    return EFI_DEVICE_ERROR;
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  // Verify the header checksum
 | 
				
			||||||
 | 
					  Checksum = CalculateSum16((UINT16*)FwVolHeader, FwVolHeader->HeaderLength);
 | 
				
			||||||
 | 
					  if (Checksum != 0) {
 | 
				
			||||||
 | 
					    DEBUG ((DEBUG_INFO, "%a: FV checksum is invalid (Checksum:0x%X)\n",
 | 
				
			||||||
 | 
					      __FUNCTION__, Checksum));
 | 
				
			||||||
 | 
					    FreePool (FwVolHeader);
 | 
				
			||||||
 | 
					    return EFI_NOT_FOUND;
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  BufferSizeReqested = sizeof(VARIABLE_STORE_HEADER);
 | 
				
			||||||
 | 
					  VariableStoreHeader = (VARIABLE_STORE_HEADER*)AllocatePool(BufferSizeReqested);
 | 
				
			||||||
 | 
					  if (!VariableStoreHeader) {
 | 
				
			||||||
 | 
					    return EFI_OUT_OF_RESOURCES;
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					  BufferSize = BufferSizeReqested;
 | 
				
			||||||
 | 
					  TempStatus = SMMStoreRead (0, FwVolHeader->HeaderLength, &BufferSize, (UINT8 *)VariableStoreHeader);
 | 
				
			||||||
 | 
					  if (EFI_ERROR (TempStatus) || BufferSizeReqested != BufferSize) {
 | 
				
			||||||
 | 
					    FreePool (VariableStoreHeader);
 | 
				
			||||||
 | 
					    FreePool (FwVolHeader);
 | 
				
			||||||
 | 
					    return EFI_DEVICE_ERROR;
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  // Check the Variable Store Guid
 | 
				
			||||||
 | 
					  if (!CompareGuid (&VariableStoreHeader->Signature, &gEfiVariableGuid) &&
 | 
				
			||||||
 | 
					      !CompareGuid (&VariableStoreHeader->Signature, &gEfiAuthenticatedVariableGuid)) {
 | 
				
			||||||
 | 
					    DEBUG ((DEBUG_INFO, "%a: Variable Store Guid non-compatible\n",
 | 
				
			||||||
 | 
					      __FUNCTION__));
 | 
				
			||||||
 | 
					    FreePool (FwVolHeader);
 | 
				
			||||||
 | 
					    FreePool (VariableStoreHeader);
 | 
				
			||||||
 | 
					    return EFI_NOT_FOUND;
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  VariableStoreLength = PcdGet32 (PcdFlashNvStorageVariableSize) - FwVolHeader->HeaderLength;
 | 
				
			||||||
 | 
					  if (VariableStoreHeader->Size != VariableStoreLength) {
 | 
				
			||||||
 | 
					    DEBUG ((DEBUG_INFO, "%a: Variable Store Length does not match\n",
 | 
				
			||||||
 | 
					      __FUNCTION__));
 | 
				
			||||||
 | 
					    FreePool (FwVolHeader);
 | 
				
			||||||
 | 
					    FreePool (VariableStoreHeader);
 | 
				
			||||||
 | 
					    return EFI_NOT_FOUND;
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  FreePool (FwVolHeader);
 | 
				
			||||||
 | 
					  FreePool (VariableStoreHeader);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  return EFI_SUCCESS;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 The GetAttributes() function retrieves the attributes and
 | 
				
			||||||
 | 
					 current settings of the block.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 @param This         Indicates the EFI_FIRMWARE_VOLUME_BLOCK2_PROTOCOL instance.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 @param Attributes   Pointer to EFI_FVB_ATTRIBUTES_2 in which the attributes and
 | 
				
			||||||
 | 
					                     current settings are returned.
 | 
				
			||||||
 | 
					                     Type EFI_FVB_ATTRIBUTES_2 is defined in EFI_FIRMWARE_VOLUME_HEADER.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 @retval EFI_SUCCESS The firmware volume attributes were returned.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 **/
 | 
				
			||||||
 | 
					EFI_STATUS
 | 
				
			||||||
 | 
					EFIAPI
 | 
				
			||||||
 | 
					FvbGetAttributes(
 | 
				
			||||||
 | 
					  IN CONST  EFI_FIRMWARE_VOLUME_BLOCK2_PROTOCOL    *This,
 | 
				
			||||||
 | 
					  OUT       EFI_FVB_ATTRIBUTES_2                   *Attributes
 | 
				
			||||||
 | 
					  )
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					  EFI_FVB_ATTRIBUTES_2  FlashFvbAttributes;
 | 
				
			||||||
 | 
					  SMMSTORE_INSTANCE *Instance;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  Instance = INSTANCE_FROM_FVB_THIS(This);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  FlashFvbAttributes = (EFI_FVB_ATTRIBUTES_2) (
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      EFI_FVB2_READ_ENABLED_CAP | // Reads may be enabled
 | 
				
			||||||
 | 
					      EFI_FVB2_READ_STATUS      | // Reads are currently enabled
 | 
				
			||||||
 | 
					      EFI_FVB2_STICKY_WRITE     | // A block erase is required to flip bits into EFI_FVB2_ERASE_POLARITY
 | 
				
			||||||
 | 
					      EFI_FVB2_MEMORY_MAPPED    | // It is memory mapped
 | 
				
			||||||
 | 
					      EFI_FVB2_ERASE_POLARITY     // After erasure all bits take this value (i.e. '1')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  // Check if it is write protected
 | 
				
			||||||
 | 
					  if (Instance->Media.ReadOnly != TRUE) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    FlashFvbAttributes = FlashFvbAttributes         |
 | 
				
			||||||
 | 
					                         EFI_FVB2_WRITE_STATUS      | // Writes are currently enabled
 | 
				
			||||||
 | 
					                         EFI_FVB2_WRITE_ENABLED_CAP;  // Writes may be enabled
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  *Attributes = FlashFvbAttributes;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  DEBUG ((DEBUG_BLKIO, "FvbGetAttributes(0x%X)\n", *Attributes));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  return EFI_SUCCESS;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 The SetAttributes() function sets configurable firmware volume attributes
 | 
				
			||||||
 | 
					 and returns the new settings of the firmware volume.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 @param This                     Indicates the EFI_FIRMWARE_VOLUME_BLOCK2_PROTOCOL instance.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 @param Attributes               On input, Attributes is a pointer to EFI_FVB_ATTRIBUTES_2
 | 
				
			||||||
 | 
					                                 that contains the desired firmware volume settings.
 | 
				
			||||||
 | 
					                                 On successful return, it contains the new settings of
 | 
				
			||||||
 | 
					                                 the firmware volume.
 | 
				
			||||||
 | 
					                                 Type EFI_FVB_ATTRIBUTES_2 is defined in EFI_FIRMWARE_VOLUME_HEADER.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 @retval EFI_SUCCESS             The firmware volume attributes were returned.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 @retval EFI_INVALID_PARAMETER   The attributes requested are in conflict with the capabilities
 | 
				
			||||||
 | 
					                                 as declared in the firmware volume header.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 **/
 | 
				
			||||||
 | 
					EFI_STATUS
 | 
				
			||||||
 | 
					EFIAPI
 | 
				
			||||||
 | 
					FvbSetAttributes(
 | 
				
			||||||
 | 
					  IN CONST  EFI_FIRMWARE_VOLUME_BLOCK2_PROTOCOL  *This,
 | 
				
			||||||
 | 
					  IN OUT    EFI_FVB_ATTRIBUTES_2                 *Attributes
 | 
				
			||||||
 | 
					  )
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					  DEBUG ((DEBUG_BLKIO, "FvbSetAttributes(0x%X) is not supported\n",*Attributes));
 | 
				
			||||||
 | 
					  return EFI_UNSUPPORTED;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 The GetPhysicalAddress() function retrieves the base address of
 | 
				
			||||||
 | 
					 a memory-mapped firmware volume. This function should be called
 | 
				
			||||||
 | 
					 only for memory-mapped firmware volumes.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 @param This               Indicates the EFI_FIRMWARE_VOLUME_BLOCK2_PROTOCOL instance.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 @param Address            Pointer to a caller-allocated
 | 
				
			||||||
 | 
					                           EFI_PHYSICAL_ADDRESS that, on successful
 | 
				
			||||||
 | 
					                           return from GetPhysicalAddress(), contains the
 | 
				
			||||||
 | 
					                           base address of the firmware volume.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 @retval EFI_SUCCESS       The firmware volume base address was returned.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 @retval EFI_NOT_SUPPORTED The firmware volume is not memory mapped.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 **/
 | 
				
			||||||
 | 
					EFI_STATUS
 | 
				
			||||||
 | 
					EFIAPI
 | 
				
			||||||
 | 
					FvbGetPhysicalAddress (
 | 
				
			||||||
 | 
					  IN CONST  EFI_FIRMWARE_VOLUME_BLOCK2_PROTOCOL  *This,
 | 
				
			||||||
 | 
					  OUT       EFI_PHYSICAL_ADDRESS                 *Address
 | 
				
			||||||
 | 
					  )
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					  ASSERT(Address != NULL);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  *Address = mFlashNvStorageVariableBase;
 | 
				
			||||||
 | 
					  return EFI_SUCCESS;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 The GetBlockSize() function retrieves the size of the requested
 | 
				
			||||||
 | 
					 block. It also returns the number of additional blocks with
 | 
				
			||||||
 | 
					 the identical size. The GetBlockSize() function is used to
 | 
				
			||||||
 | 
					 retrieve the block map (see EFI_FIRMWARE_VOLUME_HEADER).
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 @param This                     Indicates the EFI_FIRMWARE_VOLUME_BLOCK2_PROTOCOL instance.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 @param Lba                      Indicates the block for which to return the size.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 @param BlockSize                Pointer to a caller-allocated UINTN in which
 | 
				
			||||||
 | 
					                                 the size of the block is returned.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 @param NumberOfBlocks           Pointer to a caller-allocated UINTN in
 | 
				
			||||||
 | 
					                                 which the number of consecutive blocks,
 | 
				
			||||||
 | 
					                                 starting with Lba, is returned. All
 | 
				
			||||||
 | 
					                                 blocks in this range have a size of
 | 
				
			||||||
 | 
					                                 BlockSize.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 @retval EFI_SUCCESS             The firmware volume base address was returned.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 @retval EFI_INVALID_PARAMETER   The requested LBA is out of range.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 **/
 | 
				
			||||||
 | 
					EFI_STATUS
 | 
				
			||||||
 | 
					EFIAPI
 | 
				
			||||||
 | 
					FvbGetBlockSize (
 | 
				
			||||||
 | 
					  IN CONST  EFI_FIRMWARE_VOLUME_BLOCK2_PROTOCOL  *This,
 | 
				
			||||||
 | 
					  IN        EFI_LBA                              Lba,
 | 
				
			||||||
 | 
					  OUT       UINTN                                *BlockSize,
 | 
				
			||||||
 | 
					  OUT       UINTN                                *NumberOfBlocks
 | 
				
			||||||
 | 
					  )
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					  EFI_STATUS Status;
 | 
				
			||||||
 | 
					  SMMSTORE_INSTANCE *Instance;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  Instance = INSTANCE_FROM_FVB_THIS(This);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  DEBUG ((DEBUG_BLKIO, "FvbGetBlockSize(Lba=%ld, BlockSize=0x%x, LastBlock=%ld)\n", Lba, Instance->Media.BlockSize, Instance->Media.LastBlock));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  if (Lba > Instance->Media.LastBlock) {
 | 
				
			||||||
 | 
					    DEBUG ((DEBUG_ERROR, "FvbGetBlockSize: ERROR - Parameter LBA %ld is beyond the last Lba (%ld).\n", Lba, Instance->Media.LastBlock));
 | 
				
			||||||
 | 
					    Status = EFI_INVALID_PARAMETER;
 | 
				
			||||||
 | 
					  } else {
 | 
				
			||||||
 | 
					    *BlockSize = (UINTN) Instance->Media.BlockSize;
 | 
				
			||||||
 | 
					    *NumberOfBlocks = (UINTN) (Instance->Media.LastBlock - Lba + 1);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    DEBUG ((DEBUG_BLKIO, "FvbGetBlockSize: *BlockSize=0x%x, *NumberOfBlocks=0x%x.\n", *BlockSize, *NumberOfBlocks));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    Status = EFI_SUCCESS;
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  return Status;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 Reads the specified number of bytes into a buffer from the specified block.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 The Read() function reads the requested number of bytes from the
 | 
				
			||||||
 | 
					 requested block and stores them in the provided buffer.
 | 
				
			||||||
 | 
					 Implementations should be mindful that the firmware volume
 | 
				
			||||||
 | 
					 might be in the ReadDisabled state. If it is in this state,
 | 
				
			||||||
 | 
					 the Read() function must return the status code
 | 
				
			||||||
 | 
					 EFI_ACCESS_DENIED without modifying the contents of the
 | 
				
			||||||
 | 
					 buffer. The Read() function must also prevent spanning block
 | 
				
			||||||
 | 
					 boundaries. If a read is requested that would span a block
 | 
				
			||||||
 | 
					 boundary, the read must read up to the boundary but not
 | 
				
			||||||
 | 
					 beyond. The output parameter NumBytes must be set to correctly
 | 
				
			||||||
 | 
					 indicate the number of bytes actually read. The caller must be
 | 
				
			||||||
 | 
					 aware that a read may be partially completed.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 @param This                 Indicates the EFI_FIRMWARE_VOLUME_BLOCK2_PROTOCOL instance.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 @param Lba                  The starting logical block index from which to read.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 @param Offset               Offset into the block at which to begin reading.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 @param NumBytes             Pointer to a UINTN.
 | 
				
			||||||
 | 
					                             At entry, *NumBytes contains the total size of the buffer.
 | 
				
			||||||
 | 
					                             At exit, *NumBytes contains the total number of bytes read.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 @param Buffer               Pointer to a caller-allocated buffer that will be used
 | 
				
			||||||
 | 
					                             to hold the data that is read.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 @retval EFI_SUCCESS         The firmware volume was read successfully,  and contents are
 | 
				
			||||||
 | 
					                             in Buffer.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 @retval EFI_BAD_BUFFER_SIZE Read attempted across an LBA boundary.
 | 
				
			||||||
 | 
					                             On output, NumBytes contains the total number of bytes
 | 
				
			||||||
 | 
					                             returned in Buffer.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 @retval EFI_ACCESS_DENIED   The firmware volume is in the ReadDisabled state.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 @retval EFI_DEVICE_ERROR    The block device is not functioning correctly and could not be read.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 **/
 | 
				
			||||||
 | 
					EFI_STATUS
 | 
				
			||||||
 | 
					EFIAPI
 | 
				
			||||||
 | 
					FvbRead (
 | 
				
			||||||
 | 
					  IN CONST  EFI_FIRMWARE_VOLUME_BLOCK2_PROTOCOL   *This,
 | 
				
			||||||
 | 
					  IN        EFI_LBA                               Lba,
 | 
				
			||||||
 | 
					  IN        UINTN                                 Offset,
 | 
				
			||||||
 | 
					  IN OUT    UINTN                                 *NumBytes,
 | 
				
			||||||
 | 
					  IN OUT    UINT8                                 *Buffer
 | 
				
			||||||
 | 
					  )
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					  UINTN         BlockSize;
 | 
				
			||||||
 | 
					  SMMSTORE_INSTANCE *Instance;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  Instance = INSTANCE_FROM_FVB_THIS(This);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  DEBUG ((DEBUG_BLKIO, "FvbRead(Parameters: Lba=%ld, Offset=0x%x, *NumBytes=0x%x, Buffer @ 0x%08x)\n", Lba, Offset, *NumBytes, Buffer));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  // Cache the block size to avoid de-referencing pointers all the time
 | 
				
			||||||
 | 
					  BlockSize = Instance->Media.BlockSize;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  DEBUG ((DEBUG_BLKIO, "FvbRead: Check if (Offset=0x%x + NumBytes=0x%x) <= BlockSize=0x%x\n", Offset, *NumBytes, BlockSize ));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  // The read must not span block boundaries.
 | 
				
			||||||
 | 
					  // We need to check each variable individually because adding two large values together overflows.
 | 
				
			||||||
 | 
					  if ((Offset               >= BlockSize) ||
 | 
				
			||||||
 | 
					      (*NumBytes            >  BlockSize) ||
 | 
				
			||||||
 | 
					      ((Offset + *NumBytes) >  BlockSize)) {
 | 
				
			||||||
 | 
					    DEBUG ((DEBUG_ERROR, "FvbRead: ERROR - EFI_BAD_BUFFER_SIZE: (Offset=0x%x + NumBytes=0x%x) > BlockSize=0x%x\n", Offset, *NumBytes, BlockSize ));
 | 
				
			||||||
 | 
					    return EFI_BAD_BUFFER_SIZE;
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  // We must have some bytes to read
 | 
				
			||||||
 | 
					  if (*NumBytes == 0) {
 | 
				
			||||||
 | 
					    return EFI_BAD_BUFFER_SIZE;
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  return SMMStoreRead (Lba, Offset, NumBytes, Buffer);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 Writes the specified number of bytes from the input buffer to the block.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 The Write() function writes the specified number of bytes from
 | 
				
			||||||
 | 
					 the provided buffer to the specified block and offset. If the
 | 
				
			||||||
 | 
					 firmware volume is sticky write, the caller must ensure that
 | 
				
			||||||
 | 
					 all the bits of the specified range to write are in the
 | 
				
			||||||
 | 
					 EFI_FVB_ERASE_POLARITY state before calling the Write()
 | 
				
			||||||
 | 
					 function, or else the result will be unpredictable. This
 | 
				
			||||||
 | 
					 unpredictability arises because, for a sticky-write firmware
 | 
				
			||||||
 | 
					 volume, a write may negate a bit in the EFI_FVB_ERASE_POLARITY
 | 
				
			||||||
 | 
					 state but cannot flip it back again.  Before calling the
 | 
				
			||||||
 | 
					 Write() function,  it is recommended for the caller to first call
 | 
				
			||||||
 | 
					 the EraseBlocks() function to erase the specified block to
 | 
				
			||||||
 | 
					 write. A block erase cycle will transition bits from the
 | 
				
			||||||
 | 
					 (NOT)EFI_FVB_ERASE_POLARITY state back to the
 | 
				
			||||||
 | 
					 EFI_FVB_ERASE_POLARITY state. Implementations should be
 | 
				
			||||||
 | 
					 mindful that the firmware volume might be in the WriteDisabled
 | 
				
			||||||
 | 
					 state. If it is in this state, the Write() function must
 | 
				
			||||||
 | 
					 return the status code EFI_ACCESS_DENIED without modifying the
 | 
				
			||||||
 | 
					 contents of the firmware volume. The Write() function must
 | 
				
			||||||
 | 
					 also prevent spanning block boundaries. If a write is
 | 
				
			||||||
 | 
					 requested that spans a block boundary, the write must store up
 | 
				
			||||||
 | 
					 to the boundary but not beyond. The output parameter NumBytes
 | 
				
			||||||
 | 
					 must be set to correctly indicate the number of bytes actually
 | 
				
			||||||
 | 
					 written. The caller must be aware that a write may be
 | 
				
			||||||
 | 
					 partially completed. All writes, partial or otherwise, must be
 | 
				
			||||||
 | 
					 fully flushed to the hardware before the Write() service
 | 
				
			||||||
 | 
					 returns.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 @param This                 Indicates the EFI_FIRMWARE_VOLUME_BLOCK2_PROTOCOL instance.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 @param Lba                  The starting logical block index to write to.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 @param Offset               Offset into the block at which to begin writing.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 @param NumBytes             The pointer to a UINTN.
 | 
				
			||||||
 | 
					                             At entry, *NumBytes contains the total size of the buffer.
 | 
				
			||||||
 | 
					                             At exit, *NumBytes contains the total number of bytes actually written.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 @param Buffer               The pointer to a caller-allocated buffer that contains the source for the write.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 @retval EFI_SUCCESS         The firmware volume was written successfully.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 @retval EFI_BAD_BUFFER_SIZE The write was attempted across an LBA boundary.
 | 
				
			||||||
 | 
					                             On output, NumBytes contains the total number of bytes
 | 
				
			||||||
 | 
					                             actually written.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 @retval EFI_ACCESS_DENIED   The firmware volume is in the WriteDisabled state.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 @retval EFI_DEVICE_ERROR    The block device is malfunctioning and could not be written.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 **/
 | 
				
			||||||
 | 
					EFI_STATUS
 | 
				
			||||||
 | 
					EFIAPI
 | 
				
			||||||
 | 
					FvbWrite (
 | 
				
			||||||
 | 
					  IN CONST  EFI_FIRMWARE_VOLUME_BLOCK2_PROTOCOL   *This,
 | 
				
			||||||
 | 
					  IN        EFI_LBA                               Lba,
 | 
				
			||||||
 | 
					  IN        UINTN                                 Offset,
 | 
				
			||||||
 | 
					  IN OUT    UINTN                                 *NumBytes,
 | 
				
			||||||
 | 
					  IN        UINT8                                 *Buffer
 | 
				
			||||||
 | 
					  )
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					  UINTN         BlockSize;
 | 
				
			||||||
 | 
					  SMMSTORE_INSTANCE *Instance;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  Instance = INSTANCE_FROM_FVB_THIS(This);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  DEBUG ((DEBUG_BLKIO, "FvbWrite(Parameters: Lba=%ld, Offset=0x%x, *NumBytes=0x%x, Buffer @ 0x%08x)\n", Lba, Offset, *NumBytes, Buffer));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  // Cache the block size to avoid de-referencing pointers all the time
 | 
				
			||||||
 | 
					  BlockSize = Instance->Media.BlockSize;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  // The read must not span block boundaries.
 | 
				
			||||||
 | 
					  // We need to check each variable individually because adding two large values together overflows.
 | 
				
			||||||
 | 
					  if ((Offset               >= BlockSize) ||
 | 
				
			||||||
 | 
					      (*NumBytes            >  BlockSize) ||
 | 
				
			||||||
 | 
					      ((Offset + *NumBytes) >  BlockSize)) {
 | 
				
			||||||
 | 
					    DEBUG ((DEBUG_ERROR, "FvbRead: ERROR - EFI_BAD_BUFFER_SIZE: (Offset=0x%x + NumBytes=0x%x) > BlockSize=0x%x\n", Offset, *NumBytes, BlockSize ));
 | 
				
			||||||
 | 
					    return EFI_BAD_BUFFER_SIZE;
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  // We must have some bytes to read
 | 
				
			||||||
 | 
					  if (*NumBytes == 0) {
 | 
				
			||||||
 | 
					    return EFI_BAD_BUFFER_SIZE;
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  return SMMStoreWrite (Lba, Offset, NumBytes, Buffer);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 Erases and initialises a firmware volume block.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 The EraseBlocks() function erases one or more blocks as denoted
 | 
				
			||||||
 | 
					 by the variable argument list. The entire parameter list of
 | 
				
			||||||
 | 
					 blocks must be verified before erasing any blocks. If a block is
 | 
				
			||||||
 | 
					 requested that does not exist within the associated firmware
 | 
				
			||||||
 | 
					 volume (it has a larger index than the last block of the
 | 
				
			||||||
 | 
					 firmware volume), the EraseBlocks() function must return the
 | 
				
			||||||
 | 
					 status code EFI_INVALID_PARAMETER without modifying the contents
 | 
				
			||||||
 | 
					 of the firmware volume. Implementations should be mindful that
 | 
				
			||||||
 | 
					 the firmware volume might be in the WriteDisabled state. If it
 | 
				
			||||||
 | 
					 is in this state, the EraseBlocks() function must return the
 | 
				
			||||||
 | 
					 status code EFI_ACCESS_DENIED without modifying the contents of
 | 
				
			||||||
 | 
					 the firmware volume. All calls to EraseBlocks() must be fully
 | 
				
			||||||
 | 
					 flushed to the hardware before the EraseBlocks() service
 | 
				
			||||||
 | 
					 returns.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 @param This                     Indicates the EFI_FIRMWARE_VOLUME_BLOCK2_PROTOCOL
 | 
				
			||||||
 | 
					 instance.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 @param ...                      The variable argument list is a list of tuples.
 | 
				
			||||||
 | 
					                                 Each tuple describes a range of LBAs to erase
 | 
				
			||||||
 | 
					                                 and consists of the following:
 | 
				
			||||||
 | 
					                                 - An EFI_LBA that indicates the starting LBA
 | 
				
			||||||
 | 
					                                 - A UINTN that indicates the number of blocks to erase.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                                 The list is terminated with an EFI_LBA_LIST_TERMINATOR.
 | 
				
			||||||
 | 
					                                 For example, the following indicates that two ranges of blocks
 | 
				
			||||||
 | 
					                                 (5-7 and 10-11) are to be erased:
 | 
				
			||||||
 | 
					                                 EraseBlocks (This, 5, 3, 10, 2, EFI_LBA_LIST_TERMINATOR);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 @retval EFI_SUCCESS             The erase request successfully completed.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 @retval EFI_ACCESS_DENIED       The firmware volume is in the WriteDisabled state.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 @retval EFI_DEVICE_ERROR        The block device is not functioning correctly and could not be written.
 | 
				
			||||||
 | 
					                                 The firmware device may have been partially erased.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 @retval EFI_INVALID_PARAMETER   One or more of the LBAs listed in the variable argument list do
 | 
				
			||||||
 | 
					                                 not exist in the firmware volume.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 **/
 | 
				
			||||||
 | 
					EFI_STATUS
 | 
				
			||||||
 | 
					EFIAPI
 | 
				
			||||||
 | 
					FvbEraseBlocks (
 | 
				
			||||||
 | 
					  IN CONST EFI_FIRMWARE_VOLUME_BLOCK2_PROTOCOL *This,
 | 
				
			||||||
 | 
					  ...
 | 
				
			||||||
 | 
					  )
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					  EFI_STATUS  Status;
 | 
				
			||||||
 | 
					  VA_LIST     Args;
 | 
				
			||||||
 | 
					  EFI_LBA     StartingLba; // Lba from which we start erasing
 | 
				
			||||||
 | 
					  UINTN       NumOfLba; // Number of Lba blocks to erase
 | 
				
			||||||
 | 
					  SMMSTORE_INSTANCE *Instance;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  Instance = INSTANCE_FROM_FVB_THIS(This);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  DEBUG ((DEBUG_BLKIO, "FvbEraseBlocks()\n"));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  Status = EFI_SUCCESS;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  // Detect WriteDisabled state
 | 
				
			||||||
 | 
					  if (Instance->Media.ReadOnly == TRUE) {
 | 
				
			||||||
 | 
					    // Firmware volume is in WriteDisabled state
 | 
				
			||||||
 | 
					    DEBUG ((DEBUG_ERROR, "FvbEraseBlocks: ERROR - Device is in WriteDisabled state.\n"));
 | 
				
			||||||
 | 
					    return EFI_ACCESS_DENIED;
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  // Before erasing, check the entire list of parameters to ensure all specified blocks are valid
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  VA_START (Args, This);
 | 
				
			||||||
 | 
					  do {
 | 
				
			||||||
 | 
					    // Get the Lba from which we start erasing
 | 
				
			||||||
 | 
					    StartingLba = VA_ARG (Args, EFI_LBA);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    // Have we reached the end of the list?
 | 
				
			||||||
 | 
					    if (StartingLba == EFI_LBA_LIST_TERMINATOR) {
 | 
				
			||||||
 | 
					      //Exit the while loop
 | 
				
			||||||
 | 
					      break;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    // How many Lba blocks are we requested to erase?
 | 
				
			||||||
 | 
					    NumOfLba = VA_ARG (Args, UINTN);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    // All blocks must be within range
 | 
				
			||||||
 | 
					    DEBUG ((
 | 
				
			||||||
 | 
					      DEBUG_BLKIO,
 | 
				
			||||||
 | 
					      "FvbEraseBlocks: Check if: ( StartingLba=%ld + NumOfLba=%Lu - 1 ) > LastBlock=%ld.\n",
 | 
				
			||||||
 | 
					      StartingLba,
 | 
				
			||||||
 | 
					      (UINT64)NumOfLba,
 | 
				
			||||||
 | 
					      Instance->Media.LastBlock
 | 
				
			||||||
 | 
					      ));
 | 
				
			||||||
 | 
					    if ((NumOfLba == 0) || ((StartingLba + NumOfLba - 1) > Instance->Media.LastBlock)) {
 | 
				
			||||||
 | 
					      VA_END (Args);
 | 
				
			||||||
 | 
					      DEBUG ((DEBUG_ERROR, "FvbEraseBlocks: ERROR - Lba range goes past the last Lba.\n"));
 | 
				
			||||||
 | 
					      Status = EFI_INVALID_PARAMETER;
 | 
				
			||||||
 | 
					      goto EXIT;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					  } while (TRUE);
 | 
				
			||||||
 | 
					  VA_END (Args);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  //
 | 
				
			||||||
 | 
					  // To get here, all must be ok, so start erasing
 | 
				
			||||||
 | 
					  //
 | 
				
			||||||
 | 
					  VA_START (Args, This);
 | 
				
			||||||
 | 
					  do {
 | 
				
			||||||
 | 
					    // Get the Lba from which we start erasing
 | 
				
			||||||
 | 
					    StartingLba = VA_ARG (Args, EFI_LBA);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    // Have we reached the end of the list?
 | 
				
			||||||
 | 
					    if (StartingLba == EFI_LBA_LIST_TERMINATOR) {
 | 
				
			||||||
 | 
					      // Exit the while loop
 | 
				
			||||||
 | 
					      break;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    // How many Lba blocks are we requested to erase?
 | 
				
			||||||
 | 
					    NumOfLba = VA_ARG (Args, UINTN);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    // Go through each one and erase it
 | 
				
			||||||
 | 
					    while (NumOfLba > 0) {
 | 
				
			||||||
 | 
					      // Erase it
 | 
				
			||||||
 | 
					      DEBUG ((DEBUG_BLKIO, "FvbEraseBlocks: Erasing Lba=%ld\n", StartingLba));
 | 
				
			||||||
 | 
					      Status = SMMStoreEraseBlock (StartingLba);
 | 
				
			||||||
 | 
					      if (EFI_ERROR(Status)) {
 | 
				
			||||||
 | 
					        VA_END (Args);
 | 
				
			||||||
 | 
					        Status = EFI_DEVICE_ERROR;
 | 
				
			||||||
 | 
					        goto EXIT;
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      // Move to the next Lba
 | 
				
			||||||
 | 
					      StartingLba++;
 | 
				
			||||||
 | 
					      NumOfLba--;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					  } while (TRUE);
 | 
				
			||||||
 | 
					  VA_END (Args);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					EXIT:
 | 
				
			||||||
 | 
					  return Status;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					  Fixup internal data so that EFI can be call in virtual mode.
 | 
				
			||||||
 | 
					  Call the passed in Child Notify event and convert any pointers in
 | 
				
			||||||
 | 
					  lib to virtual mode.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  @param[in]    Event   The Event that is being processed
 | 
				
			||||||
 | 
					  @param[in]    Context Event Context
 | 
				
			||||||
 | 
					**/
 | 
				
			||||||
 | 
					VOID
 | 
				
			||||||
 | 
					EFIAPI
 | 
				
			||||||
 | 
					FvbVirtualNotifyEvent (
 | 
				
			||||||
 | 
					  IN EFI_EVENT        Event,
 | 
				
			||||||
 | 
					  IN VOID             *Context
 | 
				
			||||||
 | 
					  )
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					  EfiConvertPointer (0x0, (VOID**)&mFlashNvStorageVariableBase);
 | 
				
			||||||
 | 
					  return;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					EFI_STATUS
 | 
				
			||||||
 | 
					EFIAPI
 | 
				
			||||||
 | 
					SMMStoreFvbInitialize (
 | 
				
			||||||
 | 
					  IN SMMSTORE_INSTANCE* Instance
 | 
				
			||||||
 | 
					  )
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					  EFI_STATUS  Status;
 | 
				
			||||||
 | 
					  UINT32      FvbNumLba;
 | 
				
			||||||
 | 
					  EFI_BOOT_MODE BootMode;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  DEBUG((DEBUG_BLKIO,"NorFlashFvbInitialize\n"));
 | 
				
			||||||
 | 
					  ASSERT((Instance != NULL));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  mFlashNvStorageVariableBase = PcdGet32 (PcdFlashNvStorageVariableBase);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  BootMode = GetBootModeHob ();
 | 
				
			||||||
 | 
					  if (BootMode == BOOT_WITH_DEFAULT_SETTINGS) {
 | 
				
			||||||
 | 
					    Status = EFI_INVALID_PARAMETER;
 | 
				
			||||||
 | 
					  } else {
 | 
				
			||||||
 | 
					    // Determine if there is a valid header at the beginning of the NorFlash
 | 
				
			||||||
 | 
					    Status = ValidateFvHeader (Instance);
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  // Install the Default FVB header if required
 | 
				
			||||||
 | 
					  if (EFI_ERROR(Status)) {
 | 
				
			||||||
 | 
					    // There is no valid header, so time to install one.
 | 
				
			||||||
 | 
					    DEBUG ((DEBUG_INFO, "%a: The FVB Header is not valid.\n", __FUNCTION__));
 | 
				
			||||||
 | 
					    DEBUG ((DEBUG_INFO, "%a: Installing a correct one for this volume.\n",
 | 
				
			||||||
 | 
					      __FUNCTION__));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    // Erase all the NorFlash that is reserved for variable storage
 | 
				
			||||||
 | 
					    FvbNumLba = (PcdGet32(PcdFlashNvStorageVariableSize) +
 | 
				
			||||||
 | 
					        PcdGet32(PcdFlashNvStorageFtwWorkingSize) +
 | 
				
			||||||
 | 
					        PcdGet32(PcdFlashNvStorageFtwSpareSize)) / Instance->Media.BlockSize;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    Status = FvbEraseBlocks (&Instance->FvbProtocol, (EFI_LBA)0, FvbNumLba, EFI_LBA_LIST_TERMINATOR);
 | 
				
			||||||
 | 
					    if (EFI_ERROR(Status)) {
 | 
				
			||||||
 | 
					      return Status;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    // Install all appropriate headers
 | 
				
			||||||
 | 
					    Status = InitializeFvAndVariableStoreHeaders (Instance);
 | 
				
			||||||
 | 
					    if (EFI_ERROR(Status)) {
 | 
				
			||||||
 | 
					      return Status;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					  } else {
 | 
				
			||||||
 | 
					    DEBUG((DEBUG_INFO, "%a: FVB header is valid\n", __FUNCTION__));
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  //
 | 
				
			||||||
 | 
					  // The driver implementing the variable read service can now be dispatched;
 | 
				
			||||||
 | 
					  // the varstore headers are in place.
 | 
				
			||||||
 | 
					  //
 | 
				
			||||||
 | 
					  Status = gBS->InstallProtocolInterface (
 | 
				
			||||||
 | 
					                  &gImageHandle,
 | 
				
			||||||
 | 
					                  &gEdkiiNvVarStoreFormattedGuid,
 | 
				
			||||||
 | 
					                  EFI_NATIVE_INTERFACE,
 | 
				
			||||||
 | 
					                  NULL
 | 
				
			||||||
 | 
					                  );
 | 
				
			||||||
 | 
					  ASSERT_EFI_ERROR (Status);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  //
 | 
				
			||||||
 | 
					  // Register for the virtual address change event
 | 
				
			||||||
 | 
					  //
 | 
				
			||||||
 | 
					  Status = gBS->CreateEventEx (
 | 
				
			||||||
 | 
					                  EVT_NOTIFY_SIGNAL,
 | 
				
			||||||
 | 
					                  TPL_NOTIFY,
 | 
				
			||||||
 | 
					                  FvbVirtualNotifyEvent,
 | 
				
			||||||
 | 
					                  NULL,
 | 
				
			||||||
 | 
					                  &gEfiEventVirtualAddressChangeGuid,
 | 
				
			||||||
 | 
					                  &mFvbVirtualAddrChangeEvent
 | 
				
			||||||
 | 
					                  );
 | 
				
			||||||
 | 
					  ASSERT_EFI_ERROR (Status);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  return Status;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@@ -7,6 +7,7 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
**/
 | 
					**/
 | 
				
			||||||
#include "BlSupportDxe.h"
 | 
					#include "BlSupportDxe.h"
 | 
				
			||||||
 | 
					#include <Guid/TpmInstance.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
  Reserve MMIO/IO resource in GCD
 | 
					  Reserve MMIO/IO resource in GCD
 | 
				
			||||||
@@ -105,6 +106,7 @@ BlDxeEntryPoint (
 | 
				
			|||||||
  EFI_HOB_GUID_TYPE          *GuidHob;
 | 
					  EFI_HOB_GUID_TYPE          *GuidHob;
 | 
				
			||||||
  EFI_PEI_GRAPHICS_INFO_HOB  *GfxInfo;
 | 
					  EFI_PEI_GRAPHICS_INFO_HOB  *GfxInfo;
 | 
				
			||||||
  ACPI_BOARD_INFO            *AcpiBoardInfo;
 | 
					  ACPI_BOARD_INFO            *AcpiBoardInfo;
 | 
				
			||||||
 | 
					  UINTN                      Size;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  Status = EFI_SUCCESS;
 | 
					  Status = EFI_SUCCESS;
 | 
				
			||||||
  //
 | 
					  //
 | 
				
			||||||
@@ -140,6 +142,27 @@ BlDxeEntryPoint (
 | 
				
			|||||||
    ASSERT_EFI_ERROR (Status);
 | 
					    ASSERT_EFI_ERROR (Status);
 | 
				
			||||||
    Status = PcdSet64S (PcdPciExpressBaseSize, AcpiBoardInfo->PcieBaseSize);
 | 
					    Status = PcdSet64S (PcdPciExpressBaseSize, AcpiBoardInfo->PcieBaseSize);
 | 
				
			||||||
    ASSERT_EFI_ERROR (Status);
 | 
					    ASSERT_EFI_ERROR (Status);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if (AcpiBoardInfo->TPM20Present)
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					      Size = sizeof (gEfiTpmDeviceInstanceTpm20DtpmGuid);
 | 
				
			||||||
 | 
					      Status = PcdSetPtrS (
 | 
				
			||||||
 | 
					               PcdTpmInstanceGuid,
 | 
				
			||||||
 | 
					               &Size,
 | 
				
			||||||
 | 
					               &gEfiTpmDeviceInstanceTpm20DtpmGuid
 | 
				
			||||||
 | 
					               );
 | 
				
			||||||
 | 
					      ASSERT_EFI_ERROR (Status);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    else if (AcpiBoardInfo->TPM12Present)
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					      Size = sizeof (gEfiTpmDeviceInstanceTpm12Guid);
 | 
				
			||||||
 | 
					      Status = PcdSetPtrS (
 | 
				
			||||||
 | 
					                 PcdTpmInstanceGuid,
 | 
				
			||||||
 | 
					                 &Size,
 | 
				
			||||||
 | 
					                 &gEfiTpmDeviceInstanceTpm12Guid
 | 
				
			||||||
 | 
					                 );
 | 
				
			||||||
 | 
					      ASSERT_EFI_ERROR (Status);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  return EFI_SUCCESS;
 | 
					  return EFI_SUCCESS;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -31,6 +31,7 @@
 | 
				
			|||||||
  MdePkg/MdePkg.dec
 | 
					  MdePkg/MdePkg.dec
 | 
				
			||||||
  MdeModulePkg/MdeModulePkg.dec
 | 
					  MdeModulePkg/MdeModulePkg.dec
 | 
				
			||||||
  UefiPayloadPkg/UefiPayloadPkg.dec
 | 
					  UefiPayloadPkg/UefiPayloadPkg.dec
 | 
				
			||||||
 | 
					  SecurityPkg/SecurityPkg.dec
 | 
				
			||||||
 | 
					
 | 
				
			||||||
[LibraryClasses]
 | 
					[LibraryClasses]
 | 
				
			||||||
  UefiDriverEntryPoint
 | 
					  UefiDriverEntryPoint
 | 
				
			||||||
@@ -45,6 +46,8 @@
 | 
				
			|||||||
  gUefiSystemTableInfoGuid
 | 
					  gUefiSystemTableInfoGuid
 | 
				
			||||||
  gUefiAcpiBoardInfoGuid
 | 
					  gUefiAcpiBoardInfoGuid
 | 
				
			||||||
  gEfiGraphicsInfoHobGuid
 | 
					  gEfiGraphicsInfoHobGuid
 | 
				
			||||||
 | 
					  gEfiTpmDeviceInstanceTpm20DtpmGuid  ## SOMETIMES_CONSUMES
 | 
				
			||||||
 | 
					  gEfiTpmDeviceInstanceTpm12Guid      ## SOMETIMES_CONSUMES
 | 
				
			||||||
 | 
					
 | 
				
			||||||
[Pcd]
 | 
					[Pcd]
 | 
				
			||||||
  gEfiMdeModulePkgTokenSpaceGuid.PcdVideoHorizontalResolution
 | 
					  gEfiMdeModulePkgTokenSpaceGuid.PcdVideoHorizontalResolution
 | 
				
			||||||
@@ -53,6 +56,7 @@
 | 
				
			|||||||
  gEfiMdeModulePkgTokenSpaceGuid.PcdSetupVideoVerticalResolution
 | 
					  gEfiMdeModulePkgTokenSpaceGuid.PcdSetupVideoVerticalResolution
 | 
				
			||||||
  gEfiMdePkgTokenSpaceGuid.PcdPciExpressBaseAddress
 | 
					  gEfiMdePkgTokenSpaceGuid.PcdPciExpressBaseAddress
 | 
				
			||||||
  gEfiMdePkgTokenSpaceGuid.PcdPciExpressBaseSize
 | 
					  gEfiMdePkgTokenSpaceGuid.PcdPciExpressBaseSize
 | 
				
			||||||
 | 
					  gEfiSecurityPkgTokenSpaceGuid.PcdTpmInstanceGuid        ## SOMETIMES_PRODUCES
 | 
				
			||||||
 | 
					
 | 
				
			||||||
[Depex]
 | 
					[Depex]
 | 
				
			||||||
  TRUE
 | 
					  TRUE
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -236,6 +236,19 @@ struct cb_cbmem_tab {
 | 
				
			|||||||
  UINT64 cbmem_tab;
 | 
					  UINT64 cbmem_tab;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#define CB_TAG_SMMSTOREV2       0x0039
 | 
				
			||||||
 | 
					struct cb_smmstorev2 {
 | 
				
			||||||
 | 
					  UINT32 tag;
 | 
				
			||||||
 | 
					  UINT32 size;
 | 
				
			||||||
 | 
					  UINT32 num_blocks;       /* Number of writeable blocks in SMM */
 | 
				
			||||||
 | 
					  UINT32 block_size;       /* Size of a block in byte. Default: 64 KiB */
 | 
				
			||||||
 | 
					  UINT32 mmap_addr;        /* MMIO address of the store for read only access */
 | 
				
			||||||
 | 
					  UINT32 com_buffer;       /* Physical address of the communication buffer */
 | 
				
			||||||
 | 
					  UINT32 com_buffer_size;  /* Size of the communication buffer in byte */
 | 
				
			||||||
 | 
					  UINT8 apm_cmd;           /* The command byte to write to the APM I/O port */
 | 
				
			||||||
 | 
					  UINT8 unused[3];         /* Set to zero */
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* Helpful macros */
 | 
					/* Helpful macros */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define MEM_RANGE_COUNT(_rec) \
 | 
					#define MEM_RANGE_COUNT(_rec) \
 | 
				
			||||||
@@ -245,5 +258,30 @@ struct cb_cbmem_tab {
 | 
				
			|||||||
  (void *)(((UINT8 *) (_rec)) + sizeof(*(_rec)) \
 | 
					  (void *)(((UINT8 *) (_rec)) + sizeof(*(_rec)) \
 | 
				
			||||||
    + (sizeof((_rec)->map[0]) * (_idx)))
 | 
					    + (sizeof((_rec)->map[0]) * (_idx)))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#define CB_TAG_TPM_PPI_HANDOFF       0x003a
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					enum lb_tmp_ppi_tpm_version {
 | 
				
			||||||
 | 
						LB_TPM_VERSION_UNSPEC = 0,
 | 
				
			||||||
 | 
						LB_TPM_VERSION_TPM_VERSION_1_2,
 | 
				
			||||||
 | 
						LB_TPM_VERSION_TPM_VERSION_2,
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/*
 | 
				
			||||||
 | 
					 * Handoff buffer for TPM Physical Presence Interface.
 | 
				
			||||||
 | 
					 * * ppi_address   Pointer to PPI buffer shared with ACPI
 | 
				
			||||||
 | 
					 *                 The layout of the buffer matches the QEMU virtual memory device
 | 
				
			||||||
 | 
					 *                 that is generated by QEMU.
 | 
				
			||||||
 | 
					 *                 See files 'hw/i386/acpi-build.c' and 'include/hw/acpi/tpm.h'
 | 
				
			||||||
 | 
					 *                 for details.
 | 
				
			||||||
 | 
					 * * tpm_version   TPM version: 1 for TPM1.2, 2 for TPM2.0
 | 
				
			||||||
 | 
					 * * ppi_version   BCD encoded version of TPM PPI interface
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					struct cb_tpm_physical_presence {
 | 
				
			||||||
 | 
						UINT32 tag;
 | 
				
			||||||
 | 
						UINT32 size;
 | 
				
			||||||
 | 
						UINT32 ppi_address;	/* Address of ACPI PPI communication buffer */
 | 
				
			||||||
 | 
						UINT8 tpm_version;	/* 1: TPM1.2, 2: TPM2.0 */
 | 
				
			||||||
 | 
						UINT8 ppi_version;	/* BCD encoded */
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#endif // _COREBOOT_PEI_H_INCLUDED_
 | 
					#endif // _COREBOOT_PEI_H_INCLUDED_
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -25,6 +25,8 @@ typedef struct {
 | 
				
			|||||||
  UINT64             ResetRegAddress;
 | 
					  UINT64             ResetRegAddress;
 | 
				
			||||||
  UINT64             PcieBaseAddress;
 | 
					  UINT64             PcieBaseAddress;
 | 
				
			||||||
  UINT64             PcieBaseSize;
 | 
					  UINT64             PcieBaseSize;
 | 
				
			||||||
 | 
					  UINT8              TPM20Present;
 | 
				
			||||||
 | 
					  UINT8              TPM12Present;
 | 
				
			||||||
} ACPI_BOARD_INFO;
 | 
					} ACPI_BOARD_INFO;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										46
									
								
								UefiPayloadPkg/Include/Guid/PciExpressBaseAddress.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										46
									
								
								UefiPayloadPkg/Include/Guid/PciExpressBaseAddress.h
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,46 @@
 | 
				
			|||||||
 | 
					/** @file
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
 | 
				
			||||||
 | 
					This program and the accompanying materials                          
 | 
				
			||||||
 | 
					are licensed and made available under the terms and conditions of the BSD License         
 | 
				
			||||||
 | 
					which accompanies this distribution.  The full text of the license may be found at        
 | 
				
			||||||
 | 
					http://opensource.org/licenses/bsd-license.php                                            
 | 
				
			||||||
 | 
					                                                                                          
 | 
				
			||||||
 | 
					THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     
 | 
				
			||||||
 | 
					WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Module Name:
 | 
				
			||||||
 | 
					  
 | 
				
			||||||
 | 
					    PciExpressBaseAddress.h
 | 
				
			||||||
 | 
					    
 | 
				
			||||||
 | 
					Abstract:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					   GUIDs used for PciExpress Base Address
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					**/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#ifndef _EFI_PCI_EXPRESS_BASE_ADDRESS_H_
 | 
				
			||||||
 | 
					#define _EFI_PCI_EXPRESS_BASE_ADDRESS_H_
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#define EFI_PCI_EXPRESS_BASE_ADDRESS_GUID \
 | 
				
			||||||
 | 
					  { \
 | 
				
			||||||
 | 
					  0x3677d529, 0x326f, 0x4603, {0xa9, 0x26, 0xea, 0xac, 0xe0, 0x1d, 0xcb, 0xb0} \
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					//
 | 
				
			||||||
 | 
					// Following structure defines PCI Express Base Address information.
 | 
				
			||||||
 | 
					// This information is platform specific, and built into hob in PEI phase.
 | 
				
			||||||
 | 
					// It can be consumed by PEI PCI driver and DXE PCI driver.
 | 
				
			||||||
 | 
					//
 | 
				
			||||||
 | 
					#pragma pack(1)
 | 
				
			||||||
 | 
					typedef struct _EFI_PCI_EXPRESS_BASE_ADDRESS_INFORMATION {
 | 
				
			||||||
 | 
					  UINT32       HostBridgeNumber;
 | 
				
			||||||
 | 
					  UINT32       RootBridgeNumber;
 | 
				
			||||||
 | 
					  UINT64       PciExpressBaseAddress;
 | 
				
			||||||
 | 
					} EFI_PCI_EXPRESS_BASE_ADDRESS_INFORMATION;
 | 
				
			||||||
 | 
					#pragma pack()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					extern EFI_GUID gEfiPciExpressBaseAddressGuid;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
							
								
								
									
										41
									
								
								UefiPayloadPkg/Include/Guid/PciOptionRomTable.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										41
									
								
								UefiPayloadPkg/Include/Guid/PciOptionRomTable.h
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,41 @@
 | 
				
			|||||||
 | 
					/** @file
 | 
				
			||||||
 | 
					  GUID and data structure used to describe the list of PCI Option ROMs present in a system.
 | 
				
			||||||
 | 
					  
 | 
				
			||||||
 | 
					Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
 | 
				
			||||||
 | 
					This program and the accompanying materials                          
 | 
				
			||||||
 | 
					are licensed and made available under the terms and conditions of the BSD License         
 | 
				
			||||||
 | 
					which accompanies this distribution.  The full text of the license may be found at        
 | 
				
			||||||
 | 
					http://opensource.org/licenses/bsd-license.php                                            
 | 
				
			||||||
 | 
					                                                                                          
 | 
				
			||||||
 | 
					THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     
 | 
				
			||||||
 | 
					WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					**/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#ifndef __PCI_OPTION_ROM_TABLE_GUID_H_
 | 
				
			||||||
 | 
					#define __PCI_OPTION_ROM_TABLE_GUID_H_
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#define EFI_PCI_OPTION_ROM_TABLE_GUID \
 | 
				
			||||||
 | 
					  { 0x7462660f, 0x1cbd, 0x48da, {0xad, 0x11, 0x91, 0x71, 0x79, 0x13, 0x83, 0x1c } }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					extern EFI_GUID gEfiPciOptionRomTableGuid;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					typedef struct {
 | 
				
			||||||
 | 
					  EFI_PHYSICAL_ADDRESS   RomAddress; 
 | 
				
			||||||
 | 
					  EFI_MEMORY_TYPE        MemoryType;
 | 
				
			||||||
 | 
					  UINT32                 RomLength; 
 | 
				
			||||||
 | 
					  UINT32                 Seg; 
 | 
				
			||||||
 | 
					  UINT8                  Bus; 
 | 
				
			||||||
 | 
					  UINT8                  Dev; 
 | 
				
			||||||
 | 
					  UINT8                  Func; 
 | 
				
			||||||
 | 
					  BOOLEAN                ExecutedLegacyBiosImage; 
 | 
				
			||||||
 | 
					  BOOLEAN                DontLoadEfiRom;
 | 
				
			||||||
 | 
					} EFI_PCI_OPTION_ROM_DESCRIPTOR;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					typedef struct {
 | 
				
			||||||
 | 
					  UINT64                         PciOptionRomCount;
 | 
				
			||||||
 | 
					  EFI_PCI_OPTION_ROM_DESCRIPTOR   *PciOptionRomDescriptors;
 | 
				
			||||||
 | 
					} EFI_PCI_OPTION_ROM_TABLE;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#endif // __PCI_OPTION_ROM_TABLE_GUID_H_
 | 
				
			||||||
 | 
					
 | 
				
			||||||
							
								
								
									
										27
									
								
								UefiPayloadPkg/Include/Guid/SMMSTOREInfoGuid.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										27
									
								
								UefiPayloadPkg/Include/Guid/SMMSTOREInfoGuid.h
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,27 @@
 | 
				
			|||||||
 | 
					/** @file
 | 
				
			||||||
 | 
					  This file defines the hob structure for system tables like ACPI, SMBIOS tables.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  Copyright (c) 2020, 9elements Agency GmbH<BR>
 | 
				
			||||||
 | 
					  SPDX-License-Identifier: BSD-2-Clause-Patent
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					**/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#ifndef __SMMSTORE_GUID_H__
 | 
				
			||||||
 | 
					#define __SMMSTORE_GUID_H__
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					///
 | 
				
			||||||
 | 
					/// System Table Information GUID
 | 
				
			||||||
 | 
					///
 | 
				
			||||||
 | 
					extern EFI_GUID gEfiSMMSTOREInfoHobGuid;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					typedef struct {
 | 
				
			||||||
 | 
					  UINT64    ComBuffer;
 | 
				
			||||||
 | 
					  UINT32    ComBufferSize;
 | 
				
			||||||
 | 
					  UINT32    NumBlocks;
 | 
				
			||||||
 | 
					  UINT32    BlockSize;
 | 
				
			||||||
 | 
					  UINT64    MmioAddress;
 | 
				
			||||||
 | 
					  UINT8     ApmCmd;
 | 
				
			||||||
 | 
					  UINT8     Reserved0[3];
 | 
				
			||||||
 | 
					} SMMSTORE_INFO;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
Some files were not shown because too many files have changed in this diff Show More
		Reference in New Issue
	
	Block a user