linux-ide.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH ht6560b] Force prefetch for some devices
@ 2008-02-18 12:50 Jan Evert van Grootheest
  2008-02-18 13:58 ` Sergei Shtylyov
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Jan Evert van Grootheest @ 2008-02-18 12:50 UTC (permalink / raw)
  To: linux-ide, bzolnier

[-- Attachment #1: Type: text/plain, Size: 535 bytes --]

Prefetch needs to be set for some ide devices to work when connected to
a ht6560b interface. This was not always done properly, causing a system
with a HD and CD on the primary interface to not work properly. Or, in
effect, hang hard.

This patch forces prefetch on devices before checking whether it
is necessary to change the settings in the interface

This patch should also be applied to 2.4. I don't currently have a
2.4 tree around.

(also change my email address)

Signed-off-by: Jan Evert van Grootheest <janevert@caiway.nl>



[-- Attachment #2: ht65.oldide.patch --]
[-- Type: text/x-patch, Size: 1968 bytes --]

--- linux-2.6.git/drivers/ide/legacy/ht6560b.c	2008-02-01 18:50:31.000000000 +0100
+++ linux-2.6.24/drivers/ide/legacy/ht6560b.c	2008-02-18 13:48:59.000000000 +0100
@@ -23,18 +23,21 @@
  *                      "Prefetch" mode bit OFF for ide disks and
  *                      ON for anything else.
  *
+ *  Version 0.08        Need to force prefetch for CDs and other non-disk
+ *                      devices. (not sure which devices exactly need
+ *                      prefetch)
  *
  *  HT-6560B EIDE-controller support
  *  To activate controller support use kernel parameter "ide0=ht6560b".
  *  Use hdparm utility to enable PIO mode support.
  *
  *  Author:    Mikko Ala-Fossi            <maf@iki.fi>
- *             Jan Evert van Grootheest   <janevert@iae.nl>
+ *             Jan Evert van Grootheest   <janevert@caiway.nl>
  *
  *  Try:  http://www.maf.iki.fi/~maf/ht6560b/
  */
 
-#define HT6560B_VERSION "v0.07"
+#define HT6560B_VERSION "v0.08"
 
 #include <linux/module.h>
 #include <linux/types.h>
@@ -132,15 +135,20 @@
 	u8 select, timing;
 	
 	local_irq_save(flags);
-	
+
 	select = HT_CONFIG(drive);
 	timing = HT_TIMING(drive);
-	
+
+	/*
+	 * Need to enforce prefetch sometimes because otherwise
+	 * it'll hang (hard).
+	 */
+	if (drive->media != ide_disk || !drive->present)
+		select |= HT_PREFETCH_MODE;
+
 	if (select != current_select || timing != current_timing) {
 		current_select = select;
 		current_timing = timing;
-		if (drive->media != ide_disk || !drive->present)
-			select |= HT_PREFETCH_MODE;
 		(void)inb(HT_CONFIG_PORT);
 		(void)inb(HT_CONFIG_PORT);
 		(void)inb(HT_CONFIG_PORT);
@@ -190,11 +198,12 @@
 	outb(HT_TIMING_DEFAULT, 0x1f6);  /* IDE_SELECT_REG */
 	(void) inb(0x1f7);               /* IDE_STATUS_REG */
 	
-	printk("\nht6560b " HT6560B_VERSION
+	printk("ht6560b " HT6560B_VERSION
 	       ": chipset detected and initialized"
 #ifdef DEBUG
 	       " with debug enabled"
 #endif
+	       "\n"
 		);
 	return 1;
 }

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH ht6560b] Force prefetch for some devices
  2008-02-18 12:50 [PATCH ht6560b] Force prefetch for some devices Jan Evert van Grootheest
@ 2008-02-18 13:58 ` Sergei Shtylyov
  2008-02-18 14:36 ` Alan Cox
  2008-02-18 23:14 ` Bartlomiej Zolnierkiewicz
  2 siblings, 0 replies; 8+ messages in thread
From: Sergei Shtylyov @ 2008-02-18 13:58 UTC (permalink / raw)
  To: Jan Evert van Grootheest; +Cc: linux-ide, bzolnier

Hello.

Jan Evert van Grootheest wrote:

> Prefetch needs to be set for some ide devices to work when connected to

    Prefetch bit seems to mean 1=disable, 0=enable despite what the datasheet 
says...

> a ht6560b interface. This was not always done properly, causing a system
> with a HD and CD on the primary interface to not work properly. Or, in
> effect, hang hard.

