diff mbox series

[v2,11/31] OvmfPkg/XenPlatformPei: Use mXenHvmloaderInfo to get E820

Message ID 20190409110844.14746-12-anthony.perard@citrix.com (mailing list archive)
State New, archived
Headers show
Series Specific platform to run OVMF in Xen PVH and HVM guests | expand

Commit Message

Anthony PERARD April 9, 2019, 11:08 a.m. UTC
Use the already checked pointer mXenHvmloaderInfo to retrieve the E820
table produced by hvmloader.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
---
 OvmfPkg/XenPlatformPei/Xen.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

Comments

Laszlo Ersek April 11, 2019, 11:49 a.m. UTC | #1
On 04/09/19 13:08, Anthony PERARD wrote:
> Use the already checked pointer mXenHvmloaderInfo to retrieve the E820
> table produced by hvmloader.
> 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
> ---
>  OvmfPkg/XenPlatformPei/Xen.c | 18 +++++++++---------
>  1 file changed, 9 insertions(+), 9 deletions(-)
> 
> diff --git a/OvmfPkg/XenPlatformPei/Xen.c b/OvmfPkg/XenPlatformPei/Xen.c
> index a866641b67..df906b6be5 100644
> --- a/OvmfPkg/XenPlatformPei/Xen.c
> +++ b/OvmfPkg/XenPlatformPei/Xen.c
> @@ -59,18 +59,18 @@ XenGetE820Map (
>    UINT32 *Count
>    )
>  {
> -  EFI_XEN_OVMF_INFO *Info =
> -    (EFI_XEN_OVMF_INFO *)(UINTN) OVMF_INFO_PHYSICAL_ADDRESS;
> +  //
> +  // Get E820 produced by hvmloader
> +  //
> +  if (mXenHvmloaderInfo != NULL) {
> +    ASSERT (mXenHvmloaderInfo->E820 < MAX_ADDRESS);
> +    *Entries = (EFI_E820_ENTRY64 *)(UINTN) mXenHvmloaderInfo->E820;
> +    *Count = mXenHvmloaderInfo->E820EntriesCount;
>  
> -  if (AsciiStrCmp ((CHAR8 *) Info->Signature, "XenHVMOVMF")) {
> -    return EFI_NOT_FOUND;
> +    return EFI_SUCCESS;
>    }
>  
> -  ASSERT (Info->E820 < MAX_ADDRESS);
> -  *Entries = (EFI_E820_ENTRY64 *)(UINTN) Info->E820;
> -  *Count = Info->E820EntriesCount;
> -
> -  return EFI_SUCCESS;
> +  return EFI_NOT_FOUND;
>  }
>  
>  /**
> 

Acked-by: Laszlo Ersek <lersek@redhat.com>
diff mbox series

Patch

diff --git a/OvmfPkg/XenPlatformPei/Xen.c b/OvmfPkg/XenPlatformPei/Xen.c
index a866641b67..df906b6be5 100644
--- a/OvmfPkg/XenPlatformPei/Xen.c
+++ b/OvmfPkg/XenPlatformPei/Xen.c
@@ -59,18 +59,18 @@  XenGetE820Map (
   UINT32 *Count
   )
 {
-  EFI_XEN_OVMF_INFO *Info =
-    (EFI_XEN_OVMF_INFO *)(UINTN) OVMF_INFO_PHYSICAL_ADDRESS;
+  //
+  // Get E820 produced by hvmloader
+  //
+  if (mXenHvmloaderInfo != NULL) {
+    ASSERT (mXenHvmloaderInfo->E820 < MAX_ADDRESS);
+    *Entries = (EFI_E820_ENTRY64 *)(UINTN) mXenHvmloaderInfo->E820;
+    *Count = mXenHvmloaderInfo->E820EntriesCount;
 
-  if (AsciiStrCmp ((CHAR8 *) Info->Signature, "XenHVMOVMF")) {
-    return EFI_NOT_FOUND;
+    return EFI_SUCCESS;
   }
 
-  ASSERT (Info->E820 < MAX_ADDRESS);
-  *Entries = (EFI_E820_ENTRY64 *)(UINTN) Info->E820;
-  *Count = Info->E820EntriesCount;
-
-  return EFI_SUCCESS;
+  return EFI_NOT_FOUND;
 }
 
 /**