Deleted Added
full compact
80c80
< __FBSDID("$FreeBSD: head/sys/dev/ti/if_ti.c 142407 2005-02-24 22:33:05Z imp $");
---
> __FBSDID("$FreeBSD: head/sys/dev/ti/if_ti.c 143903 2005-03-21 07:17:27Z scottl $");
1830a1831,1832
> #define TI_RD_OFF(x) offsetof(struct ti_ring_data, x)
>
1841a1844
> uint32_t rdphys;
1843a1847
> rdphys = sc->ti_rdata_phys;
1848c1852,1857
< /* Tell the chip where to find the general information block. */
---
> /*
> * Tell the chip where to find the general information block.
> * While this struct could go into >4GB memory, we allocate it in a
> * single slab with the other descriptors, and those don't seem to
> * support being located in a 64-bit region.
> */
1850c1859
< CSR_WRITE_4(sc, TI_GCR_GENINFO_LO, vtophys(&sc->ti_rdata->ti_info));
---
> CSR_WRITE_4(sc, TI_GCR_GENINFO_LO, rdphys + TI_RD_OFF(ti_info));
1860c1869
< TI_HOSTADDR(rcb->ti_hostaddr) = vtophys(&sc->ti_rdata->ti_event_ring);
---
> TI_HOSTADDR(rcb->ti_hostaddr) = rdphys + TI_RD_OFF(ti_event_ring);
1863c1872
< vtophys(&sc->ti_ev_prodidx);
---
> rdphys + TI_RD_OFF(ti_ev_prodidx_r);
1889c1898
< vtophys(&sc->ti_rdata->ti_info.ti_stats);
---
> rdphys + TI_RD_OFF(ti_info.ti_stats);
1893c1902
< TI_HOSTADDR(rcb->ti_hostaddr) = vtophys(&sc->ti_rdata->ti_rx_std_ring);
---
> TI_HOSTADDR(rcb->ti_hostaddr) = rdphys + TI_RD_OFF(ti_rx_std_ring);
1903,1904c1912
< TI_HOSTADDR(rcb->ti_hostaddr) =
< vtophys(&sc->ti_rdata->ti_rx_jumbo_ring);
---
> TI_HOSTADDR(rcb->ti_hostaddr) = rdphys + TI_RD_OFF(ti_rx_jumbo_ring);
1924,1925c1932
< TI_HOSTADDR(rcb->ti_hostaddr) =
< vtophys(&sc->ti_rdata->ti_rx_mini_ring);
---
> TI_HOSTADDR(rcb->ti_hostaddr) = rdphys + TI_RD_OFF(ti_rx_mini_ring);
1940,1941c1947
< TI_HOSTADDR(rcb->ti_hostaddr) =
< vtophys(&sc->ti_rdata->ti_rx_return_ring);
---
> TI_HOSTADDR(rcb->ti_hostaddr) = rdphys + TI_RD_OFF(ti_rx_return_ring);
1945c1951
< vtophys(&sc->ti_return_prodidx);
---
> rdphys + TI_RD_OFF(ti_return_prodidx_r);
1976,1977c1982
< TI_HOSTADDR(rcb->ti_hostaddr) =
< vtophys(&sc->ti_rdata->ti_tx_ring);
---
> TI_HOSTADDR(rcb->ti_hostaddr) = rdphys + TI_RD_OFF(ti_tx_ring);
1979c1984
< vtophys(&sc->ti_tx_considx);
---
> rdphys + TI_RD_OFF(ti_tx_considx_r);
2004a2010,2026
> static void
> ti_rdata_cb(void *arg, bus_dma_segment_t *segs, int nseg, int error)
> {
> struct ti_softc *sc;
>
> sc = arg;
> if (error || nseg != 1)
> return;
>
> /*
> * All of the Tigon data structures need to live at <4GB. This
> * cast is fine since busdma was told about this constraint.
> */
> sc->ti_rdata_phys = (uint32_t)segs[0].ds_addr;
> return;
> }
>
2111,2112c2133,2147
< sc->ti_rdata = contigmalloc(sizeof(struct ti_ring_data), M_DEVBUF,
< M_NOWAIT, 0, 0xffffffff, PAGE_SIZE, 0);
---
> if (bus_dma_tag_create(NULL, /* parent */
> 1, 0, /* algnmnt, boundary */
> BUS_SPACE_MAXADDR, /* lowaddr */
> BUS_SPACE_MAXADDR, /* highaddr */
> NULL, NULL, /* filter, filterarg */
> BUS_SPACE_MAXSIZE_32BIT,/* maxsize */
> 0, /* nsegments */
> BUS_SPACE_MAXSIZE_32BIT,/* maxsegsize */
> 0, /* flags */
> NULL, NULL, /* lockfunc, lockarg */
> &sc->ti_parent_dmat) != 0) {
> printf("ti%d: Failed to allocate parent dmat\n", sc->ti_unit);
> error = ENOMEM;
> goto fail;
> }
2114,2116c2149,2161
< if (sc->ti_rdata == NULL) {
< printf("ti%d: no memory for list buffers!\n", sc->ti_unit);
< error = ENXIO;
---
> if (bus_dma_tag_create(sc->ti_parent_dmat, /* parent */
> PAGE_SIZE, 0, /* algnmnt, boundary */
> BUS_SPACE_MAXADDR_32BIT,/* lowaddr */
> BUS_SPACE_MAXADDR, /* highaddr */
> NULL, NULL, /* filter, filterarg */
> sizeof(struct ti_ring_data), /* maxsize */
> 1, /* nsegments */
> sizeof(struct ti_ring_data), /* maxsegsize */
> 0, /* flags */
> NULL, NULL, /* lockfunc, lockarg */
> &sc->ti_rdata_dmat) != 0) {
> printf("ti%d: Failed to allocate rdata dmat\n", sc->ti_unit);
> error = ENOMEM;
2119a2165,2179
> if (bus_dmamem_alloc(sc->ti_rdata_dmat, (void**)&sc->ti_rdata,
> BUS_DMA_NOWAIT, &sc->ti_rdata_dmamap) != 0) {
> printf("ti%d: Failed to allocate rdata memory\n", sc->ti_unit);
> error = ENOMEM;
> goto fail;
> }
>
> if (bus_dmamap_load(sc->ti_rdata_dmat, sc->ti_rdata_dmamap,
> sc->ti_rdata, sizeof(struct ti_ring_data),
> ti_rdata_cb, sc, BUS_DMA_NOWAIT) != 0) {
> printf("ti%d: Failed to load rdata segments\n", sc->ti_unit);
> error = ENOMEM;
> goto fail;
> }
>
2262a2323,2329
> if (sc->ti_rdata)
> bus_dmamem_free(sc->ti_rdata_dmat, sc->ti_rdata,
> sc->ti_rdata_dmamap);
> if (sc->ti_rdata_dmat)
> bus_dma_tag_destroy(sc->ti_rdata_dmat);
> if (sc->ti_parent_dmat)
> bus_dma_tag_destroy(sc->ti_parent_dmat);