ia64/xen-unstable

changeset 13097:e71fd4513352

[IA64] Updates to new files to be able to build sn2 and machvec support.

Signed-off-by: Jes Sorensen <jes@sgi.com>
author awilliam@xenbuild2.aw
date Wed Dec 13 15:22:25 2006 -0700 (2006-12-13)
parents ad886b6bdfd6
children d45d361c8ad0
files xen/arch/ia64/linux-xen/sn/kernel/io_init.c xen/arch/ia64/linux-xen/sn/kernel/iomv.c xen/arch/ia64/linux-xen/sn/kernel/irq.c xen/arch/ia64/linux-xen/sn/kernel/setup.c xen/arch/ia64/linux-xen/sn/kernel/sn2_smp.c xen/arch/ia64/xen/irq.c xen/include/asm-ia64/config.h xen/include/asm-ia64/linux-xen/asm/machvec_dig.h xen/include/asm-ia64/linux-xen/asm/machvec_hpzx1.h xen/include/asm-ia64/linux-xen/asm/machvec_sn2.h xen/include/asm-ia64/linux-xen/asm/page.h xen/include/asm-ia64/linux-xen/asm/pci.h xen/include/asm-ia64/linux-xen/asm/sn/addrs.h xen/include/asm-ia64/linux-xen/asm/sn/arch.h xen/include/asm-ia64/linux-xen/asm/sn/hubdev.h xen/include/asm-ia64/linux-xen/asm/sn/io.h xen/include/asm-ia64/linux-xen/asm/sn/pcibr_provider.h xen/include/asm-ia64/linux-xen/asm/sn/rw_mmr.h xen/include/asm-ia64/linux-xen/asm/system.h xen/include/asm-ia64/linux-xen/linux/device.h xen/include/asm-ia64/linux-xen/linux/kobject.h xen/include/asm-ia64/linux-xen/linux/pci.h xen/include/asm-ia64/linux/asm/pci.h
line diff
     1.1 --- a/xen/arch/ia64/linux-xen/sn/kernel/io_init.c	Wed Dec 13 12:23:53 2006 -0700
     1.2 +++ b/xen/arch/ia64/linux-xen/sn/kernel/io_init.c	Wed Dec 13 15:22:25 2006 -0700
     1.3 @@ -8,6 +8,9 @@
     1.4  
     1.5  #include <linux/bootmem.h>
     1.6  #include <linux/nodemask.h>
     1.7 +#ifdef XEN
     1.8 +#include <linux/init.h>
     1.9 +#endif
    1.10  #include <asm/sn/types.h>
    1.11  #include <asm/sn/addrs.h>
    1.12  #include <asm/sn/sn_feature_sets.h>
    1.13 @@ -17,17 +20,29 @@
    1.14  #include <asm/sn/module.h>
    1.15  #include <asm/sn/pcibr_provider.h>
    1.16  #include <asm/sn/pcibus_provider_defs.h>
    1.17 +#ifndef XEN
    1.18  #include <asm/sn/pcidev.h>
    1.19 +#endif
    1.20  #include <asm/sn/simulator.h>
    1.21  #include <asm/sn/sn_sal.h>
    1.22 +#ifndef XEN
    1.23  #include <asm/sn/tioca_provider.h>
    1.24  #include <asm/sn/tioce_provider.h>
    1.25 +#endif
    1.26 +#ifdef XEN
    1.27 +#include "asm/sn/hubdev.h"
    1.28 +#include "asm/sn/xwidgetdev.h"
    1.29 +#else
    1.30  #include "xtalk/hubdev.h"
    1.31  #include "xtalk/xwidgetdev.h"
    1.32 +#endif
    1.33  
    1.34  
    1.35  extern void sn_init_cpei_timer(void);
    1.36  extern void register_sn_procfs(void);
    1.37 +#ifdef XEN
    1.38 +extern void sn_irq_lh_init(void);
    1.39 +#endif
    1.40  
    1.41  static struct list_head sn_sysdata_list;
    1.42  
    1.43 @@ -50,6 +65,7 @@ int sn_ioif_inited;		/* SN I/O infrastru
    1.44  
    1.45  struct sn_pcibus_provider *sn_pci_provider[PCIIO_ASIC_MAX_TYPES];	/* indexed by asic type */
    1.46  
    1.47 +#ifndef XEN
    1.48  static int max_segment_number;		 /* Default highest segment number */
    1.49  static int max_pcibus_number = 255;	/* Default highest pci bus number */
    1.50  
    1.51 @@ -81,6 +97,7 @@ static struct sn_pcibus_provider sn_pci_
    1.52  	.dma_unmap = sn_default_pci_unmap,
    1.53  	.bus_fixup = sn_default_pci_bus_fixup,
    1.54  };
    1.55 +#endif
    1.56  
    1.57  /*
    1.58   * Retrieve the DMA Flush List given nasid, widget, and device.
    1.59 @@ -131,6 +148,7 @@ static inline u64 sal_get_pcibus_info(u6
    1.60  	return ret_stuff.v0;
    1.61  }
    1.62  
    1.63 +#ifndef XEN
    1.64  /*
    1.65   * Retrieve the pci device information given the bus and device|function number.
    1.66   */
    1.67 @@ -281,9 +299,13 @@ static void __init sn_fixup_ionodes(void
    1.68  						     nasid, widget, device,
    1.69  						     (u64)(dev_entry->common));
    1.70  				else
    1.71 +#ifdef XEN
    1.72 +					BUG();
    1.73 +#else
    1.74  					status = sn_device_fixup_war(nasid,
    1.75  						     widget, device,
    1.76  						     dev_entry->common);
    1.77 +#endif
    1.78  				if (status != SALRET_OK)
    1.79  					panic("SAL call failed: %s\n",
    1.80  					      ia64_sal_strerror(status));
    1.81 @@ -614,6 +636,7 @@ void sn_bus_free_sysdata(void)
    1.82  	}
    1.83  	return;
    1.84  }
    1.85 +#endif
    1.86  
    1.87  /*
    1.88   * Ugly hack to get PCI setup until we have a proper ACPI namespace.
    1.89 @@ -629,6 +652,7 @@ static int __init sn_pci_init(void)
    1.90  	if (!ia64_platform_is("sn2") || IS_RUNNING_ON_FAKE_PROM())
    1.91  		return 0;
    1.92  
    1.93 +#ifndef XEN
    1.94  	/*
    1.95  	 * prime sn_pci_provider[].  Individial provider init routines will
    1.96  	 * override their respective default entries.
    1.97 @@ -640,14 +664,18 @@ static int __init sn_pci_init(void)
    1.98  	pcibr_init_provider();
    1.99  	tioca_init_provider();
   1.100  	tioce_init_provider();
   1.101 +#endif
   1.102  
   1.103  	/*
   1.104  	 * This is needed to avoid bounce limit checks in the blk layer
   1.105  	 */
   1.106  	ia64_max_iommu_merge_mask = ~PAGE_MASK;
   1.107 +#ifndef XEN
   1.108  	sn_fixup_ionodes();
   1.109 +#endif
   1.110  	sn_irq_lh_init();
   1.111  	INIT_LIST_HEAD(&sn_sysdata_list);
   1.112 +#ifndef XEN
   1.113  	sn_init_cpei_timer();
   1.114  
   1.115  #ifdef CONFIG_PROC_FS
   1.116 @@ -668,6 +696,7 @@ static int __init sn_pci_init(void)
   1.117  	while ((pci_dev =
   1.118  		pci_get_device(PCI_ANY_ID, PCI_ANY_ID, pci_dev)) != NULL)
   1.119  		sn_pci_fixup_slot(pci_dev);
   1.120 +#endif
   1.121  
   1.122  	sn_ioif_inited = 1;	/* sn I/O infrastructure now initialized */
   1.123  
   1.124 @@ -682,7 +711,11 @@ void hubdev_init_node(nodepda_t * npda, 
   1.125  {
   1.126  	struct hubdev_info *hubdev_info;
   1.127  	int size;
   1.128 +#ifndef XEN
   1.129  	pg_data_t *pg;
   1.130 +#else
   1.131 +	struct pglist_data *pg;
   1.132 +#endif
   1.133  
   1.134  	size = sizeof(struct hubdev_info);
   1.135  
   1.136 @@ -705,6 +738,7 @@ cnodeid_get_geoid(cnodeid_t cnode)
   1.137  	return hubdev->hdi_geoid;
   1.138  }
   1.139  
   1.140 +#ifndef XEN
   1.141  void sn_generate_path(struct pci_bus *pci_bus, char *address)
   1.142  {
   1.143  	nasid_t nasid;
   1.144 @@ -730,11 +764,18 @@ void sn_generate_path(struct pci_bus *pc
   1.145  	    (bricktype == L1_BRICKTYPE_1932))
   1.146  			sprintf(address, "%s^%d", address, geo_slot(geoid));
   1.147  }
   1.148 +#endif
   1.149  
   1.150 +#ifdef XEN
   1.151 +__initcall(sn_pci_init);
   1.152 +#else
   1.153  subsys_initcall(sn_pci_init);
   1.154 +#endif
   1.155 +#ifndef XEN
   1.156  EXPORT_SYMBOL(sn_pci_fixup_slot);
   1.157  EXPORT_SYMBOL(sn_pci_unfixup_slot);
   1.158  EXPORT_SYMBOL(sn_pci_controller_fixup);
   1.159  EXPORT_SYMBOL(sn_bus_store_sysdata);
   1.160  EXPORT_SYMBOL(sn_bus_free_sysdata);
   1.161  EXPORT_SYMBOL(sn_generate_path);
   1.162 +#endif
     2.1 --- a/xen/arch/ia64/linux-xen/sn/kernel/iomv.c	Wed Dec 13 12:23:53 2006 -0700
     2.2 +++ b/xen/arch/ia64/linux-xen/sn/kernel/iomv.c	Wed Dec 13 15:22:25 2006 -0700
     2.3 @@ -9,7 +9,9 @@
     2.4  #include <linux/module.h>
     2.5  #include <asm/io.h>
     2.6  #include <asm/delay.h>
     2.7 +#ifndef XEN
     2.8  #include <asm/vga.h>
     2.9 +#endif
    2.10  #include <asm/sn/nodepda.h>
    2.11  #include <asm/sn/simulator.h>
    2.12  #include <asm/sn/pda.h>
    2.13 @@ -19,6 +21,10 @@
    2.14  #define IS_LEGACY_VGA_IOPORT(p) \
    2.15  	(((p) >= 0x3b0 && (p) <= 0x3bb) || ((p) >= 0x3c0 && (p) <= 0x3df))
    2.16  
    2.17 +#ifdef XEN
    2.18 +#define vga_console_iobase	0
    2.19 +#endif
    2.20 +
    2.21  /**
    2.22   * sn_io_addr - convert an in/out port to an i/o address
    2.23   * @port: port to convert
     3.1 --- a/xen/arch/ia64/linux-xen/sn/kernel/irq.c	Wed Dec 13 12:23:53 2006 -0700
     3.2 +++ b/xen/arch/ia64/linux-xen/sn/kernel/irq.c	Wed Dec 13 15:22:25 2006 -0700
     3.3 @@ -11,15 +11,25 @@
     3.4  #include <linux/irq.h>
     3.5  #include <linux/spinlock.h>
     3.6  #include <linux/init.h>
     3.7 +#ifdef XEN
     3.8 +#include <linux/pci.h>
     3.9 +#include <asm/hw_irq.h>
    3.10 +#endif
    3.11  #include <asm/sn/addrs.h>
    3.12  #include <asm/sn/arch.h>
    3.13  #include <asm/sn/intr.h>
    3.14  #include <asm/sn/pcibr_provider.h>
    3.15  #include <asm/sn/pcibus_provider_defs.h>
    3.16 +#ifndef XEN
    3.17  #include <asm/sn/pcidev.h>
    3.18 +#endif
    3.19  #include <asm/sn/shub_mmr.h>
    3.20  #include <asm/sn/sn_sal.h>
    3.21  
    3.22 +#ifdef XEN
    3.23 +#define move_native_irq(foo)	do {} while(0)
    3.24 +#endif
    3.25 +
    3.26  static void force_interrupt(int irq);
    3.27  static void register_intr_pda(struct sn_irq_info *sn_irq_info);
    3.28  static void unregister_intr_pda(struct sn_irq_info *sn_irq_info);
    3.29 @@ -111,6 +121,7 @@ static void sn_end_irq(unsigned int irq)
    3.30  		force_interrupt(irq);
    3.31  }
    3.32  
    3.33 +#ifndef XEN
    3.34  static void sn_irq_info_free(struct rcu_head *head);
    3.35  
    3.36  struct sn_irq_info *sn_retarget_vector(struct sn_irq_info *sn_irq_info,
    3.37 @@ -175,9 +186,15 @@ struct sn_irq_info *sn_retarget_vector(s
    3.38  		(pci_provider->target_interrupt)(new_irq_info);
    3.39  
    3.40  	spin_lock(&sn_irq_info_lock);
    3.41 +#ifdef XEN
    3.42 +	list_replace(&sn_irq_info->list, &new_irq_info->list);
    3.43 +#else
    3.44  	list_replace_rcu(&sn_irq_info->list, &new_irq_info->list);
    3.45 +#endif
    3.46  	spin_unlock(&sn_irq_info_lock);
    3.47 +#ifndef XEN
    3.48  	call_rcu(&sn_irq_info->rcu, sn_irq_info_free);
    3.49 +#endif
    3.50  
    3.51  #ifdef CONFIG_SMP
    3.52  	set_irq_affinity_info((vector & 0xff), cpuphys, 0);
    3.53 @@ -199,16 +216,21 @@ static void sn_set_affinity_irq(unsigned
    3.54  				 sn_irq_lh[irq], list)
    3.55  		(void)sn_retarget_vector(sn_irq_info, nasid, slice);
    3.56  }
    3.57 +#endif
    3.58  
    3.59  struct hw_interrupt_type irq_type_sn = {
    3.60 +#ifndef XEN
    3.61  	.name		= "SN hub",
    3.62 +#endif
    3.63  	.startup	= sn_startup_irq,
    3.64  	.shutdown	= sn_shutdown_irq,
    3.65  	.enable		= sn_enable_irq,
    3.66  	.disable	= sn_disable_irq,
    3.67  	.ack		= sn_ack_irq,
    3.68  	.end		= sn_end_irq,
    3.69 +#ifndef XEN
    3.70  	.set_affinity	= sn_set_affinity_irq
    3.71 +#endif
    3.72  };
    3.73  
    3.74  unsigned int sn_local_vector_to_irq(u8 vector)
    3.75 @@ -221,6 +243,7 @@ void sn_irq_init(void)
    3.76  	int i;
    3.77  	irq_desc_t *base_desc = irq_desc;
    3.78  
    3.79 +#ifndef XEN
    3.80  	ia64_first_device_vector = IA64_SN2_FIRST_DEVICE_VECTOR;
    3.81  	ia64_last_device_vector = IA64_SN2_LAST_DEVICE_VECTOR;
    3.82  
    3.83 @@ -229,6 +252,7 @@ void sn_irq_init(void)
    3.84  			base_desc[i].chip = &irq_type_sn;
    3.85  		}
    3.86  	}
    3.87 +#endif
    3.88  }
    3.89  
    3.90  static void register_intr_pda(struct sn_irq_info *sn_irq_info)
    3.91 @@ -251,14 +275,24 @@ static void unregister_intr_pda(struct s
    3.92  	struct sn_irq_info *tmp_irq_info;
    3.93  	int i, foundmatch;
    3.94  
    3.95 +#ifndef XEN
    3.96  	rcu_read_lock();
    3.97 +#else
    3.98 +	spin_lock(&sn_irq_info_lock);
    3.99 +#endif
   3.100  	if (pdacpu(cpu)->sn_last_irq == irq) {
   3.101  		foundmatch = 0;
   3.102  		for (i = pdacpu(cpu)->sn_last_irq - 1;
   3.103  		     i && !foundmatch; i--) {
   3.104 +#ifdef XEN
   3.105 +			list_for_each_entry(tmp_irq_info,
   3.106 +						sn_irq_lh[i],
   3.107 +						list) {
   3.108 +#else
   3.109  			list_for_each_entry_rcu(tmp_irq_info,
   3.110  						sn_irq_lh[i],
   3.111  						list) {
   3.112 +#endif
   3.113  				if (tmp_irq_info->irq_cpuid == cpu) {
   3.114  					foundmatch = 1;
   3.115  					break;
   3.116 @@ -272,9 +306,15 @@ static void unregister_intr_pda(struct s
   3.117  		foundmatch = 0;
   3.118  		for (i = pdacpu(cpu)->sn_first_irq + 1;
   3.119  		     i < NR_IRQS && !foundmatch; i++) {
   3.120 +#ifdef XEN
   3.121 +			list_for_each_entry(tmp_irq_info,
   3.122 +						sn_irq_lh[i],
   3.123 +						list) {
   3.124 +#else
   3.125  			list_for_each_entry_rcu(tmp_irq_info,
   3.126  						sn_irq_lh[i],
   3.127  						list) {
   3.128 +#endif
   3.129  				if (tmp_irq_info->irq_cpuid == cpu) {
   3.130  					foundmatch = 1;
   3.131  					break;
   3.132 @@ -283,9 +323,14 @@ static void unregister_intr_pda(struct s
   3.133  		}
   3.134  		pdacpu(cpu)->sn_first_irq = ((i == NR_IRQS) ? 0 : i);
   3.135  	}
   3.136 +#ifndef XEN
   3.137  	rcu_read_unlock();
   3.138 +#else
   3.139 +	spin_unlock(&sn_irq_info_lock);
   3.140 +#endif
   3.141  }
   3.142  
   3.143 +#ifndef XEN
   3.144  static void sn_irq_info_free(struct rcu_head *head)
   3.145  {
   3.146  	struct sn_irq_info *sn_irq_info;
   3.147 @@ -293,7 +338,9 @@ static void sn_irq_info_free(struct rcu_
   3.148  	sn_irq_info = container_of(head, struct sn_irq_info, rcu);
   3.149  	kfree(sn_irq_info);
   3.150  }
   3.151 +#endif
   3.152  
   3.153 +#ifndef XEN
   3.154  void sn_irq_fixup(struct pci_dev *pci_dev, struct sn_irq_info *sn_irq_info)
   3.155  {
   3.156  	nasid_t nasid = sn_irq_info->irq_nasid;
   3.157 @@ -306,8 +353,14 @@ void sn_irq_fixup(struct pci_dev *pci_de
   3.158  
   3.159  	/* link it into the sn_irq[irq] list */
   3.160  	spin_lock(&sn_irq_info_lock);
   3.161 +#ifdef XEN
   3.162 +	list_add(&sn_irq_info->list, sn_irq_lh[sn_irq_info->irq_irq]);
   3.163 +#else
   3.164  	list_add_rcu(&sn_irq_info->list, sn_irq_lh[sn_irq_info->irq_irq]);
   3.165 +#endif
   3.166 +#ifndef XEN
   3.167  	reserve_irq_vector(sn_irq_info->irq_irq);
   3.168 +#endif
   3.169  	spin_unlock(&sn_irq_info_lock);
   3.170  
   3.171  	register_intr_pda(sn_irq_info);
   3.172 @@ -331,14 +384,21 @@ void sn_irq_unfixup(struct pci_dev *pci_
   3.173  
   3.174  	unregister_intr_pda(sn_irq_info);
   3.175  	spin_lock(&sn_irq_info_lock);
   3.176 +#ifdef XEN
   3.177 +	list_del(&sn_irq_info->list);
   3.178 +#else
   3.179  	list_del_rcu(&sn_irq_info->list);
   3.180 +#endif
   3.181  	spin_unlock(&sn_irq_info_lock);
   3.182  	if (list_empty(sn_irq_lh[sn_irq_info->irq_irq]))
   3.183  		free_irq_vector(sn_irq_info->irq_irq);
   3.184 +#ifndef XEN
   3.185  	call_rcu(&sn_irq_info->rcu, sn_irq_info_free);
   3.186 +#endif
   3.187  	pci_dev_put(pci_dev);
   3.188  
   3.189  }
   3.190 +#endif
   3.191  
   3.192  static inline void
   3.193  sn_call_force_intr_provider(struct sn_irq_info *sn_irq_info)
   3.194 @@ -354,16 +414,31 @@ static void force_interrupt(int irq)
   3.195  {
   3.196  	struct sn_irq_info *sn_irq_info;
   3.197  
   3.198 +#ifndef XEN
   3.199  	if (!sn_ioif_inited)
   3.200  		return;
   3.201 +#endif
   3.202  
   3.203 +#ifdef XEN
   3.204 +	spin_lock(&sn_irq_info_lock);
   3.205 +#else
   3.206  	rcu_read_lock();
   3.207 +#endif
   3.208 +#ifdef XEN
   3.209 +	list_for_each_entry(sn_irq_info, sn_irq_lh[irq], list)
   3.210 +#else
   3.211  	list_for_each_entry_rcu(sn_irq_info, sn_irq_lh[irq], list)
   3.212 +#endif
   3.213  		sn_call_force_intr_provider(sn_irq_info);
   3.214  
   3.215 +#ifdef XEN
   3.216 +	spin_unlock(&sn_irq_info_lock);
   3.217 +#else
   3.218  	rcu_read_unlock();
   3.219 +#endif
   3.220  }
   3.221  
   3.222 +#ifndef XEN
   3.223  /*
   3.224   * Check for lost interrupts.  If the PIC int_status reg. says that
   3.225   * an interrupt has been sent, but not handled, and the interrupt
   3.226 @@ -408,22 +483,41 @@ static void sn_check_intr(int irq, struc
   3.227  	}
   3.228  	sn_irq_info->irq_last_intr = regval;
   3.229  }
   3.230 +#endif
   3.231  
   3.232  void sn_lb_int_war_check(void)
   3.233  {
   3.234  	struct sn_irq_info *sn_irq_info;
   3.235  	int i;
   3.236  
   3.237 +#ifndef XEN
   3.238 +#ifdef XEN
   3.239 +	if (pda->sn_first_irq == 0)
   3.240 +#else
   3.241  	if (!sn_ioif_inited || pda->sn_first_irq == 0)
   3.242 +#endif
   3.243  		return;
   3.244  
   3.245 +#ifdef XEN
   3.246 +	spin_lock(&sn_irq_info_lock);
   3.247 +#else
   3.248  	rcu_read_lock();
   3.249 +#endif
   3.250  	for (i = pda->sn_first_irq; i <= pda->sn_last_irq; i++) {
   3.251 +#ifdef XEN
   3.252 +		list_for_each_entry(sn_irq_info, sn_irq_lh[i], list) {
   3.253 +#else
   3.254  		list_for_each_entry_rcu(sn_irq_info, sn_irq_lh[i], list) {
   3.255 +#endif
   3.256  			sn_check_intr(i, sn_irq_info);
   3.257  		}
   3.258  	}
   3.259 +#ifdef XEN
   3.260 +	spin_unlock(&sn_irq_info_lock);
   3.261 +#else
   3.262  	rcu_read_unlock();
   3.263 +#endif
   3.264 +#endif
   3.265  }
   3.266  
   3.267  void __init sn_irq_lh_init(void)
     4.1 --- a/xen/arch/ia64/linux-xen/sn/kernel/setup.c	Wed Dec 13 12:23:53 2006 -0700
     4.2 +++ b/xen/arch/ia64/linux-xen/sn/kernel/setup.c	Wed Dec 13 15:22:25 2006 -0700
     4.3 @@ -10,9 +10,13 @@
     4.4  #include <linux/init.h>
     4.5  #include <linux/delay.h>
     4.6  #include <linux/kernel.h>
     4.7 +#ifndef XEN
     4.8  #include <linux/kdev_t.h>
     4.9 +#endif
    4.10  #include <linux/string.h>
    4.11 +#ifndef XEN
    4.12  #include <linux/screen_info.h>
    4.13 +#endif
    4.14  #include <linux/console.h>
    4.15  #include <linux/timex.h>
    4.16  #include <linux/sched.h>
    4.17 @@ -26,7 +30,9 @@
    4.18  #include <linux/acpi.h>
    4.19  #include <linux/compiler.h>
    4.20  #include <linux/sched.h>
    4.21 +#ifndef XEN
    4.22  #include <linux/root_dev.h>
    4.23 +#endif
    4.24  #include <linux/nodemask.h>
    4.25  #include <linux/pm.h>
    4.26  #include <linux/efi.h>
    4.27 @@ -36,7 +42,9 @@
    4.28  #include <asm/machvec.h>
    4.29  #include <asm/system.h>
    4.30  #include <asm/processor.h>
    4.31 +#ifndef XEN
    4.32  #include <asm/vga.h>
    4.33 +#endif
    4.34  #include <asm/sn/arch.h>
    4.35  #include <asm/sn/addrs.h>
    4.36  #include <asm/sn/pda.h>
    4.37 @@ -44,15 +52,32 @@
    4.38  #include <asm/sn/sn_cpuid.h>
    4.39  #include <asm/sn/simulator.h>
    4.40  #include <asm/sn/leds.h>
    4.41 +#ifndef XEN
    4.42  #include <asm/sn/bte.h>
    4.43 +#endif
    4.44  #include <asm/sn/shub_mmr.h>
    4.45 +#ifndef XEN
    4.46  #include <asm/sn/clksupport.h>
    4.47 +#endif
    4.48  #include <asm/sn/sn_sal.h>
    4.49  #include <asm/sn/geo.h>
    4.50  #include <asm/sn/sn_feature_sets.h>
    4.51 +#ifndef XEN
    4.52  #include "xtalk/xwidgetdev.h"
    4.53  #include "xtalk/hubdev.h"
    4.54 +#else
    4.55 +#include "asm/sn/xwidgetdev.h"
    4.56 +#include "asm/sn/hubdev.h"
    4.57 +#endif
    4.58  #include <asm/sn/klconfig.h>
    4.59 +#ifdef XEN
    4.60 +#include <asm/sn/shubio.h>
    4.61 +
    4.62 +/* Xen has no clue about NUMA ....  grrrr */
    4.63 +#define pxm_to_node(foo)		0
    4.64 +#define node_to_pxm(foo)		0
    4.65 +#define numa_node_id()			0
    4.66 +#endif
    4.67  
    4.68  
    4.69  DEFINE_PER_CPU(struct pda_s, pda_percpu);
    4.70 @@ -107,6 +132,7 @@ static void build_cnode_tables(void);
    4.71  
    4.72  static nodepda_t *nodepdaindr[MAX_COMPACT_NODES];
    4.73  
    4.74 +#ifndef XEN
    4.75  /*
    4.76   * The format of "screen_info" is strange, and due to early i386-setup
    4.77   * code. This is just enough to make the console code think we're on a
    4.78 @@ -122,6 +148,7 @@ struct screen_info sn_screen_info = {
    4.79  	.orig_video_isVGA = 1,
    4.80  	.orig_video_points = 16
    4.81  };
    4.82 +#endif
    4.83  
    4.84  /*
    4.85   * This routine can only be used during init, since
    4.86 @@ -228,6 +255,7 @@ static void __init sn_check_for_wars(voi
    4.87  	}
    4.88  }
    4.89  
    4.90 +#ifndef XEN
    4.91  /*
    4.92   * Scan the EFI PCDP table (if it exists) for an acceptable VGA console
    4.93   * output device.  If one exists, pick it and set sn_legacy_{io,mem} to
    4.94 @@ -369,6 +397,7 @@ static unsigned long long ia64_sn2_print
    4.95  	return (rtc_now - sn2_rtc_initial) *
    4.96  		(1000000000 / sn_rtc_cycles_per_second);
    4.97  }
    4.98 +#endif
    4.99  
   4.100  /**
   4.101   * sn_setup - SN platform setup routine
   4.102 @@ -378,10 +407,15 @@ static unsigned long long ia64_sn2_print
   4.103   * the RTC frequency (via a SAL call), initializing secondary CPUs, and
   4.104   * setting up per-node data areas.  The console is also initialized here.
   4.105   */
   4.106 +#ifdef XEN
   4.107 +void __cpuinit sn_cpu_init(void);
   4.108 +#endif
   4.109 +
   4.110  void __init sn_setup(char **cmdline_p)
   4.111  {
   4.112  	long status, ticks_per_sec, drift;
   4.113  	u32 version = sn_sal_rev();
   4.114 +#ifndef XEN
   4.115  	extern void sn_cpu_init(void);
   4.116  
   4.117  	sn2_rtc_initial = rtc_time();
   4.118 @@ -430,6 +464,7 @@ void __init sn_setup(char **cmdline_p)
   4.119  #endif				/* def(CONFIG_VT) && def(CONFIG_VGA_CONSOLE) */
   4.120  
   4.121  	MAX_DMA_ADDRESS = PAGE_OFFSET + MAX_PHYS_MEMORY;
   4.122 +#endif
   4.123  
   4.124  	/*
   4.125  	 * Build the tables for managing cnodes.
   4.126 @@ -446,10 +481,12 @@ void __init sn_setup(char **cmdline_p)
   4.127  		sn_rtc_cycles_per_second = 1000000000000UL / 30000UL;
   4.128  	} else
   4.129  		sn_rtc_cycles_per_second = ticks_per_sec;
   4.130 +#ifndef XEN
   4.131  
   4.132  	platform_intr_list[ACPI_INTERRUPT_CPEI] = IA64_CPE_VECTOR;
   4.133  
   4.134  	ia64_printk_clock = ia64_sn2_printk_clock;
   4.135 +#endif
   4.136  
   4.137  	printk("SGI SAL version %x.%02x\n", version >> 8, version & 0x00FF);
   4.138  
   4.139 @@ -457,14 +494,18 @@ void __init sn_setup(char **cmdline_p)
   4.140  	 * we set the default root device to /dev/hda
   4.141  	 * to make simulation easy
   4.142  	 */
   4.143 +#ifndef XEN
   4.144  	ROOT_DEV = Root_HDA1;
   4.145 +#endif
   4.146  
   4.147  	/*
   4.148  	 * Create the PDAs and NODEPDAs for all the cpus.
   4.149  	 */
   4.150  	sn_init_pdas(cmdline_p);
   4.151  
   4.152 +#ifndef XEN
   4.153  	ia64_mark_idle = &snidle;
   4.154 +#endif
   4.155  
   4.156  	/*
   4.157  	 * For the bootcpu, we do this here. All other cpus will make the
   4.158 @@ -472,6 +513,7 @@ void __init sn_setup(char **cmdline_p)
   4.159  	 */
   4.160  	sn_cpu_init();
   4.161  
   4.162 +#ifndef XEN
   4.163  #ifdef CONFIG_SMP
   4.164  	init_smp_config();
   4.165  #endif
   4.166 @@ -487,6 +529,7 @@ void __init sn_setup(char **cmdline_p)
   4.167  	 */
   4.168  	pm_power_off = ia64_sn_power_down;
   4.169  	current->thread.flags |= IA64_THREAD_MIGRATION;
   4.170 +#endif
   4.171  }
   4.172  
   4.173  /**
   4.174 @@ -526,6 +569,7 @@ static void __init sn_init_pdas(char **c
   4.175  		memcpy(nodepdaindr[cnode]->pernode_pdaindr, nodepdaindr,
   4.176  		       sizeof(nodepdaindr));
   4.177  
   4.178 +#ifndef XEN
   4.179  	/*
   4.180  	 * Set up IO related platform-dependent nodepda fields.
   4.181  	 * The following routine actually sets up the hubinfo struct
   4.182 @@ -542,6 +586,7 @@ static void __init sn_init_pdas(char **c
   4.183  	for (cnode = 0; cnode < num_cnodes; cnode++) {
   4.184  		hubdev_init_node(nodepdaindr[cnode], cnode);
   4.185  	}
   4.186 +#endif
   4.187  }
   4.188  
   4.189  /**
   4.190 @@ -565,6 +610,7 @@ void __cpuinit sn_cpu_init(void)
   4.191  	static int wars_have_been_checked;
   4.192  
   4.193  	cpuid = smp_processor_id();
   4.194 +#ifndef XEN
   4.195  	if (cpuid == 0 && IS_MEDUSA()) {
   4.196  		if (ia64_sn_is_fake_prom())
   4.197  			sn_prom_type = 2;
   4.198 @@ -573,6 +619,7 @@ void __cpuinit sn_cpu_init(void)
   4.199  		printk(KERN_INFO "Running on medusa with %s PROM\n",
   4.200  		       (sn_prom_type == 1) ? "real" : "fake");
   4.201  	}
   4.202 +#endif
   4.203  
   4.204  	memset(pda, 0, sizeof(pda));
   4.205  	if (ia64_sn_get_sn_info(0, &sn_hub_info->shub2,
   4.206 @@ -660,6 +707,7 @@ void __cpuinit sn_cpu_init(void)
   4.207  		pda->pio_write_status_val = is_shub1() ? SH_PIO_WRITE_STATUS_PENDING_WRITE_COUNT_MASK : 0;
   4.208  	}
   4.209  
   4.210 +#ifndef XEN  /* local_node_data is not allocated .... yet */
   4.211  	/*
   4.212  	 * WAR addresses for SHUB 1.x.
   4.213  	 */
   4.214 @@ -672,6 +720,7 @@ void __cpuinit sn_cpu_init(void)
   4.215  		    (volatile unsigned long *)GLOBAL_MMR_ADDR(nasid,
   4.216  							      SH1_PI_CAM_CONTROL);
   4.217  	}
   4.218 +#endif
   4.219  }
   4.220  
   4.221  /*
     5.1 --- a/xen/arch/ia64/linux-xen/sn/kernel/sn2_smp.c	Wed Dec 13 12:23:53 2006 -0700
     5.2 +++ b/xen/arch/ia64/linux-xen/sn/kernel/sn2_smp.c	Wed Dec 13 15:22:25 2006 -0700
     5.3 @@ -34,6 +34,9 @@
     5.4  #include <asm/numa.h>
     5.5  #include <asm/hw_irq.h>
     5.6  #include <asm/current.h>
     5.7 +#ifdef XEN
     5.8 +#include <asm/sn/arch.h>
     5.9 +#endif
    5.10  #include <asm/sn/sn_cpuid.h>
    5.11  #include <asm/sn/sn_sal.h>
    5.12  #include <asm/sn/addrs.h>
    5.13 @@ -63,7 +66,11 @@ sn2_ptc_deadlock_recovery(short *, short
    5.14  #define local_node_uses_ptc_ga(sh1)	((sh1) ? 1 : 0)
    5.15  #define max_active_pio(sh1)		((sh1) ? 32 : 7)
    5.16  #define reset_max_active_on_deadlock()	1
    5.17 +#ifndef XEN
    5.18  #define PTC_LOCK(sh1)			((sh1) ? &sn2_global_ptc_lock : &sn_nodepda->ptc_lock)
    5.19 +#else
    5.20 +#define PTC_LOCK(sh1)			&sn2_global_ptc_lock
    5.21 +#endif
    5.22  
    5.23  struct ptc_stats {
    5.24  	unsigned long ptc_l;
    5.25 @@ -93,6 +100,7 @@ static inline unsigned long wait_piowc(v
    5.26  	return (ws & SH_PIO_WRITE_STATUS_WRITE_DEADLOCK_MASK) != 0;
    5.27  }
    5.28  
    5.29 +#ifndef XEN  /* No idea if Xen will ever support this */
    5.30  /**
    5.31   * sn_migrate - SN-specific task migration actions
    5.32   * @task: Task being migrated to new CPU
    5.33 @@ -117,9 +125,14 @@ void sn_migrate(struct task_struct *task
    5.34  void sn_tlb_migrate_finish(struct mm_struct *mm)
    5.35  {
    5.36  	/* flush_tlb_mm is inefficient if more than 1 users of mm */
    5.37 +#ifndef XEN
    5.38  	if (mm == current->mm && mm && atomic_read(&mm->mm_users) == 1)
    5.39 +#else
    5.40 +	if (mm == &current->arch.mm && mm && atomic_read(&mm->mm_users) == 1)
    5.41 +#endif
    5.42  		flush_tlb_mm(mm);
    5.43  }
    5.44 +#endif
    5.45  
    5.46  /**
    5.47   * sn2_global_tlb_purge - globally purge translation cache of virtual address range
    5.48 @@ -143,12 +156,25 @@ void sn_tlb_migrate_finish(struct mm_str
    5.49   *	  done with ptc.g/MMRs under protection of the global ptc_lock.
    5.50   */
    5.51  
    5.52 +#ifdef XEN  /* Xen is soooooooo stupid! */
    5.53 +static cpumask_t mask_all = CPU_MASK_ALL;
    5.54 +#endif
    5.55 +
    5.56  void
    5.57 +#ifndef XEN
    5.58  sn2_global_tlb_purge(struct mm_struct *mm, unsigned long start,
    5.59 +#else
    5.60 +sn2_global_tlb_purge(unsigned long start,
    5.61 +#endif
    5.62  		     unsigned long end, unsigned long nbits)
    5.63  {
    5.64  	int i, ibegin, shub1, cnode, mynasid, cpu, lcpu = 0, nasid;
    5.65 +#ifndef XEN
    5.66  	int mymm = (mm == current->active_mm && mm == current->mm);
    5.67 +#else
    5.68 +	struct mm_struct *mm;
    5.69 +	int mymm = 1;
    5.70 +#endif
    5.71  	int use_cpu_ptcga;
    5.72  	volatile unsigned long *ptc0, *ptc1;
    5.73  	unsigned long itc, itc2, flags, data0 = 0, data1 = 0, rr_value, old_rr = 0;
    5.74 @@ -159,12 +185,21 @@ sn2_global_tlb_purge(struct mm_struct *m
    5.75  	nodes_clear(nodes_flushed);
    5.76  	i = 0;
    5.77  
    5.78 +#ifndef XEN  /* One day Xen will grow up! */
    5.79  	for_each_cpu_mask(cpu, mm->cpu_vm_mask) {
    5.80  		cnode = cpu_to_node(cpu);
    5.81  		node_set(cnode, nodes_flushed);
    5.82  		lcpu = cpu;
    5.83  		i++;
    5.84  	}
    5.85 +#else
    5.86 +	for_each_cpu(cpu) {
    5.87 +		cnode = cpu_to_node(cpu);
    5.88 +		node_set(cnode, nodes_flushed);
    5.89 +		lcpu = cpu;
    5.90 +		i++;
    5.91 +	}
    5.92 +#endif
    5.93  
    5.94  	if (i == 0)
    5.95  		return;
    5.96 @@ -182,19 +217,29 @@ sn2_global_tlb_purge(struct mm_struct *m
    5.97  		return;
    5.98  	}
    5.99  
   5.100 +#ifndef XEN
   5.101  	if (atomic_read(&mm->mm_users) == 1 && mymm) {
   5.102 +#ifndef XEN  /* I hate Xen! */
   5.103  		flush_tlb_mm(mm);
   5.104 +#else
   5.105 +		flush_tlb_mask(mask_all);
   5.106 +#endif
   5.107  		__get_cpu_var(ptcstats).change_rid++;
   5.108  		preempt_enable();
   5.109  		return;
   5.110  	}
   5.111 +#endif
   5.112  
   5.113  	itc = ia64_get_itc();
   5.114  	nix = 0;
   5.115  	for_each_node_mask(cnode, nodes_flushed)
   5.116  		nasids[nix++] = cnodeid_to_nasid(cnode);
   5.117  
   5.118 +#ifndef XEN
   5.119  	rr_value = (mm->context << 3) | REGION_NUMBER(start);
   5.120 +#else
   5.121 +	rr_value = REGION_NUMBER(start);
   5.122 +#endif
   5.123  
   5.124  	shub1 = is_shub1();
   5.125  	if (shub1) {
   5.126 @@ -202,13 +247,22 @@ sn2_global_tlb_purge(struct mm_struct *m
   5.127  		    	(nbits << SH1_PTC_0_PS_SHFT) |
   5.128  			(rr_value << SH1_PTC_0_RID_SHFT) |
   5.129  		    	(1UL << SH1_PTC_0_START_SHFT);
   5.130 +#ifndef XEN
   5.131  		ptc0 = (long *)GLOBAL_MMR_PHYS_ADDR(0, SH1_PTC_0);
   5.132  		ptc1 = (long *)GLOBAL_MMR_PHYS_ADDR(0, SH1_PTC_1);
   5.133 +#else
   5.134 +		ptc0 = (unsigned long *)GLOBAL_MMR_PHYS_ADDR(0, SH1_PTC_0);
   5.135 +		ptc1 = (unsigned long *)GLOBAL_MMR_PHYS_ADDR(0, SH1_PTC_1);
   5.136 +#endif
   5.137  	} else {
   5.138  		data0 = (1UL << SH2_PTC_A_SHFT) |
   5.139  			(nbits << SH2_PTC_PS_SHFT) |
   5.140  		    	(1UL << SH2_PTC_START_SHFT);
   5.141 +#ifndef XEN
   5.142  		ptc0 = (long *)GLOBAL_MMR_PHYS_ADDR(0, SH2_PTC + 
   5.143 +#else
   5.144 +		ptc0 = (unsigned long *)GLOBAL_MMR_PHYS_ADDR(0, SH2_PTC + 
   5.145 +#endif
   5.146  			(rr_value << SH2_PTC_RID_SHFT));
   5.147  		ptc1 = NULL;
   5.148  	}
   5.149 @@ -390,7 +444,7 @@ void sn2_send_IPI(int cpuid, int vector,
   5.150  	if (unlikely(nasid == -1))
   5.151  		ia64_sn_get_sapic_info(physid, &nasid, NULL, NULL);
   5.152  
   5.153 -	sn_send_IPI_phys(nasid, physid, vector, delivery_mode);
   5.154 + 	sn_send_IPI_phys(nasid, physid, vector, delivery_mode);
   5.155  }
   5.156  
   5.157  #ifdef CONFIG_PROC_FS
     6.1 --- a/xen/arch/ia64/xen/irq.c	Wed Dec 13 12:23:53 2006 -0700
     6.2 +++ b/xen/arch/ia64/xen/irq.c	Wed Dec 13 15:22:25 2006 -0700
     6.3 @@ -48,6 +48,13 @@
     6.4  #include <xen/event.h>
     6.5  #define apicid_to_phys_cpu_present(x)	1
     6.6  
     6.7 +#ifdef CONFIG_IA64_GENERIC
     6.8 +unsigned int __ia64_local_vector_to_irq (ia64_vector vec)
     6.9 +{
    6.10 +	return (unsigned int) vec;
    6.11 +}
    6.12 +#endif
    6.13 +
    6.14  /*
    6.15   * Linux has a controller-independent x86 interrupt architecture.
    6.16   * every controller has a 'controller-template', that is used
     7.1 --- a/xen/include/asm-ia64/config.h	Wed Dec 13 12:23:53 2006 -0700
     7.2 +++ b/xen/include/asm-ia64/config.h	Wed Dec 13 15:22:25 2006 -0700
     7.3 @@ -8,8 +8,9 @@
     7.4  // manufactured from component pieces
     7.5  
     7.6  // defined in linux/arch/ia64/defconfig
     7.7 -//#define	CONFIG_IA64_GENERIC
     7.8 -#define	CONFIG_IA64_HP_SIM
     7.9 +#define	CONFIG_IA64_GENERIC
    7.10 +#define CONFIG_HZ	32
    7.11 +
    7.12  #define	CONFIG_IA64_L1_CACHE_SHIFT 7
    7.13  // needed by include/asm-ia64/page.h
    7.14  #define	CONFIG_IA64_PAGE_SIZE_16KB	// 4KB doesn't work?!?
    7.15 @@ -145,14 +146,6 @@ extern int smp_num_siblings;
    7.16  // avoid redefining task_struct in asm/current.h
    7.17  #define task_struct vcpu
    7.18  
    7.19 -// linux/include/asm-ia64/machvec.h (linux/arch/ia64/lib/io.c)
    7.20 -#define platform_inb	__ia64_inb
    7.21 -#define platform_inw	__ia64_inw
    7.22 -#define platform_inl	__ia64_inl
    7.23 -#define platform_outb	__ia64_outb
    7.24 -#define platform_outw	__ia64_outw
    7.25 -#define platform_outl	__ia64_outl
    7.26 -
    7.27  #include <xen/cache.h>
    7.28  #ifndef CONFIG_SMP
    7.29  #define __cacheline_aligned_in_smp
    7.30 @@ -206,6 +199,16 @@ void sort_main_extable(void);
    7.31  // Deprivated linux inf and put here for short time compatibility
    7.32  #define kmalloc(s, t) xmalloc_bytes((s))
    7.33  #define kfree(s) xfree((s))
    7.34 +#define kzalloc(size, flags) 				\
    7.35 +({							\
    7.36 +	unsigned char *mem;				\
    7.37 +	mem = (unsigned char *)xmalloc_bytes(size);	\
    7.38 +	if (mem)					\
    7.39 +		memset(mem, 0, size);			\
    7.40 +	(void *)mem;					\
    7.41 +})
    7.42 +#define kcalloc(n, size, flags)		kzalloc(n * size, flags)
    7.43 +#define alloc_bootmem_node(pg, size)	xmalloc_bytes(size)
    7.44  
    7.45  // see common/keyhandler.c
    7.46  #define	nop()	asm volatile ("nop 0")
     8.1 --- a/xen/include/asm-ia64/linux-xen/asm/machvec_dig.h	Wed Dec 13 12:23:53 2006 -0700
     8.2 +++ b/xen/include/asm-ia64/linux-xen/asm/machvec_dig.h	Wed Dec 13 15:22:25 2006 -0700
     8.3 @@ -11,6 +11,32 @@ extern ia64_mv_setup_t dig_setup;
     8.4   * the macros are used directly.
     8.5   */
     8.6  #define platform_name		"dig"
     8.7 +#ifdef XEN
     8.8 +/*
     8.9 + * All the World is a PC .... yay! yay! yay!
    8.10 + */
    8.11 +extern ia64_mv_setup_t hpsim_setup;
    8.12 +#define platform_setup				hpsim_setup
    8.13 +
    8.14 +#define platform_dma_init			machvec_noop
    8.15 +#define platform_dma_alloc_coherent		machvec_noop
    8.16 +#define platform_dma_free_coherent		machvec_noop
    8.17 +#define platform_dma_map_single			machvec_noop
    8.18 +#define platform_dma_unmap_single		machvec_noop
    8.19 +#define platform_dma_map_sg			machvec_noop
    8.20 +#define platform_dma_unmap_sg			machvec_noop
    8.21 +#define platform_dma_sync_single_for_cpu	machvec_noop
    8.22 +#define platform_dma_sync_sg_for_cpu		machvec_noop
    8.23 +#define platform_dma_sync_single_for_device	machvec_noop
    8.24 +#define platform_dma_sync_sg_for_device		machvec_noop
    8.25 +#define platform_dma_mapping_error		machvec_noop
    8.26 +#define platform_dma_supported			machvec_noop
    8.27 +
    8.28 +#define platform_pci_get_legacy_mem		machvec_noop
    8.29 +#define platform_pci_legacy_read		machvec_noop
    8.30 +#define platform_pci_legacy_write		machvec_noop
    8.31 +#else
    8.32  #define platform_setup		dig_setup
    8.33 +#endif
    8.34  
    8.35  #endif /* _ASM_IA64_MACHVEC_DIG_h */
     9.1 --- a/xen/include/asm-ia64/linux-xen/asm/machvec_hpzx1.h	Wed Dec 13 12:23:53 2006 -0700
     9.2 +++ b/xen/include/asm-ia64/linux-xen/asm/machvec_hpzx1.h	Wed Dec 13 15:22:25 2006 -0700
     9.3 @@ -19,6 +19,30 @@ extern ia64_mv_dma_mapping_error	sba_dma
     9.4   * the macros are used directly.
     9.5   */
     9.6  #define platform_name				"hpzx1"
     9.7 +#ifdef XEN
     9.8 +extern ia64_mv_setup_t hpsim_setup;
     9.9 +extern ia64_mv_irq_init_t hpsim_irq_init;
    9.10 +#define platform_setup				hpsim_setup
    9.11 +#define platform_irq_init			hpsim_irq_init
    9.12 +
    9.13 +#define platform_dma_init			machvec_noop
    9.14 +#define platform_dma_alloc_coherent		machvec_noop
    9.15 +#define platform_dma_free_coherent		machvec_noop
    9.16 +#define platform_dma_map_single			machvec_noop
    9.17 +#define platform_dma_unmap_single		machvec_noop
    9.18 +#define platform_dma_map_sg			machvec_noop
    9.19 +#define platform_dma_unmap_sg			machvec_noop
    9.20 +#define platform_dma_sync_single_for_cpu	machvec_noop
    9.21 +#define platform_dma_sync_sg_for_cpu		machvec_noop
    9.22 +#define platform_dma_sync_single_for_device	machvec_noop
    9.23 +#define platform_dma_sync_sg_for_device		machvec_noop
    9.24 +#define platform_dma_mapping_error		machvec_noop
    9.25 +#define platform_dma_supported			machvec_noop
    9.26 +
    9.27 +#define platform_pci_get_legacy_mem		machvec_noop
    9.28 +#define platform_pci_legacy_read		machvec_noop
    9.29 +#define platform_pci_legacy_write		machvec_noop
    9.30 +#else
    9.31  #define platform_setup				dig_setup
    9.32  #define platform_dma_init			machvec_noop
    9.33  #define platform_dma_alloc_coherent		sba_alloc_coherent
    9.34 @@ -33,5 +57,6 @@ extern ia64_mv_dma_mapping_error	sba_dma
    9.35  #define platform_dma_sync_sg_for_device		machvec_dma_sync_sg
    9.36  #define platform_dma_supported			sba_dma_supported
    9.37  #define platform_dma_mapping_error		sba_dma_mapping_error
    9.38 +#endif
    9.39  
    9.40  #endif /* _ASM_IA64_MACHVEC_HPZX1_h */
    10.1 --- a/xen/include/asm-ia64/linux-xen/asm/machvec_sn2.h	Wed Dec 13 12:23:53 2006 -0700
    10.2 +++ b/xen/include/asm-ia64/linux-xen/asm/machvec_sn2.h	Wed Dec 13 15:22:25 2006 -0700
    10.3 @@ -66,9 +66,11 @@ extern ia64_mv_dma_sync_single_for_devic
    10.4  extern ia64_mv_dma_sync_sg_for_device	sn_dma_sync_sg_for_device;
    10.5  extern ia64_mv_dma_mapping_error	sn_dma_mapping_error;
    10.6  extern ia64_mv_dma_supported		sn_dma_supported;
    10.7 +#ifndef XEN
    10.8  extern ia64_mv_migrate_t		sn_migrate;
    10.9  extern ia64_mv_setup_msi_irq_t		sn_setup_msi_irq;
   10.10  extern ia64_mv_teardown_msi_irq_t	sn_teardown_msi_irq;
   10.11 +#endif
   10.12  
   10.13  
   10.14  /*
   10.15 @@ -83,9 +85,13 @@ extern ia64_mv_teardown_msi_irq_t	sn_tea
   10.16  #define platform_cpu_init		sn_cpu_init
   10.17  #define platform_irq_init		sn_irq_init
   10.18  #define platform_send_ipi		sn2_send_IPI
   10.19 +#ifndef XEN
   10.20  #define platform_timer_interrupt	sn_timer_interrupt
   10.21 +#endif
   10.22  #define platform_global_tlb_purge       sn2_global_tlb_purge
   10.23 +#ifndef XEN
   10.24  #define platform_tlb_migrate_finish	sn_tlb_migrate_finish
   10.25 +#endif
   10.26  #define platform_pci_fixup		sn_pci_fixup
   10.27  #define platform_inb			__sn_inb
   10.28  #define platform_inw			__sn_inw
   10.29 @@ -103,10 +109,30 @@ extern ia64_mv_teardown_msi_irq_t	sn_tea
   10.30  #define platform_readl_relaxed		__sn_readl_relaxed
   10.31  #define platform_readq_relaxed		__sn_readq_relaxed
   10.32  #define platform_local_vector_to_irq	sn_local_vector_to_irq
   10.33 +#ifdef XEN
   10.34 +#define platform_pci_get_legacy_mem	machvec_noop
   10.35 +#define platform_pci_legacy_read	machvec_noop
   10.36 +#define platform_pci_legacy_write	machvec_noop
   10.37 +#else
   10.38  #define platform_pci_get_legacy_mem	sn_pci_get_legacy_mem
   10.39  #define platform_pci_legacy_read	sn_pci_legacy_read
   10.40  #define platform_pci_legacy_write	sn_pci_legacy_write
   10.41 +#endif
   10.42  #define platform_dma_init		machvec_noop
   10.43 +#ifdef XEN
   10.44 +#define platform_dma_alloc_coherent	machvec_noop
   10.45 +#define platform_dma_free_coherent	machvec_noop
   10.46 +#define platform_dma_map_single		machvec_noop
   10.47 +#define platform_dma_unmap_single	machvec_noop
   10.48 +#define platform_dma_map_sg		machvec_noop
   10.49 +#define platform_dma_unmap_sg		machvec_noop
   10.50 +#define platform_dma_sync_single_for_cpu machvec_noop
   10.51 +#define platform_dma_sync_sg_for_cpu	machvec_noop
   10.52 +#define platform_dma_sync_single_for_device machvec_noop
   10.53 +#define platform_dma_sync_sg_for_device	machvec_noop
   10.54 +#define platform_dma_mapping_error	machvec_noop
   10.55 +#define platform_dma_supported		machvec_noop
   10.56 +#else
   10.57  #define platform_dma_alloc_coherent	sn_dma_alloc_coherent
   10.58  #define platform_dma_free_coherent	sn_dma_free_coherent
   10.59  #define platform_dma_map_single		sn_dma_map_single
   10.60 @@ -120,6 +146,9 @@ extern ia64_mv_teardown_msi_irq_t	sn_tea
   10.61  #define platform_dma_mapping_error		sn_dma_mapping_error
   10.62  #define platform_dma_supported		sn_dma_supported
   10.63  #define platform_migrate		sn_migrate
   10.64 +#endif
   10.65 +
   10.66 +#ifndef XEN
   10.67  #ifdef CONFIG_PCI_MSI
   10.68  #define platform_setup_msi_irq		sn_setup_msi_irq
   10.69  #define platform_teardown_msi_irq	sn_teardown_msi_irq
   10.70 @@ -127,6 +156,7 @@ extern ia64_mv_teardown_msi_irq_t	sn_tea
   10.71  #define platform_setup_msi_irq		((ia64_mv_setup_msi_irq_t*)NULL)
   10.72  #define platform_teardown_msi_irq	((ia64_mv_teardown_msi_irq_t*)NULL)
   10.73  #endif
   10.74 +#endif
   10.75  
   10.76  #include <asm/sn/io.h>
   10.77  
    11.1 --- a/xen/include/asm-ia64/linux-xen/asm/page.h	Wed Dec 13 12:23:53 2006 -0700
    11.2 +++ b/xen/include/asm-ia64/linux-xen/asm/page.h	Wed Dec 13 15:22:25 2006 -0700
    11.3 @@ -12,6 +12,16 @@
    11.4  #include <asm/intrinsics.h>
    11.5  #include <asm/types.h>
    11.6  
    11.7 +#ifdef XEN  /* This will go away with newer upstream */
    11.8 +#define RGN_SHIFT	61
    11.9 +#define RGN_BASE(r)	(r << RGN_SHIFT)
   11.10 +#define RGN_BITS	RGN_BASE(-1)
   11.11 +#define RGN_HPAGE	REGION_HPAGE
   11.12 +#ifndef CONFIG_HUGETLB_PAGE
   11.13 +# define REGION_HPAGE	(4UL)
   11.14 +#endif
   11.15 +#endif
   11.16 +
   11.17  /*
   11.18   * PAGE_SHIFT determines the actual kernel page size.
   11.19   */
    12.1 --- a/xen/include/asm-ia64/linux-xen/asm/pci.h	Wed Dec 13 12:23:53 2006 -0700
    12.2 +++ b/xen/include/asm-ia64/linux-xen/asm/pci.h	Wed Dec 13 15:22:25 2006 -0700
    12.3 @@ -6,9 +6,14 @@
    12.4  #include <linux/spinlock.h>
    12.5  #include <linux/string.h>
    12.6  #include <linux/types.h>
    12.7 +#ifdef XEN
    12.8 +#include <linux/ioport.h>
    12.9 +#endif
   12.10  
   12.11  #include <asm/io.h>
   12.12 +#ifndef XEN
   12.13  #include <asm/scatterlist.h>
   12.14 +#endif
   12.15  
   12.16  /*
   12.17   * Can be used to override the logic in pci_scan_bus for skipping already-configured bus
   12.18 @@ -55,7 +60,9 @@ pcibios_penalize_isa_irq (int irq, int a
   12.19  #define HAVE_ARCH_PCI_MWI 1
   12.20  extern int pcibios_prep_mwi (struct pci_dev *);
   12.21  
   12.22 +#ifndef XEN
   12.23  #include <asm-generic/pci-dma-compat.h>
   12.24 +#endif
   12.25  
   12.26  /* pci_unmap_{single,page} is not a nop, thus... */
   12.27  #define DECLARE_PCI_UNMAP_ADDR(ADDR_NAME)	\
   12.28 @@ -107,6 +114,7 @@ extern int pci_mmap_page_range (struct p
   12.29  #define HAVE_PCI_LEGACY
   12.30  extern int pci_mmap_legacy_page_range(struct pci_bus *bus,
   12.31  				      struct vm_area_struct *vma);
   12.32 +#ifndef XEN
   12.33  extern ssize_t pci_read_legacy_io(struct kobject *kobj, char *buf, loff_t off,
   12.34  				  size_t count);
   12.35  extern ssize_t pci_write_legacy_io(struct kobject *kobj, char *buf, loff_t off,
   12.36 @@ -114,6 +122,7 @@ extern ssize_t pci_write_legacy_io(struc
   12.37  extern int pci_mmap_legacy_mem(struct kobject *kobj,
   12.38  			       struct bin_attribute *attr,
   12.39  			       struct vm_area_struct *vma);
   12.40 +#endif
   12.41  
   12.42  #define pci_get_legacy_mem platform_pci_get_legacy_mem
   12.43  #define pci_legacy_read platform_pci_legacy_read
   12.44 @@ -156,6 +165,7 @@ extern void pcibios_resource_to_bus(stru
   12.45  extern void pcibios_bus_to_resource(struct pci_dev *dev,
   12.46  		struct resource *res, struct pci_bus_region *region);
   12.47  
   12.48 +#ifndef XEN
   12.49  static inline struct resource *
   12.50  pcibios_select_root(struct pci_dev *pdev, struct resource *res)
   12.51  {
   12.52 @@ -168,6 +178,7 @@ pcibios_select_root(struct pci_dev *pdev
   12.53  
   12.54  	return root;
   12.55  }
   12.56 +#endif
   12.57  
   12.58  #define pcibios_scan_all_fns(a, b)	0
   12.59  
    13.1 --- a/xen/include/asm-ia64/linux-xen/asm/sn/addrs.h	Wed Dec 13 12:23:53 2006 -0700
    13.2 +++ b/xen/include/asm-ia64/linux-xen/asm/sn/addrs.h	Wed Dec 13 15:22:25 2006 -0700
    13.3 @@ -136,7 +136,7 @@
    13.4   */
    13.5  #define TO_PHYS(x)		(TO_PHYS_MASK & (x))
    13.6  #define TO_CAC(x)		(CAC_BASE     | TO_PHYS(x))
    13.7 -#ifdef CONFIG_SGI_SN
    13.8 +#if defined(CONFIG_SGI_SN) || defined(XEN)
    13.9  #define TO_AMO(x)		(AMO_BASE     | TO_PHYS(x))
   13.10  #define TO_GET(x)		(GET_BASE     | TO_PHYS(x))
   13.11  #else
    14.1 --- a/xen/include/asm-ia64/linux-xen/asm/sn/arch.h	Wed Dec 13 12:23:53 2006 -0700
    14.2 +++ b/xen/include/asm-ia64/linux-xen/asm/sn/arch.h	Wed Dec 13 15:22:25 2006 -0700
    14.3 @@ -11,10 +11,12 @@
    14.4  #ifndef _ASM_IA64_SN_ARCH_H
    14.5  #define _ASM_IA64_SN_ARCH_H
    14.6  
    14.7 +#ifndef XEN
    14.8  #include <linux/numa.h>
    14.9  #include <asm/types.h>
   14.10  #include <asm/percpu.h>
   14.11  #include <asm/sn/types.h>
   14.12 +#endif
   14.13  #include <asm/sn/sn_cpuid.h>
   14.14  
   14.15  /*
   14.16 @@ -58,8 +60,13 @@ struct sn_hub_info_s {
   14.17  };
   14.18  DECLARE_PER_CPU(struct sn_hub_info_s, __sn_hub_info);
   14.19  #define sn_hub_info 	(&__get_cpu_var(__sn_hub_info))
   14.20 +#ifndef XEN
   14.21  #define is_shub2()	(sn_hub_info->shub2)
   14.22  #define is_shub1()	(sn_hub_info->shub2 == 0)
   14.23 +#else
   14.24 +#define is_shub2()	0
   14.25 +#define is_shub1()	1
   14.26 +#endif
   14.27  
   14.28  /*
   14.29   * Use this macro to test if shub 1.1 wars should be enabled
   14.30 @@ -74,12 +81,12 @@ DECLARE_PER_CPU(struct sn_hub_info_s, __
   14.31  DECLARE_PER_CPU(short, __sn_cnodeid_to_nasid[MAX_COMPACT_NODES]);
   14.32  #define sn_cnodeid_to_nasid	(&__get_cpu_var(__sn_cnodeid_to_nasid[0]))
   14.33  
   14.34 -
   14.35 +#ifndef XEN
   14.36  extern u8 sn_partition_id;
   14.37  extern u8 sn_system_size;
   14.38  extern u8 sn_sharing_domain_size;
   14.39  extern u8 sn_region_size;
   14.40  
   14.41  extern void sn_flush_all_caches(long addr, long bytes);
   14.42 -
   14.43 +#endif
   14.44  #endif /* _ASM_IA64_SN_ARCH_H */
    15.1 --- a/xen/include/asm-ia64/linux-xen/asm/sn/hubdev.h	Wed Dec 13 12:23:53 2006 -0700
    15.2 +++ b/xen/include/asm-ia64/linux-xen/asm/sn/hubdev.h	Wed Dec 13 15:22:25 2006 -0700
    15.3 @@ -8,7 +8,11 @@
    15.4  #ifndef _ASM_IA64_SN_XTALK_HUBDEV_H
    15.5  #define _ASM_IA64_SN_XTALK_HUBDEV_H
    15.6  
    15.7 +#ifndef XEN
    15.8  #include "xtalk/xwidgetdev.h"
    15.9 +#else
   15.10 +#include <asm/sn/xwidgetdev.h>
   15.11 +#endif
   15.12  
   15.13  #define HUB_WIDGET_ID_MAX 0xf
   15.14  #define DEV_PER_WIDGET (2*2*8)
    16.1 --- a/xen/include/asm-ia64/linux-xen/asm/sn/io.h	Wed Dec 13 12:23:53 2006 -0700
    16.2 +++ b/xen/include/asm-ia64/linux-xen/asm/sn/io.h	Wed Dec 13 15:22:25 2006 -0700
    16.3 @@ -18,7 +18,14 @@ extern int num_cnodes;
    16.4  
    16.5  #define __sn_mf_a()   ia64_mfa()
    16.6  
    16.7 +#ifdef XEN
    16.8 +/*
    16.9 + * Xen doesn't deal with any PIC devices directly, it's all handled in dom0
   16.10 + */
   16.11 +#define sn_dma_flush(foo)		do {} while(0)
   16.12 +#else
   16.13  extern void sn_dma_flush(unsigned long);
   16.14 +#endif
   16.15  
   16.16  #define __sn_inb ___sn_inb
   16.17  #define __sn_inw ___sn_inw
    17.1 --- a/xen/include/asm-ia64/linux-xen/asm/sn/pcibr_provider.h	Wed Dec 13 12:23:53 2006 -0700
    17.2 +++ b/xen/include/asm-ia64/linux-xen/asm/sn/pcibr_provider.h	Wed Dec 13 15:22:25 2006 -0700
    17.3 @@ -8,6 +8,10 @@
    17.4  #ifndef _ASM_IA64_SN_PCI_PCIBR_PROVIDER_H
    17.5  #define _ASM_IA64_SN_PCI_PCIBR_PROVIDER_H
    17.6  
    17.7 +#ifdef XEN
    17.8 +#include <linux/spinlock.h>
    17.9 +#include <linux/pci.h>
   17.10 +#endif
   17.11  #include <asm/sn/intr.h>
   17.12  #include <asm/sn/pcibus_provider_defs.h>
   17.13  
    18.1 --- a/xen/include/asm-ia64/linux-xen/asm/sn/rw_mmr.h	Wed Dec 13 12:23:53 2006 -0700
    18.2 +++ b/xen/include/asm-ia64/linux-xen/asm/sn/rw_mmr.h	Wed Dec 13 15:22:25 2006 -0700
    18.3 @@ -23,6 +23,10 @@
    18.4  
    18.5  extern long pio_phys_read_mmr(volatile long *mmr); 
    18.6  extern void pio_phys_write_mmr(volatile long *mmr, long val);
    18.7 +#ifndef XEN
    18.8  extern void pio_atomic_phys_write_mmrs(volatile long *mmr1, long val1, volatile long *mmr2, long val2); 
    18.9 +#else
   18.10 +extern void pio_atomic_phys_write_mmrs(volatile unsigned long *mmr1, long val1, volatile unsigned long *mmr2, long val2); 
   18.11 +#endif
   18.12  
   18.13  #endif /* _ASM_IA64_SN_RW_MMR_H */
    19.1 --- a/xen/include/asm-ia64/linux-xen/asm/system.h	Wed Dec 13 12:23:53 2006 -0700
    19.2 +++ b/xen/include/asm-ia64/linux-xen/asm/system.h	Wed Dec 13 15:22:25 2006 -0700
    19.3 @@ -190,6 +190,7 @@ do {								\
    19.4  #ifdef XEN
    19.5  #define local_irq_is_enabled() (!irqs_disabled())
    19.6  extern struct vcpu *ia64_switch_to(struct vcpu *next_task);
    19.7 +#define ia64_platform_is(x) (strcmp(x, platform_name) == 0)
    19.8  #else
    19.9  #ifdef __KERNEL__
   19.10  
    20.1 --- a/xen/include/asm-ia64/linux-xen/linux/device.h	Wed Dec 13 12:23:53 2006 -0700
    20.2 +++ b/xen/include/asm-ia64/linux-xen/linux/device.h	Wed Dec 13 15:22:25 2006 -0700
    20.3 @@ -78,7 +78,9 @@ int __must_check bus_for_each_drv(struct
    20.4  /* driverfs interface for exporting bus attributes */
    20.5  
    20.6  struct bus_attribute {
    20.7 +#ifndef XEN
    20.8  	struct attribute	attr;
    20.9 +#endif
   20.10  	ssize_t (*show)(struct bus_type *, char * buf);
   20.11  	ssize_t (*store)(struct bus_type *, const char * buf, size_t count);
   20.12  };
   20.13 @@ -122,7 +124,9 @@ extern int driver_probe_done(void);
   20.14  /* driverfs interface for exporting driver attributes */
   20.15  
   20.16  struct driver_attribute {
   20.17 +#ifndef XEN
   20.18  	struct attribute	attr;
   20.19 +#endif
   20.20  	ssize_t (*show)(struct device_driver *, char * buf);
   20.21  	ssize_t (*store)(struct device_driver *, const char * buf, size_t count);
   20.22  };
   20.23 @@ -152,7 +156,11 @@ struct class {
   20.24  	struct list_head	children;
   20.25  	struct list_head	devices;
   20.26  	struct list_head	interfaces;
   20.27 +#ifdef XEN
   20.28 +	spinlock_t		sem;
   20.29 +#else
   20.30  	struct semaphore	sem;	/* locks both the children and interfaces lists */
   20.31 +#endif
   20.32  
   20.33  	struct kobject		*virtual_dir;
   20.34  
   20.35 @@ -178,7 +186,9 @@ extern void class_unregister(struct clas
   20.36  
   20.37  
   20.38  struct class_attribute {
   20.39 +#ifndef XEN
   20.40  	struct attribute	attr;
   20.41 +#endif
   20.42  	ssize_t (*show)(struct class *, char * buf);
   20.43  	ssize_t (*store)(struct class *, const char * buf, size_t count);
   20.44  };
   20.45 @@ -191,7 +201,9 @@ extern int __must_check class_create_fil
   20.46  extern void class_remove_file(struct class *, const struct class_attribute *);
   20.47  
   20.48  struct class_device_attribute {
   20.49 +#ifndef XEN
   20.50  	struct attribute	attr;
   20.51 +#endif
   20.52  	ssize_t (*show)(struct class_device *, char * buf);
   20.53  	ssize_t (*store)(struct class_device *, const char * buf, size_t count);
   20.54  };
   20.55 @@ -333,9 +345,13 @@ struct device {
   20.56  	struct device_attribute uevent_attr;
   20.57  	struct device_attribute *devt_attr;
   20.58  
   20.59 +#ifdef XEN
   20.60 +	spinlock_t		sem;
   20.61 +#else
   20.62  	struct semaphore	sem;	/* semaphore to synchronize calls to
   20.63  					 * its driver.
   20.64  					 */
   20.65 +#endif
   20.66  
   20.67  	struct bus_type	* bus;		/* type of bus device is on */
   20.68  	struct device_driver *driver;	/* which driver has allocated this
    21.1 --- a/xen/include/asm-ia64/linux-xen/linux/kobject.h	Wed Dec 13 12:23:53 2006 -0700
    21.2 +++ b/xen/include/asm-ia64/linux-xen/linux/kobject.h	Wed Dec 13 15:22:25 2006 -0700
    21.3 @@ -169,7 +169,9 @@ extern struct kobject * kset_find_obj(st
    21.4  
    21.5  struct subsystem {
    21.6  	struct kset		kset;
    21.7 +#ifndef XEN
    21.8  	struct rw_semaphore	rwsem;
    21.9 +#endif
   21.10  };
   21.11  
   21.12  #define decl_subsys(_name,_type,_uevent_ops) \
   21.13 @@ -254,7 +256,9 @@ static inline void subsys_put(struct sub
   21.14  }
   21.15  
   21.16  struct subsys_attribute {
   21.17 +#ifndef XEN
   21.18  	struct attribute attr;
   21.19 +#endif
   21.20  	ssize_t (*show)(struct subsystem *, char *);
   21.21  	ssize_t (*store)(struct subsystem *, const char *, size_t); 
   21.22  };
    22.1 --- a/xen/include/asm-ia64/linux-xen/linux/pci.h	Wed Dec 13 12:23:53 2006 -0700
    22.2 +++ b/xen/include/asm-ia64/linux-xen/linux/pci.h	Wed Dec 13 15:22:25 2006 -0700
    22.3 @@ -22,6 +22,9 @@
    22.4  
    22.5  /* Include the ID list */
    22.6  #include <linux/pci_ids.h>
    22.7 +#ifdef XEN
    22.8 +#include <asm/processor.h>
    22.9 +#endif
   22.10  
   22.11  /*
   22.12   * The PCI interface treats multi-function devices as independent
    23.1 --- a/xen/include/asm-ia64/linux/asm/pci.h	Wed Dec 13 12:23:53 2006 -0700
    23.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    23.3 @@ -1,161 +0,0 @@
    23.4 -#ifndef _ASM_IA64_PCI_H
    23.5 -#define _ASM_IA64_PCI_H
    23.6 -
    23.7 -#include <linux/mm.h>
    23.8 -#include <linux/slab.h>
    23.9 -#include <linux/spinlock.h>
   23.10 -#include <linux/string.h>
   23.11 -#include <linux/types.h>
   23.12 -
   23.13 -#include <asm/io.h>
   23.14 -#include <asm/scatterlist.h>
   23.15 -
   23.16 -/*
   23.17 - * Can be used to override the logic in pci_scan_bus for skipping already-configured bus
   23.18 - * numbers - to be used for buggy BIOSes or architectures with incomplete PCI setup by the
   23.19 - * loader.
   23.20 - */
   23.21 -#define pcibios_assign_all_busses()     0
   23.22 -#define pcibios_scan_all_fns(a, b)	0
   23.23 -
   23.24 -#define PCIBIOS_MIN_IO		0x1000
   23.25 -#define PCIBIOS_MIN_MEM		0x10000000
   23.26 -
   23.27 -void pcibios_config_init(void);
   23.28 -
   23.29 -struct pci_dev;
   23.30 -
   23.31 -/*
   23.32 - * PCI_DMA_BUS_IS_PHYS should be set to 1 if there is _necessarily_ a direct correspondence
   23.33 - * between device bus addresses and CPU physical addresses.  Platforms with a hardware I/O
   23.34 - * MMU _must_ turn this off to suppress the bounce buffer handling code in the block and
   23.35 - * network device layers.  Platforms with separate bus address spaces _must_ turn this off
   23.36 - * and provide a device DMA mapping implementation that takes care of the necessary
   23.37 - * address translation.
   23.38 - *
   23.39 - * For now, the ia64 platforms which may have separate/multiple bus address spaces all
   23.40 - * have I/O MMUs which support the merging of physically discontiguous buffers, so we can
   23.41 - * use that as the sole factor to determine the setting of PCI_DMA_BUS_IS_PHYS.
   23.42 - */
   23.43 -extern unsigned long ia64_max_iommu_merge_mask;
   23.44 -#define PCI_DMA_BUS_IS_PHYS	(ia64_max_iommu_merge_mask == ~0UL)
   23.45 -
   23.46 -static inline void
   23.47 -pcibios_set_master (struct pci_dev *dev)
   23.48 -{
   23.49 -	/* No special bus mastering setup handling */
   23.50 -}
   23.51 -
   23.52 -static inline void
   23.53 -pcibios_penalize_isa_irq (int irq, int active)
   23.54 -{
   23.55 -	/* We don't do dynamic PCI IRQ allocation */
   23.56 -}
   23.57 -
   23.58 -#define HAVE_ARCH_PCI_MWI 1
   23.59 -extern int pcibios_prep_mwi (struct pci_dev *);
   23.60 -
   23.61 -#include <asm-generic/pci-dma-compat.h>
   23.62 -
   23.63 -/* pci_unmap_{single,page} is not a nop, thus... */
   23.64 -#define DECLARE_PCI_UNMAP_ADDR(ADDR_NAME)	\
   23.65 -	dma_addr_t ADDR_NAME;
   23.66 -#define DECLARE_PCI_UNMAP_LEN(LEN_NAME)		\
   23.67 -	__u32 LEN_NAME;
   23.68 -#define pci_unmap_addr(PTR, ADDR_NAME)			\
   23.69 -	((PTR)->ADDR_NAME)
   23.70 -#define pci_unmap_addr_set(PTR, ADDR_NAME, VAL)		\
   23.71 -	(((PTR)->ADDR_NAME) = (VAL))
   23.72 -#define pci_unmap_len(PTR, LEN_NAME)			\
   23.73 -	((PTR)->LEN_NAME)
   23.74 -#define pci_unmap_len_set(PTR, LEN_NAME, VAL)		\
   23.75 -	(((PTR)->LEN_NAME) = (VAL))
   23.76 -
   23.77 -/* The ia64 platform always supports 64-bit addressing. */
   23.78 -#define pci_dac_dma_supported(pci_dev, mask)		(1)
   23.79 -#define pci_dac_page_to_dma(dev,pg,off,dir)		((dma_addr_t) page_to_bus(pg) + (off))
   23.80 -#define pci_dac_dma_to_page(dev,dma_addr)		(virt_to_page(bus_to_virt(dma_addr)))
   23.81 -#define pci_dac_dma_to_offset(dev,dma_addr)		offset_in_page(dma_addr)
   23.82 -#define pci_dac_dma_sync_single_for_cpu(dev,dma_addr,len,dir)	do { } while (0)
   23.83 -#define pci_dac_dma_sync_single_for_device(dev,dma_addr,len,dir)	do { mb(); } while (0)
   23.84 -
   23.85 -#define sg_dma_len(sg)		((sg)->dma_length)
   23.86 -#define sg_dma_address(sg)	((sg)->dma_address)
   23.87 -
   23.88 -#ifdef CONFIG_PCI
   23.89 -static inline void pci_dma_burst_advice(struct pci_dev *pdev,
   23.90 -					enum pci_dma_burst_strategy *strat,
   23.91 -					unsigned long *strategy_parameter)
   23.92 -{
   23.93 -	unsigned long cacheline_size;
   23.94 -	u8 byte;
   23.95 -
   23.96 -	pci_read_config_byte(pdev, PCI_CACHE_LINE_SIZE, &byte);
   23.97 -	if (byte == 0)
   23.98 -		cacheline_size = 1024;
   23.99 -	else
  23.100 -		cacheline_size = (int) byte * 4;
  23.101 -
  23.102 -	*strat = PCI_DMA_BURST_MULTIPLE;
  23.103 -	*strategy_parameter = cacheline_size;
  23.104 -}
  23.105 -#endif
  23.106 -
  23.107 -#define HAVE_PCI_MMAP
  23.108 -extern int pci_mmap_page_range (struct pci_dev *dev, struct vm_area_struct *vma,
  23.109 -				enum pci_mmap_state mmap_state, int write_combine);
  23.110 -#define HAVE_PCI_LEGACY
  23.111 -extern int pci_mmap_legacy_page_range(struct pci_bus *bus,
  23.112 -				      struct vm_area_struct *vma);
  23.113 -extern ssize_t pci_read_legacy_io(struct kobject *kobj, char *buf, loff_t off,
  23.114 -				  size_t count);
  23.115 -extern ssize_t pci_write_legacy_io(struct kobject *kobj, char *buf, loff_t off,
  23.116 -				   size_t count);
  23.117 -extern int pci_mmap_legacy_mem(struct kobject *kobj,
  23.118 -			       struct bin_attribute *attr,
  23.119 -			       struct vm_area_struct *vma);
  23.120 -
  23.121 -#define pci_get_legacy_mem platform_pci_get_legacy_mem
  23.122 -#define pci_legacy_read platform_pci_legacy_read
  23.123 -#define pci_legacy_write platform_pci_legacy_write
  23.124 -
  23.125 -struct pci_window {
  23.126 -	struct resource resource;
  23.127 -	u64 offset;
  23.128 -};
  23.129 -
  23.130 -struct pci_controller {
  23.131 -	void *acpi_handle;
  23.132 -	void *iommu;
  23.133 -	int segment;
  23.134 -	int node;		/* nearest node with memory or -1 for global allocation */
  23.135 -
  23.136 -	unsigned int windows;
  23.137 -	struct pci_window *window;
  23.138 -
  23.139 -	void *platform_data;
  23.140 -};
  23.141 -
  23.142 -#define PCI_CONTROLLER(busdev) ((struct pci_controller *) busdev->sysdata)
  23.143 -#define pci_domain_nr(busdev)    (PCI_CONTROLLER(busdev)->segment)
  23.144 -
  23.145 -extern struct pci_ops pci_root_ops;
  23.146 -
  23.147 -static inline int pci_proc_domain(struct pci_bus *bus)
  23.148 -{
  23.149 -	return (pci_domain_nr(bus) != 0);
  23.150 -}
  23.151 -
  23.152 -static inline void pcibios_add_platform_entries(struct pci_dev *dev)
  23.153 -{
  23.154 -}
  23.155 -
  23.156 -extern void pcibios_resource_to_bus(struct pci_dev *dev,
  23.157 -		struct pci_bus_region *region, struct resource *res);
  23.158 -
  23.159 -extern void pcibios_bus_to_resource(struct pci_dev *dev,
  23.160 -		struct resource *res, struct pci_bus_region *region);
  23.161 -
  23.162 -#define pcibios_scan_all_fns(a, b)	0
  23.163 -
  23.164 -#endif /* _ASM_IA64_PCI_H */