24 #include <linux/slab.h>
25 #include <linux/module.h>
26 #include <scsi/scsi.h>
31 #define HP_SW_NAME "hp_sw"
33 #define HP_SW_TIMEOUT (60 * HZ)
34 #define HP_SW_RETRIES 3
36 #define HP_SW_PATH_UNINITIALIZED -1
37 #define HP_SW_PATH_ACTIVE 0
38 #define HP_SW_PATH_PASSIVE 1
74 "%s: sending tur failed, no sense available\n",
79 switch (sshdr.sense_key) {
84 if ((sshdr.asc == 0x04) && (sshdr.ascq == 2)) {
96 "%s: sending tur failed, sense %x/%x/%x\n",
123 req->cmd_type = REQ_TYPE_BLOCK_PC;
129 req->sense = h->
sense;
135 if (req->sense_len > 0) {
136 ret = tur_done(sdev, h->
sense);
139 "%s: sending tur failed with %x\n",
166 static int start_done(
struct scsi_device *sdev,
unsigned char *sense)
174 "%s: sending start_stop_unit failed, "
175 "no sense available\n",
179 switch (sshdr.sense_key) {
181 if ((sshdr.asc == 0x04) && (sshdr.ascq == 3)) {
193 "%s: sending start_stop_unit failed, sense %x/%x/%x\n",
202 static void start_stop_endio(
struct request *req,
int error)
210 "%s: sending start_stop_unit failed with %x\n",
216 if (req->sense_len > 0) {
222 err = hp_sw_start_stop(h);
229 req->end_io_data =
NULL;
253 req->cmd_type = REQ_TYPE_BLOCK_PC;
260 req->sense = h->
sense;
263 req->end_io_data =
h;
272 int ret = BLKPREP_OK;
292 static int hp_sw_activate(
struct scsi_device *sdev,
298 ret = hp_sw_tur(sdev, h);
304 ret = hp_sw_start_stop(h);
316 {
"COMPAQ",
"MSA1000 VOLUME"},
317 {
"COMPAQ",
"HSV110"},
327 if (scsi_device_tpgs(sdev))
330 for (i = 0; hp_sw_dh_data_list[
i].
vendor; i++) {
341 static int hp_sw_bus_attach(
struct scsi_device *sdev);
342 static void hp_sw_bus_detach(
struct scsi_device *sdev);
347 .devlist = hp_sw_dh_data_list,
348 .attach = hp_sw_bus_attach,
349 .detach = hp_sw_bus_detach,
350 .activate = hp_sw_activate,
351 .prep_fn = hp_sw_prep_fn,
352 .match = hp_sw_match,
355 static int hp_sw_bus_attach(
struct scsi_device *sdev)
362 scsi_dh_data = kzalloc(
sizeof(*scsi_dh_data)
370 scsi_dh_data->
scsi_dh = &hp_sw_dh;
376 ret = hp_sw_tur(sdev, h);
385 spin_unlock_irqrestore(sdev->
request_queue->queue_lock, flags);
400 static void hp_sw_bus_detach(
struct scsi_device *sdev )
408 spin_unlock_irqrestore(sdev->
request_queue->queue_lock, flags);
416 static int __init hp_sw_init(
void)
421 static void __exit hp_sw_exit(
void)