diff options
Diffstat (limited to 'drivers/message/i2o/i2o_scsi.c')
-rw-r--r-- | drivers/message/i2o/i2o_scsi.c | 30 |
1 files changed, 20 insertions, 10 deletions
diff --git a/drivers/message/i2o/i2o_scsi.c b/drivers/message/i2o/i2o_scsi.c index 812c29ec86d3..c3b0c29ac02d 100644 --- a/drivers/message/i2o/i2o_scsi.c +++ b/drivers/message/i2o/i2o_scsi.c | |||
@@ -103,7 +103,7 @@ static struct i2o_scsi_host *i2o_scsi_host_alloc(struct i2o_controller *c) | |||
103 | i2o_status_block *sb; | 103 | i2o_status_block *sb; |
104 | 104 | ||
105 | list_for_each_entry(i2o_dev, &c->devices, list) | 105 | list_for_each_entry(i2o_dev, &c->devices, list) |
106 | if (i2o_dev->lct_data.class_id == I2O_CLASS_BUS_ADAPTER_PORT) { | 106 | if (i2o_dev->lct_data.class_id == I2O_CLASS_BUS_ADAPTER) { |
107 | if (i2o_parm_field_get(i2o_dev, 0x0000, 0, &type, 1) | 107 | if (i2o_parm_field_get(i2o_dev, 0x0000, 0, &type, 1) |
108 | && (type == 0x01)) /* SCSI bus */ | 108 | && (type == 0x01)) /* SCSI bus */ |
109 | max_channel++; | 109 | max_channel++; |
@@ -139,7 +139,7 @@ static struct i2o_scsi_host *i2o_scsi_host_alloc(struct i2o_controller *c) | |||
139 | 139 | ||
140 | i = 0; | 140 | i = 0; |
141 | list_for_each_entry(i2o_dev, &c->devices, list) | 141 | list_for_each_entry(i2o_dev, &c->devices, list) |
142 | if (i2o_dev->lct_data.class_id == I2O_CLASS_BUS_ADAPTER_PORT) { | 142 | if (i2o_dev->lct_data.class_id == I2O_CLASS_BUS_ADAPTER) { |
143 | if (i2o_parm_field_get(i2o_dev, 0x0000, 0, &type, 1) || (type == 1)) /* only SCSI bus */ | 143 | if (i2o_parm_field_get(i2o_dev, 0x0000, 0, &type, 1) || (type == 1)) /* only SCSI bus */ |
144 | i2o_shost->channel[i++] = i2o_dev; | 144 | i2o_shost->channel[i++] = i2o_dev; |
145 | 145 | ||
@@ -186,6 +186,7 @@ static int i2o_scsi_remove(struct device *dev) | |||
186 | 186 | ||
187 | shost_for_each_device(scsi_dev, i2o_shost->scsi_host) | 187 | shost_for_each_device(scsi_dev, i2o_shost->scsi_host) |
188 | if (scsi_dev->hostdata == i2o_dev) { | 188 | if (scsi_dev->hostdata == i2o_dev) { |
189 | sysfs_remove_link(&i2o_dev->device.kobj, "scsi"); | ||
189 | scsi_remove_device(scsi_dev); | 190 | scsi_remove_device(scsi_dev); |
190 | scsi_device_put(scsi_dev); | 191 | scsi_device_put(scsi_dev); |
191 | break; | 192 | break; |
@@ -259,12 +260,14 @@ static int i2o_scsi_probe(struct device *dev) | |||
259 | scsi_dev = | 260 | scsi_dev = |
260 | __scsi_add_device(i2o_shost->scsi_host, channel, id, lun, i2o_dev); | 261 | __scsi_add_device(i2o_shost->scsi_host, channel, id, lun, i2o_dev); |
261 | 262 | ||
262 | if (!scsi_dev) { | 263 | if (IS_ERR(scsi_dev)) { |
263 | osm_warn("can not add SCSI device %03x\n", | 264 | osm_warn("can not add SCSI device %03x\n", |
264 | i2o_dev->lct_data.tid); | 265 | i2o_dev->lct_data.tid); |
265 | return -EFAULT; | 266 | return PTR_ERR(scsi_dev); |
266 | } | 267 | } |
267 | 268 | ||
269 | sysfs_create_link(&i2o_dev->device.kobj, &scsi_dev->sdev_gendev.kobj, "scsi"); | ||
270 | |||
268 | osm_info("device added (TID: %03x) channel: %d, id: %d, lun: %d\n", | 271 | osm_info("device added (TID: %03x) channel: %d, id: %d, lun: %d\n", |
269 | i2o_dev->lct_data.tid, channel, id, (unsigned int)lun); | 272 | i2o_dev->lct_data.tid, channel, id, (unsigned int)lun); |
270 | 273 | ||
@@ -545,7 +548,13 @@ static int i2o_scsi_queuecommand(struct scsi_cmnd *SCpnt, | |||
545 | int tid; | 548 | int tid; |
546 | struct i2o_message __iomem *msg; | 549 | struct i2o_message __iomem *msg; |
547 | u32 m; | 550 | u32 m; |
548 | u32 scsi_flags, sg_flags; | 551 | /* |
552 | * ENABLE_DISCONNECT | ||
553 | * SIMPLE_TAG | ||
554 | * RETURN_SENSE_DATA_IN_REPLY_MESSAGE_FRAME | ||
555 | */ | ||
556 | u32 scsi_flags = 0x20a00000; | ||
557 | u32 sg_flags; | ||
549 | u32 __iomem *mptr; | 558 | u32 __iomem *mptr; |
550 | u32 __iomem *lenptr; | 559 | u32 __iomem *lenptr; |
551 | u32 len; | 560 | u32 len; |
@@ -591,17 +600,19 @@ static int i2o_scsi_queuecommand(struct scsi_cmnd *SCpnt, | |||
591 | 600 | ||
592 | switch (SCpnt->sc_data_direction) { | 601 | switch (SCpnt->sc_data_direction) { |
593 | case PCI_DMA_NONE: | 602 | case PCI_DMA_NONE: |
594 | scsi_flags = 0x00000000; // DATA NO XFER | 603 | /* DATA NO XFER */ |
595 | sg_flags = 0x00000000; | 604 | sg_flags = 0x00000000; |
596 | break; | 605 | break; |
597 | 606 | ||
598 | case PCI_DMA_TODEVICE: | 607 | case PCI_DMA_TODEVICE: |
599 | scsi_flags = 0x80000000; // DATA OUT (iop-->dev) | 608 | /* DATA OUT (iop-->dev) */ |
609 | scsi_flags |= 0x80000000; | ||
600 | sg_flags = 0x14000000; | 610 | sg_flags = 0x14000000; |
601 | break; | 611 | break; |
602 | 612 | ||
603 | case PCI_DMA_FROMDEVICE: | 613 | case PCI_DMA_FROMDEVICE: |
604 | scsi_flags = 0x40000000; // DATA IN (iop<--dev) | 614 | /* DATA IN (iop<--dev) */ |
615 | scsi_flags |= 0x40000000; | ||
605 | sg_flags = 0x10000000; | 616 | sg_flags = 0x10000000; |
606 | break; | 617 | break; |
607 | 618 | ||
@@ -639,8 +650,7 @@ static int i2o_scsi_queuecommand(struct scsi_cmnd *SCpnt, | |||
639 | } | 650 | } |
640 | */ | 651 | */ |
641 | 652 | ||
642 | /* Direction, disconnect ok, tag, CDBLen */ | 653 | writel(scsi_flags | SCpnt->cmd_len, mptr++); |
643 | writel(scsi_flags | 0x20200000 | SCpnt->cmd_len, mptr ++); | ||
644 | 654 | ||
645 | /* Write SCSI command into the message - always 16 byte block */ | 655 | /* Write SCSI command into the message - always 16 byte block */ |
646 | memcpy_toio(mptr, SCpnt->cmnd, 16); | 656 | memcpy_toio(mptr, SCpnt->cmnd, 16); |