Deleted Added
full compact
psycho.c (108800) psycho.c (108815)
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 108800 2003-01-06 16:51:06Z tmm $
31 * $FreeBSD: head/sys/sparc64/pci/psycho.c 108815 2003-01-06 19:43:10Z 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"

--- 440 unchanged lines hidden (view full) ---

480 /* allocate our tags */
481 sc->sc_memt = psycho_alloc_bus_tag(sc, PCI_MEMORY_BUS_SPACE);
482 sc->sc_iot = psycho_alloc_bus_tag(sc, PCI_IO_BUS_SPACE);
483 sc->sc_cfgt = psycho_alloc_bus_tag(sc, PCI_CONFIG_BUS_SPACE);
484 if (bus_dma_tag_create(sc->sc_dmatag, 8, 1, 0, 0x3ffffffff, NULL, NULL,
485 0x3ffffffff, 0xff, 0xffffffff, 0, &sc->sc_dmat) != 0)
486 panic("psycho_attach: bus_dma_tag_create failed");
487 /* Customize the tag */
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"

--- 440 unchanged lines hidden (view full) ---

480 /* allocate our tags */
481 sc->sc_memt = psycho_alloc_bus_tag(sc, PCI_MEMORY_BUS_SPACE);
482 sc->sc_iot = psycho_alloc_bus_tag(sc, PCI_IO_BUS_SPACE);
483 sc->sc_cfgt = psycho_alloc_bus_tag(sc, PCI_CONFIG_BUS_SPACE);
484 if (bus_dma_tag_create(sc->sc_dmatag, 8, 1, 0, 0x3ffffffff, NULL, NULL,
485 0x3ffffffff, 0xff, 0xffffffff, 0, &sc->sc_dmat) != 0)
486 panic("psycho_attach: bus_dma_tag_create failed");
487 /* Customize the tag */
488 sc->sc_dmat->cookie = sc;
489 sc->sc_dmat->dmamap_create = psycho_dmamap_create;
490 sc->sc_dmat->dmamap_destroy = psycho_dmamap_destroy;
491 sc->sc_dmat->dmamap_load = psycho_dmamap_load;
492 sc->sc_dmat->dmamap_unload = psycho_dmamap_unload;
493 sc->sc_dmat->dmamap_sync = psycho_dmamap_sync;
494 sc->sc_dmat->dmamem_alloc = psycho_dmamem_alloc;
495 sc->sc_dmat->dmamem_free = psycho_dmamem_free;
488 sc->sc_dmat->dt_cookie = sc;
489 sc->sc_dmat->dt_dmamap_create = psycho_dmamap_create;
490 sc->sc_dmat->dt_dmamap_destroy = psycho_dmamap_destroy;
491 sc->sc_dmat->dt_dmamap_load = psycho_dmamap_load;
492 sc->sc_dmat->dt_dmamap_unload = psycho_dmamap_unload;
493 sc->sc_dmat->dt_dmamap_sync = psycho_dmamap_sync;
494 sc->sc_dmat->dt_dmamem_alloc = psycho_dmamem_alloc;
495 sc->sc_dmat->dt_dmamem_free = psycho_dmamem_free;
496 /* XXX: register as root dma tag (kluge). */
497 sparc64_root_dma_tag = sc->sc_dmat;
498
499 /* Register the softc, this is needed for paired psychos. */
500 SLIST_INSERT_HEAD(&psycho_softcs, sc, sc_link);
501
502 /*
503 * And finally, if we're a sabre or the first of a pair of psycho's to

--- 789 unchanged lines hidden (view full) ---

1293 bus_space_tag_t bt;
1294
1295 bt = (bus_space_tag_t)malloc(sizeof(struct bus_space_tag), M_DEVBUF,
1296 M_NOWAIT | M_ZERO);
1297 if (bt == NULL)
1298 panic("psycho_alloc_bus_tag: out of memory");
1299
1300 bzero(bt, sizeof *bt);
496 /* XXX: register as root dma tag (kluge). */
497 sparc64_root_dma_tag = sc->sc_dmat;
498
499 /* Register the softc, this is needed for paired psychos. */
500 SLIST_INSERT_HEAD(&psycho_softcs, sc, sc_link);
501
502 /*
503 * And finally, if we're a sabre or the first of a pair of psycho's to

--- 789 unchanged lines hidden (view full) ---

1293 bus_space_tag_t bt;
1294
1295 bt = (bus_space_tag_t)malloc(sizeof(struct bus_space_tag), M_DEVBUF,
1296 M_NOWAIT | M_ZERO);
1297 if (bt == NULL)
1298 panic("psycho_alloc_bus_tag: out of memory");
1299
1300 bzero(bt, sizeof *bt);
1301 bt->cookie = sc;
1302 bt->parent = sc->sc_bustag;
1303 bt->type = type;
1301 bt->bst_cookie = sc;
1302 bt->bst_parent = sc->sc_bustag;
1303 bt->bst_type = type;
1304 return (bt);
1305}
1306
1307/*
1308 * hooks into the iommu dvma calls.
1309 */
1310static int
1311psycho_dmamem_alloc(bus_dma_tag_t pdmat, bus_dma_tag_t ddmat, void **vaddr,
1312 int flags, bus_dmamap_t *mapp)
1313{
1314 struct psycho_softc *sc;
1315
1304 return (bt);
1305}
1306
1307/*
1308 * hooks into the iommu dvma calls.
1309 */
1310static int
1311psycho_dmamem_alloc(bus_dma_tag_t pdmat, bus_dma_tag_t ddmat, void **vaddr,
1312 int flags, bus_dmamap_t *mapp)
1313{
1314 struct psycho_softc *sc;
1315
1316 sc = (struct psycho_softc *)pdmat->cookie;
1316 sc = (struct psycho_softc *)pdmat->dt_cookie;
1317 return (iommu_dvmamem_alloc(pdmat, ddmat, sc->sc_is, vaddr, flags,
1318 mapp));
1319}
1320
1321static void
1322psycho_dmamem_free(bus_dma_tag_t pdmat, bus_dma_tag_t ddmat, void *vaddr,
1323 bus_dmamap_t map)
1324{
1325 struct psycho_softc *sc;
1326
1317 return (iommu_dvmamem_alloc(pdmat, ddmat, sc->sc_is, vaddr, flags,
1318 mapp));
1319}
1320
1321static void
1322psycho_dmamem_free(bus_dma_tag_t pdmat, bus_dma_tag_t ddmat, void *vaddr,
1323 bus_dmamap_t map)
1324{
1325 struct psycho_softc *sc;
1326
1327 sc = (struct psycho_softc *)pdmat->cookie;
1327 sc = (struct psycho_softc *)pdmat->dt_cookie;
1328 iommu_dvmamem_free(pdmat, ddmat, sc->sc_is, vaddr, map);
1329}
1330
1331static int
1332psycho_dmamap_create(bus_dma_tag_t pdmat, bus_dma_tag_t ddmat, int flags,
1333 bus_dmamap_t *mapp)
1334{
1335 struct psycho_softc *sc;
1336
1328 iommu_dvmamem_free(pdmat, ddmat, sc->sc_is, vaddr, map);
1329}
1330
1331static int
1332psycho_dmamap_create(bus_dma_tag_t pdmat, bus_dma_tag_t ddmat, int flags,
1333 bus_dmamap_t *mapp)
1334{
1335 struct psycho_softc *sc;
1336
1337 sc = (struct psycho_softc *)pdmat->cookie;
1337 sc = (struct psycho_softc *)pdmat->dt_cookie;
1338 return (iommu_dvmamap_create(pdmat, ddmat, sc->sc_is, flags, mapp));
1339
1340}
1341
1342static int
1343psycho_dmamap_destroy(bus_dma_tag_t pdmat, bus_dma_tag_t ddmat,
1344 bus_dmamap_t map)
1345{
1346 struct psycho_softc *sc;
1347
1338 return (iommu_dvmamap_create(pdmat, ddmat, sc->sc_is, flags, mapp));
1339
1340}
1341
1342static int
1343psycho_dmamap_destroy(bus_dma_tag_t pdmat, bus_dma_tag_t ddmat,
1344 bus_dmamap_t map)
1345{
1346 struct psycho_softc *sc;
1347
1348 sc = (struct psycho_softc *)pdmat->cookie;
1348 sc = (struct psycho_softc *)pdmat->dt_cookie;
1349 return (iommu_dvmamap_destroy(pdmat, ddmat, sc->sc_is, map));
1350}
1351
1352static int
1353psycho_dmamap_load(bus_dma_tag_t pdmat, bus_dma_tag_t ddmat, bus_dmamap_t map,
1354 void *buf, bus_size_t buflen, bus_dmamap_callback_t *callback,
1355 void *callback_arg, int flags)
1356{
1357 struct psycho_softc *sc;
1358
1349 return (iommu_dvmamap_destroy(pdmat, ddmat, sc->sc_is, map));
1350}
1351
1352static int
1353psycho_dmamap_load(bus_dma_tag_t pdmat, bus_dma_tag_t ddmat, bus_dmamap_t map,
1354 void *buf, bus_size_t buflen, bus_dmamap_callback_t *callback,
1355 void *callback_arg, int flags)
1356{
1357 struct psycho_softc *sc;
1358
1359 sc = (struct psycho_softc *)pdmat->cookie;
1359 sc = (struct psycho_softc *)pdmat->dt_cookie;
1360 return (iommu_dvmamap_load(pdmat, ddmat, sc->sc_is, map, buf, buflen,
1361 callback, callback_arg, flags));
1362}
1363
1364static void
1365psycho_dmamap_unload(bus_dma_tag_t pdmat, bus_dma_tag_t ddmat, bus_dmamap_t map)
1366{
1367 struct psycho_softc *sc;
1368
1360 return (iommu_dvmamap_load(pdmat, ddmat, sc->sc_is, map, buf, buflen,
1361 callback, callback_arg, flags));
1362}
1363
1364static void
1365psycho_dmamap_unload(bus_dma_tag_t pdmat, bus_dma_tag_t ddmat, bus_dmamap_t map)
1366{
1367 struct psycho_softc *sc;
1368
1369 sc = (struct psycho_softc *)pdmat->cookie;
1369 sc = (struct psycho_softc *)pdmat->dt_cookie;
1370 iommu_dvmamap_unload(pdmat, ddmat, sc->sc_is, map);
1371}
1372
1373static void
1374psycho_dmamap_sync(bus_dma_tag_t pdmat, bus_dma_tag_t ddmat, bus_dmamap_t map,
1375 bus_dmasync_op_t op)
1376{
1377 struct psycho_softc *sc;
1378
1370 iommu_dvmamap_unload(pdmat, ddmat, sc->sc_is, map);
1371}
1372
1373static void
1374psycho_dmamap_sync(bus_dma_tag_t pdmat, bus_dma_tag_t ddmat, bus_dmamap_t map,
1375 bus_dmasync_op_t op)
1376{
1377 struct psycho_softc *sc;
1378
1379 sc = (struct psycho_softc *)pdmat->cookie;
1379 sc = (struct psycho_softc *)pdmat->dt_cookie;
1380 iommu_dvmamap_sync(pdmat, ddmat, sc->sc_is, map, op);
1381}
1380 iommu_dvmamap_sync(pdmat, ddmat, sc->sc_is, map, op);
1381}