WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-ia64-devel

RE: [Xen-ia64-devel] [PATCH][GFW] Fix SMBIOS allocation

To: "Alex Williamson" <alex.williamson@xxxxxx>, "Tristan Gingold" <tgingold@xxxxxxx>
Subject: RE: [Xen-ia64-devel] [PATCH][GFW] Fix SMBIOS allocation
From: "Zhang, Xing Z" <xing.z.zhang@xxxxxxxxx>
Date: Fri, 2 Nov 2007 12:06:15 +0800
Cc: xen-ia64-devel <xen-ia64-devel@xxxxxxxxxxxxxxxxxxx>
Delivery-date: Thu, 01 Nov 2007 21:06:44 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
In-reply-to: <1193963636.31834.118.camel@bling>
List-help: <mailto:xen-ia64-devel-request@lists.xensource.com?subject=help>
List-id: Discussion of the ia64 port of Xen <xen-ia64-devel.lists.xensource.com>
List-post: <mailto:xen-ia64-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-ia64-devel>, <mailto:xen-ia64-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-ia64-devel>, <mailto:xen-ia64-devel-request@lists.xensource.com?subject=unsubscribe>
References: <1193963636.31834.118.camel@bling>
Sender: xen-ia64-devel-bounces@xxxxxxxxxxxxxxxxxxx
Thread-index: Acgc6C+MQJ6Z2LC/T/umX3UBMe/eqgAHXYWw
Thread-topic: [Xen-ia64-devel] [PATCH][GFW] Fix SMBIOS allocation
Thanks. This API is pretty good

Good good study,day day up ! ^_^
-Wing(zhang xin)

OTC,Intel Corporation

>-----Original Message-----
>From: xen-ia64-devel-bounces@xxxxxxxxxxxxxxxxxxx
>[mailto:xen-ia64-devel-bounces@xxxxxxxxxxxxxxxxxxx] On
>Behalf Of Alex Williamson
>Sent: 2007?11?2? 8:34
>To: Tristan Gingold
>Cc: xen-ia64-devel
>Subject: [Xen-ia64-devel] [PATCH][GFW] Fix SMBIOS allocation
>
>
>   When we allocate space for the SMBIOS table in the GFW, we
>check to
>see if it landed under 4GB, but we're not actually telling the
>allocator
>that's where we want it.  This always failed for me.  The patch
>below
>calls AllocatePages directly with the AllocateMaxAddress
>option to hint
>to the allocator where we want the buffer.  Thanks,
>
>       Alex
>
>Signed-off-by: Alex Williamson <alex.williamson@xxxxxx>
>--
>
>diff -r c238cddcd25b edk2-sparse/EdkXenPkg/Dxe/Bds/SMBios.c
>--- a/edk2-sparse/EdkXenPkg/Dxe/Bds/SMBios.c   Wed Oct 24
>02:50:08 2007 +0200
>+++ b/edk2-sparse/EdkXenPkg/Dxe/Bds/SMBios.c   Thu Nov 01
>18:26:09 2007 -0600
>@@ -1,3 +1,4 @@
>+#include <Common/UefiBaseTypes.h>
> #include <Ppi/XenHobs.h>
> #include <hypercall.h>
>
>@@ -747,7 +748,9 @@ UINT32 create_smbios_table(VOID **smbios
>     CHAR8 tmp[16]; /* holds result of itoa() */
>     UINT16 tmp_len; /* length of next string to add */
>
>-    VOID *smbios_table = NULL;
>+    EFI_PHYSICAL_ADDRESS phys_addr = 0xffffffff; /* allocate
>below 4G */
>+    EFI_STATUS status;
>+    VOID *smbios_table;
>
>     hypercall_xen_version(XEN_UUID, (VOID *)uuid);
>     hypercall_xen_version(XEN_VERSION, (VOID
>*)&xen_version);
>@@ -794,14 +797,18 @@ UINT32 create_smbios_table(VOID **smbios
>
>     // The memory used as smbios table for runtime, so no free()
>invoked
>     // otherwise error_out
>-    smbios_table = (VOID
>*)AllocateRuntimePool(SMBIOS_MAXIMUM_SIZE);
>-
>-    if ( !smbios_table || (UINT64)smbios_table > ADDR_4G )
>+    status = gBS->AllocatePages(AllocateMaxAddress,
>+                                EfiReservedMemoryType,
>+
>EFI_SIZE_TO_PAGES(SMBIOS_MAXIMUM_SIZE),
>+                                &phys_addr);
>+    if ( EFI_ERROR(status) )
>     {
>-        DEBUG((EFI_D_ERROR, "Cannot allocate memory below 4G
>for smbios table.\n"));
>+        DEBUG((EFI_D_ERROR, "Cannot allocate memory for smbios
>table.\n"));
>         goto error_out;
>     }
>
>+    smbios_table = (VOID *)(UINTN)phys_addr;
>+
>     len = write_smbios_tables(smbios_table,
>                               get_vcpu_nr(), get_memsize(),
>                               uuid, xen_version_str,
>@@ -820,8 +827,7 @@ error_out:
>         FreePool(smbios_table);
>
>     *smbios = NULL;
>-    DEBUG((EFI_D_ERROR, "Could not write SMBIOS tables, error
>in hvmloader.c:"
>-           "hvm_write_smbios_tables()\n"));
>+    DEBUG((EFI_D_ERROR, "Could not write SMBIOS tables\n"));
>     return 0;
> }
>
>
>
>
>_______________________________________________
>Xen-ia64-devel mailing list
>Xen-ia64-devel@xxxxxxxxxxxxxxxxxxx
>http://lists.xensource.com/xen-ia64-devel

_______________________________________________
Xen-ia64-devel mailing list
Xen-ia64-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-ia64-devel

<Prev in Thread] Current Thread [Next in Thread>