├── .github └── workflows │ └── Platform-Build.yml ├── .gitignore ├── .gitmodules ├── CODE_OF_CONDUCT.md ├── LICENSE ├── MsvmPkg ├── AcpiPlatformDxe │ ├── AcpiPlatform.c │ ├── AcpiPlatform.h │ ├── AcpiPlatformDxe.inf │ ├── Dsdt.c │ ├── Facp.c │ ├── Oem0.c │ ├── spcr.c │ └── wdat.c ├── AcpiTables │ ├── AcpiTables.inf │ ├── Dbg2.aslc │ ├── Dsdt.asl │ ├── Facs.aslc │ ├── Fadt.aslc │ ├── Gtdt.aslc │ ├── Oem0.aslc │ ├── Spcr.aslc │ ├── Waet.aslc │ └── Wdat.aslc ├── BuildPlugins │ └── FlattenMapFiles │ │ ├── FlattenMapFiles.py │ │ └── FlattenMapFiles_plug_in.json ├── CpuDxe │ ├── CpuBd.c │ ├── CpuDxe.c │ ├── CpuDxe.h │ ├── CpuDxe.inf │ ├── CpuDxe.uni │ ├── CpuDxeExtra.uni │ ├── CpuGdt.c │ ├── CpuGdt.h │ ├── CpuMp.c │ ├── CpuMp.h │ ├── CpuPageTable.c │ ├── CpuPageTable.h │ ├── Ia32 │ │ ├── CpuAsm.nasm │ │ └── PagingAttribute.c │ ├── LoongArch64 │ │ ├── CpuDxe.c │ │ ├── CpuDxe.h │ │ ├── CpuMp.c │ │ └── Exception.c │ └── X64 │ │ ├── CpuApWait.asm │ │ ├── CpuAsm.S │ │ ├── CpuAsm.asm │ │ ├── CpuAsm.nasm │ │ └── PagingAttribute.c ├── Docs │ ├── ADVANCED.md │ ├── BUILDING.md │ ├── CONTRIBUTING.md │ ├── DEBUGGING.md │ ├── DEVGUIDE.md │ ├── FIRMWARE-DEPLOYMENT.md │ ├── Images │ │ └── windbgx_uefi.png │ └── LOGGING.md ├── EfiHvDxe │ ├── EfiHv.c │ └── EfiHvDxe.inf ├── EmclDxe │ ├── Emcl.c │ ├── EmclDxe.inf │ ├── Init.c │ ├── RingBuffer.c │ ├── RingBufferWrapper.c │ └── Transportp.h ├── EventLogDxe │ ├── EfiHandleTable.c │ ├── EfiHandleTable.h │ ├── EfiRing.c │ ├── EfiRing.h │ ├── EventLogDxe.c │ ├── EventLogDxe.h │ ├── EventLogDxe.inf │ ├── EventLogger.c │ ├── EventLogger.h │ ├── StatusCode.c │ └── StatusCode.h ├── FrontPage │ ├── FrontPage.c │ ├── FrontPage.h │ ├── FrontPage.inf │ ├── FrontPageConfigAccess.c │ ├── FrontPageConfigAccess.h │ ├── FrontPageStrings.uni │ ├── FrontPageUi.c │ ├── FrontPageUi.h │ ├── FrontPageVfr.Vfr │ ├── FrontPageVfr.h │ ├── PlatformConsole.c │ ├── PlatformConsole.h │ ├── PlatformString.c │ ├── Resources │ │ ├── BootLogo.bmp │ │ ├── FirmwareSettings.bmp │ │ ├── FrontpageLogo.bmp │ │ ├── FrontpageLogo@2x.bmp │ │ ├── LBAT.bmp │ │ ├── NoBoot.bmp │ │ ├── THOT.bmp │ │ └── VolumeUp.bmp │ ├── String.c │ └── String.h ├── Include │ ├── AcpiTables.h │ ├── BiosBootLogInterface.h │ ├── BiosEventLogInterface.h │ ├── BiosInterface.h │ ├── Guid │ │ ├── DxePhaseVariables.h │ │ └── FrontPageEventDataStruct.h │ ├── Hv │ │ ├── HvGuest.h │ │ ├── HvGuestCpuid.h │ │ ├── HvGuestHypercall.h │ │ ├── HvGuestMsr.h │ │ ├── HvGuestSyntheticInterrupts.h │ │ └── HvStatus.h │ ├── IsolationTypes.h │ ├── Library │ │ ├── BiosDeviceLib.h │ │ ├── BootEventLogLib.h │ │ ├── ConfigLib.h │ │ ├── CrashDumpAgentLib.h │ │ ├── CrashLib.h │ │ ├── EmclLib.h │ │ ├── EventLogLib.h │ │ ├── GhcbLib.h │ │ ├── HostVisibilityLib.h │ │ ├── HvHypercallLib.h │ │ ├── MmioAllocationLib.h │ │ ├── MsLogoLib.h │ │ ├── MsPlatBdsLib.h │ │ ├── PCUart.h │ │ └── WatchdogTimerLib.h │ ├── MsDisplayEngine.h │ ├── MsvmBase.h │ ├── PowerManagementInterface.h │ ├── Protocol │ │ ├── EfiHv.h │ │ ├── Emcl.h │ │ ├── EventLog.h │ │ ├── SynthKeyProtocol.h │ │ ├── Vmbus.h │ │ └── VmbusFileSystem.h │ ├── Synchronization.h │ ├── TpmInterface.h │ ├── Uefi │ │ └── MsUefiInternalFormRepresentationEx.h │ ├── UefiConstants.h │ ├── VirtualDeviceId.h │ ├── Vmbus │ │ ├── NtStatus.h │ │ ├── VmbusPacketFormat.h │ │ └── VmbusPacketInterface.h │ └── macamd64.inc ├── Library │ ├── BiosDeviceDebugLib │ │ ├── BiosDeviceDebugLib.inf │ │ └── DebugLib.c │ ├── BiosDeviceLib │ │ ├── BiosDeviceLib.inf │ │ ├── BiosDeviceLibCore.c │ │ ├── BiosDeviceLibSetup.c │ │ ├── BiosDeviceRuntimeLib.inf │ │ └── BiosDeviceRuntimeLibSetup.c │ ├── BootEventLogLib │ │ ├── BootEventLogLib.c │ │ └── BootEventLogLib.inf │ ├── BootEventLogLibNull │ │ ├── BootEventLogLibNull.c │ │ └── BootEventLogLibNull.inf │ ├── ConfigLib │ │ ├── ConfigLib.c │ │ └── ConfigLib.inf │ ├── CpuExceptionHandlerLib │ │ ├── CpuExceptionCommon.c │ │ ├── CpuExceptionCommon.h │ │ ├── DxeCpuExceptionHandlerLib.inf │ │ ├── DxeCpuExceptionHandlerLib.uni │ │ ├── DxeException.c │ │ ├── Ia32 │ │ │ ├── ArchExceptionHandler.c │ │ │ ├── ArchInterruptDefs.h │ │ │ ├── ExceptionHandlerAsm.nasm │ │ │ └── ExceptionTssEntryAsm.nasm │ │ ├── LoongArch │ │ │ ├── DxeExceptionLib.c │ │ │ ├── ExceptionCommon.c │ │ │ ├── ExceptionCommon.h │ │ │ ├── LoongArch64 │ │ │ │ ├── ArchExceptionHandler.c │ │ │ │ └── ExceptionHandlerAsm.S │ │ │ └── SecPeiExceptionLib.c │ │ ├── PeiCpuException.c │ │ ├── PeiCpuExceptionHandlerLib.inf │ │ ├── PeiCpuExceptionHandlerLib.uni │ │ ├── PeiDxeSmmCpuException.c │ │ ├── SecPeiCpuException.c │ │ ├── SecPeiCpuExceptionHandlerLib.inf │ │ ├── SecPeiCpuExceptionHandlerLib.uni │ │ ├── SmmCpuExceptionHandlerLib.inf │ │ ├── SmmCpuExceptionHandlerLib.uni │ │ ├── SmmException.c │ │ ├── UnitTest │ │ │ ├── CpuExceptionHandlerTest.h │ │ │ ├── CpuExceptionHandlerTestCommon.c │ │ │ ├── DxeCpuExceptionHandlerLibUnitTest.inf │ │ │ ├── DxeCpuExceptionHandlerUnitTest.c │ │ │ ├── Ia32 │ │ │ │ ├── ArchExceptionHandlerTest.c │ │ │ │ └── ArchExceptionHandlerTestAsm.nasm │ │ │ ├── PeiCpuExceptionHandlerLibUnitTest.inf │ │ │ ├── PeiCpuExceptionHandlerUnitTest.c │ │ │ └── X64 │ │ │ │ ├── ArchExceptionHandlerTest.c │ │ │ │ └── ArchExceptionHandlerTestAsm.nasm │ │ └── X64 │ │ │ ├── ArchExceptionHandler.c │ │ │ ├── ArchInterruptDefs.h │ │ │ ├── ExceptionHandlerAsm.nasm │ │ │ └── SecPeiExceptionHandlerAsm.nasm │ ├── CrashLib │ │ ├── AArch64 │ │ │ └── Crash.c │ │ ├── CrashLib.inf │ │ ├── CrashLibConstants.h │ │ ├── FailFast.c │ │ └── X64 │ │ │ ├── Crash.c │ │ │ └── FailFast.asm │ ├── DebugTransportLibMsvm │ │ ├── AArch64 │ │ │ └── DebugTransportLibMsvm.c │ │ ├── DebugTransportLibMsvm.inf │ │ └── X64 │ │ │ └── DebugTransportLibMsvm.c │ ├── DefaultExceptionHandlerLib │ │ ├── AArch64 │ │ │ └── DefaultExceptionHandler.c │ │ ├── Arm │ │ │ └── DefaultExceptionHandler.c │ │ ├── DefaultExceptionHandlerLib.inf │ │ └── DefaultExceptionHandlerUefi.c │ ├── DeviceBootManagerLib │ │ ├── DeviceBootManagerLib.c │ │ └── DeviceBootManagerLib.inf │ ├── DxeImageVerificationLib │ │ ├── DxeImageVerificationLib.c │ │ ├── DxeImageVerificationLib.h │ │ ├── DxeImageVerificationLib.inf │ │ ├── DxeImageVerificationLib.uni │ │ └── Measurement.c │ ├── EmclLib │ │ ├── EmclLib.c │ │ └── EmclLib.inf │ ├── EventLogLib │ │ ├── EventLogLib.c │ │ └── EventLogLib.inf │ ├── ExcludeMainFvFromMeasurementLib │ │ ├── ExcludeMainFvFromMeasurementLib.c │ │ └── ExcludeMainFvFromMeasurementLib.inf │ ├── GhcbLib │ │ ├── DxeGhcbLibSupport.c │ │ ├── GhcbLib.inf │ │ ├── PeiGhcbLib.inf │ │ ├── PeiGhcbLibSupport.c │ │ └── X64 │ │ │ ├── GhcbCall.c │ │ │ └── SvmSnp.asm │ ├── HostVisibilityLib │ │ ├── HostVisibilityLib.c │ │ ├── HostVisibilityLib.inf │ │ └── X64 │ │ │ ├── Snp.asm │ │ │ └── Tdx.asm │ ├── HvHypercallLib │ │ ├── AArch64 │ │ │ └── HypercallImpl.masm │ │ ├── DxeHvHypercallLibSupport.c │ │ ├── HvHypercallLib.c │ │ ├── HvHypercallLib.inf │ │ ├── HvHypercallLibP.h │ │ ├── PeiHvHypercallLib.inf │ │ ├── PeiHvHypercallLibSupport.c │ │ └── X64 │ │ │ ├── GhcbHypercall.c │ │ │ └── TdxCall.asm │ ├── HvTimerLib │ │ ├── HvTimerLib.c │ │ └── HvTimerLib.inf │ ├── IsolationLib │ │ ├── IsolationLib.c │ │ └── IsolationLib.inf │ ├── KdPL011SerialPortLib │ │ ├── KdPL011SerialPortLib.c │ │ └── KdPL011SerialPortLib.inf │ ├── LegacyMtrrLib │ │ ├── MtrrLib.c │ │ ├── MtrrLib.inf │ │ ├── MtrrLib.uni │ │ └── UnitTest │ │ │ ├── MtrrLibUnitTest.c │ │ │ ├── MtrrLibUnitTest.h │ │ │ ├── MtrrLibUnitTestHost.inf │ │ │ ├── RandomNumber.c │ │ │ └── Support.c │ ├── MmioAllocationLib │ │ ├── MmioAllocationLib.c │ │ └── MmioAllocationLib.inf │ ├── MsBootPolicyLib │ │ ├── MsBootPolicyLib.c │ │ └── MsBootPolicyLib.inf │ ├── MsLogoLib │ │ ├── Logo.c │ │ └── MsLogoLib.inf │ ├── MsPlatBdsLib │ │ ├── BdsPlatform.c │ │ └── MsPlatBdsLib.inf │ ├── MsvmRngLib │ │ ├── AArch64 │ │ │ ├── ArmRng.S │ │ │ ├── ArmRng.asm │ │ │ ├── ArmRng.h │ │ │ └── Rndr.c │ │ ├── BaseRng.c │ │ ├── BaseRngLib.uni │ │ ├── BaseRngLibInternals.h │ │ ├── MsvmRng.c │ │ ├── MsvmRngLib.inf │ │ ├── MsvmRngLibInternals.h │ │ ├── Rand │ │ │ └── RdRand.c │ │ └── Riscv │ │ │ ├── Rng.c │ │ │ └── Seed.S │ ├── PCUart │ │ ├── PCUart.c │ │ └── PCUart.inf │ ├── PlatformThemeLib │ │ ├── PlatformThemeLib.c │ │ └── PlatformThemeLib.inf │ ├── ResetSystemLib │ │ ├── ResetSystemLib.c │ │ └── ResetSystemLib.inf │ ├── SourceDebugEnabled │ │ ├── SourceDebugEnabledLib.c │ │ └── SourceDebugEnabledLib.inf │ ├── Tcg2PhysicalPresencePromptLibApprove │ │ ├── Tcg2PhysicalPresencePromptLibApprove.c │ │ └── Tcg2PhysicalPresencePromptLibApprove.inf │ ├── Tcg2PreInitLib │ │ ├── Tcg2PreInitLibDxe.c │ │ ├── Tcg2PreInitLibDxe.inf │ │ ├── Tcg2PreInitLibPei.c │ │ ├── Tcg2PreInitLibPei.inf │ │ └── Tpm2Acpi.c │ ├── Tpm2DeviceLib │ │ ├── Tpm2DeviceLib.c │ │ ├── Tpm2DeviceLib.inf │ │ └── Tpm2DeviceLib.uni │ └── WatchdogTimerLib │ │ ├── WatchdogTimerLib.c │ │ └── WatchdogTimerLib.inf ├── MsvmPcAtRealTimeClockRuntimeDxe │ ├── PcRtc.c │ ├── PcRtc.h │ ├── PcRtc.uni │ ├── PcRtcEntry.c │ ├── PcRtcExtra.uni │ └── PcatRealTimeClockRuntimeDxe.inf ├── MsvmPkg.dec ├── MsvmPkgAARCH64.dsc ├── MsvmPkgAARCH64.fdf ├── MsvmPkgX64.dsc ├── MsvmPkgX64.fdf ├── NetvscDxe │ ├── Callback.c │ ├── ComponentName.c │ ├── Get_status.c │ ├── Initialize.c │ ├── Mcast_ip_to_mac.c │ ├── NetvscDxe.c │ ├── NetvscDxe.h │ ├── NetvscDxe.inf │ ├── Nvdata.c │ ├── Receive.c │ ├── Receive_filters.c │ ├── Reset.c │ ├── Shutdown.c │ ├── Snp.c │ ├── Snp.h │ ├── Start.c │ ├── Station_address.c │ ├── Statistics.c │ ├── Stop.c │ ├── Transmit.c │ ├── WaitForPacket.c │ ├── nvspprotocol.h │ └── rndis.h ├── NvmExpressDxe │ ├── ComponentName.c │ ├── NvmExpress.c │ ├── NvmExpress.h │ ├── NvmExpressBlockIo.c │ ├── NvmExpressBlockIo.h │ ├── NvmExpressBounce.c │ ├── NvmExpressBounce.h │ ├── NvmExpressDiskInfo.c │ ├── NvmExpressDiskInfo.h │ ├── NvmExpressDxe.inf │ ├── NvmExpressDxe.uni │ ├── NvmExpressDxeExtra.uni │ ├── NvmExpressHci.c │ ├── NvmExpressHci.h │ ├── NvmExpressMediaSanitize.c │ ├── NvmExpressMediaSanitize.h │ ├── NvmExpressPassthru.c │ └── UnitTest │ │ ├── MediaSanitizeUnitTest.c │ │ └── MediaSanitizeUnitTestHost.inf ├── PlatformBuild.py ├── PlatformDeviceStateHelper │ ├── PlatformDeviceStateHelper.c │ └── PlatformDeviceStateHelper.inf ├── PlatformPei │ ├── AArch64 │ │ ├── Extra.h │ │ ├── Extra.masm │ │ ├── Mmu.c │ │ └── Mmu.h │ ├── Config.c │ ├── Config.h │ ├── Hob.c │ ├── Hob.h │ ├── Hv.c │ ├── Hv.h │ ├── IgvmConfig.c │ ├── Platform.c │ ├── Platform.h │ ├── PlatformPei.inf │ └── README.md ├── Sec │ ├── AArch64 │ │ ├── SecEntry.masm │ │ └── SecMain.c │ ├── SecMain.inf │ └── X64 │ │ ├── SecEntry.asm │ │ ├── SecIso.c │ │ ├── SecMain.c │ │ └── SecP.h ├── SerialDxe │ ├── ComponentName.c │ ├── MsvmSerial.h │ ├── Serial.c │ ├── Serial.h │ └── SerialDxe.inf ├── SmbiosPlatformDxe │ ├── SmbiosPlatform.c │ └── SmbiosPlatformDxe.inf ├── StorvscDxe │ ├── ComponentName.c │ ├── ExtScsiPassThru.c │ ├── StorchannelDxe.c │ ├── StorportDxe.h │ ├── StorvscDxe.c │ ├── StorvscDxe.h │ ├── StorvscDxe.inf │ └── VstorageProtocol.h ├── SynicTimerDxe │ ├── SynicTimer.c │ └── SynicTimerDxe.inf ├── SynthKeyDxe │ ├── ComponentName.c │ ├── SynthKeyChannel.c │ ├── SynthKeyChannel.h │ ├── SynthKeyDxe.c │ ├── SynthKeyDxe.h │ ├── SynthKeyDxe.inf │ ├── SynthKeyLayout.c │ ├── SynthKeyLayout.h │ ├── SynthSimpleTextIn.c │ └── SynthSimpleTextIn.h ├── Tools │ ├── edk2-acpica-iasl_extdep │ │ ├── Linux-ARM │ │ │ └── iasl │ │ ├── Linux-x86 │ │ │ └── iasl │ │ ├── MacOs-x86 │ │ │ └── iasl │ │ ├── Windows-ARM-64 │ │ │ └── iasl.exe │ │ ├── Windows-ARM │ │ │ └── iasl.exe │ │ ├── Windows-x86 │ │ │ └── iasl.exe │ │ └── extdep_state.yaml │ └── iasl_ext_dep.yaml ├── VariableDxe │ ├── NvramVariableDxe.c │ ├── NvramVariableDxe.h │ ├── VariableDxe.c │ └── VariableDxe.inf ├── VideoDxe │ ├── ComponentName.c │ ├── SynthVidProtocol.h │ ├── VideoChannelDxe.c │ ├── VideoDxe.c │ ├── VideoDxe.h │ ├── VideoDxe.inf │ └── VramSize.h ├── VmMeasurementDxe │ ├── VmMeasurementDxe.c │ ├── VmMeasurementDxe.inf │ └── VmMeasurementDxe.uni ├── VmbfsDxe │ ├── Vmbfs.c │ ├── VmbfsDxe.c │ ├── VmbfsDxe.inf │ ├── VmbfsEfi.h │ └── VmbfsFile.c ├── VmbusDxe │ ├── ChannelMessages.h │ ├── VmbusChannel.c │ ├── VmbusDxe.inf │ ├── VmbusP.h │ └── VmbusRoot.c ├── VpcivscDxe │ ├── PciBars.h │ ├── VpciProtocol.h │ ├── VpcivscDxe.c │ ├── VpcivscDxe.h │ ├── VpcivscDxe.inf │ ├── VpcivscPciIo.c │ └── wdm.h ├── WatchdogTimerDxe │ ├── WatchdogTimer.c │ └── WatchdogTimerDxe.inf └── image_validation.cfg ├── README.md ├── SECURITY.md ├── SUPPORT.md └── pip_requirement_stable.txt /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | ## 4 | ## Get latest from https://github.com/github/gitignore/blob/main/VisualStudio.gitignore 5 | 6 | # User-specific files 7 | *.rsuser 8 | *.suo 9 | *.user 10 | *.userosscache 11 | *.sln.docstates 12 | 13 | # User-specific files (MonoDevelop/Xamarin Studio) 14 | *.userprefs 15 | 16 | # Files built by Visual Studio 17 | *_i.c 18 | *_p.c 19 | *_h.h 20 | *.ilk 21 | *.meta 22 | *.obj 23 | *.iobj 24 | *.pch 25 | *.pdb 26 | *.ipdb 27 | *.pgc 28 | *.pgd 29 | *.rsp 30 | *.sbr 31 | *.tlb 32 | *.tli 33 | *.tlh 34 | *.tmp 35 | *.tmp_proj 36 | *_wpftmp.csproj 37 | *.log 38 | *.tlog 39 | *.vspscc 40 | *.vssscc 41 | .builds 42 | *.pidb 43 | *.svclog 44 | *.scc 45 | 46 | # NuGet Packages 47 | *.nupkg 48 | # NuGet Symbol Packages 49 | *.snupkg 50 | # The packages folder can be ignored because of Package Restore 51 | **/[Pp]ackages/* 52 | # except build/, which is used as an MSBuild target. 53 | !**/[Pp]ackages/build/ 54 | # Uncomment if necessary however generally it will be regenerated when needed 55 | #!**/[Pp]ackages/repositories.config 56 | # NuGet v3's project.json files produces more ignorable files 57 | *.nuget.props 58 | *.nuget.targets 59 | 60 | 61 | # Visual Studio cache files 62 | # files ending in .cache can be ignored 63 | *.[Cc]ache 64 | # but keep track of directories ending in .cache 65 | !?*.[Cc]ache/ 66 | 67 | # Others 68 | ClientBin/ 69 | ~$* 70 | *~ 71 | *.dbmdl 72 | *.dbproj.schemaview 73 | *.jfm 74 | *.pfx 75 | *.publishsettings 76 | orleans.codegen.cs 77 | 78 | # Python Tools for Visual Studio (PTVS) 79 | __pycache__/ 80 | *.pyc 81 | 82 | # MSBuild Binary and Structured Log 83 | *.binlog 84 | 85 | # VS Code files for those working on multiple tools 86 | .vscode/* 87 | !.vscode/settings.json 88 | !.vscode/tasks.json 89 | !.vscode/launch.json 90 | !.vscode/extensions.json 91 | *.code-workspace 92 | 93 | # Local History for Visual Studio Code 94 | .history/ 95 | 96 | # MU 97 | /BuildConfig.conf 98 | *.bak 99 | /Build 100 | /Conf 101 | *_extdep/ 102 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "MU_BASECORE"] 2 | path = MU_BASECORE 3 | url = https://github.com/microsoft/mu_basecore.git 4 | branch = release/202502 5 | [submodule "Common/MU"] 6 | path = Common/MU 7 | url = https://github.com/microsoft/mu_plus.git 8 | branch = release/202502 9 | [submodule "Common/MU_TIANO"] 10 | path = Common/MU_TIANO 11 | url = https://github.com/microsoft/mu_tiano_plus.git 12 | branch = release/202502 13 | [submodule "Feature/DEBUGGER"] 14 | path = Feature/DEBUGGER 15 | url = https://github.com/microsoft/mu_feature_debugger.git 16 | branch = main 17 | [submodule "Silicon/ARM/MU_TIANO"] 18 | path = Silicon/ARM/MU_TIANO 19 | url = https://github.com/microsoft/mu_silicon_arm_tiano.git 20 | branch = release/202502 21 | -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Microsoft Open Source Code of Conduct 2 | 3 | This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). 4 | 5 | Resources: 6 | 7 | - [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/) 8 | - [Microsoft Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) 9 | - Contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with questions or concerns 10 | - Employees can reach out at [aka.ms/opensource/moderation-support](https://aka.ms/opensource/moderation-support) -------------------------------------------------------------------------------- /MsvmPkg/AcpiPlatformDxe/AcpiPlatform.h: -------------------------------------------------------------------------------- 1 | /** @file 2 | 3 | This file contains declarations and definitions used globally in the 4 | MsvmPkg AcpiPlatformDxe driver. 5 | 6 | Copyright (c) Microsoft Corporation. 7 | SPDX-License-Identifier: BSD-2-Clause-Patent 8 | **/ 9 | 10 | #pragma once 11 | 12 | #include 13 | 14 | #include 15 | #include 16 | 17 | EFI_STATUS 18 | Oem0InitializeTable( 19 | IN OUT EFI_ACPI_DESCRIPTION_HEADER* Table 20 | ); 21 | 22 | EFI_STATUS 23 | DsdtInitializeTable( 24 | IN OUT EFI_ACPI_DESCRIPTION_HEADER* Dsdt 25 | ); 26 | 27 | EFI_STATUS 28 | SpcrInitializeTable( 29 | IN OUT EFI_ACPI_DESCRIPTION_HEADER* Spcr 30 | ); 31 | 32 | EFI_STATUS 33 | FacpInitializeTable( 34 | IN OUT EFI_ACPI_DESCRIPTION_HEADER* Facp 35 | ); 36 | 37 | EFI_STATUS 38 | WdatInitializeTable( 39 | IN OUT EFI_ACPI_DESCRIPTION_HEADER* Wdat 40 | ); 41 | 42 | extern BOOLEAN mHardwareIsolatedNoParavisor; -------------------------------------------------------------------------------- /MsvmPkg/AcpiPlatformDxe/Oem0.c: -------------------------------------------------------------------------------- 1 | /** @file 2 | This module is responsible for runtime initialization of the entropy 3 | table. 4 | 5 | Copyright (c) Microsoft Corporation. 6 | SPDX-License-Identifier: BSD-2-Clause-Patent 7 | **/ 8 | 9 | #include 10 | #include 11 | #include "AcpiPlatform.h" 12 | 13 | // 14 | // Entry point 15 | // 16 | 17 | EFI_STATUS 18 | Oem0InitializeTable( 19 | IN OUT EFI_ACPI_DESCRIPTION_HEADER* Table 20 | ) 21 | /*++ 22 | 23 | Routine Description: 24 | 25 | Initializes the OEM0 table. 26 | 27 | Arguments: 28 | 29 | Table - The Oem0 Table, expressed as an EFI_ACPI_DESCRIPTION_HEADER*. 30 | 31 | Return Value: 32 | 33 | EFI_SUCCESS 34 | 35 | --*/ 36 | { 37 | VM_ACPI_ENTROPY_TABLE *table; 38 | 39 | // 40 | // Copy the entropy data from the configuration. 41 | // 42 | table = (VM_ACPI_ENTROPY_TABLE *)Table; 43 | 44 | CopyMem(table->Data, (VOID*)(UINTN) PcdGet64(PcdEntropyPtr), ConfigLibEntropyDataSize); 45 | 46 | return EFI_SUCCESS; 47 | } 48 | 49 | -------------------------------------------------------------------------------- /MsvmPkg/AcpiPlatformDxe/wdat.c: -------------------------------------------------------------------------------- 1 | /** @file 2 | This module is responsible for runtime initialization of the WDAT APCI table. 3 | 4 | Copyright (c) Microsoft Corporation. 5 | SPDX-License-Identifier: BSD-2-Clause-Patent 6 | **/ 7 | 8 | #include 9 | #include 10 | #include "AcpiPlatform.h" 11 | #include 12 | 13 | EFI_STATUS 14 | WdatInitializeTable( 15 | IN OUT EFI_ACPI_DESCRIPTION_HEADER* Table 16 | ) 17 | /*++ 18 | 19 | Routine Description: 20 | 21 | Initializes the WDAT table based on configuration data. 22 | 23 | Arguments: 24 | 25 | Table - The WDAT Table, expressed as an EFI_ACPI_DESCRIPTION_HEADER*. 26 | 27 | Return Value: 28 | 29 | EFI_SUCCESS if WDAT is requested and properly initialized. 30 | EFI_UNSUPPORTED if WDAT is not required. Causes table to not be added. 31 | 32 | --*/ 33 | { 34 | 35 | VM_HARDWARE_WATCHDOG_ACTION_TABLE *wdat; 36 | 37 | // 38 | // Get configuration to determine if this table is needed. 39 | // 40 | BOOLEAN watchdogEnabled = PcdGetBool(PcdWatchdogEnabled); 41 | 42 | if (!watchdogEnabled) 43 | { 44 | return EFI_UNSUPPORTED; 45 | } 46 | 47 | // 48 | // Get bios base address. 49 | // 50 | UINT32 biosBaseAddress = PcdGet32(PcdBiosBaseAddress); 51 | 52 | // 53 | // Init table with actual address values. 54 | // 55 | wdat = (VM_HARDWARE_WATCHDOG_ACTION_TABLE *)Table; 56 | 57 | for (int i = 0; i < VM_HARDWARE_WATCHDOG_ACTION_COUNT; i++) 58 | { 59 | // 60 | // BiosWatchdog (for guest) has its MMIO/IO-ports at an offset w.r.t bios base address. 61 | // BiosWdatAddress is at offset 8, BiosWdatData is at offset 12. WDAT ACPI table is 62 | // populated with 0 & 4 for Address & Data respectively. 63 | // 64 | wdat->action[i].RegisterRegion.Address = biosBaseAddress + wdat->action[i].RegisterRegion.Address + 8; 65 | } 66 | 67 | return EFI_SUCCESS; 68 | } 69 | 70 | 71 | -------------------------------------------------------------------------------- /MsvmPkg/AcpiTables/Facs.aslc: -------------------------------------------------------------------------------- 1 | /** @file 2 | Defines the FACS fixed ACPI table. This table is mandatory when 3 | running with fixed ACPI hardware, as it provides storage for the global 4 | lock. 5 | 6 | Copyright (c) Microsoft Corporation. 7 | SPDX-License-Identifier: BSD-2-Clause-Patent 8 | **/ 9 | 10 | #include 11 | #include 12 | 13 | EFI_ACPI_6_2_FIRMWARE_ACPI_CONTROL_STRUCTURE FACS = 14 | { 15 | EFI_ACPI_6_2_FIRMWARE_ACPI_CONTROL_STRUCTURE_SIGNATURE, 16 | sizeof(EFI_ACPI_6_2_FIRMWARE_ACPI_CONTROL_STRUCTURE), 17 | 0, // HardwareSignature 18 | 0, // FirmwareWakingVector 19 | 0, // GlobalLock 20 | 0, // Flags 21 | 0, // XFirmwareWakingVector 22 | EFI_ACPI_6_2_FIRMWARE_ACPI_CONTROL_STRUCTURE_VERSION, // Version 23 | }; 24 | 25 | VOID* 26 | ReferenceAcpiTable() 27 | { 28 | return (VOID*) &FACS; 29 | } 30 | 31 | -------------------------------------------------------------------------------- /MsvmPkg/AcpiTables/Gtdt.aslc: -------------------------------------------------------------------------------- 1 | /** @file 2 | Defines the Generic Timer Description Table for ARM64. 3 | 4 | Copyright (c) Microsoft Corporation. 5 | SPDX-License-Identifier: BSD-2-Clause-Patent 6 | **/ 7 | 8 | #include 9 | #include 10 | 11 | EFI_ACPI_6_2_GENERIC_TIMER_DESCRIPTION_TABLE GTDT = 12 | { 13 | STANDARD_HEADER(EFI_ACPI_6_2_GENERIC_TIMER_DESCRIPTION_TABLE_SIGNATURE, 14 | sizeof(EFI_ACPI_6_2_GENERIC_TIMER_DESCRIPTION_TABLE), 15 | EFI_ACPI_6_2_GENERIC_TIMER_DESCRIPTION_TABLE_REVISION) 16 | 0xFFFFFFFFFFFFFFFF, // CntControlBase Physical Address: doesn't exist so -1 17 | 0, // Reserved 18 | 0, // Secure EL1 timer GSIV: doesn't exist so zero 19 | 0, // Secure EL1 timer Flags: doesn't exist so zero 20 | FixedPcdGet32(PcdNonSecureEL1TimerGSIV), // Non-Secure EL1 timer GSIV 21 | 0, // Non-Secure EL1 timer Flags: doesn't exist so zero 22 | FixedPcdGet32(PcdVirtualEL1TimerGSIV), // Virtual EL1 timer GSIV 23 | 0, // Virtual Timer Flags: doesn't exist so zero 24 | FixedPcdGet32(PcdNonSecureEL2TimerGSIV), // Non-Secure EL2 timer GSIV 25 | 0, // Non-Secure EL2 timer Flags: doesn't exist so zero 26 | 0xFFFFFFFFFFFFFFFF, // CntReadBase Physical address: doesn't exist so -1 27 | 0, // Platform Timer Count 28 | 0, // Platform Timer Offset 29 | }; 30 | 31 | VOID* 32 | ReferenceAcpiTable() 33 | { 34 | return (VOID*) >DT; 35 | } 36 | -------------------------------------------------------------------------------- /MsvmPkg/AcpiTables/Oem0.aslc: -------------------------------------------------------------------------------- 1 | /** @file 2 | Defines the OEM0 fixed ACPI table. This table is used to provide initial 3 | entropy to the VM during boot for the random number generator. It is 4 | initialized in the worker process with random data. 5 | 6 | Copyright (c) Microsoft Corporation. 7 | SPDX-License-Identifier: BSD-2-Clause-Patent 8 | **/ 9 | 10 | #include 11 | #include 12 | 13 | VM_ACPI_ENTROPY_TABLE OEM0 = 14 | { 15 | STANDARD_HEADER(VM_ACPI_ENTROPY_TABLE_SIGNATURE, 16 | sizeof(VM_ACPI_ENTROPY_TABLE), 17 | 1) 18 | 19 | // 20 | // The data will be initialized at runtime. 21 | // 22 | }; 23 | 24 | 25 | VOID* 26 | ReferenceAcpiTable() 27 | { 28 | return (VOID*) &OEM0; 29 | } 30 | 31 | -------------------------------------------------------------------------------- /MsvmPkg/AcpiTables/Waet.aslc: -------------------------------------------------------------------------------- 1 | /** @file 2 | Defines the WAET fixed ACPI table. This table informs the OS that the 3 | RTC and ACPI PM timer are implemented correctly. This dramatically 4 | improves performance on operating systems that access these devices 5 | during timer ticks, since the workarounds for the bugs involved accessing 6 | the virtual hardware registers many more times than actually necessary. 7 | 8 | This is necessary for all supported Windows OSes before Windows 8. 9 | Starting in Windows 8, the hypervisor reference timer and synthetic 10 | interrupt timers are used instead of the PM timer and RTC, respectively. 11 | 12 | It is also necessary for Windows 8 when the PCI bus is present and labeled 13 | a PIIX4, since Windows 8 will bugcheck if the ACPI_PM_TIMER_GOOD_FLAG 14 | is not set. This is despite the fact though Windows 8 does not use the PM 15 | timer when running on a Hyper-V VM. 16 | 17 | Copyright (c) Microsoft Corporation. 18 | SPDX-License-Identifier: BSD-2-Clause-Patent 19 | **/ 20 | 21 | #include 22 | #include 23 | 24 | #define RTC_GOOD_FLAG 0x00000001 25 | #define ACPI_PM_TIMER_GOOD_FLAG 0x00000002 26 | 27 | #pragma pack(push, 1) 28 | 29 | typedef struct 30 | { 31 | EFI_ACPI_DESCRIPTION_HEADER Header; 32 | UINT32 Flags; 33 | } WINDOWS_ACPI_EMULATED_DEVICES_TABLE; 34 | 35 | #pragma pack(pop) 36 | 37 | WINDOWS_ACPI_EMULATED_DEVICES_TABLE WAET = 38 | { 39 | STANDARD_HEADER(EFI_ACPI_6_2_WINDOWS_ACPI_EMULATED_DEVICES_TABLE_SIGNATURE, 40 | sizeof(WINDOWS_ACPI_EMULATED_DEVICES_TABLE), 41 | 1) 42 | RTC_GOOD_FLAG | ACPI_PM_TIMER_GOOD_FLAG 43 | }; 44 | 45 | 46 | VOID* 47 | ReferenceAcpiTable() 48 | { 49 | return (VOID*) &WAET; 50 | } 51 | 52 | -------------------------------------------------------------------------------- /MsvmPkg/BuildPlugins/FlattenMapFiles/FlattenMapFiles.py: -------------------------------------------------------------------------------- 1 | ## @file FlattenMapFiles.py 2 | # Plugin to support copying all Map files to 1 directory. 3 | # This makes debugging easier when source level debugging is not available. 4 | # 5 | ## 6 | # Copyright (c) Microsoft Corporation. All rights reserved. 7 | # SPDX-License-Identifier: BSD-2-Clause-Patent 8 | ## 9 | ### 10 | from edk2toolext.environment.plugintypes.uefi_build_plugin import IUefiBuildPlugin 11 | import logging 12 | import shutil 13 | import os 14 | 15 | class FlattenMapFiles(IUefiBuildPlugin): 16 | 17 | def do_post_build(self, thebuilder): 18 | #Path to Build output 19 | BuildPath = thebuilder.env.GetValue("BUILD_OUTPUT_BASE") 20 | #Path to where the Map files will be stored 21 | MapFilesPath = os.path.join(BuildPath, "MAP") 22 | 23 | IgnoreMapFiles = [] #make lower case 24 | 25 | try: 26 | if not os.path.isdir(MapFilesPath): 27 | os.mkdir(MapFilesPath) 28 | except: 29 | logging.critical("Error making Map Files directory") 30 | 31 | logging.critical("Copying Map Files to flat directory") 32 | for dirpath, dirnames, filenames in os.walk(BuildPath): 33 | if MapFilesPath in dirpath: 34 | continue 35 | for filename in filenames: 36 | fnl = filename.strip().lower() 37 | if(fnl.endswith(".map")): 38 | if(any(e for e in IgnoreMapFiles if e in fnl)): 39 | # too much info. logging.debug("Flatten - Ignore Map files: %s" % filename) 40 | pass 41 | else: 42 | shutil.copy(os.path.join(dirpath, filename), os.path.join(MapFilesPath, filename)) 43 | return 0 -------------------------------------------------------------------------------- /MsvmPkg/BuildPlugins/FlattenMapFiles/FlattenMapFiles_plug_in.json: -------------------------------------------------------------------------------- 1 | { 2 | "scope": "global", 3 | "name": "Flatten Map Files Uefi Build Plugin", 4 | "module": "FlattenMapFiles" 5 | } -------------------------------------------------------------------------------- /MsvmPkg/CpuDxe/CpuDxe.uni: -------------------------------------------------------------------------------- 1 | // /** @file 2 | // CPU driver installs CPU Architecture Protocol and CPU MP Protocol. 3 | // 4 | // CPU driver installs CPU Architecture Protocol and CPU MP Protocol. 5 | // 6 | // Copyright (c) 2008 - 2018, Intel Corporation. All rights reserved.
7 | // 8 | // SPDX-License-Identifier: BSD-2-Clause-Patent 9 | // 10 | // **/ 11 | 12 | 13 | #string STR_MODULE_ABSTRACT #language en-US "CPU driver installs CPU Architecture Protocol and CPU MP Protocol." 14 | 15 | #string STR_MODULE_DESCRIPTION #language en-US "CPU driver installs CPU Architecture Protocol and CPU MP Protocol." 16 | 17 | -------------------------------------------------------------------------------- /MsvmPkg/CpuDxe/CpuDxeExtra.uni: -------------------------------------------------------------------------------- 1 | // /** @file 2 | // CpuDxe Localized Strings and Content 3 | // 4 | // Copyright (c) 2013 - 2018, Intel Corporation. All rights reserved.
5 | // 6 | // SPDX-License-Identifier: BSD-2-Clause-Patent 7 | // 8 | // **/ 9 | 10 | #string STR_PROPERTIES_MODULE_NAME 11 | #language en-US 12 | "CPU Architectural and CPU Multi-processor DXE Driver" 13 | 14 | 15 | -------------------------------------------------------------------------------- /MsvmPkg/CpuDxe/CpuGdt.h: -------------------------------------------------------------------------------- 1 | /** @file 2 | C based implementation of IA32 interrupt handling only 3 | requiring a minimal assembly interrupt entry point. 4 | 5 | Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.
6 | SPDX-License-Identifier: BSD-2-Clause-Patent 7 | 8 | **/ 9 | 10 | #ifndef _CPU_GDT_H_ 11 | #define _CPU_GDT_H_ 12 | 13 | // 14 | // Local structure definitions 15 | // 16 | 17 | #pragma pack (1) 18 | 19 | // 20 | // Global Descriptor Entry structures 21 | // 22 | 23 | typedef struct _GDT_ENTRY { 24 | UINT16 Limit15_0; 25 | UINT16 Base15_0; 26 | UINT8 Base23_16; 27 | UINT8 Type; 28 | UINT8 Limit19_16_and_flags; 29 | UINT8 Base31_24; 30 | } GDT_ENTRY; 31 | 32 | typedef 33 | struct _GDT_ENTRIES { 34 | GDT_ENTRY Null; 35 | GDT_ENTRY Linear; 36 | GDT_ENTRY LinearCode; 37 | GDT_ENTRY SysData; 38 | GDT_ENTRY SysCode; 39 | GDT_ENTRY SysCode16; 40 | GDT_ENTRY LinearData64; 41 | GDT_ENTRY LinearCode64; 42 | GDT_ENTRY Spare5; 43 | } GDT_ENTRIES; 44 | 45 | #pragma pack () 46 | 47 | #define NULL_SEL OFFSET_OF (GDT_ENTRIES, Null) 48 | #define LINEAR_SEL OFFSET_OF (GDT_ENTRIES, Linear) 49 | #define LINEAR_CODE_SEL OFFSET_OF (GDT_ENTRIES, LinearCode) 50 | #define SYS_DATA_SEL OFFSET_OF (GDT_ENTRIES, SysData) 51 | #define SYS_CODE_SEL OFFSET_OF (GDT_ENTRIES, SysCode) 52 | #define SYS_CODE16_SEL OFFSET_OF (GDT_ENTRIES, SysCode16) 53 | #define LINEAR_DATA64_SEL OFFSET_OF (GDT_ENTRIES, LinearData64) 54 | #define LINEAR_CODE64_SEL OFFSET_OF (GDT_ENTRIES, LinearCode64) 55 | #define SPARE5_SEL OFFSET_OF (GDT_ENTRIES, Spare5) 56 | 57 | #if defined (MDE_CPU_IA32) 58 | #define CPU_CODE_SEL LINEAR_CODE_SEL 59 | #define CPU_DATA_SEL LINEAR_SEL 60 | #elif defined (MDE_CPU_X64) 61 | #define CPU_CODE_SEL LINEAR_CODE64_SEL 62 | #define CPU_DATA_SEL LINEAR_DATA64_SEL 63 | #else 64 | #error CPU type not supported for CPU GDT initialization! 65 | #endif 66 | 67 | #endif // _CPU_GDT_H_ 68 | -------------------------------------------------------------------------------- /MsvmPkg/CpuDxe/Ia32/CpuAsm.nasm: -------------------------------------------------------------------------------- 1 | ;------------------------------------------------------------------------------ 2 | ;* 3 | ;* Copyright (c) 2016, Intel Corporation. All rights reserved.
4 | ;* SPDX-License-Identifier: BSD-2-Clause-Patent 5 | ;* 6 | ;* CpuAsm.nasm 7 | ;* 8 | ;* Abstract: 9 | ;* 10 | ;------------------------------------------------------------------------------ 11 | 12 | SECTION .text 13 | 14 | ;------------------------------------------------------------------------------ 15 | ; VOID 16 | ; SetCodeSelector ( 17 | ; UINT16 Selector 18 | ; ); 19 | ;------------------------------------------------------------------------------ 20 | global ASM_PFX(SetCodeSelector) 21 | ASM_PFX(SetCodeSelector): 22 | mov ecx, [esp+4] 23 | sub esp, 0x10 24 | lea eax, [setCodeSelectorLongJump] 25 | mov [esp], eax 26 | mov [esp+4], cx 27 | jmp dword far [esp] 28 | setCodeSelectorLongJump: 29 | add esp, 0x10 30 | ret 31 | 32 | ;------------------------------------------------------------------------------ 33 | ; VOID 34 | ; SetDataSelectors ( 35 | ; UINT16 Selector 36 | ; ); 37 | ;------------------------------------------------------------------------------ 38 | global ASM_PFX(SetDataSelectors) 39 | ASM_PFX(SetDataSelectors): 40 | mov ecx, [esp+4] 41 | o16 mov ss, cx 42 | o16 mov ds, cx 43 | o16 mov es, cx 44 | o16 mov fs, cx 45 | o16 mov gs, cx 46 | ret 47 | 48 | -------------------------------------------------------------------------------- /MsvmPkg/CpuDxe/Ia32/PagingAttribute.c: -------------------------------------------------------------------------------- 1 | /** @file 2 | Return Paging attribute. 3 | 4 | Copyright (c) 2019, Intel Corporation. All rights reserved.
5 | SPDX-License-Identifier: BSD-2-Clause-Patent 6 | 7 | **/ 8 | 9 | #include "CpuPageTable.h" 10 | 11 | /** 12 | Get paging details. 13 | 14 | @param PagingContextData The paging context. 15 | @param PageTableBase Return PageTableBase field. 16 | @param Attributes Return Attributes field. 17 | 18 | **/ 19 | VOID 20 | GetPagingDetails ( 21 | IN PAGE_TABLE_LIB_PAGING_CONTEXT_DATA *PagingContextData, 22 | OUT UINTN **PageTableBase OPTIONAL, 23 | OUT UINT32 **Attributes OPTIONAL 24 | ) 25 | { 26 | if (PageTableBase != NULL) { 27 | *PageTableBase = &PagingContextData->Ia32.PageTableBase; 28 | } 29 | 30 | if (Attributes != NULL) { 31 | *Attributes = &PagingContextData->Ia32.Attributes; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /MsvmPkg/CpuDxe/X64/CpuApWait.asm: -------------------------------------------------------------------------------- 1 | TITLE CpuAsm.asm: 2 | ;++ 3 | ; 4 | ; Copyright (c) 2013 Microsoft Corporation 5 | ; 6 | ; Module Name: 7 | ; 8 | ; CpuApWait.asm 9 | ; 10 | ; Abstract: 11 | ; 12 | ; This module implements functions to support the APs waiting in the mailbox for TDX guests. 13 | ; 14 | ;-- 15 | 16 | include macamd64.inc 17 | 18 | altentry ApWaitInMailboxEnd 19 | 20 | #define COMMAND_OFFSET 0x0 21 | #define APICID_OFFSET 0x4 22 | #define WAKEUP_VECTOR_OFFSET 0x8 23 | 24 | #define MpCommandNoop 0x0 25 | #define MpCommandWakeup 0x1 26 | 27 | #define HasVcpuEnteredMailboxWaitOffset 0x800 28 | 29 | ; 30 | ; AP loops and wait in the mailbox. 31 | ; 32 | ; @param[in] R8: Mailbox address 33 | ; @param[in] R9: VCPU Index 34 | ; @param[in] R10: PageTableBase 35 | ; 36 | ; @return None This routine does not return 37 | ; 38 | 39 | LEAF_ENTRY ApWaitInMailbox, _TEXT$00 40 | 41 | ; Update the CR3 to point to the updated page table which maps the mailbox page. 42 | mov CR3, R10 43 | 44 | ; Set the HasVcpuEnteredMailboxWait in the mailbox so that CpuDxe can continue processing 45 | ; the next AP. 46 | mov dword ptr[R8 + HasVcpuEnteredMailboxWaitOffset], 1 47 | 48 | ; Build the APIC ID and mailbox command as a single 8-byte quantity 49 | shl R9, 32 50 | or R9, MpCommandWakeup 51 | 52 | MailBoxLoop: 53 | 54 | ; Wait until the command is set 55 | cmp [R8 + COMMAND_OFFSET], R9 56 | jne MailBoxLoop 57 | 58 | ; Capture the wake vector and clear the mailbox command with a memory barrier 59 | mov R10, [R8 + WAKEUP_VECTOR_OFFSET] 60 | mov R9d, MpCommandNoop 61 | lock xchg [R8 + COMMAND_OFFSET], R9w 62 | 63 | jmp R10 64 | 65 | ALTERNATE_ENTRY ApWaitInMailboxEnd 66 | 67 | LEAF_END ApWaitInMailbox, _TEXT$00 68 | 69 | END 70 | 71 | -------------------------------------------------------------------------------- /MsvmPkg/CpuDxe/X64/CpuAsm.nasm: -------------------------------------------------------------------------------- 1 | ;------------------------------------------------------------------------------ 2 | ;* 3 | ;* Copyright (c) 2016 - 2022, Intel Corporation. All rights reserved.
4 | ;* SPDX-License-Identifier: BSD-2-Clause-Patent 5 | ;* 6 | ;* CpuAsm.nasm 7 | ;* 8 | ;* Abstract: 9 | ;* 10 | ;------------------------------------------------------------------------------ 11 | 12 | DEFAULT REL 13 | SECTION .text 14 | 15 | ;------------------------------------------------------------------------------ 16 | ; VOID 17 | ; SetCodeSelector ( 18 | ; UINT16 Selector 19 | ; ); 20 | ;------------------------------------------------------------------------------ 21 | global ASM_PFX(SetCodeSelector) 22 | ASM_PFX(SetCodeSelector): 23 | push rcx 24 | lea rax, [setCodeSelectorLongJump] 25 | push rax 26 | retfq 27 | setCodeSelectorLongJump: 28 | ret 29 | 30 | ;------------------------------------------------------------------------------ 31 | ; VOID 32 | ; SetDataSelectors ( 33 | ; UINT16 Selector 34 | ; ); 35 | ;------------------------------------------------------------------------------ 36 | global ASM_PFX(SetDataSelectors) 37 | ASM_PFX(SetDataSelectors): 38 | o16 mov ss, cx 39 | o16 mov ds, cx 40 | o16 mov es, cx 41 | o16 mov fs, cx 42 | o16 mov gs, cx 43 | ret 44 | 45 | -------------------------------------------------------------------------------- /MsvmPkg/CpuDxe/X64/PagingAttribute.c: -------------------------------------------------------------------------------- 1 | /** @file 2 | Return Paging attribute. 3 | 4 | Copyright (c) 2019, Intel Corporation. All rights reserved.
5 | SPDX-License-Identifier: BSD-2-Clause-Patent 6 | 7 | **/ 8 | 9 | #include "CpuPageTable.h" 10 | 11 | /** 12 | Get paging details. 13 | 14 | @param PagingContextData The paging context. 15 | @param PageTableBase Return PageTableBase field. 16 | @param Attributes Return Attributes field. 17 | 18 | **/ 19 | VOID 20 | GetPagingDetails ( 21 | IN PAGE_TABLE_LIB_PAGING_CONTEXT_DATA *PagingContextData, 22 | OUT UINTN **PageTableBase OPTIONAL, 23 | OUT UINT32 **Attributes OPTIONAL 24 | ) 25 | { 26 | if (PageTableBase != NULL) { 27 | *PageTableBase = &PagingContextData->X64.PageTableBase; 28 | } 29 | 30 | if (Attributes != NULL) { 31 | *Attributes = &PagingContextData->X64.Attributes; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /MsvmPkg/Docs/ADVANCED.md: -------------------------------------------------------------------------------- 1 | # Advanced Features and Experimental Functionality 2 | 3 | This guide covers additional features, experimental functionality, and advanced use cases. 4 | 5 | ## Graphics Output 6 | 7 | ### OpenVMM Graphics Support 8 | 9 | Enable graphical UEFI display with VNC connectivity. 10 | 11 | **Prerequisites:** 12 | - TigerVNC viewer: Download from [TigerVNC on SourceForge](https://sourceforge.net/projects/tigervnc/) 13 | 14 | **Setup:** 15 | 16 | 1. **Launch OpenVMM with graphics support:** 17 | ```bash 18 | cargo run -- --uefi --gfx --disk "C:\Users\vnowkakeane\Documents\virtualDrives\EfiShell1.vhdx" 19 | ``` 20 | 21 | 2. **Connect to the graphical output:** 22 | - Open TigerVNC viewer 23 | - Connect to `localhost` (default VNC port) 24 | - The UEFI graphical interface will be displayed in the VNC window 25 | 26 | **Use Cases:** 27 | - Testing UEFI graphical applications 28 | - Debugging display-related issues 29 | - Demonstrating UEFI frontpage interfaces 30 | 31 | ## UEFI Shell Integration 32 | 33 | ### Attaching UEFI Shell (OpenVMM) 34 | 35 | Test UEFI functionality with an interactive shell environment. 36 | 37 | **Prerequisites:** 38 | 39 | 1. **Obtain the UEFI Shell VHDX file** from the internal test content location: 40 | ``` 41 | \\sesdfs\1windows\TestContent\CORE\Base\HYP\MVM\uefi\EfiShell_udk.vhdx 42 | ``` 43 | 44 | 2. **Copy to local storage** (example location): 45 | ``` 46 | C:\Users\vnowkakeane\Documents\virtualDrives\EfiShell1.vhdx 47 | ``` 48 | 49 | **Usage:** 50 | 51 | Launch OpenVMM with the shell disk attached: 52 | ```bash 53 | cargo run -- --uefi --disk "C:\Users\vnowkakeane\Documents\virtualDrives\EfiShell1.vhdx" --uefi-console-mode com1 54 | ``` 55 | 56 | **Key Features:** 57 | - `--uefi-console-mode com1` redirects shell output to the terminal for easy interaction 58 | - Provides full UEFI Shell command environment 59 | - Useful for testing UEFI applications and drivers 60 | 61 | ### Hyper-V UEFI Shell 62 | 63 | For Hyper-V environments, attach the UEFI Shell VHDX as a standard disk to your Generation 2 VM and configure boot order to prioritize the shell disk. 64 | 65 | ## Next Steps 66 | 67 | - **Return to basics:** [README.md](README.md) 68 | - **Build fundamentals:** [BUILDING.md](BUILDING.md) 69 | - **Production deployment:** [FIRMWARE-DEPLOYMENT.md](FIRMWARE-DEPLOYMENT.md) 70 | -------------------------------------------------------------------------------- /MsvmPkg/Docs/BUILDING.md: -------------------------------------------------------------------------------- 1 | # Building MsvmPkg 2 | 3 | This guide covers building UEFI firmware images for all supported platforms. 4 | 5 | ## Prerequisites 6 | 7 | Follow the basic instructions for PlatformBuild [here](https://microsoft.github.io/mu/CodeDevelopment/compile/). 8 | 9 | ## Basic Build Commands 10 | 11 | ### Default Debug Build 12 | 13 | ```powershell 14 | stuart_build -c .\MsvmPkg\PlatformBuild.py 15 | ``` 16 | 17 | ### Release Build 18 | 19 | ```powershell 20 | stuart_build -c .\MsvmPkg\PlatformBuild.py TARGET=RELEASE 21 | ``` 22 | 23 | ### ARM64 Build 24 | 25 | ```powershell 26 | stuart_build -c .\MsvmPkg\PlatformBuild.py BUILD_ARCH=AARCH64 27 | ``` 28 | 29 | ## Specialized Builds 30 | 31 | ### Debug-Enabled Build 32 | 33 | For interactive debugging with WinDbg: 34 | 35 | ```powershell 36 | stuart_build -c .\MsvmPkg\PlatformBuild.py BLD_*_DEBUGGER_ENABLED=1 37 | ``` 38 | 39 | ### Serial Logging Build 40 | 41 | For serial port debug output: 42 | 43 | ```powershell 44 | stuart_build -c .\MsvmPkg\PlatformBuild.py BLD_*_DEBUGLIB_SERIAL=1 45 | ``` 46 | 47 | ### Combined Debug + Serial Build 48 | 49 | ```powershell 50 | stuart_build -c .\MsvmPkg\PlatformBuild.py BLD_*_DEBUGGER_ENABLED=1 BLD_*_DEBUGLIB_SERIAL=1 51 | ``` 52 | 53 | ## Build Output Structure 54 | 55 | Build artifacts follow this path structure: 56 | 57 | ``` 58 | {root}\Build\Msvm{architecture}\{flavor}_{toolchain}\ 59 | ├── FV\ 60 | │ └── MSVM.fd # Main firmware image 61 | ├── PDB\ # Debug symbols 62 | └── ... 63 | ``` 64 | 65 | **Path Variables:** 66 | - `{root}` = Root directory of the UEFI project 67 | - `{architecture}` = X64, AARCH64, etc. 68 | - `{flavor}` = DEBUG or RELEASE 69 | - `{toolchain}` = VS2022, GCC, etc. 70 | 71 | **Examples:** 72 | - `Build\MsvmX64\DEBUG_VS2022\FV\MSVM.fd` 73 | - `Build\MsvmAARCH64\RELEASE_GCC\FV\MSVM.fd` 74 | 75 | ## Next Steps 76 | 77 | After building, you'll need to deploy your firmware: 78 | 79 | - **Deploy Firmware:** See [FIRMWARE-DEPLOYMENT.md](FIRMWARE-DEPLOYMENT.md) 80 | - **Enable Debugging:** See [DEBUGGING.md](DEBUGGING.md) 81 | - **Collect Logs:** See [LOGGING.md](LOGGING.md) 82 | -------------------------------------------------------------------------------- /MsvmPkg/Docs/DEVGUIDE.md: -------------------------------------------------------------------------------- 1 | # MsvmPkg Documentation 2 | 3 | MsvmPkg provides UEFI firmware for Microsoft's virtualization platforms, including Hyper-V, OpenVMM, and OpenHCL environments. 4 | 5 | ## Getting Started 6 | 7 | 1. **[Building](BUILDING.md)** - Build UEFI firmware images 8 | 2. **[Firmware Deployment](FIRMWARE-DEPLOYMENT.md)** - Load custom firmware on different platforms 9 | 3. **[Debugging](DEBUGGING.md)** - Interactive UEFI debugging with WinDbg 10 | 4. **[Logging](LOGGING.md)** - Collect UEFI logs and diagnostics 11 | 5. **[Advanced](ADVANCED.md)** - Graphics, UEFI Shell, and experimental features 12 | 13 | ## Platform Support 14 | 15 | | Platform | Deployment | Debugging | Logging | 16 | |----------|------------|-----------|---------| 17 | | **Hyper-V** | Registry + File Copy | Named Pipes + TCP | ETW Tracing via EfiDiagnostics, Serial | 18 | | **OpenVMM** | Direct Loading | TCP | EfiDiagnostics, Serial | 19 | | **OpenHCL** | IGVM Build | TCP | kmsg Buffer, Serial | 20 | 21 | ## When to Use Which Platform 22 | 23 | **Use Hyper-V when:** 24 | - Working with Windows production environments 25 | - Testing on Windows 11 24H2+ / Server 2025+ 26 | - Need full Windows VM management features 27 | - **Note:** Limited to standard Gen2 VMs (no HCL/CVM support) 28 | 29 | **Use OpenVMM when:** 30 | - Developing in WSL/Linux environments 31 | - Need faster iteration cycles 32 | - Want simpler debugging setup 33 | - Testing experimental features 34 | 35 | **Use OpenHCL when:** 36 | - Working with hardware-based isolation 37 | - Testing confidential computing scenarios 38 | - Need compatibility with isolated workloads 39 | 40 | ## Getting Help 41 | 42 | - **Build Issues:** See [BUILDING.md](BUILDING.md) 43 | - **Debug Connection Problems:** See [DEBUGGING.md](DEBUGGING.md) 44 | - **No Log Output:** See [LOGGING.md](LOGGING.md) 45 | -------------------------------------------------------------------------------- /MsvmPkg/Docs/Images/windbgx_uefi.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/mu_msvm/9dd44d82aaa513e58913616f3a5a567112039574/MsvmPkg/Docs/Images/windbgx_uefi.png -------------------------------------------------------------------------------- /MsvmPkg/EfiHvDxe/EfiHvDxe.inf: -------------------------------------------------------------------------------- 1 | ## @file 2 | # Provides an implementation of the EFI_HV_PROTOCOL protocol, which provides 3 | # UEFI access to the Hyper-V hypervisor. 4 | # 5 | # Copyright (c) Microsoft Corporation. 6 | # SPDX-License-Identifier: BSD-2-Clause-Patent 7 | # 8 | ## 9 | 10 | [Defines] 11 | INF_VERSION = 0x00010005 12 | BASE_NAME = EfiHvDxe 13 | FILE_GUID = CA585647-54A9-4879-A8CD-45A769246680 14 | MODULE_TYPE = DXE_DRIVER 15 | VERSION_STRING = 1.0 16 | 17 | ENTRY_POINT = EfiHvInitialize 18 | 19 | 20 | [Sources] 21 | EfiHv.c 22 | 23 | [Packages] 24 | MdePkg/MdePkg.dec 25 | MsvmPkg/MsvmPkg.dec 26 | 27 | [Packages.X64] 28 | UefiCpuPkg/UefiCpuPkg.dec 29 | 30 | [Packages.AARCH64] 31 | EmbeddedPkg/EmbeddedPkg.dec 32 | 33 | [LibraryClasses] 34 | BaseLib 35 | CrashLib 36 | DebugLib 37 | HvHypercallLib 38 | IsolationLib 39 | MemoryAllocationLib 40 | UefiBootServicesTableLib 41 | UefiDriverEntryPoint 42 | 43 | [LibraryClasses.X64] 44 | GhcbLib 45 | HostVisibilityLib 46 | LocalApicLib 47 | 48 | [Guids] 49 | gEfiEventExitBootServicesGuid ## CONSUMES 50 | 51 | [Protocols] 52 | gEfiHvProtocolGuid ## PRODUCES 53 | gEfiHvIvmProtocolGuid ## PRODUCES 54 | 55 | [Protocols.X64] 56 | gEfiCpuArchProtocolGuid ## CONSUMES 57 | 58 | [Protocols.AARCH64] 59 | gHardwareInterruptProtocolGuid ## CONSUMES 60 | 61 | [Pcd.X64] 62 | gMsvmPkgTokenSpaceGuid.PcdIsolationSharedGpaBoundary ## CONSUMES 63 | gMsvmPkgTokenSpaceGuid.PcdIsolationSharedGpaCanonicalizationBitmask ## CONSUMES 64 | gMsvmPkgTokenSpaceGuid.PcdSvsmCallingArea ## SOMETIMES_CONSUMES 65 | 66 | [Depex.X64] 67 | gEfiCpuArchProtocolGuid 68 | 69 | [Depex.AARCH64] 70 | gHardwareInterruptProtocolGuid 71 | 72 | -------------------------------------------------------------------------------- /MsvmPkg/EmclDxe/EmclDxe.inf: -------------------------------------------------------------------------------- 1 | ## @file 2 | # EMCL (EFI VmBus client library) DXE driver. 3 | # 4 | # Copyright (c) Microsoft Corporation. 5 | # SPDX-License-Identifier: BSD-2-Clause-Patent 6 | # 7 | ## 8 | 9 | [Defines] 10 | INF_VERSION = 0x00010005 11 | BASE_NAME = EmclDxe 12 | FILE_GUID = 45386216-9A17-46AE-AD49-423112FBFFB8 13 | MODULE_TYPE = DXE_DRIVER 14 | VERSION_STRING = 1.0 15 | ENTRY_POINT = EmclDriverInitialize 16 | 17 | [Packages] 18 | MdePkg/MdePkg.dec 19 | MsvmPkg/MsvmPkg.dec 20 | 21 | [LibraryClasses] 22 | PcdLib 23 | UefiBootServicesTableLib 24 | UefiLib 25 | BaseLib 26 | CrashLib 27 | DebugLib 28 | UefiDriverEntryPoint 29 | MemoryAllocationLib 30 | DebugLib 31 | IsolationLib 32 | 33 | [Sources] 34 | Emcl.c 35 | RingBufferWrapper.c 36 | 37 | [Protocols] 38 | gEfiEmclProtocolGuid #PRODUCES 39 | gEfiEmclV2ProtocolGuid #PRODUCES 40 | gEfiEmclTagProtocolGuid #PRODUCES 41 | gEfiVmbusProtocolGuid #CONSUMES 42 | gEfiHvIvmProtocolGuid #CONSUMES 43 | 44 | [Depex] 45 | TRUE 46 | 47 | [Pcd] 48 | gMsvmPkgTokenSpaceGuid.PcdIsolationSharedGpaBoundary ## SOMETIMES_CONSUMES 49 | gMsvmPkgTokenSpaceGuid.PcdIsolationSharedGpaCanonicalizationBitmask ## SOMETIMES_CONSUMES 50 | 51 | -------------------------------------------------------------------------------- /MsvmPkg/EmclDxe/Init.c: -------------------------------------------------------------------------------- 1 | /** @file 2 | This file implements setup and teardown parts of the VMBus transport 3 | library 4 | 5 | Copyright (c) Microsoft Corporation. 6 | SPDX-License-Identifier: BSD-2-Clause-Patent 7 | 8 | **/ 9 | 10 | #include "transportp.h" 11 | 12 | #define RING_BUFFER_POOL_TAG 'gnrV' 13 | 14 | EFI_STATUS 15 | PkInitializeSingleMappedRingBuffer( 16 | OUT PPACKET_LIB_CONTEXT Context, 17 | IN VOID* IncomingControl, 18 | IN VOID* IncomingDataPages, 19 | IN UINT32 IncomingDataPageCount, 20 | IN VOID* OutgoingControl, 21 | IN VOID* OutgoingDataPages, 22 | IN UINT32 OutgoingDataPageCount 23 | ) 24 | /*++ 25 | 26 | Routine Description: 27 | 28 | Initializes a single-mapped ring buffer structure. This functions differs from 29 | PkInitializeDoubleMappedRingBuffer only in the SAL annotation. 30 | 31 | Arguments: 32 | 33 | Context - A pointer to the packet library context structure to initialize. 34 | 35 | IncomingControl - A pointer to the incoming control region. 36 | 37 | IncomingDataPages - A pointer to the incoming data pages. 38 | 39 | IncomingDataPageCount - The size of the incoming data buffer, measured in 40 | pages. 41 | 42 | OutgoingControl - A pointer to the outgoing control region. 43 | 44 | OutgoingDataPages - A pointer to the outgoing data pages. 45 | 46 | OutgoingDataPageCount - The size of the outgoing buffer, measured in 47 | pages. 48 | 49 | Return Value: 50 | 51 | EFI_STATUS. 52 | 53 | --*/ 54 | { 55 | ZeroMem(Context, sizeof(*Context)); 56 | Context->Incoming.Control = (PVMRCB)IncomingControl; 57 | Context->Incoming.Data = IncomingDataPages; 58 | Context->Incoming.DataBytesInRing = IncomingDataPageCount * EFI_PAGE_SIZE; 59 | Context->Outgoing.Control = (PVMRCB)OutgoingControl; 60 | Context->Outgoing.Data = OutgoingDataPages; 61 | Context->Outgoing.DataBytesInRing = OutgoingDataPageCount * EFI_PAGE_SIZE; 62 | Context->InterruptMaskSkips = &Context->StaticInterruptMaskSkips; 63 | return PkpInitRingBufferControl(Context); 64 | } 65 | -------------------------------------------------------------------------------- /MsvmPkg/EmclDxe/RingBufferWrapper.c: -------------------------------------------------------------------------------- 1 | /** @file 2 | This module wraps the VMBus packet library C files with definitions 3 | to allow it to compile in the UEFI environment. 4 | 5 | **/ 6 | 7 | #include 8 | #include 9 | #include 10 | #include 11 | 12 | #define PrefetchForWrite(x) 13 | 14 | #define ALIGN_UP(x, y) ALIGN_VALUE((x), sizeof(y)) 15 | 16 | #include "Init.c" 17 | #include "RingBuffer.c" 18 | -------------------------------------------------------------------------------- /MsvmPkg/EmclDxe/Transportp.h: -------------------------------------------------------------------------------- 1 | /** @file 2 | This file contains the structures that are used internally within 3 | the packet management library. 4 | 5 | Copyright (c) Microsoft Corporation. 6 | SPDX-License-Identifier: BSD-2-Clause-Patent 7 | **/ 8 | 9 | #pragma once 10 | 11 | #include 12 | #include 13 | 14 | EFI_STATUS 15 | PkpInitRingBufferControl( 16 | IN OUT PPACKET_LIB_CONTEXT Context 17 | ); 18 | -------------------------------------------------------------------------------- /MsvmPkg/EventLogDxe/EventLogDxe.c: -------------------------------------------------------------------------------- 1 | /** @file 2 | Entry point and initialization for combined status code and event logging driver 3 | 4 | Copyright (c) Microsoft Corporation. 5 | SPDX-License-Identifier: BSD-2-Clause-Patent 6 | **/ 7 | 8 | #include "EventLogDxe.h" 9 | #include 10 | #include "StatusCode.h" 11 | #include "EventLogger.h" 12 | 13 | EFI_HV_PROTOCOL *mHv; 14 | EFI_HV_IVM_PROTOCOL *mHvIvm; 15 | 16 | EFI_STATUS 17 | EFIAPI 18 | EventLogDxeEntry ( 19 | IN EFI_HANDLE ImageHandle, 20 | IN EFI_SYSTEM_TABLE *SystemTable 21 | ) 22 | /*++ 23 | 24 | Routine Description: 25 | 26 | Entry point of DXE Status Code Driver. 27 | 28 | This function is the entry point of this DXE Status Code Driver. 29 | It installs Status Code Runtime Protocol 30 | 31 | Arguments: 32 | 33 | ImageHandle The firmware allocated handle for the EFI image. 34 | 35 | SystemTable A pointer to the EFI System Table. 36 | 37 | Return Value: 38 | 39 | EFI_SUCCESS on success 40 | 41 | --*/ 42 | { 43 | EFI_STATUS status; 44 | 45 | DEBUG((DEBUG_INIT, "EventLog Driver Starting\n")); 46 | // 47 | // Initialize the event channel management and then the status code protocol 48 | // 49 | status = EventLoggerInitialize(); 50 | 51 | if (EFI_ERROR(status)) 52 | { 53 | goto Exit; 54 | } 55 | 56 | status = gBS->LocateProtocol(&gEfiHvProtocolGuid, NULL, (VOID **)&mHv); 57 | 58 | if (EFI_ERROR(status)) 59 | { 60 | goto Exit; 61 | } 62 | 63 | status = gBS->LocateProtocol(&gEfiHvIvmProtocolGuid, NULL, (VOID **)&mHvIvm); 64 | 65 | if (EFI_ERROR(status)) 66 | { 67 | goto Exit; 68 | } 69 | 70 | // 71 | // Don't fail driver initialization if this fails. 72 | // 73 | StatusCodeRuntimeInitialize(); 74 | 75 | // 76 | // Workaroud: Initialize BootEventLogLib library. This is done because BootEventLogLib 77 | // library requires gEfiEventLogProtocolGuid, which is not available at the 78 | // time of its constructor execution. 79 | // 80 | BootEventLogLibInit(ImageHandle, SystemTable); 81 | 82 | Exit: 83 | 84 | return status; 85 | } 86 | -------------------------------------------------------------------------------- /MsvmPkg/EventLogDxe/EventLogDxe.h: -------------------------------------------------------------------------------- 1 | /** @file 2 | Internal include file the Event Log Runtime DXE Driver. 3 | 4 | Copyright (c) Microsoft Corporation. 5 | SPDX-License-Identifier: BSD-2-Clause-Patent 6 | **/ 7 | 8 | #pragma once 9 | 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | 19 | #include 20 | #include 21 | -------------------------------------------------------------------------------- /MsvmPkg/EventLogDxe/EventLogger.h: -------------------------------------------------------------------------------- 1 | /** @file 2 | Defines types, constants, and function prototypes for event channels 3 | 4 | Copyright (c) Microsoft Corporation. 5 | SPDX-License-Identifier: BSD-2-Clause-Patent 6 | **/ 7 | 8 | #pragma once 9 | 10 | 11 | EFI_STATUS 12 | EFIAPI 13 | EventLoggerInitialize(); 14 | 15 | 16 | EFI_STATUS 17 | EFIAPI 18 | EventChannelCreate( 19 | IN const EFI_GUID *Channel, 20 | IN OPTIONAL EVENT_CHANNEL_INFO *Attributes, 21 | OUT OPTIONAL EFI_HANDLE *Handle 22 | ); 23 | 24 | 25 | EFI_STATUS 26 | EFIAPI 27 | EventChannelFlush( 28 | IN const EFI_HANDLE Channel 29 | ); 30 | 31 | 32 | EFI_STATUS 33 | EFIAPI 34 | EventChannelReset( 35 | IN const EFI_HANDLE Channel 36 | ); 37 | 38 | 39 | EFI_STATUS 40 | EFIAPI 41 | EventChannelStatistics( 42 | IN const EFI_HANDLE Channel, 43 | OUT EVENT_CHANNEL_STATISTICS *Stats 44 | ); 45 | 46 | 47 | EFI_STATUS 48 | EFIAPI 49 | EventEnumerate( 50 | IN const EFI_HANDLE Channel, 51 | IN OUT EFI_HANDLE *Enumerator, 52 | OUT EFI_EVENT_DESCRIPTOR *Metadata, 53 | OUT VOID **Event 54 | ); 55 | 56 | 57 | EFI_STATUS 58 | EFIAPI 59 | EventLog( 60 | IN const EFI_HANDLE Channel, 61 | IN const EFI_EVENT_DESCRIPTOR *Event, 62 | IN OPTIONAL const VOID *Data 63 | ); 64 | 65 | 66 | EFI_STATUS 67 | EFIAPI 68 | EventPendingGet( 69 | IN const EFI_HANDLE Channel, 70 | OUT EFI_EVENT_DESCRIPTOR *Metadata, 71 | OUT VOID **Data 72 | ); 73 | 74 | 75 | EFI_STATUS 76 | EFIAPI 77 | EventPendingCommit( 78 | IN const EFI_HANDLE Channel 79 | ); 80 | -------------------------------------------------------------------------------- /MsvmPkg/EventLogDxe/StatusCode.h: -------------------------------------------------------------------------------- 1 | /** @file 2 | Internal include file the Event Log Runtime DXE Driver. 3 | 4 | This code is derived from: 5 | IntelFrameworkModulePkg\Include\Framework\StatusCode.h 6 | 7 | Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.
8 | Copyright (c) Microsoft Corporation. 9 | SPDX-License-Identifier: BSD-2-Clause-Patent 10 | **/ 11 | 12 | #pragma once 13 | 14 | EFI_STATUS 15 | EFIAPI 16 | StatusCodeRuntimeInitialize(); 17 | -------------------------------------------------------------------------------- /MsvmPkg/FrontPage/PlatformConsole.h: -------------------------------------------------------------------------------- 1 | /** @file 2 | Platform Console routines for showing the Hyper-V diagnostic console 3 | 4 | Copyright (c) Microsoft Corporation. 5 | SPDX-License-Identifier: BSD-2-Clause-Patent 6 | **/ 7 | 8 | #pragma once 9 | 10 | EFI_STATUS 11 | PlatformConsoleInitialize(); 12 | 13 | VOID 14 | PlatformConsoleBootSummary( 15 | IN EFI_STRING_ID Id 16 | ); 17 | 18 | // 19 | // Platform String Helpers. 20 | // 21 | 22 | EFI_STATUS 23 | PlatformStringInitialize(); 24 | 25 | 26 | CHAR16* 27 | PlatformStringById( 28 | IN EFI_STRING_ID Id 29 | ); 30 | 31 | UINTN 32 | PlatformStringPrintById( 33 | IN EFI_STRING_ID Id, 34 | ... 35 | ); 36 | 37 | UINTN 38 | PlatformStringPrintSById( 39 | OUT CHAR16 *StartOfBuffer, 40 | IN UINTN BufferSize, 41 | IN EFI_STRING_ID Id, 42 | ... 43 | ); 44 | 45 | UINTN 46 | PlatformStringPrint( 47 | IN CHAR16 *Format, 48 | ... 49 | ); -------------------------------------------------------------------------------- /MsvmPkg/FrontPage/Resources/BootLogo.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/mu_msvm/9dd44d82aaa513e58913616f3a5a567112039574/MsvmPkg/FrontPage/Resources/BootLogo.bmp -------------------------------------------------------------------------------- /MsvmPkg/FrontPage/Resources/FirmwareSettings.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/mu_msvm/9dd44d82aaa513e58913616f3a5a567112039574/MsvmPkg/FrontPage/Resources/FirmwareSettings.bmp -------------------------------------------------------------------------------- /MsvmPkg/FrontPage/Resources/FrontpageLogo.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/mu_msvm/9dd44d82aaa513e58913616f3a5a567112039574/MsvmPkg/FrontPage/Resources/FrontpageLogo.bmp -------------------------------------------------------------------------------- /MsvmPkg/FrontPage/Resources/FrontpageLogo@2x.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/mu_msvm/9dd44d82aaa513e58913616f3a5a567112039574/MsvmPkg/FrontPage/Resources/FrontpageLogo@2x.bmp -------------------------------------------------------------------------------- /MsvmPkg/FrontPage/Resources/LBAT.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/mu_msvm/9dd44d82aaa513e58913616f3a5a567112039574/MsvmPkg/FrontPage/Resources/LBAT.bmp -------------------------------------------------------------------------------- /MsvmPkg/FrontPage/Resources/NoBoot.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/mu_msvm/9dd44d82aaa513e58913616f3a5a567112039574/MsvmPkg/FrontPage/Resources/NoBoot.bmp -------------------------------------------------------------------------------- /MsvmPkg/FrontPage/Resources/THOT.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/mu_msvm/9dd44d82aaa513e58913616f3a5a567112039574/MsvmPkg/FrontPage/Resources/THOT.bmp -------------------------------------------------------------------------------- /MsvmPkg/FrontPage/Resources/VolumeUp.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/mu_msvm/9dd44d82aaa513e58913616f3a5a567112039574/MsvmPkg/FrontPage/Resources/VolumeUp.bmp -------------------------------------------------------------------------------- /MsvmPkg/FrontPage/String.c: -------------------------------------------------------------------------------- 1 | /** @file 2 | String support 3 | 4 | Copyright (c) 2004 - 2010, Intel Corporation. All rights reserved. 5 | Copyright (c) Microsoft Corporation. 6 | SPDX-License-Identifier: BSD-2-Clause-Patent 7 | **/ 8 | 9 | #include "FrontPage.h" 10 | 11 | #include 12 | #include 13 | #include 14 | 15 | EFI_HII_HANDLE gStringPackHandle; 16 | 17 | EFI_GUID mFrontPageStringPackGuid = { 18 | // {9CA9EC7A-BC96-45E4-A500-1D4B79141553} 19 | 0x9ca9ec7a, 0xbc96, 0x45e4, { 0xa5, 0x0, 0x1d, 0x4b, 0x79, 0x14, 0x15, 0x53 } 20 | }; 21 | 22 | /** 23 | Initialize HII global accessor for string support. 24 | 25 | **/ 26 | VOID 27 | InitializeStringSupport ( 28 | VOID 29 | ) 30 | { 31 | gStringPackHandle = HiiAddPackages ( 32 | &mFrontPageStringPackGuid, 33 | gImageHandle, 34 | FrontPageStrings, 35 | NULL 36 | ); 37 | //ASSERT (gStringPackHandle != NULL); 38 | } 39 | 40 | /** 41 | Get string by string id from the HII Interface 42 | 43 | 44 | @param Id String ID. 45 | 46 | @retval CHAR16 * String from ID. 47 | @retval NULL If error occurs. 48 | 49 | **/ 50 | CHAR16 * 51 | GetStringById ( 52 | IN EFI_STRING_ID Id 53 | ) 54 | { 55 | return HiiGetString (gStringPackHandle, Id, NULL); 56 | } 57 | -------------------------------------------------------------------------------- /MsvmPkg/FrontPage/String.h: -------------------------------------------------------------------------------- 1 | /** @file 2 | String support 3 | 4 | Copyright (c) 2004 - 2010, Intel Corporation. All rights reserved. 5 | Copyright (c) Microsoft Corporation. 6 | SPDX-License-Identifier: BSD-2-Clause-Patent 7 | **/ 8 | 9 | #ifndef _STRING_H_ 10 | #define _STRING_H_ 11 | 12 | extern EFI_HII_HANDLE gStringPackHandle; 13 | 14 | // 15 | // This is the VFR compiler generated header file which defines the 16 | // string identifiers. 17 | // 18 | 19 | extern UINT8 FrontPageStrings[]; 20 | 21 | /** 22 | Get string by string id from the HII Interface 23 | 24 | 25 | @param Id String ID. 26 | 27 | @retval CHAR16 * String from ID. 28 | @retval NULL If error occurs. 29 | 30 | **/ 31 | CHAR16 * 32 | GetStringById ( 33 | IN EFI_STRING_ID Id 34 | ); 35 | 36 | /** 37 | Initialize HII global accessor for string support. 38 | 39 | **/ 40 | VOID 41 | InitializeStringSupport ( 42 | VOID 43 | ); 44 | 45 | /** 46 | Call the browser and display the front page 47 | 48 | @return Status code that will be returned by 49 | EFI_FORM_BROWSER2_PROTOCOL.SendForm (). 50 | 51 | **/ 52 | EFI_STATUS 53 | CallFrontPage (IN UINT32 FormIndex); 54 | 55 | #endif // _STRING_H_ 56 | -------------------------------------------------------------------------------- /MsvmPkg/Include/AcpiTables.h: -------------------------------------------------------------------------------- 1 | /** @file 2 | This file contains declarations and definitions shared between the 3 | ACPI table ASLC files and the ACPI platform DXE driver. 4 | 5 | Copyright (c) Microsoft Corporation. 6 | SPDX-License-Identifier: BSD-2-Clause-Patent 7 | **/ 8 | 9 | #include 10 | #include 11 | #include 12 | 13 | #define STANDARD_HEADER(sig, length, rev) \ 14 | { \ 15 | sig, \ 16 | length, \ 17 | rev, \ 18 | 0, \ 19 | "VRTUAL", \ 20 | SIGNATURE_64('M','I','C','R','O','S','F','T'), \ 21 | 1, \ 22 | SIGNATURE_32('M','S','F','T'), \ 23 | 1 \ 24 | }, 25 | 26 | #pragma pack(push, 1) 27 | 28 | typedef struct _VM_ACPI_ENTROPY_TABLE 29 | { 30 | EFI_ACPI_DESCRIPTION_HEADER Header; 31 | UINT8 Data[BiosInterfaceEntropyTableSize]; 32 | } VM_ACPI_ENTROPY_TABLE; 33 | 34 | #define VM_ACPI_ENTROPY_TABLE_SIGNATURE SIGNATURE_32('O','E','M','0') 35 | 36 | #define AMD_ACPI_ASPT_TABLE_SIGNATURE SIGNATURE_32('A', 'S', 'P', 'T') 37 | 38 | // 39 | // WDAT table. 40 | // 41 | 42 | #define VM_HARDWARE_WATCHDOG_ACTION_COUNT 18 43 | 44 | typedef struct { 45 | EFI_ACPI_WATCHDOG_ACTION_1_0_TABLE header; 46 | EFI_ACPI_WATCHDOG_ACTION_1_0_WATCHDOG_ACTION_INSTRUCTION_ENTRY action[VM_HARDWARE_WATCHDOG_ACTION_COUNT]; 47 | } VM_HARDWARE_WATCHDOG_ACTION_TABLE; 48 | 49 | #pragma pack(pop) 50 | 51 | -------------------------------------------------------------------------------- /MsvmPkg/Include/Guid/DxePhaseVariables.h: -------------------------------------------------------------------------------- 1 | /** @file -- DxePhaseVariables.h 2 | Contains definitions for locating and working with the DXE phase 3 | indication variables. 4 | 5 | Copyright (c) 2015, Microsoft Corporation. All rights reserved. 6 | 7 | **/ 8 | 9 | #ifndef _DXE_PHASE_VARIABLES_H_ 10 | #define _DXE_PHASE_VARIABLES_H_ 11 | 12 | // GUID Declaration 13 | extern EFI_GUID gMsDxePhaseVariablesGuid; 14 | 15 | typedef BOOLEAN PHASE_INDICATOR; 16 | 17 | // NOTE: Variable Attributes 18 | // When locating one of the phase indication variables, the attributes should be compared. 19 | // If the attributes don't match, that's a security error and the indicator cannot be trusted. 20 | 21 | #define DXE_PHASE_INDICATOR_ATTR (EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS) // Volatile, BS and RT 22 | 23 | // EndOfDxe Indicator 24 | #define END_OF_DXE_INDICATOR_VAR_NAME L"EndOfDxeSignalled" 25 | #define END_OF_DXE_INDICATOR_VAR_ATTR DXE_PHASE_INDICATOR_ATTR 26 | 27 | // ReadyToBoot Indicator 28 | #define READY_TO_BOOT_INDICATOR_VAR_NAME L"ReadyToBootSignalled" 29 | #define READY_TO_BOOT_INDICATOR_VAR_ATTR DXE_PHASE_INDICATOR_ATTR 30 | 31 | #endif // _DXE_PHASE_VARIABLES_H_ 32 | -------------------------------------------------------------------------------- /MsvmPkg/Include/IsolationTypes.h: -------------------------------------------------------------------------------- 1 | /** @file 2 | This file contains types and constants describing VM isolation. 3 | 4 | Copyright (c) Microsoft Corporation. 5 | SPDX-License-Identifier: BSD-2-Clause-Patent 6 | 7 | **/ 8 | 9 | #pragma once 10 | 11 | enum 12 | { 13 | UefiIsolationTypeNone = 0x00, 14 | UefiIsolationTypeVbs = 0x01, 15 | UefiIsolationTypeSnp = 0x02, 16 | UefiIsolationTypeTdx = 0x03, 17 | }; 18 | 19 | UINT32 20 | GetIsolationType(); 21 | 22 | BOOLEAN 23 | IsParavisorPresent(); 24 | 25 | BOOLEAN 26 | IsIsolatedEx( 27 | UINT32 IsolationType 28 | ); 29 | 30 | BOOLEAN 31 | IsIsolated(); 32 | 33 | BOOLEAN 34 | IsHardwareIsolatedEx( 35 | UINT32 IsolationType 36 | ); 37 | 38 | BOOLEAN 39 | IsHardwareIsolated(); 40 | 41 | BOOLEAN 42 | IsSoftwareIsolatedEx( 43 | UINT32 IsolationType 44 | ); 45 | 46 | BOOLEAN 47 | IsSoftwareIsolated(); 48 | 49 | BOOLEAN 50 | IsHardwareIsolatedNoParavisorEx( 51 | UINT32 IsolationType, 52 | BOOLEAN IsParavisorPresent 53 | ); 54 | 55 | BOOLEAN 56 | IsHardwareIsolatedNoParavisor(); -------------------------------------------------------------------------------- /MsvmPkg/Include/Library/BiosDeviceLib.h: -------------------------------------------------------------------------------- 1 | /** 2 | 3 | \copyright Copyright (c) Microsoft Corporation 4 | 5 | \file BiosDeviceLib.h 6 | 7 | \brief Library functions to access BIOS VDev config registers 8 | 9 | **/ 10 | 11 | #pragma once 12 | 13 | VOID WriteBiosDevice(UINT32 AddressRegisterValue, UINT32 DataRegisterValue); 14 | 15 | UINT32 ReadBiosDevice(UINT32 AddressRegisterValue); 16 | 17 | -------------------------------------------------------------------------------- /MsvmPkg/Include/Library/BootEventLogLib.h: -------------------------------------------------------------------------------- 1 | /** @file 2 | Library wrapper around EFI_EVENTLOG_PROTOCOL for logging boot events 3 | 4 | Copyright (c) Microsoft Corporation. 5 | SPDX-License-Identifier: BSD-2-Clause-Patent 6 | --*/ 7 | 8 | #pragma once 9 | 10 | #include 11 | 12 | #include 13 | 14 | extern EFI_GUID gBootEventChannelGuid; 15 | 16 | 17 | EFI_STATUS 18 | EFIAPI 19 | BootEventLogLibInit( 20 | IN EFI_HANDLE ImageHandle, 21 | IN EFI_SYSTEM_TABLE *SystemTable 22 | ); 23 | 24 | 25 | EFI_STATUS 26 | EFIAPI 27 | BootDeviceEventStart( 28 | IN const EFI_DEVICE_PATH_PROTOCOL *DevicePath, 29 | UINT16 BootVariableNumber, 30 | BOOT_DEVICE_STATUS Status, 31 | EFI_STATUS ExtendedStatus 32 | ); 33 | 34 | 35 | EFI_STATUS 36 | EFIAPI 37 | BootDeviceEventUpdate( 38 | BOOT_DEVICE_STATUS Status, 39 | EFI_STATUS ExtendedStatus 40 | ); 41 | 42 | 43 | EFI_STATUS 44 | EFIAPI 45 | BootDeviceEventPendingStatus( 46 | OUT BOOT_DEVICE_STATUS *Status, 47 | OUT EFI_STATUS *ExtendedStatus 48 | ); 49 | 50 | 51 | EFI_STATUS 52 | EFIAPI 53 | BootDeviceEventComplete( 54 | VOID 55 | ); 56 | 57 | 58 | EFI_STATUS 59 | EFIAPI 60 | BootDeviceEventResetLog( 61 | VOID 62 | ); 63 | 64 | 65 | EFI_STATUS 66 | EFIAPI 67 | BootDeviceEventFlushLog( 68 | VOID 69 | ); 70 | 71 | 72 | EFI_STATUS 73 | EFIAPI 74 | BootDeviceEventStatistics( 75 | OUT EVENT_CHANNEL_STATISTICS *Stats 76 | ); 77 | 78 | 79 | EFI_STATUS 80 | EFIAPI 81 | BootDeviceEventEnumerate( 82 | IN EFI_EVENTLOG_ENUMERATE_CALLBACK Callback, 83 | IN const VOID *Context 84 | ); -------------------------------------------------------------------------------- /MsvmPkg/Include/Library/ConfigLib.h: -------------------------------------------------------------------------------- 1 | /** @file 2 | A library to simplify access to virtual machine configuration information. 3 | 4 | Copyright (c) Microsoft Corporation. 5 | SPDX-License-Identifier: BSD-2-Clause-Patent 6 | 7 | **/ 8 | 9 | #pragma once 10 | 11 | #include 12 | #include 13 | 14 | typedef 15 | UINT32 16 | (CONFIG_GET_UINT32)( 17 | void 18 | ); 19 | 20 | typedef 21 | UINT64 22 | (CONFIG_GET_UINT64)( 23 | void 24 | ); 25 | 26 | typedef 27 | void* 28 | (CONFIG_GET_PTR)( 29 | void 30 | ); 31 | 32 | typedef 33 | CHAR8* 34 | (CONFIG_GET_STRING)( 35 | void 36 | ); 37 | 38 | typedef 39 | EFI_GUID* 40 | (CONFIG_GET_GUID)( 41 | void 42 | ); 43 | 44 | typedef 45 | BOOLEAN 46 | (CONFIG_GET_BOOLEAN)( 47 | void 48 | ); 49 | 50 | typedef 51 | void 52 | (CONFIG_SET_UINT64)( 53 | UINT64 Value 54 | ); 55 | 56 | enum 57 | { 58 | ConfigLibEntropyDataSize = BiosInterfaceEntropyTableSize, 59 | ConfigLibSmbiosStringMax = BiosInterfaceSmbiosStringMax, 60 | ConfigLibSmbiosV24CpuInfoSize = sizeof(SMBIOS_CPU_INFORMATION) 61 | }; 62 | 63 | CONFIG_GET_UINT32 GetNfitSize; 64 | CONFIG_SET_UINT64 GetNfit; 65 | CONFIG_SET_UINT64 SetVpmemACPIBuffer; 66 | CONFIG_SET_UINT64 SetGenerationIdAddress; -------------------------------------------------------------------------------- /MsvmPkg/Include/Library/CrashDumpAgentLib.h: -------------------------------------------------------------------------------- 1 | /** @file 2 | The Crash Dump Agent Library provide crash dump generation in the event of an 3 | unrecoverable error. 4 | 5 | **/ 6 | #ifndef __CRASH_DUMP_AGENT_LIB_H__ 7 | #define __CRASH_DUMP_AGENT_LIB_H__ 8 | 9 | 10 | /** 11 | Called to initialize the crash dump agent. 12 | 13 | @param[in] HobList Pointer to the HOB list. 14 | 15 | **/ 16 | VOID 17 | EFIAPI 18 | InitializeCrashDumpAgent( 19 | IN VOID *HobList 20 | ); 21 | 22 | 23 | /** 24 | Called when a fatal error is detected and the system cannot continue. 25 | It is not expected that this function returns. 26 | 27 | @param BugCheckCode Reason for the fatal error. 28 | @param Param1 Bugcheck code specific parameter. 29 | @param Param2 Bugcheck code specific parameter. 30 | @param Param3 Bugcheck code specific parameter. 31 | @param Param4 Bugcheck code specific parameter. 32 | 33 | **/ 34 | VOID 35 | EFIAPI 36 | EfiBugCheck( 37 | IN UINT32 BugCheckCode, 38 | IN UINTN Param1, 39 | IN UINTN Param2, 40 | IN UINTN Param3, 41 | IN UINTN Param4 42 | ); 43 | 44 | #endif // __CRASH_DUMP_AGENT_LIB_H__ -------------------------------------------------------------------------------- /MsvmPkg/Include/Library/CrashLib.h: -------------------------------------------------------------------------------- 1 | /** @file 2 | 3 | This file contains the code to fail fast. 4 | 5 | Copyright (c) Microsoft Corporation. 6 | SPDX-License-Identifier: BSD-2-Clause-Patent 7 | **/ 8 | 9 | #pragma once 10 | 11 | #define FAIL_FAST(EfiStatus, Description) \ 12 | FailFastFromMacro(EfiStatus, __FILE__, __LINE__, Description); 13 | 14 | #define FAIL_FAST_INITIALIZATION_FAILURE(EfiStatus) \ 15 | FAIL_FAST(EfiStatus, "Critical initialization failure"); 16 | 17 | #define FAIL_FAST_UNEXPECTED_HOST_BEHAVIOR() \ 18 | FAIL_FAST(EFI_SECURITY_VIOLATION, "Unexpected host behavior"); 19 | 20 | #define FAIL_FAST_UNEXPECTED_HOST_BEHAVIOR_IF_FALSE(Condition) \ 21 | if (!(Condition)) { FAIL_FAST_UNEXPECTED_HOST_BEHAVIOR() } \ 22 | 23 | VOID 24 | ReportCrash( 25 | IN UINTN Param0, 26 | IN UINTN Param1, 27 | IN UINTN Param2, 28 | IN UINTN MessageBuffer, 29 | IN UINTN MessageLength 30 | ); 31 | 32 | VOID 33 | ResetAfterCrash( 34 | IN UINTN ErrorCode, 35 | IN UINTN Param1, 36 | IN UINTN Param2 37 | ); 38 | 39 | /** 40 | Called when a fatal error is detected and the system cannot continue. 41 | It is not expected that this function returns. 42 | 43 | @param ErrorCode Bugcheck code 44 | @param Param1 Bugcheck code specific parameter. 45 | @param Param2 Bugcheck code specific parameter. 46 | @param Param3 Bugcheck code specific parameter. 47 | @param Param4 Bugcheck code specific parameter. 48 | 49 | **/ 50 | VOID 51 | FailFast( 52 | IN UINTN ErrorCode, 53 | IN UINTN Param1, 54 | IN UINTN Param2, 55 | IN UINTN MessageBuffer, 56 | IN UINTN MessageLength 57 | ); 58 | 59 | VOID 60 | FailFastFromMacro( 61 | IN UINTN ErrorCode, 62 | IN CONST CHAR8 * Component, 63 | IN UINTN Line, 64 | IN CONST CHAR8 * Description 65 | ); -------------------------------------------------------------------------------- /MsvmPkg/Include/Library/EmclLib.h: -------------------------------------------------------------------------------- 1 | /** @file 2 | Utility functions for EMCL. 3 | 4 | Copyright (c) Microsoft Corporation. 5 | SPDX-License-Identifier: BSD-2-Clause-Patent 6 | --*/ 7 | 8 | #pragma once 9 | 10 | 11 | EFI_STATUS 12 | EFIAPI 13 | EmclInstallProtocol ( 14 | IN EFI_HANDLE ControllerHandle 15 | ); 16 | 17 | VOID 18 | EFIAPI 19 | EmclUninstallProtocol ( 20 | IN EFI_HANDLE ControllerHandle 21 | ); 22 | 23 | EFI_STATUS 24 | EFIAPI 25 | EmclSendPacketSync ( 26 | IN EFI_EMCL_PROTOCOL *This, 27 | IN VOID *InlineBuffer, 28 | IN UINT32 InlineBufferLength, 29 | IN EFI_EXTERNAL_BUFFER *ExternalBuffers, 30 | IN UINT32 ExternalBufferCount 31 | ); 32 | 33 | EFI_STATUS 34 | EmclChannelTypeSupported ( 35 | IN EFI_HANDLE ControllerHandle, 36 | IN const EFI_GUID *ChannelType, 37 | IN EFI_HANDLE AgentHandle 38 | ); 39 | 40 | EFI_STATUS 41 | EmclChannelTypeAndInstanceSupported ( 42 | IN EFI_HANDLE ControllerHandle, 43 | IN const EFI_GUID *ChannelType, 44 | IN EFI_HANDLE AgentHandle, 45 | IN const EFI_GUID *ChannelInstance OPTIONAL 46 | ); -------------------------------------------------------------------------------- /MsvmPkg/Include/Library/EventLogLib.h: -------------------------------------------------------------------------------- 1 | /** @file 2 | Library wrapper around EFI_EVENTLOG_PROTOCOL 3 | 4 | Copyright (c) Microsoft Corporation. 5 | SPDX-License-Identifier: BSD-2-Clause-Patent 6 | --*/ 7 | 8 | #pragma once 9 | 10 | #include 11 | 12 | EFI_STATUS 13 | EFIAPI 14 | EventLogChannelCreate( 15 | IN const EFI_GUID *Channel, 16 | IN OPTIONAL EVENT_CHANNEL_INFO *Attributes, 17 | OUT OPTIONAL EFI_HANDLE *Handle 18 | ); 19 | 20 | 21 | EFI_STATUS 22 | EFIAPI 23 | EventLogChannelOpen( 24 | IN const EFI_GUID *Channel, 25 | OUT OPTIONAL EFI_HANDLE *Handle 26 | ); 27 | 28 | 29 | EFI_STATUS 30 | EFIAPI 31 | EventLogLib( 32 | IN const EFI_HANDLE Channel, 33 | UINT32 Flags, 34 | const UINT32 EventId, 35 | const UINT32 DataSize, 36 | IN OPTIONAL const VOID *Data 37 | ); 38 | 39 | 40 | EFI_STATUS 41 | EFIAPI 42 | EventLogPendingGet( 43 | IN const EFI_HANDLE Channel, 44 | OUT EFI_EVENT_DESCRIPTOR *Metadata, 45 | OUT VOID **Data 46 | ); 47 | 48 | 49 | EFI_STATUS 50 | EFIAPI 51 | EventLogPendingCommit( 52 | IN const EFI_HANDLE Channel 53 | ); 54 | 55 | 56 | EFI_STATUS 57 | EFIAPI 58 | EventLogFlush( 59 | IN const EFI_HANDLE Channel 60 | ); 61 | 62 | 63 | EFI_STATUS 64 | EFIAPI 65 | EventLogReset( 66 | IN const EFI_HANDLE Channel 67 | ); 68 | 69 | 70 | EFI_STATUS 71 | EFIAPI 72 | EventLogStatistics( 73 | IN const EFI_HANDLE Channel, 74 | OUT EVENT_CHANNEL_STATISTICS *Stats 75 | ); 76 | 77 | 78 | typedef 79 | BOOLEAN 80 | (EFIAPI *EFI_EVENTLOG_ENUMERATE_CALLBACK)( 81 | IN VOID *Context, 82 | IN const EFI_EVENT_DESCRIPTOR *Metadata, 83 | IN const VOID *Event 84 | ); 85 | 86 | 87 | EFI_STATUS 88 | EFIAPI 89 | EventLogEnumerate( 90 | IN const EFI_HANDLE Channel, 91 | IN EFI_EVENTLOG_ENUMERATE_CALLBACK Callback, 92 | IN const VOID *Context 93 | ); -------------------------------------------------------------------------------- /MsvmPkg/Include/Library/GhcbLib.h: -------------------------------------------------------------------------------- 1 | /** @file 2 | Definitions for functionality available through GHCB calls to the host. 3 | 4 | Copyright (c) Microsoft Corporation. 5 | SPDX-License-Identifier: BSD-2-Clause-Patent 6 | **/ 7 | 8 | #pragma once 9 | 10 | /*++ 11 | 12 | Routine Description: 13 | 14 | This routine executes the VMGEXIT instruction. 15 | 16 | Arguments: 17 | 18 | None. 19 | 20 | Return Value: 21 | 22 | None. 23 | 24 | --*/ 25 | VOID 26 | _sev_vmgexit( 27 | VOID 28 | ); 29 | 30 | 31 | /*++ 32 | 33 | Routine Description: 34 | 35 | This routine initializes the GHCB on an SNP system. 36 | 37 | Arguments: 38 | 39 | None. 40 | 41 | Return Value: 42 | 43 | Pointer to the GHCB. 44 | 45 | --*/ 46 | VOID* 47 | GhcbInitializeGhcb( 48 | VOID 49 | ); 50 | 51 | 52 | /*++ 53 | 54 | Routine Description: 55 | 56 | This routine writes an MSR using the GHCB protocol. 57 | 58 | Arguments: 59 | 60 | Ghcb - Supplies a pointer to the GHCB. 61 | 62 | MsrNumber - Supplies the MSR number. 63 | 64 | RegisterValue - Supplies the value to write to the MSR. 65 | 66 | Return Value: 67 | 68 | None. 69 | 70 | --*/ 71 | VOID 72 | GhcbWriteMsr( 73 | IN VOID *Ghcb, 74 | UINT64 MsrNumber, 75 | UINT64 RegisterValue 76 | ); 77 | 78 | 79 | /*++ 80 | 81 | Routine Description: 82 | 83 | This routine reads an MSR using the GHCB protocol. 84 | 85 | Arguments: 86 | 87 | Ghcb - Supplies a pointer to the GHCB. 88 | 89 | MsrNumber - Supplies the MSR number. 90 | 91 | RegisterValue - Supplies a pointer to a variable that will receive the 92 | value of the MSR. 93 | 94 | Return Value: 95 | 96 | None. 97 | 98 | --*/ 99 | VOID 100 | GhcbReadMsr( 101 | IN VOID *Ghcb, 102 | UINT64 MsrNumber, 103 | OUT UINT64 *RegisterValue 104 | ); 105 | -------------------------------------------------------------------------------- /MsvmPkg/Include/Library/MmioAllocationLib.h: -------------------------------------------------------------------------------- 1 | /** @file 2 | MMIO allocation library declarations 3 | 4 | Copyright (c) Microsoft Corporation. 5 | SPDX-License-Identifier: BSD-2-Clause-Patent 6 | --*/ 7 | 8 | #pragma once 9 | 10 | #include 11 | 12 | // 13 | // \brief Allocate Mmio space from one of the mmio gaps, either high or low. 14 | // 15 | // \param[in] NumberOfPages The number of pages to allocate from the mmio gap 16 | // 17 | // \return A pointer to the region of mmio space, or NULL on failure. 18 | // 19 | VOID* 20 | AllocateMmioPages(UINT64 NumberOfPages); -------------------------------------------------------------------------------- /MsvmPkg/Include/Library/MsLogoLib.h: -------------------------------------------------------------------------------- 1 | /** @file 2 | MsLogoLib library definition. 3 | 4 | Copyright (c) 2011 - 2013, Intel Corporation. All rights reserved. 5 | Copyright (c) Microsoft Corporation. 6 | SPDX-License-Identifier: BSD-2-Clause-Patent 7 | --*/ 8 | 9 | 10 | #ifndef _MS_LOGO_LIB_H_ 11 | #define _MS_LOGO_LIB_H_ 12 | 13 | /** 14 | Use SystemTable ConOut to stop video based Simple Text Out consoles from going 15 | to the video device. Put up LogoFile on every video device that is a console. 16 | 17 | @param[in] LogoFile The file name of logo to display on the center of the screen. 18 | 19 | @retval EFI_SUCCESS ConsoleControl has been flipped to graphics and logo displayed. 20 | @retval EFI_UNSUPPORTED Logo not found. 21 | 22 | **/ 23 | EFI_STATUS 24 | EFIAPI 25 | EnableQuietBoot ( 26 | IN EFI_GUID *LogoFile 27 | ); 28 | 29 | 30 | /** 31 | Use SystemTable ConOut to turn on video based Simple Text Out consoles. The 32 | Simple Text Out screens will now be synced up with all non-video output devices. 33 | 34 | @retval EFI_SUCCESS UGA devices are back in text mode and synced up. 35 | 36 | **/ 37 | EFI_STATUS 38 | EFIAPI 39 | DisableQuietBoot ( 40 | VOID 41 | ); 42 | 43 | /** 44 | This function will change video resolution and text mode 45 | according to defined setup mode or defined boot mode 46 | 47 | @param IsVgaMode TRUE, set to VGA 800x600 mode. FALSE, set to maximum native mode 48 | 49 | @retval EFI_SUCCESS Mode is changed successfully. 50 | @retval Others Mode failed to be changed. 51 | 52 | **/ 53 | EFI_STATUS 54 | EFIAPI 55 | MsLogoLibSetConsoleMode ( 56 | BOOLEAN IsVgaMode, 57 | BOOLEAN DrawLogo 58 | ); 59 | 60 | #endif 61 | 62 | -------------------------------------------------------------------------------- /MsvmPkg/Include/Library/MsPlatBdsLib.h: -------------------------------------------------------------------------------- 1 | /** @file 2 | Platform BDS library definition. A platform can implement 3 | instances to support platform-specific behavior. 4 | 5 | Copyright (c) 2008 - 2010, Intel Corporation. All rights reserved. 6 | Copyright (c) Microsoft Corporation. 7 | SPDX-License-Identifier: BSD-2-Clause-Patent 8 | --*/ 9 | 10 | #ifndef __MS_PLAT_BDS_LIB_H_ 11 | #define __MS_PLAT_BDS_LIB_H_ 12 | 13 | /** 14 | Platform Bds initialization. Includes the platform firmware vendor, revision 15 | and so crc check. 16 | 17 | **/ 18 | VOID 19 | EFIAPI 20 | PlatformBdsInit ( 21 | VOID 22 | ); 23 | 24 | #endif 25 | -------------------------------------------------------------------------------- /MsvmPkg/Include/Library/WatchdogTimerLib.h: -------------------------------------------------------------------------------- 1 | /** @file 2 | This module contains code to interact with the Hyper-V watchdog timer. 3 | 4 | Copyright (c) Microsoft Corporation. 5 | SPDX-License-Identifier: BSD-2-Clause-Patent 6 | **/ 7 | 8 | #pragma once 9 | 10 | typedef enum 11 | { 12 | // 13 | // Watchdog is disabled. This should only be used with a count 14 | // value of zero. 15 | // 16 | WatchdogDisabled, 17 | // 18 | // The count represents the amount of time before the timer will 19 | // expired. 20 | // 21 | WatchdogOneShot, 22 | // 23 | // The hardware timer will run periodically and decrement the count. 24 | // The timer is expired when the count reaches zero. 25 | // When used in periodic mode there is normally a periodic entity in 26 | // UEFI that will reset the count to its original value. 27 | // 28 | WatchdogPeriodic 29 | } WATCHDOG_MODE; 30 | 31 | 32 | VOID 33 | WatchdogConfigure( 34 | UINT32 Count, 35 | WATCHDOG_MODE Mode 36 | ); 37 | 38 | 39 | VOID 40 | WatchdogSetCount( 41 | UINT32 Count 42 | ); 43 | 44 | 45 | UINT32 46 | WatchdogGetResolution(); 47 | 48 | 49 | BOOLEAN 50 | WatchdogSuspend(); 51 | 52 | 53 | VOID 54 | WatchdogResume( 55 | BOOLEAN PreviouslyRunning 56 | ); -------------------------------------------------------------------------------- /MsvmPkg/Include/MsvmBase.h: -------------------------------------------------------------------------------- 1 | /** @file 2 | Macros, etc. 3 | 4 | Copyright (c) Microsoft Corporation. 5 | SPDX-License-Identifier: BSD-2-Clause-Patent 6 | --*/ 7 | 8 | 9 | #define FIELD_SIZE(TYPE, Field) (sizeof(((TYPE *)0)->Field)) 10 | 11 | #define SIZEOF_THROUGH_FIELD(TYPE, Field) \ 12 | (OFFSET_OF(TYPE, Field) + FIELD_SIZE(TYPE, Field)) 13 | 14 | // 15 | // CONTAINS_FIELD usage: 16 | // 17 | // if (CONTAINS_FIELD(pBlock, pBlock->cbSize, dwMumble)) { // safe to use pBlock->dwMumble 18 | // 19 | #define CONTAINS_FIELD(Struct, Size, Field) \ 20 | ( (((INT8*)(&(Struct)->Field)) + sizeof((Struct)->Field)) <= (((INT8*)(Struct))+(Size)) ) -------------------------------------------------------------------------------- /MsvmPkg/Include/Protocol/SynthKeyProtocol.h: -------------------------------------------------------------------------------- 1 | /** @file 2 | Definitions of the keyboard message structures used by 3 | the synthetic keyboard device and its VSC. 4 | 5 | Copyright (c) Microsoft Corporation. 6 | SPDX-License-Identifier: BSD-2-Clause-Patent 7 | --*/ 8 | 9 | #pragma once 10 | 11 | extern GUID gSyntheticKeyboardClassGuid; 12 | 13 | #define HK_MAKE_VERSION(Major, Minor) ((UINT32)(Major) << 16 | (UINT32)(Minor)) 14 | #define HK_VERSION_WIN8 HK_MAKE_VERSION(1, 0) 15 | 16 | typedef enum _HK_MESSAGE_TYPE 17 | { 18 | HkMessageProtocolRequest = 1, 19 | HkMessageProtocolResponse = 2, 20 | HkMessageEvent = 3, 21 | HkMessageSetLedIndicators = 4, 22 | } HK_MESSAGE_TYPE; 23 | 24 | typedef struct _HK_MESSAGE_HEADER 25 | { 26 | HK_MESSAGE_TYPE MessageType; 27 | } HK_MESSAGE_HEADER, *PHK_MESSAGE_HEADER; 28 | 29 | typedef struct _HK_MESSAGE_PROTOCOL_REQUEST 30 | { 31 | HK_MESSAGE_HEADER Header; 32 | UINT32 Version; 33 | } HK_MESSAGE_PROTOCOL_REQUEST, *PHK_MESSAGE_PROTOCOL_REQUEST; 34 | 35 | typedef struct _HK_MESSAGE_LED_INDICATORS_STATE 36 | { 37 | HK_MESSAGE_HEADER Header; 38 | UINT16 LedFlags; 39 | } HK_MESSAGE_LED_INDICATORS_STATE, *PHK_MESSAGE_LED_INDICATORS_STATE; 40 | 41 | typedef struct _HK_MESSAGE_PROTOCOL_RESPONSE 42 | { 43 | HK_MESSAGE_HEADER Header; 44 | UINT32 Accepted:1; 45 | UINT32 Reserved:31; 46 | } HK_MESSAGE_PROTOCOL_RESPONSE, *PHK_MESSAGE_PROTOCOL_RESPONSE; 47 | 48 | typedef struct _HK_MESSAGE_KEYSTROKE 49 | { 50 | HK_MESSAGE_HEADER Header; 51 | UINT16 MakeCode; 52 | UINT32 IsUnicode:1; 53 | UINT32 IsBreak:1; 54 | UINT32 IsE0:1; 55 | UINT32 IsE1:1; 56 | UINT32 Reserved:28; 57 | } HK_MESSAGE_KEYSTROKE, *PHK_MESSAGE_KEYSTROKE; 58 | 59 | #define HK_MAXIMUM_MESSAGE_SIZE 256 60 | 61 | -------------------------------------------------------------------------------- /MsvmPkg/Include/Uefi/MsUefiInternalFormRepresentationEx.h: -------------------------------------------------------------------------------- 1 | /** @file 2 | UEFI FormsBrowser Extensions. 3 | 4 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 5 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 6 | 7 | **/ 8 | 9 | #ifndef __MS_UEFI_CHECKBOX_H__ 10 | #define __MS_UEFI_CHECKBOX_H__ 11 | 12 | // Ordered List extensions 13 | #define EMBEDDED_CHECKBOX ((UINT8) 0x80) 14 | #define EMBEDDED_DELETE ((UINT8) 0x40) 15 | 16 | // The input/output value of a UINT32 value array when the EMBEDDED extensions are use does the following: 17 | // -- The low 16 bits represent the boot option value for the menu item 18 | // -- On input, the CHECKBOX_VALUE is the LOAD_OPTION_ACTIVE bit. 19 | // -- On output, the CHECKBOX_VALUE is used to set the LOAD_OPTION_ACTIVE bit. 20 | // -- On input only, ALLOW_DELETE_VALUE is used to tell Listbox that an entry is allowed to be deleted. 21 | // -- On output only, the BOOT_VALUE is used to tell the boot menu code to boot the selected item. 22 | #define ORDERED_LIST_CHECKBOX_VALUE_32 ((UINT32)0x01000000) // Currently, only value type UINT32 is supported 23 | #define ORDERED_LIST_ALLOW_DELETE_VALUE_32 ((UINT32)0x02000000) // Currently, only value type UINT32 is supported 24 | #define ORDERED_LIST_BOOT_VALUE_32 ((UINT32)0x80000000) // Currently, only value type UINT32 is supported 25 | 26 | #endif 27 |  -------------------------------------------------------------------------------- /MsvmPkg/Include/UefiConstants.h: -------------------------------------------------------------------------------- 1 | /** @file 2 | 3 | This file contains constants used in UEFI. 4 | 5 | Copyright (c) Microsoft Corporation. 6 | SPDX-License-Identifier: BSD-2-Clause-Patent 7 | **/ 8 | 9 | #pragma once 10 | 11 | enum 12 | { 13 | ConfigLibConsoleModeDefault = 0, // video+kbd (having a head) 14 | ConfigLibConsoleModeCOM1 = 1, // headless with COM1 serial console 15 | ConfigLibConsoleModeCOM2 = 2, // headless with COM2 serial console 16 | ConfigLibConsoleModeNone = 3 // headless 17 | }; 18 | 19 | enum 20 | { 21 | ConfigLibMemoryProtectionModeDisabled = 0, // MEMORY_PROTECTION_SETTINGS_OFF 22 | ConfigLibMemoryProtectionModeDefault = 1, // MEMORY_PROTECTION_SETTINGS_SHIP_MODE 23 | ConfigLibMemoryProtectionModeStrict = 2, // MEMORY_PROTECTION_SETTINGS_DEBUG 24 | ConfigLibMemoryProtectionModeRelaxed = 3, // MEMORY_PROTECTION_SETTINGS_SHIP_MODE with fewer checks 25 | }; -------------------------------------------------------------------------------- /MsvmPkg/Include/VirtualDeviceId.h: -------------------------------------------------------------------------------- 1 | /** @file 2 | 3 | Defines unique IDs for each device 4 | 5 | Copyright (c) Microsoft Corporation. 6 | SPDX-License-Identifier: BSD-2-Clause-Patent 7 | **/ 8 | 9 | #pragma once 10 | 11 | extern GUID gSyntheticKeyboardClassGuid; 12 | extern GUID gSyntheticVideoClassGuid; 13 | extern GUID gSynthetic3dVideoClassGuid; 14 | -------------------------------------------------------------------------------- /MsvmPkg/Include/Vmbus/NtStatus.h: -------------------------------------------------------------------------------- 1 | /** @file 2 | Just enough for VmBus protocol handling. 3 | 4 | Copyright (c) Microsoft Corporation. 5 | SPDX-License-Identifier: BSD-2-Clause-Patent 6 | **/ 7 | 8 | #pragma once 9 | 10 | 11 | typedef long NTSTATUS; 12 | #define NT_SUCCESS(Status) (((NTSTATUS)(Status)) >= 0) 13 | 14 | // 15 | // MessageId: STATUS_REVISION_MISMATCH 16 | // 17 | // MessageText: 18 | // 19 | // Indicates two revision levels are incompatible. 20 | // 21 | #define STATUS_REVISION_MISMATCH ((NTSTATUS)0xC0000059L) 22 | 23 | -------------------------------------------------------------------------------- /MsvmPkg/Library/BiosDeviceDebugLib/BiosDeviceDebugLib.inf: -------------------------------------------------------------------------------- 1 | ## @file 2 | # Instance of Debug Library that intercepts to the Hyper-V BiosDevice. 3 | # It uses Print Library to produce formatted output strings. 4 | # 5 | # Copyright (c) Microsoft Corporation. 6 | # SPDX-License-Identifier: BSD-2-Clause-Patent 7 | # 8 | ## 9 | 10 | [Defines] 11 | INF_VERSION = 0x00010005 12 | BASE_NAME = BiosDeviceDebugLib 13 | FILE_GUID = 156a30e1-eefb-404d-9b28-2103ca42a6ee 14 | MODULE_TYPE = BASE 15 | VERSION_STRING = 1.0 16 | LIBRARY_CLASS = DebugLib 17 | 18 | [Sources] 19 | DebugLib.c 20 | 21 | [Packages] 22 | MdePkg/MdePkg.dec 23 | MsvmPkg/MsvmPkg.dec 24 | 25 | [LibraryClasses] 26 | BaseLib 27 | BaseMemoryLib 28 | DebugPrintErrorLevelLib 29 | IoLib 30 | PcdLib 31 | PrintLib 32 | 33 | [Pcd] 34 | gEfiMdePkgTokenSpaceGuid.PcdDebugPrintErrorLevel ## CONSUMES 35 | gMsvmPkgTokenSpaceGuid.PcdBiosBaseAddress 36 | -------------------------------------------------------------------------------- /MsvmPkg/Library/BiosDeviceLib/BiosDeviceLib.inf: -------------------------------------------------------------------------------- 1 | ## @file 2 | # Library functions to access the BiosDevice registers 3 | # 4 | # Copyright (c) Microsoft Corporation. 5 | # SPDX-License-Identifier: BSD-2-Clause-Patent 6 | # 7 | ## 8 | 9 | [Defines] 10 | INF_VERSION = 0x00010005 11 | BASE_NAME = BiosDeviceLib 12 | FILE_GUID = c1009b62-fbb0-457f-a919-4b8de5711377 13 | MODULE_TYPE = BASE 14 | VERSION_STRING = 1.0 15 | LIBRARY_CLASS = BiosDeviceLib 16 | CONSTRUCTOR = BiosDeviceLibConstructor 17 | 18 | [Sources] 19 | BiosDeviceLibCore.c 20 | BiosDeviceLibSetup.c 21 | 22 | [LibraryClasses] 23 | IoLib 24 | PcdLib 25 | 26 | [Packages] 27 | MdePkg/MdePkg.dec 28 | MsvmPkg/MsvmPkg.dec 29 | 30 | [Pcd] 31 | gMsvmPkgTokenSpaceGuid.PcdBiosBaseAddress 32 | -------------------------------------------------------------------------------- /MsvmPkg/Library/BiosDeviceLib/BiosDeviceLibCore.c: -------------------------------------------------------------------------------- 1 | /** @file 2 | Library for accessing the BiosDevice emulated device registers. 3 | Abstracts away the type of IO required from callers. 4 | 5 | Copyright (c) Microsoft Corporation. 6 | SPDX-License-Identifier: BSD-2-Clause-Patent 7 | --*/ 8 | 9 | #include 10 | #include 11 | #include 12 | #include 13 | 14 | // Use MMIO access on ARM64 otherwise use IO access 15 | #if defined(MDE_CPU_AARCH64) 16 | #define _USING_BIOS_MMIO_ 1 17 | #elif defined(MDE_CPU_X64) 18 | #define _USING_BIOS_MMIO_ 0 19 | #else 20 | #error Unsupported Architecture 21 | #endif 22 | 23 | // Physical and virtual device base address 24 | UINTN mBiosBaseAddressGpa = 0; 25 | UINTN mBiosBaseAddress = 0; 26 | 27 | VOID 28 | SetupBaseAddress() 29 | { 30 | mBiosBaseAddressGpa = (UINTN)PcdGet32(PcdBiosBaseAddress); 31 | mBiosBaseAddress = mBiosBaseAddressGpa; 32 | } 33 | 34 | VOID 35 | WriteBiosDevice( 36 | IN UINT32 AddressRegisterValue, 37 | IN UINT32 DataRegisterValue 38 | ) 39 | { 40 | #if _USING_BIOS_MMIO_ 41 | MmioWrite32(mBiosBaseAddress, AddressRegisterValue); 42 | MmioWrite32(mBiosBaseAddress + 4, DataRegisterValue); 43 | #else 44 | IoWrite32(mBiosBaseAddress, AddressRegisterValue); 45 | IoWrite32(mBiosBaseAddress + 4, DataRegisterValue); 46 | #endif 47 | } 48 | 49 | UINT32 50 | ReadBiosDevice( 51 | IN UINT32 AddressRegisterValue 52 | ) 53 | { 54 | #if _USING_BIOS_MMIO_ 55 | MmioWrite32(mBiosBaseAddress, AddressRegisterValue); 56 | return MmioRead32(mBiosBaseAddress + 4); 57 | #else 58 | IoWrite32(mBiosBaseAddress, AddressRegisterValue); 59 | return IoRead32(mBiosBaseAddress + 4); 60 | #endif 61 | } 62 | -------------------------------------------------------------------------------- /MsvmPkg/Library/BiosDeviceLib/BiosDeviceLibSetup.c: -------------------------------------------------------------------------------- 1 | /** @file 2 | Library setup for BiosDeviceLib 3 | 4 | Copyright (c) Microsoft Corporation. 5 | SPDX-License-Identifier: BSD-2-Clause-Patent 6 | --*/ 7 | 8 | #include 9 | 10 | #include 11 | #include 12 | 13 | // Use MMIO access on ARM64 otherwise use IO access 14 | #if defined(MDE_CPU_AARCH64) 15 | #define _USING_BIOS_MMIO_ 1 16 | #elif defined(MDE_CPU_X64) 17 | #define _USING_BIOS_MMIO_ 0 18 | #else 19 | #error Unsupported Architecture 20 | #endif 21 | 22 | extern UINTN mBiosBaseAddress; 23 | extern void SetupBaseAddress(); 24 | 25 | EFI_STATUS 26 | EFIAPI 27 | BiosDeviceLibConstructor ( 28 | VOID 29 | ) 30 | { 31 | EFI_STATUS status = EFI_SUCCESS; 32 | 33 | SetupBaseAddress(); 34 | 35 | return status; 36 | } -------------------------------------------------------------------------------- /MsvmPkg/Library/BiosDeviceLib/BiosDeviceRuntimeLib.inf: -------------------------------------------------------------------------------- 1 | ## @file 2 | # Library functions to access the BiosDevice registers 3 | # 4 | # Copyright (c) Microsoft Corporation. 5 | # SPDX-License-Identifier: BSD-2-Clause-Patent 6 | # 7 | ## 8 | 9 | [Defines] 10 | INF_VERSION = 0x00010005 11 | BASE_NAME = BiosDeviceRuntimeLib 12 | FILE_GUID = 8bf88f91-c656-4dc0-94f6-ec1119d56a53 13 | MODULE_TYPE = DXE_RUNTIME_DRIVER 14 | VERSION_STRING = 1.0 15 | LIBRARY_CLASS = BiosDeviceLib | DXE_RUNTIME_DRIVER 16 | CONSTRUCTOR = BiosDeviceRuntimeLibConstructor 17 | DESTRUCTOR = BiosDeviceRuntimeLibDestructor 18 | 19 | [Sources] 20 | BiosDeviceLibCore.c 21 | BiosDeviceRuntimeLibSetup.c 22 | 23 | [LibraryClasses] 24 | IoLib 25 | PcdLib 26 | UefiBootServicesTableLib 27 | 28 | [LibraryClasses.AARCH64] 29 | DxeServicesTableLib 30 | 31 | [Packages] 32 | MdePkg/MdePkg.dec 33 | MsvmPkg/MsvmPkg.dec 34 | 35 | [Guids] 36 | gEfiEventVirtualAddressChangeGuid 37 | 38 | [Pcd] 39 | gMsvmPkgTokenSpaceGuid.PcdBiosBaseAddress 40 | -------------------------------------------------------------------------------- /MsvmPkg/Library/BiosDeviceLib/BiosDeviceRuntimeLibSetup.c: -------------------------------------------------------------------------------- 1 | /** @file 2 | Library setup for the runtime version of BiosDeviceLib 3 | 4 | Copyright (c) Microsoft Corporation. 5 | SPDX-License-Identifier: BSD-2-Clause-Patent 6 | --*/ 7 | 8 | #include 9 | 10 | #include 11 | #include 12 | #include 13 | 14 | // Use MMIO access on ARM64 otherwise use IO access 15 | #if defined(MDE_CPU_AARCH64) 16 | #define _USING_BIOS_MMIO_ 1 17 | #elif defined(MDE_CPU_X64) 18 | #define _USING_BIOS_MMIO_ 0 19 | #else 20 | #error Unsupported Architecture 21 | #endif 22 | 23 | extern UINTN mBiosBaseAddress; 24 | extern void SetupBaseAddress(); 25 | 26 | #if _USING_BIOS_MMIO_ 27 | 28 | // Event handle for virtual address change event 29 | EFI_EVENT mVirtualAddressChangeEvent = NULL; 30 | 31 | VOID 32 | EFIAPI 33 | BiosDeviceLibAddressChangeHandler( 34 | IN EFI_EVENT Event, 35 | IN void* Context 36 | ) 37 | { 38 | // Convert the virtual base address 39 | EFI_STATUS status = gST->RuntimeServices->ConvertPointer(0, (void**)&mBiosBaseAddress); 40 | ASSERT_EFI_ERROR(status); 41 | } 42 | 43 | #endif 44 | 45 | EFI_STATUS 46 | EFIAPI 47 | BiosDeviceRuntimeLibConstructor ( 48 | IN EFI_HANDLE ImageHandle, 49 | IN EFI_SYSTEM_TABLE *SystemTable 50 | ) 51 | { 52 | EFI_STATUS status = EFI_SUCCESS; 53 | 54 | SetupBaseAddress(); 55 | 56 | #if _USING_BIOS_MMIO_ 57 | 58 | status = gBS->CreateEventEx(EVT_NOTIFY_SIGNAL, 59 | TPL_NOTIFY, 60 | BiosDeviceLibAddressChangeHandler, 61 | NULL, 62 | &gEfiEventVirtualAddressChangeGuid, 63 | &mVirtualAddressChangeEvent); 64 | ASSERT_EFI_ERROR(status); 65 | 66 | #endif 67 | 68 | return status; 69 | } 70 | 71 | EFI_STATUS 72 | EFIAPI 73 | BiosDeviceRuntimeLibDestructor( 74 | IN EFI_HANDLE ImageHandle, 75 | IN EFI_SYSTEM_TABLE *SystemTable 76 | ) 77 | { 78 | 79 | #if _USING_BIOS_MMIO_ 80 | 81 | if (mVirtualAddressChangeEvent != NULL) { 82 | gBS->CloseEvent (mVirtualAddressChangeEvent); 83 | } 84 | #endif 85 | 86 | return EFI_SUCCESS; 87 | } 88 | -------------------------------------------------------------------------------- /MsvmPkg/Library/BootEventLogLib/BootEventLogLib.inf: -------------------------------------------------------------------------------- 1 | ## @file 2 | # Provides wrapper Boot Event Log entries using EFI_EVENTLOG_PROTOCOL 3 | # 4 | # Copyright (c) Microsoft Corporation. 5 | # SPDX-License-Identifier: BSD-2-Clause-Patent 6 | # 7 | ## 8 | 9 | [Defines] 10 | INF_VERSION = 0x00010016 11 | BASE_NAME = MsvmBootEventLogLib 12 | FILE_GUID = 6170063C-1FB6-4960-8353-BB8413E952B2 13 | MODULE_TYPE = DXE_DRIVER 14 | VERSION_STRING = 1.0 15 | LIBRARY_CLASS = BootEventLogLib|DXE_CORE DXE_DRIVER UEFI_APPLICATION UEFI_DRIVER 16 | CONSTRUCTOR = BootEventLogConstructor 17 | 18 | [Sources] 19 | BootEventLogLib.c 20 | 21 | [LibraryClasses] 22 | BaseLib 23 | BaseMemoryLib 24 | DebugLib 25 | EventLogLib 26 | MemoryAllocationLib 27 | PcdLib 28 | UefiBootServicesTableLib 29 | 30 | [Packages] 31 | MdePkg/MdePkg.dec 32 | MsvmPkg/MsvmPkg.dec 33 | 34 | [Guids] 35 | gBootEventChannelGuid ## CONSUMES ## GUID 36 | 37 | [Pcd] 38 | gMsvmPkgTokenSpaceGuid.PcdBootEventLogSize -------------------------------------------------------------------------------- /MsvmPkg/Library/BootEventLogLibNull/BootEventLogLibNull.inf: -------------------------------------------------------------------------------- 1 | ## @file 2 | # Provides wrapper Boot Event Log entries using EFI_EVENTLOG_PROTOCOL 3 | # 4 | # Copyright (c) Microsoft Corporation. 5 | # SPDX-License-Identifier: BSD-2-Clause-Patent 6 | # 7 | ## 8 | 9 | [Defines] 10 | INF_VERSION = 0x00010016 11 | BASE_NAME = MsvmBootEventLogLib 12 | FILE_GUID = 6170063C-1FB6-4960-8353-BB8413E952B2 13 | MODULE_TYPE = DXE_DRIVER 14 | VERSION_STRING = 1.0 15 | LIBRARY_CLASS = BootEventLogLib|DXE_CORE DXE_DRIVER UEFI_APPLICATION UEFI_DRIVER 16 | CONSTRUCTOR = BootEventLogConstructor 17 | 18 | [Sources] 19 | BootEventLogLibNull.c 20 | 21 | [LibraryClasses] 22 | BaseLib 23 | BaseMemoryLib 24 | DebugLib 25 | EventLogLib 26 | MemoryAllocationLib 27 | PcdLib 28 | UefiBootServicesTableLib 29 | 30 | [Packages] 31 | MdePkg/MdePkg.dec 32 | MsvmPkg/MsvmPkg.dec 33 | 34 | [Guids] 35 | gBootEventChannelGuid ## CONSUMES ## GUID 36 | 37 | [Pcd] 38 | gMsvmPkgTokenSpaceGuid.PcdBootEventLogSize -------------------------------------------------------------------------------- /MsvmPkg/Library/ConfigLib/ConfigLib.c: -------------------------------------------------------------------------------- 1 | /** @file 2 | Library that provides version agnostic access to virtual machine configuration. 3 | 4 | Copyright (c) Microsoft Corporation. 5 | SPDX-License-Identifier: BSD-2-Clause-Patent 6 | 7 | **/ 8 | 9 | #include 10 | #include 11 | #include 12 | #include 13 | 14 | #include 15 | 16 | UINT32 17 | GetNfitSize( 18 | void 19 | ) 20 | /*++ 21 | 22 | Routine Description: 23 | 24 | Returns the size of the NFIT. 25 | 26 | Arguments: 27 | 28 | None 29 | 30 | Return Value: 31 | 32 | The size of the NFIT. 33 | 34 | --*/ 35 | { 36 | return ReadBiosDevice(BiosConfigNfitSize); 37 | } 38 | 39 | void 40 | GetNfit( 41 | UINT64 Address 42 | ) 43 | /*++ 44 | 45 | Routine Description: 46 | 47 | Gets the NFIT. 48 | 49 | Arguments: 50 | 51 | Address - the GPA at which to write the NFIT table 52 | 53 | Return Value: 54 | 55 | None. 56 | 57 | --*/ 58 | { 59 | ASSERT((UINT64) Address < 0xFFFFFFFFULL); 60 | WriteBiosDevice(BiosConfigNfitPopulate, (UINT32) Address); 61 | } 62 | 63 | void 64 | SetVpmemACPIBuffer( 65 | UINT64 Address 66 | ) 67 | /*++ 68 | 69 | Routine Description: 70 | 71 | Sets the pointer to the VPMem ACPI Method Buffer. 72 | 73 | Arguments: 74 | 75 | None 76 | 77 | Return Value: 78 | 79 | None. 80 | 81 | --*/ 82 | { 83 | ASSERT((UINT64) Address < 0xFFFFFFFFULL); 84 | WriteBiosDevice(BiosConfigVpmemSetACPIBuffer, (UINT32) Address); 85 | } 86 | 87 | void 88 | SetGenerationIdAddress( 89 | UINT64 Value 90 | ) 91 | /*++ 92 | 93 | Routine Description: 94 | 95 | Communicates the Generation ID memory location to the BiosDevice. 96 | 97 | Arguments: 98 | 99 | Value - the GPA of the Generation ID 100 | 101 | Return Value: 102 | 103 | n/a 104 | 105 | --*/ 106 | { 107 | WriteBiosDevice(BiosConfigGenerationIdPtrLow, (UINT32)Value); 108 | WriteBiosDevice(BiosConfigGenerationIdPtrHigh, (UINT32)(Value >> 32)); 109 | } 110 | -------------------------------------------------------------------------------- /MsvmPkg/Library/ConfigLib/ConfigLib.inf: -------------------------------------------------------------------------------- 1 | ## @file 2 | # Config Library instance. 3 | # Simplifies access to virtual machine configuration information. 4 | # 5 | # Copyright (c) Microsoft Corporation. 6 | # SPDX-License-Identifier: BSD-2-Clause-Patent 7 | # 8 | ## 9 | 10 | [Defines] 11 | INF_VERSION = 0x00010016 12 | BASE_NAME = ConfigLib 13 | FILE_GUID = 0A0B5ED3-5BDA-4929-9C12-80DC1839C990 14 | MODULE_TYPE = DXE_DRIVER 15 | VERSION_STRING = 1.0 16 | LIBRARY_CLASS = ConfigLib 17 | 18 | [Sources] 19 | ConfigLib.c 20 | 21 | [LibraryClasses] 22 | BaseMemoryLib 23 | BiosDeviceLib 24 | DebugLib 25 | IoLib 26 | 27 | [Packages] 28 | MdePkg/MdePkg.dec 29 | MsvmPkg/MsvmPkg.dec 30 | -------------------------------------------------------------------------------- /MsvmPkg/Library/CpuExceptionHandlerLib/DxeCpuExceptionHandlerLib.uni: -------------------------------------------------------------------------------- 1 | // /** @file 2 | // CPU Exception Handler library instance for DXE modules. 3 | // 4 | // CPU Exception Handler library instance for DXE modules. 5 | // 6 | // Copyright (c) 2013 - 2014, Intel Corporation. All rights reserved.
7 | // 8 | // SPDX-License-Identifier: BSD-2-Clause-Patent 9 | // 10 | // **/ 11 | 12 | 13 | #string STR_MODULE_ABSTRACT #language en-US "CPU Exception Handler library instance for DXE modules." 14 | 15 | #string STR_MODULE_DESCRIPTION #language en-US "CPU Exception Handler library instance for DXE modules." 16 | 17 | -------------------------------------------------------------------------------- /MsvmPkg/Library/CpuExceptionHandlerLib/Ia32/ArchInterruptDefs.h: -------------------------------------------------------------------------------- 1 | /** @file 2 | Ia32 arch definition for CPU Exception Handler Library. 3 | 4 | Copyright (c) 2013 - 2018, Intel Corporation. All rights reserved.
5 | SPDX-License-Identifier: BSD-2-Clause-Patent 6 | 7 | **/ 8 | 9 | #ifndef _ARCH_CPU_INTERRUPT_DEFS_H_ 10 | #define _ARCH_CPU_INTERRUPT_DEFS_H_ 11 | 12 | typedef struct { 13 | EFI_SYSTEM_CONTEXT_IA32 SystemContext; 14 | BOOLEAN ExceptionDataFlag; 15 | UINTN OldIdtHandler; 16 | } EXCEPTION_HANDLER_CONTEXT; 17 | 18 | // 19 | // Register Structure Definitions 20 | // 21 | typedef struct { 22 | EFI_STATUS_CODE_DATA Header; 23 | EFI_SYSTEM_CONTEXT_IA32 SystemContext; 24 | } CPU_STATUS_CODE_TEMPLATE; 25 | 26 | typedef struct { 27 | SPIN_LOCK SpinLock; 28 | UINT32 ApicId; 29 | UINT32 Attribute; 30 | UINTN ExceptonHandler; 31 | UINTN OldFlags; 32 | UINTN OldCs; 33 | UINTN OldIp; 34 | UINTN ExceptionData; 35 | UINT8 HookAfterStubHeaderCode[HOOKAFTER_STUB_SIZE]; 36 | } RESERVED_VECTORS_DATA; 37 | 38 | #define CPU_TSS_DESC_SIZE \ 39 | (sizeof (IA32_TSS_DESCRIPTOR) * \ 40 | (FixedPcdGetSize (PcdCpuStackSwitchExceptionList) + 1)) 41 | 42 | #define CPU_TSS_SIZE \ 43 | (sizeof (IA32_TASK_STATE_SEGMENT) * \ 44 | (FixedPcdGetSize (PcdCpuStackSwitchExceptionList) + 1)) 45 | 46 | #endif 47 | -------------------------------------------------------------------------------- /MsvmPkg/Library/CpuExceptionHandlerLib/PeiCpuExceptionHandlerLib.inf: -------------------------------------------------------------------------------- 1 | ## @file 2 | # CPU Exception Handler library instance for PEI module. 3 | # 4 | # Copyright (c) 2016 - 2022, Intel Corporation. All rights reserved.
5 | # SPDX-License-Identifier: BSD-2-Clause-Patent 6 | # 7 | ## 8 | 9 | [Defines] 10 | INF_VERSION = 0x00010005 11 | BASE_NAME = PeiCpuExceptionHandlerLib 12 | MODULE_UNI_FILE = PeiCpuExceptionHandlerLib.uni 13 | FILE_GUID = 980DDA67-44A6-4897-99E6-275290B71F9E 14 | MODULE_TYPE = PEIM 15 | VERSION_STRING = 1.1 16 | LIBRARY_CLASS = CpuExceptionHandlerLib|PEI_CORE PEIM 17 | 18 | # 19 | # The following information is for reference only and not required by the build tools. 20 | # 21 | # VALID_ARCHITECTURES = IA32 X64 22 | # 23 | 24 | [Sources.Ia32] 25 | Ia32/ArchExceptionHandler.c 26 | Ia32/ArchInterruptDefs.h 27 | Ia32/ExceptionHandlerAsm.nasm 28 | Ia32/ExceptionTssEntryAsm.nasm 29 | 30 | [Sources.X64] 31 | X64/ArchExceptionHandler.c 32 | X64/ArchInterruptDefs.h 33 | X64/SecPeiExceptionHandlerAsm.nasm 34 | 35 | [Sources.common] 36 | CpuExceptionCommon.h 37 | CpuExceptionCommon.c 38 | PeiCpuException.c 39 | PeiDxeSmmCpuException.c 40 | 41 | [Packages] 42 | MdePkg/MdePkg.dec 43 | MdeModulePkg/MdeModulePkg.dec 44 | UefiCpuPkg/UefiCpuPkg.dec 45 | MsvmPkg/MsvmPkg.dec ## MS_HYP_CHANGE 46 | 47 | [LibraryClasses] 48 | BaseLib 49 | CcExitLib 50 | CrashLib ## MS_HYP_CHANGE 51 | HobLib 52 | LocalApicLib 53 | MemoryAllocationLib 54 | PeCoffGetEntryPointLib 55 | PrintLib 56 | SerialPortLib 57 | SynchronizationLib 58 | 59 | [Pcd] 60 | #gEfiMdeModulePkgTokenSpaceGuid.PcdCpuStackGuard # CONSUMES # MU_CHANGE 61 | gUefiCpuPkgTokenSpaceGuid.PcdCpuKnownGoodStackSize 62 | gUefiCpuPkgTokenSpaceGuid.PcdCpuStackSwitchExceptionList 63 | 64 | [FeaturePcd] 65 | gUefiCpuPkgTokenSpaceGuid.PcdCpuSmmStackGuard ## CONSUMES 66 | 67 | [BuildOptions] 68 | XCODE:*_*_X64_NASM_FLAGS = -D NO_ABSOLUTE_RELOCS_IN_TEXT 69 | -------------------------------------------------------------------------------- /MsvmPkg/Library/CpuExceptionHandlerLib/PeiCpuExceptionHandlerLib.uni: -------------------------------------------------------------------------------- 1 | // /** @file 2 | // CPU Exception Handler library instance for PEI module. 3 | // 4 | // CPU Exception Handler library instance for PEI module. 5 | // 6 | // Copyright (c) 2016, Intel Corporation. All rights reserved.
7 | // 8 | // SPDX-License-Identifier: BSD-2-Clause-Patent 9 | // 10 | // **/ 11 | 12 | 13 | #string STR_MODULE_ABSTRACT #language en-US "CPU Exception Handler library instance for PEI module." 14 | 15 | #string STR_MODULE_DESCRIPTION #language en-US "CPU Exception Handler library instance for PEI module." 16 | 17 | -------------------------------------------------------------------------------- /MsvmPkg/Library/CpuExceptionHandlerLib/SecPeiCpuExceptionHandlerLib.uni: -------------------------------------------------------------------------------- 1 | // /** @file 2 | // CPU Exception Handler library instance for SEC/PEI modules. 3 | // 4 | // CPU Exception Handler library instance for SEC/PEI modules. 5 | // 6 | // Copyright (c) 2012 - 2014, Intel Corporation. All rights reserved.
7 | // 8 | // SPDX-License-Identifier: BSD-2-Clause-Patent 9 | // 10 | // **/ 11 | 12 | 13 | #string STR_MODULE_ABSTRACT #language en-US "CPU Exception Handler library instance for SEC/PEI modules." 14 | 15 | #string STR_MODULE_DESCRIPTION #language en-US "CPU Exception Handler library instance for SEC/PEI modules." 16 | 17 | -------------------------------------------------------------------------------- /MsvmPkg/Library/CpuExceptionHandlerLib/SmmCpuExceptionHandlerLib.inf: -------------------------------------------------------------------------------- 1 | ## @file 2 | # CPU Exception Handler library instance for SMM modules. 3 | # 4 | # Copyright (c) 2013 - 2022, Intel Corporation. All rights reserved.
5 | # SPDX-License-Identifier: BSD-2-Clause-Patent 6 | # 7 | ## 8 | 9 | [Defines] 10 | INF_VERSION = 0x00010005 11 | BASE_NAME = SmmCpuExceptionHandlerLib 12 | MODULE_UNI_FILE = SmmCpuExceptionHandlerLib.uni 13 | FILE_GUID = 8D2C439B-3981-42ff-9CE5-1B50ECA502D6 14 | MODULE_TYPE = DXE_SMM_DRIVER 15 | VERSION_STRING = 1.1 16 | LIBRARY_CLASS = CpuExceptionHandlerLib|DXE_SMM_DRIVER MM_STANDALONE MM_CORE_STANDALONE 17 | 18 | # 19 | # The following information is for reference only and not required by the build tools. 20 | # 21 | # VALID_ARCHITECTURES = IA32 X64 22 | # 23 | 24 | [Sources.Ia32] 25 | Ia32/ArchExceptionHandler.c 26 | Ia32/ArchInterruptDefs.h 27 | Ia32/ExceptionHandlerAsm.nasm 28 | Ia32/ExceptionTssEntryAsm.nasm 29 | 30 | [Sources.X64] 31 | X64/ArchExceptionHandler.c 32 | X64/ArchInterruptDefs.h 33 | X64/ExceptionHandlerAsm.nasm 34 | 35 | [Sources.common] 36 | CpuExceptionCommon.h 37 | CpuExceptionCommon.c 38 | PeiDxeSmmCpuException.c 39 | SmmException.c 40 | 41 | [Packages] 42 | MdePkg/MdePkg.dec 43 | MdeModulePkg/MdeModulePkg.dec 44 | UefiCpuPkg/UefiCpuPkg.dec 45 | 46 | [LibraryClasses] 47 | BaseLib 48 | CcExitLib 49 | DebugLib 50 | LocalApicLib 51 | PeCoffGetEntryPointLib 52 | PrintLib 53 | SerialPortLib 54 | SynchronizationLib 55 | 56 | [Pcd] 57 | #gEfiMdeModulePkgTokenSpaceGuid.PcdCpuStackGuard # MU_CHANGE 58 | gUefiCpuPkgTokenSpaceGuid.PcdCpuStackSwitchExceptionList 59 | gUefiCpuPkgTokenSpaceGuid.PcdCpuKnownGoodStackSize 60 | 61 | [FeaturePcd] 62 | gUefiCpuPkgTokenSpaceGuid.PcdCpuSmmStackGuard ## CONSUMES 63 | 64 | [BuildOptions] 65 | XCODE:*_*_X64_NASM_FLAGS = -D NO_ABSOLUTE_RELOCS_IN_TEXT 66 | -------------------------------------------------------------------------------- /MsvmPkg/Library/CpuExceptionHandlerLib/SmmCpuExceptionHandlerLib.uni: -------------------------------------------------------------------------------- 1 | // /** @file 2 | // CPU Exception Handler library instance for SMM modules. 3 | // 4 | // CPU Exception Handler library instance for SMM modules. 5 | // 6 | // Copyright (c) 2013 - 2014, Intel Corporation. All rights reserved.
7 | // 8 | // SPDX-License-Identifier: BSD-2-Clause-Patent 9 | // 10 | // **/ 11 | 12 | 13 | #string STR_MODULE_ABSTRACT #language en-US "CPU Exception Handler library instance for SMM modules." 14 | 15 | #string STR_MODULE_DESCRIPTION #language en-US "CPU Exception Handler library instance for SMM modules." 16 | 17 | -------------------------------------------------------------------------------- /MsvmPkg/Library/CpuExceptionHandlerLib/UnitTest/DxeCpuExceptionHandlerLibUnitTest.inf: -------------------------------------------------------------------------------- 1 | ## @file 2 | # Unit tests of the DxeCpuExceptionHandlerLib instance. 3 | # 4 | # Copyright (c) 2022, Intel Corporation. All rights reserved.
5 | # SPDX-License-Identifier: BSD-2-Clause-Patent 6 | ## 7 | 8 | [Defines] 9 | INF_VERSION = 0x00010005 10 | BASE_NAME = CpuExceptionHandlerDxeTest 11 | FILE_GUID = D76BFD9C-0B6D-46BD-AD66-2BBB6FA7031A 12 | MODULE_TYPE = DXE_DRIVER 13 | VERSION_STRING = 1.0 14 | ENTRY_POINT = CpuExceptionHandlerTestEntry 15 | 16 | # 17 | # The following information is for reference only and not required by the build tools. 18 | # 19 | # VALID_ARCHITECTURES = X64 20 | # 21 | [Sources.X64] 22 | X64/ArchExceptionHandlerTestAsm.nasm 23 | X64/ArchExceptionHandlerTest.c 24 | 25 | [Sources.common] 26 | CpuExceptionHandlerTest.h 27 | CpuExceptionHandlerTestCommon.c 28 | DxeCpuExceptionHandlerUnitTest.c 29 | 30 | [Packages] 31 | MdePkg/MdePkg.dec 32 | MdeModulePkg/MdeModulePkg.dec 33 | UefiCpuPkg/UefiCpuPkg.dec 34 | 35 | [LibraryClasses] 36 | BaseLib 37 | BaseMemoryLib 38 | DebugLib 39 | UnitTestLib 40 | MemoryAllocationLib 41 | CpuExceptionHandlerLib 42 | UefiDriverEntryPoint 43 | HobLib 44 | UefiBootServicesTableLib 45 | CpuPageTableLib 46 | DxeMemoryProtectionHobLib ## MU_CHANGE 47 | 48 | [Guids] 49 | gEfiHobMemoryAllocStackGuid 50 | 51 | [Pcd] 52 | #gEfiMdeModulePkgTokenSpaceGuid.PcdCpuStackGuard ## CONSUMES # MU_CHANGE 53 | gUefiCpuPkgTokenSpaceGuid.PcdCpuApStackSize ## CONSUMES 54 | 55 | [Protocols] 56 | gEfiMpServiceProtocolGuid 57 | gEfiTimerArchProtocolGuid 58 | 59 | [Depex] 60 | gEfiMpServiceProtocolGuid 61 | -------------------------------------------------------------------------------- /MsvmPkg/Library/CpuExceptionHandlerLib/UnitTest/PeiCpuExceptionHandlerLibUnitTest.inf: -------------------------------------------------------------------------------- 1 | ## @file 2 | # Unit tests of the PeiCpuExceptionHandlerLib instance. 3 | # 4 | # Copyright (c) 2022, Intel Corporation. All rights reserved.
5 | # SPDX-License-Identifier: BSD-2-Clause-Patent 6 | ## 7 | 8 | [Defines] 9 | INF_VERSION = 0x00010006 10 | BASE_NAME = CpuExceptionHandlerPeiTest 11 | FILE_GUID = 39A96CF7-F369-4357-9234-4B52F98A007F 12 | MODULE_TYPE = PEIM 13 | VERSION_STRING = 1.0 14 | ENTRY_POINT = PeiEntryPoint 15 | 16 | # 17 | # The following information is for reference only and not required by the build tools. 18 | # 19 | # VALID_ARCHITECTURES = IA32 X64 20 | # 21 | [Sources.Ia32] 22 | Ia32/ArchExceptionHandlerTestAsm.nasm 23 | Ia32/ArchExceptionHandlerTest.c 24 | 25 | [Sources.X64] 26 | X64/ArchExceptionHandlerTestAsm.nasm 27 | X64/ArchExceptionHandlerTest.c 28 | 29 | [Sources.common] 30 | CpuExceptionHandlerTest.h 31 | CpuExceptionHandlerTestCommon.c 32 | PeiCpuExceptionHandlerUnitTest.c 33 | 34 | [Packages] 35 | MdePkg/MdePkg.dec 36 | MdeModulePkg/MdeModulePkg.dec 37 | UefiCpuPkg/UefiCpuPkg.dec 38 | 39 | [LibraryClasses] 40 | BaseLib 41 | BaseMemoryLib 42 | DebugLib 43 | UnitTestLib 44 | MemoryAllocationLib 45 | CpuExceptionHandlerLib 46 | PeimEntryPoint 47 | HobLib 48 | PeiServicesLib 49 | CpuPageTableLib 50 | PeiServicesTablePointerLib 51 | DxeMemoryProtectionHobLib ## MU_CHANGE 52 | 53 | [Pcd] 54 | # gEfiMdeModulePkgTokenSpaceGuid.PcdCpuStackGuard ## CONSUMES # MU_CHANGE 55 | gUefiCpuPkgTokenSpaceGuid.PcdCpuApStackSize ## CONSUMES 56 | 57 | [Ppis] 58 | gEdkiiPeiMpServices2PpiGuid ## CONSUMES 59 | 60 | [Depex] 61 | gEdkiiPeiMpServices2PpiGuid AND 62 | gEfiPeiMemoryDiscoveredPpiGuid 63 | -------------------------------------------------------------------------------- /MsvmPkg/Library/CpuExceptionHandlerLib/X64/ArchInterruptDefs.h: -------------------------------------------------------------------------------- 1 | /** @file 2 | X64 arch definition for CPU Exception Handler Library. 3 | 4 | Copyright (c) 2013, Intel Corporation. All rights reserved.
5 | SPDX-License-Identifier: BSD-2-Clause-Patent 6 | 7 | **/ 8 | 9 | #ifndef _ARCH_CPU_INTERRUPT_DEFS_H_ 10 | #define _ARCH_CPU_INTERRUPT_DEFS_H_ 11 | 12 | typedef struct { 13 | EFI_SYSTEM_CONTEXT_X64 SystemContext; 14 | BOOLEAN ExceptionDataFlag; 15 | UINTN OldIdtHandler; 16 | } EXCEPTION_HANDLER_CONTEXT; 17 | 18 | // 19 | // Register Structure Definitions 20 | // 21 | typedef struct { 22 | EFI_STATUS_CODE_DATA Header; 23 | EFI_SYSTEM_CONTEXT_X64 SystemContext; 24 | } CPU_STATUS_CODE_TEMPLATE; 25 | 26 | typedef struct { 27 | SPIN_LOCK SpinLock; 28 | UINT32 ApicId; 29 | UINT32 Attribute; 30 | UINTN ExceptonHandler; 31 | UINTN OldSs; 32 | UINTN OldSp; 33 | UINTN OldFlags; 34 | UINTN OldCs; 35 | UINTN OldIp; 36 | UINTN ExceptionData; 37 | UINT8 HookAfterStubHeaderCode[HOOKAFTER_STUB_SIZE]; 38 | } RESERVED_VECTORS_DATA; 39 | 40 | #define CPU_TSS_DESC_SIZE sizeof (IA32_TSS_DESCRIPTOR) 41 | #define CPU_TSS_SIZE sizeof (IA32_TASK_STATE_SEGMENT) 42 | 43 | #endif 44 | -------------------------------------------------------------------------------- /MsvmPkg/Library/CrashLib/CrashLib.inf: -------------------------------------------------------------------------------- 1 | ## @file 2 | # Library for crash dump generation and failing fast. 3 | # 4 | # Copyright (c) Microsoft Corporation. 5 | # SPDX-License-Identifier: BSD-2-Clause-Patent 6 | # 7 | ## 8 | 9 | [Defines] 10 | INF_VERSION = 0x00010016 11 | BASE_NAME = CrashLib 12 | FILE_GUID = E7658760-B25A-4723-8F93-FA99EE7539F0 13 | MODULE_TYPE = BASE 14 | VERSION_STRING = 1.0 15 | LIBRARY_CLASS = CrashLib 16 | 17 | [Sources] 18 | FailFast.c 19 | 20 | [Sources.X64] 21 | X64/Crash.c 22 | X64/FailFast.asm 23 | 24 | [Sources.AARCH64] 25 | AArch64/Crash.c 26 | 27 | [Packages] 28 | MdePkg/MdePkg.dec 29 | MsvmPkg/MsvmPkg.dec 30 | 31 | [Packages.AARCH64] 32 | ArmPkg/ArmPkg.dec 33 | MdeModulePkg/MdeModulePkg.dec 34 | 35 | [LibraryClasses] 36 | BaseLib 37 | BiosDeviceLib 38 | DebugLib 39 | PrintLib 40 | 41 | [LibraryClasses.AARCH64] 42 | ArmSmcLib 43 | HvHypercallLib 44 | -------------------------------------------------------------------------------- /MsvmPkg/Library/CrashLib/CrashLibConstants.h: -------------------------------------------------------------------------------- 1 | /** @file 2 | This file contains architecture specific functions for debugging a failure. 3 | 4 | Copyright (c) Microsoft Corporation. 5 | SPDX-License-Identifier: BSD-2-Clause-Patent 6 | **/ 7 | 8 | #pragma once 9 | 10 | #define MSVM_PKG_CRASH_ID 1 11 | 12 | // 13 | // Value present in RAX upon triple fault 14 | // signals that this is a guest requested memory dump 15 | // 32 bit modes will split the signature across eax & edx 16 | // with the high DWORD in eax and the low DWORD in edx. 17 | // 18 | #define GUESTDUMP_TRIPLEFAULT_SIGNATURE 0x504d445453455547 // "GUESTDMP" 19 | #define GUESTDUMP_TRIPLEFAULT_SIGNATURE_LOW_DWORD 0x53455547 // put in edx 20 | #define GUESTDUMP_TRIPLEFAULT_SIGNATURE_HIGH_DWORD 0x504d4454 // put in eax 21 | -------------------------------------------------------------------------------- /MsvmPkg/Library/CrashLib/FailFast.c: -------------------------------------------------------------------------------- 1 | 2 | /** @file 3 | This file contains architecture specific functions for debugging a failure. 4 | 5 | Copyright (c) Microsoft Corporation. 6 | SPDX-License-Identifier: BSD-2-Clause-Patent 7 | **/ 8 | 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | 15 | #include 16 | 17 | /** 18 | Called when a fatal error is detected and the system cannot continue. 19 | It is not expected that this function returns. 20 | 21 | @param ErrorCode Bugcheck code 22 | @param Param1 Bugcheck code specific parameter. 23 | @param Param2 Bugcheck code specific parameter. 24 | @param Param3 Bugcheck code specific parameter. 25 | @param Param4 Bugcheck code specific parameter. 26 | 27 | **/ 28 | VOID 29 | FailFast( 30 | IN UINTN ErrorCode, 31 | IN UINTN Param1, 32 | IN UINTN Param2, 33 | IN UINTN MessageBuffer, 34 | IN UINTN MessageLength 35 | ) 36 | { 37 | DEBUG((EFI_D_ERROR, "FailFast invoked.\n")); 38 | ASSERT(FALSE); 39 | 40 | ReportCrash(ErrorCode, Param1, Param2, MessageBuffer, MessageLength); 41 | 42 | ResetAfterCrash(ErrorCode, Param1, Param2); 43 | } 44 | 45 | VOID 46 | FailFastFromMacro( 47 | IN UINTN ErrorCode, 48 | IN CONST CHAR8 * Component, 49 | IN UINTN Line, 50 | IN CONST CHAR8 * Description 51 | ) 52 | { 53 | CHAR8 buffer[HV_CRASH_MAXIMUM_MESSAGE_SIZE]; 54 | 55 | // 56 | // Write the crash message. 57 | // 58 | UINTN bytes = AsciiSPrint(buffer, 59 | HV_CRASH_MAXIMUM_MESSAGE_SIZE, 60 | "MsvmPkg FAIL_FAST\nDESCRIPTION: %a\nERROR: %d\nCOMPONENT: %a\nLINE: %d\n", 61 | Description, 62 | ErrorCode, 63 | Component, 64 | Line); 65 | 66 | DEBUG((EFI_D_ERROR, "\n%a\n", buffer)); 67 | 68 | FailFast(ErrorCode, 0, Line, (UINTN)&buffer, bytes); 69 | } -------------------------------------------------------------------------------- /MsvmPkg/Library/CrashLib/X64/FailFast.asm: -------------------------------------------------------------------------------- 1 | /** @file 2 | This file contains architecture specific functions for debugging a failure. 3 | 4 | Copyright (c) Microsoft Corporation. 5 | SPDX-License-Identifier: BSD-2-Clause-Patent 6 | 7 | **/ 8 | 9 | .code 10 | 11 | ;++ 12 | ; 13 | ; TripleFault 14 | ; 15 | ; This function causes a triple fault. 16 | ; It places the four parameters in the respective registers prior to the triple fault. 17 | ; The VMM logs the VP state which includes these registers. 18 | ; 19 | ; @param[in] RCX - Rax - Value to place in rax register. 20 | ; @param[in] RDX - Rbx - Value to place in rbx register. 21 | ; @param[in] R8 - Rcx - Value to place in rcx register. 22 | ; @param[in] R9 - Rdx - Value to place in rdx register. 23 | ; 24 | ; @return None This routine does not return 25 | ; 26 | ;-- 27 | TripleFault PROC PUBLIC 28 | 29 | mov rax, rcx 30 | mov rbx, rdx 31 | mov rcx, r8 32 | mov rdx, r9 33 | 34 | push 0 35 | push 0 36 | lidt fword ptr [rsp] ; SET EMPTY IDT 37 | ; 38 | ; Generate #UD using UD2 instruction 39 | ; 40 | EternalUD: 41 | db 0FH, 0Bh ; #UD -> #DF -> TRIPLE FAULT 42 | 43 | jmp EternalUD 44 | 45 | TripleFault ENDP 46 | 47 | end 48 | -------------------------------------------------------------------------------- /MsvmPkg/Library/DebugTransportLibMsvm/DebugTransportLibMsvm.inf: -------------------------------------------------------------------------------- 1 | ## @file 2 | # Implementation of the DebugTransportLib that wraps the IO implementation 3 | # of serial port lib to change port address. Taken from QemuQ5Pkg from MU 4 | # TIANO. 5 | # 6 | # Copyright (c) Microsoft Corporation. 7 | # SPDX-License-Identifier: BSD-2-Clause-Patent 8 | # 9 | ## 10 | 11 | [Defines] 12 | INF_VERSION = 0x00010016 13 | BASE_NAME = DebugTransportLibMsvm 14 | FILE_GUID = 917CFE9C-0E35-43FB-BDCC-3D39F15A8BBA 15 | MODULE_TYPE = BASE 16 | VERSION_STRING = 1.0 17 | LIBRARY_CLASS = DebugTransportLib 18 | 19 | [Sources.X64] 20 | X64/DebugTransportLibMsvm.c 21 | 22 | [Sources.AARCH64] 23 | AArch64/DebugTransportLibMsvm.c 24 | 25 | [Packages] 26 | MdeModulePkg/MdeModulePkg.dec 27 | MdePkg/MdePkg.dec 28 | MsvmPkg/MsvmPkg.dec 29 | DebuggerFeaturePkg/DebuggerFeaturePkg.dec 30 | 31 | [Packages.AArch64] 32 | ArmPlatformPkg/ArmPlatformPkg.dec 33 | EmbeddedPkg/EmbeddedPkg.dec 34 | 35 | [LibraryClasses] 36 | SerialPortLib 37 | 38 | [Pcd] 39 | gMsvmPkgTokenSpaceGuid.PcdFeatureDebuggerPortUartBase ## CONSUMES 40 | 41 | [FixedPcd.AARCH64] 42 | gEfiMdePkgTokenSpaceGuid.PcdUartDefaultBaudRate 43 | gEfiMdePkgTokenSpaceGuid.PcdUartDefaultDataBits 44 | gEfiMdePkgTokenSpaceGuid.PcdUartDefaultParity 45 | gEfiMdePkgTokenSpaceGuid.PcdUartDefaultStopBits 46 | gArmPlatformTokenSpaceGuid.PL011UartClkInHz 47 | 48 | [Depex] 49 | TRUE 50 | -------------------------------------------------------------------------------- /MsvmPkg/Library/DefaultExceptionHandlerLib/DefaultExceptionHandlerLib.inf: -------------------------------------------------------------------------------- 1 | #/** @file 2 | # 3 | # Copyright (c) 2008, Apple Inc. All rights reserved.
4 | # Copyright (c) 2011 - 2013, ARM Ltd. All rights reserved.
5 | # Copyright (c) Microsoft Corporation. 6 | # 7 | # SPDX-License-Identifier: BSD-2-Clause-Patent 8 | # 9 | # 10 | #**/ 11 | 12 | #Override : 00000002 | ArmPkg/Library/DefaultExceptionHandlerLib/DefaultExceptionHandlerLib.inf | 96fee854bb34f7b8d099bdf5679984a3 | 2025-05-02T00-01-31 | 1abd9da5b6f5c85089b20eae81285d978709c9bc 13 | 14 | [Defines] 15 | INF_VERSION = 0x00010005 16 | BASE_NAME = DefaultExceptionHandlerLib 17 | FILE_GUID = EACDB354-DF1A-4AF9-A171-499737ED818F 18 | MODULE_TYPE = BASE 19 | VERSION_STRING = 1.0 20 | LIBRARY_CLASS = DefaultExceptionHandlerLib|DXE_CORE DXE_DRIVER 21 | 22 | [Sources.common] 23 | DefaultExceptionHandlerUefi.c 24 | 25 | [Sources.ARM] 26 | Arm/DefaultExceptionHandler.c 27 | 28 | [Sources.AARCH64] 29 | AArch64/DefaultExceptionHandler.c 30 | 31 | [Packages] 32 | MdePkg/MdePkg.dec 33 | ArmPkg/ArmPkg.dec 34 | MsvmPkg/MsvmPkg.dec // MS_HYP_CHANGE 35 | 36 | [LibraryClasses] 37 | UefiLib 38 | BaseLib 39 | CrashLib // MS_HYP_CHANGE 40 | PrintLib 41 | DebugLib 42 | PeCoffGetEntryPointLib 43 | SerialPortLib 44 | UefiBootServicesTableLib 45 | 46 | [Guids] 47 | gEfiDebugImageInfoTableGuid -------------------------------------------------------------------------------- /MsvmPkg/Library/DeviceBootManagerLib/DeviceBootManagerLib.inf: -------------------------------------------------------------------------------- 1 | ## @file 2 | # Device specific actions in support of PlatformBootManagerLib 3 | # 4 | # Copyright (c) Microsoft Corporation. 5 | # SPDX-License-Identifier: BSD-2-Clause-Patent 6 | # 7 | ## 8 | 9 | [Defines] 10 | EDK_RELEASE_VERSION = 0x00020000 11 | INF_VERSION = 0x00010017 12 | BASE_NAME = DeviceBootManagerLib 13 | FILE_GUID = 854d672c-c04d-4f9b-b4ec-22c89895ea78 14 | VERSION_STRING = 1.0 15 | MODULE_TYPE = DXE_DRIVER 16 | UEFI_SPECIFICATION_VERSION = 2.70 17 | LIBRARY_CLASS = DeviceBootManagerLib|DXE_DRIVER 18 | CONSTRUCTOR = DeviceBootManagerConstructor 19 | 20 | # 21 | # The following information is for reference only and not required by the build tools. 22 | # 23 | # VALID_ARCHITECTURES = IA32 X64 EBC 24 | # 25 | 26 | [Sources] 27 | DeviceBootManagerLib.c 28 | 29 | [Packages] 30 | MdePkg/MdePkg.dec 31 | MdeModulePkg/MdeModulePkg.dec 32 | MsCorePkg/MsCorePkg.dec 33 | MsvmPkg/MsvmPkg.dec 34 | PcBdsPkg/PcBdsPkg.dec 35 | 36 | [LibraryClasses] 37 | BaseMemoryLib 38 | BiosDeviceLib 39 | DebugLib 40 | DevicePathLib 41 | DxeServicesTableLib 42 | EmclLib 43 | MemoryAllocationLib 44 | MsBootPolicyLib 45 | MsLogoLib 46 | MsPlatBdsLib 47 | PcdLib 48 | UefiBootServicesTableLib 49 | UefiLib 50 | 51 | [Protocols] 52 | gEfiVmbusRootProtocolGuid 53 | gEfiVmbusProtocolGuid 54 | gEfiSimpleFileSystemProtocolGuid 55 | gEfiLoadFileProtocolGuid 56 | 57 | [Guids] 58 | gEfiVmbusChannelDevicePathGuid ## CONSUMES 59 | gSyntheticKeyboardClassGuid ## CONSUMES 60 | gSyntheticVideoClassGuid ## CONSUMES 61 | gSynthetic3dVideoClassGuid ## CONSUMES 62 | 63 | [FeaturePcd] 64 | 65 | [Pcd] 66 | gMsvmPkgTokenSpaceGuid.PcdDefaultBootAlwaysAttempt 67 | gMsvmPkgTokenSpaceGuid.PcdDefaultBootAttemptPxe 68 | gMsvmPkgTokenSpaceGuid.PcdIsVmbfsBoot 69 | gMsvmPkgTokenSpaceGuid.PcdLogoFile 70 | gMsvmPkgTokenSpaceGuid.PcdPxeIpV6 71 | gMsvmPkgTokenSpaceGuid.PcdVpciBootEnabled 72 | 73 | [Depex] 74 | TRUE 75 | -------------------------------------------------------------------------------- /MsvmPkg/Library/DxeImageVerificationLib/DxeImageVerificationLib.uni: -------------------------------------------------------------------------------- 1 | // /** @file 2 | // Provides security service of image verification 3 | // 4 | // This library hooks LoadImage() API to verify every image by the verification policy. 5 | // 6 | // Caution: This module requires additional review when modified. 7 | // This library will have external input - PE/COFF image. 8 | // This external input must be validated carefully to avoid security issues such as 9 | // buffer overflow or integer overflow. 10 | // 11 | // Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.
12 | // 13 | // SPDX-License-Identifier: BSD-2-Clause-Patent 14 | // 15 | // **/ 16 | 17 | 18 | #string STR_MODULE_ABSTRACT #language en-US "Provides security service of image verification" 19 | 20 | #string STR_MODULE_DESCRIPTION #language en-US "This library hooks LoadImage() API to verify every image by the verification policy. Caution: This module requires additional review when modified. This library will have external input - PE/COFF image. This external input must be validated carefully to avoid security issues such as buffer overflow or integer overflow." 21 | 22 | -------------------------------------------------------------------------------- /MsvmPkg/Library/EmclLib/EmclLib.inf: -------------------------------------------------------------------------------- 1 | ## @file 2 | # Library for EMCL (EFI VmBus client library). 3 | # 4 | # Copyright (c) Microsoft Corporation. 5 | # SPDX-License-Identifier: BSD-2-Clause-Patent 6 | # 7 | ## 8 | 9 | [Defines] 10 | INF_VERSION = 0x00010005 11 | BASE_NAME = EmclLib 12 | FILE_GUID = 00ACE03A-E7F0-4D3E-A68A-77E3AABB5D86 13 | MODULE_TYPE = BASE 14 | VERSION_STRING = 1.0 15 | LIBRARY_CLASS = EmclLib 16 | 17 | [Sources] 18 | EmclLib.c 19 | 20 | [Packages] 21 | MdePkg/MdePkg.dec 22 | MdeModulePkg/MdeModulePkg.dec 23 | MsvmPkg/MsvmPkg.dec 24 | 25 | [Protocols] 26 | gEfiEmclProtocolGuid #PRODUCES 27 | gEfiEmclTagProtocolGuid #PRODUCES 28 | gInternalEventServicesProtocolGuid #CONSUMES 29 | -------------------------------------------------------------------------------- /MsvmPkg/Library/EventLogLib/EventLogLib.inf: -------------------------------------------------------------------------------- 1 | ## @file 2 | # Event Log Library instance. 3 | # Provides wrapper for Event log protocol access and 4 | # specialized wrappers for specific event log channels such as the boot log. 5 | # 6 | # Copyright (c) Microsoft Corporation. 7 | # SPDX-License-Identifier: BSD-2-Clause-Patent 8 | # 9 | ## 10 | 11 | [Defines] 12 | INF_VERSION = 0x00010016 13 | BASE_NAME = MsvmEventLogLib 14 | FILE_GUID = 7E0E3784-5385-4624-9E24-D27995F045E8 15 | MODULE_TYPE = DXE_DRIVER 16 | VERSION_STRING = 1.0 17 | LIBRARY_CLASS = EventLogLib|DXE_CORE DXE_DRIVER UEFI_APPLICATION UEFI_DRIVER 18 | CONSTRUCTOR = EventLogConstructor 19 | 20 | [Sources] 21 | EventLogLib.c 22 | 23 | [LibraryClasses] 24 | BaseLib 25 | BaseMemoryLib 26 | DebugLib 27 | DevicePathLib 28 | MemoryAllocationLib 29 | PcdLib 30 | UefiBootServicesTableLib 31 | 32 | [Packages] 33 | MdePkg/MdePkg.dec 34 | MsvmPkg/MsvmPkg.dec 35 | 36 | [Protocols] 37 | gEfiEventLogProtocolGuid ## CONSUMES -------------------------------------------------------------------------------- /MsvmPkg/Library/ExcludeMainFvFromMeasurementLib/ExcludeMainFvFromMeasurementLib.c: -------------------------------------------------------------------------------- 1 | /** @file 2 | Library to inform Tcg2Pei not to measure FvMain. 3 | Some legacy Hyper-V versions require this 4 | 5 | Copyright (c) Microsoft Corporation. 6 | SPDX-License-Identifier: BSD-2-Clause-Patent 7 | --*/ 8 | 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | 15 | 16 | EFI_PEI_FIRMWARE_VOLUME_INFO_MEASUREMENT_EXCLUDED_PPI exclude = { 17 | 1, //count 18 | { 19 | (EFI_PHYSICAL_ADDRESS) FixedPcdGet64(PcdFvBaseAddress), 20 | (UINT64) FixedPcdGet32(PcdFvSize) 21 | } 22 | }; 23 | 24 | STATIC EFI_PEI_PPI_DESCRIPTOR PpiList = 25 | { 26 | EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST, 27 | &gEfiPeiFirmwareVolumeInfoMeasurementExcludedPpiGuid, 28 | &exclude 29 | }; 30 | 31 | 32 | EFI_STATUS 33 | EFIAPI 34 | ExcludeMainFvFromMeasurementLibConstructor ( 35 | IN EFI_PEI_FILE_HANDLE FileHandle, 36 | IN CONST EFI_PEI_SERVICES **PeiServices 37 | ) 38 | { 39 | EFI_STATUS Status; 40 | Status = EFI_SUCCESS; 41 | 42 | if(PcdGetBool(PcdExcludeFvMainFromMeasurements)) 43 | { 44 | Status = PeiServicesInstallPpi(&PpiList); 45 | ASSERT_EFI_ERROR(Status); 46 | } 47 | return Status;; 48 | } -------------------------------------------------------------------------------- /MsvmPkg/Library/ExcludeMainFvFromMeasurementLib/ExcludeMainFvFromMeasurementLib.inf: -------------------------------------------------------------------------------- 1 | ## @file 2 | # Library to inform Tcg2Pei not to measure FvMain. 3 | # Some legacy Hyper-V versions require this 4 | # 5 | # Copyright (c) Microsoft Corporation. 6 | # SPDX-License-Identifier: BSD-2-Clause-Patent 7 | # 8 | ## 9 | 10 | 11 | [Defines] 12 | INF_VERSION = 0x00010017 13 | BASE_NAME = ExcludeMainFvFromMeasurementLib 14 | FILE_GUID = f6262462-bffa-495b-86c3-34548c2c1a6b 15 | VERSION_STRING = 1.0 16 | MODULE_TYPE = PEIM 17 | LIBRARY_CLASS = NULL|PEIM 18 | CONSTRUCTOR = ExcludeMainFvFromMeasurementLibConstructor 19 | 20 | [Packages] 21 | MdePkg/MdePkg.dec 22 | MsvmPkg/MsvmPkg.dec 23 | SecurityPkg/SecurityPkg.dec 24 | 25 | [Sources] 26 | ExcludeMainFvFromMeasurementLib.c 27 | 28 | [LibraryClasses] 29 | DebugLib 30 | PcdLib 31 | PeiServicesLib 32 | 33 | [FixedPcd] 34 | gMsvmPkgTokenSpaceGuid.PcdFvBaseAddress 35 | gMsvmPkgTokenSpaceGuid.PcdFvSize 36 | 37 | [Pcd] 38 | gMsvmPkgTokenSpaceGuid.PcdExcludeFvMainFromMeasurements #CONSUMES 39 | 40 | [Ppis] 41 | gEfiPeiFirmwareVolumeInfoMeasurementExcludedPpiGuid 42 | -------------------------------------------------------------------------------- /MsvmPkg/Library/GhcbLib/DxeGhcbLibSupport.c: -------------------------------------------------------------------------------- 1 | /** @file 2 | This file implements support routines for GHCB-based calls. 3 | 4 | Copyright (c) Microsoft Corporation. 5 | SPDX-License-Identifier: BSD-2-Clause-Patent 6 | **/ 7 | 8 | #include 9 | 10 | #include 11 | 12 | EFI_TPL 13 | GhcbpDisableInterrupts( 14 | VOID 15 | ) 16 | { 17 | // In DXE, raise TPL to high level that will be restored when enable interrupts 18 | // is called. 19 | return gBS->RaiseTPL(TPL_HIGH_LEVEL); 20 | } 21 | 22 | VOID 23 | GhcbpEnableInterrupts( 24 | EFI_TPL tpl 25 | ) 26 | { 27 | gBS->RestoreTPL(tpl); 28 | } 29 | -------------------------------------------------------------------------------- /MsvmPkg/Library/GhcbLib/GhcbLib.inf: -------------------------------------------------------------------------------- 1 | ## @file 2 | # Support routines for GHCB-based calls. 3 | # 4 | # Copyright (c) Microsoft Corporation. 5 | # SPDX-License-Identifier: BSD-2-Clause-Patent 6 | # 7 | ## 8 | 9 | [Defines] 10 | INF_VERSION = 0x00010005 11 | BASE_NAME = GhcbLib 12 | FILE_GUID = 50c4ccb1-a610-47d6-ae29-9e8368091796 13 | MODULE_TYPE = DXE_DRIVER 14 | VERSION_STRING = 1.0 15 | LIBRARY_CLASS = GhcbLib|DXE_DRIVER UEFI_DRIVER DXE_RUNTIME_DRIVER 16 | 17 | [Sources] 18 | DxeGhcbLibSupport.c 19 | 20 | [Sources.X64] 21 | X64/GhcbCall.c 22 | X64/SvmSnp.asm | MSFT 23 | 24 | [Packages] 25 | MdePkg/MdePkg.dec 26 | MsvmPkg/MsvmPkg.dec 27 | 28 | [LibraryClasses.X64] 29 | PcdLib 30 | UefiBootServicesTableLib 31 | 32 | [Pcd.X64] 33 | gMsvmPkgTokenSpaceGuid.PcdIsolationSharedGpaBoundary 34 | gMsvmPkgTokenSpaceGuid.PcdIsolationSharedGpaCanonicalizationBitmask 35 | -------------------------------------------------------------------------------- /MsvmPkg/Library/GhcbLib/PeiGhcbLib.inf: -------------------------------------------------------------------------------- 1 | ## @file 2 | # Support routines for GHCB-based calls in PEI. 3 | # 4 | # Copyright (c) Microsoft Corporation. 5 | # SPDX-License-Identifier: BSD-2-Clause-Patent 6 | # 7 | ## 8 | 9 | [Defines] 10 | INF_VERSION = 0x00010005 11 | BASE_NAME = GhcbLib 12 | FILE_GUID = df485110-86a9-11ea-bc55-0242ac13f3f5 13 | MODULE_TYPE = PEIM 14 | VERSION_STRING = 1.0 15 | LIBRARY_CLASS = GhcbLib|PEIM PEI_CORE 16 | 17 | [Sources] 18 | PeiGhcbLibSupport.c 19 | 20 | [Sources.X64] 21 | X64/GhcbCall.c 22 | X64/SvmSnp.asm | MSFT 23 | 24 | [Packages] 25 | MdePkg/MdePkg.dec 26 | MsvmPkg/MsvmPkg.dec 27 | 28 | [LibraryClasses.X64] 29 | PcdLib 30 | 31 | [Pcd.X64] 32 | gMsvmPkgTokenSpaceGuid.PcdIsolationSharedGpaBoundary 33 | gMsvmPkgTokenSpaceGuid.PcdIsolationSharedGpaCanonicalizationBitmask -------------------------------------------------------------------------------- /MsvmPkg/Library/GhcbLib/PeiGhcbLibSupport.c: -------------------------------------------------------------------------------- 1 | /** @file 2 | This file implements support routines for GHCB-based calls. 3 | 4 | Copyright (c) Microsoft Corporation. 5 | SPDX-License-Identifier: BSD-2-Clause-Patent 6 | **/ 7 | 8 | #include 9 | 10 | EFI_TPL 11 | GhcbpDisableInterrupts( 12 | VOID 13 | ) 14 | { 15 | // In PEI, interrupts are always disabled. This function is a no-op. 16 | return 0; 17 | } 18 | 19 | VOID 20 | GhcbpEnableInterrupts( 21 | EFI_TPL tpl 22 | ) 23 | { 24 | // In PEI, interrupts are always disabled. This function is a no-op. 25 | } 26 | -------------------------------------------------------------------------------- /MsvmPkg/Library/GhcbLib/X64/SvmSnp.asm: -------------------------------------------------------------------------------- 1 | /** @file 2 | Asm implementations of SNP instructions that will become compiler 3 | intrinsics. 4 | 5 | Copyright (c) Microsoft Corporation. 6 | SPDX-License-Identifier: BSD-2-Clause-Patent 7 | **/ 8 | 9 | include macamd64.inc 10 | 11 | ;*++ 12 | ; 13 | ; VOID 14 | ; _sev_vmgexit( 15 | ; VOID 16 | ; ); 17 | ; 18 | ; Routine Description: 19 | ; 20 | ; This routine performs an VMGEXIT. 21 | ; 22 | ; Arguments: 23 | ; 24 | ; None. 25 | ; 26 | ; Return Value: 27 | ; 28 | ; None. 29 | ; 30 | ;--* 31 | 32 | LEAF_ENTRY _sev_vmgexit, _TEXT$00 33 | 34 | db 0f3h ; VMGEXIT prefix 35 | vmmcall 36 | ret 37 | 38 | LEAF_END _sev_vmgexit, _TEXT$00 39 | 40 | end 41 | -------------------------------------------------------------------------------- /MsvmPkg/Library/HostVisibilityLib/HostVisibilityLib.inf: -------------------------------------------------------------------------------- 1 | ## @file 2 | # Host visibility library. 3 | # 4 | # Copyright (c) Microsoft Corporation. 5 | # SPDX-License-Identifier: BSD-2-Clause-Patent 6 | # 7 | ## 8 | 9 | [Defines] 10 | INF_VERSION = 0x00010005 11 | BASE_NAME = HostVisibilityLib 12 | FILE_GUID = 50c4ccb1-a610-47d6-ae29-9e8368091795 13 | MODULE_TYPE = BASE 14 | VERSION_STRING = 1.0 15 | LIBRARY_CLASS = HostVisibilityLib 16 | 17 | [Sources] 18 | HostVisibilityLib.c 19 | 20 | [Sources.X64] 21 | X64/Snp.asm 22 | X64/Tdx.asm 23 | 24 | [Packages] 25 | MdePkg/MdePkg.dec 26 | MsvmPkg/MsvmPkg.dec 27 | 28 | [LibraryClasses.X64] 29 | PcdLib 30 | 31 | [Pcd.X64] 32 | gMsvmPkgTokenSpaceGuid.PcdIsolationSharedGpaBoundary 33 | -------------------------------------------------------------------------------- /MsvmPkg/Library/HvHypercallLib/DxeHvHypercallLibSupport.c: -------------------------------------------------------------------------------- 1 | /** @file 2 | Hypercall library support. 3 | 4 | Copyright (c) Microsoft Corporation. 5 | SPDX-License-Identifier: BSD-2-Clause-Patent 6 | --*/ 7 | 8 | #include 9 | 10 | #include 11 | 12 | #include 13 | 14 | EFI_TPL mTpl; 15 | 16 | VOID 17 | HvHypercallpDisableInterrupts( 18 | VOID 19 | ) 20 | { 21 | // In DXE, raise TPL to high level that will be restored when enable interrupts 22 | // is called. 23 | mTpl = gBS->RaiseTPL(TPL_HIGH_LEVEL); 24 | } 25 | 26 | VOID 27 | HvHypercallpEnableInterrupts( 28 | VOID 29 | ) 30 | { 31 | gBS->RestoreTPL(mTpl); 32 | } -------------------------------------------------------------------------------- /MsvmPkg/Library/HvHypercallLib/HvHypercallLib.inf: -------------------------------------------------------------------------------- 1 | [Defines] 2 | INF_VERSION = 0x00010005 3 | BASE_NAME = HvHypercallLib 4 | FILE_GUID = a4b0a0bd-9462-48de-b9fb-35336e38768e 5 | MODULE_TYPE = DXE_DRIVER 6 | VERSION_STRING = 1.0 7 | LIBRARY_CLASS = HvHypercallLib|DXE_DRIVER UEFI_DRIVER DXE_RUNTIME_DRIVER DXE_CORE 8 | 9 | [Sources] 10 | HvHypercallLib.c 11 | DxeHvHypercallLibSupport.c 12 | 13 | [Sources.X64] 14 | X64/GhcbHypercall.c 15 | X64/TdxCall.asm | MSFT 16 | 17 | [Sources.AARCH64] 18 | AArch64/HypercallImpl.masm 19 | 20 | [Packages] 21 | MdePkg/MdePkg.dec 22 | MsvmPkg/MsvmPkg.dec 23 | 24 | [LibraryClasses.X64] 25 | PcdLib 26 | UefiBootServicesTableLib 27 | 28 | [Pcd.X64] 29 | gMsvmPkgTokenSpaceGuid.PcdIsolationSharedGpaBoundary 30 | gMsvmPkgTokenSpaceGuid.PcdIsolationSharedGpaCanonicalizationBitmask 31 | -------------------------------------------------------------------------------- /MsvmPkg/Library/HvHypercallLib/HvHypercallLibP.h: -------------------------------------------------------------------------------- 1 | /** @file 2 | Private include for the hypercall support routine library. 3 | 4 | Copyright (c) Microsoft Corporation. 5 | SPDX-License-Identifier: BSD-2-Clause-Patent 6 | 7 | **/ 8 | 9 | #pragma once 10 | 11 | #include 12 | 13 | #include 14 | 15 | #if defined(MDE_CPU_X64) 16 | 17 | HV_STATUS 18 | HvHypercallpIssueGhcbHypercall( 19 | IN HV_HYPERCALL_CONTEXT *Context, 20 | HV_CALL_CODE CallCode, 21 | IN OPTIONAL VOID *InputPage, 22 | UINT32 CountOfElements, 23 | OUT OPTIONAL UINT32 *ElementsProcessed 24 | ); 25 | 26 | VOID 27 | _tdx_vmcall_wrmsr( 28 | UINT32 MsrIndex, 29 | UINT64 MsrValue 30 | ); 31 | 32 | UINT64 33 | _tdx_vmcall_rdmsr( 34 | UINT32 MsrIndex 35 | ); 36 | 37 | /// Functions that enable and disable interrupts, that are implemented based 38 | /// on the environment the library is built for. 39 | 40 | VOID 41 | HvHypercallpDisableInterrupts( 42 | VOID 43 | ); 44 | 45 | VOID 46 | HvHypercallpEnableInterrupts( 47 | VOID 48 | ); 49 | 50 | #endif 51 | -------------------------------------------------------------------------------- /MsvmPkg/Library/HvHypercallLib/PeiHvHypercallLib.inf: -------------------------------------------------------------------------------- 1 | ## @file 2 | # Hypercall library (PEI). 3 | # 4 | # Copyright (c) Microsoft Corporation. 5 | # SPDX-License-Identifier: BSD-2-Clause-Patent 6 | # 7 | ## 8 | 9 | [Defines] 10 | INF_VERSION = 0x00010005 11 | BASE_NAME = HvHypercallLib 12 | FILE_GUID = df485110-86a9-11ea-bc55-0242ac130003 13 | MODULE_TYPE = PEIM 14 | VERSION_STRING = 1.0 15 | LIBRARY_CLASS = HvHypercallLib|PEIM PEI_CORE 16 | 17 | [Sources] 18 | HvHypercallLib.c 19 | PeiHvHypercallLibSupport.c 20 | 21 | [Sources.X64] 22 | X64/GhcbHypercall.c 23 | 24 | [Sources.AARCH64] 25 | AArch64/HypercallImpl.masm 26 | 27 | [Packages] 28 | MdePkg/MdePkg.dec 29 | MsvmPkg/MsvmPkg.dec 30 | 31 | [LibraryClasses.X64] 32 | PcdLib 33 | 34 | [Pcd.X64] 35 | gMsvmPkgTokenSpaceGuid.PcdIsolationSharedGpaBoundary 36 | gMsvmPkgTokenSpaceGuid.PcdIsolationSharedGpaCanonicalizationBitmask -------------------------------------------------------------------------------- /MsvmPkg/Library/HvHypercallLib/PeiHvHypercallLibSupport.c: -------------------------------------------------------------------------------- 1 | /** @file 2 | This file implements support routines for PEI hypercalls. 3 | 4 | Copyright (c) Microsoft Corporation. 5 | SPDX-License-Identifier: BSD-2-Clause-Patent 6 | **/ 7 | 8 | #include 9 | 10 | #include 11 | 12 | VOID 13 | HvHypercallpDisableInterrupts( 14 | VOID 15 | ) 16 | { 17 | // In PEI, interrupts are always disabled. This function is a no-op. 18 | } 19 | 20 | VOID 21 | HvHypercallpEnableInterrupts( 22 | VOID 23 | ) 24 | { 25 | // In PEI, interrupts are always disabled. This function is a no-op. 26 | } -------------------------------------------------------------------------------- /MsvmPkg/Library/HvTimerLib/HvTimerLib.inf: -------------------------------------------------------------------------------- 1 | ## @file 2 | # The TimerLib library class. 3 | # 4 | # Copyright (c) Microsoft Corporation. 5 | # SPDX-License-Identifier: BSD-2-Clause-Patent 6 | # 7 | ## 8 | 9 | [Defines] 10 | INF_VERSION = 0x00010005 11 | BASE_NAME = HvTimerLib 12 | FILE_GUID = 1D40190D-0556-4561-B896-57E55644BBBF 13 | MODULE_TYPE = BASE 14 | VERSION_STRING = 1.0 15 | LIBRARY_CLASS = TimerLib 16 | 17 | [Sources] 18 | HvTimerLib.c 19 | 20 | [Packages] 21 | MdePkg/MdePkg.dec 22 | MsvmPkg/MsvmPkg.dec 23 | 24 | [LibraryClasses] 25 | DebugLib 26 | 27 | [LibraryClasses.AARCH64] 28 | HvHypercallLib 29 | 30 | [LibraryClasses.X64] 31 | IoLib 32 | 33 | -------------------------------------------------------------------------------- /MsvmPkg/Library/IsolationLib/IsolationLib.c: -------------------------------------------------------------------------------- 1 | /** @file 2 | This file implements helper routines to facilitate Isolation checks. 3 | 4 | Copyright (c) Microsoft Corporation. 5 | SPDX-License-Identifier: BSD-2-Clause-Patent 6 | --*/ 7 | 8 | #include 9 | 10 | UINT32 11 | GetIsolationType( 12 | ) 13 | { 14 | return PcdGet32(PcdIsolationArchitecture); 15 | } 16 | 17 | BOOLEAN 18 | IsParavisorPresent( 19 | ) 20 | { 21 | #if defined(MDE_CPU_AARCH64) 22 | return FALSE; 23 | #else 24 | return PcdGetBool(PcdIsolationParavisorPresent); 25 | #endif 26 | } 27 | 28 | BOOLEAN 29 | IsIsolatedEx( 30 | UINT32 IsolationType 31 | ) 32 | { 33 | return (IsolationType != UefiIsolationTypeNone); 34 | } 35 | 36 | BOOLEAN 37 | IsIsolated( 38 | ) 39 | { 40 | return IsIsolatedEx(GetIsolationType()); 41 | } 42 | 43 | BOOLEAN 44 | IsHardwareIsolatedEx( 45 | UINT32 IsolationType 46 | ) 47 | { 48 | #if defined(MDE_CPU_AARCH64) 49 | return FALSE; 50 | #else 51 | return (IsolationType >= UefiIsolationTypeSnp); 52 | #endif 53 | } 54 | 55 | BOOLEAN 56 | IsHardwareIsolated( 57 | ) 58 | { 59 | #if defined(MDE_CPU_AARCH64) 60 | return FALSE; 61 | #else 62 | return IsHardwareIsolatedEx(GetIsolationType()); 63 | #endif 64 | } 65 | 66 | BOOLEAN 67 | IsSoftwareIsolatedEx( 68 | UINT32 IsolationType 69 | ) 70 | { 71 | return (IsolationType == UefiIsolationTypeVbs); 72 | } 73 | 74 | BOOLEAN 75 | IsSoftwareIsolated( 76 | ) 77 | { 78 | return IsSoftwareIsolatedEx(GetIsolationType()); 79 | } 80 | 81 | BOOLEAN 82 | IsHardwareIsolatedNoParavisorEx( 83 | UINT32 IsolationType, 84 | BOOLEAN IsParavisorPresent 85 | ) 86 | { 87 | #if defined(MDE_CPU_AARCH64) 88 | return FALSE; 89 | #else 90 | return (IsHardwareIsolatedEx(IsolationType) && !IsParavisorPresent); 91 | #endif 92 | } 93 | 94 | BOOLEAN 95 | IsHardwareIsolatedNoParavisor( 96 | ) 97 | { 98 | #if defined(MDE_CPU_AARCH64) 99 | return FALSE; 100 | #else 101 | return IsHardwareIsolatedNoParavisorEx(GetIsolationType(), IsParavisorPresent()); 102 | #endif 103 | } -------------------------------------------------------------------------------- /MsvmPkg/Library/IsolationLib/IsolationLib.inf: -------------------------------------------------------------------------------- 1 | ## @file 2 | # This library implements helper routines to facilitate Isolation checks. 3 | # 4 | # Copyright (c) Microsoft Corporation. 5 | # SPDX-License-Identifier: BSD-2-Clause-Patent 6 | # 7 | ## 8 | 9 | [Defines] 10 | INF_VERSION = 0x00010005 11 | BASE_NAME = IsolationLib 12 | FILE_GUID = 50c4ccb1-a610-47d6-ae29-9e8368091795 13 | MODULE_TYPE = BASE 14 | VERSION_STRING = 1.0 15 | LIBRARY_CLASS = IsolationLib 16 | 17 | [Sources] 18 | IsolationLib.c 19 | 20 | [Packages] 21 | MdePkg/MdePkg.dec 22 | MsvmPkg/MsvmPkg.dec 23 | 24 | [Pcd] 25 | gMsvmPkgTokenSpaceGuid.PcdIsolationArchitecture 26 | gMsvmPkgTokenSpaceGuid.PcdIsolationParavisorPresent -------------------------------------------------------------------------------- /MsvmPkg/Library/KdPL011SerialPortLib/KdPL011SerialPortLib.inf: -------------------------------------------------------------------------------- 1 | #/** @file 2 | # 3 | # Component description file for PL011SerialPortLib module 4 | # 5 | # Copyright (c) 2011-2016, ARM Ltd. All rights reserved.
6 | # 7 | # SPDX-License-Identifier: BSD-2-Clause-Patent 8 | # 9 | #**/ 10 | 11 | #Override : 00000002 | ArmPlatformPkg/Library/PL011SerialPortLib/PL011SerialPortLib.inf | 444621e3ec61c11d66caf1d7d44c50e9 | 2024-10-04T16-30-42 | 4846544a82b36eb5e82b842cf332f8d8821d862e 12 | 13 | [Defines] 14 | INF_VERSION = 0x00010006 15 | BASE_NAME = KdPL011SerialPortLib 16 | FILE_GUID = 4da0fbb5-2901-4736-96da-a20ad2dd1dc0 17 | MODULE_TYPE = BASE 18 | VERSION_STRING = 1.0 19 | LIBRARY_CLASS = SerialPortLib 20 | 21 | [Sources.common] 22 | KdPL011SerialPortLib.c 23 | 24 | [LibraryClasses] 25 | PL011UartClockLib 26 | PL011UartLib 27 | PcdLib 28 | 29 | [Packages] 30 | EmbeddedPkg/EmbeddedPkg.dec 31 | MdePkg/MdePkg.dec 32 | MdeModulePkg/MdeModulePkg.dec 33 | MsvmPkg/MsvmPkg.dec 34 | ArmPlatformPkg/ArmPlatformPkg.dec 35 | 36 | [Pcd] 37 | # gEfiMdeModulePkgTokenSpaceGuid.PcdSerialRegisterBase ## MS_HYP_CHANGE 38 | 39 | [FixedPcd] 40 | gMsvmPkgTokenSpaceGuid.PcdCom1RegisterBase ## MS_HYP_CHANGE 41 | gEfiMdePkgTokenSpaceGuid.PcdUartDefaultBaudRate 42 | gEfiMdePkgTokenSpaceGuid.PcdUartDefaultDataBits 43 | gEfiMdePkgTokenSpaceGuid.PcdUartDefaultParity 44 | gEfiMdePkgTokenSpaceGuid.PcdUartDefaultStopBits 45 | gArmPlatformTokenSpaceGuid.PL011UartClkInHz -------------------------------------------------------------------------------- /MsvmPkg/Library/LegacyMtrrLib/MtrrLib.inf: -------------------------------------------------------------------------------- 1 | ## @file 2 | # MTRR library provides APIs for MTRR operation. 3 | # 4 | # Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
5 | # SPDX-License-Identifier: BSD-2-Clause-Patent 6 | # 7 | ## 8 | 9 | [Defines] 10 | INF_VERSION = 0x00010005 11 | BASE_NAME = MtrrLib 12 | MODULE_UNI_FILE = MtrrLib.uni 13 | FILE_GUID = 6826b408-f4f3-47ee-917f-af7047f9d937 14 | MODULE_TYPE = BASE 15 | VERSION_STRING = 1.0 16 | LIBRARY_CLASS = MtrrLib 17 | 18 | 19 | # 20 | # The following information is for reference only and not required by the build tools. 21 | # 22 | # VALID_ARCHITECTURES = IA32 X64 23 | # 24 | 25 | [Sources] 26 | MtrrLib.c 27 | 28 | [Packages] 29 | MdePkg/MdePkg.dec 30 | UefiCpuPkg/UefiCpuPkg.dec 31 | 32 | [LibraryClasses] 33 | BaseMemoryLib 34 | BaseLib 35 | CpuLib 36 | DebugLib 37 | 38 | [Pcd] 39 | gUefiCpuPkgTokenSpaceGuid.PcdCpuNumberOfReservedVariableMtrrs ## SOMETIMES_CONSUMES 40 | 41 | -------------------------------------------------------------------------------- /MsvmPkg/Library/LegacyMtrrLib/MtrrLib.uni: -------------------------------------------------------------------------------- 1 | // /** @file 2 | // MTRR library provides APIs for MTRR operation. 3 | // 4 | // MTRR library provides APIs for MTRR operation. 5 | // 6 | // Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
7 | // 8 | // SPDX-License-Identifier: BSD-2-Clause-Patent 9 | // 10 | // **/ 11 | 12 | 13 | #string STR_MODULE_ABSTRACT #language en-US "MTRR library provides APIs for MTRR operation" 14 | 15 | #string STR_MODULE_DESCRIPTION #language en-US "MTRR library provides APIs for MTRR operation." 16 | 17 | -------------------------------------------------------------------------------- /MsvmPkg/Library/LegacyMtrrLib/UnitTest/MtrrLibUnitTestHost.inf: -------------------------------------------------------------------------------- 1 | ## @file 2 | # Unit tests of the MtrrLib instance of the MtrrLib class 3 | # 4 | # Copyright (c) 2020, Intel Corporation. All rights reserved.
5 | # SPDX-License-Identifier: BSD-2-Clause-Patent 6 | ## 7 | 8 | [Defines] 9 | INF_VERSION = 0x00010006 10 | BASE_NAME = MtrrLibUnitTestHost 11 | FILE_GUID = A1542D84-B64D-4847-885E-0509084376AB 12 | MODULE_TYPE = HOST_APPLICATION 13 | VERSION_STRING = 1.0 14 | 15 | # 16 | # The following information is for reference only and not required by the build tools. 17 | # 18 | # VALID_ARCHITECTURES = IA32 X64 19 | # 20 | 21 | [Sources] 22 | MtrrLibUnitTest.c 23 | MtrrLibUnitTest.h 24 | Support.c 25 | RandomNumber.c 26 | 27 | [Packages] 28 | MdePkg/MdePkg.dec 29 | UefiCpuPkg/UefiCpuPkg.dec 30 | UnitTestFrameworkPkg/UnitTestFrameworkPkg.dec 31 | 32 | [LibraryClasses] 33 | BaseLib 34 | BaseMemoryLib 35 | DebugLib 36 | MtrrLib 37 | UnitTestLib 38 | 39 | [Pcd] 40 | gUefiCpuPkgTokenSpaceGuid.PcdCpuNumberOfReservedVariableMtrrs ## SOMETIMES_CONSUMES 41 | 42 | [BuildOptions] 43 | MSFT:*_*_*_CC_FLAGS = -D _CRT_SECURE_NO_WARNINGS 44 | -------------------------------------------------------------------------------- /MsvmPkg/Library/MmioAllocationLib/MmioAllocationLib.inf: -------------------------------------------------------------------------------- 1 | ## @file 2 | # MMIO allocation library 3 | # 4 | # Copyright (c) Microsoft Corporation. 5 | # SPDX-License-Identifier: BSD-2-Clause-Patent 6 | # 7 | ## 8 | 9 | [Defines] 10 | INF_VERSION = 0x00010016 11 | BASE_NAME = MmioAllocationLib 12 | FILE_GUID = BD3BD6AB-E716-47AE-BCD4-C635A382E44B 13 | MODULE_TYPE = DXE_DRIVER 14 | VERSION_STRING = 1.0 15 | LIBRARY_CLASS = MmioAllocationLib|DXE_CORE DXE_DRIVER UEFI_APPLICATION UEFI_DRIVER 16 | CONSTRUCTOR = MmioAllocationLibConstructor 17 | 18 | [Sources] 19 | MmioAllocationLib.c 20 | 21 | [LibraryClasses] 22 | BaseLib 23 | BaseMemoryLib 24 | DebugLib 25 | EventLogLib 26 | MemoryAllocationLib 27 | PcdLib 28 | UefiBootServicesTableLib 29 | 30 | [Packages] 31 | MdePkg/MdePkg.dec 32 | MsvmPkg/MsvmPkg.dec 33 | 34 | [Pcd] 35 | gMsvmPkgTokenSpaceGuid.PcdHighMmioGapBasePageNumber 36 | gMsvmPkgTokenSpaceGuid.PcdHighMmioGapSizeInPages -------------------------------------------------------------------------------- /MsvmPkg/Library/MsBootPolicyLib/MsBootPolicyLib.inf: -------------------------------------------------------------------------------- 1 | ## @file 2 | # Library for accessing system settings for MsBootPolicy 3 | # 4 | # Copyright (c) Microsoft Corporation. 5 | # SPDX-License-Identifier: BSD-2-Clause-Patent 6 | # 7 | ## 8 | 9 | [Defines] 10 | INF_VERSION = 0x00010005 11 | BASE_NAME = MsBootPolicyLib 12 | FILE_GUID = a0011331-951e-490e-9375-a4ab0a7b1a1b 13 | MODULE_TYPE = DXE_DRIVER 14 | VERSION_STRING = 1.0 15 | LIBRARY_CLASS = MsBootPolicyLib | DXE_DRIVER UEFI_APPLICATION UEFI_DRIVER 16 | 17 | # 18 | # VALID_ARCHITECTURES = IA32 X64 19 | # 20 | 21 | [Sources] 22 | MsBootPolicyLib.c 23 | 24 | [Packages] 25 | MdePkg/MdePkg.dec 26 | MdeModulePkg/MdeModulePkg.dec 27 | PcBdsPkg/PcBdsPkg.dec 28 | 29 | [LibraryClasses] 30 | DebugLib 31 | DevicePathLib 32 | MemoryAllocationLib 33 | 34 | [Protocols] 35 | 36 | [Guids] 37 | 38 | [Pcd] 39 | -------------------------------------------------------------------------------- /MsvmPkg/Library/MsLogoLib/MsLogoLib.inf: -------------------------------------------------------------------------------- 1 | ## @file 2 | # General BDS defines and produce general interfaces for platform BDS driver including: 3 | # 1) BDS boot policy interface; 4 | # 2) BDS boot device connect interface; 5 | # 3) BDS Misc interfaces for mainting boot variable, ouput string, etc. 6 | # 7 | # Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved. 8 | # Copyright (c) Microsoft Corporation. 9 | # SPDX-License-Identifier: BSD-2-Clause-Patent 10 | # 11 | ## 12 | 13 | [Defines] 14 | INF_VERSION = 0x00010005 15 | BASE_NAME = MsLogoLib 16 | FILE_GUID = F5AE5B5C-42E8-4A9B-829D-5B631CD5367A 17 | MODULE_TYPE = DXE_DRIVER 18 | VERSION_STRING = 1.0 19 | LIBRARY_CLASS = MsLogoLib|DXE_DRIVER UEFI_APPLICATION DXE_RUNTIME_DRIVER 20 | CONSTRUCTOR = MsLogoLibConstructor 21 | 22 | # 23 | # The following information is for reference only and not required by the build tools. 24 | # 25 | # VALID_ARCHITECTURES = IA32 X64 IPF EBC 26 | # 27 | 28 | [Sources] 29 | Logo.c 30 | 31 | [Packages] 32 | MsvmPkg/MsvmPkg.dec 33 | MdePkg/MdePkg.dec 34 | MdeModulePkg/MdeModulePkg.dec 35 | MsGraphicsPkg/MsGraphicsPkg.dec 36 | 37 | 38 | [LibraryClasses] 39 | BaseLib 40 | BaseMemoryLib 41 | BmpSupportLib 42 | DebugLib 43 | DisplayDeviceStateLib 44 | DxeServicesLib 45 | MemoryAllocationLib 46 | PcdLib 47 | PrintLib 48 | UefiBootServicesTableLib 49 | UefiLib 50 | 51 | [Guids] 52 | 53 | [Protocols] 54 | gEdkiiBootLogo2ProtocolGuid # PROTOCOL SOMETIMES_CONSUMES 55 | gEfiGraphicsOutputProtocolGuid # PROTOCOL SOMETIMES_CONSUMES 56 | 57 | 58 | [FeaturePcd] 59 | 60 | 61 | [Pcd] 62 | gEfiMdeModulePkgTokenSpaceGuid.PcdConOutColumn 63 | gEfiMdeModulePkgTokenSpaceGuid.PcdConOutRow 64 | gEfiMdeModulePkgTokenSpaceGuid.PcdVideoHorizontalResolution 65 | gEfiMdeModulePkgTokenSpaceGuid.PcdVideoVerticalResolution 66 | gMsvmPkgTokenSpaceGuid.PcdLogoFile 67 | gMsvmPkgTokenSpaceGuid.PcdPostBackgroundColor 68 | gMsvmPkgTokenSpaceGuid.PcdPostBackgroundColoringSkipCount 69 | -------------------------------------------------------------------------------- /MsvmPkg/Library/MsPlatBdsLib/MsPlatBdsLib.inf: -------------------------------------------------------------------------------- 1 | ## @file 2 | # Platform BDS customizations library. 3 | # 4 | # Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved. 5 | # Copyright (c) Microsoft Corporation. 6 | # SPDX-License-Identifier: BSD-2-Clause-Patent 7 | # 8 | ## 9 | 10 | [Defines] 11 | INF_VERSION = 0x00010005 12 | BASE_NAME = MsPlatBdsLib 13 | FILE_GUID = 776856C3-576C-45DC-BBFE-6FA319F9262C 14 | MODULE_TYPE = DXE_DRIVER 15 | VERSION_STRING = 1.0 16 | LIBRARY_CLASS = MsPlatBdsLib|DXE_DRIVER 17 | 18 | # 19 | # The following information is for reference only and not required by the build tools. 20 | # 21 | # VALID_ARCHITECTURES = IA32 X64 IPF EBC 22 | # 23 | 24 | [Sources] 25 | BdsPlatform.c 26 | 27 | [Packages] 28 | MdePkg/MdePkg.dec 29 | MdeModulePkg/MdeModulePkg.dec 30 | MsvmPkg/MsvmPkg.dec 31 | 32 | [LibraryClasses] 33 | BaseLib 34 | BiosDeviceLib 35 | MemoryAllocationLib 36 | UefiBootServicesTableLib 37 | DebugLib 38 | BootEventLogLib 39 | 40 | [Pcd] 41 | 42 | [Protocols] 43 | 44 | [Guids] 45 | gEfiEventExitBootServicesGuid # CONSUMES 46 | gEfiEndOfDxeEventGroupGuid # CONSUMES -------------------------------------------------------------------------------- /MsvmPkg/Library/MsvmRngLib/AArch64/ArmRng.S: -------------------------------------------------------------------------------- 1 | #------------------------------------------------------------------------------ 2 | # 3 | # ArmRndr() for AArch64 4 | # 5 | # Copyright (c) 2021, NUVIA Inc. All rights reserved.
6 | # 7 | # SPDX-License-Identifier: BSD-2-Clause-Patent 8 | # 9 | #------------------------------------------------------------------------------ 10 | 11 | #include "ArmRng.h" 12 | 13 | .text 14 | .p2align 2 15 | GCC_ASM_EXPORT(ArmRndr) 16 | 17 | #/** 18 | # Generates a random number using RNDR. 19 | # Returns TRUE on success; FALSE on failure. 20 | # 21 | # @param[out] Rand Buffer pointer to store the 64-bit random value. 22 | # 23 | # @retval TRUE Random number generated successfully. 24 | # @retval FALSE Failed to generate the random number. 25 | # 26 | #**/ 27 | #BOOLEAN 28 | #EFIAPI 29 | #ArmRndr ( 30 | # OUT UINT64 *Rand 31 | # ); 32 | # 33 | ASM_PFX(ArmRndr): 34 | AARCH64_BTI(c) 35 | mrs x1, RNDR 36 | str x1, [x0] 37 | cset x0, ne // RNDR sets NZCV to 0b0100 on failure 38 | ret 39 | -------------------------------------------------------------------------------- /MsvmPkg/Library/MsvmRngLib/AArch64/ArmRng.asm: -------------------------------------------------------------------------------- 1 | ;------------------------------------------------------------------------------ 2 | ; 3 | ; ArmRndr() for AArch64 4 | ; 5 | ; Copyright (c) 2021, NUVIA Inc. All rights reserved.
6 | ; 7 | ; SPDX-License-Identifier: BSD-2-Clause-Patent 8 | ; 9 | ;------------------------------------------------------------------------------ 10 | 11 | #include "ArmRng.h" 12 | 13 | EXPORT ArmRndr 14 | AREA BaseLib_LowLevel, CODE, READONLY 15 | 16 | 17 | ;/** 18 | ; Generates a random number using RNDR. 19 | ; Returns TRUE on success; FALSE on failure. 20 | ; 21 | ; @param[out] Rand Buffer pointer to store the 64-bit random value. 22 | ; 23 | ; @retval TRUE Random number generated successfully. 24 | ; @retval FALSE Failed to generate the random number. 25 | ; 26 | ;**/ 27 | ;BOOLEAN 28 | ;EFIAPI 29 | ;ArmRndr ( 30 | ; OUT UINT64 *Rand 31 | ; ); 32 | ; 33 | ArmRndr 34 | mrs x1, RNDR 35 | str x1, [x0] 36 | cset x0, ne // RNDR sets NZCV to 0b0100 on failure 37 | ret 38 | 39 | END 40 | -------------------------------------------------------------------------------- /MsvmPkg/Library/MsvmRngLib/AArch64/ArmRng.h: -------------------------------------------------------------------------------- 1 | /** @file 2 | Random number generator service that uses the RNDR instruction 3 | to provide pseudorandom numbers. 4 | 5 | Copyright (c) 2021, NUVIA Inc. All rights reserved.
6 | 7 | SPDX-License-Identifier: BSD-2-Clause-Patent 8 | 9 | **/ 10 | 11 | #ifndef ARM_RNG_H_ 12 | #define ARM_RNG_H_ 13 | 14 | #include 15 | 16 | /** 17 | Generates a random number using RNDR. 18 | Returns TRUE on success; FALSE on failure. 19 | 20 | @param[out] Rand Buffer pointer to store the 64-bit random value. 21 | 22 | @retval TRUE Random number generated successfully. 23 | @retval FALSE Failed to generate the random number. 24 | 25 | **/ 26 | BOOLEAN 27 | EFIAPI 28 | ArmRndr ( 29 | OUT UINT64 *Rand 30 | ); 31 | 32 | #endif /* ARM_RNG_H_ */ 33 | -------------------------------------------------------------------------------- /MsvmPkg/Library/MsvmRngLib/BaseRngLib.uni: -------------------------------------------------------------------------------- 1 | // /** @file 2 | // Instance of RNG (Random Number Generator) Library. 3 | // 4 | // BaseRng Library that uses CPU RNG instructions to provide 5 | // random numbers. 6 | // 7 | // Copyright (c) 2015, Intel Corporation. All rights reserved.
8 | // 9 | // SPDX-License-Identifier: BSD-2-Clause-Patent 10 | // 11 | // **/ 12 | 13 | 14 | #string STR_MODULE_ABSTRACT #language en-US "Instance of RNG Library" 15 | 16 | #string STR_MODULE_DESCRIPTION #language en-US "BaseRng Library that uses CPU RNG instructions to provide random numbers" 17 | -------------------------------------------------------------------------------- /MsvmPkg/Library/MsvmRngLib/BaseRngLibInternals.h: -------------------------------------------------------------------------------- 1 | /** @file 2 | 3 | Architecture specific interface to RNG functionality. 4 | 5 | Copyright (c) 2021, NUVIA Inc. All rights reserved.
6 | 7 | SPDX-License-Identifier: BSD-2-Clause-Patent 8 | 9 | **/ 10 | 11 | #ifndef BASE_RNGLIB_INTERNALS_H_ 12 | #define BASE_RNGLIB_INTERNALS_H_ 13 | 14 | /** 15 | Generates a 16-bit random number. 16 | 17 | @param[out] Rand Buffer pointer to store the 16-bit random value. 18 | 19 | @retval TRUE Random number generated successfully. 20 | @retval FALSE Failed to generate the random number. 21 | 22 | **/ 23 | BOOLEAN 24 | EFIAPI 25 | ArchGetRandomNumber16 ( 26 | OUT UINT16 *Rand 27 | ); 28 | 29 | /** 30 | Generates a 32-bit random number. 31 | 32 | @param[out] Rand Buffer pointer to store the 32-bit random value. 33 | 34 | @retval TRUE Random number generated successfully. 35 | @retval FALSE Failed to generate the random number. 36 | 37 | **/ 38 | BOOLEAN 39 | EFIAPI 40 | ArchGetRandomNumber32 ( 41 | OUT UINT32 *Rand 42 | ); 43 | 44 | /** 45 | Generates a 64-bit random number. 46 | 47 | @param[out] Rand Buffer pointer to store the 64-bit random value. 48 | 49 | @retval TRUE Random number generated successfully. 50 | @retval FALSE Failed to generate the random number. 51 | 52 | **/ 53 | BOOLEAN 54 | EFIAPI 55 | ArchGetRandomNumber64 ( 56 | OUT UINT64 *Rand 57 | ); 58 | 59 | /** 60 | Checks whether the RNG instruction is supported. 61 | 62 | @retval TRUE RNG instruction is supported. 63 | @retval FALSE RNG instruction is not supported. 64 | 65 | **/ 66 | BOOLEAN 67 | EFIAPI 68 | ArchIsRngSupported ( 69 | VOID 70 | ); 71 | 72 | #endif // BASE_RNGLIB_INTERNALS_H_ 73 | -------------------------------------------------------------------------------- /MsvmPkg/Library/MsvmRngLib/MsvmRngLibInternals.h: -------------------------------------------------------------------------------- 1 | /** @file 2 | MsvmPkg specific interface to RNG functionality. 3 | 4 | Copyright (c) Microsoft Corporation. 5 | SPDX-License-Identifier: BSD-2-Clause-Patent 6 | **/ 7 | 8 | #pragma once 9 | 10 | /** 11 | The constructor function checks whether or not RNDR instruction is supported 12 | by the host hardware. 13 | 14 | The constructor function checks whether or not RNDR instruction is supported. 15 | It will ASSERT() if RNDR instruction is not supported. 16 | It will always return EFI_SUCCESS. 17 | 18 | @retval EFI_SUCCESS The constructor always returns EFI_SUCCESS. 19 | 20 | **/ 21 | EFI_STATUS 22 | EFIAPI 23 | BaseRngLibConstructor ( 24 | VOID 25 | ); 26 | 27 | 28 | /** 29 | Generate RNG fom the host using the BiosDevice. 30 | 31 | @param SizeInBytes Bytes to generate. 32 | @param[out] Rand Buffer pointer to store the random value. 33 | 34 | @retval TRUE Random number generated successfully. 35 | @retval FALSE Failed to generate the random number. 36 | 37 | **/ 38 | BOOLEAN 39 | ProcessUsingHostEmulation ( 40 | UINTN SizeInBytes, 41 | OUT UINT8 *Rand 42 | ); 43 | -------------------------------------------------------------------------------- /MsvmPkg/Library/MsvmRngLib/Riscv/Seed.S: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // RISC-V cache operation. 4 | // 5 | // Copyright (c) 2024, Rivos Inc. All rights reserved.
6 | // 7 | // SPDX-License-Identifier: BSD-2-Clause-Patent 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | #include 12 | 13 | .text 14 | .p2align 4 15 | 16 | ASM_FUNC (ReadSeed) 17 | #The SEED CSR must only be accessed with read-write instructions 18 | csrrw a0, CSR_SEED, x0 19 | ret 20 | -------------------------------------------------------------------------------- /MsvmPkg/Library/PCUart/PCUart.inf: -------------------------------------------------------------------------------- 1 | ## @file 2 | # Component description file for PCUart module 3 | # 4 | # Copyright (c) Microsoft Corporation. 5 | # SPDX-License-Identifier: BSD-2-Clause-Patent 6 | # 7 | ## 8 | 9 | [Defines] 10 | INF_VERSION = 0x00010005 11 | BASE_NAME = PCUart 12 | FILE_GUID = 10cc790a-3c40-49e6-aea2-d7c0728de9b9 13 | MODULE_TYPE = BASE 14 | VERSION_STRING = 1.0 15 | LIBRARY_CLASS = PCUartLib 16 | 17 | [Sources.common] 18 | PCUart.c 19 | 20 | [LibraryClasses] 21 | DebugLib 22 | IoLib 23 | 24 | [Packages] 25 | MdePkg/MdePkg.dec 26 | MsvmPkg/MsvmPkg.dec 27 | 28 | [FixedPcd] 29 | -------------------------------------------------------------------------------- /MsvmPkg/Library/PlatformThemeLib/PlatformThemeLib.inf: -------------------------------------------------------------------------------- 1 | ## @file 2 | # Supplies the platform theme. 3 | # 4 | # Copyright (c) Microsoft Corporation. 5 | # SPDX-License-Identifier: BSD-2-Clause-Patent 6 | ## 7 | 8 | [Defines] 9 | INF_VERSION = 0x00010005 10 | BASE_NAME = PlatformThemeLib 11 | FILE_GUID = 511bca7c-3c33-433c-85c5-5e3eb2bfcb8f 12 | MODULE_TYPE = BASE 13 | VERSION_STRING = 1.0 14 | LIBRARY_CLASS = PlatformThemeLib 15 | 16 | # 17 | # VALID_ARCHITECTURES = IA32 X64 18 | # 19 | 20 | [Sources] 21 | PlatformThemeLib.c 22 | 23 | [Packages] 24 | MdePkg/MdePkg.dec 25 | MdeModulePkg/MdeModulePkg.dec 26 | MsGraphicsPkg/MsGraphicsPkg.dec 27 | MsvmPkg/MsvmPkg.dec 28 | 29 | [LibraryClasses] 30 | DebugLib 31 | 32 | [Protocols] 33 | 34 | [Guids] 35 | -------------------------------------------------------------------------------- /MsvmPkg/Library/ResetSystemLib/ResetSystemLib.inf: -------------------------------------------------------------------------------- 1 | ## @file 2 | # Library instance for ResetSystem library class for Hyper-V 3 | # 4 | # Copyright (c) Microsoft Corporation. 5 | # SPDX-License-Identifier: BSD-2-Clause-Patent 6 | # 7 | ## 8 | 9 | [Defines] 10 | INF_VERSION = 0x00010005 11 | BASE_NAME = HvResetSystemLib 12 | FILE_GUID = EC4F3E59-F879-418b-9E4C-7D6F434714A0 13 | MODULE_TYPE = BASE 14 | VERSION_STRING = 1.0 15 | LIBRARY_CLASS = HwResetSystemLib 16 | 17 | # 18 | # The following information is for reference only and not required by the build tools. 19 | # 20 | # VALID_ARCHITECTURES = IA32 X64 IPF 21 | # 22 | 23 | [Sources] 24 | ResetSystemLib.c 25 | 26 | [Packages] 27 | MsvmPkg/MsvmPkg.dec 28 | MdePkg/MdePkg.dec 29 | MdeModulePkg/MdeModulePkg.dec 30 | 31 | [LibraryClasses] 32 | DebugLib 33 | IoLib 34 | -------------------------------------------------------------------------------- /MsvmPkg/Library/SourceDebugEnabled/SourceDebugEnabledLib.c: -------------------------------------------------------------------------------- 1 | /** @file 2 | This module implements routines that indicate if source debugging is 3 | runtime enabled for DXE only. 4 | 5 | Copyright (c) Microsoft Corporation. 6 | SPDX-License-Identifier: BSD-2-Clause-Patent 7 | --*/ 8 | 9 | #include 10 | #include 11 | #include 12 | #include 13 | 14 | /** 15 | Check if source debugging is runtime enabled. 16 | 17 | @InitFlag Supplies a value that indicates what kind of initialization 18 | is being performed. Ignored. 19 | 20 | @return TRUE Source debugging is enabled. 21 | @return FALSE Source debugging is not enabled. 22 | 23 | **/ 24 | BOOLEAN 25 | EFIAPI 26 | IsSourceDebugEnabled ( 27 | IN UINT32 InitFlag 28 | ) 29 | { 30 | BOOLEAN debugEnabled = FALSE; 31 | 32 | // 33 | // There are two ways to figure out if debugging is enabled: 34 | // 1. Use the PcdDebuggerEnabled set in PEI 35 | // 2. Use the hob passed that contains if the debugger is enabled 36 | // 37 | // We use the hob here since we don't know exactly when this function could 38 | // be called. If it's called before PCDs are available, early on in DxeCore, 39 | // the system will die in mysterious ways. 40 | // 41 | // This is the same behavior done with the older debug stubs on X64. 42 | // 43 | void* hob = GetFirstGuidHob(&gMsvmDebuggerEnabledGuid); 44 | if (hob != NULL) 45 | { 46 | debugEnabled = *((BOOLEAN *)GET_GUID_HOB_DATA(hob)); 47 | } 48 | else 49 | { 50 | // We should always be passing this HOB. 51 | // ASSERT(FALSE); 52 | } 53 | 54 | return debugEnabled; 55 | } 56 | -------------------------------------------------------------------------------- /MsvmPkg/Library/SourceDebugEnabled/SourceDebugEnabledLib.inf: -------------------------------------------------------------------------------- 1 | ## @file 2 | # Checks if source debugging is runtime enabled. 3 | # 4 | # Copyright (c) Microsoft Corporation. 5 | # SPDX-License-Identifier: BSD-2-Clause-Patent 6 | # 7 | ## 8 | 9 | [Defines] 10 | INF_VERSION = 0x00010005 11 | BASE_NAME = SourceDebugEnabledLib 12 | FILE_GUID = 29dca2b8-3db9-45f9-994e-5c7cc78e5a26 13 | MODULE_TYPE = BASE 14 | VERSION_STRING = 1.0 15 | LIBRARY_CLASS = SourceDebugEnabledLib 16 | 17 | # 18 | # The following information is for reference only and not required by the build tools. 19 | # 20 | # VALID_ARCHITECTURES = IA32 X64 AARCH64 21 | # 22 | 23 | [Sources.Common] 24 | SourceDebugEnabledLib.c 25 | 26 | [Packages] 27 | MdePkg/MdePkg.dec 28 | MsvmPkg/MsvmPkg.dec 29 | 30 | [LibraryClasses] 31 | HobLib 32 | 33 | [Guids] 34 | gMsvmDebuggerEnabledGuid 35 | 36 | [Packages] 37 | MdePkg/MdePkg.dec 38 | MdeModulePkg/MdeModulePkg.dec 39 | SourceLevelDebugPkg/SourceLevelDebugPkg.dec -------------------------------------------------------------------------------- /MsvmPkg/Library/Tcg2PhysicalPresencePromptLibApprove/Tcg2PhysicalPresencePromptLibApprove.c: -------------------------------------------------------------------------------- 1 | /** @file 2 | This instance of the Tcg2PhysicalPresencePromptLib approves all requests without prompting. 3 | 4 | Copyright (c) Microsoft Corporation. 5 | SPDX-License-Identifier: BSD-2-Clause-Patent 6 | --*/ 7 | 8 | #include 9 | 10 | 11 | /** 12 | Simple function to inform any callers of whether the lib is ready to present a prompt. 13 | Since the prompt itself only returns TRUE or FALSE, make sure all other technical requirements 14 | are out of the way. 15 | 16 | @retval EFI_SUCCESS Prompt is ready. 17 | @retval EFI_NOT_READY Prompt does not have sufficient resources at this time. 18 | @retval EFI_DEVICE_ERROR Library failed to prepare resources. 19 | 20 | **/ 21 | EFI_STATUS 22 | EFIAPI 23 | IsPromptReady ( 24 | VOID 25 | ) 26 | { 27 | return EFI_SUCCESS; 28 | } // IsPromptReady() 29 | 30 | 31 | /** 32 | This function will take in a prompt string to present to the user in a 33 | OK/Cancel dialog box and return TRUE if the user actively pressed OK. Returns 34 | FALSE on Cancel or any errors. 35 | 36 | @param[in] PromptString The string that should occupy the body of the prompt. 37 | 38 | @retval TRUE User confirmed action. 39 | @retval FALSE User rejected action or a failure occurred. 40 | 41 | **/ 42 | BOOLEAN 43 | EFIAPI 44 | PromptForUserConfirmation ( 45 | IN CHAR16 *PromptString 46 | ) 47 | { 48 | return TRUE; 49 | } // PromptForUserConfirmation() 50 | -------------------------------------------------------------------------------- /MsvmPkg/Library/Tcg2PhysicalPresencePromptLibApprove/Tcg2PhysicalPresencePromptLibApprove.inf: -------------------------------------------------------------------------------- 1 | ## @file 2 | # This instance of the Tcg2PhysicalPresencePromptLib approves all requests without prompting. 3 | # 4 | # Copyright (c) Microsoft Corporation. 5 | # SPDX-License-Identifier: BSD-2-Clause-Patent 6 | # 7 | ## 8 | 9 | # MS_CHANGE: Entire file created. 10 | 11 | [Defines] 12 | INF_VERSION = 0x00010017 13 | BASE_NAME = Tcg2PhysicalPresencePromptLibApprove 14 | FILE_GUID = 9515E7CC-3320-4E2E-AFD9-1FEBFDBEFF69 15 | VERSION_STRING = 1.0 16 | MODULE_TYPE = DXE_DRIVER 17 | LIBRARY_CLASS = Tcg2PhysicalPresencePromptLib|DXE_DRIVER 18 | 19 | # 20 | # The following information is for reference only and not required by the build tools. 21 | # 22 | # VALID_ARCHITECTURES = X64 23 | # 24 | 25 | 26 | [Sources] 27 | Tcg2PhysicalPresencePromptLibApprove.c 28 | 29 | 30 | [Packages] 31 | MdePkg/MdePkg.dec 32 | 33 | 34 | [LibraryClasses] 35 | BaseLib 36 | -------------------------------------------------------------------------------- /MsvmPkg/Library/Tcg2PreInitLib/Tcg2PreInitLibDxe.inf: -------------------------------------------------------------------------------- 1 | ## @file 2 | # Tpm2 intialization hooks specific to the MSFT0101 virtual TPM device. 3 | # 4 | # Copyright (c) Microsoft Corporation. 5 | # SPDX-License-Identifier: BSD-2-Clause-Patent 6 | # 7 | ## 8 | 9 | 10 | [Defines] 11 | INF_VERSION = 0x00010017 12 | BASE_NAME = Tcg2PreInitLibDxe 13 | FILE_GUID = B88E201F-38D0-4D2C-A6E1-B6ED99ED808E 14 | VERSION_STRING = 1.0 15 | MODULE_TYPE = DXE_DRIVER 16 | LIBRARY_CLASS = NULL|DXE_DRIVER 17 | CONSTRUCTOR = MsvmTpm2InitLibConstructorDxe 18 | 19 | # 20 | # The following information is for reference only and not required by the build tools. 21 | # 22 | # VALID_ARCHITECTURES = IA32 X64 AARCH64 23 | # 24 | 25 | 26 | [Sources] 27 | Tpm2Acpi.c 28 | Tcg2PreInitLibDxe.c 29 | 30 | 31 | [LibraryClasses] 32 | BaseLib 33 | BaseMemoryLib 34 | DebugLib 35 | IoLib 36 | PcdLib 37 | Tpm2DeviceLib 38 | UefiBootServicesTableLib 39 | 40 | 41 | [Packages] 42 | MdePkg/MdePkg.dec 43 | MdeModulePkg/MdeModulePkg.dec 44 | SecurityPkg/SecurityPkg.dec 45 | MsvmPkg/MsvmPkg.dec 46 | 47 | 48 | [Pcd] 49 | gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiDefaultOemId ## CONSUMES 50 | gEfiSecurityPkgTokenSpaceGuid.PcdTpmBaseAddress ## CONSUMES 51 | gEfiSecurityPkgTokenSpaceGuid.PcdTpmInstanceGuid ## CONSUMES 52 | gMsvmPkgTokenSpaceGuid.PcdTpmLocalityRegsEnabled ## CONSUMES 53 | 54 | 55 | [Guids] 56 | gEfiTpmDeviceInstanceNoneGuid ## CONSUMES 57 | gEfiTpmDeviceInstanceTpm12Guid ## CONSUMES 58 | 59 | 60 | [Protocols] 61 | gEfiAcpiTableProtocolGuid ## CONSUMES 62 | 63 | 64 | [Depex] 65 | gEfiAcpiTableProtocolGuid 66 | -------------------------------------------------------------------------------- /MsvmPkg/Library/Tcg2PreInitLib/Tcg2PreInitLibPei.inf: -------------------------------------------------------------------------------- 1 | ## @file 2 | # Tpm2 intialization hooks specific to the MSFT0101 virtual TPM device. 3 | # 4 | # Copyright (c) Microsoft Corporation. 5 | # SPDX-License-Identifier: BSD-2-Clause-Patent 6 | # 7 | ## 8 | 9 | 10 | [Defines] 11 | INF_VERSION = 0x00010017 12 | BASE_NAME = Tcg2PreInitLibPei 13 | FILE_GUID = B0C518E2-BB65-424E-93E2-D9D28783722B 14 | VERSION_STRING = 1.0 15 | MODULE_TYPE = PEIM 16 | LIBRARY_CLASS = NULL|PEIM 17 | CONSTRUCTOR = MsvmTpm2InitLibConstructorPei 18 | 19 | # 20 | # The following information is for reference only and not required by the build tools. 21 | # 22 | # VALID_ARCHITECTURES = IA32 X64 AARCH64 23 | # 24 | 25 | 26 | [Sources] 27 | Tcg2PreInitLibPei.c 28 | 29 | 30 | [LibraryClasses] 31 | BaseMemoryLib 32 | DebugLib 33 | IoLib 34 | PcdLib 35 | PeiServicesLib 36 | Tpm2DeviceLib 37 | 38 | 39 | [Packages] 40 | MdePkg/MdePkg.dec 41 | SecurityPkg/SecurityPkg.dec 42 | MsvmPkg/MsvmPkg.dec 43 | 44 | 45 | [Guids] 46 | gEfiTpmDeviceInstanceNoneGuid ## SOMETIMES_CONSUMES 47 | 48 | 49 | [Pcd] 50 | gEfiSecurityPkgTokenSpaceGuid.PcdTpmBaseAddress ## CONSUMES 51 | gEfiSecurityPkgTokenSpaceGuid.PcdTpmInstanceGuid ## CONSUMES # SOMETIMES_PRODUCES 52 | gMsvmPkgTokenSpaceGuid.PcdTpmEnabled ## CONSUMES 53 | gMsvmPkgTokenSpaceGuid.PcdTpmLocalityRegsEnabled ## CONSUMES 54 | 55 | [Depex] 56 | gEfiPeiMasterBootModePpiGuid ## This is published by PlatformPei, so this ensures that all config is done first. 57 | -------------------------------------------------------------------------------- /MsvmPkg/Library/Tpm2DeviceLib/Tpm2DeviceLib.inf: -------------------------------------------------------------------------------- 1 | ## @file 2 | # This is an implementation of Tpm2DeviceLib that is specific to the Hyper-V 3 | # guest firmware. 4 | # 5 | # Copyright (c) Microsoft Corporation. 6 | # SPDX-License-Identifier: BSD-2-Clause-Patent 7 | # 8 | ## 9 | 10 | #Override : 00000002 | SecurityPkg/Library/Tpm2DeviceLibTcg2/Tpm2DeviceLibTcg2.inf | 578ea45b40640f53e4ff9a6d9cbab60b | 2025-09-23T22-30-23 | b18d13dc01fde292cb97fb5631095d1b9252358b 11 | 12 | [Defines] 13 | INF_VERSION = 0x00010005 14 | BASE_NAME = Tpm2DeviceLib 15 | MODULE_UNI_FILE = Tpm2DeviceLib.uni 16 | FILE_GUID = CEF38845-C766-4EA8-BDF5-D2AB2126B213 17 | MODULE_TYPE = BASE ## MS_HYP_CHANGE 18 | VERSION_STRING = 1.0 19 | LIBRARY_CLASS = Tpm2DeviceLib|PEIM DXE_DRIVER DXE_RUNTIME_DRIVER DXE_SMM_DRIVER UEFI_APPLICATION UEFI_DRIVER # MS_HYP_CHANGE 20 | 21 | # 22 | # The following information is for reference only and not required by the build tools. 23 | # 24 | # VALID_ARCHITECTURES = IA32 X64 25 | # 26 | 27 | [Sources] 28 | Tpm2DeviceLib.c 29 | 30 | [Packages] 31 | MdePkg/MdePkg.dec 32 | SecurityPkg/SecurityPkg.dec 33 | MsvmPkg/MsvmPkg.dec 34 | 35 | [LibraryClasses] 36 | BaseLib 37 | BaseMemoryLib 38 | DebugLib 39 | # UefiBootServicesTableLib ## MS_HYP_CHANGE 40 | IoLib ## MS_HYP_CHANGE 41 | PcdLib ## MS_HYP_CHANGE 42 | TimerLib ## MS_HYP_CHANGE 43 | 44 | 45 | [Pcd] 46 | # gEfiTcg2ProtocolGuid ## CONSUMES ## MS_HYP_CHANGE 47 | gEfiSecurityPkgTokenSpaceGuid.PcdTpmBaseAddress ## CONSUMES ## MS_HYP_CHANGE 48 | -------------------------------------------------------------------------------- /MsvmPkg/Library/Tpm2DeviceLib/Tpm2DeviceLib.uni: -------------------------------------------------------------------------------- 1 | /** @file 2 | This is an implementation of Tpm2DeviceLib that is specific to the MSFT0101 3 | virtual TPM. 4 | 5 | Copyright (c) Microsoft Corporation. 6 | SPDX-License-Identifier: BSD-2-Clause-Patent 7 | 8 | **/ 9 | 10 | #string STR_MODULE_ABSTRACT #language en-US "Provides function interfaces to communicate with TPM 2.0 device" 11 | 12 | #string STR_MODULE_DESCRIPTION #language en-US "This library helps to use TPM 2.0 device API on the MSFT0101 virtual TPM." 13 | 14 | -------------------------------------------------------------------------------- /MsvmPkg/Library/WatchdogTimerLib/WatchdogTimerLib.inf: -------------------------------------------------------------------------------- 1 | ## @file 2 | # Watchdog Timer Library instance. 3 | # 4 | # Copyright (c) Microsoft Corporation. 5 | # SPDX-License-Identifier: BSD-2-Clause-Patent 6 | # 7 | ## 8 | 9 | [Defines] 10 | INF_VERSION = 0x00010016 11 | BASE_NAME = MsvmWatchdogTimerLib 12 | FILE_GUID = 5AC0AB9B-AC06-43F9-AFF9-89E13FD17008 13 | MODULE_TYPE = BASE 14 | VERSION_STRING = 1.0 15 | LIBRARY_CLASS = WatchdogTimerLib 16 | 17 | [Sources] 18 | WatchdogTimerLib.c 19 | 20 | [LibraryClasses] 21 | BiosDeviceLib 22 | IsolationLib 23 | 24 | [Packages] 25 | MdePkg/MdePkg.dec 26 | MsvmPkg/MsvmPkg.dec 27 | -------------------------------------------------------------------------------- /MsvmPkg/MsvmPcAtRealTimeClockRuntimeDxe/PcRtc.uni: -------------------------------------------------------------------------------- 1 | // /** @file 2 | // PcRtc driver to install EFI_REAL_TIME_CLOCK_ARCH_PROTOCOL 3 | // 4 | // PcRtc driver to install EFI_REAL_TIME_CLOCK_ARCH_PROTOCOL. 5 | // 6 | // This driver provides GetTime, SetTime, GetWakeupTime, SetWakeupTime services to Runtime Service Table. 7 | // It will install a tagging protocol with gEfiRealTimeClockArchProtocolGuid. 8 | // 9 | // Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
10 | // 11 | // SPDX-License-Identifier: BSD-2-Clause-Patent 12 | // 13 | // **/ 14 | 15 | 16 | #string STR_MODULE_ABSTRACT #language en-US "PcRtc driver to install EFI_REAL_TIME_CLOCK_ARCH_PROTOCOL" 17 | 18 | #string STR_MODULE_DESCRIPTION #language en-US "This driver provides GetTime, SetTime, GetWakeupTime, SetWakeupTime services to Runtime Service Table. It will install a tagging protocol with gEfiRealTimeClockArchProtocolGuid." 19 | 20 | -------------------------------------------------------------------------------- /MsvmPkg/MsvmPcAtRealTimeClockRuntimeDxe/PcRtcExtra.uni: -------------------------------------------------------------------------------- 1 | // /** @file 2 | // PcRtc Localized Strings and Content 3 | // 4 | // Copyright (c) 2013 - 2018, Intel Corporation. All rights reserved.
5 | // 6 | // SPDX-License-Identifier: BSD-2-Clause-Patent 7 | // 8 | // **/ 9 | 10 | #string STR_PROPERTIES_MODULE_NAME 11 | #language en-US 12 | "PCAT Real Time Clock DXE Driver" 13 | 14 | 15 | -------------------------------------------------------------------------------- /MsvmPkg/NetvscDxe/WaitForPacket.c: -------------------------------------------------------------------------------- 1 | /** @file 2 | Event handler to check for available packet. 3 | 4 | Copyright (c) 2004 - 2018, Intel Corporation. All rights reserved.
5 | Copyright (c) Microsoft Corporation. 6 | SPDX-License-Identifier: BSD-2-Clause-Patent 7 | 8 | **/ 9 | 10 | #include "Snp.h" 11 | 12 | /** 13 | Notification call back function for WaitForPacket event. 14 | 15 | @param Event EFI Event. 16 | @param SnpPtr Pointer to SNP_DRIVER structure. 17 | 18 | **/ 19 | VOID 20 | EFIAPI 21 | SnpWaitForPacketNotify ( 22 | EFI_EVENT Event, 23 | VOID *SnpPtr 24 | ) 25 | { 26 | // 27 | // Do nothing if either parameter is a NULL pointer. 28 | // 29 | if ((Event == NULL) || (SnpPtr == NULL)) { 30 | return; 31 | } 32 | 33 | // 34 | // Do nothing if the SNP interface is not initialized. 35 | // 36 | switch (((SNP_DRIVER *)SnpPtr)->Mode.State) { 37 | case EfiSimpleNetworkInitialized: 38 | break; 39 | 40 | case EfiSimpleNetworkStopped: 41 | case EfiSimpleNetworkStarted: 42 | default: 43 | return; 44 | } 45 | 46 | // MS_HYP_CHANGE BEGIN 47 | NIC_DATA_INSTANCE *adapterInfo; 48 | adapterInfo = &(((SNP_DRIVER *) SnpPtr)->AdapterContext->NicInfo); 49 | if (!RxQueueIsEmpty(&adapterInfo->RxPacketQueue)) 50 | { 51 | // MS_HYP_CHANGE END 52 | gBS->SignalEvent (Event); 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /MsvmPkg/NvmExpressDxe/NvmExpressDxe.uni: -------------------------------------------------------------------------------- 1 | // /** @file 2 | // NVM Express Host Controller Module. 3 | // 4 | // NvmExpressDxe driver is used to manage non-volatile memory subsystem which follows 5 | // NVM Express specification. 6 | // 7 | // Copyright (c) 2013 - 2014, Intel Corporation. All rights reserved.
8 | // 9 | // SPDX-License-Identifier: BSD-2-Clause-Patent 10 | // 11 | // **/ 12 | 13 | 14 | #string STR_MODULE_ABSTRACT #language en-US "NVM Express Host Controller Module" 15 | 16 | #string STR_MODULE_DESCRIPTION #language en-US "NvmExpressDxe driver is used to manage non-volatile memory subsystem which follows NVM Express specification." 17 | 18 | -------------------------------------------------------------------------------- /MsvmPkg/NvmExpressDxe/NvmExpressDxeExtra.uni: -------------------------------------------------------------------------------- 1 | // /** @file 2 | // NvmExpressDxe Localized Strings and Content 3 | // 4 | // Copyright (c) 2014 - 2018, Intel Corporation. All rights reserved.
5 | // 6 | // SPDX-License-Identifier: BSD-2-Clause-Patent 7 | // 8 | // **/ 9 | 10 | #string STR_PROPERTIES_MODULE_NAME 11 | #language en-US 12 | "NVM Express DXE Driver" 13 | 14 | 15 | -------------------------------------------------------------------------------- /MsvmPkg/NvmExpressDxe/UnitTest/MediaSanitizeUnitTestHost.inf: -------------------------------------------------------------------------------- 1 | ## @file 2 | # Unit tests for MEDIA_SANITIZE_PROTOCOL and mapping to NVM Express native commands (Sanitize and FormatNVM) 3 | # 4 | # Copyright (C) Microsoft Corporation. 5 | # SPDX-License-Identifier: BSD-2-Clause-Patent 6 | ## 7 | 8 | [Defines] 9 | INF_VERSION = 0x00010006 10 | BASE_NAME = MediaSanitizeUnitTestHost 11 | FILE_GUID = AAE328E9-37C3-4F4A-A2C0-0BE0E681ADA6 12 | MODULE_TYPE = HOST_APPLICATION 13 | VERSION_STRING = 1.0 14 | 15 | # 16 | # The following information is for reference only and not required by the build tools. 17 | # 18 | # VALID_ARCHITECTURES = IA32 X64 19 | # 20 | 21 | [Sources] 22 | MediaSanitizeUnitTest.c 23 | ../NvmExpressMediaSanitize.c 24 | ../NvmExpressMediaSanitize.h 25 | 26 | [Packages] 27 | MdePkg/MdePkg.dec 28 | MdeModulePkg/MdeModulePkg.dec 29 | UnitTestFrameworkPkg/UnitTestFrameworkPkg.dec 30 | 31 | [LibraryClasses] 32 | BaseLib 33 | BaseMemoryLib 34 | DebugLib 35 | UnitTestLib 36 | PrintLib 37 | MemoryAllocationLib 38 | -------------------------------------------------------------------------------- /MsvmPkg/PlatformDeviceStateHelper/PlatformDeviceStateHelper.inf: -------------------------------------------------------------------------------- 1 | ## @file 2 | # This component sets up the device state information during PEI. 3 | # 4 | # Copyright (c) Microsoft Corporation. 5 | # SPDX-License-Identifier: BSD-2-Clause-Patent 6 | ## 7 | 8 | 9 | [Defines] 10 | INF_VERSION = 0x00010017 11 | BASE_NAME = PlatformDeviceStateHelper 12 | FILE_GUID = 40935bea-b500-45cf-8d74-92c09296bb62 13 | VERSION_STRING = 1.0 14 | MODULE_TYPE = DXE_DRIVER 15 | ENTRY_POINT = PlatformDeviceStateHelperInit 16 | 17 | [Sources] 18 | PlatformDeviceStateHelper.c 19 | 20 | [LibraryClasses] 21 | AdvancedLoggerLib 22 | BaseLib 23 | BiosDeviceLib 24 | CrashLib 25 | DebugLib 26 | DeviceStateLib 27 | HobLib 28 | IsolationLib 29 | MemoryAllocationLib 30 | UefiDriverEntryPoint 31 | UefiLib 32 | 33 | [Packages] 34 | MsvmPkg/MsvmPkg.dec 35 | MdePkg/MdePkg.dec 36 | MdeModulePkg/MdeModulePkg.dec 37 | MsCorePkg/MsCorePkg.dec 38 | AdvLoggerPkg/AdvLoggerPkg.dec 39 | 40 | [Guids] 41 | gAdvancedLoggerHobGuid ## CONSUMES 42 | gEfiGlobalVariableGuid ## CONSUMES 43 | 44 | [Depex] 45 | gEfiVariableArchProtocolGuid AND 46 | gEfiVariableWriteArchProtocolGuid 47 | -------------------------------------------------------------------------------- /MsvmPkg/PlatformPei/AArch64/Extra.h: -------------------------------------------------------------------------------- 1 | /** @file 2 | Mmu setup asm interface for ARM64 3 | 4 | Copyright (c) Microsoft Corporation. 5 | SPDX-License-Identifier: BSD-2-Clause-Patent 6 | 7 | **/ 8 | 9 | #pragma once 10 | 11 | // 12 | // Asm function 13 | // 14 | 15 | VOID 16 | EFIAPI 17 | ConfigureCachesAndMmu( 18 | IN VOID* TranslationTable, 19 | UINTN TCR, 20 | UINTN MAIR 21 | ); -------------------------------------------------------------------------------- /MsvmPkg/PlatformPei/AArch64/Extra.masm: -------------------------------------------------------------------------------- 1 | AREA |.text|,ALIGN=3,CODE,READONLY 2 | 3 | EXPORT ConfigureCachesAndMmu 4 | 5 | IMPORT ArmDisableCachesAndMmu 6 | IMPORT ArmSetTTBR0 7 | IMPORT ArmSetTCR 8 | IMPORT ArmSetMAIR 9 | IMPORT ArmInvalidateTlb 10 | IMPORT ArmEnableCachesAndMmu 11 | 12 | ConfigureCachesAndMmu PROC 13 | 14 | // x0 - TTBR0 15 | // x1 - TCR 16 | // x2 - MAIR 17 | 18 | stp x19,x20,[sp,#-0x20]! 19 | stp x21,lr,[sp,#0x10] 20 | 21 | mov x21,x0 22 | mov x20,x1 23 | mov x19,x2 24 | 25 | bl ArmDisableCachesAndMmu // It's forbidden to use memory (stack) after this line. 26 | 27 | mov x0,x21 28 | bl ArmSetTTBR0 29 | 30 | mov x0,x20 31 | bl ArmSetTCR 32 | 33 | mov x0,x19 34 | bl ArmSetMAIR 35 | 36 | bl ArmInvalidateTlb 37 | 38 | bl ArmEnableCachesAndMmu 39 | 40 | ldp x21,lr,[sp,#0x10] 41 | ldp x19,x20,[sp],#0x20 42 | 43 | ret 44 | ConfigureCachesAndMmu ENDP 45 | 46 | END 47 | -------------------------------------------------------------------------------- /MsvmPkg/PlatformPei/AArch64/Mmu.h: -------------------------------------------------------------------------------- 1 | /** @file 2 | Mmu setup for ARM64 3 | 4 | Copyright (c) Microsoft Corporation. 5 | SPDX-License-Identifier: BSD-2-Clause-Patent 6 | 7 | **/ 8 | 9 | #pragma once 10 | 11 | // 12 | // Functions 13 | // 14 | EFI_STATUS 15 | EFIAPI 16 | ConfigureMmu( 17 | UINT64 MaxAddress 18 | ); 19 | -------------------------------------------------------------------------------- /MsvmPkg/PlatformPei/Config.h: -------------------------------------------------------------------------------- 1 | /** @file 2 | Loader configuration related data and functions. 3 | 4 | Copyright (c) Microsoft Corporation. 5 | SPDX-License-Identifier: BSD-2-Clause-Patent 6 | 7 | **/ 8 | 9 | #pragma once 10 | 11 | // 12 | // Functions 13 | // 14 | UEFI_CONFIG_HEADER* 15 | GetStartOfConfigBlob( 16 | VOID 17 | ); 18 | 19 | EFI_STATUS 20 | GetConfiguration( 21 | IN CONST EFI_PEI_SERVICES** PeiServices, 22 | OUT UINT8* PhysicalAddressWidth 23 | ); 24 | 25 | EFI_STATUS 26 | GetIgvmConfigInfo( 27 | VOID 28 | ); 29 | 30 | VOID 31 | ConfigSetProcessorInfo( 32 | UEFI_CONFIG_PROCESSOR_INFORMATION *ProcessorInfo 33 | ); 34 | 35 | VOID 36 | ConfigSetUefiConfigFlags( 37 | UEFI_CONFIG_FLAGS *ConfigFlags 38 | ); 39 | -------------------------------------------------------------------------------- /MsvmPkg/PlatformPei/Hob.h: -------------------------------------------------------------------------------- 1 | /** @file 2 | Hob-building functionality. 3 | 4 | Copyright (c) Microsoft Corporation. 5 | SPDX-License-Identifier: BSD-2-Clause-Patent 6 | 7 | **/ 8 | 9 | #pragma once 10 | 11 | #include 12 | 13 | void 14 | HobAddMmioRange( 15 | EFI_PHYSICAL_ADDRESS BaseAddress, 16 | UINT64 Size 17 | ); 18 | 19 | 20 | void 21 | HobAddMemoryRange( 22 | IN OUT PPLATFORM_INIT_CONTEXT Context, 23 | EFI_PHYSICAL_ADDRESS BaseAddress, 24 | UINT64 Size 25 | ); 26 | 27 | 28 | void 29 | HobAddPersistentMemoryRange( 30 | EFI_PHYSICAL_ADDRESS BaseAddress, 31 | UINT64 Size 32 | ); 33 | 34 | void 35 | HobAddSpecificPurposeMemoryRange( 36 | EFI_PHYSICAL_ADDRESS BaseAddress, 37 | UINT64 Size 38 | ); 39 | 40 | void 41 | HobAddReservedMemoryRange( 42 | EFI_PHYSICAL_ADDRESS BaseAddress, 43 | UINT64 Size 44 | ); 45 | 46 | 47 | void 48 | HobAddUntestedMemoryRange( 49 | IN OUT PPLATFORM_INIT_CONTEXT Context, 50 | EFI_PHYSICAL_ADDRESS BaseAddress, 51 | UINT64 Size 52 | ); 53 | 54 | 55 | void 56 | HobAddAllocatedMemoryRange( 57 | EFI_PHYSICAL_ADDRESS BaseAddress, 58 | UINT64 Size 59 | ); 60 | 61 | 62 | void 63 | HobAddFvMemoryRange( 64 | EFI_PHYSICAL_ADDRESS BaseAddress, 65 | UINT64 Size 66 | ); 67 | 68 | 69 | void 70 | HobAddIoRange( 71 | EFI_PHYSICAL_ADDRESS BaseAddress, 72 | UINT64 Size 73 | ); 74 | 75 | 76 | void 77 | HobAddCpu( 78 | UINT8 SizeOfMemorySpace, 79 | UINT8 SizeOfIoSpace 80 | ); 81 | 82 | 83 | void 84 | HobAddGuidData( 85 | IN EFI_GUID* Guid, 86 | IN VOID* Data, 87 | UINTN DataSize 88 | ); 89 | -------------------------------------------------------------------------------- /MsvmPkg/PlatformPei/Hv.h: -------------------------------------------------------------------------------- 1 | /** @file 2 | Hypervisor interactions during PEI. 3 | 4 | Copyright (c) Microsoft Corporation. 5 | SPDX-License-Identifier: BSD-2-Clause-Patent 6 | 7 | **/ 8 | 9 | #pragma once 10 | 11 | extern BOOLEAN mParavisorPresent; 12 | extern UINT32 mIsolationType; 13 | extern UINT32 mSharedGpaBit; 14 | 15 | VOID 16 | HvDetectIsolation( 17 | VOID 18 | ); 19 | 20 | VOID 21 | HvDetectSvsm( 22 | IN VOID *SecretsPage, 23 | OUT UINT64 *SvsmBase, 24 | OUT UINT64 *SvsmSize 25 | ); 26 | 27 | typedef struct _SNP_SECRETS { 28 | UINT8 Reserved[0x140]; 29 | UINT64 SvsmBase; 30 | UINT64 SvsmSize; 31 | UINT64 SvsmCallingArea; 32 | } SNP_SECRETS, *PSNP_SECRETS; 33 | -------------------------------------------------------------------------------- /MsvmPkg/PlatformPei/Platform.h: -------------------------------------------------------------------------------- 1 | /** @file 2 | Definitions relating to the Hyper-V "Platform" PEI Module. 3 | 4 | Copyright (c) Microsoft Corporation. 5 | SPDX-License-Identifier: BSD-2-Clause-Patent 6 | 7 | **/ 8 | 9 | #pragma once 10 | 11 | #include 12 | #include 13 | 14 | #define PEI_FAIL_FAST_IF_FAILED(Status) \ 15 | do \ 16 | { \ 17 | if (EFI_ERROR(Status)) \ 18 | { \ 19 | FAIL_FAST_INITIALIZATION_FAILURE(Status); \ 20 | } \ 21 | } while(0) 22 | 23 | #if defined(MDE_CPU_X64) 24 | 25 | // 26 | // On X64, the config blob starts after the end of the firmware, and after 27 | // the 6 pages for pagetables, 1 page for GDT entries, and 2 free RW pages. 28 | // 29 | 30 | #define MISC_PAGE_COUNT_PAGE_TABLES 6 31 | #define MISC_PAGE_COUNT_GDT_ENTRIES 1 32 | #define MISC_PAGE_COUNT_FREE_RW 2 33 | 34 | #define MISC_PAGE_COUNT_TOTAL ( \ 35 | MISC_PAGE_COUNT_PAGE_TABLES + \ 36 | MISC_PAGE_COUNT_GDT_ENTRIES + \ 37 | MISC_PAGE_COUNT_FREE_RW) 38 | 39 | #define MISC_PAGE_OFFSET_FREE_RW ( \ 40 | MISC_PAGE_COUNT_PAGE_TABLES + \ 41 | MISC_PAGE_COUNT_GDT_ENTRIES) 42 | 43 | #endif 44 | 45 | typedef struct _PLATFORM_INIT_CONTEXT 46 | { 47 | struct _UEFI_CONFIG_HEADER *StartOfConfigBlob; 48 | HV_HYPERCALL_CONTEXT HvHypercallContext; 49 | UINT8 PhysicalAddressWidth; 50 | 51 | #if defined (MDE_CPU_X64) 52 | 53 | struct _HV_PAGES *HvPages; 54 | 55 | #endif 56 | } PLATFORM_INIT_CONTEXT, *PPLATFORM_INIT_CONTEXT; 57 | -------------------------------------------------------------------------------- /MsvmPkg/PlatformPei/README.md: -------------------------------------------------------------------------------- 1 | # KDNET support 2 | 3 | KDNET support is not available in mu_msvm builds 4 | -------------------------------------------------------------------------------- /MsvmPkg/Sec/SecMain.inf: -------------------------------------------------------------------------------- 1 | ## @file 2 | # SEC Driver 3 | # 4 | # Copyright (c) 2008 - 2010, Intel Corporation. All rights reserved.
5 | # Copyright (c) Microsoft Corporation. 6 | # SPDX-License-Identifier: BSD-2-Clause-Patent 7 | ## 8 | 9 | [Defines] 10 | INF_VERSION = 0x00010005 11 | BASE_NAME = SecMain 12 | FILE_GUID = df1ccef6-f301-4a63-9661-fc6030dcc880 13 | MODULE_TYPE = SEC 14 | VERSION_STRING = 1.0 15 | ENTRY_POINT = SecMain 16 | 17 | # 18 | # The following information is for reference only and not required by the build tools. 19 | # 20 | # VALID_ARCHITECTURES = X64 IPF EBC AARCH64 21 | # 22 | 23 | [Sources] 24 | 25 | [Sources.X64] 26 | X64/SecEntry.asm | MSFT 27 | X64/SecEntry.asm | INTEL 28 | X64/SecIso.c 29 | X64/SecMain.c 30 | 31 | [Sources.AARCH64] 32 | AArch64/SecEntry.masm | MSFT 33 | AArch64/SecMain.c 34 | 35 | [Packages] 36 | MdePkg/MdePkg.dec 37 | MdeModulePkg/MdeModulePkg.dec 38 | MsvmPkg/MsvmPkg.dec 39 | 40 | [Packages.X64] 41 | UefiCpuPkg/UefiCpuPkg.dec 42 | 43 | [Packages.AARCH64] 44 | ArmPkg/ArmPkg.dec 45 | 46 | [LibraryClasses] 47 | BaseLib 48 | BaseMemoryLib 49 | DebugAgentLib 50 | DebugLib 51 | StackCheckLib 52 | 53 | [LibraryClasses.X64] 54 | CpuLib 55 | PeCoffExtraActionLib 56 | PeCoffGetEntryPointLib 57 | PeCoffLib 58 | 59 | [LibraryClasses.AARCH64] 60 | ArmLib 61 | 62 | [Ppis] 63 | gEfiTemporaryRamSupportPpiGuid # PPI ALWAYS_PRODUCED 64 | 65 | [FixedPcd] 66 | gMsvmPkgTokenSpaceGuid.PcdBiosBaseAddress 67 | gMsvmPkgTokenSpaceGuid.PcdCom1RegisterBase 68 | gMsvmPkgTokenSpaceGuid.PcdCom2RegisterBase 69 | gMsvmPkgTokenSpaceGuid.PcdFdBaseAddress 70 | gMsvmPkgTokenSpaceGuid.PcdFdSize 71 | gMsvmPkgTokenSpaceGuid.PcdFvBaseAddress 72 | gMsvmPkgTokenSpaceGuid.PcdFvSize 73 | -------------------------------------------------------------------------------- /MsvmPkg/SerialDxe/MsvmSerial.h: -------------------------------------------------------------------------------- 1 | /** @file 2 | Provides the protocol definition for MSVM_SERIAL_BUS_PROTOCOL. 3 | 4 | This is a tag protocol used privately in the SerialDxe driver. 5 | 6 | Copyright (c) Microsoft Corporation. 7 | SPDX-License-Identifier: BSD-2-Clause-Patent 8 | 9 | 10 | **/ 11 | 12 | #pragma once 13 | 14 | #define MSVM_SERIAL_BUS_PROTOCOL_GUID \ 15 | {0x316fa37e, 0x63e5, 0x4179, {0xba, 0xb9, 0x0f, 0x66, 0x5a, 0x4c, 0x06, 0x15}} 16 | 17 | 18 | -------------------------------------------------------------------------------- /MsvmPkg/SerialDxe/SerialDxe.inf: -------------------------------------------------------------------------------- 1 | ## @file 2 | # Serial driver for standard UARTs on an ISA bus. 3 | # 4 | # Copyright (c) Microsoft Corporation. 5 | # SPDX-License-Identifier: BSD-2-Clause-Patent 6 | # 7 | ## 8 | 9 | [Defines] 10 | INF_VERSION = 0x00010005 11 | BASE_NAME = SerialDxe 12 | FILE_GUID = 23510367-1393-4DF8-A7C7-4B86313829C5 13 | MODULE_TYPE = UEFI_DRIVER 14 | VERSION_STRING = 1.0 15 | ENTRY_POINT = SerialEntryPoint 16 | 17 | [Sources] 18 | MsvmSerial.h 19 | Serial.h 20 | ComponentName.c 21 | Serial.c 22 | 23 | [Packages] 24 | MdePkg/MdePkg.dec 25 | MdeModulePkg/MdeModulePkg.dec 26 | MsvmPkg/MsvmPkg.dec 27 | 28 | [Packages.AARCH64] 29 | ArmPlatformPkg/ArmPlatformPkg.dec 30 | 31 | [LibraryClasses] 32 | PcdLib 33 | ReportStatusCodeLib 34 | UefiBootServicesTableLib 35 | MemoryAllocationLib 36 | BaseMemoryLib 37 | DevicePathLib 38 | UefiLib 39 | UefiDriverEntryPoint 40 | DebugLib 41 | ConfigLib 42 | 43 | [LibraryClasses.X64] 44 | PCUartLib 45 | 46 | [LibraryClasses.AARCH64] 47 | PL011UartLib 48 | 49 | [Guids] 50 | gEfiUartDevicePathGuid ## CONSUMES 51 | 52 | [Protocols] 53 | gEfiSerialIoProtocolGuid ## PRODUCES 54 | gEfiDevicePathProtocolGuid ## CONSUMES 55 | 56 | [FeaturePcd] 57 | 58 | 59 | [FixedPcd.X64] 60 | gEfiMdeModulePkgTokenSpaceGuid.PcdSerialClockRate ## SOMETIMES_CONSUMES 61 | 62 | [FixedPcd.AARCH64] 63 | gArmPlatformTokenSpaceGuid.PL011UartClkInHz ## SOMETIMES_CONSUMES 64 | 65 | [FixedPcd] 66 | gEfiMdePkgTokenSpaceGuid.PcdUartDefaultBaudRate ## CONSUMES 67 | gEfiMdePkgTokenSpaceGuid.PcdUartDefaultDataBits ## CONSUMES 68 | gEfiMdePkgTokenSpaceGuid.PcdUartDefaultParity ## CONSUMES 69 | gEfiMdePkgTokenSpaceGuid.PcdUartDefaultStopBits ## CONSUMES 70 | 71 | [Pcd] 72 | gMsvmPkgTokenSpaceGuid.PcdSerialControllersEnabled ## CONSUMES 73 | gMsvmPkgTokenSpaceGuid.PcdDebuggerEnabled ## CONSUMES 74 | gMsvmPkgTokenSpaceGuid.PcdConsoleMode ## CONSUMES 75 | -------------------------------------------------------------------------------- /MsvmPkg/StorvscDxe/StorvscDxe.inf: -------------------------------------------------------------------------------- 1 | ## @file 2 | # Provides an implementation of the Synthetic SCSI Controller driver. 3 | # 4 | # Copyright (c) Microsoft Corporation. 5 | # SPDX-License-Identifier: BSD-2-Clause-Patent 6 | # 7 | ## 8 | 9 | [Defines] 10 | INF_VERSION = 0x00010005 11 | BASE_NAME = StorvscDxe 12 | FILE_GUID = 6D6AE65A-393E-4E54-958F-C18E01956A00 13 | MODULE_TYPE = UEFI_DRIVER 14 | VERSION_STRING = 1.0 15 | ENTRY_POINT = StorvscDriverEntryPoint 16 | 17 | 18 | [Sources] 19 | ComponentName.c 20 | ExtScsiPassThru.c 21 | StorchannelDxe.c 22 | StorportDxe.h 23 | StorvscDxe.h 24 | StorvscDxe.c 25 | 26 | [Packages] 27 | MdeModulePkg/MdeModulePkg.dec 28 | MdePkg/MdePkg.dec 29 | MsvmPkg/MsvmPkg.dec 30 | 31 | [LibraryClasses] 32 | BaseLib 33 | BaseMemoryLib 34 | CrashLib 35 | DebugLib 36 | DevicePathLib 37 | EmclLib 38 | MemoryAllocationLib 39 | UefiBootServicesTableLib 40 | UefiDriverEntryPoint 41 | UefiLib 42 | 43 | [Protocols] 44 | gEfiVmbusProtocolGuid ## CONSUMES 45 | gEfiEmclV2ProtocolGuid ## CONSUMES 46 | gEfiExtScsiPassThruProtocolGuid ## PRODUCES 47 | gInternalEventServicesProtocolGuid ## CONSUMES 48 | 49 | [Guids] 50 | gEfiVmbusChannelDevicePathGuid ## CONSUMES 51 | gSyntheticStorageClassGuid ## CONSUMES 52 | -------------------------------------------------------------------------------- /MsvmPkg/SynicTimerDxe/SynicTimerDxe.inf: -------------------------------------------------------------------------------- 1 | ## @file 2 | # Provides an implementation of the EFI_TIMER_ARCH_PROTOCOL architectural 3 | # protocol with a Hyper-V synthetic timer. This is more efficient than using 4 | # the 8254 timer (PIT). 5 | # 6 | # Copyright (c) Microsoft Corporation. 7 | # SPDX-License-Identifier: BSD-2-Clause-Patent 8 | ## 9 | 10 | [Defines] 11 | INF_VERSION = 0x00010005 12 | BASE_NAME = SynicTimerDxe 13 | FILE_GUID = 28311F03-DC68-4C06-AB19-7A20886488A2 14 | MODULE_TYPE = DXE_DRIVER 15 | VERSION_STRING = 1.0 16 | 17 | ENTRY_POINT = SynicTimerInitialize 18 | 19 | [Packages] 20 | MdePkg/MdePkg.dec 21 | MsvmPkg/MsvmPkg.dec 22 | 23 | [LibraryClasses] 24 | BaseLib 25 | DebugLib 26 | UefiBootServicesTableLib 27 | UefiDriverEntryPoint 28 | 29 | [Sources] 30 | SynicTimer.c 31 | 32 | [Protocols] 33 | gEfiTimerArchProtocolGuid ## PRODUCES 34 | gEfiHvProtocolGuid ## CONSUMES 35 | 36 | [Depex] 37 | gEfiHvProtocolGuid 38 | 39 | [Pcd] 40 | gMsvmPkgTokenSpaceGuid.PcdSynicTimerSintIndex ## CONSUMES 41 | gMsvmPkgTokenSpaceGuid.PcdSynicTimerTimerIndex ## CONSUMES 42 | gMsvmPkgTokenSpaceGuid.PcdSynicTimerDefaultPeriod ## CONSUMES 43 | gMsvmPkgTokenSpaceGuid.PcdSynicTimerVector ## CONSUMES 44 | 45 | -------------------------------------------------------------------------------- /MsvmPkg/SynthKeyDxe/SynthKeyChannel.h: -------------------------------------------------------------------------------- 1 | /** @file 2 | VMBUS Keyboard Channel implementation for EFI. This contains the VMBUS 3 | specific implementation of the synthetic keyboard driver. 4 | 5 | Copyright (c) Microsoft Corporation. 6 | SPDX-License-Identifier: BSD-2-Clause-Patent 7 | 8 | **/ 9 | 10 | #pragma once 11 | 12 | #include 13 | #include 14 | 15 | EFI_STATUS 16 | SynthKeyChannelOpen( 17 | IN PSYNTH_KEYBOARD_DEVICE pDevice 18 | ); 19 | 20 | EFI_STATUS 21 | SynthKeyChannelClose( 22 | IN PSYNTH_KEYBOARD_DEVICE pDevice 23 | ); 24 | 25 | EFI_STATUS 26 | SynthKeyChannelSetIndicators( 27 | IN PSYNTH_KEYBOARD_DEVICE pDevice 28 | ); 29 | 30 | __forceinline 31 | VOID 32 | SynthKeyChannelInitMessage( 33 | IN OUT PHK_MESSAGE_HEADER Header, 34 | IN HK_MESSAGE_TYPE Type, 35 | IN UINT32 ByteCount 36 | ) 37 | /*++ 38 | 39 | Routine Description: 40 | 41 | A utility function to initialize a message header. 42 | 43 | Arguments: 44 | 45 | Header - Message header 46 | 47 | Type - Message type 48 | 49 | ByteCount - Size of the message header in bytes 50 | 51 | Return Value: 52 | 53 | None. 54 | 55 | --*/ 56 | { 57 | ZeroMem(Header, ByteCount); 58 | Header->MessageType = Type; 59 | } 60 | -------------------------------------------------------------------------------- /MsvmPkg/SynthKeyDxe/SynthKeyDxe.inf: -------------------------------------------------------------------------------- 1 | ## @file 2 | # Ps2 Keyboard UEFI Driver which produce gEfiSimpleTextInProtocolGuid and gEfiSimpleTextInputExProtocolGuid 3 | # protocol. 4 | # The keyboard type implemented follows IBM compatible PS2 protocol, with Scan Codes Set 1. 5 | # 6 | # This dirver directly uses IsaIo protocol service to support KeyBoard work. 7 | # 8 | # Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.
9 | # Copyright (c) Microsoft Corporation. 10 | # SPDX-License-Identifier: BSD-2-Clause-Patent 11 | # 12 | ## 13 | 14 | [Defines] 15 | INF_VERSION = 0x00010005 16 | BASE_NAME = SynthKeyDxe 17 | FILE_GUID = 8d5ea93e-f438-464b-aa26-00165028a7a6 18 | MODULE_TYPE = UEFI_DRIVER 19 | VERSION_STRING = 1.0 20 | ENTRY_POINT = SynthKeyDriverEntry 21 | 22 | [Sources] 23 | ComponentName.c 24 | SynthSimpleTextIn.c 25 | SynthKeyChannel.c 26 | SynthKeyDxe.c 27 | SynthKeyLayout.c 28 | 29 | 30 | [Packages] 31 | MdePkg/MdePkg.dec 32 | MsvmPkg/MsvmPkg.dec 33 | 34 | [LibraryClasses] 35 | BaseLib 36 | BaseMemoryLib 37 | DebugLib 38 | EmclLib 39 | MemoryAllocationLib 40 | PcdLib 41 | ReportStatusCodeLib 42 | TimerLib 43 | UefiBootServicesTableLib 44 | UefiDriverEntryPoint 45 | UefiLib 46 | UefiRuntimeServicesTableLib 47 | 48 | 49 | [Protocols] 50 | gEfiVmbusProtocolGuid ## CONSUMES 51 | gEfiEmclProtocolGuid ## CONSUMES 52 | gEfiDevicePathProtocolGuid ## CONSUMES 53 | gEfiSimpleTextInProtocolGuid ## PRODUCES 54 | gEfiSimpleTextInputExProtocolGuid ## PRODUCES 55 | 56 | [Guids] 57 | gEfiVmbusChannelDevicePathGuid ## CONSUMES 58 | gSyntheticKeyboardClassGuid ## CONSUMES 59 | -------------------------------------------------------------------------------- /MsvmPkg/SynthKeyDxe/SynthSimpleTextIn.h: -------------------------------------------------------------------------------- 1 | /** @file 2 | Functions and Prototypes for implementing UEFI simple text input protocols 3 | This is a generic as possible implementation and provides an API set 4 | for drivers to initialize the text input layer and for lower layers (like VMBUS or PS2) 5 | to queue processed key presses. 6 | 7 | This code is dervied from: 8 | IntelFrameworkModulePkg\Bus\Isa\Ps2KeyboardDxe\Ps2Keyboard.h 9 | 10 | Copyright (c) Microsoft Corporation. 11 | SPDX-License-Identifier: BSD-2-Clause-Patent 12 | 13 | **/ 14 | 15 | #pragma once 16 | 17 | // 18 | // Public Simple Text In APIs 19 | // 20 | EFI_STATUS 21 | SimpleTextInInitialize( 22 | IN OUT PSYNTH_KEYBOARD_DEVICE pDevice 23 | ); 24 | 25 | 26 | VOID 27 | SimpleTextInCleanup( 28 | IN PSYNTH_KEYBOARD_DEVICE pDevice 29 | ); 30 | 31 | 32 | VOID 33 | SimpleTextInQueueKey( 34 | IN PSYNTH_KEYBOARD_DEVICE pDevice, 35 | IN EFI_KEY_DATA *Key 36 | ); 37 | 38 | 39 | -------------------------------------------------------------------------------- /MsvmPkg/Tools/edk2-acpica-iasl_extdep/Linux-ARM/iasl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/mu_msvm/9dd44d82aaa513e58913616f3a5a567112039574/MsvmPkg/Tools/edk2-acpica-iasl_extdep/Linux-ARM/iasl -------------------------------------------------------------------------------- /MsvmPkg/Tools/edk2-acpica-iasl_extdep/Linux-x86/iasl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/mu_msvm/9dd44d82aaa513e58913616f3a5a567112039574/MsvmPkg/Tools/edk2-acpica-iasl_extdep/Linux-x86/iasl -------------------------------------------------------------------------------- /MsvmPkg/Tools/edk2-acpica-iasl_extdep/MacOs-x86/iasl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/mu_msvm/9dd44d82aaa513e58913616f3a5a567112039574/MsvmPkg/Tools/edk2-acpica-iasl_extdep/MacOs-x86/iasl -------------------------------------------------------------------------------- /MsvmPkg/Tools/edk2-acpica-iasl_extdep/Windows-ARM-64/iasl.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/mu_msvm/9dd44d82aaa513e58913616f3a5a567112039574/MsvmPkg/Tools/edk2-acpica-iasl_extdep/Windows-ARM-64/iasl.exe -------------------------------------------------------------------------------- /MsvmPkg/Tools/edk2-acpica-iasl_extdep/Windows-ARM/iasl.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/mu_msvm/9dd44d82aaa513e58913616f3a5a567112039574/MsvmPkg/Tools/edk2-acpica-iasl_extdep/Windows-ARM/iasl.exe -------------------------------------------------------------------------------- /MsvmPkg/Tools/edk2-acpica-iasl_extdep/Windows-x86/iasl.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/mu_msvm/9dd44d82aaa513e58913616f3a5a567112039574/MsvmPkg/Tools/edk2-acpica-iasl_extdep/Windows-x86/iasl.exe -------------------------------------------------------------------------------- /MsvmPkg/Tools/edk2-acpica-iasl_extdep/extdep_state.yaml: -------------------------------------------------------------------------------- 1 | version: 20230628.0.1 2 | -------------------------------------------------------------------------------- /MsvmPkg/Tools/iasl_ext_dep.yaml: -------------------------------------------------------------------------------- 1 | ## @file 2 | # Download iasl executable tool from a nuget.org package 3 | # - package contains different binaries based on host 4 | # Add the folder with the tool to the path 5 | # 6 | # This is only downloaded for scope cibuild thus 7 | # should have no impact on the asl compiler used by any 8 | # given platform to build. 9 | # 10 | # Copyright (c) Microsoft Corporation. 11 | # SPDX-License-Identifier: BSD-2-Clause-Patent 12 | ## 13 | { 14 | "id": "iasl-ci-1", 15 | "scope": "hyperv", 16 | "type": "nuget", 17 | "name": "edk2-acpica-iasl", 18 | "source": "https://pkgs.dev.azure.com/projectmu/acpica/_packaging/mu_iasl/nuget/v3/index.json", 19 | "version": "20230628.0.1", 20 | "flags": ["set_path", "host_specific"] 21 | } 22 | -------------------------------------------------------------------------------- /MsvmPkg/VariableDxe/NvramVariableDxe.h: -------------------------------------------------------------------------------- 1 | /** @file 2 | Declarations for the NVRAM Variable Services driver. 3 | 4 | Copyright (c) Microsoft Corporation. 5 | SPDX-License-Identifier: BSD-2-Clause-Patent 6 | **/ 7 | 8 | #pragma once 9 | 10 | #include 11 | 12 | extern 13 | EFI_STATUS 14 | NvramInitialize(); 15 | 16 | extern 17 | VOID 18 | NvramAddressChangeHandler(); 19 | 20 | extern 21 | VOID 22 | NvramExitBootServicesHandler( 23 | BOOLEAN VsmAware 24 | ); 25 | 26 | extern 27 | EFI_STATUS 28 | NvramQueryInfo( 29 | UINT32 Attributes, 30 | OUT UINT64* MaximumVariableStorageSize, 31 | OUT UINT64* RemainingVariableStorageSize, 32 | OUT UINT64* MaximumVariableSize 33 | ); 34 | 35 | extern 36 | EFI_STATUS 37 | NvramSetVariable( 38 | IN CHAR16* VariableName, 39 | IN EFI_GUID* VendorGuid, 40 | IN UINT32 Attributes, 41 | IN UINTN DataSize, 42 | IN void* Data 43 | ); 44 | 45 | extern 46 | EFI_STATUS 47 | NvramGetVariable( 48 | IN CHAR16* VariableName, 49 | IN EFI_GUID* VendorGuid, 50 | OUT OPTIONAL UINT32* Attributes, 51 | IN OUT UINTN* DataSize, 52 | OUT void* Data 53 | ); 54 | 55 | extern 56 | EFI_STATUS 57 | NvramGetFirstVariableName( 58 | OUT UINTN* VariableNameSize, 59 | OUT CHAR16* VariableName, 60 | OUT EFI_GUID* VendorGuid 61 | ); 62 | 63 | extern 64 | EFI_STATUS 65 | NvramGetNextVariableName( 66 | IN OUT UINTN* VariableNameSize, 67 | IN OUT CHAR16* VariableName, 68 | IN OUT EFI_GUID* VendorGuid 69 | ); 70 | 71 | extern 72 | VOID 73 | NvramDebugLog( 74 | IN CONST CHAR8 *Format, 75 | ... 76 | ); 77 | 78 | 79 | -------------------------------------------------------------------------------- /MsvmPkg/VariableDxe/VariableDxe.inf: -------------------------------------------------------------------------------- 1 | ## @file 2 | # Component description file for Variable module 3 | # 4 | # Copyright (c) Microsoft Corporation. 5 | # SPDX-License-Identifier: BSD-2-Clause-Patent 6 | # 7 | ## 8 | 9 | [Defines] 10 | INF_VERSION = 0x00010005 11 | BASE_NAME = VariableRuntimeDxe 12 | FILE_GUID = CBD2E4D5-7068-4FF5-B462-9822B4AD8D60 13 | MODULE_TYPE = DXE_RUNTIME_DRIVER 14 | VERSION_STRING = 1.0 15 | ENTRY_POINT = VariableServiceInitialize 16 | 17 | [Sources] 18 | NvramVariableDxe.c 19 | VariableDxe.c 20 | 21 | [Packages] 22 | MdePkg/MdePkg.dec 23 | MdeModulePkg/MdeModulePkg.dec 24 | MsvmPkg/MsvmPkg.dec 25 | 26 | [LibraryClasses] 27 | BaseLib 28 | BaseMemoryLib 29 | BiosDeviceLib 30 | DebugLib 31 | DxeServicesTableLib 32 | IoLib 33 | IsolationLib 34 | MemoryAllocationLib 35 | PrintLib 36 | UefiBootServicesTableLib 37 | UefiDriverEntryPoint 38 | UefiRuntimeLib 39 | 40 | [Protocols] 41 | gEfiVariableWriteArchProtocolGuid ## ALWAYS_PRODUCES 42 | gEfiVariableArchProtocolGuid ## ALWAYS_PRODUCES 43 | 44 | [Guids] 45 | gEfiEventVirtualAddressChangeGuid 46 | gEfiEventExitBootServicesGuid 47 | gEfiGlobalVariableGuid 48 | 49 | [Pcd.AARCH64] 50 | gMsvmPkgTokenSpaceGuid.PcdBiosBaseAddress 51 | 52 | [Depex] 53 | TRUE 54 | -------------------------------------------------------------------------------- /MsvmPkg/VideoDxe/VideoDxe.inf: -------------------------------------------------------------------------------- 1 | ## @file 2 | # EFI Driver for Synthetic Video Controller. 3 | # 4 | # Copyright (c) Microsoft Corporation. 5 | # SPDX-License-Identifier: BSD-2-Clause-Patent 6 | ## 7 | 8 | [Defines] 9 | INF_VERSION = 0x00010005 10 | BASE_NAME = VideoDxe 11 | FILE_GUID = 1cb52863-97b7-4fce-892b-0ef2838befbd 12 | MODULE_TYPE = UEFI_DRIVER 13 | VERSION_STRING = 1.0 14 | ENTRY_POINT = VideoDxeDriverEntryPoint 15 | 16 | 17 | [Sources] 18 | ComponentName.c 19 | VideoChannelDxe.c 20 | VideoDxe.h 21 | VideoDxe.c 22 | 23 | [Packages] 24 | MdePkg/MdePkg.dec 25 | MsvmPkg/MsvmPkg.dec 26 | 27 | [LibraryClasses] 28 | BaseLib 29 | BaseMemoryLib 30 | DebugLib 31 | DevicePathLib 32 | DxeServicesTableLib 33 | EmclLib 34 | MemoryAllocationLib 35 | UefiBootServicesTableLib 36 | UefiDriverEntryPoint 37 | UefiLib 38 | 39 | [Protocols] 40 | gEfiVmbusProtocolGuid ## CONSUMES 41 | gEfiEmclProtocolGuid ## CONSUMES 42 | gEfiDevicePathProtocolGuid ## CONSUMES 43 | mMsGopOverrideProtocolGuid ## PRODUCES 44 | 45 | [Guids] 46 | gEfiVmbusChannelDevicePathGuid ## CONSUMES 47 | gSyntheticVideoClassGuid ## CONSUMES 48 | gSynthetic3dVideoClassGuid ## CONSUMES -------------------------------------------------------------------------------- /MsvmPkg/VideoDxe/VramSize.h: -------------------------------------------------------------------------------- 1 | /** @file 2 | VRAM size definitions. 3 | 4 | Copyright (c) Microsoft Corporation. 5 | SPDX-License-Identifier: BSD-2-Clause-Patent 6 | **/ 7 | 8 | #pragma once 9 | 10 | #define DEFAULT_VRAM_SIZE_WIN7 (4 * 1024 * 1024) 11 | 12 | // 13 | // In Win8 the synthetic video device upgraded the color depth capabilty from 14 | // 16 to 32 bits per pixel. 15 | // 16 | #define DEFAULT_VRAM_SIZE_WIN8 (2 * DEFAULT_VRAM_SIZE_WIN7) 17 | -------------------------------------------------------------------------------- /MsvmPkg/VmMeasurementDxe/VmMeasurementDxe.c: -------------------------------------------------------------------------------- 1 | /** @file 2 | Measure VM specific data to TPM using PCR[06] 3 | 4 | Copyright (c) Microsoft Corporation. 5 | SPDX-License-Identifier: BSD-2-Clause-Patent 6 | 7 | **/ 8 | 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | 15 | EFI_STATUS 16 | EFIAPI 17 | VmMeasurementEntry ( 18 | IN EFI_HANDLE ImageHandle, 19 | IN EFI_SYSTEM_TABLE *SystemTable 20 | ) 21 | /*++ 22 | 23 | Routine Description: 24 | 25 | Entry to VmMeasurementDxe driver. Measures VM Identity info to TPM. 26 | 27 | --*/ 28 | { 29 | EFI_STATUS Status; 30 | CHAR8 EventLog[64]; 31 | UINT32 EventSize; 32 | 33 | DEBUG((DEBUG_INFO, __FUNCTION__"() - Measuring VM data to PCR[06]\n")); 34 | 35 | // 36 | // Include the UUID in the event log, and hash the entire event log 37 | // 38 | EventSize = (UINT32)AsciiSPrint(EventLog, sizeof(EventLog), "UUID: %g", (EFI_GUID *)PcdGet64(PcdBiosGuidPtr)); 39 | 40 | Status = TpmMeasureAndLogData ( 41 | 6, 42 | EV_COMPACT_HASH, 43 | EventLog, 44 | EventSize, 45 | EventLog, 46 | EventSize 47 | ); 48 | 49 | DEBUG((DEBUG_INFO, __FUNCTION__"() - Logged %a (size=0x%x) status 0x%x\n", EventLog, EventSize, Status)); 50 | 51 | return EFI_SUCCESS; 52 | } 53 | -------------------------------------------------------------------------------- /MsvmPkg/VmMeasurementDxe/VmMeasurementDxe.inf: -------------------------------------------------------------------------------- 1 | ## @file 2 | # Measure VM specific data to TPM using PCR[06] 3 | # 4 | # Copyright (c) Microsoft Corporation. 5 | # SPDX-License-Identifier: BSD-2-Clause-Patent 6 | ## 7 | 8 | [Defines] 9 | INF_VERSION = 0x00010005 10 | BASE_NAME = VmMeasurementDxe 11 | MODULE_UNI_FILE = VmMeasurementDxe.uni 12 | FILE_GUID = 291055a3-734b-4203-89dc-306e64a5f85f 13 | MODULE_TYPE = DXE_DRIVER 14 | VERSION_STRING = 1.0 15 | ENTRY_POINT = VmMeasurementEntry 16 | 17 | # 18 | # The following information is for reference only and not required by the build tools. 19 | # 20 | # VALID_ARCHITECTURES = X64 21 | # 22 | 23 | [Sources] 24 | VmMeasurementDxe.c 25 | 26 | [Packages] 27 | MdePkg/MdePkg.dec 28 | MdeModulePkg/MdeModulePkg.dec 29 | MsvmPkg/MsvmPkg.dec 30 | 31 | [LibraryClasses] 32 | BaseLib 33 | DebugLib 34 | UefiDriverEntryPoint 35 | UefiLib 36 | TpmMeasurementLib 37 | 38 | [Pcd] 39 | gMsvmPkgTokenSpaceGuid.PcdBiosGuidPtr ## CONSUMES 40 | 41 | [Depex] 42 | gEfiTcg2ProtocolGuid -------------------------------------------------------------------------------- /MsvmPkg/VmMeasurementDxe/VmMeasurementDxe.uni: -------------------------------------------------------------------------------- 1 | // 2 | // This driver measures VM Identify information to the TPM. 3 | // 4 | // Copyright (c) Microsoft Corporation. 5 | // SPDX-License-Identifier: BSD-2-Clause-Patent 6 | // 7 | 8 | 9 | #string STR_MODULE_ABSTRACT #language en-US "This driver measures VM properties to the TPM." 10 | 11 | #string STR_MODULE_DESCRIPTION #language en-US "This driver measures VM properties to TPM PCR[06]." 12 | 13 | -------------------------------------------------------------------------------- /MsvmPkg/VmbfsDxe/VmbfsDxe.inf: -------------------------------------------------------------------------------- 1 | ## @file 2 | # 3 | # Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.
4 | # Copyright (c) Microsoft Corporation. 5 | # SPDX-License-Identifier: BSD-2-Clause-Patent 6 | # 7 | ## 8 | 9 | [Defines] 10 | INF_VERSION = 0x00010005 11 | BASE_NAME = VmbfsDxe 12 | FILE_GUID = ba0cf5fd-6cfc-4747-83c6-6acf062a781d 13 | MODULE_TYPE = UEFI_DRIVER 14 | VERSION_STRING = 1.0 15 | ENTRY_POINT = VmbfsEntry 16 | 17 | # 18 | # The following information is for reference only and not required by the build tools. 19 | # 20 | # VALID_ARCHITECTURES = X64 IPF EBC 21 | # 22 | # DRIVER_BINDING = gVmbfsDriverBindingProtocol 23 | # 24 | 25 | [Sources] 26 | Vmbfs.c 27 | VmbfsDxe.c 28 | VmbfsFile.c 29 | VmbfsEfi.h 30 | 31 | [Packages] 32 | MdePkg/MdePkg.dec 33 | MsvmPkg/MsvmPkg.dec 34 | MdeModulePkg/MdeModulePkg.dec 35 | 36 | [LibraryClasses] 37 | BaseLib 38 | BaseMemoryLib 39 | DebugLib 40 | EmclLib 41 | MemoryAllocationLib 42 | SynchronizationLib 43 | UefiBootServicesTableLib 44 | UefiDriverEntryPoint 45 | UefiLib 46 | 47 | [Guids] 48 | gEfiVmbusChannelDevicePathGuid ## CONSUMES 49 | gEfiFileInfoGuid ## CONSUMES 50 | gEfiFileSystemInfoGuid ## CONSUMES 51 | gSyntheticVmbfsClassGuid ## CONSUMES 52 | 53 | [Protocols] 54 | gEfiDevicePathProtocolGuid ## CONSUMES 55 | gEfiEmclProtocolGuid ## CONSUMES 56 | gEfiSimpleFileSystemProtocolGuid ## PRODUCES 57 | gEfiVmbusProtocolGuid ## CONSUMES 58 | -------------------------------------------------------------------------------- /MsvmPkg/VmbusDxe/VmbusDxe.inf: -------------------------------------------------------------------------------- 1 | ## @file 2 | # Provides an implementation of the VmBus channel and root driver. 3 | # 4 | # Copyright (c) Microsoft Corporation. 5 | # SPDX-License-Identifier: BSD-2-Clause-Patent 6 | # 7 | ## 8 | 9 | 10 | [Defines] 11 | INF_VERSION = 0x00010005 12 | BASE_NAME = VmbusDxe 13 | FILE_GUID = A6683912-5C39-43CB-9BE8-2A1BC903ABC8 14 | MODULE_TYPE = DXE_DRIVER 15 | VERSION_STRING = 1.0 16 | 17 | ENTRY_POINT = VmbusDriverInitialize 18 | 19 | 20 | [Sources] 21 | VmbusChannel.c 22 | VmbusRoot.c 23 | 24 | [Packages] 25 | MdeModulePkg/MdeModulePkg.dec 26 | MdePkg/MdePkg.dec 27 | MsvmPkg/MsvmPkg.dec 28 | 29 | [LibraryClasses] 30 | BaseLib 31 | BaseMemoryLib 32 | CrashLib 33 | DebugLib 34 | DevicePathLib 35 | IsolationLib 36 | MemoryAllocationLib 37 | SynchronizationLib 38 | UefiBootServicesTableLib 39 | UefiDriverEntryPoint 40 | UefiLib 41 | 42 | [Guids] 43 | gEfiEventExitBootServicesGuid 44 | gEfiVmbusChannelDevicePathGuid 45 | gMsvmVmbusClientGuid 46 | 47 | [Protocols] 48 | gEfiHvProtocolGuid ## CONSUMES 49 | gEfiHvIvmProtocolGuid ## CONSUMES 50 | gEfiDevicePathProtocolGuid ## PRODUCES 51 | gEfiVmbusRootProtocolGuid ## PRODUCES 52 | gEfiVmbusProtocolGuid ## PRODUCES 53 | gEfiVmbusLegacyProtocolGuid ## PRODUCES 54 | gEfiVmbusLegacyProtocolIvmGuid ## PRODUCES 55 | gInternalEventServicesProtocolGuid ## CONSUMES 56 | 57 | [Pcd] 58 | gMsvmPkgTokenSpaceGuid.PcdVmbusSintVector ## CONSUMES 59 | gMsvmPkgTokenSpaceGuid.PcdVmbusSintIndex ## CONSUMES 60 | gMsvmPkgTokenSpaceGuid.PcdIsolationSharedGpaBoundary ## CONSUMES 61 | gMsvmPkgTokenSpaceGuid.PcdIsolationSharedGpaCanonicalizationBitmask ## CONSUMES 62 | gMsvmPkgTokenSpaceGuid.PcdEnableIMCWhenIsolated ## SOMETIMES_CONSUMES 63 | 64 | [Depex] 65 | gEfiHvProtocolGuid 66 | -------------------------------------------------------------------------------- /MsvmPkg/VpcivscDxe/PciBars.h: -------------------------------------------------------------------------------- 1 | /** @file 2 | Helper definition for PCI BARs defined in the PCI specification. 3 | 4 | Copyright (c) Microsoft Corporation. 5 | SPDX-License-Identifier: BSD-2-Clause-Patent 6 | --*/ 7 | 8 | #pragma once 9 | 10 | #include 11 | 12 | // Attribute types for BARs. See PCI Local Bus Specification Revision 3.0, section 6.2.5.1 13 | #pragma warning(disable : 4201) 14 | typedef struct _PCI_BAR_FORMAT 15 | { 16 | union { 17 | struct 18 | { 19 | UINT32 MemorySpaceIndicator:1; 20 | UINT32 MemoryType:2; 21 | UINT32 Prefetchable:1; 22 | UINT32 Address:28; 23 | } Memory; 24 | 25 | struct 26 | { 27 | UINT32 IoSpaceIndicator:1; 28 | UINT32 Reserved:1; 29 | UINT32 Address:30; 30 | }; 31 | 32 | UINT32 AsUINT32; 33 | }; 34 | } PCI_BAR_FORMAT; 35 | #pragma warning(default : 4201) 36 | 37 | #define PCI_BAR_MEMORY_TYPE_64BIT 0x2 -------------------------------------------------------------------------------- /MsvmPkg/VpcivscDxe/VpcivscDxe.inf: -------------------------------------------------------------------------------- 1 | ## @file 2 | # 3 | # Copyright (c) Microsoft Corporation. 4 | # SPDX-License-Identifier: BSD-2-Clause-Patent 5 | # 6 | ## 7 | 8 | [Defines] 9 | INF_VERSION = 0x00010005 10 | BASE_NAME = VpcivscDxe 11 | FILE_GUID = 5D1C9F32-965E-432E-B4BF-ED585D4E0896 12 | MODULE_TYPE = UEFI_DRIVER 13 | VERSION_STRING = 1.0 14 | ENTRY_POINT = VpcivscDriverEntryPoint 15 | 16 | [Sources] 17 | VpcivscDxe.c 18 | VpcivscPciIo.c 19 | 20 | [Packages] 21 | MdePkg/MdePkg.dec 22 | MsvmPkg/MsvmPkg.dec 23 | 24 | [LibraryClasses] 25 | BaseLib 26 | BaseMemoryLib 27 | CrashLib 28 | DebugLib 29 | DevicePathLib 30 | EmclLib 31 | IoLib 32 | IsolationLib 33 | MemoryAllocationLib 34 | MmioAllocationLib 35 | UefiDriverEntryPoint 36 | UefiLib 37 | UefiBootServicesTableLib 38 | 39 | [Protocols] 40 | gEfiVmbusProtocolGuid #CONSUMES 41 | gEfiEmclV2ProtocolGuid #CONSUMES 42 | gEfiPciIoProtocolGuid #PRODUCES 43 | 44 | [Guids] 45 | gEfiVmbusChannelDevicePathGuid #CONSUMES 46 | gSyntheticVpciClassGuid #CONSUMES 47 | 48 | [Pcd] 49 | gMsvmPkgTokenSpaceGuid.PcdIsolationSharedGpaBoundary 50 | gMsvmPkgTokenSpaceGuid.PcdIsolationSharedGpaCanonicalizationBitmask 51 | gMsvmPkgTokenSpaceGuid.PcdVpciBootEnabled 52 | gMsvmPkgTokenSpaceGuid.PcdVpciInstanceFilterGuidPtr -------------------------------------------------------------------------------- /MsvmPkg/VpcivscDxe/wdm.h: -------------------------------------------------------------------------------- 1 | /** @file 2 | Certain Windows driver-specific items made it into the VPCI protocol. 3 | Corral them here. 4 | 5 | Copyright (c) Microsoft Corporation. 6 | SPDX-License-Identifier: BSD-2-Clause-Patent 7 | --*/ 8 | 9 | #pragma once 10 | 11 | #define CmResourceTypeNull 0 12 | #define CmResourceTypeMemory 3 13 | 14 | // 15 | // Define the bit masks exclusive to type CmResourceTypeMemoryLarge. 16 | // 17 | #define CM_RESOURCE_MEMORY_LARGE_40 0x0200 18 | #define CM_RESOURCE_MEMORY_LARGE_48 0x0400 19 | #define CM_RESOURCE_MEMORY_LARGE_64 0x0800 20 | 21 | // 22 | // Define limits for large memory resources 23 | // 24 | #define CM_RESOURCE_MEMORY_LARGE_40_MAXLEN 0x000000FFFFFFFF00 25 | #define CM_RESOURCE_MEMORY_LARGE_48_MAXLEN 0x0000FFFFFFFF0000 26 | #define CM_RESOURCE_MEMORY_LARGE_64_MAXLEN 0xFFFFFFFF00000000 27 | 28 | // 29 | // Make sure alignment is made properly by compiler 30 | // 31 | #pragma pack(4) 32 | 33 | typedef struct _CM_PARTIAL_RESOURCE_DESCRIPTOR { 34 | UINT8 Type; 35 | UINT8 ShareDisposition; 36 | UINT16 Flags; 37 | union { 38 | struct { 39 | PHYSICAL_ADDRESS Start; 40 | UINT32 Length; 41 | } Generic; 42 | 43 | struct { 44 | UINT64 First; 45 | UINT64 Second; 46 | } ForSize; 47 | } u; 48 | } CM_PARTIAL_RESOURCE_DESCRIPTOR, *PCM_PARTIAL_RESOURCE_DESCRIPTOR; 49 | 50 | #pragma pack() 51 | 52 | static_assert(sizeof(CM_PARTIAL_RESOURCE_DESCRIPTOR) == 0x14); 53 | -------------------------------------------------------------------------------- /MsvmPkg/WatchdogTimerDxe/WatchdogTimerDxe.inf: -------------------------------------------------------------------------------- 1 | ## @file 2 | # Watchdog timer driver producing the Watchdog Timer Architectural Protocol. 3 | # 4 | # Copyright (c) Microsoft Corporation. 5 | # SPDX-License-Identifier: BSD-2-Clause-Patent 6 | # 7 | ## 8 | 9 | [Defines] 10 | INF_VERSION = 0x00010016 11 | BASE_NAME = WatchdogTimer 12 | FILE_GUID = BD3C7586-B9A3-4332-9EEE-E9F02CF6A931 13 | MODULE_TYPE = DXE_DRIVER 14 | VERSION_STRING = 1.0 15 | ENTRY_POINT = WatchdogInitialize 16 | 17 | [Sources] 18 | WatchdogTimer.c 19 | 20 | [Packages] 21 | MdePkg/MdePkg.dec 22 | MsvmPkg/MsvmPkg.dec 23 | 24 | [LibraryClasses] 25 | DebugLib 26 | IoLib 27 | IsolationLib 28 | ReportStatusCodeLib 29 | UefiBootServicesTableLib 30 | UefiDriverEntryPoint 31 | UefiRuntimeServicesTableLib 32 | WatchdogTimerLib 33 | 34 | [Protocols] 35 | gEfiWatchdogTimerArchProtocolGuid ## PRODUCES 36 | 37 | [Guids] 38 | gEfiEventExitBootServicesGuid ## CONSUMES 39 | 40 | [depex] 41 | gEfiTimerArchProtocolGuid 42 | -------------------------------------------------------------------------------- /MsvmPkg/image_validation.cfg: -------------------------------------------------------------------------------- 1 | IGNORE_LIST: 2 | - kduefi.efi -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Project 2 | 3 | This repo contains the Msvm firmware project for virtual machines running with 4 | the Microsoft hypervisor. 5 | 6 | This repository is built on top of Project Mu. Please see Project Mu for details https://microsoft.github.io/mu 7 | 8 | ## Developer Guide 9 | 10 | See the [developer guide](MsvmPkg/Docs/DEVGUIDE.md) and in particular the getting started section. 11 | 12 | ## Contributing 13 | 14 | This project welcomes [contributions](MsvmPkg/Docs/CONTRIBUTING.md) and suggestions. Most contributions require you to agree to a 15 | Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us 16 | the rights to use your contribution. For details, visit [Contributor License Agreements](https://cla.opensource.microsoft.com). 17 | 18 | When you submit a pull request, a CLA bot will automatically determine whether you need to provide 19 | a CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions 20 | provided by the bot. You will only need to do this once across all repos using our CLA. 21 | 22 | This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). 23 | For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or 24 | contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments. 25 | 26 | ## Trademarks 27 | 28 | This project may contain trademarks or logos for projects, products, or services. Authorized use of Microsoft 29 | trademarks or logos is subject to and must follow 30 | [Microsoft's Trademark & Brand Guidelines](https://www.microsoft.com/legal/intellectualproperty/trademarks/usage/general). 31 | Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship. 32 | Any use of third-party trademarks or logos are subject to those third-party's policies. 33 | 34 | -------------------------------------------------------------------------------- /SUPPORT.md: -------------------------------------------------------------------------------- 1 | # Support 2 | 3 | ## How to file issues and get help 4 | 5 | This project uses GitHub Issues to track bugs and feature requests. Please search the existing 6 | issues before filing new issues to avoid duplicates. For new issues, file your bug or 7 | feature request as a new Issue. 8 | 9 | ## Microsoft Support Policy 10 | 11 | Support for this project is limited to the resources listed above. -------------------------------------------------------------------------------- /pip_requirement_stable.txt: -------------------------------------------------------------------------------- 1 | edk2-pytool-library~=0.23.2 2 | edk2-pytool-extensions~=0.29.5 3 | regex --------------------------------------------------------------------------------