https://bugzilla.tianocore.org/show_bug.cgi?id=1373 Replace BSD 2-Clause License with BSD+Patent License. This change is based on the following emails: https://lists.01.org/pipermail/edk2-devel/2019-February/036260.html https://lists.01.org/pipermail/edk2-devel/2018-October/030385.html RFCs with detailed process for the license change: V3: https://lists.01.org/pipermail/edk2-devel/2019-March/038116.html V2: https://lists.01.org/pipermail/edk2-devel/2019-March/037669.html V1: https://lists.01.org/pipermail/edk2-devel/2019-March/037500.html Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com> Reviewed-by: Hao Wu <hao.a.wu@intel.com> Reviewed-by: Jian J Wang <jian.j.wang@intel.com>
		
			
				
	
	
		
			68 lines
		
	
	
		
			1.8 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
			
		
		
	
	
			68 lines
		
	
	
		
			1.8 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
/** @file
 | 
						|
  Var Check Hii generation from Hii Database.
 | 
						|
 | 
						|
Copyright (c) 2015, Intel Corporation. All rights reserved.<BR>
 | 
						|
SPDX-License-Identifier: BSD-2-Clause-Patent
 | 
						|
 | 
						|
**/
 | 
						|
 | 
						|
#include "VarCheckHiiGen.h"
 | 
						|
 | 
						|
/**
 | 
						|
  Generate from Hii Database.
 | 
						|
 | 
						|
**/
 | 
						|
VOID
 | 
						|
VarCheckHiiGenFromHiiDatabase (
 | 
						|
  VOID
 | 
						|
  )
 | 
						|
{
 | 
						|
  EFI_STATUS                    Status;
 | 
						|
  UINTN                         BufferSize;
 | 
						|
  VOID                          *Buffer;
 | 
						|
  EFI_PHYSICAL_ADDRESS          BufferAddress;
 | 
						|
  EFI_HII_DATABASE_PROTOCOL     *HiiDatabase;
 | 
						|
 | 
						|
  //
 | 
						|
  // Locate HII Database protocol
 | 
						|
  //
 | 
						|
  Status = gBS->LocateProtocol (&gEfiHiiDatabaseProtocolGuid, NULL, (VOID **) &HiiDatabase);
 | 
						|
  if (EFI_ERROR (Status)) {
 | 
						|
    return;
 | 
						|
  }
 | 
						|
 | 
						|
  //
 | 
						|
  // Call first time with zero buffer length.
 | 
						|
  // Should fail with EFI_BUFFER_TOO_SMALL.
 | 
						|
  //
 | 
						|
  BufferSize = 0;
 | 
						|
  Buffer = NULL;
 | 
						|
  Status = HiiDatabase->ExportPackageLists (HiiDatabase, 0, &BufferSize, Buffer);
 | 
						|
  if (Status == EFI_BUFFER_TOO_SMALL) {
 | 
						|
    //
 | 
						|
    // Allocate buffer to hold the HII Database.
 | 
						|
    //
 | 
						|
    Status = gBS->AllocatePages (AllocateAnyPages, EfiBootServicesData, EFI_SIZE_TO_PAGES (BufferSize), &BufferAddress);
 | 
						|
    ASSERT_EFI_ERROR (Status);
 | 
						|
    Buffer = (VOID *) (UINTN) BufferAddress;
 | 
						|
 | 
						|
    //
 | 
						|
    // Export HII Database into the buffer.
 | 
						|
    //
 | 
						|
    Status = HiiDatabase->ExportPackageLists (HiiDatabase, 0, &BufferSize, Buffer);
 | 
						|
    ASSERT_EFI_ERROR (Status);
 | 
						|
 | 
						|
    DEBUG ((DEBUG_INFO , "VarCheckHiiGenDxeFromHii - HII Database exported at 0x%x, size = 0x%x\n", Buffer, BufferSize));
 | 
						|
 | 
						|
#ifdef DUMP_HII_DATA
 | 
						|
    DEBUG_CODE (
 | 
						|
      DumpHiiDatabase (Buffer, BufferSize);
 | 
						|
      );
 | 
						|
#endif
 | 
						|
 | 
						|
    VarCheckParseHiiDatabase (Buffer, BufferSize);
 | 
						|
 | 
						|
    gBS->FreePages (BufferAddress, EFI_SIZE_TO_PAGES (BufferSize));
 | 
						|
  }
 | 
						|
}
 |