ia64/xen-unstable

changeset 16352:d0cd18d78074

[IA64] Fix breakage from upstream and remove duplicate code

- Get rid of PAGE_SIZE usage in arch-ia64.h when building tools.
- Now that more of xen_init_fv is identical to x86 code, share the
code rather than duplicate it.
- Change a few things that came over from the ia64 tree to use the
XC_* macros as already done upstream.

Signed-off-by: Alex Williamson <alex.williamson@hp.com>
author Alex Williamson <alex.williamson@hp.com>
date Wed Nov 07 15:11:44 2007 -0700 (2007-11-07)
parents a1247c2df2b4
children ee935d2b8a63
files tools/ioemu/hw/xen_machine_fv.c xen/include/public/arch-ia64.h
line diff
     1.1 --- a/tools/ioemu/hw/xen_machine_fv.c	Wed Nov 07 14:48:48 2007 -0700
     1.2 +++ b/tools/ioemu/hw/xen_machine_fv.c	Wed Nov 07 15:11:44 2007 -0700
     1.3 @@ -203,6 +203,7 @@ static void xen_init_fv(uint64_t ram_siz
     1.4          fprintf(logfile, "qemu_map_cache_init returned: error %d\n", errno);
     1.5          exit(-1);
     1.6      }
     1.7 +#endif
     1.8  
     1.9      xc_get_hvm_param(xc_handle, domid, HVM_PARAM_IOREQ_PFN, &ioreq_pfn);
    1.10      fprintf(logfile, "shared page at pfn %lx\n", ioreq_pfn);
    1.11 @@ -222,36 +223,17 @@ static void xen_init_fv(uint64_t ram_siz
    1.12          exit(-1);
    1.13      }
    1.14  
    1.15 -#elif defined(__ia64__)
    1.16 -
    1.17 -    xc_get_hvm_param(xc_handle, domid, HVM_PARAM_IOREQ_PFN, &ioreq_pfn);
    1.18 -    fprintf(logfile, "shared page at pfn %lx\n", ioreq_pfn);
    1.19 -    shared_page = xc_map_foreign_range(xc_handle, domid, PAGE_SIZE,
    1.20 -                                       PROT_READ|PROT_WRITE, ioreq_pfn);
    1.21 -    if (shared_page == NULL) {
    1.22 -        fprintf(logfile, "map shared IO page returned error %d\n", errno);
    1.23 -        exit(-1);
    1.24 -    }
    1.25 -    
    1.26 -    xc_get_hvm_param(xc_handle, domid, HVM_PARAM_BUFIOREQ_PFN, &ioreq_pfn);
    1.27 -    fprintf(logfile, "buffered io page at pfn %lx\n", ioreq_pfn);
    1.28 -    buffered_io_page = xc_map_foreign_range(xc_handle, domid, PAGE_SIZE,
    1.29 -                                            PROT_READ|PROT_WRITE, ioreq_pfn);
    1.30 -    if (buffered_io_page == NULL) {
    1.31 -        fprintf(logfile, "map buffered IO page returned error %d\n", errno);
    1.32 -        exit(-1);
    1.33 -    }
    1.34 -
    1.35 +#if defined(__ia64__)
    1.36      xc_get_hvm_param(xc_handle, domid, HVM_PARAM_BUFPIOREQ_PFN, &ioreq_pfn);
    1.37      fprintf(logfile, "buffered pio page at pfn %lx\n", ioreq_pfn);
    1.38 -    buffered_pio_page = xc_map_foreign_range(xc_handle, domid, PAGE_SIZE,
    1.39 +    buffered_pio_page = xc_map_foreign_range(xc_handle, domid, XC_PAGE_SIZE,
    1.40  					     PROT_READ|PROT_WRITE, ioreq_pfn);
    1.41      if (buffered_pio_page == NULL) {
    1.42          fprintf(logfile, "map buffered PIO page returned error %d\n", errno);
    1.43          exit(-1);
    1.44      }
    1.45  
    1.46 -    nr_pages = ram_size / PAGE_SIZE;
    1.47 +    nr_pages = ram_size / XC_PAGE_SIZE;
    1.48  
    1.49      page_array = (xen_pfn_t *)malloc(nr_pages * sizeof(xen_pfn_t));
    1.50      if (page_array == NULL) {
    1.51 @@ -267,7 +249,7 @@ static void xen_init_fv(uint64_t ram_siz
    1.52      if (ram_size > MMIO_START) {	
    1.53          for (i = 0 ; i < (MEM_G >> XC_PAGE_SHIFT); i++)
    1.54              page_array[(MMIO_START >> XC_PAGE_SHIFT) + i] =
    1.55 -                (STORE_XC_PAGE_START >> XC_PAGE_SHIFT); 
    1.56 +                (STORE_PAGE_START >> XC_PAGE_SHIFT); 
    1.57      }
    1.58  
    1.59      phys_ram_base = xc_map_foreign_batch(xc_handle, domid,
     2.1 --- a/xen/include/public/arch-ia64.h	Wed Nov 07 14:48:48 2007 -0700
     2.2 +++ b/xen/include/public/arch-ia64.h	Wed Nov 07 15:11:44 2007 -0700
     2.3 @@ -73,6 +73,12 @@ DEFINE_XEN_GUEST_HANDLE(xen_pfn_t);
     2.4  
     2.5  typedef unsigned long xen_ulong_t;
     2.6  
     2.7 +#ifdef __XEN_TOOLS__
     2.8 +#define XEN_PAGE_SIZE XC_PAGE_SIZE
     2.9 +#else
    2.10 +#define XEN_PAGE_SIZE PAGE_SIZE
    2.11 +#endif
    2.12 +
    2.13  #define INVALID_MFN       (~0UL)
    2.14  
    2.15  #define MEM_G   (1UL << 30)
    2.16 @@ -93,16 +99,16 @@ typedef unsigned long xen_ulong_t;
    2.17  #define LEGACY_IO_SIZE   (64*MEM_M)
    2.18  
    2.19  #define IO_PAGE_START (LEGACY_IO_START + LEGACY_IO_SIZE)
    2.20 -#define IO_PAGE_SIZE  PAGE_SIZE
    2.21 +#define IO_PAGE_SIZE  XEN_PAGE_SIZE
    2.22  
    2.23  #define STORE_PAGE_START (IO_PAGE_START + IO_PAGE_SIZE)
    2.24 -#define STORE_PAGE_SIZE  PAGE_SIZE
    2.25 +#define STORE_PAGE_SIZE  XEN_PAGE_SIZE
    2.26  
    2.27 -#define BUFFER_IO_PAGE_START (STORE_PAGE_START+STORE_PAGE_SIZE)
    2.28 -#define BUFFER_IO_PAGE_SIZE PAGE_SIZE
    2.29 +#define BUFFER_IO_PAGE_START (STORE_PAGE_START + STORE_PAGE_SIZE)
    2.30 +#define BUFFER_IO_PAGE_SIZE  XEN_PAGE_SIZE
    2.31  
    2.32 -#define BUFFER_PIO_PAGE_START (BUFFER_IO_PAGE_START+BUFFER_IO_PAGE_SIZE)
    2.33 -#define BUFFER_PIO_PAGE_SIZE PAGE_SIZE
    2.34 +#define BUFFER_PIO_PAGE_START (BUFFER_IO_PAGE_START + BUFFER_IO_PAGE_SIZE)
    2.35 +#define BUFFER_PIO_PAGE_SIZE  XEN_PAGE_SIZE
    2.36  
    2.37  #define IO_SAPIC_START   0xfec00000UL
    2.38  #define IO_SAPIC_SIZE    0x100000