summaryrefslogtreecommitdiff
path: root/sys/scsi/scsiconf.h
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2008-11-10 18:04:42 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2008-11-10 18:04:42 +0000
commitdedcf7dabb00172eb049d9c7114d62454caaa2f3 (patch)
tree7392dc4027b1b65bf38bd42dec24558801e68abe /sys/scsi/scsiconf.h
parent8b8ed604b4dcbfad046c7ee3f8502c90843db3a7 (diff)
clean namespace a fair bit; wrap kernel-use-only structures and gunk in
#ifdef _KERNEL
Diffstat (limited to 'sys/scsi/scsiconf.h')
-rw-r--r--sys/scsi/scsiconf.h373
1 files changed, 176 insertions, 197 deletions
diff --git a/sys/scsi/scsiconf.h b/sys/scsi/scsiconf.h
index c44c9e63fcd..a38f054540f 100644
--- a/sys/scsi/scsiconf.h
+++ b/sys/scsi/scsiconf.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: scsiconf.h,v 1.96 2008/11/09 17:01:10 deraadt Exp $ */
+/* $OpenBSD: scsiconf.h,v 1.97 2008/11/10 18:04:41 deraadt Exp $ */
/* $NetBSD: scsiconf.h,v 1.35 1997/04/02 02:29:38 mycroft Exp $ */
/*
@@ -48,7 +48,7 @@
*/
#ifndef SCSI_SCSICONF_H
-#define SCSI_SCSICONF_H 1
+#define SCSI_SCSICONF_H
#include <sys/queue.h>
#include <sys/timeout.h>
@@ -56,6 +56,178 @@
#include <machine/cpu.h>
#include <scsi/scsi_debug.h>
+static __inline void _lto2b(u_int32_t val, u_int8_t *bytes);
+static __inline void _lto3b(u_int32_t val, u_int8_t *bytes);
+static __inline void _lto4b(u_int32_t val, u_int8_t *bytes);
+static __inline void _lto8b(u_int64_t val, u_int8_t *bytes);
+static __inline u_int32_t _2btol(u_int8_t *bytes);
+static __inline u_int32_t _3btol(u_int8_t *bytes);
+static __inline u_int32_t _4btol(u_int8_t *bytes);
+static __inline u_int64_t _5btol(u_int8_t *bytes);
+static __inline u_int64_t _8btol(u_int8_t *bytes);
+
+static __inline void _lto2l(u_int32_t val, u_int8_t *bytes);
+static __inline void _lto3l(u_int32_t val, u_int8_t *bytes);
+static __inline void _lto4l(u_int32_t val, u_int8_t *bytes);
+static __inline u_int32_t _2ltol(u_int8_t *bytes);
+static __inline u_int32_t _3ltol(u_int8_t *bytes);
+static __inline u_int32_t _4ltol(u_int8_t *bytes);
+
+static __inline void
+_lto2b(u_int32_t val, u_int8_t *bytes)
+{
+
+ bytes[0] = (val >> 8) & 0xff;
+ bytes[1] = val & 0xff;
+}
+
+static __inline void
+_lto3b(u_int32_t val, u_int8_t *bytes)
+{
+
+ bytes[0] = (val >> 16) & 0xff;
+ bytes[1] = (val >> 8) & 0xff;
+ bytes[2] = val & 0xff;
+}
+
+static __inline void
+_lto4b(u_int32_t val, u_int8_t *bytes)
+{
+
+ bytes[0] = (val >> 24) & 0xff;
+ bytes[1] = (val >> 16) & 0xff;
+ bytes[2] = (val >> 8) & 0xff;
+ bytes[3] = val & 0xff;
+}
+
+static __inline void
+_lto8b(u_int64_t val, u_int8_t *bytes)
+{
+
+ bytes[0] = (val >> 56) & 0xff;
+ bytes[1] = (val >> 48) & 0xff;
+ bytes[2] = (val >> 40) & 0xff;
+ bytes[3] = (val >> 32) & 0xff;
+ bytes[4] = (val >> 24) & 0xff;
+ bytes[5] = (val >> 16) & 0xff;
+ bytes[6] = (val >> 8) & 0xff;
+ bytes[7] = val & 0xff;
+}
+
+static __inline u_int32_t
+_2btol(u_int8_t *bytes)
+{
+ u_int32_t rv;
+
+ rv = (bytes[0] << 8) | bytes[1];
+ return (rv);
+}
+
+static __inline u_int32_t
+_3btol(u_int8_t *bytes)
+{
+ u_int32_t rv;
+
+ rv = (bytes[0] << 16) | (bytes[1] << 8) | bytes[2];
+ return (rv);
+}
+
+static __inline u_int32_t
+_4btol(u_int8_t *bytes)
+{
+ u_int32_t rv;
+
+ rv = (bytes[0] << 24) | (bytes[1] << 16) |
+ (bytes[2] << 8) | bytes[3];
+ return (rv);
+}
+
+static __inline u_int64_t
+_5btol(u_int8_t *bytes)
+{
+ u_int64_t rv;
+
+ rv = ((u_int64_t)bytes[0] << 32) |
+ ((u_int64_t)bytes[1] << 24) |
+ ((u_int64_t)bytes[2] << 16) |
+ ((u_int64_t)bytes[3] << 8) |
+ (u_int64_t)bytes[4];
+ return (rv);
+}
+
+static __inline u_int64_t
+_8btol(u_int8_t *bytes)
+{
+ u_int64_t rv;
+
+ rv = (((u_int64_t)bytes[0]) << 56) |
+ (((u_int64_t)bytes[1]) << 48) |
+ (((u_int64_t)bytes[2]) << 40) |
+ (((u_int64_t)bytes[3]) << 32) |
+ (((u_int64_t)bytes[4]) << 24) |
+ (((u_int64_t)bytes[5]) << 16) |
+ (((u_int64_t)bytes[6]) << 8) |
+ ((u_int64_t)bytes[7]);
+ return (rv);
+}
+
+static __inline void
+_lto2l(u_int32_t val, u_int8_t *bytes)
+{
+
+ bytes[0] = val & 0xff;
+ bytes[1] = (val >> 8) & 0xff;
+}
+
+static __inline void
+_lto3l(u_int32_t val, u_int8_t *bytes)
+{
+
+ bytes[0] = val & 0xff;
+ bytes[1] = (val >> 8) & 0xff;
+ bytes[2] = (val >> 16) & 0xff;
+}
+
+static __inline void
+_lto4l(u_int32_t val, u_int8_t *bytes)
+{
+
+ bytes[0] = val & 0xff;
+ bytes[1] = (val >> 8) & 0xff;
+ bytes[2] = (val >> 16) & 0xff;
+ bytes[3] = (val >> 24) & 0xff;
+}
+
+static __inline u_int32_t
+_2ltol(u_int8_t *bytes)
+{
+ u_int32_t rv;
+
+ rv = bytes[0] | (bytes[1] << 8);
+ return (rv);
+}
+
+static __inline u_int32_t
+_3ltol(u_int8_t *bytes)
+{
+ u_int32_t rv;
+
+ rv = bytes[0] | (bytes[1] << 8) | (bytes[2] << 16);
+ return (rv);
+}
+
+static __inline u_int32_t
+_4ltol(u_int8_t *bytes)
+{
+ u_int32_t rv;
+
+ rv = bytes[0] | (bytes[1] << 8) |
+ (bytes[2] << 16) | (bytes[3] << 24);
+ return (rv);
+}
+
+#ifdef _KERNEL
+
#define DEVID_NONE 0
#define DEVID_NAA 1
#define DEVID_EUI 2
@@ -105,8 +277,6 @@ struct devid {
* scsi system to find the associated other parts.
*/
-struct buf;
-struct proc;
struct scsi_xfer;
struct scsi_link;
struct scsibus_softc;
@@ -383,199 +553,8 @@ int scsi_detach_bus(struct scsibus_softc *, int);
int scsi_detach_target(struct scsibus_softc *, int, int);
int scsi_detach_lun(struct scsibus_softc *, int, int, int);
-static __inline void _lto2b(u_int32_t val, u_int8_t *bytes);
-static __inline void _lto3b(u_int32_t val, u_int8_t *bytes);
-static __inline void _lto4b(u_int32_t val, u_int8_t *bytes);
-static __inline void _lto8b(u_int64_t val, u_int8_t *bytes);
-static __inline u_int32_t _2btol(u_int8_t *bytes);
-static __inline u_int32_t _3btol(u_int8_t *bytes);
-static __inline u_int32_t _4btol(u_int8_t *bytes);
-static __inline u_int64_t _5btol(u_int8_t *bytes);
-static __inline u_int64_t _8btol(u_int8_t *bytes);
-
-static __inline void _lto2l(u_int32_t val, u_int8_t *bytes);
-static __inline void _lto3l(u_int32_t val, u_int8_t *bytes);
-static __inline void _lto4l(u_int32_t val, u_int8_t *bytes);
-static __inline u_int32_t _2ltol(u_int8_t *bytes);
-static __inline u_int32_t _3ltol(u_int8_t *bytes);
-static __inline u_int32_t _4ltol(u_int8_t *bytes);
-
-static __inline void
-_lto2b(val, bytes)
- u_int32_t val;
- u_int8_t *bytes;
-{
-
- bytes[0] = (val >> 8) & 0xff;
- bytes[1] = val & 0xff;
-}
-
-static __inline void
-_lto3b(val, bytes)
- u_int32_t val;
- u_int8_t *bytes;
-{
-
- bytes[0] = (val >> 16) & 0xff;
- bytes[1] = (val >> 8) & 0xff;
- bytes[2] = val & 0xff;
-}
-
-static __inline void
-_lto4b(val, bytes)
- u_int32_t val;
- u_int8_t *bytes;
-{
-
- bytes[0] = (val >> 24) & 0xff;
- bytes[1] = (val >> 16) & 0xff;
- bytes[2] = (val >> 8) & 0xff;
- bytes[3] = val & 0xff;
-}
-
-static __inline void
-_lto8b(val, bytes)
- u_int64_t val;
- u_int8_t *bytes;
-{
-
- bytes[0] = (val >> 56) & 0xff;
- bytes[1] = (val >> 48) & 0xff;
- bytes[2] = (val >> 40) & 0xff;
- bytes[3] = (val >> 32) & 0xff;
- bytes[4] = (val >> 24) & 0xff;
- bytes[5] = (val >> 16) & 0xff;
- bytes[6] = (val >> 8) & 0xff;
- bytes[7] = val & 0xff;
-}
-
-static __inline u_int32_t
-_2btol(bytes)
- u_int8_t *bytes;
-{
- u_int32_t rv;
-
- rv = (bytes[0] << 8) | bytes[1];
- return (rv);
-}
-
-static __inline u_int32_t
-_3btol(bytes)
- u_int8_t *bytes;
-{
- u_int32_t rv;
-
- rv = (bytes[0] << 16) | (bytes[1] << 8) | bytes[2];
- return (rv);
-}
-
-static __inline u_int32_t
-_4btol(bytes)
- u_int8_t *bytes;
-{
- u_int32_t rv;
-
- rv = (bytes[0] << 24) | (bytes[1] << 16) |
- (bytes[2] << 8) | bytes[3];
- return (rv);
-}
-
-static __inline u_int64_t
-_5btol(bytes)
- u_int8_t *bytes;
-{
- u_int64_t rv;
-
- rv = ((u_int64_t)bytes[0] << 32) |
- ((u_int64_t)bytes[1] << 24) |
- ((u_int64_t)bytes[2] << 16) |
- ((u_int64_t)bytes[3] << 8) |
- (u_int64_t)bytes[4];
- return (rv);
-}
-
-static __inline u_int64_t
-_8btol(bytes)
- u_int8_t *bytes;
-{
- u_int64_t rv;
-
- rv = (((u_int64_t)bytes[0]) << 56) |
- (((u_int64_t)bytes[1]) << 48) |
- (((u_int64_t)bytes[2]) << 40) |
- (((u_int64_t)bytes[3]) << 32) |
- (((u_int64_t)bytes[4]) << 24) |
- (((u_int64_t)bytes[5]) << 16) |
- (((u_int64_t)bytes[6]) << 8) |
- ((u_int64_t)bytes[7]);
- return (rv);
-}
-
-static __inline void
-_lto2l(val, bytes)
- u_int32_t val;
- u_int8_t *bytes;
-{
-
- bytes[0] = val & 0xff;
- bytes[1] = (val >> 8) & 0xff;
-}
-
-static __inline void
-_lto3l(val, bytes)
- u_int32_t val;
- u_int8_t *bytes;
-{
-
- bytes[0] = val & 0xff;
- bytes[1] = (val >> 8) & 0xff;
- bytes[2] = (val >> 16) & 0xff;
-}
-
-static __inline void
-_lto4l(val, bytes)
- u_int32_t val;
- u_int8_t *bytes;
-{
-
- bytes[0] = val & 0xff;
- bytes[1] = (val >> 8) & 0xff;
- bytes[2] = (val >> 16) & 0xff;
- bytes[3] = (val >> 24) & 0xff;
-}
-
-static __inline u_int32_t
-_2ltol(bytes)
- u_int8_t *bytes;
-{
- u_int32_t rv;
-
- rv = bytes[0] | (bytes[1] << 8);
- return (rv);
-}
-
-static __inline u_int32_t
-_3ltol(bytes)
- u_int8_t *bytes;
-{
- u_int32_t rv;
-
- rv = bytes[0] | (bytes[1] << 8) | (bytes[2] << 16);
- return (rv);
-}
-
-static __inline u_int32_t
-_4ltol(bytes)
- u_int8_t *bytes;
-{
- u_int32_t rv;
-
- rv = bytes[0] | (bytes[1] << 8) |
- (bytes[2] << 16) | (bytes[3] << 24);
- return (rv);
-}
-
-extern const u_int8_t version_to_spc [];
+extern const u_int8_t version_to_spc[];
#define SCSISPC(x)(version_to_spc[(x) & SID_ANSII])
+#endif /* _KERNEL */
#endif /* SCSI_SCSICONF_H */