ia64/xen-unstable

changeset 11092:21240dc9f2e8

[XEN] Clean up e820 definitions. Define shared set in hvm public dir.
Signed-off-by: Keir Fraser <keir@xensource.com>
author kaf24@localhost.localdomain
date Sun Aug 13 17:47:59 2006 +0100 (2006-08-13)
parents befab551b0e1
children 1fcc31985898
files tools/firmware/vmxassist/setup.c tools/firmware/vmxassist/util.h tools/libxc/xc_hvm_build.c xen/arch/x86/e820.c xen/arch/x86/hvm/hvm.c xen/arch/x86/mm.c xen/include/asm-x86/e820.h xen/include/asm-x86/hvm/domain.h xen/include/asm-x86/page.h xen/include/public/hvm/e820.h
line diff
     1.1 --- a/tools/firmware/vmxassist/setup.c	Sun Aug 13 09:44:07 2006 +0100
     1.2 +++ b/tools/firmware/vmxassist/setup.c	Sun Aug 13 17:47:59 2006 +0100
     1.3 @@ -56,7 +56,7 @@ struct e820entry e820map[] = {
     1.4  	{ 0x00000000000A0000ULL, 0x0000000000020000ULL, E820_IO },
     1.5  	{ 0x00000000000C0000ULL, 0x0000000000040000ULL, E820_RESERVED },
     1.6  	{ 0x0000000000100000ULL, 0x0000000000000000ULL, E820_RAM },
     1.7 -	{ 0x0000000000000000ULL, 0x0000000000001000ULL, E820_SHARED },
     1.8 +	{ 0x0000000000000000ULL, 0x0000000000001000ULL, E820_SHARED_PAGE },
     1.9  	{ 0x0000000000000000ULL, 0x0000000000003000ULL, E820_NVS },
    1.10  	{ 0x0000000000003000ULL, 0x000000000000A000ULL, E820_ACPI },
    1.11  	{ 0x00000000FEC00000ULL, 0x0000000001400000ULL, E820_IO },
    1.12 @@ -94,13 +94,13 @@ banner(void)
    1.13  	e820map[6].addr = memory_size;
    1.14  	e820map[7].addr += memory_size;
    1.15  
    1.16 -	*LINUX_E820_MAP_NR = sizeof(e820map)/sizeof(e820map[0]);
    1.17 -	memcpy(LINUX_E820_MAP, e820map, sizeof(e820map));
    1.18 +	*E820_MAP_NR = sizeof(e820map)/sizeof(e820map[0]);
    1.19 +	memcpy(E820_MAP, e820map, sizeof(e820map));
    1.20  #endif
    1.21  
    1.22  	printf("Memory size %ld MB\n", memory_size >> 20);
    1.23  	printf("E820 map:\n");
    1.24 -	print_e820_map(LINUX_E820_MAP, *LINUX_E820_MAP_NR);
    1.25 +	print_e820_map(E820_MAP, *E820_MAP_NR);
    1.26  	printf("\n");
    1.27  }
    1.28  
     2.1 --- a/tools/firmware/vmxassist/util.h	Sun Aug 13 09:44:07 2006 +0100
     2.2 +++ b/tools/firmware/vmxassist/util.h	Sun Aug 13 17:47:59 2006 +0100
     2.3 @@ -23,23 +23,9 @@
     2.4  #include <stdarg.h>
     2.5  #include <vm86.h>
     2.6  
     2.7 -
     2.8 -#define	LINUX_E820_MAP_NR	((unsigned char *)0x901E8)
     2.9 -#define	LINUX_E820_MAP		((struct e820entry *)0x902D0)
    2.10 -
    2.11 -#define	E820_RAM	1
    2.12 -#define	E820_RESERVED	2
    2.13 -#define	E820_ACPI	3
    2.14 -#define	E820_NVS	4
    2.15 -#define	E820_IO		16
    2.16 -#define	E820_SHARED	17
    2.17 -
    2.18 -struct e820entry {
    2.19 -	unsigned long long	addr;
    2.20 -	unsigned long long	size;
    2.21 -	unsigned long		type;
    2.22 -} __attribute__((packed));
    2.23 -
    2.24 +#include <xen/hvm/e820.h>
    2.25 +#define E820_MAP_NR ((unsigned char *)E820_MAP_PAGE + E820_MAP_NR_OFFSET)
    2.26 +#define E820_MAP    ((struct e820entry *)(E820_MAP_PAGE + E820_MAP_OFFSET))
    2.27  
    2.28  #define	offsetof(type, member)	((unsigned) &((type *)0)->member)
    2.29  
     3.1 --- a/tools/libxc/xc_hvm_build.c	Sun Aug 13 09:44:07 2006 +0100
     3.2 +++ b/tools/libxc/xc_hvm_build.c	Sun Aug 13 17:47:59 2006 +0100
     3.3 @@ -14,30 +14,10 @@
     3.4  #include <xen/hvm/hvm_info_table.h>
     3.5  #include <xen/hvm/ioreq.h>
     3.6  #include <xen/hvm/params.h>
     3.7 +#include <xen/hvm/e820.h>
     3.8  
     3.9  #define HVM_LOADER_ENTR_ADDR  0x00100000
    3.10  
    3.11 -#define E820MAX     128
    3.12 -
    3.13 -#define E820_RAM          1
    3.14 -#define E820_RESERVED     2
    3.15 -#define E820_ACPI         3
    3.16 -#define E820_NVS          4
    3.17 -#define E820_IO          16
    3.18 -#define E820_SHARED_PAGE 17
    3.19 -#define E820_XENSTORE    18
    3.20 -#define E820_BUFFERED_IO 19
    3.21 -
    3.22 -#define E820_MAP_PAGE       0x00090000
    3.23 -#define E820_MAP_NR_OFFSET  0x000001E8
    3.24 -#define E820_MAP_OFFSET     0x000002D0
    3.25 -
    3.26 -struct e820entry {
    3.27 -    uint64_t addr;
    3.28 -    uint64_t size;
    3.29 -    uint32_t type;
    3.30 -} __attribute__((packed));
    3.31 -
    3.32  static int
    3.33  parseelfimage(
    3.34      char *elfbase, unsigned long elfsize, struct domain_setup_info *dsi);
     4.1 --- a/xen/arch/x86/e820.c	Sun Aug 13 09:44:07 2006 +0100
     4.2 +++ b/xen/arch/x86/e820.c	Sun Aug 13 17:47:59 2006 +0100
     4.3 @@ -2,6 +2,7 @@
     4.4  #include <xen/init.h>
     4.5  #include <xen/lib.h>
     4.6  #include <asm/e820.h>
     4.7 +#include <asm/page.h>
     4.8  
     4.9  /* opt_mem: Limit of physical RAM. Any RAM beyond this point is ignored. */
    4.10  unsigned long long opt_mem;
    4.11 @@ -30,16 +31,7 @@ static void __init add_memory_region(uns
    4.12      }
    4.13  } /* add_memory_region */
    4.14  
    4.15 -#define E820_DEBUG	1
    4.16 -
    4.17 -#ifndef NDEBUG
    4.18 -#define __init_unless_debugging
    4.19 -#else
    4.20 -#define __init_unless_debugging __init
    4.21 -#endif
    4.22 -
    4.23 -void __init_unless_debugging
    4.24 -print_e820_memory_map(struct e820entry *map, int entries)
    4.25 +static void __init print_e820_memory_map(struct e820entry *map, int entries)
    4.26  {
    4.27      int i;
    4.28  
     5.1 --- a/xen/arch/x86/hvm/hvm.c	Sun Aug 13 09:44:07 2006 +0100
     5.2 +++ b/xen/arch/x86/hvm/hvm.c	Sun Aug 13 17:47:59 2006 +0100
     5.3 @@ -31,6 +31,7 @@
     5.4  #include <xen/guest_access.h>
     5.5  #include <xen/event.h>
     5.6  #include <asm/current.h>
     5.7 +#include <asm/e820.h>
     5.8  #include <asm/io.h>
     5.9  #include <asm/shadow.h>
    5.10  #include <asm/regs.h>
     6.1 --- a/xen/arch/x86/mm.c	Sun Aug 13 09:44:07 2006 +0100
     6.2 +++ b/xen/arch/x86/mm.c	Sun Aug 13 17:47:59 2006 +0100
     6.3 @@ -105,6 +105,7 @@
     6.4  #include <asm/io.h>
     6.5  #include <asm/ldt.h>
     6.6  #include <asm/x86_emulate.h>
     6.7 +#include <asm/e820.h>
     6.8  #include <public/memory.h>
     6.9  
    6.10  #ifdef VERBOSE
     7.1 --- a/xen/include/asm-x86/e820.h	Sun Aug 13 09:44:07 2006 +0100
     7.2 +++ b/xen/include/asm-x86/e820.h	Sun Aug 13 17:47:59 2006 +0100
     7.3 @@ -1,30 +1,10 @@
     7.4  #ifndef __E820_HEADER
     7.5  #define __E820_HEADER
     7.6  
     7.7 -#include <asm/page.h>
     7.8 +#include <public/hvm/e820.h>
     7.9  
    7.10  #define E820MAX	128
    7.11  
    7.12 -#define E820_RAM          1
    7.13 -#define E820_RESERVED     2
    7.14 -#define E820_ACPI         3
    7.15 -#define E820_NVS          4
    7.16 -#define E820_IO          16
    7.17 -#define E820_SHARED_PAGE 17
    7.18 -#define E820_XENSTORE    18
    7.19 -#define E820_BUFFERED_IO 19
    7.20 -
    7.21 -#define E820_MAP_PAGE        0x00090000
    7.22 -#define E820_MAP_NR_OFFSET   0x000001E8
    7.23 -#define E820_MAP_OFFSET      0x000002D0
    7.24 -
    7.25 -#ifndef __ASSEMBLY__
    7.26 -struct e820entry {
    7.27 -    u64 addr;
    7.28 -    u64 size;
    7.29 -    u32 type;
    7.30 -} __attribute__((packed));
    7.31 -
    7.32  struct e820map {
    7.33      int nr_map;
    7.34      struct e820entry map[E820MAX];
    7.35 @@ -33,13 +13,4 @@ struct e820map {
    7.36  extern unsigned long init_e820(struct e820entry *, int *);
    7.37  extern struct e820map e820;
    7.38  
    7.39 -#ifndef NDEBUG
    7.40 -extern void print_e820_memory_map(struct e820entry *map, int entries);
    7.41 -#endif
    7.42 -
    7.43 -#endif /*!__ASSEMBLY__*/
    7.44 -
    7.45 -#define PFN_DOWN(x)   ((x) >> PAGE_SHIFT)
    7.46 -#define PFN_UP(x)     (((x) + PAGE_SIZE-1) >> PAGE_SHIFT)
    7.47 -
    7.48  #endif /*__E820_HEADER*/
     8.1 --- a/xen/include/asm-x86/hvm/domain.h	Sun Aug 13 09:44:07 2006 +0100
     8.2 +++ b/xen/include/asm-x86/hvm/domain.h	Sun Aug 13 17:47:59 2006 +0100
     8.3 @@ -22,7 +22,6 @@
     8.4  #ifndef __ASM_X86_HVM_DOMAIN_H__
     8.5  #define __ASM_X86_HVM_DOMAIN_H__
     8.6  
     8.7 -#include <asm/e820.h>
     8.8  #include <asm/hvm/vpic.h>
     8.9  #include <asm/hvm/vpit.h>
    8.10  #include <asm/hvm/vlapic.h>
     9.1 --- a/xen/include/asm-x86/page.h	Sun Aug 13 09:44:07 2006 +0100
     9.2 +++ b/xen/include/asm-x86/page.h	Sun Aug 13 17:47:59 2006 +0100
     9.3 @@ -354,7 +354,10 @@ map_pages_to_xen(
     9.4  
     9.5  #endif /* !__ASSEMBLY__ */
     9.6  
     9.7 -#endif /* __I386_PAGE_H__ */
     9.8 +#define PFN_DOWN(x)   ((x) >> PAGE_SHIFT)
     9.9 +#define PFN_UP(x)     (((x) + PAGE_SIZE-1) >> PAGE_SHIFT)
    9.10 +
    9.11 +#endif /* __X86_PAGE_H__ */
    9.12  
    9.13  /*
    9.14   * Local variables:
    10.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    10.2 +++ b/xen/include/public/hvm/e820.h	Sun Aug 13 17:47:59 2006 +0100
    10.3 @@ -0,0 +1,27 @@
    10.4 +#ifndef __XEN_PUBLIC_HVM_E820_H__
    10.5 +#define __XEN_PUBLIC_HVM_E820_H__
    10.6 +
    10.7 +/* PC BIOS standard E820 types. */
    10.8 +#define E820_RAM          1
    10.9 +#define E820_RESERVED     2
   10.10 +#define E820_ACPI         3
   10.11 +#define E820_NVS          4
   10.12 +
   10.13 +/* Xen HVM extended E820 types. */
   10.14 +#define E820_IO          16
   10.15 +#define E820_SHARED_PAGE 17
   10.16 +#define E820_XENSTORE    18
   10.17 +#define E820_BUFFERED_IO 19
   10.18 +
   10.19 +/* E820 location in HVM virtual address space. */
   10.20 +#define E820_MAP_PAGE        0x00090000
   10.21 +#define E820_MAP_NR_OFFSET   0x000001E8
   10.22 +#define E820_MAP_OFFSET      0x000002D0
   10.23 +
   10.24 +struct e820entry {
   10.25 +    uint64_t addr;
   10.26 +    uint64_t size;
   10.27 +    uint32_t type;
   10.28 +} __attribute__((packed));
   10.29 +
   10.30 +#endif /* __XEN_PUBLIC_HVM_E820_H__ */