OvmfPkg/QemuFlashFvbServices: factor out SetPcdFlashNvStorageBaseAddresses
Extract the dynamic setting of the - PcdFlashNvStorageVariableBase64 - PcdFlashNvStorageFtwWorkingBase - PcdFlashNvStorageFtwSpareBase addresses to a helper function. For now, the helper function is identical (duplicated) between the SMM flash driver and the runtime DXE flash driver. In subsequent patches, this will change. Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org> Cc: Jordan Justen <jordan.l.justen@intel.com> Cc: Philippe Mathieu-Daudé <philmd@redhat.com> Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=386 Signed-off-by: Laszlo Ersek <lersek@redhat.com> Message-Id: <20200310222739.26717-3-lersek@redhat.com> Acked-by: Leif Lindholm <leif@nuviainc.com>
This commit is contained in:
		
				
					committed by
					
						![mergify[bot]](/avatar/e3df20cd7a67969c41a65f03bea54961?size=40) mergify[bot]
						mergify[bot]
					
				
			
			
				
	
			
			
			
						parent
						
							d6961bb47a
						
					
				
				
					commit
					cd99d07d53
				
			| @@ -1051,24 +1051,7 @@ FvbInitialize ( | ||||
|  | ||||
|   MarkIoMemoryRangeForRuntimeAccess (BaseAddress, Length); | ||||
|  | ||||
|   // | ||||
|   // Set several PCD values to point to flash | ||||
|   // | ||||
|   PcdStatus = PcdSet64S ( | ||||
|     PcdFlashNvStorageVariableBase64, | ||||
|     (UINTN) PcdGet32 (PcdOvmfFlashNvStorageVariableBase) | ||||
|     ); | ||||
|   ASSERT_RETURN_ERROR (PcdStatus); | ||||
|   PcdStatus = PcdSet32S ( | ||||
|     PcdFlashNvStorageFtwWorkingBase, | ||||
|     PcdGet32 (PcdOvmfFlashNvStorageFtwWorkingBase) | ||||
|     ); | ||||
|   ASSERT_RETURN_ERROR (PcdStatus); | ||||
|   PcdStatus = PcdSet32S ( | ||||
|     PcdFlashNvStorageFtwSpareBase, | ||||
|     PcdGet32 (PcdOvmfFlashNvStorageFtwSpareBase) | ||||
|     ); | ||||
|   ASSERT_RETURN_ERROR (PcdStatus); | ||||
|   SetPcdFlashNvStorageBaseAddresses (); | ||||
|  | ||||
|   FwhInstance = (EFI_FW_VOL_INSTANCE *) | ||||
|     ( | ||||
|   | ||||
| @@ -190,4 +190,9 @@ MarkIoMemoryRangeForRuntimeAccess ( | ||||
|   IN UINTN                  Length | ||||
|   ); | ||||
|  | ||||
| VOID | ||||
| SetPcdFlashNvStorageBaseAddresses ( | ||||
|   VOID | ||||
|   ); | ||||
|  | ||||
| #endif | ||||
|   | ||||
| @@ -216,3 +216,30 @@ MarkIoMemoryRangeForRuntimeAccess ( | ||||
|  | ||||
|   return Status; | ||||
| } | ||||
|  | ||||
| VOID | ||||
| SetPcdFlashNvStorageBaseAddresses ( | ||||
|   VOID | ||||
|   ) | ||||
| { | ||||
|   RETURN_STATUS PcdStatus; | ||||
|  | ||||
|   // | ||||
|   // Set several PCD values to point to flash | ||||
|   // | ||||
|   PcdStatus = PcdSet64S ( | ||||
|     PcdFlashNvStorageVariableBase64, | ||||
|     (UINTN) PcdGet32 (PcdOvmfFlashNvStorageVariableBase) | ||||
|     ); | ||||
|   ASSERT_RETURN_ERROR (PcdStatus); | ||||
|   PcdStatus = PcdSet32S ( | ||||
|     PcdFlashNvStorageFtwWorkingBase, | ||||
|     PcdGet32 (PcdOvmfFlashNvStorageFtwWorkingBase) | ||||
|     ); | ||||
|   ASSERT_RETURN_ERROR (PcdStatus); | ||||
|   PcdStatus = PcdSet32S ( | ||||
|     PcdFlashNvStorageFtwSpareBase, | ||||
|     PcdGet32 (PcdOvmfFlashNvStorageFtwSpareBase) | ||||
|     ); | ||||
|   ASSERT_RETURN_ERROR (PcdStatus); | ||||
| } | ||||
|   | ||||
| @@ -74,3 +74,30 @@ MarkIoMemoryRangeForRuntimeAccess ( | ||||
|  | ||||
|   return EFI_SUCCESS; | ||||
| } | ||||
|  | ||||
| VOID | ||||
| SetPcdFlashNvStorageBaseAddresses ( | ||||
|   VOID | ||||
|   ) | ||||
| { | ||||
|   RETURN_STATUS PcdStatus; | ||||
|  | ||||
|   // | ||||
|   // Set several PCD values to point to flash | ||||
|   // | ||||
|   PcdStatus = PcdSet64S ( | ||||
|     PcdFlashNvStorageVariableBase64, | ||||
|     (UINTN) PcdGet32 (PcdOvmfFlashNvStorageVariableBase) | ||||
|     ); | ||||
|   ASSERT_RETURN_ERROR (PcdStatus); | ||||
|   PcdStatus = PcdSet32S ( | ||||
|     PcdFlashNvStorageFtwWorkingBase, | ||||
|     PcdGet32 (PcdOvmfFlashNvStorageFtwWorkingBase) | ||||
|     ); | ||||
|   ASSERT_RETURN_ERROR (PcdStatus); | ||||
|   PcdStatus = PcdSet32S ( | ||||
|     PcdFlashNvStorageFtwSpareBase, | ||||
|     PcdGet32 (PcdOvmfFlashNvStorageFtwSpareBase) | ||||
|     ); | ||||
|   ASSERT_RETURN_ERROR (PcdStatus); | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user