Re: [PATCH] preliminary sata_promise ATAPI support

Previous thread: Re: bluetooth memory corruption (was Re: ext3-related crash in 2.6.20-rc1) by Pavel Machek on Monday, January 1, 2007 - 3:01 pm. (5 messages)

Next thread: Re: [PATCH] Consolidate default sched_clock() by Vincent Legoll on Monday, January 1, 2007 - 3:09 pm. (2 messages)
To: Ingo Molnar <mingo@...>, Maciej W. Rozycki <macro@...>
Cc: H. Peter Anvin <hpa@...>, Thomas Gleixner <tglx@...>, Yinghai Lu <yhlu.kernel@...>, <linux-kernel@...>, Cyrill Gorcunov <gorcunov@...>
Date: Wednesday, December 31, 1969 - 8:00 pm

Impact: cleanup

It saves us some sourcse lines and shift
the code a bit righter.

And a multiline comment style is fixed too :-)

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
---
arch/x86/kernel/apic.c | 116 ++++++++++++++++++++++---------------------------
1 file changed, 53 insertions(+), 63 deletions(-)

Index: linux-2.6.git/arch/x86/kernel/apic.c
===================================================================
--- linux-2.6.git.orig/arch/x86/kernel/apic.c
+++ linux-2.6.git/arch/x86/kernel/apic.c
@@ -559,13 +559,13 @@ static int __init calibrate_by_pmtimer(l
} else {
res = (((u64)deltapm) * mult) >> 22;
do_div(res, 1000000);
- printk(KERN_WARNING "APIC calibration not consistent "
+ pr_warning("APIC calibration not consistent "
"with PM Timer: %ldms instead of 100ms\n",
(long)res);
/* Correct the lapic counter value */
res = (((u64)(*delta)) * pm_100ms);
do_div(res, deltapm);
- printk(KERN_INFO "APIC delta adjusted to PM-Timer: "
+ pr_info("APIC delta adjusted to PM-Timer: "
"%lu (%ld)\n", (unsigned long)res, *delta);
*delta = (long)res;
}
@@ -645,8 +645,7 @@ static int __init calibrate_APIC_clock(v
*/
if (calibration_result < (1000000 / HZ)) {
local_irq_enable();
- printk(KERN_WARNING
- "APIC frequency too slow, disabling apic timer\n");
+ pr_warning("APIC frequency too slow, disabling apic timer\n");
return -1;
}

@@ -688,8 +687,7 @@ static int __init calibrate_APIC_clock(v
local_irq_enable();

if (levt->features & CLOCK_EVT_FEAT_DUMMY) {
- printk(KERN_WARNING
- "APIC timer disabled due to verification failure.\n");
+ pr_warning("APIC timer disabled due to verification failure.\n");
return -1;
}

@@ -710,7 +708,7 @@ void __init setup_boot_APIC_clock(void)
* broadcast mechanism is used. On UP systems simply ignore it.
*/
if (disable_apic_timer) {
- printk(KERN_INFO "Disabling APIC timer\n");
+ pr_info("Disabling APIC timer\...

To: <jgarzik@...>
Cc: <linux-ide@...>, <linux-kernel@...>
Date: Monday, January 1, 2007 - 3:00 pm

That was it: ->check_atapi_dma() needs to inspect the packet
command and only enable DMA for bulk data transfers. With this
change sata_promise successfully both reads and writes CDs.

The rules for which commands should use DMA are taken from
Promise's drivers. I missed this filter originally because it
is located in their high-level Linux glue driver while I was
mostly studying their low-level hardware driver. The filter matches
the corresponding code in pata_pdc2027x.c, with the exception
of an additional no-DMA restriction for WRITE_10 with large LBA.

The patch below goes on top of the first preliminary patch.

/Mikael

--- linux-2.6.20-rc3/drivers/ata/sata_promise.c.~1~ 2007-01-01 17:13:05.000000000 +0100
+++ linux-2.6.20-rc3/drivers/ata/sata_promise.c 2007-01-01 19:14:00.000000000 +0100
@@ -39,6 +39,7 @@
#include <linux/interrupt.h>
#include <linux/sched.h>
#include <linux/device.h>
+#include <scsi/scsi.h>
#include <scsi/scsi_host.h>
#include <scsi/scsi_cmnd.h>
#include <linux/libata.h>
@@ -430,16 +431,10 @@ static void pdc_qc_prep(struct ata_queue
qc->tf.protocol = ATA_PROT_DMA;
pdc_pkt_header(&qc->tf, qc->ap->prd_dma, qc->dev->devno, pp->pkt);
qc->tf.protocol = ATA_PROT_ATAPI_DMA;
- if (qc->dev->cdb_len & ~0x1E) { /* 2/4/6/8/10/12/14/16 are Ok */
- printk(KERN_ERR "%s: bad cdb_len %u\n", __FUNCTION__, qc->dev->cdb_len);
- BUG();
- }
+ /* we can represent cdb lengths 2/4/6/8/10/12/14/16 */
+ BUG_ON(qc->dev->cdb_len & ~0x1E);
pp->pkt[12] = (((qc->dev->cdb_len >> 1) & 7) << 5) | 0x00 | 0x08;
memcpy(pp->pkt+13, qc->cdb, qc->dev->cdb_len);
-#if 0
- /* pdc-ultra/cam/cam_ata.c will pad SG length to a multiple
- of 4 here, but libata has already done that for us */
-#endif
break;

default:
@@ -788,7 +783,29 @@ static void pdc_exec_command_mmio(struct

static int pdc_check_atapi_dma(struct a...

To: Cyrill Gorcunov <gorcunov@...>
Cc: Ingo Molnar <mingo@...>, H. Peter Anvin <hpa@...>, Thomas Gleixner <tglx@...>, Yinghai Lu <yhlu.kernel@...>, <linux-kernel@...>
Date: Sunday, November 9, 2008 - 8:44 am

Acked-by: Maciej W. Rozycki <macro@linux-mips.org>

Thanks, Cyrill -- it was high time to get this done. And, BTW, at the
next opportunity please fix up your date -- I think it may confuse some
people and/or scripts. Good to know it was a Thursday though. ;)

Maciej
--

To: Maciej W. Rozycki <macro@...>
Cc: Cyrill Gorcunov <gorcunov@...>, H. Peter Anvin <hpa@...>, Thomas Gleixner <tglx@...>, Yinghai Lu <yhlu.kernel@...>, <linux-kernel@...>
Date: Monday, November 10, 2008 - 4:17 am

applied to tip/x86/apic, thanks guys!

Ingo
--

To: Maciej W. Rozycki <macro@...>
Cc: Ingo Molnar <mingo@...>, H. Peter Anvin <hpa@...>, Thomas Gleixner <tglx@...>, Yinghai Lu <yhlu.kernel@...>, <linux-kernel@...>
Date: Sunday, November 9, 2008 - 8:59 am

[Maciej W. Rozycki - Sun, Nov 09, 2008 at 12:44:54PM +0000]
| On Thu, 1 Jan 1970, Cyrill Gorcunov wrote:
|
| > Impact: cleanup
| >
| > It saves us some sourcse lines and shift
| > the code a bit righter.
| >
| > And a multiline comment style is fixed too :-)
| >
| > Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
| > ---
| > arch/x86/kernel/apic.c | 116 ++++++++++++++++++++++---------------------------
| > 1 file changed, 53 insertions(+), 63 deletions(-)
|
| Acked-by: Maciej W. Rozycki <macro@linux-mips.org>
|
| Thanks, Cyrill -- it was high time to get this done. And, BTW, at the
| next opportunity please fix up your date -- I think it may confuse some
| people and/or scripts. Good to know it was a Thursday though. ;)
|
| Maciej
|

Thanks for review, Maciej! I really sorry for that "date" related
issue -- will debug it and try to eliminate in future.

- Cyrill -
--

Previous thread: Re: bluetooth memory corruption (was Re: ext3-related crash in 2.6.20-rc1) by Pavel Machek on Monday, January 1, 2007 - 3:01 pm. (5 messages)

Next thread: Re: [PATCH] Consolidate default sched_clock() by Vincent Legoll on Monday, January 1, 2007 - 3:09 pm. (2 messages)