psycho.c (170851) | psycho.c (170930) |
---|---|
1/*- 2 * Copyright (c) 1999, 2000 Matthew R. Green 3 * Copyright (c) 2001 - 2003 by Thomas Moestl <tmm@FreeBSD.org> 4 * Copyright (c) 2005 - 2006 Marius Strobl <marius@FreeBSD.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 --- 17 unchanged lines hidden (view full) --- 26 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 27 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28 * SUCH DAMAGE. 29 * 30 * from: NetBSD: psycho.c,v 1.39 2001/10/07 20:30:41 eeh Exp 31 */ 32 33#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 1999, 2000 Matthew R. Green 3 * Copyright (c) 2001 - 2003 by Thomas Moestl <tmm@FreeBSD.org> 4 * Copyright (c) 2005 - 2006 Marius Strobl <marius@FreeBSD.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 --- 17 unchanged lines hidden (view full) --- 26 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 27 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28 * SUCH DAMAGE. 29 * 30 * from: NetBSD: psycho.c,v 1.39 2001/10/07 20:30:41 eeh Exp 31 */ 32 33#include <sys/cdefs.h> |
34__FBSDID("$FreeBSD: head/sys/sparc64/pci/psycho.c 170851 2007-06-16 23:46:41Z marius $"); | 34__FBSDID("$FreeBSD: head/sys/sparc64/pci/psycho.c 170930 2007-06-18 21:49:42Z marius $"); |
35 36/* 37 * Support for `Hummingbird' (UltraSPARC IIe), `Psycho' and `Psycho+' 38 * (UltraSPARC II) and `Sabre' (UltraSPARC IIi) UPA to PCI bridges. 39 */ 40 41#include "opt_ofw_pci.h" 42#include "opt_psycho.h" --- 72 unchanged lines hidden (view full) --- 115static bus_release_resource_t psycho_release_resource; 116static bus_get_dma_tag_t psycho_get_dma_tag; 117static pcib_maxslots_t psycho_maxslots; 118static pcib_read_config_t psycho_read_config; 119static pcib_write_config_t psycho_write_config; 120static pcib_route_interrupt_t psycho_route_interrupt; 121static ofw_pci_intr_pending_t psycho_intr_pending; 122static ofw_bus_get_node_t psycho_get_node; | 35 36/* 37 * Support for `Hummingbird' (UltraSPARC IIe), `Psycho' and `Psycho+' 38 * (UltraSPARC II) and `Sabre' (UltraSPARC IIi) UPA to PCI bridges. 39 */ 40 41#include "opt_ofw_pci.h" 42#include "opt_psycho.h" --- 72 unchanged lines hidden (view full) --- 115static bus_release_resource_t psycho_release_resource; 116static bus_get_dma_tag_t psycho_get_dma_tag; 117static pcib_maxslots_t psycho_maxslots; 118static pcib_read_config_t psycho_read_config; 119static pcib_write_config_t psycho_write_config; 120static pcib_route_interrupt_t psycho_route_interrupt; 121static ofw_pci_intr_pending_t psycho_intr_pending; 122static ofw_bus_get_node_t psycho_get_node; |
123static ofw_pci_alloc_busno_t psycho_alloc_busno; |
|
123static ofw_pci_adjust_busrange_t psycho_adjust_busrange; 124 125static device_method_t psycho_methods[] = { 126 /* Device interface */ 127 DEVMETHOD(device_probe, psycho_probe), 128 DEVMETHOD(device_attach, psycho_attach), 129 DEVMETHOD(device_shutdown, bus_generic_shutdown), 130 DEVMETHOD(device_suspend, bus_generic_suspend), --- 16 unchanged lines hidden (view full) --- 147 DEVMETHOD(pcib_write_config, psycho_write_config), 148 DEVMETHOD(pcib_route_interrupt, psycho_route_interrupt), 149 150 /* ofw_bus interface */ 151 DEVMETHOD(ofw_bus_get_node, psycho_get_node), 152 153 /* ofw_pci interface */ 154 DEVMETHOD(ofw_pci_intr_pending, psycho_intr_pending), | 124static ofw_pci_adjust_busrange_t psycho_adjust_busrange; 125 126static device_method_t psycho_methods[] = { 127 /* Device interface */ 128 DEVMETHOD(device_probe, psycho_probe), 129 DEVMETHOD(device_attach, psycho_attach), 130 DEVMETHOD(device_shutdown, bus_generic_shutdown), 131 DEVMETHOD(device_suspend, bus_generic_suspend), --- 16 unchanged lines hidden (view full) --- 148 DEVMETHOD(pcib_write_config, psycho_write_config), 149 DEVMETHOD(pcib_route_interrupt, psycho_route_interrupt), 150 151 /* ofw_bus interface */ 152 DEVMETHOD(ofw_bus_get_node, psycho_get_node), 153 154 /* ofw_pci interface */ 155 DEVMETHOD(ofw_pci_intr_pending, psycho_intr_pending), |
156 DEVMETHOD(ofw_pci_alloc_busno, psycho_alloc_busno), |
|
155 DEVMETHOD(ofw_pci_adjust_busrange, psycho_adjust_busrange), 156 157 { 0, 0 } 158}; 159 160static driver_t psycho_driver = { 161 "pcib", 162 psycho_methods, 163 sizeof(struct psycho_softc), 164}; 165 166static devclass_t psycho_devclass; 167 168DRIVER_MODULE(psycho, nexus, psycho_driver, psycho_devclass, 0, 0); 169 | 157 DEVMETHOD(ofw_pci_adjust_busrange, psycho_adjust_busrange), 158 159 { 0, 0 } 160}; 161 162static driver_t psycho_driver = { 163 "pcib", 164 psycho_methods, 165 sizeof(struct psycho_softc), 166}; 167 168static devclass_t psycho_devclass; 169 170DRIVER_MODULE(psycho, nexus, psycho_driver, psycho_devclass, 0, 0); 171 |
170SLIST_HEAD(, psycho_softc) psycho_softcs = | 172static SLIST_HEAD(, psycho_softc) psycho_softcs = |
171 SLIST_HEAD_INITIALIZER(psycho_softcs); 172 | 173 SLIST_HEAD_INITIALIZER(psycho_softcs); 174 |
175static uint8_t psycho_pci_bus_cnt; 176 |
|
173struct psycho_clr { 174 struct psycho_softc *pci_sc; 175 bus_addr_t pci_clr; /* clear register */ 176 driver_filter_t *pci_filter; /* filter to call */ 177 driver_intr_t *pci_handler; /* handler to call */ 178 void *pci_arg; /* argument for the handler */ 179 void *pci_cookie; /* parent bus int. cookie */ 180 device_t pci_ppb; /* farest PCI-PCI bridge */ --- 443 unchanged lines hidden (view full) --- 624 625 /* 626 * Set the latency timer register as this isn't always done by the 627 * firmware. 628 */ 629 PCIB_WRITE_CONFIG(dev, psycho_br[0], PCS_DEVICE, PCS_FUNC, 630 PCIR_LATTIMER, 64, 1); 631 | 177struct psycho_clr { 178 struct psycho_softc *pci_sc; 179 bus_addr_t pci_clr; /* clear register */ 180 driver_filter_t *pci_filter; /* filter to call */ 181 driver_intr_t *pci_handler; /* handler to call */ 182 void *pci_arg; /* argument for the handler */ 183 void *pci_cookie; /* parent bus int. cookie */ 184 device_t pci_ppb; /* farest PCI-PCI bridge */ --- 443 unchanged lines hidden (view full) --- 628 629 /* 630 * Set the latency timer register as this isn't always done by the 631 * firmware. 632 */ 633 PCIB_WRITE_CONFIG(dev, psycho_br[0], PCS_DEVICE, PCS_FUNC, 634 PCIR_LATTIMER, 64, 1); 635 |
632 sc->sc_pci_secbus = sc->sc_pci_subbus = ofw_pci_alloc_busno(node); | 636 sc->sc_pci_secbus = sc->sc_pci_subbus = psycho_alloc_busno(dev); |
633 /* 634 * Program the bus range registers. 635 * NOTE: for the Psycho, the second write changes the bus number the 636 * Psycho itself uses for it's configuration space, so these 637 * writes must be kept in this order! 638 * The Hummingbird/Sabre always uses bus 0, but there only can be one 639 * Hummingbird/Sabre per machine. 640 */ --- 660 unchanged lines hidden (view full) --- 1301{ 1302 struct psycho_softc *sc; 1303 1304 sc = device_get_softc(bus); 1305 /* We only have one child, the PCI bus, which needs our own node. */ 1306 return (sc->sc_node); 1307} 1308 | 637 /* 638 * Program the bus range registers. 639 * NOTE: for the Psycho, the second write changes the bus number the 640 * Psycho itself uses for it's configuration space, so these 641 * writes must be kept in this order! 642 * The Hummingbird/Sabre always uses bus 0, but there only can be one 643 * Hummingbird/Sabre per machine. 644 */ --- 660 unchanged lines hidden (view full) --- 1305{ 1306 struct psycho_softc *sc; 1307 1308 sc = device_get_softc(bus); 1309 /* We only have one child, the PCI bus, which needs our own node. */ 1310 return (sc->sc_node); 1311} 1312 |
1313static int 1314psycho_alloc_busno(device_t dev) 1315{ 1316 1317 if (psycho_pci_bus_cnt == PCI_BUSMAX) 1318 panic("%s: out of PCI bus numbers", __func__); 1319 return (psycho_pci_bus_cnt++); 1320} 1321 |
|
1309static void 1310psycho_adjust_busrange(device_t dev, u_int subbus) 1311{ 1312 struct psycho_softc *sc; 1313 1314 sc = device_get_softc(dev); 1315 /* If necessary, adjust the subordinate bus number register. */ 1316 if (subbus > sc->sc_pci_subbus) { --- 25 unchanged lines hidden --- | 1322static void 1323psycho_adjust_busrange(device_t dev, u_int subbus) 1324{ 1325 struct psycho_softc *sc; 1326 1327 sc = device_get_softc(dev); 1328 /* If necessary, adjust the subordinate bus number register. */ 1329 if (subbus > sc->sc_pci_subbus) { --- 25 unchanged lines hidden --- |