> This patch forces prefetch on devices before checking whether it
> is necessary to change the settings in the interface

> This patch should also be applied to 2.4. I don't currently have a
> 2.4 tree around.

> (also change my email address)

> Signed-off-by: Jan Evert van Grootheest <janevert@caiway.nl>

    Please send the patch to the current 2.4 maintainer, after applying it to 
the 2.4 tree which you can download on kernel.org.

> ------------------------------------------------------------------------
> 
> --- linux-2.6.git/drivers/ide/legacy/ht6560b.c	2008-02-01 18:50:31.000000000 +0100
> +++ linux-2.6.24/drivers/ide/legacy/ht6560b.c	2008-02-18 13:48:59.000000000 +0100
> @@ -23,18 +23,21 @@
>   *                      "Prefetch" mode bit OFF for ide disks and
>   *                      ON for anything else.
>   *
> + *  Version 0.08        Need to force prefetch for CDs and other non-disk
> + *                      devices. (not sure which devices exactly need
> + *                      prefetch)
>   *

    Hard disks only ai guess, i.e. non-ATAPI device.

MBR, Sergei

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH ht6560b] Force prefetch for some devices
  2008-02-18 12:50 [PATCH ht6560b] Force prefetch for some devices Jan Evert van Grootheest
  2008-02-18 13:58 ` Sergei Shtylyov
@ 2008-02-18 14:36 ` Alan Cox
  2008-02-18 15:21   ` Jan Evert van Grootheest
  2008-06-27 19:51   ` Jan Evert van Grootheest
  2008-02-18 23:14 ` Bartlomiej Zolnierkiewicz
  2 siblings, 2 replies; 8+ messages in thread
From: Alan Cox @ 2008-02-18 14:36 UTC (permalink / raw)
  To: Jan Evert van Grootheest; +Cc: linux-ide, bzolnier

On Mon, 18 Feb 2008 13:50:02 +0100
Jan Evert van Grootheest <j.e.van.grootheest@caiway.nl> wrote:

> Prefetch needs to be set for some ide devices to work when connected to
> a ht6560b interface. This was not always done properly, causing a system
> with a HD and CD on the primary interface to not work properly. Or, in
> effect, hang hard.
> 
> This patch forces prefetch on devices before checking whether it
> is necessary to change the settings in the interface

Interesting, that is backwards to the docs and not something I've seen.
If you are correct then pata_legacy also wants tweaking .

Alan

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH ht6560b] Force prefetch for some devices
  2008-02-18 14:36 ` Alan Cox
@ 2008-02-18 15:21   ` Jan Evert van Grootheest
  2008-02-18 15:47     ` Alan Cox
  2008-06-27 19:51   ` Jan Evert van Grootheest
  1 sibling, 1 reply; 8+ messages in thread
From: Jan Evert van Grootheest @ 2008-02-18 15:21 UTC (permalink / raw)
  To: Alan Cox; +Cc: linux-ide, bzolnier

Alan,

Alan Cox wrote:
> On Mon, 18 Feb 2008 13:50:02 +0100
> Jan Evert van Grootheest <j.e.van.grootheest@caiway.nl> wrote:
>
>   
>> Prefetch needs to be set for some ide devices to work when connected to
>> a ht6560b interface. This was not always done properly, causing a system
>> with a HD and CD on the primary interface to not work properly. Or, in
>> effect, hang hard.
>>
>> This patch forces prefetch on devices before checking whether it
>> is necessary to change the settings in the interface
>>     
>
> Interesting, that is backwards to the docs and not something I've seen.
>   
Hum, I may have an incorrect understanding of the prefetch bit or 
misread the code.
But for sure that patch makes my 486 boot (HD as primary master and CD 
as primary slave).

 From testing I know that the HD works with and without prefetch (it's 
1.15M/s without prefetch, ~950k/s with). And the boot hangs (as in 
powerbutton required) if prefetch is not set for the CD.
For reference, the generic IDE driver is ~850k/s.
> If you are correct then pata_legacy also wants tweaking .
>
> Alan
>   
I think, but didn't look real good nor test yet, that pata_legacy also 
needs something comparable to select_proc? Or is that implemented in 
some generic manner?
Depending on the day job, I could get to testing that somewhere this week.

-- Jan Evert


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH ht6560b] Force prefetch for some devices
  2008-02-18 15:21   ` Jan Evert van Grootheest
