/*-
* Copyright (c) 1999 by Ross Harvey. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by Ross Harvey.
* 4. The name of Ross Harvey may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY ROSS HARVEY ``AS IS'' AND ANY EXPRESS
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURP0SE
* ARE DISCLAIMED. IN NO EVENT SHALL ROSS HARVEY BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
*/
/*
* Some Tsunami models have a PCI device (the USB controller) with interrupts
* tied to ISA IRQ lines. The IRQ is encoded as:
*
* line = 0xe0 | isa_irq;
*/
#define DEC_6600_LINE_IS_ISA(line) ((line) >= 0xe0 && (line) <= 0xef)
#define DEC_6600_LINE_ISA_IRQ(line) ((line) & 0x0f)
static void dec_6600_intr_enable(pci_chipset_tag_t, int irq);
static void dec_6600_intr_disable(pci_chipset_tag_t, int irq);
static void dec_6600_intr_set_affinity(pci_chipset_tag_t, int,
struct cpu_info *);
static void dec_6600_intr_program(pci_chipset_tag_t);
static void dec_6600_intr_redistribute(void);
/*
* We keep 2 software copies of the interrupt enables: one global one,
* and one per-CPU for setting the interrupt affinity.
*/
static uint64_t dec_6600_intr_enables __read_mostly;
static uint64_t dec_6600_cpu_intr_enables[4] __read_mostly;
/*
* The console places the interrupt mapping in the "line" value.
* A value of (char)-1 indicates there is no mapping.
*/
if (line == 0xff) {
printf("dec_6600_intr_map: no mapping for %d/%d/%d\n",
bus, device, function);
return (1);
}
#if NSIO == 0
if (DEC_6600_LINE_IS_ISA(line)) {
printf("dec_6600_intr_map: ISA IRQ %d for %d/%d/%d\n",
DEC_6600_LINE_ISA_IRQ(line), bus, device, function);
return (1);
}
#endif
if (DEC_6600_LINE_IS_ISA(line) == 0 && line >= PCI_NIRQ)
panic("dec_6600_intr_map: dec 6600 irq too large (%d)",
line);
/*
* We have to determine if this is an ISA IRQ or not! We do this
* by checking to see if the intrhand points back to an intrhead
* that points to the sioprimary TSP. If not, it's an ISA IRQ.
* Pretty disgusting, eh?
*/
if (ih->ih_intrhead->intr_private != sioprimary) {
sio_intr_disestablish(NULL /*XXX*/, cookie);
return;
}
#endif