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
|