diff options
author | dufault <dufault@FreeBSD.org> | 1995-03-04 20:51:10 +0000 |
---|---|---|
committer | dufault <dufault@FreeBSD.org> | 1995-03-04 20:51:10 +0000 |
commit | caa91d7b29df7b209af9699dd4f38031136d1b0d (patch) | |
tree | 08e7e0728f4cbe050b6439ba8c037dc43bf00e8e /sys/scsi/scsi_base.c | |
parent | 504389ec944dd6925d07e290d3aa2f23ccb14153 (diff) | |
download | FreeBSD-src-caa91d7b29df7b209af9699dd4f38031136d1b0d.zip FreeBSD-src-caa91d7b29df7b209af9699dd4f38031136d1b0d.tar.gz |
1. Change driver signatures to full signature for slice support.
2. Add "pt" (processor type) driver.
3. Add "worm" (Write Once) driver for Jordan.
Diffstat (limited to 'sys/scsi/scsi_base.c')
-rw-r--r-- | sys/scsi/scsi_base.c | 63 |
1 files changed, 51 insertions, 12 deletions
diff --git a/sys/scsi/scsi_base.c b/sys/scsi/scsi_base.c index 31fdbe6..a055b33 100644 --- a/sys/scsi/scsi_base.c +++ b/sys/scsi/scsi_base.c @@ -8,7 +8,7 @@ * file. * * Written by Julian Elischer (julian@dialix.oz.au) - * $Id: scsi_base.c,v 1.19 1995/01/31 11:41:44 dufault Exp $ + * $Id: scsi_base.c,v 1.20 1995/02/15 07:44:07 davidg Exp $ */ #define SPLSD splbio @@ -108,12 +108,16 @@ free_xs(xs, sc_link, flags) } } +/* XXX dufault: Replace "sd_size" with "scsi_read_capacity" + * when bde is done with sd.c + */ /* * Find out from the device what its capacity is. */ u_int32 -scsi_size(sc_link, flags) +scsi_read_capacity(sc_link, blk_size, flags) struct scsi_link *sc_link; + u_int32 *blk_size; u_int32 flags; { struct scsi_read_cap_data rdcap; @@ -145,10 +149,9 @@ scsi_size(sc_link, flags) printf("could not get size\n"); return (0); } else { - size = rdcap.addr_0 + 1; - size += rdcap.addr_1 << 8; - size += rdcap.addr_2 << 16; - size += rdcap.addr_3 << 24; + size = scsi_4btou(&rdcap.addr_3) + 1; + if (blk_size) + *blk_size = scsi_4btou(&rdcap.length_3); } return (size); } @@ -932,9 +935,6 @@ scsi_uto3b(val, bytes) *bytes = val & 0xff; } -/* - * The reverse of scsi_uto3b - */ u_int32 scsi_3btou(bytes) u_char *bytes; @@ -946,9 +946,6 @@ scsi_3btou(bytes) return rc; } -/* - * scsi_3btoi: scsi_3btou for twos complement signed integers: - */ int32 scsi_3btoi(bytes) u_char *bytes; @@ -961,6 +958,48 @@ scsi_3btoi(bytes) return (int32) rc; } +void +scsi_uto2b(val, bytes) + u_int32 val; + u_char *bytes; +{ + *bytes++ = (val & 0xff00) >> 8; + *bytes = val & 0xff; +} + +u_int32 +scsi_2btou(bytes) + u_char *bytes; +{ + u_int32 rc; + rc = (*bytes++ << 8); + rc += *bytes; + return rc; +} + +void +scsi_uto4b(val, bytes) + u_int32 val; + u_char *bytes; +{ + *bytes++ = (val & 0xff000000) >> 24; + *bytes++ = (val & 0xff0000) >> 16; + *bytes++ = (val & 0xff00) >> 8; + *bytes = val & 0xff; +} + +u_int32 +scsi_4btou(bytes) + u_char *bytes; +{ + u_int32 rc; + rc = (*bytes++ << 24); + rc += (*bytes++ << 16); + rc += (*bytes++ << 8); + rc += *bytes; + return rc; +} + /* * Print out the scsi_link structure's address info. */ |