Lines Matching +full:irq +full:- +full:device
6 * Copyright (C) 2005-2009, 2010 Cavium Networks
15 #include <asm/octeon/cvmx-npi-defs.h>
16 #include <asm/octeon/cvmx-pci-defs.h>
17 #include <asm/octeon/cvmx-npei-defs.h>
18 #include <asm/octeon/cvmx-sli-defs.h>
19 #include <asm/octeon/cvmx-pexp-defs.h>
20 #include <asm/octeon/pci-octeon.h>
29 * Each bit in msi_multiple_irq_bitmask tells that the device using
31 * is used so we can disable all of the MSI interrupts when a device
49 * arch_setup_msi_irq() - setup MSI IRQs for a device
50 * @dev: Device requesting MSI interrupts
54 * legacy INT A-D. This routine will allocate multiple interrupts
55 * for MSI devices that support them. A device can override this by
59 * Return: %0 on success, non-%0 on error.
67 int irq = 0; in arch_setup_msi_irq() local
72 if (desc->pci.msi_attrib.is_msix) in arch_setup_msi_irq()
73 return -EINVAL; in arch_setup_msi_irq()
76 * Read the MSI config to figure out how many IRQs this device in arch_setup_msi_irq()
80 pci_read_config_word(dev, dev->msi_cap + PCI_MSI_FLAGS, &control); in arch_setup_msi_irq()
103 * interrupts. If this device asks for more, only give it one. in arch_setup_msi_irq()
115 /* Mask with one bit for each IRQ */ in arch_setup_msi_irq()
116 search_mask = (1 << irq_step) - 1; in arch_setup_msi_irq()
125 for (irq = 0; irq < 64; irq += irq_step) { in arch_setup_msi_irq()
126 if ((msi_free_irq_bitmask[index] & (search_mask << irq)) == 0) { in arch_setup_msi_irq()
127 msi_free_irq_bitmask[index] |= search_mask << irq; in arch_setup_msi_irq()
128 msi_multiple_irq_bitmask[index] |= (search_mask >> 1) << irq; in arch_setup_msi_irq()
137 if (irq >= 64) { in arch_setup_msi_irq()
147 /* MSI interrupts start at logical IRQ OCTEON_IRQ_MSI_BIT0 */ in arch_setup_msi_irq()
148 irq += index*64; in arch_setup_msi_irq()
149 irq += OCTEON_IRQ_MSI_BIT0; in arch_setup_msi_irq()
177 msg.data = irq - OCTEON_IRQ_MSI_BIT0; in arch_setup_msi_irq()
179 /* Update the number of IRQs the device has available to it */ in arch_setup_msi_irq()
182 pci_write_config_word(dev, dev->msi_cap + PCI_MSI_FLAGS, control); in arch_setup_msi_irq()
184 irq_set_msi_desc(irq, desc); in arch_setup_msi_irq()
185 pci_write_msi_msg(irq, &msg); in arch_setup_msi_irq()
190 * arch_teardown_msi_irq() - release MSI IRQs for a device
191 * @irq: The devices first irq number. There may be multiple in sequence.
193 * Called when a device no longer needs its MSI interrupts. All
194 * MSI interrupts for the device are freed.
196 void arch_teardown_msi_irq(unsigned int irq) in arch_teardown_msi_irq() argument
203 if ((irq < OCTEON_IRQ_MSI_BIT0) in arch_teardown_msi_irq()
204 || (irq > msi_irq_size + OCTEON_IRQ_MSI_BIT0)) in arch_teardown_msi_irq()
206 "MSI interrupt (%d)", irq); in arch_teardown_msi_irq()
208 irq -= OCTEON_IRQ_MSI_BIT0; in arch_teardown_msi_irq()
209 index = irq / 64; in arch_teardown_msi_irq()
210 irq0 = irq % 64; in arch_teardown_msi_irq()
215 * IRQ is also owned by this device. in arch_teardown_msi_irq()
223 /* Mask with one bit for each IRQ */ in arch_teardown_msi_irq()
224 bitmask = (1 << number_irqs) - 1; in arch_teardown_msi_irq()
229 "interrupt (%d) not in use", irq); in arch_teardown_msi_irq()
247 int msi_number = data->irq - OCTEON_IRQ_MSI_BIT0; in octeon_irq_msi_enable_pcie()
263 int msi_number = data->irq - OCTEON_IRQ_MSI_BIT0; in octeon_irq_msi_disable_pcie()
309 int irq; in __octeon_msi_do_interrupt() local
314 bit--; in __octeon_msi_do_interrupt()
318 irq = bit + OCTEON_IRQ_MSI_BIT0 + 64 * index; in __octeon_msi_do_interrupt()
319 do_IRQ(irq); in __octeon_msi_do_interrupt()
333 * Create octeon_msi_interrupt{0-3} function body
345 int irq; in octeon_msi_initialize() local
373 for (irq = OCTEON_IRQ_MSI_BIT0; irq <= OCTEON_IRQ_MSI_LAST; irq++) in octeon_msi_initialize()
374 irq_set_chip_and_handler(irq, msi, handle_simple_irq); in octeon_msi_initialize()