VirtualBox

source: vbox/trunk/src/VBox/Devices/EFI/FirmwareNew/OvmfPkg/QemuFlashFvbServicesRuntimeDxe/QemuFlashSmm.c@ 99396

最後變更 在這個檔案從99396是 89983,由 vboxsync 提交於 4 年 前

Devices/EFI: Merge edk-stable202105 and openssl 1.1.1j and make it build, bugref:4643

  • 屬性 svn:eol-style 設為 native
檔案大小: 1.5 KB
 
1/** @file
2 Define the module hooks used while probing the QEMU flash device.
3
4 Copyright (C) 2018, Advanced Micro Devices. All rights reserved.
5
6 SPDX-License-Identifier: BSD-2-Clause-Patent
7
8**/
9
10#include <Library/BaseMemoryLib.h>
11#include <Library/DebugLib.h>
12#include <Library/PcdLib.h>
13#include <Library/MemEncryptSevLib.h>
14
15#include "QemuFlash.h"
16
17VOID
18QemuFlashBeforeProbe (
19 IN EFI_PHYSICAL_ADDRESS BaseAddress,
20 IN UINTN FdBlockSize,
21 IN UINTN FdBlockCount
22 )
23{
24 EFI_STATUS Status;
25
26 ASSERT (FeaturePcdGet (PcdSmmSmramRequire));
27
28 if (!MemEncryptSevIsEnabled ()) {
29 return;
30 }
31
32 //
33 // When SEV is enabled, AmdSevDxe runs early in DXE phase and clears the
34 // C-bit from the NonExistent entry -- which is later split and accommodate
35 // the flash MMIO but the driver runs in non SMM context hence it cleared the
36 // flash ranges from non SMM page table. When SMM is enabled, the flash
37 // services are accessed from the SMM mode hence we explicitly clear the
38 // C-bit on flash ranges from SMM page table.
39 //
40
41 Status = MemEncryptSevClearPageEncMask (
42 0,
43 BaseAddress,
44 EFI_SIZE_TO_PAGES (FdBlockSize * FdBlockCount),
45 FALSE
46 );
47 ASSERT_EFI_ERROR (Status);
48}
49
50/**
51 Write to QEMU Flash
52
53 @param[in] Ptr Pointer to the location to write.
54 @param[in] Value The value to write.
55
56**/
57VOID
58QemuFlashPtrWrite (
59 IN volatile UINT8 *Ptr,
60 IN UINT8 Value
61 )
62{
63 *Ptr = Value;
64}
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette