Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 31 Mar 2023 14:59:33 +0200
From:      Mario Marietto <marietto2008@gmail.com>
To:        =?UTF-8?Q?Corvin_K=C3=B6hne?= <corvink@freebsd.org>
Cc:        virtualization@freebsd.org
Subject:   Re: [PATCH] OvmfPkg/BhyveBhf: install bhyve's ACPI tables
Message-ID:  <CA%2B1FSiggd8Z8VEC=KGhV7wkBiWH1rtJdNTAm8nq71Q-3HgOHsQ@mail.gmail.com>
In-Reply-To: <20230331123936.540020-1-corvink@FreeBSD.org>
References:  <20230331123936.540020-1-corvink@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help
--00000000000000eace05f831cab3
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

Hello Corvin.

I will try your patch very soon if you  want to write carefully all the
commands that I should issue. Thanks.

On Fri, Mar 31, 2023 at 2:40=E2=80=AFPM Corvin K=C3=B6hne <corvink@freebsd.=
org> wrote:

> Hi,
>
> I would like to send the following patch to the EDKII project.
> Therefore, I'd like to get some feedback from the bhyve community before
> sending them to EDKII.
>
> At the moment, UEFI guests are using static ACPI tables. Modifying them
> is not easy because we need to patch them in the EDKII repo.
> Additionally, ACPI tables should be configuration dependent. If one
> assigns a TPM device to one guest, this guest requires different ACPI
> tables than other guests.
>
> Bhyve already builds it own set of ACPI tables. This patch picks them up
> an installs them in the UEFI guest. This will overcome the mentioned
> limitations.
>
> Note that this patch is required to easily implement features like
> qemu's fwcfg or a tpm device emulation.
>
> Here's the patch:
>
> It's much easier to create configuration dependend ACPI tables for bhyve
> than for OVMF. For this reason, don't use the statically created ACPI
> tables provided by OVMF. Instead prefer the dynamically created ACPI
> tables of bhyve. If bhyve provides no ACPI tables or we are unable to
> detect those, fall back to OVMF tables.
>
> Implementation is similar to OvmfPkg/XenAcpiPlatformDxe/Xen.c.
> ---
>  MdePkg/Include/Uefi/UefiBaseType.h           |   2 +
>  OvmfPkg/Bhyve/AcpiPlatformDxe/AcpiPlatform.c |  15 ++
>  OvmfPkg/Bhyve/AcpiPlatformDxe/AcpiPlatform.h |   6 +
>  OvmfPkg/Bhyve/AcpiPlatformDxe/Bhyve.c        | 266 +++++++++++++++++++
>  4 files changed, 289 insertions(+)
>
> diff --git a/MdePkg/Include/Uefi/UefiBaseType.h
> b/MdePkg/Include/Uefi/UefiBaseType.h
> index 83975a08eb..b18a0760ee 100644
> --- a/MdePkg/Include/Uefi/UefiBaseType.h
> +++ b/MdePkg/Include/Uefi/UefiBaseType.h
> @@ -54,6 +54,8 @@ typedef UINT64 EFI_PHYSICAL_ADDRESS;
>  ///
>  typedef UINT64 EFI_VIRTUAL_ADDRESS;
>
> +#define NUMERIC_VALUE_AS_POINTER(Type, Value)  ((Type *) ((UINTN)(Value)=
))
> +
>  ///
>  /// EFI Time Abstraction:
>  ///  Year:       1900 - 9999
> diff --git a/OvmfPkg/Bhyve/AcpiPlatformDxe/AcpiPlatform.c
> b/OvmfPkg/Bhyve/AcpiPlatformDxe/AcpiPlatform.c
> index 999e9f151e..34d9fc80d0 100644
> --- a/OvmfPkg/Bhyve/AcpiPlatformDxe/AcpiPlatform.c
> +++ b/OvmfPkg/Bhyve/AcpiPlatformDxe/AcpiPlatform.c
> @@ -243,6 +243,21 @@ InstallAcpiTables (
>  {
>    EFI_STATUS  Status;
>
> +  Status =3D InstallBhyveTables (AcpiTable);
> +  if (!EFI_ERROR (Status)) {
> +    return EFI_SUCCESS;
> +  }
> +
> +  if (Status !=3D EFI_NOT_FOUND) {
> +    DEBUG ((
> +      DEBUG_INFO,
> +      "%a: unable to install bhyve's ACPI tables (%r)\n",
> +      __FUNCTION__,
> +      Status
> +      ));
> +    return Status;
> +  }
> +
>    Status =3D InstallOvmfFvTables (AcpiTable);
>
>    return Status;
> diff --git a/OvmfPkg/Bhyve/AcpiPlatformDxe/AcpiPlatform.h
> b/OvmfPkg/Bhyve/AcpiPlatformDxe/AcpiPlatform.h
> index 54d1af073e..b2724135d0 100644
> --- a/OvmfPkg/Bhyve/AcpiPlatformDxe/AcpiPlatform.h
> +++ b/OvmfPkg/Bhyve/AcpiPlatformDxe/AcpiPlatform.h
> @@ -46,6 +46,12 @@ BhyveInstallAcpiTable (
>    OUT  UINTN                    *TableKey
>    );
>
> +EFI_STATUS
> +EFIAPI
> +InstallBhyveTables (
> +  IN   EFI_ACPI_TABLE_PROTOCOL  *AcpiProtocol
> +  );
> +
>  EFI_STATUS
>  EFIAPI
>  InstallXenTables (
> diff --git a/OvmfPkg/Bhyve/AcpiPlatformDxe/Bhyve.c
> b/OvmfPkg/Bhyve/AcpiPlatformDxe/Bhyve.c
> index e216a21bfa..5e1b759c01 100644
> --- a/OvmfPkg/Bhyve/AcpiPlatformDxe/Bhyve.c
> +++ b/OvmfPkg/Bhyve/AcpiPlatformDxe/Bhyve.c
> @@ -13,6 +13,18 @@
>  #include <Library/MemoryAllocationLib.h>
>  #include <Library/QemuFwCfgLib.h>             // QemuFwCfgFindFile()
>
> +#define BHYVE_ACPI_PHYSICAL_ADDRESS  ((UINTN)0x000F2400)
> +#define BHYVE_BIOS_PHYSICAL_END      ((UINTN)0x00100000)
> +
> +#pragma pack (1)
> +
> +typedef struct {
> +  EFI_ACPI_DESCRIPTION_HEADER    Header;
> +  UINT64                         Tables[0];
> +} EFI_ACPI_2_0_EXTENDED_SYSTEM_DESCRIPTION_TABLE;
> +
> +#pragma pack ()
> +
>  STATIC
>  EFI_STATUS
>  EFIAPI
> @@ -164,3 +176,257 @@ BhyveInstallAcpiTable (
>             TableKey
>             );
>  }
> +
> +/**
> +  Get the address of bhyve's ACPI Root System Description Pointer (RSDP)=
.
> +
> +  @param  RsdpPtr             Return pointer to RSDP.
> +
> +  @return EFI_SUCCESS         Bhyve's RSDP successfully found.
> +  @return EFI_NOT_FOUND       Couldn't find bhyve's RSDP.
> +  @return EFI_UNSUPPORTED     Revision is lower than 2.
> +  @return EFI_PROTOCOL_ERROR  Invalid RSDP found.
> +
> +**/
> +EFI_STATUS
> +EFIAPI
> +BhyveGetAcpiRsdp (
> +  OUT   EFI_ACPI_2_0_ROOT_SYSTEM_DESCRIPTION_POINTER  **RsdpPtr
> +  )
> +{
> +  UINTN                                         RsdpAddress;
> +  EFI_ACPI_2_0_ROOT_SYSTEM_DESCRIPTION_POINTER  *Rsdp;
> +
> +  if (RsdpPtr =3D=3D NULL) {
> +    return EFI_INVALID_PARAMETER;
> +  }
> +
> +  //
> +  // Detect the RSDP
> +  //
> +  for (RsdpAddress =3D BHYVE_ACPI_PHYSICAL_ADDRESS;
> +       RsdpAddress < BHYVE_BIOS_PHYSICAL_END;
> +       RsdpAddress +=3D 0x10)
> +  {
> +    Rsdp =3D NUMERIC_VALUE_AS_POINTER (
> +             EFI_ACPI_2_0_ROOT_SYSTEM_DESCRIPTION_POINTER,
> +             RsdpAddress
> +             );
> +    if (Rsdp->Signature !=3D
> EFI_ACPI_2_0_ROOT_SYSTEM_DESCRIPTION_POINTER_SIGNATURE) {
> +      continue;
> +    }
> +
> +    if (Rsdp->Revision < 2) {
> +      DEBUG ((DEBUG_INFO, "%a: unsupported RSDP found\n", __FUNCTION__))=
;
> +      return EFI_UNSUPPORTED;
> +    }
> +
> +    //
> +    // For ACPI 1.0/2.0/3.0 the checksum of first 20 bytes should be 0.
> +    // For ACPI 2.0/3.0 the checksum of the entire table should be 0.
> +    //
> +    UINT8  Sum =3D CalculateCheckSum8 (
> +                   (CONST UINT8 *)Rsdp,
> +                   sizeof (EFI_ACPI_1_0_ROOT_SYSTEM_DESCRIPTION_POINTER)
> +                   );
> +    if (Sum !=3D 0) {
> +      DEBUG ((
> +        DEBUG_INFO,
> +        "%a: RSDP header checksum not valid: 0x%02x\n",
> +        __FUNCTION__,
> +        Sum
> +        ));
> +      return EFI_PROTOCOL_ERROR;
> +    }
> +
> +    Sum =3D CalculateCheckSum8 (
> +            (CONST UINT8 *)Rsdp,
> +            sizeof (EFI_ACPI_2_0_ROOT_SYSTEM_DESCRIPTION_POINTER)
> +            );
> +    if (Sum !=3D 0) {
> +      DEBUG ((
> +        DEBUG_INFO,
> +        "%a: RSDP table checksum not valid: 0x%02x\n",
> +        __FUNCTION__,
> +        Sum
> +        ));
> +      return EFI_PROTOCOL_ERROR;
> +    }
> +
> +    //
> +    // RSDP was found and is valid
> +    //
> +    *RsdpPtr =3D Rsdp;
> +
> +    return EFI_SUCCESS;
> +  }
> +
> +  DEBUG ((DEBUG_INFO, "%a: RSDP not found\n", __FUNCTION__));
> +  return EFI_NOT_FOUND;
> +}
> +
> +/**
> +  Get bhyve's ACPI tables from the RSDP. And install bhyve's ACPI tables
> +  into the RSDT/XSDT using InstallAcpiTable.
> +
> +  @param  AcpiProtocol        Protocol instance pointer.
> +
> +  @return EFI_SUCCESS         All tables were successfully inserted.
> +  @return EFI_UNSUPPORTED     Bhyve's ACPI tables doesn't include a XSDT=
.
> +  @return EFI_PROTOCOL_ERROR  Invalid XSDT found.
> +
> +  @return                     Error codes propagated from underlying
> functions.
> +**/
> +EFI_STATUS
> +EFIAPI
> +InstallBhyveTables (
> +  IN   EFI_ACPI_TABLE_PROTOCOL  *AcpiProtocol
> +  )
> +{
> +  EFI_STATUS                                    Status;
> +  UINTN                                         TableHandle;
> +  EFI_ACPI_2_0_ROOT_SYSTEM_DESCRIPTION_POINTER  *Rsdp;
> +  EFI_ACPI_2_0_FIRMWARE_ACPI_CONTROL_STRUCTURE  *Facs;
> +  EFI_ACPI_DESCRIPTION_HEADER                   *Dsdt;
> +
> +  Rsdp =3D NULL;
> +  Facs =3D NULL;
> +  Dsdt =3D NULL;
> +
> +  //
> +  // Try to find bhyve ACPI tables
> +  //
> +  Status =3D BhyveGetAcpiRsdp (&Rsdp);
> +  if (EFI_ERROR (Status)) {
> +    DEBUG ((DEBUG_INFO, "%a: can't get RSDP (%r)\n", __FUNCTION__,
> Status));
> +    return Status;
> +  }
> +
> +  //
> +  // Bhyve should always provide a XSDT
> +  //
> +  EFI_ACPI_2_0_EXTENDED_SYSTEM_DESCRIPTION_TABLE *CONST  Xsdt =3D
> +    NUMERIC_VALUE_AS_POINTER (
> +      EFI_ACPI_2_0_EXTENDED_SYSTEM_DESCRIPTION_TABLE,
> +      Rsdp->XsdtAddress
> +      );
> +
> +  if (Xsdt =3D=3D NULL) {
> +    DEBUG ((DEBUG_INFO, "%a: XSDT not found\n", __FUNCTION__));
> +    return EFI_UNSUPPORTED;
> +  }
> +
> +  if (Xsdt->Header.Length < sizeof (EFI_ACPI_DESCRIPTION_HEADER)) {
> +    DEBUG ((DEBUG_INFO, "%a: invalid XSDT length\n", __FUNCTION__));
> +    return EFI_PROTOCOL_ERROR;
> +  }
> +
> +  //
> +  // Install ACPI tables
> +  //
> +  CONST UINTN  NumberOfTableEntries =3D
> +    (Xsdt->Header.Length - sizeof (Xsdt->Header)) / sizeof (UINT64);
> +
> +  for (UINTN Index =3D 0; Index < NumberOfTableEntries; Index++) {
> +    EFI_ACPI_DESCRIPTION_HEADER *CONST  CurrentTable =3D
> +      NUMERIC_VALUE_AS_POINTER (
> +        EFI_ACPI_DESCRIPTION_HEADER,
> +        Xsdt->Tables[Index]
> +        );
> +    Status =3D AcpiProtocol->InstallAcpiTable (
> +                             AcpiProtocol,
> +                             CurrentTable,
> +                             CurrentTable->Length,
> +                             &TableHandle
> +                             );
> +    if (EFI_ERROR (Status)) {
> +      DEBUG ((
> +        DEBUG_INFO,
> +        "%a: failed to install ACPI table %c%c%c%c (%r)\n",
> +        __FUNCTION__,
> +        NUMERIC_VALUE_AS_POINTER (UINT8, CurrentTable->Signature)[0],
> +        NUMERIC_VALUE_AS_POINTER (UINT8, CurrentTable->Signature)[1],
> +        NUMERIC_VALUE_AS_POINTER (UINT8, CurrentTable->Signature)[2],
> +        NUMERIC_VALUE_AS_POINTER (UINT8, CurrentTable->Signature)[3],
> +        Status
> +        ));
> +      return Status;
> +    }
> +
> +    if (CurrentTable->Signature =3D=3D
> EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE_SIGNATURE) {
> +      EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE *CONST  Fadt =3D
> +        (EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE *CONST)CurrentTable;
> +      if (Fadt->XFirmwareCtrl) {
> +        Facs =3D NUMERIC_VALUE_AS_POINTER (
> +                 EFI_ACPI_2_0_FIRMWARE_ACPI_CONTROL_STRUCTURE,
> +                 Fadt->XFirmwareCtrl
> +                 );
> +      } else {
> +        Facs =3D NUMERIC_VALUE_AS_POINTER (
> +                 EFI_ACPI_2_0_FIRMWARE_ACPI_CONTROL_STRUCTURE,
> +                 Fadt->FirmwareCtrl
> +                 );
> +      }
> +
> +      if (Fadt->XDsdt) {
> +        Dsdt =3D NUMERIC_VALUE_AS_POINTER (
> +                 EFI_ACPI_DESCRIPTION_HEADER,
> +                 Fadt->XDsdt
> +                 );
> +      } else {
> +        Dsdt =3D NUMERIC_VALUE_AS_POINTER (
> +                 EFI_ACPI_DESCRIPTION_HEADER,
> +                 Fadt->Dsdt
> +                 );
> +      }
> +    }
> +  }
> +
> +  //
> +  // Install FACS
> +  //
> +  if (Facs !=3D NULL) {
> +    Status =3D AcpiProtocol->InstallAcpiTable (
> +                             AcpiProtocol,
> +                             Facs,
> +                             Facs->Length,
> +                             &TableHandle
> +                             );
> +    if (EFI_ERROR (Status)) {
> +      DEBUG ((
> +        DEBUG_INFO,
> +        "%a: failed to install FACS (%r)\n",
> +        __FUNCTION__,
> +        Status
> +        ));
> +      return Status;
> +    }
> +  }
> +
> +  //
> +  // Install DSDT
> +  // If it's not found, something bad happened. Don't continue execution=
.
> +  //
> +  if (Dsdt =3D=3D NULL) {
> +    DEBUG ((DEBUG_ERROR, "%a: failed to find DSDT\n", __FUNCTION__));
> +    CpuDeadLoop ();
> +  }
> +
> +  Status =3D AcpiProtocol->InstallAcpiTable (
> +                           AcpiProtocol,
> +                           Dsdt,
> +                           Dsdt->Length,
> +                           &TableHandle
> +                           );
> +  if (EFI_ERROR (Status)) {
> +    DEBUG ((
> +      DEBUG_INFO,
> +      "%a: failed to install DSDT (%r)\n",
> +      __FUNCTION__,
> +      Status
> +      ));
> +    return Status;
> +  }
> +
> +  return EFI_SUCCESS;
> +}
> --
> 2.40.0
>
>
>

--=20
Mario.

--00000000000000eace05f831cab3
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div>Hello Corvin.</div><div><br></div><div>I will try you=
r patch very soon if you=C2=A0 want to write carefully all the commands tha=
t I should issue. Thanks.</div></div><br><div class=3D"gmail_quote"><div di=
r=3D"ltr" class=3D"gmail_attr">On Fri, Mar 31, 2023 at 2:40=E2=80=AFPM Corv=
in K=C3=B6hne &lt;<a href=3D"mailto:corvink@freebsd.org">corvink@freebsd.or=
g</a>&gt; wrote:<br></div><blockquote class=3D"gmail_quote" style=3D"margin=
:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"=
>Hi,<br>
<br>
I would like to send the following patch to the EDKII project.<br>
Therefore, I&#39;d like to get some feedback from the bhyve community befor=
e<br>
sending them to EDKII.<br>
<br>
At the moment, UEFI guests are using static ACPI tables. Modifying them<br>
is not easy because we need to patch them in the EDKII repo.<br>
Additionally, ACPI tables should be configuration dependent. If one<br>
assigns a TPM device to one guest, this guest requires different ACPI<br>
tables than other guests.<br>
<br>
Bhyve already builds it own set of ACPI tables. This patch picks them up<br=
>
an installs them in the UEFI guest. This will overcome the mentioned<br>
limitations.<br>
<br>
Note that this patch is required to easily implement features like<br>
qemu&#39;s fwcfg or a tpm device emulation.<br>
<br>
Here&#39;s the patch:<br>
<br>
It&#39;s much easier to create configuration dependend ACPI tables for bhyv=
e<br>
than for OVMF. For this reason, don&#39;t use the statically created ACPI<b=
r>
tables provided by OVMF. Instead prefer the dynamically created ACPI<br>
tables of bhyve. If bhyve provides no ACPI tables or we are unable to<br>
detect those, fall back to OVMF tables.<br>
<br>
Implementation is similar to OvmfPkg/XenAcpiPlatformDxe/Xen.c.<br>
---<br>
=C2=A0MdePkg/Include/Uefi/UefiBaseType.h=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0|=C2=A0 =C2=A02 +<br>
=C2=A0OvmfPkg/Bhyve/AcpiPlatformDxe/AcpiPlatform.c |=C2=A0 15 ++<br>
=C2=A0OvmfPkg/Bhyve/AcpiPlatformDxe/AcpiPlatform.h |=C2=A0 =C2=A06 +<br>
=C2=A0OvmfPkg/Bhyve/AcpiPlatformDxe/Bhyve.c=C2=A0 =C2=A0 =C2=A0 =C2=A0 | 26=
6 +++++++++++++++++++<br>
=C2=A04 files changed, 289 insertions(+)<br>
<br>
diff --git a/MdePkg/Include/Uefi/UefiBaseType.h b/MdePkg/Include/Uefi/UefiB=
aseType.h<br>
index 83975a08eb..b18a0760ee 100644<br>
--- a/MdePkg/Include/Uefi/UefiBaseType.h<br>
+++ b/MdePkg/Include/Uefi/UefiBaseType.h<br>
@@ -54,6 +54,8 @@ typedef UINT64 EFI_PHYSICAL_ADDRESS;<br>
=C2=A0///<br>
=C2=A0typedef UINT64 EFI_VIRTUAL_ADDRESS;<br>
<br>
+#define NUMERIC_VALUE_AS_POINTER(Type, Value)=C2=A0 ((Type *) ((UINTN)(Val=
ue)))<br>
+<br>
=C2=A0///<br>
=C2=A0/// EFI Time Abstraction:<br>
=C2=A0///=C2=A0 Year:=C2=A0 =C2=A0 =C2=A0 =C2=A01900 - 9999<br>
diff --git a/OvmfPkg/Bhyve/AcpiPlatformDxe/AcpiPlatform.c b/OvmfPkg/Bhyve/A=
cpiPlatformDxe/AcpiPlatform.c<br>
index 999e9f151e..34d9fc80d0 100644<br>
--- a/OvmfPkg/Bhyve/AcpiPlatformDxe/AcpiPlatform.c<br>
+++ b/OvmfPkg/Bhyve/AcpiPlatformDxe/AcpiPlatform.c<br>
@@ -243,6 +243,21 @@ InstallAcpiTables (<br>
=C2=A0{<br>
=C2=A0 =C2=A0EFI_STATUS=C2=A0 Status;<br>
<br>
+=C2=A0 Status =3D InstallBhyveTables (AcpiTable);<br>
+=C2=A0 if (!EFI_ERROR (Status)) {<br>
+=C2=A0 =C2=A0 return EFI_SUCCESS;<br>
+=C2=A0 }<br>
+<br>
+=C2=A0 if (Status !=3D EFI_NOT_FOUND) {<br>
+=C2=A0 =C2=A0 DEBUG ((<br>
+=C2=A0 =C2=A0 =C2=A0 DEBUG_INFO,<br>
+=C2=A0 =C2=A0 =C2=A0 &quot;%a: unable to install bhyve&#39;s ACPI tables (=
%r)\n&quot;,<br>
+=C2=A0 =C2=A0 =C2=A0 __FUNCTION__,<br>
+=C2=A0 =C2=A0 =C2=A0 Status<br>
+=C2=A0 =C2=A0 =C2=A0 ));<br>
+=C2=A0 =C2=A0 return Status;<br>
+=C2=A0 }<br>
+<br>
=C2=A0 =C2=A0Status =3D InstallOvmfFvTables (AcpiTable);<br>
<br>
=C2=A0 =C2=A0return Status;<br>
diff --git a/OvmfPkg/Bhyve/AcpiPlatformDxe/AcpiPlatform.h b/OvmfPkg/Bhyve/A=
cpiPlatformDxe/AcpiPlatform.h<br>
index 54d1af073e..b2724135d0 100644<br>
--- a/OvmfPkg/Bhyve/AcpiPlatformDxe/AcpiPlatform.h<br>
+++ b/OvmfPkg/Bhyve/AcpiPlatformDxe/AcpiPlatform.h<br>
@@ -46,6 +46,12 @@ BhyveInstallAcpiTable (<br>
=C2=A0 =C2=A0OUT=C2=A0 UINTN=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 *TableKey<br>
=C2=A0 =C2=A0);<br>
<br>
+EFI_STATUS<br>
+EFIAPI<br>
+InstallBhyveTables (<br>
+=C2=A0 IN=C2=A0 =C2=A0EFI_ACPI_TABLE_PROTOCOL=C2=A0 *AcpiProtocol<br>
+=C2=A0 );<br>
+<br>
=C2=A0EFI_STATUS<br>
=C2=A0EFIAPI<br>
=C2=A0InstallXenTables (<br>
diff --git a/OvmfPkg/Bhyve/AcpiPlatformDxe/Bhyve.c b/OvmfPkg/Bhyve/AcpiPlat=
formDxe/Bhyve.c<br>
index e216a21bfa..5e1b759c01 100644<br>
--- a/OvmfPkg/Bhyve/AcpiPlatformDxe/Bhyve.c<br>
+++ b/OvmfPkg/Bhyve/AcpiPlatformDxe/Bhyve.c<br>
@@ -13,6 +13,18 @@<br>
=C2=A0#include &lt;Library/MemoryAllocationLib.h&gt;<br>
=C2=A0#include &lt;Library/QemuFwCfgLib.h&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0// QemuFwCfgFindFile()<br>
<br>
+#define BHYVE_ACPI_PHYSICAL_ADDRESS=C2=A0 ((UINTN)0x000F2400)<br>
+#define BHYVE_BIOS_PHYSICAL_END=C2=A0 =C2=A0 =C2=A0 ((UINTN)0x00100000)<br=
>
+<br>
+#pragma pack (1)<br>
+<br>
+typedef struct {<br>
+=C2=A0 EFI_ACPI_DESCRIPTION_HEADER=C2=A0 =C2=A0 Header;<br>
+=C2=A0 UINT64=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0Tables[0];<br>
+} EFI_ACPI_2_0_EXTENDED_SYSTEM_DESCRIPTION_TABLE;<br>
+<br>
+#pragma pack ()<br>
+<br>
=C2=A0STATIC<br>
=C2=A0EFI_STATUS<br>
=C2=A0EFIAPI<br>
@@ -164,3 +176,257 @@ BhyveInstallAcpiTable (<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 TableKey<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 );<br>
=C2=A0}<br>
+<br>
+/**<br>
+=C2=A0 Get the address of bhyve&#39;s ACPI Root System Description Pointer=
 (RSDP).<br>
+<br>
+=C2=A0 @param=C2=A0 RsdpPtr=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0Return pointer to RSDP.<br>
+<br>
+=C2=A0 @return EFI_SUCCESS=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0Bhyve&#39;s RS=
DP successfully found.<br>
+=C2=A0 @return EFI_NOT_FOUND=C2=A0 =C2=A0 =C2=A0 =C2=A0Couldn&#39;t find b=
hyve&#39;s RSDP.<br>
+=C2=A0 @return EFI_UNSUPPORTED=C2=A0 =C2=A0 =C2=A0Revision is lower than 2=
.<br>
+=C2=A0 @return EFI_PROTOCOL_ERROR=C2=A0 Invalid RSDP found.<br>
+<br>
+**/<br>
+EFI_STATUS<br>
+EFIAPI<br>
+BhyveGetAcpiRsdp (<br>
+=C2=A0 OUT=C2=A0 =C2=A0EFI_ACPI_2_0_ROOT_SYSTEM_DESCRIPTION_POINTER=C2=A0 =
**RsdpPtr<br>
+=C2=A0 )<br>
+{<br>
+=C2=A0 UINTN=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=
 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0RsdpAddress;<br>
+=C2=A0 EFI_ACPI_2_0_ROOT_SYSTEM_DESCRIPTION_POINTER=C2=A0 *Rsdp;<br>
+<br>
+=C2=A0 if (RsdpPtr =3D=3D NULL) {<br>
+=C2=A0 =C2=A0 return EFI_INVALID_PARAMETER;<br>
+=C2=A0 }<br>
+<br>
+=C2=A0 //<br>
+=C2=A0 // Detect the RSDP<br>
+=C2=A0 //<br>
+=C2=A0 for (RsdpAddress =3D BHYVE_ACPI_PHYSICAL_ADDRESS;<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0RsdpAddress &lt; BHYVE_BIOS_PHYSICAL_END;<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0RsdpAddress +=3D 0x10)<br>
+=C2=A0 {<br>
+=C2=A0 =C2=A0 Rsdp =3D NUMERIC_VALUE_AS_POINTER (<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0EFI_ACPI_2_0_ROOT_SYSTEM_D=
ESCRIPTION_POINTER,<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0RsdpAddress<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0);<br>
+=C2=A0 =C2=A0 if (Rsdp-&gt;Signature !=3D EFI_ACPI_2_0_ROOT_SYSTEM_DESCRIP=
TION_POINTER_SIGNATURE) {<br>
+=C2=A0 =C2=A0 =C2=A0 continue;<br>
+=C2=A0 =C2=A0 }<br>
+<br>
+=C2=A0 =C2=A0 if (Rsdp-&gt;Revision &lt; 2) {<br>
+=C2=A0 =C2=A0 =C2=A0 DEBUG ((DEBUG_INFO, &quot;%a: unsupported RSDP found\=
n&quot;, __FUNCTION__));<br>
+=C2=A0 =C2=A0 =C2=A0 return EFI_UNSUPPORTED;<br>
+=C2=A0 =C2=A0 }<br>
+<br>
+=C2=A0 =C2=A0 //<br>
+=C2=A0 =C2=A0 // For ACPI 1.0/2.0/3.0 the checksum of first 20 bytes shoul=
d be 0.<br>
+=C2=A0 =C2=A0 // For ACPI 2.0/3.0 the checksum of the entire table should =
be 0.<br>
+=C2=A0 =C2=A0 //<br>
+=C2=A0 =C2=A0 UINT8=C2=A0 Sum =3D CalculateCheckSum8 (<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(CONS=
T UINT8 *)Rsdp,<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0sizeo=
f (EFI_ACPI_1_0_ROOT_SYSTEM_DESCRIPTION_POINTER)<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0);<br=
>
+=C2=A0 =C2=A0 if (Sum !=3D 0) {<br>
+=C2=A0 =C2=A0 =C2=A0 DEBUG ((<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 DEBUG_INFO,<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 &quot;%a: RSDP header checksum not valid: 0x%0=
2x\n&quot;,<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 __FUNCTION__,<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 Sum<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 ));<br>
+=C2=A0 =C2=A0 =C2=A0 return EFI_PROTOCOL_ERROR;<br>
+=C2=A0 =C2=A0 }<br>
+<br>
+=C2=A0 =C2=A0 Sum =3D CalculateCheckSum8 (<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (CONST UINT8 *)Rsdp,<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 sizeof (EFI_ACPI_2_0_ROOT_SYSTEM=
_DESCRIPTION_POINTER)<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 );<br>
+=C2=A0 =C2=A0 if (Sum !=3D 0) {<br>
+=C2=A0 =C2=A0 =C2=A0 DEBUG ((<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 DEBUG_INFO,<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 &quot;%a: RSDP table checksum not valid: 0x%02=
x\n&quot;,<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 __FUNCTION__,<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 Sum<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 ));<br>
+=C2=A0 =C2=A0 =C2=A0 return EFI_PROTOCOL_ERROR;<br>
+=C2=A0 =C2=A0 }<br>
+<br>
+=C2=A0 =C2=A0 //<br>
+=C2=A0 =C2=A0 // RSDP was found and is valid<br>
+=C2=A0 =C2=A0 //<br>
+=C2=A0 =C2=A0 *RsdpPtr =3D Rsdp;<br>
+<br>
+=C2=A0 =C2=A0 return EFI_SUCCESS;<br>
+=C2=A0 }<br>
+<br>
+=C2=A0 DEBUG ((DEBUG_INFO, &quot;%a: RSDP not found\n&quot;, __FUNCTION__)=
);<br>
+=C2=A0 return EFI_NOT_FOUND;<br>
+}<br>
+<br>
+/**<br>
+=C2=A0 Get bhyve&#39;s ACPI tables from the RSDP. And install bhyve&#39;s =
ACPI tables<br>
+=C2=A0 into the RSDT/XSDT using InstallAcpiTable.<br>
+<br>
+=C2=A0 @param=C2=A0 AcpiProtocol=C2=A0 =C2=A0 =C2=A0 =C2=A0 Protocol insta=
nce pointer.<br>
+<br>
+=C2=A0 @return EFI_SUCCESS=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0All tables wer=
e successfully inserted.<br>
+=C2=A0 @return EFI_UNSUPPORTED=C2=A0 =C2=A0 =C2=A0Bhyve&#39;s ACPI tables =
doesn&#39;t include a XSDT.<br>
+=C2=A0 @return EFI_PROTOCOL_ERROR=C2=A0 Invalid XSDT found.<br>
+<br>
+=C2=A0 @return=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0Error codes propagated from underlying functions.<br>
+**/<br>
+EFI_STATUS<br>
+EFIAPI<br>
+InstallBhyveTables (<br>
+=C2=A0 IN=C2=A0 =C2=A0EFI_ACPI_TABLE_PROTOCOL=C2=A0 *AcpiProtocol<br>
+=C2=A0 )<br>
+{<br>
+=C2=A0 EFI_STATUS=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 Statu=
s;<br>
+=C2=A0 UINTN=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=
 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0TableHandle;<br>
+=C2=A0 EFI_ACPI_2_0_ROOT_SYSTEM_DESCRIPTION_POINTER=C2=A0 *Rsdp;<br>
+=C2=A0 EFI_ACPI_2_0_FIRMWARE_ACPI_CONTROL_STRUCTURE=C2=A0 *Facs;<br>
+=C2=A0 EFI_ACPI_DESCRIPTION_HEADER=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0*Dsdt;<br>
+<br>
+=C2=A0 Rsdp =3D NULL;<br>
+=C2=A0 Facs =3D NULL;<br>
+=C2=A0 Dsdt =3D NULL;<br>
+<br>
+=C2=A0 //<br>
+=C2=A0 // Try to find bhyve ACPI tables<br>
+=C2=A0 //<br>
+=C2=A0 Status =3D BhyveGetAcpiRsdp (&amp;Rsdp);<br>
+=C2=A0 if (EFI_ERROR (Status)) {<br>
+=C2=A0 =C2=A0 DEBUG ((DEBUG_INFO, &quot;%a: can&#39;t get RSDP (%r)\n&quot=
;, __FUNCTION__, Status));<br>
+=C2=A0 =C2=A0 return Status;<br>
+=C2=A0 }<br>
+<br>
+=C2=A0 //<br>
+=C2=A0 // Bhyve should always provide a XSDT<br>
+=C2=A0 //<br>
+=C2=A0 EFI_ACPI_2_0_EXTENDED_SYSTEM_DESCRIPTION_TABLE *CONST=C2=A0 Xsdt =
=3D<br>
+=C2=A0 =C2=A0 NUMERIC_VALUE_AS_POINTER (<br>
+=C2=A0 =C2=A0 =C2=A0 EFI_ACPI_2_0_EXTENDED_SYSTEM_DESCRIPTION_TABLE,<br>
+=C2=A0 =C2=A0 =C2=A0 Rsdp-&gt;XsdtAddress<br>
+=C2=A0 =C2=A0 =C2=A0 );<br>
+<br>
+=C2=A0 if (Xsdt =3D=3D NULL) {<br>
+=C2=A0 =C2=A0 DEBUG ((DEBUG_INFO, &quot;%a: XSDT not found\n&quot;, __FUNC=
TION__));<br>
+=C2=A0 =C2=A0 return EFI_UNSUPPORTED;<br>
+=C2=A0 }<br>
+<br>
+=C2=A0 if (Xsdt-&gt;Header.Length &lt; sizeof (EFI_ACPI_DESCRIPTION_HEADER=
)) {<br>
+=C2=A0 =C2=A0 DEBUG ((DEBUG_INFO, &quot;%a: invalid XSDT length\n&quot;, _=
_FUNCTION__));<br>
+=C2=A0 =C2=A0 return EFI_PROTOCOL_ERROR;<br>
+=C2=A0 }<br>
+<br>
+=C2=A0 //<br>
+=C2=A0 // Install ACPI tables<br>
+=C2=A0 //<br>
+=C2=A0 CONST UINTN=C2=A0 NumberOfTableEntries =3D<br>
+=C2=A0 =C2=A0 (Xsdt-&gt;Header.Length - sizeof (Xsdt-&gt;Header)) / sizeof=
 (UINT64);<br>
+<br>
+=C2=A0 for (UINTN Index =3D 0; Index &lt; NumberOfTableEntries; Index++) {=
<br>
+=C2=A0 =C2=A0 EFI_ACPI_DESCRIPTION_HEADER *CONST=C2=A0 CurrentTable =3D<br=
>
+=C2=A0 =C2=A0 =C2=A0 NUMERIC_VALUE_AS_POINTER (<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 EFI_ACPI_DESCRIPTION_HEADER,<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 Xsdt-&gt;Tables[Index]<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 );<br>
+=C2=A0 =C2=A0 Status =3D AcpiProtocol-&gt;InstallAcpiTable (<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0AcpiProtocol,<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0CurrentTable,<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0CurrentTable-&gt;Length,<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0&amp;TableHandle<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0);<br>
+=C2=A0 =C2=A0 if (EFI_ERROR (Status)) {<br>
+=C2=A0 =C2=A0 =C2=A0 DEBUG ((<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 DEBUG_INFO,<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 &quot;%a: failed to install ACPI table %c%c%c%=
c (%r)\n&quot;,<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 __FUNCTION__,<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 NUMERIC_VALUE_AS_POINTER (UINT8, CurrentTable-=
&gt;Signature)[0],<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 NUMERIC_VALUE_AS_POINTER (UINT8, CurrentTable-=
&gt;Signature)[1],<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 NUMERIC_VALUE_AS_POINTER (UINT8, CurrentTable-=
&gt;Signature)[2],<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 NUMERIC_VALUE_AS_POINTER (UINT8, CurrentTable-=
&gt;Signature)[3],<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 Status<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 ));<br>
+=C2=A0 =C2=A0 =C2=A0 return Status;<br>
+=C2=A0 =C2=A0 }<br>
+<br>
+=C2=A0 =C2=A0 if (CurrentTable-&gt;Signature =3D=3D EFI_ACPI_2_0_FIXED_ACP=
I_DESCRIPTION_TABLE_SIGNATURE) {<br>
+=C2=A0 =C2=A0 =C2=A0 EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE *CONST=C2=
=A0 Fadt =3D<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 (EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE *CO=
NST)CurrentTable;<br>
+=C2=A0 =C2=A0 =C2=A0 if (Fadt-&gt;XFirmwareCtrl) {<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 Facs =3D NUMERIC_VALUE_AS_POINTER (<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0EFI_ACPI_2_0=
_FIRMWARE_ACPI_CONTROL_STRUCTURE,<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0Fadt-&gt;XFi=
rmwareCtrl<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0);<br>
+=C2=A0 =C2=A0 =C2=A0 } else {<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 Facs =3D NUMERIC_VALUE_AS_POINTER (<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0EFI_ACPI_2_0=
_FIRMWARE_ACPI_CONTROL_STRUCTURE,<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0Fadt-&gt;Fir=
mwareCtrl<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0);<br>
+=C2=A0 =C2=A0 =C2=A0 }<br>
+<br>
+=C2=A0 =C2=A0 =C2=A0 if (Fadt-&gt;XDsdt) {<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 Dsdt =3D NUMERIC_VALUE_AS_POINTER (<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0EFI_ACPI_DES=
CRIPTION_HEADER,<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0Fadt-&gt;XDs=
dt<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0);<br>
+=C2=A0 =C2=A0 =C2=A0 } else {<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 Dsdt =3D NUMERIC_VALUE_AS_POINTER (<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0EFI_ACPI_DES=
CRIPTION_HEADER,<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0Fadt-&gt;Dsd=
t<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0);<br>
+=C2=A0 =C2=A0 =C2=A0 }<br>
+=C2=A0 =C2=A0 }<br>
+=C2=A0 }<br>
+<br>
+=C2=A0 //<br>
+=C2=A0 // Install FACS<br>
+=C2=A0 //<br>
+=C2=A0 if (Facs !=3D NULL) {<br>
+=C2=A0 =C2=A0 Status =3D AcpiProtocol-&gt;InstallAcpiTable (<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0AcpiProtocol,<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0Facs,<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0Facs-&gt;Length,<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0&amp;TableHandle<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0);<br>
+=C2=A0 =C2=A0 if (EFI_ERROR (Status)) {<br>
+=C2=A0 =C2=A0 =C2=A0 DEBUG ((<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 DEBUG_INFO,<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 &quot;%a: failed to install FACS (%r)\n&quot;,=
<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 __FUNCTION__,<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 Status<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 ));<br>
+=C2=A0 =C2=A0 =C2=A0 return Status;<br>
+=C2=A0 =C2=A0 }<br>
+=C2=A0 }<br>
+<br>
+=C2=A0 //<br>
+=C2=A0 // Install DSDT<br>
+=C2=A0 // If it&#39;s not found, something bad happened. Don&#39;t continu=
e execution.<br>
+=C2=A0 //<br>
+=C2=A0 if (Dsdt =3D=3D NULL) {<br>
+=C2=A0 =C2=A0 DEBUG ((DEBUG_ERROR, &quot;%a: failed to find DSDT\n&quot;, =
__FUNCTION__));<br>
+=C2=A0 =C2=A0 CpuDeadLoop ();<br>
+=C2=A0 }<br>
+<br>
+=C2=A0 Status =3D AcpiProtocol-&gt;InstallAcpiTable (<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0AcpiProtocol,<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0Dsdt,<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0Dsdt-&gt;Length,<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0&amp;TableHandle<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0);<br>
+=C2=A0 if (EFI_ERROR (Status)) {<br>
+=C2=A0 =C2=A0 DEBUG ((<br>
+=C2=A0 =C2=A0 =C2=A0 DEBUG_INFO,<br>
+=C2=A0 =C2=A0 =C2=A0 &quot;%a: failed to install DSDT (%r)\n&quot;,<br>
+=C2=A0 =C2=A0 =C2=A0 __FUNCTION__,<br>
+=C2=A0 =C2=A0 =C2=A0 Status<br>
+=C2=A0 =C2=A0 =C2=A0 ));<br>
+=C2=A0 =C2=A0 return Status;<br>
+=C2=A0 }<br>
+<br>
+=C2=A0 return EFI_SUCCESS;<br>
+}<br>
-- <br>
2.40.0<br>
<br>
<br>
</blockquote></div><br clear=3D"all"><br><span class=3D"gmail_signature_pre=
fix">-- </span><br><div dir=3D"ltr" class=3D"gmail_signature">Mario.<br></d=
iv>

--00000000000000eace05f831cab3--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CA%2B1FSiggd8Z8VEC=KGhV7wkBiWH1rtJdNTAm8nq71Q-3HgOHsQ>