ia64/xen-unstable

changeset 19197:9e3be0660c1e

Cleanup naming for ia64 and x86 interrupt handling functions

- Append '_IRQ' to AUTO_ASSIGN, NEVER_ASSIGN, and FREE_TO_ASSIGN
- Rename {request,setup}_irq to {request,setup}_irq_vector
- Rename free_irq to release_irq_vector
- Add {request,setup,release}_irq wrappers for their
{request,setup,release}_irq_vector counterparts
- Added generic irq_to_vector inline for ia64
- Changed ia64 to use the new naming scheme

Signed-off-by: Espen Skoglund <espen.skoglund@netronome.com>
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
author Keir Fraser <keir.fraser@citrix.com>
date Thu Feb 12 10:48:55 2009 +0000 (2009-02-12)
parents bf9cdbec516a
children a624353a668d
files xen/arch/ia64/linux-xen/iosapic.c xen/arch/ia64/linux-xen/irq_ia64.c xen/arch/ia64/linux-xen/mca.c xen/arch/ia64/xen/hypercall.c xen/arch/ia64/xen/irq.c xen/arch/x86/i8259.c xen/arch/x86/irq.c xen/arch/x86/physdev.c xen/drivers/char/serial.c xen/drivers/passthrough/amd/iommu_init.c xen/drivers/passthrough/vtd/ia64/vtd.c xen/drivers/passthrough/vtd/iommu.c xen/include/asm-ia64/hvm/iommu.h xen/include/asm-ia64/hvm/irq.h xen/include/asm-ia64/linux-xen/linux/interrupt.h xen/include/asm-ia64/linux/asm/hw_irq.h xen/include/asm-x86/irq.h xen/include/xen/irq.h
line diff
     1.1 --- a/xen/arch/ia64/linux-xen/iosapic.c	Wed Feb 11 16:36:59 2009 +0000
     1.2 +++ b/xen/arch/ia64/linux-xen/iosapic.c	Thu Feb 12 10:48:55 2009 +0000
     1.3 @@ -93,6 +93,16 @@
     1.4  #include <asm/ptrace.h>
     1.5  #include <asm/system.h>
     1.6  
     1.7 +#ifdef XEN
     1.8 +static inline int iosapic_irq_to_vector (int irq)
     1.9 +{
    1.10 +	return irq;
    1.11 +}
    1.12 +
    1.13 +#undef irq_to_vector
    1.14 +#define irq_to_vector(irq)      iosapic_irq_to_vector(irq)
    1.15 +#define AUTO_ASSIGN	AUTO_ASSIGN_IRQ
    1.16 +#endif
    1.17  
    1.18  #undef DEBUG_INTERRUPT_ROUTING
    1.19  
     2.1 --- a/xen/arch/ia64/linux-xen/irq_ia64.c	Wed Feb 11 16:36:59 2009 +0000
     2.2 +++ b/xen/arch/ia64/linux-xen/irq_ia64.c	Thu Feb 12 10:48:55 2009 +0000
     2.3 @@ -250,6 +250,7 @@ void
     2.4  register_percpu_irq (ia64_vector vec, struct irqaction *action)
     2.5  {
     2.6  	irq_desc_t *desc;
     2.7 +#ifndef XEN
     2.8  	unsigned int irq;
     2.9  
    2.10  	for (irq = 0; irq < NR_IRQS; ++irq)
    2.11 @@ -258,16 +259,19 @@ register_percpu_irq (ia64_vector vec, st
    2.12  			desc->status |= IRQ_PER_CPU;
    2.13  			desc->handler = &irq_type_ia64_lsapic;
    2.14  			if (action)
    2.15 -#ifdef XEN
    2.16 -				setup_vector(irq, action);
    2.17 +				setup_irq(irq, action);
    2.18 +		}
    2.19  #else
    2.20 -				setup_irq(irq, action);
    2.21 +	desc = irq_descp(vec);
    2.22 +	desc->status |= IRQ_PER_CPU;
    2.23 +	desc->handler = &irq_type_ia64_lsapic;
    2.24 +	if (action)
    2.25 +		setup_vector(vec, action);
    2.26  #endif
    2.27 -		}
    2.28  }
    2.29  
    2.30  #ifdef XEN
    2.31 -int request_irq(unsigned int irq,
    2.32 +int request_irq_vector(unsigned int vector,
    2.33  		void (*handler)(int, void *, struct cpu_user_regs *),
    2.34  		unsigned long irqflags, const char * devname, void *dev_id)
    2.35  {
    2.36 @@ -279,7 +283,7 @@ int request_irq(unsigned int irq,
    2.37  	 * otherwise we'll have trouble later trying to figure out
    2.38  	 * which interrupt is which (messes up the interrupt freeing logic etc).
    2.39  	 *                          */
    2.40 -	if (irq >= NR_IRQS)
    2.41 +	if (vector >= NR_VECTORS)
    2.42  		return -EINVAL;
    2.43  	if (!handler)
    2.44  		return -EINVAL;
    2.45 @@ -291,7 +295,7 @@ int request_irq(unsigned int irq,
    2.46  	action->handler = handler;
    2.47  	action->name = devname;
    2.48  	action->dev_id = dev_id;
    2.49 -	setup_vector(irq, action);
    2.50 +	setup_vector(vector, action);
    2.51  	if (retval)
    2.52  		xfree(action);
    2.53  
     3.1 --- a/xen/arch/ia64/linux-xen/mca.c	Wed Feb 11 16:36:59 2009 +0000
     3.2 +++ b/xen/arch/ia64/linux-xen/mca.c	Thu Feb 12 10:48:55 2009 +0000
     3.3 @@ -114,7 +114,6 @@ extern void			ia64_monarch_init_handler 
     3.4  extern void			ia64_slave_init_handler (void);
     3.5  #ifdef XEN
     3.6  extern void setup_vector (unsigned int vec, struct irqaction *action);
     3.7 -#define setup_irq(irq, action)	setup_vector(irq, action)
     3.8  #endif
     3.9  
    3.10  static ia64_mc_info_t		ia64_mc_info;
    3.11 @@ -1922,12 +1921,18 @@ ia64_mca_late_init(void)
    3.12  		if (cpe_vector >= 0) {
    3.13  			/* If platform supports CPEI, enable the irq. */
    3.14  			cpe_poll_enabled = 0;
    3.15 +#ifndef XEN
    3.16  			for (irq = 0; irq < NR_IRQS; ++irq)
    3.17  				if (irq_to_vector(irq) == cpe_vector) {
    3.18  					desc = irq_descp(irq);
    3.19  					desc->status |= IRQ_PER_CPU;
    3.20 -					setup_irq(irq, &mca_cpe_irqaction);
    3.21 +					setup_vector(irq, &mca_cpe_irqaction);
    3.22  				}
    3.23 +#else
    3.24 +			desc = irq_descp(cpe_vector);
    3.25 +			desc->status |= IRQ_PER_CPU;
    3.26 +			setup_vector(cpe_vector, &mca_cpe_irqaction);
    3.27 +#endif
    3.28  			ia64_mca_register_cpev(cpe_vector);
    3.29  			IA64_MCA_DEBUG("%s: CPEI/P setup and enabled.\n", __FUNCTION__);
    3.30  		} else {
     4.1 --- a/xen/arch/ia64/xen/hypercall.c	Wed Feb 11 16:36:59 2009 +0000
     4.2 +++ b/xen/arch/ia64/xen/hypercall.c	Thu Feb 12 10:48:55 2009 +0000
     4.3 @@ -543,7 +543,7 @@ long do_physdev_op(int cmd, XEN_GUEST_HA
     4.4              break;
     4.5          irq_status_query.flags = 0;
     4.6          /* Edge-triggered interrupts don't need an explicit unmask downcall. */
     4.7 -        if ( !strstr(irq_desc[irq_to_vector(irq)].handler->typename, "edge") )
     4.8 +        if ( !strstr(irq_descp(irq)->handler->typename, "edge") )
     4.9              irq_status_query.flags |= XENIRQSTAT_needs_eoi;
    4.10          ret = copy_to_guest(arg, &irq_status_query, 1) ? -EFAULT : 0;
    4.11          break;
     5.1 --- a/xen/arch/ia64/xen/irq.c	Wed Feb 11 16:36:59 2009 +0000
     5.2 +++ b/xen/arch/ia64/xen/irq.c	Thu Feb 12 10:48:55 2009 +0000
     5.3 @@ -228,11 +228,11 @@ out:
     5.4   * disabled.
     5.5   */
     5.6  
     5.7 -int setup_vector(unsigned int irq, struct irqaction * new)
     5.8 +int setup_vector(unsigned int vector, struct irqaction * new)
     5.9  {
    5.10  	unsigned long flags;
    5.11  	struct irqaction *old, **p;
    5.12 -	irq_desc_t *desc = irq_descp(irq);
    5.13 +	irq_desc_t *desc = irq_descp(vector);
    5.14  
    5.15  	/*
    5.16  	 * The following block of code has to be executed atomically
    5.17 @@ -248,8 +248,8 @@ int setup_vector(unsigned int irq, struc
    5.18  
    5.19  	desc->depth = 0;
    5.20  	desc->status &= ~(IRQ_DISABLED | IRQ_INPROGRESS | IRQ_GUEST);
    5.21 -	desc->handler->startup(irq);
    5.22 -	desc->handler->enable(irq);
    5.23 +	desc->handler->startup(vector);
    5.24 +	desc->handler->enable(vector);
    5.25  	spin_unlock_irqrestore(&desc->lock,flags);
    5.26  
    5.27  	return 0;
    5.28 @@ -258,13 +258,11 @@ int setup_vector(unsigned int irq, struc
    5.29  /* Vectors reserved by xen (and thus not sharable with domains).  */
    5.30  unsigned long ia64_xen_vector[BITS_TO_LONGS(NR_IRQS)];
    5.31  
    5.32 -int setup_irq(unsigned int irq, struct irqaction * new)
    5.33 +int setup_irq_vector(unsigned int vec, struct irqaction * new)
    5.34  {
    5.35 -	unsigned int vec;
    5.36  	int res;
    5.37  
    5.38 -	/* Get vector for IRQ.  */
    5.39 -	if (acpi_gsi_to_irq (irq, &vec) < 0)
    5.40 +	if ( vec == IA64_INVALID_VECTOR )
    5.41  		return -ENOSYS;
    5.42  	/* Reserve the vector (and thus the irq).  */
    5.43  	if (test_and_set_bit(vec, ia64_xen_vector))
    5.44 @@ -273,14 +271,12 @@ int setup_irq(unsigned int irq, struct i
    5.45  	return res;
    5.46  }
    5.47  
    5.48 -void free_irq(unsigned int irq)
    5.49 +void release_irq_vector(unsigned int vec)
    5.50  {
    5.51 -	unsigned int vec;
    5.52  	unsigned long flags;
    5.53  	irq_desc_t *desc;
    5.54  
    5.55 -	/* Get vector for IRQ.  */
    5.56 -	if (acpi_gsi_to_irq(irq, &vec) < 0)
    5.57 +	if ( vec == IA64_INVALID_VECTOR )
    5.58  		return;
    5.59  
    5.60  	desc = irq_descp(vec);
     6.1 --- a/xen/arch/x86/i8259.c	Wed Feb 11 16:36:59 2009 +0000
     6.2 +++ b/xen/arch/x86/i8259.c	Thu Feb 12 10:48:55 2009 +0000
     6.3 @@ -410,8 +410,8 @@ void __init init_IRQ(void)
     6.4      }
     6.5  
     6.6      /* Never allocate the hypercall vector or Linux/BSD fast-trap vector. */
     6.7 -    vector_irq[HYPERCALL_VECTOR] = NEVER_ASSIGN;
     6.8 -    vector_irq[0x80] = NEVER_ASSIGN;
     6.9 +    vector_irq[HYPERCALL_VECTOR] = NEVER_ASSIGN_IRQ;
    6.10 +    vector_irq[0x80] = NEVER_ASSIGN_IRQ;
    6.11  
    6.12      apic_intr_init();
    6.13  
     7.1 --- a/xen/arch/x86/irq.c	Wed Feb 11 16:36:59 2009 +0000
     7.2 +++ b/xen/arch/x86/irq.c	Thu Feb 12 10:48:55 2009 +0000
     7.3 @@ -29,7 +29,7 @@ irq_desc_t irq_desc[NR_VECTORS];
     7.4  
     7.5  static DEFINE_SPINLOCK(vector_lock);
     7.6  int vector_irq[NR_VECTORS] __read_mostly = {
     7.7 -    [0 ... NR_VECTORS - 1] = FREE_TO_ASSIGN
     7.8 +    [0 ... NR_VECTORS - 1] = FREE_TO_ASSIGN_IRQ
     7.9  };
    7.10  
    7.11  static void __do_IRQ_guest(int vector);
    7.12 @@ -66,11 +66,11 @@ int free_irq_vector(int vector)
    7.13      BUG_ON((vector > LAST_DYNAMIC_VECTOR) || (vector < FIRST_DYNAMIC_VECTOR));
    7.14  
    7.15      spin_lock(&vector_lock);
    7.16 -    if ((irq = vector_irq[vector]) == AUTO_ASSIGN)
    7.17 -        vector_irq[vector] = FREE_TO_ASSIGN;
    7.18 +    if ((irq = vector_irq[vector]) == AUTO_ASSIGN_IRQ)
    7.19 +        vector_irq[vector] = FREE_TO_ASSIGN_IRQ;
    7.20      spin_unlock(&vector_lock);
    7.21  
    7.22 -    return (irq == AUTO_ASSIGN) ? 0 : -EINVAL;
    7.23 +    return (irq == AUTO_ASSIGN_IRQ) ? 0 : -EINVAL;
    7.24  }
    7.25  
    7.26  int assign_irq_vector(int irq)
    7.27 @@ -82,13 +82,13 @@ int assign_irq_vector(int irq)
    7.28  
    7.29      spin_lock(&vector_lock);
    7.30  
    7.31 -    if ((irq != AUTO_ASSIGN) && (IO_APIC_VECTOR(irq) > 0)) {
    7.32 +    if ((irq != AUTO_ASSIGN_IRQ) && (IO_APIC_VECTOR(irq) > 0)) {
    7.33          spin_unlock(&vector_lock);
    7.34          return IO_APIC_VECTOR(irq);
    7.35      }
    7.36  
    7.37      vector = current_vector;
    7.38 -    while (vector_irq[vector] != FREE_TO_ASSIGN) {
    7.39 +    while (vector_irq[vector] != FREE_TO_ASSIGN_IRQ) {
    7.40          vector += 8;
    7.41          if (vector > LAST_DYNAMIC_VECTOR)
    7.42              vector = FIRST_DYNAMIC_VECTOR + ((vector + 1) & 7);
    7.43 @@ -101,7 +101,7 @@ int assign_irq_vector(int irq)
    7.44  
    7.45      current_vector = vector;
    7.46      vector_irq[vector] = irq;
    7.47 -    if (irq != AUTO_ASSIGN)
    7.48 +    if (irq != AUTO_ASSIGN_IRQ)
    7.49          IO_APIC_VECTOR(irq) = vector;
    7.50  
    7.51      spin_unlock(&vector_lock);
    7.52 @@ -159,7 +159,7 @@ asmlinkage void do_IRQ(struct cpu_user_r
    7.53      spin_unlock(&desc->lock);
    7.54  }
    7.55  
    7.56 -int request_irq(unsigned int irq,
    7.57 +int request_irq_vector(unsigned int vector,
    7.58          void (*handler)(int, void *, struct cpu_user_regs *),
    7.59          unsigned long irqflags, const char * devname, void *dev_id)
    7.60  {
    7.61 @@ -172,7 +172,7 @@ int request_irq(unsigned int irq,
    7.62       * which interrupt is which (messes up the interrupt freeing
    7.63       * logic etc).
    7.64       */
    7.65 -    if (irq >= NR_IRQS)
    7.66 +    if (vector >= NR_VECTORS)
    7.67          return -EINVAL;
    7.68      if (!handler)
    7.69          return -EINVAL;
    7.70 @@ -185,17 +185,16 @@ int request_irq(unsigned int irq,
    7.71      action->name = devname;
    7.72      action->dev_id = dev_id;
    7.73  
    7.74 -    retval = setup_irq(irq, action);
    7.75 +    retval = setup_irq_vector(vector, action);
    7.76      if (retval)
    7.77          xfree(action);
    7.78  
    7.79      return retval;
    7.80  }
    7.81  
    7.82 -void free_irq(unsigned int irq)
    7.83 +void release_irq_vector(unsigned int vector)
    7.84  {
    7.85 -    unsigned int  vector = irq_to_vector(irq);
    7.86 -    irq_desc_t   *desc = &irq_desc[vector];
    7.87 +    irq_desc_t *desc = &irq_desc[vector];
    7.88      unsigned long flags;
    7.89  
    7.90      spin_lock_irqsave(&desc->lock,flags);
    7.91 @@ -209,10 +208,9 @@ void free_irq(unsigned int irq)
    7.92      do { smp_mb(); } while ( desc->status & IRQ_INPROGRESS );
    7.93  }
    7.94  
    7.95 -int setup_irq(unsigned int irq, struct irqaction *new)
    7.96 +int setup_irq_vector(unsigned int vector, struct irqaction *new)
    7.97  {
    7.98 -    unsigned int  vector = irq_to_vector(irq);
    7.99 -    irq_desc_t   *desc = &irq_desc[vector];
   7.100 +    irq_desc_t *desc = &irq_desc[vector];
   7.101      unsigned long flags;
   7.102   
   7.103      spin_lock_irqsave(&desc->lock,flags);
     8.1 --- a/xen/arch/x86/physdev.c	Wed Feb 11 16:36:59 2009 +0000
     8.2 +++ b/xen/arch/x86/physdev.c	Thu Feb 12 10:48:55 2009 +0000
     8.3 @@ -75,7 +75,7 @@ static int physdev_map_pirq(struct physd
     8.4          case MAP_PIRQ_TYPE_MSI:
     8.5              vector = map->index;
     8.6              if ( vector == -1 )
     8.7 -                vector = assign_irq_vector(AUTO_ASSIGN);
     8.8 +                vector = assign_irq_vector(AUTO_ASSIGN_IRQ);
     8.9  
    8.10              if ( vector < 0 || vector >= NR_VECTORS )
    8.11              {
     9.1 --- a/xen/drivers/char/serial.c	Wed Feb 11 16:36:59 2009 +0000
     9.2 +++ b/xen/drivers/char/serial.c	Thu Feb 12 10:48:55 2009 +0000
     9.3 @@ -471,7 +471,7 @@ void serial_suspend(void)
     9.4      int i, irq;
     9.5      for ( i = 0; i < ARRAY_SIZE(com); i++ )
     9.6          if ( (irq = serial_irq(i)) >= 0 )
     9.7 -            free_irq(irq);
     9.8 +            release_irq(irq);
     9.9  }
    9.10  
    9.11  void serial_resume(void)
    10.1 --- a/xen/drivers/passthrough/amd/iommu_init.c	Wed Feb 11 16:36:59 2009 +0000
    10.2 +++ b/xen/drivers/passthrough/amd/iommu_init.c	Thu Feb 12 10:48:55 2009 +0000
    10.3 @@ -479,7 +479,7 @@ static int set_iommu_interrupt_handler(s
    10.4  {
    10.5      int vector, ret;
    10.6  
    10.7 -    vector = assign_irq_vector(AUTO_ASSIGN);
    10.8 +    vector = assign_irq_vector(AUTO_ASSIGN_IRQ);
    10.9      if ( vector <= 0 )
   10.10      {
   10.11          gdprintk(XENLOG_ERR VTDPREFIX, "IOMMU: no vectors\n");
   10.12 @@ -487,7 +487,8 @@ static int set_iommu_interrupt_handler(s
   10.13      }
   10.14  
   10.15      irq_desc[vector].handler = &iommu_msi_type;
   10.16 -    ret = request_irq(vector, amd_iommu_page_fault, 0, "amd_iommu", iommu);
   10.17 +    ret = request_irq_vector(vector, amd_iommu_page_fault, 0,
   10.18 +                             "amd_iommu", iommu);
   10.19      if ( ret )
   10.20      {
   10.21          irq_desc[vector].handler = &no_irq_type;
   10.22 @@ -497,7 +498,7 @@ static int set_iommu_interrupt_handler(s
   10.23      }
   10.24  
   10.25      /* Make sure that vector is never re-used. */
   10.26 -    vector_irq[vector] = NEVER_ASSIGN;
   10.27 +    vector_irq[vector] = NEVER_ASSIGN_IRQ;
   10.28      vector_to_iommu[vector] = iommu;
   10.29      iommu->vector = vector;
   10.30      return vector;
    11.1 --- a/xen/drivers/passthrough/vtd/ia64/vtd.c	Wed Feb 11 16:36:59 2009 +0000
    11.2 +++ b/xen/drivers/passthrough/vtd/ia64/vtd.c	Thu Feb 12 10:48:55 2009 +0000
    11.3 @@ -29,7 +29,9 @@
    11.4  #include "../vtd.h"
    11.5  
    11.6  
    11.7 -int vector_irq[NR_VECTORS] __read_mostly = { [0 ... NR_VECTORS - 1] = -1};
    11.8 +int vector_irq[NR_VECTORS] __read_mostly = {
    11.9 +    [0 ... NR_VECTORS - 1] = FREE_TO_ASSIGN_IRQ
   11.10 +};
   11.11  /* irq_vectors is indexed by the sum of all RTEs in all I/O APICs. */
   11.12  u8 irq_vector[NR_IRQS] __read_mostly;
   11.13  
    12.1 --- a/xen/drivers/passthrough/vtd/iommu.c	Wed Feb 11 16:36:59 2009 +0000
    12.2 +++ b/xen/drivers/passthrough/vtd/iommu.c	Thu Feb 12 10:48:55 2009 +0000
    12.3 @@ -874,7 +874,7 @@ int iommu_set_interrupt(struct iommu *io
    12.4  {
    12.5      int vector, ret;
    12.6  
    12.7 -    vector = assign_irq_vector(AUTO_ASSIGN);
    12.8 +    vector = assign_irq_vector(AUTO_ASSIGN_IRQ);
    12.9      if ( vector <= 0 )
   12.10      {
   12.11          gdprintk(XENLOG_ERR VTDPREFIX, "IOMMU: no vectors\n");
   12.12 @@ -882,7 +882,7 @@ int iommu_set_interrupt(struct iommu *io
   12.13      }
   12.14  
   12.15      irq_desc[vector].handler = &dma_msi_type;
   12.16 -    ret = request_irq(vector, iommu_page_fault, 0, "dmar", iommu);
   12.17 +    ret = request_irq_vector(vector, iommu_page_fault, 0, "dmar", iommu);
   12.18      if ( ret )
   12.19      {
   12.20          irq_desc[vector].handler = &no_irq_type;
   12.21 @@ -892,7 +892,7 @@ int iommu_set_interrupt(struct iommu *io
   12.22      }
   12.23  
   12.24      /* Make sure that vector is never re-used. */
   12.25 -    vector_irq[vector] = NEVER_ASSIGN;
   12.26 +    vector_irq[vector] = NEVER_ASSIGN_IRQ;
   12.27      vector_to_iommu[vector] = iommu;
   12.28  
   12.29      return vector;
   12.30 @@ -970,7 +970,7 @@ static void iommu_free(struct acpi_drhd_
   12.31          iounmap(iommu->reg);
   12.32  
   12.33      free_intel_iommu(iommu->intel);
   12.34 -    free_irq(iommu->vector);
   12.35 +    release_irq_vector(iommu->vector);
   12.36      xfree(iommu);
   12.37  
   12.38      drhd->iommu = NULL;
    13.1 --- a/xen/include/asm-ia64/hvm/iommu.h	Wed Feb 11 16:36:59 2009 +0000
    13.2 +++ b/xen/include/asm-ia64/hvm/iommu.h	Thu Feb 12 10:48:55 2009 +0000
    13.3 @@ -28,10 +28,6 @@ static inline void pci_cleanup_msi(struc
    13.4      /* TODO */
    13.5  }
    13.6  
    13.7 -/* Special IRQ numbers */
    13.8 -#define AUTO_ASSIGN     (-1)
    13.9 -#define NEVER_ASSIGN    (-2)
   13.10 -#define FREE_TO_ASSIGN  (-3)
   13.11  
   13.12  extern int assign_irq_vector (int irq);
   13.13  
    14.1 --- a/xen/include/asm-ia64/hvm/irq.h	Wed Feb 11 16:36:59 2009 +0000
    14.2 +++ b/xen/include/asm-ia64/hvm/irq.h	Thu Feb 12 10:48:55 2009 +0000
    14.3 @@ -90,14 +90,18 @@ struct hvm_irq {
    14.4  #define hvm_pci_intx_link(dev, intx) \
    14.5      (((dev) + (intx)) & 3)
    14.6  
    14.7 -/* Extract the IA-64 vector that corresponds to IRQ.  */
    14.8 -static inline int
    14.9 -irq_to_vector (int irq)
   14.10 +#define IA64_INVALID_VECTOR	((unsigned int)((int)-1))
   14.11 +static inline unsigned int irq_to_vector(int irq)
   14.12  {
   14.13 -    return irq;
   14.14 +    int acpi_gsi_to_irq (u32 gsi, unsigned int *irq);
   14.15 +    unsigned int vector;
   14.16 +
   14.17 +    if ( acpi_gsi_to_irq(irq, &vector) < 0)
   14.18 +        return 0;
   14.19 +
   14.20 +    return vector;
   14.21  }
   14.22  
   14.23 -
   14.24  extern u8 irq_vector[NR_IRQS];
   14.25  extern int vector_irq[NR_VECTORS];
   14.26  
    15.1 --- a/xen/include/asm-ia64/linux-xen/linux/interrupt.h	Wed Feb 11 16:36:59 2009 +0000
    15.2 +++ b/xen/include/asm-ia64/linux-xen/linux/interrupt.h	Thu Feb 12 10:48:55 2009 +0000
    15.3 @@ -52,10 +52,10 @@ struct irqaction {
    15.4  };
    15.5  
    15.6  extern irqreturn_t no_action(int cpl, void *dev_id, struct pt_regs *regs);
    15.7 -extern int request_irq(unsigned int,
    15.8 +extern int request_irq_vector(unsigned int,
    15.9  		       irqreturn_t (*handler)(int, void *, struct pt_regs *),
   15.10  		       unsigned long, const char *, void *);
   15.11 -extern void free_irq(unsigned int, void *);
   15.12 +extern void release_irq_vector(unsigned int, void *);
   15.13  #endif
   15.14  
   15.15  
    16.1 --- a/xen/include/asm-ia64/linux/asm/hw_irq.h	Wed Feb 11 16:36:59 2009 +0000
    16.2 +++ b/xen/include/asm-ia64/linux/asm/hw_irq.h	Thu Feb 12 10:48:55 2009 +0000
    16.3 @@ -34,7 +34,7 @@ typedef u8 ia64_vector;
    16.4  #define IA64_MAX_VECTORED_IRQ		255
    16.5  #define IA64_NUM_VECTORS		256
    16.6  
    16.7 -#define AUTO_ASSIGN			-1
    16.8 +#define AUTO_ASSIGN_IRQ			(-1)
    16.9  
   16.10  #define IA64_SPURIOUS_INT_VECTOR	0x0f
   16.11  
    17.1 --- a/xen/include/asm-x86/irq.h	Wed Feb 11 16:36:59 2009 +0000
    17.2 +++ b/xen/include/asm-x86/irq.h	Thu Feb 12 10:48:55 2009 +0000
    17.3 @@ -19,9 +19,6 @@
    17.4  
    17.5  extern int vector_irq[NR_VECTORS];
    17.6  extern u8 irq_vector[NR_IRQS];
    17.7 -#define AUTO_ASSIGN    -1
    17.8 -#define NEVER_ASSIGN   -2
    17.9 -#define FREE_TO_ASSIGN -3
   17.10  
   17.11  #define platform_legacy_irq(irq)	((irq) < 16)
   17.12  
    18.1 --- a/xen/include/xen/irq.h	Wed Feb 11 16:36:59 2009 +0000
    18.2 +++ b/xen/include/xen/irq.h	Thu Feb 12 10:48:55 2009 +0000
    18.3 @@ -25,6 +25,11 @@ struct irqaction
    18.4  #define IRQ_GUEST_EOI_PENDING 32 /* IRQ was disabled, pending a guest EOI */
    18.5  #define IRQ_PER_CPU     256     /* IRQ is per CPU */
    18.6  
    18.7 +/* Special IRQ numbers. */
    18.8 +#define AUTO_ASSIGN_IRQ         (-1)
    18.9 +#define NEVER_ASSIGN_IRQ        (-2)
   18.10 +#define FREE_TO_ASSIGN_IRQ      (-3)
   18.11 +
   18.12  /*
   18.13   * Interrupt controller descriptor. This is all we need
   18.14   * to describe about the low-level hardware. 
   18.15 @@ -64,12 +69,21 @@ typedef struct {
   18.16  
   18.17  extern irq_desc_t irq_desc[NR_VECTORS];
   18.18  
   18.19 -extern int setup_irq(unsigned int, struct irqaction *);
   18.20 -extern void free_irq(unsigned int);
   18.21 -extern int request_irq(unsigned int irq,
   18.22 +extern int setup_irq_vector(unsigned int, struct irqaction *);
   18.23 +extern void release_irq_vector(unsigned int);
   18.24 +extern int request_irq_vector(unsigned int vector,
   18.25                 void (*handler)(int, void *, struct cpu_user_regs *),
   18.26                 unsigned long irqflags, const char * devname, void *dev_id);
   18.27  
   18.28 +#define setup_irq(irq, action) \
   18.29 +    setup_irq_vector(irq_to_vector(irq), action)
   18.30 +
   18.31 +#define release_irq(irq) \
   18.32 +    release_irq_vector(irq_to_vector(irq))
   18.33 +
   18.34 +#define request_irq(irq, handler, irqflags, devname, devid) \
   18.35 +    request_irq_vector(irq_to_vector(irq), handler, irqflags, defname, devid)
   18.36 +
   18.37  extern hw_irq_controller no_irq_type;
   18.38  extern void no_action(int cpl, void *dev_id, struct cpu_user_regs *regs);
   18.39