/*
* Copyright (c) 2000 Soren S. Jorvang. 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.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS 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.
*/
/*
* PCI doesn't have any special needs; just use
* the generic versions of these functions.
*/
struct mips_bus_dma_tag pci_bus_dma_tag = {
._dmamap_ops = _BUS_DMAMAP_OPS_INITIALIZER,
._dmamem_ops = _BUS_DMAMEM_OPS_INITIALIZER,
._dmatag_ops = _BUS_DMATAG_OPS_INITIALIZER,
};
int
pci_intr_map(const struct pci_attach_args *pa, pci_intr_handle_t *ihp)
{
pci_chipset_tag_t pc = pa->pa_pc;
pcitag_t intrtag = pa->pa_intrtag;
int pin = pa->pa_intrpin;
int line = pa->pa_intrline;
int bus, dev, func;
/*
* The interrupt lines of the internal Tulips are connected
* directly to the CPU.
*/
if (cobalt_id == COBALT_ID_QUBE2700) {
if (bus == 0 && dev == 7 && pin == PCI_INTERRUPT_PIN_A) {
/* tulip is connected to CPU INT2 on Qube2700 */
*ihp = NICU_INT + 2;
return 0;
}
} else {
if (bus == 0 && dev == 7 && pin == PCI_INTERRUPT_PIN_A) {
/* the primary tulip is connected to CPU INT1 */
*ihp = NICU_INT + 1;
return 0;
}
if (bus == 0 && dev == 12 && pin == PCI_INTERRUPT_PIN_A) {
/* the secondary tulip is connected to CPU INT2 */
*ihp = NICU_INT + 2;
return 0;
}
}
/* sanity check */
if (line == 0 || line >= NICU_INT)
return -1;
/* Try both, only the valid one will disestablish. */
cpu_intr_disestablish(cookie);
icu_intr_disestablish(cookie);
}
void
pci_conf_interrupt(pci_chipset_tag_t pc, int bus, int dev, int pin, int swiz,
int *iline)
{
/*
* Use irq 9 on all devices on the Qube's PCI slot.
* XXX doesn't handle devices over PCI-PCI bridges
*/
if (bus == 0 && dev == 10 && pin != PCI_INTERRUPT_PIN_NONE)
*iline = 9;
}
int
pci_conf_hook(pci_chipset_tag_t pc, int bus, int dev, int func, pcireg_t id)
{