@ 2008-02-18 15:47     ` Alan Cox
  0 siblings, 0 replies; 8+ messages in thread
From: Alan Cox @ 2008-02-18 15:47 UTC (permalink / raw)
  To: Jan Evert van Grootheest; +Cc: linux-ide, bzolnier

> I think, but didn't look real good nor test yet, that pata_legacy also 
> needs something comparable to select_proc? Or is that implemented in 
> some generic manner?

It sets it in the timing routine:
	pata_legacy:ht6560b_set_piomode


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH ht6560b] Force prefetch for some devices
  2008-02-18 12:50 [PATCH ht6560b] Force prefetch for some devices Jan Evert van Grootheest
  2008-02-18 13:58 ` Sergei Shtylyov
  2008-02-18 14:36 ` Alan Cox
@ 2008-02-18 23:14 ` Bartlomiej Zolnierkiewicz
  2 siblings, 0 replies; 8+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2008-02-18 23:14 UTC (permalink / raw)
  To: Jan Evert van Grootheest; +Cc: linux-ide

On Monday 18 February 2008, Jan Evert van Grootheest wrote:
> Prefetch needs to be set for some ide devices to work when connected to
> a ht6560b interface. This was not always done properly, causing a system
> with a HD and CD on the primary interface to not work properly. Or, in
> effect, hang hard.
> 
> This patch forces prefetch on devices before checking whether it
> is necessary to change the settings in the interface
> 
> This patch should also be applied to 2.4. I don't currently have a
> 2.4 tree around.
> 
> (also change my email address)
> 
> Signed-off-by: Jan Evert van Grootheest <janevert@caiway.nl>

I applied it as it is but could I ask you to follow up on the following
(rather minor) issues:

- According to observations from your testing and comments from Sergei/Alan
  it really seems that prefetch bit has reversed meaning so the driver should
  be updated to reflect it.

- Could the old changelog be removed while we are at it?  The detailed
  changelog is kept in the kernel git tree nowadays.

Thanks,
Bart

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH ht6560b] Force prefetch for some devices
  2008-02-18 14:36 ` Alan Cox
  2008-02-18 15:21   ` Jan Evert van Grootheest
@ 2008-06-27 19:51   ` Jan Evert van Grootheest
  2008-06-27 20:04     ` Alan Cox
  1 sibling, 1 reply; 8+ messages in thread
From: Jan Evert van Grootheest @ 2008-06-27 19:51 UTC (permalink / raw)
  To: Alan Cox; +Cc: linux-ide, bzolnier

[-- Attachment #1: Type: text/plain, Size: 986 bytes --]

Alan, Bart,

It's been a while...

Alan Cox wrote:
> On Mon, 18 Feb 2008 13:50:02 +0100
> Jan Evert van Grootheest <j.e.van.grootheest@caiway.nl> wrote:
>
>   
>> Prefetch needs to be set for some ide devices to work when connected to
>> a ht6560b interface. This was not always done properly, causing a system
>> with a HD and CD on the primary interface to not work properly. Or, in
>> effect, hang hard.
>>
>> This patch forces prefetch on devices before checking whether it
>> is necessary to change the settings in the interface
>>     
>
> Interesting, that is backwards to the docs and not something I've seen.
> If you are correct then pata_legacy also wants tweaking .
>   
I'm testing this... but lack some knowledge.
Is there some generic way to figure out wheter a device supports it?
What devices normally support prefetching? Disks only?
I already found out that CDs do not. But tapes? Floppies? What else can 
be there that might support prefetching?

Thanks,
Jan Evert


[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/x-pkcs7-signature, Size: 5185 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH ht6560b] Force prefetch for some devices
  2008-06-27 19:51   ` Jan Evert van Grootheest
@ 2008-06-27 20:04     ` Alan Cox
  0 siblings, 0 replies; 8+ messages in thread
From: Alan Cox @ 2008-06-27 20:04 UTC (permalink / raw)
  To: Jan Evert van Grootheest; +Cc: linux-ide, bzolnier

> Is there some generic way to figure out wheter a device supports it?
> What devices normally support prefetching? Disks only?

It depends on the controller not the device - generally older controller
support it only for disk devices.

Alan

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2008-06-27 20:21 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-02-18 12:50 [PATCH ht6560b] Force prefetch for some devices Jan Evert van Grootheest
2008-02-18 13:58 ` Sergei Shtylyov
2008-02-18 14:36 ` Alan Cox
2008-02-18 15:21   ` Jan Evert van Grootheest
2008-02-18 15:47     ` Alan Cox
2008-06-27 19:51   ` Jan Evert van Grootheest
2008-06-27 20:04     ` Alan Cox
2008-02-18 23:14 ` Bartlomiej Zolnierkiewicz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).