ixdp425_pci.c (164426) | ixdp425_pci.c (177456) |
---|---|
1/* $NetBSD: ixdp425_pci.c,v 1.5 2005/12/11 12:17:09 christos Exp $ */ 2/* 3 * Copyright (c) 2003 4 * Ichiro FUKUHARA <ichiro@ichiro.org>. 5 * All rights reserved. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions --- 19 unchanged lines hidden (view full) --- 28 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 29 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 30 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 31 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 32 * SUCH DAMAGE. 33 */ 34 35#include <sys/cdefs.h> | 1/* $NetBSD: ixdp425_pci.c,v 1.5 2005/12/11 12:17:09 christos Exp $ */ 2/* 3 * Copyright (c) 2003 4 * Ichiro FUKUHARA <ichiro@ichiro.org>. 5 * All rights reserved. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions --- 19 unchanged lines hidden (view full) --- 28 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 29 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 30 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 31 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 32 * SUCH DAMAGE. 33 */ 34 35#include <sys/cdefs.h> |
36__FBSDID("$FreeBSD: head/sys/arm/xscale/ixp425/ixdp425_pci.c 164426 2006-11-19 23:55:23Z sam $"); | 36__FBSDID("$FreeBSD: head/sys/arm/xscale/ixp425/ixdp425_pci.c 177456 2008-03-20 15:54:19Z sam $"); |
37 38#define _ARM32_BUS_DMA_PRIVATE 39#include <sys/param.h> 40#include <sys/systm.h> 41#include <sys/bus.h> 42#include <sys/kernel.h> 43#include <sys/module.h> 44#include <sys/malloc.h> --- 89 unchanged lines hidden (view full) --- 134 pci_sc->sc_irq_rman.rm_descr = "IXP425 PCI IRQs"; 135 CTASSERT(PCI_INT_D < PCI_INT_A); 136 /* XXX this overlaps the irq's setup in ixp425_attach */ 137 if (rman_init(&pci_sc->sc_irq_rman) != 0 || 138 rman_manage_region(&pci_sc->sc_irq_rman, PCI_INT_D, PCI_INT_A) != 0) 139 panic("ixp425_md_attach: failed to set up IRQ rman"); 140} 141 | 37 38#define _ARM32_BUS_DMA_PRIVATE 39#include <sys/param.h> 40#include <sys/systm.h> 41#include <sys/bus.h> 42#include <sys/kernel.h> 43#include <sys/module.h> 44#include <sys/malloc.h> --- 89 unchanged lines hidden (view full) --- 134 pci_sc->sc_irq_rman.rm_descr = "IXP425 PCI IRQs"; 135 CTASSERT(PCI_INT_D < PCI_INT_A); 136 /* XXX this overlaps the irq's setup in ixp425_attach */ 137 if (rman_init(&pci_sc->sc_irq_rman) != 0 || 138 rman_manage_region(&pci_sc->sc_irq_rman, PCI_INT_D, PCI_INT_A) != 0) 139 panic("ixp425_md_attach: failed to set up IRQ rman"); 140} 141 |
142#define IXP425_MAX_DEV 4 | 142#define IXP425_MAX_DEV 5 |
143#define IXP425_MAX_LINE 4 144 145int 146ixp425_md_route_interrupt(device_t bridge, device_t device, int pin) 147{ | 143#define IXP425_MAX_LINE 4 144 145int 146ixp425_md_route_interrupt(device_t bridge, device_t device, int pin) 147{ |
148 static int ixp425_pci_table[IXP425_MAX_DEV][IXP425_MAX_LINE] = 149 { | 148 static int ixp425_pci_table[IXP425_MAX_DEV][IXP425_MAX_LINE] = { |
150 {PCI_INT_A, PCI_INT_B, PCI_INT_C, PCI_INT_D}, 151 {PCI_INT_B, PCI_INT_C, PCI_INT_D, PCI_INT_A}, 152 {PCI_INT_C, PCI_INT_D, PCI_INT_A, PCI_INT_B}, 153 {PCI_INT_D, PCI_INT_A, PCI_INT_B, PCI_INT_C}, | 149 {PCI_INT_A, PCI_INT_B, PCI_INT_C, PCI_INT_D}, 150 {PCI_INT_B, PCI_INT_C, PCI_INT_D, PCI_INT_A}, 151 {PCI_INT_C, PCI_INT_D, PCI_INT_A, PCI_INT_B}, 152 {PCI_INT_D, PCI_INT_A, PCI_INT_B, PCI_INT_C}, |
153 /* NB: for optional USB controller on Gateworks Avila */ 154 {PCI_INT_A, PCI_INT_B, PCI_INT_C, PCI_INT_D}, |
|
154 }; 155 int dev; 156 157 dev = pci_get_slot(device); 158 if (bootverbose) 159 device_printf(bridge, "routing pin %d for %s\n", pin, 160 device_get_nameunit(device)); 161 if (pin >= 1 && pin <= IXP425_MAX_LINE && 162 dev >= 1 && dev <= IXP425_MAX_DEV) { 163 return (ixp425_pci_table[dev - 1][pin - 1]); 164 } else 165 printf("ixppcib: no mapping for %d/%d/%d\n", 166 pci_get_bus(device), dev, pci_get_function(device)); 167 168 return (-1); 169} | 155 }; 156 int dev; 157 158 dev = pci_get_slot(device); 159 if (bootverbose) 160 device_printf(bridge, "routing pin %d for %s\n", pin, 161 device_get_nameunit(device)); 162 if (pin >= 1 && pin <= IXP425_MAX_LINE && 163 dev >= 1 && dev <= IXP425_MAX_DEV) { 164 return (ixp425_pci_table[dev - 1][pin - 1]); 165 } else 166 printf("ixppcib: no mapping for %d/%d/%d\n", 167 pci_get_bus(device), dev, pci_get_function(device)); 168 169 return (-1); 170} |