[PATCH] update copyright and licensing
[linux-2.6/history.git] / drivers / scsi / scsi.h
blob35186048dba609ba10ebea20ebe60c272cb16792
1 /*
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
8 * <drew@colorado.edu>
10 * Modified by Eric Youngdale eric@andante.org to
11 * add scatter-gather, multiple outstanding request, and other
12 * enhancements.
15 #ifndef _SCSI_H
16 #define _SCSI_H
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.
30 #ifndef TRUE
31 #define TRUE 1
32 #endif
33 #ifndef FALSE
34 #define FALSE 0
35 #endif
37 #define MAX_SCSI_DEVICE_CODE 14
38 extern const char *const scsi_device_types[MAX_SCSI_DEVICE_CODE];
40 #ifdef DEBUG
41 #define SCSI_TIMEOUT (5*HZ)
42 #else
43 #define SCSI_TIMEOUT (2*HZ)
44 #endif
47 * Use these to separate status msg and our bytes
49 * These are set by:
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) |\
70 ((lun) & 0x07))
73 * SCSI command sets
76 #define SCSI_UNKNOWN 0
77 #define SCSI_1 1
78 #define SCSI_1_CCS 2
79 #define SCSI_2 3
80 #define SCSI_3 4
83 struct Scsi_Host;
84 struct scsi_cmnd;
85 struct scsi_device;
86 struct scsi_target;
87 struct scatterlist;
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"
128 #endif /* _SCSI_H */