summaryrefslogtreecommitdiff
path: root/sys/scsi/scsiconf.h
diff options
context:
space:
mode:
authorDavid Gwynne <dlg@cvs.openbsd.org>2009-12-01 01:40:03 +0000
committerDavid Gwynne <dlg@cvs.openbsd.org>2009-12-01 01:40:03 +0000
commit56901e51ebf1db9a1c61f31f83c5b6e63d702f20 (patch)
treee67ac5f8cc1747cdb9604d963d72edfc3d46c789 /sys/scsi/scsiconf.h
parent92a8e1a40ad01eb3ce5d68d4a5b10308e44cdf34 (diff)
put the midlayer changes back in.
the two issues affecting it last time are gone. the first, mishandling of TRY_AGAIN_LATER is not relevant now that krw got rid of TRY_AGAIN_LATER. the second, the misbehaving IBM disk was found to be a problem with siop using ordered tags on most ops combined with the speed of the new code. putting this in so we can move forward. ok krw@ "commit please" marco@
Diffstat (limited to 'sys/scsi/scsiconf.h')
-rw-r--r--sys/scsi/scsiconf.h50
1 files changed, 37 insertions, 13 deletions
diff --git a/sys/scsi/scsiconf.h b/sys/scsi/scsiconf.h
index 1d896e3e4ad..8f9619d8fb9 100644
--- a/sys/scsi/scsiconf.h
+++ b/sys/scsi/scsiconf.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: scsiconf.h,v 1.111 2009/11/22 20:16:43 krw Exp $ */
+/* $OpenBSD: scsiconf.h,v 1.112 2009/12/01 01:40:02 dlg Exp $ */
/* $NetBSD: scsiconf.h,v 1.35 1997/04/02 02:29:38 mycroft Exp $ */
/*
@@ -53,6 +53,7 @@
#include <sys/queue.h>
#include <sys/timeout.h>
#include <sys/workq.h>
+#include <sys/mutex.h>
#include <machine/cpu.h>
#include <scsi/scsi_debug.h>
@@ -234,20 +235,31 @@ _4ltol(u_int8_t *bytes)
#define DEVID_T10 3
struct devid {
- int d_type;
- u_int d_len;
- u_int8_t *d_id;
+ u_int8_t d_type;
+ u_int8_t d_flags;
+#define DEVID_F_PRINT (1<<0)
+ u_int8_t d_refcount;
+ u_int8_t d_len;
+
+ /*
+ * the devid struct is basically a header, the actual id is allocated
+ * immediately after it.
+ */
};
-#define DEVID_CMP(_a, _b) ( \
- (_a) != NULL && \
- (_b) != NULL && \
- (_a)->d_type != DEVID_NONE && \
- (_a)->d_type == (_b)->d_type && \
- (_a)->d_len == (_b)->d_len && \
- bcmp((_a)->d_id, (_b)->d_id, (_a)->d_len) == 0 \
+#define DEVID_CMP(_a, _b) ( \
+ (_a) != NULL && (_b) != NULL && \
+ ((_a) == (_b) || \
+ ((_a)->d_type != DEVID_NONE && \
+ (_a)->d_type == (_b)->d_type && \
+ (_a)->d_len == (_b)->d_len && \
+ bcmp((_a) + 1, (_b) + 1, (_a)->d_len) == 0)) \
)
+struct devid * devid_alloc(u_int8_t, u_int8_t, u_int8_t, u_int8_t *);
+struct devid * devid_copy(struct devid *);
+void devid_free(struct devid *);
+
/*
* The following documentation tries to describe the relationship between the
* various structures defined in this file:
@@ -337,7 +349,6 @@ struct scsi_link {
u_int64_t node_wwn; /* world wide name of node */
u_int16_t adapter_target; /* what are we on the scsi bus */
u_int16_t adapter_buswidth; /* 8 (regular) or 16 (wide). (0 becomes 8) */
- u_int16_t active; /* operations in progress */
u_int16_t flags; /* flags that all devices have */
#define SDEV_REMOVABLE 0x0001 /* media is removable */
#define SDEV_MEDIA_LOADED 0x0002 /* device figures are still valid */
@@ -366,7 +377,8 @@ struct scsi_link {
void *adapter_softc; /* needed for call to foo_scsi_cmd */
struct scsibus_softc *bus; /* link to the scsibus we're on */
struct scsi_inquiry_data inqdata; /* copy of INQUIRY data from probe */
- struct devid id;
+ struct devid *id;
+ struct mutex mtx;
};
int scsiprint(void *, const char *);
@@ -442,6 +454,8 @@ struct scsi_xfer {
* timeout structure for hba's to use for a command
*/
struct timeout stimeout;
+ void *cookie;
+ void (*done)(struct scsi_xfer *);
};
/*
@@ -484,6 +498,7 @@ struct scsi_xfer {
#define XS_BUSY 5 /* The device busy, try again later? */
#define XS_SHORTSENSE 6 /* Check the ATAPI sense for the error */
#define XS_RESET 8 /* bus was reset; possible retry command */
+#define XS_NO_CCB 9 /* device should requeue io and retry */
/*
* Possible retries for scsi_test_unit_ready()
@@ -555,14 +570,23 @@ int scsi_detach_lun(struct scsibus_softc *, int, int, int);
int scsi_req_probe(struct scsibus_softc *, int, int);
int scsi_req_detach(struct scsibus_softc *, int, int, int);
+void scsi_activate(struct scsibus_softc *, int, int, int);
+
extern const u_int8_t version_to_spc[];
#define SCSISPC(x)(version_to_spc[(x) & SID_ANSII])
+struct scsi_xfer * scsi_xs_get(struct scsi_link *, int);
+void scsi_xs_exec(struct scsi_xfer *);
+void scsi_xs_put(struct scsi_xfer *);
+
/*
* Entrypoints for multipathing
*/
int mpath_path_attach(struct scsi_link *);
int mpath_path_detach(struct scsi_link *, int);
+void mpath_path_activate(struct scsi_link *);
+void mpath_path_deactivate(struct scsi_link *);
+
#endif /* _KERNEL */
#endif /* SCSI_SCSICONF_H */