Here's a suggestion for changes in the scsi.h include file. I have added a
few missing opcodes and some missing device types.

I have also added a definition of the very frequently used INQUIRY response
data struct. It is currently duplicated in about a dozen different drivers
and every new driver has to define it yet again. Better to have it in a
central place IMHO.

The value for TYPE_NO_LUN has changed from 0x7f to 0x1f. This is because
the "device type" field is 5 bits wide. The 7th bit of the old value 0x7f
is actually the "missing" bit from the qualifier field. The only driver
that uses the old value (ibmmca) is patched to redefine the symbol locally.

/Björn

--- linux-2.4.2-orig/include/scsi/scsi.h        Tue Sep  5 23:08:55 2000
+++ linux-2.4.2/include/scsi/scsi.h     Sun Feb 25 19:21:48 2001
@@ -78,13 +78,17 @@
 #define MODE_SENSE_10         0x5a
 #define PERSISTENT_RESERVE_IN 0x5e
 #define PERSISTENT_RESERVE_OUT 0x5f
+#define REPORT_LUNS           0xa0
+#define SET_DEVICE_ID         0xa4
 #define MOVE_MEDIUM           0xa5
+#define MOVE_MEDIUM_ATTACHED  0xa7
 #define READ_12               0xa8
 #define WRITE_12              0xaa
 #define WRITE_VERIFY_12       0xae
 #define SEARCH_HIGH_12        0xb0
 #define SEARCH_EQUAL_12       0xb1
 #define SEARCH_LOW_12         0xb2
+#define READ_ELEMENT_STATUS_ATTACHED 0xb4
 #define READ_ELEMENT_STATUS   0xb8
 #define SEND_VOLUME_TAG       0xb6
 #define WRITE_LONG_2          0xea
@@ -138,8 +142,69 @@
                                     * - treated as TYPE_DISK */
 #define TYPE_MEDIUM_CHANGER 0x08
 #define TYPE_COMM           0x09    /* Communications device */
+#define TYPE_RAID           0x0c    /* Storage array controller device */
 #define TYPE_ENCLOSURE      0x0d    /* Enclosure Services Device */
-#define TYPE_NO_LUN         0x7f
+#define TYPE_SIMPLE_DISK    0x0e    /* Simplified direct-access device */
+#define TYPE_CARD           0x0f    /* Optical card reader/writer device */
+#define TYPE_OBJECT         0x11    /* Object-based Storage Device */
+#define TYPE_NO_LUN         0x1f
+
+/*
+ * The SCSI INQUIRY command result data format
+ * (From SCSI-2 final draft, section 8.2.5.1
+ *  and SCSI-3 SPC draft 18, section 7.6.2)
+ */
+
+struct scsi_inquiry_response
+{
+       unsigned int device_type : 5;
+       unsigned int qualifier : 3;
+       unsigned int _res1 : 7;
+       unsigned int removable : 1;
+       unsigned int scsi_version : 8;
+       unsigned int response_format : 4;
+       unsigned int hierarchial : 1;
+       unsigned int normal_aca : 1;
+       unsigned int terminate_iop : 1;
+       unsigned int async_events : 1;
+       unsigned int add_length : 8;
+       unsigned int _res2 : 7;
+       unsigned int scc_support : 1;
+       unsigned int addr16 : 1;
+       unsigned int _res3 : 2;
+       unsigned int changer : 1;
+       unsigned int multiport : 1;
+       unsigned int _res4 : 1;
+       unsigned int enclosure : 1;
+       unsigned int basic_queue : 1;
+       unsigned int soft_reset : 1;
+       unsigned int command_queue : 1;
+       unsigned int transfer_disable : 1;
+       unsigned int linked : 1;
+       unsigned int sync : 1;
+       unsigned int wbus16 : 1;
+       unsigned int wbus32 : 1;
+       unsigned int rel_addr : 1;
+       unsigned char vendor[8];
+       unsigned char product[16];
+       unsigned char revision[4];
+       unsigned char vendor_specific[20];
+       unsigned int info_unit : 1;
+       unsigned int quick_arbitrate : 1;
+       unsigned int clocking : 2;
+       unsigned int _res5 : 4;
+       unsigned int _res6 : 8;
+       unsigned int standard1 : 16;
+       unsigned int standard2 : 16;
+       unsigned int standard3 : 16;
+       unsigned int standard4 : 16;
+       unsigned int standard5 : 16;
+       unsigned int standard6 : 16;
+       unsigned int standard7 : 16;
+       unsigned int standard8 : 16;
+       unsigned char _res7[22];
+};
+

 /*
  * standard mode-select header prepended to all mode-select commands
--- linux-2.4.2-orig/drivers/scsi/ibmmca.c      Mon Jan 29 01:08:00 2001
+++ linux-2.4.2/drivers/scsi/ibmmca.c   Sun Feb 25 19:36:54 2001
@@ -409,6 +409,10 @@
    the ANSI-SCSI-standard, therefore, it can be used and should not cause any
    harm. */
 #define TYPE_NO_DEVICE          0xFF
+#ifdef TYPE_NO_LUN
+#undef TYPE_NO_LUN
+#endif
+#define TYPE_NO_LUN             0x7F

 /* define medium-changer. If this is not defined previously, e.g. Linux
    2.0.x, define this type here. */




-
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to [EMAIL PROTECTED]

Reply via email to