Re: ATAPI devices in AHCI mode not working
Gaston, Jason D wrote: -Original Message- From: Alan Cox [mailto:[EMAIL PROTECTED] Sent: Monday, October 29, 2007 3:14 PM To: Gaston, Jason D Cc: linux-ide@vger.kernel.org Subject: Re: ATAPI devices in AHCI mode not working ata1: SATA max UDMA/133 abar [EMAIL PROTECTED] port 0xd9101100 irq 216 ata2: SATA max UDMA/133 abar [EMAIL PROTECTED] port 0xd9101180 irq 216 ata1: SATA link up 1.5 Gbps (SStatus 113 SControl 300) ata1.00: ATAPI: ATAPI DVD D DH16D2S, EP52, max UDMA/100 ata1.00: configured for UDMA/100 Much better - no misdetected link type, no device claiming to be PATA when its SATA. Right that eliminates all the obvious goings on being caused by broken devices which is a start. Doesn't shed any light on the rest of it. What happens if you boot with irqpoll enabled ? (wondering if the timeouts are ACPI or IRQ routing stuff) I rebuilt the kernel; the DVD and USB devices are functional now. I'm not sure what the problem was before. On a side note: In 2.6.24.rc1 the DVD starts working right away, but on a SLES10_SP1 kernel, it takes some time for it to step down to a PIO mode before the DVD can be mounted. Oh well. Yeah, there has been quite some update in libata between SLES10_SP1 and 2.6.24-rc1. The controller being ahci, I wonder whether this is caused by the different in check_atapi_dma(). 1. Does other optical drives have the same problem? If not, please post the result of hdparm -I /dev/sr0 with the problematic one attached. 2. If you apply the attached patch to 2.6.24-rc1, does it behave the same as the SLES10SP1 kernel? -- tejun diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c index 8ee56e5..5d9b193 100644 --- a/drivers/ata/libata-core.c +++ b/drivers/ata/libata-core.c @@ -4491,11 +4491,13 @@ int ata_check_atapi_dma(struct ata_queued_cmd *qc) { struct ata_port *ap = qc-ap; +#if 0 /* Don't allow DMA if it isn't multiple of 16 bytes. Quite a * few ATAPI devices choke on such DMA requests. */ if (unlikely(qc-nbytes 15)) return 1; +#endif if (ap-ops-check_atapi_dma) return ap-ops-check_atapi_dma(qc);
[PATCH] killing sg_last(), and discussion
I looked into killing sg_last(), but really, this is the best its gonna get (moving sg_last to libata-core.c). You could maybe kill one use with caching, but in the other sg_last() callsites there isn't another s/g loop we can stick a last_sg = sg; into. libata is stuck because we undertake the highly unusual operation of fiddling with the final S/G element, to enforce 32-bit alignment. Of course we could eliminate all that nasty fiddling/padding completely, including sg_last(), if other areas of the kernel would guarantee ahead of time that buffer lengths are always a multiple of 4 Jeff [the obvious patch follows, moving sg_last()...] drivers/ata/libata-core.c | 24 drivers/ata/sata_nv.c |1 - drivers/ata/sata_promise.c |1 - drivers/ata/sata_qstor.c|1 - include/linux/scatterlist.h | 34 -- 5 files changed, 24 insertions(+), 37 deletions(-) diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c index 63035d7..4f0acc5 100644 --- a/drivers/ata/libata-core.c +++ b/drivers/ata/libata-core.c @@ -4480,6 +4480,30 @@ static unsigned int ata_dev_init_params(struct ata_device *dev, } /** + * sg_last - return the last scatterlist entry in a list + * @sgl: First entry in the scatterlist + * @nents: Number of entries in the scatterlist + * + * Description: + * Should only be used casually, it (currently) scan the entire list + * to get the last entry. + * + * Note that the @sgl@ pointer passed in need not be the first one, + * the important bit is that @nents@ denotes the number of entries that + * exist from @[EMAIL PROTECTED] + * + **/ +static inline struct scatterlist *sg_last(struct scatterlist *sgl, + unsigned int nents) +{ + struct scatterlist *sg, *ret = NULL; + unsigned int i; + + for_each_sg(sgl, sg, nents, i) + ret = sg; +} + +/** * ata_sg_clean - Unmap DMA memory associated with command * @qc: Command containing DMA memory to be released * diff --git a/drivers/ata/sata_nv.c b/drivers/ata/sata_nv.c index 35b2df2..6546913 100644 --- a/drivers/ata/sata_nv.c +++ b/drivers/ata/sata_nv.c @@ -1985,7 +1985,6 @@ static void nv_swncq_fill_sg(struct ata_queued_cmd *qc) struct nv_swncq_port_priv *pp = ap-private_data; struct ata_prd *prd; - WARN_ON(qc-__sg == NULL); WARN_ON(qc-n_elem == 0 qc-pad_len == 0); prd = pp-prd + ATA_MAX_PRD * qc-tag; diff --git a/drivers/ata/sata_promise.c b/drivers/ata/sata_promise.c index 825e717..1fba9d4 100644 --- a/drivers/ata/sata_promise.c +++ b/drivers/ata/sata_promise.c @@ -547,7 +547,6 @@ static void pdc_fill_sg(struct ata_queued_cmd *qc) if (!(qc-flags ATA_QCFLAG_DMAMAP)) return; - WARN_ON(qc-__sg == NULL); WARN_ON(qc-n_elem == 0 qc-pad_len == 0); idx = 0; diff --git a/drivers/ata/sata_qstor.c b/drivers/ata/sata_qstor.c index 6d43ba7..664e3f7 100644 --- a/drivers/ata/sata_qstor.c +++ b/drivers/ata/sata_qstor.c @@ -276,7 +276,6 @@ static unsigned int qs_fill_sg(struct ata_queued_cmd *qc) unsigned int nelem; u8 *prd = pp-pkt + QS_CPB_BYTES; - WARN_ON(qc-__sg == NULL); WARN_ON(qc-n_elem == 0 qc-pad_len == 0); nelem = 0; diff --git a/include/linux/scatterlist.h b/include/linux/scatterlist.h index 32326c2..ab94464 100644 --- a/include/linux/scatterlist.h +++ b/include/linux/scatterlist.h @@ -130,40 +130,6 @@ static inline struct scatterlist *sg_next(struct scatterlist *sg) for (__i = 0, sg = (sglist); __i (nr); __i++, sg = sg_next(sg)) /** - * sg_last - return the last scatterlist entry in a list - * @sgl: First entry in the scatterlist - * @nents: Number of entries in the scatterlist - * - * Description: - * Should only be used casually, it (currently) scan the entire list - * to get the last entry. - * - * Note that the @sgl@ pointer passed in need not be the first one, - * the important bit is that @nents@ denotes the number of entries that - * exist from @[EMAIL PROTECTED] - * - **/ -static inline struct scatterlist *sg_last(struct scatterlist *sgl, - unsigned int nents) -{ -#ifndef ARCH_HAS_SG_CHAIN - struct scatterlist *ret = sgl[nents - 1]; -#else - struct scatterlist *sg, *ret = NULL; - unsigned int i; - - for_each_sg(sgl, sg, nents, i) - ret = sg; - -#endif -#ifdef CONFIG_DEBUG_SG - BUG_ON(sgl[0].sg_magic != SG_MAGIC); - BUG_ON(!sg_is_last(ret)); -#endif - return ret; -} - -/** * sg_chain - Chain two sglists together * @prv: First scatterlist * @prv_nents: Number of entries in prv - To unsubscribe from this list: send the line unsubscribe linux-ide in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [git patches] libata fixes
Mikael Pettersson wrote: That's my fault for misremembering the rule about the number of dashes before the other comments part :-( I'll remember better in the future. Well, I should have caught it and hand-edited it on my side too... Jeff - To unsubscribe from this list: send the line unsubscribe linux-ide in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [git patches] libata fixes
On Tue, 30 Oct 2007 11:54:01 -0700 (PDT), Linus Torvalds wrote: On Tue, 30 Oct 2007, Jeff Garzik wrote: Mikael Pettersson (2): sata_promise: ASIC PRD table bug workaround, take 2 sata_promise: cleanups You and Mikael need to sort out the way you send/accept patches. Both of these commits had stuff like this: Signed-off-by: Mikael Pettersson [EMAIL PROTECTED] -- Changes since previous version: * use new PDC_MAX_PRD constant to initialise sg_tablesize drivers/ata/sata_promise.c | 87 ++--- 1 files changed, 83 insertions(+), 4 deletions(-) Signed-off-by: Jeff Garzik [EMAIL PROTECTED] which seems to be because Mikael uses two dashes instead of three to separate his real message from the stuff you have. So either you need to teach Mikael to use the proper separators That's my fault for misremembering the rule about the number of dashes before the other comments part :-( I'll remember better in the future. /Mikael - To unsubscribe from this list: send the line unsubscribe linux-ide in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] killing sg_last(), and discussion
On Wed, Oct 31 2007 at 10:49 +0200, Jeff Garzik [EMAIL PROTECTED] wrote: I looked into killing sg_last(), but really, this is the best its gonna get (moving sg_last to libata-core.c). You could maybe kill one use with caching, but in the other sg_last() callsites there isn't another s/g loop we can stick a last_sg = sg; into. libata is stuck because we undertake the highly unusual operation of fiddling with the final S/G element, to enforce 32-bit alignment. Of course we could eliminate all that nasty fiddling/padding completely, including sg_last(), if other areas of the kernel would guarantee ahead of time that buffer lengths are always a multiple of 4 Jeff OK Now I'm confused. I thought that ULD's can give you SG's that are actually longer than bufflen and that, at the end, the bufflen should govern the transfer length. Now FS_PC commands are sector aligned so you do not have problems with that. The BLOCK_PC commands have 2 main sources that I know of one is sg bsg from user mode that can easily enforce 4 bytes alignment. The second is kernel services which 80% of these are done by scsi_execute(). All These can be found and fixed. Starting with scsi_execute(). Another place can be blk_rq_map_sg(), since all IO's are bio based. It can enforce alignment too. I would start by sticking a WARN_ON(qc-pad_len) and see if it triggers, what are the sources of that. Please note that the code already has a 4 bytes alignment assumption about the start of the transfer, other wise the first SG can also have a none aligned length, which is not checked for. Boaz - To unsubscribe from this list: send the line unsubscribe linux-ide in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] killing sg_last(), and discussion
Boaz Harrosh wrote: On Wed, Oct 31 2007 at 10:49 +0200, Jeff Garzik [EMAIL PROTECTED] wrote: I looked into killing sg_last(), but really, this is the best its gonna get (moving sg_last to libata-core.c). You could maybe kill one use with caching, but in the other sg_last() callsites there isn't another s/g loop we can stick a last_sg = sg; into. libata is stuck because we undertake the highly unusual operation of fiddling with the final S/G element, to enforce 32-bit alignment. Of course we could eliminate all that nasty fiddling/padding completely, including sg_last(), if other areas of the kernel would guarantee ahead of time that buffer lengths are always a multiple of 4 Jeff OK Now I'm confused. I thought that ULD's can give you SG's that are actually longer than bufflen and that, at the end, the bufflen should govern the transfer length. Now FS_PC commands are sector aligned so you do not have problems with that. The BLOCK_PC commands have 2 main sources that I know of one is sg bsg from user mode that can easily enforce 4 bytes alignment. The second is kernel services which 80% of these are done by scsi_execute(). All These can be found and fixed. Starting with scsi_execute(). Another place can be blk_rq_map_sg(), since all IO's are bio based. It can enforce alignment too. I would start by sticking a WARN_ON(qc-pad_len) and see if it triggers, what are the sources of that. The whole qc-pad_len etc. machinery was added because it solved problems in the field with ATAPI devices. So sr or some userland application is sending lengths that are not padded to 32-bit boundary, probably because plenty of trivial commands can send or return odd amounts of data. This used to be irrelevant, but now with SATA, even PIO data xfer (normally what is used for non-READ/WRITE CDBs) must be 32-bit aligned because both SATA DMA and SATA PIO are converted into dword-based SATA FIS's on the wire. Jeff - To unsubscribe from this list: send the line unsubscribe linux-ide in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: Slow hard drives
The same comes up for hdb (i have two hard drives installed) and those 3 messages repeat for a while and then this comes up Oct 30 20:45:41 jimin-desktop kernel: [ 69.256000] hda: DMA disabled Oct 30 20:45:41 jimin-desktop kernel: [ 69.592000] ide0: reset: success The kernel switches from DMA to PIO (slow) when it finds that the DMA isn't working properly - its attempting to keep the box running rather than just dying What controller ? - To unsubscribe from this list: send the line unsubscribe linux-ide in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] killing sg_last(), and discussion
On Wed, Oct 31 2007 at 12:29 +0200, Jeff Garzik [EMAIL PROTECTED] wrote: Boaz Harrosh wrote: On Wed, Oct 31 2007 at 10:49 +0200, Jeff Garzik [EMAIL PROTECTED] wrote: I looked into killing sg_last(), but really, this is the best its gonna get (moving sg_last to libata-core.c). You could maybe kill one use with caching, but in the other sg_last() callsites there isn't another s/g loop we can stick a last_sg = sg; into. libata is stuck because we undertake the highly unusual operation of fiddling with the final S/G element, to enforce 32-bit alignment. Of course we could eliminate all that nasty fiddling/padding completely, including sg_last(), if other areas of the kernel would guarantee ahead of time that buffer lengths are always a multiple of 4 Jeff OK Now I'm confused. I thought that ULD's can give you SG's that are actually longer than bufflen and that, at the end, the bufflen should govern the transfer length. Now FS_PC commands are sector aligned so you do not have problems with that. The BLOCK_PC commands have 2 main sources that I know of one is sg bsg from user mode that can easily enforce 4 bytes alignment. The second is kernel services which 80% of these are done by scsi_execute(). All These can be found and fixed. Starting with scsi_execute(). Another place can be blk_rq_map_sg(), since all IO's are bio based. It can enforce alignment too. I would start by sticking a WARN_ON(qc-pad_len) and see if it triggers, what are the sources of that. The whole qc-pad_len etc. machinery was added because it solved problems in the field with ATAPI devices. So sr or some userland application is sending lengths that are not padded to 32-bit boundary, probably because plenty of trivial commands can send or return odd amounts of data. This used to be irrelevant, but now with SATA, even PIO data xfer (normally what is used for non-READ/WRITE CDBs) must be 32-bit aligned because both SATA DMA and SATA PIO are converted into dword-based SATA FIS's on the wire. Jeff 2 things 1. Than why not fix blk_rq_map_sg() to enforce the alignment. Also I bet that these problems in the field are from pre 2.6.18 kernels, and this is no longer the case. Why not put that WARN_ON(qc-pad_len) and prove me wrong. 2. Just checking bufflen is enough. Since you are already assuming that first SG's offset is aligned, than if last SG's length is odd than so is bufflen. (You are already assuming that SG's total length matches bufflen) Boaz - To unsubscribe from this list: send the line unsubscribe linux-ide in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 01/12] ata/sata_fsl: Update for ata_link introduction
Update the driver to use the newly added ata_link structure. Signed-off-by: Li Yang [EMAIL PROTECTED] --- drivers/ata/sata_fsl.c | 31 ++- 1 files changed, 18 insertions(+), 13 deletions(-) diff --git a/drivers/ata/sata_fsl.c b/drivers/ata/sata_fsl.c index b4c37b9..8a8ce9d 100644 --- a/drivers/ata/sata_fsl.c +++ b/drivers/ata/sata_fsl.c @@ -34,7 +34,8 @@ enum { SATA_FSL_HOST_FLAGS = (ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY | ATA_FLAG_MMIO | ATA_FLAG_PIO_DMA | - ATA_FLAG_NCQ | ATA_FLAG_SKIP_D2H_BSY), + ATA_FLAG_NCQ), + SATA_FSL_HOST_LFLAGS= ATA_LFLAG_SKIP_D2H_BSY, SATA_FSL_MAX_CMDS = SATA_FSL_QUEUE_DEPTH, SATA_FSL_CMD_HDR_SIZE = 16, /* 4 DWORDS */ @@ -728,9 +729,10 @@ static unsigned int sata_fsl_dev_classify(struct ata_port *ap) return ata_dev_classify(tf); } -static int sata_fsl_softreset(struct ata_port *ap, unsigned int *class, +static int sata_fsl_softreset(struct ata_link *link, unsigned int *class, unsigned long deadline) { + struct ata_port *ap = link-ap; struct sata_fsl_port_priv *pp = ap-private_data; struct sata_fsl_host_priv *host_priv = ap-host-private_data; void __iomem *hcr_base = host_priv-hcr_base; @@ -811,7 +813,7 @@ try_offline_again: */ temp = ata_wait_register(hcr_base + HSTATUS, 0xFF, 0, 1, 500); - if ((!(temp 0x10)) || ata_port_offline(ap)) { + if ((!(temp 0x10)) || ata_link_offline(link)) { ata_port_printk(ap, KERN_WARNING, No Device OR PHYRDY change,Hstatus = 0x%x\n, ioread32(hcr_base + HSTATUS)); @@ -842,12 +844,12 @@ try_offline_again: * reached here, we can send a command to the target device */ - if (ap-sactive) + if (link-sactive) goto skip_srst_do_ncq_error_handling; DPRINTK(Sending SRST/device reset\n); - ata_tf_init(ap-device, tf); + ata_tf_init(link-device, tf); cfis = (u8 *) pp-cmdentry-cfis; /* device reset/SRST is a control register update FIS, uses tag0 */ @@ -919,7 +921,7 @@ skip_srst_do_ncq_error_handling: VPRINTK(Sending read log ext(10h) command\n); memset(qc, 0, sizeof(struct ata_queued_cmd)); - ata_tf_init(ap-device, tf); + ata_tf_init(link-device, tf); tf.command = ATA_CMD_READ_LOG_EXT; tf.lbal = ATA_LOG_SATA_NCQ; @@ -931,7 +933,7 @@ skip_srst_do_ncq_error_handling: qc.tag = ATA_TAG_INTERNAL; qc.scsicmd = NULL; qc.ap = ap; - qc.dev = ap-device; + qc.dev = link-device; qc.tf = tf; qc.flags |= ATA_QCFLAG_RESULT_TF; @@ -981,7 +983,7 @@ skip_srst_do_ncq_error_handling: *class = ATA_DEV_NONE; /* Verify if SStatus indicates device presence */ - if (ata_port_online(ap)) { + if (ata_link_online(link)) { /* * if we are here, device presence has been detected, * 1st D2H FIS would have been received, but sfis in @@ -1042,7 +1044,8 @@ static void sata_fsl_irq_clear(struct ata_port *ap) static void sata_fsl_error_intr(struct ata_port *ap) { - struct ata_eh_info *ehi = ap-eh_info; + struct ata_link *link = ap-link; + struct ata_eh_info *ehi = link-eh_info; struct sata_fsl_host_priv *host_priv = ap-host-private_data; void __iomem *hcr_base = host_priv-hcr_base; u32 hstatus, dereg, cereg = 0, SError = 0; @@ -,7 +1114,7 @@ static void sata_fsl_error_intr(struct ata_port *ap) } /* record error info */ - qc = ata_qc_from_tag(ap, ap-active_tag); + qc = ata_qc_from_tag(ap, link-active_tag); if (qc) { sata_fsl_cache_taskfile_from_d2h_fis(qc, qc-ap); @@ -1139,6 +1142,7 @@ static void sata_fsl_qc_complete(struct ata_queued_cmd *qc) static void sata_fsl_host_intr(struct ata_port *ap) { + struct ata_link *link = ap-link; struct sata_fsl_host_priv *host_priv = ap-host-private_data; void __iomem *hcr_base = host_priv-hcr_base; u32 hstatus, qc_active = 0; @@ -1161,7 +1165,7 @@ static void sata_fsl_host_intr(struct ata_port *ap) return; } - if (ap-sactive) { /* only true for NCQ commands */ + if (link-sactive) {/* only true for NCQ commands */ int i; /* Read command completed register */ qc_active = ioread32(hcr_base + CC); @@ -1190,10 +1194,10 @@ static void sata_fsl_host_intr(struct ata_port *ap) } else if (ap-qc_active) { iowrite32(1, hcr_base + CC); - qc = ata_qc_from_tag(ap, ap-active_tag); + qc = ata_qc_from_tag(ap, link-active_tag); DPRINTK(completing non-ncq
[PATCH 02/12] ata/sata_fsl: Remove deprecated hooks
Signed-off-by: Li Yang [EMAIL PROTECTED] --- drivers/ata/sata_fsl.c |4 1 files changed, 0 insertions(+), 4 deletions(-) diff --git a/drivers/ata/sata_fsl.c b/drivers/ata/sata_fsl.c index 8a8ce9d..4c8c820 100644 --- a/drivers/ata/sata_fsl.c +++ b/drivers/ata/sata_fsl.c @@ -1323,8 +1323,6 @@ static struct scsi_host_template sata_fsl_sht = { }; static const struct ata_port_operations sata_fsl_ops = { - .port_disable = ata_port_disable, - .check_status = sata_fsl_check_status, .check_altstatus = sata_fsl_check_status, .dev_select = ata_noop_dev_select, @@ -1334,8 +1332,6 @@ static const struct ata_port_operations sata_fsl_ops = { .qc_prep = sata_fsl_qc_prep, .qc_issue = sata_fsl_qc_issue, .irq_clear = sata_fsl_irq_clear, - .irq_on = ata_dummy_irq_on, - .irq_ack = ata_dummy_irq_ack, .scr_read = sata_fsl_scr_read, .scr_write = sata_fsl_scr_write, -- 1.5.3.2.104.g41ef - To unsubscribe from this list: send the line unsubscribe linux-ide in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 03/12] ata/sata_fsl: save irq in private data for irq unmapping
Powerpc uses virtual irq which has to be unmapped. Signed-off-by: Li Yang [EMAIL PROTECTED] --- drivers/ata/sata_fsl.c |4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diff --git a/drivers/ata/sata_fsl.c b/drivers/ata/sata_fsl.c index 4c8c820..f8d8614 100644 --- a/drivers/ata/sata_fsl.c +++ b/drivers/ata/sata_fsl.c @@ -265,6 +265,7 @@ struct sata_fsl_host_priv { void __iomem *hcr_base; void __iomem *ssr_base; void __iomem *csr_base; + int irq; }; static inline unsigned int sata_fsl_tag(unsigned int tag, @@ -1399,6 +1400,7 @@ static int sata_fsl_probe(struct of_device *ofdev, dev_printk(KERN_ERR, ofdev-dev, invalid irq from platform\n); goto error_exit_with_cleanup; } + host_priv-irq = irq; /* allocate host structure */ host = ata_host_alloc_pinfo(ofdev-dev, ppi, SATA_FSL_MAX_PORTS); @@ -1445,7 +1447,7 @@ static int sata_fsl_remove(struct of_device *ofdev) dev_set_drvdata(ofdev-dev, NULL); - irq_dispose_mapping(host-irq); + irq_dispose_mapping(host_priv-irq); iounmap(host_priv-hcr_base); kfree(host_priv); -- 1.5.3.2.104.g41ef - To unsubscribe from this list: send the line unsubscribe linux-ide in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 04/12] ata/sata_fsl: Kill ata_sg_is_last()
Signed-off-by: Li Yang [EMAIL PROTECTED] --- drivers/ata/sata_fsl.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/drivers/ata/sata_fsl.c b/drivers/ata/sata_fsl.c index f8d8614..9e99cc8 100644 --- a/drivers/ata/sata_fsl.c +++ b/drivers/ata/sata_fsl.c @@ -355,7 +355,7 @@ static unsigned int sata_fsl_fill_sg(struct ata_queued_cmd *qc, void *cmd_desc, s/g len unaligned : 0x%x\n, sg_len); if ((num_prde == (SATA_FSL_MAX_PRD_DIRECT - 1)) - !ata_sg_is_last(sg, qc)) { + (qc-n_iter + 1 != qc-n_elem)) { VPRINTK(setting indirect prde\n); prd_ptr_to_indirect_ext = prd; prd-dba = cpu_to_le32(indirect_ext_segment_paddr); -- 1.5.3.2.104.g41ef - To unsubscribe from this list: send the line unsubscribe linux-ide in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 05/12] ata/sata_fsl: Remove unnecessary SCR cases
From: Jeff Garzik [EMAIL PROTECTED] SCRs in the driver map to the standard values found in include/linux/ata.h, so no need for individual scr_read/scr_write case statements duplicating the natural value. Signed-off-by: Jeff Garzik [EMAIL PROTECTED] Signed-off-by: Li Yang [EMAIL PROTECTED] --- drivers/ata/sata_fsl.c | 16 ++-- 1 files changed, 2 insertions(+), 14 deletions(-) diff --git a/drivers/ata/sata_fsl.c b/drivers/ata/sata_fsl.c index 9e99cc8..e04fb75 100644 --- a/drivers/ata/sata_fsl.c +++ b/drivers/ata/sata_fsl.c @@ -472,16 +472,10 @@ static int sata_fsl_scr_write(struct ata_port *ap, unsigned int sc_reg_in, switch (sc_reg_in) { case SCR_STATUS: - sc_reg = 0; - break; case SCR_ERROR: - sc_reg = 1; - break; case SCR_CONTROL: - sc_reg = 2; - break; case SCR_ACTIVE: - sc_reg = 3; + sc_reg = sc_reg_in; break; default: return -EINVAL; @@ -502,16 +496,10 @@ static int sata_fsl_scr_read(struct ata_port *ap, unsigned int sc_reg_in, switch (sc_reg_in) { case SCR_STATUS: - sc_reg = 0; - break; case SCR_ERROR: - sc_reg = 1; - break; case SCR_CONTROL: - sc_reg = 2; - break; case SCR_ACTIVE: - sc_reg = 3; + sc_reg = sc_reg_in; break; default: return -EINVAL; -- 1.5.3.2.104.g41ef - To unsubscribe from this list: send the line unsubscribe linux-ide in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 06/12] ata/sata_fsl: cleanup needless casts to/from void __iomem *
From: Jeff Garzik [EMAIL PROTECTED] Signed-off-by: Jeff Garzik [EMAIL PROTECTED] Signed-off-by: Li Yang [EMAIL PROTECTED] --- drivers/ata/sata_fsl.c |4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/ata/sata_fsl.c b/drivers/ata/sata_fsl.c index e04fb75..e3bf954 100644 --- a/drivers/ata/sata_fsl.c +++ b/drivers/ata/sata_fsl.c @@ -483,7 +483,7 @@ static int sata_fsl_scr_write(struct ata_port *ap, unsigned int sc_reg_in, VPRINTK(xx_scr_write, reg_in = %d\n, sc_reg); - iowrite32(val, (void __iomem *)ssr_base + (sc_reg * 4)); + iowrite32(val, ssr_base + (sc_reg * 4)); return 0; } @@ -507,7 +507,7 @@ static int sata_fsl_scr_read(struct ata_port *ap, unsigned int sc_reg_in, VPRINTK(xx_scr_read, reg_in = %d\n, sc_reg); - *val = ioread32((void __iomem *)ssr_base + (sc_reg * 4)); + *val = ioread32(ssr_base + (sc_reg * 4)); return 0; } -- 1.5.3.2.104.g41ef - To unsubscribe from this list: send the line unsubscribe linux-ide in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 07/12] ata/sata_fsl: remove unneeded on-stack copy of FIS
From: Jeff Garzik [EMAIL PROTECTED] Remove unneeded on-stack copy of FIS in sata_fsl_cache_taskfile_from_d2h_fis(). Signed-off-by: Jeff Garzik [EMAIL PROTECTED] Signed-off-by: Li Yang [EMAIL PROTECTED] --- drivers/ata/sata_fsl.c |4 +--- 1 files changed, 1 insertions(+), 3 deletions(-) diff --git a/drivers/ata/sata_fsl.c b/drivers/ata/sata_fsl.c index e3bf954..c47f2d4 100644 --- a/drivers/ata/sata_fsl.c +++ b/drivers/ata/sata_fsl.c @@ -561,7 +561,6 @@ static inline void sata_fsl_cache_taskfile_from_d2h_fis(struct ata_queued_cmd struct ata_port *ap) { struct sata_fsl_port_priv *pp = ap-private_data; - u8 fis[6 * 4]; struct sata_fsl_host_priv *host_priv = ap-host-private_data; void __iomem *hcr_base = host_priv-hcr_base; unsigned int tag = sata_fsl_tag(qc-tag, hcr_base); @@ -569,8 +568,7 @@ static inline void sata_fsl_cache_taskfile_from_d2h_fis(struct ata_queued_cmd cd = pp-cmdentry + tag; - memcpy(fis, cd-sfis, 6 * 4); /* should we use memcpy_from_io() */ - ata_tf_from_fis(fis, pp-tf); + ata_tf_from_fis(cd-sfis, pp-tf); } static u8 sata_fsl_check_status(struct ata_port *ap) -- 1.5.3.2.104.g41ef - To unsubscribe from this list: send the line unsubscribe linux-ide in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 08/12] ata/sata_fsl: remove unneeded sata_fsl_hardreset()
From: Jeff Garzik [EMAIL PROTECTED] Signed-off-by: Jeff Garzik [EMAIL PROTECTED] Signed-off-by: Li Yang [EMAIL PROTECTED] --- drivers/ata/sata_fsl.c | 14 +- 1 files changed, 1 insertions(+), 13 deletions(-) diff --git a/drivers/ata/sata_fsl.c b/drivers/ata/sata_fsl.c index c47f2d4..03629b6 100644 --- a/drivers/ata/sata_fsl.c +++ b/drivers/ata/sata_fsl.c @@ -991,25 +991,13 @@ err: return -EIO; } -static int sata_fsl_hardreset(struct ata_port *ap, unsigned int *class, - unsigned long deadline) -{ - int retval; - - retval = sata_std_hardreset(ap, class, deadline); - - DPRINTK(SATA FSL : in xx_hardreset, retval = 0x%d\n, retval); - - return retval; -} - static void sata_fsl_error_handler(struct ata_port *ap) { DPRINTK(in xx_error_handler\n); /* perform recovery */ - ata_do_eh(ap, ata_std_prereset, sata_fsl_softreset, sata_fsl_hardreset, + ata_do_eh(ap, ata_std_prereset, sata_fsl_softreset, sata_std_hardreset, ata_std_postreset); } -- 1.5.3.2.104.g41ef - To unsubscribe from this list: send the line unsubscribe linux-ide in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 09/12] ata/sata_fsl: cleanup style problem
Signed-off-by: Li Yang [EMAIL PROTECTED] --- drivers/ata/sata_fsl.c | 12 ++-- 1 files changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/ata/sata_fsl.c b/drivers/ata/sata_fsl.c index 03629b6..5892472 100644 --- a/drivers/ata/sata_fsl.c +++ b/drivers/ata/sata_fsl.c @@ -269,7 +269,7 @@ struct sata_fsl_host_priv { }; static inline unsigned int sata_fsl_tag(unsigned int tag, - void __iomem * hcr_base) + void __iomem *hcr_base) { /* We let libATA core do actual (queue) tag allocation */ @@ -308,7 +308,7 @@ static void sata_fsl_setup_cmd_hdr_entry(struct sata_fsl_port_priv *pp, pp-cmdslot[tag].prde_fis_len = cpu_to_le32((num_prde 16) | (fis_len 2)); pp-cmdslot[tag].ttl = cpu_to_le32(data_xfer_len ~0x03); - pp-cmdslot[tag].desc_info = cpu_to_le32((desc_info | (tag 0x1F))); + pp-cmdslot[tag].desc_info = cpu_to_le32(desc_info | (tag 0x1F)); VPRINTK(cda=0x%x, prde_fis_len=0x%x, ttl=0x%x, di=0x%x\n, pp-cmdslot[tag].cda, @@ -318,7 +318,7 @@ static void sata_fsl_setup_cmd_hdr_entry(struct sata_fsl_port_priv *pp, } static unsigned int sata_fsl_fill_sg(struct ata_queued_cmd *qc, void *cmd_desc, -u32 * ttl, dma_addr_t cmd_desc_paddr) +u32 *ttl, dma_addr_t cmd_desc_paddr) { struct scatterlist *sg; unsigned int num_prde = 0; @@ -406,7 +406,7 @@ static void sata_fsl_qc_prep(struct ata_queued_cmd *qc) cd = (struct command_desc *)pp-cmdentry + tag; cd_paddr = pp-cmdentry_paddr + tag * SATA_FSL_CMD_DESC_SIZE; - ata_tf_to_fis(qc-tf, 0, 1, (u8 *) cd-cfis); + ata_tf_to_fis(qc-tf, 0, 1, (u8 *) cd-cfis); VPRINTK(Dumping cfis : 0x%x, 0x%x, 0x%x\n, cd-cfis[0], cd-cfis[1], cd-cfis[2]); @@ -837,7 +837,7 @@ try_offline_again: DPRINTK(Sending SRST/device reset\n); ata_tf_init(link-device, tf); - cfis = (u8 *) pp-cmdentry-cfis; + cfis = (u8 *) pp-cmdentry-cfis; /* device reset/SRST is a control register update FIS, uses tag0 */ sata_fsl_setup_cmd_hdr_entry(pp, 0, @@ -963,7 +963,7 @@ skip_srst_do_ncq_error_handling: iowrite32(0x01, CC + hcr_base); /* We know it will be cmd#0 always */ - check_device_signature: +check_device_signature: DPRINTK(SATA FSL : Now checking device signature\n); -- 1.5.3.2.104.g41ef - To unsubscribe from this list: send the line unsubscribe linux-ide in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 10/12] ata/sata_fsl: Move MPC8315DS link speed limit workaround to specific ifdef
From: ashish kalra [EMAIL PROTECTED] Signed-off-by: ashish kalra [EMAIL PROTECTED] Signed-off-by: Li Yang [EMAIL PROTECTED] --- drivers/ata/sata_fsl.c |2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/drivers/ata/sata_fsl.c b/drivers/ata/sata_fsl.c index 5892472..e076e1f 100644 --- a/drivers/ata/sata_fsl.c +++ b/drivers/ata/sata_fsl.c @@ -652,6 +652,7 @@ static int sata_fsl_port_start(struct ata_port *ap) VPRINTK(HControl = 0x%x\n, ioread32(hcr_base + HCONTROL)); VPRINTK(CHBA = 0x%x\n, ioread32(hcr_base + CHBA)); +#ifdef CONFIG_MPC8315_DS /* * Workaround for 8315DS board 3gbps link-up issue, * currently limit SATA port to GEN1 speed @@ -664,6 +665,7 @@ static int sata_fsl_port_start(struct ata_port *ap) sata_fsl_scr_read(ap, SCR_CONTROL, temp); dev_printk(KERN_WARNING, dev, scr_control, speed limited to %x\n, temp); +#endif return 0; } -- 1.5.3.2.104.g41ef - To unsubscribe from this list: send the line unsubscribe linux-ide in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 11/12] ata/sata_fsl: Remove sending LOG EXT command in sata_fsl_softreset()
From: ashish kalra [EMAIL PROTECTED] Signed-off-by: ashish kalra [EMAIL PROTECTED] Signed-off-by: Li Yang [EMAIL PROTECTED] --- drivers/ata/sata_fsl.c | 70 1 files changed, 0 insertions(+), 70 deletions(-) diff --git a/drivers/ata/sata_fsl.c b/drivers/ata/sata_fsl.c index e076e1f..c3b0360 100644 --- a/drivers/ata/sata_fsl.c +++ b/drivers/ata/sata_fsl.c @@ -730,10 +730,6 @@ static int sata_fsl_softreset(struct ata_link *link, unsigned int *class, u8 *cfis; u32 Serror; int i = 0; - struct ata_queued_cmd qc; - u8 *buf; - dma_addr_t dma_address; - struct scatterlist *sg; unsigned long start_jiffies; DPRINTK(in xx_softreset\n); @@ -833,9 +829,6 @@ try_offline_again: * reached here, we can send a command to the target device */ - if (link-sactive) - goto skip_srst_do_ncq_error_handling; - DPRINTK(Sending SRST/device reset\n); ata_tf_init(link-device, tf); @@ -903,69 +896,6 @@ try_offline_again: * command bit of the CCreg */ iowrite32(0x01, CC + hcr_base); /* We know it will be cmd#0 always */ - goto check_device_signature; - -skip_srst_do_ncq_error_handling: - - VPRINTK(Sending read log ext(10h) command\n); - - memset(qc, 0, sizeof(struct ata_queued_cmd)); - ata_tf_init(link-device, tf); - - tf.command = ATA_CMD_READ_LOG_EXT; - tf.lbal = ATA_LOG_SATA_NCQ; - tf.nsect = 1; - tf.hob_nsect = 0; - tf.flags |= ATA_TFLAG_ISADDR | ATA_TFLAG_LBA48 | ATA_TFLAG_DEVICE; - tf.protocol = ATA_PROT_PIO; - - qc.tag = ATA_TAG_INTERNAL; - qc.scsicmd = NULL; - qc.ap = ap; - qc.dev = link-device; - - qc.tf = tf; - qc.flags |= ATA_QCFLAG_RESULT_TF; - qc.dma_dir = DMA_FROM_DEVICE; - - buf = ap-sector_buf; - ata_sg_init_one(qc, buf, 1 * ATA_SECT_SIZE); - - /* -* Need to DMA-map the memory buffer associated with the command -*/ - - sg = qc.__sg; - dma_address = dma_map_single(ap-dev, qc.buf_virt, -sg-length, DMA_FROM_DEVICE); - - sg_dma_address(sg) = dma_address; - sg_dma_len(sg) = sg-length; - - VPRINTK(EH, addr = 0x%x, len = 0x%x\n, dma_address, sg-length); - - sata_fsl_qc_prep(qc); - sata_fsl_qc_issue(qc); - - temp = ata_wait_register(CQ + hcr_base, 0x1, 0x1, 1, 5000); - if (temp 0x1) { - VPRINTK(READ_LOG_EXT_10H issue failed\n); - - VPRINTK([EMAIL PROTECTED],CQ=0x%x,CA=0x%x,CC=0x%x\n, - ioread32(CQ + hcr_base), - ioread32(CA + hcr_base), ioread32(CC + hcr_base)); - - sata_fsl_scr_read(ap, SCR_ERROR, Serror); - - VPRINTK(HStatus = 0x%x\n, ioread32(hcr_base + HSTATUS)); - VPRINTK(HControl = 0x%x\n, ioread32(hcr_base + HCONTROL)); - VPRINTK(Serror = 0x%x\n, Serror); - goto err; - } - - iowrite32(0x01, CC + hcr_base); /* We know it will be cmd#0 always */ - -check_device_signature: DPRINTK(SATA FSL : Now checking device signature\n); -- 1.5.3.2.104.g41ef - To unsubscribe from this list: send the line unsubscribe linux-ide in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 12/12] ata/sata_fsl: Remove ata_scsi_suspend/resume callbacks
From: ashish kalra [EMAIL PROTECTED] Signed-off-by: ashish kalra [EMAIL PROTECTED] Signed-off-by: Li Yang [EMAIL PROTECTED] --- drivers/ata/sata_fsl.c |4 1 files changed, 0 insertions(+), 4 deletions(-) diff --git a/drivers/ata/sata_fsl.c b/drivers/ata/sata_fsl.c index c3b0360..d015b4a 100644 --- a/drivers/ata/sata_fsl.c +++ b/drivers/ata/sata_fsl.c @@ -1223,10 +1223,6 @@ static struct scsi_host_template sata_fsl_sht = { .slave_configure = ata_scsi_slave_config, .slave_destroy = ata_scsi_slave_destroy, .bios_param = ata_std_bios_param, -#ifdef CONFIG_PM - .suspend = ata_scsi_device_suspend, - .resume = ata_scsi_device_resume, -#endif }; static const struct ata_port_operations sata_fsl_ops = { -- 1.5.3.2.104.g41ef - To unsubscribe from this list: send the line unsubscribe linux-ide in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: IDE Problem with old Gateway laptop (1998 solo 2300)
The above output seems to indicate that the kernel is still relying on drivers/ide instead of libata. To change this, I'd suggest setting CONFIG_IDE=n and CONFIG_ATA=y in your .config before compiling the kernel. Also, make sure everything that starts with CONFIG_ATA, CONFIG_PATA, CONFIG_SATA, and CONFIG_SCSI is set to y. OK, managed this at the second attempt. Checked the .config with grep . I even thought of converting hda to sda in fstab grub. First time I failed to compile in ext3, so I got 'couldn't mount root' stuff. This time I'm using the system above the 1024 cylinder limit, so I'd expect that 'couldn't mount root' again if it couldn't read it. Apparently the 1024 cylinder thing was a red herring. We wait at exactly the same place. Typing onscreen works. I'll spare you all the initcalls, and just mention the relevant ones pci_init returned this Limiting Direct PCI/PCI transfers loopback_init scsi_tgt_init init_sd init_sg ahci_init k2_sata_init piix_init scsi0: ata_piix scsi1: ata_piix ata1: PATA max udma/33 cmd 0x000101f0 ctl 0x000103f6 bmdma 0x0001fcd0 irq 14 ata2: PATA max udma/33 cmd 0x00010170 ctl 0x00010376 bmdma 0x0001fcd8 irq 15 ATA1.00: ATA-3 HITATCHI_DK226A-32 00T0A0A0 max MWDMA2 ATA1.00: 6332256 sectors multi 16: LBA ATA1.00: configured for MWDMA2 scsi 0:0:0:0 Direct Access ATA Hitatchi_DK226A-3 00T0 PQ: 0 ANSI 5 sd 0:0:0:0 [sda] 6332256 512-byte hardware sectors (3242MB) sd 0:0:0:0 [sda] Write Protect is off sd 0:0:0:0 [sda] Write cache: disabled, read cache: enabled doesn't support DPO or FUA sda: sda1 sda2 sda3 ssda4 sd 0:0:0:0 [sda] Attached scsi disk sd 0:0:0:0 [sda] Attached scsi generic sg0 type 0 (piix_init returned 0 ran for 383 msec. The following ones ran for 0 msec) pdc_ata_init qs_ata_init sil_init sil24_init svia_init vsc_sata_init sis_init pdc_sata_init nv_init uli_init mv_init inic_init adma_ata_init ali_init amd_init artop_init atiixp_init cmd640_init cs5520_init cs5530_init cs5535_init cy82c693_init efar_init hpt36x_init hpt37x_init hpt3x2n_init hpt3x3_init it821x_init it8213_init jmicron_init netcell_init ns87410_init opti_init optidma_init marvell_init mpiix_init piix_init oldpiix_init pdc2027x_init pdc202xx_init qdi_init radisys_init rz1000_init sc1200_init serverworks_init sil680_init via_init sl82c105_init winbond_init sis_init triflex_init ata_generic_init legacy_init mon_init .. pcspeaker_init (ran for 375 msec) io_apic_bug_finalize pci_sysfs_init scsi_complete_async_scans tcp_congestion_default kjournald starting Commit interval 5 seconds VFS: Mounted root (ext3 filesystem) readonly Freeing unused kernel memory: 168k freed (keyboard still echoed onscreen, disk parked) Adding init=/bin/bash is no better. Just to nail the possibility, I also did a chroot into the system I built (here on an Athlon which is on that laptop) and ran the init program. I got one very surprised and confused init, but it ran until I killed it. I'm hoping just for a diagnosis - X is wrong I gather the ide stuff is old, but ok Please 'reply to all' as I'm not on the list. - To unsubscribe from this list: send the line unsubscribe linux-ide in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: Fix ATAPI transfer lengths causes CD writing regression
On Tue, 30 Oct 2007 19:21:29 + Daniel Drake [EMAIL PROTECTED] wrote: Alan Cox wrote: I would guess Brasero is issuing a command with the length of data wrongly set. In the old code that might well just produce errors of the Umm wtf is this data left over for ?, with the new code the drive is likely to change state as it knows the transfer size and that will *correctly* cause an HSM error and what follows. Now the question is who gets the length wrong - Brasero or the ata translation code in libata Brasero does exactly the same as my test app which I attached to my last mail. Is my test app wrong? Would need to double check the SCSI specificatons to be sure but I think you are asking for less data than the drive wishes to provide. You aren't allowed to do that with ATA. Alan - To unsubscribe from this list: send the line unsubscribe linux-ide in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: Fix ATAPI transfer lengths causes CD writing regression
On Wed, Oct 31 2007, Alan Cox wrote: On Tue, 30 Oct 2007 19:21:29 + Daniel Drake [EMAIL PROTECTED] wrote: Alan Cox wrote: I would guess Brasero is issuing a command with the length of data wrongly set. In the old code that might well just produce errors of the Umm wtf is this data left over for ?, with the new code the drive is likely to change state as it knows the transfer size and that will *correctly* cause an HSM error and what follows. Now the question is who gets the length wrong - Brasero or the ata translation code in libata Brasero does exactly the same as my test app which I attached to my last mail. Is my test app wrong? Would need to double check the SCSI specificatons to be sure but I think you are asking for less data than the drive wishes to provide. You aren't allowed to do that with ATA. ide-cd handles this by throwing the excess away, which I think is the sane way to do this. -- Jens Axboe - To unsubscribe from this list: send the line unsubscribe linux-ide in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: Fix ATAPI transfer lengths causes CD writing regression
Jens Axboe wrote: On Wed, Oct 31 2007, Alan Cox wrote: On Tue, 30 Oct 2007 19:21:29 + Daniel Drake [EMAIL PROTECTED] wrote: Alan Cox wrote: I would guess Brasero is issuing a command with the length of data wrongly set. In the old code that might well just produce errors of the Umm wtf is this data left over for ?, with the new code the drive is likely to change state as it knows the transfer size and that will *correctly* cause an HSM error and what follows. Now the question is who gets the length wrong - Brasero or the ata translation code in libata Brasero does exactly the same as my test app which I attached to my last mail. Is my test app wrong? Would need to double check the SCSI specificatons to be sure but I think you are asking for less data than the drive wishes to provide. You aren't allowed to do that with ATA. ide-cd handles this by throwing the excess away, which I think is the sane way to do this. That's easy for the PIO case. But CD writing is normally DMA, which means you will get a DMA engine exception if the device wants to give you more data than the scatter/gather entries permit. Jeff - To unsubscribe from this list: send the line unsubscribe linux-ide in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 2.6.24-rc1] sata_promise: fix endianess bug in ASIC PRD bug workaround
The original workaround for the Promise ASIC PRD bug contained an endianess bug which I failed to detect: the adjustment of the last PRD entry's length field applied host arithmetic to little-endian data, which is incorrect on big-endian machines. We have the length available in host-endian format, so do the adjustment on host-endian data and then convert and store it in the PRD entry's little-endian data field. Thanks to an anonymous reviewer for detecting this bug. Signed-off-by: Mikael Pettersson [EMAIL PROTECTED] --- Jeff: please include this fix in any backport(s) of the ASIC PRD bug workaround. drivers/ata/sata_promise.c |2 +- 1 files changed, 1 insertion(+), 1 deletion(-) diff -rupN linux-2.6.24-rc1/drivers/ata/sata_promise.c linux-2.6.24-rc1.sata_promise-endianess-fix/drivers/ata/sata_promise.c --- linux-2.6.24-rc1/drivers/ata/sata_promise.c 2007-10-31 11:47:13.0 +0100 +++ linux-2.6.24-rc1.sata_promise-endianess-fix/drivers/ata/sata_promise.c 2007-10-31 11:47:25.0 +0100 @@ -585,7 +585,7 @@ static void pdc_fill_sg(struct ata_queue VPRINTK(Splitting last PRD.\n); addr = le32_to_cpu(ap-prd[idx - 1].addr); - ap-prd[idx - 1].flags_len -= cpu_to_le32(SG_COUNT_ASIC_BUG); + ap-prd[idx - 1].flags_len = cpu_to_le32(len - SG_COUNT_ASIC_BUG); VPRINTK(PRD[%u] = (0x%X, 0x%X)\n, idx - 1, addr, SG_COUNT_ASIC_BUG); addr = addr + len - SG_COUNT_ASIC_BUG; - To unsubscribe from this list: send the line unsubscribe linux-ide in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] libata: increase 128 KB / cmd limit for ATAPI tape drives
On Tue, 30 Oct 2007 11:44:35 -0400 Tony Battersby [EMAIL PROTECTED] wrote: Commands sent to ATAPI tape drives via the SCSI generic (sg) driver are limited in the amount of data that they can transfer by the max_sectors value. The max_sectors value is currently calculated according to the command set for disk drives, which doesn't apply to tape drives. The default max_sectors value of 256 limits ATAPI tape drive commands to 128 KB. This patch against 2.6.24-rc1 increases the max_sectors value for tape drives to 65535, which permits tape drive commands to transfer just under 32 MB. Seems reasonable to me and is valid for all ATAPI devices as far as I can see since we use READ_10/WRITE_10 commands. Alan - To unsubscribe from this list: send the line unsubscribe linux-ide in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: Fix ATAPI transfer lengths causes CD writing regression
Would need to double check the SCSI specificatons to be sure but I think you are asking for less data than the drive wishes to provide. You aren't allowed to do that with ATA. ide-cd handles this by throwing the excess away, which I think is the sane way to do this. It also fails for some cases because the controller snoops the length information in the packet command. Alan - To unsubscribe from this list: send the line unsubscribe linux-ide in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: Fix ATAPI transfer lengths causes CD writing regression
On Wed, Oct 31 2007, Jeff Garzik wrote: Jens Axboe wrote: On Wed, Oct 31 2007, Alan Cox wrote: On Tue, 30 Oct 2007 19:21:29 + Daniel Drake [EMAIL PROTECTED] wrote: Alan Cox wrote: I would guess Brasero is issuing a command with the length of data wrongly set. In the old code that might well just produce errors of the Umm wtf is this data left over for ?, with the new code the drive is likely to change state as it knows the transfer size and that will *correctly* cause an HSM error and what follows. Now the question is who gets the length wrong - Brasero or the ata translation code in libata Brasero does exactly the same as my test app which I attached to my last mail. Is my test app wrong? Would need to double check the SCSI specificatons to be sure but I think you are asking for less data than the drive wishes to provide. You aren't allowed to do that with ATA. ide-cd handles this by throwing the excess away, which I think is the sane way to do this. That's easy for the PIO case. But CD writing is normally DMA, which means you will get a DMA engine exception if the device wants to give you more data than the scatter/gather entries permit. Right, that's of course problematic... There has to be a way to recover that situation though, or you can't export any user command issue facility. -- Jens Axboe - To unsubscribe from this list: send the line unsubscribe linux-ide in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH]libata-acpi: add ACPI _PSx method
On Wednesday, 31 October 2007 03:27, Len Brown wrote: It would be interseting if any of the folks having power consumption problems when suspended see an improvement with this patch. Are there plans to refresh this patch and get it upstream? Acked-by: Len Brown [EMAIL PROTECTED] There was a discussion regarding this patch, IIRC, and it was argued that _PSx are only applicable to IDE/PATA devices. I wonder if this has been addressed. Greetings, Rafael On Thursday 20 September 2007 22:17, Shaohua Li wrote: On Fri, 2007-09-21 at 11:20 +0900, Tejun Heo wrote: Hello, Shaohua Li wrote: + /* channel first and then drives for power on and verse versa for power off */ + if (state.event == PM_EVENT_ON) + acpi_bus_set_power(ap-acpi_handle, ACPI_STATE_D0); + + if (ap-flags ATA_FLAG_SLAVE_POSS) + max_devices++; ata_port_max_devices()? ok, fixed. Index: linux/drivers/ata/libata-eh.c === --- linux.orig/drivers/ata/libata-eh.c 2007-09-14 10:28:25.0 +0800 +++ linux/drivers/ata/libata-eh.c 2007-09-21 08:56:40.0 +0800 @@ -2349,6 +2349,7 @@ static void ata_eh_handle_port_suspend(s if (ap-ops-port_suspend) rc = ap-ops-port_suspend(ap, ap-pm_mesg); + ata_acpi_set_state(ap, PMSG_SUSPEND); out: /* report result */ spin_lock_irqsave(ap-lock, flags); @@ -2394,6 +2395,8 @@ static void ata_eh_handle_port_resume(st WARN_ON(!(ap-pflags ATA_PFLAG_SUSPENDED)); + ata_acpi_set_state(ap, PMSG_ON); + if (ap-ops-port_resume) rc = ap-ops-port_resume(ap); Can these be moved into ata_acpi_on_suspend() and ata_acpi_on_resume()? Or do they have to be placed on the other side of -port_suspend/resume callbacks? I suppose _PSx will shutdown ports. So I want to do PS3 as later as possible in suspend, and vice versa in resume. Thanks, Shaohua --- drivers/ata/libata-acpi.c | 34 ++ drivers/ata/libata-eh.c |3 +++ drivers/ata/libata.h |2 ++ 3 files changed, 39 insertions(+) Index: linux/drivers/ata/libata-acpi.c === --- linux.orig/drivers/ata/libata-acpi.c2007-09-21 09:23:13.0 +0800 +++ linux/drivers/ata/libata-acpi.c 2007-09-21 10:13:32.0 +0800 @@ -523,6 +523,39 @@ void ata_acpi_on_resume(struct ata_port } /** + * ata_acpi_set_state - set the port power state + * @ap: target ATA port + * @state: state, on/off + * + * This function executes the _PS0/_PS3 ACPI method to set the power state. + * ACPI spec requires _PS0 when IDE power on and _PS3 when power off + */ +void ata_acpi_set_state(struct ata_port *ap, pm_message_t state) +{ + int max_devices, i; + + if (!ap-acpi_handle || (ap-flags ATA_FLAG_ACPI_SATA)) + return; + + /* channel first and then drives for power on and verse versa for power off */ + if (state.event == PM_EVENT_ON) + acpi_bus_set_power(ap-acpi_handle, ACPI_STATE_D0); + + max_devices = ata_port_max_devices(ap); + + for (i = 0; i max_devices; ++i) { + struct ata_device *dev = ap-device[i]; + + if (dev-acpi_handle) + acpi_bus_set_power(dev-acpi_handle, + state.event == PM_EVENT_ON ? + ACPI_STATE_D0: ACPI_STATE_D3); + } + if (state.event != PM_EVENT_ON) + acpi_bus_set_power(ap-acpi_handle, ACPI_STATE_D3); +} + +/** * ata_acpi_on_devcfg - ATA ACPI hook called on device donfiguration * @dev: target ATA device * Index: linux/drivers/ata/libata-eh.c === --- linux.orig/drivers/ata/libata-eh.c 2007-09-21 09:23:13.0 +0800 +++ linux/drivers/ata/libata-eh.c 2007-09-21 10:09:10.0 +0800 @@ -2349,6 +2349,7 @@ static void ata_eh_handle_port_suspend(s if (ap-ops-port_suspend) rc = ap-ops-port_suspend(ap, ap-pm_mesg); + ata_acpi_set_state(ap, PMSG_SUSPEND); out: /* report result */ spin_lock_irqsave(ap-lock, flags); @@ -2394,6 +2395,8 @@ static void ata_eh_handle_port_resume(st WARN_ON(!(ap-pflags ATA_PFLAG_SUSPENDED)); + ata_acpi_set_state(ap, PMSG_ON); + if (ap-ops-port_resume) rc = ap-ops-port_resume(ap); Index: linux/drivers/ata/libata.h === --- linux.orig/drivers/ata/libata.h 2007-09-21 09:23:13.0 +0800 +++ linux/drivers/ata/libata.h 2007-09-21 10:09:10.0 +0800 @@ -102,11
libata-core.c compile warnings with !CONFIG_PM
Hi , I see this warnings on current git head with !CONFIG_PM : ... drivers/ata/libata-core.c:768: warning: 'ata_lpm_enable' defined but not used drivers/ata/libata-core.c:784: warning: 'ata_lpm_disable' defined but not used ... So far I see ata_lpm_enable() is only used in ata_host_suspend(), ata_lpm_disable() only in ata_host_resume() which have already #ifdef CONFIG_PM around. Possible fix is to do the same for ata_lpm_enable() , ata_lpm_disable() and for ata_dev_disable_pm() which is only used in ata_lpm_enable() Signed-off-by: Gabriel Craciunescu [EMAIL PROTECTED] --- drivers/ata/libata-core.c |5 - 1 files changed, 4 insertions(+), 1 deletions(-) diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c index 63035d7..7c78810 100644 --- a/drivers/ata/libata-core.c +++ b/drivers/ata/libata-core.c @@ -747,6 +747,7 @@ enable_pm_out: * Locking: Caller. * Returns: void */ +#ifdef CONFIG_PM static void ata_dev_disable_pm(struct ata_device *dev) { struct ata_port *ap = dev-link-ap; @@ -755,6 +756,7 @@ static void ata_dev_disable_pm(struct ata_device *dev) if (ap-ops-disable_pm) ap-ops-disable_pm(ap); } +#endif void ata_lpm_schedule(struct ata_port *ap, enum link_pm policy) { @@ -764,6 +766,7 @@ void ata_lpm_schedule(struct ata_port *ap, enum link_pm policy) ata_port_schedule_eh(ap); } +#ifdef CONFIG_PM static void ata_lpm_enable(struct ata_host *host) { struct ata_link *link; @@ -789,7 +792,7 @@ static void ata_lpm_disable(struct ata_host *host) ata_lpm_schedule(ap, ap-pm_policy); } } - +#endif /** * ata_devchk - PATA device presence detection - To unsubscribe from this list: send the line unsubscribe linux-ide in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Other Problems with Marvell Driver - 7042 (2.6.23)...
I am running the 'latest' kernel retrieved from Kumar Gala's Powerpc git tree (mainly because I am running on a MPC8548 board) and it appears to be in the full 2.6.23 version while the sata_mv driver version seems to be 1.01. I have searched the archives, and there has been some discussion of a regression in the Marvell driver, but I seem to have a different symptom from Olaf's (I am not running a 64bit kernel - and I am *not* running with large (36bit) physical and resources - so I wouldn't have the same type of IOMMU issues) Below in the error output (using ATA_DEBUG) the driver sees the two drives (3 partitions on /dev/sda 2 partitions on /dev/sdb) and apparently sets up everything correctly for standard access... But, when I try to mount a partition - it freezes up and gets I/O errors? Can someone give me any hints of things to try? Thanks in advance... Tom Morrison Principal S/W Engineer Empirix, Inc (www.empirix.com) [EMAIL PROTECTED] (781) 266 - 3567 start related initialization/error output=== ---version--- Linux version 2.6.23-gd85714d8-dirty ([EMAIL PROTECTED]) (gcc version 3.4.3 20041021 (prerelease)) #33 Wed Oct 31 11:14:34 EDT 2007 bootup Scanning CPUs ... Memory CAM mapping: CAM0=256Mb, CAM1=256Mb, CAM2=256Mb residual: 2304Mb Linux version 2.6.23-gd85714d8-dirty ([EMAIL PROTECTED]) (gcc version 3.4.3 20041021 (prerelease)) #32 Wed Oct 31 10:47:38 EDT 2007 ---pci setup--- Adding PCI host bridge /[EMAIL PROTECTED]/[EMAIL PROTECTED] Found FSL PCI host bridge at 0xe000a000.Firmware bus number: 0-255 -Hose at 0xc037d000, cfg_addr=0xfdffd000,cfg_data=0xfdffd004 PCI: MEM[0] 0xc000 - 0xdfff PCI: IO 0x0 - 0xff PCI memory map start 0xe000a000, size 0x1000 PCI MEM resource start 0xc000, size 0x2000. PCI IO resource start 0x, size 0x0100, phy base 0xe300. ---related pci probing PCI: Scanning bus :0c PCI: Found :0c:00.0 [11ab/7042] 000100 00 PCI: Fixups for bus :0c io_base_high ff new base/limit fff000/fff000 pci_busdev_to_OF_node(12,0x0) pci_busdev_to_OF_node(2,0x40) pci_busdev_to_OF_node(1,0x0) pci_busdev_to_OF_node(0,0x0) parent is /[EMAIL PROTECTED]/[EMAIL PROTECTED] result is NULL PCI: Bus scan for :0c returning with max=0c ---pci probing results--- PCI: bridge rsrc dab0..dabf (200), parent c2015a58 PCI::0c:00.0: Resource 0: dab0-dabf (f=204) = snip unrelated initialization = --- sata_mv init --- sata_mv :0c:00.0: version 1.01 ata_host_alloc: ENTER ata_port_alloc: ENTER ata_port_alloc: ENTER ata_port_alloc: ENTER ata_port_alloc: ENTER sata_mv :0c:00.0: Applying 60X1C0 workarounds to unknown rev mv_port_init: EDMA cfg=0x211f EDMA IRQ err cause/mask=0x/0x mv_port_init: EDMA cfg=0x211f EDMA IRQ err cause/mask=0x/0x mv_port_init: EDMA cfg=0x211f EDMA IRQ err cause/mask=0x/0x mv_port_init: EDMA cfg=0x211f EDMA IRQ err cause/mask=0x/0x mv_init_host: HC0: HC config=0x000100ff HC IRQ cause (before clear)=0x mv_init_host: HC MAIN IRQ cause/mask=0x/0x0087 PCI int cause/mask=0x/0x mv_dump_pci_cfg: 00: 704211ab 0017 0102 mv_dump_pci_cfg: 10: dab4 0001 mv_dump_pci_cfg: 20: 11ab11ab mv_dump_pci_cfg: 30: 0040 0100 mv_dump_pci_cfg: 40: 00025001 mv_dump_pci_cfg: 50: 00806005 mv_dump_pci_cfg: 60: 00110010 00640081 sata_mv :0c:00.0: Gen-IIE 32 slots 4 ports SCSI mode IRQ via INTx __ata_port_freeze: ata4294967295 port frozen __ata_port_freeze: ata4294967295 port frozen __ata_port_freeze: ata4294967295 port frozen __ata_port_freeze: ata4294967295 port frozen scsi0 : sata_mv scsi1 : sata_mv scsi2 : sata_mv scsi3 : sata_mv ata1: SATA max UDMA/133 mmio [EMAIL PROTECTED] port 0xdab22000 irq 18 ata2: SATA max UDMA/133 mmio [EMAIL PROTECTED] port 0xdab24000 irq 18 ata3: SATA max UDMA/133 mmio [EMAIL PROTECTED] port 0xdab26000 irq 18 ata4: SATA max UDMA/133 mmio [EMAIL PROTECTED] port 0xdab28000 irq 18 ata_host_register: probe begin ata_port_schedule_eh: port EH scheduled ata_scsi_error: ENTER ata_port_flush_task: ENTER ata_eh_link_autopsy: ENTER ata_eh_recover: ENTER __ata_port_freeze: ata1 port frozen mv_phy_reset: ENTER, port 0, mmio 0xf10a2000 mv_phy_reset: S-regs after ATA_RST: SStat 0x0004 SErr 0x SCtrl 0x0004 mv_phy_reset: S-regs after PHY wake: SStat 0x0113 SErr 0x0401 SCtrl 0x0300 ata_dev_classify: found ATA device by sig mv_phy_reset: EXIT ata1: SATA link up 1.5 Gbps (SStatus 113 SControl 300) ata_eh_thaw_port: ata1 port thawed ata_eh_revalidate_and_attach: ENTER ata1: ata_dev_select: ENTER, device 0, wait 1 ata1: ata_dev_select: ENTER, device 0, wait 1 ata_tf_load: feat 0x0 nsect 0x0 lba
Re: Fix ATAPI transfer lengths causes CD writing regression
Jens Axboe wrote: Right, that's of course problematic... There has to be a way to recover that situation though, or you can't export any user command issue facility. You cannot hope to handle all possible effects arising from an app providing an invalid sg header / cdb. Once you start talking recovery you are already screwed: we are talking about low-level hardware commands that are passed straight to the hardware. It is trivial to lock up hardware, brick hardware, and corrupt data at that level. If this is NOT a privileged app, we must update the command validation to ensure that invalid commands are not transported to the hardware. If this is a privileged app, our work is done. Fix the app. We gave root rope, and he took it. I even venture to say that accept anything, clean up afterwards is /impossible/ to implement, in addition to being dangerous. Jeff - To unsubscribe from this list: send the line unsubscribe linux-ide in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: Other Problems with Marvell Driver - 7042 (2.6.23)...
Morrison, Tom wrote: I am running the 'latest' kernel retrieved from Kumar Gala's Powerpc git tree (mainly because I am running on a MPC8548 board) and it appears to be in the full 2.6.23 version while the sata_mv driver version seems to be 1.01. I have searched the archives, and there has been some discussion of a regression in the Marvell driver, but I seem to have a different symptom from Olaf's (I am not running a 64bit kernel - and I am *not* running with large (36bit) physical and resources - so I wouldn't have the same type of IOMMU issues) Below in the error output (using ATA_DEBUG) the driver sees the two drives (3 partitions on /dev/sda 2 partitions on /dev/sdb) and apparently sets up everything correctly for standard access... But, when I try to mount a partition - it freezes up and gets I/O errors? Can someone give me any hints of things to try? First you need to try 2.6.23.1 rather than 2.6.23, because it contains a critical sata_mv fix. Jeff - To unsubscribe from this list: send the line unsubscribe linux-ide in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: Fix ATAPI transfer lengths causes CD writing regression
Jeff Garzik wrote: Jens Axboe wrote: Right, that's of course problematic... There has to be a way to recover that situation though, or you can't export any user command issue facility. You cannot hope to handle all possible effects arising from an app providing an invalid sg header / cdb. Is it invalid though? As a SCSI command, it seems perfectly valid to ask for less data than the total amount the drive could possibly send. It's only when we have to translate it to an ATA command in libata that it becomes invalid there, right? Are you saying that we should limit the SG_IO commands to only ones that are valid both as SCSI *and* as their ATA translations? Would that be for all SCSI devices, or just ones that libata backs? Daniel - To unsubscribe from this list: send the line unsubscribe linux-ide in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 2/15] ide: CPU endianness doesn't matter for special_t
Hello. Bartlomiej Zolnierkiewicz wrote: special_t is used only internally by the IDE subsystem (it isn't related to hardware registers and isn't exported to the user-space). Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED] Acked-by: Sergei Shtylyov [EMAIL PROTECTED] MBR, Sergei - To unsubscribe from this list: send the line unsubscribe linux-ide in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: Fix ATAPI transfer lengths causes CD writing regression
If this is NOT a privileged app, we must update the command validation to ensure that invalid commands are not transported to the hardware. We allow only a subset of standard commands to be issued by unprivileged applications. We don't strictly enforce transfer sizes and its arguable on SCSI transports this doesn't matter one iota. On ATA it perhaps matters a bit more. Note btw - the reset sequence cased by excess data off these drives is something we jump up and down and trigger. For PIO draining the bits is fine, for DMA pretty much all controllers will clean up happily enough. Its also nothing like the problem you might think as most drives told send me 150 bytes, oh and the transfer length is 40 will in fact send 40. Alan - To unsubscribe from this list: send the line unsubscribe linux-ide in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
RE: ATAPI devices in AHCI mode not working
-Original Message- From: [EMAIL PROTECTED] [mailto:linux-ide- [EMAIL PROTECTED] On Behalf Of Tejun Heo Sent: Wednesday, October 31, 2007 1:07 AM To: Gaston, Jason D Cc: Alan Cox; linux-ide@vger.kernel.org Subject: Re: ATAPI devices in AHCI mode not working Gaston, Jason D wrote: -Original Message- From: Alan Cox [mailto:[EMAIL PROTECTED] Sent: Monday, October 29, 2007 3:14 PM To: Gaston, Jason D Cc: linux-ide@vger.kernel.org Subject: Re: ATAPI devices in AHCI mode not working ata1: SATA max UDMA/133 abar [EMAIL PROTECTED] port 0xd9101100 irq 216 ata2: SATA max UDMA/133 abar [EMAIL PROTECTED] port 0xd9101180 irq 216 ata1: SATA link up 1.5 Gbps (SStatus 113 SControl 300) ata1.00: ATAPI: ATAPI DVD D DH16D2S, EP52, max UDMA/100 ata1.00: configured for UDMA/100 Much better - no misdetected link type, no device claiming to be PATA when its SATA. Right that eliminates all the obvious goings on being caused by broken devices which is a start. Doesn't shed any light on the rest of it. What happens if you boot with irqpoll enabled ? (wondering if the timeouts are ACPI or IRQ routing stuff) I rebuilt the kernel; the DVD and USB devices are functional now. I'm not sure what the problem was before. On a side note: In 2.6.24.rc1 the DVD starts working right away, but on a SLES10_SP1 kernel, it takes some time for it to step down to a PIO mode before the DVD can be mounted. Oh well. Yeah, there has been quite some update in libata between SLES10_SP1 and 2.6.24-rc1. The controller being ahci, I wonder whether this is caused by the different in check_atapi_dma(). 1. Does other optical drives have the same problem? If not, please post the result of hdparm -I /dev/sr0 with the problematic one attached. 2. If you apply the attached patch to 2.6.24-rc1, does it behave the same as the SLES10SP1 kernel? -- Tejun All of the ATAPI drives seem to have the issue of taking a while to slow down and start working. I will try the patch and see what happens. I will also get the hdparm info from all of the drives I am using to see if something stands out. Thanks, Jason - To unsubscribe from this list: send the line unsubscribe linux-ide in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: IDE Problem with old Gateway laptop (1998 solo 2300)
kjournald starting Commit interval 5 seconds VFS: Mounted root (ext3 filesystem) readonly Freeing unused kernel memory: 168k freed (keyboard still echoed onscreen, disk parked) Adding init=/bin/bash is no better. So its the user space which is broken. Make sure the user space has the right /dev etc - and is for the right CPU - a 200MHz pentium means you need i386 or i586 binaries. i686/athlon binaries would produce the effect you report. Alan - To unsubscribe from this list: send the line unsubscribe linux-ide in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: IDE Problem with old Gateway laptop (1998 solo 2300)
--- Declan Moriarty [EMAIL PROTECTED] wrote: piix_init scsi0: ata_piix scsi1: ata_piix ata1: PATA max udma/33 cmd 0x000101f0 ctl 0x000103f6 bmdma 0x0001fcd0 irq 14 ata2: PATA max udma/33 cmd 0x00010170 ctl 0x00010376 bmdma 0x0001fcd8 irq 15 ATA1.00: ATA-3 HITATCHI_DK226A-32 00T0A0A0 max MWDMA2 ATA1.00: 6332256 sectors multi 16: LBA ATA1.00: configured for MWDMA2 scsi 0:0:0:0 Direct Access ATA Hitatchi_DK226A-3 00T0 PQ: 0 ANSI 5 sd 0:0:0:0 [sda] 6332256 512-byte hardware sectors (3242MB) sd 0:0:0:0 [sda] Write Protect is off sd 0:0:0:0 [sda] Write cache: disabled, read cache: enabled doesn't support DPO or FUA sda: sda1 sda2 sda3 ssda4 sd 0:0:0:0 [sda] Attached scsi disk sd 0:0:0:0 [sda] Attached scsi generic sg0 type 0 (piix_init returned 0 ran for 383 msec. The following ones ran for 0 msec) I'm hoping just for a diagnosis - X is wrong I agree that the problem is in userspace. I can think of two diagnoses: 1) The userspace components of the distro youre using are mis-configured. To eliminate this possibility, boot the computer from Debian installation floppies: http://http.us.debian.org/debian/dists/unstable/main/installer-i386/current/images/floppy/ See installation instructions below: http://www.debian.org/releases/stable/i386/apas02.html.en#howto-getting-images-floppy At one point during the Debian installation, youll be able to press Alt-Ctrl-F2 and get a console. From here you can manually mount the various partitions. If you can mount and read the partitions, then everything is fine and you can go ahead and install Debian or another distro. If any step fails, try to capture the output of the dmesg command from the console and email it to the list. 2) If mounting fails, your drives might be formatted with a proprietary Disk Drive Overlay (DDO). You would have to either a) remove the DDO using the same proprietary software that installed it; or b) reformat the disk. Vlad __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com - To unsubscribe from this list: send the line unsubscribe linux-ide in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: Fix ATAPI transfer lengths causes CD writing regression
On Wed, Oct 31 2007, Jeff Garzik wrote: Jens Axboe wrote: Right, that's of course problematic... There has to be a way to recover that situation though, or you can't export any user command issue facility. You cannot hope to handle all possible effects arising from an app providing an invalid sg header / cdb. Once you start talking recovery you are already screwed: we are talking about low-level hardware commands that are passed straight to the hardware. It is trivial to lock up hardware, brick hardware, and corrupt data at that level. If this is NOT a privileged app, we must update the command validation to ensure that invalid commands are not transported to the hardware. If this is a privileged app, our work is done. Fix the app. We gave root rope, and he took it. Woaw, back the truck up a bit :-) I'm talking about simple things - like asking for 8 bytes of sense data. Simple mistakes. You cannot possibly check for everything like that in a command filter, it's utterly impossible. I even venture to say that accept anything, clean up afterwards is /impossible/ to implement, in addition to being dangerous. Certainly, that's not what I'm talking about. -- Jens Axboe - To unsubscribe from this list: send the line unsubscribe linux-ide in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Update (Now a False Alarm) RE: Other Problems with Marvell Driver - 7042 (2.6.23)...
Jeff / all - Jeff is (again) 100% correct with comments - the sata_mv.c I used from Kumar's 2.6.23 Powerpc tree is very *close*, but not exactly the same as the sata_mv.c in the 'official' 2.6.23.1 tree. I have verified that I now can access my disks behind the 7042 chip with the 'mainline' 2.6.23.1 (and my bsp)... Sorry for the false alarm - thank you Jeff for pointing me in the right direction with this! Sincerely, Tom Morrison -Original Message- From: Jeff Garzik [mailto:[EMAIL PROTECTED] Sent: Wednesday, October 31, 2007 12:07 PM To: Morrison, Tom Cc: linux-ide@vger.kernel.org; [EMAIL PROTECTED]; Kumar Gala Subject: Re: Other Problems with Marvell Driver - 7042 (2.6.23)... Morrison, Tom wrote: snip description of problem ==Jeff writes= First you need to try 2.6.23.1 rather than 2.6.23, because it contains a critical sata_mv fix. Jeff - To unsubscribe from this list: send the line unsubscribe linux-ide in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 13/15] ide: remove hwif-intrproc
Hello. Bartlomiej Zolnierkiewicz wrote: Given that: * hpt366.c::hpt3xx_intrproc() is the only user of hwif-intrproc * hpt366.c::hpt3xx_quirkproc() sets drive-quirk_list to 1 for quirky drives which is a value unique to hpt366 host driver we can remove hwif-intproc and just check for drive-quirk_list == 1 in ide_do_request(). Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED] Acked-by: Sergei Shtylyov [EMAIL PROTECTED] --- Handling of quirky drives (problems with nIEN) by hpt366 and pdc202xx_* looks suspicious... are the problems really dependent on the host type (thus hwif-quirkproc and -quirk_list == 1/2)? Shouldn't we just handle quirky drives in the same way in the core IDE code regardless of the host driver being used (of course using hwif-maskproc where needed)? Indeed... MBR, Sergei - To unsubscribe from this list: send the line unsubscribe linux-ide in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 2/3] drivers/ide/pci/sc1200.c: remove pointless hwif lookup loop
On Friday 26 October 2007, Jeff Garzik wrote: Bartlomiej Zolnierkiewicz wrote: On Thursday 25 October 2007, Jeff Garzik wrote: Store our hwif indices at probe time, in order to eliminate a needless and ugly loop across all hwifs, searching for our pci device. It seems that we can simplify it even further and remove knowledge about hwifs altogether from suspend/resume methods. Signed-off-by: Jeff Garzik [EMAIL PROTECTED] --- drivers/ide/pci/sc1200.c | 76 +++--- 1 files changed, 51 insertions(+), 25 deletions(-) diff --git a/drivers/ide/pci/sc1200.c b/drivers/ide/pci/sc1200.c index d2c8b55..17e58d6 100644 --- a/drivers/ide/pci/sc1200.c +++ b/drivers/ide/pci/sc1200.c @@ -41,6 +41,8 @@ #define PCI_CLK_660x02 #define PCI_CLK_33A 0x03 +#define SC1200_IFS4 + static unsigned short sc1200_get_pci_clock (void) { unsigned char chip_id, silicon_revision; @@ -261,31 +263,32 @@ static void sc1200_set_pio_mode(ide_drive_t *drive, const u8 pio) } #ifdef CONFIG_PM -static ide_hwif_t *lookup_pci_dev (ide_hwif_t *prev, struct pci_dev *dev) -{ - int h; - - for (h = 0; h MAX_HWIFS; h++) { - ide_hwif_t *hwif = ide_hwifs[h]; - if (prev) { - if (hwif == prev) - prev = NULL;// found previous, now look for next match - } else { - if (hwif hwif-pci_dev == dev) - return hwif;// found next match - } - } - return NULL;// not found -} - typedef struct sc1200_saved_state_s { __u32 regs[4]; } sc1200_saved_state_t; +static unsigned int pack_hwif_idx(u8 *idx) +{ + return (((unsigned int) idx[0]) 0) | + (((unsigned int) idx[1]) 8) | + (((unsigned int) idx[2]) 16) | + (((unsigned int) idx[3]) 24); +} + +static ide_hwif_t *sc1200_hwif(struct pci_dev *pdev, unsigned int iface) +{ + unsigned int packed_hwifs, idx; + + packed_hwifs = (unsigned long) pci_get_drvdata(pdev); + idx = (packed_hwifs (iface * 8)) 0xff; + + return (idx == 0xff) ? NULL : ide_hwifs[idx]; +} static int sc1200_suspend (struct pci_dev *dev, pm_message_t state) { - ide_hwif_t *hwif = NULL; + ide_hwif_t *hwif; + int i; printk(SC1200: suspend(%u)\n, state.event); @@ -295,9 +298,14 @@ static int sc1200_suspend (struct pci_dev *dev, pm_message_t state) // // Loop over all interfaces that are part of this PCI device: // - while ((hwif = lookup_pci_dev(hwif, dev)) != NULL) { + for (i = 0; i SC1200_IFS; i++) { sc1200_saved_state_t*ss; unsigned intbasereg, r; + + hwif = sc1200_hwif(dev, i); + if (!hwif) + continue; + // // allocate a permanent save area, if not already allocated // @@ -310,7 +318,7 @@ static int sc1200_suspend (struct pci_dev *dev, pm_message_t state) } ss = (sc1200_saved_state_t *)hwif-config_data; // - // Save timing registers: this may be unnecessary if + // Save timing registers: this may be unnecessary if // BIOS also does it // basereg = hwif-channel ? 0x50 : 0x40; Please take a close look at the line above and the next three lines: for (r = 0; r 4; ++r) { pci_read_config_dword (hwif-pci_dev, basereg + (r2), ss-regs[r]); } It is highly obfuscated but the sc1200_suspend() reads 16 bytes from the offset 0x40 (for the primary port) and puts them in the corresponding struct sc1200_saved_state_s buffer, then it reads another 16 bytes from the offset 0x50 (for the secondary port) and puts it in the another buffer. In summary sc1200_suspend() reads 32 continuous bytes from offset 0x40 and the exactly reverse operation happens in sc1200_resume(). Given that and the fact that struct sc1200_save_state_s buffers are used _only_ by sc1200_{suspend,resume}() we may safely convert the code to use one buffer for both ports (the whole PCI device). We just need to bump the size of struct sc1200_saved_state_s (from 4 to 8 double-words) and use pci_{get,set}_drvdata() instead of hwif-config_data. Then we can remove looping over interfaces completely from sc1200_{suspend,resume}()! :) May I assume you'll handle that task? :) It sounds like you have a far better idea than mine, and my main goal -- fixing bugs and warning -- is accomplished anyway with the merging of patch #3. Uh, OK... [PATCH] sc1200:
Re: SATA_SIL
Frans de Boer wrote: Dear Sir, I know, I am not the only one to find out that we can't upgrade to a newer kernel when using SUSE 10.3. It seems that in 2.6.23 the sil modules have been updated (newer versions) and thus render the current system mostly unuseable. I noticed that in the sata_sil24.c source there where a significant number of chances, which are probally not easy to change. Overwriting the newer versions with the versions from 2.6.22.9 might work, but for how long. Those are backported PMP changes and the code base very similar to 2.6.24-rc1. Is this a problem SUSE introduced, you forgot to take legacy into account or is it a feature. Is this problem adjusted in 2.6.24-rc1? Please file a bug report at bugzilla.novell.com, attach /var/log/boot.msg and the result of hwinfo --all and assign it to [EMAIL PROTECTED] Thanks. -- tejun - To unsubscribe from this list: send the line unsubscribe linux-ide in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
RE: ATAPI devices in AHCI mode not working
Yeah, there has been quite some update in libata between SLES10_SP1 and 2.6.24-rc1. The controller being ahci, I wonder whether this is caused by the different in check_atapi_dma(). 1. Does other optical drives have the same problem? If not, please post the result of hdparm -I /dev/sr0 with the problematic one attached. 2. If you apply the attached patch to 2.6.24-rc1, does it behave the same as the SLES10SP1 kernel? -- Tejun All of the ATAPI drives seem to have the issue of taking a while to slow down and start working. I will try the patch and see what happens. I will also get the hdparm info from all of the drives I am using to see if something stands out. Thanks, Jason Tejun, Attached are the hdparm -I /dev/cdrom results for the three other drives I am using. These do not include the original drive that had the major issues on, TSSTcorpCD/DVDW SH-S183L. Applying the patch to the 2.6.24-rc kernel did not cause the same behavior, which I am seeing with older kernels. Instead, everything seemed to be fine until I tried to automount the drive, which said that there was no media. I was however, able to manually mount the drive. Thanks, Jason hdparm_cdrom Description: hdparm_cdrom
Re: ATAPI devices in AHCI mode not working
Hello, Gaston, Jason D wrote: Attached are the hdparm -I /dev/cdrom results for the three other drives I am using. These do not include the original drive that had the major issues on, TSSTcorpCD/DVDW SH-S183L. Applying the patch to the 2.6.24-rc kernel did not cause the same behavior, which I am seeing with older kernels. Instead, everything seemed to be fine until I tried to automount the drive, which said that there was no media. I was however, able to manually mount the drive. Thanks. Yeah, libata in SLE10SP1 can be considered ancient considering the speed libata code has been evolving. Please file a bug report in bugzilla.novell.com and assign it to [EMAIL PROTECTED] Eeeek... /me hates vendor kernels. :-) Thanks. -- tejun - To unsubscribe from this list: send the line unsubscribe linux-ide in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH]libata-acpi: add ACPI _PSx method
On Wed, 2007-10-31 at 14:26 +0100, Rafael J. Wysocki wrote: On Wednesday, 31 October 2007 03:27, Len Brown wrote: It would be interseting if any of the folks having power consumption problems when suspended see an improvement with this patch. Are there plans to refresh this patch and get it upstream? Acked-by: Len Brown [EMAIL PROTECTED] There was a discussion regarding this patch, IIRC, and it was argued that _PSx are only applicable to IDE/PATA devices. I wonder if this has been addressed. Sure, there is a check for PATA. I refreshed the patch to against latest git tree. ACPI spec (ver 3.0a, p289) requires IDE power on/off executes ACPI _PSx methods. As recently most PATA drivers use libata, this patch adds _PSx method support in libata. ACPI spec doesn't mention if SATA requires the same _PSx method. Signed-off-by: Shaohua Li [EMAIL PROTECTED] Acked-by: Len Brown [EMAIL PROTECTED] --- drivers/ata/libata-acpi.c | 33 + drivers/ata/libata-eh.c |3 +++ drivers/ata/libata.h |2 ++ 3 files changed, 38 insertions(+) Index: linux/drivers/ata/libata-acpi.c === --- linux.orig/drivers/ata/libata-acpi.c2007-10-26 08:49:07.0 +0800 +++ linux/drivers/ata/libata-acpi.c 2007-11-01 09:17:12.0 +0800 @@ -652,6 +652,39 @@ void ata_acpi_on_resume(struct ata_port } /** + * ata_acpi_set_state - set the port power state + * @ap: target ATA port + * @state: state, on/off + * + * This function executes the _PS0/_PS3 ACPI method to set the power state. + * ACPI spec requires _PS0 when IDE power on and _PS3 when power off + */ +void ata_acpi_set_state(struct ata_port *ap, pm_message_t state) +{ + int max_devices, i; + + if (!ap-acpi_handle || (ap-flags ATA_FLAG_ACPI_SATA)) + return; + + /* channel first and then drives for power on and verse versa for power off */ + if (state.event == PM_EVENT_ON) + acpi_bus_set_power(ap-acpi_handle, ACPI_STATE_D0); + + max_devices = ata_link_max_devices(ap-link); + + for (i = 0; i max_devices; ++i) { + struct ata_device *dev = ap-link.device[i]; + + if (dev-acpi_handle) + acpi_bus_set_power(dev-acpi_handle, + state.event == PM_EVENT_ON ? + ACPI_STATE_D0: ACPI_STATE_D3); + } + if (state.event != PM_EVENT_ON) + acpi_bus_set_power(ap-acpi_handle, ACPI_STATE_D3); +} + +/** * ata_acpi_on_devcfg - ATA ACPI hook called on device donfiguration * @dev: target ATA device * Index: linux/drivers/ata/libata-eh.c === --- linux.orig/drivers/ata/libata-eh.c 2007-10-31 09:14:06.0 +0800 +++ linux/drivers/ata/libata-eh.c 2007-11-01 08:55:05.0 +0800 @@ -2796,6 +2796,7 @@ static void ata_eh_handle_port_suspend(s if (ap-ops-port_suspend) rc = ap-ops-port_suspend(ap, ap-pm_mesg); + ata_acpi_set_state(ap, PMSG_SUSPEND); out: /* report result */ spin_lock_irqsave(ap-lock, flags); @@ -2841,6 +2842,8 @@ static void ata_eh_handle_port_resume(st WARN_ON(!(ap-pflags ATA_PFLAG_SUSPENDED)); + ata_acpi_set_state(ap, PMSG_ON); + if (ap-ops-port_resume) rc = ap-ops-port_resume(ap); Index: linux/drivers/ata/libata.h === --- linux.orig/drivers/ata/libata.h 2007-10-30 14:17:14.0 +0800 +++ linux/drivers/ata/libata.h 2007-11-01 08:55:05.0 +0800 @@ -111,12 +111,14 @@ extern void ata_acpi_associate(struct at extern int ata_acpi_on_suspend(struct ata_port *ap); extern void ata_acpi_on_resume(struct ata_port *ap); extern int ata_acpi_on_devcfg(struct ata_device *adev); +extern void ata_acpi_set_state(struct ata_port *ap, pm_message_t state); #else static inline void ata_acpi_associate_sata_port(struct ata_port *ap) { } static inline void ata_acpi_associate(struct ata_host *host) { } static inline int ata_acpi_on_suspend(struct ata_port *ap) { return 0; } static inline void ata_acpi_on_resume(struct ata_port *ap) { } static inline int ata_acpi_on_devcfg(struct ata_device *adev) { return 0; } +static inline void ata_acpi_set_state(struct ata_port *ap, pm_message_t state) { } #endif /* libata-scsi.c */ - To unsubscribe from this list: send the line unsubscribe linux-ide in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html