diff options
author | Constantine Sapuntzakis <csapuntz@cvs.openbsd.org> | 1999-10-29 16:40:23 +0000 |
---|---|---|
committer | Constantine Sapuntzakis <csapuntz@cvs.openbsd.org> | 1999-10-29 16:40:23 +0000 |
commit | 32279f3de9f8fa6dd4dcccde68242ff3024156fc (patch) | |
tree | 44152bcd1309e5b02ca7b67078bea65d89debe06 /sys/dev/ic | |
parent | 710d034c7a14f8cf07ba702ceeaf3fc0f6951ee5 (diff) |
Change wdc_input_bytes and wdc_output_bytes to use
bus_space_{read,write}_raw_* instead of the byte-swapping API. For
PowerPC and other big-endian architectures.
Diffstat (limited to 'sys/dev/ic')
-rw-r--r-- | sys/dev/ic/wdc.c | 39 |
1 files changed, 24 insertions, 15 deletions
diff --git a/sys/dev/ic/wdc.c b/sys/dev/ic/wdc.c index e5fb5b201b6..fb3fdaeff8a 100644 --- a/sys/dev/ic/wdc.c +++ b/sys/dev/ic/wdc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: wdc.c,v 1.12 1999/10/29 01:15:15 deraadt Exp $ */ +/* $OpenBSD: wdc.c,v 1.13 1999/10/29 16:40:22 csapuntz Exp $ */ /* $NetBSD: wdc.c,v 1.68 1999/06/23 19:00:17 bouyer Exp $ */ @@ -1010,23 +1010,27 @@ wdc_output_bytes(drvp, bytes, buflen) { struct channel_softc *chp = drvp->chnl_softc; unsigned int off = 0; - unsigned int len = buflen; + unsigned int len = buflen, roundlen; if (drvp->drive_flags & DRIVE_CAP32) { - bus_space_write_multi_4(chp->data32iot, + roundlen = len & ~3; + + bus_space_write_raw_multi_4(chp->data32iot, chp->data32ioh, wd_data, (void *)((u_int8_t *)bytes + off), - len >> 2); + roundlen); - off += ((len >> 2) << 2); - len = len & 0x03; + off += roundlen; + len -= roundlen; } if (len > 0) { - bus_space_write_multi_2(chp->cmd_iot, + roundlen = (len + 1) & ~0x1; + + bus_space_write_raw_multi_2(chp->cmd_iot, chp->cmd_ioh, wd_data, (void *)((u_int8_t *)bytes + off), - (len + 1) >> 1); + roundlen); } return; @@ -1040,22 +1044,27 @@ wdc_input_bytes(drvp, bytes, buflen) { struct channel_softc *chp = drvp->chnl_softc; unsigned int off = 0; - unsigned int len = buflen; + unsigned int len = buflen, roundlen; if (drvp->drive_flags & DRIVE_CAP32) { - bus_space_read_multi_4(chp->data32iot, + roundlen = len & ~3; + + bus_space_read_raw_multi_4(chp->data32iot, chp->data32ioh, wd_data, (void *)((u_int8_t *)bytes + off), - len >> 2); - off += ((len >> 2) << 2); - len = len & 0x03; + roundlen); + + off += roundlen; + len -= roundlen; } if (len > 0) { - bus_space_read_multi_2(chp->cmd_iot, + roundlen = (len + 1) & ~0x1; + + bus_space_read_raw_multi_2(chp->cmd_iot, chp->cmd_ioh, wd_data, (void *)((u_int8_t *)bytes + off), - (len + 1) >> 1); + roundlen); } return; |