From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smic.int.bsdio.com (smic.int.bsdio.com [65.103.231.193]) by mx.groups.io with SMTP id smtpd.web11.827.1586992370037336991 for ; Wed, 15 Apr 2020 16:12:50 -0700 Authentication-Results: mx.groups.io; dkim=missing; spf=none, err=permanent DNS error (domain: smic.int.bsdio.com, ip: 65.103.231.193, mailfrom: bcran@smic.int.bsdio.com) Received: from smic.int.bsdio.com (localhost [127.0.0.1]) by smic.int.bsdio.com (8.15.2/8.15.2) with ESMTPS id 03FNA83t066386 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Wed, 15 Apr 2020 17:10:08 -0600 (MDT) (envelope-from bcran@smic.int.bsdio.com) Received: (from bcran@localhost) by smic.int.bsdio.com (8.15.2/8.15.2/Submit) id 03FNA8Xv064170; Wed, 15 Apr 2020 17:10:08 -0600 (MDT) (envelope-from bcran) From: "Rebecca Cran" To: devel@edk2.groups.io Cc: Jordan Justen , Laszlo Ersek , Ard Biesheuvel , Rebecca Cran Subject: [PATCH 08/13] Add BhyvePkg, to support the bhyve hypervisor Date: Wed, 15 Apr 2020 17:09:34 -0600 Message-Id: <821d6c92bb70f1f416a87fc01e5d180527592a95.1586991816.git.rebecca@bsdio.com> X-Mailer: git-send-email 2.26.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable BhyvePkg supports the bhyve hypervisor, which is a hypervisor/virtual machine manager available on FreeBSD, macOS and Illumos. Signed-off-by: Rebecca Cran --- BhyvePkg/AcpiTables/AcpiTables.inf | 47 + BhyvePkg/AcpiTables/Dsdt.asl | 1134 +++++++++++ BhyvePkg/AcpiTables/Facp.aslc | 82 + BhyvePkg/AcpiTables/Facs.aslc | 84 + BhyvePkg/AcpiTables/Hpet.aslc | 78 + BhyvePkg/AcpiTables/Madt.aslc | 149 ++ BhyvePkg/AcpiTables/Mcfg.aslc | 63 + BhyvePkg/AcpiTables/Platform.h | 76 + BhyvePkg/AcpiTables/Spcr.aslc | 69 + BhyvePkg/AcpiTables/Ssdt.asl | 19 + BhyvePkg/BhyvePkg.dec | 176 ++ BhyvePkg/BhyvePkg.fdf.inc | 92 + BhyvePkg/BhyvePkgX64.dsc | 862 +++++++++ BhyvePkg/BhyvePkgX64.fdf | 529 ++++++ BhyvePkg/BhyveRfbDxe/BhyveRfbDxe.inf | 76 + BhyvePkg/BhyveRfbDxe/ComponentName.c | 205 ++ BhyvePkg/BhyveRfbDxe/Gop.h | 153 ++ BhyvePkg/BhyveRfbDxe/GopDriver.c | 548 ++++++ BhyvePkg/BhyveRfbDxe/GopScreen.c | 398 ++++ BhyvePkg/BhyveRfbDxe/VbeShim.asm | 347 ++++ BhyvePkg/BhyveRfbDxe/VbeShim.c | 263 +++ BhyvePkg/BhyveRfbDxe/VbeShim.h | 912 +++++++++ BhyvePkg/BhyveRfbDxe/VbeShim.sh | 85 + BhyvePkg/DecomprScratchEnd.fdf.inc | 72 + BhyvePkg/Include/Library/BhyveFwCtlLib.h | 52 + .../Library/BhyveFwCtlLib/BhyveFwCtlLib.c | 431 +++++ .../Library/BhyveFwCtlLib/BhyveFwCtlLib.inf | 45 + .../PlatformBootManagerLib/BdsPlatform.c | 1663 +++++++++++++++++ .../PlatformBootManagerLib/BdsPlatform.h | 196 ++ .../PlatformBootManagerLib.inf | 79 + .../PlatformBootManagerLib/PlatformData.c | 176 ++ BhyvePkg/License.txt | 50 + BhyvePkg/SmbiosPlatformDxe/Bhyve.c | 49 + .../SmbiosPlatformDxe/SmbiosPlatformDxe.c | 250 +++ .../SmbiosPlatformDxe/SmbiosPlatformDxe.h | 69 + .../SmbiosPlatformDxe/SmbiosPlatformDxe.inf | 59 + BhyvePkg/VarStore.fdf.inc | 122 ++ 37 files changed, 9760 insertions(+) create mode 100644 BhyvePkg/AcpiTables/AcpiTables.inf create mode 100644 BhyvePkg/AcpiTables/Dsdt.asl create mode 100644 BhyvePkg/AcpiTables/Facp.aslc create mode 100644 BhyvePkg/AcpiTables/Facs.aslc create mode 100644 BhyvePkg/AcpiTables/Hpet.aslc create mode 100644 BhyvePkg/AcpiTables/Madt.aslc create mode 100644 BhyvePkg/AcpiTables/Mcfg.aslc create mode 100644 BhyvePkg/AcpiTables/Platform.h create mode 100644 BhyvePkg/AcpiTables/Spcr.aslc create mode 100644 BhyvePkg/AcpiTables/Ssdt.asl create mode 100644 BhyvePkg/BhyvePkg.dec create mode 100644 BhyvePkg/BhyvePkg.fdf.inc create mode 100644 BhyvePkg/BhyvePkgX64.dsc create mode 100644 BhyvePkg/BhyvePkgX64.fdf create mode 100644 BhyvePkg/BhyveRfbDxe/BhyveRfbDxe.inf create mode 100644 BhyvePkg/BhyveRfbDxe/ComponentName.c create mode 100644 BhyvePkg/BhyveRfbDxe/Gop.h create mode 100644 BhyvePkg/BhyveRfbDxe/GopDriver.c create mode 100644 BhyvePkg/BhyveRfbDxe/GopScreen.c create mode 100644 BhyvePkg/BhyveRfbDxe/VbeShim.asm create mode 100644 BhyvePkg/BhyveRfbDxe/VbeShim.c create mode 100644 BhyvePkg/BhyveRfbDxe/VbeShim.h create mode 100644 BhyvePkg/BhyveRfbDxe/VbeShim.sh create mode 100644 BhyvePkg/DecomprScratchEnd.fdf.inc create mode 100644 BhyvePkg/Include/Library/BhyveFwCtlLib.h create mode 100644 BhyvePkg/Library/BhyveFwCtlLib/BhyveFwCtlLib.c create mode 100644 BhyvePkg/Library/BhyveFwCtlLib/BhyveFwCtlLib.inf create mode 100644 BhyvePkg/Library/PlatformBootManagerLib/BdsPlatform.c create mode 100644 BhyvePkg/Library/PlatformBootManagerLib/BdsPlatform.h create mode 100644 BhyvePkg/Library/PlatformBootManagerLib/PlatformBootMan= agerLib.inf create mode 100644 BhyvePkg/Library/PlatformBootManagerLib/PlatformData.c create mode 100644 BhyvePkg/License.txt create mode 100644 BhyvePkg/SmbiosPlatformDxe/Bhyve.c create mode 100644 BhyvePkg/SmbiosPlatformDxe/SmbiosPlatformDxe.c create mode 100644 BhyvePkg/SmbiosPlatformDxe/SmbiosPlatformDxe.h create mode 100644 BhyvePkg/SmbiosPlatformDxe/SmbiosPlatformDxe.inf create mode 100644 BhyvePkg/VarStore.fdf.inc diff --git a/BhyvePkg/AcpiTables/AcpiTables.inf b/BhyvePkg/AcpiTables/AcpiT= ables.inf new file mode 100644 index 0000000000..38665eaa9b --- /dev/null +++ b/BhyvePkg/AcpiTables/AcpiTables.inf @@ -0,0 +1,47 @@ +## @file=0D +# Component description file for PlatformAcpiTables module.=0D +#=0D +# ACPI table data and ASL sources required to boot the platform.=0D +#=0D +# Copyright (c) 2008 - 2018, Intel Corporation. All rights reserved.
= =0D +# Copyright (c) 2014, Pluribus Networks, Inc.^M=0D +# This program and the accompanying materials=0D +# are licensed and made available under the terms and conditions of the B= SD License=0D +# which accompanies this distribution. The full text of the license may = be found at=0D +# http://opensource.org/licenses/bsd-license.php=0D +#=0D +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,=0D +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IM= PLIED.=0D +#=0D +##=0D +=0D +[Defines]=0D + INF_VERSION =3D 0x00010005=0D + BASE_NAME =3D PlatformAcpiTables=0D + FILE_GUID =3D 7E374E25-8E01-4FEE-87F2-390C23C606CD= =0D + MODULE_TYPE =3D USER_DEFINED=0D + VERSION_STRING =3D 1.0=0D +=0D +#=0D +# The following information is for reference only and not required by the = build tools.=0D +#=0D +# VALID_ARCHITECTURES =3D IA32 X64 EBC=0D +#=0D +=0D +[Sources]=0D + Platform.h=0D + Madt.aslc=0D + Facp.aslc=0D + Facs.aslc=0D + Dsdt.asl=0D + Hpet.aslc=0D + Spcr.aslc=0D + Mcfg.aslc=0D +=0D +[Packages]=0D + MdePkg/MdePkg.dec=0D + OvmfPkg/OvmfPkg.dec=0D +=0D +[Pcd]=0D + gUefiOvmfPkgTokenSpaceGuid.PcdDebugIoPort=0D +=0D diff --git a/BhyvePkg/AcpiTables/Dsdt.asl b/BhyvePkg/AcpiTables/Dsdt.asl new file mode 100644 index 0000000000..a60d001ffd --- /dev/null +++ b/BhyvePkg/AcpiTables/Dsdt.asl @@ -0,0 +1,1134 @@ +/*=0D + * Intel ACPI Component Architecture=0D + * AML Disassembler version 20100528=0D + *=0D + * Disassembly of DSDT.dat, Sat Apr 18 15:41:05 2015=0D + *=0D + *=0D + * Original Table Header:=0D + * Signature "DSDT"=0D + * Length 0x000008FA (2298)=0D + * Revision 0x02=0D + * Checksum 0xC4=0D + * OEM ID "BHYVE "=0D + * OEM Table ID "BVDSDT "=0D + * OEM Revision 0x00000001 (1)=0D + * Compiler ID "INTL"=0D + * Compiler Version 0x20150204 (538247684)=0D + */=0D +DefinitionBlock ("DSDT.aml", "DSDT", 2, "BHYVE", "BVDSDT", 0x00000001)=0D +{=0D + Name (_S5, Package (0x02)=0D + {=0D + 0x05,=0D + Zero=0D + })=0D + Name (PICM, Zero)=0D + Method (_PIC, 1, NotSerialized)=0D + {=0D + Store (Arg0, PICM)=0D + }=0D +=0D + Scope (_SB)=0D + {=0D + Device (PC00)=0D + {=0D + Name (_HID, EisaId ("PNP0A03"))=0D + Name (_ADR, Zero)=0D + Method (_BBN, 0, NotSerialized)=0D + {=0D + Return (Zero)=0D + }=0D +=0D + Name (_CRS, ResourceTemplate ()=0D + {=0D + WordBusNumber (ResourceProducer, MinFixed, MaxFixed, PosDe= code,=0D + 0x0000, // Granularity=0D + 0x0000, // Range Minimum=0D + 0x00FF, // Range Maximum=0D + 0x0000, // Translation Offset=0D + 0x0100, // Length=0D + ,, )=0D + IO (Decode16,=0D + 0x03C0, // Range Minimum=0D + 0x03C0, // Range Maximum=0D + 0x00, // Alignment=0D + 0x20, // Length=0D + )=0D + IO (Decode16,=0D + 0x0CF8, // Range Minimum=0D + 0x0CF8, // Range Maximum=0D + 0x01, // Alignment=0D + 0x08, // Length=0D + )=0D + WordIO (ResourceProducer, MinFixed, MaxFixed, PosDecode, E= ntireRange,=0D + 0x0000, // Granularity=0D + 0x0000, // Range Minimum=0D + 0x0CF7, // Range Maximum=0D + 0x0000, // Translation Offset=0D + 0x0CF8, // Length=0D + ,, , TypeStatic)=0D + WordIO (ResourceProducer, MinFixed, MaxFixed, PosDecode, E= ntireRange,=0D + 0x0000, // Granularity=0D + 0x0D00, // Range Minimum=0D + 0xFFFF, // Range Maximum=0D + 0x0000, // Translation Offset=0D + 0xF300, // Length=0D + ,, , TypeStatic)=0D + DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFix= ed, Cacheable, ReadWrite,=0D + 0x00000000, // Granularity=0D + 0x000A0000, // Range Minimum=0D + 0x000BFFFF, // Range Maximum=0D + 0x00000000, // Translation Offset=0D + 0x00020000, // Length=0D + ,, , AddressRangeMemory, TypeStatic)=0D + DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFix= ed, NonCacheable, ReadWrite,=0D + 0x00000000, // Granularity=0D + 0xC0000000, // Range Minimum=0D + 0xDFFFFFFF, // Range Maximum=0D + 0x00000000, // Translation Offset=0D + 0x20000000, // Range Length=0D + ,, PW32)=0D + DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFix= ed, NonCacheable, ReadWrite,=0D + 0x00000000, // Granularity=0D + 0xF0000000, // Range Minimum=0D + 0xF07FFFFF, // Range Maximum=0D + 0x00000000, // Translation Offset=0D + 0x00800000, // Range Length=0D + ,, FB32)=0D + QWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFix= ed, NonCacheable, ReadWrite,=0D + 0x0000000000000000, // Granularity=0D + 0x000000D000000000, // Range Minimum=0D + 0x000000D0000FFFFF, // Range Maximum=0D + 0x0000000000000000, // Translation Offset=0D + 0x0000000000100000, // Length=0D + ,, , AddressRangeMemory, TypeStatic)=0D + })=0D + Name (PPRT, Package ()=0D + {=0D + Package () { 0x0000FFFF, 0, LPC.LNKF, Zero },=0D + Package () { 0x0000FFFF, 1, LPC.LNKG, Zero },=0D + Package () { 0x0000FFFF, 2, LPC.LNKH, Zero },=0D + Package () { 0x0000FFFF, 3, LPC.LNKA, Zero },=0D +=0D + Package () { 0x0001FFFF, 0, LPC.LNKG, Zero },=0D + Package () { 0x0001FFFF, 1, LPC.LNKH, Zero },=0D + Package () { 0x0001FFFF, 2, LPC.LNKA, Zero },=0D + Package () { 0x0001FFFF, 3, LPC.LNKB, Zero },=0D +=0D + Package () { 0x0002FFFF, 0, LPC.LNKH, Zero },=0D + Package () { 0x0002FFFF, 1, LPC.LNKA, Zero },=0D + Package () { 0x0002FFFF, 2, LPC.LNKB, Zero },=0D + Package () { 0x0002FFFF, 3, LPC.LNKC, Zero },=0D +=0D + Package () { 0x0003FFFF, 0, LPC.LNKA, Zero },=0D + Package () { 0x0003FFFF, 1, LPC.LNKB, Zero },=0D + Package () { 0x0003FFFF, 2, LPC.LNKC, Zero },=0D + Package () { 0x0003FFFF, 3, LPC.LNKD, Zero },=0D +=0D + Package () { 0x0004FFFF, 0, LPC.LNKB, Zero },=0D + Package () { 0x0004FFFF, 1, LPC.LNKC, Zero },=0D + Package () { 0x0004FFFF, 2, LPC.LNKD, Zero },=0D + Package () { 0x0004FFFF, 3, LPC.LNKE, Zero },=0D +=0D + Package () { 0x0005FFFF, 0, LPC.LNKC, Zero },=0D + Package () { 0x0005FFFF, 1, LPC.LNKD, Zero },=0D + Package () { 0x0005FFFF, 2, LPC.LNKE, Zero },=0D + Package () { 0x0005FFFF, 3, LPC.LNKF, Zero },=0D +=0D + Package () { 0x0006FFFF, 0, LPC.LNKD, Zero },=0D + Package () { 0x0006FFFF, 1, LPC.LNKE, Zero },=0D + Package () { 0x0006FFFF, 2, LPC.LNKF, Zero },=0D + Package () { 0x0006FFFF, 3, LPC.LNKG, Zero },=0D +=0D + Package () { 0x0007FFFF, 0, LPC.LNKE, Zero },=0D + Package () { 0x0007FFFF, 1, LPC.LNKF, Zero },=0D + Package () { 0x0007FFFF, 2, LPC.LNKG, Zero },=0D + Package () { 0x0007FFFF, 3, LPC.LNKH, Zero },=0D +=0D + Package () { 0x0008FFFF, 0, LPC.LNKF, Zero },=0D + Package () { 0x0008FFFF, 1, LPC.LNKG, Zero },=0D + Package () { 0x0008FFFF, 2, LPC.LNKH, Zero },=0D + Package () { 0x0008FFFF, 3, LPC.LNKA, Zero },=0D +=0D + Package () { 0x0009FFFF, 0, LPC.LNKG, Zero },=0D + Package () { 0x0009FFFF, 1, LPC.LNKH, Zero },=0D + Package () { 0x0009FFFF, 2, LPC.LNKA, Zero },=0D + Package () { 0x0009FFFF, 3, LPC.LNKB, Zero },=0D +=0D + Package () { 0x000AFFFF, 0, LPC.LNKH, Zero },=0D + Package () { 0x000AFFFF, 1, LPC.LNKA, Zero },=0D + Package () { 0x000AFFFF, 2, LPC.LNKB, Zero },=0D + Package () { 0x000AFFFF, 3, LPC.LNKC, Zero },=0D +=0D + Package () { 0x000BFFFF, 0, LPC.LNKA, Zero },=0D + Package () { 0x000BFFFF, 1, LPC.LNKB, Zero },=0D + Package () { 0x000BFFFF, 2, LPC.LNKC, Zero },=0D + Package () { 0x000BFFFF, 3, LPC.LNKD, Zero },=0D +=0D + Package () { 0x000CFFFF, 0, LPC.LNKB, Zero },=0D + Package () { 0x000CFFFF, 1, LPC.LNKC, Zero },=0D + Package () { 0x000CFFFF, 2, LPC.LNKD, Zero },=0D + Package () { 0x000CFFFF, 3, LPC.LNKE, Zero },=0D +=0D + Package () { 0x000DFFFF, 0, LPC.LNKC, Zero },=0D + Package () { 0x000DFFFF, 1, LPC.LNKD, Zero },=0D + Package () { 0x000DFFFF, 2, LPC.LNKE, Zero },=0D + Package () { 0x000DFFFF, 3, LPC.LNKF, Zero },=0D +=0D + Package () { 0x000EFFFF, 0, LPC.LNKD, Zero },=0D + Package () { 0x000EFFFF, 1, LPC.LNKE, Zero },=0D + Package () { 0x000EFFFF, 2, LPC.LNKF, Zero },=0D + Package () { 0x000EFFFF, 3, LPC.LNKG, Zero },=0D +=0D + Package () { 0x000FFFFF, 0, LPC.LNKE, Zero },=0D + Package () { 0x000FFFFF, 1, LPC.LNKF, Zero },=0D + Package () { 0x000FFFFF, 2, LPC.LNKG, Zero },=0D + Package () { 0x000FFFFF, 3, LPC.LNKH, Zero },=0D +=0D + Package () { 0x0010FFFF, 0, LPC.LNKF, Zero },=0D + Package () { 0x0010FFFF, 1, LPC.LNKG, Zero },=0D + Package () { 0x0010FFFF, 2, LPC.LNKH, Zero },=0D + Package () { 0x0010FFFF, 3, LPC.LNKA, Zero },=0D +=0D + Package () { 0x0011FFFF, 0, LPC.LNKG, Zero },=0D + Package () { 0x0011FFFF, 1, LPC.LNKH, Zero },=0D + Package () { 0x0011FFFF, 2, LPC.LNKA, Zero },=0D + Package () { 0x0011FFFF, 3, LPC.LNKB, Zero },=0D +=0D + Package () { 0x0012FFFF, 0, LPC.LNKH, Zero },=0D + Package () { 0x0012FFFF, 1, LPC.LNKA, Zero },=0D + Package () { 0x0012FFFF, 2, LPC.LNKB, Zero },=0D + Package () { 0x0012FFFF, 3, LPC.LNKC, Zero },=0D +=0D + Package () { 0x0013FFFF, 0, LPC.LNKA, Zero },=0D + Package () { 0x0013FFFF, 1, LPC.LNKB, Zero },=0D + Package () { 0x0013FFFF, 2, LPC.LNKC, Zero },=0D + Package () { 0x0013FFFF, 3, LPC.LNKD, Zero },=0D +=0D + Package () { 0x0014FFFF, 0, LPC.LNKB, Zero },=0D + Package () { 0x0014FFFF, 1, LPC.LNKC, Zero },=0D + Package () { 0x0014FFFF, 2, LPC.LNKD, Zero },=0D + Package () { 0x0014FFFF, 3, LPC.LNKE, Zero },=0D +=0D + Package () { 0x0015FFFF, 0, LPC.LNKC, Zero },=0D + Package () { 0x0015FFFF, 1, LPC.LNKD, Zero },=0D + Package () { 0x0015FFFF, 2, LPC.LNKE, Zero },=0D + Package () { 0x0015FFFF, 3, LPC.LNKF, Zero },=0D +=0D + Package () { 0x0016FFFF, 0, LPC.LNKD, Zero },=0D + Package () { 0x0016FFFF, 1, LPC.LNKE, Zero },=0D + Package () { 0x0016FFFF, 2, LPC.LNKF, Zero },=0D + Package () { 0x0016FFFF, 3, LPC.LNKG, Zero },=0D +=0D + Package () { 0x0017FFFF, 0, LPC.LNKE, Zero },=0D + Package () { 0x0017FFFF, 1, LPC.LNKF, Zero },=0D + Package () { 0x0017FFFF, 2, LPC.LNKG, Zero },=0D + Package () { 0x0017FFFF, 3, LPC.LNKH, Zero },=0D +=0D + Package () { 0x0018FFFF, 0, LPC.LNKF, Zero },=0D + Package () { 0x0018FFFF, 1, LPC.LNKG, Zero },=0D + Package () { 0x0018FFFF, 2, LPC.LNKH, Zero },=0D + Package () { 0x0018FFFF, 3, LPC.LNKA, Zero },=0D +=0D + Package () { 0x0019FFFF, 0, LPC.LNKG, Zero },=0D + Package () { 0x0019FFFF, 1, LPC.LNKH, Zero },=0D + Package () { 0x0019FFFF, 2, LPC.LNKA, Zero },=0D + Package () { 0x0019FFFF, 3, LPC.LNKB, Zero },=0D +=0D + Package () { 0x001AFFFF, 0, LPC.LNKH, Zero },=0D + Package () { 0x001AFFFF, 1, LPC.LNKA, Zero },=0D + Package () { 0x001AFFFF, 2, LPC.LNKB, Zero },=0D + Package () { 0x001AFFFF, 3, LPC.LNKC, Zero },=0D +=0D + Package () { 0x001BFFFF, 0, LPC.LNKA, Zero },=0D + Package () { 0x001BFFFF, 1, LPC.LNKB, Zero },=0D + Package () { 0x001BFFFF, 2, LPC.LNKC, Zero },=0D + Package () { 0x001BFFFF, 3, LPC.LNKD, Zero },=0D +=0D + Package () { 0x001CFFFF, 0, LPC.LNKB, Zero },=0D + Package () { 0x001CFFFF, 1, LPC.LNKC, Zero },=0D + Package () { 0x001CFFFF, 2, LPC.LNKD, Zero },=0D + Package () { 0x001CFFFF, 3, LPC.LNKE, Zero },=0D +=0D + Package () { 0x001DFFFF, 0, LPC.LNKC, Zero },=0D + Package () { 0x001DFFFF, 1, LPC.LNKD, Zero },=0D + Package () { 0x001DFFFF, 2, LPC.LNKE, Zero },=0D + Package () { 0x001DFFFF, 3, LPC.LNKF, Zero },=0D +=0D + Package () { 0x001EFFFF, 0, LPC.LNKD, Zero },=0D + Package () { 0x001EFFFF, 1, LPC.LNKE, Zero },=0D + Package () { 0x001EFFFF, 2, LPC.LNKF, Zero },=0D + Package () { 0x001EFFFF, 3, LPC.LNKG, Zero },=0D +=0D + Package () { 0x001FFFFF, 0, LPC.LNKE, Zero },=0D + Package () { 0x001FFFFF, 1, LPC.LNKF, Zero },=0D + Package () { 0x001FFFFF, 2, LPC.LNKG, Zero },=0D + Package () { 0x001FFFFF, 3, LPC.LNKH, Zero }=0D + })=0D + Name (APRT, Package ()=0D + {=0D + Package () { 0x0000FFFF, 0, Zero, 0x15 },=0D + Package () { 0x0000FFFF, 1, Zero, 0x16 },=0D + Package () { 0x0000FFFF, 2, Zero, 0x17 },=0D + Package () { 0x0000FFFF, 3, Zero, 0x10 },=0D +=0D + Package () { 0x0001FFFF, 0, Zero, 0x16 },=0D + Package () { 0x0001FFFF, 1, Zero, 0x17 },=0D + Package () { 0x0001FFFF, 2, Zero, 0x10 },=0D + Package () { 0x0001FFFF, 3, Zero, 0x11 },=0D +=0D + Package () { 0x0002FFFF, 0, Zero, 0x17 },=0D + Package () { 0x0002FFFF, 1, Zero, 0x10 },=0D + Package () { 0x0002FFFF, 2, Zero, 0x11 },=0D + Package () { 0x0002FFFF, 3, Zero, 0x12 },=0D +=0D + Package () { 0x0003FFFF, 0, Zero, 0x10 },=0D + Package () { 0x0003FFFF, 1, Zero, 0x11 },=0D + Package () { 0x0003FFFF, 2, Zero, 0x12 },=0D + Package () { 0x0003FFFF, 3, Zero, 0x13 },=0D +=0D + Package () { 0x0004FFFF, 0, Zero, 0x11 },=0D + Package () { 0x0004FFFF, 1, Zero, 0x12 },=0D + Package () { 0x0004FFFF, 2, Zero, 0x13 },=0D + Package () { 0x0004FFFF, 3, Zero, 0x14 },=0D +=0D + Package () { 0x0005FFFF, 0, Zero, 0x12 },=0D + Package () { 0x0005FFFF, 1, Zero, 0x13 },=0D + Package () { 0x0005FFFF, 2, Zero, 0x14 },=0D + Package () { 0x0005FFFF, 3, Zero, 0x15 },=0D +=0D + Package () { 0x0006FFFF, 0, Zero, 0x13 },=0D + Package () { 0x0006FFFF, 1, Zero, 0x14 },=0D + Package () { 0x0006FFFF, 2, Zero, 0x15 },=0D + Package () { 0x0006FFFF, 3, Zero, 0x16 },=0D +=0D + Package () { 0x0007FFFF, 0, Zero, 0x14 },=0D + Package () { 0x0007FFFF, 1, Zero, 0x15 },=0D + Package () { 0x0007FFFF, 2, Zero, 0x16 },=0D + Package () { 0x0007FFFF, 3, Zero, 0x17 },=0D +=0D + Package () { 0x0008FFFF, 0, Zero, 0x15 },=0D + Package () { 0x0008FFFF, 1, Zero, 0x16 },=0D + Package () { 0x0008FFFF, 2, Zero, 0x17 },=0D + Package () { 0x0008FFFF, 3, Zero, 0x10 },=0D +=0D + Package () { 0x0009FFFF, 0, Zero, 0x16 },=0D + Package () { 0x0009FFFF, 1, Zero, 0x17 },=0D + Package () { 0x0009FFFF, 2, Zero, 0x10 },=0D + Package () { 0x0009FFFF, 3, Zero, 0x11 },=0D +=0D + Package () { 0x000AFFFF, 0, Zero, 0x17 },=0D + Package () { 0x000AFFFF, 1, Zero, 0x10 },=0D + Package () { 0x000AFFFF, 2, Zero, 0x11 },=0D + Package () { 0x000AFFFF, 3, Zero, 0x12 },=0D +=0D + Package () { 0x000BFFFF, 0, Zero, 0x10 },=0D + Package () { 0x000BFFFF, 1, Zero, 0x11 },=0D + Package () { 0x000BFFFF, 2, Zero, 0x12 },=0D + Package () { 0x000BFFFF, 3, Zero, 0x13 },=0D +=0D + Package () { 0x000CFFFF, 0, Zero, 0x11 },=0D + Package () { 0x000CFFFF, 1, Zero, 0x12 },=0D + Package () { 0x000CFFFF, 2, Zero, 0x13 },=0D + Package () { 0x000CFFFF, 3, Zero, 0x14 },=0D +=0D + Package () { 0x000DFFFF, 0, Zero, 0x12 },=0D + Package () { 0x000DFFFF, 1, Zero, 0x13 },=0D + Package () { 0x000DFFFF, 2, Zero, 0x14 },=0D + Package () { 0x000DFFFF, 3, Zero, 0x15 },=0D +=0D + Package () { 0x000EFFFF, 0, Zero, 0x13 },=0D + Package () { 0x000EFFFF, 1, Zero, 0x14 },=0D + Package () { 0x000EFFFF, 2, Zero, 0x15 },=0D + Package () { 0x000EFFFF, 3, Zero, 0x16 },=0D +=0D + Package () { 0x000FFFFF, 0, Zero, 0x14 },=0D + Package () { 0x000FFFFF, 1, Zero, 0x15 },=0D + Package () { 0x000FFFFF, 2, Zero, 0x16 },=0D + Package () { 0x000FFFFF, 3, Zero, 0x17 },=0D +=0D + Package () { 0x0010FFFF, 0, Zero, 0x15 },=0D + Package () { 0x0010FFFF, 1, Zero, 0x16 },=0D + Package () { 0x0010FFFF, 2, Zero, 0x17 },=0D + Package () { 0x0010FFFF, 3, Zero, 0x10 },=0D +=0D + Package () { 0x0011FFFF, 0, Zero, 0x16 },=0D + Package () { 0x0011FFFF, 1, Zero, 0x17 },=0D + Package () { 0x0011FFFF, 2, Zero, 0x10 },=0D + Package () { 0x0011FFFF, 3, Zero, 0x11 },=0D +=0D + Package () { 0x0012FFFF, 0, Zero, 0x17 },=0D + Package () { 0x0012FFFF, 1, Zero, 0x10 },=0D + Package () { 0x0012FFFF, 2, Zero, 0x11 },=0D + Package () { 0x0012FFFF, 3, Zero, 0x12 },=0D +=0D + Package () { 0x0013FFFF, 0, Zero, 0x10 },=0D + Package () { 0x0013FFFF, 1, Zero, 0x11 },=0D + Package () { 0x0013FFFF, 2, Zero, 0x12 },=0D + Package () { 0x0013FFFF, 3, Zero, 0x13 },=0D +=0D + Package () { 0x0014FFFF, 0, Zero, 0x11 },=0D + Package () { 0x0014FFFF, 1, Zero, 0x12 },=0D + Package () { 0x0014FFFF, 2, Zero, 0x13 },=0D + Package () { 0x0014FFFF, 3, Zero, 0x14 },=0D +=0D + Package () { 0x0015FFFF, 0, Zero, 0x12 },=0D + Package () { 0x0015FFFF, 1, Zero, 0x13 },=0D + Package () { 0x0015FFFF, 2, Zero, 0x14 },=0D + Package () { 0x0015FFFF, 3, Zero, 0x15 },=0D +=0D + Package () { 0x0016FFFF, 0, Zero, 0x13 },=0D + Package () { 0x0016FFFF, 1, Zero, 0x14 },=0D + Package () { 0x0016FFFF, 2, Zero, 0x15 },=0D + Package () { 0x0016FFFF, 3, Zero, 0x16 },=0D +=0D + Package () { 0x0017FFFF, 0, Zero, 0x14 },=0D + Package () { 0x0017FFFF, 1, Zero, 0x15 },=0D + Package () { 0x0017FFFF, 2, Zero, 0x16 },=0D + Package () { 0x0017FFFF, 3, Zero, 0x17 },=0D +=0D + Package () { 0x0018FFFF, 0, Zero, 0x15 },=0D + Package () { 0x0018FFFF, 1, Zero, 0x16 },=0D + Package () { 0x0018FFFF, 2, Zero, 0x17 },=0D + Package () { 0x0018FFFF, 3, Zero, 0x10 },=0D +=0D + Package () { 0x0019FFFF, 0, Zero, 0x16 },=0D + Package () { 0x0019FFFF, 1, Zero, 0x17 },=0D + Package () { 0x0019FFFF, 2, Zero, 0x10 },=0D + Package () { 0x0019FFFF, 3, Zero, 0x11 },=0D +=0D + Package () { 0x001AFFFF, 0, Zero, 0x17 },=0D + Package () { 0x001AFFFF, 1, Zero, 0x10 },=0D + Package () { 0x001AFFFF, 2, Zero, 0x11 },=0D + Package () { 0x001AFFFF, 3, Zero, 0x12 },=0D +=0D + Package () { 0x001BFFFF, 0, Zero, 0x10 },=0D + Package () { 0x001BFFFF, 1, Zero, 0x11 },=0D + Package () { 0x001BFFFF, 2, Zero, 0x12 },=0D + Package () { 0x001BFFFF, 3, Zero, 0x13 },=0D +=0D + Package () { 0x001CFFFF, 0, Zero, 0x11 },=0D + Package () { 0x001CFFFF, 1, Zero, 0x12 },=0D + Package () { 0x001CFFFF, 2, Zero, 0x13 },=0D + Package () { 0x001CFFFF, 3, Zero, 0x14 },=0D +=0D + Package () { 0x001DFFFF, 0, Zero, 0x12 },=0D + Package () { 0x001DFFFF, 1, Zero, 0x13 },=0D + Package () { 0x001DFFFF, 2, Zero, 0x14 },=0D + Package () { 0x001DFFFF, 3, Zero, 0x15 },=0D +=0D + Package () { 0x001EFFFF, 0, Zero, 0x13 },=0D + Package () { 0x001EFFFF, 1, Zero, 0x14 },=0D + Package () { 0x001EFFFF, 2, Zero, 0x15 },=0D + Package () { 0x001EFFFF, 3, Zero, 0x16 },=0D +=0D + Package () { 0x001FFFFF, 0, Zero, 0x14 },=0D + Package () { 0x001FFFFF, 1, Zero, 0x15 },=0D + Package () { 0x001FFFFF, 2, Zero, 0x16 },=0D + Package () { 0x001FFFFF, 3, Zero, 0x17 }=0D + })=0D + Method (_PRT, 0, NotSerialized)=0D + {=0D + If (PICM)=0D + {=0D + Return (APRT)=0D + }=0D + Else=0D + {=0D + Return (PPRT)=0D + }=0D + }=0D +=0D + Device (LPC)=0D + {=0D + Name (_ADR, 0x001F0000)=0D + OperationRegion (LPCR, PCI_Config, Zero, 0x0100)=0D + Field (LPCR, AnyAcc, NoLock, Preserve)=0D + {=0D + Offset (0x60),=0D + PIRA, 8,=0D + PIRB, 8,=0D + PIRC, 8,=0D + PIRD, 8,=0D + Offset (0x68),=0D + PIRE, 8,=0D + PIRF, 8,=0D + PIRG, 8,=0D + PIRH, 8=0D + }=0D +=0D + Device (KBD)=0D + {=0D + Name (_HID, EISAID ("PNP0303"))=0D + Name (_CID, EISAID ("PNP030B"))=0D + Name (_CRS, ResourceTemplate ()=0D + {=0D + IO (Decode16,=0D + 0x0060, // Range Minimum=0D + 0x0060, // Range Maximum=0D + 0x00, // Alignment=0D + 0x01, // Length=0D + )=0D + IO (Decode16,=0D + 0x0064, // Range Minimum=0D + 0x0064, // Range Maximum=0D + 0x00, // Alignment=0D + 0x01, // Length=0D + )=0D + IRQNoFlags ()=0D + {1}=0D + })=0D + }=0D +=0D + Device (MOU)=0D + {=0D + Name (_HID, EISAID ("PNP0F03"))=0D + Name (_CID, EISAID ("PNP0F13"))=0D + Name (_CRS, ResourceTemplate ()=0D + {=0D + IRQNoFlags ()=0D + {12}=0D + })=0D + }=0D +=0D + Method (PIRV, 1, NotSerialized)=0D + {=0D + If (And (Arg0, 0x80))=0D + {=0D + Return (Zero)=0D + }=0D +=0D + And (Arg0, 0x0F, Local0)=0D + If (LLess (Local0, 0x03))=0D + {=0D + Return (Zero)=0D + }=0D +=0D + If (LEqual (Local0, 0x08))=0D + {=0D + Return (Zero)=0D + }=0D +=0D + If (LEqual (Local0, 0x0D))=0D + {=0D + Return (Zero)=0D + }=0D +=0D + Return (One)=0D + }=0D +=0D + Device (LNKA)=0D + {=0D + Name (_HID, EisaId ("PNP0C0F"))=0D + Name (_UID, One)=0D + Method (_STA, 0, NotSerialized)=0D + {=0D + If (PIRV (PIRA))=0D + {=0D + Return (0x0B)=0D + }=0D + Else=0D + {=0D + Return (0x09)=0D + }=0D + }=0D +=0D + Name (_PRS, ResourceTemplate ()=0D + {=0D + IRQ (Level, ActiveLow, Shared, )=0D + {3,4,5,6,7,9,10,11,12,14,15}=0D + })=0D + Name (CB01, ResourceTemplate ()=0D + {=0D + IRQ (Level, ActiveLow, Shared, )=0D + {}=0D + })=0D + CreateWordField (CB01, One, CIRA)=0D + Method (_CRS, 0, NotSerialized)=0D + {=0D + And (PIRA, 0x8F, Local0)=0D + If (PIRV (Local0))=0D + {=0D + ShiftLeft (One, Local0, CIRA)=0D + }=0D + Else=0D + {=0D + Store (Zero, CIRA)=0D + }=0D +=0D + Return (CB01)=0D + }=0D +=0D + Method (_DIS, 0, NotSerialized)=0D + {=0D + Store (0x80, PIRA)=0D + }=0D +=0D + Method (_SRS, 1, NotSerialized)=0D + {=0D + CreateWordField (Arg0, One, SIRA)=0D + FindSetRightBit (SIRA, Local0)=0D + Store (Decrement (Local0), PIRA)=0D + }=0D + }=0D +=0D + Device (LNKB)=0D + {=0D + Name (_HID, EisaId ("PNP0C0F"))=0D + Name (_UID, 0x02)=0D + Method (_STA, 0, NotSerialized)=0D + {=0D + If (PIRV (PIRB))=0D + {=0D + Return (0x0B)=0D + }=0D + Else=0D + {=0D + Return (0x09)=0D + }=0D + }=0D +=0D + Name (_PRS, ResourceTemplate ()=0D + {=0D + IRQ (Level, ActiveLow, Shared, )=0D + {3,4,5,6,7,9,10,11,12,14,15}=0D + })=0D + Name (CB02, ResourceTemplate ()=0D + {=0D + IRQ (Level, ActiveLow, Shared, )=0D + {}=0D + })=0D + CreateWordField (CB02, One, CIRB)=0D + Method (_CRS, 0, NotSerialized)=0D + {=0D + And (PIRB, 0x8F, Local0)=0D + If (PIRV (Local0))=0D + {=0D + ShiftLeft (One, Local0, CIRB)=0D + }=0D + Else=0D + {=0D + Store (Zero, CIRB)=0D + }=0D +=0D + Return (CB02)=0D + }=0D +=0D + Method (_DIS, 0, NotSerialized)=0D + {=0D + Store (0x80, PIRB)=0D + }=0D +=0D + Method (_SRS, 1, NotSerialized)=0D + {=0D + CreateWordField (Arg0, One, SIRB)=0D + FindSetRightBit (SIRB, Local0)=0D + Store (Decrement (Local0), PIRB)=0D + }=0D + }=0D +=0D + Device (LNKC)=0D + {=0D + Name (_HID, EisaId ("PNP0C0F"))=0D + Name (_UID, 0x03)=0D + Method (_STA, 0, NotSerialized)=0D + {=0D + If (PIRV (PIRC))=0D + {=0D + Return (0x0B)=0D + }=0D + Else=0D + {=0D + Return (0x09)=0D + }=0D + }=0D +=0D + Name (_PRS, ResourceTemplate ()=0D + {=0D + IRQ (Level, ActiveLow, Shared, )=0D + {3,4,5,6,7,9,10,11,12,14,15}=0D + })=0D + Name (CB03, ResourceTemplate ()=0D + {=0D + IRQ (Level, ActiveLow, Shared, )=0D + {}=0D + })=0D + CreateWordField (CB03, One, CIRC)=0D + Method (_CRS, 0, NotSerialized)=0D + {=0D + And (PIRC, 0x8F, Local0)=0D + If (PIRV (Local0))=0D + {=0D + ShiftLeft (One, Local0, CIRC)=0D + }=0D + Else=0D + {=0D + Store (Zero, CIRC)=0D + }=0D +=0D + Return (CB03)=0D + }=0D +=0D + Method (_DIS, 0, NotSerialized)=0D + {=0D + Store (0x80, PIRC)=0D + }=0D +=0D + Method (_SRS, 1, NotSerialized)=0D + {=0D + CreateWordField (Arg0, One, SIRC)=0D + FindSetRightBit (SIRC, Local0)=0D + Store (Decrement (Local0), PIRC)=0D + }=0D + }=0D +=0D + Device (LNKD)=0D + {=0D + Name (_HID, EisaId ("PNP0C0F"))=0D + Name (_UID, 0x04)=0D + Method (_STA, 0, NotSerialized)=0D + {=0D + If (PIRV (PIRD))=0D + {=0D + Return (0x0B)=0D + }=0D + Else=0D + {=0D + Return (0x09)=0D + }=0D + }=0D +=0D + Name (_PRS, ResourceTemplate ()=0D + {=0D + IRQ (Level, ActiveLow, Shared, )=0D + {3,4,5,6,7,9,10,11,12,14,15}=0D + })=0D + Name (CB04, ResourceTemplate ()=0D + {=0D + IRQ (Level, ActiveLow, Shared, )=0D + {}=0D + })=0D + CreateWordField (CB04, One, CIRD)=0D + Method (_CRS, 0, NotSerialized)=0D + {=0D + And (PIRD, 0x8F, Local0)=0D + If (PIRV (Local0))=0D + {=0D + ShiftLeft (One, Local0, CIRD)=0D + }=0D + Else=0D + {=0D + Store (Zero, CIRD)=0D + }=0D +=0D + Return (CB04)=0D + }=0D +=0D + Method (_DIS, 0, NotSerialized)=0D + {=0D + Store (0x80, PIRD)=0D + }=0D +=0D + Method (_SRS, 1, NotSerialized)=0D + {=0D + CreateWordField (Arg0, One, SIRD)=0D + FindSetRightBit (SIRD, Local0)=0D + Store (Decrement (Local0), PIRD)=0D + }=0D + }=0D +=0D + Device (LNKE)=0D + {=0D + Name (_HID, EisaId ("PNP0C0F"))=0D + Name (_UID, 0x05)=0D + Method (_STA, 0, NotSerialized)=0D + {=0D + If (PIRV (PIRE))=0D + {=0D + Return (0x0B)=0D + }=0D + Else=0D + {=0D + Return (0x09)=0D + }=0D + }=0D +=0D + Name (_PRS, ResourceTemplate ()=0D + {=0D + IRQ (Level, ActiveLow, Shared, )=0D + {3,4,5,6,7,9,10,11,12,14,15}=0D + })=0D + Name (CB05, ResourceTemplate ()=0D + {=0D + IRQ (Level, ActiveLow, Shared, )=0D + {}=0D + })=0D + CreateWordField (CB05, One, CIRE)=0D + Method (_CRS, 0, NotSerialized)=0D + {=0D + And (PIRE, 0x8F, Local0)=0D + If (PIRV (Local0))=0D + {=0D + ShiftLeft (One, Local0, CIRE)=0D + }=0D + Else=0D + {=0D + Store (Zero, CIRE)=0D + }=0D +=0D + Return (CB05)=0D + }=0D +=0D + Method (_DIS, 0, NotSerialized)=0D + {=0D + Store (0x80, PIRE)=0D + }=0D +=0D + Method (_SRS, 1, NotSerialized)=0D + {=0D + CreateWordField (Arg0, One, SIRE)=0D + FindSetRightBit (SIRE, Local0)=0D + Store (Decrement (Local0), PIRE)=0D + }=0D + }=0D +=0D + Device (LNKF)=0D + {=0D + Name (_HID, EisaId ("PNP0C0F"))=0D + Name (_UID, 0x06)=0D + Method (_STA, 0, NotSerialized)=0D + {=0D + If (PIRV (PIRF))=0D + {=0D + Return (0x0B)=0D + }=0D + Else=0D + {=0D + Return (0x09)=0D + }=0D + }=0D +=0D + Name (_PRS, ResourceTemplate ()=0D + {=0D + IRQ (Level, ActiveLow, Shared, )=0D + {3,4,5,6,7,9,10,11,12,14,15}=0D + })=0D + Name (CB06, ResourceTemplate ()=0D + {=0D + IRQ (Level, ActiveLow, Shared, )=0D + {}=0D + })=0D + CreateWordField (CB06, One, CIRF)=0D + Method (_CRS, 0, NotSerialized)=0D + {=0D + And (PIRF, 0x8F, Local0)=0D + If (PIRV (Local0))=0D + {=0D + ShiftLeft (One, Local0, CIRF)=0D + }=0D + Else=0D + {=0D + Store (Zero, CIRF)=0D + }=0D +=0D + Return (CB06)=0D + }=0D +=0D + Method (_DIS, 0, NotSerialized)=0D + {=0D + Store (0x80, PIRF)=0D + }=0D +=0D + Method (_SRS, 1, NotSerialized)=0D + {=0D + CreateWordField (Arg0, One, SIRF)=0D + FindSetRightBit (SIRF, Local0)=0D + Store (Decrement (Local0), PIRF)=0D + }=0D + }=0D +=0D + Device (LNKG)=0D + {=0D + Name (_HID, EisaId ("PNP0C0F"))=0D + Name (_UID, 0x07)=0D + Method (_STA, 0, NotSerialized)=0D + {=0D + If (PIRV (PIRG))=0D + {=0D + Return (0x0B)=0D + }=0D + Else=0D + {=0D + Return (0x09)=0D + }=0D + }=0D +=0D + Name (_PRS, ResourceTemplate ()=0D + {=0D + IRQ (Level, ActiveLow, Shared, )=0D + {3,4,5,6,7,9,10,11,12,14,15}=0D + })=0D + Name (CB07, ResourceTemplate ()=0D + {=0D + IRQ (Level, ActiveLow, Shared, )=0D + {}=0D + })=0D + CreateWordField (CB07, One, CIRG)=0D + Method (_CRS, 0, NotSerialized)=0D + {=0D + And (PIRG, 0x8F, Local0)=0D + If (PIRV (Local0))=0D + {=0D + ShiftLeft (One, Local0, CIRG)=0D + }=0D + Else=0D + {=0D + Store (Zero, CIRG)=0D + }=0D +=0D + Return (CB07)=0D + }=0D +=0D + Method (_DIS, 0, NotSerialized)=0D + {=0D + Store (0x80, PIRG)=0D + }=0D +=0D + Method (_SRS, 1, NotSerialized)=0D + {=0D + CreateWordField (Arg0, One, SIRG)=0D + FindSetRightBit (SIRG, Local0)=0D + Store (Decrement (Local0), PIRG)=0D + }=0D + }=0D +=0D + Device (LNKH)=0D + {=0D + Name (_HID, EisaId ("PNP0C0F"))=0D + Name (_UID, 0x08)=0D + Method (_STA, 0, NotSerialized)=0D + {=0D + If (PIRV (PIRH))=0D + {=0D + Return (0x0B)=0D + }=0D + Else=0D + {=0D + Return (0x09)=0D + }=0D + }=0D +=0D + Name (_PRS, ResourceTemplate ()=0D + {=0D + IRQ (Level, ActiveLow, Shared, )=0D + {3,4,5,6,7,9,10,11,12,14,15}=0D + })=0D + Name (CB08, ResourceTemplate ()=0D + {=0D + IRQ (Level, ActiveLow, Shared, )=0D + {}=0D + })=0D + CreateWordField (CB08, One, CIRH)=0D + Method (_CRS, 0, NotSerialized)=0D + {=0D + And (PIRH, 0x8F, Local0)=0D + If (PIRV (Local0))=0D + {=0D + ShiftLeft (One, Local0, CIRH)=0D + }=0D + Else=0D + {=0D + Store (Zero, CIRH)=0D + }=0D +=0D + Return (CB08)=0D + }=0D +=0D + Method (_DIS, 0, NotSerialized)=0D + {=0D + Store (0x80, PIRH)=0D + }=0D +=0D + Method (_SRS, 1, NotSerialized)=0D + {=0D + CreateWordField (Arg0, One, SIRH)=0D + FindSetRightBit (SIRH, Local0)=0D + Store (Decrement (Local0), PIRH)=0D + }=0D + }=0D +=0D + Device (SIO)=0D + {=0D + Name (_HID, EisaId ("PNP0C02"))=0D + Name (_CRS, ResourceTemplate ()=0D + {=0D + IO (Decode16,=0D + 0x0220, // Range Minimum=0D + 0x0220, // Range Maximum=0D + 0x01, // Alignment=0D + 0x04, // Length=0D + )=0D + IO (Decode16,=0D + 0x0224, // Range Minimum=0D + 0x0224, // Range Maximum=0D + 0x01, // Alignment=0D + 0x04, // Length=0D + )=0D + Memory32Fixed (ReadWrite,=0D + 0xE0000000, // Address Base=0D + 0x10000000, // Address Length=0D + )=0D + IO (Decode16,=0D + 0x04D0, // Range Minimum=0D + 0x04D0, // Range Maximum=0D + 0x01, // Alignment=0D + 0x02, // Length=0D + )=0D + IO (Decode16,=0D + 0x0061, // Range Minimum=0D + 0x0061, // Range Maximum=0D + 0x01, // Alignment=0D + 0x01, // Length=0D + )=0D + IO (Decode16,=0D + 0x0400, // Range Minimum=0D + 0x0400, // Range Maximum=0D + 0x01, // Alignment=0D + 0x08, // Length=0D + )=0D + IO (Decode16,=0D + 0x00B2, // Range Minimum=0D + 0x00B2, // Range Maximum=0D + 0x01, // Alignment=0D + 0x01, // Length=0D + )=0D + IO (Decode16,=0D + 0x0084, // Range Minimum=0D + 0x0084, // Range Maximum=0D + 0x01, // Alignment=0D + 0x01, // Length=0D + )=0D + IO (Decode16,=0D + 0x0072, // Range Minimum=0D + 0x0072, // Range Maximum=0D + 0x01, // Alignment=0D + 0x06, // Length=0D + )=0D + })=0D + }=0D +=0D + Device (COM1)=0D + {=0D + Name (_HID, EisaId ("PNP0501"))=0D + Name (_UID, One)=0D + Name (_CRS, ResourceTemplate ()=0D + {=0D + IO (Decode16,=0D + 0x03F8, // Range Minimum=0D + 0x03F8, // Range Maximum=0D + 0x01, // Alignment=0D + 0x08, // Length=0D + )=0D + IRQNoFlags ()=0D + {4}=0D + })=0D + }=0D +=0D + Device (COM2)=0D + {=0D + Name (_HID, EisaId ("PNP0501"))=0D + Name (_UID, 0x02)=0D + Name (_CRS, ResourceTemplate ()=0D + {=0D + IO (Decode16,=0D + 0x02F8, // Range Minimum=0D + 0x02F8, // Range Maximum=0D + 0x01, // Alignment=0D + 0x08, // Length=0D + )=0D + IRQNoFlags ()=0D + {3}=0D + })=0D + }=0D +=0D + Device (RTC)=0D + {=0D + Name (_HID, EisaId ("PNP0B00"))=0D + Name (_CRS, ResourceTemplate ()=0D + {=0D + IO (Decode16,=0D + 0x0070, // Range Minimum=0D + 0x0070, // Range Maximum=0D + 0x00, // Alignment=0D + 0x02, // Length=0D + )=0D + IRQNoFlags ()=0D + {8}=0D + IO (Decode16,=0D + 0x0072, // Range Minimum=0D + 0x0072, // Range Maximum=0D + 0x02, // Alignment=0D + 0x06, // Length=0D + )=0D + })=0D + }=0D +=0D + Device (PIC)=0D + {=0D + Name (_HID, EisaId ("PNP0000"))=0D + Name (_CRS, ResourceTemplate ()=0D + {=0D + IO (Decode16,=0D + 0x0020, // Range Minimum=0D + 0x0020, // Range Maximum=0D + 0x01, // Alignment=0D + 0x02, // Length=0D + )=0D + IO (Decode16,=0D + 0x00A0, // Range Minimum=0D + 0x00A0, // Range Maximum=0D + 0x01, // Alignment=0D + 0x02, // Length=0D + )=0D + IRQNoFlags ()=0D + {2}=0D + })=0D + }=0D +=0D + Device (TIMR)=0D + {=0D + Name (_HID, EisaId ("PNP0100"))=0D + Name (_CRS, ResourceTemplate ()=0D + {=0D + IO (Decode16,=0D + 0x0040, // Range Minimum=0D + 0x0040, // Range Maximum=0D + 0x01, // Alignment=0D + 0x04, // Length=0D + )=0D + IRQNoFlags ()=0D + {0}=0D + })=0D + }=0D + }=0D + }=0D + }=0D +=0D + Scope (_SB.PC00)=0D + {=0D + Device (HPET)=0D + {=0D + Name (_HID, EisaId ("PNP0103"))=0D + Name (_UID, Zero)=0D + Name (_CRS, ResourceTemplate ()=0D + {=0D + Memory32Fixed (ReadWrite,=0D + 0xFED00000, // Address Base=0D + 0x00000400, // Address Length=0D + )=0D + })=0D + }=0D + }=0D +}=0D +=0D diff --git a/BhyvePkg/AcpiTables/Facp.aslc b/BhyvePkg/AcpiTables/Facp.aslc new file mode 100644 index 0000000000..0197e8e930 --- /dev/null +++ b/BhyvePkg/AcpiTables/Facp.aslc @@ -0,0 +1,82 @@ +/*=0D + * Copyright (c) 2014, Pluribus Networks, Inc.=0D + *=0D + * This program and the accompanying materials are licensed and made=0D + * available under the terms and conditions of the BSD License which=0D + * accompanies this distribution. The full text of the license may be=0D + * found at http://opensource.org/licenses/bsd-license.php=0D + *=0D + * THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS"=0D + * BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER=0D + * EXPRESS OR IMPLIED.=0D + */=0D +=0D +#include "Platform.h"=0D +=0D +#define EFI_ACPI_OEM_TABLE_ID SIGNATURE_64('B','V','F','A','C','P',' '= ,' ')=0D +=0D +EFI_ACPI_3_0_FIXED_ACPI_DESCRIPTION_TABLE FACP =3D {=0D + {=0D + EFI_ACPI_3_0_FIXED_ACPI_DESCRIPTION_TABLE_SIGNATURE,=0D + sizeof (EFI_ACPI_3_0_FIXED_ACPI_DESCRIPTION_TABLE),=0D + EFI_ACPI_3_0_FIXED_ACPI_DESCRIPTION_TABLE_REVISION,=0D + 0, // to make sum of entire table =3D=3D 0=0D + {EFI_ACPI_OEM_ID}, // OEMID is a 6 bytes long field=0D + EFI_ACPI_OEM_TABLE_ID, // OEM table identification(8 bytes long)= =0D + EFI_ACPI_OEM_REVISION, // OEM revision number=0D + EFI_ACPI_CREATOR_ID, // ASL compiler vendor ID=0D + EFI_ACPI_CREATOR_REVISION // ASL compiler revision number=0D + },=0D + 0, // Physical addesss of FACS=0D + 0, // Physical address of DSDT=0D + INT_MODEL, // System Interrupt Model=0D + RESERVED, // reserved=0D + SCI_INT_VECTOR, // System vector of SCI interrupt=0D + SMI_CMD_IO_PORT, // Port address of SMI command port=0D + ACPI_ENABLE, // value to write to port smi_cmd to enable ACPI=0D + ACPI_DISABLE, // value to write to port smi_cmd to disable ACPI=0D + S4BIOS_REQ, // Value to write to SMI CMD port to enter the S4BIOS = state=0D + 0, // PState control=0D + PM1a_EVT_BLK, // Port address of Power Mgt 1a Event Reg Blk=0D + PM1b_EVT_BLK, // Port address of Power Mgt 1b Event Reg Blk=0D + PM1a_CNT_BLK, // Port address of Power Mgt 1a Ctrl Reg Blk=0D + PM1b_CNT_BLK, // Port address of Power Mgt 1b Ctrl Reg Blk=0D + PM2_CNT_BLK, // Port address of Power Mgt 2 Ctrl Reg Blk=0D + PM_TMR_BLK, // Port address of Power Mgt Timer Ctrl Reg Blk=0D + GPE0_BLK, // Port addr of General Purpose Event 0 Reg Blk=0D + GPE1_BLK, // Port addr of General Purpose Event 1 Reg Blk=0D + PM1_EVT_LEN, // Byte Length of ports at pm1X_evt_blk=0D + PM1_CNT_LEN, // Byte Length of ports at pm1X_cnt_blk=0D + PM2_CNT_LEN, // Byte Length of ports at pm2_cnt_blk=0D + PM_TM_LEN, // Byte Length of ports at pm_tm_blk=0D + GPE0_BLK_LEN, // Byte Length of ports at gpe0_blk=0D + GPE1_BLK_LEN, // Byte Length of ports at gpe1_blk=0D + GPE1_BASE, // offset in gpe model where gpe1 events start=0D + 0, // _CST support=0D + P_LVL2_LAT, // worst case HW latency to enter/exit C2 state=0D + P_LVL3_LAT, // worst case HW latency to enter/exit C3 state=0D + FLUSH_SIZE, // Size of area read to flush caches=0D + FLUSH_STRIDE, // Stride used in flushing caches=0D + DUTY_OFFSET, // bit location of duty cycle field in p_cnt reg=0D + DUTY_WIDTH, // bit width of duty cycle field in p_cnt reg=0D + DAY_ALRM, // index to day-of-month alarm in RTC CMOS RAM=0D + MON_ALRM, // index to month-of-year alarm in RTC CMOS RAM=0D + CENTURY, // index to century in RTC CMOS RAM=0D + IAPC_BOOT_ARCH, // Boot architecture flag=0D + RESERVED, // reserved=0D + FACP_FLAGS,=0D + FACP_RESET_REG,=0D + FACP_RESET_VAL,=0D +};=0D +=0D +VOID*=0D +ReferenceAcpiTable (=0D + VOID=0D + )=0D +{=0D + //=0D + // Reference the table being generated to prevent the optimizer from rem= oving the=0D + // data structure from the exeutable=0D + //=0D + return (VOID*)&FACP;=0D +}=0D diff --git a/BhyvePkg/AcpiTables/Facs.aslc b/BhyvePkg/AcpiTables/Facs.aslc new file mode 100644 index 0000000000..aec3bf8dc6 --- /dev/null +++ b/BhyvePkg/AcpiTables/Facs.aslc @@ -0,0 +1,84 @@ +/** @file=0D + FACS Table=0D +=0D + Copyright (c) 2008 - 2012, Intel Corporation. All rights reserved.
=0D + This program and the accompanying materials are=0D + licensed and made available under the terms and conditions of the BSD Li= cense=0D + which accompanies this distribution. The full text of the license may b= e found at=0D + http://opensource.org/licenses/bsd-license.php=0D +=0D + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,=0D + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMP= LIED.=0D +=0D +**/=0D +=0D +#include =0D +=0D +EFI_ACPI_1_0_FIRMWARE_ACPI_CONTROL_STRUCTURE FACS =3D {=0D + EFI_ACPI_1_0_FIRMWARE_ACPI_CONTROL_STRUCTURE_SIGNATURE,=0D + sizeof (EFI_ACPI_1_0_FIRMWARE_ACPI_CONTROL_STRUCTURE),=0D +=0D + //=0D + // Hardware Signature will be updated at runtime=0D + //=0D + 0x00000000,=0D + 0x00,=0D + 0x00,=0D + 0x00,=0D + {=0D + EFI_ACPI_RESERVED_BYTE,=0D + EFI_ACPI_RESERVED_BYTE,=0D + EFI_ACPI_RESERVED_BYTE,=0D + EFI_ACPI_RESERVED_BYTE,=0D + EFI_ACPI_RESERVED_BYTE,=0D + EFI_ACPI_RESERVED_BYTE,=0D + EFI_ACPI_RESERVED_BYTE,=0D + EFI_ACPI_RESERVED_BYTE,=0D + EFI_ACPI_RESERVED_BYTE,=0D + EFI_ACPI_RESERVED_BYTE,=0D + EFI_ACPI_RESERVED_BYTE,=0D + EFI_ACPI_RESERVED_BYTE,=0D + EFI_ACPI_RESERVED_BYTE,=0D + EFI_ACPI_RESERVED_BYTE,=0D + EFI_ACPI_RESERVED_BYTE,=0D + EFI_ACPI_RESERVED_BYTE,=0D + EFI_ACPI_RESERVED_BYTE,=0D + EFI_ACPI_RESERVED_BYTE,=0D + EFI_ACPI_RESERVED_BYTE,=0D + EFI_ACPI_RESERVED_BYTE,=0D + EFI_ACPI_RESERVED_BYTE,=0D + EFI_ACPI_RESERVED_BYTE,=0D + EFI_ACPI_RESERVED_BYTE,=0D + EFI_ACPI_RESERVED_BYTE,=0D + EFI_ACPI_RESERVED_BYTE,=0D + EFI_ACPI_RESERVED_BYTE,=0D + EFI_ACPI_RESERVED_BYTE,=0D + EFI_ACPI_RESERVED_BYTE,=0D + EFI_ACPI_RESERVED_BYTE,=0D + EFI_ACPI_RESERVED_BYTE,=0D + EFI_ACPI_RESERVED_BYTE,=0D + EFI_ACPI_RESERVED_BYTE,=0D + EFI_ACPI_RESERVED_BYTE,=0D + EFI_ACPI_RESERVED_BYTE,=0D + EFI_ACPI_RESERVED_BYTE,=0D + EFI_ACPI_RESERVED_BYTE,=0D + EFI_ACPI_RESERVED_BYTE,=0D + EFI_ACPI_RESERVED_BYTE,=0D + EFI_ACPI_RESERVED_BYTE,=0D + EFI_ACPI_RESERVED_BYTE=0D + }=0D +};=0D +=0D +=0D +VOID*=0D +ReferenceAcpiTable (=0D + VOID=0D + )=0D +{=0D + //=0D + // Reference the table being generated to prevent the optimizer from rem= oving the=0D + // data structure from the exeutable=0D + //=0D + return (VOID*)&FACS;=0D +}=0D +=0D diff --git a/BhyvePkg/AcpiTables/Hpet.aslc b/BhyvePkg/AcpiTables/Hpet.aslc new file mode 100644 index 0000000000..2eb81bce37 --- /dev/null +++ b/BhyvePkg/AcpiTables/Hpet.aslc @@ -0,0 +1,78 @@ +/*=0D + * Copyright (c) 2014, Pluribus Networks, Inc.=0D + *=0D + * This program and the accompanying materials are licensed and made=0D + * available under the terms and conditions of the BSD License which=0D + * accompanies this distribution. The full text of the license may be=0D + * found at http://opensource.org/licenses/bsd-license.php=0D + *=0D + * THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS"=0D + * BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER=0D + * EXPRESS OR IMPLIED.=0D + */=0D +=0D +#include =0D +=0D +#include "Platform.h"=0D +=0D +#define EFI_ACPI_HPET_DESCRIPTION_TABLE_SIGNATURE SIGNATURE_32('H', 'P', = 'E', 'T')=0D +#define EFI_ACPI_OEM_TABLE_ID SIGNATURE_64('B','V','H= ','P','E','T',' ',' ')=0D +=0D +//=0D +// Ensure proper structure formats=0D +//=0D +#pragma pack (1)=0D +=0D +//=0D +// ACPI HPET structure=0D +//=0D +typedef struct {=0D + EFI_ACPI_HIGH_PRECISION_EVENT_TIMER_TABLE_HEADER Header;=0D +} EFI_ACPI_HIGH_PRECISION_EVENT_TIMER_DESCRIPTION_TABLE;=0D +=0D +#pragma pack ()=0D +=0D +//=0D +// HPET Description Table=0D +//=0D +EFI_ACPI_HIGH_PRECISION_EVENT_TIMER_DESCRIPTION_TABLE Hpet =3D {=0D + {=0D + {=0D + EFI_ACPI_HPET_DESCRIPTION_TABLE_SIGNATURE,=0D + sizeof (EFI_ACPI_HIGH_PRECISION_EVENT_TIMER_DESCRIPTION_TABLE),=0D + EFI_ACPI_HIGH_PRECISION_EVENT_TIMER_TABLE_REVISION,=0D + 0x00, // Checksum will be updated at ru= ntime=0D + {EFI_ACPI_OEM_ID},=0D + EFI_ACPI_OEM_TABLE_ID,=0D + EFI_ACPI_OEM_REVISION,=0D + EFI_ACPI_CREATOR_ID,=0D + EFI_ACPI_CREATOR_REVISION=0D + },=0D +=0D + //=0D + // HPET specific fields=0D + //=0D + 0x0000A400, // EventTimerBlockId=0D + {=0D + EFI_ACPI_2_0_SYSTEM_MEMORY,=0D + 0,=0D + 0,=0D + EFI_ACPI_RESERVED_BYTE,=0D + 0xFED00000,=0D + },=0D + 0 // HpetNumber=0D + }=0D +};=0D +=0D +=0D +VOID*=0D +ReferenceAcpiTable (=0D + VOID=0D + )=0D +{=0D + //=0D + // Reference the table being generated to prevent the optimizer from rem= oving the=0D + // data structure from the exeutable=0D + //=0D + return (VOID*)&Hpet;=0D +}=0D diff --git a/BhyvePkg/AcpiTables/Madt.aslc b/BhyvePkg/AcpiTables/Madt.aslc new file mode 100644 index 0000000000..c84c84bc93 --- /dev/null +++ b/BhyvePkg/AcpiTables/Madt.aslc @@ -0,0 +1,149 @@ +/** @file=0D + MADT Table=0D +=0D + This file contains a structure definition for the ACPI 1.0 Multiple APIC= =0D + Description Table (MADT).=0D +=0D + Copyright (c) 2014, Pluribus Networks, Inc.=0D + Copyright (c) 2008 - 2012, Intel Corporation. All rights reserved.
=0D + This program and the accompanying materials are=0D + licensed and made available under the terms and conditions of the BSD Li= cense=0D + which accompanies this distribution. The full text of the license may b= e found at=0D + http://opensource.org/licenses/bsd-license.php=0D +=0D + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,=0D + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMP= LIED.=0D +=0D +**/=0D +=0D +#include =0D +#include =0D +=0D +#define EFI_ACPI_OEM_TABLE_ID SIGNATURE_64('B','V','M= ','A','D','T',' ',' ')=0D +=0D +//=0D +// Local APIC address=0D +//=0D +#define EFI_ACPI_LOCAL_APIC_ADDRESS 0xFEE00000=0D +=0D +//=0D +// Multiple APIC Flags are defined in AcpiX.0.h=0D +//=0D +#define EFI_ACPI_1_0_MULTIPLE_APIC_FLAGS (EFI_ACPI_1_0_PCAT_COMPAT)=0D +=0D +//=0D +// Define the number of each table type.=0D +// This is where the table layout is modified.=0D +//=0D +#define EFI_ACPI_PROCESSOR_LOCAL_APIC_COUNT 1=0D +#define EFI_ACPI_INTERRUPT_SOURCE_OVERRIDE_COUNT 1=0D +#define EFI_ACPI_IO_APIC_COUNT 1=0D +=0D +//=0D +// Ensure proper structure formats=0D +//=0D +#pragma pack (1)=0D +=0D +//=0D +// ACPI 1.0 MADT structure=0D +//=0D +typedef struct {=0D + EFI_ACPI_1_0_MULTIPLE_APIC_DESCRIPTION_TABLE_HEADER Header;=0D +=0D +#if EFI_ACPI_PROCESSOR_LOCAL_APIC_COUNT > 0=0D + EFI_ACPI_1_0_PROCESSOR_LOCAL_APIC_STRUCTURE LocalApic[EFI_ACPI= _PROCESSOR_LOCAL_APIC_COUNT];=0D +#endif=0D +=0D +#if EFI_ACPI_INTERRUPT_SOURCE_OVERRIDE_COUNT > 0=0D + EFI_ACPI_1_0_INTERRUPT_SOURCE_OVERRIDE_STRUCTURE Iso[EFI_ACPI_INTER= RUPT_SOURCE_OVERRIDE_COUNT];=0D +#endif=0D +=0D +#if EFI_ACPI_IO_APIC_COUNT > 0=0D + EFI_ACPI_1_0_IO_APIC_STRUCTURE IoApic[EFI_ACPI_IO= _APIC_COUNT];=0D +#endif=0D +=0D +} EFI_ACPI_1_0_MULTIPLE_APIC_DESCRIPTION_TABLE;=0D +=0D +#pragma pack ()=0D +=0D +//=0D +// Multiple APIC Description Table=0D +//=0D +EFI_ACPI_1_0_MULTIPLE_APIC_DESCRIPTION_TABLE Madt =3D {=0D + {=0D + {=0D + EFI_ACPI_1_0_APIC_SIGNATURE,=0D + sizeof (EFI_ACPI_1_0_MULTIPLE_APIC_DESCRIPTION_TABLE),=0D + EFI_ACPI_1_0_MULTIPLE_APIC_DESCRIPTION_TABLE_REVISION,=0D + 0x00, // Checksu= m will be updated at runtime=0D + {EFI_ACPI_OEM_ID},=0D + EFI_ACPI_OEM_TABLE_ID,=0D + EFI_ACPI_OEM_REVISION,=0D + EFI_ACPI_CREATOR_ID,=0D + EFI_ACPI_CREATOR_REVISION=0D + },=0D +=0D + //=0D + // MADT specific fields=0D + //=0D + EFI_ACPI_LOCAL_APIC_ADDRESS,=0D + EFI_ACPI_1_0_MULTIPLE_APIC_FLAGS,=0D + },=0D +=0D + //=0D + // Processor Local APIC Structure=0D + //=0D + {=0D + {=0D + EFI_ACPI_1_0_PROCESSOR_LOCAL_APIC, // Type=0D + sizeof (EFI_ACPI_1_0_PROCESSOR_LOCAL_APIC_STRUCTURE), // Length= =0D + 0x00, // Process= or ID=0D + 0x00, // Local A= PIC ID=0D + 0x00000001 // Flags -= Enabled by default=0D + }=0D + },=0D +=0D + //=0D + // Interrupt Source Override Structure=0D + //=0D + {=0D + {=0D + //=0D + // IRQ0=3D>IRQ2 Interrupt Source Override Structure=0D + //=0D + EFI_ACPI_1_0_INTERRUPT_SOURCE_OVERRIDE, // Type=0D + sizeof (EFI_ACPI_1_0_INTERRUPT_SOURCE_OVERRIDE_STRUCTURE),// Length= =0D + 0x00, // Bus - I= SA=0D + 0x00, // Source = - IRQ0=0D + 0x00000002, // Global = System Interrupt - IRQ2=0D + 0x0005 // Flags -= Conforms to specifications of the bus=0D + },=0D + },=0D +=0D + //=0D + // IO APIC Structure=0D + //=0D + {=0D + {=0D + EFI_ACPI_1_0_IO_APIC, // Type=0D + sizeof (EFI_ACPI_1_0_IO_APIC_STRUCTURE), // Length= =0D + 0x01, // IO APIC= ID=0D + EFI_ACPI_RESERVED_BYTE, // Reserve= d=0D + 0xFEC00000, // IO APIC= Address (physical)=0D + 0x00000000 // Global = System Interrupt Base=0D + }=0D + },=0D +};=0D +=0D +=0D +VOID*=0D +ReferenceAcpiTable (=0D + VOID=0D + )=0D +{=0D + //=0D + // Reference the table being generated to prevent the optimizer from rem= oving the=0D + // data structure from the exeutable=0D + //=0D + return (VOID*)&Madt;=0D +}=0D diff --git a/BhyvePkg/AcpiTables/Mcfg.aslc b/BhyvePkg/AcpiTables/Mcfg.aslc new file mode 100644 index 0000000000..29f78965f7 --- /dev/null +++ b/BhyvePkg/AcpiTables/Mcfg.aslc @@ -0,0 +1,63 @@ +/*=0D + * Copyright (c) 2015, Nahanni Systems, Inc.=0D + *=0D + * This program and the accompanying materials are licensed and made=0D + * available under the terms and conditions of the BSD License which=0D + * accompanies this distribution. The full text of the license may be=0D + * found at http://opensource.org/licenses/bsd-license.php=0D + *=0D + * THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS"=0D + * BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER=0D + * EXPRESS OR IMPLIED.=0D + */=0D +=0D +#include "Platform.h"=0D +=0D +#define EFI_ACPI_OEM_TABLE_ID SIGNATURE_64('B','V','M= ','C','F','G',' ',' ')=0D +=0D +#pragma pack(1)=0D +=0D +typedef struct {=0D + EFI_ACPI_DESCRIPTION_HEADER Header;=0D + UINT64 Reserved0;=0D + UINT64 BaseAddress;=0D + UINT16 PciSegmentGroupNumber;=0D + UINT8 StartBusNumber;=0D + UINT8 EndBusNumber;=0D + UINT32 Reserved1;=0D +} EFI_ACPI_MEMORY_MAPPED_CONFIGURATION_SPACE_ACCESS_TABLE;=0D +=0D +#pragma pack()=0D +=0D +EFI_ACPI_MEMORY_MAPPED_CONFIGURATION_SPACE_ACCESS_TABLE MCFG =3D {=0D + {=0D + EFI_ACPI_2_0_MEMORY_MAPPED_CONFIGURATION_BASE_ADDRESS_TABLE_SIGNATURE,= =0D + sizeof (EFI_ACPI_MEMORY_MAPPED_CONFIGURATION_SPACE_ACCESS_TABLE),=0D + EFI_ACPI_MEMORY_MAPPED_CONFIGURATION_SPACE_ACCESS_TABLE_REVISION,=0D + 0, // to make sum of entire table =3D=3D 0=0D + {EFI_ACPI_OEM_ID}, // OEMID is a 6 bytes long field=0D + EFI_ACPI_OEM_TABLE_ID, // OEM table identification(8 bytes long)= =0D + EFI_ACPI_OEM_REVISION, // OEM revision number=0D + EFI_ACPI_CREATOR_ID, // ASL compiler vendor ID=0D + EFI_ACPI_CREATOR_REVISION // ASL compiler revision number=0D + },=0D + 0, // Reserved=0D + 0x00000000E0000000, // BaseAddress=0D + 0x0000, // PciSegmentGroupNumber=0D + 0, // StartBusNumber=0D + 255, // EndBusNumber=0D + 0 // Reserved=0D +};=0D +=0D +=0D +VOID *=0D +ReferenceAcpiTable (=0D + VOID=0D + )=0D +{=0D + //=0D + // Reference the table being generated to prevent the optimizer from rem= oving the=0D + // data structure from the exeutable=0D + //=0D + return (VOID*)&MCFG;=0D +}=0D diff --git a/BhyvePkg/AcpiTables/Platform.h b/BhyvePkg/AcpiTables/Platform.h new file mode 100644 index 0000000000..92ccacd6b9 --- /dev/null +++ b/BhyvePkg/AcpiTables/Platform.h @@ -0,0 +1,76 @@ +/** @file=0D + Platform specific defines for constructing ACPI tables=0D +=0D + Copyright (c) 2014, Pluribus Networks, Inc.^M=0D + Copyright (c) 2012, 2013, Red Hat, Inc.=0D + Copyright (c) 2008, Intel Corporation. All rights reserved.
=0D + This program and the accompanying materials are=0D + licensed and made available under the terms and conditions of the BSD Li= cense=0D + which accompanies this distribution. The full text of the license may b= e found at=0D + http://opensource.org/licenses/bsd-license.php=0D +=0D + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,=0D + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMP= LIED.=0D +=0D +**/=0D +=0D +#ifndef _Platform_h_INCLUDED_=0D +#define _Platform_h_INCLUDED_=0D +=0D +#include =0D +#include =0D +#include =0D +=0D +//=0D +// ACPI table information used to initialize tables.=0D +//=0D +#define EFI_ACPI_OEM_ID 'B','H','Y','V','E',' ' // OEMID 6 byt= es long=0D +#define EFI_ACPI_OEM_REVISION 0x1=0D +#define EFI_ACPI_CREATOR_ID SIGNATURE_32('B','H','Y','V')=0D +#define EFI_ACPI_CREATOR_REVISION 0x00000001=0D +=0D +#define INT_MODEL 0x01=0D +#define SCI_INT_VECTOR 0x0009=0D +#define SMI_CMD_IO_PORT 0xB2=0D +#define ACPI_ENABLE 0xA0=0D +#define ACPI_DISABLE 0xA1=0D +#define S4BIOS_REQ 0x00=0D +#define PM1a_EVT_BLK 0x00000400 /* TNXXX */=0D +#define PM1b_EVT_BLK 0x00000000=0D +#define PM1a_CNT_BLK 0x00000404 /* TNXXX */=0D +#define PM1b_CNT_BLK 0x00000000=0D +#define PM2_CNT_BLK 0x00000000=0D +#define PM_TMR_BLK 0x00000408=0D +#define GPE0_BLK 0x00000000=0D +#define GPE1_BLK 0x00000000=0D +#define PM1_EVT_LEN 0x04=0D +#define PM1_CNT_LEN 0x02=0D +#define PM2_CNT_LEN 0x00=0D +#define PM_TM_LEN 0x04=0D +#define GPE0_BLK_LEN 0x00=0D +#define GPE1_BLK_LEN 0x00=0D +#define GPE1_BASE 0x00=0D +#define RESERVED 0x00=0D +#define P_LVL2_LAT 0x0000=0D +#define P_LVL3_LAT 0x0000=0D +#define FLUSH_SIZE 0x0000=0D +#define FLUSH_STRIDE 0x0000=0D +#define DUTY_OFFSET 0x00=0D +#define DUTY_WIDTH 0x00=0D +#define DAY_ALRM 0x00=0D +#define MON_ALRM 0x00=0D +#define CENTURY 0x32=0D +#define IAPC_BOOT_ARCH 0x12 /* 8042 present, disable PCIe ASPM */=0D +#define FACP_FLAGS (EFI_ACPI_1_0_WBINVD | EFI_ACPI_1_0_PROC_C1 | = \=0D + EFI_ACPI_1_0_SLP_BUTTON | EFI_ACPI_1_0_TMR_VAL_EXT= | \=0D + EFI_ACPI_2_0_RESET_REG_SUP | = \=0D + EFI_ACPI_3_0_FORCE_APIC_PHYSICAL_DESTINATION_MODE)= =0D +#define FACP_RESET_REG { \= =0D + EFI_ACPI_3_0_SYSTEM_IO, /* Address Space ID */ \= =0D + 8, /* Bit Width */ \= =0D + 0, /* Bit Offset */ \= =0D + EFI_ACPI_3_0_BYTE, /* Byte Access */ \= =0D + 0xCF9 /* I/O Port */ \= =0D +}=0D +#define FACP_RESET_VAL 0x6=0D +#endif=0D diff --git a/BhyvePkg/AcpiTables/Spcr.aslc b/BhyvePkg/AcpiTables/Spcr.aslc new file mode 100644 index 0000000000..56b3def629 --- /dev/null +++ b/BhyvePkg/AcpiTables/Spcr.aslc @@ -0,0 +1,69 @@ +/*=0D + * Copyright (c) 2015, Nahanni Systems, Inc.=0D + *=0D + * This program and the accompanying materials are licensed and made=0D + * available under the terms and conditions of the BSD License which=0D + * accompanies this distribution. The full text of the license may be=0D + * found at http://opensource.org/licenses/bsd-license.php=0D + *=0D + * THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS"=0D + * BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER=0D + * EXPRESS OR IMPLIED.=0D + */=0D +=0D +#include "Platform.h"=0D +=0D +#define EFI_ACPI_OEM_TABLE_ID SIGNATURE_64('B','V','S','P','C','R',' '= ,' ')=0D +=0D +EFI_ACPI_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE SPCR =3D {=0D + {=0D + EFI_ACPI_2_0_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_SIGNATURE,=0D + sizeof (EFI_ACPI_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE),=0D + EFI_ACPI_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_REVISION,=0D + 0, // to make sum of entire table =3D=3D 0=0D + {EFI_ACPI_OEM_ID}, // OEMID is a 6 bytes long field=0D + EFI_ACPI_OEM_TABLE_ID, // OEM table identification(8 bytes long)= =0D + EFI_ACPI_OEM_REVISION, // OEM revision number=0D + EFI_ACPI_CREATOR_ID, // ASL compiler vendor ID=0D + EFI_ACPI_CREATOR_REVISION // ASL compiler revision number=0D + },=0D + EFI_ACPI_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_INTERFACE_TYPE_16550,=0D + { 0 }, // Reserved=0D + { // BaseAddress=0D + 0x01, // AddressSpaceId=0D + 0x08, // RegisterBitWidth=0D + 0x00, // RegisterBitOffset=0D + 0x00, // Reserved=0D + 0x03F8 // Address (COM1)=0D + },=0D + EFI_ACPI_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_INTERRUPT_TYPE_8259,=0D + 4, // Irq=0D + 0, // GlobalSystemInterrupt=0D + EFI_ACPI_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_BAUD_RATE_115200,=0D + EFI_ACPI_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_PARITY_NO_PARITY,=0D + EFI_ACPI_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_STOP_BITS_1,=0D + 0x03, // FlowControl: RTS/CTS | DCD=0D + EFI_ACPI_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_TERMINAL_TYPE_VT_UTF8,=0D + 0, // Language=0D + 0, // PciDeviceId=0D + 0, // PciVendorId=0D + 0, // PciBusNumber=0D + 0, // PciDeviceNumber=0D + 0, // PciFunctionNumber=0D + 0, // PciFlags=0D + 0, // PciSegment=0D + 0 // Reserved=0D +};=0D +=0D +=0D +VOID *=0D +ReferenceAcpiTable (=0D + VOID=0D + )=0D +{=0D + //=0D + // Reference the table being generated to prevent the optimizer from rem= oving the=0D + // data structure from the exeutable=0D + //=0D + return (VOID*)&SPCR;=0D +}=0D diff --git a/BhyvePkg/AcpiTables/Ssdt.asl b/BhyvePkg/AcpiTables/Ssdt.asl new file mode 100644 index 0000000000..67c5fdb3a4 --- /dev/null +++ b/BhyvePkg/AcpiTables/Ssdt.asl @@ -0,0 +1,19 @@ +/** @file=0D + Placeholder for runtime-generated objects.=0D +=0D + This empty table provides only a header for dynamic copying and extensio= n,=0D + and a trigger for QemuInstallAcpiSsdtTable().=0D +=0D + Copyright (C) 2012 Red Hat, Inc.=0D +=0D + This program and the accompanying materials are licensed and made availa= ble=0D + under the terms and conditions of the BSD License which accompanies this= =0D + distribution. The full text of the license may be found at=0D + http://opensource.org/licenses/bsd-license.php=0D +=0D + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WI= THOUT=0D + WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.=0D +**/=0D +=0D +DefinitionBlock ("Ssdt.aml", "SSDT", 1, "REDHAT", "OVMF ", 1) {=0D +}=0D diff --git a/BhyvePkg/BhyvePkg.dec b/BhyvePkg/BhyvePkg.dec new file mode 100644 index 0000000000..c0e92ff3d9 --- /dev/null +++ b/BhyvePkg/BhyvePkg.dec @@ -0,0 +1,176 @@ +#=0D +# Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.
= =0D +# Copyright (c) 2014, Pluribus Networks, Inc.=0D +#=0D +# This program and the accompanying materials=0D +# are licensed and made available under the terms and conditions of the B= SD License=0D +# which accompanies this distribution. The full text of the license may b= e found at=0D +# http://opensource.org/licenses/bsd-license.php=0D +#=0D +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,=0D +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IM= PLIED.=0D +#=0D +##=0D +=0D +[Defines]=0D + DEC_SPECIFICATION =3D 0x00010005=0D + PACKAGE_NAME =3D BhyvePkg=0D + PACKAGE_GUID =3D 2daf5f34-50e5-4b9d-b8e3-5562334d87e5= =0D + PACKAGE_VERSION =3D 0.1=0D +=0D +[Includes]=0D + Include=0D + ../OvmfPkg/Include=0D +=0D +[LibraryClasses]=0D + ## @libraryclass Save and restore variables using a file=0D + #=0D + NvVarsFileLib|Include/Library/NvVarsFileLib.h=0D +=0D + ## @libraryclass Provides services to work with PCI capabilities in PC= I=0D + # config space.=0D + PciCapLib|Include/Library/PciCapLib.h=0D +=0D + ## @libraryclass Layered on top of PciCapLib, allows clients to plug a= n=0D + # EFI_PCI_IO_PROTOCOL backend into PciCapLib, for confi= g=0D + # space access.=0D + PciCapPciIoLib|Include/Library/PciCapPciIoLib.h=0D +=0D + ## @libraryclass Layered on top of PciCapLib, allows clients to plug a= =0D + # PciSegmentLib backend into PciCapLib, for config spac= e=0D + # access.=0D + PciCapPciSegmentLib|Include/Library/PciCapPciSegmentLib.h=0D +=0D + ## @libraryclass Register a status code handler for printing the Boot= =0D + # Manager's LoadImage() and StartImage() preparations, = and=0D + # return codes, to the UEFI console.=0D + PlatformBmPrintScLib|Include/Library/PlatformBmPrintScLib.h=0D +=0D + ## @libraryclass Serialize (and deserialize) variables=0D + #=0D + SerializeVariablesLib|Include/Library/SerializeVariablesLib.h=0D +=0D + ## @libraryclass Access bhyve's firmware control interface=0D + #=0D + BhyveFwCtlLib|Include/Library/BhyveFwCtlLib.h=0D +=0D +[Guids]=0D + gUefiOvmfPkgTokenSpaceGuid =3D {0x93bb96af, 0xb9f2, 0x4eb8, {0x= 94, 0x62, 0xe0, 0xba, 0x74, 0x56, 0x42, 0x36}}=0D + gOvmfPlatformConfigGuid =3D {0x7235c51c, 0x0c80, 0x4cab, {0x= 87, 0xac, 0x3b, 0x08, 0x4a, 0x63, 0x04, 0xb1}}=0D + gVirtioMmioTransportGuid =3D {0x837dca9e, 0xe874, 0x4d82, {0x= b2, 0x9a, 0x23, 0xfe, 0x0e, 0x23, 0xd1, 0xe2}}=0D + gRootBridgesConnectedEventGroupGuid =3D {0x24a2d66f, 0xeedd, 0x4086, {0x= 90, 0x42, 0xf2, 0x6e, 0x47, 0x97, 0xee, 0x69}}=0D +=0D +[Protocols]=0D + gVirtioDeviceProtocolGuid =3D {0xfa920010, 0x6785, 0x4941, {0x= b6, 0xec, 0x49, 0x8c, 0x57, 0x9f, 0x16, 0x0a}}=0D + gIoMmuAbsentProtocolGuid =3D {0xf8775d50, 0x8abd, 0x4adf, {0x= 92, 0xac, 0x85, 0x3e, 0x51, 0xf6, 0xc8, 0xdc}}=0D +=0D +[PcdsFixedAtBuild]=0D + gUefiOvmfPkgTokenSpaceGuid.PcdOvmfPeiMemFvBase|0x0|UINT32|0=0D + gUefiOvmfPkgTokenSpaceGuid.PcdOvmfPeiMemFvSize|0x0|UINT32|1=0D + gUefiOvmfPkgTokenSpaceGuid.PcdOvmfDxeMemFvBase|0x0|UINT32|0x15=0D + gUefiOvmfPkgTokenSpaceGuid.PcdOvmfDxeMemFvSize|0x0|UINT32|0x16=0D +=0D + ## This flag is used to control the destination port for PlatformDebugLi= bIoPort=0D + gUefiOvmfPkgTokenSpaceGuid.PcdDebugIoPort|0x2F8|UINT16|4=0D +=0D + ## When VirtioScsiDxe is instantiated for a HBA, the numbers of targets = and=0D + # LUNs are retrieved from the host during virtio-scsi setup.=0D + # MdeModulePkg/Bus/Scsi/ScsiBusDxe then scans all MaxTarget * MaxLun=0D + # possible devices. This can take extremely long, for example with=0D + # MaxTarget=3D255 and MaxLun=3D16383. The *inclusive* constants below l= imit=0D + # MaxTarget and MaxLun, independently, should the host report higher va= lues,=0D + # so that scanning the number of devices given by their product is stil= l=0D + # acceptably fast.=0D + gUefiOvmfPkgTokenSpaceGuid.PcdVirtioScsiMaxTargetLimit|31|UINT16|6=0D + gUefiOvmfPkgTokenSpaceGuid.PcdVirtioScsiMaxLunLimit|7|UINT32|7=0D +=0D + gUefiOvmfPkgTokenSpaceGuid.PcdOvmfFlashNvStorageEventLogBase|0x0|UINT32|= 0x8=0D + gUefiOvmfPkgTokenSpaceGuid.PcdOvmfFlashNvStorageEventLogSize|0x0|UINT32|= 0x9=0D + gUefiOvmfPkgTokenSpaceGuid.PcdOvmfFirmwareFdSize|0x0|UINT32|0xa=0D + gUefiOvmfPkgTokenSpaceGuid.PcdOvmfFirmwareBlockSize|0|UINT32|0xb=0D + gUefiOvmfPkgTokenSpaceGuid.PcdOvmfFlashNvStorageVariableBase|0x0|UINT32|= 0xc=0D + gUefiOvmfPkgTokenSpaceGuid.PcdOvmfFlashNvStorageFtwSpareBase|0x0|UINT32|= 0xd=0D + gUefiOvmfPkgTokenSpaceGuid.PcdOvmfFlashNvStorageFtwWorkingBase|0x0|UINT3= 2|0xe=0D + gUefiOvmfPkgTokenSpaceGuid.PcdOvmfFdBaseAddress|0x0|UINT32|0xf=0D + gUefiOvmfPkgTokenSpaceGuid.PcdOvmfSecPageTablesBase|0x0|UINT32|0x11=0D + gUefiOvmfPkgTokenSpaceGuid.PcdOvmfSecPageTablesSize|0x0|UINT32|0x12=0D + gUefiOvmfPkgTokenSpaceGuid.PcdOvmfSecPeiTempRamBase|0x0|UINT32|0x13=0D + gUefiOvmfPkgTokenSpaceGuid.PcdOvmfSecPeiTempRamSize|0x0|UINT32|0x14=0D + gUefiOvmfPkgTokenSpaceGuid.PcdOvmfLockBoxStorageBase|0x0|UINT32|0x18=0D + gUefiOvmfPkgTokenSpaceGuid.PcdOvmfLockBoxStorageSize|0x0|UINT32|0x19=0D + gUefiOvmfPkgTokenSpaceGuid.PcdGuidedExtractHandlerTableSize|0x0|UINT32|0= x1a=0D + gUefiOvmfPkgTokenSpaceGuid.PcdOvmfDecompressionScratchEnd|0x0|UINT32|0x1= f=0D +=0D + ## Pcd8259LegacyModeMask defines the default mask value for platform. Th= is=0D + # value is determined.=0D + # 1) If platform only support pure UEFI, value should be set to 0xFFFF = or=0D + # 0xFFFE; Because only clock interrupt is allowed in legacy mode in = pure=0D + # UEFI platform.=0D + # 2) If platform install CSM and use thunk module:=0D + # a) If thunk call provided by CSM binary requires some legacy inter= rupt=0D + # support, the corresponding bit should be opened as 0.=0D + # For example, if keyboard interfaces provided CSM binary use leg= acy=0D + # keyboard interrupt in 8259 bit 1, then the value should be set = to=0D + # 0xFFFC.=0D + # b) If all thunk call provied by CSM binary do not require legacy=0D + # interrupt support, value should be set to 0xFFFF or 0xFFFE.=0D + #=0D + # The default value of legacy mode mask could be changed by=0D + # EFI_LEGACY_8259_PROTOCOL->SetMask(). But it is rarely need change it= =0D + # except some special cases such as when initializing the CSM binary, i= t=0D + # should be set to 0xFFFF to mask all legacy interrupt. Please restore = the=0D + # original legacy mask value if changing is made for these special case= .=0D + gUefiOvmfPkgTokenSpaceGuid.Pcd8259LegacyModeMask|0xFFFF|UINT16|0x3=0D +=0D + ## Pcd8259LegacyModeEdgeLevel defines the default edge level for legacy= =0D + # mode's interrrupt controller.=0D + # For the corresponding bits, 0 =3D Edge triggered and 1 =3D Level trig= gered.=0D + gUefiOvmfPkgTokenSpaceGuid.Pcd8259LegacyModeEdgeLevel|0x0000|UINT16|0x5= =0D +=0D +=0D +=0D +[PcdsDynamic, PcdsDynamicEx]=0D + gUefiOvmfPkgTokenSpaceGuid.PcdEmuVariableEvent|0|UINT64|2=0D + gUefiOvmfPkgTokenSpaceGuid.PcdOvmfFlashVariablesEnable|FALSE|BOOLEAN|0x1= 0=0D + gUefiOvmfPkgTokenSpaceGuid.PcdOvmfHostBridgePciDevId|0|UINT16|0x1b=0D + gUefiOvmfPkgTokenSpaceGuid.PcdQemuSmbiosValidated|FALSE|BOOLEAN|0x21=0D +=0D + ## The IO port aperture shared by all PCI root bridges.=0D + #=0D + gUefiOvmfPkgTokenSpaceGuid.PcdPciIoBase|0x0|UINT64|0x22=0D + gUefiOvmfPkgTokenSpaceGuid.PcdPciIoSize|0x0|UINT64|0x23=0D +=0D + ## The 32-bit MMIO aperture shared by all PCI root bridges.=0D + #=0D + gUefiOvmfPkgTokenSpaceGuid.PcdPciMmio32Base|0x0|UINT64|0x24=0D + gUefiOvmfPkgTokenSpaceGuid.PcdPciMmio32Size|0x0|UINT64|0x25=0D +=0D + ## The 64-bit MMIO aperture shared by all PCI root bridges.=0D + #=0D + gUefiOvmfPkgTokenSpaceGuid.PcdPciMmio64Base|0x0|UINT64|0x26=0D + gUefiOvmfPkgTokenSpaceGuid.PcdPciMmio64Size|0x0|UINT64|0x27=0D +=0D + ## The following setting controls how many megabytes we configure as TSE= G on=0D + # Q35, for SMRAM purposes. Permitted defaults are: 1, 2, 8. Other defau= lts=0D + # cause undefined behavior. During boot, the PCD is updated by Platform= Pei=0D + # to reflect the extended TSEG size, if one is advertized by QEMU.=0D + #=0D + # This PCD is only accessed if PcdSmmSmramRequire is TRUE (see below).= =0D + gUefiOvmfPkgTokenSpaceGuid.PcdQ35TsegMbytes|8|UINT16|0x20=0D +=0D +[PcdsFeatureFlag]=0D + gUefiOvmfPkgTokenSpaceGuid.PcdQemuBootOrderPciTranslation|TRUE|BOOLEAN|0= x1c=0D + gUefiOvmfPkgTokenSpaceGuid.PcdQemuBootOrderMmioTranslation|FALSE|BOOLEAN= |0x1d=0D +=0D + ## This feature flag enables SMM/SMRAM support. Note that it also requir= es=0D + # such support from the underlying QEMU instance; if that support is no= t=0D + # present, the firmware will reject continuing after a certain point.=0D + #=0D + # The flag also acts as a general "security switch"; when TRUE, many=0D + # components will change behavior, with the goal of preventing a malici= ous=0D + # runtime OS from tampering with firmware structures (special memory ra= nges=0D + # used by OVMF, the varstore pflash chip, LockBox etc).=0D + gUefiOvmfPkgTokenSpaceGuid.PcdSmmSmramRequire|FALSE|BOOLEAN|0x1e=0D +=0D +[Protocols]=0D +gEfiLegacyBiosProtocolGuid =3D {0xdb9a1e3d, 0x45cb, 0x4abb, {0x85= , 0x3b, 0xe5, 0x38, 0x7f, 0xdb, 0x2e, 0x2d}}=0D diff --git a/BhyvePkg/BhyvePkg.fdf.inc b/BhyvePkg/BhyvePkg.fdf.inc new file mode 100644 index 0000000000..b3e0c472a1 --- /dev/null +++ b/BhyvePkg/BhyvePkg.fdf.inc @@ -0,0 +1,92 @@ +## @file=0D +# FDF include file that defines the main macros and sets the dependent PC= Ds.=0D +#=0D +# Copyright (C) 2014, Red Hat, Inc.=0D +# Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.
= =0D +#=0D +# This program and the accompanying materials are licensed and made avail= able=0D +# under the terms and conditions of the BSD License which accompanies thi= s=0D +# distribution. The full text of the license may be found at=0D +# http://opensource.org/licenses/bsd-license.php=0D +#=0D +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,=0D +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR=0D +# IMPLIED.=0D +#=0D +##=0D +=0D +DEFINE BLOCK_SIZE =3D 0x1000=0D +=0D +#=0D +# A firmware binary built with FD_SIZE_IN_KB=3D1024, and a firmware binary= built=0D +# with FD_SIZE_IN_KB=3D2048, use the same variable store layout.=0D +#=0D +# Setting FD_SIZE_IN_KB to 4096 results in a different (much larger) varia= ble=0D +# store structure that is incompatible with both of the above-mentioned=0D +# firmware binaries.=0D +#=0D +!if ($(FD_SIZE_IN_KB) =3D=3D 1024) || ($(FD_SIZE_IN_KB) =3D=3D 2048)=0D +DEFINE VARS_SIZE =3D 0x20000=0D +DEFINE VARS_BLOCKS =3D 0x20=0D +DEFINE VARS_LIVE_SIZE =3D 0xE000=0D +DEFINE VARS_SPARE_SIZE =3D 0x10000=0D +!endif=0D +=0D +!if $(FD_SIZE_IN_KB) =3D=3D 1024=0D +DEFINE FW_BASE_ADDRESS =3D 0xFFF00000=0D +DEFINE FW_SIZE =3D 0x00100000=0D +DEFINE FW_BLOCKS =3D 0x100=0D +DEFINE CODE_BASE_ADDRESS =3D 0xFFF20000=0D +DEFINE CODE_SIZE =3D 0x000E0000=0D +DEFINE CODE_BLOCKS =3D 0xE0=0D +DEFINE FVMAIN_SIZE =3D 0x000CC000=0D +DEFINE SECFV_OFFSET =3D 0x000EC000=0D +DEFINE SECFV_SIZE =3D 0x14000=0D +!endif=0D +=0D +!if $(FD_SIZE_IN_KB) =3D=3D 2048=0D +DEFINE FW_BASE_ADDRESS =3D 0xFFE00000=0D +DEFINE FW_SIZE =3D 0x00200000=0D +DEFINE FW_BLOCKS =3D 0x200=0D +DEFINE CODE_BASE_ADDRESS =3D 0xFFE20000=0D +DEFINE CODE_SIZE =3D 0x001E0000=0D +DEFINE CODE_BLOCKS =3D 0x1E0=0D +DEFINE FVMAIN_SIZE =3D 0x001AC000=0D +DEFINE SECFV_OFFSET =3D 0x001CC000=0D +DEFINE SECFV_SIZE =3D 0x34000=0D +!endif=0D +=0D +!if $(FD_SIZE_IN_KB) =3D=3D 4096=0D +DEFINE VARS_SIZE =3D 0x84000=0D +DEFINE VARS_BLOCKS =3D 0x84=0D +DEFINE VARS_LIVE_SIZE =3D 0x40000=0D +DEFINE VARS_SPARE_SIZE =3D 0x42000=0D +=0D +DEFINE FW_BASE_ADDRESS =3D 0xFFC00000=0D +DEFINE FW_SIZE =3D 0x00400000=0D +DEFINE FW_BLOCKS =3D 0x400=0D +DEFINE CODE_BASE_ADDRESS =3D 0xFFC84000=0D +DEFINE CODE_SIZE =3D 0x0037C000=0D +DEFINE CODE_BLOCKS =3D 0x37C=0D +DEFINE FVMAIN_SIZE =3D 0x00348000=0D +DEFINE SECFV_OFFSET =3D 0x003CC000=0D +DEFINE SECFV_SIZE =3D 0x34000=0D +!endif=0D +=0D +SET gUefiOvmfPkgTokenSpaceGuid.PcdOvmfFdBaseAddress =3D $(FW_BASE_ADDR= ESS)=0D +SET gUefiOvmfPkgTokenSpaceGuid.PcdOvmfFirmwareFdSize =3D $(FW_SIZE)=0D +SET gUefiOvmfPkgTokenSpaceGuid.PcdOvmfFirmwareBlockSize =3D $(BLOCK_SIZE)= =0D +=0D +SET gUefiOvmfPkgTokenSpaceGuid.PcdOvmfFlashNvStorageVariableBase =3D $(FW_= BASE_ADDRESS)=0D +SET gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableSize =3D $(VAR= S_LIVE_SIZE)=0D +=0D +SET gUefiOvmfPkgTokenSpaceGuid.PcdOvmfFlashNvStorageEventLogBase =3D gUefi= OvmfPkgTokenSpaceGuid.PcdOvmfFlashNvStorageVariableBase + gEfiMdeModulePkgT= okenSpaceGuid.PcdFlashNvStorageVariableSize=0D +SET gUefiOvmfPkgTokenSpaceGuid.PcdOvmfFlashNvStorageEventLogSize =3D $(BLO= CK_SIZE)=0D +=0D +SET gUefiOvmfPkgTokenSpaceGuid.PcdOvmfFlashNvStorageFtwWorkingBase =3D gUe= fiOvmfPkgTokenSpaceGuid.PcdOvmfFlashNvStorageEventLogBase + gUefiOvmfPkgTok= enSpaceGuid.PcdOvmfFlashNvStorageEventLogSize=0D +SET gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingSize =3D $(B= LOCK_SIZE)=0D +=0D +SET gUefiOvmfPkgTokenSpaceGuid.PcdOvmfFlashNvStorageFtwSpareBase =3D gUefi= OvmfPkgTokenSpaceGuid.PcdOvmfFlashNvStorageFtwWorkingBase + gEfiMdeModulePk= gTokenSpaceGuid.PcdFlashNvStorageFtwWorkingSize=0D +SET gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareSize =3D $(VAR= S_SPARE_SIZE)=0D +=0D +DEFINE MEMFD_BASE_ADDRESS =3D 0x800000=0D diff --git a/BhyvePkg/BhyvePkgX64.dsc b/BhyvePkg/BhyvePkgX64.dsc new file mode 100644 index 0000000000..e41fab9cc4 --- /dev/null +++ b/BhyvePkg/BhyvePkgX64.dsc @@ -0,0 +1,862 @@ +#=0D +# Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.
= =0D +# (C) Copyright 2016 Hewlett Packard Enterprise Development LP
=0D +# Copyright (c) 2014, Pluribus Networks, Inc.=0D +#=0D +# This program and the accompanying materials=0D +# are licensed and made available under the terms and conditions of the B= SD License=0D +# which accompanies this distribution. The full text of the license may b= e found at=0D +# http://opensource.org/licenses/bsd-license.php=0D +#=0D +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,=0D +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IM= PLIED.=0D +#=0D +##=0D +=0D +##########################################################################= ######=0D +#=0D +# Defines Section - statements that will be processed to create a Makefile= .=0D +#=0D +##########################################################################= ######=0D +[Defines]=0D + PLATFORM_NAME =3D Bhyve=0D + PLATFORM_GUID =3D 562b76ee-ceb2-4f4f-adfe-a4c8dc46e4ff= =0D + PLATFORM_VERSION =3D 0.1=0D + DSC_SPECIFICATION =3D 0x00010005=0D + OUTPUT_DIRECTORY =3D Build/BhyveX64=0D + SUPPORTED_ARCHITECTURES =3D X64=0D + BUILD_TARGETS =3D NOOPT|DEBUG|RELEASE=0D + SKUID_IDENTIFIER =3D DEFAULT=0D + FLASH_DEFINITION =3D BhyvePkg/BhyvePkgX64.fdf=0D +=0D + #=0D + # Defines for default states. These can be changed on the command line.= =0D + # -D FLAG=3DVALUE=0D + #=0D + DEFINE SECURE_BOOT_ENABLE =3D FALSE=0D + DEFINE SMM_REQUIRE =3D FALSE=0D + DEFINE SOURCE_DEBUG_ENABLE =3D FALSE=0D + DEFINE TPM_ENABLE =3D FALSE=0D + DEFINE TPM_CONFIG_ENABLE =3D FALSE=0D +=0D +#=0D + # Network definition=0D + #=0D + DEFINE NETWORK_TLS_ENABLE =3D FALSE=0D + DEFINE NETWORK_IP6_ENABLE =3D FALSE=0D + DEFINE NETWORK_HTTP_BOOT_ENABLE =3D FALSE=0D + DEFINE NETWORK_ALLOW_HTTP_CONNECTIONS =3D TRUE=0D +=0D +!include NetworkPkg/NetworkDefines.dsc.inc=0D +=0D + #=0D + # Flash size selection. Setting FD_SIZE_IN_KB on the command line direct= ly to=0D + # one of the supported values, in place of any of the convenience macros= , is=0D + # permitted.=0D + #=0D +!ifdef $(FD_SIZE_1MB)=0D + DEFINE FD_SIZE_IN_KB =3D 1024=0D +!else=0D +!ifdef $(FD_SIZE_2MB)=0D + DEFINE FD_SIZE_IN_KB =3D 2048=0D +!else=0D +!ifdef $(FD_SIZE_4MB)=0D + DEFINE FD_SIZE_IN_KB =3D 4096=0D +!else=0D + DEFINE FD_SIZE_IN_KB =3D 4096=0D +!endif=0D +!endif=0D +!endif=0D +=0D +[BuildOptions]=0D + GCC:RELEASE_*_*_CC_FLAGS =3D -DMDEPKG_NDEBUG=0D + INTEL:RELEASE_*_*_CC_FLAGS =3D /D MDEPKG_NDEBUG=0D + MSFT:RELEASE_*_*_CC_FLAGS =3D /D MDEPKG_NDEBUG=0D +!if $(TOOL_CHAIN_TAG) !=3D "XCODE5" && $(TOOL_CHAIN_TAG) !=3D "CLANGPDB"=0D + GCC:*_*_*_CC_FLAGS =3D -mno-mmx -mno-sse=0D +!endif=0D +!if $(SOURCE_DEBUG_ENABLE) =3D=3D TRUE=0D + MSFT:*_*_X64_GENFW_FLAGS =3D --keepexceptiontable=0D + GCC:*_*_X64_GENFW_FLAGS =3D --keepexceptiontable=0D + INTEL:*_*_X64_GENFW_FLAGS =3D --keepexceptiontable=0D +!endif=0D +=0D + #=0D + # Disable deprecated APIs.=0D + #=0D + MSFT:*_*_*_CC_FLAGS =3D /D DISABLE_NEW_DEPRECATED_INTERFACES=0D + INTEL:*_*_*_CC_FLAGS =3D /D DISABLE_NEW_DEPRECATED_INTERFACES=0D + GCC:*_*_*_CC_FLAGS =3D -D DISABLE_NEW_DEPRECATED_INTERFACES=0D +=0D +[BuildOptions.common.EDKII.DXE_RUNTIME_DRIVER]=0D + GCC:*_*_*_DLINK_FLAGS =3D -z common-page-size=3D0x1000=0D + XCODE:*_*_*_DLINK_FLAGS =3D -seg1addr 0x1000 -segalign 0x1000=0D + XCODE:*_*_*_MTOC_FLAGS =3D -align 0x1000=0D + CLANGPDB:*_*_*_DLINK_FLAGS =3D /ALIGN:4096=0D +=0D +# Force PE/COFF sections to be aligned at 4KB boundaries to support page l= evel=0D +# protection of DXE_SMM_DRIVER/SMM_CORE modules=0D +[BuildOptions.common.EDKII.DXE_SMM_DRIVER, BuildOptions.common.EDKII.SMM_C= ORE]=0D + GCC:*_*_*_DLINK_FLAGS =3D -z common-page-size=3D0x1000=0D + XCODE:*_*_*_DLINK_FLAGS =3D -seg1addr 0x1000 -segalign 0x1000=0D + XCODE:*_*_*_MTOC_FLAGS =3D -align 0x1000=0D + CLANGPDB:*_*_*_DLINK_FLAGS =3D /ALIGN:4096=0D +=0D +##########################################################################= ######=0D +#=0D +# SKU Identification section - list of all SKU IDs supported by this Platf= orm.=0D +#=0D +##########################################################################= ######=0D +[SkuIds]=0D + 0|DEFAULT=0D +=0D +##########################################################################= ######=0D +#=0D +# Library Class section - list of all Library Classes needed by this Platf= orm.=0D +#=0D +##########################################################################= ######=0D +[LibraryClasses]=0D + PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf=0D + TimerLib|OvmfPkg/Library/AcpiTimerLib/BaseAcpiTimerLibBhyve.inf=0D + PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf=0D + BaseMemoryLib|MdePkg/Library/BaseMemoryLibRepStr/BaseMemoryLibRepStr.inf= =0D + BaseLib|MdePkg/Library/BaseLib/BaseLib.inf=0D + SafeIntLib|MdePkg/Library/BaseSafeIntLib/BaseSafeIntLib.inf=0D + BmpSupportLib|MdeModulePkg/Library/BaseBmpSupportLib/BaseBmpSupportLib.i= nf=0D + SynchronizationLib|MdePkg/Library/BaseSynchronizationLib/BaseSynchroniza= tionLib.inf=0D + CpuLib|MdePkg/Library/BaseCpuLib/BaseCpuLib.inf=0D + PerformanceLib|MdePkg/Library/BasePerformanceLibNull/BasePerformanceLibN= ull.inf=0D + PeCoffLib|MdePkg/Library/BasePeCoffLib/BasePeCoffLib.inf=0D + CacheMaintenanceLib|MdePkg/Library/BaseCacheMaintenanceLib/BaseCacheMain= tenanceLib.inf=0D + UefiDecompressLib|MdePkg/Library/BaseUefiDecompressLib/BaseUefiDecompres= sLib.inf=0D + UefiHiiServicesLib|MdeModulePkg/Library/UefiHiiServicesLib/UefiHiiServic= esLib.inf=0D + HiiLib|MdeModulePkg/Library/UefiHiiLib/UefiHiiLib.inf=0D + SortLib|MdeModulePkg/Library/UefiSortLib/UefiSortLib.inf=0D + UefiBootManagerLib|MdeModulePkg/Library/UefiBootManagerLib/UefiBootManag= erLib.inf=0D + BootLogoLib|MdeModulePkg/Library/BootLogoLib/BootLogoLib.inf=0D + FileExplorerLib|MdeModulePkg/Library/FileExplorerLib/FileExplorerLib.inf= =0D + CapsuleLib|MdeModulePkg/Library/DxeCapsuleLibNull/DxeCapsuleLibNull.inf= =0D + DxeServicesLib|MdePkg/Library/DxeServicesLib/DxeServicesLib.inf=0D + DxeServicesTableLib|MdePkg/Library/DxeServicesTableLib/DxeServicesTableL= ib.inf=0D + PeCoffGetEntryPointLib|MdePkg/Library/BasePeCoffGetEntryPointLib/BasePeC= offGetEntryPointLib.inf=0D + PciCf8Lib|MdePkg/Library/BasePciCf8Lib/BasePciCf8Lib.inf=0D + PciExpressLib|MdePkg/Library/BasePciExpressLib/BasePciExpressLib.inf=0D + PciLib|MdePkg/Library/BasePciLibCf8/BasePciLibCf8.inf=0D + PciSegmentLib|MdePkg/Library/BasePciSegmentLibPci/BasePciSegmentLibPci.i= nf=0D + PciCapLib|OvmfPkg/Library/BasePciCapLib/BasePciCapLib.inf=0D + PciCapPciSegmentLib|OvmfPkg/Library/BasePciCapPciSegmentLib/BasePciCapPc= iSegmentLib.inf=0D + PciCapPciIoLib|OvmfPkg/Library/UefiPciCapPciIoLib/UefiPciCapPciIoLib.inf= =0D + IoLib|MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsicSev.inf=0D + OemHookStatusCodeLib|MdeModulePkg/Library/OemHookStatusCodeLibNull/OemHo= okStatusCodeLibNull.inf=0D + SerialPortLib|PcAtChipsetPkg/Library/SerialIoLib/SerialIoLib.inf=0D + MtrrLib|UefiCpuPkg/Library/MtrrLib/MtrrLib.inf=0D + UefiLib|MdePkg/Library/UefiLib/UefiLib.inf=0D + UefiBootServicesTableLib|MdePkg/Library/UefiBootServicesTableLib/UefiBoo= tServicesTableLib.inf=0D + UefiRuntimeServicesTableLib|MdePkg/Library/UefiRuntimeServicesTableLib/U= efiRuntimeServicesTableLib.inf=0D + UefiDriverEntryPoint|MdePkg/Library/UefiDriverEntryPoint/UefiDriverEntry= Point.inf=0D + UefiApplicationEntryPoint|MdePkg/Library/UefiApplicationEntryPoint/UefiA= pplicationEntryPoint.inf=0D + DevicePathLib|MdePkg/Library/UefiDevicePathLibDevicePathProtocol/UefiDev= icePathLibDevicePathProtocol.inf=0D + NvVarsFileLib|OvmfPkg/Library/NvVarsFileLib/NvVarsFileLib.inf=0D + FileHandleLib|MdePkg/Library/UefiFileHandleLib/UefiFileHandleLib.inf=0D + UefiCpuLib|UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.inf=0D + SecurityManagementLib|MdeModulePkg/Library/DxeSecurityManagementLib/DxeS= ecurityManagementLib.inf=0D +# UefiUsbLib|MdePkg/Library/UefiUsbLib/UefiUsbLib.inf=0D + SerializeVariablesLib|OvmfPkg/Library/SerializeVariablesLib/SerializeVar= iablesLib.inf=0D + QemuFwCfgLib|OvmfPkg/Library/QemuFwCfgLibNull/QemuFwCfgDxeLibNull.inf=0D + BhyveFwCtlLib|BhyvePkg/Library/BhyveFwCtlLib/BhyveFwCtlLib.inf=0D + VirtioLib|OvmfPkg/Library/VirtioLib/VirtioLib.inf=0D + MemEncryptSevLib|OvmfPkg/Library/BaseMemEncryptSevLib/BaseMemEncryptSevL= ib.inf=0D + LockBoxLib|OvmfPkg/Library/LockBoxLib/LockBoxBaseLib.inf=0D +=0D + CustomizedDisplayLib|MdeModulePkg/Library/CustomizedDisplayLib/Customize= dDisplayLib.inf=0D + FrameBufferBltLib|MdeModulePkg/Library/FrameBufferBltLib/FrameBufferBltL= ib.inf=0D +=0D +!if $(SOURCE_DEBUG_ENABLE) =3D=3D TRUE=0D + PeCoffExtraActionLib|SourceLevelDebugPkg/Library/PeCoffExtraActionLibDeb= ug/PeCoffExtraActionLibDebug.inf=0D + DebugCommunicationLib|SourceLevelDebugPkg/Library/DebugCommunicationLibS= erialPort/DebugCommunicationLibSerialPort.inf=0D +!else=0D + PeCoffExtraActionLib|MdePkg/Library/BasePeCoffExtraActionLibNull/BasePeC= offExtraActionLibNull.inf=0D + DebugAgentLib|MdeModulePkg/Library/DebugAgentLibNull/DebugAgentLibNull.i= nf=0D +!endif=0D +=0D + ResetSystemLib|OvmfPkg/Library/ResetSystemLib/ResetSystemLib.inf=0D + LocalApicLib|UefiCpuPkg/Library/BaseXApicLib/BaseXApicLib.inf=0D + IoApicLib|PcAtChipsetPkg/Library/BaseIoApicLib/BaseIoApicLib.inf=0D + DebugPrintErrorLevelLib|MdePkg/Library/BaseDebugPrintErrorLevelLib/BaseD= ebugPrintErrorLevelLib.inf=0D +=0D + IntrinsicLib|CryptoPkg/Library/IntrinsicLib/IntrinsicLib.inf=0D +!if $(NETWORK_TLS_ENABLE) =3D=3D TRUE=0D + OpensslLib|CryptoPkg/Library/OpensslLib/OpensslLib.inf=0D +!else=0D + OpensslLib|CryptoPkg/Library/OpensslLib/OpensslLibCrypto.inf=0D +!endif=0D +=0D +!if $(SECURE_BOOT_ENABLE) =3D=3D TRUE=0D + PlatformSecureLib|BhyvePkg/Library/PlatformSecureLib/PlatformSecureLib.i= nf=0D + AuthVariableLib|SecurityPkg/Library/AuthVariableLib/AuthVariableLib.inf= =0D +!else=0D + AuthVariableLib|MdeModulePkg/Library/AuthVariableLibNull/AuthVariableLib= Null.inf=0D +!endif=0D + VarCheckLib|MdeModulePkg/Library/VarCheckLib/VarCheckLib.inf=0D +=0D +=0D + #=0D + # Network libraries=0D + #=0D +!include NetworkPkg/NetworkLibs.dsc.inc=0D +=0D +!if $(NETWORK_TLS_ENABLE) =3D=3D TRUE=0D + TlsLib|CryptoPkg/Library/TlsLib/TlsLib.inf=0D +!endif=0D +=0D + ShellLib|ShellPkg/Library/UefiShellLib/UefiShellLib.inf=0D + ShellCEntryLib|ShellPkg/Library/UefiShellCEntryLib/UefiShellCEntryLib.in= f=0D + S3BootScriptLib|MdeModulePkg/Library/PiDxeS3BootScriptLib/DxeS3BootScrip= tLib.inf=0D + SmbusLib|MdePkg/Library/BaseSmbusLibNull/BaseSmbusLibNull.inf=0D + OrderedCollectionLib|MdePkg/Library/BaseOrderedCollectionRedBlackTreeLib= /BaseOrderedCollectionRedBlackTreeLib.inf=0D + XenPlatformLib|OvmfPkg/Library/XenPlatformLib/XenPlatformLib.inf=0D +=0D +=0D +!if $(TPM_ENABLE) =3D=3D TRUE=0D + Tpm2CommandLib|SecurityPkg/Library/Tpm2CommandLib/Tpm2CommandLib.inf=0D + Tcg2PhysicalPresenceLib|OvmfPkg/Library/Tcg2PhysicalPresenceLibQemu/DxeT= cg2PhysicalPresenceLib.inf=0D + Tcg2PpVendorLib|SecurityPkg/Library/Tcg2PpVendorLibNull/Tcg2PpVendorLibN= ull.inf=0D + TpmMeasurementLib|SecurityPkg/Library/DxeTpmMeasurementLib/DxeTpmMeasure= mentLib.inf=0D +!else=0D + Tcg2PhysicalPresenceLib|OvmfPkg/Library/Tcg2PhysicalPresenceLibNull/DxeT= cg2PhysicalPresenceLib.inf=0D + TpmMeasurementLib|MdeModulePkg/Library/TpmMeasurementLibNull/TpmMeasurem= entLibNull.inf=0D +!endif=0D +=0D +[LibraryClasses.common]=0D + BaseCryptLib|CryptoPkg/Library/BaseCryptLib/BaseCryptLib.inf=0D +=0D +[LibraryClasses.common.SEC]=0D +!ifdef $(DEBUG_ON_SERIAL_PORT)=0D + DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.in= f=0D +!else=0D + DebugLib|OvmfPkg/Library/PlatformDebugLibIoPort/PlatformRomDebugLibIoPor= t.inf=0D +!endif=0D + ReportStatusCodeLib|MdeModulePkg/Library/PeiReportStatusCodeLib/PeiRepor= tStatusCodeLib.inf=0D + ExtractGuidedSectionLib|MdePkg/Library/BaseExtractGuidedSectionLib/BaseE= xtractGuidedSectionLib.inf=0D +!if $(SOURCE_DEBUG_ENABLE) =3D=3D TRUE=0D + DebugAgentLib|SourceLevelDebugPkg/Library/DebugAgent/SecPeiDebugAgentLib= .inf=0D +!endif=0D + HobLib|MdePkg/Library/PeiHobLib/PeiHobLib.inf=0D + PeiServicesLib|MdePkg/Library/PeiServicesLib/PeiServicesLib.inf=0D + PeiServicesTablePointerLib|MdePkg/Library/PeiServicesTablePointerLibIdt/= PeiServicesTablePointerLibIdt.inf=0D + MemoryAllocationLib|MdePkg/Library/PeiMemoryAllocationLib/PeiMemoryAlloc= ationLib.inf=0D + CpuExceptionHandlerLib|UefiCpuPkg/Library/CpuExceptionHandlerLib/SecPeiC= puExceptionHandlerLib.inf=0D +=0D +[LibraryClasses.common.PEI_CORE]=0D + HobLib|MdePkg/Library/PeiHobLib/PeiHobLib.inf=0D + PeiServicesTablePointerLib|MdePkg/Library/PeiServicesTablePointerLibIdt/= PeiServicesTablePointerLibIdt.inf=0D + PeiServicesLib|MdePkg/Library/PeiServicesLib/PeiServicesLib.inf=0D + MemoryAllocationLib|MdePkg/Library/PeiMemoryAllocationLib/PeiMemoryAlloc= ationLib.inf=0D + PeiCoreEntryPoint|MdePkg/Library/PeiCoreEntryPoint/PeiCoreEntryPoint.inf= =0D + ReportStatusCodeLib|MdeModulePkg/Library/PeiReportStatusCodeLib/PeiRepor= tStatusCodeLib.inf=0D + OemHookStatusCodeLib|MdeModulePkg/Library/OemHookStatusCodeLibNull/OemHo= okStatusCodeLibNull.inf=0D + PeCoffGetEntryPointLib|MdePkg/Library/BasePeCoffGetEntryPointLib/BasePeC= offGetEntryPointLib.inf=0D +!ifdef $(DEBUG_ON_SERIAL_PORT)=0D + DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.in= f=0D +!else=0D + DebugLib|OvmfPkg/Library/PlatformDebugLibIoPort/PlatformDebugLibIoPort.i= nf=0D +!endif=0D + PeCoffLib|MdePkg/Library/BasePeCoffLib/BasePeCoffLib.inf=0D +=0D +[LibraryClasses.common.PEIM]=0D + HobLib|MdePkg/Library/PeiHobLib/PeiHobLib.inf=0D + PeiServicesTablePointerLib|MdePkg/Library/PeiServicesTablePointerLibIdt/= PeiServicesTablePointerLibIdt.inf=0D + PeiServicesLib|MdePkg/Library/PeiServicesLib/PeiServicesLib.inf=0D + MemoryAllocationLib|MdePkg/Library/PeiMemoryAllocationLib/PeiMemoryAlloc= ationLib.inf=0D + PeimEntryPoint|MdePkg/Library/PeimEntryPoint/PeimEntryPoint.inf=0D + ReportStatusCodeLib|MdeModulePkg/Library/PeiReportStatusCodeLib/PeiRepor= tStatusCodeLib.inf=0D + OemHookStatusCodeLib|MdeModulePkg/Library/OemHookStatusCodeLibNull/OemHo= okStatusCodeLibNull.inf=0D + PeCoffGetEntryPointLib|MdePkg/Library/BasePeCoffGetEntryPointLib/BasePeC= offGetEntryPointLib.inf=0D +!ifdef $(DEBUG_ON_SERIAL_PORT)=0D + DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.in= f=0D +!else=0D + DebugLib|OvmfPkg/Library/PlatformDebugLibIoPort/PlatformDebugLibIoPort.i= nf=0D +!endif=0D + PeCoffLib|MdePkg/Library/BasePeCoffLib/BasePeCoffLib.inf=0D + ResourcePublicationLib|MdePkg/Library/PeiResourcePublicationLib/PeiResou= rcePublicationLib.inf=0D + ExtractGuidedSectionLib|MdePkg/Library/PeiExtractGuidedSectionLib/PeiExt= ractGuidedSectionLib.inf=0D +!if $(SOURCE_DEBUG_ENABLE) =3D=3D TRUE=0D + DebugAgentLib|SourceLevelDebugPkg/Library/DebugAgent/SecPeiDebugAgentLib= .inf=0D +!endif=0D + CpuExceptionHandlerLib|UefiCpuPkg/Library/CpuExceptionHandlerLib/PeiCpuE= xceptionHandlerLib.inf=0D + PcdLib|MdePkg/Library/PeiPcdLib/PeiPcdLib.inf=0D + QemuFwCfgLib|OvmfPkg/Library/QemuFwCfgLibNull/QemuFwCfgPeiLibNull.inf=0D + QemuFwCfgS3Lib|OvmfPkg/Library/QemuFwCfgS3LibNull/PeiQemuFwCfgS3LibFwCfg= Null.inf=0D +=0D +!if $(TPM_ENABLE) =3D=3D TRUE=0D + BaseCryptLib|CryptoPkg/Library/BaseCryptLib/PeiCryptLib.inf=0D + Tpm2DeviceLib|SecurityPkg/Library/Tpm2DeviceLibDTpm/Tpm2DeviceLibDTpm.in= f=0D +!endif=0D +=0D +[LibraryClasses.common.DXE_CORE]=0D + HobLib|MdePkg/Library/DxeCoreHobLib/DxeCoreHobLib.inf=0D + DxeCoreEntryPoint|MdePkg/Library/DxeCoreEntryPoint/DxeCoreEntryPoint.inf= =0D + MemoryAllocationLib|MdeModulePkg/Library/DxeCoreMemoryAllocationLib/DxeC= oreMemoryAllocationLib.inf=0D + ReportStatusCodeLib|MdeModulePkg/Library/DxeReportStatusCodeLib/DxeRepor= tStatusCodeLib.inf=0D +!ifdef $(DEBUG_ON_SERIAL_PORT)=0D + DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.in= f=0D +!else=0D + DebugLib|OvmfPkg/Library/PlatformDebugLibIoPort/PlatformDebugLibIoPort.i= nf=0D +!endif=0D + ExtractGuidedSectionLib|MdePkg/Library/DxeExtractGuidedSectionLib/DxeExt= ractGuidedSectionLib.inf=0D +!if $(SOURCE_DEBUG_ENABLE) =3D=3D TRUE=0D + DebugAgentLib|SourceLevelDebugPkg/Library/DebugAgent/DxeDebugAgentLib.in= f=0D +!endif=0D + CpuExceptionHandlerLib|UefiCpuPkg/Library/CpuExceptionHandlerLib/DxeCpuE= xceptionHandlerLib.inf=0D + PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf=0D +=0D +[LibraryClasses.common.DXE_RUNTIME_DRIVER]=0D + PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf=0D + HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf=0D + DxeCoreEntryPoint|MdePkg/Library/DxeCoreEntryPoint/DxeCoreEntryPoint.inf= =0D + MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAll= ocationLib.inf=0D + ReportStatusCodeLib|MdeModulePkg/Library/RuntimeDxeReportStatusCodeLib/R= untimeDxeReportStatusCodeLib.inf=0D +!ifdef $(DEBUG_ON_SERIAL_PORT)=0D + DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.in= f=0D +!else=0D + DebugLib|OvmfPkg/Library/PlatformDebugLibIoPort/PlatformDebugLibIoPort.i= nf=0D +!endif=0D + UefiRuntimeLib|MdePkg/Library/UefiRuntimeLib/UefiRuntimeLib.inf=0D + BaseCryptLib|CryptoPkg/Library/BaseCryptLib/RuntimeCryptLib.inf=0D + PciLib|OvmfPkg/Library/DxePciLibI440FxQ35/DxePciLibI440FxQ35.inf=0D + QemuFwCfgS3Lib|OvmfPkg/Library/QemuFwCfgS3LibNull/DxeQemuFwCfgS3LibFwCfg= Null.inf=0D +=0D +[LibraryClasses.common.UEFI_DRIVER]=0D + PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf=0D + HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf=0D + DxeCoreEntryPoint|MdePkg/Library/DxeCoreEntryPoint/DxeCoreEntryPoint.inf= =0D + MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAll= ocationLib.inf=0D + ReportStatusCodeLib|MdeModulePkg/Library/DxeReportStatusCodeLib/DxeRepor= tStatusCodeLib.inf=0D +!ifdef $(DEBUG_ON_SERIAL_PORT)=0D + DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.in= f=0D +!else=0D + DebugLib|OvmfPkg/Library/PlatformDebugLibIoPort/PlatformDebugLibIoPort.i= nf=0D +!endif=0D + UefiScsiLib|MdePkg/Library/UefiScsiLib/UefiScsiLib.inf=0D + PciLib|OvmfPkg/Library/DxePciLibI440FxQ35/DxePciLibI440FxQ35.inf=0D +=0D +[LibraryClasses.common.DXE_DRIVER]=0D + PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf=0D + HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf=0D + MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAll= ocationLib.inf=0D + ReportStatusCodeLib|MdeModulePkg/Library/DxeReportStatusCodeLib/DxeRepor= tStatusCodeLib.inf=0D + UefiScsiLib|MdePkg/Library/UefiScsiLib/UefiScsiLib.inf=0D +!ifdef $(DEBUG_ON_SERIAL_PORT)=0D + DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.in= f=0D +!else=0D + DebugLib|OvmfPkg/Library/PlatformDebugLibIoPort/PlatformDebugLibIoPort.i= nf=0D +!endif=0D + PlatformBootManagerLib|BhyvePkg/Library/PlatformBootManagerLib/PlatformB= ootManagerLib.inf=0D + PlatformBmPrintScLib|OvmfPkg/Library/PlatformBmPrintScLib/PlatformBmPrin= tScLib.inf=0D + CpuExceptionHandlerLib|UefiCpuPkg/Library/CpuExceptionHandlerLib/DxeCpuE= xceptionHandlerLib.inf=0D + LockBoxLib|OvmfPkg/Library/LockBoxLib/LockBoxDxeLib.inf=0D +!if $(SOURCE_DEBUG_ENABLE) =3D=3D TRUE=0D + DebugAgentLib|SourceLevelDebugPkg/Library/DebugAgent/DxeDebugAgentLib.in= f=0D +!endif=0D + PciLib|OvmfPkg/Library/DxePciLibI440FxQ35/DxePciLibI440FxQ35.inf=0D + MpInitLib|UefiCpuPkg/Library/MpInitLibUp/MpInitLibUp.inf=0D + QemuFwCfgS3Lib|OvmfPkg/Library/QemuFwCfgS3LibNull/DxeQemuFwCfgS3LibFwCfg= Null.inf=0D +!if $(TPM_ENABLE) =3D=3D TRUE=0D + Tpm2DeviceLib|SecurityPkg/Library/Tpm2DeviceLibTcg2/Tpm2DeviceLibTcg2.in= f=0D +!endif=0D +=0D +[LibraryClasses.common.UEFI_APPLICATION]=0D + PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf=0D + HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf=0D + MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAll= ocationLib.inf=0D + ReportStatusCodeLib|MdeModulePkg/Library/DxeReportStatusCodeLib/DxeRepor= tStatusCodeLib.inf=0D +!ifdef $(DEBUG_ON_SERIAL_PORT)=0D + DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.in= f=0D +!else=0D + DebugLib|OvmfPkg/Library/PlatformDebugLibIoPort/PlatformDebugLibIoPort.i= nf=0D +!endif=0D + PciLib|OvmfPkg/Library/DxePciLibI440FxQ35/DxePciLibI440FxQ35.inf=0D +=0D +[LibraryClasses.common.DXE_SMM_DRIVER]=0D + PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf=0D + MemoryAllocationLib|MdePkg/Library/SmmMemoryAllocationLib/SmmMemoryAlloc= ationLib.inf=0D + ReportStatusCodeLib|MdeModulePkg/Library/DxeReportStatusCodeLib/DxeRepor= tStatusCodeLib.inf=0D + HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf=0D + SmmMemLib|MdePkg/Library/SmmMemLib/SmmMemLib.inf=0D + MmServicesTableLib|MdePkg/Library/MmServicesTableLib/MmServicesTableLib.= inf=0D + SmmServicesTableLib|MdePkg/Library/SmmServicesTableLib/SmmServicesTableL= ib.inf=0D +!ifdef $(DEBUG_ON_SERIAL_PORT)=0D + DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.in= f=0D +!else=0D + DebugLib|OvmfPkg/Library/PlatformDebugLibIoPort/PlatformDebugLibIoPort.i= nf=0D +!endif=0D + CpuExceptionHandlerLib|UefiCpuPkg/Library/CpuExceptionHandlerLib/SmmCpuE= xceptionHandlerLib.inf=0D +!if $(SOURCE_DEBUG_ENABLE) =3D=3D TRUE=0D + DebugAgentLib|SourceLevelDebugPkg/Library/DebugAgent/SmmDebugAgentLib.in= f=0D +!endif=0D + BaseCryptLib|CryptoPkg/Library/BaseCryptLib/SmmCryptLib.inf=0D + PciLib|OvmfPkg/Library/DxePciLibI440FxQ35/DxePciLibI440FxQ35.inf=0D +=0D +[LibraryClasses.common.SMM_CORE]=0D + PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf=0D + SmmCorePlatformHookLib|MdeModulePkg/Library/SmmCorePlatformHookLibNull/S= mmCorePlatformHookLibNull.inf=0D + MemoryAllocationLib|MdeModulePkg/Library/PiSmmCoreMemoryAllocationLib/Pi= SmmCoreMemoryAllocationLib.inf=0D + ReportStatusCodeLib|MdeModulePkg/Library/DxeReportStatusCodeLib/DxeRepor= tStatusCodeLib.inf=0D + HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf=0D + SmmMemLib|MdePkg/Library/SmmMemLib/SmmMemLib.inf=0D + SmmServicesTableLib|MdeModulePkg/Library/PiSmmCoreSmmServicesTableLib/Pi= SmmCoreSmmServicesTableLib.inf=0D +!ifdef $(DEBUG_ON_SERIAL_PORT)=0D + DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.in= f=0D +!else=0D + DebugLib|OvmfPkg/Library/PlatformDebugLibIoPort/PlatformDebugLibIoPort.i= nf=0D +!endif=0D + PciLib|OvmfPkg/Library/DxePciLibI440FxQ35/DxePciLibI440FxQ35.inf=0D +=0D +##########################################################################= ######=0D +#=0D +# Pcd Section - list of all EDK II PCD Entries defined by this Platform.=0D +#=0D +##########################################################################= ######=0D +[PcdsFeatureFlag]=0D + gEfiMdeModulePkgTokenSpaceGuid.PcdHiiOsRuntimeSupport|FALSE=0D + gEfiMdeModulePkgTokenSpaceGuid.PcdStatusCodeUseSerial|FALSE=0D + gEfiMdeModulePkgTokenSpaceGuid.PcdStatusCodeUseMemory|TRUE=0D + gEfiMdeModulePkgTokenSpaceGuid.PcdDxeIplSupportUefiDecompress|FALSE=0D + gEfiMdeModulePkgTokenSpaceGuid.PcdDxeIplSwitchToLongMode|FALSE=0D + gEfiMdeModulePkgTokenSpaceGuid.PcdConOutGopSupport|TRUE=0D + gEfiMdeModulePkgTokenSpaceGuid.PcdConOutUgaSupport|FALSE=0D + gEfiMdeModulePkgTokenSpaceGuid.PcdInstallAcpiSdtProtocol|TRUE=0D +=0D +[PcdsFixedAtBuild]=0D + gEfiMdeModulePkgTokenSpaceGuid.PcdStatusCodeMemorySize|1=0D + gEfiMdeModulePkgTokenSpaceGuid.PcdResetOnMemoryTypeInformationChange|FAL= SE=0D + gEfiMdePkgTokenSpaceGuid.PcdMaximumGuidedExtractHandler|0x10=0D +!if ($(FD_SIZE_IN_KB) =3D=3D 1024) || ($(FD_SIZE_IN_KB) =3D=3D 2048)=0D + gEfiMdeModulePkgTokenSpaceGuid.PcdMaxVariableSize|0x2000=0D + gEfiMdeModulePkgTokenSpaceGuid.PcdMaxAuthVariableSize|0x2800=0D +!if $(NETWORK_TLS_ENABLE) =3D=3D FALSE=0D + # match PcdFlashNvStorageVariableSize purely for convenience=0D + gEfiMdeModulePkgTokenSpaceGuid.PcdVariableStoreSize|0xe000=0D +!endif=0D +!endif=0D +!if $(FD_SIZE_IN_KB) =3D=3D 4096=0D + gEfiMdeModulePkgTokenSpaceGuid.PcdMaxVariableSize|0x8400=0D + gEfiMdeModulePkgTokenSpaceGuid.PcdMaxAuthVariableSize|0x8400=0D +!if $(NETWORK_TLS_ENABLE) =3D=3D FALSE=0D + # match PcdFlashNvStorageVariableSize purely for convenience=0D + gEfiMdeModulePkgTokenSpaceGuid.PcdVariableStoreSize|0x40000=0D +!endif=0D +!endif=0D +!if $(NETWORK_TLS_ENABLE) =3D=3D TRUE=0D + gEfiMdeModulePkgTokenSpaceGuid.PcdVariableStoreSize|0x80000=0D + gEfiMdeModulePkgTokenSpaceGuid.PcdMaxVolatileVariableSize|0x40000=0D +!endif=0D +=0D + gEfiMdeModulePkgTokenSpaceGuid.PcdVpdBaseAddress|0x0=0D +=0D + gEfiMdePkgTokenSpaceGuid.PcdReportStatusCodePropertyMask|0x07=0D +=0D + # DEBUG_INIT 0x00000001 // Initialization=0D + # DEBUG_WARN 0x00000002 // Warnings=0D + # DEBUG_LOAD 0x00000004 // Load events=0D + # DEBUG_FS 0x00000008 // EFI File system=0D + # DEBUG_POOL 0x00000010 // Alloc & Free (pool)=0D + # DEBUG_PAGE 0x00000020 // Alloc & Free (page)=0D + # DEBUG_INFO 0x00000040 // Informational debug messages=0D + # DEBUG_DISPATCH 0x00000080 // PEI/DXE/SMM Dispatchers=0D + # DEBUG_VARIABLE 0x00000100 // Variable=0D + # DEBUG_BM 0x00000400 // Boot Manager=0D + # DEBUG_BLKIO 0x00001000 // BlkIo Driver=0D + # DEBUG_NET 0x00004000 // SNP Driver=0D + # DEBUG_UNDI 0x00010000 // UNDI Driver=0D + # DEBUG_LOADFILE 0x00020000 // LoadFile=0D + # DEBUG_EVENT 0x00080000 // Event messages=0D + # DEBUG_GCD 0x00100000 // Global Coherency Database changes=0D + # DEBUG_CACHE 0x00200000 // Memory range cachability changes=0D + # DEBUG_VERBOSE 0x00400000 // Detailed debug messages that may=0D + # // significantly impact boot performance=0D + # DEBUG_ERROR 0x80000000 // Error=0D + gEfiMdePkgTokenSpaceGuid.PcdDebugPrintErrorLevel|0x8000004F=0D +=0D +!if $(SOURCE_DEBUG_ENABLE) =3D=3D TRUE=0D + gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask|0x17=0D +!else=0D + gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask|0x2F=0D +!endif=0D +=0D + # This PCD is used to set the base address of the PCI express hierarchy.= It=0D + # is only consulted when OVMF runs on Q35. In that case it is programmed= into=0D + # the PCIEXBAR register.=0D + #=0D + # On Q35 machine types that QEMU intends to support in the long term, QE= MU=0D + # never lets the RAM below 4 GB exceed 2816 MB.=0D + gEfiMdePkgTokenSpaceGuid.PcdPciExpressBaseAddress|0xB0000000=0D +=0D +!if $(SOURCE_DEBUG_ENABLE) =3D=3D TRUE=0D + gEfiSourceLevelDebugPkgTokenSpaceGuid.PcdDebugLoadImageMethod|0x2=0D +!endif=0D +=0D + #=0D + # Network Pcds=0D + #=0D +!include NetworkPkg/NetworkPcds.dsc.inc=0D +=0D + # Point to the MdeModulePkg/Application/UiApp/UiApp.inf=0D + gEfiMdeModulePkgTokenSpaceGuid.PcdBootManagerMenuFile|{ 0x21, 0xaa, 0x2c= , 0x46, 0x14, 0x76, 0x03, 0x45, 0x83, 0x6e, 0x8a, 0xb6, 0xf4, 0x66, 0x23, 0= x31 }=0D +=0D + gEfiMdeModulePkgTokenSpaceGuid.PcdConInConnectOnDemand|FALSE=0D +=0D + gEfiMdeModulePkgTokenSpaceGuid.PcdFirmwareVendor|L"BHYVE"=0D +=0D +##########################################################################= ######=0D +#=0D +# Pcd Dynamic Section - list of all EDK II PCD Entries defined by this Pla= tform=0D +#=0D +##########################################################################= ######=0D +=0D +[PcdsDynamicDefault]=0D + # only set when=0D + # ($(SMM_REQUIRE) =3D=3D FALSE)=0D + gEfiMdeModulePkgTokenSpaceGuid.PcdEmuVariableNvStoreReserved|0=0D +=0D + gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase64|0=0D + gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingBase|0=0D + gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareBase|0=0D + gEfiMdeModulePkgTokenSpaceGuid.PcdPciDisableBusEnumeration|TRUE=0D + gEfiMdeModulePkgTokenSpaceGuid.PcdVideoHorizontalResolution|800=0D + gEfiMdeModulePkgTokenSpaceGuid.PcdVideoVerticalResolution|600=0D + gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiS3Enable|FALSE=0D + gUefiOvmfPkgTokenSpaceGuid.PcdOvmfHostBridgePciDevId|0=0D + gUefiOvmfPkgTokenSpaceGuid.PcdPciIoBase|0x0=0D + gUefiOvmfPkgTokenSpaceGuid.PcdPciIoSize|0x0=0D + gUefiOvmfPkgTokenSpaceGuid.PcdPciMmio32Base|0x0=0D + gUefiOvmfPkgTokenSpaceGuid.PcdPciMmio32Size|0x0=0D + gUefiOvmfPkgTokenSpaceGuid.PcdPciMmio64Base|0x0=0D + gUefiOvmfPkgTokenSpaceGuid.PcdPciMmio64Size|0x800000000=0D +=0D + gEfiMdePkgTokenSpaceGuid.PcdPlatformBootTimeOut|0=0D +=0D + # Set video resolution for text setup.=0D + gEfiMdeModulePkgTokenSpaceGuid.PcdSetupVideoHorizontalResolution|640=0D + gEfiMdeModulePkgTokenSpaceGuid.PcdSetupVideoVerticalResolution|480=0D +=0D + gEfiMdeModulePkgTokenSpaceGuid.PcdSmbiosVersion|0x0208=0D + gEfiMdeModulePkgTokenSpaceGuid.PcdSmbiosDocRev|0x0=0D + gUefiOvmfPkgTokenSpaceGuid.PcdQemuSmbiosValidated|FALSE=0D +=0D + # Noexec settings for DXE.=0D + gEfiMdeModulePkgTokenSpaceGuid.PcdSetNxForStack|FALSE=0D +=0D + # UefiCpuPkg PCDs related to initial AP bringup and general AP managemen= t.=0D + gUefiCpuPkgTokenSpaceGuid.PcdCpuMaxLogicalProcessorNumber|64=0D + gUefiCpuPkgTokenSpaceGuid.PcdCpuApInitTimeOutInMicroSeconds|50000=0D +=0D + # Set memory encryption mask=0D + gEfiMdeModulePkgTokenSpaceGuid.PcdPteMemoryEncryptionAddressOrMask|0x0=0D +=0D + gEfiSecurityPkgTokenSpaceGuid.PcdOptionRomImageVerificationPolicy|0x00=0D +=0D +!if $(TPM_ENABLE) =3D=3D TRUE=0D + gEfiSecurityPkgTokenSpaceGuid.PcdTpmInstanceGuid|{0x00, 0x00, 0x00, 0x00= , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}=0D +!endif=0D +=0D + # MdeModulePkg resolution sets up the system display resolution=0D + gEfiMdeModulePkgTokenSpaceGuid.PcdVideoHorizontalResolution|0=0D + gEfiMdeModulePkgTokenSpaceGuid.PcdVideoVerticalResolution|0=0D + gEfiMdeModulePkgTokenSpaceGuid.PcdConOutRow|0=0D + gEfiMdeModulePkgTokenSpaceGuid.PcdConOutColumn|0=0D +=0D +[PcdsDynamicHii]=0D +!if $(TPM_ENABLE) =3D=3D TRUE && $(TPM_CONFIG_ENABLE) =3D=3D TRUE=0D + gEfiSecurityPkgTokenSpaceGuid.PcdTcgPhysicalPresenceInterfaceVer|L"TCG2_= VERSION"|gTcg2ConfigFormSetGuid|0x0|"1.3"|NV,BS=0D + gEfiSecurityPkgTokenSpaceGuid.PcdTpm2AcpiTableRev|L"TCG2_VERSION"|gTcg2C= onfigFormSetGuid|0x8|3|NV,BS=0D +!endif=0D +=0D +##########################################################################= ######=0D +#=0D +# Components Section - list of all EDK II Modules needed by this Platform.= =0D +#=0D +##########################################################################= ######=0D +[Components]=0D + OvmfPkg/ResetVector/ResetVector.inf=0D +=0D + #=0D + # SEC Phase modules=0D + #=0D + OvmfPkg/Sec/SecMain.inf {=0D + =0D + NULL|MdeModulePkg/Library/LzmaCustomDecompressLib/LzmaCustomDecompre= ssLib.inf=0D + }=0D +=0D + #=0D + # PEI Phase modules=0D + #=0D + MdeModulePkg/Core/Pei/PeiMain.inf=0D + MdeModulePkg/Universal/PCD/Pei/Pcd.inf {=0D + =0D + PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf=0D + }=0D + MdeModulePkg/Universal/ReportStatusCodeRouter/Pei/ReportStatusCodeRouter= Pei.inf {=0D + =0D + PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf=0D + }=0D + MdeModulePkg/Universal/StatusCodeHandler/Pei/StatusCodeHandlerPei.inf {= =0D + =0D + PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf=0D + }=0D + MdeModulePkg/Core/DxeIplPeim/DxeIpl.inf=0D +=0D + OvmfPkg/PlatformPei/PlatformPeiBhyve.inf=0D + UefiCpuPkg/Universal/Acpi/S3Resume2Pei/S3Resume2Pei.inf {=0D + =0D + }=0D +=0D +!if $(TPM_ENABLE) =3D=3D TRUE=0D + BhyvePkg/Tcg/Tcg2Config/Tcg2ConfigPei.inf=0D + SecurityPkg/Tcg/Tcg2Pei/Tcg2Pei.inf {=0D + =0D + HashLib|SecurityPkg/Library/HashLibBaseCryptoRouter/HashLibBaseCrypt= oRouterPei.inf=0D + NULL|SecurityPkg/Library/HashInstanceLibSha1/HashInstanceLibSha1.inf= =0D + NULL|SecurityPkg/Library/HashInstanceLibSha256/HashInstanceLibSha256= .inf=0D + NULL|SecurityPkg/Library/HashInstanceLibSha384/HashInstanceLibSha384= .inf=0D + NULL|SecurityPkg/Library/HashInstanceLibSha512/HashInstanceLibSha512= .inf=0D + NULL|SecurityPkg/Library/HashInstanceLibSm3/HashInstanceLibSm3.inf=0D + }=0D +!endif=0D +=0D + #=0D + # DXE Phase modules=0D + #=0D + MdeModulePkg/Core/Dxe/DxeMain.inf {=0D + =0D + NULL|MdeModulePkg/Library/LzmaCustomDecompressLib/LzmaCustomDecompre= ssLib.inf=0D + DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf= =0D + }=0D +=0D + MdeModulePkg/Universal/ReportStatusCodeRouter/RuntimeDxe/ReportStatusCod= eRouterRuntimeDxe.inf=0D + MdeModulePkg/Universal/StatusCodeHandler/RuntimeDxe/StatusCodeHandlerRun= timeDxe.inf=0D + MdeModulePkg/Universal/PCD/Dxe/Pcd.inf {=0D + =0D + PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf=0D + }=0D +=0D + MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf=0D +=0D + MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf {=0D + =0D +!if $(SECURE_BOOT_ENABLE) =3D=3D TRUE=0D + NULL|SecurityPkg/Library/DxeImageVerificationLib/DxeImageVerificatio= nLib.inf=0D +!endif=0D +!if $(TPM_ENABLE) =3D=3D TRUE=0D + NULL|SecurityPkg/Library/DxeTpm2MeasureBootLib/DxeTpm2MeasureBootLib= .inf=0D +!endif=0D + }=0D +=0D + MdeModulePkg/Universal/EbcDxe/EbcDxe.inf=0D + UefiCpuPkg/CpuIo2Dxe/CpuIo2Dxe.inf=0D + UefiCpuPkg/CpuDxe/CpuDxe.inf=0D + PcAtChipsetPkg/HpetTimerDxe/HpetTimerDxe.inf=0D + OvmfPkg/IncompatiblePciDeviceSupportDxe/IncompatiblePciDeviceSupport.inf= =0D + OvmfPkg/PciHotPlugInitDxe/PciHotPlugInit.inf=0D + MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciHostBridgeDxe.inf {=0D + =0D + PciHostBridgeLib|OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.i= nf=0D + NULL|OvmfPkg/Library/PlatformHasIoMmuLib/PlatformHasIoMmuLib.inf=0D + }=0D + MdeModulePkg/Bus/Pci/PciBusDxe/PciBusDxe.inf {=0D + =0D + PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf=0D + }=0D + MdeModulePkg/Universal/ResetSystemRuntimeDxe/ResetSystemRuntimeDxe.inf=0D + MdeModulePkg/Universal/Metronome/Metronome.inf=0D + PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcatRealTimeClockRuntimeDxe.i= nf=0D + MdeModulePkg/Universal/DriverHealthManagerDxe/DriverHealthManagerDxe.inf= =0D + MdeModulePkg/Universal/BdsDxe/BdsDxe.inf {=0D + =0D +!ifdef $(CSM_ENABLE)=0D + NULL|BhyvePkg/Csm/CsmSupportLib/CsmSupportLib.inf=0D + NULL|OvmfPkg/Csm/LegacyBootManagerLib/LegacyBootManagerLib.inf=0D +!endif=0D + }=0D + MdeModulePkg/Logo/LogoDxe.inf=0D + MdeModulePkg/Application/UiApp/UiApp.inf {=0D + =0D + NULL|MdeModulePkg/Library/DeviceManagerUiLib/DeviceManagerUiLib.inf= =0D + NULL|MdeModulePkg/Library/BootManagerUiLib/BootManagerUiLib.inf=0D + NULL|MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanc= eManagerUiLib.inf=0D +!ifdef $(CSM_ENABLE)=0D + NULL|OvmfPkg/Csm/LegacyBootManagerLib/LegacyBootManagerLib.inf=0D + NULL|OvmfPkg/Csm/LegacyBootMaintUiLib/LegacyBootMaintUiLib.inf=0D +!endif=0D + }=0D + OvmfPkg/VirtioPciDeviceDxe/VirtioPciDeviceDxe.inf=0D + OvmfPkg/Virtio10Dxe/Virtio10.inf=0D + OvmfPkg/VirtioBlkDxe/VirtioBlk.inf=0D + OvmfPkg/VirtioScsiDxe/VirtioScsi.inf=0D + OvmfPkg/VirtioRngDxe/VirtioRng.inf=0D + MdeModulePkg/Universal/WatchdogTimerDxe/WatchdogTimer.inf=0D + MdeModulePkg/Universal/MonotonicCounterRuntimeDxe/MonotonicCounterRuntim= eDxe.inf=0D + MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleRuntimeDxe.inf=0D + MdeModulePkg/Universal/Console/ConPlatformDxe/ConPlatformDxe.inf=0D + MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitterDxe.inf=0D + MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsoleDxe.inf= {=0D + =0D + PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf=0D + }=0D + MdeModulePkg/Universal/Console/TerminalDxe/TerminalDxe.inf=0D + MdeModulePkg/Universal/DevicePathDxe/DevicePathDxe.inf {=0D + =0D + DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf= =0D + PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf=0D + }=0D + MdeModulePkg/Universal/PrintDxe/PrintDxe.inf=0D + MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIoDxe.inf=0D + MdeModulePkg/Universal/Disk/PartitionDxe/PartitionDxe.inf=0D + MdeModulePkg/Universal/Disk/RamDiskDxe/RamDiskDxe.inf=0D + MdeModulePkg/Universal/Disk/UnicodeCollation/EnglishDxe/EnglishDxe.inf=0D + FatPkg/EnhancedFatDxe/Fat.inf=0D + MdeModulePkg/Universal/Disk/UdfDxe/UdfDxe.inf=0D + MdeModulePkg/Bus/Scsi/ScsiBusDxe/ScsiBusDxe.inf=0D + MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDiskDxe.inf=0D + OvmfPkg/SataControllerDxe/SataControllerDxe.inf=0D + MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AtaAtapiPassThru.inf=0D + MdeModulePkg/Bus/Ata/AtaBusDxe/AtaBusDxe.inf=0D + MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpressDxe.inf=0D + MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseDxe.inf=0D + MdeModulePkg/Universal/SetupBrowserDxe/SetupBrowserDxe.inf=0D + MdeModulePkg/Universal/DisplayEngineDxe/DisplayEngineDxe.inf=0D + MdeModulePkg/Universal/MemoryTest/NullMemoryTestDxe/NullMemoryTestDxe.in= f=0D +=0D + BhyvePkg/BhyveRfbDxe/BhyveRfbDxe.inf {=0D + =0D + BltLib|MdeModulePkg/Library/FrameBufferBltLib/FrameBufferBltLib.inf= =0D + PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf=0D + }=0D +=0D + #=0D + # ISA Support=0D + #=0D + OvmfPkg/SioBusDxe/SioBusDxe.inf=0D + MdeModulePkg/Bus/Pci/PciSioSerialDxe/PciSioSerialDxe.inf=0D + MdeModulePkg/Bus/Isa/Ps2KeyboardDxe/Ps2KeyboardDxe.inf=0D + MdeModulePkg/Bus/Isa/Ps2MouseDxe/Ps2MouseDxe.inf=0D +=0D + #=0D + # SMBIOS Support=0D + #=0D + MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.inf=0D + BhyvePkg/SmbiosPlatformDxe/SmbiosPlatformDxe.inf=0D +=0D + #=0D + # ACPI Support=0D + #=0D + MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf=0D + OvmfPkg/AcpiPlatformDxe/AcpiPlatformDxeBhyve.inf=0D + BhyvePkg/AcpiTables/AcpiTables.inf=0D + MdeModulePkg/Universal/Acpi/S3SaveStateDxe/S3SaveStateDxe.inf=0D + MdeModulePkg/Universal/Acpi/BootScriptExecutorDxe/BootScriptExecutorDxe.= inf=0D + MdeModulePkg/Universal/Acpi/BootGraphicsResourceTableDxe/BootGraphicsRes= ourceTableDxe.inf=0D +=0D + #=0D + # Network Support=0D + #=0D +!include NetworkPkg/NetworkComponents.dsc.inc=0D +=0D +!if $(NETWORK_TLS_ENABLE) =3D=3D TRUE=0D + NetworkPkg/TlsAuthConfigDxe/TlsAuthConfigDxe.inf {=0D + =0D + NULL|BhyvePkg/Library/TlsAuthConfigLib/TlsAuthConfigLib.inf=0D + }=0D +!endif=0D + OvmfPkg/VirtioNetDxe/VirtioNet.inf=0D +=0D + #=0D + # Usb Support=0D + #=0D +# MdeModulePkg/Bus/Pci/XhciDxe/XhciDxe.inf=0D +# MdeModulePkg/Bus/Usb/UsbBusDxe/UsbBusDxe.inf=0D +=0D +!ifdef $(CSM_ENABLE)=0D + IntelFrameworkModulePkg/Csm/BiosThunk/VideoDxe/VideoDxe.inf {=0D + =0D + PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf=0D + }=0D +!endif=0D +# OvmfPkg/Csm/LegacyBiosDxe/LegacyBiosDxe.inf=0D +!ifdef $(CSM_ENABLE)=0D + BhyvePkg/Csm/BhyveCsm16/BhyveCsm16.inf=0D +!endif=0D +=0D +!if $(TOOL_CHAIN_TAG) !=3D "XCODE5"=0D + ShellPkg/DynamicCommand/TftpDynamicCommand/TftpDynamicCommand.inf {=0D + =0D + gEfiShellPkgTokenSpaceGuid.PcdShellLibAutoInitialize|FALSE=0D + }=0D +!endif=0D + ShellPkg/Application/Shell/Shell.inf {=0D + =0D + ShellCommandLib|ShellPkg/Library/UefiShellCommandLib/UefiShellComman= dLib.inf=0D + NULL|ShellPkg/Library/UefiShellLevel2CommandsLib/UefiShellLevel2Comm= andsLib.inf=0D + NULL|ShellPkg/Library/UefiShellLevel1CommandsLib/UefiShellLevel1Comm= andsLib.inf=0D + NULL|ShellPkg/Library/UefiShellLevel3CommandsLib/UefiShellLevel3Comm= andsLib.inf=0D + NULL|ShellPkg/Library/UefiShellDriver1CommandsLib/UefiShellDriver1Co= mmandsLib.inf=0D + NULL|ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1Comm= andsLib.inf=0D + NULL|ShellPkg/Library/UefiShellInstall1CommandsLib/UefiShellInstall1= CommandsLib.inf=0D + NULL|ShellPkg/Library/UefiShellNetwork1CommandsLib/UefiShellNetwork1= CommandsLib.inf=0D +!if $(NETWORK_IP6_ENABLE) =3D=3D TRUE=0D + NULL|ShellPkg/Library/UefiShellNetwork2CommandsLib/UefiShellNetwork2= CommandsLib.inf=0D +!endif=0D + HandleParsingLib|ShellPkg/Library/UefiHandleParsingLib/UefiHandlePar= singLib.inf=0D + PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf=0D + BcfgCommandLib|ShellPkg/Library/UefiShellBcfgCommandLib/UefiShellBcf= gCommandLib.inf=0D +=0D + =0D + gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask|0xFF=0D + gEfiShellPkgTokenSpaceGuid.PcdShellLibAutoInitialize|FALSE=0D + gEfiMdePkgTokenSpaceGuid.PcdUefiLibMaxPrintBufferSize|8000=0D + }=0D +=0D +!if $(SECURE_BOOT_ENABLE) =3D=3D TRUE=0D + SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigDx= e.inf=0D + OvmfPkg/EnrollDefaultKeys/EnrollDefaultKeys.inf=0D +!endif=0D +=0D + OvmfPkg/PlatformDxe/Platform.inf=0D + OvmfPkg/AmdSevDxe/AmdSevDxe.inf=0D + OvmfPkg/IoMmuDxe/IoMmuDxe.inf=0D +=0D +=0D + #=0D + # Variable driver stack (non-SMM)=0D + #=0D + OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FvbServicesRuntimeDxe.inf=0D + OvmfPkg/EmuVariableFvbRuntimeDxe/Fvb.inf {=0D + =0D + PlatformFvbLib|OvmfPkg/Library/EmuVariableFvbLib/EmuVariableFvbLib.i= nf=0D + }=0D + MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteDxe.inf=0D + MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRuntimeDxe.inf {=0D + =0D + NULL|MdeModulePkg/Library/VarCheckUefiLib/VarCheckUefiLib.inf=0D + }=0D +=0D +=0D + #=0D + # TPM support=0D + #=0D +!if $(TPM_ENABLE) =3D=3D TRUE=0D + SecurityPkg/Tcg/Tcg2Dxe/Tcg2Dxe.inf {=0D + =0D + Tpm2DeviceLib|SecurityPkg/Library/Tpm2DeviceLibRouter/Tpm2DeviceLibR= outerDxe.inf=0D + NULL|SecurityPkg/Library/Tpm2DeviceLibDTpm/Tpm2InstanceLibDTpm.inf=0D + HashLib|SecurityPkg/Library/HashLibBaseCryptoRouter/HashLibBaseCrypt= oRouterDxe.inf=0D + NULL|SecurityPkg/Library/HashInstanceLibSha1/HashInstanceLibSha1.inf= =0D + NULL|SecurityPkg/Library/HashInstanceLibSha256/HashInstanceLibSha256= .inf=0D + NULL|SecurityPkg/Library/HashInstanceLibSha384/HashInstanceLibSha384= .inf=0D + NULL|SecurityPkg/Library/HashInstanceLibSha512/HashInstanceLibSha512= .inf=0D + NULL|SecurityPkg/Library/HashInstanceLibSm3/HashInstanceLibSm3.inf=0D + }=0D +!if $(TPM_CONFIG_ENABLE) =3D=3D TRUE=0D + SecurityPkg/Tcg/Tcg2Config/Tcg2ConfigDxe.inf=0D +!endif=0D +!endif=0D diff --git a/BhyvePkg/BhyvePkgX64.fdf b/BhyvePkg/BhyvePkgX64.fdf new file mode 100644 index 0000000000..49a15ddccb --- /dev/null +++ b/BhyvePkg/BhyvePkgX64.fdf @@ -0,0 +1,529 @@ +#=0D +# Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.
= =0D +# (C) Copyright 2016 Hewlett Packard Enterprise Development LP
=0D +# Copyright (c) 2014, Pluribus Networks, Inc.=0D +#=0D +# This program and the accompanying materials=0D +# are licensed and made available under the terms and conditions of the B= SD License=0D +# which accompanies this distribution. The full text of the license may b= e found at=0D +# http://opensource.org/licenses/bsd-license.php=0D +#=0D +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,=0D +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IM= PLIED.=0D +#=0D +##=0D +=0D +##########################################################################= ######=0D +=0D +[Defines]=0D +!include BhyvePkg.fdf.inc=0D +=0D +#=0D +# Build the variable store and the firmware code as one unified flash devi= ce=0D +# image.=0D +#=0D +[FD.BHYVE]=0D +BaseAddress =3D $(FW_BASE_ADDRESS)=0D +Size =3D $(FW_SIZE)=0D +ErasePolarity =3D 1=0D +BlockSize =3D $(BLOCK_SIZE)=0D +NumBlocks =3D $(FW_BLOCKS)=0D +=0D +!include VarStore.fdf.inc=0D +=0D +$(VARS_SIZE)|$(FVMAIN_SIZE)=0D +FV =3D FVMAIN_COMPACT=0D +=0D +$(SECFV_OFFSET)|$(SECFV_SIZE)=0D +FV =3D SECFV=0D +=0D +#=0D +# Build the variable store and the firmware code as separate flash device= =0D +# images.=0D +#=0D +[FD.BHYVE_VARS]=0D +BaseAddress =3D $(FW_BASE_ADDRESS)=0D +Size =3D $(VARS_SIZE)=0D +ErasePolarity =3D 1=0D +BlockSize =3D $(BLOCK_SIZE)=0D +NumBlocks =3D $(VARS_BLOCKS)=0D +=0D +!include VarStore.fdf.inc=0D +=0D +[FD.BHYVE_CODE]=0D +BaseAddress =3D $(CODE_BASE_ADDRESS)=0D +Size =3D $(CODE_SIZE)=0D +ErasePolarity =3D 1=0D +BlockSize =3D $(BLOCK_SIZE)=0D +NumBlocks =3D $(CODE_BLOCKS)=0D +=0D +0x00000000|$(FVMAIN_SIZE)=0D +FV =3D FVMAIN_COMPACT=0D +=0D +$(FVMAIN_SIZE)|$(SECFV_SIZE)=0D +FV =3D SECFV=0D +=0D +##########################################################################= ######=0D +=0D +[FD.MEMFD]=0D +BaseAddress =3D $(MEMFD_BASE_ADDRESS)=0D +Size =3D 0xC00000=0D +ErasePolarity =3D 1=0D +BlockSize =3D 0x10000=0D +NumBlocks =3D 0xC0=0D +=0D +0x000000|0x006000=0D +gUefiOvmfPkgTokenSpaceGuid.PcdOvmfSecPageTablesBase|gUefiOvmfPkgTokenSpace= Guid.PcdOvmfSecPageTablesSize=0D +=0D +0x006000|0x001000=0D +gUefiOvmfPkgTokenSpaceGuid.PcdOvmfLockBoxStorageBase|gUefiOvmfPkgTokenSpac= eGuid.PcdOvmfLockBoxStorageSize=0D +=0D +0x007000|0x001000=0D +gEfiMdePkgTokenSpaceGuid.PcdGuidedExtractHandlerTableAddress|gUefiOvmfPkgT= okenSpaceGuid.PcdGuidedExtractHandlerTableSize=0D +=0D +0x010000|0x010000=0D +gUefiOvmfPkgTokenSpaceGuid.PcdOvmfSecPeiTempRamBase|gUefiOvmfPkgTokenSpace= Guid.PcdOvmfSecPeiTempRamSize=0D +=0D +0x020000|0x0E0000=0D +gUefiOvmfPkgTokenSpaceGuid.PcdOvmfPeiMemFvBase|gUefiOvmfPkgTokenSpaceGuid.= PcdOvmfPeiMemFvSize=0D +FV =3D PEIFV=0D +=0D +0x100000|0xB00000=0D +gUefiOvmfPkgTokenSpaceGuid.PcdOvmfDxeMemFvBase|gUefiOvmfPkgTokenSpaceGuid.= PcdOvmfDxeMemFvSize=0D +FV =3D DXEFV=0D +=0D +##########################################################################= ######=0D +=0D +[FV.SECFV]=0D +FvNameGuid =3D 763BED0D-DE9F-48F5-81F1-3E90E1B1A015=0D +BlockSize =3D 0x1000=0D +FvAlignment =3D 16=0D +ERASE_POLARITY =3D 1=0D +MEMORY_MAPPED =3D TRUE=0D +STICKY_WRITE =3D TRUE=0D +LOCK_CAP =3D TRUE=0D +LOCK_STATUS =3D TRUE=0D +WRITE_DISABLED_CAP =3D TRUE=0D +WRITE_ENABLED_CAP =3D TRUE=0D +WRITE_STATUS =3D TRUE=0D +WRITE_LOCK_CAP =3D TRUE=0D +WRITE_LOCK_STATUS =3D TRUE=0D +READ_DISABLED_CAP =3D TRUE=0D +READ_ENABLED_CAP =3D TRUE=0D +READ_STATUS =3D TRUE=0D +READ_LOCK_CAP =3D TRUE=0D +READ_LOCK_STATUS =3D TRUE=0D +=0D +#=0D +# SEC Phase modules=0D +#=0D +# The code in this FV handles the initial firmware startup, and=0D +# decompresses the PEI and DXE FVs which handles the rest of the boot sequ= ence.=0D +#=0D +INF OvmfPkg/Sec/SecMain.inf=0D +=0D +INF RuleOverride=3DRESET_VECTOR OvmfPkg/ResetVector/ResetVector.inf=0D +=0D +##########################################################################= ######=0D +[FV.PEIFV]=0D +FvNameGuid =3D 6938079B-B503-4E3D-9D24-B28337A25806=0D +BlockSize =3D 0x10000=0D +FvAlignment =3D 16=0D +ERASE_POLARITY =3D 1=0D +MEMORY_MAPPED =3D TRUE=0D +STICKY_WRITE =3D TRUE=0D +LOCK_CAP =3D TRUE=0D +LOCK_STATUS =3D TRUE=0D +WRITE_DISABLED_CAP =3D TRUE=0D +WRITE_ENABLED_CAP =3D TRUE=0D +WRITE_STATUS =3D TRUE=0D +WRITE_LOCK_CAP =3D TRUE=0D +WRITE_LOCK_STATUS =3D TRUE=0D +READ_DISABLED_CAP =3D TRUE=0D +READ_ENABLED_CAP =3D TRUE=0D +READ_STATUS =3D TRUE=0D +READ_LOCK_CAP =3D TRUE=0D +READ_LOCK_STATUS =3D TRUE=0D +=0D +APRIORI PEI {=0D + INF MdeModulePkg/Universal/PCD/Pei/Pcd.inf=0D +}=0D +=0D +#=0D +# PEI Phase modules=0D +#=0D +INF MdeModulePkg/Core/Pei/PeiMain.inf=0D +INF MdeModulePkg/Universal/PCD/Pei/Pcd.inf=0D +INF MdeModulePkg/Universal/ReportStatusCodeRouter/Pei/ReportStatusCodeRou= terPei.inf=0D +INF MdeModulePkg/Universal/StatusCodeHandler/Pei/StatusCodeHandlerPei.inf= =0D +INF OvmfPkg/PlatformPei/PlatformPeiBhyve.inf=0D +INF MdeModulePkg/Core/DxeIplPeim/DxeIpl.inf=0D +INF UefiCpuPkg/Universal/Acpi/S3Resume2Pei/S3Resume2Pei.inf=0D +!if $(SMM_REQUIRE) =3D=3D TRUE=0D +INF BhyvePkg/SmmAccess/SmmAccessPei.inf=0D +!endif=0D +=0D +!if $(TPM2_ENABLE) =3D=3D TRUE=0D +INF BhyvePkg/Tcg/Tcg2Config/Tcg2ConfigPei.inf=0D +INF SecurityPkg/Tcg/Tcg2Pei/Tcg2Pei.inf=0D +!endif=0D +=0D +##########################################################################= ######=0D +=0D +[FV.DXEFV]=0D +FvForceRebase =3D FALSE=0D +FvNameGuid =3D 7CB8BDC9-F8EB-4F34-AAEA-3EE4AF6516A1=0D +BlockSize =3D 0x10000=0D +FvAlignment =3D 16=0D +ERASE_POLARITY =3D 1=0D +MEMORY_MAPPED =3D TRUE=0D +STICKY_WRITE =3D TRUE=0D +LOCK_CAP =3D TRUE=0D +LOCK_STATUS =3D TRUE=0D +WRITE_DISABLED_CAP =3D TRUE=0D +WRITE_ENABLED_CAP =3D TRUE=0D +WRITE_STATUS =3D TRUE=0D +WRITE_LOCK_CAP =3D TRUE=0D +WRITE_LOCK_STATUS =3D TRUE=0D +READ_DISABLED_CAP =3D TRUE=0D +READ_ENABLED_CAP =3D TRUE=0D +READ_STATUS =3D TRUE=0D +READ_LOCK_CAP =3D TRUE=0D +READ_LOCK_STATUS =3D TRUE=0D +=0D +APRIORI DXE {=0D + INF MdeModulePkg/Universal/DevicePathDxe/DevicePathDxe.inf=0D + INF MdeModulePkg/Universal/PCD/Dxe/Pcd.inf=0D + INF OvmfPkg/AmdSevDxe/AmdSevDxe.inf=0D +!if $(SMM_REQUIRE) =3D=3D FALSE=0D + INF OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FvbServicesRuntimeDxe.inf=0D +!endif=0D +}=0D +=0D +#=0D +# DXE Phase modules=0D +#=0D +INF MdeModulePkg/Core/Dxe/DxeMain.inf=0D +=0D +INF MdeModulePkg/Universal/ReportStatusCodeRouter/RuntimeDxe/ReportStatus= CodeRouterRuntimeDxe.inf=0D +INF MdeModulePkg/Universal/StatusCodeHandler/RuntimeDxe/StatusCodeHandler= RuntimeDxe.inf=0D +INF MdeModulePkg/Universal/PCD/Dxe/Pcd.inf=0D +=0D +INF MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf=0D +INF MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf=0D +INF MdeModulePkg/Universal/EbcDxe/EbcDxe.inf=0D +# INF OvmfPkg/8259InterruptControllerDxe/8259.inf=0D +INF UefiCpuPkg/CpuIo2Dxe/CpuIo2Dxe.inf=0D +INF UefiCpuPkg/CpuDxe/CpuDxe.inf=0D +INF PcAtChipsetPkg/HpetTimerDxe/HpetTimerDxe.inf=0D +INF OvmfPkg/IncompatiblePciDeviceSupportDxe/IncompatiblePciDeviceSupport.= inf=0D +INF OvmfPkg/PciHotPlugInitDxe/PciHotPlugInit.inf=0D +INF MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciHostBridgeDxe.inf=0D +INF MdeModulePkg/Bus/Pci/PciBusDxe/PciBusDxe.inf=0D +INF MdeModulePkg/Universal/ResetSystemRuntimeDxe/ResetSystemRuntimeDxe.in= f=0D +INF MdeModulePkg/Universal/Metronome/Metronome.inf=0D +INF PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcatRealTimeClockRuntimeDx= e.inf=0D +=0D +INF OvmfPkg/VirtioPciDeviceDxe/VirtioPciDeviceDxe.inf=0D +INF OvmfPkg/Virtio10Dxe/Virtio10.inf=0D +INF OvmfPkg/VirtioBlkDxe/VirtioBlk.inf=0D +INF OvmfPkg/VirtioScsiDxe/VirtioScsi.inf=0D +INF OvmfPkg/VirtioRngDxe/VirtioRng.inf=0D +=0D +!if $(SECURE_BOOT_ENABLE) =3D=3D TRUE=0D + INF SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootCon= figDxe.inf=0D +!endif=0D +=0D +INF MdeModulePkg/Universal/WatchdogTimerDxe/WatchdogTimer.inf=0D +INF MdeModulePkg/Universal/MonotonicCounterRuntimeDxe/MonotonicCounterRun= timeDxe.inf=0D +INF MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleRuntimeDxe.inf=0D +INF MdeModulePkg/Universal/Console/ConPlatformDxe/ConPlatformDxe.inf=0D +INF MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitterDxe.inf=0D +INF MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsoleDxe.= inf=0D +INF MdeModulePkg/Universal/Console/TerminalDxe/TerminalDxe.inf=0D +INF MdeModulePkg/Universal/DriverHealthManagerDxe/DriverHealthManagerDxe.= inf=0D +INF MdeModulePkg/Universal/BdsDxe/BdsDxe.inf=0D +INF MdeModulePkg/Application/UiApp/UiApp.inf=0D +INF MdeModulePkg/Universal/DevicePathDxe/DevicePathDxe.inf=0D +INF MdeModulePkg/Universal/PrintDxe/PrintDxe.inf=0D +INF MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIoDxe.inf=0D +INF MdeModulePkg/Universal/Disk/PartitionDxe/PartitionDxe.inf=0D +INF MdeModulePkg/Universal/Disk/RamDiskDxe/RamDiskDxe.inf=0D +INF MdeModulePkg/Universal/Disk/UnicodeCollation/EnglishDxe/EnglishDxe.in= f=0D +INF MdeModulePkg/Bus/Scsi/ScsiBusDxe/ScsiBusDxe.inf=0D +INF MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDiskDxe.inf=0D +INF OvmfPkg/SataControllerDxe/SataControllerDxe.inf=0D +INF MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AtaAtapiPassThru.inf=0D +INF MdeModulePkg/Bus/Ata/AtaBusDxe/AtaBusDxe.inf=0D +INF MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpressDxe.inf=0D +INF MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseDxe.inf=0D +INF MdeModulePkg/Universal/SetupBrowserDxe/SetupBrowserDxe.inf=0D +INF MdeModulePkg/Universal/DisplayEngineDxe/DisplayEngineDxe.inf=0D +INF MdeModulePkg/Universal/MemoryTest/NullMemoryTestDxe/NullMemoryTestDxe= .inf=0D +=0D +=0D +INF OvmfPkg/SioBusDxe/SioBusDxe.inf=0D +INF MdeModulePkg/Bus/Pci/PciSioSerialDxe/PciSioSerialDxe.inf=0D +INF MdeModulePkg/Bus/Isa/Ps2KeyboardDxe/Ps2KeyboardDxe.inf=0D +INF MdeModulePkg/Bus/Isa/Ps2MouseDxe/Ps2MouseDxe.inf=0D +=0D +INF MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.inf=0D +INF BhyvePkg/SmbiosPlatformDxe/SmbiosPlatformDxe.inf=0D +=0D +INF MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf=0D +INF OvmfPkg/AcpiPlatformDxe/AcpiPlatformDxeBhyve.inf=0D +INF RuleOverride=3DACPITABLE BhyvePkg/AcpiTables/AcpiTables.inf=0D +INF MdeModulePkg/Universal/Acpi/S3SaveStateDxe/S3SaveStateDxe.inf=0D +INF MdeModulePkg/Universal/Acpi/BootScriptExecutorDxe/BootScriptExecutorD= xe.inf=0D +INF MdeModulePkg/Universal/Acpi/BootGraphicsResourceTableDxe/BootGraphics= ResourceTableDxe.inf=0D +=0D +INF FatPkg/EnhancedFatDxe/Fat.inf=0D +INF MdeModulePkg/Universal/Disk/UdfDxe/UdfDxe.inf=0D +=0D +!if $(TOOL_CHAIN_TAG) !=3D "XCODE5"=0D +INF ShellPkg/DynamicCommand/TftpDynamicCommand/TftpDynamicCommand.inf=0D +!endif=0D +INF ShellPkg/Application/Shell/Shell.inf=0D +=0D +INF MdeModulePkg/Logo/LogoDxe.inf=0D +=0D +#=0D +# Network modules=0D +#=0D +!if $(E1000_ENABLE)=0D + FILE DRIVER =3D 5D695E11-9B3F-4b83-B25F-4A8D5D69BE07 {=0D + SECTION PE32 =3D Intel3.5/EFIX64/E3522X2.EFI=0D + }=0D +!endif=0D + INF NetworkPkg/SnpDxe/SnpDxe.inf=0D + INF NetworkPkg/DpcDxe/DpcDxe.inf=0D + INF NetworkPkg/MnpDxe/MnpDxe.inf=0D + INF NetworkPkg/VlanConfigDxe/VlanConfigDxe.inf=0D + INF NetworkPkg/ArpDxe/ArpDxe.inf=0D + INF NetworkPkg/Dhcp4Dxe/Dhcp4Dxe.inf=0D + INF NetworkPkg/Ip4Dxe/Ip4Dxe.inf=0D + INF NetworkPkg/Mtftp4Dxe/Mtftp4Dxe.inf=0D + INF NetworkPkg/Udp4Dxe/Udp4Dxe.inf=0D + INF NetworkPkg/UefiPxeBcDxe/UefiPxeBcDxe.inf=0D + INF NetworkPkg/TcpDxe/TcpDxe.inf=0D + INF NetworkPkg/IScsiDxe/IScsiDxe.inf=0D +!if $(NETWORK_IP6_ENABLE) =3D=3D TRUE=0D + INF NetworkPkg/Ip6Dxe/Ip6Dxe.inf=0D + INF NetworkPkg/Udp6Dxe/Udp6Dxe.inf=0D + INF NetworkPkg/Dhcp6Dxe/Dhcp6Dxe.inf=0D + INF NetworkPkg/Mtftp6Dxe/Mtftp6Dxe.inf=0D +!endif=0D +!if $(HTTP_BOOT_ENABLE) =3D=3D TRUE=0D + INF NetworkPkg/DnsDxe/DnsDxe.inf=0D + INF NetworkPkg/HttpUtilitiesDxe/HttpUtilitiesDxe.inf=0D + INF NetworkPkg/HttpDxe/HttpDxe.inf=0D + INF NetworkPkg/HttpBootDxe/HttpBootDxe.inf=0D +!endif=0D +!if $(TLS_ENABLE) =3D=3D TRUE=0D + INF NetworkPkg/TlsDxe/TlsDxe.inf=0D + INF NetworkPkg/TlsAuthConfigDxe/TlsAuthConfigDxe.inf=0D +!endif=0D + INF OvmfPkg/VirtioNetDxe/VirtioNet.inf=0D +=0D +#=0D +# Usb Support=0D +#=0D +#INF MdeModulePkg/Bus/Pci/UhciDxe/UhciDxe.inf=0D +#INF MdeModulePkg/Bus/Pci/EhciDxe/EhciDxe.inf=0D +#INF MdeModulePkg/Bus/Usb/UsbBusDxe/UsbBusDxe.inf=0D +#INF MdeModulePkg/Bus/Usb/UsbKbDxe/UsbKbDxe.inf=0D +#INF MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassStorageDxe.inf=0D +=0D +!ifdef $(CSM_ENABLE)=0D +INF IntelFrameworkModulePkg/Csm/BiosThunk/VideoDxe/VideoDxe.inf=0D +!endif=0D +#INF OvmfPkg/Csm/LegacyBiosDxe/LegacyBiosDxe.inf=0D +!ifdef $(CSM_ENABLE)=0D +INF RuleOverride=3DCSM BhyvePkg/Csm/BhyveCsm16/BhyveCsm16.inf=0D +!endif=0D +=0D +INF OvmfPkg/PlatformDxe/Platform.inf=0D +INF OvmfPkg/AmdSevDxe/AmdSevDxe.inf=0D +INF OvmfPkg/IoMmuDxe/IoMmuDxe.inf=0D +INF BhyvePkg/BhyveRfbDxe/BhyveRfbDxe.inf=0D +=0D +!if $(SMM_REQUIRE) =3D=3D TRUE=0D +INF BhyvePkg/SmmAccess/SmmAccess2Dxe.inf=0D +INF BhyvePkg/SmmControl2Dxe/SmmControl2Dxe.inf=0D +INF UefiCpuPkg/CpuS3DataDxe/CpuS3DataDxe.inf=0D +INF MdeModulePkg/Core/PiSmmCore/PiSmmIpl.inf=0D +INF MdeModulePkg/Core/PiSmmCore/PiSmmCore.inf=0D +INF UefiCpuPkg/CpuIo2Smm/CpuIo2Smm.inf=0D +INF MdeModulePkg/Universal/LockBox/SmmLockBox/SmmLockBox.inf=0D +INF UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.inf=0D +=0D +#=0D +# Variable driver stack (SMM)=0D +#=0D +INF OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FvbServicesSmm.inf=0D +INF MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteSmm.in= f=0D +INF MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmm.inf=0D +INF MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmmRuntimeDxe.inf= =0D +=0D +!else=0D +=0D +#=0D +# Variable driver stack (non-SMM)=0D +#=0D +INF OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FvbServicesRuntimeDxe.inf=0D +INF OvmfPkg/EmuVariableFvbRuntimeDxe/Fvb.inf=0D +INF MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteDxe.in= f=0D +INF MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRuntimeDxe.inf=0D +!endif=0D +=0D +!if $(TPM2_ENABLE) =3D=3D TRUE=0D +INF SecurityPkg/Tcg/Tcg2Dxe/Tcg2Dxe.inf=0D +!if $(TPM2_CONFIG_ENABLE) =3D=3D TRUE=0D +INF SecurityPkg/Tcg/Tcg2Config/Tcg2ConfigDxe.inf=0D +!endif=0D +!endif=0D +=0D +##########################################################################= ######=0D +=0D +[FV.FVMAIN_COMPACT]=0D +FvNameGuid =3D 48DB5E17-707C-472D-91CD-1613E7EF51B0=0D +FvAlignment =3D 16=0D +ERASE_POLARITY =3D 1=0D +MEMORY_MAPPED =3D TRUE=0D +STICKY_WRITE =3D TRUE=0D +LOCK_CAP =3D TRUE=0D +LOCK_STATUS =3D TRUE=0D +WRITE_DISABLED_CAP =3D TRUE=0D +WRITE_ENABLED_CAP =3D TRUE=0D +WRITE_STATUS =3D TRUE=0D +WRITE_LOCK_CAP =3D TRUE=0D +WRITE_LOCK_STATUS =3D TRUE=0D +READ_DISABLED_CAP =3D TRUE=0D +READ_ENABLED_CAP =3D TRUE=0D +READ_STATUS =3D TRUE=0D +READ_LOCK_CAP =3D TRUE=0D +READ_LOCK_STATUS =3D TRUE=0D +=0D +FILE FV_IMAGE =3D 9E21FD93-9C72-4c15-8C4B-E77F1DB2D792 {=0D + SECTION GUIDED EE4E5898-3914-4259-9D6E-DC7BD79403CF PROCESSING_REQUIRED= =3D TRUE {=0D + #=0D + # These firmware volumes will have files placed in them uncompressed,= =0D + # and then both firmware volumes will be compressed in a single=0D + # compression operation in order to achieve better overall compressio= n.=0D + #=0D + SECTION FV_IMAGE =3D PEIFV=0D + SECTION FV_IMAGE =3D DXEFV=0D + }=0D + }=0D +=0D +!include DecomprScratchEnd.fdf.inc=0D +=0D +##########################################################################= ######=0D +=0D +[Rule.Common.SEC]=0D + FILE SEC =3D $(NAMED_GUID) {=0D + PE32 PE32 $(INF_OUTPUT)/$(MODULE_NAME).efi=0D + UI STRING =3D"$(MODULE_NAME)" Optional=0D + VERSION STRING =3D"$(INF_VERSION)" Optional BUILD_NUM=3D$(BUILD_NUMBE= R)=0D + }=0D +=0D +[Rule.Common.PEI_CORE]=0D + FILE PEI_CORE =3D $(NAMED_GUID) {=0D + PE32 PE32 Align=3DAuto $(INF_OUTPUT)/$(MODULE_NAME).efi=0D + UI STRING =3D"$(MODULE_NAME)" Optional=0D + VERSION STRING =3D"$(INF_VERSION)" Optional BUILD_NUM=3D$(BUILD_NUMBE= R)=0D + }=0D +=0D +[Rule.Common.PEIM]=0D + FILE PEIM =3D $(NAMED_GUID) {=0D + PEI_DEPEX PEI_DEPEX Optional $(INF_OUTPUT)/$(MODULE_NAME).depe= x=0D + PE32 PE32 Align=3DAuto $(INF_OUTPUT)/$(MODULE_NAME).ef= i=0D + UI STRING=3D"$(MODULE_NAME)" Optional=0D + VERSION STRING=3D"$(INF_VERSION)" Optional BUILD_NUM=3D$(BUILD_NUMBE= R)=0D + }=0D +=0D +[Rule.Common.DXE_CORE]=0D + FILE DXE_CORE =3D $(NAMED_GUID) {=0D + PE32 PE32 $(INF_OUTPUT)/$(MODULE_NAME).efi=0D + UI STRING=3D"$(MODULE_NAME)" Optional=0D + VERSION STRING=3D"$(INF_VERSION)" Optional BUILD_NUM=3D$(BUILD_NUMBER= )=0D + }=0D +=0D +[Rule.Common.DXE_DRIVER]=0D + FILE DRIVER =3D $(NAMED_GUID) {=0D + DXE_DEPEX DXE_DEPEX Optional $(INF_OUTPUT)/$(MODULE_NAME).depe= x=0D + PE32 PE32 $(INF_OUTPUT)/$(MODULE_NAME).efi=0D + UI STRING=3D"$(MODULE_NAME)" Optional=0D + VERSION STRING=3D"$(INF_VERSION)" Optional BUILD_NUM=3D$(BUILD_NUMBER= )=0D + RAW ACPI Optional |.acpi=0D + RAW ASL Optional |.aml=0D + }=0D +=0D +[Rule.Common.DXE_RUNTIME_DRIVER]=0D + FILE DRIVER =3D $(NAMED_GUID) {=0D + DXE_DEPEX DXE_DEPEX Optional $(INF_OUTPUT)/$(MODULE_NAME).depe= x=0D + PE32 PE32 $(INF_OUTPUT)/$(MODULE_NAME).efi=0D + UI STRING=3D"$(MODULE_NAME)" Optional=0D + VERSION STRING=3D"$(INF_VERSION)" Optional BUILD_NUM=3D$(BUILD_NUMBER= )=0D + }=0D +=0D +[Rule.Common.UEFI_DRIVER]=0D + FILE DRIVER =3D $(NAMED_GUID) {=0D + DXE_DEPEX DXE_DEPEX Optional $(INF_OUTPUT)/$(MODULE_NAME).depe= x=0D + PE32 PE32 $(INF_OUTPUT)/$(MODULE_NAME).efi=0D + UI STRING=3D"$(MODULE_NAME)" Optional=0D + VERSION STRING=3D"$(INF_VERSION)" Optional BUILD_NUM=3D$(BUILD_NUMBER= )=0D + }=0D +=0D +[Rule.Common.UEFI_DRIVER.BINARY]=0D + FILE DRIVER =3D $(NAMED_GUID) {=0D + DXE_DEPEX DXE_DEPEX Optional |.depex=0D + PE32 PE32 |.efi=0D + UI STRING=3D"$(MODULE_NAME)" Optional=0D + VERSION STRING=3D"$(INF_VERSION)" Optional BUILD_NUM=3D$(BUILD_NUMBE= R)=0D + }=0D +=0D +[Rule.Common.UEFI_APPLICATION]=0D + FILE APPLICATION =3D $(NAMED_GUID) {=0D + PE32 PE32 $(INF_OUTPUT)/$(MODULE_NAME).efi=0D + UI STRING=3D"$(MODULE_NAME)" Optional=0D + VERSION STRING=3D"$(INF_VERSION)" Optional BUILD_NUM=3D$(BUILD_NUMBER= )=0D + }=0D +=0D +[Rule.Common.UEFI_APPLICATION.BINARY]=0D + FILE APPLICATION =3D $(NAMED_GUID) {=0D + PE32 PE32 |.efi=0D + UI STRING=3D"$(MODULE_NAME)" Optional=0D + VERSION STRING=3D"$(INF_VERSION)" Optional BUILD_NUM=3D$(BUILD_NUMBE= R)=0D + }=0D +=0D +[Rule.Common.USER_DEFINED.ACPITABLE]=0D + FILE FREEFORM =3D $(NAMED_GUID) {=0D + RAW ACPI |.acpi=0D + RAW ASL |.aml=0D + }=0D +=0D +[Rule.Common.USER_DEFINED.CSM]=0D + FILE FREEFORM =3D $(NAMED_GUID) {=0D + RAW BIN |.bin=0D + }=0D +=0D +[Rule.Common.SEC.RESET_VECTOR]=0D + FILE RAW =3D $(NAMED_GUID) {=0D + RAW BIN Align =3D 16 |.bin=0D + }=0D +=0D +[Rule.Common.SMM_CORE]=0D + FILE SMM_CORE =3D $(NAMED_GUID) {=0D + PE32 PE32 $(INF_OUTPUT)/$(MODULE_NAME).efi=0D + UI STRING=3D"$(MODULE_NAME)" Optional=0D + VERSION STRING=3D"$(INF_VERSION)" Optional BUILD_NUM=3D$(BUILD_NUMBER= )=0D + }=0D +=0D +[Rule.Common.DXE_SMM_DRIVER]=0D + FILE SMM =3D $(NAMED_GUID) {=0D + SMM_DEPEX SMM_DEPEX Optional $(INF_OUTPUT)/$(MODULE_NAME).depe= x=0D + PE32 PE32 $(INF_OUTPUT)/$(MODULE_NAME).efi=0D + UI STRING=3D"$(MODULE_NAME)" Optional=0D + VERSION STRING=3D"$(INF_VERSION)" Optional BUILD_NUM=3D$(BUILD_NUMBER= )=0D + }=0D diff --git a/BhyvePkg/BhyveRfbDxe/BhyveRfbDxe.inf b/BhyvePkg/BhyveRfbDxe/Bh= yveRfbDxe.inf new file mode 100644 index 0000000000..ebed65a4bd --- /dev/null +++ b/BhyvePkg/BhyveRfbDxe/BhyveRfbDxe.inf @@ -0,0 +1,76 @@ +## @file=0D +# GOP driver=0D +#=0D +# Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
=0D +# Portions copyright (c) 2011, Apple Inc. All rights reserved.=0D +#=0D +# This program and the accompanying materials=0D +# are licensed and made available under the terms and conditions of the B= SD License=0D +# which accompanies this distribution. The full text of the license may b= e found at=0D +# http://opensource.org/licenses/bsd-license.php=0D +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,=0D +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IM= PLIED.=0D +#=0D +#=0D +##=0D +=0D +[Defines]=0D + INF_VERSION =3D 0x00010005=0D + BASE_NAME =3D EmuGopDxe=0D + FILE_GUID =3D BCC87E0D-86D6-4D4D-8040-2D983D368BD1= =0D + MODULE_TYPE =3D UEFI_DRIVER=0D + VERSION_STRING =3D 1.0=0D +=0D + ENTRY_POINT =3D InitializeEmuGop=0D +=0D +#=0D +# The following information is for reference only and not required by the = build tools.=0D +#=0D +# VALID_ARCHITECTURES =3D IA32 X64 EBC=0D +#=0D +# DRIVER_BINDING =3D gEmuGopDriverBinding=0D +# COMPONENT_NAME =3D gEmuGopComponentName=0D +#=0D +=0D +[Sources]=0D + ComponentName.c=0D + GopScreen.c=0D + GopDriver.c=0D + Gop.h=0D + VbeShim.c=0D +=0D +=0D +[Packages]=0D + MdePkg/MdePkg.dec=0D +# OptionRomPkg/OptionRomPkg.dec=0D +# OvmfPkg/OvmfPkg.dec=0D + BhyvePkg/BhyvePkg.dec=0D +# IntelFrameworkModulePkg/IntelFrameworkModulePkg.dec=0D + MdeModulePkg/MdeModulePkg.dec=0D +=0D +=0D +[LibraryClasses]=0D + BaseLib=0D + BaseMemoryLib=0D + BltLib=0D + DebugLib=0D + DevicePathLib=0D + MemoryAllocationLib=0D + PciLib=0D + PcdLib=0D + PrintLib=0D + UefiLib=0D + UefiBootServicesTableLib=0D + UefiDriverEntryPoint=0D +=0D +=0D +[Protocols]=0D + gEfiGraphicsOutputProtocolGuid # PROTOCOL BY_START=0D + gEfiDevicePathProtocolGuid # PROTOCOL TO_START=0D + gEfiPciIoProtocolGuid # PROTOCOL TO_START=0D +=0D +[Pcd]=0D +# gOptionRomPkgTokenSpaceGuid.PcdDriverSupportedEfiVersion=0D + gEfiMdeModulePkgTokenSpaceGuid.PcdVideoHorizontalResolution=0D + gEfiMdeModulePkgTokenSpaceGuid.PcdVideoVerticalResolution=0D +=0D diff --git a/BhyvePkg/BhyveRfbDxe/ComponentName.c b/BhyvePkg/BhyveRfbDxe/Co= mponentName.c new file mode 100644 index 0000000000..76d01d00cd --- /dev/null +++ b/BhyvePkg/BhyveRfbDxe/ComponentName.c @@ -0,0 +1,205 @@ +/** @file=0D +=0D +Copyright (c) 2006, Intel Corporation. All rights reserved.
=0D +Portions copyright (c) 2010,Apple Inc. All rights reserved.
=0D +This program and the accompanying materials=0D +are licensed and made available under the terms and conditions of the BSD = License=0D +which accompanies this distribution. The full text of the license may be = found at=0D +http://opensource.org/licenses/bsd-license.php=0D +=0D +THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,=0D +WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLI= ED.=0D +=0D +Module Name:=0D +=0D + ComponentName.c=0D +=0D +Abstract:=0D +=0D +**/=0D +=0D +#include "Gop.h"=0D +=0D +//=0D +// EFI Component Name Functions=0D +//=0D +EFI_STATUS=0D +EFIAPI=0D +EmuGopComponentNameGetDriverName (=0D + IN EFI_COMPONENT_NAME_PROTOCOL *This,=0D + IN CHAR8 *Language,=0D + OUT CHAR16 **DriverName=0D + );=0D +=0D +EFI_STATUS=0D +EFIAPI=0D +EmuGopComponentNameGetControllerName (=0D + IN EFI_COMPONENT_NAME_PROTOCOL *This,=0D + IN EFI_HANDLE ControllerHandle,=0D + IN EFI_HANDLE ChildHandle O= PTIONAL,=0D + IN CHAR8 *Language,=0D + OUT CHAR16 **ControllerName=0D + );=0D +=0D +//=0D +// EFI Component Name Protocol=0D +//=0D +EFI_COMPONENT_NAME_PROTOCOL gEmuGopComponentName =3D {=0D + EmuGopComponentNameGetDriverName,=0D + EmuGopComponentNameGetControllerName,=0D + "eng"=0D +};=0D +=0D +//=0D +// EFI Component Name 2 Protocol=0D +//=0D +GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME2_PROTOCOL gEmuGopComponen= tName2 =3D {=0D + (EFI_COMPONENT_NAME2_GET_DRIVER_NAME) EmuGopComponentNameGetDriverName,= =0D + (EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME) EmuGopComponentNameGetControll= erName,=0D + "en"=0D +};=0D +=0D +=0D +EFI_UNICODE_STRING_TABLE mEmuGopDriverNameTable[] =3D {=0D + { "eng", L"Emulator GOP Driver" },=0D + { NULL , NULL }=0D +};=0D +=0D +=0D +/**=0D + Retrieves a Unicode string that is the user readable name of the driver.= =0D +=0D + This function retrieves the user readable name of a driver in the form o= f a=0D + Unicode string. If the driver specified by This has a user readable name= in=0D + the language specified by Language, then a pointer to the driver name is= =0D + returned in DriverName, and EFI_SUCCESS is returned. If the driver speci= fied=0D + by This does not support the language specified by Language,=0D + then EFI_UNSUPPORTED is returned.=0D +=0D + @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTO= COL or=0D + EFI_COMPONENT_NAME_PROTOCOL instance.=0D +=0D + @param Language[in] A pointer to a Null-terminated ASCII strin= g=0D + array indicating the language. This is the= =0D + language of the driver name that the calle= r is=0D + requesting, and it must match one of the=0D + languages specified in SupportedLanguages.= The=0D + number of languages supported by a driver = is up=0D + to the driver writer. Language is specifie= d=0D + in RFC 4646 or ISO 639-2 language code for= mat.=0D +=0D + @param DriverName[out] A pointer to the Unicode string to return.= =0D + This Unicode string is the name of the=0D + driver specified by This in the language=0D + specified by Language.=0D +=0D + @retval EFI_SUCCESS The Unicode string for the Driver specifie= d by=0D + This and the language specified by Languag= e was=0D + returned in DriverName.=0D +=0D + @retval EFI_INVALID_PARAMETER Language is NULL.=0D +=0D + @retval EFI_INVALID_PARAMETER DriverName is NULL.=0D +=0D + @retval EFI_UNSUPPORTED The driver specified by This does not supp= ort=0D + the language specified by Language.=0D +=0D +**/=0D +EFI_STATUS=0D +EFIAPI=0D +EmuGopComponentNameGetDriverName (=0D + IN EFI_COMPONENT_NAME_PROTOCOL *This,=0D + IN CHAR8 *Language,=0D + OUT CHAR16 **DriverName=0D + )=0D +{=0D + return LookupUnicodeString2 (=0D + Language,=0D + This->SupportedLanguages,=0D + mEmuGopDriverNameTable,=0D + DriverName,=0D + (BOOLEAN)(This =3D=3D &gEmuGopComponentName)=0D + );=0D +}=0D +=0D +=0D +/**=0D + Retrieves a Unicode string that is the user readable name of the control= ler=0D + that is being managed by a driver.=0D +=0D + This function retrieves the user readable name of the controller specifi= ed by=0D + ControllerHandle and ChildHandle in the form of a Unicode string. If the= =0D + driver specified by This has a user readable name in the language specif= ied by=0D + Language, then a pointer to the controller name is returned in Controlle= rName,=0D + and EFI_SUCCESS is returned. If the driver specified by This is not cur= rently=0D + managing the controller specified by ControllerHandle and ChildHandle,=0D + then EFI_UNSUPPORTED is returned. If the driver specified by This does = not=0D + support the language specified by Language, then EFI_UNSUPPORTED is retu= rned.=0D +=0D + @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTO= COL or=0D + EFI_COMPONENT_NAME_PROTOCOL instance.=0D +=0D + @param ControllerHandle[in] The handle of a controller that the driver= =0D + specified by This is managing. This handl= e=0D + specifies the controller whose name is to = be=0D + returned.=0D +=0D + @param ChildHandle[in] The handle of the child controller to retr= ieve=0D + the name of. This is an optional paramete= r that=0D + may be NULL. It will be NULL for device=0D + drivers. It will also be NULL for a bus d= rivers=0D + that wish to retrieve the name of the bus= =0D + controller. It will not be NULL for a bus= =0D + driver that wishes to retrieve the name of= a=0D + child controller.=0D +=0D + @param Language[in] A pointer to a Null-terminated ASCII strin= g=0D + array indicating the language. This is th= e=0D + language of the driver name that the calle= r is=0D + requesting, and it must match one of the=0D + languages specified in SupportedLanguages.= The=0D + number of languages supported by a driver = is up=0D + to the driver writer. Language is specifie= d in=0D + RFC 4646 or ISO 639-2 language code format= .=0D +=0D + @param ControllerName[out] A pointer to the Unicode string to return.= =0D + This Unicode string is the name of the=0D + controller specified by ControllerHandle a= nd=0D + ChildHandle in the language specified by=0D + Language from the point of view of the dri= ver=0D + specified by This.=0D +=0D + @retval EFI_SUCCESS The Unicode string for the user readable n= ame in=0D + the language specified by Language for the= =0D + driver specified by This was returned in=0D + DriverName.=0D +=0D + @retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE= .=0D +=0D + @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a va= lid=0D + EFI_HANDLE.=0D +=0D + @retval EFI_INVALID_PARAMETER Language is NULL.=0D +=0D + @retval EFI_INVALID_PARAMETER ControllerName is NULL.=0D +=0D + @retval EFI_UNSUPPORTED The driver specified by This is not curren= tly=0D + managing the controller specified by=0D + ControllerHandle and ChildHandle.=0D +=0D + @retval EFI_UNSUPPORTED The driver specified by This does not supp= ort=0D + the language specified by Language.=0D +=0D +**/=0D +EFI_STATUS=0D +EFIAPI=0D +EmuGopComponentNameGetControllerName (=0D + IN EFI_COMPONENT_NAME_PROTOCOL *This,=0D + IN EFI_HANDLE ControllerHandle,=0D + IN EFI_HANDLE ChildHandle O= PTIONAL,=0D + IN CHAR8 *Language,=0D + OUT CHAR16 **ControllerName=0D + )=0D +{=0D + return EFI_UNSUPPORTED;=0D +}=0D diff --git a/BhyvePkg/BhyveRfbDxe/Gop.h b/BhyvePkg/BhyveRfbDxe/Gop.h new file mode 100644 index 0000000000..1361288d20 --- /dev/null +++ b/BhyvePkg/BhyveRfbDxe/Gop.h @@ -0,0 +1,153 @@ +/*++ @file=0D +=0D +Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
=0D +Portions copyright (c) 2010,Apple Inc. All rights reserved.
=0D +This program and the accompanying materials=0D +are licensed and made available under the terms and conditions of the BSD = License=0D +which accompanies this distribution. The full text of the license may be = found at=0D +http://opensource.org/licenses/bsd-license.php=0D +=0D +THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,=0D +WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLI= ED.=0D +=0D +**/=0D +=0D +#ifndef __UGA_H_=0D +#define __UGA_H_=0D +=0D +#include =0D +#include =0D +#include =0D +#include =0D +#include =0D +=0D +#include =0D +=0D +#include =0D +#include =0D +#include =0D +#include =0D +#include =0D +#include =0D +#include =0D +#include =0D +#include =0D +=0D +#include =0D +=0D +#define GRAPHICS_OUTPUT_INVALID_MODE_NUMBER 0xffff=0D +=0D +typedef struct {=0D + UINT32 HorizontalResolution;=0D + UINT32 VerticalResolution;=0D + UINT32 ColorDepth;=0D + UINT32 RefreshRate;=0D +} GOP_MODE_DATA;=0D +=0D +#define PIXEL_RED_SHIFT 0=0D +#define PIXEL_GREEN_SHIFT 3=0D +#define PIXEL_BLUE_SHIFT 6=0D +=0D +#define PIXEL_RED_MASK (BIT7 | BIT6 | BIT5)=0D +#define PIXEL_GREEN_MASK (BIT4 | BIT3 | BIT2)=0D +#define PIXEL_BLUE_MASK (BIT1 | BIT0)=0D +=0D +#define PIXEL_TO_COLOR_BYTE(pixel, mask, shift) ((UINT8) ((pixel & mask) <= < shift))=0D +#define PIXEL_TO_RED_BYTE(pixel) PIXEL_TO_COLOR_BYTE(pixel, PIXEL_RED_MASK= , PIXEL_RED_SHIFT)=0D +#define PIXEL_TO_GREEN_BYTE(pixel) PIXEL_TO_COLOR_BYTE(pixel, PIXEL_GREEN_= MASK, PIXEL_GREEN_SHIFT)=0D +#define PIXEL_TO_BLUE_BYTE(pixel) PIXEL_TO_COLOR_BYTE(pixel, PIXEL_BLUE_MA= SK, PIXEL_BLUE_SHIFT)=0D +=0D +#define RGB_BYTES_TO_PIXEL(Red, Green, Blue) \=0D + (UINT8) ( (((Red) >> PIXEL_RED_SHIFT) & PIXEL_RED_MASK) | \=0D + (((Green) >> PIXEL_GREEN_SHIFT) & PIXEL_GREEN_MASK) | \=0D + (((Blue) >> PIXEL_BLUE_SHIFT) & PIXEL_BLUE_MASK) )=0D +=0D +#define PIXEL24_RED_MASK 0x00ff0000=0D +#define PIXEL24_GREEN_MASK 0x0000ff00=0D +#define PIXEL24_BLUE_MASK 0x000000ff=0D +=0D +extern EFI_DRIVER_BINDING_PROTOCOL gEmuGopDriverBinding;=0D +extern EFI_COMPONENT_NAME_PROTOCOL gEmuGopComponentName;=0D +=0D +#define EMU_UGA_CLASS_NAME L"EmuGopWindow"=0D +=0D +#define GOP_PRIVATE_DATA_SIGNATURE SIGNATURE_32 ('G', 'o', 'p', 'N')=0D +typedef struct {=0D + UINT64 Signature;=0D +=0D + EFI_HANDLE Handle;=0D + EFI_PCI_IO_PROTOCOL *PciIo;=0D + EFI_GRAPHICS_OUTPUT_PROTOCOL GraphicsOutput;=0D + EFI_DEVICE_PATH_PROTOCOL *GopDevicePath;=0D +=0D + EFI_UNICODE_STRING_TABLE *ControllerNameTable;=0D +=0D + //=0D + // GOP Private Data for QueryMode ()=0D + //=0D + GOP_MODE_DATA *ModeData;=0D +=0D + UINT64 FbAddr;=0D + UINT32 FbSize;=0D +} GOP_PRIVATE_DATA;=0D +=0D +=0D +#define GOP_PRIVATE_DATA_FROM_THIS(a) \=0D + CR(a, GOP_PRIVATE_DATA, GraphicsOutput, GOP_PRIVATE_DATA_SIGNATUR= E)=0D +=0D +typedef struct {=0D + UINT32 FbSize;=0D + UINT16 Width;=0D + UINT16 Height;=0D + UINT16 Depth;=0D + UINT16 RefreshRate;=0D +} BHYVE_FBUF_MEMREGS;=0D +=0D +//=0D +// Global Protocol Variables=0D +//=0D +extern EFI_DRIVER_BINDING_PROTOCOL gEmuGopDriverBinding;=0D +extern EFI_COMPONENT_NAME_PROTOCOL gEmuGopComponentName;=0D +extern EFI_COMPONENT_NAME2_PROTOCOL gEmuGopComponentName2;=0D +=0D +//=0D +// Gop Hardware abstraction internal worker functions=0D +//=0D +EFI_STATUS=0D +EmuGopConstructor (=0D + IN GOP_PRIVATE_DATA *Private=0D + );=0D +=0D +EFI_STATUS=0D +EmuGopDestructor (=0D + IN GOP_PRIVATE_DATA *Private=0D + );=0D +=0D +VOID=0D +EFIAPI=0D +ShutdownGopEvent (=0D + IN EFI_EVENT Event,=0D + IN VOID *Context=0D + );=0D +=0D +VOID=0D +BhyveSetGraphicsMode (=0D + GOP_PRIVATE_DATA *Private,=0D + UINT16 Width,=0D + UINT16 Height,=0D + UINT16 Depth=0D + );=0D +=0D +VOID=0D +BhyveGetMemregs (=0D + GOP_PRIVATE_DATA *Private,=0D + BHYVE_FBUF_MEMREGS *Memregs=0D + );=0D +=0D +VOID=0D +InstallVbeShim (=0D + IN CONST CHAR16 *CardName,=0D + IN EFI_PHYSICAL_ADDRESS FrameBufferBase=0D + );=0D +=0D +#endif=0D diff --git a/BhyvePkg/BhyveRfbDxe/GopDriver.c b/BhyvePkg/BhyveRfbDxe/GopDri= ver.c new file mode 100644 index 0000000000..48e4535e61 --- /dev/null +++ b/BhyvePkg/BhyveRfbDxe/GopDriver.c @@ -0,0 +1,548 @@ +/*++ @file=0D +=0D +Copyright (c) 2006, Intel Corporation. All rights reserved.
=0D +Portions copyright (c) 2010,Apple Inc. All rights reserved.
=0D +This program and the accompanying materials=0D +are licensed and made available under the terms and conditions of the BSD = License=0D +which accompanies this distribution. The full text of the license may be = found at=0D +http://opensource.org/licenses/bsd-license.php=0D +=0D +THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,=0D +WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLI= ED.=0D +=0D +=0D +**/=0D +=0D +#include "Gop.h"=0D +#include =0D +=0D +STATIC VOID=0D +BhyveGetGraphicsMode (=0D + EFI_PCI_IO_PROTOCOL *PciIo,=0D + UINT16 *Width,=0D + UINT16 *Height,=0D + UINT16 *Depth=0D + );=0D +=0D +=0D +/**=0D + Tests to see if this driver supports a given controller. If a child devi= ce is provided,=0D + it further tests to see if this driver supports creating a handle for th= e specified child device.=0D +=0D + This function checks to see if the driver specified by This supports the= device specified by=0D + ControllerHandle. Drivers will typically use the device path attached to= =0D + ControllerHandle and/or the services from the bus I/O abstraction attach= ed to=0D + ControllerHandle to determine if the driver supports ControllerHandle. T= his function=0D + may be called many times during platform initialization. In order to red= uce boot times, the tests=0D + performed by this function must be very small, and take as little time a= s possible to execute. This=0D + function must not change the state of any hardware devices, and this fun= ction must be aware that the=0D + device specified by ControllerHandle may already be managed by the same = driver or a=0D + different driver. This function must match its calls to AllocatePages() = with FreePages(),=0D + AllocatePool() with FreePool(), and OpenProtocol() with CloseProtocol().= =0D + Because ControllerHandle may have been previously started by the same dr= iver, if a protocol is=0D + already in the opened state, then it must not be closed with CloseProtoc= ol(). This is required=0D + to guarantee the state of ControllerHandle is not modified by this funct= ion.=0D +=0D + @param[in] This A pointer to the EFI_DRIVER_BINDING_PRO= TOCOL instance.=0D + @param[in] ControllerHandle The handle of the controller to test. T= his handle=0D + must support a protocol interface that = supplies=0D + an I/O abstraction to the driver.=0D + @param[in] RemainingDevicePath A pointer to the remaining portion of a= device path. This=0D + parameter is ignored by device drivers,= and is optional for bus=0D + drivers. For bus drivers, if this param= eter is not NULL, then=0D + the bus driver must determine if the bu= s controller specified=0D + by ControllerHandle and the child contr= oller specified=0D + by RemainingDevicePath are both support= ed by this=0D + bus driver.=0D +=0D + @retval EFI_SUCCESS The device specified by ControllerHandl= e and=0D + RemainingDevicePath is supported by the= driver specified by This.=0D + @retval EFI_ALREADY_STARTED The device specified by ControllerHandl= e and=0D + RemainingDevicePath is already being ma= naged by the driver=0D + specified by This.=0D + @retval EFI_ACCESS_DENIED The device specified by ControllerHandl= e and=0D + RemainingDevicePath is already being ma= naged by a different=0D + driver or an application that requires = exclusive access.=0D + Currently not implemented.=0D + @retval EFI_UNSUPPORTED The device specified by ControllerHandl= e and=0D + RemainingDevicePath is not supported by= the driver specified by This.=0D +**/=0D +EFI_STATUS=0D +EFIAPI=0D +EmuGopDriverBindingSupported (=0D + IN EFI_DRIVER_BINDING_PROTOCOL *This,=0D + IN EFI_HANDLE Handle,=0D + IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath=0D + )=0D +{=0D + EFI_STATUS Status;=0D + EFI_PCI_IO_PROTOCOL *PciIo;=0D + PCI_TYPE00 Pci;=0D + UINT16 Width, Height, Depth;=0D +=0D + //=0D + // Open the IO Abstraction(s) needed to perform the supported test=0D + //=0D + Status =3D gBS->OpenProtocol (=0D + Handle,=0D + &gEfiPciIoProtocolGuid,=0D + (VOID **) &PciIo,=0D + This->DriverBindingHandle,=0D + Handle,=0D + EFI_OPEN_PROTOCOL_BY_DRIVER=0D + );=0D + if (EFI_ERROR (Status)) {=0D + return Status;=0D + }=0D +=0D + //=0D + // See if this is a PCI Framebuffer Controller by looking at the Command= register and=0D + // Class Code Register=0D + //=0D + Status =3D PciIo->Pci.Read (=0D + PciIo,=0D + EfiPciIoWidthUint32,=0D + PCI_BAR_IDX0,=0D + sizeof (Pci) / sizeof (UINT32),=0D + &Pci=0D + );=0D + if (EFI_ERROR (Status)) {=0D + Status =3D EFI_UNSUPPORTED;=0D + goto Done;=0D + }=0D +=0D + Status =3D EFI_UNSUPPORTED;=0D + if (Pci.Hdr.VendorId =3D=3D 0xFB5D && Pci.Hdr.DeviceId =3D=3D 0x40FB) {= =0D + DEBUG((DEBUG_INFO, "BHYVE framebuffer device detected\n"));=0D + Status =3D EFI_SUCCESS;=0D +=0D + BhyveGetGraphicsMode(PciIo, &Width, &Height, &Depth);=0D + PcdSet32S (PcdVideoHorizontalResolution, Width);=0D + PcdSet32S (PcdVideoVerticalResolution, Height);=0D + }=0D +=0D +Done:=0D + //=0D + // Close the PCI I/O Protocol=0D + //=0D + gBS->CloseProtocol (=0D + Handle,=0D + &gEfiPciIoProtocolGuid,=0D + This->DriverBindingHandle,=0D + Handle=0D + );=0D +=0D + return Status;=0D +}=0D +=0D +=0D +/**=0D + Starts a device controller or a bus controller.=0D +=0D + The Start() function is designed to be invoked from the EFI boot service= ConnectController().=0D + As a result, much of the error checking on the parameters to Start() has= been moved into this=0D + common boot service. It is legal to call Start() from other locations,=0D + but the following calling restrictions must be followed, or the system b= ehavior will not be deterministic.=0D + 1. ControllerHandle must be a valid EFI_HANDLE.=0D + 2. If RemainingDevicePath is not NULL, then it must be a pointer to a na= turally aligned=0D + EFI_DEVICE_PATH_PROTOCOL.=0D + 3. Prior to calling Start(), the Supported() function for the driver spe= cified by This must=0D + have been called with the same calling parameters, and Supported() mu= st have returned EFI_SUCCESS.=0D +=0D + @param[in] This A pointer to the EFI_DRIVER_BINDING_PRO= TOCOL instance.=0D + @param[in] ControllerHandle The handle of the controller to start. = This handle=0D + must support a protocol interface that = supplies=0D + an I/O abstraction to the driver.=0D + @param[in] RemainingDevicePath A pointer to the remaining portion of a= device path. This=0D + parameter is ignored by device drivers,= and is optional for bus=0D + drivers. For a bus driver, if this para= meter is NULL, then handles=0D + for all the children of Controller are = created by this driver.=0D + If this parameter is not NULL and the f= irst Device Path Node is=0D + not the End of Device Path Node, then o= nly the handle for the=0D + child device specified by the first Dev= ice Path Node of=0D + RemainingDevicePath is created by this = driver.=0D + If the first Device Path Node of Remain= ingDevicePath is=0D + the End of Device Path Node, no child h= andle is created by this=0D + driver.=0D +=0D + @retval EFI_SUCCESS The device was started.=0D + @retval EFI_DEVICE_ERROR The device could not be started due to = a device error.Currently not implemented.=0D + @retval EFI_OUT_OF_RESOURCES The request could not be completed due = to a lack of resources.=0D + @retval Others The driver failded to start the device.= =0D +=0D +**/=0D +EFI_STATUS=0D +EFIAPI=0D +EmuGopDriverBindingStart (=0D + IN EFI_DRIVER_BINDING_PROTOCOL *This,=0D + IN EFI_HANDLE Handle,=0D + IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath=0D + )=0D +{=0D + BHYVE_FBUF_MEMREGS Memregs;=0D + GOP_PRIVATE_DATA *Private;=0D + EFI_STATUS Status;=0D + EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *MmioDesc;=0D +=0D + //=0D + // Allocate Private context data for SGO inteface.=0D + //=0D + Private =3D NULL;=0D + Status =3D gBS->AllocatePool (=0D + EfiBootServicesData,=0D + sizeof (GOP_PRIVATE_DATA),=0D + (VOID **)&Private=0D + );=0D + if (EFI_ERROR (Status)) {=0D + goto Done;=0D + }=0D +=0D + // Set up context record=0D + //=0D + Private->Signature =3D GOP_PRIVATE_DATA_SIGNATURE;=0D + Private->Handle =3D Handle;=0D + Private->ControllerNameTable =3D NULL;=0D +=0D + //=0D + // Open PCI I/O Protocol=0D + //=0D + Status =3D gBS->OpenProtocol (=0D + Handle,=0D + &gEfiPciIoProtocolGuid,=0D + (VOID **) &Private->PciIo,=0D + This->DriverBindingHandle,=0D + Handle,=0D + EFI_OPEN_PROTOCOL_BY_DRIVER=0D + );=0D + if (EFI_ERROR (Status)) {=0D + goto Done;=0D + }=0D +=0D + //=0D + // Check if fbuf mmio BAR is present=0D + //=0D + MmioDesc =3D NULL;=0D + Status =3D Private->PciIo->GetBarAttributes (=0D + Private->PciIo,=0D + PCI_BAR_IDX0,=0D + NULL,=0D + (VOID**) &MmioDesc=0D + );=0D + if (EFI_ERROR (Status) ||=0D + MmioDesc->ResType !=3D ACPI_ADDRESS_SPACE_TYPE_MEM) {=0D + DEBUG ((DEBUG_INFO, "BHYVE GOP: No mmio bar\n"));=0D + } else {=0D + DEBUG ((DEBUG_INFO, "BHYVE GOP: Using mmio bar @ 0x%lx\n",=0D + MmioDesc->AddrRangeMin));=0D + BhyveGetMemregs(Private, &Memregs);=0D + Private->FbSize =3D Memregs.FbSize;=0D + }=0D + if (MmioDesc !=3D NULL) {=0D + FreePool (MmioDesc);=0D + }=0D + if (EFI_ERROR (Status)) {=0D + goto Done;=0D + }=0D +=0D + //=0D + // Check if fbuf frame-buffer BAR is present=0D + //=0D + MmioDesc =3D NULL;=0D + Status =3D Private->PciIo->GetBarAttributes (=0D + Private->PciIo,=0D + PCI_BAR_IDX1,=0D + NULL,=0D + (VOID**) &MmioDesc=0D + );=0D + if (EFI_ERROR (Status) ||=0D + MmioDesc->ResType !=3D ACPI_ADDRESS_SPACE_TYPE_MEM) {=0D + DEBUG ((DEBUG_INFO, "BHYVE GOP: No frame-buffer bar\n"));=0D + } else {=0D + DEBUG ((DEBUG_INFO, "BHYVE GOP: Using frame-buffer bar @ 0x%lx\n",=0D + MmioDesc->AddrRangeMin));=0D + Private->FbAddr =3D MmioDesc->AddrRangeMin;=0D + // XXX assert BAR is >=3D size=0D + }=0D +=0D + if (MmioDesc !=3D NULL) {=0D + FreePool (MmioDesc);=0D + }=0D + if (EFI_ERROR (Status)) {=0D + goto Done;=0D + }=0D +=0D + DEBUG ((DEBUG_INFO, "BHYVE GOP: Framebuf addr 0x%lx, size %x\n",=0D + Private->FbAddr, Private->FbSize));=0D +=0D + Status =3D EmuGopConstructor (Private);=0D + if (EFI_ERROR (Status)) {=0D + goto Done;=0D + }=0D +=0D + //=0D + // Publish the Gop interface to the world=0D + //=0D + Status =3D gBS->InstallMultipleProtocolInterfaces (=0D + &Private->Handle,=0D + &gEfiGraphicsOutputProtocolGuid, &Private->GraphicsOu= tput,=0D + NULL=0D + );=0D +=0D + DEBUG((DEBUG_INFO, "BHYVE framebuffer device started\n"));=0D +=0D + //=0D + // Install int10 handler=0D + //=0D +#ifndef CSM_ENABLE=0D + InstallVbeShim (L"Framebuffer", Private->FbAddr);=0D +#endif=0D +=0D +Done:=0D + if (EFI_ERROR (Status)) {=0D + if (Private !=3D NULL) {=0D + //=0D + // On Error Free back private data=0D + //=0D + if (Private->ControllerNameTable !=3D NULL) {=0D + FreeUnicodeStringTable (Private->ControllerNameTable);=0D + }=0D +=0D + gBS->FreePool (Private);=0D + }=0D + }=0D +=0D + return Status;=0D +}=0D +=0D +=0D +=0D +/**=0D + Stops a device controller or a bus controller.=0D +=0D + The Stop() function is designed to be invoked from the EFI boot service = DisconnectController().=0D + As a result, much of the error checking on the parameters to Stop() has = been moved=0D + into this common boot service. It is legal to call Stop() from other loc= ations,=0D + but the following calling restrictions must be followed, or the system b= ehavior will not be deterministic.=0D + 1. ControllerHandle must be a valid EFI_HANDLE that was used on a previo= us call to this=0D + same driver's Start() function.=0D + 2. The first NumberOfChildren handles of ChildHandleBuffer must all be a= valid=0D + EFI_HANDLE. In addition, all of these handles must have been created = in this driver's=0D + Start() function, and the Start() function must have called OpenProto= col() on=0D + ControllerHandle with an Attribute of EFI_OPEN_PROTOCOL_BY_CHILD_CONT= ROLLER.=0D +=0D + @param[in] This A pointer to the EFI_DRIVER_BINDING_PROTOC= OL instance.=0D + @param[in] ControllerHandle A handle to the device being stopped. The = handle must=0D + support a bus specific I/O protocol for th= e driver=0D + to use to stop the device.=0D + @param[in] NumberOfChildren The number of child device handles in Chil= dHandleBuffer.=0D + @param[in] ChildHandleBuffer An array of child handles to be freed. May= be NULL=0D + if NumberOfChildren is 0.=0D +=0D + @retval EFI_SUCCESS The device was stopped.=0D + @retval EFI_DEVICE_ERROR The device could not be stopped due to a d= evice error.=0D +=0D +**/=0D +EFI_STATUS=0D +EFIAPI=0D +EmuGopDriverBindingStop (=0D + IN EFI_DRIVER_BINDING_PROTOCOL *This,=0D + IN EFI_HANDLE Handle,=0D + IN UINTN NumberOfChildren,=0D + IN EFI_HANDLE *ChildHandleBuffer=0D + )=0D +{=0D + EFI_GRAPHICS_OUTPUT_PROTOCOL *GraphicsOutput;=0D + EFI_STATUS Status;=0D + GOP_PRIVATE_DATA *Private;=0D +=0D + DEBUG((DEBUG_INFO, "BHYVE framebuffer device stopping\n"));=0D +=0D + Status =3D gBS->OpenProtocol (=0D + Handle,=0D + &gEfiGraphicsOutputProtocolGuid,=0D + (VOID **)&GraphicsOutput,=0D + This->DriverBindingHandle,=0D + Handle,=0D + EFI_OPEN_PROTOCOL_GET_PROTOCOL=0D + );=0D + if (EFI_ERROR (Status)) {=0D + //=0D + // If the GOP interface does not exist the driver is not started=0D + //=0D + return EFI_NOT_STARTED;=0D + }=0D +=0D + //=0D + // Get our private context information=0D + //=0D + Private =3D GOP_PRIVATE_DATA_FROM_THIS (GraphicsOutput);=0D +=0D + //=0D + // Remove the SGO interface from the system=0D + //=0D + Status =3D gBS->UninstallMultipleProtocolInterfaces (=0D + Private->Handle,=0D + &gEfiGraphicsOutputProtocolGuid, &Private->GraphicsOu= tput,=0D + NULL=0D + );=0D + if (!EFI_ERROR (Status)) {=0D + //=0D + // Shutdown the hardware=0D + //=0D + Status =3D EmuGopDestructor (Private);=0D + if (EFI_ERROR (Status)) {=0D + return EFI_DEVICE_ERROR;=0D + }=0D +=0D + gBS->CloseProtocol (=0D + Handle,=0D + &gEfiPciIoProtocolGuid,=0D + This->DriverBindingHandle,=0D + Private->Handle=0D + );=0D +=0D + //=0D + // Free our instance data=0D + //=0D + FreeUnicodeStringTable (Private->ControllerNameTable);=0D +=0D + gBS->FreePool (Private);=0D +=0D + }=0D +=0D + return Status;=0D +}=0D +=0D +=0D +///=0D +/// This protocol provides the services required to determine if a driver = supports a given controller.=0D +/// If a controller is supported, then it also provides routines to start = and stop the controller.=0D +///=0D +EFI_DRIVER_BINDING_PROTOCOL gEmuGopDriverBinding =3D {=0D + EmuGopDriverBindingSupported,=0D + EmuGopDriverBindingStart,=0D + EmuGopDriverBindingStop,=0D + 0xa,=0D + NULL,=0D + NULL=0D +};=0D +=0D +=0D +=0D +/**=0D + The user Entry Point for module EmuGop. The user code starts with this f= unction.=0D +=0D + @param[in] ImageHandle The firmware allocated handle for the EFI imag= e.=0D + @param[in] SystemTable A pointer to the EFI System Table.=0D +=0D + @retval EFI_SUCCESS The entry point is executed successfully.=0D + @retval other Some error occurs when executing this entry po= int.=0D +=0D +**/=0D +EFI_STATUS=0D +EFIAPI=0D +InitializeEmuGop (=0D + IN EFI_HANDLE ImageHandle,=0D + IN EFI_SYSTEM_TABLE *SystemTable=0D + )=0D +{=0D + EFI_STATUS Status;=0D +=0D + Status =3D EfiLibInstallDriverBindingComponentName2 (=0D + ImageHandle,=0D + SystemTable,=0D + &gEmuGopDriverBinding,=0D + ImageHandle,=0D + &gEmuGopComponentName,=0D + &gEmuGopComponentName2=0D + );=0D + ASSERT_EFI_ERROR (Status);=0D +=0D +=0D + return Status;=0D +}=0D +=0D +STATIC VOID=0D +BhyveGetGraphicsMode (=0D + EFI_PCI_IO_PROTOCOL *PciIo,=0D + UINT16 *Width,=0D + UINT16 *Height,=0D + UINT16 *Depth=0D + )=0D +{=0D + BHYVE_FBUF_MEMREGS BhyveRegs;=0D + UINT64 Offset;=0D + EFI_STATUS Status;=0D +=0D +=0D + Offset =3D (UINT64)&BhyveRegs.Width - (UINT64)&BhyveRegs;=0D +=0D + Status =3D PciIo->Mem.Read (=0D + PciIo,=0D + EfiPciIoWidthUint16,=0D + PCI_BAR_IDX0,=0D + Offset,=0D + 3,=0D + &BhyveRegs.Width=0D + );=0D +=0D + *Width =3D BhyveRegs.Width;=0D + *Height =3D BhyveRegs.Height;=0D + *Depth =3D BhyveRegs.Depth;=0D +=0D + DEBUG ((DEBUG_INFO, "BHYVE Get Graphics Mode: w %d, h %d\n", *Width, *He= ight));=0D +=0D + ASSERT_EFI_ERROR (Status);=0D +}=0D +=0D +VOID=0D +BhyveSetGraphicsMode (=0D + GOP_PRIVATE_DATA *Private,=0D + UINT16 Width,=0D + UINT16 Height,=0D + UINT16 Depth=0D + )=0D +{=0D + BHYVE_FBUF_MEMREGS BhyveRegs;=0D + UINT64 Offset;=0D + EFI_STATUS Status;=0D +=0D + DEBUG ((DEBUG_INFO, "BHYVE Set Graphics Mode: w %d, h %d\n", Width, Heig= ht));=0D +=0D + BhyveRegs.Width =3D Width;=0D + BhyveRegs.Height =3D Height;=0D + BhyveRegs.Depth =3D Depth;=0D + Offset =3D (UINT64)&BhyveRegs.Width - (UINT64)&BhyveRegs;=0D +=0D + Status =3D Private->PciIo->Mem.Write (=0D + Private->PciIo,=0D + EfiPciIoWidthUint16,=0D + PCI_BAR_IDX0,=0D + Offset,=0D + 3,=0D + &BhyveRegs.Width=0D + );=0D + ASSERT_EFI_ERROR (Status);=0D +}=0D +=0D +VOID=0D +BhyveGetMemregs (=0D + GOP_PRIVATE_DATA *Private,=0D + BHYVE_FBUF_MEMREGS *Memregs=0D + )=0D +{=0D + EFI_STATUS Status;=0D +=0D + Status =3D Private->PciIo->Mem.Read (=0D + Private->PciIo,=0D + EfiPciIoWidthUint32,=0D + PCI_BAR_IDX0,=0D + 0,=0D + 3,=0D + Memregs=0D + );=0D + ASSERT_EFI_ERROR (Status);=0D +=0D + DEBUG ((DEBUG_INFO, "BHYVE Get Memregs, size %d width %d height %d\n",=0D + Memregs->FbSize, Memregs->Width, Memregs->Height));=0D +}=0D diff --git a/BhyvePkg/BhyveRfbDxe/GopScreen.c b/BhyvePkg/BhyveRfbDxe/GopScr= een.c new file mode 100644 index 0000000000..6e5ccce0b3 --- /dev/null +++ b/BhyvePkg/BhyveRfbDxe/GopScreen.c @@ -0,0 +1,398 @@ +/*++ @file=0D +=0D +Copyright (c) 2015, Nahanni Systems, Inc.=0D +Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
=0D +Portions copyright (c) 2010 - 2011, Apple Inc. All rights reserved.=0D +This program and the accompanying materials=0D +are licensed and made available under the terms and conditions of the BSD = License=0D +which accompanies this distribution. The full text of the license may be = found at=0D +http://opensource.org/licenses/bsd-license.php=0D +=0D +THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,=0D +WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLI= ED.=0D +=0D +Module Name:=0D +=0D + EmuGopScreen.c=0D +=0D +Abstract:=0D +=0D + This file produces the graphics abstration of UGA. It is called by=0D + EmuGopDriver.c file which deals with the EFI 1.1 driver model.=0D + This file just does graphics.=0D +=0D +**/=0D +=0D +#include "Gop.h"=0D +#include =0D +=0D +=0D +EFI_EVENT mGopScreenExitBootServicesEvent;=0D +=0D +GOP_MODE_DATA mGopModeData[] =3D {=0D + { 1920, 1200, 32, 0 },=0D + { 1920, 1080, 32, 0 },=0D + { 1600, 1200, 32, 0 },=0D + { 1600, 900, 32, 0 },=0D + { 1280, 1024, 32, 0 },=0D + { 1280, 720, 32, 0 },=0D + { 1024, 768, 32, 0 },=0D + { 800, 600, 32, 0 },=0D + { 640, 480, 32, 0 }=0D + };=0D +=0D +STATIC=0D +VOID=0D +BhyveGopCompleteModeInfo (=0D + IN GOP_MODE_DATA *ModeData,=0D + OUT EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *Info=0D + )=0D +{=0D + Info->Version =3D 0;=0D + if (ModeData->ColorDepth =3D=3D 8) {=0D + Info->PixelFormat =3D PixelBitMask;=0D + Info->PixelInformation.RedMask =3D PIXEL_RED_MASK;=0D + Info->PixelInformation.GreenMask =3D PIXEL_GREEN_MASK;=0D + Info->PixelInformation.BlueMask =3D PIXEL_BLUE_MASK;=0D + Info->PixelInformation.ReservedMask =3D 0;=0D + } else if (ModeData->ColorDepth =3D=3D 24) {=0D + Info->PixelFormat =3D PixelBitMask;=0D + Info->PixelInformation.RedMask =3D PIXEL24_RED_MASK;=0D + Info->PixelInformation.GreenMask =3D PIXEL24_GREEN_MASK;=0D + Info->PixelInformation.BlueMask =3D PIXEL24_BLUE_MASK;=0D + Info->PixelInformation.ReservedMask =3D 0;=0D + } else if (ModeData->ColorDepth =3D=3D 32) {=0D + DEBUG ((DEBUG_INFO, "%dx%d PixelBlueGreenRedReserved8BitPerColor\n",=0D + ModeData->HorizontalResolution, ModeData->VerticalResolution));=0D + Info->PixelFormat =3D PixelBlueGreenRedReserved8BitPerColor;=0D + }=0D + Info->PixelsPerScanLine =3D Info->HorizontalResolution;=0D +}=0D +=0D +=0D +/**=0D + Returns information for an available graphics mode that the graphics dev= ice=0D + and the set of active video output devices supports.=0D +=0D + @param This The EFI_GRAPHICS_OUTPUT_PROTOCOL instance.= =0D + @param ModeNumber The mode number to return information on.= =0D + @param SizeOfInfo A pointer to the size, in bytes, of the In= fo buffer.=0D + @param Info A pointer to callee allocated buffer that = returns information about ModeNumber.=0D +=0D + @retval EFI_SUCCESS Mode information returned.=0D + @retval EFI_BUFFER_TOO_SMALL The Info buffer was too small.=0D + @retval EFI_DEVICE_ERROR A hardware error occurred trying to retrie= ve the video mode.=0D + @retval EFI_NOT_STARTED Video display is not initialized. Call Set= Mode ()=0D + @retval EFI_INVALID_PARAMETER One of the input args was NULL.=0D +=0D +**/=0D +EFI_STATUS=0D +EFIAPI=0D +EmuGopQuerytMode (=0D + IN EFI_GRAPHICS_OUTPUT_PROTOCOL *This,=0D + IN UINT32 ModeNumber,=0D + OUT UINTN *SizeOfInfo,=0D + OUT EFI_GRAPHICS_OUTPUT_MODE_INFORMATION **Info=0D + )=0D +{=0D + GOP_PRIVATE_DATA *Private;=0D + GOP_MODE_DATA *ModeData;=0D +=0D + Private =3D GOP_PRIVATE_DATA_FROM_THIS (This);=0D +=0D + if (Info =3D=3D NULL || SizeOfInfo =3D=3D NULL || (UINTN) ModeNumber >= =3D This->Mode->MaxMode) {=0D + return EFI_INVALID_PARAMETER;=0D + }=0D +=0D + *Info =3D AllocatePool (sizeof (EFI_GRAPHICS_OUTPUT_MODE_INFORMATION));= =0D + if (*Info =3D=3D NULL) {=0D + return EFI_OUT_OF_RESOURCES;=0D + }=0D +=0D + *SizeOfInfo =3D sizeof (EFI_GRAPHICS_OUTPUT_MODE_INFORMATION);=0D +=0D + ModeData =3D &Private->ModeData[ModeNumber];=0D + (*Info)->Version =3D 0;=0D + (*Info)->HorizontalResolution =3D ModeData->HorizontalResolution;=0D + (*Info)->VerticalResolution =3D ModeData->VerticalResolution;=0D + (*Info)->PixelFormat =3D PixelBitMask;=0D + (*Info)->PixelsPerScanLine =3D (*Info)->HorizontalResolution;=0D + BhyveGopCompleteModeInfo(ModeData, *Info);=0D + return EFI_SUCCESS;=0D +}=0D +=0D +=0D +=0D +/**=0D + Set the video device into the specified mode and clears the visible port= ions of=0D + the output display to black.=0D +=0D + @param This The EFI_GRAPHICS_OUTPUT_PROTOCOL instance.=0D + @param ModeNumber Abstraction that defines the current video mod= e.=0D +=0D + @retval EFI_SUCCESS The graphics mode specified by ModeNumber was = selected.=0D + @retval EFI_DEVICE_ERROR The device had an error and could not complete= the request.=0D + @retval EFI_UNSUPPORTED ModeNumber is not supported by this device.=0D +=0D +**/=0D +=0D +FRAME_BUFFER_CONFIGURE *fbconf;=0D +=0D +EFI_STATUS=0D +EFIAPI=0D +EmuGopSetMode (=0D + IN EFI_GRAPHICS_OUTPUT_PROTOCOL *This,=0D + IN UINT32 ModeNumber=0D + )=0D +{=0D + GOP_PRIVATE_DATA *Private;=0D + GOP_MODE_DATA *ModeData;=0D + EFI_GRAPHICS_OUTPUT_BLT_PIXEL Fill;=0D + EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *Info;=0D +=0D + UINTN confsize =3D 0;=0D + fbconf =3D NULL;=0D +=0D + Private =3D GOP_PRIVATE_DATA_FROM_THIS (This);=0D +=0D + if (ModeNumber >=3D This->Mode->MaxMode) {=0D + // Tell bhyve that we are switching out of vesa=0D + BhyveSetGraphicsMode(Private, 0, 0, 0);=0D + return EFI_UNSUPPORTED;=0D + }=0D +=0D + DEBUG ((DEBUG_INFO, "BHYVE GopSetMode %d\n", ModeNumber));=0D +=0D + ModeData =3D &Private->ModeData[ModeNumber];=0D + This->Mode->Mode =3D ModeNumber;=0D + Private->GraphicsOutput.Mode->Info->HorizontalResolution =3D ModeData->H= orizontalResolution;=0D + Private->GraphicsOutput.Mode->Info->VerticalResolution =3D ModeData->Ver= ticalResolution;=0D + Private->GraphicsOutput.Mode->Info->PixelsPerScanLine =3D ModeData->Hori= zontalResolution;=0D +=0D + Info =3D This->Mode->Info;=0D + BhyveGopCompleteModeInfo(ModeData, Info);=0D +=0D + This->Mode->Info->HorizontalResolution =3D ModeData->HorizontalResolutio= n;=0D + This->Mode->Info->VerticalResolution =3D ModeData->VerticalResolution;=0D + This->Mode->SizeOfInfo =3D sizeof(EFI_GRAPHICS_OUTPUT_MODE_INFORMATION);= =0D + This->Mode->FrameBufferBase =3D Private->GraphicsOutput.Mode->FrameBuffe= rBase;=0D +=0D + /*=0D + This->Mode->FrameBufferSize =3D Info->HorizontalResolution * Info->Verti= calResolution=0D + * ((ModeData->ColorDepth + 7) / 8);=0D + */=0D + This->Mode->FrameBufferSize =3D Private->FbSize;=0D + DEBUG ((DEBUG_INFO, "BHYVE GOP FrameBufferBase: 0x%x, FrameBufferSize: 0= x%x\n", This->Mode->FrameBufferBase, This->Mode->FrameBufferSize));=0D +=0D + BhyveSetGraphicsMode(Private, ModeData->HorizontalResolution, ModeData->= VerticalResolution, ModeData->ColorDepth);=0D +=0D + RETURN_STATUS ret =3D FrameBufferBltConfigure (=0D + (VOID*)(UINTN) This->Mode->FrameBufferBase,=0D + This->Mode->Info, fbconf, &confsize=0D + );=0D + if (ret =3D=3D EFI_BUFFER_TOO_SMALL || ret =3D=3D EFI_INVALID_PARAMETER)= {=0D + fbconf =3D AllocatePool(confsize);=0D + ret =3D FrameBufferBltConfigure(=0D + (VOID*)(UINTN)This->Mode->FrameBufferBase,=0D + This->Mode->Info, fbconf, &confsize);=0D + ASSERT(ret =3D=3D EFI_SUCCESS);=0D + }=0D +=0D + Fill.Red =3D 0;=0D + Fill.Green =3D 0;=0D + Fill.Blue =3D 0;=0D + This->Blt (=0D + This,=0D + &Fill,=0D + EfiBltVideoFill,=0D + 0,=0D + 0,=0D + 0,=0D + 0,=0D + ModeData->HorizontalResolution,=0D + ModeData->VerticalResolution,=0D + ModeData->HorizontalResolution * sizeof (EFI_GRAPHICS_OUTPUT_BLT= _PIXEL)=0D + );=0D + return EFI_SUCCESS;=0D +}=0D +=0D +=0D +=0D +/**=0D + Blt a rectangle of pixels on the graphics screen. Blt stands for BLock T= ransfer.=0D +=0D + @param This Protocol instance pointer.=0D + @param BltBuffer Buffer containing data to blit into video buffer. T= his=0D + buffer has a size of Width*Height*sizeof(EFI_GRAPHI= CS_OUTPUT_BLT_PIXEL)=0D + @param BltOperation Operation to perform on BlitBuffer and video memory= =0D + @param SourceX X coordinate of source for the BltBuffer.=0D + @param SourceY Y coordinate of source for the BltBuffer.=0D + @param DestinationX X coordinate of destination for the BltBuffer.=0D + @param DestinationY Y coordinate of destination for the BltBuffer.=0D + @param Width Width of rectangle in BltBuffer in pixels.=0D + @param Height Hight of rectangle in BltBuffer in pixels.=0D + @param Delta OPTIONAL=0D +=0D + @retval EFI_SUCCESS The Blt operation completed.=0D + @retval EFI_INVALID_PARAMETER BltOperation is not valid.=0D + @retval EFI_DEVICE_ERROR A hardware error occured writting to the v= ideo buffer.=0D +=0D +**/=0D +EFI_STATUS=0D +EFIAPI=0D +EmuGopBlt (=0D + IN EFI_GRAPHICS_OUTPUT_PROTOCOL *This,=0D + IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *BltBuffer, OPTIONAL=0D + IN EFI_GRAPHICS_OUTPUT_BLT_OPERATION BltOperation,=0D + IN UINTN SourceX,=0D + IN UINTN SourceY,=0D + IN UINTN DestinationX,=0D + IN UINTN DestinationY,=0D + IN UINTN Width,=0D + IN UINTN Height,=0D + IN UINTN Delta OPTIONAL=0D + )=0D +{=0D + EFI_TPL OriginalTPL;=0D + EFI_STATUS Status;=0D +=0D + if ((UINT32)BltOperation >=3D EfiGraphicsOutputBltOperationMax) {=0D + return EFI_INVALID_PARAMETER;=0D + }=0D +=0D + if (Width =3D=3D 0 || Height =3D=3D 0) {=0D + return EFI_INVALID_PARAMETER;=0D + }=0D +=0D + //=0D + // We have to raise to TPL Notify, so we make an atomic write the frame = buffer.=0D + // We would not want a timer based event (Cursor, ...) to come in while = we are=0D + // doing this operation.=0D + //=0D + OriginalTPL =3D gBS->RaiseTPL (TPL_NOTIFY);=0D +=0D + switch (BltOperation) {=0D + case EfiBltVideoToBltBuffer:=0D + case EfiBltBufferToVideo:=0D + case EfiBltVideoFill:=0D + case EfiBltVideoToVideo:=0D + Status =3D FrameBufferBlt (=0D + fbconf,=0D + BltBuffer,=0D + BltOperation,=0D + SourceX,=0D + SourceY,=0D + DestinationX,=0D + DestinationY,=0D + Width,=0D + Height,=0D + Delta=0D + );=0D + break;=0D +=0D + default:=0D + Status =3D EFI_INVALID_PARAMETER;=0D + ASSERT (FALSE);=0D + }=0D +=0D + gBS->RestoreTPL (OriginalTPL);=0D +=0D + return Status;=0D +}=0D +=0D +=0D +//=0D +// Construction and Destruction functions=0D +//=0D +=0D +EFI_STATUS=0D +EmuGopConstructor (=0D + GOP_PRIVATE_DATA *Private=0D + )=0D +{=0D + Private->ModeData =3D mGopModeData;=0D +=0D + Private->GraphicsOutput.QueryMode =3D EmuGopQuerytMode;=0D + Private->GraphicsOutput.SetMode =3D EmuGopSetMode;=0D + Private->GraphicsOutput.Blt =3D EmuGopBlt;=0D +=0D + //=0D + // Allocate buffer for Graphics Output Protocol mode information=0D + //=0D + Private->GraphicsOutput.Mode =3D AllocatePool (sizeof (EFI_GRAPHICS_OUTP= UT_PROTOCOL_MODE));=0D + if (Private->GraphicsOutput.Mode =3D=3D NULL) {=0D + return EFI_OUT_OF_RESOURCES;=0D + }=0D + Private->GraphicsOutput.Mode->Info =3D AllocatePool (sizeof (EFI_GRAPHIC= S_OUTPUT_MODE_INFORMATION));=0D + if (Private->GraphicsOutput.Mode->Info =3D=3D NULL) {=0D + return EFI_OUT_OF_RESOURCES;=0D + }=0D +=0D +=0D + DEBUG ((DEBUG_INFO, "BHYVE Gop Constructor\n"));=0D +=0D + Private->GraphicsOutput.Mode->MaxMode =3D sizeof(mGopModeData) / sizeof(= GOP_MODE_DATA);=0D + //=0D + // Till now, we have no idea about the window size.=0D + //=0D + Private->GraphicsOutput.Mode->Mode =3D GRAPHICS_OUTPUT_INVALID_MODE_NUMB= ER;=0D + Private->GraphicsOutput.Mode->Info->Version =3D 0;=0D + Private->GraphicsOutput.Mode->Info->HorizontalResolution =3D 0;=0D + Private->GraphicsOutput.Mode->Info->VerticalResolution =3D 0;=0D + Private->GraphicsOutput.Mode->Info->PixelFormat =3D PixelBitMask;=0D + Private->GraphicsOutput.Mode->SizeOfInfo =3D sizeof (EFI_GRAPHICS_OUTPUT= _MODE_INFORMATION);=0D + Private->GraphicsOutput.Mode->FrameBufferBase =3D (EFI_PHYSICAL_ADDRESS)= Private->FbAddr;=0D + Private->GraphicsOutput.Mode->FrameBufferSize =3D Private->FbSize;=0D +=0D + return EFI_SUCCESS;=0D +}=0D +=0D +=0D +=0D +EFI_STATUS=0D +EmuGopDestructor (=0D + GOP_PRIVATE_DATA *Private=0D + )=0D +{=0D + //=0D + // Free graphics output protocol occupied resource=0D + //=0D + if (Private->GraphicsOutput.Mode !=3D NULL) {=0D + if (Private->GraphicsOutput.Mode->Info !=3D NULL) {=0D + FreePool (Private->GraphicsOutput.Mode->Info);=0D + }=0D + FreePool (Private->GraphicsOutput.Mode);=0D + Private->GraphicsOutput.Mode =3D NULL;=0D + }=0D +=0D + return EFI_SUCCESS;=0D +}=0D +=0D +=0D +VOID=0D +EFIAPI=0D +ShutdownGopEvent (=0D + IN EFI_EVENT Event,=0D + IN VOID *Context=0D + )=0D +/*++=0D +=0D +Routine Description:=0D +=0D + This is the UGA screen's callback notification function for exit-boot-se= rvices.=0D + All we do here is call EmuGopDestructor().=0D +=0D +Arguments:=0D +=0D + Event - not used=0D + Context - pointer to the Private structure.=0D +=0D +Returns:=0D +=0D + None.=0D +=0D +**/=0D +{=0D + EmuGopDestructor (Context);=0D +}=0D +=0D diff --git a/BhyvePkg/BhyveRfbDxe/VbeShim.asm b/BhyvePkg/BhyveRfbDxe/VbeShi= m.asm new file mode 100644 index 0000000000..86c995a080 --- /dev/null +++ b/BhyvePkg/BhyveRfbDxe/VbeShim.asm @@ -0,0 +1,347 @@ +;-------------------------------------------------------------------------= -----=0D +; @file=0D +; A minimal Int10h stub that allows the Windows 2008 R2 SP1 UEFI guest's b= uggy,=0D +; default VGA driver to switch to 1024x768x32.=0D +;=0D +; Copyright (C) 2015, Nahanni Systems, Inc.=0D +; Copyright (C) 2014, Red Hat, Inc.=0D +; Copyright (c) 2013 - 2014, Intel Corporation. All rights reserved.
=0D +;=0D +; This program and the accompanying materials are licensed and made availa= ble=0D +; under the terms and conditions of the BSD License which accompanies this= =0D +; distribution. The full text of the license may be found at=0D +; http://opensource.org/licenses/bsd-license.php=0D +;=0D +; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WI= THOUT=0D +; WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.=0D +;=0D +;-------------------------------------------------------------------------= -----=0D +=0D +; enable this macro for debug messages=0D +%define DEBUG=0D +=0D +%macro DebugLog 1=0D +%ifdef DEBUG=0D + push si=0D + mov si, %1=0D + call PrintStringSi=0D + pop si=0D +%endif=0D +%endmacro=0D +=0D +=0D +BITS 16=0D +ORG 0=0D +=0D +VbeInfo:=0D +TIMES 256 nop=0D +=0D +VbeModeInfo:=0D +VbeMode1:=0D +TIMES 50 nop=0D +VbeMode2:=0D +TIMES 50 nop=0D +VbeMode3:=0D +TIMES 50 nop=0D +VbeMode4:=0D +TIMES 50 nop=0D +TIMES 56 nop ; filler for 256 bytes=0D +=0D +Handler:=0D + cmp ax, 0x4f00=0D + je GetInfo=0D + cmp ax, 0x4f01=0D + je GetModeInfo=0D + cmp ax, 0x4f02=0D + je SetMode=0D + cmp ax, 0x4f03=0D + je GetMode=0D + cmp ax, 0x4f10=0D + je GetPmCapabilities=0D + cmp ax, 0x4f15=0D + je ReadEdid=0D + cmp ah, 0x00=0D + je SetModeLegacy=0D + DebugLog StrUnkownFunction=0D +Hang:=0D + jmp Hang=0D +=0D +=0D +GetInfo:=0D + push es=0D + push di=0D + push ds=0D + push si=0D + push cx=0D +=0D + DebugLog StrEnterGetInfo=0D +=0D + ; target (es:di) set on input=0D + push cs=0D + pop ds=0D + mov si, VbeInfo=0D + ; source (ds:si) set now=0D +=0D + mov cx, 256=0D + cld=0D + rep movsb=0D +=0D + pop cx=0D + pop si=0D + pop ds=0D + pop di=0D + pop es=0D + jmp Success=0D +=0D +=0D +GetModeInfo:=0D + push es=0D + push di=0D + push ds=0D + push si=0D + push cx=0D +=0D + DebugLog StrEnterGetModeInfo=0D +=0D + and cx, ~0x4000 ; clear potentially set LFB bit in mode number=0D +=0D + cmp cx, 0x013f=0D + je gKnownMode1=0D + cmp cx, 0x0140=0D + je gKnownMode2=0D + cmp cx, 0x0141=0D + je gKnownMode3=0D +=0D + DebugLog StrUnkownMode=0D + jmp Hang=0D +gKnownMode1:=0D + DebugLog StrMode1=0D + mov si, VbeMode1=0D + jmp CopyModeInfo=0D +gKnownMode2:=0D + DebugLog StrMode2=0D + mov si, VbeMode2=0D + jmp CopyModeInfo=0D +gKnownMode3:=0D + DebugLog StrMode3=0D + mov si, VbeMode3=0D + jmp CopyModeInfo=0D +gKnownMode4:=0D + DebugLog StrMode4=0D + mov si, VbeMode4=0D + jmp CopyModeInfo=0D +=0D +CopyModeInfo:=0D + ; target (es:di) set on input=0D + push cs=0D + pop ds=0D + ;mov si, VbeModeInfo=0D + ; source (ds:si) set now=0D +=0D + ;mov cx, 256=0D + mov cx, 50=0D + cld=0D + rep movsb=0D +=0D + pop cx=0D + pop si=0D + pop ds=0D + pop di=0D + pop es=0D + jmp Success=0D +=0D +=0D +SetMode:=0D + push dx=0D + push ax=0D +=0D + DebugLog StrEnterSetMode=0D +=0D + and bx, ~0x4000 ; clear potentially set LFB bit in mode number=0D + cmp bx, 0x013f=0D + je KnownMode1=0D + cmp bx, 0x0140=0D + je KnownMode2=0D + cmp bx, 0x0141=0D + je KnownMode3=0D + DebugLog StrUnkownMode=0D + jmp Hang=0D +KnownMode1:=0D + DebugLog StrMode1=0D + jmp SetModeDone=0D +KnownMode2:=0D + DebugLog StrMode2=0D + jmp SetModeDone=0D +KnownMode3:=0D + DebugLog StrMode3=0D + jmp SetModeDone=0D +KnownMode4:=0D + DebugLog StrMode4=0D +=0D +SetModeDone:=0D + mov [CurMode], bl=0D + mov [CurMode+1], bh=0D + pop ax=0D + pop dx=0D + jmp Success=0D +=0D +=0D +GetMode:=0D + DebugLog StrEnterGetMode=0D + mov bl, [CurMode]=0D + mov bh, [CurMode+1]=0D + jmp Success=0D +=0D +=0D +GetPmCapabilities:=0D + DebugLog StrGetPmCapabilities=0D + mov bx, 0x0080=0D + jmp Success=0D +=0D +=0D +ReadEdid:=0D + push es=0D + push di=0D + push ds=0D + push si=0D + push cx=0D +=0D + DebugLog StrReadEdid=0D +=0D + ; target (es:di) set on input=0D + push cs=0D + pop ds=0D + mov si, Edid=0D + ; source (ds:si) set now=0D +=0D + mov cx, 128=0D + cld=0D + rep movsb=0D +=0D + pop cx=0D + pop si=0D + pop ds=0D + pop di=0D + pop es=0D + jmp Success=0D +=0D +=0D +SetModeLegacy:=0D + DebugLog StrEnterSetModeLegacy=0D +=0D + cmp al, 0x03=0D + je sKnownMode3=0D + cmp al, 0x12=0D + je sKnownMode4=0D + DebugLog StrUnkownMode=0D + jmp Hang=0D +sKnownMode3:=0D + DebugLog StrLegacyMode3=0D + mov al, 0 ; 0x30=0D + jmp SetModeLegacyDone=0D +sKnownMode4:=0D + mov al, 0 ;0x20=0D +SetModeLegacyDone:=0D + DebugLog StrExitSuccess=0D + iret=0D +=0D +=0D +Success:=0D + DebugLog StrExitSuccess=0D + mov ax, 0x004f=0D + iret=0D +=0D +=0D +Unsupported:=0D + DebugLog StrExitUnsupported=0D + mov ax, 0x024f=0D + iret=0D +=0D +=0D +%ifdef DEBUG=0D +PrintStringSi:=0D + pusha=0D + push ds ; save original=0D + push cs=0D + pop ds=0D + mov dx, 0x220 ; bhyve debug cons port=0D + mov ax, 0=0D +PrintStringSiLoop:=0D + lodsb=0D + cmp al, 0=0D + je PrintStringSiDone=0D + out dx, al=0D + jmp PrintStringSiLoop=0D +PrintStringSiDone:=0D + pop ds ; restore original=0D + popa=0D + ret=0D +=0D +=0D +StrExitSuccess:=0D + db 'vOk', 0x0d, 0x0a, 0=0D +=0D +StrExitUnsupported:=0D + db 'vUnsupported', 0x0d, 0x0a, 0=0D +=0D +StrUnkownFunction:=0D + db 'vUnknown Function', 0x0d, 0x0a, 0=0D +=0D +StrEnterGetInfo:=0D + db 'vGetInfo', 0x0d, 0x0a, 0=0D +=0D +StrEnterGetModeInfo:=0D + db 'vGetModeInfo', 0x0d, 0x0a, 0=0D +=0D +StrEnterGetMode:=0D + db 'vGetMode', 0x0d, 0x0a, 0=0D +=0D +StrEnterSetMode:=0D + db 'vSetMode', 0x0d, 0x0a, 0=0D +=0D +StrEnterSetModeLegacy:=0D + db 'vSetModeLegacy', 0x0d, 0x0a, 0=0D +=0D +StrUnkownMode:=0D + db 'vUnkown Mode', 0x0d, 0x0a, 0=0D +=0D +StrGetPmCapabilities:=0D + db 'vGetPmCapabilities', 0x0d, 0x0a, 0=0D +=0D +StrReadEdid:=0D + db 'vReadEdid', 0x0d, 0x0a, 0=0D +=0D +StrLegacyMode3:=0D + db 'vLegacyMode3', 0x0d, 0x0a, 0=0D +=0D +=0D +StrMode1:=0D + db 'mode_640x480x32', 0x0d, 0x0a, 0=0D +StrMode2:=0D + db 'mode_800x600x32', 0x0d, 0x0a, 0=0D +StrMode3:=0D + db 'mode_1024x768x32', 0x0d, 0x0a, 0=0D +StrMode4:=0D + db 'mode_unused', 0x0d, 0x0a, 0=0D +%endif=0D +=0D +CurMode:=0D + db 0x00, 0x00=0D +=0D +;=0D +; EDID stores monitor information. For now, just send back an null item.=0D +;=0D +Edid:=0D + db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00=0D + db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00=0D + db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00=0D + db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00=0D + db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00=0D + db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00=0D + db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00=0D + db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00=0D + db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00=0D + db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00=0D + db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00=0D + db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00=0D + db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00=0D diff --git a/BhyvePkg/BhyveRfbDxe/VbeShim.c b/BhyvePkg/BhyveRfbDxe/VbeShim.c new file mode 100644 index 0000000000..0aa08a2458 --- /dev/null +++ b/BhyvePkg/BhyveRfbDxe/VbeShim.c @@ -0,0 +1,263 @@ +/** @file=0D + Install a fake VGABIOS service handler (real mode Int10h) for the buggy= =0D + Windows 2008 R2 SP1 UEFI guest.=0D +=0D + The handler is never meant to be directly executed by a VCPU; it's there= for=0D + the internal real mode emulator of Windows 2008 R2 SP1.=0D +=0D + The code is based on Ralf Brown's Interrupt List:=0D + =0D + =0D +=0D + Copyright (C) 2015, Nahanni Systems, Inc.=0D + Copyright (C) 2014, Red Hat, Inc.=0D + Copyright (c) 2013 - 2014, Intel Corporation. All rights reserved.
=0D +=0D + This program and the accompanying materials are licensed and made availa= ble=0D + under the terms and conditions of the BSD License which accompanies this= =0D + distribution. The full text of the license may be found at=0D + http://opensource.org/licenses/bsd-license.php=0D +=0D + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WI= THOUT=0D + WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.=0D +**/=0D +=0D +#include =0D +#include =0D +#include =0D +#include =0D +=0D +#include "Gop.h"=0D +#include "VbeShim.h"=0D +=0D +#pragma pack (1)=0D +typedef struct {=0D + UINT16 Offset;=0D + UINT16 Segment;=0D +} IVT_ENTRY;=0D +#pragma pack ()=0D +=0D +//=0D +// This string is displayed by Windows 2008 R2 SP1 in the Screen Resolutio= n,=0D +// Advanced Settings dialog. It should be short.=0D +//=0D +STATIC CONST CHAR8 mProductRevision[] =3D "2.0";=0D +=0D +#define NUM_VBE_MODES 3=0D +STATIC CONST UINT16 vbeModeIds[] =3D {=0D + 0x13f, // 640x480x32=0D + 0x140, // 800x600x32=0D + 0x141 // 1024x768x32=0D +};=0D +=0D +// Modes can be toggled with bit-0=0D +#define VBE_MODE_ENABLED 0x00BB=0D +#define VBE_MODE_DISABLED 0x00BA=0D +=0D +STATIC VBE2_MODE_INFO vbeModes[] =3D {=0D + { // 0x13f 640x480x32=0D +=0D + // ModeAttr - BytesPerScanLine=0D + VBE_MODE_DISABLED, 0x07, 0x00, 0x40, 0x40, 0xA000, 0x00, 0x0000, 640*4= ,=0D + // Width, Height..., Vbe3=0D + 640, 480, 16, 8, 1, 32, 1, 0x06, 0, 0, 1,=0D + // Masks=0D + 0x08, 0x10, 0x08, 0x08, 0x08, 0x00, 0x08, 0x18, 0x00,=0D + // Framebuffer=0D + 0xdeadbeef, 0x0000, 0x0000=0D + },=0D + { // 0x140 800x600x32=0D +=0D + // ModeAttr - BytesPerScanLine=0D + VBE_MODE_DISABLED, 0x07, 0x00, 0x40, 0x40, 0xA000, 0x00, 0x0000, 800*4= ,=0D + // Width, Height..., Vbe3=0D + 800, 600, 16, 8, 1, 32, 1, 0x06, 0, 0, 1,=0D + // Masks=0D + 0x08, 0x10, 0x08, 0x08, 0x08, 0x00, 0x08, 0x18, 0x00,=0D + // Framebuffer=0D + 0xdeadbeef, 0x0000, 0x0000=0D + },=0D + { // 0x141 1024x768x32=0D +=0D + // ModeAttr - BytesPerScanLine=0D + VBE_MODE_ENABLED, 0x07, 0x00, 0x40, 0x40, 0xA000, 0x00, 0x0000, 1024*4= ,=0D + // Width, Height..., Vbe3=0D + 1024, 768, 16, 8, 1, 32, 1, 0x06, 0, 0, 1,=0D + // Masks=0D + 0x08, 0x10, 0x08, 0x08, 0x08, 0x00, 0x08, 0x18, 0x00,=0D + // Framebuffer=0D + 0xdeadbeef, 0x0000, 0x0000=0D + }=0D +};=0D +=0D +/**=0D + Install the VBE Info and VBE Mode Info structures, and the VBE service=0D + handler routine in the C segment. Point the real-mode Int10h interrupt v= ector=0D + to the handler. The only advertised mode is 1024x768x32.=0D +=0D + @param[in] CardName Name of the video card to be exposed in the= =0D + Product Name field of the VBE Info structure= .=0D + @param[in] FrameBufferBase Guest-physical base address of the video car= d's=0D + frame buffer.=0D +**/=0D +VOID=0D +InstallVbeShim (=0D + IN CONST CHAR16 *CardName,=0D + IN EFI_PHYSICAL_ADDRESS FrameBufferBase=0D + )=0D +{=0D + EFI_PHYSICAL_ADDRESS Segment0, SegmentC, SegmentF;=0D + UINTN Segment0Pages;=0D + IVT_ENTRY *Int0x10;=0D + EFI_STATUS Status;=0D + UINTN Pam1Address;=0D + UINT8 Pam1;=0D + UINTN SegmentCPages;=0D + VBE_INFO *VbeInfoFull;=0D + VBE_INFO_BASE *VbeInfo;=0D + UINT8 *Ptr;=0D + UINTN Printed;=0D + VBE_MODE_INFO *VbeModeInfo;=0D + UINTN i;=0D +=0D + Segment0 =3D 0x00000;=0D + SegmentC =3D 0xC0000;=0D + SegmentF =3D 0xF0000;=0D +=0D + //=0D + // Attempt to cover the real mode IVT with an allocation. This is a UEFI= =0D + // driver, hence the arch protocols have been installed previously. Amon= g=0D + // those, the CPU arch protocol has configured the IDT, so we can overwr= ite=0D + // the IVT used in real mode.=0D + //=0D + // The allocation request may fail, eg. if LegacyBiosDxe has already run= .=0D + //=0D + Segment0Pages =3D 1;=0D + Int0x10 =3D (IVT_ENTRY *)(UINTN)Segment0 + 0x10;=0D + Status =3D gBS->AllocatePages (AllocateAddress, EfiBootServicesCode,=0D + Segment0Pages, &Segment0);=0D +=0D + if (EFI_ERROR (Status)) {=0D + EFI_PHYSICAL_ADDRESS Handler;=0D +=0D + //=0D + // Check if a video BIOS handler has been installed previously -- we=0D + // shouldn't override a real video BIOS with our shim, nor our own shi= m if=0D + // it's already present.=0D + //=0D + Handler =3D (Int0x10->Segment << 4) + Int0x10->Offset;=0D + if (Handler >=3D SegmentC && Handler < SegmentF) {=0D + DEBUG ((DEBUG_VERBOSE, "%a: Video BIOS handler found at %04x:%04x\n"= ,=0D + __FUNCTION__, Int0x10->Segment, Int0x10->Offset));=0D + return;=0D + }=0D +=0D + //=0D + // Otherwise we'll overwrite the Int10h vector, even though we may not= own=0D + // the page at zero.=0D + //=0D + DEBUG ((DEBUG_VERBOSE, "%a: failed to allocate page at zero: %r\n",=0D + __FUNCTION__, Status));=0D + } else {=0D + //=0D + // We managed to allocate the page at zero. SVN r14218 guarantees that= it=0D + // is NUL-filled.=0D + //=0D + ASSERT (Int0x10->Segment =3D=3D 0x0000);=0D + ASSERT (Int0x10->Offset =3D=3D 0x0000);=0D + }=0D +=0D + //=0D + // Put the shim in place first.=0D + //=0D + Pam1Address =3D PCI_LIB_ADDRESS (0, 0, 0, 0x5A);=0D + //=0D + // low nibble covers 0xC0000 to 0xC3FFF=0D + // high nibble covers 0xC4000 to 0xC7FFF=0D + // bit1 in each nibble is Write Enable=0D + // bit0 in each nibble is Read Enable=0D + //=0D + Pam1 =3D PciRead8 (Pam1Address);=0D + PciWrite8 (Pam1Address, Pam1 | (BIT1 | BIT0));=0D +=0D + //=0D + // We never added memory space durig PEI or DXE for the C segment, so we= =0D + // don't need to (and can't) allocate from there. Also, guest operating= =0D + // systems will see a hole in the UEFI memory map there.=0D + //=0D + SegmentCPages =3D 4;=0D +=0D + ASSERT (sizeof mVbeShim <=3D EFI_PAGES_TO_SIZE (SegmentCPages));=0D + CopyMem ((VOID *)(UINTN)SegmentC, mVbeShim, sizeof mVbeShim);=0D +=0D + //=0D + // Fill in the VBE INFO structure.=0D + //=0D + VbeInfoFull =3D (VBE_INFO *)(UINTN)SegmentC;=0D + VbeInfo =3D &VbeInfoFull->Base;=0D + Ptr =3D VbeInfoFull->Buffer;=0D +=0D + CopyMem (VbeInfo->Signature, "VESA", 4);=0D + VbeInfo->VesaVersion =3D 0x0200;=0D +=0D + VbeInfo->OemNameAddress =3D (UINT32)SegmentC << 12 | (UINT16)((UINTN)Ptr= -SegmentC);=0D + CopyMem (Ptr, "FBSD", 5);=0D + Ptr +=3D 5;=0D +=0D + VbeInfo->Capabilities =3D BIT1 | BIT0; // DAC can be switched into 8-bit= mode=0D +=0D + VbeInfo->ModeListAddress =3D (UINT32)SegmentC << 12 | (UINT16)((UINTN)Pt= r-SegmentC);=0D + for (i =3D 0; i < NUM_VBE_MODES; i ++) {=0D + *(UINT16*)Ptr =3D vbeModeIds[i]; // mode number=0D + Ptr +=3D 2;=0D + }=0D + *(UINT16*)Ptr =3D 0xFFFF; // mode list terminator=0D + Ptr +=3D 2;=0D +=0D + VbeInfo->VideoMem64K =3D (UINT16)((1024 * 768 * 4 + 65535) / 65536);=0D + VbeInfo->OemSoftwareVersion =3D 0x0200;=0D +=0D + VbeInfo->VendorNameAddress =3D (UINT32)SegmentC << 12 | (UINT16)((UINTN)= Ptr-SegmentC);=0D + CopyMem (Ptr, "FBSD", 5);=0D + Ptr +=3D 5;=0D +=0D + VbeInfo->ProductNameAddress =3D (UINT32)SegmentC << 12 | (UINT16)((UINTN= )Ptr-SegmentC);=0D + Printed =3D AsciiSPrint ((CHAR8 *)Ptr,=0D + sizeof VbeInfoFull->Buffer - (Ptr - VbeInfoFull->Buffer), "%= s",=0D + CardName);=0D + Ptr +=3D Printed + 1;=0D +=0D + VbeInfo->ProductRevAddress =3D (UINT32)SegmentC << 12 | (UINT16)((UINTN)= Ptr-SegmentC);=0D + CopyMem (Ptr, mProductRevision, sizeof mProductRevision);=0D + Ptr +=3D sizeof mProductRevision;=0D +=0D + ASSERT (sizeof VbeInfoFull->Buffer >=3D Ptr - VbeInfoFull->Buffer);=0D + ZeroMem (Ptr, sizeof VbeInfoFull->Buffer - (Ptr - VbeInfoFull->Buffer));= =0D +=0D + //=0D + // Fill in the VBE MODE INFO structure list=0D + //=0D + VbeModeInfo =3D (VBE_MODE_INFO *)(VbeInfoFull + 1);=0D + Ptr =3D (UINT8 *)VbeModeInfo;=0D + for (i =3D 0; i < NUM_VBE_MODES; i++) {=0D + vbeModes[i].LfbAddress =3D (UINT32)FrameBufferBase;=0D + CopyMem (Ptr, &vbeModes[i], 0x32);=0D + Ptr +=3D 0x32;=0D + }=0D +=0D + ZeroMem (Ptr, 56); // Clear remaining bytes=0D +=0D + //=0D + // Clear Write Enable (bit1), keep Read Enable (bit0) set=0D + //=0D + PciWrite8 (Pam1Address, (Pam1 & ~BIT1) | BIT0);=0D +=0D + //=0D + // Second, point the Int10h vector at the shim.=0D + //=0D + Int0x10->Segment =3D (UINT16) ((UINT32)SegmentC >> 4);=0D + Int0x10->Offset =3D (UINT16) ((UINTN) (VbeModeInfo + 1) - SegmentC);=0D +=0D + DEBUG ((DEBUG_INFO, "%a: VBE shim installed to %x:%x\n",=0D + __FUNCTION__, Int0x10->Segment, Int0x10->Offset));=0D +}=0D diff --git a/BhyvePkg/BhyveRfbDxe/VbeShim.h b/BhyvePkg/BhyveRfbDxe/VbeShim.h new file mode 100644 index 0000000000..72b8a3f25f --- /dev/null +++ b/BhyvePkg/BhyveRfbDxe/VbeShim.h @@ -0,0 +1,912 @@ +//=0D +// THIS FILE WAS GENERATED BY "VbeShim.sh". DO NOT EDIT.=0D +//=0D +#ifndef _VBE_SHIM_H_=0D +#define _VBE_SHIM_H_=0D +STATIC CONST UINT8 mVbeShim[] =3D {=0D + /* 00000000 nop */ 0x90,=0D + /* 00000001 nop */ 0x90,=0D + /* 00000002 nop */ 0x90,=0D + /* 00000003 nop */ 0x90,=0D + /* 00000004 nop */ 0x90,=0D + /* 00000005 nop */ 0x90,=0D + /* 00000006 nop */ 0x90,=0D + /* 00000007 nop */ 0x90,=0D + /* 00000008 nop */ 0x90,=0D + /* 00000009 nop */ 0x90,=0D + /* 0000000A nop */ 0x90,=0D + /* 0000000B nop */ 0x90,=0D + /* 0000000C nop */ 0x90,=0D + /* 0000000D nop */ 0x90,=0D + /* 0000000E nop */ 0x90,=0D + /* 0000000F nop */ 0x90,=0D + /* 00000010 nop */ 0x90,=0D + /* 00000011 nop */ 0x90,=0D + /* 00000012 nop */ 0x90,=0D + /* 00000013 nop */ 0x90,=0D + /* 00000014 nop */ 0x90,=0D + /* 00000015 nop */ 0x90,=0D + /* 00000016 nop */ 0x90,=0D + /* 00000017 nop */ 0x90,=0D + /* 00000018 nop */ 0x90,=0D + /* 00000019 nop */ 0x90,=0D + /* 0000001A nop */ 0x90,=0D + /* 0000001B nop */ 0x90,=0D + /* 0000001C nop */ 0x90,=0D + /* 0000001D nop */ 0x90,=0D + /* 0000001E nop */ 0x90,=0D + /* 0000001F nop */ 0x90,=0D + /* 00000020 nop */ 0x90,=0D + /* 00000021 nop */ 0x90,=0D + /* 00000022 nop */ 0x90,=0D + /* 00000023 nop */ 0x90,=0D + /* 00000024 nop */ 0x90,=0D + /* 00000025 nop */ 0x90,=0D + /* 00000026 nop */ 0x90,=0D + /* 00000027 nop */ 0x90,=0D + /* 00000028 nop */ 0x90,=0D + /* 00000029 nop */ 0x90,=0D + /* 0000002A nop */ 0x90,=0D + /* 0000002B nop */ 0x90,=0D + /* 0000002C nop */ 0x90,=0D + /* 0000002D nop */ 0x90,=0D + /* 0000002E nop */ 0x90,=0D + /* 0000002F nop */ 0x90,=0D + /* 00000030 nop */ 0x90,=0D + /* 00000031 nop */ 0x90,=0D + /* 00000032 nop */ 0x90,=0D + /* 00000033 nop */ 0x90,=0D + /* 00000034 nop */ 0x90,=0D + /* 00000035 nop */ 0x90,=0D + /* 00000036 nop */ 0x90,=0D + /* 00000037 nop */ 0x90,=0D + /* 00000038 nop */ 0x90,=0D + /* 00000039 nop */ 0x90,=0D + /* 0000003A nop */ 0x90,=0D + /* 0000003B nop */ 0x90,=0D + /* 0000003C nop */ 0x90,=0D + /* 0000003D nop */ 0x90,=0D + /* 0000003E nop */ 0x90,=0D + /* 0000003F nop */ 0x90,=0D + /* 00000040 nop */ 0x90,=0D + /* 00000041 nop */ 0x90,=0D + /* 00000042 nop */ 0x90,=0D + /* 00000043 nop */ 0x90,=0D + /* 00000044 nop */ 0x90,=0D + /* 00000045 nop */ 0x90,=0D + /* 00000046 nop */ 0x90,=0D + /* 00000047 nop */ 0x90,=0D + /* 00000048 nop */ 0x90,=0D + /* 00000049 nop */ 0x90,=0D + /* 0000004A nop */ 0x90,=0D + /* 0000004B nop */ 0x90,=0D + /* 0000004C nop */ 0x90,=0D + /* 0000004D nop */ 0x90,=0D + /* 0000004E nop */ 0x90,=0D + /* 0000004F nop */ 0x90,=0D + /* 00000050 nop */ 0x90,=0D + /* 00000051 nop */ 0x90,=0D + /* 00000052 nop */ 0x90,=0D + /* 00000053 nop */ 0x90,=0D + /* 00000054 nop */ 0x90,=0D + /* 00000055 nop */ 0x90,=0D + /* 00000056 nop */ 0x90,=0D + /* 00000057 nop */ 0x90,=0D + /* 00000058 nop */ 0x90,=0D + /* 00000059 nop */ 0x90,=0D + /* 0000005A nop */ 0x90,=0D + /* 0000005B nop */ 0x90,=0D + /* 0000005C nop */ 0x90,=0D + /* 0000005D nop */ 0x90,=0D + /* 0000005E nop */ 0x90,=0D + /* 0000005F nop */ 0x90,=0D + /* 00000060 nop */ 0x90,=0D + /* 00000061 nop */ 0x90,=0D + /* 00000062 nop */ 0x90,=0D + /* 00000063 nop */ 0x90,=0D + /* 00000064 nop */ 0x90,=0D + /* 00000065 nop */ 0x90,=0D + /* 00000066 nop */ 0x90,=0D + /* 00000067 nop */ 0x90,=0D + /* 00000068 nop */ 0x90,=0D + /* 00000069 nop */ 0x90,=0D + /* 0000006A nop */ 0x90,=0D + /* 0000006B nop */ 0x90,=0D + /* 0000006C nop */ 0x90,=0D + /* 0000006D nop */ 0x90,=0D + /* 0000006E nop */ 0x90,=0D + /* 0000006F nop */ 0x90,=0D + /* 00000070 nop */ 0x90,=0D + /* 00000071 nop */ 0x90,=0D + /* 00000072 nop */ 0x90,=0D + /* 00000073 nop */ 0x90,=0D + /* 00000074 nop */ 0x90,=0D + /* 00000075 nop */ 0x90,=0D + /* 00000076 nop */ 0x90,=0D + /* 00000077 nop */ 0x90,=0D + /* 00000078 nop */ 0x90,=0D + /* 00000079 nop */ 0x90,=0D + /* 0000007A nop */ 0x90,=0D + /* 0000007B nop */ 0x90,=0D + /* 0000007C nop */ 0x90,=0D + /* 0000007D nop */ 0x90,=0D + /* 0000007E nop */ 0x90,=0D + /* 0000007F nop */ 0x90,=0D + /* 00000080 nop */ 0x90,=0D + /* 00000081 nop */ 0x90,=0D + /* 00000082 nop */ 0x90,=0D + /* 00000083 nop */ 0x90,=0D + /* 00000084 nop */ 0x90,=0D + /* 00000085 nop */ 0x90,=0D + /* 00000086 nop */ 0x90,=0D + /* 00000087 nop */ 0x90,=0D + /* 00000088 nop */ 0x90,=0D + /* 00000089 nop */ 0x90,=0D + /* 0000008A nop */ 0x90,=0D + /* 0000008B nop */ 0x90,=0D + /* 0000008C nop */ 0x90,=0D + /* 0000008D nop */ 0x90,=0D + /* 0000008E nop */ 0x90,=0D + /* 0000008F nop */ 0x90,=0D + /* 00000090 nop */ 0x90,=0D + /* 00000091 nop */ 0x90,=0D + /* 00000092 nop */ 0x90,=0D + /* 00000093 nop */ 0x90,=0D + /* 00000094 nop */ 0x90,=0D + /* 00000095 nop */ 0x90,=0D + /* 00000096 nop */ 0x90,=0D + /* 00000097 nop */ 0x90,=0D + /* 00000098 nop */ 0x90,=0D + /* 00000099 nop */ 0x90,=0D + /* 0000009A nop */ 0x90,=0D + /* 0000009B nop */ 0x90,=0D + /* 0000009C nop */ 0x90,=0D + /* 0000009D nop */ 0x90,=0D + /* 0000009E nop */ 0x90,=0D + /* 0000009F nop */ 0x90,=0D + /* 000000A0 nop */ 0x90,=0D + /* 000000A1 nop */ 0x90,=0D + /* 000000A2 nop */ 0x90,=0D + /* 000000A3 nop */ 0x90,=0D + /* 000000A4 nop */ 0x90,=0D + /* 000000A5 nop */ 0x90,=0D + /* 000000A6 nop */ 0x90,=0D + /* 000000A7 nop */ 0x90,=0D + /* 000000A8 nop */ 0x90,=0D + /* 000000A9 nop */ 0x90,=0D + /* 000000AA nop */ 0x90,=0D + /* 000000AB nop */ 0x90,=0D + /* 000000AC nop */ 0x90,=0D + /* 000000AD nop */ 0x90,=0D + /* 000000AE nop */ 0x90,=0D + /* 000000AF nop */ 0x90,=0D + /* 000000B0 nop */ 0x90,=0D + /* 000000B1 nop */ 0x90,=0D + /* 000000B2 nop */ 0x90,=0D + /* 000000B3 nop */ 0x90,=0D + /* 000000B4 nop */ 0x90,=0D + /* 000000B5 nop */ 0x90,=0D + /* 000000B6 nop */ 0x90,=0D + /* 000000B7 nop */ 0x90,=0D + /* 000000B8 nop */ 0x90,=0D + /* 000000B9 nop */ 0x90,=0D + /* 000000BA nop */ 0x90,=0D + /* 000000BB nop */ 0x90,=0D + /* 000000BC nop */ 0x90,=0D + /* 000000BD nop */ 0x90,=0D + /* 000000BE nop */ 0x90,=0D + /* 000000BF nop */ 0x90,=0D + /* 000000C0 nop */ 0x90,=0D + /* 000000C1 nop */ 0x90,=0D + /* 000000C2 nop */ 0x90,=0D + /* 000000C3 nop */ 0x90,=0D + /* 000000C4 nop */ 0x90,=0D + /* 000000C5 nop */ 0x90,=0D + /* 000000C6 nop */ 0x90,=0D + /* 000000C7 nop */ 0x90,=0D + /* 000000C8 nop */ 0x90,=0D + /* 000000C9 nop */ 0x90,=0D + /* 000000CA nop */ 0x90,=0D + /* 000000CB nop */ 0x90,=0D + /* 000000CC nop */ 0x90,=0D + /* 000000CD nop */ 0x90,=0D + /* 000000CE nop */ 0x90,=0D + /* 000000CF nop */ 0x90,=0D + /* 000000D0 nop */ 0x90,=0D + /* 000000D1 nop */ 0x90,=0D + /* 000000D2 nop */ 0x90,=0D + /* 000000D3 nop */ 0x90,=0D + /* 000000D4 nop */ 0x90,=0D + /* 000000D5 nop */ 0x90,=0D + /* 000000D6 nop */ 0x90,=0D + /* 000000D7 nop */ 0x90,=0D + /* 000000D8 nop */ 0x90,=0D + /* 000000D9 nop */ 0x90,=0D + /* 000000DA nop */ 0x90,=0D + /* 000000DB nop */ 0x90,=0D + /* 000000DC nop */ 0x90,=0D + /* 000000DD nop */ 0x90,=0D + /* 000000DE nop */ 0x90,=0D + /* 000000DF nop */ 0x90,=0D + /* 000000E0 nop */ 0x90,=0D + /* 000000E1 nop */ 0x90,=0D + /* 000000E2 nop */ 0x90,=0D + /* 000000E3 nop */ 0x90,=0D + /* 000000E4 nop */ 0x90,=0D + /* 000000E5 nop */ 0x90,=0D + /* 000000E6 nop */ 0x90,=0D + /* 000000E7 nop */ 0x90,=0D + /* 000000E8 nop */ 0x90,=0D + /* 000000E9 nop */ 0x90,=0D + /* 000000EA nop */ 0x90,=0D + /* 000000EB nop */ 0x90,=0D + /* 000000EC nop */ 0x90,=0D + /* 000000ED nop */ 0x90,=0D + /* 000000EE nop */ 0x90,=0D + /* 000000EF nop */ 0x90,=0D + /* 000000F0 nop */ 0x90,=0D + /* 000000F1 nop */ 0x90,=0D + /* 000000F2 nop */ 0x90,=0D + /* 000000F3 nop */ 0x90,=0D + /* 000000F4 nop */ 0x90,=0D + /* 000000F5 nop */ 0x90,=0D + /* 000000F6 nop */ 0x90,=0D + /* 000000F7 nop */ 0x90,=0D + /* 000000F8 nop */ 0x90,=0D + /* 000000F9 nop */ 0x90,=0D + /* 000000FA nop */ 0x90,=0D + /* 000000FB nop */ 0x90,=0D + /* 000000FC nop */ 0x90,=0D + /* 000000FD nop */ 0x90,=0D + /* 000000FE nop */ 0x90,=0D + /* 000000FF nop */ 0x90,=0D + /* 00000100 nop */ 0x90,=0D + /* 00000101 nop */ 0x90,=0D + /* 00000102 nop */ 0x90,=0D + /* 00000103 nop */ 0x90,=0D + /* 00000104 nop */ 0x90,=0D + /* 00000105 nop */ 0x90,=0D + /* 00000106 nop */ 0x90,=0D + /* 00000107 nop */ 0x90,=0D + /* 00000108 nop */ 0x90,=0D + /* 00000109 nop */ 0x90,=0D + /* 0000010A nop */ 0x90,=0D + /* 0000010B nop */ 0x90,=0D + /* 0000010C nop */ 0x90,=0D + /* 0000010D nop */ 0x90,=0D + /* 0000010E nop */ 0x90,=0D + /* 0000010F nop */ 0x90,=0D + /* 00000110 nop */ 0x90,=0D + /* 00000111 nop */ 0x90,=0D + /* 00000112 nop */ 0x90,=0D + /* 00000113 nop */ 0x90,=0D + /* 00000114 nop */ 0x90,=0D + /* 00000115 nop */ 0x90,=0D + /* 00000116 nop */ 0x90,=0D + /* 00000117 nop */ 0x90,=0D + /* 00000118 nop */ 0x90,=0D + /* 00000119 nop */ 0x90,=0D + /* 0000011A nop */ 0x90,=0D + /* 0000011B nop */ 0x90,=0D + /* 0000011C nop */ 0x90,=0D + /* 0000011D nop */ 0x90,=0D + /* 0000011E nop */ 0x90,=0D + /* 0000011F nop */ 0x90,=0D + /* 00000120 nop */ 0x90,=0D + /* 00000121 nop */ 0x90,=0D + /* 00000122 nop */ 0x90,=0D + /* 00000123 nop */ 0x90,=0D + /* 00000124 nop */ 0x90,=0D + /* 00000125 nop */ 0x90,=0D + /* 00000126 nop */ 0x90,=0D + /* 00000127 nop */ 0x90,=0D + /* 00000128 nop */ 0x90,=0D + /* 00000129 nop */ 0x90,=0D + /* 0000012A nop */ 0x90,=0D + /* 0000012B nop */ 0x90,=0D + /* 0000012C nop */ 0x90,=0D + /* 0000012D nop */ 0x90,=0D + /* 0000012E nop */ 0x90,=0D + /* 0000012F nop */ 0x90,=0D + /* 00000130 nop */ 0x90,=0D + /* 00000131 nop */ 0x90,=0D + /* 00000132 nop */ 0x90,=0D + /* 00000133 nop */ 0x90,=0D + /* 00000134 nop */ 0x90,=0D + /* 00000135 nop */ 0x90,=0D + /* 00000136 nop */ 0x90,=0D + /* 00000137 nop */ 0x90,=0D + /* 00000138 nop */ 0x90,=0D + /* 00000139 nop */ 0x90,=0D + /* 0000013A nop */ 0x90,=0D + /* 0000013B nop */ 0x90,=0D + /* 0000013C nop */ 0x90,=0D + /* 0000013D nop */ 0x90,=0D + /* 0000013E nop */ 0x90,=0D + /* 0000013F nop */ 0x90,=0D + /* 00000140 nop */ 0x90,=0D + /* 00000141 nop */ 0x90,=0D + /* 00000142 nop */ 0x90,=0D + /* 00000143 nop */ 0x90,=0D + /* 00000144 nop */ 0x90,=0D + /* 00000145 nop */ 0x90,=0D + /* 00000146 nop */ 0x90,=0D + /* 00000147 nop */ 0x90,=0D + /* 00000148 nop */ 0x90,=0D + /* 00000149 nop */ 0x90,=0D + /* 0000014A nop */ 0x90,=0D + /* 0000014B nop */ 0x90,=0D + /* 0000014C nop */ 0x90,=0D + /* 0000014D nop */ 0x90,=0D + /* 0000014E nop */ 0x90,=0D + /* 0000014F nop */ 0x90,=0D + /* 00000150 nop */ 0x90,=0D + /* 00000151 nop */ 0x90,=0D + /* 00000152 nop */ 0x90,=0D + /* 00000153 nop */ 0x90,=0D + /* 00000154 nop */ 0x90,=0D + /* 00000155 nop */ 0x90,=0D + /* 00000156 nop */ 0x90,=0D + /* 00000157 nop */ 0x90,=0D + /* 00000158 nop */ 0x90,=0D + /* 00000159 nop */ 0x90,=0D + /* 0000015A nop */ 0x90,=0D + /* 0000015B nop */ 0x90,=0D + /* 0000015C nop */ 0x90,=0D + /* 0000015D nop */ 0x90,=0D + /* 0000015E nop */ 0x90,=0D + /* 0000015F nop */ 0x90,=0D + /* 00000160 nop */ 0x90,=0D + /* 00000161 nop */ 0x90,=0D + /* 00000162 nop */ 0x90,=0D + /* 00000163 nop */ 0x90,=0D + /* 00000164 nop */ 0x90,=0D + /* 00000165 nop */ 0x90,=0D + /* 00000166 nop */ 0x90,=0D + /* 00000167 nop */ 0x90,=0D + /* 00000168 nop */ 0x90,=0D + /* 00000169 nop */ 0x90,=0D + /* 0000016A nop */ 0x90,=0D + /* 0000016B nop */ 0x90,=0D + /* 0000016C nop */ 0x90,=0D + /* 0000016D nop */ 0x90,=0D + /* 0000016E nop */ 0x90,=0D + /* 0000016F nop */ 0x90,=0D + /* 00000170 nop */ 0x90,=0D + /* 00000171 nop */ 0x90,=0D + /* 00000172 nop */ 0x90,=0D + /* 00000173 nop */ 0x90,=0D + /* 00000174 nop */ 0x90,=0D + /* 00000175 nop */ 0x90,=0D + /* 00000176 nop */ 0x90,=0D + /* 00000177 nop */ 0x90,=0D + /* 00000178 nop */ 0x90,=0D + /* 00000179 nop */ 0x90,=0D + /* 0000017A nop */ 0x90,=0D + /* 0000017B nop */ 0x90,=0D + /* 0000017C nop */ 0x90,=0D + /* 0000017D nop */ 0x90,=0D + /* 0000017E nop */ 0x90,=0D + /* 0000017F nop */ 0x90,=0D + /* 00000180 nop */ 0x90,=0D + /* 00000181 nop */ 0x90,=0D + /* 00000182 nop */ 0x90,=0D + /* 00000183 nop */ 0x90,=0D + /* 00000184 nop */ 0x90,=0D + /* 00000185 nop */ 0x90,=0D + /* 00000186 nop */ 0x90,=0D + /* 00000187 nop */ 0x90,=0D + /* 00000188 nop */ 0x90,=0D + /* 00000189 nop */ 0x90,=0D + /* 0000018A nop */ 0x90,=0D + /* 0000018B nop */ 0x90,=0D + /* 0000018C nop */ 0x90,=0D + /* 0000018D nop */ 0x90,=0D + /* 0000018E nop */ 0x90,=0D + /* 0000018F nop */ 0x90,=0D + /* 00000190 nop */ 0x90,=0D + /* 00000191 nop */ 0x90,=0D + /* 00000192 nop */ 0x90,=0D + /* 00000193 nop */ 0x90,=0D + /* 00000194 nop */ 0x90,=0D + /* 00000195 nop */ 0x90,=0D + /* 00000196 nop */ 0x90,=0D + /* 00000197 nop */ 0x90,=0D + /* 00000198 nop */ 0x90,=0D + /* 00000199 nop */ 0x90,=0D + /* 0000019A nop */ 0x90,=0D + /* 0000019B nop */ 0x90,=0D + /* 0000019C nop */ 0x90,=0D + /* 0000019D nop */ 0x90,=0D + /* 0000019E nop */ 0x90,=0D + /* 0000019F nop */ 0x90,=0D + /* 000001A0 nop */ 0x90,=0D + /* 000001A1 nop */ 0x90,=0D + /* 000001A2 nop */ 0x90,=0D + /* 000001A3 nop */ 0x90,=0D + /* 000001A4 nop */ 0x90,=0D + /* 000001A5 nop */ 0x90,=0D + /* 000001A6 nop */ 0x90,=0D + /* 000001A7 nop */ 0x90,=0D + /* 000001A8 nop */ 0x90,=0D + /* 000001A9 nop */ 0x90,=0D + /* 000001AA nop */ 0x90,=0D + /* 000001AB nop */ 0x90,=0D + /* 000001AC nop */ 0x90,=0D + /* 000001AD nop */ 0x90,=0D + /* 000001AE nop */ 0x90,=0D + /* 000001AF nop */ 0x90,=0D + /* 000001B0 nop */ 0x90,=0D + /* 000001B1 nop */ 0x90,=0D + /* 000001B2 nop */ 0x90,=0D + /* 000001B3 nop */ 0x90,=0D + /* 000001B4 nop */ 0x90,=0D + /* 000001B5 nop */ 0x90,=0D + /* 000001B6 nop */ 0x90,=0D + /* 000001B7 nop */ 0x90,=0D + /* 000001B8 nop */ 0x90,=0D + /* 000001B9 nop */ 0x90,=0D + /* 000001BA nop */ 0x90,=0D + /* 000001BB nop */ 0x90,=0D + /* 000001BC nop */ 0x90,=0D + /* 000001BD nop */ 0x90,=0D + /* 000001BE nop */ 0x90,=0D + /* 000001BF nop */ 0x90,=0D + /* 000001C0 nop */ 0x90,=0D + /* 000001C1 nop */ 0x90,=0D + /* 000001C2 nop */ 0x90,=0D + /* 000001C3 nop */ 0x90,=0D + /* 000001C4 nop */ 0x90,=0D + /* 000001C5 nop */ 0x90,=0D + /* 000001C6 nop */ 0x90,=0D + /* 000001C7 nop */ 0x90,=0D + /* 000001C8 nop */ 0x90,=0D + /* 000001C9 nop */ 0x90,=0D + /* 000001CA nop */ 0x90,=0D + /* 000001CB nop */ 0x90,=0D + /* 000001CC nop */ 0x90,=0D + /* 000001CD nop */ 0x90,=0D + /* 000001CE nop */ 0x90,=0D + /* 000001CF nop */ 0x90,=0D + /* 000001D0 nop */ 0x90,=0D + /* 000001D1 nop */ 0x90,=0D + /* 000001D2 nop */ 0x90,=0D + /* 000001D3 nop */ 0x90,=0D + /* 000001D4 nop */ 0x90,=0D + /* 000001D5 nop */ 0x90,=0D + /* 000001D6 nop */ 0x90,=0D + /* 000001D7 nop */ 0x90,=0D + /* 000001D8 nop */ 0x90,=0D + /* 000001D9 nop */ 0x90,=0D + /* 000001DA nop */ 0x90,=0D + /* 000001DB nop */ 0x90,=0D + /* 000001DC nop */ 0x90,=0D + /* 000001DD nop */ 0x90,=0D + /* 000001DE nop */ 0x90,=0D + /* 000001DF nop */ 0x90,=0D + /* 000001E0 nop */ 0x90,=0D + /* 000001E1 nop */ 0x90,=0D + /* 000001E2 nop */ 0x90,=0D + /* 000001E3 nop */ 0x90,=0D + /* 000001E4 nop */ 0x90,=0D + /* 000001E5 nop */ 0x90,=0D + /* 000001E6 nop */ 0x90,=0D + /* 000001E7 nop */ 0x90,=0D + /* 000001E8 nop */ 0x90,=0D + /* 000001E9 nop */ 0x90,=0D + /* 000001EA nop */ 0x90,=0D + /* 000001EB nop */ 0x90,=0D + /* 000001EC nop */ 0x90,=0D + /* 000001ED nop */ 0x90,=0D + /* 000001EE nop */ 0x90,=0D + /* 000001EF nop */ 0x90,=0D + /* 000001F0 nop */ 0x90,=0D + /* 000001F1 nop */ 0x90,=0D + /* 000001F2 nop */ 0x90,=0D + /* 000001F3 nop */ 0x90,=0D + /* 000001F4 nop */ 0x90,=0D + /* 000001F5 nop */ 0x90,=0D + /* 000001F6 nop */ 0x90,=0D + /* 000001F7 nop */ 0x90,=0D + /* 000001F8 nop */ 0x90,=0D + /* 000001F9 nop */ 0x90,=0D + /* 000001FA nop */ 0x90,=0D + /* 000001FB nop */ 0x90,=0D + /* 000001FC nop */ 0x90,=0D + /* 000001FD nop */ 0x90,=0D + /* 000001FE nop */ 0x90,=0D + /* 000001FF nop */ 0x90,=0D + /* 00000200 cmp ax,0x4f00 */ 0x3D, 0x00, 0x4F,=0D + /* 00000203 jz 0x237 */ 0x74, 0x32,=0D + /* 00000205 cmp ax,0x4f01 */ 0x3D, 0x01, 0x4F,=0D + /* 00000208 jz 0x257 */ 0x74, 0x4D,=0D + /* 0000020A cmp ax,0x4f02 */ 0x3D, 0x02, 0x4F,=0D + /* 0000020D jz word 0x2c8 */ 0x0F, 0x84, 0xB7, 0x00,=0D + /* 00000211 cmp ax,0x4f03 */ 0x3D, 0x03, 0x4F,=0D + /* 00000214 jz word 0x325 */ 0x0F, 0x84, 0x0D, 0x01,=0D + /* 00000218 cmp ax,0x4f10 */ 0x3D, 0x10, 0x4F,=0D + /* 0000021B jz word 0x337 */ 0x0F, 0x84, 0x18, 0x01,=0D + /* 0000021F cmp ax,0x4f15 */ 0x3D, 0x15, 0x4F,=0D + /* 00000222 jz word 0x344 */ 0x0F, 0x84, 0x1E, 0x01,=0D + /* 00000226 cmp ah,0x0 */ 0x80, 0xFC, 0x00,=0D + /* 00000229 jz word 0x363 */ 0x0F, 0x84, 0x36, 0x01,=0D + /* 0000022D push si */ 0x56,=0D + /* 0000022E mov si,0x3d7 */ 0xBE, 0xD7, 0x03,=0D + /* 00000231 call word 0x3ad */ 0xE8, 0x79, 0x01,=0D + /* 00000234 pop si */ 0x5E,=0D + /* 00000235 jmp short 0x235 */ 0xEB, 0xFE,=0D + /* 00000237 push es */ 0x06,=0D + /* 00000238 push di */ 0x57,=0D + /* 00000239 push ds */ 0x1E,=0D + /* 0000023A push si */ 0x56,=0D + /* 0000023B push cx */ 0x51,=0D + /* 0000023C push si */ 0x56,=0D + /* 0000023D mov si,0x3eb */ 0xBE, 0xEB, 0x03,=0D + /* 00000240 call word 0x3ad */ 0xE8, 0x6A, 0x01,=0D + /* 00000243 pop si */ 0x5E,=0D + /* 00000244 push cs */ 0x0E,=0D + /* 00000245 pop ds */ 0x1F,=0D + /* 00000246 mov si,0x0 */ 0xBE, 0x00, 0x00,=0D + /* 00000249 mov cx,0x100 */ 0xB9, 0x00, 0x01,=0D + /* 0000024C cld */ 0xFC,=0D + /* 0000024D rep movsb */ 0xF3, 0xA4,=0D + /* 0000024F pop cx */ 0x59,=0D + /* 00000250 pop si */ 0x5E,=0D + /* 00000251 pop ds */ 0x1F,=0D + /* 00000252 pop di */ 0x5F,=0D + /* 00000253 pop es */ 0x07,=0D + /* 00000254 jmp word 0x395 */ 0xE9, 0x3E, 0x01,=0D + /* 00000257 push es */ 0x06,=0D + /* 00000258 push di */ 0x57,=0D + /* 00000259 push ds */ 0x1E,=0D + /* 0000025A push si */ 0x56,=0D + /* 0000025B push cx */ 0x51,=0D + /* 0000025C push si */ 0x56,=0D + /* 0000025D mov si,0x3f6 */ 0xBE, 0xF6, 0x03,=0D + /* 00000260 call word 0x3ad */ 0xE8, 0x4A, 0x01,=0D + /* 00000263 pop si */ 0x5E,=0D + /* 00000264 and cx,0xbfff */ 0x81, 0xE1, 0xFF, 0xBF,=0D + /* 00000268 cmp cx,0x13f */ 0x81, 0xF9, 0x3F, 0x01,=0D + /* 0000026C jz 0x284 */ 0x74, 0x16,=0D + /* 0000026E cmp cx,0x140 */ 0x81, 0xF9, 0x40, 0x01,=0D + /* 00000272 jz 0x291 */ 0x74, 0x1D,=0D + /* 00000274 cmp cx,0x141 */ 0x81, 0xF9, 0x41, 0x01,=0D + /* 00000278 jz 0x29e */ 0x74, 0x24,=0D + /* 0000027A push si */ 0x56,=0D + /* 0000027B mov si,0x42c */ 0xBE, 0x2C, 0x04,=0D + /* 0000027E call word 0x3ad */ 0xE8, 0x2C, 0x01,=0D + /* 00000281 pop si */ 0x5E,=0D + /* 00000282 jmp short 0x235 */ 0xEB, 0xB1,=0D + /* 00000284 push si */ 0x56,=0D + /* 00000285 mov si,0x46b */ 0xBE, 0x6B, 0x04,=0D + /* 00000288 call word 0x3ad */ 0xE8, 0x22, 0x01,=0D + /* 0000028B pop si */ 0x5E,=0D + /* 0000028C mov si,0x100 */ 0xBE, 0x00, 0x01,=0D + /* 0000028F jmp short 0x2b8 */ 0xEB, 0x27,=0D + /* 00000291 push si */ 0x56,=0D + /* 00000292 mov si,0x47d */ 0xBE, 0x7D, 0x04,=0D + /* 00000295 call word 0x3ad */ 0xE8, 0x15, 0x01,=0D + /* 00000298 pop si */ 0x5E,=0D + /* 00000299 mov si,0x132 */ 0xBE, 0x32, 0x01,=0D + /* 0000029C jmp short 0x2b8 */ 0xEB, 0x1A,=0D + /* 0000029E push si */ 0x56,=0D + /* 0000029F mov si,0x48f */ 0xBE, 0x8F, 0x04,=0D + /* 000002A2 call word 0x3ad */ 0xE8, 0x08, 0x01,=0D + /* 000002A5 pop si */ 0x5E,=0D + /* 000002A6 mov si,0x164 */ 0xBE, 0x64, 0x01,=0D + /* 000002A9 jmp short 0x2b8 */ 0xEB, 0x0D,=0D + /* 000002AB push si */ 0x56,=0D + /* 000002AC mov si,0x4a2 */ 0xBE, 0xA2, 0x04,=0D + /* 000002AF call word 0x3ad */ 0xE8, 0xFB, 0x00,=0D + /* 000002B2 pop si */ 0x5E,=0D + /* 000002B3 mov si,0x196 */ 0xBE, 0x96, 0x01,=0D + /* 000002B6 jmp short 0x2b8 */ 0xEB, 0x00,=0D + /* 000002B8 push cs */ 0x0E,=0D + /* 000002B9 pop ds */ 0x1F,=0D + /* 000002BA mov cx,0x32 */ 0xB9, 0x32, 0x00,=0D + /* 000002BD cld */ 0xFC,=0D + /* 000002BE rep movsb */ 0xF3, 0xA4,=0D + /* 000002C0 pop cx */ 0x59,=0D + /* 000002C1 pop si */ 0x5E,=0D + /* 000002C2 pop ds */ 0x1F,=0D + /* 000002C3 pop di */ 0x5F,=0D + /* 000002C4 pop es */ 0x07,=0D + /* 000002C5 jmp word 0x395 */ 0xE9, 0xCD, 0x00,=0D + /* 000002C8 push dx */ 0x52,=0D + /* 000002C9 push ax */ 0x50,=0D + /* 000002CA push si */ 0x56,=0D + /* 000002CB mov si,0x410 */ 0xBE, 0x10, 0x04,=0D + /* 000002CE call word 0x3ad */ 0xE8, 0xDC, 0x00,=0D + /* 000002D1 pop si */ 0x5E,=0D + /* 000002D2 and bx,0xbfff */ 0x81, 0xE3, 0xFF, 0xBF,=0D + /* 000002D6 cmp bx,0x13f */ 0x81, 0xFB, 0x3F, 0x01,=0D + /* 000002DA jz 0x2f3 */ 0x74, 0x17,=0D + /* 000002DC cmp bx,0x140 */ 0x81, 0xFB, 0x40, 0x01,=0D + /* 000002E0 jz 0x2fd */ 0x74, 0x1B,=0D + /* 000002E2 cmp bx,0x141 */ 0x81, 0xFB, 0x41, 0x01,=0D + /* 000002E6 jz 0x307 */ 0x74, 0x1F,=0D + /* 000002E8 push si */ 0x56,=0D + /* 000002E9 mov si,0x42c */ 0xBE, 0x2C, 0x04,=0D + /* 000002EC call word 0x3ad */ 0xE8, 0xBE, 0x00,=0D + /* 000002EF pop si */ 0x5E,=0D + /* 000002F0 jmp word 0x235 */ 0xE9, 0x42, 0xFF,=0D + /* 000002F3 push si */ 0x56,=0D + /* 000002F4 mov si,0x46b */ 0xBE, 0x6B, 0x04,=0D + /* 000002F7 call word 0x3ad */ 0xE8, 0xB3, 0x00,=0D + /* 000002FA pop si */ 0x5E,=0D + /* 000002FB jmp short 0x319 */ 0xEB, 0x1C,=0D + /* 000002FD push si */ 0x56,=0D + /* 000002FE mov si,0x47d */ 0xBE, 0x7D, 0x04,=0D + /* 00000301 call word 0x3ad */ 0xE8, 0xA9, 0x00,=0D + /* 00000304 pop si */ 0x5E,=0D + /* 00000305 jmp short 0x319 */ 0xEB, 0x12,=0D + /* 00000307 push si */ 0x56,=0D + /* 00000308 mov si,0x48f */ 0xBE, 0x8F, 0x04,=0D + /* 0000030B call word 0x3ad */ 0xE8, 0x9F, 0x00,=0D + /* 0000030E pop si */ 0x5E,=0D + /* 0000030F jmp short 0x319 */ 0xEB, 0x08,=0D + /* 00000311 push si */ 0x56,=0D + /* 00000312 mov si,0x4a2 */ 0xBE, 0xA2, 0x04,=0D + /* 00000315 call word 0x3ad */ 0xE8, 0x95, 0x00,=0D + /* 00000318 pop si */ 0x5E,=0D + /* 00000319 mov [0x4b0],bl */ 0x88, 0x1E, 0xB0, 0x04,=0D + /* 0000031D mov [0x4b1],bh */ 0x88, 0x3E, 0xB1, 0x04,=0D + /* 00000321 pop ax */ 0x58,=0D + /* 00000322 pop dx */ 0x5A,=0D + /* 00000323 jmp short 0x395 */ 0xEB, 0x70,=0D + /* 00000325 push si */ 0x56,=0D + /* 00000326 mov si,0x405 */ 0xBE, 0x05, 0x04,=0D + /* 00000329 call word 0x3ad */ 0xE8, 0x81, 0x00,=0D + /* 0000032C pop si */ 0x5E,=0D + /* 0000032D mov bl,[0x4b0] */ 0x8A, 0x1E, 0xB0, 0x04,=0D + /* 00000331 mov bh,[0x4b1] */ 0x8A, 0x3E, 0xB1, 0x04,=0D + /* 00000335 jmp short 0x395 */ 0xEB, 0x5E,=0D + /* 00000337 push si */ 0x56,=0D + /* 00000338 mov si,0x43b */ 0xBE, 0x3B, 0x04,=0D + /* 0000033B call word 0x3ad */ 0xE8, 0x6F, 0x00,=0D + /* 0000033E pop si */ 0x5E,=0D + /* 0000033F mov bx,0x80 */ 0xBB, 0x80, 0x00,=0D + /* 00000342 jmp short 0x395 */ 0xEB, 0x51,=0D + /* 00000344 push es */ 0x06,=0D + /* 00000345 push di */ 0x57,=0D + /* 00000346 push ds */ 0x1E,=0D + /* 00000347 push si */ 0x56,=0D + /* 00000348 push cx */ 0x51,=0D + /* 00000349 push si */ 0x56,=0D + /* 0000034A mov si,0x450 */ 0xBE, 0x50, 0x04,=0D + /* 0000034D call word 0x3ad */ 0xE8, 0x5D, 0x00,=0D + /* 00000350 pop si */ 0x5E,=0D + /* 00000351 push cs */ 0x0E,=0D + /* 00000352 pop ds */ 0x1F,=0D + /* 00000353 mov si,0x4b2 */ 0xBE, 0xB2, 0x04,=0D + /* 00000356 mov cx,0x80 */ 0xB9, 0x80, 0x00,=0D + /* 00000359 cld */ 0xFC,=0D + /* 0000035A rep movsb */ 0xF3, 0xA4,=0D + /* 0000035C pop cx */ 0x59,=0D + /* 0000035D pop si */ 0x5E,=0D + /* 0000035E pop ds */ 0x1F,=0D + /* 0000035F pop di */ 0x5F,=0D + /* 00000360 pop es */ 0x07,=0D + /* 00000361 jmp short 0x395 */ 0xEB, 0x32,=0D + /* 00000363 push si */ 0x56,=0D + /* 00000364 mov si,0x41b */ 0xBE, 0x1B, 0x04,=0D + /* 00000367 call word 0x3ad */ 0xE8, 0x43, 0x00,=0D + /* 0000036A pop si */ 0x5E,=0D + /* 0000036B cmp al,0x3 */ 0x3C, 0x03,=0D + /* 0000036D jz 0x37e */ 0x74, 0x0F,=0D + /* 0000036F cmp al,0x12 */ 0x3C, 0x12,=0D + /* 00000371 jz 0x38a */ 0x74, 0x17,=0D + /* 00000373 push si */ 0x56,=0D + /* 00000374 mov si,0x42c */ 0xBE, 0x2C, 0x04,=0D + /* 00000377 call word 0x3ad */ 0xE8, 0x33, 0x00,=0D + /* 0000037A pop si */ 0x5E,=0D + /* 0000037B jmp word 0x235 */ 0xE9, 0xB7, 0xFE,=0D + /* 0000037E push si */ 0x56,=0D + /* 0000037F mov si,0x45c */ 0xBE, 0x5C, 0x04,=0D + /* 00000382 call word 0x3ad */ 0xE8, 0x28, 0x00,=0D + /* 00000385 pop si */ 0x5E,=0D + /* 00000386 mov al,0x0 */ 0xB0, 0x00,=0D + /* 00000388 jmp short 0x38c */ 0xEB, 0x02,=0D + /* 0000038A mov al,0x0 */ 0xB0, 0x00,=0D + /* 0000038C push si */ 0x56,=0D + /* 0000038D mov si,0x3c2 */ 0xBE, 0xC2, 0x03,=0D + /* 00000390 call word 0x3ad */ 0xE8, 0x1A, 0x00,=0D + /* 00000393 pop si */ 0x5E,=0D + /* 00000394 iretw */ 0xCF,=0D + /* 00000395 push si */ 0x56,=0D + /* 00000396 mov si,0x3c2 */ 0xBE, 0xC2, 0x03,=0D + /* 00000399 call word 0x3ad */ 0xE8, 0x11, 0x00,=0D + /* 0000039C pop si */ 0x5E,=0D + /* 0000039D mov ax,0x4f */ 0xB8, 0x4F, 0x00,=0D + /* 000003A0 iretw */ 0xCF,=0D + /* 000003A1 push si */ 0x56,=0D + /* 000003A2 mov si,0x3c8 */ 0xBE, 0xC8, 0x03,=0D + /* 000003A5 call word 0x3ad */ 0xE8, 0x05, 0x00,=0D + /* 000003A8 pop si */ 0x5E,=0D + /* 000003A9 mov ax,0x24f */ 0xB8, 0x4F, 0x02,=0D + /* 000003AC iretw */ 0xCF,=0D + /* 000003AD pushaw */ 0x60,=0D + /* 000003AE push ds */ 0x1E,=0D + /* 000003AF push cs */ 0x0E,=0D + /* 000003B0 pop ds */ 0x1F,=0D + /* 000003B1 mov dx,0x220 */ 0xBA, 0x20, 0x02,=0D + /* 000003B4 mov ax,0x0 */ 0xB8, 0x00, 0x00,=0D + /* 000003B7 lodsb */ 0xAC,=0D + /* 000003B8 cmp al,0x0 */ 0x3C, 0x00,=0D + /* 000003BA jz 0x3bf */ 0x74, 0x03,=0D + /* 000003BC out dx,al */ 0xEE,=0D + /* 000003BD jmp short 0x3b7 */ 0xEB, 0xF8,=0D + /* 000003BF pop ds */ 0x1F,=0D + /* 000003C0 popaw */ 0x61,=0D + /* 000003C1 ret */ 0xC3,=0D + /* 000003C2 jna 0x413 */ 0x76, 0x4F,=0D + /* 000003C4 imul cx,[di],byte +0xa */ 0x6B, 0x0D, 0x0A,=0D + /* 000003C7 add [bp+0x55],dh */ 0x00, 0x76, 0x55,=0D + /* 000003CA outsb */ 0x6E,=0D + /* 000003CB jnc 0x442 */ 0x73, 0x75,=0D + /* 000003CD jo 0x43f */ 0x70, 0x70,=0D + /* 000003CF outsw */ 0x6F,=0D + /* 000003D0 jc 0x446 */ 0x72, 0x74,=0D + /* 000003D2 fs or ax,0xa */ 0x65, 0x64, 0x0D, 0x0A, 0= x00,=0D + /* 000003D7 jna 0x42e */ 0x76, 0x55,=0D + /* 000003D9 outsb */ 0x6E,=0D + /* 000003DA imul bp,[bp+0x6f],byte +0x77 */ 0x6B, 0x6E, 0x6F, 0x77,=0D + /* 000003DE outsb */ 0x6E,=0D + /* 000003DF and [bp+0x75],al */ 0x20, 0x46, 0x75,=0D + /* 000003E2 outsb */ 0x6E,=0D + /* 000003E3 arpl [si+0x69],si */ 0x63, 0x74, 0x69,=0D + /* 000003E6 outsw */ 0x6F,=0D + /* 000003E7 outsb */ 0x6E,=0D + /* 000003E8 or ax,0xa */ 0x0D, 0x0A, 0x00,=0D + /* 000003EB jna 0x434 */ 0x76, 0x47,=0D + /* 000003ED gs jz 0x439 */ 0x65, 0x74, 0x49,=0D + /* 000003F0 outsb */ 0x6E,=0D + /* 000003F1 outsd */ 0x66, 0x6F,=0D + /* 000003F3 or ax,0xa */ 0x0D, 0x0A, 0x00,=0D + /* 000003F6 jna 0x43f */ 0x76, 0x47,=0D + /* 000003F8 gs jz 0x448 */ 0x65, 0x74, 0x4D,=0D + /* 000003FB outsw */ 0x6F,=0D + /* 000003FC gs dec cx */ 0x64, 0x65, 0x49,=0D + /* 000003FF outsb */ 0x6E,=0D + /* 00000400 outsd */ 0x66, 0x6F,=0D + /* 00000402 or ax,0xa */ 0x0D, 0x0A, 0x00,=0D + /* 00000405 jna 0x44e */ 0x76, 0x47,=0D + /* 00000407 gs jz 0x457 */ 0x65, 0x74, 0x4D,=0D + /* 0000040A outsw */ 0x6F,=0D + /* 0000040B gs or ax,0xa */ 0x64, 0x65, 0x0D, 0x0A, 0= x00,=0D + /* 00000410 jna 0x465 */ 0x76, 0x53,=0D + /* 00000412 gs jz 0x462 */ 0x65, 0x74, 0x4D,=0D + /* 00000415 outsw */ 0x6F,=0D + /* 00000416 gs or ax,0xa */ 0x64, 0x65, 0x0D, 0x0A, 0= x00,=0D + /* 0000041B jna 0x470 */ 0x76, 0x53,=0D + /* 0000041D gs jz 0x46d */ 0x65, 0x74, 0x4D,=0D + /* 00000420 outsw */ 0x6F,=0D + /* 00000421 gs dec sp */ 0x64, 0x65, 0x4C,=0D + /* 00000424 gs a32 popaw */ 0x65, 0x67, 0x61,=0D + /* 00000427 arpl [bx+di+0xd],di */ 0x63, 0x79, 0x0D,=0D + /* 0000042A or al,[bx+si] */ 0x0A, 0x00,=0D + /* 0000042C jna 0x483 */ 0x76, 0x55,=0D + /* 0000042E outsb */ 0x6E,=0D + /* 0000042F imul bp,[bx+0x77],byte +0x6e */ 0x6B, 0x6F, 0x77, 0x6E,=0D + /* 00000433 and [di+0x6f],cl */ 0x20, 0x4D, 0x6F,=0D + /* 00000436 gs or ax,0xa */ 0x64, 0x65, 0x0D, 0x0A, 0= x00,=0D + /* 0000043B jna 0x484 */ 0x76, 0x47,=0D + /* 0000043D gs jz 0x490 */ 0x65, 0x74, 0x50,=0D + /* 00000440 insw */ 0x6D,=0D + /* 00000441 inc bx */ 0x43,=0D + /* 00000442 popaw */ 0x61,=0D + /* 00000443 jo 0x4a6 */ 0x70, 0x61,=0D + /* 00000445 bound bp,[bx+di+0x6c] */ 0x62, 0x69, 0x6C,=0D + /* 00000448 imul si,[si+0x69],word 0x7365 */ 0x69, 0x74, 0x69, 0x65, 0= x73,=0D + /* 0000044D or ax,0xa */ 0x0D, 0x0A, 0x00,=0D + /* 00000450 jna 0x4a4 */ 0x76, 0x52,=0D + /* 00000452 gs popaw */ 0x65, 0x61,=0D + /* 00000454 fs inc bp */ 0x64, 0x45,=0D + /* 00000456 imul sp,[fs:si+0xd],word 0xa */ 0x64, 0x69, 0x64, 0x0D, 0= x0A, 0x00,=0D + /* 0000045C jna 0x4aa */ 0x76, 0x4C,=0D + /* 0000045E gs a32 popaw */ 0x65, 0x67, 0x61,=0D + /* 00000461 arpl [bx+di+0x4d],di */ 0x63, 0x79, 0x4D,=0D + /* 00000464 outsw */ 0x6F,=0D + /* 00000465 xor cx,[gs:di] */ 0x64, 0x65, 0x33, 0x0D,=0D + /* 00000469 or al,[bx+si] */ 0x0A, 0x00,=0D + /* 0000046B insw */ 0x6D,=0D + /* 0000046C outsw */ 0x6F,=0D + /* 0000046D gs pop di */ 0x64, 0x65, 0x5F,=0D + /* 00000470 ss xor al,0x30 */ 0x36, 0x34, 0x30,=0D + /* 00000473 js 0x4a9 */ 0x78, 0x34,=0D + /* 00000475 cmp [bx+si],dh */ 0x38, 0x30,=0D + /* 00000477 js 0x4ac */ 0x78, 0x33,=0D + /* 00000479 xor cl,[di] */ 0x32, 0x0D,=0D + /* 0000047B or al,[bx+si] */ 0x0A, 0x00,=0D + /* 0000047D insw */ 0x6D,=0D + /* 0000047E outsw */ 0x6F,=0D + /* 0000047F gs pop di */ 0x64, 0x65, 0x5F,=0D + /* 00000482 cmp [bx+si],dh */ 0x38, 0x30,=0D + /* 00000484 xor [bx+si+0x36],bh */ 0x30, 0x78, 0x36,=0D + /* 00000487 xor [bx+si],dh */ 0x30, 0x30,=0D + /* 00000489 js 0x4be */ 0x78, 0x33,=0D + /* 0000048B xor cl,[di] */ 0x32, 0x0D,=0D + /* 0000048D or al,[bx+si] */ 0x0A, 0x00,=0D + /* 0000048F insw */ 0x6D,=0D + /* 00000490 outsw */ 0x6F,=0D + /* 00000491 gs pop di */ 0x64, 0x65, 0x5F,=0D + /* 00000494 xor [bx+si],si */ 0x31, 0x30,=0D + /* 00000496 xor dh,[si] */ 0x32, 0x34,=0D + /* 00000498 js 0x4d1 */ 0x78, 0x37,=0D + /* 0000049A cmp [ss:bx+si+0x33],bh */ 0x36, 0x38, 0x78, 0x33,=0D + /* 0000049E xor cl,[di] */ 0x32, 0x0D,=0D + /* 000004A0 or al,[bx+si] */ 0x0A, 0x00,=0D + /* 000004A2 insw */ 0x6D,=0D + /* 000004A3 outsw */ 0x6F,=0D + /* 000004A4 gs pop di */ 0x64, 0x65, 0x5F,=0D + /* 000004A7 jnz 0x517 */ 0x75, 0x6E,=0D + /* 000004A9 jnz 0x51e */ 0x75, 0x73,=0D + /* 000004AB fs or ax,0xa */ 0x65, 0x64, 0x0D, 0x0A, 0= x00,=0D + /* 000004B0 add [bx+si],al */ 0x00, 0x00,=0D + /* 000004B2 add [bx+si],al */ 0x00, 0x00,=0D + /* 000004B4 add [bx+si],al */ 0x00, 0x00,=0D + /* 000004B6 add [bx+si],al */ 0x00, 0x00,=0D + /* 000004B8 add [bx+si],al */ 0x00, 0x00,=0D + /* 000004BA add [bx+si],al */ 0x00, 0x00,=0D + /* 000004BC add [bx+si],al */ 0x00, 0x00,=0D + /* 000004BE add [bx+si],al */ 0x00, 0x00,=0D + /* 000004C0 add [bx+si],al */ 0x00, 0x00,=0D + /* 000004C2 add [bx+si],al */ 0x00, 0x00,=0D + /* 000004C4 add [bx+si],al */ 0x00, 0x00,=0D + /* 000004C6 add [bx+si],al */ 0x00, 0x00,=0D + /* 000004C8 add [bx+si],al */ 0x00, 0x00,=0D + /* 000004CA add [bx+si],al */ 0x00, 0x00,=0D + /* 000004CC add [bx+si],al */ 0x00, 0x00,=0D + /* 000004CE add [bx+si],al */ 0x00, 0x00,=0D + /* 000004D0 add [bx+si],al */ 0x00, 0x00,=0D + /* 000004D2 add [bx+si],al */ 0x00, 0x00,=0D + /* 000004D4 add [bx+si],al */ 0x00, 0x00,=0D + /* 000004D6 add [bx+si],al */ 0x00, 0x00,=0D + /* 000004D8 add [bx+si],al */ 0x00, 0x00,=0D + /* 000004DA add [bx+si],al */ 0x00, 0x00,=0D + /* 000004DC add [bx+si],al */ 0x00, 0x00,=0D + /* 000004DE add [bx+si],al */ 0x00, 0x00,=0D + /* 000004E0 add [bx+si],al */ 0x00, 0x00,=0D + /* 000004E2 add [bx+si],al */ 0x00, 0x00,=0D + /* 000004E4 add [bx+si],al */ 0x00, 0x00,=0D + /* 000004E6 add [bx+si],al */ 0x00, 0x00,=0D + /* 000004E8 add [bx+si],al */ 0x00, 0x00,=0D + /* 000004EA add [bx+si],al */ 0x00, 0x00,=0D + /* 000004EC add [bx+si],al */ 0x00, 0x00,=0D + /* 000004EE add [bx+si],al */ 0x00, 0x00,=0D + /* 000004F0 add [bx+si],al */ 0x00, 0x00,=0D + /* 000004F2 add [bx+si],al */ 0x00, 0x00,=0D + /* 000004F4 add [bx+si],al */ 0x00, 0x00,=0D + /* 000004F6 add [bx+si],al */ 0x00, 0x00,=0D + /* 000004F8 add [bx+si],al */ 0x00, 0x00,=0D + /* 000004FA add [bx+si],al */ 0x00, 0x00,=0D + /* 000004FC add [bx+si],al */ 0x00, 0x00,=0D + /* 000004FE add [bx+si],al */ 0x00, 0x00,=0D + /* 00000500 add [bx+si],al */ 0x00, 0x00,=0D + /* 00000502 add [bx+si],al */ 0x00, 0x00,=0D + /* 00000504 add [bx+si],al */ 0x00, 0x00,=0D + /* 00000506 add [bx+si],al */ 0x00, 0x00,=0D + /* 00000508 add [bx+si],al */ 0x00, 0x00,=0D + /* 0000050A add [bx+si],al */ 0x00, 0x00,=0D + /* 0000050C add [bx+si],al */ 0x00, 0x00,=0D + /* 0000050E add [bx+si],al */ 0x00, 0x00,=0D + /* 00000510 add [bx+si],al */ 0x00, 0x00,=0D + /* 00000512 add [bx+si],al */ 0x00, 0x00,=0D + /* 00000514 add [bx+si],al */ 0x00, 0x00,=0D + /* 00000516 add [bx+si],al */ 0x00, 0x00,=0D + /* 00000518 add [bx+si],al */ 0x00, 0x00,=0D + /* 0000051A add [bx+si],al */ 0x00, 0x00,=0D + /* 0000051C add [bx+si],al */ 0x00, 0x00,=0D + /* 0000051E add [bx+si],al */ 0x00, 0x00,=0D + /* 00000520 add [bx+si],al */ 0x00, 0x00,=0D + /* 00000522 add [bx+si],al */ 0x00, 0x00,=0D + /* 00000524 add [bx+si],al */ 0x00, 0x00,=0D + /* 00000526 add [bx+si],al */ 0x00, 0x00,=0D + /* 00000528 add [bx+si],al */ 0x00, 0x00,=0D + /* 0000052A add [bx+si],al */ 0x00, 0x00,=0D + /* 0000052C add [bx+si],al */ 0x00, 0x00,=0D + /* 0000052E add [bx+si],al */ 0x00, 0x00,=0D + /* 00000530 add [bx+si],al */ 0x00, 0x00,=0D + /* 00000532 add [bx+si],al */ 0x00, 0x00,=0D +};=0D +#endif=0D diff --git a/BhyvePkg/BhyveRfbDxe/VbeShim.sh b/BhyvePkg/BhyveRfbDxe/VbeShim= .sh new file mode 100644 index 0000000000..9c7366af40 --- /dev/null +++ b/BhyvePkg/BhyveRfbDxe/VbeShim.sh @@ -0,0 +1,85 @@ +#!/bin/sh +### +# @file +# Shell script to assemble and dump the fake Int10h handler from NASM sour= ce to +# a C array. +# +# Copyright (C) 2014, Red Hat, Inc. +# Copyright (c) 2013 - 2014, Intel Corporation. All rights reserved.
+# +# This program and the accompanying materials are licensed and made availa= ble +# under the terms and conditions of the BSD License which accompanies this +# distribution. The full text of the license may be found at +# http://opensource.org/licenses/bsd-license.php +# +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WI= THOUT +# WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +# +### + +set -e -u + +STEM=3D$(dirname -- "$0")/$(basename -- "$0" .sh) + +# +# Install exit handler -- remove temporary files. +# +exit_handler() +{ + rm -f -- "$STEM".bin "$STEM".disasm "$STEM".offsets "$STEM".insns \ + "$STEM".bytes +} +trap exit_handler EXIT + +# +# Assemble the source file. +# +nasm -o "$STEM".bin -- "$STEM".asm + +# +# Disassemble it, in order to get a binary dump associated with the source. +# (ndisasm doesn't recognize the "--" end-of-options delimiter.) +# +ndisasm "$STEM".bin >"$STEM".disasm + +# +# Create three files, each with one column of the disassembly. +# +# The first column contains the offsets, and it starts the comment. +# +cut -c 1-8 -- "$STEM".disasm \ +| sed -e 's,^, /* ,' >"$STEM".offsets + +# +# The second column contains the assembly-language instructions, and it cl= oses +# the comment. We first pad it to 30 characters. +# +cut -c 29- -- "$STEM".disasm \ +| sed -e 's,$, ,' \ + -e 's,^\(.\{30\}\).*$,\1 */,' >"$STEM".insns + +# +# The third column contains the bytes corresponding to the instruction, +# represented as C integer constants. First strip trailing whitespace from= the +# middle column of the input disassembly, then process pairs of nibbles. +# +cut -c 11-28 -- "$STEM".disasm \ +| sed -e 's, \+$,,' -e 's/\(..\)/ 0x\1,/g' | sed 's/0x ,//g' >"$STEM".byt= es + +# +# Write the output file, recombining the columns. The output should have C= RLF +# line endings. +# +{ + printf '//\n' + printf '// THIS FILE WAS GENERATED BY "%s". DO NOT EDIT.\n' \ + "$(basename -- "$0")" + printf '//\n' + printf '#ifndef _VBE_SHIM_H_\n' + printf '#define _VBE_SHIM_H_\n' + printf 'STATIC CONST UINT8 mVbeShim[] =3D {\n' + paste -d ' ' -- "$STEM".offsets "$STEM".insns "$STEM".bytes + printf '};\n' + printf '#endif\n' +} \ +| unix2dos >"$STEM".h diff --git a/BhyvePkg/DecomprScratchEnd.fdf.inc b/BhyvePkg/DecomprScratchEn= d.fdf.inc new file mode 100644 index 0000000000..eb5cd49470 --- /dev/null +++ b/BhyvePkg/DecomprScratchEnd.fdf.inc @@ -0,0 +1,72 @@ +## @file=0D +# This FDF include file computes the end of the scratch buffer used in=0D +# DecompressMemFvs() [OvmfPkg/Sec/SecMain.c]. It is based on the decompre= ssed=0D +# (ie. original) size of the LZMA-compressed section of the one FFS file = in=0D +# the FVMAIN_COMPACT firmware volume.=0D +#=0D +# Copyright (C) 2015, Red Hat, Inc.=0D +#=0D +# This program and the accompanying materials are licensed and made avail= able=0D +# under the terms and conditions of the BSD License which accompanies thi= s=0D +# distribution. The full text of the license may be found at=0D +# http://opensource.org/licenses/bsd-license.php=0D +#=0D +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,=0D +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR=0D +# IMPLIED.=0D +##=0D +=0D +# The GUID EE4E5898-3914-4259-9D6E-DC7BD79403CF means "LzmaCustomDecompres= s".=0D +# The decompressed output will have the following structure (see the file= =0D +# "9E21FD93-9C72-4c15-8C4B-E77F1DB2D792SEC1.guided.dummy" in the=0D +# Build/Ovmf*/*/FV/Ffs/9E21FD93-9C72-4c15-8C4B-E77F1DB2D792/ directory):=0D +#=0D +# Size Contents=0D +# ------------------- ---------------------------------------------------= -----=0D +# 4 EFI_COMMON_SECTION_HEADER, stating size 124 (0x7C) = and=0D +# type 0x19 (EFI_SECTION_RAW). The purpose of this se= ction=0D +# is to pad the start of PEIFV to 128 bytes.=0D +# 120 Zero bytes (padding).=0D +#=0D +# 4 EFI_COMMON_SECTION_HEADER, stating size=0D +# (PcdOvmfPeiMemFvSize + 4), and type 0x17=0D +# (EFI_SECTION_FIRMWARE_VOLUME_IMAGE).=0D +# PcdOvmfPeiMemFvSize PEIFV. Note that the above sizes pad the offset of = this=0D +# object to 128 bytes. See also the "guided.dummy.txt= "=0D +# file in the same directory.=0D +#=0D +# 4 EFI_COMMON_SECTION_HEADER, stating size 12 (0xC) an= d=0D +# type 0x19 (EFI_SECTION_RAW). The purpose of this se= ction=0D +# is to pad the start of DXEFV to 16 bytes.=0D +# 8 Zero bytes (padding).=0D +#=0D +# 4 EFI_COMMON_SECTION_HEADER, stating size=0D +# (PcdOvmfDxeMemFvSize + 4), and type 0x17=0D +# (EFI_SECTION_FIRMWARE_VOLUME_IMAGE).=0D +# PcdOvmfDxeMemFvSize DXEFV. Note that the above sizes pad the offset of = this=0D +# object to 16 bytes. See also the "guided.dummy.txt"= file=0D +# in the same directory.=0D +#=0D +# The total size after decompression is (128 + PcdOvmfPeiMemFvSize + 16 += =0D +# PcdOvmfDxeMemFvSize).=0D +=0D +DEFINE OUTPUT_SIZE =3D (128 + gUefiOvmfPkgTokenSpaceGuid.PcdOvmfPeiMemFvSi= ze + 16 + gUefiOvmfPkgTokenSpaceGuid.PcdOvmfDxeMemFvSize)=0D +=0D +# LzmaCustomDecompressLib uses a constant scratch buffer size of 64KB; see= =0D +# SCRATCH_BUFFER_REQUEST_SIZE in=0D +# "MdeModulePkg/Library/LzmaCustomDecompressLib/LzmaDecompress.c".=0D +=0D +DEFINE DECOMP_SCRATCH_SIZE =3D 0x00010000=0D +=0D +# Note: when we use PcdOvmfDxeMemFvBase in this context, BaseTools have no= t yet=0D +# offset it with MEMFD's base address. For that reason we have to do it ma= nually.=0D +#=0D +# The calculation below mirrors DecompressMemFvs() [OvmfPkg/Sec/SecMain.c]= .=0D +=0D +DEFINE OUTPUT_BASE =3D ($(MEMFD_BASE_ADDRESS) + gUefiOvm= fPkgTokenSpaceGuid.PcdOvmfDxeMemFvBase + 0x00100000)=0D +DEFINE DECOMP_SCRATCH_BASE_UNALIGNED =3D ($(OUTPUT_BASE) + $(OUTPUT_SIZE))= =0D +DEFINE DECOMP_SCRATCH_BASE_ALIGNMENT =3D 0x000FFFFF=0D +DEFINE DECOMP_SCRATCH_BASE_MASK =3D 0xFFF00000=0D +DEFINE DECOMP_SCRATCH_BASE =3D (($(DECOMP_SCRATCH_BASE_UNALIGNED= ) + $(DECOMP_SCRATCH_BASE_ALIGNMENT)) & $(DECOMP_SCRATCH_BASE_MASK))=0D +=0D +SET gUefiOvmfPkgTokenSpaceGuid.PcdOvmfDecompressionScratchEnd =3D $(DECOMP= _SCRATCH_BASE) + $(DECOMP_SCRATCH_SIZE)=0D diff --git a/BhyvePkg/Include/Library/BhyveFwCtlLib.h b/BhyvePkg/Include/Li= brary/BhyveFwCtlLib.h new file mode 100644 index 0000000000..8d6d8a83a4 --- /dev/null +++ b/BhyvePkg/Include/Library/BhyveFwCtlLib.h @@ -0,0 +1,52 @@ +/** @file=0D + bhyve firmware configuration access=0D +=0D + Copyright (c) 2015 Nahanni Systems=0D +=0D + This program and the accompanying materials=0D + are licensed and made available under the terms and conditions of the BS= D License=0D + which accompanies this distribution. The full text of the license may b= e found at=0D + http://opensource.org/licenses/bsd-license.php=0D +=0D + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,=0D + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMP= LIED.=0D +=0D +**/=0D +=0D +#ifndef __BHYVE_FW_CTL_LIB__=0D +#define __BHYVE_FW_CTL_LIB__=0D +=0D +/**=0D + Sysctl-like interface to read host information via a dot-separated=0D + ASCII OID.=0D +=0D + The information is copied into the buffer specified by Item. The=0D + size of the buffer is given by the location specified by Size=0D + before the call, and that location gives the amount of data copied=0D + after a successfull call, and after a call that returns a truncated=0D + value with an error return of RETURN_BUFFER_TOO_SMALL.=0D +=0D + The size of the available data can be determined by passing a NULL=0D + argument for Item. The size will be returned in the location pointed=0D + to by Size.=0D +=0D + @param[] Name - ASCII OID name=0D + @param[] Data - return buffer pointer=0D + @param[] Size - pointer to length=0D +=0D + @return RETURN_SUCCESS Valid data/len returned.=0D + RETURN_UNSUPPORTED f/w interface not present.=0D + RETURN_NOT_FOUND OID not found.=0D + RETURN_BUFFER_TOO_SMALL Return message truncated.=0D + RETURN_INVALID_PARAMETER Buffer too large=0D + RETURN_PROTOCOL_ERROR Unknown error from host=0D + **/=0D +RETURN_STATUS=0D +EFIAPI=0D +BhyveFwCtlGet (=0D + IN CONST CHAR8 *Name,=0D + OUT VOID *Item,=0D + IN OUT UINTN *Size=0D + );=0D +=0D +#endif=0D diff --git a/BhyvePkg/Library/BhyveFwCtlLib/BhyveFwCtlLib.c b/BhyvePkg/Libr= ary/BhyveFwCtlLib/BhyveFwCtlLib.c new file mode 100644 index 0000000000..d6a02e48e2 --- /dev/null +++ b/BhyvePkg/Library/BhyveFwCtlLib/BhyveFwCtlLib.c @@ -0,0 +1,431 @@ +/** @file=0D +=0D + Copyright (c) 2011 - 2013, Intel Corporation. All rights reserved.
=0D + Copyright (C) 2013, Red Hat, Inc.=0D + Copyright (c) 2015, Nahanni Systems.=0D +=0D + This program and the accompanying materials=0D + are licensed and made available under the terms and conditions of the BS= D License=0D + which accompanies this distribution. The full text of the license may b= e found at=0D + http://opensource.org/licenses/bsd-license.php=0D +=0D + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,=0D + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMP= LIED.=0D +=0D +**/=0D +=0D +#include "Uefi.h"=0D +#include =0D +#include =0D +#include =0D +#include =0D +#include =0D +#include =0D +#include =0D +=0D +#define FW_PORT 0x510=0D +#define FW_IPORT 0x511=0D +=0D +/* Transport protocol basic operations */=0D +#define OP_NULL 1=0D +#define OP_ECHO 2=0D +#define OP_GET 3=0D +#define OP_GET_LEN 4=0D +#define OP_SET 5=0D +=0D +/* Transport protocol error returns */=0D +#define T_ESUCCESS 0=0D +#define T_ENOENT 2=0D +#define T_E2BIG 7=0D +#define T_EMSGSIZE 40=0D +=0D +#define ROUNDUP(x, y) ((((x)+((y)-1))/(y))*(y))=0D +=0D +STATIC CONST CHAR8 mBhyveSig[4] =3D { 'B', 'H', 'Y', 'V' };=0D +=0D +STATIC BOOLEAN mBhyveFwCtlSupported =3D FALSE;=0D +=0D +STATIC INTN mBhyveFwCtlTxid =3D 0xa5;=0D +=0D +/* XXX Maybe a better inbuilt version of this ? */=0D +struct BIoVec {=0D + VOID *Base;=0D + UINTN Len;=0D +};=0D +=0D +struct MsgRxHdr {=0D + UINT32 Sz;=0D + UINT32 Op;=0D + UINT32 TxId;=0D + UINT32 Err;=0D +};=0D +=0D +STATIC=0D +RETURN_STATUS=0D +EFIAPI=0D +BhyveFwCtl_CvtErr (=0D + IN UINT32 errno=0D + )=0D +{=0D + RETURN_STATUS Status;=0D +=0D + switch (errno) {=0D + case T_ESUCCESS:=0D + Status =3D RETURN_SUCCESS;=0D + break;=0D + case T_ENOENT:=0D + Status =3D RETURN_NOT_FOUND;=0D + break;=0D + case T_E2BIG:=0D + Status =3D RETURN_INVALID_PARAMETER;=0D + break;=0D + case T_EMSGSIZE:=0D + Status =3D RETURN_BUFFER_TOO_SMALL;=0D + break;=0D + default:=0D + Status =3D RETURN_PROTOCOL_ERROR;=0D + break;=0D + }=0D +=0D + return Status;=0D +}=0D +=0D +STATIC=0D +UINTN=0D +EFIAPI=0D +BIov_WLen (=0D + IN struct BIoVec b[]=0D + )=0D +{=0D + UINTN i;=0D + UINTN tLen;=0D +=0D + tLen =3D 0;=0D +=0D + if (b !=3D NULL) {=0D + for (i =3D 0; b[i].Base !=3D NULL; i++)=0D + tLen +=3D ROUNDUP (b[i].Len, sizeof(UINT32));=0D + }=0D +=0D + return tLen;=0D +}=0D +=0D +/**=0D + Utility to send 1-3 bhyes of input as a 4-byte value=0D + with trailing zeroes.=0D + **/=0D +STATIC=0D +UINT32=0D +BIov_Send_Rem (=0D + IN UINT32 *Data,=0D + IN UINTN Len=0D + )=0D +{=0D + union {=0D + UINT8 c[4];=0D + UINT32 w;=0D + } u;=0D + UINT8 *cdata;=0D + UINTN i;=0D +=0D + cdata =3D (UINT8 *)Data;=0D + u.w =3D 0;=0D +=0D + for (i =3D 0; i < Len; i++)=0D + u.c[i] =3D *cdata++;=0D +=0D + return u.w;=0D +}=0D +=0D +/**=0D + Send a block of data out the i/o port as 4-byte quantities,=0D + appending trailing zeroes on the last if required.=0D + **/=0D +STATIC=0D +VOID=0D +BIov_Send (=0D + IN char *Data,=0D + IN UINTN Len=0D + )=0D +{=0D + UINT32 *LData;=0D +=0D + LData =3D (UINT32 *)Data;=0D +=0D + while (Len > sizeof(UINT32)) {=0D + IoWrite32 (FW_PORT, *LData++);=0D + Len -=3D sizeof(UINT32);=0D + }=0D +=0D + if (Len > 0) {=0D + IoWrite32 (FW_PORT, BIov_Send_Rem (LData, Len));=0D + }=0D +}=0D +=0D +/**=0D + Send data described by an array of iovecs out the i/o port.=0D + **/=0D +STATIC=0D +VOID=0D +BIov_SendAll (=0D + IN struct BIoVec b[]=0D + )=0D +{=0D + INTN i;=0D +=0D + if (b !=3D NULL) {=0D + for (i =3D 0; b[i].Base; i++) {=0D + BIov_Send (b[i].Base, b[i].Len);=0D + }=0D + }=0D +}=0D +=0D +/**=0D + Prepend the transport header to a block of data and send.=0D + **/=0D +STATIC=0D +VOID=0D +EFIAPI=0D +BhyveFwCtl_MsgSend(=0D + IN UINTN OpCode,=0D + IN struct BIoVec Data[]=0D + )=0D +{=0D + struct BIoVec hIov[4];=0D + UINTN Hdr[3];=0D + UINTN i;=0D +=0D + /* Set up header as an iovec */=0D + for (i =3D 0; i < 3; i++) {=0D + hIov[i].Base =3D &Hdr[i];=0D + hIov[i].Len =3D sizeof(Hdr[0]);=0D + }=0D + hIov[i].Base =3D NULL;=0D + hIov[i].Len =3D 0;=0D +=0D + /* Initialize header */=0D + Hdr[0] =3D BIov_WLen (hIov) + BIov_WLen (Data);=0D + Hdr[1] =3D OpCode;=0D + Hdr[2] =3D mBhyveFwCtlTxid;=0D +=0D + /* Send header and data */=0D + BIov_SendAll (hIov);=0D + BIov_SendAll (Data);=0D +}=0D +=0D +/**=0D + Read a transport response and optional data from the i/o port.=0D + **/=0D +STATIC=0D +RETURN_STATUS=0D +EFIAPI=0D +BhyveFwCtl_MsgRecv(=0D + OUT struct MsgRxHdr *Rhdr,=0D + OUT struct BIoVec Data[]=0D + )=0D +{=0D + RETURN_STATUS Status;=0D + UINT32 *Dp;=0D + UINT32 Rd;=0D + UINTN remLen;=0D + INTN oLen, xLen;=0D +=0D + Rd =3D IoRead32 (FW_PORT);=0D + if (Rd < sizeof(struct MsgRxHdr)) {=0D + ;=0D + }=0D +=0D + /* Read in header and setup initial error */=0D + Rhdr->Sz =3D Rd;=0D + Rhdr->Op =3D IoRead32 (FW_PORT);=0D + Rhdr->TxId =3D IoRead32 (FW_PORT);=0D + Rhdr->Err =3D IoRead32 (FW_PORT);=0D +=0D + /* Convert transport errno into UEFI error status */=0D + Status =3D BhyveFwCtl_CvtErr(Rhdr->Err);=0D +=0D + remLen =3D Rd - sizeof(struct MsgRxHdr);=0D + xLen =3D 0;=0D +=0D + /*=0D + * A few cases to handle:=0D + * - the user didn't supply a read buffer=0D + * - the buffer is too small for the response=0D + * - the response is zero-length=0D + */=0D + if (Data !=3D NULL) {=0D + Dp =3D (UINT32 *)Data[0].Base;=0D + oLen =3D remLen;=0D + if (remLen > Data[0].Len) {=0D + Status =3D RETURN_BUFFER_TOO_SMALL;=0D + xLen =3D remLen - Data[0].Len;=0D + oLen =3D remLen =3D Data[0].Len;=0D + }=0D + while (remLen > 0) {=0D + *Dp++ =3D IoRead32 (FW_PORT);=0D + remLen -=3D sizeof(UINT32);=0D + }=0D + Data[0].Len =3D oLen;=0D + } else {=0D + /* No user data, but data returned - drop */=0D + if (remLen > 0) {=0D + Status =3D RETURN_BUFFER_TOO_SMALL;=0D + xLen =3D remLen;=0D + }=0D + }=0D +=0D + /* Drop additional data */=0D + while (xLen > 0) {=0D + (void) IoRead32 (FW_PORT);=0D + xLen -=3D sizeof(UINT32);=0D + }=0D +=0D + return Status;=0D +}=0D +=0D +=0D +STATIC=0D +RETURN_STATUS=0D +EFIAPI=0D +BhyveFwCtl_Msg(=0D + IN UINTN OpCode,=0D + IN struct BIoVec Sdata[],=0D + OUT struct BIoVec Rdata[]=0D + )=0D +{=0D + struct MsgRxHdr Rh;=0D + RETURN_STATUS Status;=0D +=0D + Status =3D RETURN_SUCCESS;=0D +=0D + BhyveFwCtl_MsgSend (OpCode, Sdata);=0D + Status =3D BhyveFwCtl_MsgRecv (&Rh, Rdata);=0D +=0D + mBhyveFwCtlTxid++;=0D +=0D + return Status;=0D +}=0D +=0D +STATIC=0D +RETURN_STATUS=0D +EFIAPI=0D +BhyveFwCtlGetLen (=0D + IN CONST CHAR8 *Name,=0D + IN OUT UINTN *Size=0D + )=0D +{=0D + struct BIoVec Req[2], Resp[2];=0D + RETURN_STATUS Status;=0D +=0D + Req[0].Base =3D (VOID *)Name;=0D + Req[0].Len =3D AsciiStrLen (Name) + 1;=0D + Req[1].Base =3D NULL;=0D +=0D + Resp[0].Base =3D Size;=0D + Resp[0].Len =3D sizeof(UINTN);=0D + Resp[1].Base =3D NULL;=0D +=0D + Status =3D BhyveFwCtl_Msg (OP_GET_LEN, Req, Resp);=0D +=0D + return Status;=0D +}=0D +=0D +#define FMAXSZ 1024=0D +STATIC struct {=0D + UINT64 fSize;=0D + UINT32 fData[FMAXSZ];=0D +} FwGetvalBuf;=0D +=0D +STATIC=0D +RETURN_STATUS=0D +EFIAPI=0D +BhyveFwCtlGetVal (=0D + IN CONST CHAR8 *Name,=0D + OUT VOID *Item,=0D + IN OUT UINTN *Size=0D + )=0D +{=0D + struct BIoVec Req[2], Resp[2];=0D + RETURN_STATUS Status;=0D +=0D + /* Make sure temp buffer is larger than passed-in size */=0D + if (*Size > sizeof(FwGetvalBuf.fData))=0D + return RETURN_INVALID_PARAMETER;=0D +=0D + Req[0].Base =3D (VOID *)Name;=0D + Req[0].Len =3D AsciiStrLen(Name) + 1;=0D + Req[1].Base =3D NULL;=0D +=0D + Resp[0].Base =3D &FwGetvalBuf;=0D + Resp[0].Len =3D sizeof(UINT64) + *Size;=0D + Resp[1].Base =3D NULL;=0D +=0D + Status =3D BhyveFwCtl_Msg (OP_GET, Req, Resp);=0D +=0D + /*=0D + * Copy out data on success (or on a truncated message).=0D + * XXX This step can be eliminted with Msg() supporting=0D + * multiple iovecs.=0D + */=0D + if ((Status =3D=3D RETURN_SUCCESS) || (Status =3D=3D RETURN_BUFFER_TOO_S= MALL)) {=0D + *Size =3D FwGetvalBuf.fSize;=0D + CopyMem (Item, FwGetvalBuf.fData, *Size);=0D + }=0D +=0D + return Status;=0D +}=0D +=0D +/**=0D + Front end to the internal GET_LEN and GET protocols=0D + **/=0D +RETURN_STATUS=0D +EFIAPI=0D +BhyveFwCtlGet (=0D + IN CONST CHAR8 *Name,=0D + OUT VOID *Item,=0D + IN OUT UINTN *Size=0D + )=0D +{=0D + RETURN_STATUS Status;=0D +=0D + if (mBhyveFwCtlSupported =3D=3D FALSE)=0D + return RETURN_UNSUPPORTED;=0D +=0D + if (Item =3D=3D NULL) {=0D + Status =3D BhyveFwCtlGetLen (Name, Size);=0D + } else {=0D + Status =3D BhyveFwCtlGetVal (Name, Item, Size);=0D + }=0D +=0D + return Status;=0D +}=0D +=0D +=0D +/**=0D + Library initialization. Probe the host to see if the f/w ctl=0D + interface is supported.=0D + **/=0D +RETURN_STATUS=0D +EFIAPI=0D +BhyveFwCtlInitialize (=0D + VOID=0D + )=0D +{=0D + UINTN i;=0D + UINT8 ch;=0D +=0D + DEBUG ((DEBUG_INFO, "FwCtlInitialize\n"));=0D +=0D + IoWrite16 (FW_PORT, 0x0000);=0D + for (i =3D 0; i < 4; i++) {=0D + ch =3D IoRead8 (FW_IPORT);=0D + if (ch !=3D mBhyveSig[i]) {=0D + DEBUG ((DEBUG_INFO, "Host f/w sig mismatch %c/%c\n", ch, mBhyveSig[i= ]));=0D + return RETURN_SUCCESS;=0D + }=0D + }=0D +=0D + mBhyveFwCtlSupported =3D TRUE;=0D +=0D + return RETURN_SUCCESS;=0D +}=0D diff --git a/BhyvePkg/Library/BhyveFwCtlLib/BhyveFwCtlLib.inf b/BhyvePkg/Li= brary/BhyveFwCtlLib/BhyveFwCtlLib.inf new file mode 100644 index 0000000000..7eccfd0c5e --- /dev/null +++ b/BhyvePkg/Library/BhyveFwCtlLib/BhyveFwCtlLib.inf @@ -0,0 +1,45 @@ +## @file=0D +#=0D +# Copyright (C) 2015 Nahanni Systems=0D +# Copyright (c) 2008 - 2012, Intel Corporation. All rights reserved.
= =0D +#=0D +# This program and the accompanying materials=0D +# are licensed and made available under the terms and conditions of the B= SD License=0D +# which accompanies this distribution. The full text of the license may b= e found at=0D +# http://opensource.org/licenses/bsd-license.php=0D +#=0D +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,=0D +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IM= PLIED.=0D +#=0D +##=0D +=0D +[Defines]=0D + INF_VERSION =3D 0x00010005=0D + BASE_NAME =3D BhyveFwCtlLib=0D + FILE_GUID =3D fd982666-67f9-11e5-a42a-0025908602f6= =0D + MODULE_TYPE =3D BASE=0D + VERSION_STRING =3D 1.0=0D + LIBRARY_CLASS =3D BhyveFwCtlLib|PEIM DXE_DRIVER DXE_RUN= TIME_DRIVER=0D +=0D + CONSTRUCTOR =3D BhyveFwCtlInitialize=0D +=0D +#=0D +# The following information is for reference only and not required by the = build tools.=0D +#=0D +# VALID_ARCHITECTURES =3D X64=0D +#=0D +=0D +[Sources]=0D + BhyveFwCtlLib.c=0D +=0D +[Packages]=0D + MdePkg/MdePkg.dec=0D + BhyvePkg/BhyvePkg.dec=0D +=0D +[LibraryClasses]=0D + BaseLib=0D + BaseMemoryLib=0D + DebugLib=0D + IoLib=0D + MemoryAllocationLib=0D +=0D diff --git a/BhyvePkg/Library/PlatformBootManagerLib/BdsPlatform.c b/BhyveP= kg/Library/PlatformBootManagerLib/BdsPlatform.c new file mode 100644 index 0000000000..48f7473788 --- /dev/null +++ b/BhyvePkg/Library/PlatformBootManagerLib/BdsPlatform.c @@ -0,0 +1,1663 @@ +/** @file=0D + Platform BDS customizations.=0D +=0D + Copyright (c) 2004 - 2018, Intel Corporation. All rights reserved.
=0D + This program and the accompanying materials are licensed and made availa= ble=0D + under the terms and conditions of the BSD License which accompanies this= =0D + distribution. The full text of the license may be found at=0D + http://opensource.org/licenses/bsd-license.php=0D +=0D + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WI= THOUT=0D + WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.=0D +=0D +**/=0D +=0D +#include "BdsPlatform.h"=0D +#include =0D +#include =0D +#include =0D +#include =0D +=0D +#include =0D +=0D +//=0D +// Global data=0D +//=0D +=0D +VOID *mEfiDevPathNotifyReg;=0D +EFI_EVENT mEfiDevPathEvent;=0D +VOID *mEmuVariableEventReg;=0D +EFI_EVENT mEmuVariableEvent;=0D +UINT16 mHostBridgeDevId;=0D +=0D +//=0D +// Table of host IRQs matching PCI IRQs A-D=0D +// (for configuring PCI Interrupt Line register)=0D +//=0D +CONST UINT8 PciHostIrqs[] =3D {=0D + 0x0a, 0x0a, 0x0b, 0x0b=0D +};=0D +=0D +//=0D +// Type definitions=0D +//=0D +=0D +typedef=0D +EFI_STATUS=0D +(EFIAPI *PROTOCOL_INSTANCE_CALLBACK)(=0D + IN EFI_HANDLE Handle,=0D + IN VOID *Instance,=0D + IN VOID *Context=0D + );=0D +=0D +/**=0D + @param[in] Handle - Handle of PCI device instance=0D + @param[in] PciIo - PCI IO protocol instance=0D + @param[in] Pci - PCI Header register block=0D +**/=0D +typedef=0D +EFI_STATUS=0D +(EFIAPI *VISIT_PCI_INSTANCE_CALLBACK)(=0D + IN EFI_HANDLE Handle,=0D + IN EFI_PCI_IO_PROTOCOL *PciIo,=0D + IN PCI_TYPE00 *Pci=0D + );=0D +=0D +=0D +//=0D +// Function prototypes=0D +//=0D +=0D +EFI_STATUS=0D +VisitAllInstancesOfProtocol (=0D + IN EFI_GUID *Id,=0D + IN PROTOCOL_INSTANCE_CALLBACK CallBackFunction,=0D + IN VOID *Context=0D + );=0D +=0D +EFI_STATUS=0D +VisitAllPciInstancesOfProtocol (=0D + IN VISIT_PCI_INSTANCE_CALLBACK CallBackFunction=0D + );=0D +=0D +VOID=0D +InstallDevicePathCallback (=0D + VOID=0D + );=0D +=0D +VOID=0D +PlatformRegisterFvBootOption (=0D + EFI_GUID *FileGuid,=0D + CHAR16 *Description,=0D + UINT32 Attributes=0D + )=0D +{=0D + EFI_STATUS Status;=0D + INTN OptionIndex;=0D + EFI_BOOT_MANAGER_LOAD_OPTION NewOption;=0D + EFI_BOOT_MANAGER_LOAD_OPTION *BootOptions;=0D + UINTN BootOptionCount;=0D + MEDIA_FW_VOL_FILEPATH_DEVICE_PATH FileNode;=0D + EFI_LOADED_IMAGE_PROTOCOL *LoadedImage;=0D + EFI_DEVICE_PATH_PROTOCOL *DevicePath;=0D +=0D + Status =3D gBS->HandleProtocol (=0D + gImageHandle,=0D + &gEfiLoadedImageProtocolGuid,=0D + (VOID **) &LoadedImage=0D + );=0D + ASSERT_EFI_ERROR (Status);=0D +=0D + EfiInitializeFwVolDevicepathNode (&FileNode, FileGuid);=0D + DevicePath =3D DevicePathFromHandle (LoadedImage->DeviceHandle);=0D + ASSERT (DevicePath !=3D NULL);=0D + DevicePath =3D AppendDevicePathNode (=0D + DevicePath,=0D + (EFI_DEVICE_PATH_PROTOCOL *) &FileNode=0D + );=0D + ASSERT (DevicePath !=3D NULL);=0D +=0D + Status =3D EfiBootManagerInitializeLoadOption (=0D + &NewOption,=0D + LoadOptionNumberUnassigned,=0D + LoadOptionTypeBoot,=0D + Attributes,=0D + Description,=0D + DevicePath,=0D + NULL,=0D + 0=0D + );=0D + ASSERT_EFI_ERROR (Status);=0D + FreePool (DevicePath);=0D +=0D + BootOptions =3D EfiBootManagerGetLoadOptions (=0D + &BootOptionCount, LoadOptionTypeBoot=0D + );=0D +=0D + OptionIndex =3D EfiBootManagerFindLoadOption (=0D + &NewOption, BootOptions, BootOptionCount=0D + );=0D +=0D + if (OptionIndex =3D=3D -1) {=0D + Status =3D EfiBootManagerAddLoadOptionVariable (&NewOption, MAX_UINTN)= ;=0D + ASSERT_EFI_ERROR (Status);=0D + }=0D + EfiBootManagerFreeLoadOption (&NewOption);=0D + EfiBootManagerFreeLoadOptions (BootOptions, BootOptionCount);=0D +}=0D +=0D +/**=0D + Remove all MemoryMapped(...)/FvFile(...) and Fv(...)/FvFile(...) boot op= tions=0D + whose device paths do not resolve exactly to an FvFile in the system.=0D +=0D + This removes any boot options that point to binaries built into the firm= ware=0D + and have become stale due to any of the following:=0D + - DXEFV's base address or size changed (historical),=0D + - DXEFV's FvNameGuid changed,=0D + - the FILE_GUID of the pointed-to binary changed,=0D + - the referenced binary is no longer built into the firmware.=0D +=0D + EfiBootManagerFindLoadOption() used in PlatformRegisterFvBootOption() on= ly=0D + avoids exact duplicates.=0D +**/=0D +VOID=0D +RemoveStaleFvFileOptions (=0D + VOID=0D + )=0D +{=0D + EFI_BOOT_MANAGER_LOAD_OPTION *BootOptions;=0D + UINTN BootOptionCount;=0D + UINTN Index;=0D +=0D + BootOptions =3D EfiBootManagerGetLoadOptions (&BootOptionCount,=0D + LoadOptionTypeBoot);=0D +=0D + for (Index =3D 0; Index < BootOptionCount; ++Index) {=0D + EFI_DEVICE_PATH_PROTOCOL *Node1, *Node2, *SearchNode;=0D + EFI_STATUS Status;=0D + EFI_HANDLE FvHandle;=0D +=0D + //=0D + // If the device path starts with neither MemoryMapped(...) nor Fv(...= ),=0D + // then keep the boot option.=0D + //=0D + Node1 =3D BootOptions[Index].FilePath;=0D + if (!(DevicePathType (Node1) =3D=3D HARDWARE_DEVICE_PATH &&=0D + DevicePathSubType (Node1) =3D=3D HW_MEMMAP_DP) &&=0D + !(DevicePathType (Node1) =3D=3D MEDIA_DEVICE_PATH &&=0D + DevicePathSubType (Node1) =3D=3D MEDIA_PIWG_FW_VOL_DP)) {=0D + continue;=0D + }=0D +=0D + //=0D + // If the second device path node is not FvFile(...), then keep the bo= ot=0D + // option.=0D + //=0D + Node2 =3D NextDevicePathNode (Node1);=0D + if (DevicePathType (Node2) !=3D MEDIA_DEVICE_PATH ||=0D + DevicePathSubType (Node2) !=3D MEDIA_PIWG_FW_FILE_DP) {=0D + continue;=0D + }=0D +=0D + //=0D + // Locate the Firmware Volume2 protocol instance that is denoted by th= e=0D + // boot option. If this lookup fails (i.e., the boot option references= a=0D + // firmware volume that doesn't exist), then we'll proceed to delete t= he=0D + // boot option.=0D + //=0D + SearchNode =3D Node1;=0D + Status =3D gBS->LocateDevicePath (&gEfiFirmwareVolume2ProtocolGuid,=0D + &SearchNode, &FvHandle);=0D +=0D + if (!EFI_ERROR (Status)) {=0D + //=0D + // The firmware volume was found; now let's see if it contains the F= vFile=0D + // identified by GUID.=0D + //=0D + EFI_FIRMWARE_VOLUME2_PROTOCOL *FvProtocol;=0D + MEDIA_FW_VOL_FILEPATH_DEVICE_PATH *FvFileNode;=0D + UINTN BufferSize;=0D + EFI_FV_FILETYPE FoundType;=0D + EFI_FV_FILE_ATTRIBUTES FileAttributes;=0D + UINT32 AuthenticationStatus;=0D +=0D + Status =3D gBS->HandleProtocol (FvHandle, &gEfiFirmwareVolume2Protoc= olGuid,=0D + (VOID **)&FvProtocol);=0D + ASSERT_EFI_ERROR (Status);=0D +=0D + FvFileNode =3D (MEDIA_FW_VOL_FILEPATH_DEVICE_PATH *)Node2;=0D + //=0D + // Buffer=3D=3DNULL means we request metadata only: BufferSize, Foun= dType,=0D + // FileAttributes.=0D + //=0D + Status =3D FvProtocol->ReadFile (=0D + FvProtocol,=0D + &FvFileNode->FvFileName, // NameGuid=0D + NULL, // Buffer=0D + &BufferSize,=0D + &FoundType,=0D + &FileAttributes,=0D + &AuthenticationStatus=0D + );=0D + if (!EFI_ERROR (Status)) {=0D + //=0D + // The FvFile was found. Keep the boot option.=0D + //=0D + continue;=0D + }=0D + }=0D +=0D + //=0D + // Delete the boot option.=0D + //=0D + Status =3D EfiBootManagerDeleteLoadOptionVariable (=0D + BootOptions[Index].OptionNumber, LoadOptionTypeBoot);=0D + DEBUG_CODE (=0D + CHAR16 *DevicePathString;=0D +=0D + DevicePathString =3D ConvertDevicePathToText(BootOptions[Index].File= Path,=0D + FALSE, FALSE);=0D + DEBUG ((=0D + EFI_ERROR (Status) ? EFI_D_WARN : DEBUG_VERBOSE,=0D + "%a: removing stale Boot#%04x %s: %r\n",=0D + __FUNCTION__,=0D + (UINT32)BootOptions[Index].OptionNumber,=0D + DevicePathString =3D=3D NULL ? L"" : DevicePathString= ,=0D + Status=0D + ));=0D + if (DevicePathString !=3D NULL) {=0D + FreePool (DevicePathString);=0D + }=0D + );=0D + }=0D +=0D + EfiBootManagerFreeLoadOptions (BootOptions, BootOptionCount);=0D +}=0D +=0D +VOID=0D +PlatformRegisterOptionsAndKeys (=0D + VOID=0D + )=0D +{=0D + EFI_STATUS Status;=0D + EFI_INPUT_KEY Enter;=0D + EFI_INPUT_KEY F2;=0D + EFI_INPUT_KEY Esc;=0D + EFI_BOOT_MANAGER_LOAD_OPTION BootOption;=0D +=0D + //=0D + // Register ENTER as CONTINUE key=0D + //=0D + Enter.ScanCode =3D SCAN_NULL;=0D + Enter.UnicodeChar =3D CHAR_CARRIAGE_RETURN;=0D + Status =3D EfiBootManagerRegisterContinueKeyOption (0, &Enter, NULL);=0D + ASSERT_EFI_ERROR (Status);=0D +=0D + //=0D + // Map F2 to Boot Manager Menu=0D + //=0D + F2.ScanCode =3D SCAN_F2;=0D + F2.UnicodeChar =3D CHAR_NULL;=0D + Esc.ScanCode =3D SCAN_ESC;=0D + Esc.UnicodeChar =3D CHAR_NULL;=0D + Status =3D EfiBootManagerGetBootManagerMenu (&BootOption);=0D + ASSERT_EFI_ERROR (Status);=0D + Status =3D EfiBootManagerAddKeyOptionVariable (=0D + NULL, (UINT16) BootOption.OptionNumber, 0, &F2, NULL=0D + );=0D + ASSERT (Status =3D=3D EFI_SUCCESS || Status =3D=3D EFI_ALREADY_STARTED);= =0D + Status =3D EfiBootManagerAddKeyOptionVariable (=0D + NULL, (UINT16) BootOption.OptionNumber, 0, &Esc, NULL=0D + );=0D + ASSERT (Status =3D=3D EFI_SUCCESS || Status =3D=3D EFI_ALREADY_STARTED);= =0D +}=0D +=0D +EFI_STATUS=0D +EFIAPI=0D +ConnectRootBridge (=0D + IN EFI_HANDLE RootBridgeHandle,=0D + IN VOID *Instance,=0D + IN VOID *Context=0D + );=0D +=0D +STATIC=0D +EFI_STATUS=0D +EFIAPI=0D +ConnectVirtioPciRng (=0D + IN EFI_HANDLE Handle,=0D + IN VOID *Instance,=0D + IN VOID *Context=0D + );=0D +=0D +STATIC=0D +VOID=0D +SaveS3BootScript (=0D + VOID=0D + );=0D +=0D +//=0D +// BDS Platform Functions=0D +//=0D +/**=0D + Do the platform init, can be customized by OEM/IBV=0D +=0D + Possible things that can be done in PlatformBootManagerBeforeConsole:=0D +=0D + > Update console variable: 1. include hot-plug devices;=0D + > 2. Clear ConIn and add SOL for AMT=0D + > Register new Driver#### or Boot####=0D + > Register new Key####: e.g.: F12=0D + > Signal ReadyToLock event=0D + > Authentication action: 1. connect Auth devices;=0D + > 2. Identify auto logon user.=0D +**/=0D +VOID=0D +EFIAPI=0D +PlatformBootManagerBeforeConsole (=0D + VOID=0D + )=0D +{=0D + EFI_HANDLE Handle;=0D + EFI_STATUS Status;=0D +=0D + DEBUG ((DEBUG_INFO, "PlatformBootManagerBeforeConsole\n"));=0D + InstallDevicePathCallback ();=0D +=0D + VisitAllInstancesOfProtocol (&gEfiPciRootBridgeIoProtocolGuid,=0D + ConnectRootBridge, NULL);=0D +=0D + //=0D + // Signal the ACPI platform driver that it can download QEMU ACPI tables= .=0D + //=0D + EfiEventGroupSignal (&gRootBridgesConnectedEventGroupGuid);=0D +=0D + //=0D + // We can't signal End-of-Dxe earlier than this. Namely, End-of-Dxe trig= gers=0D + // the preparation of S3 system information. That logic has a hard depen= dency=0D + // on the presence of the FACS ACPI table. Since our ACPI tables are onl= y=0D + // installed after PCI enumeration completes, we must not trigger the S3= save=0D + // earlier, hence we can't signal End-of-Dxe earlier.=0D + //=0D + EfiEventGroupSignal (&gEfiEndOfDxeEventGroupGuid);=0D +=0D + //=0D + // Prevent further changes to LockBoxes or SMRAM.=0D + //=0D + Handle =3D NULL;=0D + Status =3D gBS->InstallProtocolInterface (&Handle,=0D + &gEfiDxeSmmReadyToLockProtocolGuid, EFI_NATIVE_INTERFACE= ,=0D + NULL);=0D + ASSERT_EFI_ERROR (Status);=0D +=0D + //=0D + // Dispatch deferred images after EndOfDxe event and ReadyToLock=0D + // installation.=0D + //=0D + EfiBootManagerDispatchDeferredImages ();=0D +=0D + PlatformInitializeConsole (gPlatformConsole);=0D +=0D + PlatformRegisterOptionsAndKeys ();=0D +=0D + //=0D + // Install both VIRTIO_DEVICE_PROTOCOL and (dependent) EFI_RNG_PROTOCOL= =0D + // instances on Virtio PCI RNG devices.=0D + //=0D + VisitAllInstancesOfProtocol (&gEfiPciIoProtocolGuid, ConnectVirtioPciRng= ,=0D + NULL);=0D +}=0D +=0D +=0D +EFI_STATUS=0D +EFIAPI=0D +ConnectRootBridge (=0D + IN EFI_HANDLE RootBridgeHandle,=0D + IN VOID *Instance,=0D + IN VOID *Context=0D + )=0D +{=0D + EFI_STATUS Status;=0D +=0D + //=0D + // Make the PCI bus driver connect the root bridge, non-recursively. Thi= s=0D + // will produce a number of child handles with PciIo on them.=0D + //=0D + Status =3D gBS->ConnectController (=0D + RootBridgeHandle, // ControllerHandle=0D + NULL, // DriverImageHandle=0D + NULL, // RemainingDevicePath -- produce all= =0D + // children=0D + FALSE // Recursive=0D + );=0D + return Status;=0D +}=0D +=0D +=0D +STATIC=0D +EFI_STATUS=0D +EFIAPI=0D +ConnectVirtioPciRng (=0D + IN EFI_HANDLE Handle,=0D + IN VOID *Instance,=0D + IN VOID *Context=0D + )=0D +{=0D + EFI_PCI_IO_PROTOCOL *PciIo;=0D + EFI_STATUS Status;=0D + UINT16 VendorId;=0D + UINT16 DeviceId;=0D + UINT8 RevisionId;=0D + BOOLEAN Virtio10;=0D + UINT16 SubsystemId;=0D +=0D + PciIo =3D Instance;=0D +=0D + //=0D + // Read and check VendorId.=0D + //=0D + Status =3D PciIo->Pci.Read (PciIo, EfiPciIoWidthUint16, PCI_VENDOR_ID_OF= FSET,=0D + 1, &VendorId);=0D + if (EFI_ERROR (Status)) {=0D + goto Error;=0D + }=0D + if (VendorId !=3D VIRTIO_VENDOR_ID) {=0D + return EFI_SUCCESS;=0D + }=0D +=0D + //=0D + // Read DeviceId and RevisionId.=0D + //=0D + Status =3D PciIo->Pci.Read (PciIo, EfiPciIoWidthUint16, PCI_DEVICE_ID_OF= FSET,=0D + 1, &DeviceId);=0D + if (EFI_ERROR (Status)) {=0D + goto Error;=0D + }=0D + Status =3D PciIo->Pci.Read (PciIo, EfiPciIoWidthUint8, PCI_REVISION_ID_O= FFSET,=0D + 1, &RevisionId);=0D + if (EFI_ERROR (Status)) {=0D + goto Error;=0D + }=0D +=0D + //=0D + // From DeviceId and RevisionId, determine whether the device is a=0D + // modern-only Virtio 1.0 device. In case of Virtio 1.0, DeviceId can=0D + // immediately be restricted to VIRTIO_SUBSYSTEM_ENTROPY_SOURCE, and=0D + // SubsystemId will only play a sanity-check role. Otherwise, DeviceId c= an=0D + // only be sanity-checked, and SubsystemId will decide.=0D + //=0D + if (DeviceId =3D=3D 0x1040 + VIRTIO_SUBSYSTEM_ENTROPY_SOURCE &&=0D + RevisionId >=3D 0x01) {=0D + Virtio10 =3D TRUE;=0D + } else if (DeviceId >=3D 0x1000 && DeviceId <=3D 0x103F && RevisionId = =3D=3D 0x00) {=0D + Virtio10 =3D FALSE;=0D + } else {=0D + return EFI_SUCCESS;=0D + }=0D +=0D + //=0D + // Read and check SubsystemId as dictated by Virtio10.=0D + //=0D + Status =3D PciIo->Pci.Read (PciIo, EfiPciIoWidthUint16,=0D + PCI_SUBSYSTEM_ID_OFFSET, 1, &SubsystemId);=0D + if (EFI_ERROR (Status)) {=0D + goto Error;=0D + }=0D + if ((Virtio10 && SubsystemId >=3D 0x40) ||=0D + (!Virtio10 && SubsystemId =3D=3D VIRTIO_SUBSYSTEM_ENTROPY_SOURCE)) {= =0D + Status =3D gBS->ConnectController (=0D + Handle, // ControllerHandle=0D + NULL, // DriverImageHandle -- connect all drivers=0D + NULL, // RemainingDevicePath -- produce all child ha= ndles=0D + FALSE // Recursive -- don't follow child handles=0D + );=0D + if (EFI_ERROR (Status)) {=0D + goto Error;=0D + }=0D + }=0D + return EFI_SUCCESS;=0D +=0D +Error:=0D + DEBUG ((DEBUG_ERROR, "%a: %r\n", __FUNCTION__, Status));=0D + return Status;=0D +}=0D +=0D +=0D +/**=0D + Add IsaKeyboard to ConIn; add IsaSerial to ConOut, ConIn, ErrOut.=0D +=0D + @param[in] DeviceHandle Handle of the LPC Bridge device.=0D +=0D + @retval EFI_SUCCESS Console devices on the LPC bridge have been added t= o=0D + ConOut, ConIn, and ErrOut.=0D +=0D + @return Error codes, due to EFI_DEVICE_PATH_PROTOCOL missin= g=0D + from DeviceHandle.=0D +**/=0D +EFI_STATUS=0D +PrepareLpcBridgeDevicePath (=0D + IN EFI_HANDLE DeviceHandle=0D + )=0D +{=0D + EFI_STATUS Status;=0D + EFI_DEVICE_PATH_PROTOCOL *DevicePath;=0D + EFI_DEVICE_PATH_PROTOCOL *TempDevicePath;=0D + CHAR16 *DevPathStr;=0D +=0D + DevicePath =3D NULL;=0D + Status =3D gBS->HandleProtocol (=0D + DeviceHandle,=0D + &gEfiDevicePathProtocolGuid,=0D + (VOID*)&DevicePath=0D + );=0D + if (EFI_ERROR (Status)) {=0D + return Status;=0D + }=0D + TempDevicePath =3D DevicePath;=0D +=0D + //=0D + // Register Keyboard=0D + //=0D + DevicePath =3D AppendDevicePathNode (DevicePath,=0D + (EFI_DEVICE_PATH_PROTOCOL *)&gPnpPs2KeyboardDeviceNode);= =0D +=0D + EfiBootManagerUpdateConsoleVariable (ConIn, DevicePath, NULL);=0D +=0D + //=0D + // Register COM1=0D + //=0D + DevicePath =3D TempDevicePath;=0D + gPnp16550ComPortDeviceNode.UID =3D 0;=0D +=0D + DevicePath =3D AppendDevicePathNode (DevicePath,=0D + (EFI_DEVICE_PATH_PROTOCOL *)&gPnp16550ComPortDeviceNode);= =0D + DevicePath =3D AppendDevicePathNode (DevicePath,=0D + (EFI_DEVICE_PATH_PROTOCOL *)&gUartDeviceNode);=0D + DevicePath =3D AppendDevicePathNode (DevicePath,=0D + (EFI_DEVICE_PATH_PROTOCOL *)&gTerminalTypeDeviceNode);=0D +=0D + //=0D + // Print Device Path=0D + //=0D + DevPathStr =3D ConvertDevicePathToText (DevicePath, FALSE, FALSE);=0D + if (DevPathStr !=3D NULL) {=0D + DEBUG((=0D + DEBUG_INFO,=0D + "BdsPlatform.c+%d: COM%d DevPath: %s\n",=0D + __LINE__,=0D + gPnp16550ComPortDeviceNode.UID + 1,=0D + DevPathStr=0D + ));=0D + FreePool(DevPathStr);=0D + }=0D +=0D + EfiBootManagerUpdateConsoleVariable (ConOut, DevicePath, NULL);=0D + EfiBootManagerUpdateConsoleVariable (ConIn, DevicePath, NULL);=0D + EfiBootManagerUpdateConsoleVariable (ErrOut, DevicePath, NULL);=0D +=0D + // Don't register COM2 which can be used for DBG instead so keep it clea= n=0D +=0D + return EFI_SUCCESS;=0D +}=0D +=0D +EFI_STATUS=0D +GetGopDevicePath (=0D + IN EFI_DEVICE_PATH_PROTOCOL *PciDevicePath,=0D + OUT EFI_DEVICE_PATH_PROTOCOL **GopDevicePath=0D + )=0D +{=0D + UINTN Index;=0D + EFI_STATUS Status;=0D + EFI_HANDLE PciDeviceHandle;=0D + EFI_DEVICE_PATH_PROTOCOL *TempDevicePath;=0D + EFI_DEVICE_PATH_PROTOCOL *TempPciDevicePath;=0D + UINTN GopHandleCount;=0D + EFI_HANDLE *GopHandleBuffer;=0D +=0D + if (PciDevicePath =3D=3D NULL || GopDevicePath =3D=3D NULL) {=0D + return EFI_INVALID_PARAMETER;=0D + }=0D +=0D + //=0D + // Initialize the GopDevicePath to be PciDevicePath=0D + //=0D + *GopDevicePath =3D PciDevicePath;=0D + TempPciDevicePath =3D PciDevicePath;=0D +=0D + Status =3D gBS->LocateDevicePath (=0D + &gEfiDevicePathProtocolGuid,=0D + &TempPciDevicePath,=0D + &PciDeviceHandle=0D + );=0D + if (EFI_ERROR (Status)) {=0D + return Status;=0D + }=0D +=0D + //=0D + // Try to connect this handle, so that GOP driver could start on this=0D + // device and create child handles with GraphicsOutput Protocol installe= d=0D + // on them, then we get device paths of these child handles and select=0D + // them as possible console device.=0D + //=0D + gBS->ConnectController (PciDeviceHandle, NULL, NULL, FALSE);=0D +=0D + Status =3D gBS->LocateHandleBuffer (=0D + ByProtocol,=0D + &gEfiGraphicsOutputProtocolGuid,=0D + NULL,=0D + &GopHandleCount,=0D + &GopHandleBuffer=0D + );=0D + if (!EFI_ERROR (Status)) {=0D + //=0D + // Add all the child handles as possible Console Device=0D + //=0D + for (Index =3D 0; Index < GopHandleCount; Index++) {=0D + Status =3D gBS->HandleProtocol (GopHandleBuffer[Index],=0D + &gEfiDevicePathProtocolGuid, (VOID*)&TempDevicePath)= ;=0D + if (EFI_ERROR (Status)) {=0D + continue;=0D + }=0D + if (CompareMem (=0D + PciDevicePath,=0D + TempDevicePath,=0D + GetDevicePathSize (PciDevicePath) - END_DEVICE_PATH_LENGTH=0D + ) =3D=3D 0) {=0D + //=0D + // In current implementation, we only enable one of the child hand= les=0D + // as console device, i.e. sotre one of the child handle's device= =0D + // path to variable "ConOut"=0D + // In future, we could select all child handles to be console devi= ce=0D + //=0D +=0D + *GopDevicePath =3D TempDevicePath;=0D +=0D + //=0D + // Delete the PCI device's path that added by=0D + // GetPlugInPciVgaDevicePath(). Add the integrity GOP device path.= =0D + //=0D + EfiBootManagerUpdateConsoleVariable (ConOutDev, NULL, PciDevicePat= h);=0D + EfiBootManagerUpdateConsoleVariable (ConOutDev, TempDevicePath, NU= LL);=0D + }=0D + }=0D + gBS->FreePool (GopHandleBuffer);=0D + }=0D +=0D + return EFI_SUCCESS;=0D +}=0D +=0D +/**=0D + Add PCI display to ConOut.=0D +=0D + @param[in] DeviceHandle Handle of the PCI display device.=0D +=0D + @retval EFI_SUCCESS The PCI display device has been added to ConOut.=0D +=0D + @return Error codes, due to EFI_DEVICE_PATH_PROTOCOL missin= g=0D + from DeviceHandle.=0D +**/=0D +EFI_STATUS=0D +PreparePciDisplayDevicePath (=0D + IN EFI_HANDLE DeviceHandle=0D + )=0D +{=0D + EFI_STATUS Status;=0D + EFI_DEVICE_PATH_PROTOCOL *DevicePath;=0D + EFI_DEVICE_PATH_PROTOCOL *GopDevicePath;=0D +=0D + DevicePath =3D NULL;=0D + GopDevicePath =3D NULL;=0D + Status =3D gBS->HandleProtocol (=0D + DeviceHandle,=0D + &gEfiDevicePathProtocolGuid,=0D + (VOID*)&DevicePath=0D + );=0D + if (EFI_ERROR (Status)) {=0D + return Status;=0D + }=0D +=0D + GetGopDevicePath (DevicePath, &GopDevicePath);=0D + DevicePath =3D GopDevicePath;=0D +=0D + EfiBootManagerUpdateConsoleVariable (ConOut, DevicePath, NULL);=0D +=0D + return EFI_SUCCESS;=0D +}=0D +=0D +/**=0D + Add PCI Serial to ConOut, ConIn, ErrOut.=0D +=0D + @param[in] DeviceHandle Handle of the PCI serial device.=0D +=0D + @retval EFI_SUCCESS The PCI serial device has been added to ConOut, Con= In,=0D + ErrOut.=0D +=0D + @return Error codes, due to EFI_DEVICE_PATH_PROTOCOL missin= g=0D + from DeviceHandle.=0D +**/=0D +EFI_STATUS=0D +PreparePciSerialDevicePath (=0D + IN EFI_HANDLE DeviceHandle=0D + )=0D +{=0D + EFI_STATUS Status;=0D + EFI_DEVICE_PATH_PROTOCOL *DevicePath;=0D +=0D + DevicePath =3D NULL;=0D + Status =3D gBS->HandleProtocol (=0D + DeviceHandle,=0D + &gEfiDevicePathProtocolGuid,=0D + (VOID*)&DevicePath=0D + );=0D + if (EFI_ERROR (Status)) {=0D + return Status;=0D + }=0D +=0D + DevicePath =3D AppendDevicePathNode (DevicePath,=0D + (EFI_DEVICE_PATH_PROTOCOL *)&gUartDeviceNode);=0D + DevicePath =3D AppendDevicePathNode (DevicePath,=0D + (EFI_DEVICE_PATH_PROTOCOL *)&gTerminalTypeDeviceNode);=0D +=0D + EfiBootManagerUpdateConsoleVariable (ConOut, DevicePath, NULL);=0D + EfiBootManagerUpdateConsoleVariable (ConIn, DevicePath, NULL);=0D + EfiBootManagerUpdateConsoleVariable (ErrOut, DevicePath, NULL);=0D +=0D + return EFI_SUCCESS;=0D +}=0D +=0D +EFI_STATUS=0D +VisitAllInstancesOfProtocol (=0D + IN EFI_GUID *Id,=0D + IN PROTOCOL_INSTANCE_CALLBACK CallBackFunction,=0D + IN VOID *Context=0D + )=0D +{=0D + EFI_STATUS Status;=0D + UINTN HandleCount;=0D + EFI_HANDLE *HandleBuffer;=0D + UINTN Index;=0D + VOID *Instance;=0D +=0D + //=0D + // Start to check all the PciIo to find all possible device=0D + //=0D + HandleCount =3D 0;=0D + HandleBuffer =3D NULL;=0D + Status =3D gBS->LocateHandleBuffer (=0D + ByProtocol,=0D + Id,=0D + NULL,=0D + &HandleCount,=0D + &HandleBuffer=0D + );=0D + if (EFI_ERROR (Status)) {=0D + return Status;=0D + }=0D +=0D + for (Index =3D 0; Index < HandleCount; Index++) {=0D + Status =3D gBS->HandleProtocol (HandleBuffer[Index], Id, &Instance);=0D + if (EFI_ERROR (Status)) {=0D + continue;=0D + }=0D +=0D + Status =3D (*CallBackFunction) (=0D + HandleBuffer[Index],=0D + Instance,=0D + Context=0D + );=0D + }=0D +=0D + gBS->FreePool (HandleBuffer);=0D +=0D + return EFI_SUCCESS;=0D +}=0D +=0D +=0D +EFI_STATUS=0D +EFIAPI=0D +VisitingAPciInstance (=0D + IN EFI_HANDLE Handle,=0D + IN VOID *Instance,=0D + IN VOID *Context=0D + )=0D +{=0D + EFI_STATUS Status;=0D + EFI_PCI_IO_PROTOCOL *PciIo;=0D + PCI_TYPE00 Pci;=0D +=0D + PciIo =3D (EFI_PCI_IO_PROTOCOL*) Instance;=0D +=0D + //=0D + // Check for all PCI device=0D + //=0D + Status =3D PciIo->Pci.Read (=0D + PciIo,=0D + EfiPciIoWidthUint32,=0D + 0,=0D + sizeof (Pci) / sizeof (UINT32),=0D + &Pci=0D + );=0D + if (EFI_ERROR (Status)) {=0D + return Status;=0D + }=0D +=0D + return (*(VISIT_PCI_INSTANCE_CALLBACK)(UINTN) Context) (=0D + Handle,=0D + PciIo,=0D + &Pci=0D + );=0D +=0D +}=0D +=0D +=0D +=0D +EFI_STATUS=0D +VisitAllPciInstances (=0D + IN VISIT_PCI_INSTANCE_CALLBACK CallBackFunction=0D + )=0D +{=0D + return VisitAllInstancesOfProtocol (=0D + &gEfiPciIoProtocolGuid,=0D + VisitingAPciInstance,=0D + (VOID*)(UINTN) CallBackFunction=0D + );=0D +}=0D +=0D +=0D +/**=0D + Do platform specific PCI Device check and add them to=0D + ConOut, ConIn, ErrOut.=0D +=0D + @param[in] Handle - Handle of PCI device instance=0D + @param[in] PciIo - PCI IO protocol instance=0D + @param[in] Pci - PCI Header register block=0D +=0D + @retval EFI_SUCCESS - PCI Device check and Console variable update=0D + successfully.=0D + @retval EFI_STATUS - PCI Device check or Console variable update fail.=0D +=0D +**/=0D +EFI_STATUS=0D +EFIAPI=0D +DetectAndPreparePlatformPciDevicePath (=0D + IN EFI_HANDLE Handle,=0D + IN EFI_PCI_IO_PROTOCOL *PciIo,=0D + IN PCI_TYPE00 *Pci=0D + )=0D +{=0D + EFI_STATUS Status;=0D +=0D + Status =3D PciIo->Attributes (=0D + PciIo,=0D + EfiPciIoAttributeOperationEnable,=0D + EFI_PCI_DEVICE_ENABLE,=0D + NULL=0D + );=0D + ASSERT_EFI_ERROR (Status);=0D +=0D + //=0D + // Here we decide whether it is LPC Bridge=0D + //=0D + if ((IS_PCI_LPC (Pci)) ||=0D + ((IS_PCI_ISA_PDECODE (Pci)) &&=0D + (Pci->Hdr.VendorId =3D=3D 0x8086) &&=0D + (Pci->Hdr.DeviceId =3D=3D 0x7000)=0D + )=0D + ) {=0D + //=0D + // Add IsaKeyboard to ConIn,=0D + // add IsaSerial to ConOut, ConIn, ErrOut=0D + //=0D + DEBUG ((DEBUG_INFO, "Found LPC Bridge device\n"));=0D + PrepareLpcBridgeDevicePath (Handle);=0D + return EFI_SUCCESS;=0D + }=0D + //=0D + // Here we decide which Serial device to enable in PCI bus=0D + //=0D + if (IS_PCI_16550SERIAL (Pci)) {=0D + //=0D + // Add them to ConOut, ConIn, ErrOut.=0D + //=0D + DEBUG ((DEBUG_INFO, "Found PCI 16550 SERIAL device\n"));=0D + PreparePciSerialDevicePath (Handle);=0D + return EFI_SUCCESS;=0D + }=0D +=0D + //=0D + // Here we decide which display device to enable in PCI bus=0D + //=0D + if (IS_PCI_DISPLAY (Pci)) {=0D + //=0D + // Add them to ConOut.=0D + //=0D + DEBUG ((DEBUG_INFO, "Found PCI display device\n"));=0D + PreparePciDisplayDevicePath (Handle);=0D + return EFI_SUCCESS;=0D + }=0D +=0D + return Status;=0D +}=0D +=0D +=0D +/**=0D + Connect the predefined platform default console device.=0D +=0D + Always try to find and enable PCI display devices.=0D +=0D + @param[in] PlatformConsole Predefined platform default console device a= rray.=0D +**/=0D +VOID=0D +PlatformInitializeConsole (=0D + IN PLATFORM_CONSOLE_CONNECT_ENTRY *PlatformConsole=0D + )=0D +{=0D + UINTN Index;=0D +=0D + //=0D + // Do platform specific PCI Device check and add them to ConOut, ConIn,= =0D + // ErrOut=0D + //=0D + VisitAllPciInstances (DetectAndPreparePlatformPciDevicePath);=0D +=0D + //=0D + // Have chance to connect the platform default console,=0D + // the platform default console is the minimum device group=0D + // the platform should support=0D + //=0D + for (Index =3D 0; PlatformConsole[Index].DevicePath !=3D NULL; ++Index) = {=0D + //=0D + // Update the console variable with the connect type=0D + //=0D + if ((PlatformConsole[Index].ConnectType & CONSOLE_IN) =3D=3D CONSOLE_I= N) {=0D + EfiBootManagerUpdateConsoleVariable (ConIn,=0D + PlatformConsole[Index].DevicePath, NULL);=0D + }=0D + if ((PlatformConsole[Index].ConnectType & CONSOLE_OUT) =3D=3D CONSOLE_= OUT) {=0D + EfiBootManagerUpdateConsoleVariable (ConOut,=0D + PlatformConsole[Index].DevicePath, NULL);=0D + }=0D + if ((PlatformConsole[Index].ConnectType & STD_ERROR) =3D=3D STD_ERROR)= {=0D + EfiBootManagerUpdateConsoleVariable (ErrOut,=0D + PlatformConsole[Index].DevicePath, NULL);=0D + }=0D + }=0D +}=0D +=0D +=0D +/**=0D + Configure PCI Interrupt Line register for applicable devices=0D + Ported from SeaBIOS, src/fw/pciinit.c, *_pci_slot_get_irq()=0D +=0D + @param[in] Handle - Handle of PCI device instance=0D + @param[in] PciIo - PCI IO protocol instance=0D + @param[in] PciHdr - PCI Header register block=0D +=0D + @retval EFI_SUCCESS - PCI Interrupt Line register configured successfull= y.=0D +=0D +**/=0D +EFI_STATUS=0D +EFIAPI=0D +SetPciIntLine (=0D + IN EFI_HANDLE Handle,=0D + IN EFI_PCI_IO_PROTOCOL *PciIo,=0D + IN PCI_TYPE00 *PciHdr=0D + )=0D +{=0D + EFI_DEVICE_PATH_PROTOCOL *DevPathNode;=0D + EFI_DEVICE_PATH_PROTOCOL *DevPath;=0D + UINTN RootSlot;=0D + UINTN Idx;=0D + UINT8 IrqLine;=0D + EFI_STATUS Status;=0D + UINT32 RootBusNumber;=0D +=0D + Status =3D EFI_SUCCESS;=0D +=0D + if (PciHdr->Device.InterruptPin !=3D 0) {=0D +=0D + DevPathNode =3D DevicePathFromHandle (Handle);=0D + ASSERT (DevPathNode !=3D NULL);=0D + DevPath =3D DevPathNode;=0D +=0D + RootBusNumber =3D 0;=0D + if (DevicePathType (DevPathNode) =3D=3D ACPI_DEVICE_PATH &&=0D + DevicePathSubType (DevPathNode) =3D=3D ACPI_DP &&=0D + ((ACPI_HID_DEVICE_PATH *)DevPathNode)->HID =3D=3D EISA_PNP_ID(0x0A= 03)) {=0D + RootBusNumber =3D ((ACPI_HID_DEVICE_PATH *)DevPathNode)->UID;=0D + }=0D +=0D + //=0D + // Compute index into PciHostIrqs[] table by walking=0D + // the device path and adding up all device numbers=0D + //=0D + Status =3D EFI_NOT_FOUND;=0D + RootSlot =3D 0;=0D + Idx =3D PciHdr->Device.InterruptPin - 1;=0D + while (!IsDevicePathEnd (DevPathNode)) {=0D + if (DevicePathType (DevPathNode) =3D=3D HARDWARE_DEVICE_PATH &&=0D + DevicePathSubType (DevPathNode) =3D=3D HW_PCI_DP) {=0D +=0D + Idx +=3D ((PCI_DEVICE_PATH *)DevPathNode)->Device;=0D +=0D + //=0D + // Unlike SeaBIOS, which starts climbing from the leaf device=0D + // up toward the root, we traverse the device path starting at=0D + // the root moving toward the leaf node.=0D + // The slot number of the top-level parent bridge is needed for=0D + // Q35 cases with more than 24 slots on the root bus.=0D + //=0D + if (Status !=3D EFI_SUCCESS) {=0D + Status =3D EFI_SUCCESS;=0D + RootSlot =3D ((PCI_DEVICE_PATH *)DevPathNode)->Device;=0D + }=0D + }=0D +=0D + DevPathNode =3D NextDevicePathNode (DevPathNode);=0D + }=0D + if (EFI_ERROR (Status)) {=0D + return Status;=0D + }=0D + if (RootBusNumber =3D=3D 0 && RootSlot =3D=3D 0) {=0D + DEBUG((=0D + DEBUG_ERROR,=0D + "%a: PCI host bridge (00:00.0) should have no interrupts!\n",=0D + __FUNCTION__=0D + ));=0D + ASSERT (FALSE);=0D + }=0D +=0D + //=0D + // Final PciHostIrqs[] index calculation depends on the platform=0D + // and should match SeaBIOS src/fw/pciinit.c *_pci_slot_get_irq()=0D + //=0D + switch (mHostBridgeDevId) {=0D + case 0x1275: // BHYVE=0D + case INTEL_82441_DEVICE_ID:=0D + Idx -=3D 1;=0D + break;=0D + case INTEL_Q35_MCH_DEVICE_ID:=0D + //=0D + // SeaBIOS contains the following comment:=0D + // "Slots 0-24 rotate slot:pin mapping similar to piix above, but= =0D + // with a different starting index - see q35-acpi-dsdt.dsl.=0D + //=0D + // Slots 25-31 all use LNKA mapping (or LNKE, but A:D =3D E:H)"=0D + //=0D + if (RootSlot > 24) {=0D + //=0D + // in this case, subtract back out RootSlot from Idx=0D + // (SeaBIOS never adds it to begin with, but that would make our= =0D + // device path traversal loop above too awkward)=0D + //=0D + Idx -=3D RootSlot;=0D + }=0D + break;=0D + default:=0D + ASSERT (FALSE); // should never get here=0D + }=0D + Idx %=3D ARRAY_SIZE (PciHostIrqs);=0D + IrqLine =3D PciHostIrqs[Idx];=0D +=0D + DEBUG_CODE_BEGIN ();=0D + {=0D + CHAR16 *DevPathString;=0D + STATIC CHAR16 Fallback[] =3D L"";=0D + UINTN Segment, Bus, Device, Function;=0D +=0D + DevPathString =3D ConvertDevicePathToText (DevPath, FALSE, FALSE);=0D + if (DevPathString =3D=3D NULL) {=0D + DevPathString =3D Fallback;=0D + }=0D + Status =3D PciIo->GetLocation (PciIo, &Segment, &Bus, &Device, &Func= tion);=0D + ASSERT_EFI_ERROR (Status);=0D +=0D + DEBUG ((DEBUG_VERBOSE, "%a: [%02x:%02x.%x] %s -> 0x%02x\n", __FUNCTI= ON__,=0D + (UINT32)Bus, (UINT32)Device, (UINT32)Function, DevPathString,=0D + IrqLine));=0D +=0D + if (DevPathString !=3D Fallback) {=0D + FreePool (DevPathString);=0D + }=0D + }=0D + DEBUG_CODE_END ();=0D +=0D + //=0D + // Set PCI Interrupt Line register for this device to PciHostIrqs[Idx]= =0D + //=0D + Status =3D PciIo->Pci.Write (=0D + PciIo,=0D + EfiPciIoWidthUint8,=0D + PCI_INT_LINE_OFFSET,=0D + 1,=0D + &IrqLine=0D + );=0D + }=0D +=0D + return Status;=0D +}=0D +=0D +=0D +VOID=0D +PciAcpiInitialization (=0D + )=0D +{=0D + UINTN Pmba;=0D +=0D + //=0D + // Query Host Bridge DID to determine platform type=0D + //=0D + mHostBridgeDevId =3D PcdGet16 (PcdOvmfHostBridgePciDevId);=0D + switch (mHostBridgeDevId) {=0D + case 0x1275: // BHYVE=0D + case INTEL_82441_DEVICE_ID:=0D + Pmba =3D POWER_MGMT_REGISTER_PIIX4 (PIIX4_PMBA);=0D + //=0D + // 00:01.0 ISA Bridge (PIIX4) LNK routing targets=0D + //=0D + PciWrite8 (PCI_LIB_ADDRESS (0, 1, 0, 0x60), 0x0b); // A=0D + PciWrite8 (PCI_LIB_ADDRESS (0, 1, 0, 0x61), 0x0b); // B=0D + PciWrite8 (PCI_LIB_ADDRESS (0, 1, 0, 0x62), 0x0a); // C=0D + PciWrite8 (PCI_LIB_ADDRESS (0, 1, 0, 0x63), 0x0a); // D=0D + break;=0D + case INTEL_Q35_MCH_DEVICE_ID:=0D + Pmba =3D POWER_MGMT_REGISTER_Q35 (ICH9_PMBASE);=0D + //=0D + // 00:1f.0 LPC Bridge (Q35) LNK routing targets=0D + //=0D + PciWrite8 (PCI_LIB_ADDRESS (0, 0x1f, 0, 0x60), 0x0a); // A=0D + PciWrite8 (PCI_LIB_ADDRESS (0, 0x1f, 0, 0x61), 0x0a); // B=0D + PciWrite8 (PCI_LIB_ADDRESS (0, 0x1f, 0, 0x62), 0x0b); // C=0D + PciWrite8 (PCI_LIB_ADDRESS (0, 0x1f, 0, 0x63), 0x0b); // D=0D + PciWrite8 (PCI_LIB_ADDRESS (0, 0x1f, 0, 0x68), 0x0a); // E=0D + PciWrite8 (PCI_LIB_ADDRESS (0, 0x1f, 0, 0x69), 0x0a); // F=0D + PciWrite8 (PCI_LIB_ADDRESS (0, 0x1f, 0, 0x6a), 0x0b); // G=0D + PciWrite8 (PCI_LIB_ADDRESS (0, 0x1f, 0, 0x6b), 0x0b); // H=0D + break;=0D + default:=0D + DEBUG ((DEBUG_ERROR, "%a: Unknown Host Bridge Device ID: 0x%04x\n",= =0D + __FUNCTION__, mHostBridgeDevId));=0D + ASSERT (FALSE);=0D + return;=0D + }=0D +=0D + //=0D + // Initialize PCI_INTERRUPT_LINE for applicable present PCI devices=0D + //=0D + VisitAllPciInstances (SetPciIntLine);=0D +=0D + //=0D + // Set ACPI SCI_EN bit in PMCNTRL=0D + //=0D + IoOr16 ((PciRead32 (Pmba) & ~BIT0) + 4, BIT0);=0D +}=0D +=0D +EFI_STATUS=0D +EFIAPI=0D +ConnectRecursivelyIfPciMassStorage (=0D + IN EFI_HANDLE Handle,=0D + IN EFI_PCI_IO_PROTOCOL *Instance,=0D + IN PCI_TYPE00 *PciHeader=0D + )=0D +{=0D + EFI_STATUS Status;=0D + EFI_DEVICE_PATH_PROTOCOL *DevicePath;=0D + CHAR16 *DevPathStr;=0D +=0D + //=0D + // Recognize PCI Mass Storage, and Xen PCI devices=0D + //=0D + if (IS_CLASS1 (PciHeader, PCI_CLASS_MASS_STORAGE)) {=0D + DevicePath =3D NULL;=0D + Status =3D gBS->HandleProtocol (=0D + Handle,=0D + &gEfiDevicePathProtocolGuid,=0D + (VOID*)&DevicePath=0D + );=0D + if (EFI_ERROR (Status)) {=0D + return Status;=0D + }=0D +=0D + //=0D + // Print Device Path=0D + //=0D + DevPathStr =3D ConvertDevicePathToText (DevicePath, FALSE, FALSE);=0D + if (DevPathStr !=3D NULL) {=0D + DEBUG((=0D + DEBUG_INFO,=0D + "Found %s device: %s\n",=0D + (IS_CLASS1 (PciHeader, PCI_CLASS_MASS_STORAGE) ?=0D + L"Mass Storage" :=0D + L"Xen"=0D + ),=0D + DevPathStr=0D + ));=0D + FreePool(DevPathStr);=0D + }=0D +=0D + Status =3D gBS->ConnectController (Handle, NULL, NULL, TRUE);=0D + if (EFI_ERROR (Status)) {=0D + return Status;=0D + }=0D +=0D + }=0D +=0D + return EFI_SUCCESS;=0D +}=0D +=0D +=0D +/**=0D + This notification function is invoked when the=0D + EMU Variable FVB has been changed.=0D +=0D + @param Event The event that occurred=0D + @param Context For EFI compatibility. Not used.=0D +=0D +**/=0D +VOID=0D +EFIAPI=0D +EmuVariablesUpdatedCallback (=0D + IN EFI_EVENT Event,=0D + IN VOID *Context=0D + )=0D +{=0D + DEBUG ((DEBUG_INFO, "EmuVariablesUpdatedCallback\n"));=0D + UpdateNvVarsOnFileSystem ();=0D +}=0D +=0D +=0D +EFI_STATUS=0D +EFIAPI=0D +VisitingFileSystemInstance (=0D + IN EFI_HANDLE Handle,=0D + IN VOID *Instance,=0D + IN VOID *Context=0D + )=0D +{=0D + EFI_STATUS Status;=0D + STATIC BOOLEAN ConnectedToFileSystem =3D FALSE;=0D + RETURN_STATUS PcdStatus;=0D +=0D + if (ConnectedToFileSystem) {=0D + return EFI_ALREADY_STARTED;=0D + }=0D +=0D + Status =3D ConnectNvVarsToFileSystem (Handle);=0D + if (EFI_ERROR (Status)) {=0D + return Status;=0D + }=0D +=0D + ConnectedToFileSystem =3D TRUE;=0D + mEmuVariableEvent =3D=0D + EfiCreateProtocolNotifyEvent (=0D + &gEfiDevicePathProtocolGuid,=0D + TPL_CALLBACK,=0D + EmuVariablesUpdatedCallback,=0D + NULL,=0D + &mEmuVariableEventReg=0D + );=0D + PcdStatus =3D PcdSet64S (PcdEmuVariableEvent,=0D + (UINT64)(UINTN) mEmuVariableEvent);=0D + ASSERT_RETURN_ERROR (PcdStatus);=0D +=0D + return EFI_SUCCESS;=0D +}=0D +=0D +=0D +VOID=0D +PlatformBdsRestoreNvVarsFromHardDisk (=0D + )=0D +{=0D + VisitAllPciInstances (ConnectRecursivelyIfPciMassStorage);=0D + VisitAllInstancesOfProtocol (=0D + &gEfiSimpleFileSystemProtocolGuid,=0D + VisitingFileSystemInstance,=0D + NULL=0D + );=0D +=0D +}=0D +=0D +/**=0D + Connect with predefined platform connect sequence.=0D +=0D + The OEM/IBV can customize with their own connect sequence.=0D +**/=0D +VOID=0D +PlatformBdsConnectSequence (=0D + VOID=0D + )=0D +{=0D + UINTN Index;=0D +=0D + DEBUG ((DEBUG_INFO, "PlatformBdsConnectSequence\n"));=0D +=0D + Index =3D 0;=0D +=0D + //=0D + // Here we can get the customized platform connect sequence=0D + // Notes: we can connect with new variable which record the=0D + // last time boots connect device path sequence=0D + //=0D + while (gPlatformConnectSequence[Index] !=3D NULL) {=0D + //=0D + // Build the platform boot option=0D + //=0D + EfiBootManagerConnectDevicePath (gPlatformConnectSequence[Index], NULL= );=0D + Index++;=0D + }=0D +=0D + //=0D + // Just use the simple policy to connect all devices=0D + //=0D + DEBUG ((DEBUG_INFO, "EfiBootManagerConnectAll\n"));=0D + EfiBootManagerConnectAll ();=0D +}=0D +=0D +/**=0D + Save the S3 boot script.=0D +=0D + Note that DxeSmmReadyToLock must be signaled after this function returns= ;=0D + otherwise the script wouldn't be saved actually.=0D +**/=0D +__attribute__((unused))=0D +STATIC=0D +VOID=0D +SaveS3BootScript (=0D + VOID=0D + )=0D +{=0D + EFI_STATUS Status;=0D + EFI_S3_SAVE_STATE_PROTOCOL *BootScript;=0D + STATIC CONST UINT8 Info[] =3D { 0xDE, 0xAD, 0xBE, 0xEF };=0D +=0D + Status =3D gBS->LocateProtocol (&gEfiS3SaveStateProtocolGuid, NULL,=0D + (VOID **) &BootScript);=0D + ASSERT_EFI_ERROR (Status);=0D +=0D + //=0D + // Despite the opcode documentation in the PI spec, the protocol=0D + // implementation embeds a deep copy of the info in the boot script, rat= her=0D + // than storing just a pointer to runtime or NVS storage.=0D + //=0D + Status =3D BootScript->Write(BootScript, EFI_BOOT_SCRIPT_INFORMATION_OPC= ODE,=0D + (UINT32) sizeof Info,=0D + (EFI_PHYSICAL_ADDRESS)(UINTN) &Info);=0D + ASSERT_EFI_ERROR (Status);=0D +}=0D +=0D +=0D +/**=0D + Do the platform specific action after the console is ready=0D +=0D + Possible things that can be done in PlatformBootManagerAfterConsole:=0D +=0D + > Console post action:=0D + > Dynamically switch output mode from 100x31 to 80x25 for certain sena= rino=0D + > Signal console ready platform customized event=0D + > Run diagnostics like memory testing=0D + > Connect certain devices=0D + > Dispatch aditional option roms=0D + > Special boot: e.g.: USB boot, enter UI=0D +**/=0D +VOID=0D +EFIAPI=0D +PlatformBootManagerAfterConsole (=0D + VOID=0D + )=0D +{=0D + EFI_BOOT_MODE BootMode;=0D +=0D + DEBUG ((DEBUG_INFO, "PlatformBootManagerAfterConsole\n"));=0D +=0D + if (PcdGetBool (PcdOvmfFlashVariablesEnable)) {=0D + DEBUG ((DEBUG_INFO, "PlatformBdsPolicyBehavior: not restoring NvVars "= =0D + "from disk since flash variables appear to be supported.\n"));=0D + } else {=0D + //=0D + // Try to restore variables from the hard disk early so=0D + // they can be used for the other BDS connect operations.=0D + //=0D + /* XXX Calling this causes Keyboard to be removed from ConIn which=0D + results in unresponsive guest boot loaders in the GUI. Restore it=0D + when we figure out what is needed to get NvVars storage done=0D + properly.=0D + */=0D + /*PlatformBdsRestoreNvVarsFromHardDisk ();*/=0D + }=0D +=0D + //=0D + // Get current Boot Mode=0D + //=0D + BootMode =3D GetBootModeHob ();=0D + DEBUG ((DEBUG_INFO, "Boot Mode:%x\n", BootMode));=0D +=0D + //=0D + // Go the different platform policy with different boot mode=0D + // Notes: this part code can be change with the table policy=0D + //=0D + ASSERT (BootMode =3D=3D BOOT_WITH_FULL_CONFIGURATION);=0D +=0D + //=0D + // Logo show=0D + //=0D + BootLogoEnableLogo ();=0D +=0D + //=0D + // Set PCI Interrupt Line registers and ACPI SCI_EN=0D + //=0D + PciAcpiInitialization ();=0D +=0D + //=0D + // Process TPM PPI request=0D + //=0D + Tcg2PhysicalPresenceLibProcessRequest (NULL);=0D +=0D + //=0D + // Perform some platform specific connect sequence=0D + //=0D + PlatformBdsConnectSequence ();=0D +=0D + EfiBootManagerRefreshAllBootOption ();=0D +=0D + //=0D + // Register UEFI Shell=0D + //=0D + PlatformRegisterFvBootOption (=0D + &gUefiShellFileGuid, L"EFI Internal Shell", LOAD_OPTION_ACTIVE=0D + );=0D +=0D + RemoveStaleFvFileOptions ();=0D +=0D + PlatformBmPrintScRegisterHandler ();=0D +}=0D +=0D +/**=0D + This notification function is invoked when an instance of the=0D + EFI_DEVICE_PATH_PROTOCOL is produced.=0D +=0D + @param Event The event that occurred=0D + @param Context For EFI compatibility. Not used.=0D +=0D +**/=0D +VOID=0D +EFIAPI=0D +NotifyDevPath (=0D + IN EFI_EVENT Event,=0D + IN VOID *Context=0D + )=0D +{=0D + EFI_HANDLE Handle;=0D + EFI_STATUS Status;=0D + UINTN BufferSize;=0D + EFI_DEVICE_PATH_PROTOCOL *DevPathNode;=0D + ATAPI_DEVICE_PATH *Atapi;=0D +=0D + //=0D + // Examine all new handles=0D + //=0D + for (;;) {=0D + //=0D + // Get the next handle=0D + //=0D + BufferSize =3D sizeof (Handle);=0D + Status =3D gBS->LocateHandle (=0D + ByRegisterNotify,=0D + NULL,=0D + mEfiDevPathNotifyReg,=0D + &BufferSize,=0D + &Handle=0D + );=0D +=0D + //=0D + // If not found, we're done=0D + //=0D + if (EFI_NOT_FOUND =3D=3D Status) {=0D + break;=0D + }=0D +=0D + if (EFI_ERROR (Status)) {=0D + continue;=0D + }=0D +=0D + //=0D + // Get the DevicePath protocol on that handle=0D + //=0D + Status =3D gBS->HandleProtocol (Handle, &gEfiDevicePathProtocolGuid,=0D + (VOID **)&DevPathNode);=0D + ASSERT_EFI_ERROR (Status);=0D +=0D + while (!IsDevicePathEnd (DevPathNode)) {=0D + //=0D + // Find the handler to dump this device path node=0D + //=0D + if (=0D + (DevicePathType(DevPathNode) =3D=3D MESSAGING_DEVICE_PATH) &&=0D + (DevicePathSubType(DevPathNode) =3D=3D MSG_ATAPI_DP)=0D + ) {=0D + Atapi =3D (ATAPI_DEVICE_PATH*) DevPathNode;=0D + PciOr16 (=0D + PCI_LIB_ADDRESS (=0D + 0,=0D + 1,=0D + 1,=0D + (Atapi->PrimarySecondary =3D=3D 1) ? 0x42: 0x40=0D + ),=0D + BIT15=0D + );=0D + }=0D +=0D + //=0D + // Next device path node=0D + //=0D + DevPathNode =3D NextDevicePathNode (DevPathNode);=0D + }=0D + }=0D +=0D + return;=0D +}=0D +=0D +=0D +VOID=0D +InstallDevicePathCallback (=0D + VOID=0D + )=0D +{=0D + DEBUG ((DEBUG_INFO, "Registered NotifyDevPath Event\n"));=0D + mEfiDevPathEvent =3D EfiCreateProtocolNotifyEvent (=0D + &gEfiDevicePathProtocolGuid,=0D + TPL_CALLBACK,=0D + NotifyDevPath,=0D + NULL,=0D + &mEfiDevPathNotifyReg=0D + );=0D +}=0D +=0D +/**=0D + This function is called each second during the boot manager waits the=0D + timeout.=0D +=0D + @param TimeoutRemain The remaining timeout.=0D +**/=0D +VOID=0D +EFIAPI=0D +PlatformBootManagerWaitCallback (=0D + UINT16 TimeoutRemain=0D + )=0D +{=0D + EFI_GRAPHICS_OUTPUT_BLT_PIXEL_UNION Black;=0D + EFI_GRAPHICS_OUTPUT_BLT_PIXEL_UNION White;=0D + UINT16 Timeout;=0D +=0D + Timeout =3D PcdGet16 (PcdPlatformBootTimeOut);=0D +=0D + Black.Raw =3D 0x00000000;=0D + White.Raw =3D 0x00FFFFFF;=0D +=0D + BootLogoUpdateProgress (=0D + White.Pixel,=0D + Black.Pixel,=0D + L"Start boot option",=0D + White.Pixel,=0D + (Timeout - TimeoutRemain) * 100 / Timeout,=0D + 0=0D + );=0D +}=0D +=0D +/**=0D + The function is called when no boot option could be launched,=0D + including platform recovery options and options pointing to applications= =0D + built into firmware volumes.=0D +=0D + If this function returns, BDS attempts to enter an infinite loop.=0D +**/=0D +VOID=0D +EFIAPI=0D +PlatformBootManagerUnableToBoot (=0D + VOID=0D + )=0D +{=0D + EFI_STATUS Status;=0D + EFI_INPUT_KEY Key;=0D + EFI_BOOT_MANAGER_LOAD_OPTION BootManagerMenu;=0D + UINTN Index;=0D +=0D + //=0D + // BootManagerMenu doesn't contain the correct information when return s= tatus=0D + // is EFI_NOT_FOUND.=0D + //=0D + Status =3D EfiBootManagerGetBootManagerMenu (&BootManagerMenu);=0D + if (EFI_ERROR (Status)) {=0D + return;=0D + }=0D + //=0D + // Normally BdsDxe does not print anything to the system console, but th= is is=0D + // a last resort -- the end-user will likely not see any DEBUG messages= =0D + // logged in this situation.=0D + //=0D + // AsciiPrint() will NULL-check gST->ConOut internally. We check gST->Co= nIn=0D + // here to see if it makes sense to request and wait for a keypress.=0D + //=0D + if (gST->ConIn !=3D NULL) {=0D + AsciiPrint (=0D + "%a: No bootable option or device was found.\n"=0D + "%a: Press any key to enter the Boot Manager Menu.\n",=0D + gEfiCallerBaseName,=0D + gEfiCallerBaseName=0D + );=0D + Status =3D gBS->WaitForEvent (1, &gST->ConIn->WaitForKey, &Index);=0D + ASSERT_EFI_ERROR (Status);=0D + ASSERT (Index =3D=3D 0);=0D +=0D + //=0D + // Drain any queued keys.=0D + //=0D + while (!EFI_ERROR (gST->ConIn->ReadKeyStroke (gST->ConIn, &Key))) {=0D + //=0D + // just throw away Key=0D + //=0D + }=0D + }=0D +=0D + for (;;) {=0D + EfiBootManagerBoot (&BootManagerMenu);=0D + }=0D +}=0D diff --git a/BhyvePkg/Library/PlatformBootManagerLib/BdsPlatform.h b/BhyveP= kg/Library/PlatformBootManagerLib/BdsPlatform.h new file mode 100644 index 0000000000..4948ca6518 --- /dev/null +++ b/BhyvePkg/Library/PlatformBootManagerLib/BdsPlatform.h @@ -0,0 +1,196 @@ +/** @file=0D + Platform BDS customizations include file.=0D +=0D + Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.
=0D + This program and the accompanying materials=0D + are licensed and made available under the terms and conditions of the BS= D License=0D + which accompanies this distribution. The full text of the license may b= e found at=0D + http://opensource.org/licenses/bsd-license.php=0D +=0D + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,=0D + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMP= LIED.=0D +=0D +Module Name:=0D +=0D + BdsPlatform.h=0D +=0D +Abstract:=0D +=0D + Head file for BDS Platform specific code=0D +=0D +**/=0D +=0D +#ifndef _PLATFORM_SPECIFIC_BDS_PLATFORM_H_=0D +#define _PLATFORM_SPECIFIC_BDS_PLATFORM_H_=0D +=0D +=0D +#include =0D +=0D +#include =0D +#include =0D +#include =0D +#include =0D +#include =0D +=0D +#include =0D +#include =0D +#include =0D +#include =0D +#include =0D +#include =0D +#include =0D +#include =0D +#include =0D +#include =0D +#include =0D +#include =0D +#include =0D +#include =0D +#include =0D +#include =0D +#include =0D +#include =0D +#include =0D +=0D +#include =0D +#include =0D +#include =0D +#include =0D +#include =0D +#include =0D +#include =0D +#include =0D +=0D +#include =0D +#include =0D +#include =0D +#include =0D +#include =0D +#include =0D +#include =0D +=0D +#include =0D +=0D +extern EFI_DEVICE_PATH_PROTOCOL *gPlatformConnectSequence[];=0D +extern ACPI_HID_DEVICE_PATH gPnpPs2KeyboardDeviceNode;=0D +extern ACPI_HID_DEVICE_PATH gPnp16550ComPortDeviceNode;=0D +extern UART_DEVICE_PATH gUartDeviceNode;=0D +extern VENDOR_DEVICE_PATH gTerminalTypeDeviceNode;=0D +=0D +#define PCI_DEVICE_PATH_NODE(Func, Dev) \=0D + { \=0D + { \=0D + HARDWARE_DEVICE_PATH, \=0D + HW_PCI_DP, \=0D + { \=0D + (UINT8) (sizeof (PCI_DEVICE_PATH)), \=0D + (UINT8) ((sizeof (PCI_DEVICE_PATH)) >> 8) \=0D + } \=0D + }, \=0D + (Func), \=0D + (Dev) \=0D + }=0D +=0D +#define PNPID_DEVICE_PATH_NODE(PnpId) \=0D + { \=0D + { \=0D + ACPI_DEVICE_PATH, \=0D + ACPI_DP, \=0D + { \=0D + (UINT8) (sizeof (ACPI_HID_DEVICE_PATH)), \=0D + (UINT8) ((sizeof (ACPI_HID_DEVICE_PATH)) >> 8) \=0D + }, \=0D + }, \=0D + EISA_PNP_ID((PnpId)), \=0D + 0 \=0D + }=0D +=0D +#define gPciIsaBridge \=0D + PCI_DEVICE_PATH_NODE(0, 0x1f)=0D +=0D +#define gP2PBridge \=0D + PCI_DEVICE_PATH_NODE(0, 0x1e)=0D +=0D +#define gPnpPs2Keyboard \=0D + PNPID_DEVICE_PATH_NODE(0x0303)=0D +=0D +#define gPnp16550ComPort \=0D + PNPID_DEVICE_PATH_NODE(0x0501)=0D +=0D +#define gUart \=0D + { \=0D + { \=0D + MESSAGING_DEVICE_PATH, \=0D + MSG_UART_DP, \=0D + { \=0D + (UINT8) (sizeof (UART_DEVICE_PATH)), \=0D + (UINT8) ((sizeof (UART_DEVICE_PATH)) >> 8) \=0D + } \=0D + }, \=0D + 0, \=0D + 115200, \=0D + 8, \=0D + 1, \=0D + 1 \=0D + }=0D +=0D +#define gPcAnsiTerminal \=0D + { \=0D + { \=0D + MESSAGING_DEVICE_PATH, \=0D + MSG_VENDOR_DP, \=0D + { \=0D + (UINT8) (sizeof (VENDOR_DEVICE_PATH)), \=0D + (UINT8) ((sizeof (VENDOR_DEVICE_PATH)) >> 8) \=0D + } \=0D + }, \=0D + DEVICE_PATH_MESSAGING_PC_ANSI \=0D + }=0D +=0D +#define gEndEntire \=0D + { \=0D + END_DEVICE_PATH_TYPE, \=0D + END_ENTIRE_DEVICE_PATH_SUBTYPE, \=0D + { \=0D + END_DEVICE_PATH_LENGTH, \=0D + 0 \=0D + } \=0D + }=0D +=0D +#define PCI_CLASS_SCC 0x07=0D +#define PCI_SUBCLASS_SERIAL 0x00=0D +#define PCI_IF_16550 0x02=0D +#define IS_PCI_16550SERIAL(_p) IS_CLASS3 (_p, PCI_CLASS_SCC, PCI= _SUBCLASS_SERIAL, PCI_IF_16550)=0D +#define IS_PCI_ISA_PDECODE(_p) IS_CLASS3 (_p, PCI_CLASS_BRIDGE, PCI= _CLASS_BRIDGE_ISA_PDECODE, 0)=0D +=0D +typedef struct {=0D + EFI_DEVICE_PATH_PROTOCOL *DevicePath;=0D + UINTN ConnectType;=0D +} PLATFORM_CONSOLE_CONNECT_ENTRY;=0D +=0D +#define CONSOLE_OUT BIT0=0D +#define CONSOLE_IN BIT1=0D +#define STD_ERROR BIT2=0D +extern PLATFORM_CONSOLE_CONNECT_ENTRY gPlatformConsole[];=0D +=0D +//=0D +// Platform BDS Functions=0D +//=0D +=0D +VOID=0D +PlatformInitializeConsole (=0D + IN PLATFORM_CONSOLE_CONNECT_ENTRY *PlatformConsole=0D + );=0D +=0D +/**=0D + Loads and boots UEFI Linux via the FwCfg interface.=0D +=0D + @retval EFI_NOT_FOUND - The Linux kernel was not found=0D +=0D +**/=0D +EFI_STATUS=0D +TryRunningQemuKernel (=0D + VOID=0D + );=0D +=0D +#endif // _PLATFORM_SPECIFIC_BDS_PLATFORM_H_=0D diff --git a/BhyvePkg/Library/PlatformBootManagerLib/PlatformBootManagerLib= .inf b/BhyvePkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf new file mode 100644 index 0000000000..eefc172d1a --- /dev/null +++ b/BhyvePkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf @@ -0,0 +1,79 @@ +## @file=0D +# Platform BDS customizations library.=0D +#=0D +# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.
= =0D +# This program and the accompanying materials=0D +# are licensed and made available under the terms and conditions of the B= SD License=0D +# which accompanies this distribution. The full text of the license may = be found at=0D +# http://opensource.org/licenses/bsd-license.php=0D +#=0D +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,=0D +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IM= PLIED.=0D +#=0D +##=0D +=0D +[Defines]=0D + INF_VERSION =3D 0x00010005=0D + BASE_NAME =3D PlatformBootManagerLib=0D + FILE_GUID =3D FB65006C-AC9F-4992-AD80-184B2BDBBD83= =0D + MODULE_TYPE =3D DXE_DRIVER=0D + VERSION_STRING =3D 1.0=0D + LIBRARY_CLASS =3D PlatformBootManagerLib|DXE_DRIVER=0D +=0D +#=0D +# The following information is for reference only and not required by the = build tools.=0D +#=0D +# VALID_ARCHITECTURES =3D IA32 X64 EBC=0D +#=0D +=0D +[Sources]=0D + BdsPlatform.c=0D + PlatformData.c=0D + BdsPlatform.h=0D +=0D +[Packages]=0D + MdePkg/MdePkg.dec=0D + MdeModulePkg/MdeModulePkg.dec=0D + SourceLevelDebugPkg/SourceLevelDebugPkg.dec=0D + OvmfPkg/OvmfPkg.dec=0D + SecurityPkg/SecurityPkg.dec=0D + ShellPkg/ShellPkg.dec=0D +=0D +[LibraryClasses]=0D + BaseLib=0D + MemoryAllocationLib=0D + UefiBootServicesTableLib=0D + BaseMemoryLib=0D + DebugLib=0D + PcdLib=0D + UefiBootManagerLib=0D + BootLogoLib=0D + DevicePathLib=0D + PciLib=0D + NvVarsFileLib=0D + ReportStatusCodeLib=0D + UefiLib=0D + PlatformBmPrintScLib=0D + Tcg2PhysicalPresenceLib=0D +=0D +[Pcd]=0D + gUefiOvmfPkgTokenSpaceGuid.PcdEmuVariableEvent=0D + gUefiOvmfPkgTokenSpaceGuid.PcdOvmfFlashVariablesEnable=0D + gUefiOvmfPkgTokenSpaceGuid.PcdOvmfHostBridgePciDevId=0D + gEfiMdePkgTokenSpaceGuid.PcdPlatformBootTimeOut=0D +=0D +[Pcd.IA32, Pcd.X64]=0D + gEfiMdePkgTokenSpaceGuid.PcdFSBClock=0D +=0D +[Protocols]=0D + gEfiDecompressProtocolGuid=0D + gEfiPciRootBridgeIoProtocolGuid=0D + gEfiS3SaveStateProtocolGuid # PROTOCOL SOMETIMES_CONSU= MED=0D + gEfiDxeSmmReadyToLockProtocolGuid # PROTOCOL SOMETIMES_PRODU= CED=0D + gEfiLoadedImageProtocolGuid # PROTOCOL SOMETIMES_PRODU= CED=0D + gEfiFirmwareVolume2ProtocolGuid # PROTOCOL SOMETIMES_CONSU= MED=0D +=0D +[Guids]=0D + gEfiEndOfDxeEventGroupGuid=0D + gRootBridgesConnectedEventGroupGuid=0D + gUefiShellFileGuid=0D diff --git a/BhyvePkg/Library/PlatformBootManagerLib/PlatformData.c b/Bhyve= Pkg/Library/PlatformBootManagerLib/PlatformData.c new file mode 100644 index 0000000000..1250a6d351 --- /dev/null +++ b/BhyvePkg/Library/PlatformBootManagerLib/PlatformData.c @@ -0,0 +1,176 @@ +/** @file=0D + Defined the platform specific device path which will be used by=0D + platform Bbd to perform the platform policy connect.=0D +=0D + Copyright (c) 2004 - 2017, Intel Corporation. All rights reserved.
=0D + This program and the accompanying materials=0D + are licensed and made available under the terms and conditions of the BS= D License=0D + which accompanies this distribution. The full text of the license may b= e found at=0D + http://opensource.org/licenses/bsd-license.php=0D +=0D + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,=0D + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMP= LIED.=0D +=0D +**/=0D +=0D +#include "BdsPlatform.h"=0D +#include =0D +=0D +//=0D +// Debug Agent UART Device Path structure=0D +//=0D +#pragma pack(1)=0D +typedef struct {=0D + VENDOR_DEVICE_PATH VendorHardware;=0D + UART_DEVICE_PATH Uart;=0D + VENDOR_DEVICE_PATH TerminalType;=0D + EFI_DEVICE_PATH_PROTOCOL End;=0D +} VENDOR_UART_DEVICE_PATH;=0D +#pragma pack()=0D +=0D +//=0D +// USB Keyboard Device Path structure=0D +//=0D +#pragma pack (1)=0D +typedef struct {=0D + USB_CLASS_DEVICE_PATH Keyboard;=0D + EFI_DEVICE_PATH_PROTOCOL End;=0D +} USB_KEYBOARD_DEVICE_PATH;=0D +#pragma pack ()=0D +=0D +//=0D +// QemuRamfb Device Path structure=0D +//=0D +#pragma pack (1)=0D +typedef struct {=0D + VENDOR_DEVICE_PATH Vendor;=0D + ACPI_ADR_DEVICE_PATH AcpiAdr;=0D + EFI_DEVICE_PATH_PROTOCOL End;=0D +} VENDOR_RAMFB_DEVICE_PATH;=0D +#pragma pack ()=0D +=0D +ACPI_HID_DEVICE_PATH gPnpPs2KeyboardDeviceNode =3D gPnpPs2Keyboard;= =0D +ACPI_HID_DEVICE_PATH gPnp16550ComPortDeviceNode =3D gPnp16550ComPort= ;=0D +UART_DEVICE_PATH gUartDeviceNode =3D gUart;=0D +VENDOR_DEVICE_PATH gTerminalTypeDeviceNode =3D gPcAnsiTerminal;= =0D +=0D +//=0D +// Platform specific keyboard device path=0D +//=0D +=0D +=0D +//=0D +// Debug Agent UART Device Path=0D +//=0D +VENDOR_UART_DEVICE_PATH gDebugAgentUartDevicePath =3D {=0D + {=0D + {=0D + HARDWARE_DEVICE_PATH,=0D + HW_VENDOR_DP,=0D + {=0D + (UINT8) (sizeof (VENDOR_DEVICE_PATH)),=0D + (UINT8) ((sizeof (VENDOR_DEVICE_PATH)) >> 8)=0D + }=0D + },=0D + EFI_DEBUG_AGENT_GUID,=0D + },=0D + {=0D + {=0D + MESSAGING_DEVICE_PATH,=0D + MSG_UART_DP,=0D + {=0D + (UINT8) (sizeof (UART_DEVICE_PATH)),=0D + (UINT8) ((sizeof (UART_DEVICE_PATH)) >> 8)=0D + }=0D + },=0D + 0, // Reserved=0D + 0, // BaudRate - Default=0D + 0, // DataBits - Default=0D + 0, // Parity - Default=0D + 0, // StopBits - Default=0D + },=0D + gPcAnsiTerminal,=0D + gEndEntire=0D +};=0D +=0D +STATIC USB_KEYBOARD_DEVICE_PATH gUsbKeyboardDevicePath =3D {=0D + {=0D + {=0D + MESSAGING_DEVICE_PATH,=0D + MSG_USB_CLASS_DP,=0D + {=0D + (UINT8)sizeof (USB_CLASS_DEVICE_PATH),=0D + (UINT8)(sizeof (USB_CLASS_DEVICE_PATH) >> 8)=0D + }=0D + },=0D + 0xFFFF, // VendorId: any=0D + 0xFFFF, // ProductId: any=0D + 3, // DeviceClass: HID=0D + 1, // DeviceSubClass: boot=0D + 1 // DeviceProtocol: keyboard=0D + },=0D + gEndEntire=0D +};=0D +=0D +STATIC VENDOR_RAMFB_DEVICE_PATH gQemuRamfbDevicePath =3D {=0D + {=0D + {=0D + HARDWARE_DEVICE_PATH,=0D + HW_VENDOR_DP,=0D + {=0D + (UINT8) (sizeof (VENDOR_DEVICE_PATH)),=0D + (UINT8) ((sizeof (VENDOR_DEVICE_PATH)) >> 8)=0D + }=0D + },=0D + QEMU_RAMFB_GUID,=0D + },=0D + {=0D + {=0D + ACPI_DEVICE_PATH,=0D + ACPI_ADR_DP,=0D + {=0D + (UINT8) (sizeof (ACPI_ADR_DEVICE_PATH)),=0D + (UINT8) ((sizeof (ACPI_ADR_DEVICE_PATH)) >> 8)=0D + }=0D + },=0D + ACPI_DISPLAY_ADR (=0D + 1, // DeviceIdScheme=0D + 0, // HeadId=0D + 0, // NonVgaOutput=0D + 1, // BiosCanDetect=0D + 0, // VendorInfo=0D + ACPI_ADR_DISPLAY_TYPE_EXTERNAL_DIGITAL, // Type=0D + 0, // Port=0D + 0 // Index=0D + ),=0D + },=0D + gEndEntire=0D +};=0D +=0D +//=0D +// Predefined platform default console device path=0D +//=0D +PLATFORM_CONSOLE_CONNECT_ENTRY gPlatformConsole[] =3D {=0D + {=0D + (EFI_DEVICE_PATH_PROTOCOL *) &gDebugAgentUartDevicePath,=0D + (CONSOLE_OUT | CONSOLE_IN | STD_ERROR)=0D + },=0D + {=0D + (EFI_DEVICE_PATH_PROTOCOL *)&gUsbKeyboardDevicePath,=0D + CONSOLE_IN=0D + },=0D + {=0D + (EFI_DEVICE_PATH_PROTOCOL *)&gQemuRamfbDevicePath,=0D + CONSOLE_OUT=0D + },=0D + {=0D + NULL,=0D + 0=0D + }=0D +};=0D +=0D +//=0D +// Predefined platform connect sequence=0D +//=0D +EFI_DEVICE_PATH_PROTOCOL *gPlatformConnectSequence[] =3D { NULL };=0D +=0D diff --git a/BhyvePkg/License.txt b/BhyvePkg/License.txt new file mode 100644 index 0000000000..e2eff41571 --- /dev/null +++ b/BhyvePkg/License.txt @@ -0,0 +1,50 @@ +Copyright (c) 2012, Intel Corporation. All rights reserved.=0D +=0D +Redistribution and use in source and binary forms, with or without=0D +modification, are permitted provided that the following conditions=0D +are met:=0D +=0D +* Redistributions of source code must retain the above copyright=0D + notice, this list of conditions and the following disclaimer.=0D +* Redistributions in binary form must reproduce the above copyright=0D + notice, this list of conditions and the following disclaimer in=0D + the documentation and/or other materials provided with the=0D + distribution.=0D +=0D +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS=0D +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT=0D +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS=0D +FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE=0D +COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,=0D +INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,=0D +BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;=0D +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER=0D +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT=0D +LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN=0D +ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE=0D +POSSIBILITY OF SUCH DAMAGE.=0D +=0D +=0D +Some files are subject to the following license, the MIT license. Those fi= les=0D +are located in:=0D +- OvmfPkg/Include/IndustryStandard/Xen/=0D +- OvmfPkg/XenBusDxe/=0D +- OvmfPkg/XenPvBlkDxe/=0D +=0D +Permission is hereby granted, free of charge, to any person obtaining a co= py=0D +of this software and associated documentation files (the "Software"), to d= eal=0D +in the Software without restriction, including without limitation the righ= ts=0D +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell= =0D +copies of the Software, and to permit persons to whom the Software is=0D +furnished to do so, subject to the following conditions:=0D +=0D +The above copyright notice and this permission notice shall be included in= =0D +all copies or substantial portions of the Software.=0D +=0D +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR= =0D +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,=0D +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL TH= E=0D +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER=0D +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FR= OM,=0D +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN= =0D +THE SOFTWARE.=0D diff --git a/BhyvePkg/SmbiosPlatformDxe/Bhyve.c b/BhyvePkg/SmbiosPlatformDx= e/Bhyve.c new file mode 100644 index 0000000000..4a607fcd63 --- /dev/null +++ b/BhyvePkg/SmbiosPlatformDxe/Bhyve.c @@ -0,0 +1,49 @@ +/*=0D + * Copyright (c) 2014, Pluribus Networks, Inc.=0D + *=0D + * This program and the accompanying materials are licensed and made=0D + * available under the terms and conditions of the BSD License which=0D + * accompanies this distribution. The full text of the license may be=0D + * found at http://opensource.org/licenses/bsd-license.php=0D + *=0D + * THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS"=0D + * BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER=0D + * EXPRESS OR IMPLIED.=0D + */=0D +=0D +#include "SmbiosPlatformDxe.h"=0D +=0D +#define BHYVE_SMBIOS_PHYSICAL_ADDRESS 0x000F0000=0D +#define BHYVE_SMBIOS_PHYSICAL_END 0x000FFFFF=0D +=0D +/**=0D + Locates the bhyve SMBIOS data if it exists=0D +=0D + @return SMBIOS_TABLE_ENTRY_POINT Address of bhyve SMBIOS data=0D +=0D +**/=0D +SMBIOS_TABLE_ENTRY_POINT *=0D +GetBhyveSmbiosTables (=0D + VOID=0D + )=0D +{=0D + UINT8 *BhyveSmbiosPtr;=0D + SMBIOS_TABLE_ENTRY_POINT *BhyveSmbiosEntryPointStructure;=0D +=0D + for (BhyveSmbiosPtr =3D (UINT8*)(UINTN) BHYVE_SMBIOS_PHYSICAL_ADDRESS;=0D + BhyveSmbiosPtr < (UINT8*)(UINTN) BHYVE_SMBIOS_PHYSICAL_END;=0D + BhyveSmbiosPtr +=3D 0x10) {=0D +=0D + BhyveSmbiosEntryPointStructure =3D (SMBIOS_TABLE_ENTRY_POINT *) BhyveS= mbiosPtr;=0D +=0D + if (!AsciiStrnCmp ((CHAR8 *) BhyveSmbiosEntryPointStructure->AnchorStr= ing, "_SM_", 4) &&=0D + !AsciiStrnCmp ((CHAR8 *) BhyveSmbiosEntryPointStructure->Intermedi= ateAnchorString, "_DMI_", 5) &&=0D + IsEntryPointStructureValid (BhyveSmbiosEntryPointStructure)) {=0D +=0D + return BhyveSmbiosEntryPointStructure;=0D +=0D + }=0D + }=0D +=0D + return NULL;=0D +}=0D diff --git a/BhyvePkg/SmbiosPlatformDxe/SmbiosPlatformDxe.c b/BhyvePkg/Smbi= osPlatformDxe/SmbiosPlatformDxe.c new file mode 100644 index 0000000000..81158dc8a8 --- /dev/null +++ b/BhyvePkg/SmbiosPlatformDxe/SmbiosPlatformDxe.c @@ -0,0 +1,250 @@ +/** @file=0D + This driver installs SMBIOS information for OVMF=0D +=0D + Copyright (c) 2011, Bei Guan =0D + Copyright (c) 2011 - 2015, Intel Corporation. All rights reserved.
=0D +=0D + This program and the accompanying materials=0D + are licensed and made available under the terms and conditions of the BS= D License=0D + which accompanies this distribution. The full text of the license may b= e found at=0D + http://opensource.org/licenses/bsd-license.php=0D +=0D + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,=0D + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMP= LIED.=0D +=0D +**/=0D +=0D +#include "SmbiosPlatformDxe.h"=0D +=0D +#define TYPE0_STRINGS \=0D + "EFI Development Kit II / OVMF\0" /* Vendor */ \=0D + "0.0.0\0" /* BiosVersion */ \=0D + "02/06/2015\0" /* BiosReleaseDate */=0D +//=0D +// Type definition and contents of the default Type 0 SMBIOS table.=0D +//=0D +#pragma pack(1)=0D +typedef struct {=0D + SMBIOS_TABLE_TYPE0 Base;=0D + UINT8 Strings[sizeof(TYPE0_STRINGS)];=0D +} OVMF_TYPE0;=0D +#pragma pack()=0D +=0D +STATIC CONST OVMF_TYPE0 mOvmfDefaultType0 =3D {=0D + {=0D + // SMBIOS_STRUCTURE Hdr=0D + {=0D + EFI_SMBIOS_TYPE_BIOS_INFORMATION, // UINT8 Type=0D + sizeof (SMBIOS_TABLE_TYPE0), // UINT8 Length=0D + },=0D + 1, // SMBIOS_TABLE_STRING Vendor=0D + 2, // SMBIOS_TABLE_STRING BiosVersion=0D + 0xE800,// UINT16 BiosSegment=0D + 3, // SMBIOS_TABLE_STRING BiosReleaseDate=0D + 0, // UINT8 BiosSize=0D + { // MISC_BIOS_CHARACTERISTICS BiosCharacteristics=0D + 0, // Reserved :2=0D + 0, // Unknown :1=0D + 1, // BiosCharacteristicsNotSupported :1=0D + // Remaining BiosCharacteristics bits left unset :60=0D + },=0D + { // BIOSCharacteristicsExtensionBytes[2]=0D + 0, // BiosReserved=0D + 0x1C // SystemReserved =3D VirtualMachineSupported |=0D + // UefiSpecificationSupported |=0D + // TargetContentDistributionEnabled=0D + },=0D + 0, // UINT8 SystemBiosMajorRelease=0D + 0, // UINT8 SystemBiosMinorRelease=0D + 0xFF, // UINT8 EmbeddedControllerFirmwareMajorRel= ease=0D + 0xFF // UINT8 EmbeddedControllerFirmwareMinorRel= ease=0D + },=0D + // Text strings (unformatted area)=0D + TYPE0_STRINGS=0D +};=0D +=0D +=0D +/**=0D + Validates the SMBIOS entry point structure=0D +=0D + @param EntryPointStructure SMBIOS entry point structure=0D +=0D + @retval TRUE The entry point structure is valid=0D + @retval FALSE The entry point structure is not valid=0D +=0D +**/=0D +BOOLEAN=0D +IsEntryPointStructureValid (=0D + IN SMBIOS_TABLE_ENTRY_POINT *EntryPointStructure=0D + )=0D +{=0D + UINTN Index;=0D + UINT8 Length;=0D + UINT8 Checksum;=0D + UINT8 *BytePtr;=0D +=0D + BytePtr =3D (UINT8*) EntryPointStructure;=0D + Length =3D EntryPointStructure->EntryPointLength;=0D + Checksum =3D 0;=0D +=0D + for (Index =3D 0; Index < Length; Index++) {=0D + Checksum =3D Checksum + (UINT8) BytePtr[Index];=0D + }=0D +=0D + if (Checksum !=3D 0) {=0D + return FALSE;=0D + } else {=0D + return TRUE;=0D + }=0D +}=0D +=0D +=0D +/**=0D + Get SMBIOS record length.=0D +=0D + @param SmbiosTable SMBIOS pointer.=0D +=0D +**/=0D +UINTN=0D +SmbiosTableLength (=0D + IN SMBIOS_STRUCTURE_POINTER SmbiosTable=0D + )=0D +{=0D + CHAR8 *AChar;=0D + UINTN Length;=0D +=0D + AChar =3D (CHAR8 *)(SmbiosTable.Raw + SmbiosTable.Hdr->Length);=0D +=0D + //=0D + // Each structure shall be terminated by a double-null (SMBIOS spec.7.1)= =0D + //=0D + while ((*AChar !=3D 0) || (*(AChar + 1) !=3D 0)) {=0D + AChar ++;=0D + }=0D + Length =3D ((UINTN)AChar - (UINTN)SmbiosTable.Raw + 2);=0D +=0D + return Length;=0D +}=0D +=0D +=0D +/**=0D + Install all structures from the given SMBIOS structures block=0D +=0D + @param Smbios SMBIOS protocol=0D + @param TableAddress SMBIOS tables starting address=0D +=0D +**/=0D +EFI_STATUS=0D +InstallAllStructures (=0D + IN EFI_SMBIOS_PROTOCOL *Smbios,=0D + IN UINT8 *TableAddress=0D + )=0D +{=0D + EFI_STATUS Status;=0D + SMBIOS_STRUCTURE_POINTER SmbiosTable;=0D + EFI_SMBIOS_HANDLE SmbiosHandle;=0D + BOOLEAN NeedSmbiosType0;=0D +=0D + SmbiosTable.Raw =3D TableAddress;=0D + if (SmbiosTable.Raw =3D=3D NULL) {=0D + return EFI_INVALID_PARAMETER;=0D + }=0D +=0D + NeedSmbiosType0 =3D TRUE;=0D +=0D + while (SmbiosTable.Hdr->Type !=3D 127) {=0D + //=0D + // Log the SMBIOS data for this structure=0D + //=0D + SmbiosHandle =3D SmbiosTable.Hdr->Handle;=0D + Status =3D Smbios->Add (=0D + Smbios,=0D + NULL,=0D + &SmbiosHandle,=0D + (EFI_SMBIOS_TABLE_HEADER*) SmbiosTable.Raw=0D + );=0D + ASSERT_EFI_ERROR (Status);=0D +=0D + if (SmbiosTable.Hdr->Type =3D=3D 0) {=0D + NeedSmbiosType0 =3D FALSE;=0D + }=0D +=0D + //=0D + // Get the next structure address=0D + //=0D + SmbiosTable.Raw =3D (UINT8 *)(SmbiosTable.Raw + SmbiosTableLength (Smb= iosTable));=0D + }=0D +=0D + if (NeedSmbiosType0) {=0D + //=0D + // Add OVMF default Type 0 (BIOS Information) table=0D + //=0D + SmbiosHandle =3D SMBIOS_HANDLE_PI_RESERVED;=0D + Status =3D Smbios->Add (=0D + Smbios,=0D + NULL,=0D + &SmbiosHandle,=0D + (EFI_SMBIOS_TABLE_HEADER*) &mOvmfDefaultType0=0D + );=0D + ASSERT_EFI_ERROR (Status);=0D + }=0D +=0D + return EFI_SUCCESS;=0D +}=0D +=0D +=0D +/**=0D + Installs SMBIOS information for OVMF=0D +=0D + @param ImageHandle Module's image handle=0D + @param SystemTable Pointer of EFI_SYSTEM_TABLE=0D +=0D + @retval EFI_SUCCESS Smbios data successfully installed=0D + @retval Other Smbios data was not installed=0D +=0D +**/=0D +EFI_STATUS=0D +EFIAPI=0D +SmbiosTablePublishEntry (=0D + IN EFI_HANDLE ImageHandle,=0D + IN EFI_SYSTEM_TABLE *SystemTable=0D + )=0D +{=0D + EFI_STATUS Status;=0D + EFI_SMBIOS_PROTOCOL *Smbios;=0D + SMBIOS_TABLE_ENTRY_POINT *EntryPointStructure;=0D + UINT8 *SmbiosTables =3D NULL;=0D +=0D + //=0D + // Find the SMBIOS protocol=0D + //=0D + Status =3D gBS->LocateProtocol (=0D + &gEfiSmbiosProtocolGuid,=0D + NULL,=0D + (VOID**)&Smbios=0D + );=0D + if (EFI_ERROR (Status)) {=0D + return Status;=0D + }=0D +=0D + //=0D + // Add bhyve SMBIOS data=0D + //=0D + EntryPointStructure =3D GetBhyveSmbiosTables ();=0D + if (EntryPointStructure !=3D NULL) {=0D + SmbiosTables =3D (UINT8*)(UINTN)EntryPointStructure->TableAddress;=0D + }=0D +=0D + if (SmbiosTables !=3D NULL) {=0D + Status =3D InstallAllStructures (Smbios, SmbiosTables);=0D +=0D + //=0D + // Free SmbiosTables if allocated by Qemu (i.e., NOT by Xen):=0D + //=0D + if (EntryPointStructure =3D=3D NULL) {=0D + FreePool (SmbiosTables);=0D + }=0D + }=0D +=0D + return Status;=0D +}=0D diff --git a/BhyvePkg/SmbiosPlatformDxe/SmbiosPlatformDxe.h b/BhyvePkg/Smbi= osPlatformDxe/SmbiosPlatformDxe.h new file mode 100644 index 0000000000..d69793c5ad --- /dev/null +++ b/BhyvePkg/SmbiosPlatformDxe/SmbiosPlatformDxe.h @@ -0,0 +1,69 @@ +/** @file=0D + This driver installs SMBIOS information for OVMF=0D +=0D + Copyright (c) 2011, Bei Guan =0D + Copyright (c) 2011, Intel Corporation. All rights reserved.
=0D +=0D + This program and the accompanying materials=0D + are licensed and made available under the terms and conditions of the BS= D License=0D + which accompanies this distribution. The full text of the license may b= e found at=0D + http://opensource.org/licenses/bsd-license.php=0D +=0D + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,=0D + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMP= LIED.=0D +=0D +**/=0D +=0D +#ifndef _SMBIOS_PLATFORM_DXE_H_=0D +#define _SMBIOS_PLATFORM_DXE_H_=0D +=0D +#include =0D +=0D +#include =0D +#include =0D +#include =0D +#include =0D +#include =0D +#include =0D +#include =0D +=0D +=0D +/**=0D + Locates the bhyve SMBIOS data if it exists=0D +=0D + @return SMBIOS_TABLE_ENTRY_POINT Address of bhyve SMBIOS data=0D +=0D +**/=0D +SMBIOS_TABLE_ENTRY_POINT *=0D +GetBhyveSmbiosTables (=0D + VOID=0D + );=0D +=0D +=0D +/**=0D + Locates and extracts the QEMU SMBIOS table data if present in fw_cfg=0D +=0D + @return Address of extracted QEMU SMBIOS data=0D +=0D +**/=0D +UINT8 *=0D +GetQemuSmbiosTables (=0D + VOID=0D + );=0D +=0D +=0D +/**=0D + Validates the SMBIOS entry point structure=0D +=0D + @param EntryPointStructure SMBIOS entry point structure=0D +=0D + @retval TRUE The entry point structure is valid=0D + @retval FALSE The entry point structure is not valid=0D +=0D +**/=0D +BOOLEAN=0D +IsEntryPointStructureValid (=0D + IN SMBIOS_TABLE_ENTRY_POINT *EntryPointStructure=0D + );=0D +=0D +#endif=0D diff --git a/BhyvePkg/SmbiosPlatformDxe/SmbiosPlatformDxe.inf b/BhyvePkg/Sm= biosPlatformDxe/SmbiosPlatformDxe.inf new file mode 100644 index 0000000000..8c83dbec42 --- /dev/null +++ b/BhyvePkg/SmbiosPlatformDxe/SmbiosPlatformDxe.inf @@ -0,0 +1,59 @@ +## @file=0D +# This driver installs SMBIOS information for OVMF=0D +#=0D +# Copyright (c) 2011, Bei Guan =0D +# Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.
= =0D +#=0D +# This program and the accompanying materials=0D +# are licensed and made available under the terms and conditions of the B= SD License=0D +# which accompanies this distribution. The full text of the license may b= e found at=0D +# http://opensource.org/licenses/bsd-license.php=0D +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,=0D +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IM= PLIED.=0D +#=0D +##=0D +=0D +[Defines]=0D + INF_VERSION =3D 0x00010005=0D + BASE_NAME =3D SmbiosPlatformDxe=0D + FILE_GUID =3D 4110465d-5ff3-4f4b-b580-24ed0d06747a= =0D + MODULE_TYPE =3D DXE_DRIVER=0D + VERSION_STRING =3D 1.0=0D +=0D + ENTRY_POINT =3D SmbiosTablePublishEntry=0D +=0D +#=0D +# The following information is for reference only and not required by the = build tools.=0D +#=0D +# VALID_ARCHITECTURES =3D IA32 X64 EBC ARM AARCH64=0D +#=0D +=0D +[Sources]=0D + SmbiosPlatformDxe.h=0D + SmbiosPlatformDxe.c=0D + Bhyve.c=0D +=0D +[Packages]=0D + MdePkg/MdePkg.dec=0D + MdeModulePkg/MdeModulePkg.dec=0D + OvmfPkg/OvmfPkg.dec=0D +=0D +[LibraryClasses]=0D + UefiBootServicesTableLib=0D + BaseMemoryLib=0D + BaseLib=0D + UefiDriverEntryPoint=0D + DebugLib=0D + HobLib=0D + MemoryAllocationLib=0D + PcdLib=0D +=0D +[Pcd]=0D + gUefiOvmfPkgTokenSpaceGuid.PcdQemuSmbiosValidated=0D +=0D +[Protocols]=0D + gEfiSmbiosProtocolGuid # PROTOCOL ALWAYS_CONSUMED=0D +=0D +[Depex]=0D + gEfiSmbiosProtocolGuid=0D +=0D diff --git a/BhyvePkg/VarStore.fdf.inc b/BhyvePkg/VarStore.fdf.inc new file mode 100644 index 0000000000..742fed1053 --- /dev/null +++ b/BhyvePkg/VarStore.fdf.inc @@ -0,0 +1,122 @@ +## @file=0D +# FDF include file with Layout Regions that define an empty variable stor= e.=0D +#=0D +# Copyright (C) 2014, Red Hat, Inc.=0D +# Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.
= =0D +#=0D +# This program and the accompanying materials are licensed and made avail= able=0D +# under the terms and conditions of the BSD License which accompanies thi= s=0D +# distribution. The full text of the license may be found at=0D +# http://opensource.org/licenses/bsd-license.php=0D +#=0D +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,=0D +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR=0D +# IMPLIED.=0D +#=0D +##=0D +=0D +!if ($(FD_SIZE_IN_KB) =3D=3D 1024) || ($(FD_SIZE_IN_KB) =3D=3D 2048)=0D +0x00000000|0x0000e000=0D +!endif=0D +!if $(FD_SIZE_IN_KB) =3D=3D 4096=0D +0x00000000|0x00040000=0D +!endif=0D +#NV_VARIABLE_STORE=0D +DATA =3D {=0D + ## This is the EFI_FIRMWARE_VOLUME_HEADER=0D + # ZeroVector []=0D + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,=0D + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,=0D + # FileSystemGuid: gEfiSystemNvDataFvGuid =3D=0D + # { 0xFFF12B8D, 0x7696, 0x4C8B,=0D + # { 0xA9, 0x85, 0x27, 0x47, 0x07, 0x5B, 0x4F, 0x50 }}=0D + 0x8D, 0x2B, 0xF1, 0xFF, 0x96, 0x76, 0x8B, 0x4C,=0D + 0xA9, 0x85, 0x27, 0x47, 0x07, 0x5B, 0x4F, 0x50,=0D +!if ($(FD_SIZE_IN_KB) =3D=3D 1024) || ($(FD_SIZE_IN_KB) =3D=3D 2048)=0D + # FvLength: 0x20000=0D + 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00,=0D +!endif=0D +!if $(FD_SIZE_IN_KB) =3D=3D 4096=0D + # FvLength: 0x84000=0D + 0x00, 0x40, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00,=0D +!endif=0D + # Signature "_FVH" # Attributes=0D + 0x5f, 0x46, 0x56, 0x48, 0xff, 0xfe, 0x04, 0x00,=0D + # HeaderLength=0D + 0x48, 0x00,=0D +!if ($(FD_SIZE_IN_KB) =3D=3D 1024) || ($(FD_SIZE_IN_KB) =3D=3D 2048)=0D + # CheckSum=0D + 0x19, 0xF9,=0D +!endif=0D +!if $(FD_SIZE_IN_KB) =3D=3D 4096=0D + # CheckSum=0D + 0xAF, 0xB8,=0D +!endif=0D + # ExtHeaderOffset #Reserved #Revision=0D + 0x00, 0x00, 0x00, 0x02,=0D +!if ($(FD_SIZE_IN_KB) =3D=3D 1024) || ($(FD_SIZE_IN_KB) =3D=3D 2048)=0D + # Blockmap[0]: 0x20 Blocks * 0x1000 Bytes / Block=0D + 0x20, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00,=0D +!endif=0D +!if $(FD_SIZE_IN_KB) =3D=3D 4096=0D + # Blockmap[0]: 0x84 Blocks * 0x1000 Bytes / Block=0D + 0x84, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00,=0D +!endif=0D + # Blockmap[1]: End=0D + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,=0D + ## This is the VARIABLE_STORE_HEADER=0D + # It is compatible with SECURE_BOOT_ENABLE =3D=3D FALSE as well.=0D + # Signature: gEfiAuthenticatedVariableGuid =3D=0D + # { 0xaaf32c78, 0x947b, 0x439a,=0D + # { 0xa1, 0x80, 0x2e, 0x14, 0x4e, 0xc3, 0x77, 0x92 }}=0D + 0x78, 0x2c, 0xf3, 0xaa, 0x7b, 0x94, 0x9a, 0x43,=0D + 0xa1, 0x80, 0x2e, 0x14, 0x4e, 0xc3, 0x77, 0x92,=0D +!if ($(FD_SIZE_IN_KB) =3D=3D 1024) || ($(FD_SIZE_IN_KB) =3D=3D 2048)=0D + # Size: 0xe000 (gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariable= Size) -=0D + # 0x48 (size of EFI_FIRMWARE_VOLUME_HEADER) =3D 0xdfb8=0D + # This can speed up the Variable Dispatch a bit.=0D + 0xB8, 0xDF, 0x00, 0x00,=0D +!endif=0D +!if $(FD_SIZE_IN_KB) =3D=3D 4096=0D + # Size: 0x40000 (gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariabl= eSize) -=0D + # 0x48 (size of EFI_FIRMWARE_VOLUME_HEADER) =3D 0x3ffb8=0D + # This can speed up the Variable Dispatch a bit.=0D + 0xB8, 0xFF, 0x03, 0x00,=0D +!endif=0D + # FORMATTED: 0x5A #HEALTHY: 0xFE #Reserved: UINT16 #Reserved1: UINT32=0D + 0x5A, 0xFE, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00=0D +}=0D +=0D +!if ($(FD_SIZE_IN_KB) =3D=3D 1024) || ($(FD_SIZE_IN_KB) =3D=3D 2048)=0D +0x0000e000|0x00001000=0D +!endif=0D +!if $(FD_SIZE_IN_KB) =3D=3D 4096=0D +0x00040000|0x00001000=0D +!endif=0D +#NV_EVENT_LOG=0D +=0D +!if ($(FD_SIZE_IN_KB) =3D=3D 1024) || ($(FD_SIZE_IN_KB) =3D=3D 2048)=0D +0x0000f000|0x00001000=0D +!endif=0D +!if $(FD_SIZE_IN_KB) =3D=3D 4096=0D +0x00041000|0x00001000=0D +!endif=0D +#NV_FTW_WORKING=0D +DATA =3D {=0D + # EFI_FAULT_TOLERANT_WORKING_BLOCK_HEADER->Signature =3D gEdkiiWorkingBl= ockSignatureGuid =3D=0D + # { 0x9e58292b, 0x7c68, 0x497d, { 0xa0, 0xce, 0x65, 0x0, 0xfd, 0x9f, 0= x1b, 0x95 }}=0D + 0x2b, 0x29, 0x58, 0x9e, 0x68, 0x7c, 0x7d, 0x49,=0D + 0xa0, 0xce, 0x65, 0x0, 0xfd, 0x9f, 0x1b, 0x95,=0D + # Crc:UINT32 #WorkingBlockValid:1, WorkingBlockInvalid:1, Res= erved=0D + 0x2c, 0xaf, 0x2c, 0x64, 0xFE, 0xFF, 0xFF, 0xFF,=0D + # WriteQueueSize: UINT64=0D + 0xE0, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00=0D +}=0D +=0D +!if ($(FD_SIZE_IN_KB) =3D=3D 1024) || ($(FD_SIZE_IN_KB) =3D=3D 2048)=0D +0x00010000|0x00010000=0D +!endif=0D +!if $(FD_SIZE_IN_KB) =3D=3D 4096=0D +0x00042000|0x00042000=0D +!endif=0D +#NV_FTW_SPARE=0D --=20 2.26.1