psycho.c (104075) | psycho.c (105274) |
---|---|
1/* 2 * Copyright (c) 1999, 2000 Matthew R. Green 3 * All rights reserved. 4 * Copyright 2001 by Thomas Moestl <tmm@FreeBSD.org>. All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 14 unchanged lines hidden (view full) --- 23 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 24 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 25 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 * SUCH DAMAGE. 28 * 29 * from: NetBSD: psycho.c,v 1.39 2001/10/07 20:30:41 eeh Exp 30 * | 1/* 2 * Copyright (c) 1999, 2000 Matthew R. Green 3 * All rights reserved. 4 * Copyright 2001 by Thomas Moestl <tmm@FreeBSD.org>. All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 14 unchanged lines hidden (view full) --- 23 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 24 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 25 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 * SUCH DAMAGE. 28 * 29 * from: NetBSD: psycho.c,v 1.39 2001/10/07 20:30:41 eeh Exp 30 * |
31 * $FreeBSD: head/sys/sparc64/pci/psycho.c 104075 2002-09-28 03:06:35Z jake $ | 31 * $FreeBSD: head/sys/sparc64/pci/psycho.c 105274 2002-10-16 17:03:36Z tmm $ |
32 */ 33 34/* 35 * Support for `psycho' and `psycho+' UPA to PCI bridge and 36 * UltraSPARC IIi and IIe `sabre' PCI controllers. 37 */ 38 39#include "opt_psycho.h" --- 132 unchanged lines hidden (view full) --- 172 psycho_methods, 173 sizeof(struct psycho_softc), 174}; 175 176static devclass_t psycho_devclass; 177 178DRIVER_MODULE(psycho, nexus, psycho_driver, psycho_devclass, 0, 0); 179 | 32 */ 33 34/* 35 * Support for `psycho' and `psycho+' UPA to PCI bridge and 36 * UltraSPARC IIi and IIe `sabre' PCI controllers. 37 */ 38 39#include "opt_psycho.h" --- 132 unchanged lines hidden (view full) --- 172 psycho_methods, 173 sizeof(struct psycho_softc), 174}; 175 176static devclass_t psycho_devclass; 177 178DRIVER_MODULE(psycho, nexus, psycho_driver, psycho_devclass, 0, 0); 179 |
180static int psycho_ndevs; 181static struct psycho_softc *psycho_softcs[4]; | 180SLIST_HEAD(, psycho_softc) psycho_softcs = 181 SLIST_HEAD_INITIALIZER(psycho_softcs); |
182 183struct psycho_clr { 184 struct psycho_softc *pci_sc; 185 bus_addr_t pci_clr; /* clear register */ 186 driver_intr_t *pci_handler; /* handler to call */ 187 void *pci_arg; /* argument for the handler */ 188 void *pci_cookie; /* interrupt cookie of parent bus */ 189}; --- 166 unchanged lines hidden (view full) --- 356 pcictl_offs = sc->sc_basepaddr + PSR_PCICTL0; 357 } 358 359 /* 360 * Match other psycho's that are already configured against 361 * the base physical address. This will be the same for a 362 * pair of devices that share register space. 363 */ | 182 183struct psycho_clr { 184 struct psycho_softc *pci_sc; 185 bus_addr_t pci_clr; /* clear register */ 186 driver_intr_t *pci_handler; /* handler to call */ 187 void *pci_arg; /* argument for the handler */ 188 void *pci_cookie; /* interrupt cookie of parent bus */ 189}; --- 166 unchanged lines hidden (view full) --- 356 pcictl_offs = sc->sc_basepaddr + PSR_PCICTL0; 357 } 358 359 /* 360 * Match other psycho's that are already configured against 361 * the base physical address. This will be the same for a 362 * pair of devices that share register space. 363 */ |
364 for (n = 0; n < psycho_ndevs && n < sizeof(psycho_softcs) / 365 sizeof(psycho_softcs[0]); n++) { 366 asc = (struct psycho_softc *)psycho_softcs[n]; 367 368 if (asc == NULL || asc == sc) 369 /* This entry is not there or it is me */ 370 continue; 371 372 if (asc->sc_basepaddr != sc->sc_basepaddr) 373 /* This is an unrelated psycho */ 374 continue; 375 376 /* Found partner */ 377 osc = asc; 378 break; | 364 SLIST_FOREACH(asc, &psycho_softcs, sc_link) { 365 if (asc->sc_basepaddr == sc->sc_basepaddr) { 366 /* Found partner */ 367 osc = asc; 368 break; 369 } |
379 } 380 381 if (osc == NULL) { 382 rid = 0; 383 sc->sc_mem_res = bus_alloc_resource(dev, SYS_RES_MEMORY, &rid, 384 sc->sc_basepaddr, sc->sc_basepaddr + mlen - 1, mlen, 385 RF_ACTIVE); 386 if (sc->sc_mem_res == NULL || --- 81 unchanged lines hidden (view full) --- 468 sc->sc_dmat->dmamap_unload = psycho_dmamap_unload; 469 sc->sc_dmat->dmamap_sync = psycho_dmamap_sync; 470 sc->sc_dmat->dmamem_alloc = psycho_dmamem_alloc; 471 sc->sc_dmat->dmamem_free = psycho_dmamem_free; 472 /* XXX: register as root dma tag (kluge). */ 473 sparc64_root_dma_tag = sc->sc_dmat; 474 475 /* Register the softc, this is needed for paired psychos. */ | 370 } 371 372 if (osc == NULL) { 373 rid = 0; 374 sc->sc_mem_res = bus_alloc_resource(dev, SYS_RES_MEMORY, &rid, 375 sc->sc_basepaddr, sc->sc_basepaddr + mlen - 1, mlen, 376 RF_ACTIVE); 377 if (sc->sc_mem_res == NULL || --- 81 unchanged lines hidden (view full) --- 459 sc->sc_dmat->dmamap_unload = psycho_dmamap_unload; 460 sc->sc_dmat->dmamap_sync = psycho_dmamap_sync; 461 sc->sc_dmat->dmamem_alloc = psycho_dmamem_alloc; 462 sc->sc_dmat->dmamem_free = psycho_dmamem_free; 463 /* XXX: register as root dma tag (kluge). */ 464 sparc64_root_dma_tag = sc->sc_dmat; 465 466 /* Register the softc, this is needed for paired psychos. */ |
476 if (psycho_ndevs < sizeof(psycho_softcs) / sizeof(psycho_softcs[0])) 477 psycho_softcs[psycho_ndevs] = sc; 478 else 479 device_printf(dev, "XXX: bump the number of psycho_softcs"); 480 psycho_ndevs++; | 467 SLIST_INSERT_HEAD(&psycho_softcs, sc, sc_link); 468 |
481 /* 482 * And finally, if we're a sabre or the first of a pair of psycho's to 483 * arrive here, start up the IOMMU and get a config space tag. 484 */ 485 if (osc == NULL) { 486 /* 487 * Establish handlers for interesting interrupts.... 488 * --- 895 unchanged lines hidden --- | 469 /* 470 * And finally, if we're a sabre or the first of a pair of psycho's to 471 * arrive here, start up the IOMMU and get a config space tag. 472 */ 473 if (osc == NULL) { 474 /* 475 * Establish handlers for interesting interrupts.... 476 * --- 895 unchanged lines hidden --- |