Re: [PATCH v2] libata: translate INQUIRY VPD page 89h (ATA info)
Jeff Garzik wrote: + memcpy(&pbuf[8], "ATA ", 8); + ata_id_string(args->id, &pbuf[16], ATA_ID_PROD, 16); + ata_id_string(args->id, &pbuf[32], ATA_ID_FW_REV, 4); And I just checked in a fix that changes the above to reflect the SCSI simulator's vendor/product/version (linux/libata/DRV_VERSION), rather than the ATA device's, as the spec wants. Jeff - To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v2] libata: translate INQUIRY VPD page 89h (ATA info)
Ditched ATAPI, fixed a bug, a few clean-ups and fixmes taken care of. commit a1c69f03a85fe6fa1b7f2f3726dd7205eb68a328 Author: Jeff Garzik <[EMAIL PROTECTED]> Date: Fri Sep 21 20:38:03 2007 -0400 [libata] SCSI: support INQUIRY page 89h (ATA info page) Signed-off-by: Jeff Garzik <[EMAIL PROTECTED]> drivers/ata/libata-scsi.c | 72 +++--- 1 file changed, 68 insertions(+), 4 deletions(-) a1c69f03a85fe6fa1b7f2f3726dd7205eb68a328 diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c index 7ad046b..b399662 100644 --- a/drivers/ata/libata-scsi.c +++ b/drivers/ata/libata-scsi.c @@ -1804,6 +1804,61 @@ unsigned int ata_scsiop_inq_83(struct ata_scsi_args *args, u8 *rbuf, } /** + * ata_scsiop_inq_89 - Simulate INQUIRY VPD page 89, ATA info + * @args: device IDENTIFY data / SCSI command of interest. + * @rbuf: Response buffer, to which simulated SCSI cmd output is sent. + * @buflen: Response buffer length. + * + * Yields SAT-specified ATA VPD page. + * + * LOCKING: + * spin_lock_irqsave(host lock) + */ + +unsigned int ata_scsiop_inq_89(struct ata_scsi_args *args, u8 *rbuf, + unsigned int buflen) +{ + u8 pbuf[60]; + struct ata_taskfile tf; + unsigned int i; + + if (!buflen) + return 0; + + memset(&pbuf, 0, sizeof(pbuf)); + memset(&tf, 0, sizeof(tf)); + + pbuf[1] = 0x89; /* our page code */ + pbuf[2] = (0x238 >> 8); /* page size fixed at 238h */ + pbuf[3] = (0x238 & 0xff); + + memcpy(&pbuf[8], "ATA ", 8); + ata_id_string(args->id, &pbuf[16], ATA_ID_PROD, 16); + ata_id_string(args->id, &pbuf[32], ATA_ID_FW_REV, 4); + + /* we don't store the ATA device signature, so we fake it */ + + tf.command = ATA_DRDY; /* really, this is Status reg */ + tf.lbal = 0x1; + tf.nsect = 0x1; + + ata_tf_to_fis(&tf, 0, 1, &pbuf[36]);/* TODO: PMP? */ + pbuf[36] = 0x34;/* force D2H Reg FIS (34h) */ + + pbuf[56] = ATA_CMD_ID_ATA; + + i = min(buflen, 60U); + memcpy(rbuf, &pbuf[0], i); + buflen -= i; + + if (!buflen) + return 0; + + memcpy(&rbuf[60], &args->id[0], min(buflen, 512U)); + return 0; +} + +/** * ata_scsiop_noop - Command handler that simply returns success. * @args: device IDENTIFY data / SCSI command of interest. * @rbuf: Response buffer, to which simulated SCSI cmd output is sent. @@ -2880,14 +2935,23 @@ void ata_scsi_simulate(struct ata_device *dev, struct scsi_cmnd *cmd, ata_scsi_invalid_field(cmd, done); else if ((scsicmd[1] & 1) == 0)/* is EVPD clear? */ ata_scsi_rbuf_fill(&args, ata_scsiop_inq_std); - else if (scsicmd[2] == 0x00) + else switch (scsicmd[2]) { + case 0x00: ata_scsi_rbuf_fill(&args, ata_scsiop_inq_00); - else if (scsicmd[2] == 0x80) + break; + case 0x80: ata_scsi_rbuf_fill(&args, ata_scsiop_inq_80); - else if (scsicmd[2] == 0x83) + break; + case 0x83: ata_scsi_rbuf_fill(&args, ata_scsiop_inq_83); - else + break; + case 0x89: + ata_scsi_rbuf_fill(&args, ata_scsiop_inq_89); + break; + default: ata_scsi_invalid_field(cmd, done); + break; + } break; case MODE_SENSE: - To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] libata: translate INQUIRY VPD page 89h (ATA info)
James Bottomley wrote: On Fri, 2007-09-21 at 05:48 -0400, Jeff Garzik wrote: commit a6d5ac6a3a1cfbed2a045928bbadd5285f1df084 Author: Jeff Garzik <[EMAIL PROTECTED]> Date: Fri Sep 21 05:07:19 2007 -0400 [libata] SCSI: support INQUIRY page 89h (ATA info page) Signed-off-by: Jeff Garzik <[EMAIL PROTECTED]> drivers/ata/libata-scsi.c | 82 +++--- 1 file changed, 78 insertions(+), 4 deletions(-) a6d5ac6a3a1cfbed2a045928bbadd5285f1df084 diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c index 7ad046b..bb5a5c1 100644 --- a/drivers/ata/libata-scsi.c +++ b/drivers/ata/libata-scsi.c @@ -1804,6 +1804,71 @@ unsigned int ata_scsiop_inq_83(struct ata_scsi_args *args, u8 *rbuf, } /** + * ata_scsiop_inq_89 - Simulate INQUIRY VPD page 89, ATA info + * @args: device IDENTIFY data / SCSI command of interest. + * @rbuf: Response buffer, to which simulated SCSI cmd output is sent. + * @buflen: Response buffer length. + * + * Yields SAT-specified ATA VPD page. + * + * LOCKING: + * spin_lock_irqsave(host lock) + */ + +unsigned int ata_scsiop_inq_89(struct ata_scsi_args *args, u8 *rbuf, + unsigned int buflen) +{ + struct ata_device *dev = args->dev; + u8 pbuf[60]; + bool is_atapi = (dev->class == ATA_DEV_ATAPI); I thought this was only used in the dev->class == ATA_DEV_ATA leg of the ata_scsi_queuecommand(), so isn't this always false? Now I remember why this is here -- SAT specifies providing this page even for ATAPI devices (optional). If the SATL chooses to do so, the obvious fallout ensues: snooping and modifying the list of supported VPD pages, etc. That's too cumbersome IMO, so I'm just going to do it for ATA. So, same end result as with my previous response (atapi checks go away), but this was some additional info. + struct ata_taskfile tf; + unsigned int i; + + if (!buflen) + return 0; + + memset(&pbuf, 0, sizeof(pbuf)); + memset(&tf, 0, sizeof(tf)); + + if (is_atapi) + pbuf[0] = 0x5; /* FIXME: hardcodes MMC */ Actually, in MMC implementation of INQUIRY per SPC-3 (or earlier if MMC < 5) is mandatory. The problem cases I can see are non-standard ATAPI devices (probably scanners). To be more clear: pbuf[0] is peripheral device type. ATAPI devices are not limited to device type == 5 (MMC), hence the 'FIXME'. Tape devices are a different device type, for example. libata treats ATAPI as a pass-through bridge to a conforming SCSI device of /any/ type. There are actually some ATAPI bridges which plug into any SCSI-2 device, those these are quite rare in practice. libata only provides a single modification to any SCSI command passed to an ATAPI device: INQUIRY is fixed up to report scsi-version==5, if scsi-version==0 (see atapi_qc_complete). Jeff - To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
RE: Megaraid driver not detecting RAID volumes in kernel 2.6.22?
> > https://bugzilla.redhat.com/show_bug.cgi?id=288421 > > When running Fedora on a Dell 2950 w/ integrated LSI Perc5i (megaraid), the > system will not boot after upgrading to 2.6.22. The boot message indicates the > system is somehow seeing through RAID, cannot access logical volume. This > causes the root device to be unavailable and the kernel to panic. > > Version-Release number of selected component (if applicable): > I experience this problem with kernel 2.6.22 and higher. I do not believe it is > isolated to FC6, as I downloaded the stock 2.6.22 kernel from kernel.org and was > able to reproduce. > > How reproducible: > Every time. > > Steps to Reproduce: > 1. Configure RAID10 (I've also tried RAID5) on a Perc5i in this system. > > 2. Load Fedora Core. The installer works fine since the kernel version it uses > has a working LSI driver. > > 3. Upgrade to 2.6.22 kernel image (in yum) or download kernel.org sources, > compile, and install. > > 4. Reboot system. It comes up unable to boot. The kernel panics. > > Actual results: > As the system boots, it cannot mount the root device. Also in the output we see > all 6 disks separately, when they should be showing up as one logical volume. Could a standard MPT driver (non-RAID) be loading on this controller? During the reboot, can you see megaraid driver loading at all? Or do you see mpt_scsi driver? Before upgrading, can you blacklist this controller in pci hotplug? I see shpchp on your screenshot. Sreenivas - To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
RE: [PATCH] aic94xx: fix smartctl utility problem
Hi James, We want to find the root cause and make sure this problem will happen on STA device certain commands. If it does not affect SATA device then we can adopt the workaround. Thanks! Gilbert -Original Message- From: James Bottomley [mailto:[EMAIL PROTECTED] Sent: Friday, September 21, 2007 1:40 PM To: Wu, Gilbert Cc: [EMAIL PROTECTED]; Linux-scsi@vger.kernel.org Subject: RE: [PATCH] aic94xx: fix smartctl utility problem On Fri, 2007-09-21 at 11:53 -0700, Wu, Gilbert wrote: >I can reproduce the problem on my machine. Most likely, the Sequencer > (Firmware) has bug on handling ATA output register for ATAPI device. I > am still working on this issue with Sequencer engineer. But, since you already vet the commands we can simply work around this by not asking for the ATA output register on packet commands (i.e. just add ATA_CMD_PACKET to the is_ata_rw_command() switch statement. James - To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: aic79xx problems
On Thu, 2007-09-20 at 09:41 -0500, James Bottomley wrote: > On Thu, 2007-09-20 at 16:34 +0200, Stefan Boresch wrote: > > So, since I seem to have a slightly broken machine at hand, let me > > know whether I can try/test anything to fix the issues the newer > > kernels might have. > > It will take me a while to set up the configuration, so the dmesg from > the failing 2.6.2x might be helpful, just in case it's an obvious > problem that doesn't need debugging (small chance, but still possible). OK, did the cut cable test (finally). It turns out that our DV interaction with aic79xx isn't very smart. After assessing that wide isn't allowed and turning it off, it then merrily begins DV at the lowest possible period it can think of, which turns wide back on again, sigh. Try this patch, it fixes the problem for me. James diff --git a/drivers/scsi/scsi_transport_spi.c b/drivers/scsi/scsi_transport_spi.c index 6f56f87..fccc62d 100644 --- a/drivers/scsi/scsi_transport_spi.c +++ b/drivers/scsi/scsi_transport_spi.c @@ -787,6 +787,7 @@ spi_dv_device_internal(struct scsi_device *sdev, u8 *buffer) struct scsi_target *starget = sdev->sdev_target; struct Scsi_Host *shost = sdev->host; int len = sdev->inquiry_len; + int min_period = spi_min_period(starget); /* first set us up for narrow async */ DV_SET(offset, 0); DV_SET(width, 0); @@ -809,6 +810,11 @@ spi_dv_device_internal(struct scsi_device *sdev, u8 *buffer) != SPI_COMPARE_SUCCESS) { starget_printk(KERN_ERR, starget, "Wide Transfers Fail\n"); i->f->set_width(starget, 0); + /* Make sure we don't force wide back on by asking +* for a transfer period that requires it */ + spi_max_width(starget) = 0; + if (min_period < 10) + min_period = 10; } } @@ -828,7 +834,8 @@ spi_dv_device_internal(struct scsi_device *sdev, u8 *buffer) /* now set up to the maximum */ DV_SET(offset, spi_max_offset(starget)); - DV_SET(period, spi_min_period(starget)); + DV_SET(period, min_period); + /* try QAS requests; this should be harmless to set if the * target supports it */ if (scsi_device_qas(sdev)) { @@ -837,14 +844,14 @@ spi_dv_device_internal(struct scsi_device *sdev, u8 *buffer) DV_SET(qas, 0); } - if (scsi_device_ius(sdev) && spi_min_period(starget) < 9) { + if (scsi_device_ius(sdev) && min_period < 9) { /* This u320 (or u640). Set IU transfers */ DV_SET(iu, 1); /* Then set the optional parameters */ DV_SET(rd_strm, 1); DV_SET(wr_flow, 1); DV_SET(rti, 1); - if (spi_min_period(starget) == 8) + if (min_period == 8) DV_SET(pcomp_en, 1); } else { DV_SET(iu, 0); - To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v3] Fix ibmvscsi client for multiplatform iSeries+pSeries kernel
From: David Woodhouse <[EMAIL PROTECTED]> If you build a multiplatform kernel for iSeries and pSeries, with ibmvscsic support, the resulting client doesn't work on iSeries. This fixes that, using the appropriate low-level operations for the machine detected at runtime. Signed-off-by: David Woodhouse <[EMAIL PROTECTED]> Acked by: Brian King <[EMAIL PROTECTED]> Signed-off-by: Paul Mackerras <[EMAIL PROTECTED]> --- This is being submitted for inclusion in 2.6.24. --- diff --git a/drivers/scsi/ibmvscsi/rpa_vscsi.c b/drivers/scsi/ibmvscsi/rpa_vscsi.c index 9c14e78..1821461 100644 --- a/drivers/scsi/ibmvscsi/rpa_vscsi.c +++ b/drivers/scsi/ibmvscsi/rpa_vscsi.c @@ -42,14 +42,14 @@ static unsigned int partition_number = -1; * Routines for managing the command/response queue */ /** - * ibmvscsi_handle_event: - Interrupt handler for crq events + * rpavscsi_handle_event: - Interrupt handler for crq events * @irq: number of irq to handle, not used * @dev_instance: ibmvscsi_host_data of host that received interrupt * * Disables interrupts and schedules srp_task * Always returns IRQ_HANDLED */ -static irqreturn_t ibmvscsi_handle_event(int irq, void *dev_instance) +static irqreturn_t rpavscsi_handle_event(int irq, void *dev_instance) { struct ibmvscsi_host_data *hostdata = (struct ibmvscsi_host_data *)dev_instance; @@ -66,9 +66,9 @@ static irqreturn_t ibmvscsi_handle_event(int irq, void *dev_instance) * Frees irq, deallocates a page for messages, unmaps dma, and unregisters * the crq with the hypervisor. */ -void ibmvscsi_release_crq_queue(struct crq_queue *queue, - struct ibmvscsi_host_data *hostdata, - int max_requests) +static void rpavscsi_release_crq_queue(struct crq_queue *queue, + struct ibmvscsi_host_data *hostdata, + int max_requests) { long rc; struct vio_dev *vdev = to_vio_dev(hostdata->dev); @@ -108,12 +108,13 @@ static struct viosrp_crq *crq_queue_next_crq(struct crq_queue *queue) } /** - * ibmvscsi_send_crq: - Send a CRQ + * rpavscsi_send_crq: - Send a CRQ * @hostdata: the adapter * @word1: the first 64 bits of the data * @word2: the second 64 bits of the data */ -int ibmvscsi_send_crq(struct ibmvscsi_host_data *hostdata, u64 word1, u64 word2) +static int rpavscsi_send_crq(struct ibmvscsi_host_data *hostdata, +u64 word1, u64 word2) { struct vio_dev *vdev = to_vio_dev(hostdata->dev); @@ -121,10 +122,10 @@ int ibmvscsi_send_crq(struct ibmvscsi_host_data *hostdata, u64 word1, u64 word2) } /** - * ibmvscsi_task: - Process srps asynchronously + * rpavscsi_task: - Process srps asynchronously * @data: ibmvscsi_host_data of host */ -static void ibmvscsi_task(void *data) +static void rpavscsi_task(void *data) { struct ibmvscsi_host_data *hostdata = (struct ibmvscsi_host_data *)data; struct vio_dev *vdev = to_vio_dev(hostdata->dev); @@ -190,6 +191,42 @@ static void set_adapter_info(struct ibmvscsi_host_data *hostdata) } /** + * reset_crq_queue: - resets a crq after a failure + * @queue: crq_queue to initialize and register + * @hostdata: ibmvscsi_host_data of host + * + */ +static int rpavscsi_reset_crq_queue(struct crq_queue *queue, + struct ibmvscsi_host_data *hostdata) +{ + int rc; + struct vio_dev *vdev = to_vio_dev(hostdata->dev); + + /* Close the CRQ */ + do { + rc = plpar_hcall_norets(H_FREE_CRQ, vdev->unit_address); + } while ((rc == H_BUSY) || (H_IS_LONG_BUSY(rc))); + + /* Clean out the queue */ + memset(queue->msgs, 0x00, PAGE_SIZE); + queue->cur = 0; + + set_adapter_info(hostdata); + + /* And re-open it again */ + rc = plpar_hcall_norets(H_REG_CRQ, + vdev->unit_address, + queue->msg_token, PAGE_SIZE); + if (rc == 2) { + /* Adapter is good, but other end is not ready */ + dev_warn(hostdata->dev, "Partner adapter not ready\n"); + } else if (rc != 0) { + dev_warn(hostdata->dev, "couldn't register crq--rc 0x%x\n", rc); + } + return rc; +} + +/** * initialize_crq_queue: - Initializes and registers CRQ with hypervisor * @queue: crq_queue to initialize and register * @hostdata: ibmvscsi_host_data of host @@ -198,9 +235,9 @@ static void set_adapter_info(struct ibmvscsi_host_data *hostdata) * the crq with the hypervisor. * Returns zero on success. */ -int ibmvscsi_init_crq_queue(struct crq_queue *queue, - struct ibmvscsi_host_data *hostdata, - int max_requests) +static int rpavscsi_init_crq_queue(struct crq_queue *queue, + struct ibmvscsi_host_data *hostdata, +
Megaraid driver not detecting RAID volumes in kernel 2.6.22?
https://bugzilla.redhat.com/show_bug.cgi?id=288421 When running Fedora on a Dell 2950 w/ integrated LSI Perc5i (megaraid), the system will not boot after upgrading to 2.6.22. The boot message indicates the system is somehow seeing through RAID, cannot access logical volume. This causes the root device to be unavailable and the kernel to panic. Version-Release number of selected component (if applicable): I experience this problem with kernel 2.6.22 and higher. I do not believe it is isolated to FC6, as I downloaded the stock 2.6.22 kernel from kernel.org and was able to reproduce. How reproducible: Every time. Steps to Reproduce: 1. Configure RAID10 (I've also tried RAID5) on a Perc5i in this system. 2. Load Fedora Core. The installer works fine since the kernel version it uses has a working LSI driver. 3. Upgrade to 2.6.22 kernel image (in yum) or download kernel.org sources, compile, and install. 4. Reboot system. It comes up unable to boot. The kernel panics. Actual results: As the system boots, it cannot mount the root device. Also in the output we see all 6 disks separately, when they should be showing up as one logical volume. - To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
RE: [PATCH] aic94xx: fix smartctl utility problem
On Fri, 2007-09-21 at 11:53 -0700, Wu, Gilbert wrote: >I can reproduce the problem on my machine. Most likely, the Sequencer > (Firmware) has bug on handling ATA output register for ATAPI device. I > am still working on this issue with Sequencer engineer. But, since you already vet the commands we can simply work around this by not asking for the ATA output register on packet commands (i.e. just add ATA_CMD_PACKET to the is_ata_rw_command() switch statement. James - To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] libata: translate INQUIRY VPD page 89h (ATA info)
James Bottomley wrote: On Fri, 2007-09-21 at 05:48 -0400, Jeff Garzik wrote: commit a6d5ac6a3a1cfbed2a045928bbadd5285f1df084 Author: Jeff Garzik <[EMAIL PROTECTED]> Date: Fri Sep 21 05:07:19 2007 -0400 [libata] SCSI: support INQUIRY page 89h (ATA info page) Signed-off-by: Jeff Garzik <[EMAIL PROTECTED]> drivers/ata/libata-scsi.c | 82 +++--- 1 file changed, 78 insertions(+), 4 deletions(-) a6d5ac6a3a1cfbed2a045928bbadd5285f1df084 diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c index 7ad046b..bb5a5c1 100644 --- a/drivers/ata/libata-scsi.c +++ b/drivers/ata/libata-scsi.c @@ -1804,6 +1804,71 @@ unsigned int ata_scsiop_inq_83(struct ata_scsi_args *args, u8 *rbuf, } /** + * ata_scsiop_inq_89 - Simulate INQUIRY VPD page 89, ATA info + * @args: device IDENTIFY data / SCSI command of interest. + * @rbuf: Response buffer, to which simulated SCSI cmd output is sent. + * @buflen: Response buffer length. + * + * Yields SAT-specified ATA VPD page. + * + * LOCKING: + * spin_lock_irqsave(host lock) + */ + +unsigned int ata_scsiop_inq_89(struct ata_scsi_args *args, u8 *rbuf, + unsigned int buflen) +{ + struct ata_device *dev = args->dev; + u8 pbuf[60]; + bool is_atapi = (dev->class == ATA_DEV_ATAPI); I thought this was only used in the dev->class == ATA_DEV_ATA leg of the ata_scsi_queuecommand(), so isn't this always false? Actually, yes, you're right. + struct ata_taskfile tf; + unsigned int i; + + if (!buflen) + return 0; + + memset(&pbuf, 0, sizeof(pbuf)); + memset(&tf, 0, sizeof(tf)); + + if (is_atapi) + pbuf[0] = 0x5; /* FIXME: hardcodes MMC */ Actually, in MMC implementation of INQUIRY per SPC-3 (or earlier if MMC < 5) is mandatory. The problem cases I can see are non-standard ATAPI devices (probably scanners). The problem at hand is that the device might -not- be an MMC device at all. But it sounds like that stuff can be removed regardless. Jeff - To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
RE: [PATCH] aic94xx: fix smartctl utility problem
Hi James, I can reproduce the problem on my machine. Most likely, the Sequencer (Firmware) has bug on handling ATA output register for ATAPI device. I am still working on this issue with Sequencer engineer. Thanks! Gilbert -Original Message- From: James Bottomley [mailto:[EMAIL PROTECTED] Sent: Monday, September 17, 2007 3:59 PM To: Wu, Gilbert Cc: [EMAIL PROTECTED]; Linux-scsi@vger.kernel.org Subject: RE: [PATCH] aic94xx: fix smartctl utility problem On Mon, 2007-09-17 at 13:53 -0700, Wu, Gilbert wrote: >I tested the SATA DVD Plextor model 716SA and 755SA with direct > attached. Both failed in my tested system and it end up with System > Panic even without my patch. Actually, because of the difficulty of wiring it up, I've not tried directly attached SATAPI devices, only expander remote ones (which do work). I did manage to cheat and force one into a drive bay using a mini inifiniband connector, and it seems to work just fine as well. This is the boot log with it directly connected to phy6: aic94xx: posting 8 control phy scbs aic94xx: control_phy_tasklet_complete: phy6, lrate:0x8, proto:0xe aic94xx: control_phy_tasklet_complete: phy0: no device present: oob_status:0x0 aic94xx: control_phy_tasklet_complete: phy1: no device present: oob_status:0x0 aic94xx: control_phy_tasklet_complete: phy2: no device present: oob_status:0x0 aic94xx: control_phy_tasklet_complete: phy3: no device present: oob_status:0x0 aic94xx: control_phy_tasklet_complete: phy4: no device present: oob_status:0x0 aic94xx: control_phy_tasklet_complete: phy5: no device present: oob_status:0x0 aic94xx: control_phy_tasklet_complete: phy7: no device present: oob_status:0x0 aic94xx: escb_tasklet_complete: phy6: BYTES_DMAED aic94xx: STP proto device-to-host FIS: aic94xx: 00: 34 00 10 01 aic94xx: 04: 01 14 eb 00 aic94xx: 08: 00 00 00 00 aic94xx: 0c: 01 00 00 00 aic94xx: 10: 00 00 00 00 aic94xx: asd_form_port: updating phy_mask 0x40 for phy6 sas: phy6 added to port0, phy_mask:0x40 sas: DOING DISCOVERY on port 0, pid:3197 sas: sas_ata_phy_reset: Found ATAPI device. ata1.00: ATAPI: PLEXTOR DVDR PX-755A, 1.03, max UDMA/66 ata1.00: configured for UDMA/66 scsi 3:0:0:0: CD-ROMPLEXTOR DVDR PX-755A 1.03 PQ: 0 ANSI: 5 sr0: scsi3-mmc drive: 40x/40x writer cd/rw xa/form2 cdda tray sr 3:0:0:0: Attached scsi generic sg1 type 5 sas: DONE DISCOVERY on port 0, pid:3197, result:0 > The CSMI_TASK should not make any > difference between ATA and ATAPI device. I am digging into it for root > cause. It does if it's set on a command that's not generated by the smartctl utility ... which is what happens for the ATA PACKET COMMAND case. James - To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: qla2xxx behavior with changing volumes
Vladislav Bolkhovitin wrote: Sean Bruno wrote: What is the expected behavior when volumes on a SAN change size and LUN ID order? I've noticed that if a volume changes size, leaves the SAN or changes target ID it isn't auto-magically picked up by a 2.6.18 based system(running CentOS 5). If a new target appears on the SAN however, it is noticed and assigned a new drive letter. For changes in the volume size the target (SAN) should generate "CAPACITY DATA HAS CHANGED" Unit Attention. For changes in the LUN ID order the target should generate "REPORTED LUNS DATA HAS CHANGED" Unit Attention. On these notifications initiator is supposed to make the appropriate actions, like rescan the SAN in case of "REPORTED LUNS DATA HAS CHANGED". Unfortunately, Linux just ignores them as well as the majority of other Unit Attentions, hence you have to restart the system or, at least, the corresponding driver to see the changes. Or, I forgot, do the manual rescan via sysfs "rescan". Sometimes it helps too. Vlad - To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: qla2xxx behavior with changing volumes
Sean Bruno wrote: What is the expected behavior when volumes on a SAN change size and LUN ID order? I've noticed that if a volume changes size, leaves the SAN or changes target ID it isn't auto-magically picked up by a 2.6.18 based system(running CentOS 5). If a new target appears on the SAN however, it is noticed and assigned a new drive letter. For changes in the volume size the target (SAN) should generate "CAPACITY DATA HAS CHANGED" Unit Attention. For changes in the LUN ID order the target should generate "REPORTED LUNS DATA HAS CHANGED" Unit Attention. On these notifications initiator is supposed to make the appropriate actions, like rescan the SAN in case of "REPORTED LUNS DATA HAS CHANGED". Unfortunately, Linux just ignores them as well as the majority of other Unit Attentions, hence you have to restart the system or, at least, the corresponding driver to see the changes. Vlad - To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] aic7xxx driver. Restrict DMA to 32bit for 29320LPE Adaptec SCSI controller
please don't drop linux-scsi ... just because no-one else has asked the question doesn't mean they're not interested in the answer. Having the answer in the list means that search tools can find it. On Thu, 2007-09-20 at 09:20 -0700, Anil K. Ravindranath wrote: > Oh I see. I looked into the scsi_host_alloc(), now I see this.Thanks. By > setting a dma_boundary to 4G, does it mean the kernel(in block) is > ensuring that a DMA segment will not cross this 4G boundary. I mean a > DMA segment will not be split at 4G boundary. Yes, that's exactly what it means. Primarily, as I said, because PCI bridges can't necessarily span non-DAC to DAC in a single DMA transfer. James > With regards, > Anil > > > On Thu, 2007-09-20 at 19:41 -0500, James Bottomley wrote: > > On Thu, 2007-09-20 at 08:08 -0700, Anil K. Ravindranath wrote: > > > Hi, > > > > > > We have not heard any comments or inputs on this patch. > > > > > > With regards, > > > Anil > > > > > > On Sat, 2007-06-30 at 05:45 -0700, Anil K. Ravindranath wrote: > > > > Subject: [PATCH] aic7xxx driver. Restrict DMA to 32bit for 29320LPE > > > > Adaptec SCSI controller > > > > > > > > Contribution: > > > > > > > > Anil Ravindranath <[EMAIL PROTECTED]> > > > > > > > > Issue: > > > > > > > > Data Bursts that cross from 32- to 64-Bit address space have incorrect > > > > address for 29320LPE. This leads to potential data corruption. > > > > Where do you think you see this happening? The block layer has a > > dma_boundary parameter (basically a mask which it refuses to allow dma > > to cross). By default this is set to 4GB (because a lot of PCI cards > > have difficulty going from non-DAC to DAC). The aic79xx driver does > > nothing to alter this, so you shouldn't be seeing any DMA segments > > crossing the 4GB boundary. > > > > James > > > > - To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 4/5] qla2xxx: add target mode support
Andrew Vasquez wrote: > On Sat, 01 Sep 2007, FUJITA Tomonori wrote: > >> This adds target mode support to qla2xxx. >> >> With set ql2enable_target_mode module parameter to 1, the driver runs >> in target mode. By default, ql2enable_target_mode is set to 0, and the >> driver should work in initiator mode as before. >> >> The driver could support dual-mode in the future but it doesn't at the >> moment (we need to add dual-mode support tgt first). >> >> It is based on scst qla2xxx target mode driver. Mike converted the >> driver to use tgt long ago. I changed it to use the latest (mainline) >> version of qla2xxx driver and tgt, and also converted it to use fc >> transport class. > > Thanks for doing this. Some initial comments before a full review is > complete, As was seen from the initiator updates needed for 24xx > support, there are comparable changes needed in the area of > target-mode support for 4gb and 8gb parts. Also, which ISPs and > firmwares were exercised with this code? The patch is still under reviewing and will get done, soon. One quick question on the patch, The tgt core will invoke transfer_response() once it completes the command processing. Could you point out where the actual data transfer is happening if the command required it? I guest it should happen in scsi_tgt_kspace_exec(), but not sure where it is happening? Thank you, Seokmann - To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] libata: translate INQUIRY VPD page 89h (ATA info)
On Fri, 2007-09-21 at 05:48 -0400, Jeff Garzik wrote: > commit a6d5ac6a3a1cfbed2a045928bbadd5285f1df084 > Author: Jeff Garzik <[EMAIL PROTECTED]> > Date: Fri Sep 21 05:07:19 2007 -0400 > > [libata] SCSI: support INQUIRY page 89h (ATA info page) > > Signed-off-by: Jeff Garzik <[EMAIL PROTECTED]> > > drivers/ata/libata-scsi.c | 82 > +++--- > 1 file changed, 78 insertions(+), 4 deletions(-) > > a6d5ac6a3a1cfbed2a045928bbadd5285f1df084 > diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c > index 7ad046b..bb5a5c1 100644 > --- a/drivers/ata/libata-scsi.c > +++ b/drivers/ata/libata-scsi.c > @@ -1804,6 +1804,71 @@ unsigned int ata_scsiop_inq_83(struct ata_scsi_args > *args, u8 *rbuf, > } > > /** > + * ata_scsiop_inq_89 - Simulate INQUIRY VPD page 89, ATA info > + * @args: device IDENTIFY data / SCSI command of interest. > + * @rbuf: Response buffer, to which simulated SCSI cmd output is sent. > + * @buflen: Response buffer length. > + * > + * Yields SAT-specified ATA VPD page. > + * > + * LOCKING: > + * spin_lock_irqsave(host lock) > + */ > + > +unsigned int ata_scsiop_inq_89(struct ata_scsi_args *args, u8 *rbuf, > + unsigned int buflen) > +{ > + struct ata_device *dev = args->dev; > + u8 pbuf[60]; > + bool is_atapi = (dev->class == ATA_DEV_ATAPI); I thought this was only used in the dev->class == ATA_DEV_ATA leg of the ata_scsi_queuecommand(), so isn't this always false? > + struct ata_taskfile tf; > + unsigned int i; > + > + if (!buflen) > + return 0; > + > + memset(&pbuf, 0, sizeof(pbuf)); > + memset(&tf, 0, sizeof(tf)); > + > + if (is_atapi) > + pbuf[0] = 0x5; /* FIXME: hardcodes MMC */ Actually, in MMC implementation of INQUIRY per SPC-3 (or earlier if MMC < 5) is mandatory. The problem cases I can see are non-standard ATAPI devices (probably scanners). James - To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] libata: clean up R/W recovery mode page
commit 14052d9ba16b826e4bc79db4b2b77e451faf0b01 Author: Jeff Garzik <[EMAIL PROTECTED]> Date: Fri Sep 21 07:54:49 2007 -0400 [libata] SCSI: clean up R/W recovery mode page Clear ARRE, we don't do auto-reallocation on reads, just on writes. Also, hardcode the size of the array using RW_RECOVERY_MPAGE_LEN, following the style of the surrounding code. Signed-off-by: Jeff Garzik <[EMAIL PROTECTED]> drivers/ata/libata-scsi.c |5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) 14052d9ba16b826e4bc79db4b2b77e451faf0b01 diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c index cd192c1..29e2cf6 100644 --- a/drivers/ata/libata-scsi.c +++ b/drivers/ata/libata-scsi.c @@ -71,11 +71,10 @@ static int ata_scsi_user_scan(struct Scsi_Host *shost, unsigned int channel, #define ALL_SUB_MPAGES 0xff -static const u8 def_rw_recovery_mpage[] = { +static const u8 def_rw_recovery_mpage[RW_RECOVERY_MPAGE_LEN] = { RW_RECOVERY_MPAGE, RW_RECOVERY_MPAGE_LEN - 2, - (1 << 7) | /* AWRE, sat-r06 say it shall be 0 */ - (1 << 6), /* ARRE (auto read reallocation) */ + (1 << 7), /* AWRE */ 0, /* read retry count */ 0, 0, 0, 0, 0, /* write retry count */ - To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] libata: improve FORMAT UNIT; minor code cleanups
commit ee67edb0e7701f8ae9114692837a8bbee9f99a35 Author: Jeff Garzik <[EMAIL PROTECTED]> Date: Fri Sep 21 07:26:08 2007 -0400 [libata] SCSI: improve FORMAT UNIT; minor code cleanups * SAT specifies that FORMAT UNIT should be translated into a series of READ and WRITE commands that zero the ATA device. That is far too cumbersome to bother with. Since we don't actually format the device, the old behavior of always returning success was inaccurate. Change FORMAT UNIT from returning success immediately (old behavior) to always returning an error (new behavior). * Add some comments around SYNCHRONIZE CACHE * Shuffle scsi command code around a bit, so that things are close to alphabetic order. Signed-off-by: Jeff Garzik <[EMAIL PROTECTED]> drivers/ata/libata-scsi.c | 23 --- 1 file changed, 16 insertions(+), 7 deletions(-) ee67edb0e7701f8ae9114692837a8bbee9f99a35 diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c index 456b75f..cd192c1 100644 --- a/drivers/ata/libata-scsi.c +++ b/drivers/ata/libata-scsi.c @@ -2961,13 +2961,9 @@ void ata_scsi_simulate(struct ata_device *dev, struct scsi_cmnd *cmd, args.done = done; switch(scsicmd[0]) { - /* no-op's, complete with success */ - case SYNCHRONIZE_CACHE: - case REZERO_UNIT: - case SEEK_6: - case SEEK_10: - case FORMAT_UNIT: /* FIXME: correct? */ - ata_scsi_rbuf_fill(&args, ata_scsiop_noop); + /* TODO: worth improving? */ + case FORMAT_UNIT: + ata_scsi_invalid_field(cmd, done); break; case INQUIRY: @@ -3025,6 +3021,19 @@ void ata_scsi_simulate(struct ata_device *dev, struct scsi_cmnd *cmd, done(cmd); break; + /* if we reach this, then writeback caching is disabled, +* turning this into a no-op. +*/ + case SYNCHRONIZE_CACHE: + /* fall through */ + + /* no-op's, complete with success */ + case REZERO_UNIT: + case SEEK_6: + case SEEK_10: + ata_scsi_rbuf_fill(&args, ata_scsiop_noop); + break; + case SEND_DIAGNOSTIC: tmp8 = scsicmd[1] & ~(1 << 3); if ((tmp8 == 0x4) && (!scsicmd[3]) && (!scsicmd[4])) - To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] libata: slightly improved req-sense, send-diag no-ops
Alan Cox wrote: REQUEST SENSE -- as we autosense, R.S. just returns zeroes SEND DIAGNOSTIC -- our default (no-op) self-test succeeds, all other requests for testing fail. Signed-off-by: Jeff Garzik <[EMAIL PROTECTED]> Acked-by: Alan Cox <[EMAIL PROTECTED]> Possibly our default SEND_DIAGNOSTIC should turn into smart or just return whether the drive failed the power up diagnostic ? Either/or. In general the SAT (SCSI/ATA translation) spec posted publicly on http://www.t10.org/ gives the suggested transformation into ATA commands. And yep, you guessed it -- send diag morphs into SMART. I doubt I'm motivated enough to enhance send diag, but others are encouraged to do so. Jeff - To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] libata: simple TEST UNIT READY simulation
As per SAT (sans removable devices)... commit 09d9637c413406cf63f0e1efb364411ac8a9243c Author: Jeff Garzik <[EMAIL PROTECTED]> Date: Fri Sep 21 07:09:36 2007 -0400 [libata] SCSI: simple TEST UNIT READY simulation It's trivial to ping the device, and that's a much more sane behavior than no-op. Signed-off-by: Jeff Garzik <[EMAIL PROTECTED]> drivers/ata/libata-scsi.c | 62 ++ 1 file changed, 46 insertions(+), 16 deletions(-) 09d9637c413406cf63f0e1efb364411ac8a9243c diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c index dbe8ac3..456b75f 100644 --- a/drivers/ata/libata-scsi.c +++ b/drivers/ata/libata-scsi.c @@ -906,6 +906,29 @@ static void ata_delayed_done(struct scsi_cmnd *scmd) } /** + * ata_scsi_tur_xlat - Translate SCSI TEST UNIT READY command + * @qc: Storage for translated ATA taskfile + * + * Simulates a TEST UNIT READY command. + * + * LOCKING: + * spin_lock_irqsave(host lock) + * + * RETURNS: + * Zero on success, non-zero on error. + */ +static unsigned int ata_scsi_tur_xlat(struct ata_queued_cmd *qc) +{ + struct ata_taskfile *tf = &qc->tf; + + tf->flags |= ATA_TFLAG_DEVICE; + tf->protocol = ATA_PROT_NODATA; + tf->command = ATA_CMD_CHK_POWER; + + return 0; +} + +/** * ata_scsi_start_stop_xlat - Translate SCSI START STOP UNIT command * @qc: Storage for translated ATA taskfile * @@ -1376,6 +1399,12 @@ static void ata_scsi_qc_complete(struct ata_queued_cmd *qc) } } + /* For TEST UNIT READY failures, we are told to respond with +* NOT READY / LOGICAL UNIT DOES NOT RESPOND TO SELECTION +*/ + if ((cdb[0] == TEST_UNIT_READY) && need_sense) + ata_scsi_set_sense(cmd, NOT_READY, 0x05, 0x00); + /* For ATA pass thru (SAT) commands, generate a sense block if * user mandated it or if there's an error. Note that if we * generate because the user forced us to, a check condition @@ -1383,22 +1412,21 @@ static void ata_scsi_qc_complete(struct ata_queued_cmd *qc) * whether the command completed successfully or not. If there * was no error, SK, ASC and ASCQ will all be zero. */ - if (((cdb[0] == ATA_16) || (cdb[0] == ATA_12)) && - ((cdb[2] & 0x20) || need_sense)) { + else if (((cdb[0] == ATA_16) || (cdb[0] == ATA_12)) && +((cdb[2] & 0x20) || need_sense)) ata_gen_passthru_sense(qc); - } else { - if (!need_sense) { - cmd->result = SAM_STAT_GOOD; - } else { - /* TODO: decide which descriptor format to use -* for 48b LBA devices and call that here -* instead of the fixed desc, which is only -* good for smaller LBA (and maybe CHS?) -* devices. -*/ - ata_gen_ata_sense(qc); - } - } + + else if (need_sense) + /* TODO: decide which descriptor format to use +* for 48b LBA devices and call that here +* instead of the fixed desc, which is only +* good for smaller LBA (and maybe CHS?) +* devices. +*/ + ata_gen_ata_sense(qc); + + else + cmd->result = SAM_STAT_GOOD; /* XXX: track spindown state for spindown skipping and warning */ if (unlikely(qc->tf.command == ATA_CMD_STANDBY || @@ -2780,6 +2808,9 @@ static inline ata_xlat_func_t ata_get_xlat_func(struct ata_device *dev, u8 cmd) case START_STOP: return ata_scsi_start_stop_xlat; + + case TEST_UNIT_READY: + return ata_scsi_tur_xlat; } return NULL; @@ -2935,7 +2966,6 @@ void ata_scsi_simulate(struct ata_device *dev, struct scsi_cmnd *cmd, case REZERO_UNIT: case SEEK_6: case SEEK_10: - case TEST_UNIT_READY: case FORMAT_UNIT: /* FIXME: correct? */ ata_scsi_rbuf_fill(&args, ata_scsiop_noop); break; - To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] libata: slightly improved req-sense, send-diag no-ops
> REQUEST SENSE -- as we autosense, R.S. just returns zeroes > > SEND DIAGNOSTIC -- our default (no-op) self-test succeeds, all > other requests for testing fail. > > Signed-off-by: Jeff Garzik <[EMAIL PROTECTED]> Acked-by: Alan Cox <[EMAIL PROTECTED]> Possibly our default SEND_DIAGNOSTIC should turn into smart or just return whether the drive failed the power up diagnostic ? - To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] libata: slightly improved req-sense, send-diag no-ops
commit 8a7a20fb60d9746ec68a876aade1f14c4f2b7b46 Author: Jeff Garzik <[EMAIL PROTECTED]> Date: Fri Sep 21 06:23:42 2007 -0400 [libata] Slightly improved no-op REQUEST SENSE, SEND DIAGNOSTIC A few pedantic apps care about missing or lame "mandatory" SCSI commands, so REQUEST SENSE -- as we autosense, R.S. just returns zeroes SEND DIAGNOSTIC -- our default (no-op) self-test succeeds, all other requests for testing fail. Signed-off-by: Jeff Garzik <[EMAIL PROTECTED]> drivers/ata/libata-scsi.c | 15 +-- 1 file changed, 13 insertions(+), 2 deletions(-) 8a7a20fb60d9746ec68a876aade1f14c4f2b7b46 diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c index bb5a5c1..dbe8ac3 100644 --- a/drivers/ata/libata-scsi.c +++ b/drivers/ata/libata-scsi.c @@ -2922,6 +2922,7 @@ void ata_scsi_simulate(struct ata_device *dev, struct scsi_cmnd *cmd, { struct ata_scsi_args args; const u8 *scsicmd = cmd->cmnd; + u8 tmp8; args.dev = dev; args.id = dev->id; @@ -2936,7 +2937,6 @@ void ata_scsi_simulate(struct ata_device *dev, struct scsi_cmnd *cmd, case SEEK_10: case TEST_UNIT_READY: case FORMAT_UNIT: /* FIXME: correct? */ - case SEND_DIAGNOSTIC: /* FIXME: correct? */ ata_scsi_rbuf_fill(&args, ata_scsiop_noop); break; @@ -2989,8 +2989,19 @@ void ata_scsi_simulate(struct ata_device *dev, struct scsi_cmnd *cmd, ata_scsi_rbuf_fill(&args, ata_scsiop_report_luns); break; - /* mandatory commands we haven't implemented yet */ case REQUEST_SENSE: + ata_scsi_set_sense(cmd, 0, 0, 0); + cmd->result = (DRIVER_SENSE << 24); + done(cmd); + break; + + case SEND_DIAGNOSTIC: + tmp8 = scsicmd[1] & ~(1 << 3); + if ((tmp8 == 0x4) && (!scsicmd[3]) && (!scsicmd[4])) + ata_scsi_rbuf_fill(&args, ata_scsiop_noop); + else + ata_scsi_invalid_field(cmd, done); + break; /* all other commands */ default: - To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] libata: translate INQUIRY VPD page 89h (ATA info)
commit a6d5ac6a3a1cfbed2a045928bbadd5285f1df084 Author: Jeff Garzik <[EMAIL PROTECTED]> Date: Fri Sep 21 05:07:19 2007 -0400 [libata] SCSI: support INQUIRY page 89h (ATA info page) Signed-off-by: Jeff Garzik <[EMAIL PROTECTED]> drivers/ata/libata-scsi.c | 82 +++--- 1 file changed, 78 insertions(+), 4 deletions(-) a6d5ac6a3a1cfbed2a045928bbadd5285f1df084 diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c index 7ad046b..bb5a5c1 100644 --- a/drivers/ata/libata-scsi.c +++ b/drivers/ata/libata-scsi.c @@ -1804,6 +1804,71 @@ unsigned int ata_scsiop_inq_83(struct ata_scsi_args *args, u8 *rbuf, } /** + * ata_scsiop_inq_89 - Simulate INQUIRY VPD page 89, ATA info + * @args: device IDENTIFY data / SCSI command of interest. + * @rbuf: Response buffer, to which simulated SCSI cmd output is sent. + * @buflen: Response buffer length. + * + * Yields SAT-specified ATA VPD page. + * + * LOCKING: + * spin_lock_irqsave(host lock) + */ + +unsigned int ata_scsiop_inq_89(struct ata_scsi_args *args, u8 *rbuf, + unsigned int buflen) +{ + struct ata_device *dev = args->dev; + u8 pbuf[60]; + bool is_atapi = (dev->class == ATA_DEV_ATAPI); + struct ata_taskfile tf; + unsigned int i; + + if (!buflen) + return 0; + + memset(&pbuf, 0, sizeof(pbuf)); + memset(&tf, 0, sizeof(tf)); + + if (is_atapi) + pbuf[0] = 0x5; /* FIXME: hardcodes MMC */ + + pbuf[1] = 0x89; /* our page code */ + pbuf[2] = (0x238 >> 8); /* page size fixed at 238h */ + pbuf[3] = (0x238 & 0xff); + + memcpy(&pbuf[8], "ATA ", 8); + ata_id_string(args->id, &pbuf[16], ATA_ID_PROD, 16); + ata_id_string(args->id, &pbuf[32], ATA_ID_FW_REV, 4); + + /* we don't store the ATA/ATAPI device signature, so we fake it */ + if (is_atapi) { + tf.command = ATA_CMD_ID_ATAPI; + tf.lbam = 0x14; + tf.lbah = 0xeb; + } else { + tf.command = ATA_CMD_ID_ATA; + } + tf.lbal = 0x1; + tf.nsect = 0x1; + + /* FIXME: PMP. don't use H2D Reg FIS. */ + ata_tf_to_fis(&tf, 0, 1, &pbuf[36]); + + pbuf[56] = tf.command; + + i = min(buflen, 60U); + memcpy(rbuf, &pbuf[0], i); + buflen -= i; + + if (!i) + return 0; + + memcpy(&rbuf[60], &args->id[0], min(buflen, 512U)); + return 0; +} + +/** * ata_scsiop_noop - Command handler that simply returns success. * @args: device IDENTIFY data / SCSI command of interest. * @rbuf: Response buffer, to which simulated SCSI cmd output is sent. @@ -2880,14 +2945,23 @@ void ata_scsi_simulate(struct ata_device *dev, struct scsi_cmnd *cmd, ata_scsi_invalid_field(cmd, done); else if ((scsicmd[1] & 1) == 0)/* is EVPD clear? */ ata_scsi_rbuf_fill(&args, ata_scsiop_inq_std); - else if (scsicmd[2] == 0x00) + else switch (scsicmd[2]) { + case 0x00: ata_scsi_rbuf_fill(&args, ata_scsiop_inq_00); - else if (scsicmd[2] == 0x80) + break; + case 0x80: ata_scsi_rbuf_fill(&args, ata_scsiop_inq_80); - else if (scsicmd[2] == 0x83) + break; + case 0x83: ata_scsi_rbuf_fill(&args, ata_scsiop_inq_83); - else + break; + case 0x89: + ata_scsi_rbuf_fill(&args, ata_scsiop_inq_89); + break; + default: ata_scsi_invalid_field(cmd, done); + break; + } break; case MODE_SENSE: - To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html