[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-ia64-devel] [PATCH] [ia64] efi: allow efi memory regions to be dumped at boot
In Linux, when EFI_DEBUG in xen/arch/ia64/linux-xen/efi.c is set to a non-zero value the EFI memory regions, as supplied by the boot parameter are displayed. In xen similar behaviour is provided by using the efi_print command-line parameter. * Allow the memory region printing code (print_md()) used to show the virtualised EFI regions used by by domains to also be used to show the physical regions. * Allow print_md() to print a region using a single call to printk - previously 2 were used, which seems dubious. * Enhance print_md() to show TB and GB as well as MB and KB. On the rx2620 box I use there us a (reserved) region of 8TB in size. 8TB seems much more readable than 8388608MB to me. * Pad the size displayed by print_md() with white-space for readability. * Wrap the current EFI range dumping code inherited from Linux with #ifdef XEN. It does not work in Xen as it is called before the console is in a useful state. Signed-off-by: Simon Horman <horms@xxxxxxxxxxxx> --- xen/arch/ia64/linux-xen/efi.c | 33 ++++++++++++++++++++++++++++ xen/arch/ia64/xen/dom_fw_common.c | 19 ---------------- xen/arch/ia64/xen/xensetup.c | 10 +------- xen/include/asm-ia64/linux-xen/linux/efi.h | 4 +++ 4 files changed, 40 insertions(+), 26 deletions(-) The output for the hypervisor memory will look like: (XEN) mem00: type= 4, attr=0x0000000000000008, range=[0x0000000000000000-0x0000000000001000) ( 4KB) (XEN) mem01: type= 7, attr=0x0000000000000008, range=[0x0000000000001000-0x00000000000a0000) ( 636KB) (XEN) mem02: type=11, attr=0x0000000000000003, range=[0x00000000000a0000-0x00000000000c0000) ( 128KB) (XEN) mem03: type= 5, attr=0x8000000000000001, range=[0x00000000000c0000-0x0000000000100000) ( 256KB) (XEN) mem04: type= 7, attr=0x0000000000000008, range=[0x0000000000100000-0x0000000004000000) ( 63MB) (XEN) mem05: type= 2, attr=0x0000000000000008, range=[0x0000000004000000-0x00000000041f0000) ( 1MB) (XEN) mem06: type= 7, attr=0x0000000000000008, range=[0x00000000041f0000-0x000000003e695000) ( 932MB) The output for domain memory will look like: (XEN) dom mem00: type=13, attr=0x8000000000000008, range=[0x0000000000000000-0x0000000000001000) ( 4KB) (XEN) dom mem01: type=10, attr=0x8000000000000008, range=[0x0000000000001000-0x0000000000002000) ( 4KB) (XEN) dom mem02: type= 6, attr=0x8000000000000008, range=[0x0000000000002000-0x0000000000003000) ( 4KB) (XEN) dom mem03: type= 7, attr=0x0000000000000008, range=[0x0000000000003000-0x00000000000a0000) ( 628KB) (XEN) dom mem04: type=11, attr=0x0000000000000003, range=[0x00000000000a0000-0x00000000000c0000) ( 128KB) (XEN) dom mem05: type= 5, attr=0x8000000000000001, range=[0x00000000000c0000-0x0000000000100000) ( 256KB) (XEN) dom mem06: type= 7, attr=0x0000000000000008, range=[0x0000000000100000-0x0000000004000000) ( 63MB) (XEN) dom mem07: type= 7, attr=0x0000000000000008, range=[0x0000000004000000-0x00000000041f0000) ( 1MB) (XEN) dom mem08: type= 7, attr=0x0000000000000008, range=[0x00000000041f0000-0x000000003e4a5000) ( 930MB) Date: Tue, 26 Feb 2008 13:42:31 +0900 Sent upstream Date: Tue, 26 Feb 2008 15:28:00 +0900 Updated for linux coding style guidelines - else should follow { - space after = Wed, 27 Feb 2008 17:21:10 +0900 Refactored to use efi_print() Index: xen-unstable.hg/xen/arch/ia64/linux-xen/efi.c =================================================================== --- xen-unstable.hg.orig/xen/arch/ia64/linux-xen/efi.c 2008-02-27 13:00:18.000000000 +0900 +++ xen-unstable.hg/xen/arch/ia64/linux-xen/efi.c 2008-02-27 17:03:45.000000000 +0900 @@ -577,6 +577,7 @@ efi_init (void) efi_map_end = efi_map_start + ia64_boot_param->efi_memmap_size; efi_desc_size = ia64_boot_param->efi_memdesc_size; +#ifndef XEN #if EFI_DEBUG /* print EFI memory map: */ { @@ -592,11 +593,43 @@ efi_init (void) } } #endif +#endif efi_map_pal_code(); efi_enter_virtual_mode(); } +#ifdef XEN +void +print_md(const char *prefix, int index, efi_memory_desc_t *md) +{ + uint64_t size = md->num_pages << EFI_PAGE_SHIFT; + const char *unit; + + size = md->num_pages << EFI_PAGE_SHIFT; + + if ((size >> 40) > 0) { + size >>= 40; + unit = "TB"; + } else if ((size >> 30) > 0) { + size >>= 30; + unit = "GB"; + } else if ((size >> 20) > 0) { + size >>= 20; + unit = "MB"; + } else { + size >>= 10; + unit = "KB"; + } + + printk(KERN_INFO "%s%02d: type=%2u, attr=0x%016lx, " + "range=[0x%016lx-0x%016lx) (%4lu%s)\n", prefix, index, + md->type, md->attribute, md->phys_addr, + md->phys_addr + (md->num_pages << EFI_PAGE_SHIFT), size, unit); + +} +#endif + void efi_enter_virtual_mode (void) { Index: xen-unstable.hg/xen/arch/ia64/xen/dom_fw_common.c =================================================================== --- xen-unstable.hg.orig/xen/arch/ia64/xen/dom_fw_common.c 2008-02-27 13:00:18.000000000 +0900 +++ xen-unstable.hg/xen/arch/ia64/xen/dom_fw_common.c 2008-02-27 16:45:17.000000000 +0900 @@ -190,23 +190,6 @@ dom_fw_pal_hypercall_patch(uint64_t brki brkimm, FW_HYPERCALL_PAL_CALL); } -static inline void -print_md(efi_memory_desc_t *md) -{ - uint64_t size; - - printk(XENLOG_INFO "dom mem: type=%2u, attr=0x%016lx, " - "range=[0x%016lx-0x%016lx) ", - md->type, md->attribute, md->phys_addr, - md->phys_addr + (md->num_pages << EFI_PAGE_SHIFT)); - - size = md->num_pages << EFI_PAGE_SHIFT; - if (size > ONE_MB) - printk("(%luMB)\n", size >> 20); - else - printk("(%luKB)\n", size >> 10); -} - struct fake_acpi_tables { struct acpi20_table_rsdp rsdp; struct xsdt_descriptor_rev2 xsdt; @@ -543,7 +526,7 @@ dom_fw_init(domain_t *d, /* Display memmap. */ for (i = 0 ; i < tables->num_mds; i++) - print_md(&tables->efi_memmap[i]); + print_md("dom mem", i, &tables->efi_memmap[i]); /* Fill boot_param */ bp->efi_systab = FW_FIELD_MPA(efi_systab); Index: xen-unstable.hg/xen/include/asm-ia64/linux-xen/linux/efi.h =================================================================== --- xen-unstable.hg.orig/xen/include/asm-ia64/linux-xen/linux/efi.h 2008-02-27 13:00:18.000000000 +0900 +++ xen-unstable.hg/xen/include/asm-ia64/linux-xen/linux/efi.h 2008-02-27 16:45:17.000000000 +0900 @@ -309,6 +309,10 @@ efi_guid_unparse(efi_guid_t *guid, char } extern void efi_init (void); +#if XEN +extern void efi_dump_mem (void); +extern void print_md(const char *prefix, int index, efi_memory_desc_t *md); +#endif extern void *efi_get_pal_addr (void); extern void efi_map_pal_code (void); extern void efi_map_memmap(void); Index: xen-unstable.hg/xen/arch/ia64/xen/xensetup.c =================================================================== --- xen-unstable.hg.orig/xen/arch/ia64/xen/xensetup.c 2008-02-27 13:00:19.000000000 +0900 +++ xen-unstable.hg/xen/arch/ia64/xen/xensetup.c 2008-02-27 17:12:54.000000000 +0900 @@ -181,7 +181,6 @@ efi_print(void) void *efi_map_start, *efi_map_end; u64 efi_desc_size; - efi_memory_desc_t *md; void *p; int i; @@ -192,13 +191,8 @@ efi_print(void) efi_map_end = efi_map_start + ia64_boot_param->efi_memmap_size; efi_desc_size = ia64_boot_param->efi_memdesc_size; - for (i = 0, p = efi_map_start; p < efi_map_end; ++i, p += efi_desc_size) { - md = p; - printk("mem%02u: type=%2u, attr=0x%016lx, range=[0x%016lx-0x%016lx) " - "(%luMB)\n", i, md->type, md->attribute, md->phys_addr, - md->phys_addr + (md->num_pages << EFI_PAGE_SHIFT), - md->num_pages >> (20 - EFI_PAGE_SHIFT)); - } + for (i = 0, p = efi_map_start; p < efi_map_end; ++i, p += efi_desc_size) + print_md("mem", i, p); } /* _______________________________________________ Xen-ia64-devel mailing list Xen-ia64-devel@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-ia64-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |