diff options
author | mdodd <mdodd@FreeBSD.org> | 2004-01-15 02:42:20 +0000 |
---|---|---|
committer | mdodd <mdodd@FreeBSD.org> | 2004-01-15 02:42:20 +0000 |
commit | 5a24570752af1016a359842690d5849bb03e911c (patch) | |
tree | f1e9f1c97649bda5416d7c8ee49a86d990b4690d /sys/dev/ida/ida.c | |
parent | f76d668175b28f4720aaffb6aa97b784948f060a (diff) | |
download | FreeBSD-src-5a24570752af1016a359842690d5849bb03e911c.zip FreeBSD-src-5a24570752af1016a359842690d5849bb03e911c.tar.gz |
Insure values of adapter structure members are in correct byte order.
Diffstat (limited to 'sys/dev/ida/ida.c')
-rw-r--r-- | sys/dev/ida/ida.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/sys/dev/ida/ida.c b/sys/dev/ida/ida.c index c2460ad..2ada0ed 100644 --- a/sys/dev/ida/ida.c +++ b/sys/dev/ida/ida.c @@ -43,6 +43,7 @@ __FBSDID("$FreeBSD$"); #include <sys/bio.h> #include <sys/bus.h> #include <sys/conf.h> +#include <sys/endian.h> #include <machine/bus_memio.h> #include <machine/bus_pio.h> @@ -307,12 +308,12 @@ ida_setup_dmamap(void *arg, bus_dma_segment_t *segs, int nsegments, int error) struct ida_hardware_qcb *hwqcb = (struct ida_hardware_qcb *)arg; int i; - hwqcb->hdr.size = (sizeof(struct ida_req) + - sizeof(struct ida_sgb) * IDA_NSEG) >> 2; + hwqcb->hdr.size = htole16((sizeof(struct ida_req) + + sizeof(struct ida_sgb) * IDA_NSEG) >> 2); for (i = 0; i < nsegments; i++) { - hwqcb->seg[i].addr = segs[i].ds_addr; - hwqcb->seg[i].length = segs[i].ds_len; + hwqcb->seg[i].addr = htole32(segs[i].ds_addr); + hwqcb->seg[i].length = htole32(segs[i].ds_len); } hwqcb->req.sgcount = nsegments; } @@ -345,8 +346,8 @@ ida_command(struct ida_softc *ida, int command, void *data, int datasize, bus_dmamap_sync(ida->buffer_dmat, qcb->dmamap, op); hwqcb->hdr.drive = drive; - hwqcb->req.blkno = pblkno; - hwqcb->req.bcount = howmany(datasize, DEV_BSIZE); + hwqcb->req.blkno = htole32(pblkno); + hwqcb->req.bcount = htole16(howmany(datasize, DEV_BSIZE)); hwqcb->req.command = command; qcb->flags = flags | IDA_COMMAND; |