diff options
Diffstat (limited to 'sys/dev')
-rw-r--r-- | sys/dev/pci/hifn7751.c | 87 |
1 files changed, 46 insertions, 41 deletions
diff --git a/sys/dev/pci/hifn7751.c b/sys/dev/pci/hifn7751.c index ca847d8b0cf..cf0ffc79801 100644 --- a/sys/dev/pci/hifn7751.c +++ b/sys/dev/pci/hifn7751.c @@ -1,4 +1,4 @@ -/* $OpenBSD: hifn7751.c,v 1.108 2001/11/12 18:04:06 jason Exp $ */ +/* $OpenBSD: hifn7751.c,v 1.109 2001/11/12 19:32:23 jason Exp $ */ /* * Invertex AEON / Hifn 7751 driver @@ -837,10 +837,10 @@ hifn_writeramaddr(sc, addr, data, slot) const u_int32_t masks = HIFN_D_VALID | HIFN_D_LAST | HIFN_D_MASKDONEIRQ; int r; - wc.masks = 3 << 13; - wc.session_num = addr >> 14; - wc.total_source_count = 8; - wc.total_dest_count = addr & 0x3fff;; + wc.masks = htole16(3 << 13); + wc.session_num = htole16(addr >> 14); + wc.total_source_count = htole16(8); + wc.total_dest_count = htole16(addr & 0x3fff); WRITE_REG_1(sc, HIFN_1_DMA_CSR, HIFN_DMACSR_C_CTRL_ENA | HIFN_DMACSR_S_CTRL_ENA | @@ -851,15 +851,15 @@ hifn_writeramaddr(sc, addr, data, slot) *(hifn_base_command_t *)dma->command_bufs[slot] = wc; bcopy(data, &dma->test_src, sizeof(dma->test_src)); - dma->srcr[slot].p = sc->sc_dmamap->dm_segs[0].ds_addr - + offsetof(struct hifn_dma, test_src); - dma->dstr[slot].p = sc->sc_dmamap->dm_segs[0].ds_addr - + offsetof(struct hifn_dma, test_dst); + dma->srcr[slot].p = htole32(sc->sc_dmamap->dm_segs[0].ds_addr + + offsetof(struct hifn_dma, test_src)); + dma->dstr[slot].p = htole32(sc->sc_dmamap->dm_segs[0].ds_addr + + offsetof(struct hifn_dma, test_dst)); - dma->cmdr[slot].l = 16 | masks; - dma->srcr[slot].l = 8 | masks; - dma->dstr[slot].l = 4 | masks; - dma->resr[slot].l = 4 | masks; + dma->cmdr[slot].l = htole32(16 | masks); + dma->srcr[slot].l = htole32(8 | masks); + dma->dstr[slot].l = htole32(4 | masks); + dma->resr[slot].l = htole32(4 | masks); bus_dmamap_sync(sc->sc_dmat, sc->sc_dmamap, 0, sc->sc_dmamap->dm_mapsize, @@ -871,14 +871,14 @@ hifn_writeramaddr(sc, addr, data, slot) 0, sc->sc_dmamap->dm_mapsize, BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE); - if (dma->resr[slot].l & HIFN_D_VALID) { + if (letoh32(dma->resr[slot].l) & HIFN_D_VALID) { printf("\n%s: writeramaddr error -- " "result[%d](addr %d) valid still set\n", sc->sc_dv.dv_xname, slot, addr); r = -1; return (-1); } else - r = 0; + r = 0; WRITE_REG_1(sc, HIFN_1_DMA_CSR, HIFN_DMACSR_C_CTRL_DIS | HIFN_DMACSR_S_CTRL_DIS | @@ -898,10 +898,10 @@ hifn_readramaddr(sc, addr, data, slot) const u_int32_t masks = HIFN_D_VALID | HIFN_D_LAST | HIFN_D_MASKDONEIRQ; int r; - rc.masks = 2 << 13; - rc.session_num = addr >> 14; - rc.total_source_count = addr & 0x3fff; - rc.total_dest_count = 8; + rc.masks = htole16(2 << 13); + rc.session_num = htole16(addr >> 14); + rc.total_source_count = htole16(addr & 0x3fff); + rc.total_dest_count = htole16(8); WRITE_REG_1(sc, HIFN_1_DMA_CSR, HIFN_DMACSR_C_CTRL_ENA | HIFN_DMACSR_S_CTRL_ENA | @@ -910,16 +910,16 @@ hifn_readramaddr(sc, addr, data, slot) bzero(dma->command_bufs[slot], HIFN_MAX_COMMAND); *(hifn_base_command_t *)dma->command_bufs[slot] = rc; - dma->srcr[slot].p = sc->sc_dmamap->dm_segs[0].ds_addr + - offsetof(struct hifn_dma, test_src); + dma->srcr[slot].p = htole32(sc->sc_dmamap->dm_segs[0].ds_addr + + offsetof(struct hifn_dma, test_src)); dma->test_src = 0; - dma->dstr[slot].p = sc->sc_dmamap->dm_segs[0].ds_addr + - offsetof(struct hifn_dma, test_dst); + dma->dstr[slot].p = htole32(sc->sc_dmamap->dm_segs[0].ds_addr + + offsetof(struct hifn_dma, test_dst)); dma->test_dst = 0; - dma->cmdr[slot].l = 8 | masks; - dma->srcr[slot].l = 8 | masks; - dma->dstr[slot].l = 8 | masks; - dma->resr[slot].l = HIFN_MAX_RESULT | masks; + dma->cmdr[slot].l = htole32(8 | masks); + dma->srcr[slot].l = htole32(8 | masks); + dma->dstr[slot].l = htole32(8 | masks); + dma->resr[slot].l = htole32(HIFN_MAX_RESULT | masks); bus_dmamap_sync(sc->sc_dmat, sc->sc_dmamap, 0, sc->sc_dmamap->dm_mapsize, @@ -931,7 +931,7 @@ hifn_readramaddr(sc, addr, data, slot) 0, sc->sc_dmamap->dm_mapsize, BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE); - if (dma->resr[slot].l & HIFN_D_VALID) { + if (letoh32(dma->resr[slot].l) & HIFN_D_VALID) { printf("\n%s: readramaddr error -- " "result[%d](addr %d) valid still set\n", sc->sc_dv.dv_xname, slot, addr); @@ -965,20 +965,25 @@ hifn_init_dma(sc) /* initialize static pointer values */ for (i = 0; i < HIFN_D_CMD_RSIZE; i++) - dma->cmdr[i].p = sc->sc_dmamap->dm_segs[0].ds_addr + - offsetof(struct hifn_dma, command_bufs[i][0]); + dma->cmdr[i].p = htole32(sc->sc_dmamap->dm_segs[0].ds_addr + + offsetof(struct hifn_dma, command_bufs[i][0])); for (i = 0; i < HIFN_D_RES_RSIZE; i++) - dma->resr[i].p = sc->sc_dmamap->dm_segs[0].ds_addr + - offsetof(struct hifn_dma, result_bufs[i][0]); - - dma->cmdr[HIFN_D_CMD_RSIZE].p = sc->sc_dmamap->dm_segs[0].ds_addr - + offsetof(struct hifn_dma, cmdr[0]); - dma->srcr[HIFN_D_SRC_RSIZE].p = sc->sc_dmamap->dm_segs[0].ds_addr - + offsetof(struct hifn_dma, srcr[0]); - dma->dstr[HIFN_D_DST_RSIZE].p = sc->sc_dmamap->dm_segs[0].ds_addr - + offsetof(struct hifn_dma, dstr[0]); - dma->resr[HIFN_D_RES_RSIZE].p = sc->sc_dmamap->dm_segs[0].ds_addr - + offsetof(struct hifn_dma, resr[0]); + dma->resr[i].p = htole32(sc->sc_dmamap->dm_segs[0].ds_addr + + offsetof(struct hifn_dma, result_bufs[i][0])); + + dma->cmdr[HIFN_D_CMD_RSIZE].p = + htole32(sc->sc_dmamap->dm_segs[0].ds_addr + + offsetof(struct hifn_dma, cmdr[0])); + dma->srcr[HIFN_D_SRC_RSIZE].p = + htole32(sc->sc_dmamap->dm_segs[0].ds_addr + + offsetof(struct hifn_dma, srcr[0])); + dma->dstr[HIFN_D_DST_RSIZE].p = + htole32(sc->sc_dmamap->dm_segs[0].ds_addr + + offsetof(struct hifn_dma, dstr[0])); + dma->resr[HIFN_D_RES_RSIZE].p = + htole32(sc->sc_dmamap->dm_segs[0].ds_addr + + offsetof(struct hifn_dma, resr[0])); + dma->cmdu = dma->srcu = dma->dstu = dma->resu = 0; dma->cmdi = dma->srci = dma->dsti = dma->resi = 0; dma->cmdk = dma->srck = dma->dstk = dma->resk = 0; |