linux 2.6.16.38 w/ vs2.0.3-rc1
[linux-2.6.git] / drivers / scsi / 53c700.h
index 97ebe71..a8c83bb 100644 (file)
@@ -12,7 +12,7 @@
 #include <asm/io.h>
 
 #include <scsi/scsi_device.h>
-#include <scsi/scsi_cmnd.h>
+
 
 /* Turn on for general debugging---too verbose for normal use */
 #undef NCR_700_DEBUG
@@ -76,16 +76,11 @@ struct NCR_700_SG_List {
        #define SCRIPT_RETURN                   0x90080000
 };
 
-struct NCR_700_Device_Parameters {
-       /* space for creating a request sense command. Really, except
-        * for the annoying SCSI-2 requirement for LUN information in
-        * cmnd[1], this could be in static storage */
-       unsigned char cmnd[MAX_COMMAND_SIZE];
-       __u8    depth;
-};
-
-
-/* The SYNC negotiation sequence looks like:
+/* We use device->hostdata to store negotiated parameters.  This is
+ * supposed to be a pointer to a device private area, but we cannot
+ * really use it as such since it will never be freed, so just use the
+ * 32 bits to cram the information.  The SYNC negotiation sequence looks
+ * like:
  * 
  * If DEV_NEGOTIATED_SYNC not set, tack and SDTR message on to the
  * initial identify for the device and set DEV_BEGIN_SYNC_NEGOTATION
@@ -103,26 +98,19 @@ struct NCR_700_Device_Parameters {
 #define NCR_700_DEV_BEGIN_SYNC_NEGOTIATION     (1<<17)
 #define NCR_700_DEV_PRINT_SYNC_NEGOTIATION (1<<19)
 
-static inline char *NCR_700_get_sense_cmnd(struct scsi_device *SDp)
-{
-       struct NCR_700_Device_Parameters *hostdata = SDp->hostdata;
-
-       return hostdata->cmnd;
-}
-
 static inline void
 NCR_700_set_depth(struct scsi_device *SDp, __u8 depth)
 {
-       struct NCR_700_Device_Parameters *hostdata = SDp->hostdata;
+       long l = (long)SDp->hostdata;
 
-       hostdata->depth = depth;
+       l &= 0xffff00ff;
+       l |= 0xff00 & (depth << 8);
+       SDp->hostdata = (void *)l;
 }
 static inline __u8
 NCR_700_get_depth(struct scsi_device *SDp)
 {
-       struct NCR_700_Device_Parameters *hostdata = SDp->hostdata;
-
-       return hostdata->depth;
+       return ((((unsigned long)SDp->hostdata) & 0xff00)>>8);
 }
 static inline int
 NCR_700_is_flag_set(struct scsi_device *SDp, __u32 flag)
@@ -175,8 +163,6 @@ struct NCR_700_command_slot {
        #define NCR_700_SLOT_BUSY (1|NCR_700_SLOT_MAGIC) /* slot has command active on HA */
        #define NCR_700_SLOT_QUEUED (2|NCR_700_SLOT_MAGIC) /* slot has command to be made active on HA */
        __u8    state;
-       #define NCR_700_FLAG_AUTOSENSE  0x01
-       __u8    flags;
        int     tag;
        __u32   resume_offset;
        struct scsi_cmnd *cmnd;
@@ -486,7 +472,8 @@ NCR_700_readl(struct Scsi_Host *host, __u32 reg)
                ioread32(hostdata->base + reg);
 #if 1
        /* sanity check the register */
-       BUG_ON((reg & 0x3) != 0);
+       if((reg & 0x3) != 0)
+               BUG();
 #endif
 
        return value;
@@ -509,7 +496,8 @@ NCR_700_writel(__u32 value, struct Scsi_Host *host, __u32 reg)
 
 #if 1
        /* sanity check the register */
-       BUG_ON((reg & 0x3) != 0);
+       if((reg & 0x3) != 0)
+               BUG();
 #endif
 
        bEBus ? iowrite32be(value, hostdata->base + reg):