2 * scsi.h Copyright (C) 1992 Drew Eckhardt
3 * Copyright (C) 1993, 1994, 1995, 1998, 1999 Eric Youngdale
4 * generic SCSI package header file by
5 * Initial versions: Drew Eckhardt
6 * Subsequent revisions: Eric Youngdale
10 * Modified by Eric Youngdale eric@andante.org to
11 * add scatter-gather, multiple outstanding request, and other
18 #include <linux/config.h> /* for CONFIG_SCSI_LOGGING */
20 #include <scsi/scsi_cmnd.h>
21 #include <scsi/scsi_device.h>
22 #include <scsi/scsi_eh.h>
23 #include <scsi/scsi_request.h>
24 #include <scsi/scsi_tcq.h>
25 #include <scsi/scsi.h>
28 * Some defs, in case these are not defined elsewhere.
37 #define MAX_SCSI_DEVICE_CODE 14
38 extern const char *const scsi_device_types
[MAX_SCSI_DEVICE_CODE
];
41 #define SCSI_TIMEOUT (5*HZ)
43 #define SCSI_TIMEOUT (2*HZ)
47 * Use these to separate status msg and our bytes
51 * status byte = set from target device
52 * msg_byte = return status from host adapter itself.
53 * host_byte = set by low-level driver to indicate status.
54 * driver_byte = set by mid-level.
56 #define status_byte(result) (((result) >> 1) & 0x1f)
57 #define msg_byte(result) (((result) >> 8) & 0xff)
58 #define host_byte(result) (((result) >> 16) & 0xff)
59 #define driver_byte(result) (((result) >> 24) & 0xff)
60 #define suggestion(result) (driver_byte(result) & SUGGEST_MASK)
62 #define sense_class(sense) (((sense) >> 4) & 0x7)
63 #define sense_error(sense) ((sense) & 0xf)
64 #define sense_valid(sense) ((sense) & 0x80);
67 #define IDENTIFY_BASE 0x80
68 #define IDENTIFY(can_disconnect, lun) (IDENTIFY_BASE |\
69 ((can_disconnect) ? 0x40 : 0) |\
76 #define SCSI_UNKNOWN 0
90 * Prototypes for functions in constants.c
91 * Some of these used to live in constants.h
93 extern void print_Scsi_Cmnd(struct scsi_cmnd
*);
94 extern void print_command(unsigned char *);
95 extern void print_sense(const char *, struct scsi_cmnd
*);
96 extern void print_req_sense(const char *, struct scsi_request
*);
97 extern void print_driverbyte(int scsiresult
);
98 extern void print_hostbyte(int scsiresult
);
99 extern void print_status(unsigned char status
);
100 extern int print_msg(const unsigned char *);
101 extern const char *scsi_sense_key_string(unsigned char);
102 extern const char *scsi_extd_sense_format(unsigned char, unsigned char);
105 * Legacy dma direction interfaces.
107 * This assumes the pci/sbus dma mapping flags have the same numercial
108 * values as the generic dma-mapping ones. Currently they have but there's
109 * no way to check. Better don't use these interfaces!
111 #define SCSI_DATA_UNKNOWN (DMA_BIDIRECTIONAL)
112 #define SCSI_DATA_WRITE (DMA_TO_DEVICE)
113 #define SCSI_DATA_READ (DMA_FROM_DEVICE)
114 #define SCSI_DATA_NONE (DMA_NONE)
116 #define scsi_to_pci_dma_dir(scsi_dir) ((int)(scsi_dir))
117 #define scsi_to_sbus_dma_dir(scsi_dir) ((int)(scsi_dir))
120 * This is the crap from the old error handling code. We have it in a special
121 * place so that we can more easily delete it later on.
123 #include "scsi_obsolete.h"
125 /* obsolete typedef junk. */
126 #include "scsi_typedefs.h"