diff options
Diffstat (limited to 'include/scsi')
-rw-r--r-- | include/scsi/scsi.h | 2 | ||||
-rw-r--r-- | include/scsi/scsi_cmnd.h | 20 | ||||
-rw-r--r-- | include/scsi/scsi_device.h | 26 | ||||
-rw-r--r-- | include/scsi/scsi_eh.h | 3 | ||||
-rw-r--r-- | include/scsi/scsi_host.h | 14 | ||||
-rw-r--r-- | include/scsi/scsi_transport.h | 11 | ||||
-rw-r--r-- | include/scsi/scsi_transport_sas.h | 50 | ||||
-rw-r--r-- | include/scsi/scsi_transport_spi.h | 4 |
8 files changed, 101 insertions, 29 deletions
diff --git a/include/scsi/scsi.h b/include/scsi/scsi.h index 9c331258bc27..c60b8ff2f5e4 100644 --- a/include/scsi/scsi.h +++ b/include/scsi/scsi.h | |||
@@ -433,6 +433,4 @@ struct scsi_lun { | |||
433 | /* Used to obtain the PCI location of a device */ | 433 | /* Used to obtain the PCI location of a device */ |
434 | #define SCSI_IOCTL_GET_PCI 0x5387 | 434 | #define SCSI_IOCTL_GET_PCI 0x5387 |
435 | 435 | ||
436 | int scsi_execute_in_process_context(void (*fn)(void *data), void *data); | ||
437 | |||
438 | #endif /* _SCSI_SCSI_H */ | 436 | #endif /* _SCSI_SCSI_H */ |
diff --git a/include/scsi/scsi_cmnd.h b/include/scsi/scsi_cmnd.h index 7529f4388bb4..1ace1b9fe537 100644 --- a/include/scsi/scsi_cmnd.h +++ b/include/scsi/scsi_cmnd.h | |||
@@ -104,10 +104,10 @@ struct scsi_cmnd { | |||
104 | working on */ | 104 | working on */ |
105 | 105 | ||
106 | #define SCSI_SENSE_BUFFERSIZE 96 | 106 | #define SCSI_SENSE_BUFFERSIZE 96 |
107 | unsigned char sense_buffer[SCSI_SENSE_BUFFERSIZE]; /* obtained by REQUEST SENSE | 107 | unsigned char sense_buffer[SCSI_SENSE_BUFFERSIZE]; |
108 | * when CHECK CONDITION is | 108 | /* obtained by REQUEST SENSE when |
109 | * received on original command | 109 | * CHECK CONDITION is received on original |
110 | * (auto-sense) */ | 110 | * command (auto-sense) */ |
111 | 111 | ||
112 | /* Low-level done function - can be used by low-level driver to point | 112 | /* Low-level done function - can be used by low-level driver to point |
113 | * to completion function. Not used by mid/upper level code. */ | 113 | * to completion function. Not used by mid/upper level code. */ |
@@ -120,12 +120,12 @@ struct scsi_cmnd { | |||
120 | struct scsi_pointer SCp; /* Scratchpad used by some host adapters */ | 120 | struct scsi_pointer SCp; /* Scratchpad used by some host adapters */ |
121 | 121 | ||
122 | unsigned char *host_scribble; /* The host adapter is allowed to | 122 | unsigned char *host_scribble; /* The host adapter is allowed to |
123 | * call scsi_malloc and get some memory | 123 | * call scsi_malloc and get some memory |
124 | * and hang it here. The host adapter | 124 | * and hang it here. The host adapter |
125 | * is also expected to call scsi_free | 125 | * is also expected to call scsi_free |
126 | * to release this memory. (The memory | 126 | * to release this memory. (The memory |
127 | * obtained by scsi_malloc is guaranteed | 127 | * obtained by scsi_malloc is guaranteed |
128 | * to be at an address < 16Mb). */ | 128 | * to be at an address < 16Mb). */ |
129 | 129 | ||
130 | int result; /* Status code from lower level driver */ | 130 | int result; /* Status code from lower level driver */ |
131 | 131 | ||
diff --git a/include/scsi/scsi_device.h b/include/scsi/scsi_device.h index 290e3b4d2aec..895d212864cd 100644 --- a/include/scsi/scsi_device.h +++ b/include/scsi/scsi_device.h | |||
@@ -4,6 +4,7 @@ | |||
4 | #include <linux/device.h> | 4 | #include <linux/device.h> |
5 | #include <linux/list.h> | 5 | #include <linux/list.h> |
6 | #include <linux/spinlock.h> | 6 | #include <linux/spinlock.h> |
7 | #include <linux/workqueue.h> | ||
7 | #include <asm/atomic.h> | 8 | #include <asm/atomic.h> |
8 | 9 | ||
9 | struct request_queue; | 10 | struct request_queue; |
@@ -73,7 +74,6 @@ struct scsi_device { | |||
73 | unsigned sector_size; /* size in bytes */ | 74 | unsigned sector_size; /* size in bytes */ |
74 | 75 | ||
75 | void *hostdata; /* available to low-level driver */ | 76 | void *hostdata; /* available to low-level driver */ |
76 | char devfs_name[256]; /* devfs junk */ | ||
77 | char type; | 77 | char type; |
78 | char scsi_level; | 78 | char scsi_level; |
79 | char inq_periph_qual; /* PQ from INQUIRY data */ | 79 | char inq_periph_qual; /* PQ from INQUIRY data */ |
@@ -138,6 +138,8 @@ struct scsi_device { | |||
138 | struct device sdev_gendev; | 138 | struct device sdev_gendev; |
139 | struct class_device sdev_classdev; | 139 | struct class_device sdev_classdev; |
140 | 140 | ||
141 | struct execute_work ew; /* used to get process context on put */ | ||
142 | |||
141 | enum scsi_device_state sdev_state; | 143 | enum scsi_device_state sdev_state; |
142 | unsigned long sdev_data[0]; | 144 | unsigned long sdev_data[0]; |
143 | } __attribute__((aligned(sizeof(unsigned long)))); | 145 | } __attribute__((aligned(sizeof(unsigned long)))); |
@@ -154,6 +156,11 @@ struct scsi_device { | |||
154 | #define scmd_printk(prefix, scmd, fmt, a...) \ | 156 | #define scmd_printk(prefix, scmd, fmt, a...) \ |
155 | dev_printk(prefix, &(scmd)->device->sdev_gendev, fmt, ##a) | 157 | dev_printk(prefix, &(scmd)->device->sdev_gendev, fmt, ##a) |
156 | 158 | ||
159 | enum scsi_target_state { | ||
160 | STARGET_RUNNING = 1, | ||
161 | STARGET_DEL, | ||
162 | }; | ||
163 | |||
157 | /* | 164 | /* |
158 | * scsi_target: representation of a scsi target, for now, this is only | 165 | * scsi_target: representation of a scsi target, for now, this is only |
159 | * used for single_lun devices. If no one has active IO to the target, | 166 | * used for single_lun devices. If no one has active IO to the target, |
@@ -168,8 +175,13 @@ struct scsi_target { | |||
168 | unsigned int channel; | 175 | unsigned int channel; |
169 | unsigned int id; /* target id ... replace | 176 | unsigned int id; /* target id ... replace |
170 | * scsi_device.id eventually */ | 177 | * scsi_device.id eventually */ |
171 | unsigned long create:1; /* signal that it needs to be added */ | 178 | unsigned int create:1; /* signal that it needs to be added */ |
179 | unsigned int pdt_1f_for_no_lun; /* PDT = 0x1f */ | ||
180 | /* means no lun present */ | ||
181 | |||
172 | char scsi_level; | 182 | char scsi_level; |
183 | struct execute_work ew; | ||
184 | enum scsi_target_state state; | ||
173 | void *hostdata; /* available to low-level driver */ | 185 | void *hostdata; /* available to low-level driver */ |
174 | unsigned long starget_data[0]; /* for the transport */ | 186 | unsigned long starget_data[0]; /* for the transport */ |
175 | /* starget_data must be the last element!!!! */ | 187 | /* starget_data must be the last element!!!! */ |
@@ -249,6 +261,11 @@ extern int scsi_mode_sense(struct scsi_device *sdev, int dbd, int modepage, | |||
249 | unsigned char *buffer, int len, int timeout, | 261 | unsigned char *buffer, int len, int timeout, |
250 | int retries, struct scsi_mode_data *data, | 262 | int retries, struct scsi_mode_data *data, |
251 | struct scsi_sense_hdr *); | 263 | struct scsi_sense_hdr *); |
264 | extern int scsi_mode_select(struct scsi_device *sdev, int pf, int sp, | ||
265 | int modepage, unsigned char *buffer, int len, | ||
266 | int timeout, int retries, | ||
267 | struct scsi_mode_data *data, | ||
268 | struct scsi_sense_hdr *); | ||
252 | extern int scsi_test_unit_ready(struct scsi_device *sdev, int timeout, | 269 | extern int scsi_test_unit_ready(struct scsi_device *sdev, int timeout, |
253 | int retries); | 270 | int retries); |
254 | extern int scsi_device_set_state(struct scsi_device *sdev, | 271 | extern int scsi_device_set_state(struct scsi_device *sdev, |
@@ -281,6 +298,11 @@ extern int scsi_execute_async(struct scsi_device *sdev, | |||
281 | void (*done)(void *, char *, int, int), | 298 | void (*done)(void *, char *, int, int), |
282 | gfp_t gfp); | 299 | gfp_t gfp); |
283 | 300 | ||
301 | static inline void scsi_device_reprobe(struct scsi_device *sdev) | ||
302 | { | ||
303 | device_reprobe(&sdev->sdev_gendev); | ||
304 | } | ||
305 | |||
284 | static inline unsigned int sdev_channel(struct scsi_device *sdev) | 306 | static inline unsigned int sdev_channel(struct scsi_device *sdev) |
285 | { | 307 | { |
286 | return sdev->channel; | 308 | return sdev->channel; |
diff --git a/include/scsi/scsi_eh.h b/include/scsi/scsi_eh.h index fabd879c2f2e..d160880b2a87 100644 --- a/include/scsi/scsi_eh.h +++ b/include/scsi/scsi_eh.h | |||
@@ -35,6 +35,9 @@ static inline int scsi_sense_valid(struct scsi_sense_hdr *sshdr) | |||
35 | } | 35 | } |
36 | 36 | ||
37 | 37 | ||
38 | extern void scsi_eh_finish_cmd(struct scsi_cmnd *scmd, | ||
39 | struct list_head *done_q); | ||
40 | extern void scsi_eh_flush_done_q(struct list_head *done_q); | ||
38 | extern void scsi_report_bus_reset(struct Scsi_Host *, int); | 41 | extern void scsi_report_bus_reset(struct Scsi_Host *, int); |
39 | extern void scsi_report_device_reset(struct Scsi_Host *, int, int); | 42 | extern void scsi_report_device_reset(struct Scsi_Host *, int, int); |
40 | extern int scsi_block_when_processing_errors(struct scsi_device *); | 43 | extern int scsi_block_when_processing_errors(struct scsi_device *); |
diff --git a/include/scsi/scsi_host.h b/include/scsi/scsi_host.h index 827992949c4b..a6cf3e535c0b 100644 --- a/include/scsi/scsi_host.h +++ b/include/scsi/scsi_host.h | |||
@@ -147,20 +147,6 @@ struct scsi_host_template { | |||
147 | int (* eh_host_reset_handler)(struct scsi_cmnd *); | 147 | int (* eh_host_reset_handler)(struct scsi_cmnd *); |
148 | 148 | ||
149 | /* | 149 | /* |
150 | * This is an optional routine to notify the host that the scsi | ||
151 | * timer just fired. The returns tell the timer routine what to | ||
152 | * do about this: | ||
153 | * | ||
154 | * EH_HANDLED: I fixed the error, please complete the command | ||
155 | * EH_RESET_TIMER: I need more time, reset the timer and | ||
156 | * begin counting again | ||
157 | * EH_NOT_HANDLED Begin normal error recovery | ||
158 | * | ||
159 | * Status: OPTIONAL | ||
160 | */ | ||
161 | enum scsi_eh_timer_return (* eh_timed_out)(struct scsi_cmnd *); | ||
162 | |||
163 | /* | ||
164 | * Before the mid layer attempts to scan for a new device where none | 150 | * Before the mid layer attempts to scan for a new device where none |
165 | * currently exists, it will call this entry in your driver. Should | 151 | * currently exists, it will call this entry in your driver. Should |
166 | * your driver need to allocate any structs or perform any other init | 152 | * your driver need to allocate any structs or perform any other init |
diff --git a/include/scsi/scsi_transport.h b/include/scsi/scsi_transport.h index e7b1054adf86..b3657f111937 100644 --- a/include/scsi/scsi_transport.h +++ b/include/scsi/scsi_transport.h | |||
@@ -48,6 +48,17 @@ struct scsi_transport_template { | |||
48 | * True if the transport wants to use a host-based work-queue | 48 | * True if the transport wants to use a host-based work-queue |
49 | */ | 49 | */ |
50 | unsigned int create_work_queue : 1; | 50 | unsigned int create_work_queue : 1; |
51 | |||
52 | /* | ||
53 | * This is an optional routine that allows the transport to become | ||
54 | * involved when a scsi io timer fires. The return value tells the | ||
55 | * timer routine how to finish the io timeout handling: | ||
56 | * EH_HANDLED: I fixed the error, please complete the command | ||
57 | * EH_RESET_TIMER: I need more time, reset the timer and | ||
58 | * begin counting again | ||
59 | * EH_NOT_HANDLED Begin normal error recovery | ||
60 | */ | ||
61 | enum scsi_eh_timer_return (* eh_timed_out)(struct scsi_cmnd *); | ||
51 | }; | 62 | }; |
52 | 63 | ||
53 | #define transport_class_to_shost(tc) \ | 64 | #define transport_class_to_shost(tc) \ |
diff --git a/include/scsi/scsi_transport_sas.h b/include/scsi/scsi_transport_sas.h index b91400bfb02a..93cfb4bf4211 100644 --- a/include/scsi/scsi_transport_sas.h +++ b/include/scsi/scsi_transport_sas.h | |||
@@ -30,6 +30,7 @@ enum sas_linkrate { | |||
30 | SAS_SATA_PORT_SELECTOR, | 30 | SAS_SATA_PORT_SELECTOR, |
31 | SAS_LINK_RATE_1_5_GBPS, | 31 | SAS_LINK_RATE_1_5_GBPS, |
32 | SAS_LINK_RATE_3_0_GBPS, | 32 | SAS_LINK_RATE_3_0_GBPS, |
33 | SAS_LINK_RATE_6_0_GBPS, | ||
33 | SAS_LINK_VIRTUAL, | 34 | SAS_LINK_VIRTUAL, |
34 | }; | 35 | }; |
35 | 36 | ||
@@ -89,11 +90,45 @@ struct sas_rphy { | |||
89 | dev_to_rphy((cdev)->dev) | 90 | dev_to_rphy((cdev)->dev) |
90 | #define rphy_to_shost(rphy) \ | 91 | #define rphy_to_shost(rphy) \ |
91 | dev_to_shost((rphy)->dev.parent) | 92 | dev_to_shost((rphy)->dev.parent) |
93 | #define target_to_rphy(targ) \ | ||
94 | dev_to_rphy((targ)->dev.parent) | ||
95 | |||
96 | struct sas_end_device { | ||
97 | struct sas_rphy rphy; | ||
98 | /* flags */ | ||
99 | unsigned ready_led_meaning:1; | ||
100 | /* parameters */ | ||
101 | u16 I_T_nexus_loss_timeout; | ||
102 | u16 initiator_response_timeout; | ||
103 | }; | ||
104 | #define rphy_to_end_device(r) \ | ||
105 | container_of((r), struct sas_end_device, rphy) | ||
106 | |||
107 | struct sas_expander_device { | ||
108 | int level; | ||
109 | |||
110 | #define SAS_EXPANDER_VENDOR_ID_LEN 8 | ||
111 | char vendor_id[SAS_EXPANDER_VENDOR_ID_LEN+1]; | ||
112 | #define SAS_EXPANDER_PRODUCT_ID_LEN 16 | ||
113 | char product_id[SAS_EXPANDER_PRODUCT_ID_LEN+1]; | ||
114 | #define SAS_EXPANDER_PRODUCT_REV_LEN 4 | ||
115 | char product_rev[SAS_EXPANDER_PRODUCT_REV_LEN+1]; | ||
116 | #define SAS_EXPANDER_COMPONENT_VENDOR_ID_LEN 8 | ||
117 | char component_vendor_id[SAS_EXPANDER_COMPONENT_VENDOR_ID_LEN+1]; | ||
118 | u16 component_id; | ||
119 | u8 component_revision_id; | ||
92 | 120 | ||
121 | struct sas_rphy rphy; | ||
122 | |||
123 | }; | ||
124 | #define rphy_to_expander_device(r) \ | ||
125 | container_of((r), struct sas_expander_device, rphy) | ||
93 | 126 | ||
94 | /* The functions by which the transport class and the driver communicate */ | 127 | /* The functions by which the transport class and the driver communicate */ |
95 | struct sas_function_template { | 128 | struct sas_function_template { |
96 | int (*get_linkerrors)(struct sas_phy *); | 129 | int (*get_linkerrors)(struct sas_phy *); |
130 | int (*get_enclosure_identifier)(struct sas_rphy *, u64 *); | ||
131 | int (*get_bay_identifier)(struct sas_rphy *); | ||
97 | int (*phy_reset)(struct sas_phy *, int); | 132 | int (*phy_reset)(struct sas_phy *, int); |
98 | }; | 133 | }; |
99 | 134 | ||
@@ -106,7 +141,8 @@ extern int sas_phy_add(struct sas_phy *); | |||
106 | extern void sas_phy_delete(struct sas_phy *); | 141 | extern void sas_phy_delete(struct sas_phy *); |
107 | extern int scsi_is_sas_phy(const struct device *); | 142 | extern int scsi_is_sas_phy(const struct device *); |
108 | 143 | ||
109 | extern struct sas_rphy *sas_rphy_alloc(struct sas_phy *); | 144 | extern struct sas_rphy *sas_end_device_alloc(struct sas_phy *); |
145 | extern struct sas_rphy *sas_expander_alloc(struct sas_phy *, enum sas_device_type); | ||
110 | void sas_rphy_free(struct sas_rphy *); | 146 | void sas_rphy_free(struct sas_rphy *); |
111 | extern int sas_rphy_add(struct sas_rphy *); | 147 | extern int sas_rphy_add(struct sas_rphy *); |
112 | extern void sas_rphy_delete(struct sas_rphy *); | 148 | extern void sas_rphy_delete(struct sas_rphy *); |
@@ -115,5 +151,17 @@ extern int scsi_is_sas_rphy(const struct device *); | |||
115 | extern struct scsi_transport_template * | 151 | extern struct scsi_transport_template * |
116 | sas_attach_transport(struct sas_function_template *); | 152 | sas_attach_transport(struct sas_function_template *); |
117 | extern void sas_release_transport(struct scsi_transport_template *); | 153 | extern void sas_release_transport(struct scsi_transport_template *); |
154 | int sas_read_port_mode_page(struct scsi_device *); | ||
155 | |||
156 | static inline int | ||
157 | scsi_is_sas_expander_device(struct device *dev) | ||
158 | { | ||
159 | struct sas_rphy *rphy; | ||
160 | if (!scsi_is_sas_rphy(dev)) | ||
161 | return 0; | ||
162 | rphy = dev_to_rphy(dev); | ||
163 | return rphy->identify.device_type == SAS_FANOUT_EXPANDER_DEVICE || | ||
164 | rphy->identify.device_type == SAS_EDGE_EXPANDER_DEVICE; | ||
165 | } | ||
118 | 166 | ||
119 | #endif /* SCSI_TRANSPORT_SAS_H */ | 167 | #endif /* SCSI_TRANSPORT_SAS_H */ |
diff --git a/include/scsi/scsi_transport_spi.h b/include/scsi/scsi_transport_spi.h index fb5a2ffae939..5e1d61913d4e 100644 --- a/include/scsi/scsi_transport_spi.h +++ b/include/scsi/scsi_transport_spi.h | |||
@@ -148,5 +148,9 @@ void spi_schedule_dv_device(struct scsi_device *); | |||
148 | void spi_dv_device(struct scsi_device *); | 148 | void spi_dv_device(struct scsi_device *); |
149 | void spi_display_xfer_agreement(struct scsi_target *); | 149 | void spi_display_xfer_agreement(struct scsi_target *); |
150 | int spi_print_msg(const unsigned char *); | 150 | int spi_print_msg(const unsigned char *); |
151 | int spi_populate_width_msg(unsigned char *msg, int width); | ||
152 | int spi_populate_sync_msg(unsigned char *msg, int period, int offset); | ||
153 | int spi_populate_ppr_msg(unsigned char *msg, int period, int offset, int width, | ||
154 | int options); | ||
151 | 155 | ||
152 | #endif /* SCSI_TRANSPORT_SPI_H */ | 156 | #endif /* SCSI_TRANSPORT_SPI_H */ |