diff --git a/sys/dev/scsipi/cd.c b/sys/dev/scsipi/cd.c index e629e0b95620..913ad188e911 100644 --- a/sys/dev/scsipi/cd.c +++ b/sys/dev/scsipi/cd.c @@ -1,4 +1,4 @@ -/* $NetBSD: cd.c,v 1.67 1995/04/15 05:01:26 mycroft Exp $ */ +/* $NetBSD: cd.c,v 1.68 1995/05/03 19:38:45 mycroft Exp $ */ /* * Copyright (c) 1994, 1995 Charles M. Hannum. All rights reserved. @@ -537,12 +537,12 @@ cdstart(cd) */ bzero(&cmd, sizeof(cmd)); cmd.opcode = (bp->b_flags & B_READ) ? READ_BIG : WRITE_BIG; - cmd.addr_3 = (blkno & 0xff000000) >> 24; - cmd.addr_2 = (blkno & 0xff0000) >> 16; - cmd.addr_1 = (blkno & 0xff00) >> 8; + cmd.addr_3 = (blkno >> 24) & 0xff; + cmd.addr_2 = (blkno >> 16) & 0xff; + cmd.addr_1 = (blkno >> 8) & 0xff; cmd.addr_0 = blkno & 0xff; - cmd.length2 = (nblks & 0xff00) >> 8; - cmd.length1 = (nblks & 0xff); + cmd.length2 = (nblks >> 8) & 0xff; + cmd.length1 = nblks & 0xff; /* * Call the routine that chats with the adapter. @@ -1084,8 +1084,8 @@ cd_read_subchannel(cd, mode, format, track, data, len) scsi_cmd.byte3 = SRS_SUBQ; scsi_cmd.subchan_format = format; scsi_cmd.track = track; - scsi_cmd.data_len[0] = (len) >> 8; - scsi_cmd.data_len[1] = (len) & 0xff; + scsi_cmd.data_len[0] = (len >> 8) & 0xff; + scsi_cmd.data_len[1] = len & 0xff; return scsi_scsi_cmd(cd->sc_link, (struct scsi_generic *)&scsi_cmd, sizeof(struct scsi_read_subchannel), (u_char *)data, len, CDRETRIES, 5000, NULL, SCSI_DATA_IN); @@ -1112,8 +1112,8 @@ cd_read_toc(cd, mode, start, data, len) if (mode == CD_MSF_FORMAT) scsi_cmd.byte2 |= CD_MSF; scsi_cmd.from_track = start; - scsi_cmd.data_len[0] = (ntoc) >> 8; - scsi_cmd.data_len[1] = (ntoc) & 0xff; + scsi_cmd.data_len[0] = (ntoc >> 8) & 0xff; + scsi_cmd.data_len[1] = ntoc & 0xff; return scsi_scsi_cmd(cd->sc_link, (struct scsi_generic *)&scsi_cmd, sizeof(struct scsi_read_toc), (u_char *)data, len, CDRETRIES, 5000, NULL, SCSI_DATA_IN); diff --git a/sys/dev/scsipi/scsi_base.c b/sys/dev/scsipi/scsi_base.c index 919a8847008e..8a4fca6a3a9d 100644 --- a/sys/dev/scsipi/scsi_base.c +++ b/sys/dev/scsipi/scsi_base.c @@ -1,4 +1,4 @@ -/* $NetBSD: scsi_base.c,v 1.28 1995/01/26 12:05:51 mycroft Exp $ */ +/* $NetBSD: scsi_base.c,v 1.29 1995/05/03 19:38:57 mycroft Exp $ */ /* * Copyright (c) 1994, 1995 Charles Hannum. All rights reserved. @@ -754,8 +754,8 @@ lto3b(val, bytes) u_int8_t *bytes; { - *bytes++ = (val & 0xff0000) >> 16; - *bytes++ = (val & 0xff00) >> 8; + *bytes++ = (val >> 16) & 0xff; + *bytes++ = (val >> 8) & 0xff; *bytes = val & 0xff; } diff --git a/sys/dev/scsipi/sd.c b/sys/dev/scsipi/sd.c index 8566d05a95cd..33f18286c5e2 100644 --- a/sys/dev/scsipi/sd.c +++ b/sys/dev/scsipi/sd.c @@ -1,4 +1,4 @@ -/* $NetBSD: sd.c,v 1.68 1995/04/15 05:01:29 mycroft Exp $ */ +/* $NetBSD: sd.c,v 1.69 1995/05/03 19:39:05 mycroft Exp $ */ /* * Copyright (c) 1994, 1995 Charles M. Hannum. All rights reserved. @@ -541,12 +541,12 @@ sdstart(sd) */ bzero(&cmd, sizeof(cmd)); cmd.opcode = (bp->b_flags & B_READ) ? READ_BIG : WRITE_BIG; - cmd.addr_3 = (blkno & 0xff000000) >> 24; - cmd.addr_2 = (blkno & 0xff0000) >> 16; - cmd.addr_1 = (blkno & 0xff00) >> 8; + cmd.addr_3 = (blkno >> 24) & 0xff; + cmd.addr_2 = (blkno >> 16) & 0xff; + cmd.addr_1 = (blkno >> 8) & 0xff; cmd.addr_0 = blkno & 0xff; - cmd.length2 = (nblks & 0xff00) >> 8; - cmd.length1 = (nblks & 0xff); + cmd.length2 = (nblks >> 8) & 0xff; + cmd.length1 = nblks & 0xff; /* * Call the routine that chats with the adapter. @@ -741,10 +741,10 @@ sd_reassign_blocks(sd, block) rbdata.length_msb = 0; rbdata.length_lsb = sizeof(rbdata.defect_descriptor[0]); - rbdata.defect_descriptor[0].dlbaddr_3 = ((block >> 24) & 0xff); - rbdata.defect_descriptor[0].dlbaddr_2 = ((block >> 16) & 0xff); - rbdata.defect_descriptor[0].dlbaddr_1 = ((block >> 8) & 0xff); - rbdata.defect_descriptor[0].dlbaddr_0 = ((block) & 0xff); + rbdata.defect_descriptor[0].dlbaddr_3 = (block >> 24) & 0xff); + rbdata.defect_descriptor[0].dlbaddr_2 = (block >> 16) & 0xff); + rbdata.defect_descriptor[0].dlbaddr_1 = (block >> 8) & 0xff); + rbdata.defect_descriptor[0].dlbaddr_0 = block & 0xff; return scsi_scsi_cmd(sd->sc_link, (struct scsi_generic *)&scsi_cmd, sizeof(scsi_cmd), (u_char *)&rbdata, sizeof(rbdata), SDRETRIES, @@ -879,7 +879,7 @@ sddump(dev_t dev) register struct sd_softc *sd; /* disk unit to do the IO */ int32 num; /* number of sectors to write */ u_int32 unit, part; - int32 blkoff, blknum, blkcnt = MAXTRANSFER; + int32 blkoff, blkno, nblks = MAXTRANSFER; int32 nblocks; char *addr; struct scsi_rw_big cmd; @@ -926,7 +926,7 @@ sddump(dev_t dev) sddoingadump = 1; - blknum = dumplo + blkoff; + blkno = dumplo + blkoff; while (num > 0) { pmap_enter(pmap_kernel(), MAPTO, @@ -939,12 +939,12 @@ sddump(dev_t dev) */ bzero(&cmd, sizeof(cmd)); cmd.opcode = WRITE_BIG; - cmd.addr_3 = (blknum & 0xff000000) >> 24; - cmd.addr_2 = (blknum & 0xff0000) >> 16; - cmd.addr_1 = (blknum & 0xff00) >> 8; - cmd.addr_0 = blknum & 0xff; - cmd.length2 = (blkcnt & 0xff00) >> 8; - cmd.length1 = (blkcnt & 0xff); + cmd.addr_3 = (blkno >> 24) & 0xff; + cmd.addr_2 = (blkno >> 16) & 0xff; + cmd.addr_1 = (blkno >> 8) & 0xff; + cmd.addr_0 = blkno & 0xff; + cmd.length2 = (nblks >> 8) & 0xff; + cmd.length1 = nblks & 0xff; /* * Fill out the scsi_xfer structure * Note: we cannot sleep as we may be an interrupt @@ -958,11 +958,11 @@ sddump(dev_t dev) xs->timeout = 10000; /* 10000 millisecs for a disk ! */ xs->cmd = (struct scsi_generic *)&cmd; xs->cmdlen = sizeof(cmd); - xs->resid = blkcnt * 512; + xs->resid = nblks * 512; xs->error = XS_NOERROR; xs->bp = 0; xs->data = (u_char *) MAPTO; - xs->datalen = blkcnt * 512; + xs->datalen = nblks * 512; /* * Pass all this info to the scsi driver. @@ -972,15 +972,15 @@ sddump(dev_t dev) return ENXIO; #else /* NOT_TRUSTED */ /* lets just talk about this first... */ - printf("sd%d: dump addr 0x%x, blk %d\n", unit, addr, blknum); + printf("sd%d: dump addr 0x%x, blk %d\n", unit, addr, blkno); #endif /* NOT_TRUSTED */ if ((unsigned)addr % (1024 * 1024) == 0) printf("%d ", num / 2048); /* update block count */ - num -= blkcnt; - blknum += blkcnt; - (int)addr += 512 * blkcnt; + num -= nblks; + blkno += nblks; + (int)addr += 512 * nblks; /* operator aborting dump? */ if ((c = sgetc(1)) && (c != 0x100)) diff --git a/sys/scsi/cd.c b/sys/scsi/cd.c index e629e0b95620..913ad188e911 100644 --- a/sys/scsi/cd.c +++ b/sys/scsi/cd.c @@ -1,4 +1,4 @@ -/* $NetBSD: cd.c,v 1.67 1995/04/15 05:01:26 mycroft Exp $ */ +/* $NetBSD: cd.c,v 1.68 1995/05/03 19:38:45 mycroft Exp $ */ /* * Copyright (c) 1994, 1995 Charles M. Hannum. All rights reserved. @@ -537,12 +537,12 @@ cdstart(cd) */ bzero(&cmd, sizeof(cmd)); cmd.opcode = (bp->b_flags & B_READ) ? READ_BIG : WRITE_BIG; - cmd.addr_3 = (blkno & 0xff000000) >> 24; - cmd.addr_2 = (blkno & 0xff0000) >> 16; - cmd.addr_1 = (blkno & 0xff00) >> 8; + cmd.addr_3 = (blkno >> 24) & 0xff; + cmd.addr_2 = (blkno >> 16) & 0xff; + cmd.addr_1 = (blkno >> 8) & 0xff; cmd.addr_0 = blkno & 0xff; - cmd.length2 = (nblks & 0xff00) >> 8; - cmd.length1 = (nblks & 0xff); + cmd.length2 = (nblks >> 8) & 0xff; + cmd.length1 = nblks & 0xff; /* * Call the routine that chats with the adapter. @@ -1084,8 +1084,8 @@ cd_read_subchannel(cd, mode, format, track, data, len) scsi_cmd.byte3 = SRS_SUBQ; scsi_cmd.subchan_format = format; scsi_cmd.track = track; - scsi_cmd.data_len[0] = (len) >> 8; - scsi_cmd.data_len[1] = (len) & 0xff; + scsi_cmd.data_len[0] = (len >> 8) & 0xff; + scsi_cmd.data_len[1] = len & 0xff; return scsi_scsi_cmd(cd->sc_link, (struct scsi_generic *)&scsi_cmd, sizeof(struct scsi_read_subchannel), (u_char *)data, len, CDRETRIES, 5000, NULL, SCSI_DATA_IN); @@ -1112,8 +1112,8 @@ cd_read_toc(cd, mode, start, data, len) if (mode == CD_MSF_FORMAT) scsi_cmd.byte2 |= CD_MSF; scsi_cmd.from_track = start; - scsi_cmd.data_len[0] = (ntoc) >> 8; - scsi_cmd.data_len[1] = (ntoc) & 0xff; + scsi_cmd.data_len[0] = (ntoc >> 8) & 0xff; + scsi_cmd.data_len[1] = ntoc & 0xff; return scsi_scsi_cmd(cd->sc_link, (struct scsi_generic *)&scsi_cmd, sizeof(struct scsi_read_toc), (u_char *)data, len, CDRETRIES, 5000, NULL, SCSI_DATA_IN); diff --git a/sys/scsi/scsi_base.c b/sys/scsi/scsi_base.c index 919a8847008e..8a4fca6a3a9d 100644 --- a/sys/scsi/scsi_base.c +++ b/sys/scsi/scsi_base.c @@ -1,4 +1,4 @@ -/* $NetBSD: scsi_base.c,v 1.28 1995/01/26 12:05:51 mycroft Exp $ */ +/* $NetBSD: scsi_base.c,v 1.29 1995/05/03 19:38:57 mycroft Exp $ */ /* * Copyright (c) 1994, 1995 Charles Hannum. All rights reserved. @@ -754,8 +754,8 @@ lto3b(val, bytes) u_int8_t *bytes; { - *bytes++ = (val & 0xff0000) >> 16; - *bytes++ = (val & 0xff00) >> 8; + *bytes++ = (val >> 16) & 0xff; + *bytes++ = (val >> 8) & 0xff; *bytes = val & 0xff; } diff --git a/sys/scsi/sd.c b/sys/scsi/sd.c index 8566d05a95cd..33f18286c5e2 100644 --- a/sys/scsi/sd.c +++ b/sys/scsi/sd.c @@ -1,4 +1,4 @@ -/* $NetBSD: sd.c,v 1.68 1995/04/15 05:01:29 mycroft Exp $ */ +/* $NetBSD: sd.c,v 1.69 1995/05/03 19:39:05 mycroft Exp $ */ /* * Copyright (c) 1994, 1995 Charles M. Hannum. All rights reserved. @@ -541,12 +541,12 @@ sdstart(sd) */ bzero(&cmd, sizeof(cmd)); cmd.opcode = (bp->b_flags & B_READ) ? READ_BIG : WRITE_BIG; - cmd.addr_3 = (blkno & 0xff000000) >> 24; - cmd.addr_2 = (blkno & 0xff0000) >> 16; - cmd.addr_1 = (blkno & 0xff00) >> 8; + cmd.addr_3 = (blkno >> 24) & 0xff; + cmd.addr_2 = (blkno >> 16) & 0xff; + cmd.addr_1 = (blkno >> 8) & 0xff; cmd.addr_0 = blkno & 0xff; - cmd.length2 = (nblks & 0xff00) >> 8; - cmd.length1 = (nblks & 0xff); + cmd.length2 = (nblks >> 8) & 0xff; + cmd.length1 = nblks & 0xff; /* * Call the routine that chats with the adapter. @@ -741,10 +741,10 @@ sd_reassign_blocks(sd, block) rbdata.length_msb = 0; rbdata.length_lsb = sizeof(rbdata.defect_descriptor[0]); - rbdata.defect_descriptor[0].dlbaddr_3 = ((block >> 24) & 0xff); - rbdata.defect_descriptor[0].dlbaddr_2 = ((block >> 16) & 0xff); - rbdata.defect_descriptor[0].dlbaddr_1 = ((block >> 8) & 0xff); - rbdata.defect_descriptor[0].dlbaddr_0 = ((block) & 0xff); + rbdata.defect_descriptor[0].dlbaddr_3 = (block >> 24) & 0xff); + rbdata.defect_descriptor[0].dlbaddr_2 = (block >> 16) & 0xff); + rbdata.defect_descriptor[0].dlbaddr_1 = (block >> 8) & 0xff); + rbdata.defect_descriptor[0].dlbaddr_0 = block & 0xff; return scsi_scsi_cmd(sd->sc_link, (struct scsi_generic *)&scsi_cmd, sizeof(scsi_cmd), (u_char *)&rbdata, sizeof(rbdata), SDRETRIES, @@ -879,7 +879,7 @@ sddump(dev_t dev) register struct sd_softc *sd; /* disk unit to do the IO */ int32 num; /* number of sectors to write */ u_int32 unit, part; - int32 blkoff, blknum, blkcnt = MAXTRANSFER; + int32 blkoff, blkno, nblks = MAXTRANSFER; int32 nblocks; char *addr; struct scsi_rw_big cmd; @@ -926,7 +926,7 @@ sddump(dev_t dev) sddoingadump = 1; - blknum = dumplo + blkoff; + blkno = dumplo + blkoff; while (num > 0) { pmap_enter(pmap_kernel(), MAPTO, @@ -939,12 +939,12 @@ sddump(dev_t dev) */ bzero(&cmd, sizeof(cmd)); cmd.opcode = WRITE_BIG; - cmd.addr_3 = (blknum & 0xff000000) >> 24; - cmd.addr_2 = (blknum & 0xff0000) >> 16; - cmd.addr_1 = (blknum & 0xff00) >> 8; - cmd.addr_0 = blknum & 0xff; - cmd.length2 = (blkcnt & 0xff00) >> 8; - cmd.length1 = (blkcnt & 0xff); + cmd.addr_3 = (blkno >> 24) & 0xff; + cmd.addr_2 = (blkno >> 16) & 0xff; + cmd.addr_1 = (blkno >> 8) & 0xff; + cmd.addr_0 = blkno & 0xff; + cmd.length2 = (nblks >> 8) & 0xff; + cmd.length1 = nblks & 0xff; /* * Fill out the scsi_xfer structure * Note: we cannot sleep as we may be an interrupt @@ -958,11 +958,11 @@ sddump(dev_t dev) xs->timeout = 10000; /* 10000 millisecs for a disk ! */ xs->cmd = (struct scsi_generic *)&cmd; xs->cmdlen = sizeof(cmd); - xs->resid = blkcnt * 512; + xs->resid = nblks * 512; xs->error = XS_NOERROR; xs->bp = 0; xs->data = (u_char *) MAPTO; - xs->datalen = blkcnt * 512; + xs->datalen = nblks * 512; /* * Pass all this info to the scsi driver. @@ -972,15 +972,15 @@ sddump(dev_t dev) return ENXIO; #else /* NOT_TRUSTED */ /* lets just talk about this first... */ - printf("sd%d: dump addr 0x%x, blk %d\n", unit, addr, blknum); + printf("sd%d: dump addr 0x%x, blk %d\n", unit, addr, blkno); #endif /* NOT_TRUSTED */ if ((unsigned)addr % (1024 * 1024) == 0) printf("%d ", num / 2048); /* update block count */ - num -= blkcnt; - blknum += blkcnt; - (int)addr += 512 * blkcnt; + num -= nblks; + blkno += nblks; + (int)addr += 512 * nblks; /* operator aborting dump? */ if ((c = sgetc(1)) && (c != 0x100))