* Re: Linux 2.5.19
2002-05-29 18:50 Linux 2.5.19 Linus Torvalds
@ 2002-05-29 19:42 ` Jason Lunz
2002-05-29 20:17 ` Russell King
` (12 subsequent siblings)
13 siblings, 0 replies; 35+ messages in thread
From: Jason Lunz @ 2002-05-29 19:42 UTC (permalink / raw)
To: linux-kernel
In mlist.linux-kernel, you wrote:
> <kai@tp1.ruhr-uni-bochum.de>
> o kbuild: Figure out flags independently from pass
> o ISDN/CAPI: Move methods from capi_driver to capi_ctr
> o kbuild: Simplify rule for just building one subdir
> o kbuild: Use consistently FORCE instead of dummy
> o drivers/video/matrox/matroxfb_accel.c: Explicitly export symbols.
> o ISDN/CAPI: Cleanup /proc/capi
> o ISDN: CAPI: Remove unused capi_driver::driver_read_proc
> o ISDN/CAPI: Have hardware driver alloc struct capi_drv
> o ISDN/CAPI: Export callbacks for CAPI drivers directly
> o ISDN/CAPI: Remove struct capi_driver
> o kbuild: built-in and modules in one pass
> o kbuild: Normal sources should not include <linux/compile.h>
> o kbuild: Add EXTRA_TARGETS variable
> o kbuild: Remove remaining O_TARGET in drivers/*/Makefile
> o kbuild: Don't overwrite Rules.make's first_rule
> o kbuild: beautify Makefile / Rules.make...
> o kbuild: Group together descending/linking in drivers/*
> o kbuild: Build targets locally
> o kbuild: Provide correct 'make some/dir/file.[iso]'
> o kbuild: Hand merge link order change form driverfs update.
Are these purely patches to kbuild 1 or are they the beginning of a
gradual migration to kbuild 2?
--
Jason Lunz Reflex Security
lunz@reflexsecurity.com http://www.reflexsecurity.com/
^ permalink raw reply [flat|nested] 35+ messages in thread* Re: Linux 2.5.19
2002-05-29 18:50 Linux 2.5.19 Linus Torvalds
2002-05-29 19:42 ` Jason Lunz
@ 2002-05-29 20:17 ` Russell King
2002-05-29 20:38 ` Eli Carter
2002-05-29 20:44 ` James Simmons
2002-05-29 20:37 ` [PATCH] Missing include in drivers/base/bus.c and drivers/pci/pci-driver.c Tom Rini
` (11 subsequent siblings)
13 siblings, 2 replies; 35+ messages in thread
From: Russell King @ 2002-05-29 20:17 UTC (permalink / raw)
To: Linus Torvalds; +Cc: Kernel Mailing List
The following change appeared in 2.5.19:
xx- a/drivers/video/cyber2000fb.c Wed May 29 11:43:02 2002
xx+ b/drivers/video/cyber2000fb.c Wed May 29 11:43:02 2002
@@ -1729,9 +1729,8 @@
}
static struct pci_device_id cyberpro_pci_table[] __devinitdata = {
-// Not yet
-// { PCI_VENDOR_ID_INTERG, PCI_DEVICE_ID_INTERG_1682,
-// PCI_ANY_ID, PCI_ANY_ID, 0, 0, ID_IGA_1682 },
+ { PCI_VENDOR_ID_INTERG, PCI_DEVICE_ID_INTERG_1682,
+ PCI_ANY_ID, PCI_ANY_ID, 0, 0, ID_IGA_1682 },
{ PCI_VENDOR_ID_INTERG, PCI_DEVICE_ID_INTERG_2000,
PCI_ANY_ID, PCI_ANY_ID, 0, 0, ID_CYBERPRO_2000 },
{ PCI_VENDOR_ID_INTERG, PCI_DEVICE_ID_INTERG_2010,
This is completely wrong - the driver has been tested NOT to work on
the Integraphics 1682. As such, please do uncomment these lines.
In addition, I'm disappointed that no one forwarded the patch for
maintainer approval PRIOR to submitting it to Linus.
Linus, I request that you apply the following patch. Thanks.
--- orig/drivers/video/cyber2000fb.c Mon May 6 16:54:10 2002
+++ linux/drivers/video/cyber2000fb.c Mon May 13 10:48:13 2002
@@ -1729,8 +1729,9 @@
}
static struct pci_device_id cyberpro_pci_table[] __devinitdata = {
- { PCI_VENDOR_ID_INTERG, PCI_DEVICE_ID_INTERG_1682,
- PCI_ANY_ID, PCI_ANY_ID, 0, 0, ID_IGA_1682 },
+// Not yet
+// { PCI_VENDOR_ID_INTERG, PCI_DEVICE_ID_INTERG_1682,
+// PCI_ANY_ID, PCI_ANY_ID, 0, 0, ID_IGA_1682 },
{ PCI_VENDOR_ID_INTERG, PCI_DEVICE_ID_INTERG_2000,
PCI_ANY_ID, PCI_ANY_ID, 0, 0, ID_CYBERPRO_2000 },
{ PCI_VENDOR_ID_INTERG, PCI_DEVICE_ID_INTERG_2010,
--
Russell King (rmk@arm.linux.org.uk) The developer of ARM Linux
http://www.arm.linux.org.uk/personal/aboutme.html
^ permalink raw reply [flat|nested] 35+ messages in thread* Re: Linux 2.5.19
2002-05-29 20:17 ` Russell King
@ 2002-05-29 20:38 ` Eli Carter
2002-05-29 20:44 ` James Simmons
1 sibling, 0 replies; 35+ messages in thread
From: Eli Carter @ 2002-05-29 20:38 UTC (permalink / raw)
To: Russell King; +Cc: Linus Torvalds, Kernel Mailing List
Russell King wrote:
> The following change appeared in 2.5.19:
>
> xx- a/drivers/video/cyber2000fb.c Wed May 29 11:43:02 2002
> xx+ b/drivers/video/cyber2000fb.c Wed May 29 11:43:02 2002
> @@ -1729,9 +1729,8 @@
> }
>
> static struct pci_device_id cyberpro_pci_table[] __devinitdata = {
> -// Not yet
> -// { PCI_VENDOR_ID_INTERG, PCI_DEVICE_ID_INTERG_1682,
> -// PCI_ANY_ID, PCI_ANY_ID, 0, 0, ID_IGA_1682 },
> + { PCI_VENDOR_ID_INTERG, PCI_DEVICE_ID_INTERG_1682,
> + PCI_ANY_ID, PCI_ANY_ID, 0, 0, ID_IGA_1682 },
> { PCI_VENDOR_ID_INTERG, PCI_DEVICE_ID_INTERG_2000,
> PCI_ANY_ID, PCI_ANY_ID, 0, 0, ID_CYBERPRO_2000 },
> { PCI_VENDOR_ID_INTERG, PCI_DEVICE_ID_INTERG_2010,
>
> This is completely wrong - the driver has been tested NOT to work on
> the Integraphics 1682. As such, please do uncomment these lines.
>
> In addition, I'm disappointed that no one forwarded the patch for
> maintainer approval PRIOR to submitting it to Linus.
>
> Linus, I request that you apply the following patch. Thanks.
>
> --- orig/drivers/video/cyber2000fb.c Mon May 6 16:54:10 2002
> +++ linux/drivers/video/cyber2000fb.c Mon May 13 10:48:13 2002
> @@ -1729,8 +1729,9 @@
> }
>
> static struct pci_device_id cyberpro_pci_table[] __devinitdata = {
> - { PCI_VENDOR_ID_INTERG, PCI_DEVICE_ID_INTERG_1682,
> - PCI_ANY_ID, PCI_ANY_ID, 0, 0, ID_IGA_1682 },
> +// Not yet
> +// { PCI_VENDOR_ID_INTERG, PCI_DEVICE_ID_INTERG_1682,
> +// PCI_ANY_ID, PCI_ANY_ID, 0, 0, ID_IGA_1682 },
> { PCI_VENDOR_ID_INTERG, PCI_DEVICE_ID_INTERG_2000,
> PCI_ANY_ID, PCI_ANY_ID, 0, 0, ID_CYBERPRO_2000 },
> { PCI_VENDOR_ID_INTERG, PCI_DEVICE_ID_INTERG_2010,
>
>
How about s/Not yet/This driver has been tested NOT to work on the
Integraphics 1682. Do not enable with out contacting the maintainer./
instead? That might avoid the problem recurring...
Just a thought, ignore if you wish.
Eli
--------------------. "If it ain't broke now,
Eli Carter \ it will be soon." -- crypto-gram
eli.carter(a)inet.com `-------------------------------------------------
^ permalink raw reply [flat|nested] 35+ messages in thread* Re: Linux 2.5.19
2002-05-29 20:17 ` Russell King
2002-05-29 20:38 ` Eli Carter
@ 2002-05-29 20:44 ` James Simmons
2002-05-29 20:47 ` Russell King
1 sibling, 1 reply; 35+ messages in thread
From: James Simmons @ 2002-05-29 20:44 UTC (permalink / raw)
To: Russell King; +Cc: Kernel Mailing List, Linux Fbdev development list
> This is completely wrong - the driver has been tested NOT to work on
> the Integraphics 1682. As such, please do uncomment these lines.
Due to a error with merging some stuff from a older DJ tree. I fixed it
in the fbdev BK repository.
> In addition, I'm disappointed that no one forwarded the patch for
> maintainer approval PRIOR to submitting it to Linus.
I'm even more disappointed that some people DONT test my patches especially
when I announce them and usually wait about 5 days before pushing them to
Linus. Some of the changes I have done have been sitting around for months
in the DJ tree. The good news is that people can now look at skeletonfb.c
to see how to port the fbdev drivers to the new api. Of course I have a
feeling most will not bother so I will have to do it for them.
^ permalink raw reply [flat|nested] 35+ messages in thread
* Re: Linux 2.5.19
2002-05-29 20:44 ` James Simmons
@ 2002-05-29 20:47 ` Russell King
2002-05-29 22:22 ` Martin Dalecki
2002-05-29 22:43 ` James Simmons
0 siblings, 2 replies; 35+ messages in thread
From: Russell King @ 2002-05-29 20:47 UTC (permalink / raw)
To: James Simmons; +Cc: Kernel Mailing List, Linux Fbdev development list
On Wed, May 29, 2002 at 01:44:12PM -0700, James Simmons wrote:
> > This is completely wrong - the driver has been tested NOT to work on
> > the Integraphics 1682. As such, please do uncomment these lines.
>
> Due to a error with merging some stuff from a older DJ tree. I fixed it
> in the fbdev BK repository.
They haven't *been* in any DJ tree.
> > In addition, I'm disappointed that no one forwarded the patch for
> > maintainer approval PRIOR to submitting it to Linus.
>
> I'm even more disappointed that some people DONT test my patches especially
> when I announce them and usually wait about 5 days before pushing them to
> Linus. Some of the changes I have done have been sitting around for months
> in the DJ tree. The good news is that people can now look at skeletonfb.c
> to see how to port the fbdev drivers to the new api. Of course I have a
> feeling most will not bother so I will have to do it for them.
Why the fuck should I go around finding and testing peoples trees when I
haven't submitted the stuff to them? *YOU* shouldn't go around randomly
pulling stuff from maintainers trees without first asking them why the
change hasn't been submitted.
I'm not talking about general maintainence of the cyber2000fb driver here,
or general "keep it working" type changes. I'm talking about a blatent
"take the version from the rmk patch and submit it to Linus without telling
the maintainer of the code you're buggering with" attitude here.
--
Russell King (rmk@arm.linux.org.uk) The developer of ARM Linux
http://www.arm.linux.org.uk/personal/aboutme.html
^ permalink raw reply [flat|nested] 35+ messages in thread* Re: Linux 2.5.19
2002-05-29 20:47 ` Russell King
@ 2002-05-29 22:22 ` Martin Dalecki
2002-05-29 23:25 ` Russell King
2002-05-29 22:43 ` James Simmons
1 sibling, 1 reply; 35+ messages in thread
From: Martin Dalecki @ 2002-05-29 22:22 UTC (permalink / raw)
To: Russell King
Cc: James Simmons, Kernel Mailing List, Linux Fbdev development list
Russell King wrote:
> I'm not talking about general maintainence of the cyber2000fb driver here,
> or general "keep it working" type changes. I'm talking about a blatent
> "take the version from the rmk patch and submit it to Linus without telling
> the maintainer of the code you're buggering with" attitude here.
Dear Russell why don't you just abuse Linus as a spinlock for this kind
of synchronization its his job. No need to get angry at this.
Hey it's developement series time...
^ permalink raw reply [flat|nested] 35+ messages in thread
* Re: Linux 2.5.19
2002-05-29 22:22 ` Martin Dalecki
@ 2002-05-29 23:25 ` Russell King
2002-05-29 22:42 ` Martin Dalecki
0 siblings, 1 reply; 35+ messages in thread
From: Russell King @ 2002-05-29 23:25 UTC (permalink / raw)
To: Martin Dalecki
Cc: James Simmons, Kernel Mailing List, Linux Fbdev development list
On Thu, May 30, 2002 at 12:22:25AM +0200, Martin Dalecki wrote:
> Dear Russell why don't you just abuse Linus as a spinlock for this kind
> of synchronization its his job. No need to get angry at this.
> Hey it's developement series time...
The fundamental point I'm making is people shouldn't go around taking
changes randomly from maintainers trees, and believing that they know
far better than the maintainer what they're doing, especially when they
don't have the hardware to even try it out, and go submitting these
changes to Linus without even asking about it first... after the
maintainer has been very careful and explicitly not submitted
the change because they have very good reasons not to.
What if I were to take, say, Mochel's experimental tree and send some
random alpha code to Linus? Let anarchy rule!
--
Russell King (rmk@arm.linux.org.uk) The developer of ARM Linux
http://www.arm.linux.org.uk/personal/aboutme.html
^ permalink raw reply [flat|nested] 35+ messages in thread* Re: Linux 2.5.19
2002-05-29 23:25 ` Russell King
@ 2002-05-29 22:42 ` Martin Dalecki
2002-05-29 23:52 ` Russell King
0 siblings, 1 reply; 35+ messages in thread
From: Martin Dalecki @ 2002-05-29 22:42 UTC (permalink / raw)
To: Russell King
Cc: James Simmons, Kernel Mailing List, Linux Fbdev development list
Russell King wrote:
> What if I were to take, say, Mochel's experimental tree and send some
> random alpha code to Linus? Let anarchy rule!
Well ... they have once excuse... if the maintainer is
himself a bit slow on submitting to Linus. Yes I know that's
a matter primary of personal style so there is no need
to discuss about it until down...
About the anarchy - are you sure a Kozaks blood like me
couldn't life up with it ruling? :-).
^ permalink raw reply [flat|nested] 35+ messages in thread
* Re: Linux 2.5.19
2002-05-29 22:42 ` Martin Dalecki
@ 2002-05-29 23:52 ` Russell King
2002-05-29 23:00 ` Martin Dalecki
0 siblings, 1 reply; 35+ messages in thread
From: Russell King @ 2002-05-29 23:52 UTC (permalink / raw)
To: Martin Dalecki
Cc: James Simmons, Kernel Mailing List, Linux Fbdev development list
On Thu, May 30, 2002 at 12:42:09AM +0200, Martin Dalecki wrote:
> Well ... they have once excuse... if the maintainer is
> himself a bit slow on submitting to Linus. Yes I know that's
> a matter primary of personal style so there is no need
> to discuss about it until down...
You still don't get the point.
1. Patches from cyber2000fb.c have been submitted and the driver in Linus'
tree up to 2.5.18 is completely up to date and functional, with zero
known problems.
2. Someone comes along, scans my patch and finds a change.
3. This person takes it upon themselves to solely take that change,
and, without querying the person who put out the patch set, or
the maintainer of the driver, decides to send it to Linus without
testing it in any way since they don't have the hardware to test it.
4. Maintainer, naturally, gets really pissed off.
If you think this is acceptable, why the hell did I bother sending those
IDE DMA changes through you? After all, you don't need to know about
them because I know better than you, don't I? *That's* what you're
advocating here, and I'm sure you're going to object to that.
--
Russell King (rmk@arm.linux.org.uk) The developer of ARM Linux
http://www.arm.linux.org.uk/personal/aboutme.html
^ permalink raw reply [flat|nested] 35+ messages in thread* Re: Linux 2.5.19
2002-05-29 23:52 ` Russell King
@ 2002-05-29 23:00 ` Martin Dalecki
0 siblings, 0 replies; 35+ messages in thread
From: Martin Dalecki @ 2002-05-29 23:00 UTC (permalink / raw)
To: Russell King
Cc: James Simmons, Kernel Mailing List, Linux Fbdev development list
Russell King wrote:
> If you think this is acceptable, why the hell did I bother sending those
> IDE DMA changes through you? After all, you don't need to know about
> them because I know better than you, don't I? *That's* what you're
> advocating here, and I'm sure you're going to object to that.
Well just to make my point clear. I trust you and I thing that you indeed
know better then me on ARM stuff. (At least you can run it on
more then my tinny PSION 5mx... where I still didn't revert to
the original OS, quite cute this little thing under linux :-).
But I wouldn't have minded it at all if you had just sendid
the ARM adjustments directly to Linus!
In the particular case we had it was however good to
have some direct communication in front
just to resolve the API issues. OK?
^ permalink raw reply [flat|nested] 35+ messages in thread
* Re: Linux 2.5.19
2002-05-29 20:47 ` Russell King
2002-05-29 22:22 ` Martin Dalecki
@ 2002-05-29 22:43 ` James Simmons
2002-05-29 22:29 ` Martin Dalecki
1 sibling, 1 reply; 35+ messages in thread
From: James Simmons @ 2002-05-29 22:43 UTC (permalink / raw)
To: Russell King; +Cc: Kernel Mailing List, Linux Fbdev development list
> > Due to a error with merging some stuff from a older DJ tree. I fixed it
> > in the fbdev BK repository.
>
> They haven't *been* in any DJ tree.
Looking threw the many patches I have from people I did grab it from
patch-2.5.15-rmk1. It is right above the fbcmap.c fix which I did need.
That is where I go it from. Thank you for that fix.
While grabbing that fix I noticed what a appeared to be a simple two
line fix for the cyber2000fb driver. Actually I was tempted to port the
whole driver over to the new api but I didn't because I feared you be
ticked off. Especially since I don't have the hardware. The only drivers I
have ported over are the ones that are really simple. I touched the
anakin driver because of this reason. The complex one where I don't have
the hardware I don't touch. Now that we have enough functionally drivers
people can see the new changes needed to be done.
> Why the fuck should I go around finding and testing peoples trees when I
> haven't submitted the stuff to them?
Look here. I'm not looking for trouble or to upset anyone. I know alot
of the fbdev driver maintainers are too busy to properly maintain the
drivers. Several have told me this. Or the drivers have been abandon.
Plus the docs have been shotty for porting to the new api. I am willing to
do extra work and port these drivers to save the maintainers time. I'm
not going to do a perfect port but I do hope what work I did do will help
them out.
I do admit and apologize for not properly saying which drivers have
been altered. I will make a special note of doing that in the future.
Especially since very few actually look at my patches.
^ permalink raw reply [flat|nested] 35+ messages in thread* Re: Linux 2.5.19
2002-05-29 22:43 ` James Simmons
@ 2002-05-29 22:29 ` Martin Dalecki
2002-05-29 23:31 ` Russell King
0 siblings, 1 reply; 35+ messages in thread
From: Martin Dalecki @ 2002-05-29 22:29 UTC (permalink / raw)
To: James Simmons
Cc: Russell King, Kernel Mailing List, Linux Fbdev development list
James Simmons wrote:
>
> I do admit and apologize for not properly saying which drivers have
> been altered. I will make a special note of doing that in the future.
> Especially since very few actually look at my patches.
Plese don't take silent aprobation for "don't look" :-).
I *like* the patches you do... well just my 0.02EUR.
^ permalink raw reply [flat|nested] 35+ messages in thread
* Re: Linux 2.5.19
2002-05-29 22:29 ` Martin Dalecki
@ 2002-05-29 23:31 ` Russell King
2002-05-30 5:10 ` Framebuffer policy [ was Re: Linux 2.5.19] James Simmons
0 siblings, 1 reply; 35+ messages in thread
From: Russell King @ 2002-05-29 23:31 UTC (permalink / raw)
To: Martin Dalecki
Cc: James Simmons, Kernel Mailing List, Linux Fbdev development list
On Thu, May 30, 2002 at 12:29:26AM +0200, Martin Dalecki wrote:
> Plese don't take silent aprobation for "don't look" :-).
> I *like* the patches you do... well just my 0.02EUR.
This is about people who think they're god nicking patches from
the author and maintainer of drivers and bypassing the maintainer
completely.
--
Russell King (rmk@arm.linux.org.uk) The developer of ARM Linux
http://www.arm.linux.org.uk/personal/aboutme.html
^ permalink raw reply [flat|nested] 35+ messages in thread* Framebuffer policy [ was Re: Linux 2.5.19]
2002-05-29 23:31 ` Russell King
@ 2002-05-30 5:10 ` James Simmons
0 siblings, 0 replies; 35+ messages in thread
From: James Simmons @ 2002-05-30 5:10 UTC (permalink / raw)
To: Russell King
Cc: Martin Dalecki, Kernel Mailing List, Linux Fbdev development list,
Geert Uytterhoeven
> This is about people who think they're god nicking patches from
> the author and maintainer of drivers and bypassing the maintainer
> completely.
Please no fighting. It is clear the problem is the lack of order here.
I understand how Russell feels. Most of the time people send in new fbdev
drivers or good size patches without consulting me or Geert first. I have
to say it has gotten better. So here goes for policy time:
--------------------------------------------------------------------
Framebuffer driver policy.
1) Basic one or few line fixes for drivers can go straight into the
kernel. Please don't abuse this.
2) All new drivers must be posted to the fbdev developement list for
peer review. Me and/or geert have final fword about them going in.
Please note we do get busy so just harass me about your driver. I
will not be offended and it pushs me to go do it. I'm the type of
person if I don't do it right away I will forget.
linux-fbdev-devel@lists.sourceforge.net
3) Large changes should be posted to both the framebuffer list and the
kernel mailing list as well to the framebuffer author if they
are know. Again it is for peer review and wide scale testing. We
need to make clear what drivers where effect. And yes if you are the
maintainer of a driver you should mail yourself. It makes it easier
for users to reply to you directly.
If no one follows these rules then their changes will be ignored. No
exceptions including for myself.
-----------------------------------------------------------------
How does this sound? Again sorry about the confusion.
^ permalink raw reply [flat|nested] 35+ messages in thread
* [PATCH] Missing include in drivers/base/bus.c and drivers/pci/pci-driver.c
2002-05-29 18:50 Linux 2.5.19 Linus Torvalds
2002-05-29 19:42 ` Jason Lunz
2002-05-29 20:17 ` Russell King
@ 2002-05-29 20:37 ` Tom Rini
2002-05-29 22:24 ` Linux 2.5.19 Tom Rini
` (10 subsequent siblings)
13 siblings, 0 replies; 35+ messages in thread
From: Tom Rini @ 2002-05-29 20:37 UTC (permalink / raw)
To: Linus Torvalds; +Cc: Kernel Mailing List
drivers/base/bus.c and drivers/pci/pci-driver.c both have functions
which are marked with __init, but didn't include <linux/init.h> directly.
The following fixes that (and allows 2.5.19 to compile on PPC32).
--
Tom Rini (TR1265)
http://gate.crashing.org/~trini/
===== drivers/base/bus.c 1.4 vs edited =====
--- 1.4/drivers/base/bus.c Tue May 28 11:35:01 2002
+++ edited/drivers/base/bus.c Wed May 29 13:30:05 2002
@@ -13,6 +13,7 @@
#include <linux/module.h>
#include <linux/errno.h>
#include <linux/stat.h>
+#include <linux/init.h>
#include "base.h"
static LIST_HEAD(bus_driver_list);
===== drivers/pci/pci-driver.c 1.5 vs edited =====
--- 1.5/drivers/pci/pci-driver.c Tue May 28 18:02:33 2002
+++ edited/drivers/pci/pci-driver.c Wed May 29 13:32:06 2002
@@ -5,6 +5,7 @@
#include <linux/pci.h>
#include <linux/module.h>
+#include <linux/init.h>
/*
* Registration of PCI drivers and handling of hot-pluggable devices.
^ permalink raw reply [flat|nested] 35+ messages in thread* Re: Linux 2.5.19
2002-05-29 18:50 Linux 2.5.19 Linus Torvalds
` (2 preceding siblings ...)
2002-05-29 20:37 ` [PATCH] Missing include in drivers/base/bus.c and drivers/pci/pci-driver.c Tom Rini
@ 2002-05-29 22:24 ` Tom Rini
2002-05-30 1:29 ` Rusty Russell
2002-05-29 23:01 ` Matthias Andree
` (9 subsequent siblings)
13 siblings, 1 reply; 35+ messages in thread
From: Tom Rini @ 2002-05-29 22:24 UTC (permalink / raw)
To: Linus Torvalds; +Cc: Kernel Mailing List, Rusty Russell
Hello. The following fixes compilation with CONFIG_BLK_DEV_RAM=y
I assume that Rusty intended to use a test for CONFIG_BLK_DEV_RAM and
not BLOCK_DEV_RAM.
--
Tom Rini (TR1265)
http://gate.crashing.org/~trini/
===== init/do_mounts.c 1.16 vs edited =====
--- 1.16/init/do_mounts.c Mon May 27 05:07:34 2002
+++ edited/init/do_mounts.c Wed May 29 15:22:38 2002
@@ -365,7 +365,7 @@
return sys_symlink(path + n + 5, name);
}
-#if defined(BLOCK_DEV_RAM) || defined(CONFIG_BLK_DEV_FD)
+#if defined(CONFIG_BLK_DEV_RAM) || defined(CONFIG_BLK_DEV_FD)
static void __init change_floppy(char *fmt, ...)
{
struct termios termios;
^ permalink raw reply [flat|nested] 35+ messages in thread* Re: Linux 2.5.19
2002-05-29 22:24 ` Linux 2.5.19 Tom Rini
@ 2002-05-30 1:29 ` Rusty Russell
0 siblings, 0 replies; 35+ messages in thread
From: Rusty Russell @ 2002-05-30 1:29 UTC (permalink / raw)
To: Tom Rini; +Cc: Kernel Mailing List, Peter Chubb
In message <20020529222429.GU5997@opus.bloom.county> you write:
> Hello. The following fixes compilation with CONFIG_BLK_DEV_RAM=y
> I assume that Rusty intended to use a test for CONFIG_BLK_DEV_RAM and
> not BLOCK_DEV_RAM.
Oops.... Damn you, Peter Chubb!
Thanks,
Rusty.
--
Anyone who quotes me in their sig is an idiot. -- Rusty Russell.
^ permalink raw reply [flat|nested] 35+ messages in thread
* Re: Linux 2.5.19
2002-05-29 18:50 Linux 2.5.19 Linus Torvalds
` (3 preceding siblings ...)
2002-05-29 22:24 ` Linux 2.5.19 Tom Rini
@ 2002-05-29 23:01 ` Matthias Andree
2002-05-29 23:35 ` J.A. Magallon
` (8 subsequent siblings)
13 siblings, 0 replies; 35+ messages in thread
From: Matthias Andree @ 2002-05-29 23:01 UTC (permalink / raw)
To: Kernel Mailing List; +Cc: Linus Torvalds
On Wed, 29 May 2002, Linus Torvalds wrote:
Summary of changes from v2.5.18 to v2.5.19
> ============================================
>
> <Andries.Brouwer@cwi.nl>
> o usb-storage
[...]
Linus,
is there any particular reason why you have not yet updated to my
lk-changelog.pl script or ever replied to any of my mails on that
subject?
I am constantly updating it to have it resolve most addresses to names,
fixing bugs, and it seems people are all in favor of my script, but
still it looks as though some very early version was used to generate
this summary which knows hardly half of the common mail addresses.
I'm not adding the script again, it has been posted less than 24 hours
ago (in response to Marcelo's 2.4.19-pre9 announcement), if you need it,
find it at http://mandree.home.pages.de/linux/kernel/ or drop me a line
-- the current version is v0.21.
Thanks for your attention.
Matthias
^ permalink raw reply [flat|nested] 35+ messages in thread* Re: Linux 2.5.19
2002-05-29 18:50 Linux 2.5.19 Linus Torvalds
` (4 preceding siblings ...)
2002-05-29 23:01 ` Matthias Andree
@ 2002-05-29 23:35 ` J.A. Magallon
2002-05-30 14:15 ` [PATCH] 2.5.19 blk.h and more about the ugly kids Martin Dalecki
` (7 subsequent siblings)
13 siblings, 0 replies; 35+ messages in thread
From: J.A. Magallon @ 2002-05-29 23:35 UTC (permalink / raw)
To: Linus Torvalds; +Cc: Kernel Mailing List
On 2002.05.29 Linus Torvalds wrote:
>
>
>Summary of changes from v2.5.18 to v2.5.19
>============================================
[...]
> o Robert Love likes leather and chains
this is funny...
--
J.A. Magallon # Let the source be with you...
mailto:jamagallon@able.es
Mandrake Linux release 8.3 (Cooker) for i586
Linux werewolf 2.4.19-pre9-jam1 #1 SMP mié may 29 02:20:48 CEST 2002 i686
^ permalink raw reply [flat|nested] 35+ messages in thread* [PATCH] 2.5.19 blk.h and more about the ugly kids.
2002-05-29 18:50 Linux 2.5.19 Linus Torvalds
` (5 preceding siblings ...)
2002-05-29 23:35 ` J.A. Magallon
@ 2002-05-30 14:15 ` Martin Dalecki
2002-05-31 11:09 ` [PATCH] 2.5.19 IDE 76 Martin Dalecki
` (6 subsequent siblings)
13 siblings, 0 replies; 35+ messages in thread
From: Martin Dalecki @ 2002-05-30 14:15 UTC (permalink / raw)
To: Linus Torvalds; +Cc: Kernel Mailing List
[-- Attachment #1: Type: text/plain, Size: 687 bytes --]
- Remove DEVICE_INTR and associated code from floppy driver.
- Savlage s390 xpram code from kernel version dependant compilation disease.
- Eliminate SET_INTR code from the places where it was used.
- Eliminate bogous support for multiple sbpcd controllers. The driver didn't
even compile right now before we could think about further supporting it at
all we have to get rid of this hack first.
Don't call invalidate_buffers in the release method there.
Why should it be necessary?
- Resurrect sonycd535 compilation.
- Let CURRENT request macro use the same primitive at the remaining QUEUE macro
in blk.h, which is still not quite right, but first things first :-).
[-- Attachment #2: blk-2.5.19.diff --]
[-- Type: text/plain, Size: 37383 bytes --]
diff -urN linux-2.5.19/drivers/acorn/block/mfmhd.c linux/drivers/acorn/block/mfmhd.c
--- linux-2.5.19/drivers/acorn/block/mfmhd.c 2002-05-29 20:42:49.000000000 +0200
+++ linux/drivers/acorn/block/mfmhd.c 2002-05-30 13:46:49.000000000 +0200
@@ -570,7 +570,7 @@
DBG("mfm_rw_intr: returned from cont->done\n");
} else {
/* Its going to generate another interrupt */
- SET_INTR(mfm_rw_intr);
+ DEVICE_INTR = mfm_rw_intr;
};
}
@@ -578,7 +578,7 @@
{
DBG("setting up for rw...\n");
- SET_INTR(mfm_rw_intr);
+ DEVICE_INTR = mfm_rw_intr;
issue_command(raw_cmd.cmdcode, raw_cmd.cmddata, raw_cmd.cmdlen);
}
@@ -608,7 +608,7 @@
/* Command end without seek end (see data sheet p.20) for parallel seek
- we have to send a POL command to wait for the seek */
if (mfm_status & STAT_CED) {
- SET_INTR(mfm_recal_intr);
+ DEVICE_INTR = mfm_recal_intr;
issue_command(CMD_POL, NULL, 0);
return;
}
@@ -638,7 +638,7 @@
return;
}
if (mfm_status & STAT_CED) {
- SET_INTR(mfm_seek_intr);
+ DEVICE_INTR = mfm_seek_intr;
issue_command(CMD_POL, NULL, 0);
return;
}
@@ -696,7 +696,7 @@
DBG("seeking...\n");
if (MFM_DRV_INFO.cylinder < 0) {
- SET_INTR(mfm_recal_intr);
+ DEVICE_INTR = mfm_recal_intr;
DBG("mfm_seek: about to call specify\n");
mfm_specify (); /* DAG added this */
@@ -712,7 +712,7 @@
cmdb[2] = raw_cmd.cylinder >> 8;
cmdb[3] = raw_cmd.cylinder;
- SET_INTR(mfm_seek_intr);
+ DEVICE_INTR = mfm_seek_intr;
issue_command(CMD_SEK, cmdb, 4);
} else
mfm_setup_rw();
@@ -907,7 +907,7 @@
if (blk_queue_empty(QUEUE)) {
printk("mfm_request: Exiting due to empty queue (pre)\n");
- CLEAR_INTR;
+ DEVICE_INTR = NULL;
Busy = 0;
return;
}
@@ -971,7 +971,7 @@
{
void (*handler) (void) = DEVICE_INTR;
- CLEAR_INTR;
+ DEVICE_INTR = NULL;
DBG("mfm_interrupt_handler (handler=0x%p)\n", handler);
diff -urN linux-2.5.19/drivers/block/acsi.c linux/drivers/block/acsi.c
--- linux-2.5.19/drivers/block/acsi.c 2002-05-29 20:42:54.000000000 +0200
+++ linux/drivers/block/acsi.c 2002-05-30 13:44:06.000000000 +0200
@@ -1041,7 +1041,7 @@
}
CurrentBuffer = buffer;
CurrentNSect = nsect;
-
+
if (CURRENT->cmd == WRITE) {
CMDSET_TARG_LUN( write_cmd, target, lun );
CMDSET_BLOCK( write_cmd, block );
@@ -1049,7 +1049,7 @@
if (buffer == acsi_buffer)
copy_to_acsibuffer();
dma_cache_maintenance( pbuffer, nsect*512, 1 );
- SET_INTR(write_intr);
+ DEVICE_INTR = write_intr;
if (!acsicmd_dma( write_cmd, buffer, nsect, 1, 1)) {
CLEAR_INTR;
printk( KERN_ERR "ACSI (write): Timeout in command block\n" );
@@ -1063,7 +1063,7 @@
CMDSET_TARG_LUN( read_cmd, target, lun );
CMDSET_BLOCK( read_cmd, block );
CMDSET_LEN( read_cmd, nsect );
- SET_INTR(read_intr);
+ DEVICE_INTR = read_intr;
if (!acsicmd_dma( read_cmd, buffer, nsect, 0, 1)) {
CLEAR_INTR;
printk( KERN_ERR "ACSI (read): Timeout in command block\n" );
diff -urN linux-2.5.19/drivers/block/floppy.c linux/drivers/block/floppy.c
--- linux-2.5.19/drivers/block/floppy.c 2002-05-29 20:42:47.000000000 +0200
+++ linux/drivers/block/floppy.c 2002-05-30 13:45:57.000000000 +0200
@@ -633,6 +633,8 @@
}
#endif
+static void (*do_floppy)(void) = NULL;
+
#ifdef FLOPPY_SANITY_CHECK
#define OLOGSIZE 20
@@ -920,9 +922,9 @@
if (!fdc_busy)
DPRINT("FDC access conflict!\n");
- if (DEVICE_INTR)
+ if (do_floppy)
DPRINT("device interrupt still active at FDC release: %p!\n",
- DEVICE_INTR);
+ do_floppy);
command_status = FD_COMMAND_NONE;
del_timer(&fd_timeout);
cont = NULL;
@@ -1005,7 +1007,7 @@
static void cancel_activity(void)
{
- CLEAR_INTR;
+ do_floppy = NULL;
floppy_tq.routine = (void *)(void *) empty;
del_timer(&fd_timer);
}
@@ -1524,7 +1526,7 @@
setup_DMA();
if (flags & FD_RAW_INTR)
- SET_INTR(main_command_interrupt);
+ do_floppy = main_command_interrupt;
r=0;
for (i=0; i< raw_cmd->cmd_count; i++)
@@ -1656,7 +1658,7 @@
}
}
- SET_INTR(seek_interrupt);
+ do_floppy = seek_interrupt;
output_byte(FD_SEEK);
output_byte(UNIT(current_drive));
LAST_OUT(track);
@@ -1736,7 +1738,7 @@
/* interrupt handler. Note that this can be called externally on the Sparc */
void floppy_interrupt(int irq, void *dev_id, struct pt_regs * regs)
{
- void (*handler)(void) = DEVICE_INTR;
+ void (*handler)(void) = do_floppy;
int do_print;
unsigned long f;
@@ -1746,9 +1748,9 @@
f=claim_dma_lock();
fd_disable_dma();
release_dma_lock(f);
-
+
floppy_enable_hlt();
- CLEAR_INTR;
+ do_floppy = NULL;
if (fdc >= N_FDC || FDCS->address == -1){
/* we don't even know which FDC is the culprit */
printk("DOR0=%x\n", fdc_state[0].dor);
@@ -1795,7 +1797,7 @@
#ifdef DEBUGT
debugt("recalibrate floppy:");
#endif
- SET_INTR(recal_interrupt);
+ do_floppy = recal_interrupt;
output_byte(FD_RECALIBRATE);
LAST_OUT(UNIT(current_drive));
}
@@ -1823,14 +1825,14 @@
static void reset_fdc(void)
{
unsigned long flags;
-
- SET_INTR(reset_interrupt);
+
+ do_floppy = reset_interrupt;
FDCS->reset = 0;
reset_fdc_info(0);
/* Pseudo-DMA may intercept 'reset finished' interrupt. */
/* Irrelevant for systems with true DMA (i386). */
-
+
flags=claim_dma_lock();
fd_disable_dma();
release_dma_lock(flags);
@@ -1873,8 +1875,8 @@
printk("status=%x\n", fd_inb(FD_STATUS));
printk("fdc_busy=%lu\n", fdc_busy);
- if (DEVICE_INTR)
- printk("DEVICE_INTR=%p\n", DEVICE_INTR);
+ if (do_floppy)
+ printk("do_floppy=%p\n", do_floppy);
if (floppy_tq.sync)
printk("floppy_tq.routine=%p\n", floppy_tq.routine);
if (timer_pending(&fd_timer))
@@ -2920,7 +2922,7 @@
for (;;) {
if (blk_queue_empty(QUEUE)) {
- CLEAR_INTR;
+ do_floppy = NULL;
unlock_fdc();
return;
}
diff -urN linux-2.5.19/drivers/cdrom/Config.help linux/drivers/cdrom/Config.help
--- linux-2.5.19/drivers/cdrom/Config.help 2002-05-29 20:42:55.000000000 +0200
+++ linux/drivers/cdrom/Config.help 2002-05-30 14:26:43.000000000 +0200
@@ -106,27 +106,6 @@
The module will be called sbpcd.o. If you want to compile it as a
module, say M here and read <file:Documentation/modules.txt>.
-CONFIG_SBPCD2
- Say Y here only if you have two CD-ROM controller cards of this type
- (usually only if you have more than four drives). You should enter
- the parameters for the second, third and fourth interface card into
- <file:drivers/cdrom/sbpcd.h> before compiling the new kernel. Read
- the file <file:Documentation/cdrom/sbpcd>.
-
-CONFIG_SBPCD3
- Say Y here only if you have three CD-ROM controller cards of this
- type (usually only if you have more than six drives). You should
- enter the parameters for the second, third and fourth interface card
- into <file:include/linux/sbpcd.h> before compiling the new kernel.
- Read the file <file:Documentation/cdrom/sbpcd>.
-
-CONFIG_SBPCD4
- Say Y here only if you have four CD-ROM controller cards of this
- type (usually only if you have more than eight drives). You should
- enter the parameters for the second, third and fourth interface card
- into <file:include/linux/sbpcd.h> before compiling the new kernel.
- Read the file <file:Documentation/cdrom/sbpcd>.
-
CONFIG_AZTCD
This is your driver if you have an Aztech CDA268-01A, Orchid
CD-3110, Okano or Wearnes CDD110, Conrad TXC, or CyCD-ROM CR520 or
diff -urN linux-2.5.19/drivers/cdrom/Config.in linux/drivers/cdrom/Config.in
--- linux-2.5.19/drivers/cdrom/Config.in 2002-05-29 20:42:44.000000000 +0200
+++ linux/drivers/cdrom/Config.in 2002-05-30 14:03:07.000000000 +0200
@@ -4,15 +4,6 @@
tristate ' Aztech/Orchid/Okano/Wearnes/TXC/CyDROM CDROM support' CONFIG_AZTCD
tristate ' Goldstar R420 CDROM support' CONFIG_GSCD
tristate ' Matsushita/Panasonic/Creative, Longshine, TEAC CDROM support' CONFIG_SBPCD
-if [ "$CONFIG_SBPCD" = "y" ]; then
- bool ' Matsushita/Panasonic, ... second CDROM controller support' CONFIG_SBPCD2
- if [ "$CONFIG_SBPCD2" = "y" ]; then
- bool ' Matsushita/Panasonic, ... third CDROM controller support' CONFIG_SBPCD3
- if [ "$CONFIG_SBPCD3" = "y" ]; then
- bool ' Matsushita/Panasonic, ... fourth CDROM controller support' CONFIG_SBPCD4
- fi
- fi
-fi
tristate ' Mitsumi (standard) [no XA/Multisession] CDROM support' CONFIG_MCD
if [ "$CONFIG_MCD" != "n" ]; then
int 'MCD IRQ' CONFIG_MCD_IRQ 11
diff -urN linux-2.5.19/drivers/cdrom/gscd.c linux/drivers/cdrom/gscd.c
--- linux-2.5.19/drivers/cdrom/gscd.c 2002-05-29 20:42:44.000000000 +0200
+++ linux/drivers/cdrom/gscd.c 2002-05-30 13:53:38.000000000 +0200
@@ -292,7 +292,7 @@
goto out;
if (CURRENT->cmd != READ) {
- printk("GSCD: bad cmd %d\n", CURRENT->cmd);
+ printk("GSCD: bad cmd %p\n", CURRENT->cmd);
end_request(0);
goto repeat;
}
diff -urN linux-2.5.19/drivers/cdrom/Makefile linux/drivers/cdrom/Makefile
--- linux-2.5.19/drivers/cdrom/Makefile 2002-05-29 20:42:54.000000000 +0200
+++ linux/drivers/cdrom/Makefile 2002-05-30 14:26:47.000000000 +0200
@@ -34,9 +34,6 @@
obj-$(CONFIG_MCDX) += mcdx.o cdrom.o
obj-$(CONFIG_OPTCD) += optcd.o
obj-$(CONFIG_SBPCD) += sbpcd.o cdrom.o
-obj-$(CONFIG_SBPCD2) += sbpcd2.o cdrom.o
-obj-$(CONFIG_SBPCD3) += sbpcd3.o cdrom.o
-obj-$(CONFIG_SBPCD4) += sbpcd4.o cdrom.o
obj-$(CONFIG_SJCD) += sjcd.o
obj-$(CONFIG_CDU535) += sonycd535.o
diff -urN linux-2.5.19/drivers/cdrom/sbpcd2.c linux/drivers/cdrom/sbpcd2.c
--- linux-2.5.19/drivers/cdrom/sbpcd2.c 2002-05-29 20:42:58.000000000 +0200
+++ linux/drivers/cdrom/sbpcd2.c 1970-01-01 01:00:00.000000000 +0100
@@ -1,5 +0,0 @@
-/*
- * duplication of sbpcd.c for multiple interfaces
- */
-#define SBPCD_ISSUE 2
-#include "sbpcd.c"
diff -urN linux-2.5.19/drivers/cdrom/sbpcd3.c linux/drivers/cdrom/sbpcd3.c
--- linux-2.5.19/drivers/cdrom/sbpcd3.c 2002-05-29 20:42:59.000000000 +0200
+++ linux/drivers/cdrom/sbpcd3.c 1970-01-01 01:00:00.000000000 +0100
@@ -1,5 +0,0 @@
-/*
- * duplication of sbpcd.c for multiple interfaces
- */
-#define SBPCD_ISSUE 3
-#include "sbpcd.c"
diff -urN linux-2.5.19/drivers/cdrom/sbpcd4.c linux/drivers/cdrom/sbpcd4.c
--- linux-2.5.19/drivers/cdrom/sbpcd4.c 2002-05-29 20:42:48.000000000 +0200
+++ linux/drivers/cdrom/sbpcd4.c 1970-01-01 01:00:00.000000000 +0100
@@ -1,5 +0,0 @@
-/*
- * duplication of sbpcd.c for multiple interfaces
- */
-#define SBPCD_ISSUE 4
-#include "sbpcd.c"
diff -urN linux-2.5.19/drivers/cdrom/sbpcd.c linux/drivers/cdrom/sbpcd.c
--- linux-2.5.19/drivers/cdrom/sbpcd.c 2002-05-29 20:42:48.000000000 +0200
+++ linux/drivers/cdrom/sbpcd.c 2002-05-30 14:42:37.000000000 +0200
@@ -1,5 +1,3 @@
-
-
/*
* sbpcd.c CD-ROM device driver for the whole family of traditional,
* non-ATAPI IDE-style Matsushita/Panasonic CR-5xx drives.
@@ -341,16 +339,20 @@
/*
* Trying to merge requests breaks this driver horribly (as in it goes
- * boom and apparently has done so since 2.3.41). As it is a legacy
- * driver for a horribly slow double speed CD on a hideous interface
- * designed for polled operation, I won't loose any sleep in simply
+ * boom and apparently has done so since 2.3.41). As it is a legacy
+ * driver for a horribly slow double speed CD on a hideous interface
+ * designed for polled operation, I won't loose any sleep in simply
* disallowing merging. Paul G. 02/2001
+ *
+ * Thu May 30 14:14:47 CEST 2002:
+ *
+ * I have presumably found the reson for the above - there was a bogous
+ * end_request substitute, which was manipulating the request queues
+ * incorrectly. If someone has access to the actual hardware, and it's
+ * still operations - well please free to test it.
+ *
+ * Marcin Dalecki
*/
-#define DONT_MERGE_REQUESTS
-
-#ifndef SBPCD_ISSUE
-#define SBPCD_ISSUE 1
-#endif /* SBPCD_ISSUE */
#include <linux/module.h>
@@ -364,7 +366,7 @@
#include <linux/cdrom.h>
#include <linux/ioport.h>
#include <linux/devfs_fs_kernel.h>
-#include <linux/major.h>
+#include <linux/major.h>
#include <linux/string.h>
#include <linux/vmalloc.h>
#include <linux/init.h>
@@ -377,50 +379,19 @@
#include <linux/config.h>
#include "sbpcd.h"
-#if !(SBPCD_ISSUE-1)
#define MAJOR_NR MATSUSHITA_CDROM_MAJOR
-#endif
-#if !(SBPCD_ISSUE-2)
-#define MAJOR_NR MATSUSHITA_CDROM2_MAJOR /* second driver issue */
-#endif
-#if !(SBPCD_ISSUE-3)
-#define MAJOR_NR MATSUSHITA_CDROM3_MAJOR /* third driver issue */
-#endif
-#if !(SBPCD_ISSUE-4)
-#define MAJOR_NR MATSUSHITA_CDROM4_MAJOR /* fourth driver issue */
-#endif
#include <linux/blk.h>
/*==========================================================================*/
-/*
- * provisions for more than 1 driver issues
- * currently up to 4 drivers, expandable
- */
-#if !(SBPCD_ISSUE-1)
-#define DO_SBPCD_REQUEST(a) do_sbpcd_request(a)
-#define SBPCD_INIT(a) sbpcd_init(a)
-#endif
-#if !(SBPCD_ISSUE-2)
-#define DO_SBPCD_REQUEST(a) do_sbpcd2_request(a)
-#define SBPCD_INIT(a) sbpcd2_init(a)
-#endif
-#if !(SBPCD_ISSUE-3)
-#define DO_SBPCD_REQUEST(a) do_sbpcd3_request(a)
-#define SBPCD_INIT(a) sbpcd3_init(a)
-#endif
-#if !(SBPCD_ISSUE-4)
-#define DO_SBPCD_REQUEST(a) do_sbpcd4_request(a)
-#define SBPCD_INIT(a) sbpcd4_init(a)
-#endif
-/*==========================================================================*/
#if SBPCD_DIS_IRQ
-#define SBPCD_CLI cli()
-#define SBPCD_STI sti()
+# define SBPCD_CLI cli()
+# define SBPCD_STI sti()
#else
-#define SBPCD_CLI
-#define SBPCD_STI
-#endif /* SBPCD_DIS_IRQ */
+# define SBPCD_CLI
+# define SBPCD_STI
+#endif
+
/*==========================================================================*/
/*
* auto-probing address list
@@ -438,8 +409,7 @@
* send mail to emoenke@gwdg.de if your interface card is not FULLY
* represented here.
*/
-#if !(SBPCD_ISSUE-1)
-static int sbpcd[] =
+static int sbpcd[] =
{
CDROM_PORT, SBPRO, /* probe with user's setup first */
#if DISTRIBUTION
@@ -482,31 +452,18 @@
#endif
#endif /* DISTRIBUTION */
};
-#else
-static int sbpcd[] = {CDROM_PORT, SBPRO}; /* probe with user's setup only */
-#endif
+
+/*
+ * Protects access to global structures etc.
+ */
+static spinlock_t sbpcd_lock __cacheline_aligned = SPIN_LOCK_UNLOCKED;
+
MODULE_PARM(sbpcd, "2i");
MODULE_PARM(max_drives, "i");
#define NUM_PROBE (sizeof(sbpcd) / sizeof(int))
/*==========================================================================*/
-/*
- * the external references:
- */
-#if !(SBPCD_ISSUE-1)
-#ifdef CONFIG_SBPCD2
-extern int sbpcd2_init(void);
-#endif
-#ifdef CONFIG_SBPCD3
-extern int sbpcd3_init(void);
-#endif
-#ifdef CONFIG_SBPCD4
-extern int sbpcd4_init(void);
-#endif
-#endif
-
-/*==========================================================================*/
#define INLINE inline
@@ -604,19 +561,7 @@
static const char *str_sp = "SPEA";
static const char *str_t16 = "Teac16bit";
static const char *type;
-
-#if !(SBPCD_ISSUE-1)
static const char *major_name="sbpcd";
-#endif
-#if !(SBPCD_ISSUE-2)
-static const char *major_name="sbpcd2";
-#endif
-#if !(SBPCD_ISSUE-3)
-static const char *major_name="sbpcd3";
-#endif
-#if !(SBPCD_ISSUE-4)
-static const char *major_name="sbpcd4";
-#endif
/*==========================================================================*/
@@ -4879,15 +4824,12 @@
*
*/
#undef DEBUG_GTL
-static inline void sbpcd_end_request(struct request *req, int uptodate) {
- list_add(&req->queue, &req->q->queue_head);
- end_request(uptodate);
-}
+
/*==========================================================================*/
/*
* I/O request routine, called from Linux kernel.
*/
-static void DO_SBPCD_REQUEST(request_queue_t * q)
+static void do_sbpcd_request(request_queue_t * q)
{
u_int block;
u_int nsect;
@@ -4921,11 +4863,11 @@
return;
}
- req=CURRENT; /* take out our request so no other */
+ req = CURRENT; /* take out our request so no other */
blkdev_dequeue_request(req); /* task can fuck it up GTL */
if (req -> sector == -1)
- sbpcd_end_request(req, 0);
+ end_request(0);
spin_unlock_irq(q->queue_lock);
down(&ioctl_read_sem);
@@ -4967,7 +4909,7 @@
#endif
up(&ioctl_read_sem);
spin_lock_irq(q->queue_lock);
- sbpcd_end_request(req, 1);
+ end_request(1);
goto request_loop;
}
@@ -5008,7 +4950,7 @@
#endif
up(&ioctl_read_sem);
spin_lock_irq(q->queue_lock);
- sbpcd_end_request(req, 1);
+ end_request(1);
goto request_loop;
}
}
@@ -5024,7 +4966,7 @@
up(&ioctl_read_sem);
sbp_sleep(0); /* wait a bit, try again */
spin_lock_irq(q->queue_lock);
- sbpcd_end_request(req, 0);
+ end_request(0);
goto request_loop;
}
/*==========================================================================*/
@@ -5469,7 +5411,7 @@
static void sbpcd_release(struct cdrom_device_info * cdi)
{
int i;
-
+
i = minor(cdi->dev);
if ((i<0) || (i>=NR_SBPCD) || (D_S[i].drv_id==-1))
{
@@ -5488,7 +5430,6 @@
if (--D_S[d].open_count<=0)
{
D_S[d].sbp_first_frame=D_S[d].sbp_last_frame=-1;
- invalidate_buffers(cdi->dev);
if (D_S[d].audio_state!=audio_playing)
if (D_S[d].f_eject) cc_SpinDown();
D_S[d].diskstate_flags &= ~cd_size_bit;
@@ -5559,11 +5500,7 @@
*
*/
-#if (SBPCD_ISSUE-1)
-static int sbpcd_setup(char *s)
-#else
int sbpcd_setup(char *s)
-#endif
{
#ifndef MODULE
int p[4];
@@ -5680,20 +5617,6 @@
return (0);
}
-#ifdef DONT_MERGE_REQUESTS
-static int dont_merge_requests_fn(request_queue_t *q, struct request *req,
- struct request *next, int max_segments)
-{
- return 0;
-}
-
-static int dont_bh_merge_fn(request_queue_t *q, struct request *req,
- struct buffer_head *bh, int max_segments)
-{
- return 0;
-}
-#endif
-
/*==========================================================================*/
/*
* Test for presence of drive and initialize it.
@@ -5703,10 +5626,10 @@
static devfs_handle_t devfs_handle;
#ifdef MODULE
-int __init __SBPCD_INIT(void)
+int __init __sbpcd_init(void)
#else
-int __init SBPCD_INIT(void)
-#endif /* MODULE */
+int __init sbpcd_init(void)
+#endif
{
char nbuff[16];
int i=0, j=0;
@@ -5841,7 +5764,7 @@
i=SetSpeed();
if (i>=0) D_S[j].CD_changed=1;
}
-
+
/*
* Turn on the CD audio channels.
* The addresses are obtained from SOUND_BASE (see sbpcd.h).
@@ -5849,8 +5772,8 @@
#if SOUND_BASE
OUT(MIXER_addr,MIXER_CD_Volume); /* select SB Pro mixer register */
OUT(MIXER_data,0xCC); /* one nibble per channel, max. value: 0xFF */
-#endif /* SOUND_BASE */
-
+#endif /* SOUND_BASE */
+
if (devfs_register_blkdev(MAJOR_NR, major_name, &sbpcd_bdops) != 0)
{
msg(DBG_INF, "Can't get MAJOR %d for Matsushita CDROM\n", MAJOR_NR);
@@ -5860,16 +5783,10 @@
goto init_done;
#endif /* MODULE */
}
- blk_init_queue(BLK_DEFAULT_QUEUE(MAJOR_NR), DO_SBPCD_REQUEST, &sbpcd_lock);
-#ifdef DONT_MERGE_REQUESTS
- (BLK_DEFAULT_QUEUE(MAJOR_NR))->back_merge_fn = dont_bh_merge_fn;
- (BLK_DEFAULT_QUEUE(MAJOR_NR))->front_merge_fn = dont_bh_merge_fn;
- (BLK_DEFAULT_QUEUE(MAJOR_NR))->merge_requests_fn = dont_merge_requests_fn;
-#endif
- read_ahead[MAJOR_NR] = buffers * (CD_FRAMESIZE / 512);
-
+ blk_init_queue(BLK_DEFAULT_QUEUE(MAJOR_NR), do_sbpcd_request, &sbpcd_lock);
+
request_region(CDo_command,4,major_name);
-
+
devfs_handle = devfs_mk_dir (NULL, "sbp", NULL);
for (j=0;j<NR_SBPCD;j++)
{
@@ -5918,35 +5835,24 @@
}
D_S[j].sbpcd_infop = sbpcd_infop;
memcpy (sbpcd_infop, &sbpcd_info, sizeof(struct cdrom_device_info));
- sbpcd_infop->dev = MKDEV(MAJOR_NR, j);
+ sbpcd_infop->dev = mk_kdev(MAJOR_NR, j);
strncpy(sbpcd_infop->name,major_name, sizeof(sbpcd_infop->name));
- sprintf (nbuff, "c%dt%d/cd", SBPCD_ISSUE - 1, D_S[j].drv_id);
+ sprintf (nbuff, "c0t%d/cd", D_S[j].drv_id);
sbpcd_infop->de =
devfs_register (devfs_handle, nbuff, DEVFS_FL_DEFAULT,
MAJOR_NR, j, S_IFBLK | S_IRUGO | S_IWUGO,
&sbpcd_bdops, NULL);
if (register_cdrom(sbpcd_infop))
{
- printk(" sbpcd: Unable to register with Uniform CD-ROm driver\n");
+ printk(" sbpcd: Unable to register with Uniform CD-ROm driver\n");
}
}
blk_queue_hardsect_size(BLK_DEFAULT_QUEUE(MAJOR_NR), CD_FRAMESIZE);
#ifndef MODULE
init_done:
-#if !(SBPCD_ISSUE-1)
-#ifdef CONFIG_SBPCD2
- sbpcd2_init();
-#endif /* CONFIG_SBPCD2 */
-#ifdef CONFIG_SBPCD3
- sbpcd3_init();
-#endif /* CONFIG_SBPCD3 */
-#ifdef CONFIG_SBPCD4
- sbpcd4_init();
-#endif /* CONFIG_SBPCD4 */
-#endif /* !(SBPCD_ISSUE-1) */
-#endif /* MODULE */
+#endif
return 0;
}
/*==========================================================================*/
@@ -5978,14 +5884,11 @@
msg(DBG_INF, "%s module released.\n", major_name);
}
-
-#ifdef MODULE
-module_init(__SBPCD_INIT) /*HACK!*/;
-#endif
+module_init(__sbpcd_init) /*HACK!*/;
module_exit(sbpcd_exit);
-#endif /* MODULE */
+#endif /* MODULE */
/*==========================================================================*/
/*
* Check if the media has changed in the CD-ROM drive.
@@ -6003,7 +5906,7 @@
D_S[i].CD_changed=0;
msg(DBG_CHK,"medium changed (drive %d)\n", i);
/* BUG! Should invalidate buffers! --AJK */
- invalidate_buffers(full_dev);
+ /* Why should it do the above at all?! --mdcki */
D_S[d].diskstate_flags &= ~toc_bit;
D_S[d].diskstate_flags &= ~cd_size_bit;
#if SAFE_MIXED
diff -urN linux-2.5.19/drivers/cdrom/sbpcd.h linux/drivers/cdrom/sbpcd.h
--- linux-2.5.19/drivers/cdrom/sbpcd.h 2002-05-29 20:42:47.000000000 +0200
+++ linux/drivers/cdrom/sbpcd.h 2002-05-30 14:11:43.000000000 +0200
@@ -74,30 +74,10 @@
* Example: #define SOUND_BASE 0x220 enables the sound card's CD channels
* #define SOUND_BASE 0 leaves the soundcard untouched
*/
-#if !(SBPCD_ISSUE-1) /* first (or if you have only one) interface board: */
#define CDROM_PORT 0x340 /* <-----------<< port address */
#define SBPRO 0 /* <-----------<< interface type */
#define MAX_DRIVES 4 /* set to 1 if the card does not use "drive select" */
#define SOUND_BASE 0x220 /* <-----------<< sound address of this card or 0 */
-#endif
-#if !(SBPCD_ISSUE-2) /* ==================== second interface board: === */
-#define CDROM_PORT 0x344 /* <-----------<< port address */
-#define SBPRO 0 /* <-----------<< interface type */
-#define MAX_DRIVES 4 /* set to 1 if the card does not use "drive select" */
-#define SOUND_BASE 0x000 /* <-----------<< sound address of this card or 0 */
-#endif
-#if !(SBPCD_ISSUE-3) /* ===================== third interface board: === */
-#define CDROM_PORT 0x630 /* <-----------<< port address */
-#define SBPRO 1 /* <-----------<< interface type */
-#define MAX_DRIVES 4 /* set to 1 if the card does not use "drive select" */
-#define SOUND_BASE 0x240 /* <-----------<< sound address of this card or 0 */
-#endif
-#if !(SBPCD_ISSUE-4) /* ==================== fourth interface board: === */
-#define CDROM_PORT 0x634 /* <-----------<< port address */
-#define SBPRO 0 /* <-----------<< interface type */
-#define MAX_DRIVES 4 /* set to 1 if the card does not use "drive select" */
-#define SOUND_BASE 0x000 /* <-----------<< sound address of this card or 0 */
-#endif
/*
* some more or less user dependent definitions - service them!
diff -urN linux-2.5.19/drivers/cdrom/sonycd535.c linux/drivers/cdrom/sonycd535.c
--- linux-2.5.19/drivers/cdrom/sonycd535.c 2002-05-29 20:42:52.000000000 +0200
+++ linux/drivers/cdrom/sonycd535.c 2002-05-30 14:35:52.000000000 +0200
@@ -118,6 +118,7 @@
#include <linux/timer.h>
#include <linux/fs.h>
#include <linux/kernel.h>
+#include <linux/interrupt.h>
#include <linux/ioport.h>
#include <linux/hdreg.h>
#include <linux/genhd.h>
@@ -134,7 +135,8 @@
#include <linux/cdrom.h>
#define MAJOR_NR CDU535_CDROM_MAJOR
-# include <linux/blk.h>
+#include <linux/blk.h>
+
#define sony535_cd_base_io sonycd535 /* for compatible parameter passing with "insmod" */
#include "sonycd535.h"
@@ -1589,7 +1591,6 @@
&cdu_fops, NULL);
if (devfs_register_blkdev(MAJOR_NR, CDU535_HANDLE, &cdu_fops)) {
printk("Unable to get major %d for %s\n",
- devfs_unregister(sony_devfs_handle);
MAJOR_NR, CDU535_MESSAGE_NAME);
return -EIO;
}
@@ -1663,8 +1664,7 @@
devfs_unregister(sony_devfs_handle);
if (sony535_irq_used)
free_irq(sony535_irq_used, NULL);
- }
-
+
return -EIO;
}
register_disk(NULL, mk_kdev(MAJOR_NR,0), 1, &cdu_fops, 0);
diff -urN linux-2.5.19/drivers/ide/hd.c linux/drivers/ide/hd.c
--- linux-2.5.19/drivers/ide/hd.c 2002-05-29 20:42:47.000000000 +0200
+++ linux/drivers/ide/hd.c 2002-05-30 13:36:10.000000000 +0200
@@ -110,20 +110,16 @@
static struct timer_list device_timer;
-#define SET_TIMER \
+#define SET_TIMER \
do { \
mod_timer(&device_timer, jiffies + TIMEOUT_VALUE); \
} while (0)
-#define CLEAR_TIMER del_timer(&device_timer);
-
-#undef SET_INTR
-
-#define SET_INTR(x) \
+#define SET_HANDLER(x) \
if ((DEVICE_INTR = (x)) != NULL) \
SET_TIMER; \
else \
- CLEAR_TIMER;
+ del_timer(&device_timer);
#if (HD_DELAY > 0)
@@ -279,7 +275,7 @@
reset = 1;
return;
}
- SET_INTR(intr_addr);
+ SET_HANDLER(intr_addr);
outb_p(hd_info[drive].ctl,HD_CMD);
port=HD_DATA;
outb_p(hd_info[drive].wpcom>>2,++port);
@@ -429,7 +425,7 @@
if (CURRENT->current_nr_sectors <= 0)
end_request(1);
if (i > 0) {
- SET_INTR(&read_intr);
+ SET_HANDLER(&read_intr);
return;
}
(void) inb_p(HD_STATUS);
@@ -467,7 +463,7 @@
if (!i || (CURRENT->bio && !SUBSECTOR(i)))
end_request(1);
if (i > 0) {
- SET_INTR(&write_intr);
+ SET_HANDLER(&write_intr);
outsw(HD_DATA,CURRENT->buffer,256);
sti();
} else {
diff -urN linux-2.5.19/drivers/s390/block/xpram.c linux/drivers/s390/block/xpram.c
--- linux-2.5.19/drivers/s390/block/xpram.c 2002-05-29 20:42:57.000000000 +0200
+++ linux/drivers/s390/block/xpram.c 2002-05-30 05:21:22.000000000 +0200
@@ -59,25 +59,15 @@
#include <linux/version.h>
#ifdef MODULE
-char kernel_version [] = UTS_RELEASE;
+char kernel_version [] = UTS_RELEASE;
#endif
-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,3,98))
-# define XPRAM_VERSION 24
-#else
-# define XPRAM_VERSION 22
-#endif
-
-#if (XPRAM_VERSION == 24)
-# include <linux/config.h>
-# include <linux/init.h>
-#endif /* V24 */
+#include <linux/config.h>
+#include <linux/init.h>
#include <linux/sched.h>
#include <linux/kernel.h> /* printk() */
#include <linux/slab.h> /* kmalloc() */
-#if (XPRAM_VERSION == 24)
-# include <linux/devfs_fs_kernel.h>
-#endif /* V24 */
+#include <linux/devfs_fs_kernel.h>
#include <linux/fs.h> /* everything... */
#include <linux/errno.h> /* error codes */
#include <linux/timer.h>
@@ -89,7 +79,6 @@
#include <asm/system.h> /* cli(), *_flags */
#include <asm/uaccess.h> /* put_user */
-#if (XPRAM_VERSION == 24)
#define MAJOR_NR xpram_major /* force definitions on in blk.h */
int xpram_major; /* must be declared before including blk.h */
devfs_handle_t xpram_devfs_handle;
@@ -105,7 +94,6 @@
#include "xpram.h" /* local definitions */
__setup("xpram_parts=", xpram_setup);
-#endif /* V24 */
/*
define the debug levels:
@@ -133,26 +121,7 @@
#define PRINT_WARN(x...) printk ( KERN_DEBUG PRINTK_HEADER "warning:" x )
#define PRINT_ERR(x...) printk ( KERN_DEBUG PRINTK_HEADER "error:" x )
#define PRINT_FATAL(x...) printk ( KERN_DEBUG PRINTK_HEADER "panic:" x )
-#endif
-
-#if (XPRAM_VERSION == 22)
-#define MAJOR_NR xpram_major /* force definitions on in blk.h */
-int xpram_major; /* must be declared before including blk.h */
-
-#define DEVICE_NR(device) MINOR(device) /* xpram has no partition bits */
-#define DEVICE_NAME "xpram" /* name for messaging */
-#define DEVICE_INTR xpram_intrptr /* pointer to the bottom half */
-#define DEVICE_NO_RANDOM /* no entropy to contribute */
-
-
-#define DEVICE_OFF(d) /* do-nothing */
-
-#define DEVICE_REQUEST *xpram_dummy_device_request /* dummy function variable
- * to prevent warnings
- */#include <linux/blk.h>
-
-#include "xpram.h" /* local definitions */
-#endif /* V22 */
+#endif
/*
* Non-prefixed symbols are static. They are meant to be assigned at
@@ -659,13 +628,6 @@
case BLKRRPART: /* re-read partition table: can't do it, 0x1259 */
return -EINVAL;
-#if (XPRAM_VERSION == 22)
- RO_IOCTLS(inode->i_rdev, arg); /* the default RO operations
- * BLKROSET
- * BLKROGET
- */
-#endif /* V22 */
-
case HDIO_GETGEO:
/*
* get geometry: we have to fake one... trim the size to a
@@ -695,27 +657,6 @@
/*
* The file operations
*/
-
-#if (XPRAM_VERSION == 22)
-struct file_operations xpram_fops = {
- NULL, /* lseek: default */
- block_read,
- block_write,
- NULL, /* xpram_readdir */
- NULL, /* xpram_select */
- xpram_ioctl,
- NULL, /* xpram_mmap */
- xpram_open,
- NULL, /* flush */
- xpram_release,
- block_fsync,
- NULL, /* xpram_fasync */
- NULL,
- NULL
-};
-#endif /* V22 */
-
-#if (XPRAM_VERSION == 24)
struct block_device_operations xpram_devops =
{
owner: THIS_MODULE,
@@ -723,7 +664,6 @@
open: xpram_open,
release: xpram_release,
};
-#endif /* V24 */
/*
* Block-driver specific functions
@@ -740,11 +680,7 @@
char * buffer; /* local pointer into buffer cache */
int dev_no; /* device number of request */
int fault; /* faulty access to expanded memory */
-#if ( XPRAM_VERSION == 24 )
struct request * current_req; /* working request */
-#else
-# define current_req CURRENT
-#endif /* V24 */
while(1) {
if (blk_queue_empty(QUEUE)) {
@@ -753,10 +689,8 @@
}
fault=0;
-#if ( XPRAM_VERSION == 24 )
current_req = CURRENT;
-#endif /* V24 */
- dev_no = DEVICE_NR(current_req->rq_dev);
+ dev_no = DEVICE_NR(current_req->rq_dev);
/* Check if the minor number is in range */
if ( dev_no > xpram_devs ) {
static int count = 0;
@@ -872,26 +806,18 @@
* partition size (if provided). A parsing error of a value
* results in this value being set to -EINVAL.
*/
-#if (XPRAM_VERSION == 22)
-void xpram_setup (char *str, int *ints)
-#else
int xpram_setup (char *str)
-#endif /* V22 */
{
devs = xpram_read_int(&str);
- if ( devs != -EINVAL )
- if ( xpram_read_size_list_tail(&str,devs,sizes) < 0 ) {
+ if ( devs != -EINVAL )
+ if ( xpram_read_size_list_tail(&str,devs,sizes) < 0 ) {
PRINT_ERR("error while reading xpram parameters.\n");
-#if (XPRAM_VERSION == 24)
return -EINVAL;
-#endif /* V24 */
- }
-#if (XPRAM_VERSION == 24)
- else return 0;
- else return -EINVAL;
-#elif (XPRAM_VERSION == 22)
- return;
-#endif /* V24/V22 */
+ }
+ else
+ return 0;
+ else
+ return -EINVAL;
}
/*
@@ -911,12 +837,10 @@
int mem_auto_no=0; /* number of (implicit) zero parameters in sizes */
int mem_auto; /* automatically determined device size */
-#if (XPRAM_VERSION == 24)
int minor_length; /* store the length of a minor (w/o '\0') */
int minor_thresh; /* threshhold for minor lenght */
request_queue_t *q; /* request queue */
-#endif /* V24 */
/*
* Copy the (static) cfg variables to public prefixed ones to allow
@@ -975,29 +899,23 @@
/*
* Register your major, and accept a dynamic number
*/
-#if (XPRAM_VERSION == 22)
- result = register_blkdev(xpram_major, "xpram", &xpram_fops);
-#elif (XPRAM_VERSION == 24)
result = devfs_register_blkdev(xpram_major, "xpram", &xpram_devops);
-#endif /* V22/V24 */
if (result < 0) {
PRINT_ERR("Can't get major %d\n",xpram_major);
PRINT_ERR("Giving up xpram\n");
return result;
}
-#if (XPRAM_VERSION == 24)
xpram_devfs_handle = devfs_mk_dir (NULL, "slram", NULL);
devfs_register_series (xpram_devfs_handle, "%u", XPRAM_MAX_DEVS,
DEVFS_FL_DEFAULT, XPRAM_MAJOR, 0,
S_IFBLK | S_IRUSR | S_IWUSR,
&xpram_devops, NULL);
-#endif /* V22/V24 */
if (xpram_major == 0) xpram_major = result; /* dynamic */
major = xpram_major; /* Use `major' later on to save typing */
result = -ENOMEM; /* for the possible errors */
- /*
+ /*
* measure expanded memory
*/
@@ -1018,13 +936,9 @@
* arrays if it uses the default values.
*/
-#if (XPRAM_VERSION == 22)
- blk_dev[major].request_fn = xpram_request;
-#elif (XPRAM_VERSION == 24)
- q = BLK_DEFAULT_QUEUE (major);
+ q = BLK_DEFAULT_QUEUE(major);
blk_init_queue (q, xpram_request);
blk_queue_hardsect_size(q, xpram_hardsect);
-#endif /* V22/V24 */
/* we want to have XPRAM_UNUSED blocks security buffer between devices */
mem_usable=xpram_mem_avail-(XPRAM_UNUSED*(xpram_devs-1));
@@ -1076,15 +990,12 @@
goto fail_malloc_devices;
}
memset(xpram_devices, 0, xpram_devs * sizeof (Xpram_Dev));
-#if (XPRAM_VERSION == 24)
minor_length = 1;
minor_thresh = 10;
-#endif /* V24 */
for (i=0; i < xpram_devs; i++) {
/* data and usage remain zeroed */
xpram_devices[i].size = xpram_sizes[i]; /* size in kB not in bytes */
atomic_set(&(xpram_devices[i].usage),0);
-#if (XPRAM_VERSION == 24)
if (i == minor_thresh) {
minor_length++;
minor_thresh *= 10;
@@ -1119,27 +1030,20 @@
goto fail_devfs_register;
}
#endif /* WHY? */
-#endif /* V24 */
-
}
return 0; /* succeed */
/* clean up memory in case of failures */
-#if (XPRAM_VERSION == 24)
fail_devfs_register:
for (i=0; i < xpram_devs; i++) {
if ( xpram_devices[i].device_name )
kfree(xpram_devices[i].device_name);
}
kfree(xpram_devices);
-#endif /* V24 */
kfree (xpram_offsets);
fail_malloc_devices:
fail_malloc:
-#if (XPRAM_VERSION == 22)
- blk_dev[major].request_fn = NULL;
-#endif /* V22 */
/* ??? unregister_chrdev(major, "xpram"); */
unregister_blkdev(major, "xpram");
return result;
@@ -1168,20 +1072,12 @@
int i;
/* first of all, reset all the data structures */
-
-#if (XPRAM_VERSION == 22)
- blk_dev[major].request_fn = NULL;
-#endif /* V22 */
kfree(xpram_offsets);
blk_clear(major);
/* finally, the usual cleanup */
-#if (XPRAM_VERSION == 22)
- unregister_blkdev(major, "xpram");
-#elif (XPRAM_VERSION == 24)
devfs_unregister(xpram_devfs_handle);
if (devfs_unregister_blkdev(MAJOR_NR, "xpram"))
printk(KERN_WARNING "xpram: cannot unregister blkdev\n");
-#endif /* V22/V24 */
kfree(xpram_devices);
}
diff -urN linux-2.5.19/include/linux/blk.h linux/include/linux/blk.h
--- linux-2.5.19/include/linux/blk.h 2002-05-29 20:42:50.000000000 +0200
+++ linux/include/linux/blk.h 2002-05-30 14:24:35.000000000 +0200
@@ -125,7 +125,6 @@
static void floppy_off(unsigned int nr);
#define DEVICE_NAME "floppy"
-#define DEVICE_INTR do_floppy
#define DEVICE_NR(device) ( (minor(device) & 3) | ((minor(device) & 0x80 ) >> 5 ))
#elif (MAJOR_NR == HD_MAJOR)
@@ -149,14 +148,14 @@
#elif (MAJOR_NR == SCSI_TAPE_MAJOR)
#define DEVICE_NAME "scsitape"
-#define DEVICE_INTR do_st
+#define DEVICE_INTR do_st
#define DEVICE_NR(device) (minor(device) & 0x7f)
#elif (MAJOR_NR == OSST_MAJOR)
-#define DEVICE_NAME "onstream"
+#define DEVICE_NAME "onstream"
#define DEVICE_INTR do_osst
-#define DEVICE_NR(device) (minor(device) & 0x7f)
+#define DEVICE_NR(device) (minor(device) & 0x7f)
#elif (MAJOR_NR == SCSI_CDROM_MAJOR)
@@ -187,33 +186,16 @@
#elif (MAJOR_NR == MITSUMI_CDROM_MAJOR)
#define DEVICE_NAME "Mitsumi CD-ROM"
-/* #define DEVICE_INTR do_mcd */
#define DEVICE_NR(device) (minor(device))
#elif (MAJOR_NR == MITSUMI_X_CDROM_MAJOR)
#define DEVICE_NAME "Mitsumi CD-ROM"
-/* #define DEVICE_INTR do_mcdx */
#define DEVICE_NR(device) (minor(device))
#elif (MAJOR_NR == MATSUSHITA_CDROM_MAJOR)
-#define DEVICE_NAME "Matsushita CD-ROM controller #1"
-#define DEVICE_NR(device) (minor(device))
-
-#elif (MAJOR_NR == MATSUSHITA_CDROM2_MAJOR)
-
-#define DEVICE_NAME "Matsushita CD-ROM controller #2"
-#define DEVICE_NR(device) (minor(device))
-
-#elif (MAJOR_NR == MATSUSHITA_CDROM3_MAJOR)
-
-#define DEVICE_NAME "Matsushita CD-ROM controller #3"
-#define DEVICE_NR(device) (minor(device))
-
-#elif (MAJOR_NR == MATSUSHITA_CDROM4_MAJOR)
-
-#define DEVICE_NAME "Matsushita CD-ROM controller #4"
+#define DEVICE_NAME "Matsushita CD-ROM controller"
#define DEVICE_NR(device) (minor(device))
#elif (MAJOR_NR == AZTECH_CDROM_MAJOR)
@@ -292,27 +274,23 @@
#if (MAJOR_NR != SCSI_TAPE_MAJOR) && (MAJOR_NR != OSST_MAJOR)
#if !defined(IDE_DRIVER)
-#ifndef CURRENT
-# define CURRENT elv_next_request(&blk_dev[MAJOR_NR].request_queue)
-#endif
#ifndef QUEUE
# define QUEUE (&blk_dev[MAJOR_NR].request_queue)
#endif
+#ifndef CURRENT
+# define CURRENT elv_next_request(QUEUE)
+#endif
#ifndef DEVICE_NAME
# define DEVICE_NAME "unknown"
#endif
#ifdef DEVICE_INTR
static void (*DEVICE_INTR)(void) = NULL;
-#endif
-
-#define SET_INTR(x) (DEVICE_INTR = (x))
-
-# ifdef DEVICE_INTR
-# define CLEAR_INTR SET_INTR(NULL)
+# define CLEAR_INTR DEVICE_INTR = NULL
# else
# define CLEAR_INTR
# endif
+
#endif /* !defined(IDE_DRIVER) */
/*
^ permalink raw reply [flat|nested] 35+ messages in thread* [PATCH] 2.5.19 IDE 76
2002-05-29 18:50 Linux 2.5.19 Linus Torvalds
` (6 preceding siblings ...)
2002-05-30 14:15 ` [PATCH] 2.5.19 blk.h and more about the ugly kids Martin Dalecki
@ 2002-05-31 11:09 ` Martin Dalecki
2002-05-31 18:17 ` [PATCH] 2.5.19 IDE 77 Martin Dalecki
` (5 subsequent siblings)
13 siblings, 0 replies; 35+ messages in thread
From: Martin Dalecki @ 2002-05-31 11:09 UTC (permalink / raw)
To: Linus Torvalds; +Cc: Kernel Mailing List
[-- Attachment #1: Type: text/plain, Size: 982 bytes --]
Wed May 29 19:02:15 CEST 2002 ide-clean-76
- Since Bartek has released finally an entierly user space based setup
monitoring utility, we can finally remove the nonfunctional PROC code from
the host chip drivers. We have preserved it thus far only for documentation
purposes.
- Use generic bus master DMA setup code. There is nothing wrong with it.
- Make the ide-scsi code actually just allow for one device id per scsi host,
since we are registering a host per device right now. This prevents the
repetitive device recognition. Well registering an SCSI host of every single
disk out there isn't the proper thing to do. I will deal with that later
after my visual perception recovers again from already looking too long at
the SCSI code :-).
- Deal properly with host specific data mapping. (Could be that solves some
problems with the driver, which where in reality kernel data corruptions.)
- Homogenize flag handling for ATAPI drivers.
[-- Attachment #2: ide-clean-76.diff.gz --]
[-- Type: application/x-gzip, Size: 17516 bytes --]
^ permalink raw reply [flat|nested] 35+ messages in thread* [PATCH] 2.5.19 IDE 77
2002-05-29 18:50 Linux 2.5.19 Linus Torvalds
` (7 preceding siblings ...)
2002-05-31 11:09 ` [PATCH] 2.5.19 IDE 76 Martin Dalecki
@ 2002-05-31 18:17 ` Martin Dalecki
2002-06-02 6:04 ` [PATCH] 2.5.19 IDE 78 Martin Dalecki
` (4 subsequent siblings)
13 siblings, 0 replies; 35+ messages in thread
From: Martin Dalecki @ 2002-05-31 18:17 UTC (permalink / raw)
To: Linus Torvalds; +Cc: Kernel Mailing List
[-- Attachment #1: Type: text/plain, Size: 384 bytes --]
Fri May 31 13:45:52 CEST 2002 ide-clean-77
- Get rid of SELECT_DRIVE macro. Start to move all direct hardware access
functions in to one place.
- Get rid of SELECT_MASK macro. Realize that the mask is always equal 0.
Simplify the maskproc therefore.
- Get rid of GET_STAT and OK_STAT macros as well.
- hpt366 cleanups by Andrej Panin.
- Artop driver update by Franz Sirl.
[-- Attachment #2: ide-clean-77.diff --]
[-- Type: text/plain, Size: 59582 bytes --]
diff -urN linux-2.5.19/arch/cris/drivers/ide.c linux/arch/cris/drivers/ide.c
--- linux-2.5.19/arch/cris/drivers/ide.c 2002-05-29 20:42:49.000000000 +0200
+++ linux/arch/cris/drivers/ide.c 2002-05-31 19:03:57.000000000 +0200
@@ -688,17 +688,16 @@
/*
* etrax_dma_intr() is the handler for disk read/write DMA interrupts
*/
-static ide_startstop_t etrax_dma_intr (struct ata_device *drive, struct request *rq)
+static ide_startstop_t etrax_dma_intr(struct ata_device *drive, struct request *rq)
{
int i, dma_stat;
- byte stat;
LED_DISK_READ(0);
LED_DISK_WRITE(0);
dma_stat = drive->channel->udma(ide_dma_end, drive, rq);
- stat = GET_STAT(); /* get drive status */
- if (OK_STAT(stat,DRIVE_READY,drive->bad_wstat|DRQ_STAT)) {
+ /* get drive status */
+ if (ata_status(drive, DRIVE_READY, drive->bad_wstat | DRQ_STAT)) {
if (!dma_stat) {
for (i = rq->nr_sectors; i > 0;) {
i -= rq->current_nr_sectors;
@@ -708,7 +707,7 @@
}
printk("%s: bad DMA status\n", drive->name);
}
- return ide_error(drive, "dma_intr", stat);
+ return ide_error(drive, "dma_intr", drive->status);
}
/*
diff -urN linux-2.5.19/drivers/ide/aec62xx.c linux/drivers/ide/aec62xx.c
--- linux-2.5.19/drivers/ide/aec62xx.c 2002-05-29 20:42:52.000000000 +0200
+++ linux/drivers/ide/aec62xx.c 2002-05-31 21:04:44.000000000 +0200
@@ -54,6 +54,12 @@
#define AEC_IDE_ENABLE 0x4a
#define AEC_UDMA_OLD 0x54
+#define AEC_BM_STAT_PCH 0x02
+#define AEC_BM_STAT_SCH 0x0a
+
+#define AEC_PLLCLK_ATA133 0x10
+#define AEC_CABLEPINS_INPUT 0x10
+
static unsigned char aec_cyc2udma[17] = { 0, 0, 7, 6, 5, 4, 4, 3, 3, 2, 2, 2, 2, 1, 1, 1, 1 };
/*
@@ -146,6 +152,7 @@
#ifdef CONFIG_BLK_DEV_IDEDMA
static int aec62xx_dmaproc(struct ata_device *drive)
{
+ u32 bmide = pci_resource_start(drive->channel->pci_dev, 4);
short speed;
int map;
@@ -155,7 +162,9 @@
switch (drive->channel->pci_dev->device) {
case PCI_DEVICE_ID_ARTOP_ATP865R:
case PCI_DEVICE_ID_ARTOP_ATP865:
- map |= XFER_UDMA_100 | XFER_UDMA_133;
+ /* Can't use these modes simultaneously,
+ based on which PLL clock was chosen. */
+ map |= inb (bmide + AEC_BM_STAT_PCH) & AEC_PLLCLK_ATA133 ? XFER_UDMA_133 : XFER_UDMA_100;
case PCI_DEVICE_ID_ARTOP_ATP860R:
case PCI_DEVICE_ID_ARTOP_ATP860:
map |= XFER_UDMA_66;
@@ -172,10 +181,12 @@
/*
* The initialization callback. Here we determine the IDE chip type
* and initialize its drive independent registers.
+ * We return the IRQ assigned to the chip.
*/
static unsigned int __init aec62xx_init_chipset(struct pci_dev *dev)
{
+ u32 bmide = pci_resource_start(dev, 4);
unsigned char t;
/*
@@ -202,8 +213,9 @@
/* Enable burst mode. */
pci_read_config_byte(dev, AEC_IDE_ENABLE, &t);
pci_write_config_byte(dev, AEC_IDE_ENABLE, t | 0x80);
-
#endif
+ /* switch cable detection pins to input-only. */
+ outb (inb (bmide + AEC_BM_STAT_SCH) | AEC_CABLEPINS_INPUT, bmide + AEC_BM_STAT_SCH);
}
/*
@@ -214,7 +226,7 @@
printk(KERN_INFO "AEC_IDE: %s (rev %02x) controller on pci%s\n",
dev->name, t, dev->slot_name);
- return 0;
+ return dev->irq;
}
static unsigned int __init aec62xx_ata66_check(struct ata_channel *ch)
diff -urN linux-2.5.19/drivers/ide/device.c linux/drivers/ide/device.c
--- linux-2.5.19/drivers/ide/device.c 1970-01-01 01:00:00.000000000 +0100
+++ linux/drivers/ide/device.c 2002-05-31 16:53:15.000000000 +0200
@@ -0,0 +1,95 @@
+/**** vi:set ts=8 sts=8 sw=8:************************************************
+ *
+ * Copyright (C) 2002 Marcin Dalecki <martin@dalecki.de>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 as published by
+ * the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ */
+
+/*
+ * Common low leved device access code. This is the lowest layer of hardware
+ * access.
+ */
+
+#include <linux/module.h>
+#include <linux/types.h>
+#include <linux/string.h>
+#include <linux/kernel.h>
+#include <linux/mm.h>
+#include <linux/ioport.h>
+#include <linux/blkdev.h>
+#include <linux/errno.h>
+#include <linux/slab.h>
+#include <linux/delay.h>
+#include <linux/cdrom.h>
+#include <linux/hdreg.h>
+#include <linux/ide.h>
+
+#include <asm/byteorder.h>
+#include <asm/io.h>
+#include <asm/bitops.h>
+#include <asm/uaccess.h>
+
+/*
+ * Select a device for operation with possible busy waiting for the operation
+ * to complete.
+ */
+void ata_select(struct ata_device *drive, unsigned long delay)
+{
+ struct ata_channel *ch = drive->channel;
+
+ if (!ch)
+ return;
+
+ if (ch->selectproc)
+ ch->selectproc(drive);
+ OUT_BYTE(drive->select.all, ch->io_ports[IDE_SELECT_OFFSET]);
+
+ /* The delays during probing for drives can be georgeous. Deal with
+ * it.
+ */
+ if (delay) {
+ if (delay >= 1000)
+ mdelay(delay / 1000);
+ else
+ udelay(delay);
+ }
+}
+
+EXPORT_SYMBOL(ata_select);
+
+/*
+ * Handle quirky routing of interrupts.
+ */
+void ata_mask(struct ata_device *drive)
+{
+ struct ata_channel *ch = drive->channel;
+
+ if (!ch)
+ return;
+
+ if (ch->maskproc)
+ ch->maskproc(drive);
+}
+
+/*
+ * Check the state of the status register.
+ */
+int ata_status(struct ata_device *drive, u8 good, u8 bad)
+{
+ struct ata_channel *ch = drive->channel;
+
+ drive->status = IN_BYTE(ch->io_ports[IDE_STATUS_OFFSET]);
+
+ return (drive->status & (good | bad)) == good;
+}
+
+EXPORT_SYMBOL(ata_status);
+
+MODULE_LICENSE("GPL");
diff -urN linux-2.5.19/drivers/ide/hpt366.c linux/drivers/ide/hpt366.c
--- linux-2.5.19/drivers/ide/hpt366.c 2002-05-31 19:30:47.000000000 +0200
+++ linux/drivers/ide/hpt366.c 2002-05-31 15:51:58.000000000 +0200
@@ -500,7 +500,7 @@
static unsigned int hpt_revision(struct pci_dev *dev)
{
- unsigned int class_rev;
+ u32 class_rev;
pci_read_config_dword(dev, PCI_CLASS_REVISION, &class_rev);
class_rev &= 0xff;
@@ -556,7 +556,7 @@
}
-static unsigned int pci_bus_clock_list(byte speed, struct chipset_bus_clock_list_entry * chipset_table)
+static unsigned int pci_bus_clock_list(u8 speed, struct chipset_bus_clock_list_entry * chipset_table)
{
for ( ; chipset_table->xfer_speed ; chipset_table++)
if (chipset_table->xfer_speed == speed) {
@@ -565,18 +565,17 @@
return chipset_table->chipset_settings;
}
-static void hpt366_tune_chipset(struct ata_device *drive, byte speed)
+static void hpt366_tune_chipset(struct ata_device *drive, u8 speed)
{
struct pci_dev *dev = drive->channel->pci_dev;
- byte regtime = (drive->select.b.unit & 0x01) ? 0x44 : 0x40;
- byte regfast = (drive->channel->unit) ? 0x55 : 0x51;
+ u8 regtime = (drive->select.b.unit & 0x01) ? 0x44 : 0x40;
+ u8 regfast = (drive->channel->unit) ? 0x55 : 0x51;
/*
* since the channel is always 0 it does not matter.
*/
- unsigned int reg1 = 0;
- unsigned int reg2 = 0;
- byte drive_fast = 0;
+ u32 reg1, reg2;
+ u8 drive_fast;
/*
* Disable the "fast interrupt" prediction.
@@ -601,19 +600,18 @@
pci_write_config_dword(dev, regtime, reg2);
}
-static void hpt368_tune_chipset(struct ata_device *drive, byte speed)
+static void hpt368_tune_chipset(struct ata_device *drive, u8 speed)
{
hpt366_tune_chipset(drive, speed);
}
-static void hpt370_tune_chipset(struct ata_device *drive, byte speed)
+static void hpt370_tune_chipset(struct ata_device *drive, u8 speed)
{
- byte regfast = (drive->channel->unit) ? 0x55 : 0x51;
- unsigned int list_conf = 0;
- unsigned int drive_conf = 0;
- unsigned int conf_mask = (speed >= XFER_MW_DMA_0) ? 0xc0000000 : 0x30070000;
- byte drive_pci = 0x40 + (drive->dn * 4);
- byte new_fast, drive_fast = 0;
+ u8 regfast = (drive->channel->unit) ? 0x55 : 0x51;
+ u32 list_conf, drive_conf;
+ u32 conf_mask = (speed >= XFER_MW_DMA_0) ? 0xc0000000 : 0x30070000;
+ u8 drive_pci = 0x40 + (drive->dn * 4);
+ u8 new_fast, drive_fast;
struct pci_dev *dev = drive->channel->pci_dev;
/*
@@ -649,14 +647,13 @@
pci_write_config_dword(dev, drive_pci, list_conf);
}
-static void hpt372_tune_chipset(struct ata_device *drive, byte speed)
+static void hpt372_tune_chipset(struct ata_device *drive, u8 speed)
{
- byte regfast = (drive->channel->unit) ? 0x55 : 0x51;
- unsigned int list_conf = 0;
- unsigned int drive_conf = 0;
- unsigned int conf_mask = (speed >= XFER_MW_DMA_0) ? 0xc0000000 : 0x30070000;
- byte drive_pci = 0x40 + (drive->dn * 4);
- byte drive_fast = 0;
+ u8 regfast = (drive->channel->unit) ? 0x55 : 0x51;
+ u32 list_conf, drive_conf;
+ u32 conf_mask = (speed >= XFER_MW_DMA_0) ? 0xc0000000 : 0x30070000;
+ u8 drive_pci = 0x40 + (drive->dn * 4);
+ u8 drive_fast;
struct pci_dev *dev = drive->channel->pci_dev;
/*
@@ -677,12 +674,12 @@
pci_write_config_dword(dev, drive_pci, list_conf);
}
-static void hpt374_tune_chipset(struct ata_device *drive, byte speed)
+static void hpt374_tune_chipset(struct ata_device *drive, u8 speed)
{
hpt372_tune_chipset(drive, speed);
}
-static int hpt3xx_tune_chipset(struct ata_device *drive, byte speed)
+static int hpt3xx_tune_chipset(struct ata_device *drive, u8 speed)
{
struct pci_dev *dev = drive->channel->pci_dev;
@@ -706,9 +703,9 @@
static void config_chipset_for_pio(struct ata_device *drive)
{
- unsigned short eide_pio_timing[6] = {960, 480, 240, 180, 120, 90};
+ static unsigned short eide_pio_timing[6] = {960, 480, 240, 180, 120, 90};
unsigned short xfer_pio = drive->id->eide_pio_modes;
- byte timing, speed, pio;
+ u8 timing, speed, pio;
pio = ata_timing_mode(drive, XFER_PIO | XFER_EPIO) - XFER_PIO_0;
@@ -739,12 +736,12 @@
speed = (!drive->id->tPIO) ? XFER_PIO_0 : XFER_PIO_SLOW;
break;
}
- (void) hpt3xx_tune_chipset(drive, speed);
+ hpt3xx_tune_chipset(drive, speed);
}
-static void hpt3xx_tune_drive(struct ata_device *drive, byte pio)
+static void hpt3xx_tune_drive(struct ata_device *drive, u8 pio)
{
- byte speed;
+ u8 speed;
switch(pio) {
case 4: speed = XFER_PIO_4;break;
case 3: speed = XFER_PIO_3;break;
@@ -760,7 +757,7 @@
{
struct pci_dev *dev = drive->channel->pci_dev;
int map;
- byte mode;
+ u8 mode;
if (drive->type != ATA_DISK)
return 0;
@@ -820,13 +817,14 @@
}
}
-static void hpt3xx_maskproc(struct ata_device *drive, int mask)
+static void hpt3xx_maskproc(struct ata_device *drive)
{
struct pci_dev *dev = drive->channel->pci_dev;
+ const int mask = 0;
if (drive->quirk_list) {
if (hpt_min_rev(dev, 3)) {
- byte reg5a = 0;
+ u8 reg5a;
pci_read_config_byte(dev, 0x5a, ®5a);
if (((reg5a & 0x10) >> 4) != mask)
pci_write_config_byte(dev, 0x5a, mask ? (reg5a | 0x10) : (reg5a & ~0x10));
@@ -899,7 +897,7 @@
static void hpt366_udma_irq_lost(struct ata_device *drive)
{
- u8 reg50h = 0, reg52h = 0, reg5ah = 0;
+ u8 reg50h, reg52h, reg5ah;
pci_read_config_byte(drive->channel->pci_dev, 0x50, ®50h);
pci_read_config_byte(drive->channel->pci_dev, 0x52, ®52h);
@@ -1042,8 +1040,8 @@
{
#if 0
unsigned long high_16 = pci_resource_start(drive->channel->pci_dev, 4);
- byte reset = (drive->channel->unit) ? 0x80 : 0x40;
- byte reg59h = 0;
+ u8 reset = (drive->channel->unit) ? 0x80 : 0x40;
+ u8 reg59h;
pci_read_config_byte(drive->channel->pci_dev, 0x59, ®59h);
pci_write_config_byte(drive->channel->pci_dev, 0x59, reg59h|reset);
@@ -1056,10 +1054,9 @@
{
struct ata_channel *ch = drive->channel;
struct pci_dev *dev = ch->pci_dev;
- byte reset = (ch->unit) ? 0x80 : 0x40;
- byte state_reg = (ch->unit) ? 0x57 : 0x53;
- byte reg59h = 0;
- byte regXXh = 0;
+ u8 reset = (ch->unit) ? 0x80 : 0x40;
+ u8 state_reg = (ch->unit) ? 0x57 : 0x53;
+ u8 reg59h, regXXh;
if (!ch)
return -EINVAL;
@@ -1268,8 +1265,8 @@
static void __init hpt366_init(struct pci_dev *dev)
{
- unsigned int reg1 = 0;
- u8 drive_fast = 0;
+ u32 reg1;
+ u8 drive_fast;
/*
* Disable the "fast interrupt" prediction.
@@ -1296,7 +1293,7 @@
static unsigned int __init hpt366_init_chipset(struct pci_dev *dev)
{
- u8 test = 0;
+ u8 test;
if (dev->resource[PCI_ROM_RESOURCE].start)
pci_write_config_byte(dev, PCI_ROM_ADDRESS, dev->resource[PCI_ROM_RESOURCE].start | PCI_ROM_ADDRESS_ENABLE);
@@ -1327,8 +1324,8 @@
static unsigned int __init hpt366_ata66_check(struct ata_channel *ch)
{
- u8 ata66 = 0;
- u8 regmask = (ch->unit) ? 0x01 : 0x02;
+ u8 ata66;
+ u8 regmask = (ch->unit) ? 0x01 : 0x02;
pci_read_config_byte(ch->pci_dev, 0x5a, &ata66);
#ifdef DEBUG
@@ -1358,7 +1355,7 @@
#ifdef CONFIG_BLK_DEV_IDEDMA
if (ch->dma_base) {
if (hpt_min_rev(dev, 3)) {
- byte reg5ah = 0;
+ u8 reg5ah;
pci_read_config_byte(dev, 0x5a, ®5ah);
if (reg5ah & 0x10) /* interrupt force enable */
pci_write_config_byte(dev, 0x5a, reg5ah & ~0x10);
@@ -1413,14 +1410,12 @@
static void __init hpt366_init_dma(struct ata_channel *ch, unsigned long dmabase)
{
- u8 masterdma = 0;
- u8 slavedma = 0;
- u8 dma_new = 0;
- u8 dma_old = inb(dmabase+2);
- u8 primary = ch->unit ? 0x4b : 0x43;
- u8 secondary = ch->unit ? 0x4f : 0x47;
+ u8 masterdma, slavedma;
+ u8 dma_old = inb(dmabase + 2);
+ u8 dma_new = dma_old;
+ u8 primary = ch->unit ? 0x4b : 0x43;
+ u8 secondary = primary + 4;
- dma_new = dma_old;
pci_read_config_byte(ch->pci_dev, primary, &masterdma);
pci_read_config_byte(ch->pci_dev, secondary, &slavedma);
@@ -1480,5 +1475,5 @@
ata_register_chipset(&chipsets[i]);
}
- return 0;
+ return 0;
}
diff -urN linux-2.5.19/drivers/ide/icside.c linux/drivers/ide/icside.c
--- linux-2.5.19/drivers/ide/icside.c 2002-05-29 20:42:46.000000000 +0200
+++ linux/drivers/ide/icside.c 2002-05-31 18:38:54.000000000 +0200
@@ -232,8 +232,9 @@
* Handle routing of interrupts. This is called before
* we write the command to the drive.
*/
-static void icside_maskproc(struct ata_device *drive, int mask)
+static void icside_maskproc(struct ata_device *drive)
{
+ const int mask = 0;
struct ata_channel *ch = drive->channel;
struct icside_state *state = ch->hw.priv;
unsigned long flags;
@@ -465,12 +466,9 @@
static ide_startstop_t icside_dmaintr(struct ata_device *drive, struct request *rq)
{
int dma_stat;
- byte stat;
dma_stat = icside_dma_stop(drive);
-
- stat = GET_STAT(); /* get drive status */
- if (OK_STAT(stat,DRIVE_READY,drive->bad_wstat|DRQ_STAT)) {
+ if (ata_status(drive, DRIVE_READY, drive->bad_wstat | DRQ_STAT)) {
if (!dma_stat) {
__ide_end_request(drive, rq, 1, rq->nr_sectors);
return ide_stopped;
@@ -478,7 +476,7 @@
printk("%s: dma_intr: bad DMA status (dma_stat=%x)\n",
drive->name, dma_stat);
}
- return ide_error(drive, rq, "dma_intr", stat);
+ return ide_error(drive, rq, "dma_intr", drive->status);
}
static int
@@ -587,7 +585,8 @@
static void icside_dma_timeout(struct ata_device *drive)
{
printk(KERN_ERR "ATA: %s: UDMA timeout occured:", drive->name);
- ide_dump_status(drive, NULL, "UDMA timeout", GET_STAT());
+ ata_status(drive, 0, 0);
+ ide_dump_status(drive, NULL, "UDMA timeout", drive->status);
}
static void icside_irq_lost(struct ata_device *drive)
diff -urN linux-2.5.19/drivers/ide/ide.c linux/drivers/ide/ide.c
--- linux-2.5.19/drivers/ide/ide.c 2002-05-29 20:42:54.000000000 +0200
+++ linux/drivers/ide/ide.c 2002-05-31 19:49:06.000000000 +0200
@@ -258,21 +258,21 @@
static ide_startstop_t atapi_reset_pollfunc(struct ata_device *drive, struct request *__rq)
{
struct ata_channel *ch = drive->channel;
- u8 stat;
- SELECT_DRIVE(ch,drive);
- udelay (10);
+ ata_select(drive, 10);
- if (OK_STAT(stat=GET_STAT(), 0, BUSY_STAT)) {
+ if (ata_status(drive, 0, BUSY_STAT))
printk("%s: ATAPI reset complete\n", drive->name);
- } else {
+ else {
if (time_before(jiffies, ch->poll_timeout)) {
ide_set_handler (drive, atapi_reset_pollfunc, HZ/20, NULL);
+
return ide_started; /* continue polling */
}
ch->poll_timeout = 0; /* end of polling */
- printk("%s: ATAPI reset timed out, status=0x%02x\n", drive->name, stat);
- return do_reset1 (drive, 1); /* do it the old fashioned way */
+ printk("%s: ATAPI reset timed out, status=0x%02x\n", drive->name, drive->status);
+
+ return do_reset1(drive, 1); /* do it the old fashioned way */
}
ch->poll_timeout = 0; /* done polling */
@@ -287,16 +287,18 @@
static ide_startstop_t reset_pollfunc(struct ata_device *drive, struct request *__rq)
{
struct ata_channel *ch = drive->channel;
- u8 stat;
- if (!OK_STAT(stat=GET_STAT(), 0, BUSY_STAT)) {
+ if (!ata_status(drive, 0, BUSY_STAT)) {
if (time_before(jiffies, ch->poll_timeout)) {
ide_set_handler(drive, reset_pollfunc, HZ/20, NULL);
+
return ide_started; /* continue polling */
}
- printk("%s: reset timed out, status=0x%02x\n", ch->name, stat);
+ printk("%s: reset timed out, status=0x%02x\n", ch->name, drive->status);
drive->failures++;
} else {
+ u8 stat;
+
printk("%s: reset: ", ch->name);
if ((stat = GET_ERR()) == 1) {
printk("success\n");
@@ -360,8 +362,7 @@
/* For an ATAPI device, first try an ATAPI SRST. */
if (drive->type != ATA_DISK && !do_not_try_atapi) {
check_crc_errors(drive);
- SELECT_DRIVE(ch, drive);
- udelay (20);
+ ata_select(drive, 20);
OUT_BYTE(WIN_SRST, IDE_COMMAND_REG);
ch->poll_timeout = jiffies + WAIT_WORSTCASE;
ide_set_handler(drive, atapi_reset_pollfunc, HZ/20, NULL);
@@ -430,20 +431,20 @@
*
* Should be called under lock held.
*/
-void ide_end_drive_cmd(struct ata_device *drive, struct request *rq, u8 stat, u8 err)
+void ide_end_drive_cmd(struct ata_device *drive, struct request *rq, u8 err)
{
if (rq->flags & REQ_DRIVE_CMD) {
u8 *args = rq->buffer;
- rq->errors = !OK_STAT(stat, READY_STAT, BAD_STAT);
+ rq->errors = !ata_status(drive, READY_STAT, BAD_STAT);
if (args) {
- args[0] = stat;
+ args[0] = drive->status;
args[1] = err;
args[2] = IN_BYTE(IDE_NSECTOR_REG);
}
} else if (rq->flags & REQ_DRIVE_ACB) {
struct ata_taskfile *args = rq->special;
- rq->errors = !OK_STAT(stat, READY_STAT, BAD_STAT);
+ rq->errors = !ata_status(drive, READY_STAT, BAD_STAT);
if (args) {
args->taskfile.feature = err;
args->taskfile.sector_count = IN_BYTE(IDE_NSECTOR_REG);
@@ -451,7 +452,7 @@
args->taskfile.low_cylinder = IN_BYTE(IDE_LCYL_REG);
args->taskfile.high_cylinder = IN_BYTE(IDE_HCYL_REG);
args->taskfile.device_head = IN_BYTE(IDE_SELECT_REG);
- args->taskfile.command = stat;
+ args->taskfile.command = drive->status;
if ((drive->id->command_set_2 & 0x0400) &&
(drive->id->cfs_enable_2 & 0x0400) &&
(drive->addressing == 1)) {
@@ -641,7 +642,7 @@
/* retry only "normal" I/O: */
if (!(rq->flags & REQ_CMD)) {
rq->errors = 1;
- ide_end_drive_cmd(drive, rq, stat, err);
+ ide_end_drive_cmd(drive, rq, err);
return ide_stopped;
}
@@ -664,8 +665,8 @@
if ((stat & DRQ_STAT) && rq_data_dir(rq) == READ)
try_to_flush_leftover_data(drive);
}
- if (GET_STAT() & (BUSY_STAT|DRQ_STAT))
- OUT_BYTE(WIN_IDLEIMMEDIATE,IDE_COMMAND_REG); /* force an abort */
+ if (!ata_status(drive, 0, BUSY_STAT|DRQ_STAT))
+ OUT_BYTE(WIN_IDLEIMMEDIATE, IDE_COMMAND_REG); /* force an abort */
if (rq->errors >= ERROR_MAX) {
if (ata_ops(drive) && ata_ops(drive)->end_request)
@@ -688,20 +689,19 @@
static ide_startstop_t drive_cmd_intr(struct ata_device *drive, struct request *rq)
{
u8 *args = rq->buffer;
- u8 stat = GET_STAT();
int retries = 10;
ide__sti(); /* local CPU only */
- if ((stat & DRQ_STAT) && args && args[3]) {
+ if (!ata_status(drive, 0, DRQ_STAT) && args && args[3]) {
ata_read(drive, &args[4], args[3] * SECTOR_WORDS);
- while (((stat = GET_STAT()) & BUSY_STAT) && retries--)
+ while (!ata_status(drive, 0, BUSY_STAT) && retries--)
udelay(100);
}
- if (!OK_STAT(stat, READY_STAT, BAD_STAT))
- return ide_error(drive, rq, "drive_cmd", stat); /* already calls ide_end_drive_cmd */
- ide_end_drive_cmd(drive, rq, stat, GET_ERR());
+ if (!ata_status(drive, READY_STAT, BAD_STAT))
+ return ide_error(drive, rq, "drive_cmd", drive->status); /* already calls ide_end_drive_cmd */
+ ide_end_drive_cmd(drive, rq, GET_ERR());
return ide_stopped;
}
@@ -714,7 +714,7 @@
ide_set_handler(drive, drive_cmd_intr, WAIT_CMD, NULL);
if (IDE_CONTROL_REG)
OUT_BYTE(drive->ctl, IDE_CONTROL_REG); /* clear nIEN */
- SELECT_MASK(drive->channel, drive, 0);
+ ata_mask(drive);
OUT_BYTE(nsect, IDE_NSECTOR_REG);
OUT_BYTE(cmd, IDE_COMMAND_REG);
}
@@ -735,21 +735,21 @@
struct ata_device *drive, struct request *rq,
byte good, byte bad, unsigned long timeout)
{
- u8 stat;
int i;
/* bail early if we've exceeded max_failures */
if (drive->max_failures && (drive->failures > drive->max_failures)) {
*startstop = ide_stopped;
+
return 1;
}
udelay(1); /* spec allows drive 400ns to assert "BUSY" */
- if ((stat = GET_STAT()) & BUSY_STAT) {
+ if (!ata_status(drive, 0, BUSY_STAT)) {
timeout += jiffies;
- while ((stat = GET_STAT()) & BUSY_STAT) {
+ while (!ata_status(drive, 0, BUSY_STAT)) {
if (time_after(jiffies, timeout)) {
- *startstop = ide_error(drive, rq, "status timeout", stat);
+ *startstop = ide_error(drive, rq, "status timeout", drive->status);
return 1;
}
}
@@ -763,10 +763,10 @@
*/
for (i = 0; i < 10; i++) {
udelay(1);
- if (OK_STAT((stat = GET_STAT()), good, bad))
+ if (ata_status(drive, good, bad))
return 0;
}
- *startstop = ide_error(drive, rq, "status error", stat);
+ *startstop = ide_error(drive, rq, "status error", drive->status);
return 1;
}
@@ -813,7 +813,7 @@
{
ide_startstop_t res;
- SELECT_DRIVE(ch, drive);
+ ata_select(drive, 0);
if (ide_wait_stat(&res, drive, rq, drive->ready_stat,
BUSY_STAT|DRQ_STAT, WAIT_READY)) {
printk(KERN_WARNING "%s: drive not ready for command\n", drive->name);
@@ -905,7 +905,7 @@
#ifdef DEBUG
printk("%s: DRIVE_CMD (null)\n", drive->name);
#endif
- ide_end_drive_cmd(drive, rq, GET_STAT(), GET_ERR());
+ ide_end_drive_cmd(drive, rq, GET_ERR());
return ide_stopped;
}
@@ -1279,7 +1279,7 @@
startstop = ide_stopped;
dma_timeout_retry(drive, drive->rq);
} else
- startstop = ide_error(drive, drive->rq, "irq timeout", GET_STAT());
+ startstop = ide_error(drive, drive->rq, "irq timeout", drive->status);
}
enable_irq(ch->irq);
@@ -1323,8 +1323,8 @@
int i;
for (i = 0; i < MAX_HWIFS; ++i) {
- u8 stat;
struct ata_channel *ch = &ide_hwifs[i];
+ struct ata_device *drive;
if (!ch->present)
continue;
@@ -1332,8 +1332,10 @@
if (ch->irq != irq)
continue;
- stat = IN_BYTE(ch->io_ports[IDE_STATUS_OFFSET]);
- if (!OK_STAT(stat, READY_STAT, BAD_STAT)) {
+ /* FIXME: this is a bit weak */
+ drive = &ch->drives[0];
+
+ if (!ata_status(drive, READY_STAT, BAD_STAT)) {
/* Try to not flood the console with msgs */
static unsigned long last_msgtime;
static int count;
@@ -1342,7 +1344,7 @@
if (time_after(jiffies, last_msgtime + HZ)) {
last_msgtime = jiffies;
printk("%s: unexpected interrupt, status=0x%02x, count=%d\n",
- ch->name, stat, count);
+ ch->name, drive->status, count);
}
}
}
diff -urN linux-2.5.19/drivers/ide/ide-cd.c linux/drivers/ide/ide-cd.c
--- linux-2.5.19/drivers/ide/ide-cd.c 2002-05-29 20:42:53.000000000 +0200
+++ linux/drivers/ide/ide-cd.c 2002-05-31 18:41:18.000000000 +0200
@@ -565,14 +565,14 @@
static int cdrom_decode_status(ide_startstop_t *startstop, struct ata_device *drive, struct request *rq,
int good_stat, int *stat_ret)
{
- int stat, err, sense_key;
+ int err, sense_key;
struct packet_command *pc;
+ int ok;
/* Check for errors. */
- stat = GET_STAT();
- *stat_ret = stat;
-
- if (OK_STAT (stat, good_stat, BAD_R_STAT))
+ ok = ata_status(drive, good_stat, BAD_R_STAT);
+ *stat_ret = drive->status;
+ if (ok)
return 0;
/* Get the IDE error register. */
@@ -594,7 +594,7 @@
pc = (struct packet_command *) rq->special;
pc->stat = 1;
cdrom_end_request(drive, rq, 1);
- *startstop = ide_error (drive, rq, "request sense failure", stat);
+ *startstop = ide_error(drive, rq, "request sense failure", drive->status);
return 1;
} else if (rq->flags & (REQ_PC | REQ_BLOCK_PC)) {
@@ -614,7 +614,7 @@
return 0;
} else if (!pc->quiet) {
/* Otherwise, print an error. */
- ide_dump_status(drive, rq, "packet command error", stat);
+ ide_dump_status(drive, rq, "packet command error", drive->status);
}
/* Set the error flag and complete the request.
@@ -625,7 +625,7 @@
the semaphore from the packet command request to the request
sense request. */
- if ((stat & ERR_STAT) != 0) {
+ if (drive->status & ERR_STAT) {
wait = rq->waiting;
rq->waiting = NULL;
}
@@ -637,7 +637,7 @@
* Think hard about how to get rid of it...
*/
- if ((stat & ERR_STAT) != 0)
+ if (drive->status & ERR_STAT)
cdrom_queue_request_sense(drive, wait, pc->sense, pc);
} else if (rq->flags & REQ_CMD) {
/* Handle errors from READ and WRITE requests. */
@@ -662,18 +662,18 @@
sense_key == DATA_PROTECT) {
/* No point in retrying after an illegal
request or data protect error.*/
- ide_dump_status(drive, rq, "command error", stat);
+ ide_dump_status(drive, rq, "command error", drive->status);
cdrom_end_request(drive, rq, 0);
} else if (sense_key == MEDIUM_ERROR) {
/* No point in re-trying a zillion times on a bad
* sector. The error is not correctable at all.
*/
- ide_dump_status(drive, rq, "media error (bad sector)", stat);
+ ide_dump_status(drive, rq, "media error (bad sector)", drive->status);
cdrom_end_request(drive, rq, 0);
} else if ((err & ~ABRT_ERR) != 0) {
/* Go to the default handler
for other errors. */
- *startstop = ide_error(drive, rq, __FUNCTION__, stat);
+ *startstop = ide_error(drive, rq, __FUNCTION__, drive->status);
return 1;
} else if ((++rq->errors > ERROR_MAX)) {
/* We've racked up too many retries. Abort. */
@@ -682,7 +682,7 @@
/* If we got a CHECK_CONDITION status,
queue a request sense command. */
- if ((stat & ERR_STAT) != 0)
+ if (drive->status & ERR_STAT)
cdrom_queue_request_sense(drive, NULL, NULL, NULL);
} else
blk_dump_rq_flags(rq, "ide-cd bad flags");
@@ -880,7 +880,7 @@
/* Some drives (ASUS) seem to tell us that status
* info is available. just get it and ignore.
*/
- GET_STAT();
+ ata_status(drive, 0, 0);
return 0;
} else {
/* Drive wants a command packet, or invalid ireason... */
@@ -1619,9 +1619,8 @@
if (rq->flags & REQ_CMD) {
if (CDROM_CONFIG_FLAGS(drive)->seeking) {
unsigned long elpased = jiffies - info->start_seek;
- int stat = GET_STAT();
- if ((stat & SEEK_STAT) != SEEK_STAT) {
+ if (!ata_status(drive, SEEK_STAT, 0)) {
if (elpased < IDECD_SEEK_TIMEOUT) {
ide_stall_queue(drive, IDECD_SEEK_TIMER);
return ide_stopped;
diff -urN linux-2.5.19/drivers/ide/ide-floppy.c linux/drivers/ide/ide-floppy.c
--- linux-2.5.19/drivers/ide/ide-floppy.c 2002-05-31 19:30:47.000000000 +0200
+++ linux/drivers/ide/ide-floppy.c 2002-05-31 18:52:48.000000000 +0200
@@ -637,7 +637,7 @@
return 0;
}
rq->errors = error;
- ide_end_drive_cmd (drive, rq, 0, 0);
+ ide_end_drive_cmd (drive, rq, 0);
return 0;
}
@@ -844,7 +844,8 @@
}
#endif
- status.all = GET_STAT(); /* Clear the interrupt */
+ ata_status(drive, 0, 0);
+ status.all = drive->status; /* Clear the interrupt */
if (!status.b.drq) { /* No more interrupts */
#if IDEFLOPPY_DEBUG_LOG
@@ -1588,7 +1589,8 @@
__save_flags(flags);
__cli();
- status.all=GET_STAT();
+ ata_status(drive, 0, 0);
+ status.all = drive->status;
__restore_flags(flags);
progress_indication= !status.b.dsc ? 0:0x10000;
diff -urN linux-2.5.19/drivers/ide/ide-pmac.c linux/drivers/ide/ide-pmac.c
--- linux-2.5.19/drivers/ide/ide-pmac.c 2002-05-29 20:42:57.000000000 +0200
+++ linux/drivers/ide/ide-pmac.c 2002-05-31 19:53:24.000000000 +0200
@@ -395,21 +395,21 @@
{
/* Timeout bumped for some powerbooks */
int timeout = 2000;
- byte stat;
- while(--timeout) {
- stat = GET_STAT();
- if(!(stat & BUSY_STAT)) {
+ while (--timeout) {
+ if(ata_status(drive, 0, BUSY_STAT)) {
if (drive->ready_stat == 0)
break;
- else if((stat & drive->ready_stat) || (stat & ERR_STAT))
+ else if((drive->status & drive->ready_stat)
+ || (drive->status & ERR_STAT))
break;
}
mdelay(1);
}
- if((stat & ERR_STAT) || timeout <= 0) {
- if (stat & ERR_STAT) {
- printk(KERN_ERR "ide_pmac: wait_for_ready, error status: %x\n", stat);
+ if((drive->status & ERR_STAT) || timeout <= 0) {
+ if (drive->status & ERR_STAT) {
+ printk(KERN_ERR "ide_pmac: wait_for_ready, error status: %x\n",
+ drive->status);
}
return 1;
}
@@ -417,7 +417,7 @@
}
static int __pmac
-pmac_ide_do_setfeature(struct ata_device *drive, byte command)
+pmac_ide_do_setfeature(struct ata_device *drive, u8 command)
{
int result = 1;
unsigned long flags;
@@ -425,11 +425,11 @@
disable_irq(hwif->irq); /* disable_irq_nosync ?? */
udelay(1);
- SELECT_DRIVE(drive->channel, drive);
- SELECT_MASK(drive->channel, drive, 0);
+ ata_select(drive, 0);
+ ata_mask(drive);
udelay(1);
- (void)GET_STAT(); /* Get rid of pending error state */
- if(wait_for_ready(drive)) {
+ ata_status(drive, 0, 0); /* Get rid of pending error state */
+ if (wait_for_ready(drive)) {
printk(KERN_ERR "pmac_ide_do_setfeature disk not ready before SET_FEATURE!\n");
goto out;
}
@@ -447,7 +447,7 @@
if (result)
printk(KERN_ERR "pmac_ide_do_setfeature disk not ready after SET_FEATURE !\n");
out:
- SELECT_MASK(drive->channel, drive, 0);
+ ata_mask(drive);
if (result == 0) {
drive->id->dma_ultra &= ~0xFF00;
drive->id->dma_mword &= ~0x0F00;
diff -urN linux-2.5.19/drivers/ide/ide-tape.c linux/drivers/ide/ide-tape.c
--- linux-2.5.19/drivers/ide/ide-tape.c 2002-05-31 19:30:47.000000000 +0200
+++ linux/drivers/ide/ide-tape.c 2002-05-31 18:55:07.000000000 +0200
@@ -1864,7 +1864,7 @@
idetape_increase_max_pipeline_stages (drive);
}
}
- ide_end_drive_cmd(drive, rq, 0, 0);
+ ide_end_drive_cmd(drive, rq, 0);
if (remove_stage)
idetape_remove_stage_head (drive);
if (tape->active_data_request == NULL)
@@ -1991,7 +1991,8 @@
printk (KERN_INFO "ide-tape: Reached idetape_pc_intr interrupt handler\n");
#endif
- status.all = GET_STAT(); /* Clear the interrupt */
+ ata_status(drive, 0, 0);
+ status.all = drive->status; /* Clear the interrupt */
#ifdef CONFIG_BLK_DEV_IDEDMA
if (test_bit (PC_DMA_IN_PROGRESS, &pc->flags)) {
@@ -2415,7 +2416,8 @@
if (tape->onstream)
printk(KERN_INFO "ide-tape: bug: onstream, media_access_finished\n");
- status.all = GET_STAT();
+ ata_status(drive, 0, 0);
+ status.all = drive->status;
if (status.b.dsc) {
if (status.b.check) { /* Error detected */
printk (KERN_ERR "ide-tape: %s: I/O error, ",tape->name);
@@ -2603,10 +2605,11 @@
tape->postponed_rq = NULL;
/*
- * If the tape is still busy, postpone our request and service
- * the other device meanwhile.
+ * If the tape is still busy, postpone our request and service
+ * the other device meanwhile.
*/
- status.all = GET_STAT();
+ ata_status(drive, 0, 0);
+ status.all = drive->status;
/*
* The OnStream tape drive doesn't support DSC. Assume
diff -urN linux-2.5.19/drivers/ide/ide-taskfile.c linux/drivers/ide/ide-taskfile.c
--- linux-2.5.19/drivers/ide/ide-taskfile.c 2002-05-29 20:42:55.000000000 +0200
+++ linux/drivers/ide/ide-taskfile.c 2002-05-31 18:51:26.000000000 +0200
@@ -1,4 +1,5 @@
-/*
+/**** vi:set ts=8 sts=8 sw=8:************************************************
+ *
* Copyright (C) 2002 Marcin Dalecki <martin@dalecki.de>
* Copyright (C) 2000 Michael Cornwell <cornwell@acm.org>
* Copyright (C) 2000 Andre Hedrick <andre@linux-ide.org>
@@ -165,14 +166,15 @@
*/
int drive_is_ready(struct ata_device *drive)
{
- byte stat = 0;
if (drive->waiting_for_dma)
return udma_irq_status(drive);
+
#if 0
/* need to guarantee 400ns since last command was issued */
udelay(1);
#endif
+ /* FIXME: promote this to the general status read method perhaps */
#ifdef CONFIG_IDEPCI_SHARE_IRQ
/*
* We do a passive status test under shared PCI interrupts on
@@ -181,12 +183,12 @@
* about possible isa-pnp and pci-pnp issues yet.
*/
if (IDE_CONTROL_REG)
- stat = GET_ALTSTAT();
+ drive->status = GET_ALTSTAT();
else
#endif
- stat = GET_STAT(); /* Note: this may clear a pending IRQ!! */
+ ata_status(drive, 0, 0); /* Note: this may clear a pending IRQ!! */
- if (stat & BUSY_STAT)
+ if (drive->status & BUSY_STAT)
return 0; /* drive busy: definitely not interrupting */
return 1; /* drive ready: *might* be interrupting */
@@ -228,34 +230,36 @@
static ide_startstop_t task_mulout_intr(struct ata_device *drive, struct request *rq)
{
- u8 stat = GET_STAT();
+ int ok;
int mcount = drive->mult_count;
ide_startstop_t startstop;
+
/*
+ * FIXME: the drive->status checks here seem to be messy.
+ *
* (ks/hs): Handle last IRQ on multi-sector transfer,
* occurs after all data was sent in this chunk
*/
- if (!rq->nr_sectors) {
- if (stat & (ERR_STAT|DRQ_STAT)) {
- startstop = ide_error(drive, rq, "task_mulout_intr", stat);
+
+ ok = ata_status(drive, DATA_READY, BAD_R_STAT);
+
+ if (!ok || !rq->nr_sectors) {
+ if (drive->status & (ERR_STAT | DRQ_STAT)) {
+ startstop = ide_error(drive, rq, __FUNCTION__, drive->status);
return startstop;
}
+ }
+ if (!rq->nr_sectors) {
__ide_end_request(drive, rq, 1, rq->hard_nr_sectors);
rq->bio = NULL;
return ide_stopped;
}
- if (!OK_STAT(stat, DATA_READY, BAD_R_STAT)) {
- if (stat & (ERR_STAT | DRQ_STAT)) {
- startstop = ide_error(drive, rq, "task_mulout_intr", stat);
-
- return startstop;
- }
-
+ if (!ok) {
/* no data yet, so wait for another interrupt */
if (!drive->channel->handler)
ide_set_handler(drive, task_mulout_intr, WAIT_CMD, NULL);
@@ -330,7 +334,7 @@
if (args->handler != task_mulout_intr) {
if (IDE_CONTROL_REG)
OUT_BYTE(drive->ctl, IDE_CONTROL_REG); /* clear nIEN */
- SELECT_MASK(drive->channel, drive, 0);
+ ata_mask(drive);
}
if ((id->command_set_2 & 0x0400) &&
@@ -407,10 +411,9 @@
*/
ide_startstop_t recal_intr(struct ata_device *drive, struct request *rq)
{
- u8 stat;
+ if (!ata_status(drive, READY_STAT, BAD_STAT))
+ return ide_error(drive, rq, "recal_intr", drive->status);
- if (!OK_STAT(stat = GET_STAT(),READY_STAT,BAD_STAT))
- return ide_error(drive, rq, "recal_intr", stat);
return ide_stopped;
}
@@ -419,19 +422,18 @@
*/
ide_startstop_t task_no_data_intr(struct ata_device *drive, struct request *rq)
{
- u8 stat;
struct ata_taskfile *args = rq->special;
ide__sti(); /* local CPU only */
- if (!OK_STAT(stat = GET_STAT(), READY_STAT, BAD_STAT)) {
+ if (!ata_status(drive, READY_STAT, BAD_STAT)) {
/* Keep quiet for NOP because it is expected to fail. */
if (args && args->taskfile.command != WIN_NOP)
- return ide_error(drive, rq, "task_no_data_intr", stat);
+ return ide_error(drive, rq, "task_no_data_intr", drive->status);
}
if (args)
- ide_end_drive_cmd(drive, rq, stat, GET_ERR());
+ ide_end_drive_cmd(drive, rq, GET_ERR());
return ide_stopped;
}
@@ -441,42 +443,41 @@
*/
static ide_startstop_t task_in_intr(struct ata_device *drive, struct request *rq)
{
- u8 stat = GET_STAT();
char *pBuf = NULL;
unsigned long flags;
- if (!OK_STAT(stat,DATA_READY,BAD_R_STAT)) {
- if (stat & (ERR_STAT|DRQ_STAT)) {
- return ide_error(drive, rq, "task_in_intr", stat);
- }
- if (!(stat & BUSY_STAT)) {
+ if (!ata_status(drive, DATA_READY, BAD_R_STAT)) {
+ if (drive->status & (ERR_STAT|DRQ_STAT))
+ return ide_error(drive, rq, __FUNCTION__, drive->status);
+
+ if (!(drive->status & BUSY_STAT)) {
DTF("task_in_intr to Soon wait for next interrupt\n");
ide_set_handler(drive, task_in_intr, WAIT_CMD, NULL);
+
return ide_started;
}
}
- DTF("stat: %02x\n", stat);
+ DTF("stat: %02x\n", drive->status);
pBuf = ide_map_rq(rq, &flags);
DTF("Read: %p, rq->current_nr_sectors: %d\n", pBuf, (int) rq->current_nr_sectors);
ata_read(drive, pBuf, SECTOR_WORDS);
ide_unmap_rq(rq, pBuf, &flags);
- /*
- * first segment of the request is complete. note that this does not
- * necessarily mean that the entire request is done!! this is only
- * true if ide_end_request() returns 0.
+ /* First segment of the request is complete. note that this does not
+ * necessarily mean that the entire request is done!! this is only true
+ * if ide_end_request() returns 0.
*/
+
if (--rq->current_nr_sectors <= 0) {
- DTF("Request Ended stat: %02x\n", GET_STAT());
+ DTF("Request Ended stat: %02x\n", drive->status);
if (!ide_end_request(drive, rq, 1))
return ide_stopped;
}
- /*
- * still data left to transfer
- */
+ /* still data left to transfer */
ide_set_handler(drive, task_in_intr, WAIT_CMD, NULL);
+
return ide_started;
}
@@ -511,18 +512,17 @@
*/
static ide_startstop_t task_out_intr(struct ata_device *drive, struct request *rq)
{
- u8 stat = GET_STAT();
char *pBuf = NULL;
unsigned long flags;
- if (!OK_STAT(stat,DRIVE_READY,drive->bad_wstat))
- return ide_error(drive, rq, "task_out_intr", stat);
+ if (!ata_status(drive, DRIVE_READY, drive->bad_wstat))
+ return ide_error(drive, rq, __FUNCTION__, drive->status);
if (!rq->current_nr_sectors)
if (!ide_end_request(drive, rq, 1))
return ide_stopped;
- if ((rq->nr_sectors == 1) != (stat & DRQ_STAT)) {
+ if ((rq->nr_sectors == 1) != (drive->status & DRQ_STAT)) {
pBuf = ide_map_rq(rq, &flags);
DTF("write: %p, rq->current_nr_sectors: %d\n", pBuf, (int) rq->current_nr_sectors);
@@ -533,6 +533,7 @@
}
ide_set_handler(drive, task_out_intr, WAIT_CMD, NULL);
+
return ide_started;
}
@@ -541,14 +542,13 @@
*/
static ide_startstop_t task_mulin_intr(struct ata_device *drive, struct request *rq)
{
- u8 stat;
char *pBuf = NULL;
unsigned int msect, nsect;
unsigned long flags;
- if (!OK_STAT(stat = GET_STAT(),DATA_READY,BAD_R_STAT)) {
- if (stat & (ERR_STAT|DRQ_STAT)) {
- return ide_error(drive, rq, "task_mulin_intr", stat);
+ if (!ata_status(drive, DATA_READY, BAD_R_STAT)) {
+ if (drive->status & (ERR_STAT|DRQ_STAT)) {
+ return ide_error(drive, rq, __FUNCTION__, drive->status);
}
/* no data yet, so wait for another interrupt */
ide_set_handler(drive, task_mulin_intr, WAIT_CMD, NULL);
diff -urN linux-2.5.19/drivers/ide/main.c linux/drivers/ide/main.c
--- linux-2.5.19/drivers/ide/main.c 2002-05-29 20:42:43.000000000 +0200
+++ linux/drivers/ide/main.c 2002-05-31 21:04:44.000000000 +0200
@@ -1293,6 +1293,7 @@
printk(KERN_INFO "ATA/ATAPI device driver v" VERSION "\n");
ide_devfs_handle = devfs_mk_dir(NULL, "ata", NULL);
+ devfs_mk_symlink(NULL, "ide", DEVFS_FL_DEFAULT, "ata", NULL, NULL);
/*
* Because most of the ATA adapters represent the timings in unit of
diff -urN linux-2.5.19/drivers/ide/Makefile linux/drivers/ide/Makefile
--- linux-2.5.19/drivers/ide/Makefile 2002-05-29 20:42:56.000000000 +0200
+++ linux/drivers/ide/Makefile 2002-05-31 13:51:23.000000000 +0200
@@ -8,7 +8,7 @@
# In the future, some of these should be built conditionally.
#
-export-objs := ide-taskfile.o main.o ide.o probe.o quirks.o pcidma.o tcq.o \
+export-objs := device.o ide-taskfile.o main.o ide.o probe.o quirks.o pcidma.o tcq.o \
atapi.o ataraid.o
obj-$(CONFIG_BLK_DEV_HD) += hd.o
@@ -68,7 +68,7 @@
obj-$(CONFIG_BLK_DEV_ATARAID_PDC) += pdcraid.o
obj-$(CONFIG_BLK_DEV_ATARAID_HPT) += hptraid.o
-ide-mod-objs := ide-taskfile.o main.o ide.o probe.o \
+ide-mod-objs := device.o ide-taskfile.o main.o ide.o probe.o \
ioctl.o atapi.o ata-timing.o $(ide-obj-y)
include $(TOPDIR)/Rules.make
diff -urN linux-2.5.19/drivers/ide/ns87415.c linux/drivers/ide/ns87415.c
--- linux-2.5.19/drivers/ide/ns87415.c 2002-05-29 20:42:52.000000000 +0200
+++ linux/drivers/ide/ns87415.c 2002-05-31 14:20:47.000000000 +0200
@@ -195,7 +195,7 @@
#ifdef __sparc_v9__
/*
* XXX: Reset the device, if we don't it will not respond
- * to SELECT_DRIVE() properly during first probe_hwif().
+ * to select properly during first probe.
*/
timeout = 10000;
outb(12, hwif->io_ports[IDE_CONTROL_OFFSET]);
diff -urN linux-2.5.19/drivers/ide/pcidma.c linux/drivers/ide/pcidma.c
--- linux-2.5.19/drivers/ide/pcidma.c 2002-05-29 20:42:48.000000000 +0200
+++ linux/drivers/ide/pcidma.c 2002-05-31 18:45:20.000000000 +0200
@@ -39,10 +39,9 @@
*/
ide_startstop_t ide_dma_intr(struct ata_device *drive, struct request *rq)
{
- u8 stat, dma_stat;
-
+ u8 dma_stat;
dma_stat = udma_stop(drive);
- if (OK_STAT(stat = GET_STAT(),DRIVE_READY,drive->bad_wstat|DRQ_STAT)) {
+ if (ata_status(drive, DRIVE_READY, drive->bad_wstat | DRQ_STAT)) {
if (!dma_stat) {
__ide_end_request(drive, rq, 1, rq->nr_sectors);
return ide_stopped;
@@ -50,7 +49,7 @@
printk(KERN_ERR "%s: dma_intr: bad DMA status (dma_stat=%x)\n",
drive->name, dma_stat);
}
- return ide_error(drive, rq, "dma_intr", stat);
+ return ide_error(drive, rq, "dma_intr", drive->status);
}
/*
@@ -130,8 +129,8 @@
#endif
if (dma_stat & 2) { /* ERROR */
- u8 stat = GET_STAT();
- return ide_error(drive, rq, "dma_timer_expiry", stat);
+ ata_status(drive, 0, 0);
+ return ide_error(drive, rq, "dma_timer_expiry", drive->status);
}
if (dma_stat & 1) /* DMAing */
return WAIT_CMD;
diff -urN linux-2.5.19/drivers/ide/pdc4030.c linux/drivers/ide/pdc4030.c
--- linux-2.5.19/drivers/ide/pdc4030.c 2002-05-29 20:42:49.000000000 +0200
+++ linux/drivers/ide/pdc4030.c 2002-05-31 19:55:22.000000000 +0200
@@ -373,15 +373,13 @@
*/
static ide_startstop_t promise_read_intr(struct ata_device *drive, struct request *rq)
{
- u8 stat;
int total_remaining;
unsigned int sectors_left, sectors_avail, nsect;
unsigned long flags;
char *to;
- if (!OK_STAT(stat=GET_STAT(),DATA_READY,BAD_R_STAT)) {
- return ide_error(drive, rq, "promise_read_intr", stat);
- }
+ if (!ata_status(drive, DATA_READY, BAD_R_STAT))
+ return ide_error(drive, rq, "promise_read_intr", drive->status);
read_again:
do {
@@ -427,10 +425,10 @@
if (total_remaining > 0) {
if (sectors_avail)
goto read_next;
- stat = GET_STAT();
- if (stat & DRQ_STAT)
+ ata_status(drive, 0, 0);
+ if (drive->status & DRQ_STAT)
goto read_again;
- if (stat & BUSY_STAT) {
+ if (drive->status & BUSY_STAT) {
ide_set_handler(drive, promise_read_intr, WAIT_CMD, NULL);
#ifdef DEBUG_READ
printk(KERN_DEBUG "%s: promise_read: waiting for"
@@ -440,7 +438,7 @@
}
printk(KERN_ERR "%s: Eeek! promise_read_intr: sectors left "
"!DRQ !BUSY\n", drive->name);
- return ide_error(drive, rq, "promise read intr", stat);
+ return ide_error(drive, rq, "promise read intr", drive->status);
}
return ide_stopped;
}
@@ -457,7 +455,7 @@
{
struct ata_channel *ch = drive->channel;
- if (GET_STAT() & BUSY_STAT) {
+ if (!ata_status(drive, 0, BUSY_STAT)) {
if (time_before(jiffies, ch->poll_timeout)) {
ide_set_handler(drive, promise_complete_pollfunc, HZ/100, NULL);
return ide_started; /* continue polling... */
@@ -465,7 +463,7 @@
ch->poll_timeout = 0;
printk(KERN_ERR "%s: completion timeout - still busy!\n",
drive->name);
- return ide_error(drive, rq, "busy timeout", GET_STAT());
+ return ide_error(drive, rq, "busy timeout", drive->status);
}
ch->poll_timeout = 0;
@@ -543,7 +541,8 @@
}
ch->poll_timeout = 0;
printk(KERN_ERR "%s: write timed out!\n",drive->name);
- return ide_error(drive, rq, "write timeout", GET_STAT());
+ ata_status(drive, 0, 0);
+ return ide_error(drive, rq, "write timeout", drive->status);
}
/*
@@ -554,7 +553,7 @@
ide_set_handler(drive, promise_complete_pollfunc, HZ/100, NULL);
#ifdef DEBUG_WRITE
printk(KERN_DEBUG "%s: Done last 4 sectors - status = %02x\n",
- drive->name, GET_STAT());
+ drive->name, drive->status);
#endif
return ide_started;
}
@@ -597,7 +596,7 @@
ide_set_handler(drive, promise_complete_pollfunc, HZ/100, NULL);
#ifdef DEBUG_WRITE
printk(KERN_DEBUG "%s: promise_write: <= 4 sectors, "
- "status = %02x\n", drive->name, GET_STAT());
+ "status = %02x\n", drive->name, drive->status);
#endif
return ide_started;
}
@@ -612,7 +611,6 @@
{
struct hd_drive_task_hdr *taskfile = &(args->taskfile);
unsigned long timeout;
- byte stat;
/* Check that it's a regular command. If not, bomb out early. */
if (!(rq->flags & REQ_CMD)) {
@@ -623,7 +621,7 @@
if (IDE_CONTROL_REG)
outb(drive->ctl, IDE_CONTROL_REG); /* clear nIEN */
- SELECT_MASK(drive->channel, drive, 0);
+ ata_mask(drive);
outb(taskfile->feature, IDE_FEATURE_REG);
outb(taskfile->sector_count, IDE_NSECTOR_REG);
@@ -649,8 +647,7 @@
*/
timeout = jiffies + HZ/20; /* 50ms wait */
do {
- stat=GET_STAT();
- if (stat & DRQ_STAT) {
+ if (!ata_status(drive, 0, DRQ_STAT)) {
udelay(1);
return promise_read_intr(drive, rq);
}
diff -urN linux-2.5.19/drivers/ide/probe.c linux/drivers/ide/probe.c
--- linux-2.5.19/drivers/ide/probe.c 2002-05-31 19:30:47.000000000 +0200
+++ linux/drivers/ide/probe.c 2002-05-31 20:56:53.000000000 +0200
@@ -295,11 +295,10 @@
struct ata_channel *hwif = drive->channel;
int i;
int error = 1;
- u8 stat;
#if defined(CONFIG_BLK_DEV_IDEDMA) && !defined(__CRIS__)
u8 unit = (drive->select.b.unit & 0x01);
- outb(inb(hwif->dma_base+2) & ~(1<<(5+unit)), hwif->dma_base+2);
+ outb(inb(hwif->dma_base + 2) & ~(1 << (5 + unit)), hwif->dma_base + 2);
#endif
/*
@@ -312,8 +311,8 @@
*/
disable_irq(hwif->irq); /* disable_irq_nosync ?? */
udelay(1);
- SELECT_DRIVE(drive->channel, drive);
- SELECT_MASK(drive->channel, drive, 0);
+ ata_select(drive, 0);
+ ata_mask(drive);
udelay(1);
if (IDE_CONTROL_REG)
OUT_BYTE(drive->ctl | 2, IDE_CONTROL_REG);
@@ -327,12 +326,12 @@
/*
* Wait for drive to become non-BUSY
*/
- if ((stat = GET_STAT()) & BUSY_STAT) {
+ if (!ata_status(drive, 0, BUSY_STAT)) {
unsigned long flags, timeout;
__save_flags(flags); /* local CPU only */
ide__sti(); /* local CPU only -- for jiffies */
timeout = jiffies + WAIT_CMD;
- while ((stat = GET_STAT()) & BUSY_STAT) {
+ while (!ata_status(drive, 0, BUSY_STAT)) {
if (time_after(jiffies, timeout))
break;
}
@@ -348,18 +347,18 @@
*/
for (i = 0; i < 10; i++) {
udelay(1);
- if (OK_STAT((stat = GET_STAT()), DRIVE_READY, BUSY_STAT|DRQ_STAT|ERR_STAT)) {
+ if (ata_status(drive, DRIVE_READY, BUSY_STAT | DRQ_STAT | ERR_STAT)) {
error = 0;
break;
}
}
- SELECT_MASK(drive->channel, drive, 0);
+ ata_mask(drive);
enable_irq(hwif->irq);
if (error) {
- ide_dump_status(drive, NULL, "set_drive_speed_status", stat);
+ ide_dump_status(drive, NULL, "set_drive_speed_status", drive->status);
return error;
}
@@ -623,22 +622,23 @@
mdelay(50); /* wait for IRQ and DRQ_STAT */
- if (OK_STAT(GET_STAT(),DRQ_STAT,BAD_R_STAT)) {
+ if (ata_status(drive, DRQ_STAT, BAD_R_STAT)) {
unsigned long flags;
- __save_flags(flags); /* local CPU only */
- __cli(); /* local CPU only; some systems need this */
- do_identify(drive, cmd); /* drive returned ID */
- rc = 0; /* drive responded with ID */
- (void) GET_STAT(); /* clear drive IRQ */
- __restore_flags(flags); /* local CPU only */
+ __save_flags(flags); /* local CPU only */
+ __cli(); /* local CPU only; some systems need this */
+ do_identify(drive, cmd); /* drive returned ID */
+ rc = 0; /* drive responded with ID */
+ ata_status(drive, 0, 0); /* clear drive IRQ */
+ __restore_flags(flags); /* local CPU only */
} else
rc = 2; /* drive refused ID */
out:
if (autoprobe) {
int irq;
+
OUT_BYTE(drive->ctl | 0x02, IDE_CONTROL_REG); /* mask device irq */
- GET_STAT(); /* clear drive IRQ */
+ ata_status(drive, 0, 0); /* clear drive IRQ */
udelay(5);
irq = probe_irq_off(cookie);
if (!drive->channel->irq) {
@@ -684,43 +684,41 @@
(cmd == WIN_IDENTIFY) ? "ATA" : "ATAPI");
#endif
mdelay(50); /* needed for some systems (e.g. crw9624 as drive0 with disk as slave) */
- SELECT_DRIVE(ch, drive);
- mdelay(50);
+ ata_select(drive, 50000);
select = IN_BYTE(IDE_SELECT_REG);
if (select != drive->select.all && !drive->present) {
if (drive->select.b.unit != 0) {
- SELECT_DRIVE(ch, &ch->drives[0]); /* exit with drive0 selected */
- mdelay(50); /* allow BUSY_STAT to assert & clear */
+ ata_select(&ch->drives[0], 50000); /* exit with drive0 selected */
}
return 3; /* no i/f present: mmm.. this should be a 4 -ml */
}
- if (OK_STAT(GET_STAT(), READY_STAT, BUSY_STAT) || drive->present || cmd == WIN_PIDENTIFY)
- {
+ if (ata_status(drive, READY_STAT, BUSY_STAT) || drive->present || cmd == WIN_PIDENTIFY) {
if ((rc = identify(drive,cmd))) /* send cmd and wait */
rc = identify(drive,cmd); /* failed: try again */
if (rc == 1 && cmd == WIN_PIDENTIFY && drive->autotune != 2) {
unsigned long timeout;
- printk("%s: no response (status = 0x%02x), resetting drive\n", drive->name, GET_STAT());
+ printk("%s: no response (status = 0x%02x), resetting drive\n",
+ drive->name, drive->status);
mdelay(50);
- OUT_BYTE (drive->select.all, IDE_SELECT_REG);
+ OUT_BYTE(drive->select.all, IDE_SELECT_REG);
mdelay(50);
OUT_BYTE(WIN_SRST, IDE_COMMAND_REG);
timeout = jiffies;
- while ((GET_STAT() & BUSY_STAT) && time_before(jiffies, timeout + WAIT_WORSTCASE))
+ while (!ata_status(drive, 0, BUSY_STAT) && time_before(jiffies, timeout + WAIT_WORSTCASE))
mdelay(50);
rc = identify(drive, cmd);
}
if (rc == 1)
- printk("%s: no response (status = 0x%02x)\n", drive->name, GET_STAT());
- GET_STAT(); /* ensure drive irq is clear */
+ printk("%s: no response (status = 0x%02x)\n",
+ drive->name, drive->status);
+ ata_status(drive, 0, 0); /* ensure drive irq is clear */
} else
rc = 3; /* not present or maybe ATAPI */
if (drive->select.b.unit != 0) {
- SELECT_DRIVE(ch, &ch->drives[0]); /* exit with drive0 selected */
- mdelay(50);
- GET_STAT(); /* ensure drive irq is clear */
+ ata_select(&ch->drives[0], 50000); /* exit with drive0 selected */
+ ata_status(drive, 0, 0); /* ensure drive irq is clear */
}
return rc;
@@ -764,8 +762,7 @@
unsigned long timeout;
printk("%s: enabling %s -- ", drive->channel->name, drive->id->model);
- SELECT_DRIVE(drive->channel, drive);
- mdelay(50);
+ ata_select(drive, 50000);
OUT_BYTE(EXABYTE_ENABLE_NEST, IDE_COMMAND_REG);
timeout = jiffies + WAIT_WORSTCASE;
do {
@@ -774,10 +771,10 @@
return;
}
mdelay(50);
- } while (GET_STAT() & BUSY_STAT);
+ } while (!ata_status(drive, 0, BUSY_STAT));
mdelay(50);
- if (!OK_STAT(GET_STAT(), 0, BAD_STAT))
- printk("failed (status = 0x%02x)\n", GET_STAT());
+ if (!ata_status(drive, 0, BAD_STAT))
+ printk("failed (status = 0x%02x)\n", drive->status);
else
printk("success\n");
diff -urN linux-2.5.19/drivers/ide/tcq.c linux/drivers/ide/tcq.c
--- linux-2.5.19/drivers/ide/tcq.c 2002-05-29 20:42:57.000000000 +0200
+++ linux/drivers/ide/tcq.c 2002-05-31 20:02:21.000000000 +0200
@@ -71,8 +71,9 @@
struct ata_taskfile *args = rq->special;
ide__sti();
- ide_end_drive_cmd(drive, rq, GET_STAT(), GET_ERR());
+ ide_end_drive_cmd(drive, rq, GET_ERR());
kfree(args);
+
return ide_stopped;
}
@@ -169,7 +170,7 @@
/*
* if pending commands, try service before giving up
*/
- if (ata_pending_commands(drive) && (GET_STAT() & SERVICE_STAT))
+ if (ata_pending_commands(drive) && !ata_status(drive, 0, SERVICE_STAT))
if (service(drive, drive->rq) == ide_started)
return;
@@ -246,10 +247,8 @@
/*
* need to select the right drive first...
*/
- if (drive != drive->channel->drive) {
- SELECT_DRIVE(drive->channel, drive);
- udelay(10);
- }
+ if (drive != drive->channel->drive)
+ ata_select(drive, 10);
drive_ctl_nien(drive, 1);
@@ -309,14 +308,12 @@
static ide_startstop_t check_service(struct ata_device *drive, struct request *rq)
{
- u8 stat;
-
TCQ_PRINTK("%s: %s\n", drive->name, __FUNCTION__);
if (!ata_pending_commands(drive))
return ide_stopped;
- if ((stat = GET_STAT()) & SERVICE_STAT)
+ if (!ata_status(drive, 0, SERVICE_STAT))
return service(drive, rq);
/*
@@ -327,7 +324,7 @@
return ide_started;
}
-ide_startstop_t ide_dmaq_complete(struct ata_device *drive, struct request *rq, u8 stat)
+static ide_startstop_t dmaq_complete(struct ata_device *drive, struct request *rq)
{
u8 dma_stat;
@@ -339,9 +336,9 @@
/*
* must be end of I/O, check status and complete as necessary
*/
- if (unlikely(!OK_STAT(stat, READY_STAT, drive->bad_wstat | DRQ_STAT))) {
- printk(KERN_ERR "%s: %s: error status %x\n", __FUNCTION__, drive->name,stat);
- ide_dump_status(drive, rq, __FUNCTION__, stat);
+ if (!ata_status(drive, READY_STAT, drive->bad_wstat | DRQ_STAT)) {
+ printk(KERN_ERR "%s: %s: error status %x\n", __FUNCTION__, drive->name, drive->status);
+ ide_dump_status(drive, rq, __FUNCTION__, drive->status);
tcq_invalidate_queue(drive);
return ide_stopped;
@@ -360,7 +357,7 @@
}
/*
- * intr handler for queued dma operations. this can be entered for two
+ * Interrupt handler for queued dma operations. this can be entered for two
* reasons:
*
* 1) device has completed dma transfer
@@ -371,26 +368,28 @@
*/
static ide_startstop_t ide_dmaq_intr(struct ata_device *drive, struct request *rq)
{
- u8 stat = GET_STAT();
+ int ok;
- TCQ_PRINTK("%s: stat=%x\n", __FUNCTION__, stat);
+ ok = !ata_status(drive, 0, SERVICE_STAT);
+ TCQ_PRINTK("%s: stat=%x\n", __FUNCTION__, drive->status);
/*
- * if a command completion interrupt is pending, do that first and
- * check service afterwards
+ * If a command completion interrupt is pending, do that first and
+ * check service afterwards.
*/
if (rq)
- return ide_dmaq_complete(drive, rq, stat);
+ return dmaq_complete(drive, rq);
/*
* service interrupt
*/
- if (stat & SERVICE_STAT) {
- TCQ_PRINTK("%s: SERV (stat=%x)\n", __FUNCTION__, stat);
+ if (ok) {
+ TCQ_PRINTK("%s: SERV (stat=%x)\n", __FUNCTION__, drive->status);
return service(drive, rq);
}
- printk("%s: stat=%x, not expected\n", __FUNCTION__, stat);
+ printk("%s: stat=%x, not expected\n", __FUNCTION__, drive->status);
+
return check_service(drive, rq);
}
@@ -494,19 +493,19 @@
static int tcq_wait_dataphase(struct ata_device *drive)
{
- u8 stat;
int i;
- while ((stat = GET_STAT()) & BUSY_STAT)
+ while (!ata_status(drive, 0, BUSY_STAT))
udelay(10);
- if (OK_STAT(stat, READY_STAT | DRQ_STAT, drive->bad_wstat))
+ if (ata_status(drive, READY_STAT | DRQ_STAT, drive->bad_wstat))
return 0;
i = 0;
udelay(1);
- while (!OK_STAT(GET_STAT(), READY_STAT | DRQ_STAT, drive->bad_wstat)) {
- if (unlikely(i++ > IDE_TCQ_WAIT))
+ while (!ata_status(drive, READY_STAT | DRQ_STAT, drive->bad_wstat)) {
+ ++i;
+ if (i > IDE_TCQ_WAIT)
return 1;
udelay(10);
@@ -588,7 +587,7 @@
TCQ_PRINTK("REL in queued_start\n");
- if ((stat = GET_STAT()) & SERVICE_STAT)
+ if (!ata_status(drive, 0, SERVICE_STAT))
return service(drive, rq);
return ide_released;
diff -urN linux-2.5.19/drivers/scsi/ide-scsi.c linux/drivers/scsi/ide-scsi.c
--- linux-2.5.19/drivers/scsi/ide-scsi.c 2002-05-31 19:30:47.000000000 +0200
+++ linux/drivers/scsi/ide-scsi.c 2002-05-31 20:03:34.000000000 +0200
@@ -242,7 +242,7 @@
ide_end_request(drive, rq, uptodate);
return 0;
}
- ide_end_drive_cmd(drive, rq, 0, 0);
+ ide_end_drive_cmd(drive, rq, 0);
if (rq->errors >= ERROR_MAX) {
pc->s.scsi_cmd->result = DID_ERROR << 16;
if (log)
@@ -286,7 +286,7 @@
{
struct Scsi_Host *host = drive->driver_data;
idescsi_scsi_t *scsi = (idescsi_scsi_t *) host->hostdata[0];
- byte status, ireason;
+ u8 ireason;
int bcount;
struct atapi_packet_command *pc=scsi->pc;
unsigned int temp;
@@ -303,13 +303,12 @@
udma_stop(drive);
}
- status = GET_STAT(); /* Clear the interrupt */
-
- if ((status & DRQ_STAT) == 0) { /* No more interrupts */
+ /* Clear the interrupt */
+ if (ata_status(drive, 0, DRQ_STAT)) { /* No more interrupts */
if (test_bit(IDESCSI_LOG_CMD, &scsi->log))
printk (KERN_INFO "Packet command completed, %d bytes transferred\n", pc->actually_transferred);
ide__sti();
- if (status & ERR_STAT)
+ if (drive->status & ERR_STAT)
rq->errors++;
idescsi_end_request(drive, rq, 1);
return ide_stopped;
@@ -411,7 +410,7 @@
dma_ok = !udma_read(drive, rq);
}
- SELECT_DRIVE(drive->channel, drive);
+ ata_select(drive, 10);
if (IDE_CONTROL_REG)
OUT_BYTE (drive->ctl,IDE_CONTROL_REG);
OUT_BYTE (dma_ok,IDE_FEATURE_REG);
diff -urN linux-2.5.19/include/linux/ide.h linux/include/linux/ide.h
--- linux-2.5.19/include/linux/ide.h 2002-05-29 20:42:48.000000000 +0200
+++ linux/include/linux/ide.h 2002-05-31 19:17:19.000000000 +0200
@@ -112,8 +112,6 @@
#define GET_ALTSTAT() IN_BYTE(IDE_CONTROL_REG)
#define GET_FEAT() IN_BYTE(IDE_NSECTOR_REG)
-#define OK_STAT(stat,good,bad) (((stat)&((good)|(bad)))==(good))
-
#define BAD_R_STAT (BUSY_STAT | ERR_STAT)
#define BAD_W_STAT (BAD_R_STAT | WRERR_STAT)
#define BAD_STAT (BAD_R_STAT | DRQ_STAT)
@@ -157,19 +155,6 @@
#define WAIT_CMD (10*HZ) /* 10sec - maximum wait for an IRQ to happen */
#define WAIT_MIN_SLEEP (2*HZ/100) /* 20msec - minimum sleep time */
-#define SELECT_DRIVE(channel, drive) \
-{ \
- if (channel->selectproc) \
- channel->selectproc(drive); \
- OUT_BYTE((drive)->select.all, channel->io_ports[IDE_SELECT_OFFSET]); \
-}
-
-#define SELECT_MASK(channel, drive, mask) \
-{ \
- if (channel->maskproc) \
- channel->maskproc(drive,mask); \
-}
-
/*
* Check for an interrupt and acknowledge the interrupt status
*/
@@ -359,8 +344,12 @@
unsigned ata_flash : 1; /* 1=present, 0=default */
unsigned addressing; /* : 2; 0=28-bit, 1=48-bit, 2=64-bit */
byte scsi; /* 0=default, 1=skip current ide-subdriver for ide-scsi emulation */
+
select_t select; /* basic drive/head select reg value */
- byte ctl; /* "normal" value for IDE_CONTROL_REG */
+
+ u8 ctl; /* "normal" value for IDE_CONTROL_REG */
+ u8 status; /* last retrived status value for device */
+
byte ready_stat; /* min status value for drive ready */
byte mult_count; /* current multiple sector setting */
byte bad_wstat; /* used for ignoring WRERR_STAT */
@@ -485,7 +474,7 @@
void (*intrproc) (struct ata_device *);
/* special host masking for drive selection */
- void (*maskproc) (struct ata_device *, int);
+ void (*maskproc) (struct ata_device *);
/* check host's drive quirk list */
int (*quirkproc) (struct ata_device *);
@@ -730,7 +719,7 @@
/*
* Clean up after success/failure of an explicit drive cmd.
*/
-extern void ide_end_drive_cmd(struct ata_device *, struct request *, u8, u8);
+extern void ide_end_drive_cmd(struct ata_device *, struct request *, u8);
struct ata_taskfile {
struct hd_drive_task_hdr taskfile;
@@ -902,4 +891,10 @@
extern int drive_is_ready(struct ata_device *drive);
+/* Low level device access functions. */
+
+extern void ata_select(struct ata_device *, unsigned long);
+extern void ata_mask(struct ata_device *);
+extern int ata_status(struct ata_device *, u8, u8);
+
#endif
^ permalink raw reply [flat|nested] 35+ messages in thread* [PATCH] 2.5.19 IDE 78
2002-05-29 18:50 Linux 2.5.19 Linus Torvalds
` (8 preceding siblings ...)
2002-05-31 18:17 ` [PATCH] 2.5.19 IDE 77 Martin Dalecki
@ 2002-06-02 6:04 ` Martin Dalecki
2002-06-02 8:16 ` Paul Dickson
2002-06-02 9:21 ` Paul Mackerras
2002-06-02 6:06 ` [PATCH} 2.5.19 IDE 79 Martin Dalecki
` (3 subsequent siblings)
13 siblings, 2 replies; 35+ messages in thread
From: Martin Dalecki @ 2002-06-02 6:04 UTC (permalink / raw)
To: Linus Torvalds; +Cc: Kernel Mailing List
[-- Attachment #1: Type: text/plain, Size: 806 bytes --]
Sat Jun 1 16:54:57 CEST 2002 ide-clean-78
- Move ide_fixstring() from ide.c to probe.c, since this is the place, where it's
most used.
- Remove GET_STAT() - it's not used any longer.
- Remove last parameter of ide_error. Rename it to ata_error().
- Don't use ide_fixstring in qd65xx.c host chip driver. The model name is
already fixed in probe.c.
- Invent ata_irq_enable() for the handling of the trice nIEN bit of the
control register. Consistently use ch->intrproc method every time we toggle
this bit. This simply wasn't the case before!
- Disable interrupts on a previous channel only when we share them indeed.
- Eliminate simple drive command handling function drive_cmd.
- Simplify the ioctl handler. Move it to ioctl, since that's the only place
where it's actually used.
[-- Attachment #2: ide-clean-78.diff --]
[-- Type: text/plain, Size: 49715 bytes --]
diff -urN linux-2.5.19/arch/cris/drivers/ide.c linux/arch/cris/drivers/ide.c
--- linux-2.5.19/arch/cris/drivers/ide.c 2002-06-01 18:53:06.000000000 +0200
+++ linux/arch/cris/drivers/ide.c 2002-06-01 17:14:44.000000000 +0200
@@ -707,7 +707,7 @@
}
printk("%s: bad DMA status\n", drive->name);
}
- return ide_error(drive, "dma_intr", drive->status);
+ return ata_error(drive, __FUNCTION__);
}
/*
diff -urN linux-2.5.19/drivers/ide/device.c linux/drivers/ide/device.c
--- linux-2.5.19/drivers/ide/device.c 2002-06-01 18:53:06.000000000 +0200
+++ linux/drivers/ide/device.c 2002-06-01 19:45:30.000000000 +0200
@@ -15,6 +15,9 @@
/*
* Common low leved device access code. This is the lowest layer of hardware
* access.
+ *
+ * This is the place where register set access portability will be handled in
+ * the future.
*/
#include <linux/module.h>
@@ -23,11 +26,9 @@
#include <linux/kernel.h>
#include <linux/mm.h>
#include <linux/ioport.h>
-#include <linux/blkdev.h>
#include <linux/errno.h>
#include <linux/slab.h>
#include <linux/delay.h>
-#include <linux/cdrom.h>
#include <linux/hdreg.h>
#include <linux/ide.h>
@@ -92,4 +93,53 @@
EXPORT_SYMBOL(ata_status);
+/*
+ * Handle the nIEN - negated Interrupt ENable of the drive.
+ * This is controlling whatever the drive will acnowlenge commands
+ * with interrupts or not.
+ */
+int ata_irq_enable(struct ata_device *drive, int on)
+{
+ struct ata_channel *ch = drive->channel;
+
+ if (!ch->io_ports[IDE_CONTROL_OFFSET])
+ return 0;
+
+ if (on)
+ OUT_BYTE(0x00, ch->io_ports[IDE_CONTROL_OFFSET]);
+ else {
+ if (!ch->intrproc)
+ OUT_BYTE(0x02, ch->io_ports[IDE_CONTROL_OFFSET]);
+ else
+ ch->intrproc(drive);
+ }
+
+ return 1;
+}
+
+EXPORT_SYMBOL(ata_irq_enable);
+
+/*
+ * Perform a reset operation on the currently selected drive.
+ */
+void ata_reset(struct ata_channel *ch)
+{
+ unsigned long timeout = jiffies + WAIT_WORSTCASE;
+ u8 stat;
+
+ if (!ch->io_ports[IDE_CONTROL_OFFSET])
+ return;
+
+ printk("%s: reset\n", ch->name);
+ OUT_BYTE(0x04, ch->io_ports[IDE_CONTROL_OFFSET]);
+ udelay(10);
+ OUT_BYTE(0x00, ch->io_ports[IDE_CONTROL_OFFSET]);
+ do {
+ mdelay(50);
+ stat = IN_BYTE(ch->io_ports[IDE_STATUS_OFFSET]);
+ } while ((stat & BUSY_STAT) && time_before(jiffies, timeout));
+}
+
+EXPORT_SYMBOL(ata_reset);
+
MODULE_LICENSE("GPL");
diff -urN linux-2.5.19/drivers/ide/hpt34x.c linux/drivers/ide/hpt34x.c
--- linux-2.5.19/drivers/ide/hpt34x.c 2002-06-01 18:53:02.000000000 +0200
+++ linux/drivers/ide/hpt34x.c 2002-06-01 17:19:02.000000000 +0200
@@ -264,7 +264,7 @@
if (drive->type != ATA_DISK)
return 0;
- ide_set_handler(drive, &ide_dma_intr, WAIT_CMD, NULL); /* issue cmd to drive */
+ ide_set_handler(drive, ide_dma_intr, WAIT_CMD, NULL); /* issue cmd to drive */
OUT_BYTE((reading == 9) ? WIN_READDMA : WIN_WRITEDMA, IDE_COMMAND_REG);
return 0;
diff -urN linux-2.5.19/drivers/ide/hpt366.c linux/drivers/ide/hpt366.c
--- linux-2.5.19/drivers/ide/hpt366.c 2002-06-01 18:53:06.000000000 +0200
+++ linux/drivers/ide/hpt366.c 2002-06-01 19:41:26.000000000 +0200
@@ -813,31 +813,26 @@
if (drive->quirk_list) {
/* drives in the quirk_list may not like intr setups/cleanups */
} else {
- OUT_BYTE((drive)->ctl|2, drive->channel->io_ports[IDE_CONTROL_OFFSET]);
+ OUT_BYTE(0x02, drive->channel->io_ports[IDE_CONTROL_OFFSET]);
}
}
static void hpt3xx_maskproc(struct ata_device *drive)
{
struct pci_dev *dev = drive->channel->pci_dev;
- const int mask = 0;
+ struct ata_channel *ch = drive->channel;
if (drive->quirk_list) {
if (hpt_min_rev(dev, 3)) {
u8 reg5a;
pci_read_config_byte(dev, 0x5a, ®5a);
- if (((reg5a & 0x10) >> 4) != mask)
- pci_write_config_byte(dev, 0x5a, mask ? (reg5a | 0x10) : (reg5a & ~0x10));
- } else {
- if (mask) {
- disable_irq(drive->channel->irq);
- } else {
- enable_irq(drive->channel->irq);
- }
- }
+ if ((reg5a & 0x10) >> 4)
+ pci_write_config_byte(dev, 0x5a, reg5a & ~0x10);
+ } else
+ enable_irq(drive->channel->irq);
} else {
- if (IDE_CONTROL_REG)
- OUT_BYTE(mask ? (drive->ctl | 2) : (drive->ctl & ~2), IDE_CONTROL_REG);
+ if (ch->io_ports[IDE_CONTROL_OFFSET])
+ OUT_BYTE(0x00, ch->io_ports[IDE_CONTROL_OFFSET]);
}
}
diff -urN linux-2.5.19/drivers/ide/ht6560b.c linux/drivers/ide/ht6560b.c
--- linux-2.5.19/drivers/ide/ht6560b.c 2002-05-29 20:42:48.000000000 +0200
+++ linux/drivers/ide/ht6560b.c 2002-06-01 16:31:10.000000000 +0200
@@ -123,16 +123,16 @@
static void ht6560b_selectproc(struct ata_device *drive)
{
unsigned long flags;
- static byte current_select = 0;
- static byte current_timing = 0;
- byte select, timing;
-
+ static u8 current_select = 0;
+ static u8 current_timing = 0;
+ u8 select, timing;
+
__save_flags (flags); /* local CPU only */
__cli(); /* local CPU only */
-
+
select = HT_CONFIG(drive);
timing = HT_TIMING(drive);
-
+
if (select != current_select || timing != current_timing) {
current_select = select;
current_timing = timing;
@@ -147,7 +147,7 @@
* Set timing for this drive:
*/
outb(timing, IDE_SELECT_REG);
- (void) inb(IDE_STATUS_REG);
+ ata_status(drive, 0, 0);
#ifdef DEBUG
printk("ht6560b: %s: select=%#x timing=%#x\n", drive->name, select, timing);
#endif
@@ -160,13 +160,13 @@
*/
static int __init try_to_init_ht6560b(void)
{
- byte orig_value;
+ u8 orig_value;
int i;
-
+
/* Autodetect ht6560b */
if ((orig_value=inb(HT_CONFIG_PORT)) == 0xff)
return 0;
-
+
for (i=3;i>0;i--) {
outb(0x00, HT_CONFIG_PORT);
if (!( (~inb(HT_CONFIG_PORT)) & 0x3f )) {
@@ -183,9 +183,9 @@
* Ht6560b autodetected
*/
outb(HT_CONFIG_DEFAULT, HT_CONFIG_PORT);
- outb(HT_TIMING_DEFAULT, 0x1f6); /* IDE_SELECT_REG */
- (void) inb(0x1f7); /* IDE_STATUS_REG */
-
+ outb(HT_TIMING_DEFAULT, 0x1f6); /* SELECT */
+ (void) inb(0x1f7); /* STATUS */
+
printk("\nht6560b " HT6560B_VERSION
": chipset detected and initialized"
#ifdef DEBUG
@@ -228,19 +228,19 @@
if (recovery_cycles < 2) recovery_cycles = 2;
if (active_cycles > 15) active_cycles = 15;
if (recovery_cycles > 15) recovery_cycles = 0; /* 0==16 */
-
+
#ifdef DEBUG
printk("ht6560b: drive %s setting pio=%d recovery=%d (%dns) active=%d (%dns)\n",
drive->name, pio - XFER_PIO_0, recovery_cycles, recovery_time, active_cycles, active_time);
#endif
-
+
return (byte)((recovery_cycles << 4) | active_cycles);
} else {
-
+
#ifdef DEBUG
printk("ht6560b: drive %s setting pio=0\n", drive->name);
#endif
-
+
return HT_TIMING_DEFAULT; /* default setting */
}
}
@@ -252,10 +252,10 @@
{
unsigned long flags;
int t = HT_PREFETCH_MODE << 8;
-
+
save_flags (flags); /* all CPUs */
cli(); /* all CPUs */
-
+
/*
* Prefetch mode and unmask irq seems to conflict
*/
@@ -267,9 +267,9 @@
drive->drive_data &= ~t; /* disable prefetch mode */
drive->channel->no_unmask = 0;
}
-
+
restore_flags (flags); /* all CPUs */
-
+
#ifdef DEBUG
printk("ht6560b: drive %s prefetch mode %sabled\n", drive->name, (state ? "en" : "dis"));
#endif
@@ -279,24 +279,24 @@
{
unsigned long flags;
byte timing;
-
+
switch (pio) {
case 8: /* set prefetch off */
case 9: /* set prefetch on */
ht_set_prefetch(drive, pio & 1);
return;
}
-
+
timing = ht_pio2timings(drive, pio);
-
+
save_flags (flags); /* all CPUs */
cli(); /* all CPUs */
-
+
drive->drive_data &= 0xff00;
drive->drive_data |= timing;
-
+
restore_flags (flags); /* all CPUs */
-
+
#ifdef DEBUG
printk("ht6560b: drive %s tuned to pio mode %#x timing=%#x\n", drive->name, pio, timing);
#endif
@@ -305,7 +305,7 @@
void __init init_ht6560b (void)
{
int t;
-
+
if (check_region(HT_CONFIG_PORT,1)) {
printk(KERN_ERR "ht6560b: PORT %#x ALREADY IN USE\n", HT_CONFIG_PORT);
} else {
diff -urN linux-2.5.19/drivers/ide/icside.c linux/drivers/ide/icside.c
--- linux-2.5.19/drivers/ide/icside.c 2002-06-01 18:53:06.000000000 +0200
+++ linux/drivers/ide/icside.c 2002-06-01 17:20:45.000000000 +0200
@@ -476,7 +476,7 @@
printk("%s: dma_intr: bad DMA status (dma_stat=%x)\n",
drive->name, dma_stat);
}
- return ide_error(drive, rq, "dma_intr", drive->status);
+ return ata_error(drive, rq, __FUNCTION__);
}
static int
diff -urN linux-2.5.19/drivers/ide/ide.c linux/drivers/ide/ide.c
--- linux-2.5.19/drivers/ide/ide.c 2002-06-01 18:53:06.000000000 +0200
+++ linux/drivers/ide/ide.c 2002-06-01 19:49:34.000000000 +0200
@@ -378,42 +378,6 @@
for (unit = 0; unit < MAX_DRIVES; ++unit)
check_crc_errors(&ch->drives[unit]);
-#if OK_TO_RESET_CONTROLLER
- if (!IDE_CONTROL_REG) {
- __restore_flags(flags);
-
- return ide_stopped;
- }
- /*
- * Note that we also set nIEN while resetting the device,
- * to mask unwanted interrupts from the interface during the reset.
- * However, due to the design of PC hardware, this will cause an
- * immediate interrupt due to the edge transition it produces.
- * This single interrupt gives us a "fast poll" for drives that
- * recover from reset very quickly, saving us the first 50ms wait time.
- */
- OUT_BYTE(drive->ctl|6,IDE_CONTROL_REG); /* set SRST and nIEN */
- udelay(10); /* more than enough time */
- if (drive->quirk_list == 2) {
- OUT_BYTE(drive->ctl,IDE_CONTROL_REG); /* clear SRST and nIEN */
- } else {
- OUT_BYTE(drive->ctl|2,IDE_CONTROL_REG); /* clear SRST, leave nIEN */
- }
- udelay(10); /* more than enough time */
- ch->poll_timeout = jiffies + WAIT_WORSTCASE;
- ide_set_handler(drive, reset_pollfunc, HZ/20, NULL);
-
- /*
- * Some weird controller like resetting themselves to a strange
- * state when the disks are reset this way. At least, the Winbond
- * 553 documentation says that
- */
- if (ch->resetproc != NULL)
- ch->resetproc(drive);
-
- /* FIXME: we should handle mulit mode setting here as well ! */
-#endif
-
__restore_flags (flags); /* local CPU only */
return ide_started;
@@ -421,8 +385,8 @@
static inline u32 read_24(struct ata_device *drive)
{
- return (IN_BYTE(IDE_HCYL_REG)<<16) |
- (IN_BYTE(IDE_LCYL_REG)<<8) |
+ return (IN_BYTE(IDE_HCYL_REG) << 16) |
+ (IN_BYTE(IDE_LCYL_REG) << 8) |
IN_BYTE(IDE_SECTOR_REG);
}
@@ -457,11 +421,9 @@
(drive->id->cfs_enable_2 & 0x0400) &&
(drive->addressing == 1)) {
/* The following command goes to the hob file! */
-
- OUT_BYTE(drive->ctl|0x80, IDE_CONTROL_REG);
+ OUT_BYTE(0x80, drive->channel->io_ports[IDE_CONTROL_OFFSET]);
args->hobfile.feature = IN_BYTE(IDE_FEATURE_REG);
args->hobfile.sector_count = IN_BYTE(IDE_NSECTOR_REG);
-
args->hobfile.sector_number = IN_BYTE(IDE_SECTOR_REG);
args->hobfile.low_cylinder = IN_BYTE(IDE_LCYL_REG);
args->hobfile.high_cylinder = IN_BYTE(IDE_HCYL_REG);
@@ -547,13 +509,13 @@
__u64 sectors = 0;
u32 low = 0, high = 0;
low = read_24(drive);
- OUT_BYTE(drive->ctl|0x80, IDE_CONTROL_REG);
+ OUT_BYTE(0x80, drive->channel->io_ports[IDE_CONTROL_OFFSET]);
high = read_24(drive);
sectors = ((__u64)high << 24) | low;
printk(", LBAsect=%lld, high=%d, low=%d", (long long) sectors, high, low);
} else {
- byte cur = IN_BYTE(IDE_SELECT_REG);
+ u8 cur = IN_BYTE(IDE_SELECT_REG);
if (cur & 0x40) { /* using LBA? */
printk(", LBAsect=%ld", (unsigned long)
((cur&0xf)<<24)
@@ -632,9 +594,10 @@
/*
* Take action based on the error returned by the drive.
*/
-ide_startstop_t ide_error(struct ata_device *drive, struct request *rq, const char *msg, byte stat)
+ide_startstop_t ata_error(struct ata_device *drive, struct request *rq, const char *msg)
{
- byte err;
+ u8 err;
+ u8 stat = drive->status;
err = ide_dump_status(drive, rq, msg, stat);
if (!drive || !rq)
@@ -645,18 +608,18 @@
ide_end_drive_cmd(drive, rq, err);
return ide_stopped;
}
-
- if (stat & BUSY_STAT || ((stat & WRERR_STAT) && !drive->nowerr)) { /* other bits are useless when BUSY */
- rq->errors |= ERROR_RESET;
- } else {
+ /* other bits are useless when BUSY */
+ if (stat & BUSY_STAT || ((stat & WRERR_STAT) && !drive->nowerr))
+ rq->errors |= ERROR_RESET; /* FIXME: What's that?! */
+ else {
if (drive->type == ATA_DISK && (stat & ERR_STAT)) {
/* err has different meaning on cdrom and tape */
if (err == ABRT_ERR) {
if (drive->select.b.lba && IN_BYTE(IDE_COMMAND_REG) == WIN_SPECIFY)
return ide_stopped; /* some newer drives don't support WIN_SPECIFY */
- } else if ((err & (ABRT_ERR | ICRC_ERR)) == (ABRT_ERR | ICRC_ERR)) {
+ } else if ((err & (ABRT_ERR | ICRC_ERR)) == (ABRT_ERR | ICRC_ERR))
drive->crc_count++; /* UDMA crc error -- just retry the operation */
- } else if (err & (BBD_ERR | ECC_ERR)) /* retries won't help these */
+ else if (err & (BBD_ERR | ECC_ERR)) /* retries won't help these */
rq->errors = ERROR_MAX;
else if (err & TRK0_ERR) /* help it find track zero */
rq->errors |= ERROR_RECAL;
@@ -665,7 +628,8 @@
if ((stat & DRQ_STAT) && rq_data_dir(rq) == READ)
try_to_flush_leftover_data(drive);
}
- if (!ata_status(drive, 0, BUSY_STAT|DRQ_STAT))
+
+ if (!ata_status(drive, 0, BUSY_STAT | DRQ_STAT))
OUT_BYTE(WIN_IDLEIMMEDIATE, IDE_COMMAND_REG); /* force an abort */
if (rq->errors >= ERROR_MAX) {
@@ -680,6 +644,7 @@
if ((rq->errors & ERROR_RECAL) == ERROR_RECAL)
return do_recalibrate(drive);
}
+
return ide_stopped;
}
@@ -689,10 +654,11 @@
static ide_startstop_t drive_cmd_intr(struct ata_device *drive, struct request *rq)
{
u8 *args = rq->buffer;
- int retries = 10;
ide__sti(); /* local CPU only */
if (!ata_status(drive, 0, DRQ_STAT) && args && args[3]) {
+ int retries = 10;
+
ata_read(drive, &args[4], args[3] * SECTOR_WORDS);
while (!ata_status(drive, 0, BUSY_STAT) && retries--)
@@ -700,7 +666,7 @@
}
if (!ata_status(drive, READY_STAT, BAD_STAT))
- return ide_error(drive, rq, "drive_cmd", drive->status); /* already calls ide_end_drive_cmd */
+ return ata_error(drive, rq, __FUNCTION__); /* already calls ide_end_drive_cmd */
ide_end_drive_cmd(drive, rq, GET_ERR());
return ide_stopped;
@@ -712,8 +678,7 @@
static void drive_cmd(struct ata_device *drive, u8 cmd, u8 nsect)
{
ide_set_handler(drive, drive_cmd_intr, WAIT_CMD, NULL);
- if (IDE_CONTROL_REG)
- OUT_BYTE(drive->ctl, IDE_CONTROL_REG); /* clear nIEN */
+ ata_irq_enable(drive, 1);
ata_mask(drive);
OUT_BYTE(nsect, IDE_NSECTOR_REG);
OUT_BYTE(cmd, IDE_COMMAND_REG);
@@ -723,7 +688,7 @@
/*
* Busy-wait for the drive status to be not "busy". Check then the status for
* all of the "good" bits and none of the "bad" bits, and if all is okay it
- * returns 0. All other cases return 1 after invoking ide_error() -- caller
+ * returns 0. All other cases return 1 after invoking error handler -- caller
* should just return.
*
* This routine should get fixed to not hog the cpu during extra long waits..
@@ -744,12 +709,13 @@
return 1;
}
- udelay(1); /* spec allows drive 400ns to assert "BUSY" */
+ /* spec allows drive 400ns to assert "BUSY" */
+ udelay(1);
if (!ata_status(drive, 0, BUSY_STAT)) {
timeout += jiffies;
while (!ata_status(drive, 0, BUSY_STAT)) {
if (time_after(jiffies, timeout)) {
- *startstop = ide_error(drive, rq, "status timeout", drive->status);
+ *startstop = ata_error(drive, rq, "status timeout");
return 1;
}
}
@@ -766,7 +732,7 @@
if (ata_status(drive, good, bad))
return 0;
}
- *startstop = ide_error(drive, rq, "status error", drive->status);
+ *startstop = ata_error(drive, rq, "status error");
return 1;
}
@@ -1134,15 +1100,15 @@
ch = drive->channel;
- if (channel->sharing_irq && ch != channel && ch->io_ports[IDE_CONTROL_OFFSET]) {
- /* set nIEN for previous channel */
- /* FIXME: check this! It appears to act on the current channel! */
-
- if (ch->intrproc)
- ch->intrproc(drive);
- else
- OUT_BYTE((drive)->ctl|2, ch->io_ports[IDE_CONTROL_OFFSET]);
- }
+ /* Disable intrerrupts from the drive on the previous channel.
+ *
+ * FIXME: This should be only done if we are indeed sharing the same
+ * interrupt line with it.
+ *
+ * FIXME: check this! It appears to act on the current channel!
+ */
+ if (ch != channel && channel->sharing_irq && ch->irq == channel->irq)
+ ata_irq_enable(drive, 0);
/* Remember the last drive we where acting on.
*/
@@ -1279,7 +1245,7 @@
startstop = ide_stopped;
dma_timeout_retry(drive, drive->rq);
} else
- startstop = ide_error(drive, drive->rq, "irq timeout", drive->status);
+ startstop = ata_error(drive, drive->rq, "irq timeout");
}
enable_irq(ch->irq);
@@ -1571,33 +1537,6 @@
return res;
}
-void ide_fixstring (byte *s, const int bytecount, const int byteswap)
-{
- byte *p = s, *end = &s[bytecount & ~1]; /* bytecount must be even */
-
- if (byteswap) {
- /* convert from big-endian to host byte order */
- for (p = end ; p != s;) {
- unsigned short *pp = (unsigned short *) (p -= 2);
- *pp = ntohs(*pp);
- }
- }
-
- /* strip leading blanks */
- while (s != end && *s == ' ')
- ++s;
-
- /* compress internal blanks and strip trailing blanks */
- while (s != end && *s) {
- if (*s++ != ' ' || (s != end && *s && *s != ' '))
- *p++ = *(s-1);
- }
-
- /* wipe out trailing garbage */
- while (p != end)
- *p++ = '\0';
-}
-
struct block_device_operations ide_fops[] = {{
owner: THIS_MODULE,
open: ide_open,
@@ -1616,8 +1555,8 @@
EXPORT_SYMBOL(ide_set_handler);
EXPORT_SYMBOL(ide_dump_status);
-EXPORT_SYMBOL(ide_error);
-EXPORT_SYMBOL(ide_fixstring);
+EXPORT_SYMBOL(ata_error);
+
EXPORT_SYMBOL(ide_wait_stat);
EXPORT_SYMBOL(restart_request);
EXPORT_SYMBOL(ide_end_drive_cmd);
diff -urN linux-2.5.19/drivers/ide/ide-cd.c linux/drivers/ide/ide-cd.c
--- linux-2.5.19/drivers/ide/ide-cd.c 2002-06-01 18:53:06.000000000 +0200
+++ linux/drivers/ide/ide-cd.c 2002-06-01 18:40:19.000000000 +0200
@@ -594,7 +594,7 @@
pc = (struct packet_command *) rq->special;
pc->stat = 1;
cdrom_end_request(drive, rq, 1);
- *startstop = ide_error(drive, rq, "request sense failure", drive->status);
+ *startstop = ata_error(drive, rq, "request sense failure");
return 1;
} else if (rq->flags & (REQ_PC | REQ_BLOCK_PC)) {
@@ -673,7 +673,7 @@
} else if ((err & ~ABRT_ERR) != 0) {
/* Go to the default handler
for other errors. */
- *startstop = ide_error(drive, rq, __FUNCTION__, drive->status);
+ *startstop = ata_error(drive, rq, __FUNCTION__);
return 1;
} else if ((++rq->errors > ERROR_MAX)) {
/* We've racked up too many retries. Abort. */
@@ -751,9 +751,7 @@
OUT_BYTE(xferlen & 0xff, IDE_LCYL_REG);
OUT_BYTE(xferlen >> 8 , IDE_HCYL_REG);
- if (IDE_CONTROL_REG)
- OUT_BYTE (drive->ctl, IDE_CONTROL_REG);
-
+ ata_irq_enable(drive, 1);
if (info->dma)
udma_start(drive, rq);
@@ -918,7 +916,7 @@
__ide_end_request(drive, rq, 1, rq->nr_sectors);
return ide_stopped;
} else
- return ide_error (drive, rq, "dma error", stat);
+ return ata_error(drive, rq, "dma error");
}
/* Read the interrupt reason and the transfer length. */
@@ -1498,7 +1496,7 @@
*/
if (dma) {
if (dma_error)
- return ide_error(drive, rq, "dma error", stat);
+ return ata_error(drive, rq, "dma error");
__ide_end_request(drive, rq, 1, rq->nr_sectors);
return ide_stopped;
diff -urN linux-2.5.19/drivers/ide/ide-disk.c linux/drivers/ide/ide-disk.c
--- linux-2.5.19/drivers/ide/ide-disk.c 2002-05-29 20:42:43.000000000 +0200
+++ linux/drivers/ide/ide-disk.c 2002-06-01 19:02:41.000000000 +0200
@@ -257,14 +257,15 @@
args.taskfile.sector_number = block; /* low lba */
args.taskfile.low_cylinder = (block >>= 8); /* mid lba */
args.taskfile.high_cylinder = (block >>= 8); /* hi lba */
+ args.taskfile.device_head = drive->select.all;
args.hobfile.sector_number = (block >>= 8); /* low lba */
args.hobfile.low_cylinder = (block >>= 8); /* mid lba */
args.hobfile.high_cylinder = (block >>= 8); /* hi lba */
+ args.hobfile.device_head = drive->select.all;
+
+ args.hobfile.control = 0x80;
- args.taskfile.device_head = drive->select.all;
- args.hobfile.device_head = args.taskfile.device_head;
- args.hobfile.control = (drive->ctl|0x80);
args.taskfile.command = get_command(drive, rq_data_dir(rq));
#ifdef DEBUG
@@ -727,7 +728,7 @@
args.hobfile.high_cylinder = (addr_req >>= 8);
args.hobfile.device_head = 0x40;
- args.hobfile.control = (drive->ctl | 0x80);
+ args.hobfile.control = 0x80;
args.handler = task_no_data_intr;
/* submit command request */
diff -urN linux-2.5.19/drivers/ide/ide-floppy.c linux/drivers/ide/ide-floppy.c
--- linux-2.5.19/drivers/ide/ide-floppy.c 2002-06-01 18:53:06.000000000 +0200
+++ linux/drivers/ide/ide-floppy.c 2002-06-01 18:22:08.000000000 +0200
@@ -1064,8 +1064,7 @@
}
#endif
- if (IDE_CONTROL_REG)
- OUT_BYTE (drive->ctl,IDE_CONTROL_REG);
+ ata_irq_enable(drive, 1);
OUT_BYTE (dma_ok ? 1:0,IDE_FEATURE_REG); /* Use PIO/DMA */
OUT_BYTE (bcount.b.high,IDE_BCOUNTH_REG);
OUT_BYTE (bcount.b.low,IDE_BCOUNTL_REG);
diff -urN linux-2.5.19/drivers/ide/ide-pmac.c linux/drivers/ide/ide-pmac.c
--- linux-2.5.19/drivers/ide/ide-pmac.c 2002-06-01 18:53:06.000000000 +0200
+++ linux/drivers/ide/ide-pmac.c 2002-06-01 18:17:36.000000000 +0200
@@ -434,7 +434,7 @@
goto out;
}
udelay(10);
- OUT_BYTE(drive->ctl | 2, IDE_CONTROL_REG);
+ ata_irq_enale(drive, 0);
OUT_BYTE(command, IDE_NSECTOR_REG);
OUT_BYTE(SETFEATURES_XFER, IDE_FEATURE_REG);
OUT_BYTE(WIN_SETFEATURES, IDE_COMMAND_REG);
@@ -443,7 +443,7 @@
ide__sti(); /* local CPU only -- for jiffies */
result = wait_for_ready(drive);
__restore_flags(flags); /* local CPU only */
- OUT_BYTE(drive->ctl, IDE_CONTROL_REG);
+ ata_irq_enable(drive, 1);
if (result)
printk(KERN_ERR "pmac_ide_do_setfeature disk not ready after SET_FEATURE !\n");
out:
@@ -1330,7 +1330,7 @@
/* Normal MultiWord DMA modes. */
drive->using_dma = pmac_ide_mdma_enable(drive, idx);
}
- OUT_BYTE(0, IDE_CONTROL_REG);
+ ata_irq_enable(drive, 1);
/* Apply settings to controller */
pmac_ide_selectproc(drive);
}
diff -urN linux-2.5.19/drivers/ide/ide-tape.c linux/drivers/ide/ide-tape.c
--- linux-2.5.19/drivers/ide/ide-tape.c 2002-06-01 18:53:06.000000000 +0200
+++ linux/drivers/ide/ide-tape.c 2002-06-01 18:32:37.000000000 +0200
@@ -2263,8 +2263,7 @@
}
#endif
- if (IDE_CONTROL_REG)
- OUT_BYTE (drive->ctl, IDE_CONTROL_REG);
+ ata_irq_enable(drive, 1);
OUT_BYTE (dma_ok ? 1 : 0, IDE_FEATURE_REG); /* Use PIO/DMA */
OUT_BYTE (bcount.b.high, IDE_BCOUNTH_REG);
OUT_BYTE (bcount.b.low, IDE_BCOUNTL_REG);
diff -urN linux-2.5.19/drivers/ide/ide-taskfile.c linux/drivers/ide/ide-taskfile.c
--- linux-2.5.19/drivers/ide/ide-taskfile.c 2002-06-01 18:53:06.000000000 +0200
+++ linux/drivers/ide/ide-taskfile.c 2002-06-01 19:34:02.000000000 +0200
@@ -169,12 +169,12 @@
if (drive->waiting_for_dma)
return udma_irq_status(drive);
-#if 0
- /* need to guarantee 400ns since last command was issued */
- udelay(1);
-#endif
+ /*
+ * Need to guarantee 400ns since last command was issued?
+ */
- /* FIXME: promote this to the general status read method perhaps */
+ /* FIXME: promote this to the general status read method perhaps.
+ */
#ifdef CONFIG_IDEPCI_SHARE_IRQ
/*
* We do a passive status test under shared PCI interrupts on
@@ -182,16 +182,16 @@
* an interrupt with another pci card/device. We make no assumptions
* about possible isa-pnp and pci-pnp issues yet.
*/
- if (IDE_CONTROL_REG)
+ if (drive->channel->io_ports[IDE_CONTROL_OFFSET])
drive->status = GET_ALTSTAT();
else
#endif
- ata_status(drive, 0, 0); /* Note: this may clear a pending IRQ!! */
+ ata_status(drive, 0, 0); /* Note: this may clear a pending IRQ! */
if (drive->status & BUSY_STAT)
return 0; /* drive busy: definitely not interrupting */
- return 1; /* drive ready: *might* be interrupting */
+ return 1; /* drive ready: *might* be interrupting */
}
/*
@@ -246,7 +246,7 @@
if (!ok || !rq->nr_sectors) {
if (drive->status & (ERR_STAT | DRQ_STAT)) {
- startstop = ide_error(drive, rq, __FUNCTION__, drive->status);
+ startstop = ata_error(drive, rq, __FUNCTION__);
return startstop;
}
@@ -316,24 +316,9 @@
struct hd_driveid *id = drive->id;
u8 HIHI = (drive->addressing) ? 0xE0 : 0xEF;
-#if 0
- printk("ata_taskfile ... %p\n", args->handler);
-
- printk(" sector feature %02x\n", args->taskfile.feature);
- printk(" sector count %02x\n", args->taskfile.sector_count);
- printk(" drive/head %02x\n", args->taskfile.device_head);
- printk(" command %02x\n", args->taskfile.command);
-
- if (rq)
- printk(" rq->nr_sectors %2li\n", rq->nr_sectors);
- else
- printk(" rq-> = null\n");
-#endif
-
/* (ks/hs): Moved to start, do not use for multiple out commands */
if (args->handler != task_mulout_intr) {
- if (IDE_CONTROL_REG)
- OUT_BYTE(drive->ctl, IDE_CONTROL_REG); /* clear nIEN */
+ ata_irq_enable(drive, 1);
ata_mask(drive);
}
@@ -412,7 +397,7 @@
ide_startstop_t recal_intr(struct ata_device *drive, struct request *rq)
{
if (!ata_status(drive, READY_STAT, BAD_STAT))
- return ide_error(drive, rq, "recal_intr", drive->status);
+ return ata_error(drive, rq, __FUNCTION__);
return ide_stopped;
}
@@ -429,7 +414,7 @@
if (!ata_status(drive, READY_STAT, BAD_STAT)) {
/* Keep quiet for NOP because it is expected to fail. */
if (args && args->taskfile.command != WIN_NOP)
- return ide_error(drive, rq, "task_no_data_intr", drive->status);
+ return ata_error(drive, rq, __FUNCTION__);
}
if (args)
@@ -443,12 +428,12 @@
*/
static ide_startstop_t task_in_intr(struct ata_device *drive, struct request *rq)
{
- char *pBuf = NULL;
+ char *buf = NULL;
unsigned long flags;
if (!ata_status(drive, DATA_READY, BAD_R_STAT)) {
if (drive->status & (ERR_STAT|DRQ_STAT))
- return ide_error(drive, rq, __FUNCTION__, drive->status);
+ return ata_error(drive, rq, __FUNCTION__);
if (!(drive->status & BUSY_STAT)) {
DTF("task_in_intr to Soon wait for next interrupt\n");
@@ -458,11 +443,11 @@
}
}
DTF("stat: %02x\n", drive->status);
- pBuf = ide_map_rq(rq, &flags);
- DTF("Read: %p, rq->current_nr_sectors: %d\n", pBuf, (int) rq->current_nr_sectors);
+ buf = ide_map_rq(rq, &flags);
+ DTF("Read: %p, rq->current_nr_sectors: %d\n", buf, (int) rq->current_nr_sectors);
- ata_read(drive, pBuf, SECTOR_WORDS);
- ide_unmap_rq(rq, pBuf, &flags);
+ ata_read(drive, buf, SECTOR_WORDS);
+ ide_unmap_rq(rq, buf, &flags);
/* First segment of the request is complete. note that this does not
* necessarily mean that the entire request is done!! this is only true
@@ -512,22 +497,22 @@
*/
static ide_startstop_t task_out_intr(struct ata_device *drive, struct request *rq)
{
- char *pBuf = NULL;
+ char *buf = NULL;
unsigned long flags;
if (!ata_status(drive, DRIVE_READY, drive->bad_wstat))
- return ide_error(drive, rq, __FUNCTION__, drive->status);
+ return ata_error(drive, rq, __FUNCTION__);
if (!rq->current_nr_sectors)
if (!ide_end_request(drive, rq, 1))
return ide_stopped;
if ((rq->nr_sectors == 1) != (drive->status & DRQ_STAT)) {
- pBuf = ide_map_rq(rq, &flags);
- DTF("write: %p, rq->current_nr_sectors: %d\n", pBuf, (int) rq->current_nr_sectors);
+ buf = ide_map_rq(rq, &flags);
+ DTF("write: %p, rq->current_nr_sectors: %d\n", buf, (int) rq->current_nr_sectors);
- ata_write(drive, pBuf, SECTOR_WORDS);
- ide_unmap_rq(rq, pBuf, &flags);
+ ata_write(drive, buf, SECTOR_WORDS);
+ ide_unmap_rq(rq, buf, &flags);
rq->errors = 0;
rq->current_nr_sectors--;
}
@@ -542,14 +527,14 @@
*/
static ide_startstop_t task_mulin_intr(struct ata_device *drive, struct request *rq)
{
- char *pBuf = NULL;
+ char *buf = NULL;
unsigned int msect, nsect;
unsigned long flags;
if (!ata_status(drive, DATA_READY, BAD_R_STAT)) {
- if (drive->status & (ERR_STAT|DRQ_STAT)) {
- return ide_error(drive, rq, __FUNCTION__, drive->status);
- }
+ if (drive->status & (ERR_STAT|DRQ_STAT))
+ return ata_error(drive, rq, __FUNCTION__);
+
/* no data yet, so wait for another interrupt */
ide_set_handler(drive, task_mulin_intr, WAIT_CMD, NULL);
return ide_started;
@@ -563,12 +548,12 @@
if (nsect > msect)
nsect = msect;
- pBuf = ide_map_rq(rq, &flags);
+ buf = ide_map_rq(rq, &flags);
DTF("Multiread: %p, nsect: %d , rq->current_nr_sectors: %d\n",
- pBuf, nsect, rq->current_nr_sectors);
- ata_read(drive, pBuf, nsect * SECTOR_WORDS);
- ide_unmap_rq(rq, pBuf, &flags);
+ buf, nsect, rq->current_nr_sectors);
+ ata_read(drive, buf, nsect * SECTOR_WORDS);
+ ide_unmap_rq(rq, buf, &flags);
rq->errors = 0;
rq->current_nr_sectors -= nsect;
msect -= nsect;
diff -urN linux-2.5.19/drivers/ide/main.c linux/drivers/ide/main.c
--- linux-2.5.19/drivers/ide/main.c 2002-06-01 18:53:06.000000000 +0200
+++ linux/drivers/ide/main.c 2002-06-01 18:59:44.000000000 +0200
@@ -205,9 +205,8 @@
struct ata_device *drive = &ch->drives[unit];
drive->type = ATA_DISK;
- drive->select.all = (unit<<4)|0xa0;
+ drive->select.all = (unit << 4) | 0xa0;
drive->channel = ch;
- drive->ctl = 0x08;
drive->ready_stat = READY_STAT;
drive->bad_wstat = BAD_W_STAT;
sprintf(drive->name, "hd%c", 'a' + (index * MAX_DRIVES) + unit);
diff -urN linux-2.5.19/drivers/ide/ns87415.c linux/drivers/ide/ns87415.c
--- linux-2.5.19/drivers/ide/ns87415.c 2002-06-01 18:53:06.000000000 +0200
+++ linux/drivers/ide/ns87415.c 2002-06-01 19:25:31.000000000 +0200
@@ -141,10 +141,6 @@
struct pci_dev *dev = hwif->pci_dev;
unsigned int ctrl, using_inta;
byte progif;
-#ifdef __sparc_v9__
- int timeout;
- byte stat;
-#endif
/* Set a good latency timer and cache line size value. */
(void) pci_write_config_byte(dev, PCI_LATENCY_TIMER, 64);
@@ -197,16 +193,7 @@
* XXX: Reset the device, if we don't it will not respond
* to select properly during first probe.
*/
- timeout = 10000;
- outb(12, hwif->io_ports[IDE_CONTROL_OFFSET]);
- udelay(10);
- outb(8, hwif->io_ports[IDE_CONTROL_OFFSET]);
- do {
- udelay(50);
- stat = inb(hwif->io_ports[IDE_STATUS_OFFSET]);
- if (stat == 0xff)
- break;
- } while ((stat & BUSY_STAT) && --timeout);
+ ata_reset(struct ata_channel *hwif);
#endif
}
diff -urN linux-2.5.19/drivers/ide/pcidma.c linux/drivers/ide/pcidma.c
--- linux-2.5.19/drivers/ide/pcidma.c 2002-06-01 18:53:06.000000000 +0200
+++ linux/drivers/ide/pcidma.c 2002-06-01 17:19:51.000000000 +0200
@@ -41,6 +41,7 @@
{
u8 dma_stat;
dma_stat = udma_stop(drive);
+
if (ata_status(drive, DRIVE_READY, drive->bad_wstat | DRQ_STAT)) {
if (!dma_stat) {
__ide_end_request(drive, rq, 1, rq->nr_sectors);
@@ -49,7 +50,8 @@
printk(KERN_ERR "%s: dma_intr: bad DMA status (dma_stat=%x)\n",
drive->name, dma_stat);
}
- return ide_error(drive, rq, "dma_intr", drive->status);
+
+ return ata_error(drive, rq, __FUNCTION__);
}
/*
@@ -118,7 +120,7 @@
static int dma_timer_expiry(struct ata_device *drive, struct request *rq)
{
/* FIXME: What's that? */
- u8 dma_stat = inb(drive->channel->dma_base+2);
+ u8 dma_stat = inb(drive->channel->dma_base + 2);
#ifdef DEBUG
printk("%s: dma_timer_expiry: dma status == 0x%02x\n", drive->name, dma_stat);
@@ -130,10 +132,11 @@
if (dma_stat & 2) { /* ERROR */
ata_status(drive, 0, 0);
- return ide_error(drive, rq, "dma_timer_expiry", drive->status);
+ return ata_error(drive, rq, __FUNCTION__);
}
if (dma_stat & 1) /* DMAing */
return WAIT_CMD;
+
return 0;
}
diff -urN linux-2.5.19/drivers/ide/pdc202xx.c linux/drivers/ide/pdc202xx.c
--- linux-2.5.19/drivers/ide/pdc202xx.c 2002-05-29 20:42:58.000000000 +0200
+++ linux/drivers/ide/pdc202xx.c 2002-06-01 19:27:10.000000000 +0200
@@ -686,9 +686,11 @@
void pdc202xx_new_reset(struct ata_device *drive)
{
- set_reg_and_wait(0x04,IDE_CONTROL_REG, 1000);
- set_reg_and_wait(0x00,IDE_CONTROL_REG, 1000);
- printk("PDC202XX: %s channel reset.\n",
+ ata_reset(drive->channel);
+ mdelay(1000);
+ ata_irq_enable(drive, 1);
+ mdelay(1000);
+ printk(KERN_INFO "PDC202XX: %s channel reset.\n",
drive->channel->unit ? "Secondary" : "Primary");
}
diff -urN linux-2.5.19/drivers/ide/pdc4030.c linux/drivers/ide/pdc4030.c
--- linux-2.5.19/drivers/ide/pdc4030.c 2002-06-01 18:53:06.000000000 +0200
+++ linux/drivers/ide/pdc4030.c 2002-06-01 18:24:23.000000000 +0200
@@ -243,9 +243,8 @@
if (inb(IDE_NSECTOR_REG) == 0xFF || inb(IDE_SECTOR_REG) == 0xFF) {
return 0;
}
- if (IDE_CONTROL_REG)
- outb(0x08, IDE_CONTROL_REG);
- if (pdc4030_cmd(drive,PROMISE_GET_CONFIG)) {
+ ata_irq_enable(drive, 1);
+ if (pdc4030_cmd(drive, PROMISE_GET_CONFIG)) {
return 0;
}
if (ide_wait_stat(&startstop, drive, NULL, DATA_READY,BAD_W_STAT,WAIT_DRQ)) {
@@ -379,7 +378,7 @@
char *to;
if (!ata_status(drive, DATA_READY, BAD_R_STAT))
- return ide_error(drive, rq, "promise_read_intr", drive->status);
+ return ata_error(drive, rq, __FUNCTION__);
read_again:
do {
@@ -438,7 +437,7 @@
}
printk(KERN_ERR "%s: Eeek! promise_read_intr: sectors left "
"!DRQ !BUSY\n", drive->name);
- return ide_error(drive, rq, "promise read intr", drive->status);
+ return ata_error(drive, rq, "promise read intr");
}
return ide_stopped;
}
@@ -463,7 +462,7 @@
ch->poll_timeout = 0;
printk(KERN_ERR "%s: completion timeout - still busy!\n",
drive->name);
- return ide_error(drive, rq, "busy timeout", drive->status);
+ return ata_error(drive, rq, "busy timeout");
}
ch->poll_timeout = 0;
@@ -540,9 +539,9 @@
return ide_started; /* continue polling... */
}
ch->poll_timeout = 0;
- printk(KERN_ERR "%s: write timed out!\n",drive->name);
+ printk(KERN_ERR "%s: write timed out!\n", drive->name);
ata_status(drive, 0, 0);
- return ide_error(drive, rq, "write timeout", drive->status);
+ return ata_error(drive, rq, "write timeout");
}
/*
@@ -616,11 +615,11 @@
if (!(rq->flags & REQ_CMD)) {
blk_dump_rq_flags(rq, "pdc4030 bad flags");
ide_end_request(drive, rq, 0);
+
return ide_stopped;
}
- if (IDE_CONTROL_REG)
- outb(drive->ctl, IDE_CONTROL_REG); /* clear nIEN */
+ ata_irq_enable(drive, 1); /* clear nIEN */
ata_mask(drive);
outb(taskfile->feature, IDE_FEATURE_REG);
diff -urN linux-2.5.19/drivers/ide/probe.c linux/drivers/ide/probe.c
--- linux-2.5.19/drivers/ide/probe.c 2002-06-01 18:53:06.000000000 +0200
+++ linux/drivers/ide/probe.c 2002-06-01 19:15:27.000000000 +0200
@@ -267,6 +267,34 @@
#endif
}
+void ide_fixstring(char *s, const int bytecount, const int byteswap)
+{
+ char *p = s;
+ char *end = &s[bytecount & ~1]; /* bytecount must be even */
+
+ if (byteswap) {
+ /* convert from big-endian to host byte order */
+ for (p = end ; p != s;) {
+ unsigned short *pp = (unsigned short *) (p -= 2);
+ *pp = ntohs(*pp);
+ }
+ }
+
+ /* strip leading blanks */
+ while (s != end && *s == ' ')
+ ++s;
+
+ /* compress internal blanks and strip trailing blanks */
+ while (s != end && *s) {
+ if (*s++ != ' ' || (s != end && *s && *s != ' '))
+ *p++ = *(s-1);
+ }
+
+ /* wipe out trailing garbage */
+ while (p != end)
+ *p++ = '\0';
+}
+
/*
* All hosts that use the 80c ribbon must use this!
*/
@@ -280,7 +308,7 @@
}
/*
- * Similar to ide_wait_stat(), except it never calls ide_error internally.
+ * Similar to ide_wait_stat(), except it never calls ata_error internally.
* This is a kludge to handle the new ide_config_drive_speed() function,
* and should not otherwise be used anywhere. Eventually, the tuneproc's
* should be updated to return ide_startstop_t, in which case we can get
@@ -292,13 +320,13 @@
*/
int ide_config_drive_speed(struct ata_device *drive, byte speed)
{
- struct ata_channel *hwif = drive->channel;
+ struct ata_channel *ch = drive->channel;
int i;
int error = 1;
#if defined(CONFIG_BLK_DEV_IDEDMA) && !defined(__CRIS__)
u8 unit = (drive->select.b.unit & 0x01);
- outb(inb(hwif->dma_base + 2) & ~(1 << (5 + unit)), hwif->dma_base + 2);
+ outb(inb(ch->dma_base + 2) & ~(1 << (5 + unit)), ch->dma_base + 2);
#endif
/*
@@ -309,18 +337,17 @@
/*
* Select the drive, and issue the SETFEATURES command
*/
- disable_irq(hwif->irq); /* disable_irq_nosync ?? */
+ disable_irq(ch->irq); /* disable_irq_nosync ?? */
udelay(1);
ata_select(drive, 0);
ata_mask(drive);
udelay(1);
- if (IDE_CONTROL_REG)
- OUT_BYTE(drive->ctl | 2, IDE_CONTROL_REG);
+ ata_irq_enable(drive, 0);
OUT_BYTE(speed, IDE_NSECTOR_REG);
OUT_BYTE(SETFEATURES_XFER, IDE_FEATURE_REG);
OUT_BYTE(WIN_SETFEATURES, IDE_COMMAND_REG);
- if ((IDE_CONTROL_REG) && (drive->quirk_list == 2))
- OUT_BYTE(drive->ctl, IDE_CONTROL_REG);
+ if (drive->quirk_list == 2)
+ ata_irq_enable(drive, 1);
udelay(1);
/*
@@ -355,7 +382,7 @@
ata_mask(drive);
- enable_irq(hwif->irq);
+ enable_irq(ch->irq);
if (error) {
ide_dump_status(drive, NULL, "set_drive_speed_status", drive->status);
@@ -368,9 +395,9 @@
#if defined(CONFIG_BLK_DEV_IDEDMA) && !defined(__CRIS__)
if (speed > XFER_PIO_4) {
- outb(inb(hwif->dma_base+2)|(1<<(5+unit)), hwif->dma_base+2);
+ outb(inb(ch->dma_base + 2)|(1 << (5 + unit)), ch->dma_base + 2);
} else {
- outb(inb(hwif->dma_base+2) & ~(1<<(5+unit)), hwif->dma_base+2);
+ outb(inb(ch->dma_base + 2) & ~(1 << (5 + unit)), ch->dma_base + 2);
}
#endif
@@ -391,6 +418,7 @@
case XFER_SW_DMA_0: drive->id->dma_1word |= 0x0101; break;
default: break;
}
+
return error;
}
@@ -446,9 +474,9 @@
|| (id->model[0] == 'P' && id->model[1] == 'i'))/* Pioneer */
bswap ^= 1; /* Vertos drives may still be weird */
}
- ide_fixstring (id->model, sizeof(id->model), bswap);
- ide_fixstring (id->fw_rev, sizeof(id->fw_rev), bswap);
- ide_fixstring (id->serial_no, sizeof(id->serial_no), bswap);
+ ide_fixstring(id->model, sizeof(id->model), bswap);
+ ide_fixstring(id->fw_rev, sizeof(id->fw_rev), bswap);
+ ide_fixstring(id->serial_no, sizeof(id->serial_no), bswap);
if (strstr(id->model, "E X A B Y T E N E S T"))
goto err_misc;
@@ -566,36 +594,40 @@
*/
static int identify(struct ata_device *drive, u8 cmd)
{
- int rc;
+ struct ata_channel *ch = drive->channel;
+ int rc = 1;
int autoprobe = 0;
unsigned long cookie = 0;
ide_ioreg_t hd_status;
unsigned long timeout;
- u8 s;
- u8 a;
- if (IDE_CONTROL_REG && !drive->channel->irq) {
- autoprobe = 1;
- cookie = probe_irq_on();
- OUT_BYTE(drive->ctl,IDE_CONTROL_REG); /* enable device irq */
- }
+ /* FIXME: perhaps we should be just using allways the status register,
+ * since it should simplify the code significantly.
+ */
+ if (ch->io_ports[IDE_CONTROL_OFFSET]) {
+ u8 s;
+ u8 a;
+
+ if (!drive->channel->irq) {
+ autoprobe = 1;
+ cookie = probe_irq_on();
+ ata_irq_enable(drive, 1); /* enable device irq */
+ }
- rc = 1;
- if (IDE_CONTROL_REG) {
/* take a deep breath */
mdelay(50);
- a = IN_BYTE(IDE_ALTSTATUS_REG);
- s = IN_BYTE(IDE_STATUS_REG);
+ a = IN_BYTE(ch->io_ports[IDE_ALTSTATUS_OFFSET]);
+ s = IN_BYTE(ch->io_ports[IDE_STATUS_OFFSET]);
if ((a ^ s) & ~INDEX_STAT) {
printk("%s: probing with STATUS(0x%02x) instead of ALTSTATUS(0x%02x)\n", drive->name, s, a);
- hd_status = IDE_STATUS_REG; /* ancient Seagate drives, broken interfaces */
+ hd_status = ch->io_ports[IDE_STATUS_OFFSET]; /* ancient Seagate drives, broken interfaces */
} else {
- hd_status = IDE_ALTSTATUS_REG; /* use non-intrusive polling */
+ hd_status = ch->io_ports[IDE_ALTSTATUS_OFFSET]; /* use non-intrusive polling */
}
} else {
mdelay(50);
- hd_status = IDE_STATUS_REG;
+ hd_status = ch->io_ports[IDE_STATUS_OFFSET];
}
/* set features register for atapi identify command to be sure of reply */
@@ -637,8 +669,8 @@
if (autoprobe) {
int irq;
- OUT_BYTE(drive->ctl | 0x02, IDE_CONTROL_REG); /* mask device irq */
- ata_status(drive, 0, 0); /* clear drive IRQ */
+ ata_irq_enable(drive, 0); /* mask device irq */
+ ata_status(drive, 0, 0); /* clear drive IRQ */
udelay(5);
irq = probe_irq_off(cookie);
if (!drive->channel->irq) {
@@ -855,19 +887,8 @@
device_register(&ch->dev);
- if (ch->reset && ch->io_ports[IDE_CONTROL_OFFSET]) {
- unsigned long timeout = jiffies + WAIT_WORSTCASE;
- u8 stat;
-
- printk("%s: reset\n", ch->name);
- OUT_BYTE(12, ch->io_ports[IDE_CONTROL_OFFSET]);
- udelay(10);
- OUT_BYTE(8, ch->io_ports[IDE_CONTROL_OFFSET]);
- do {
- mdelay(50);
- stat = IN_BYTE(ch->io_ports[IDE_STATUS_OFFSET]);
- } while ((stat & BUSY_STAT) && time_before(jiffies, timeout));
- }
+ if (ch->reset)
+ ata_reset(ch);
__restore_flags(flags); /* local CPU only */
@@ -969,14 +990,19 @@
* Allocate the irq, if not already obtained for another channel
*/
if (!match || match->irq != ch->irq) {
+ struct ata_device tmp;
#ifdef CONFIG_IDEPCI_SHARE_IRQ
int sa = IDE_CHIPSET_IS_PCI(ch->chipset) ? SA_SHIRQ : SA_INTERRUPT;
#else
int sa = IDE_CHIPSET_IS_PCI(ch->chipset) ? SA_INTERRUPT|SA_SHIRQ : SA_INTERRUPT;
#endif
- if (ch->io_ports[IDE_CONTROL_OFFSET])
- OUT_BYTE(0x08, ch->io_ports[IDE_CONTROL_OFFSET]); /* clear nIEN */
+ /* Enable interrupts triggered by the drive. We use a shallow
+ * device structure, just to use the generic function very
+ * early.
+ */
+ tmp.channel = ch;
+ ata_irq_enable(&tmp, 1);
if (request_irq(ch->irq, &ata_irq_request, sa, ch->name, ch)) {
if (!match) {
@@ -1240,5 +1266,6 @@
}
EXPORT_SYMBOL(ata_fix_driveid);
+EXPORT_SYMBOL(ide_fixstring);
EXPORT_SYMBOL(eighty_ninty_three);
EXPORT_SYMBOL(ide_config_drive_speed);
diff -urN linux-2.5.19/drivers/ide/qd65xx.c linux/drivers/ide/qd65xx.c
--- linux-2.5.19/drivers/ide/qd65xx.c 2002-05-29 20:42:50.000000000 +0200
+++ linux/drivers/ide/qd65xx.c 2002-06-01 16:48:03.000000000 +0200
@@ -173,9 +173,7 @@
if (!*drive->id->model) return 0;
- strncpy(model,drive->id->model,40);
- ide_fixstring(model,40,1); /* byte-swap */
-
+ strncpy(model,drive->id->model, 40);
for (p = qd65xx_timing ; p->offset != -1 ; p++) {
if (!strncmp(p->model, model+p->offset, 4)) {
printk(KERN_DEBUG "%s: listed !\n", drive->name);
diff -urN linux-2.5.19/drivers/ide/tcq.c linux/drivers/ide/tcq.c
--- linux-2.5.19/drivers/ide/tcq.c 2002-06-01 18:53:06.000000000 +0200
+++ linux/drivers/ide/tcq.c 2002-06-01 17:41:40.000000000 +0200
@@ -55,17 +55,6 @@
static ide_startstop_t ide_dmaq_intr(struct ata_device *drive, struct request *rq);
static ide_startstop_t service(struct ata_device *drive, struct request *rq);
-static inline void drive_ctl_nien(struct ata_device *drive, int set)
-{
-#ifdef IDE_TCQ_NIEN
- if (IDE_CONTROL_REG) {
- int mask = set ? 0x02 : 0x00;
-
- OUT_BYTE(drive->ctl | mask, IDE_CONTROL_REG);
- }
-#endif
-}
-
static ide_startstop_t tcq_nop_handler(struct ata_device *drive, struct request *rq)
{
struct ata_taskfile *args = rq->special;
@@ -136,11 +125,10 @@
rq->rq_dev = mk_kdev(drive->channel->major, (drive->select.b.unit)<<PARTN_BITS);
_elv_add_request(q, rq, 0, 0);
- /*
- * make sure that nIEN is cleared
- */
out:
- drive_ctl_nien(drive, 0);
+#ifdef IDE_TCQ_NIEN
+ ata_irq_enable(drive, 1);
+#endif
/*
* start doing stuff again
@@ -250,8 +238,9 @@
if (drive != drive->channel->drive)
ata_select(drive, 10);
- drive_ctl_nien(drive, 1);
-
+#ifdef IDE_TCQ_NIEN
+ ata_irq_enable(drive, 0);
+#endif
/*
* send SERVICE, wait 400ns, wait for BUSY_STAT to clear
*/
@@ -265,7 +254,9 @@
return ide_stopped;
}
- drive_ctl_nien(drive, 0);
+#ifdef IDE_TCQ_NIEN
+ ata_irq_enable(drive, 1);
+#endif
/*
* FIXME, invalidate queue
@@ -559,7 +550,9 @@
* set nIEN, tag start operation will enable again when
* it is safe
*/
- drive_ctl_nien(drive, 1);
+#ifdef IDE_TCQ_NIEN
+ ata_irq_enable(drive, 0);
+#endif
OUT_BYTE(args->taskfile.command, IDE_COMMAND_REG);
@@ -569,7 +562,9 @@
return ide_stopped;
}
- drive_ctl_nien(drive, 0);
+#ifdef IDE_TCQ_NIEN
+ ata_irq_enable(drive, 1);
+#endif
if (stat & ERR_STAT) {
ide_dump_status(drive, rq, "tcq_start", stat);
diff -urN linux-2.5.19/drivers/ide/trm290.c linux/drivers/ide/trm290.c
--- linux-2.5.19/drivers/ide/trm290.c 2002-05-29 20:42:48.000000000 +0200
+++ linux/drivers/ide/trm290.c 2002-06-01 17:18:46.000000000 +0200
@@ -222,7 +222,7 @@
if (drive->type != ATA_DISK)
return 0;
- ide_set_handler(drive, &ide_dma_intr, WAIT_CMD, NULL);
+ ide_set_handler(drive, ide_dma_intr, WAIT_CMD, NULL);
OUT_BYTE(reading ? WIN_READDMA : WIN_WRITEDMA, IDE_COMMAND_REG);
return 0;
diff -urN linux-2.5.19/drivers/scsi/ide-scsi.c linux/drivers/scsi/ide-scsi.c
--- linux-2.5.19/drivers/scsi/ide-scsi.c 2002-06-01 18:53:06.000000000 +0200
+++ linux/drivers/scsi/ide-scsi.c 2002-06-01 19:03:48.000000000 +0200
@@ -411,8 +411,7 @@
}
ata_select(drive, 10);
- if (IDE_CONTROL_REG)
- OUT_BYTE (drive->ctl,IDE_CONTROL_REG);
+ ata_irq_enable(drive, 1);
OUT_BYTE (dma_ok,IDE_FEATURE_REG);
OUT_BYTE (bcount >> 8,IDE_BCOUNTH_REG);
OUT_BYTE (bcount & 0xff,IDE_BCOUNTL_REG);
diff -urN linux-2.5.19/include/linux/ide.h linux/include/linux/ide.h
--- linux-2.5.19/include/linux/ide.h 2002-06-01 18:53:06.000000000 +0200
+++ linux/include/linux/ide.h 2002-06-01 19:36:29.000000000 +0200
@@ -38,11 +38,6 @@
# define SUPPORT_SLOW_DATA_PORTS 1 /* 0 to reduce kernel size */
#endif
-/* Right now this is only needed by a promise controlled.
- */
-#ifndef OK_TO_RESET_CONTROLLER /* 1 needed for good error recovery */
-# define OK_TO_RESET_CONTROLLER 0 /* 0 for use with AH2372A/B interface */
-#endif
#ifndef FANCY_STATUS_DUMPS /* 1 for human-readable drive errors */
# define FANCY_STATUS_DUMPS 1 /* 0 to reduce kernel size */
#endif
@@ -73,21 +68,22 @@
*/
enum {
- IDE_DATA_OFFSET = 0,
- IDE_ERROR_OFFSET = 1,
- IDE_NSECTOR_OFFSET = 2,
- IDE_SECTOR_OFFSET = 3,
- IDE_LCYL_OFFSET = 4,
- IDE_HCYL_OFFSET = 5,
- IDE_SELECT_OFFSET = 6,
- IDE_STATUS_OFFSET = 7,
- IDE_CONTROL_OFFSET = 8,
- IDE_IRQ_OFFSET = 9,
- IDE_NR_PORTS = 10
+ IDE_DATA_OFFSET = 0,
+ IDE_ERROR_OFFSET = 1,
+ IDE_FEATURE_OFFSET = 1,
+ IDE_NSECTOR_OFFSET = 2,
+ IDE_SECTOR_OFFSET = 3,
+ IDE_LCYL_OFFSET = 4,
+ IDE_HCYL_OFFSET = 5,
+ IDE_SELECT_OFFSET = 6,
+ IDE_STATUS_OFFSET = 7,
+ IDE_COMMAND_OFFSET = 7,
+ IDE_CONTROL_OFFSET = 8,
+ IDE_ALTSTATUS_OFFSET = 8,
+ IDE_IRQ_OFFSET = 9,
+ IDE_NR_PORTS = 10
};
-#define IDE_FEATURE_OFFSET IDE_ERROR_OFFSET
-#define IDE_COMMAND_OFFSET IDE_STATUS_OFFSET
#define IDE_DATA_REG (drive->channel->io_ports[IDE_DATA_OFFSET])
#define IDE_ERROR_REG (drive->channel->io_ports[IDE_ERROR_OFFSET])
@@ -96,20 +92,16 @@
#define IDE_LCYL_REG (drive->channel->io_ports[IDE_LCYL_OFFSET])
#define IDE_HCYL_REG (drive->channel->io_ports[IDE_HCYL_OFFSET])
#define IDE_SELECT_REG (drive->channel->io_ports[IDE_SELECT_OFFSET])
-#define IDE_STATUS_REG (drive->channel->io_ports[IDE_STATUS_OFFSET])
-#define IDE_CONTROL_REG (drive->channel->io_ports[IDE_CONTROL_OFFSET])
+#define IDE_COMMAND_REG (drive->channel->io_ports[IDE_STATUS_OFFSET])
#define IDE_IRQ_REG (drive->channel->io_ports[IDE_IRQ_OFFSET])
#define IDE_FEATURE_REG IDE_ERROR_REG
-#define IDE_COMMAND_REG IDE_STATUS_REG
-#define IDE_ALTSTATUS_REG IDE_CONTROL_REG
#define IDE_IREASON_REG IDE_NSECTOR_REG
#define IDE_BCOUNTL_REG IDE_LCYL_REG
#define IDE_BCOUNTH_REG IDE_HCYL_REG
#define GET_ERR() IN_BYTE(IDE_ERROR_REG)
-#define GET_STAT() IN_BYTE(IDE_STATUS_REG)
-#define GET_ALTSTAT() IN_BYTE(IDE_CONTROL_REG)
+#define GET_ALTSTAT() IN_BYTE(drive->channel->io_ports[IDE_CONTROL_OFFSET])
#define GET_FEAT() IN_BYTE(IDE_NSECTOR_REG)
#define BAD_R_STAT (BUSY_STAT | ERR_STAT)
@@ -346,8 +338,6 @@
byte scsi; /* 0=default, 1=skip current ide-subdriver for ide-scsi emulation */
select_t select; /* basic drive/head select reg value */
-
- u8 ctl; /* "normal" value for IDE_CONTROL_REG */
u8 status; /* last retrived status value for device */
byte ready_stat; /* min status value for drive ready */
@@ -653,25 +643,10 @@
*/
extern u8 ide_dump_status(struct ata_device *, struct request *rq, const char *, u8);
-extern ide_startstop_t ide_error(struct ata_device *, struct request *rq,
- const char *, byte);
+extern ide_startstop_t ata_error(struct ata_device *, struct request *rq, const char *);
-/*
- * ide_fixstring() cleans up and (optionally) byte-swaps a text string,
- * removing leading/trailing blanks and compressing internal blanks.
- * It is primarily used to tidy up the model name/number fields as
- * returned by the WIN_[P]IDENTIFY commands.
- */
-void ide_fixstring(byte *s, const int bytecount, const int byteswap);
+extern void ide_fixstring(char *s, const int bytecount, const int byteswap);
-/*
- * This routine busy-waits for the drive status to be not "busy".
- * It then checks the status for all of the "good" bits and none
- * of the "bad" bits, and if all is okay it returns 0. All other
- * cases return 1 after doing "*startstop = ide_error()", and the
- * caller should return the updated value of "startstop" in this case.
- * "startstop" is unchanged when the function returns 0;
- */
extern int ide_wait_stat(ide_startstop_t *,
struct ata_device *, struct request *rq,
byte, byte, unsigned long);
@@ -896,5 +871,7 @@
extern void ata_select(struct ata_device *, unsigned long);
extern void ata_mask(struct ata_device *);
extern int ata_status(struct ata_device *, u8, u8);
+extern int ata_irq_enable(struct ata_device *, int);
+extern void ata_reset(struct ata_channel *);
#endif
^ permalink raw reply [flat|nested] 35+ messages in thread* Re: [PATCH] 2.5.19 IDE 78
2002-06-02 6:04 ` [PATCH] 2.5.19 IDE 78 Martin Dalecki
@ 2002-06-02 8:16 ` Paul Dickson
2002-06-02 9:21 ` Paul Mackerras
1 sibling, 0 replies; 35+ messages in thread
From: Paul Dickson @ 2002-06-02 8:16 UTC (permalink / raw)
To: Martin Dalecki; +Cc: linux-kernel
On Sun, 02 Jun 2002 08:04:59 +0200, Martin Dalecki wrote:
> static void hpt3xx_maskproc(struct ata_device *drive)
> {
> struct pci_dev *dev = drive->channel->pci_dev;
> - const int mask = 0;
> + struct ata_channel *ch = drive->channel;
>
> if (drive->quirk_list) {
> if (hpt_min_rev(dev, 3)) {
> u8 reg5a;
> pci_read_config_byte(dev, 0x5a, ®5a);
> - if (((reg5a & 0x10) >> 4) != mask)
> - pci_write_config_byte(dev, 0x5a, mask ? (reg5a | 0x10) : (reg5a & ~0x10));
[...]
> + if ((reg5a & 0x10) >> 4)
> + pci_write_config_byte(dev, 0x5a, reg5a & ~0x10);
Perhaps you can remove the " >> 4" too.
-Paul
^ permalink raw reply [flat|nested] 35+ messages in thread* Re: [PATCH] 2.5.19 IDE 78
2002-06-02 6:04 ` [PATCH] 2.5.19 IDE 78 Martin Dalecki
2002-06-02 8:16 ` Paul Dickson
@ 2002-06-02 9:21 ` Paul Mackerras
2002-06-02 19:34 ` Martin Dalecki
1 sibling, 1 reply; 35+ messages in thread
From: Paul Mackerras @ 2002-06-02 9:21 UTC (permalink / raw)
To: Martin Dalecki; +Cc: Linus Torvalds, Kernel Mailing List
Martin,
I think you have a typo here:
> diff -urN linux-2.5.19/drivers/ide/ide-pmac.c linux/drivers/ide/ide-pmac.c
> --- linux-2.5.19/drivers/ide/ide-pmac.c 2002-06-01 18:53:06.000000000 +0200
> +++ linux/drivers/ide/ide-pmac.c 2002-06-01 18:17:36.000000000 +0200
> @@ -434,7 +434,7 @@
> goto out;
> }
> udelay(10);
> - OUT_BYTE(drive->ctl | 2, IDE_CONTROL_REG);
> + ata_irq_enale(drive, 0);
ata_irq_enable surely?
Also, we need the patch below now that ata_channel.active is a
pointer.
Paul.
diff -urN linux-2.5/drivers/ide/ide-pmac.c pmac-2.5/drivers/ide/ide-pmac.c
--- linux-2.5/drivers/ide/ide-pmac.c Sun Jun 2 14:45:47 2002
+++ pmac-2.5/drivers/ide/ide-pmac.c Sun Jun 2 15:41:31 2002
@@ -1584,9 +1584,9 @@
*/
if (used_dma && !ide_spin_wait_hwgroup(drive)) {
/* Lock HW group */
- set_bit(IDE_BUSY, &drive->channel->active);
+ set_bit(IDE_BUSY, drive->channel->active);
pmac_ide_check_dma(drive);
- clear_bit(IDE_BUSY, &drive->channel->active);
+ clear_bit(IDE_BUSY, drive->channel->active);
spin_unlock_irq(drive->channel->lock);
}
#endif
@@ -1633,7 +1633,7 @@
return;
else {
/* Lock HW group */
- set_bit(IDE_BUSY, &drive->channel->active);
+ set_bit(IDE_BUSY, drive->channel->active);
/* Stop the device */
idepmac_sleep_device(drive, idx, base);
spin_unlock_irq(drive->channel->lock);
@@ -1663,7 +1663,7 @@
/* We resume processing on the lock group */
spin_lock_irq(drive->channel->lock);
- clear_bit(IDE_BUSY, &drive->channel->active);
+ clear_bit(IDE_BUSY, drive->channel->active);
if (!list_empty(&drive->queue.queue_head))
do_ide_request(&drive->queue);
spin_unlock_irq(drive->channel->lock);
^ permalink raw reply [flat|nested] 35+ messages in thread* Re: [PATCH] 2.5.19 IDE 78
2002-06-02 9:21 ` Paul Mackerras
@ 2002-06-02 19:34 ` Martin Dalecki
2002-06-02 21:36 ` Bartlomiej Zolnierkiewicz
2002-06-02 21:59 ` Paul Mackerras
0 siblings, 2 replies; 35+ messages in thread
From: Martin Dalecki @ 2002-06-02 19:34 UTC (permalink / raw)
To: Paul Mackerras; +Cc: Linus Torvalds, Kernel Mailing List
Paul Mackerras wrote:
> Martin,
>
> I think you have a typo here:
>
>
>>diff -urN linux-2.5.19/drivers/ide/ide-pmac.c linux/drivers/ide/ide-pmac.c
>>--- linux-2.5.19/drivers/ide/ide-pmac.c 2002-06-01 18:53:06.000000000 +0200
>>+++ linux/drivers/ide/ide-pmac.c 2002-06-01 18:17:36.000000000 +0200
>>@@ -434,7 +434,7 @@
>> goto out;
>> }
>> udelay(10);
>>- OUT_BYTE(drive->ctl | 2, IDE_CONTROL_REG);
>>+ ata_irq_enale(drive, 0);
For sure not. The nIEN bit is *negated* on the part of the
device - please look at the ata_irq_enable() functions definition.
I have explained it there.
> ata_irq_enable surely?
The toggle is the second parameter becouse I didn't wan't to
provide two functions. - 0 measn disable it 1 means enable it.
>
> Also, we need the patch below now that ata_channel.active is a
> pointer.
That actually is obviously correct - thank's I will include it.
>
> Paul.
>
> diff -urN linux-2.5/drivers/ide/ide-pmac.c pmac-2.5/drivers/ide/ide-pmac.c
> --- linux-2.5/drivers/ide/ide-pmac.c Sun Jun 2 14:45:47 2002
> +++ pmac-2.5/drivers/ide/ide-pmac.c Sun Jun 2 15:41:31 2002
> @@ -1584,9 +1584,9 @@
> */
> if (used_dma && !ide_spin_wait_hwgroup(drive)) {
> /* Lock HW group */
> - set_bit(IDE_BUSY, &drive->channel->active);
> + set_bit(IDE_BUSY, drive->channel->active);
> pmac_ide_check_dma(drive);
> - clear_bit(IDE_BUSY, &drive->channel->active);
> + clear_bit(IDE_BUSY, drive->channel->active);
> spin_unlock_irq(drive->channel->lock);
> }
> #endif
> @@ -1633,7 +1633,7 @@
> return;
> else {
> /* Lock HW group */
> - set_bit(IDE_BUSY, &drive->channel->active);
> + set_bit(IDE_BUSY, drive->channel->active);
> /* Stop the device */
> idepmac_sleep_device(drive, idx, base);
> spin_unlock_irq(drive->channel->lock);
> @@ -1663,7 +1663,7 @@
>
> /* We resume processing on the lock group */
> spin_lock_irq(drive->channel->lock);
> - clear_bit(IDE_BUSY, &drive->channel->active);
> + clear_bit(IDE_BUSY, drive->channel->active);
> if (!list_empty(&drive->queue.queue_head))
> do_ide_request(&drive->queue);
> spin_unlock_irq(drive->channel->lock);
>
>
--
- phone: +49 214 8656 283
- job: eVision-Ventures AG, LEV .de (MY OPINIONS ARE MY OWN!)
- langs: de_DE.ISO8859-1, en_US, pl_PL.ISO8859-2, last ressort: ru_RU.KOI8-R
^ permalink raw reply [flat|nested] 35+ messages in thread* Re: [PATCH] 2.5.19 IDE 78
2002-06-02 19:34 ` Martin Dalecki
@ 2002-06-02 21:36 ` Bartlomiej Zolnierkiewicz
2002-06-02 21:59 ` Paul Mackerras
1 sibling, 0 replies; 35+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2002-06-02 21:36 UTC (permalink / raw)
To: Martin Dalecki; +Cc: Paul Mackerras, Kernel Mailing List
On Sun, 2 Jun 2002, Martin Dalecki wrote:
> Paul Mackerras wrote:
> > Martin,
> >
> > I think you have a typo here:
> >
> >
> >>diff -urN linux-2.5.19/drivers/ide/ide-pmac.c linux/drivers/ide/ide-pmac.c
> >>--- linux-2.5.19/drivers/ide/ide-pmac.c 2002-06-01 18:53:06.000000000 +0200
> >>+++ linux/drivers/ide/ide-pmac.c 2002-06-01 18:17:36.000000000 +0200
> >>@@ -434,7 +434,7 @@
> >> goto out;
> >> }
> >> udelay(10);
> >>- OUT_BYTE(drive->ctl | 2, IDE_CONTROL_REG);
> >>+ ata_irq_enale(drive, 0);
>
I think Paul was talking about ata_irq_enale() ;)
> For sure not. The nIEN bit is *negated* on the part of the
> device - please look at the ata_irq_enable() functions definition.
> I have explained it there.
>
> > ata_irq_enable surely?
>
> The toggle is the second parameter becouse I didn't wan't to
> provide two functions. - 0 measn disable it 1 means enable it.>
--
Bartlomiej
^ permalink raw reply [flat|nested] 35+ messages in thread
* Re: [PATCH] 2.5.19 IDE 78
2002-06-02 19:34 ` Martin Dalecki
2002-06-02 21:36 ` Bartlomiej Zolnierkiewicz
@ 2002-06-02 21:59 ` Paul Mackerras
2002-06-03 4:47 ` Martin Dalecki
1 sibling, 1 reply; 35+ messages in thread
From: Paul Mackerras @ 2002-06-02 21:59 UTC (permalink / raw)
To: Martin Dalecki; +Cc: Linus Torvalds, Kernel Mailing List
> >>- OUT_BYTE(drive->ctl | 2, IDE_CONTROL_REG);
> >>+ ata_irq_enale(drive, 0);
>
> For sure not. The nIEN bit is *negated* on the part of the
> device - please look at the ata_irq_enable() functions definition.
> I have explained it there.
Martin, that's a bit of your patch I was quoting. I was just trying
to point out that you wrote "ata_irq_enale" instead of "ata_irq_enable".
Paul.
^ permalink raw reply [flat|nested] 35+ messages in thread
* Re: [PATCH] 2.5.19 IDE 78
2002-06-02 21:59 ` Paul Mackerras
@ 2002-06-03 4:47 ` Martin Dalecki
0 siblings, 0 replies; 35+ messages in thread
From: Martin Dalecki @ 2002-06-03 4:47 UTC (permalink / raw)
To: Paul Mackerras; +Cc: Linus Torvalds, Kernel Mailing List
Paul Mackerras wrote:
>>>>- OUT_BYTE(drive->ctl | 2, IDE_CONTROL_REG);
>>>>+ ata_irq_enale(drive, 0);
>>>
>>For sure not. The nIEN bit is *negated* on the part of the
>>device - please look at the ata_irq_enable() functions definition.
>>I have explained it there.
>
>
> Martin, that's a bit of your patch I was quoting. I was just trying
> to point out that you wrote "ata_irq_enale" instead of "ata_irq_enable".
Yeep I realized and it's fixed in 82.
^ permalink raw reply [flat|nested] 35+ messages in thread
* [PATCH} 2.5.19 IDE 79
2002-05-29 18:50 Linux 2.5.19 Linus Torvalds
` (9 preceding siblings ...)
2002-06-02 6:04 ` [PATCH] 2.5.19 IDE 78 Martin Dalecki
@ 2002-06-02 6:06 ` Martin Dalecki
2002-06-02 6:07 ` [PATCH] 2.5.19 IDE 80 Martin Dalecki
` (2 subsequent siblings)
13 siblings, 0 replies; 35+ messages in thread
From: Martin Dalecki @ 2002-06-02 6:06 UTC (permalink / raw)
To: Linus Torvalds; +Cc: Kernel Mailing List
[-- Attachment #1: Type: text/plain, Size: 403 bytes --]
Sat Jun 1 21:31:47 CEST 2002 ide-clean-79
- Fix typo in sparc_v9 code, in ns87415, just introduced.
- Eliminate unnecessary struct hd_drive_hob_hdr those are
in reality precisely the same registers as usual.
- Eliminate control_t, nowhere used type.
- Unfold ide_init_drive_cmd() at the places where it's used. This makes obvious
that REQ_DRIVE_CMD gets only used on the ioctl command path.
[-- Attachment #2: ide-clean-79.diff --]
[-- Type: text/plain, Size: 26279 bytes --]
diff -urN linux-2.5.19/drivers/ide/device.c linux/drivers/ide/device.c
--- linux-2.5.19/drivers/ide/device.c 2002-06-01 23:17:28.000000000 +0200
+++ linux/drivers/ide/device.c 2002-06-01 22:14:42.000000000 +0200
@@ -142,4 +142,18 @@
EXPORT_SYMBOL(ata_reset);
+/*
+ * Output a complete register file.
+ */
+void ata_out_regfile(struct ata_device *drive, struct hd_drive_task_hdr *rf)
+{
+ struct ata_channel *ch = drive->channel;
+
+ OUT_BYTE(rf->feature, ch->io_ports[IDE_FEATURE_OFFSET]);
+ OUT_BYTE(rf->sector_count, ch->io_ports[IDE_NSECTOR_OFFSET]);
+ OUT_BYTE(rf->sector_number, ch->io_ports[IDE_SECTOR_OFFSET]);
+ OUT_BYTE(rf->low_cylinder, ch->io_ports[IDE_LCYL_OFFSET]);
+ OUT_BYTE(rf->high_cylinder, ch->io_ports[IDE_HCYL_OFFSET]);
+}
+
MODULE_LICENSE("GPL");
diff -urN linux-2.5.19/drivers/ide/ide.c linux/drivers/ide/ide.c
--- linux-2.5.19/drivers/ide/ide.c 2002-06-01 23:17:28.000000000 +0200
+++ linux/drivers/ide/ide.c 2002-06-01 22:41:03.000000000 +0200
@@ -673,19 +673,6 @@
}
/*
- * Issue a simple drive command. The drive must be selected beforehand.
- */
-static void drive_cmd(struct ata_device *drive, u8 cmd, u8 nsect)
-{
- ide_set_handler(drive, drive_cmd_intr, WAIT_CMD, NULL);
- ata_irq_enable(drive, 1);
- ata_mask(drive);
- OUT_BYTE(nsect, IDE_NSECTOR_REG);
- OUT_BYTE(cmd, IDE_COMMAND_REG);
-}
-
-
-/*
* Busy-wait for the drive status to be not "busy". Check then the status for
* all of the "good" bits and none of the "bad" bits, and if all is okay it
* returns 0. All other cases return 1 after invoking error handler -- caller
@@ -815,21 +802,26 @@
#ifdef DEBUG
printk("%s: DRIVE_CMD ", drive->name);
printk("cmd=0x%02x ", args[0]);
- printk("sc=0x%02x ", args[1]);
- printk("fr=0x%02x ", args[2]);
- printk("xx=0x%02x\n", args[3]);
+ printk(" sc=0x%02x ", args[1]);
+ printk(" fr=0x%02x ", args[2]);
+ printk(" xx=0x%02x\n", args[3]);
#endif
+ ide_set_handler(drive, drive_cmd_intr, WAIT_CMD, NULL);
+ ata_irq_enable(drive, 1);
+ ata_mask(drive);
if (args[0] == WIN_SMART) {
- OUT_BYTE(0x4f, IDE_LCYL_REG);
- OUT_BYTE(0xc2, IDE_HCYL_REG);
- OUT_BYTE(args[2],IDE_FEATURE_REG);
- OUT_BYTE(args[1],IDE_SECTOR_REG);
- drive_cmd(drive, args[0], args[3]);
-
- return ide_started;
+ struct hd_drive_task_hdr regfile;
+ regfile.feature = args[2];
+ regfile.sector_count = args[3];
+ regfile.sector_number = args[1];
+ regfile.low_cylinder = 0x4f;
+ regfile.high_cylinder = 0xc2;
+ ata_out_regfile(drive, ®file);
+ } else {
+ OUT_BYTE(args[2], IDE_FEATURE_REG);
+ OUT_BYTE(args[1], IDE_NSECTOR_REG);
}
- OUT_BYTE(args[2],IDE_FEATURE_REG);
- drive_cmd(drive, args[0], args[1]);
+ OUT_BYTE(args[0], IDE_COMMAND_REG);
return ide_started;
}
diff -urN linux-2.5.19/drivers/ide/ide-cd.c linux/drivers/ide/ide-cd.c
--- linux-2.5.19/drivers/ide/ide-cd.c 2002-06-01 23:17:28.000000000 +0200
+++ linux/drivers/ide/ide-cd.c 2002-06-01 23:48:30.000000000 +0200
@@ -535,7 +535,7 @@
/* stuff the sense request in front of our current request */
rq = &info->request_sense_request;
- ide_init_drive_cmd(rq);
+ memset(rq, 0, sizeof(*rq));
rq->cmd[0] = GPCMD_REQUEST_SENSE;
rq->cmd[4] = pc->buflen;
rq->flags = REQ_SENSE;
@@ -1389,9 +1389,8 @@
/* Start of retry loop. */
do {
- ide_init_drive_cmd(&rq);
+ memset(&rq, 0, sizeof(rq));
memcpy(rq.cmd, cmd, CDROM_PACKET_SIZE);
-
rq.flags = REQ_PC;
/* FIXME --mdcki */
@@ -2276,7 +2275,7 @@
struct request req;
int ret;
- ide_init_drive_cmd(&req);
+ memset(&req, 0, sizeof(req));
req.flags = REQ_SPECIAL;
ret = ide_do_drive_cmd(drive, &req, ide_wait);
diff -urN linux-2.5.19/drivers/ide/ide-disk.c linux/drivers/ide/ide-disk.c
--- linux-2.5.19/drivers/ide/ide-disk.c 2002-06-01 23:17:28.000000000 +0200
+++ linux/drivers/ide/ide-disk.c 2002-06-01 21:53:07.000000000 +0200
@@ -264,8 +264,6 @@
args.hobfile.high_cylinder = (block >>= 8); /* hi lba */
args.hobfile.device_head = drive->select.all;
- args.hobfile.control = 0x80;
-
args.taskfile.command = get_command(drive, rq_data_dir(rq));
#ifdef DEBUG
@@ -728,7 +726,6 @@
args.hobfile.high_cylinder = (addr_req >>= 8);
args.hobfile.device_head = 0x40;
- args.hobfile.control = 0x80;
args.handler = task_no_data_intr;
/* submit command request */
diff -urN linux-2.5.19/drivers/ide/ide-floppy.c linux/drivers/ide/ide-floppy.c
--- linux-2.5.19/drivers/ide/ide-floppy.c 2002-06-01 23:17:28.000000000 +0200
+++ linux/drivers/ide/ide-floppy.c 2002-06-01 23:55:10.000000000 +0200
@@ -712,10 +712,10 @@
static void idefloppy_queue_pc_head(struct ata_device *drive,
struct atapi_packet_command *pc, struct request *rq)
{
- ide_init_drive_cmd (rq);
+ memset(rq, 0, sizeof(*rq));
+ rq->flags = IDEFLOPPY_RQ;
/* FIXME: --mdcki */
rq->buffer = (char *) pc;
- rq->flags = IDEFLOPPY_RQ;
(void) ide_do_drive_cmd (drive, rq, ide_preempt);
}
@@ -1065,10 +1065,10 @@
#endif
ata_irq_enable(drive, 1);
- OUT_BYTE (dma_ok ? 1:0,IDE_FEATURE_REG); /* Use PIO/DMA */
- OUT_BYTE (bcount.b.high,IDE_BCOUNTH_REG);
- OUT_BYTE (bcount.b.low,IDE_BCOUNTL_REG);
- OUT_BYTE (drive->select.all,IDE_SELECT_REG);
+ OUT_BYTE(dma_ok ? 1:0,IDE_FEATURE_REG); /* Use PIO/DMA */
+ OUT_BYTE(bcount.b.high,IDE_BCOUNTH_REG);
+ OUT_BYTE(bcount.b.low,IDE_BCOUNTL_REG);
+ OUT_BYTE(drive->select.all,IDE_SELECT_REG);
#ifdef CONFIG_BLK_DEV_IDEDMA
if (dma_ok) { /* Begin DMA, if necessary */
@@ -1271,11 +1271,12 @@
{
struct request rq;
- ide_init_drive_cmd (&rq);
+ memset(&rq, 0, sizeof(rq));
/* FIXME: --mdcki */
rq.buffer = (char *) pc;
rq.flags = IDEFLOPPY_RQ;
- return ide_do_drive_cmd (drive, &rq, ide_wait);
+
+ return ide_do_drive_cmd(drive, &rq, ide_wait);
}
/*
diff -urN linux-2.5.19/drivers/ide/ide-tape.c linux/drivers/ide/ide-tape.c
--- linux-2.5.19/drivers/ide/ide-tape.c 2002-06-01 23:17:28.000000000 +0200
+++ linux/drivers/ide/ide-tape.c 2002-06-01 23:43:22.000000000 +0200
@@ -1921,7 +1921,7 @@
*/
static void idetape_queue_pc_head(struct ata_device *drive, struct atapi_packet_command *pc, struct request *rq)
{
- ide_init_drive_cmd (rq);
+ memset(rq, 0, sizeof(*rq));
rq->buffer = (char *) pc;
rq->flags = IDETAPE_PC_RQ1;
ide_do_drive_cmd(drive, rq, ide_preempt);
@@ -3153,7 +3153,7 @@
{
struct request rq;
- ide_init_drive_cmd (&rq);
+ memset(&rq, 0, sizeof(rq));
/* FIXME: --mdcki */
rq.buffer = (char *) pc;
rq.flags = IDETAPE_PC_RQ1;
@@ -3414,17 +3414,17 @@
#if IDETAPE_DEBUG_LOG
if (tape->debug_level >= 2)
printk (KERN_INFO "ide-tape: idetape_queue_rw_tail: cmd=%d\n",cmd);
-#endif /* IDETAPE_DEBUG_LOG */
+#endif
#if IDETAPE_DEBUG_BUGS
if (idetape_pipeline_active (tape)) {
printk (KERN_ERR "ide-tape: bug: the pipeline is active in idetape_queue_rw_tail\n");
return (0);
}
-#endif /* IDETAPE_DEBUG_BUGS */
+#endif
- ide_init_drive_cmd (&rq);
- rq.bio = bio;
+ memset(&rq, 0, sizeof(rq));
rq.flags = cmd;
+ rq.bio = bio;
rq.sector = tape->first_frame_position;
rq.nr_sectors = rq.current_nr_sectors = blocks;
if (tape->onstream)
@@ -3472,7 +3472,7 @@
printk(KERN_INFO "ide-tape: %s: read back logical block %d, data %x %x %x %x\n", tape->name, logical_blk_num, *p++, *p++, *p++, *p++);
#endif
rq = &stage->rq;
- ide_init_drive_cmd (rq);
+ memset(rq, 0, sizeof(*rq));
rq->flags = IDETAPE_WRITE_RQ;
rq->sector = tape->first_frame_position;
rq->nr_sectors = rq->current_nr_sectors = tape->capabilities.ctl;
@@ -3748,7 +3748,7 @@
}
}
rq = &new_stage->rq;
- ide_init_drive_cmd (rq);
+ memset(rq, 0, sizeof(*rq));
rq->flags = IDETAPE_WRITE_RQ;
rq->sector = tape->first_frame_position; /* Doesn't actually matter - We always assume sequential access */
rq->nr_sectors = rq->current_nr_sectors = blocks;
@@ -3938,7 +3938,8 @@
}
if (tape->restart_speed_control_req)
idetape_restart_speed_control(drive);
- ide_init_drive_cmd (&rq);
+
+ memset(&rq, 0, sizeof(rq));
rq.flags = IDETAPE_READ_RQ;
rq.sector = tape->first_frame_position;
rq.nr_sectors = rq.current_nr_sectors = blocks;
diff -urN linux-2.5.19/drivers/ide/ide-taskfile.c linux/drivers/ide/ide-taskfile.c
--- linux-2.5.19/drivers/ide/ide-taskfile.c 2002-06-01 23:17:28.000000000 +0200
+++ linux/drivers/ide/ide-taskfile.c 2002-06-01 23:59:07.000000000 +0200
@@ -314,7 +314,6 @@
struct ata_taskfile *args, struct request *rq)
{
struct hd_driveid *id = drive->id;
- u8 HIHI = (drive->addressing) ? 0xE0 : 0xEF;
/* (ks/hs): Moved to start, do not use for multiple out commands */
if (args->handler != task_mulout_intr) {
@@ -322,25 +321,16 @@
ata_mask(drive);
}
- if ((id->command_set_2 & 0x0400) &&
- (id->cfs_enable_2 & 0x0400) &&
- (drive->addressing == 1)) {
- OUT_BYTE(args->hobfile.feature, IDE_FEATURE_REG);
- OUT_BYTE(args->hobfile.sector_count, IDE_NSECTOR_REG);
- OUT_BYTE(args->hobfile.sector_number, IDE_SECTOR_REG);
- OUT_BYTE(args->hobfile.low_cylinder, IDE_LCYL_REG);
- OUT_BYTE(args->hobfile.high_cylinder, IDE_HCYL_REG);
- }
-
- OUT_BYTE(args->taskfile.feature, IDE_FEATURE_REG);
- OUT_BYTE(args->taskfile.sector_count, IDE_NSECTOR_REG);
- /* refers to number of sectors to transfer */
- OUT_BYTE(args->taskfile.sector_number, IDE_SECTOR_REG);
- /* refers to sector offset or start sector */
- OUT_BYTE(args->taskfile.low_cylinder, IDE_LCYL_REG);
- OUT_BYTE(args->taskfile.high_cylinder, IDE_HCYL_REG);
-
- OUT_BYTE((args->taskfile.device_head & HIHI) | drive->select.all, IDE_SELECT_REG);
+ if ((id->command_set_2 & 0x0400) && (id->cfs_enable_2 & 0x0400) &&
+ (drive->addressing == 1))
+ ata_out_regfile(drive, &args->hobfile);
+
+ ata_out_regfile(drive, &args->taskfile);
+
+ {
+ u8 HIHI = (drive->addressing) ? 0xE0 : 0xEF;
+ OUT_BYTE((args->taskfile.device_head & HIHI) | drive->select.all, IDE_SELECT_REG);
+ }
if (args->handler != NULL) {
/* This is apparently supposed to reset the wait timeout for
@@ -361,8 +351,7 @@
} else {
/*
* FIXME: this is a gross hack, need to unify tcq dma proc and
- * regular dma proc -- basically split stuff that needs to act
- * on a request from things like ide_dma_check etc.
+ * regular dma proc.
*/
if (!drive->using_dma)
@@ -761,15 +750,6 @@
}
/*
- * This function is intended to be used prior to invoking ide_do_drive_cmd().
- */
-void ide_init_drive_cmd(struct request *rq)
-{
- memset(rq, 0, sizeof(*rq));
- rq->flags = REQ_DRIVE_CMD;
-}
-
-/*
* This function issues a special IDE device request onto the request queue.
*
* If action is ide_wait, then the rq is queued at the end of the request
@@ -849,139 +829,12 @@
return ide_do_drive_cmd(drive, &rq, ide_wait);
}
-/*
- * Implement generic ioctls invoked from userspace to imlpement specific
- * functionality.
- *
- * Unfortunately every single low level programm out there is using this
- * interface.
- */
-
-/*
- * Backside of HDIO_DRIVE_CMD call of SETFEATURES_XFER.
- * 1 : Safe to update drive->id DMA registers.
- * 0 : OOPs not allowed.
- */
-static int set_transfer(struct ata_device *drive, struct ata_taskfile *args)
-{
- if ((args->taskfile.command == WIN_SETFEATURES) &&
- (args->taskfile.sector_number >= XFER_SW_DMA_0) &&
- (args->taskfile.feature == SETFEATURES_XFER) &&
- (drive->id->dma_ultra ||
- drive->id->dma_mword ||
- drive->id->dma_1word))
- return 1;
-
- return 0;
-}
-
-/*
- * Verify that we are doing an approved SETFEATURES_XFER with respect
- * to the hardware being able to support request. Since some hardware
- * can improperly report capabilties, we check to see if the host adapter
- * in combination with the device (usually a disk) properly detect
- * and acknowledge each end of the ribbon.
- */
-static int ata66_check(struct ata_device *drive, struct ata_taskfile *args)
-{
- if ((args->taskfile.command == WIN_SETFEATURES) &&
- (args->taskfile.sector_number > XFER_UDMA_2) &&
- (args->taskfile.feature == SETFEATURES_XFER)) {
- if (!drive->channel->udma_four) {
- printk("%s: Speed warnings UDMA 3/4/5 is not functional.\n", drive->channel->name);
- return 1;
- }
-#ifndef CONFIG_IDEDMA_IVB
- if ((drive->id->hw_config & 0x6000) == 0) {
-#else
- if (((drive->id->hw_config & 0x2000) == 0) ||
- ((drive->id->hw_config & 0x4000) == 0)) {
-#endif
- printk("%s: Speed warnings UDMA 3/4/5 is not functional.\n", drive->name);
- return 1;
- }
- }
- return 0;
-}
-
-int ide_cmd_ioctl(struct ata_device *drive, unsigned long arg)
-{
- int err = 0;
- u8 vals[4];
- u8 *argbuf = vals;
- u8 pio = 0;
- int argsize = 4;
- struct ata_taskfile args;
- struct request rq;
-
- ide_init_drive_cmd(&rq);
-
- /* Wait for drive ready.
- */
- if (!arg)
- return ide_do_drive_cmd(drive, &rq, ide_wait);
-
- /* Second phase.
- */
- if (copy_from_user(vals, (void *)arg, 4))
- return -EFAULT;
-
- args.taskfile.feature = vals[2];
- args.taskfile.sector_count = vals[3];
- args.taskfile.sector_number = vals[1];
- args.taskfile.low_cylinder = 0x00;
- args.taskfile.high_cylinder = 0x00;
- args.taskfile.device_head = 0x00;
- args.taskfile.command = vals[0];
-
- if (vals[3]) {
- argsize = 4 + (SECTOR_WORDS * 4 * vals[3]);
- argbuf = kmalloc(argsize, GFP_KERNEL);
- if (argbuf == NULL)
- return -ENOMEM;
- memcpy(argbuf, vals, 4);
- memset(argbuf + 4, 0, argsize - 4);
- }
-
- /* Always make sure the transfer reate has been setup.
- * FIXME: what about setting up the drive with ->tuneproc?
- */
- if (set_transfer(drive, &args)) {
- pio = vals[1];
- if (ata66_check(drive, &args))
- goto abort;
- }
-
- /* Issue ATA command and wait for completion.
- */
- rq.buffer = argbuf;
- err = ide_do_drive_cmd(drive, &rq, ide_wait);
-
- if (!err && pio) {
- /* active-retuning-calls future */
- /* FIXME: what about the setup for the drive?! */
- if (drive->channel->speedproc)
- drive->channel->speedproc(drive, pio);
- }
-
-abort:
- if (copy_to_user((void *)arg, argbuf, argsize))
- err = -EFAULT;
-
- if (argsize > 4)
- kfree(argbuf);
-
- return err;
-}
-
EXPORT_SYMBOL(drive_is_ready);
EXPORT_SYMBOL(ata_read);
EXPORT_SYMBOL(ata_write);
EXPORT_SYMBOL(ata_taskfile);
EXPORT_SYMBOL(recal_intr);
EXPORT_SYMBOL(task_no_data_intr);
-EXPORT_SYMBOL(ide_init_drive_cmd);
EXPORT_SYMBOL(ide_do_drive_cmd);
EXPORT_SYMBOL(ide_raw_taskfile);
EXPORT_SYMBOL(ide_cmd_type_parser);
-EXPORT_SYMBOL(ide_cmd_ioctl);
diff -urN linux-2.5.19/drivers/ide/ioctl.c linux/drivers/ide/ioctl.c
--- linux-2.5.19/drivers/ide/ioctl.c 2002-05-29 20:42:50.000000000 +0200
+++ linux/drivers/ide/ioctl.c 2002-06-02 00:03:22.000000000 +0200
@@ -33,6 +33,119 @@
#include "ioctl.h"
/*
+ * Implement generic ioctls invoked from userspace to imlpement specific
+ * functionality.
+ *
+ * Unfortunately every single low level programm out there is using this
+ * interface.
+ */
+static int cmd_ioctl(struct ata_device *drive, unsigned long arg)
+{
+ int err = 0;
+ u8 vals[4];
+ u8 *argbuf = vals;
+ u8 pio = 0;
+ int argsize = 4;
+ struct ata_taskfile args;
+ struct request rq;
+
+ memset(&rq, 0, sizeof(rq));
+ rq.flags = REQ_DRIVE_CMD;
+
+ /* If empty parameter file - wait for drive ready.
+ */
+ if (!arg)
+ return ide_do_drive_cmd(drive, &rq, ide_wait);
+
+ /* Second phase.
+ */
+ if (copy_from_user(vals, (void *)arg, 4))
+ return -EFAULT;
+
+ args.taskfile.feature = vals[2];
+ args.taskfile.sector_count = vals[3];
+ args.taskfile.sector_number = vals[1];
+ args.taskfile.low_cylinder = 0x00;
+ args.taskfile.high_cylinder = 0x00;
+ args.taskfile.device_head = 0x00;
+ args.taskfile.command = vals[0];
+
+ if (vals[3]) {
+ argsize = 4 + (SECTOR_WORDS * 4 * vals[3]);
+ argbuf = kmalloc(argsize, GFP_KERNEL);
+ if (argbuf == NULL)
+ return -ENOMEM;
+ memcpy(argbuf, vals, 4);
+ memset(argbuf + 4, 0, argsize - 4);
+ }
+
+ /*
+ * Always make sure the transfer reate has been setup.
+ *
+ * FIXME: what about setting up the drive with ->tuneproc?
+ *
+ * Backside of HDIO_DRIVE_CMD call of SETFEATURES_XFER.
+ * 1 : Safe to update drive->id DMA registers.
+ * 0 : OOPs not allowed.
+ */
+ if ((args.taskfile.command == WIN_SETFEATURES) &&
+ (args.taskfile.sector_number >= XFER_SW_DMA_0) &&
+ (args.taskfile.feature == SETFEATURES_XFER) &&
+ (drive->id->dma_ultra ||
+ drive->id->dma_mword ||
+ drive->id->dma_1word)) {
+ pio = vals[1];
+ /*
+ * Verify that we are doing an approved SETFEATURES_XFER with
+ * respect to the hardware being able to support request.
+ * Since some hardware can improperly report capabilties, we
+ * check to see if the host adapter in combination with the
+ * device (usually a disk) properly detect and acknowledge each
+ * end of the ribbon.
+ */
+ if (args.taskfile.sector_number > XFER_UDMA_2) {
+ if (!drive->channel->udma_four) {
+ printk(KERN_WARNING "%s: Speed warnings UDMA > 2 is not functional.\n",
+ drive->channel->name);
+ goto abort;
+ }
+#ifndef CONFIG_IDEDMA_IVB
+ if (!(drive->id->hw_config & 0x6000))
+#else
+ if (!(drive->id->hw_config & 0x2000) ||
+ !(drive->id->hw_config & 0x4000))
+#endif
+ {
+ printk(KERN_WARNING "%s: Speed warnings UDMA > 2 is not functional.\n",
+ drive->name);
+ goto abort;
+ }
+ }
+ }
+
+ /* Issue ATA command and wait for completion.
+ */
+ rq.buffer = argbuf;
+ err = ide_do_drive_cmd(drive, &rq, ide_wait);
+
+ if (!err && pio) {
+ /* active-retuning-calls future */
+ /* FIXME: what about the setup for the drive?! */
+ if (drive->channel->speedproc)
+ drive->channel->speedproc(drive, pio);
+ }
+
+abort:
+ if (copy_to_user((void *)arg, argbuf, argsize))
+ err = -EFAULT;
+
+ if (argsize > 4)
+ kfree(argbuf);
+
+ return err;
+}
+
+/*
* NOTE: Due to ridiculous coding habbits in the hdparm utility we have to
* always return unsigned long in case we are returning simple values.
*/
@@ -40,7 +153,7 @@
{
unsigned int major, minor;
struct ata_device *drive;
- struct request rq;
+// struct request rq;
kdev_t dev;
dev = inode->i_rdev;
@@ -50,7 +163,6 @@
if ((drive = get_info_ptr(inode->i_rdev)) == NULL)
return -ENODEV;
-
/* Contrary to popular beleve we disallow even the reading of the ioctl
* values for users which don't have permission too. We do this becouse
* such information could be used by an attacker to deply a simple-user
@@ -61,7 +173,6 @@
if (!capable(CAP_SYS_ADMIN))
return -EACCES;
- ide_init_drive_cmd(&rq);
switch (cmd) {
case HDIO_GET_32BIT: {
unsigned long val = drive->channel->io_32bit;
@@ -96,7 +207,6 @@
/* FIXME: we can see that tuneproc whould do the
* locking!.
*/
-
if (ide_spin_wait_hwgroup(drive))
return -EBUSY;
@@ -114,7 +224,6 @@
return 0;
}
-
case HDIO_SET_UNMASKINTR:
if (arg < 0 || arg > 1)
return -EINVAL;
@@ -202,9 +311,6 @@
return 0;
}
- case BLKRRPART: /* Re-read partition tables */
- return ata_revalidate(inode->i_rdev);
-
case HDIO_GET_IDENTITY:
if (minor(inode->i_rdev) & PARTN_MASK)
return -EINVAL;
@@ -222,12 +328,6 @@
drive->atapi_overlap << IDE_NICE_ATAPI_OVERLAP,
(long *) arg);
- case HDIO_DRIVE_CMD:
- if (!capable(CAP_SYS_RAWIO))
- return -EACCES;
-
- return ide_cmd_ioctl(drive, arg);
-
case HDIO_SET_NICE:
if (arg != (arg & ((1 << IDE_NICE_DSC_OVERLAP))))
return -EPERM;
@@ -241,6 +341,34 @@
return 0;
+ case HDIO_GET_BUSSTATE:
+ if (put_user(drive->channel->bus_state, (long *)arg))
+ return -EFAULT;
+
+ return 0;
+
+ case HDIO_SET_BUSSTATE:
+ if (drive->channel->busproc)
+ drive->channel->busproc(drive, (int)arg);
+
+ return 0;
+
+ case HDIO_DRIVE_CMD:
+ if (!capable(CAP_SYS_RAWIO))
+ return -EACCES;
+
+ return cmd_ioctl(drive, arg);
+
+ /*
+ * uniform packet command handling
+ */
+ case CDROMEJECT:
+ case CDROMCLOSETRAY:
+ return block_ioctl(inode->i_bdev, cmd, arg);
+
+ case BLKRRPART: /* Re-read partition tables */
+ return ata_revalidate(inode->i_rdev);
+
case BLKGETSIZE:
case BLKGETSIZE64:
case BLKROSET:
@@ -254,25 +382,6 @@
case BLKBSZSET:
return blk_ioctl(inode->i_bdev, cmd, arg);
- /*
- * uniform packet command handling
- */
- case CDROMEJECT:
- case CDROMCLOSETRAY:
- return block_ioctl(inode->i_bdev, cmd, arg);
-
- case HDIO_GET_BUSSTATE:
- if (put_user(drive->channel->bus_state, (long *)arg))
- return -EFAULT;
-
- return 0;
-
- case HDIO_SET_BUSSTATE:
- if (drive->channel->busproc)
- drive->channel->busproc(drive, (int)arg);
-
- return 0;
-
/* Now check whatever this particular ioctl has a device type
* specific implementation.
*/
diff -urN linux-2.5.19/drivers/ide/ns87415.c linux/drivers/ide/ns87415.c
--- linux-2.5.19/drivers/ide/ns87415.c 2002-06-01 23:17:28.000000000 +0200
+++ linux/drivers/ide/ns87415.c 2002-06-01 21:32:31.000000000 +0200
@@ -193,7 +193,7 @@
* XXX: Reset the device, if we don't it will not respond
* to select properly during first probe.
*/
- ata_reset(struct ata_channel *hwif);
+ ata_reset(hwif);
#endif
}
diff -urN linux-2.5.19/drivers/scsi/ide-scsi.c linux/drivers/scsi/ide-scsi.c
--- linux-2.5.19/drivers/scsi/ide-scsi.c 2002-06-01 23:17:28.000000000 +0200
+++ linux/drivers/scsi/ide-scsi.c 2002-06-01 23:39:24.000000000 +0200
@@ -412,9 +412,9 @@
ata_select(drive, 10);
ata_irq_enable(drive, 1);
- OUT_BYTE (dma_ok,IDE_FEATURE_REG);
- OUT_BYTE (bcount >> 8,IDE_BCOUNTH_REG);
- OUT_BYTE (bcount & 0xff,IDE_BCOUNTL_REG);
+ OUT_BYTE(dma_ok,IDE_FEATURE_REG);
+ OUT_BYTE(bcount >> 8,IDE_BCOUNTH_REG);
+ OUT_BYTE(bcount & 0xff,IDE_BCOUNTL_REG);
if (dma_ok) {
set_bit(PC_DMA_IN_PROGRESS, &pc->flags);
@@ -662,17 +662,20 @@
}
}
- ide_init_drive_cmd (rq);
+ memset(rq, 0, sizeof(*rq));
+ rq->flags = REQ_SPECIAL;
rq->special = (char *) pc;
rq->bio = idescsi_dma_bio (drive, pc);
- rq->flags = REQ_SPECIAL;
spin_unlock_irq(cmd->host->host_lock);
- (void) ide_do_drive_cmd (drive, rq, ide_end);
+ ide_do_drive_cmd (drive, rq, ide_end);
spin_lock_irq(cmd->host->host_lock);
+
return 0;
abort:
- if (pc) kfree (pc);
- if (rq) kfree (rq);
+ if (pc)
+ kfree (pc);
+ if (rq)
+ kfree (rq);
cmd->result = DID_ERROR << 16;
done(cmd);
diff -urN linux-2.5.19/include/linux/hdreg.h linux/include/linux/hdreg.h
--- linux-2.5.19/include/linux/hdreg.h 2002-05-29 20:42:54.000000000 +0200
+++ linux/include/linux/hdreg.h 2002-06-01 22:45:05.000000000 +0200
@@ -81,18 +81,9 @@
u8 low_cylinder;
u8 high_cylinder;
u8 device_head;
- u8 command;
-} __attribute__((packed));
-struct hd_drive_hob_hdr {
- u8 data;
- u8 feature;
- u8 sector_count;
- u8 sector_number;
- u8 low_cylinder;
- u8 high_cylinder;
- u8 device_head;
- u8 control;
+ /* FXIME: Consider moving this out from here. */
+ u8 command;
} __attribute__((packed));
/*
diff -urN linux-2.5.19/include/linux/ide.h linux/include/linux/ide.h
--- linux-2.5.19/include/linux/ide.h 2002-06-01 23:17:29.000000000 +0200
+++ linux/include/linux/ide.h 2002-06-01 23:58:26.000000000 +0200
@@ -253,11 +253,11 @@
unsigned all : 8; /* all of the bits together */
struct {
#if defined(__LITTLE_ENDIAN_BITFIELD)
- unsigned head : 4; /* always zeros here */
+ unsigned XXX_head : 4; /* always zeros here */
unsigned unit : 1; /* drive select number: 0/1 */
- unsigned bit5 : 1; /* always 1 */
+ unsigned XXX_bit5 : 1; /* always 1 */
unsigned lba : 1; /* using LBA instead of CHS */
- unsigned bit7 : 1; /* always 1 */
+ unsigned XXX_bit7 : 1; /* always 1 */
#elif defined(__BIG_ENDIAN_BITFIELD)
unsigned bit7 : 1;
unsigned lba : 1;
@@ -270,29 +270,6 @@
} b;
} select_t;
-typedef union {
- unsigned all : 8; /* all of the bits together */
- struct {
-#if defined(__LITTLE_ENDIAN_BITFIELD)
- unsigned bit0 : 1;
- unsigned nIEN : 1; /* device INTRQ to host */
- unsigned SRST : 1; /* host soft reset bit */
- unsigned bit3 : 1; /* ATA-2 thingy */
- unsigned reserved456 : 3;
- unsigned HOB : 1; /* 48-bit address ordering */
-#elif defined(__BIG_ENDIAN_BITFIELD)
- unsigned HOB : 1;
- unsigned reserved456 : 3;
- unsigned bit3 : 1;
- unsigned SRST : 1;
- unsigned nIEN : 1;
- unsigned bit0 : 1;
-#else
-#error "Please fix <asm/byteorder.h>"
-#endif
- } b;
-} control_t;
-
/*
* ATA/ATAPI device structure :
*/
@@ -530,7 +507,7 @@
* Register new hardware with ide
*/
extern int ide_register_hw(hw_regs_t *hw);
-extern void ide_unregister(struct ata_channel *hwif);
+extern void ide_unregister(struct ata_channel *);
struct ata_taskfile;
@@ -671,11 +648,6 @@
ide_startstop_t restart_request(struct ata_device *);
/*
- * This function is intended to be used prior to invoking ide_do_drive_cmd().
- */
-extern void ide_init_drive_cmd(struct request *rq);
-
-/*
* "action" parameter type for ide_do_drive_cmd() below.
*/
typedef enum {
@@ -698,7 +670,7 @@
struct ata_taskfile {
struct hd_drive_task_hdr taskfile;
- struct hd_drive_hob_hdr hobfile;
+ struct hd_drive_task_hdr hobfile;
int command_type;
ide_startstop_t (*prehandler)(struct ata_device *, struct request *);
ide_startstop_t (*handler)(struct ata_device *, struct request *);
@@ -717,21 +689,18 @@
extern ide_startstop_t recal_intr(struct ata_device *, struct request *);
extern ide_startstop_t task_no_data_intr(struct ata_device *, struct request *);
-
-/* This is setting up all fields in args, which depend upon the command type.
- */
extern void ide_cmd_type_parser(struct ata_taskfile *args);
extern int ide_raw_taskfile(struct ata_device *, struct ata_taskfile *);
-extern int ide_cmd_ioctl(struct ata_device *drive, unsigned long arg);
extern void ide_fix_driveid(struct hd_driveid *id);
extern int ide_config_drive_speed(struct ata_device *, byte);
extern byte eighty_ninty_three(struct ata_device *);
-extern int system_bus_speed;
extern void ide_stall_queue(struct ata_device *, unsigned long);
+extern int system_bus_speed;
+
/*
* CompactFlash cards and their brethern pretend to be removable hard disks,
* but they never have a slave unit, and they don't have doorlock mechanisms.
@@ -873,5 +842,6 @@
extern int ata_status(struct ata_device *, u8, u8);
extern int ata_irq_enable(struct ata_device *, int);
extern void ata_reset(struct ata_channel *);
+extern void ata_out_regfile(struct ata_device *, struct hd_drive_task_hdr *);
#endif
^ permalink raw reply [flat|nested] 35+ messages in thread* [PATCH] 2.5.19 IDE 80
2002-05-29 18:50 Linux 2.5.19 Linus Torvalds
` (10 preceding siblings ...)
2002-06-02 6:06 ` [PATCH} 2.5.19 IDE 79 Martin Dalecki
@ 2002-06-02 6:07 ` Martin Dalecki
2002-06-02 19:45 ` [PATCH] 2.5.19 IDE 81 Martin Dalecki
2002-06-02 20:13 ` [PATCH] 2.5.19 IDE 82 Martin Dalecki
13 siblings, 0 replies; 35+ messages in thread
From: Martin Dalecki @ 2002-06-02 6:07 UTC (permalink / raw)
To: Linus Torvalds; +Cc: Kernel Mailing List
[-- Attachment #1: Type: text/plain, Size: 782 bytes --]
Sun Jun 2 03:31:56 CEST 2002 ide-clean-80
- Sanitize the handling of the ioctl's and fix a bug on the way in dealing with
the WIN_SMART command where arguments where exchanged.
- Finally sanitize ioctl further until it turned out that we could get rid of
the special request type REQ_DRIVE_CMD entierly. We are now using
consistently REQ_DRIVE_ACB.
One hidden code path less again!
- Realize the ide_end_drive_cmd can be on the REQ_DRIVE_ACB only for ioctl() to
a disk. Eliminate it's usage from device type driver modules.
- Remove command member from struct hd_drive_task_hdr and place it in strcut
ata_taskfile. It is not common between the normal register file and HOB.
We will have to introduce some helper functions for particular command types.
[-- Attachment #2: ide-clean-80.diff --]
[-- Type: text/plain, Size: 29511 bytes --]
diff -urN linux-2.5.19/drivers/block/ll_rw_blk.c linux/drivers/block/ll_rw_blk.c
--- linux-2.5.19/drivers/block/ll_rw_blk.c 2002-05-29 20:42:46.000000000 +0200
+++ linux/drivers/block/ll_rw_blk.c 2002-06-02 06:33:53.000000000 +0200
@@ -490,11 +490,21 @@
}
}
-static char *rq_flags[] = { "REQ_RW", "REQ_RW_AHEAD", "REQ_BARRIER",
- "REQ_CMD", "REQ_NOMERGE", "REQ_STARTED",
- "REQ_DONTPREP", "REQ_QUEUED", "REQ_DRIVE_CMD",
- "REQ_DRIVE_ACB", "REQ_PC", "REQ_BLOCK_PC",
- "REQ_SENSE", "REQ_SPECIAL" };
+static char *rq_flags[] = {
+ "REQ_RW",
+ "REQ_RW_AHEAD",
+ "REQ_BARRIER",
+ "REQ_CMD",
+ "REQ_NOMERGE",
+ "REQ_STARTED",
+ "REQ_DONTPREP",
+ "REQ_QUEUED",
+ "REQ_DRIVE_ACB",
+ "REQ_PC",
+ "REQ_BLOCK_PC",
+ "REQ_SENSE",
+ "REQ_SPECIAL"
+};
void blk_dump_rq_flags(struct request *rq, char *msg)
{
diff -urN linux-2.5.19/drivers/ide/ide.c linux/drivers/ide/ide.c
--- linux-2.5.19/drivers/ide/ide.c 2002-06-02 07:28:28.000000000 +0200
+++ linux/drivers/ide/ide.c 2002-06-02 07:09:29.000000000 +0200
@@ -395,38 +395,30 @@
*
* Should be called under lock held.
*/
-void ide_end_drive_cmd(struct ata_device *drive, struct request *rq, u8 err)
+void ide_end_drive_cmd(struct ata_device *drive, struct request *rq)
{
- if (rq->flags & REQ_DRIVE_CMD) {
- u8 *args = rq->buffer;
- rq->errors = !ata_status(drive, READY_STAT, BAD_STAT);
- if (args) {
- args[0] = drive->status;
- args[1] = err;
- args[2] = IN_BYTE(IDE_NSECTOR_REG);
- }
- } else if (rq->flags & REQ_DRIVE_ACB) {
- struct ata_taskfile *args = rq->special;
+ if (rq->flags & REQ_DRIVE_ACB) {
+ struct ata_taskfile *ar = rq->special;
rq->errors = !ata_status(drive, READY_STAT, BAD_STAT);
- if (args) {
- args->taskfile.feature = err;
- args->taskfile.sector_count = IN_BYTE(IDE_NSECTOR_REG);
- args->taskfile.sector_number = IN_BYTE(IDE_SECTOR_REG);
- args->taskfile.low_cylinder = IN_BYTE(IDE_LCYL_REG);
- args->taskfile.high_cylinder = IN_BYTE(IDE_HCYL_REG);
- args->taskfile.device_head = IN_BYTE(IDE_SELECT_REG);
- args->taskfile.command = drive->status;
+ if (ar) {
+ ar->taskfile.feature = IN_BYTE(IDE_ERROR_REG);
+ ar->taskfile.sector_count = IN_BYTE(IDE_NSECTOR_REG);
+ ar->taskfile.sector_number = IN_BYTE(IDE_SECTOR_REG);
+ ar->taskfile.low_cylinder = IN_BYTE(IDE_LCYL_REG);
+ ar->taskfile.high_cylinder = IN_BYTE(IDE_HCYL_REG);
+ ar->taskfile.device_head = IN_BYTE(IDE_SELECT_REG);
+ ar->cmd = drive->status;
if ((drive->id->command_set_2 & 0x0400) &&
(drive->id->cfs_enable_2 & 0x0400) &&
(drive->addressing == 1)) {
/* The following command goes to the hob file! */
OUT_BYTE(0x80, drive->channel->io_ports[IDE_CONTROL_OFFSET]);
- args->hobfile.feature = IN_BYTE(IDE_FEATURE_REG);
- args->hobfile.sector_count = IN_BYTE(IDE_NSECTOR_REG);
- args->hobfile.sector_number = IN_BYTE(IDE_SECTOR_REG);
- args->hobfile.low_cylinder = IN_BYTE(IDE_LCYL_REG);
- args->hobfile.high_cylinder = IN_BYTE(IDE_HCYL_REG);
+ ar->hobfile.feature = IN_BYTE(IDE_FEATURE_REG);
+ ar->hobfile.sector_count = IN_BYTE(IDE_NSECTOR_REG);
+ ar->hobfile.sector_number = IN_BYTE(IDE_SECTOR_REG);
+ ar->hobfile.low_cylinder = IN_BYTE(IDE_LCYL_REG);
+ ar->hobfile.high_cylinder = IN_BYTE(IDE_HCYL_REG);
}
}
}
@@ -583,7 +575,7 @@
memset(&args, 0, sizeof(args));
args.taskfile.sector_count = drive->sect;
- args.taskfile.command = WIN_RESTORE;
+ args.cmd = WIN_RESTORE;
args.handler = recal_intr;
ata_taskfile(drive, &args, NULL);
}
@@ -602,10 +594,12 @@
err = ide_dump_status(drive, rq, msg, stat);
if (!drive || !rq)
return ide_stopped;
+
/* retry only "normal" I/O: */
if (!(rq->flags & REQ_CMD)) {
rq->errors = 1;
- ide_end_drive_cmd(drive, rq, err);
+ ide_end_drive_cmd(drive, rq);
+
return ide_stopped;
}
/* other bits are useless when BUSY */
@@ -649,30 +643,6 @@
}
/*
- * Invoked on completion of a special DRIVE_CMD.
- */
-static ide_startstop_t drive_cmd_intr(struct ata_device *drive, struct request *rq)
-{
- u8 *args = rq->buffer;
-
- ide__sti(); /* local CPU only */
- if (!ata_status(drive, 0, DRQ_STAT) && args && args[3]) {
- int retries = 10;
-
- ata_read(drive, &args[4], args[3] * SECTOR_WORDS);
-
- while (!ata_status(drive, 0, BUSY_STAT) && retries--)
- udelay(100);
- }
-
- if (!ata_status(drive, READY_STAT, BAD_STAT))
- return ata_error(drive, rq, __FUNCTION__); /* already calls ide_end_drive_cmd */
- ide_end_drive_cmd(drive, rq, GET_ERR());
-
- return ide_stopped;
-}
-
-/*
* Busy-wait for the drive status to be not "busy". Check then the status for
* all of the "good" bits and none of the "bad" bits, and if all is okay it
* returns 0. All other cases return 1 after invoking error handler -- caller
@@ -775,53 +745,20 @@
}
}
- /* This issues a special drive command, usually initiated by ioctl()
- * from the external hdparm program.
+ /* This issues a special drive command.
*/
if (rq->flags & REQ_DRIVE_ACB) {
- struct ata_taskfile *args = rq->special;
+ struct ata_taskfile *ar = rq->special;
- if (!(args))
+ if (!(ar))
goto args_error;
- ata_taskfile(drive, args, NULL);
-
- if (((args->command_type == IDE_DRIVE_TASK_RAW_WRITE) ||
- (args->command_type == IDE_DRIVE_TASK_OUT)) &&
- args->prehandler && args->handler)
- return args->prehandler(drive, rq);
-
- return ide_started;
- }
+ ata_taskfile(drive, ar, NULL);
- if (rq->flags & REQ_DRIVE_CMD) {
- u8 *args = rq->buffer;
-
- if (!(args))
- goto args_error;
-#ifdef DEBUG
- printk("%s: DRIVE_CMD ", drive->name);
- printk("cmd=0x%02x ", args[0]);
- printk(" sc=0x%02x ", args[1]);
- printk(" fr=0x%02x ", args[2]);
- printk(" xx=0x%02x\n", args[3]);
-#endif
- ide_set_handler(drive, drive_cmd_intr, WAIT_CMD, NULL);
- ata_irq_enable(drive, 1);
- ata_mask(drive);
- if (args[0] == WIN_SMART) {
- struct hd_drive_task_hdr regfile;
- regfile.feature = args[2];
- regfile.sector_count = args[3];
- regfile.sector_number = args[1];
- regfile.low_cylinder = 0x4f;
- regfile.high_cylinder = 0xc2;
- ata_out_regfile(drive, ®file);
- } else {
- OUT_BYTE(args[2], IDE_FEATURE_REG);
- OUT_BYTE(args[1], IDE_NSECTOR_REG);
- }
- OUT_BYTE(args[0], IDE_COMMAND_REG);
+ if (((ar->command_type == IDE_DRIVE_TASK_RAW_WRITE) ||
+ (ar->command_type == IDE_DRIVE_TASK_OUT)) &&
+ ar->prehandler && ar->handler)
+ return ar->prehandler(drive, rq);
return ide_started;
}
@@ -863,7 +800,7 @@
#ifdef DEBUG
printk("%s: DRIVE_CMD (null)\n", drive->name);
#endif
- ide_end_drive_cmd(drive, rq, GET_ERR());
+ ide_end_drive_cmd(drive, rq);
return ide_stopped;
}
diff -urN linux-2.5.19/drivers/ide/ide-disk.c linux/drivers/ide/ide-disk.c
--- linux-2.5.19/drivers/ide/ide-disk.c 2002-06-02 07:28:28.000000000 +0200
+++ linux/drivers/ide/ide-disk.c 2002-06-02 07:18:26.000000000 +0200
@@ -170,7 +170,7 @@
args.taskfile.device_head = head;
args.taskfile.device_head |= drive->select.all;
- args.taskfile.command = get_command(drive, rq_data_dir(rq));
+ args.cmd = get_command(drive, rq_data_dir(rq));
#ifdef DEBUG
printk("%s: %sing: ", drive->name,
@@ -211,7 +211,7 @@
args.taskfile.device_head = ((block >> 8) & 0x0f);
args.taskfile.device_head |= drive->select.all;
- args.taskfile.command = get_command(drive, rq_data_dir(rq));
+ args.cmd = get_command(drive, rq_data_dir(rq));
#ifdef DEBUG
printk("%s: %sing: ", drive->name,
@@ -264,7 +264,7 @@
args.hobfile.high_cylinder = (block >>= 8); /* hi lba */
args.hobfile.device_head = drive->select.all;
- args.taskfile.command = get_command(drive, rq_data_dir(rq));
+ args.cmd = get_command(drive, rq_data_dir(rq));
#ifdef DEBUG
printk("%s: %sing: ", drive->name,
@@ -355,7 +355,7 @@
memset(&args, 0, sizeof(args));
- args.taskfile.command = WIN_DOORLOCK;
+ args.cmd = WIN_DOORLOCK;
ide_cmd_type_parser(&args);
/*
@@ -377,9 +377,9 @@
memset(&args, 0, sizeof(args));
if (drive->id->cfs_enable_2 & 0x2400)
- args.taskfile.command = WIN_FLUSH_CACHE_EXT;
+ args.cmd = WIN_FLUSH_CACHE_EXT;
else
- args.taskfile.command = WIN_FLUSH_CACHE;
+ args.cmd = WIN_FLUSH_CACHE;
ide_cmd_type_parser(&args);
@@ -395,7 +395,7 @@
invalidate_bdev(inode->i_bdev, 0);
memset(&args, 0, sizeof(args));
- args.taskfile.command = WIN_DOORUNLOCK;
+ args.cmd = WIN_DOORUNLOCK;
ide_cmd_type_parser(&args);
if (drive->doorlocking &&
@@ -444,7 +444,7 @@
memset(&args, 0, sizeof(args));
args.taskfile.sector_count = arg;
- args.taskfile.command = WIN_SETMULT;
+ args.cmd = WIN_SETMULT;
ide_cmd_type_parser(&args);
if (!ide_raw_taskfile(drive, &args)) {
@@ -475,7 +475,7 @@
memset(&args, 0, sizeof(args));
args.taskfile.feature = (arg) ? SETFEATURES_EN_WCACHE : SETFEATURES_DIS_WCACHE;
- args.taskfile.command = WIN_SETFEATURES;
+ args.cmd = WIN_SETFEATURES;
ide_cmd_type_parser(&args);
ide_raw_taskfile(drive, &args);
@@ -489,7 +489,7 @@
struct ata_taskfile args;
memset(&args, 0, sizeof(args));
- args.taskfile.command = WIN_STANDBYNOW1;
+ args.cmd = WIN_STANDBYNOW1;
ide_cmd_type_parser(&args);
return ide_raw_taskfile(drive, &args);
@@ -502,7 +502,7 @@
memset(&args, 0, sizeof(args));
args.taskfile.feature = (arg)?SETFEATURES_EN_AAM:SETFEATURES_DIS_AAM;
args.taskfile.sector_count = arg;
- args.taskfile.command = WIN_SETFEATURES;
+ args.cmd = WIN_SETFEATURES;
ide_cmd_type_parser(&args);
ide_raw_taskfile(drive, &args);
@@ -622,14 +622,14 @@
/* Create IDE/ATA command request structure */
memset(&args, 0, sizeof(args));
args.taskfile.device_head = 0x40;
- args.taskfile.command = WIN_READ_NATIVE_MAX;
+ args.cmd = WIN_READ_NATIVE_MAX;
args.handler = task_no_data_intr;
/* submit command request */
ide_raw_taskfile(drive, &args);
/* if OK, compute maximum address value */
- if ((args.taskfile.command & 0x01) == 0) {
+ if ((args.cmd & 0x01) == 0) {
addr = ((args.taskfile.device_head & 0x0f) << 24)
| (args.taskfile.high_cylinder << 16)
| (args.taskfile.low_cylinder << 8)
@@ -650,14 +650,14 @@
memset(&args, 0, sizeof(args));
args.taskfile.device_head = 0x40;
- args.taskfile.command = WIN_READ_NATIVE_MAX_EXT;
+ args.cmd = WIN_READ_NATIVE_MAX_EXT;
args.handler = task_no_data_intr;
/* submit command request */
ide_raw_taskfile(drive, &args);
/* if OK, compute maximum address value */
- if ((args.taskfile.command & 0x01) == 0) {
+ if ((args.cmd & 0x01) == 0) {
u32 high = (args.hobfile.high_cylinder << 16) |
(args.hobfile.low_cylinder << 8) |
args.hobfile.sector_number;
@@ -691,12 +691,12 @@
args.taskfile.high_cylinder = (addr_req >> 16);
args.taskfile.device_head = ((addr_req >> 24) & 0x0f) | 0x40;
- args.taskfile.command = WIN_SET_MAX;
+ args.cmd = WIN_SET_MAX;
args.handler = task_no_data_intr;
/* submit command request */
ide_raw_taskfile(drive, &args);
/* if OK, read new maximum address value */
- if ((args.taskfile.command & 0x01) == 0) {
+ if ((args.cmd & 0x01) == 0) {
addr_set = ((args.taskfile.device_head & 0x0f) << 24)
| (args.taskfile.high_cylinder << 16)
| (args.taskfile.low_cylinder << 8)
@@ -719,7 +719,7 @@
args.taskfile.low_cylinder = (addr_req >>= 8);
args.taskfile.high_cylinder = (addr_req >>= 8);
args.taskfile.device_head = 0x40;
- args.taskfile.command = WIN_SET_MAX_EXT;
+ args.cmd = WIN_SET_MAX_EXT;
args.hobfile.sector_number = (addr_req >>= 8);
args.hobfile.low_cylinder = (addr_req >>= 8);
@@ -731,7 +731,7 @@
/* submit command request */
ide_raw_taskfile(drive, &args);
/* if OK, compute maximum address value */
- if ((args.taskfile.command & 0x01) == 0) {
+ if ((args.cmd & 0x01) == 0) {
u32 high = (args.hobfile.high_cylinder << 16) |
(args.hobfile.low_cylinder << 8) |
args.hobfile.sector_number;
diff -urN linux-2.5.19/drivers/ide/ide-floppy.c linux/drivers/ide/ide-floppy.c
--- linux-2.5.19/drivers/ide/ide-floppy.c 2002-06-02 07:28:28.000000000 +0200
+++ linux/drivers/ide/ide-floppy.c 2002-06-02 06:51:41.000000000 +0200
@@ -620,7 +620,7 @@
#if IDEFLOPPY_DEBUG_LOG
printk (KERN_INFO "Reached idefloppy_end_request\n");
-#endif /* IDEFLOPPY_DEBUG_LOG */
+#endif
switch (uptodate) {
case 0: error = IDEFLOPPY_ERROR_GENERAL; break;
@@ -632,12 +632,16 @@
/* Why does this happen? */
if (!rq)
return 0;
+
if (!(rq->flags & IDEFLOPPY_RQ)) {
ide_end_request(drive, rq, uptodate);
return 0;
}
+
rq->errors = error;
- ide_end_drive_cmd (drive, rq, 0);
+ blkdev_dequeue_request(rq);
+ drive->rq = NULL;
+ end_that_request_last(rq);
return 0;
}
diff -urN linux-2.5.19/drivers/ide/ide-tape.c linux/drivers/ide/ide-tape.c
--- linux-2.5.19/drivers/ide/ide-tape.c 2002-06-02 07:28:28.000000000 +0200
+++ linux/drivers/ide/ide-tape.c 2002-06-02 06:52:11.000000000 +0200
@@ -1864,9 +1864,12 @@
idetape_increase_max_pipeline_stages (drive);
}
}
- ide_end_drive_cmd(drive, rq, 0);
+ blkdev_dequeue_request(rq);
+ drive->rq = NULL;
+ end_that_request_last(rq);
+
if (remove_stage)
- idetape_remove_stage_head (drive);
+ idetape_remove_stage_head(drive);
if (tape->active_data_request == NULL)
clear_bit(IDETAPE_PIPELINE_ACTIVE, &tape->flags);
spin_unlock_irqrestore(&tape->spinlock, flags);
diff -urN linux-2.5.19/drivers/ide/ide-taskfile.c linux/drivers/ide/ide-taskfile.c
--- linux-2.5.19/drivers/ide/ide-taskfile.c 2002-06-02 07:28:28.000000000 +0200
+++ linux/drivers/ide/ide-taskfile.c 2002-06-02 07:07:28.000000000 +0200
@@ -311,34 +311,34 @@
}
ide_startstop_t ata_taskfile(struct ata_device *drive,
- struct ata_taskfile *args, struct request *rq)
+ struct ata_taskfile *ar, struct request *rq)
{
struct hd_driveid *id = drive->id;
/* (ks/hs): Moved to start, do not use for multiple out commands */
- if (args->handler != task_mulout_intr) {
+ if (ar->handler != task_mulout_intr) {
ata_irq_enable(drive, 1);
ata_mask(drive);
}
if ((id->command_set_2 & 0x0400) && (id->cfs_enable_2 & 0x0400) &&
(drive->addressing == 1))
- ata_out_regfile(drive, &args->hobfile);
+ ata_out_regfile(drive, &ar->hobfile);
- ata_out_regfile(drive, &args->taskfile);
+ ata_out_regfile(drive, &ar->taskfile);
{
u8 HIHI = (drive->addressing) ? 0xE0 : 0xEF;
- OUT_BYTE((args->taskfile.device_head & HIHI) | drive->select.all, IDE_SELECT_REG);
+ OUT_BYTE((ar->taskfile.device_head & HIHI) | drive->select.all, IDE_SELECT_REG);
}
- if (args->handler != NULL) {
+ if (ar->handler != NULL) {
/* This is apparently supposed to reset the wait timeout for
* the interrupt to accur.
*/
- ide_set_handler(drive, args->handler, WAIT_CMD, NULL);
- OUT_BYTE(args->taskfile.command, IDE_COMMAND_REG);
+ ide_set_handler(drive, ar->handler, WAIT_CMD, NULL);
+ OUT_BYTE(ar->cmd, IDE_COMMAND_REG);
/*
* Warning check for race between handler and prehandler for
@@ -346,8 +346,8 @@
* inside the boundaries of the seek, we should be okay.
*/
- if (args->prehandler != NULL)
- return args->prehandler(drive, rq);
+ if (ar->prehandler != NULL)
+ return ar->prehandler(drive, rq);
} else {
/*
* FIXME: this is a gross hack, need to unify tcq dma proc and
@@ -358,21 +358,20 @@
return ide_started;
/* for dma commands we don't set the handler */
- if (args->taskfile.command == WIN_WRITEDMA
- || args->taskfile.command == WIN_WRITEDMA_EXT)
+ if (ar->cmd == WIN_WRITEDMA || ar->cmd == WIN_WRITEDMA_EXT)
return !udma_write(drive, rq);
- else if (args->taskfile.command == WIN_READDMA
- || args->taskfile.command == WIN_READDMA_EXT)
+ else if (ar->cmd == WIN_READDMA
+ || ar->cmd == WIN_READDMA_EXT)
return !udma_read(drive, rq);
#ifdef CONFIG_BLK_DEV_IDE_TCQ
- else if (args->taskfile.command == WIN_WRITEDMA_QUEUED
- || args->taskfile.command == WIN_WRITEDMA_QUEUED_EXT
- || args->taskfile.command == WIN_READDMA_QUEUED
- || args->taskfile.command == WIN_READDMA_QUEUED_EXT)
+ else if (ar->cmd == WIN_WRITEDMA_QUEUED
+ || ar->cmd == WIN_WRITEDMA_QUEUED_EXT
+ || ar->cmd == WIN_READDMA_QUEUED
+ || ar->cmd == WIN_READDMA_QUEUED_EXT)
return udma_tcq_taskfile(drive, rq);
#endif
else {
- printk("ata_taskfile: unknown command %x\n", args->taskfile.command);
+ printk("ata_taskfile: unknown command %x\n", ar->cmd);
return ide_stopped;
}
}
@@ -396,18 +395,18 @@
*/
ide_startstop_t task_no_data_intr(struct ata_device *drive, struct request *rq)
{
- struct ata_taskfile *args = rq->special;
+ struct ata_taskfile *ar = rq->special;
ide__sti(); /* local CPU only */
if (!ata_status(drive, READY_STAT, BAD_STAT)) {
/* Keep quiet for NOP because it is expected to fail. */
- if (args && args->taskfile.command != WIN_NOP)
+ if (ar && ar->cmd != WIN_NOP)
return ata_error(drive, rq, __FUNCTION__);
}
- if (args)
- ide_end_drive_cmd(drive, rq, GET_ERR());
+ if (ar)
+ ide_end_drive_cmd(drive, rq);
return ide_stopped;
}
@@ -466,8 +465,8 @@
}
/* (ks/hs): Fixed Multi Write */
- if ((args->taskfile.command != WIN_MULTWRITE) &&
- (args->taskfile.command != WIN_MULTWRITE_EXT)) {
+ if ((args->cmd != WIN_MULTWRITE) &&
+ (args->cmd != WIN_MULTWRITE_EXT)) {
unsigned long flags;
char *buf = ide_map_rq(rq, &flags);
/* For Write_sectors we need to stuff the first sector */
@@ -569,7 +568,7 @@
args->prehandler = NULL;
args->handler = NULL;
- switch(args->taskfile.command) {
+ switch (args->cmd) {
case WIN_IDENTIFY:
case WIN_PIDENTIFY:
args->handler = task_in_intr;
@@ -817,13 +816,6 @@
memset(&rq, 0, sizeof(rq));
rq.flags = REQ_DRIVE_ACB;
-
-#if 0
- if (args->command_type != IDE_DRIVE_TASK_NO_DATA)
- rq.current_nr_sectors = rq.nr_sectors
- = (args->hobfile.sector_count << 8)
- | args->taskfile.sector_count;
-#endif
rq.special = args;
return ide_do_drive_cmd(drive, &rq, ide_wait);
diff -urN linux-2.5.19/drivers/ide/ioctl.c linux/drivers/ide/ioctl.c
--- linux-2.5.19/drivers/ide/ioctl.c 2002-06-02 07:28:28.000000000 +0200
+++ linux/drivers/ide/ioctl.c 2002-06-02 07:10:02.000000000 +0200
@@ -23,6 +23,7 @@
#include <linux/errno.h>
#include <linux/blkpg.h>
#include <linux/pci.h>
+#include <linux/delay.h>
#include <linux/cdrom.h>
#include <linux/device.h>
@@ -33,42 +34,67 @@
#include "ioctl.h"
/*
+ * Invoked on completion of a special DRIVE_CMD.
+ */
+static ide_startstop_t drive_cmd_intr(struct ata_device *drive, struct request *rq)
+{
+ struct ata_taskfile *ar = rq->special;
+
+ ide__sti(); /* local CPU only */
+ if (!ata_status(drive, 0, DRQ_STAT) && ar->taskfile.sector_number) {
+ int retries = 10;
+
+ ata_read(drive, rq->buffer, ar->taskfile.sector_number * SECTOR_WORDS);
+
+ while (!ata_status(drive, 0, BUSY_STAT) && retries--)
+ udelay(100);
+ }
+
+ if (!ata_status(drive, READY_STAT, BAD_STAT))
+ return ata_error(drive, rq, __FUNCTION__); /* already calls ide_end_drive_cmd */
+ ide_end_drive_cmd(drive, rq);
+
+ return ide_stopped;
+}
+
+/*
* Implement generic ioctls invoked from userspace to imlpement specific
* functionality.
*
* Unfortunately every single low level programm out there is using this
* interface.
*/
-static int cmd_ioctl(struct ata_device *drive, unsigned long arg)
+static int do_cmd_ioctl(struct ata_device *drive, unsigned long arg)
{
int err = 0;
u8 vals[4];
u8 *argbuf = vals;
- u8 pio = 0;
int argsize = 4;
struct ata_taskfile args;
struct request rq;
- memset(&rq, 0, sizeof(rq));
- rq.flags = REQ_DRIVE_CMD;
-
- /* If empty parameter file - wait for drive ready.
- */
- if (!arg)
- return ide_do_drive_cmd(drive, &rq, ide_wait);
-
/* Second phase.
*/
if (copy_from_user(vals, (void *)arg, 4))
return -EFAULT;
+ memset(&rq, 0, sizeof(rq));
+ rq.flags = REQ_DRIVE_ACB;
+
+ memset(&args, 0, sizeof(args));
+
args.taskfile.feature = vals[2];
- args.taskfile.sector_count = vals[3];
- args.taskfile.sector_number = vals[1];
- args.taskfile.low_cylinder = 0x00;
- args.taskfile.high_cylinder = 0x00;
+ args.taskfile.sector_count = vals[1];
+ args.taskfile.sector_number = vals[3];
+ if (vals[0] == WIN_SMART) {
+ args.taskfile.low_cylinder = 0x4f;
+ args.taskfile.high_cylinder = 0xc2;
+ } else {
+ args.taskfile.low_cylinder = 0x00;
+ args.taskfile.high_cylinder = 0x00;
+ }
args.taskfile.device_head = 0x00;
- args.taskfile.command = vals[0];
+ args.cmd = vals[0];
if (vals[3]) {
argsize = 4 + (SECTOR_WORDS * 4 * vals[3]);
@@ -79,63 +105,18 @@
memset(argbuf + 4, 0, argsize - 4);
}
- /*
- * Always make sure the transfer reate has been setup.
- *
- * FIXME: what about setting up the drive with ->tuneproc?
- *
- * Backside of HDIO_DRIVE_CMD call of SETFEATURES_XFER.
- * 1 : Safe to update drive->id DMA registers.
- * 0 : OOPs not allowed.
- */
- if ((args.taskfile.command == WIN_SETFEATURES) &&
- (args.taskfile.sector_number >= XFER_SW_DMA_0) &&
- (args.taskfile.feature == SETFEATURES_XFER) &&
- (drive->id->dma_ultra ||
- drive->id->dma_mword ||
- drive->id->dma_1word)) {
- pio = vals[1];
- /*
- * Verify that we are doing an approved SETFEATURES_XFER with
- * respect to the hardware being able to support request.
- * Since some hardware can improperly report capabilties, we
- * check to see if the host adapter in combination with the
- * device (usually a disk) properly detect and acknowledge each
- * end of the ribbon.
- */
- if (args.taskfile.sector_number > XFER_UDMA_2) {
- if (!drive->channel->udma_four) {
- printk(KERN_WARNING "%s: Speed warnings UDMA > 2 is not functional.\n",
- drive->channel->name);
- goto abort;
- }
-#ifndef CONFIG_IDEDMA_IVB
- if (!(drive->id->hw_config & 0x6000))
-#else
- if (!(drive->id->hw_config & 0x2000) ||
- !(drive->id->hw_config & 0x4000))
-#endif
- {
- printk(KERN_WARNING "%s: Speed warnings UDMA > 2 is not functional.\n",
- drive->name);
- goto abort;
- }
- }
- }
-
/* Issue ATA command and wait for completion.
*/
- rq.buffer = argbuf;
+ args.handler = drive_cmd_intr;
+
+ rq.buffer = argbuf + 4;
+ rq.special = &args;
err = ide_do_drive_cmd(drive, &rq, ide_wait);
- if (!err && pio) {
- /* active-retuning-calls future */
- /* FIXME: what about the setup for the drive?! */
- if (drive->channel->speedproc)
- drive->channel->speedproc(drive, pio);
- }
+ argbuf[0] = drive->status;
+ argbuf[1] = args.taskfile.feature;
+ argbuf[2] = args.taskfile.sector_count;
-abort:
if (copy_to_user((void *)arg, argbuf, argsize))
err = -EFAULT;
@@ -153,7 +134,6 @@
{
unsigned int major, minor;
struct ata_device *drive;
-// struct request rq;
kdev_t dev;
dev = inode->i_rdev;
@@ -354,10 +334,14 @@
return 0;
case HDIO_DRIVE_CMD:
- if (!capable(CAP_SYS_RAWIO))
- return -EACCES;
+ if (!arg) {
+ if (ide_spin_wait_hwgroup(drive))
+ return -EBUSY;
+ else
+ return 0;
+ }
- return cmd_ioctl(drive, arg);
+ return do_cmd_ioctl(drive, arg);
/*
* uniform packet command handling
diff -urN linux-2.5.19/drivers/ide/pcidma.c linux/drivers/ide/pcidma.c
--- linux-2.5.19/drivers/ide/pcidma.c 2002-06-01 23:17:28.000000000 +0200
+++ linux/drivers/ide/pcidma.c 2002-06-02 07:11:16.000000000 +0200
@@ -541,9 +541,10 @@
ide_set_handler(drive, ide_dma_intr, WAIT_CMD, dma_timer_expiry); /* issue cmd to drive */
if ((rq->flags & REQ_DRIVE_ACB) && (drive->addressing == 1)) {
+ /* FIXME: this should never happen */
struct ata_taskfile *args = rq->special;
- outb(args->taskfile.command, IDE_COMMAND_REG);
+ outb(args->cmd, IDE_COMMAND_REG);
} else if (drive->addressing) {
outb(reading ? WIN_READDMA_EXT : WIN_WRITEDMA_EXT, IDE_COMMAND_REG);
} else {
diff -urN linux-2.5.19/drivers/ide/pdc4030.c linux/drivers/ide/pdc4030.c
--- linux-2.5.19/drivers/ide/pdc4030.c 2002-06-01 23:17:28.000000000 +0200
+++ linux/drivers/ide/pdc4030.c 2002-06-02 07:13:34.000000000 +0200
@@ -630,7 +630,7 @@
outb(taskfile->low_cylinder, IDE_LCYL_REG);
outb(taskfile->high_cylinder, IDE_HCYL_REG);
outb(taskfile->device_head, IDE_SELECT_REG);
- outb(taskfile->command, IDE_COMMAND_REG);
+ outb(args->cmd, IDE_COMMAND_REG);
switch (rq_data_dir(rq)) {
case READ:
@@ -708,7 +708,7 @@
args.taskfile.low_cylinder = (block>>=8);
args.taskfile.high_cylinder = (block>>=8);
args.taskfile.device_head = ((block>>8)&0x0f)|drive->select.all;
- args.taskfile.command = (rq_data_dir(rq)==READ)?PROMISE_READ:PROMISE_WRITE;
+ args.cmd = (rq_data_dir(rq)==READ)?PROMISE_READ:PROMISE_WRITE;
/* We can't call ide_cmd_type_parser here, since it won't understand
our command, but that doesn't matter, since we don't use the
diff -urN linux-2.5.19/drivers/ide/tcq.c linux/drivers/ide/tcq.c
--- linux-2.5.19/drivers/ide/tcq.c 2002-06-01 23:17:28.000000000 +0200
+++ linux/drivers/ide/tcq.c 2002-06-02 07:12:17.000000000 +0200
@@ -60,7 +60,7 @@
struct ata_taskfile *args = rq->special;
ide__sti();
- ide_end_drive_cmd(drive, rq, GET_ERR());
+ ide_end_drive_cmd(drive, rq);
kfree(args);
return ide_stopped;
@@ -118,7 +118,7 @@
BUG_ON(!rq);
rq->special = args;
- args->taskfile.command = WIN_NOP;
+ args->cmd = WIN_NOP;
args->handler = tcq_nop_handler;
args->command_type = IDE_DRIVE_TASK_NO_DATA;
@@ -407,7 +407,7 @@
memset(&args, 0, sizeof(args));
args.taskfile.feature = 0x01;
- args.taskfile.command = WIN_NOP;
+ args.cmd = WIN_NOP;
ide_cmd_type_parser(&args);
/*
@@ -442,7 +442,7 @@
memset(&args, 0, sizeof(args));
args.taskfile.feature = SETFEATURES_EN_WCACHE;
- args.taskfile.command = WIN_SETFEATURES;
+ args.cmd = WIN_SETFEATURES;
ide_cmd_type_parser(&args);
if (ide_raw_taskfile(drive, &args)) {
@@ -456,7 +456,7 @@
*/
memset(&args, 0, sizeof(args));
args.taskfile.feature = SETFEATURES_DIS_RI;
- args.taskfile.command = WIN_SETFEATURES;
+ args.cmd = WIN_SETFEATURES;
ide_cmd_type_parser(&args);
if (ide_raw_taskfile(drive, &args)) {
@@ -470,7 +470,7 @@
*/
memset(&args, 0, sizeof(args));
args.taskfile.feature = SETFEATURES_EN_SI;
- args.taskfile.command = WIN_SETFEATURES;
+ args.cmd = WIN_SETFEATURES;
ide_cmd_type_parser(&args);
if (ide_raw_taskfile(drive, &args)) {
@@ -554,7 +554,7 @@
ata_irq_enable(drive, 0);
#endif
- OUT_BYTE(args->taskfile.command, IDE_COMMAND_REG);
+ OUT_BYTE(args->cmd, IDE_COMMAND_REG);
if (wait_altstat(drive, &stat, BUSY_STAT)) {
ide_dump_status(drive, rq, "queued start", stat);
diff -urN linux-2.5.19/drivers/scsi/ide-scsi.c linux/drivers/scsi/ide-scsi.c
--- linux-2.5.19/drivers/scsi/ide-scsi.c 2002-06-02 07:28:28.000000000 +0200
+++ linux/drivers/scsi/ide-scsi.c 2002-06-02 04:48:47.000000000 +0200
@@ -242,7 +242,11 @@
ide_end_request(drive, rq, uptodate);
return 0;
}
- ide_end_drive_cmd(drive, rq, 0);
+
+ blkdev_dequeue_request(rq);
+ drive->rq = NULL;
+ end_that_request_last(rq);
+
if (rq->errors >= ERROR_MAX) {
pc->s.scsi_cmd->result = DID_ERROR << 16;
if (log)
diff -urN linux-2.5.19/include/linux/blkdev.h linux/include/linux/blkdev.h
--- linux-2.5.19/include/linux/blkdev.h 2002-05-29 20:42:49.000000000 +0200
+++ linux/include/linux/blkdev.h 2002-06-02 06:33:55.000000000 +0200
@@ -81,7 +81,6 @@
/*
* for ATA/ATAPI devices
*/
- __REQ_DRIVE_CMD,
__REQ_DRIVE_ACB,
__REQ_PC, /* packet command (special) */
@@ -101,7 +100,6 @@
#define REQ_STARTED (1 << __REQ_STARTED)
#define REQ_DONTPREP (1 << __REQ_DONTPREP)
#define REQ_QUEUED (1 << __REQ_QUEUED)
-#define REQ_DRIVE_CMD (1 << __REQ_DRIVE_CMD)
#define REQ_DRIVE_ACB (1 << __REQ_DRIVE_ACB)
#define REQ_PC (1 << __REQ_PC)
#define REQ_BLOCK_PC (1 << __REQ_BLOCK_PC)
diff -urN linux-2.5.19/include/linux/hdreg.h linux/include/linux/hdreg.h
--- linux-2.5.19/include/linux/hdreg.h 2002-06-02 07:28:28.000000000 +0200
+++ linux/include/linux/hdreg.h 2002-06-02 07:20:57.000000000 +0200
@@ -74,16 +74,12 @@
#define IDE_DRIVE_TASK_RAW_WRITE 4
struct hd_drive_task_hdr {
- u8 data;
u8 feature;
u8 sector_count;
u8 sector_number;
u8 low_cylinder;
u8 high_cylinder;
u8 device_head;
-
- /* FXIME: Consider moving this out from here. */
- u8 command;
} __attribute__((packed));
/*
diff -urN linux-2.5.19/include/linux/ide.h linux/include/linux/ide.h
--- linux-2.5.19/include/linux/ide.h 2002-06-02 07:28:28.000000000 +0200
+++ linux/include/linux/ide.h 2002-06-02 07:21:08.000000000 +0200
@@ -253,11 +253,11 @@
unsigned all : 8; /* all of the bits together */
struct {
#if defined(__LITTLE_ENDIAN_BITFIELD)
- unsigned XXX_head : 4; /* always zeros here */
+ unsigned head : 4; /* always zeros here */
unsigned unit : 1; /* drive select number: 0/1 */
- unsigned XXX_bit5 : 1; /* always 1 */
+ unsigned bit5 : 1; /* always 1 */
unsigned lba : 1; /* using LBA instead of CHS */
- unsigned XXX_bit7 : 1; /* always 1 */
+ unsigned bit7 : 1; /* always 1 */
#elif defined(__BIG_ENDIAN_BITFIELD)
unsigned bit7 : 1;
unsigned lba : 1;
@@ -666,11 +666,12 @@
/*
* Clean up after success/failure of an explicit drive cmd.
*/
-extern void ide_end_drive_cmd(struct ata_device *, struct request *, u8);
+extern void ide_end_drive_cmd(struct ata_device *, struct request *);
struct ata_taskfile {
struct hd_drive_task_hdr taskfile;
struct hd_drive_task_hdr hobfile;
+ u8 cmd; /* actual ATA command */
int command_type;
ide_startstop_t (*prehandler)(struct ata_device *, struct request *);
ide_startstop_t (*handler)(struct ata_device *, struct request *);
^ permalink raw reply [flat|nested] 35+ messages in thread* [PATCH] 2.5.19 IDE 81
2002-05-29 18:50 Linux 2.5.19 Linus Torvalds
` (11 preceding siblings ...)
2002-06-02 6:07 ` [PATCH] 2.5.19 IDE 80 Martin Dalecki
@ 2002-06-02 19:45 ` Martin Dalecki
2002-06-02 20:13 ` [PATCH] 2.5.19 IDE 82 Martin Dalecki
13 siblings, 0 replies; 35+ messages in thread
From: Martin Dalecki @ 2002-06-02 19:45 UTC (permalink / raw)
To: Linus Torvalds; +Cc: Kernel Mailing List
[-- Attachment #1: Type: text/plain, Size: 573 bytes --]
Sun Jun 2 07:29:17 CEST 2002 ide-clean-81
- Don't use ata_taskfiles cmd field for drive status reporting,
we can now simply use drive->status instead.
- Unify command type parser entries which could be unified due to the
unification of corresponding interrupt handlers.
- Eliminate reading parameter from ata_do_udma(). We have this information
already in the rq. This allows us to merge several methods.
- Rename XXX_udma to udma_setup, since we have finally settled up on this
semantics.
- Simplify tons of host chip code by removing wrapper functions.
[-- Attachment #2: ide-clean-81.diff --]
[-- Type: text/plain, Size: 49199 bytes --]
diff -urN linux-2.5.19/drivers/ide/aec62xx.c linux/drivers/ide/aec62xx.c
--- linux-2.5.19/drivers/ide/aec62xx.c 2002-06-01 18:53:06.000000000 +0200
+++ linux/drivers/ide/aec62xx.c 2002-06-02 12:24:11.000000000 +0200
@@ -150,7 +150,7 @@
}
#ifdef CONFIG_BLK_DEV_IDEDMA
-static int aec62xx_dmaproc(struct ata_device *drive)
+static int aec62xx_udma_setup(struct ata_device *drive)
{
u32 bmide = pci_resource_start(drive->channel->pci_dev, 4);
short speed;
@@ -244,8 +244,8 @@
{
int i;
- ch->tuneproc = &aec62xx_tune_drive;
- ch->speedproc = &aec_set_drive;
+ ch->tuneproc = aec62xx_tune_drive;
+ ch->speedproc = aec_set_drive;
ch->autodma = 0;
ch->io_32bit = 1;
@@ -259,7 +259,7 @@
#ifdef CONFIG_BLK_DEV_IDEDMA
if (ch->dma_base) {
ch->highmem = 1;
- ch->XXX_udma = aec62xx_dmaproc;
+ ch->udma_setup = aec62xx_udma_setup;
#ifdef CONFIG_IDEDMA_AUTO
if (!noautodma)
ch->autodma = 1;
diff -urN linux-2.5.19/drivers/ide/alim15x3.c linux/drivers/ide/alim15x3.c
--- linux-2.5.19/drivers/ide/alim15x3.c 2002-06-01 18:53:01.000000000 +0200
+++ linux/drivers/ide/alim15x3.c 2002-06-02 12:05:13.000000000 +0200
@@ -199,7 +199,7 @@
return !ali15x3_tune_chipset(drive, mode);
}
-static int ali15x3_config_drive_for_dma(struct ata_device *drive)
+static int ali15x3_udma_setup(struct ata_device *drive)
{
struct hd_driveid *id = drive->id;
struct ata_channel *hwif = drive->channel;
@@ -261,17 +261,12 @@
return 0;
}
-static int ali15x3_udma_write(struct ata_device *drive, struct request *rq)
+static int ali15x3_udma_init(struct ata_device *drive, struct request *rq)
{
if ((m5229_revision < 0xC2) && (drive->type != ATA_DISK))
return 1; /* try PIO instead of DMA */
- return ata_do_udma(0, drive, rq);
-}
-
-static int ali15x3_dmaproc(struct ata_device *drive)
-{
- return ali15x3_config_drive_for_dma(drive);
+ return udma_pci_init(drive, rq);
}
#endif
@@ -447,8 +442,8 @@
/*
* M1543C or newer for DMAing
*/
- hwif->udma_write = ali15x3_udma_write;
- hwif->XXX_udma = ali15x3_dmaproc;
+ hwif->udma_init = ali15x3_udma_init;
+ hwif->udma_setup = ali15x3_udma_setup;
hwif->autodma = 1;
}
diff -urN linux-2.5.19/drivers/ide/amd74xx.c linux/drivers/ide/amd74xx.c
--- linux-2.5.19/drivers/ide/amd74xx.c 2002-06-01 18:53:01.000000000 +0200
+++ linux/drivers/ide/amd74xx.c 2002-06-02 11:46:59.000000000 +0200
@@ -177,7 +177,7 @@
}
#ifdef CONFIG_BLK_DEV_IDEDMA
-int amd74xx_dmaproc(struct ata_device *drive)
+static int amd74xx_udma_setup(struct ata_device *drive)
{
short w80 = drive->channel->udma_four;
@@ -291,7 +291,7 @@
#ifdef CONFIG_BLK_DEV_IDEDMA
if (hwif->dma_base) {
hwif->highmem = 1;
- hwif->XXX_udma = amd74xx_dmaproc;
+ hwif->udma_setup = amd74xx_udma_setup;
# ifdef CONFIG_IDEDMA_AUTO
if (!noautodma)
hwif->autodma = 1;
diff -urN linux-2.5.19/drivers/ide/cmd64x.c linux/drivers/ide/cmd64x.c
--- linux-2.5.19/drivers/ide/cmd64x.c 2002-06-01 18:53:02.000000000 +0200
+++ linux/drivers/ide/cmd64x.c 2002-06-02 11:45:19.000000000 +0200
@@ -627,7 +627,7 @@
return 0;
}
-static int cmd680_dmaproc(struct ata_device *drive)
+static int cmd680_udma_setup(struct ata_device *drive)
{
return cmd64x_config_drive_for_dma(drive);
}
@@ -680,7 +680,7 @@
return (dma_stat & 4) == 4; /* return 1 if INTR asserted */
}
-static int cmd64x_dmaproc(struct ata_device *drive)
+static int cmd64x_udma_setup(struct ata_device *drive)
{
return cmd64x_config_drive_for_dma(drive);
}
@@ -703,7 +703,7 @@
* ASUS P55T2P4D with CMD646 chipset revision 0x01 requires the old
* event order for DMA transfers.
*/
-static int cmd646_1_dmaproc(struct ata_device *drive)
+static int cmd646_1_udma_setup(struct ata_device *drive)
{
return cmd64x_config_drive_for_dma(drive);
}
@@ -903,7 +903,7 @@
hwif->busproc = cmd680_busproc;
#ifdef CONFIG_BLK_DEV_IDEDMA
if (hwif->dma_base)
- hwif->XXX_udma = cmd680_dmaproc;
+ hwif->udma_setup = cmd680_udma_setup;
#endif
hwif->resetproc = cmd680_reset;
hwif->speedproc = cmd680_tune_chipset;
@@ -914,7 +914,7 @@
case PCI_DEVICE_ID_CMD_643:
#ifdef CONFIG_BLK_DEV_IDEDMA
if (hwif->dma_base) {
- hwif->XXX_udma = cmd64x_dmaproc;
+ hwif->udma_setup = cmd64x_udma_setup;
hwif->udma_stop = cmd64x_udma_stop;
hwif->udma_irq_status = cmd64x_udma_irq_status;
}
@@ -927,10 +927,10 @@
#ifdef CONFIG_BLK_DEV_IDEDMA
if (hwif->dma_base) {
if (class_rev == 0x01) {
- hwif->XXX_udma = cmd646_1_dmaproc;
+ hwif->udma_setup = cmd646_1_udma_setup;
hwif->udma_stop = cmd646_1_udma_stop;
} else {
- hwif->XXX_udma = cmd64x_dmaproc;
+ hwif->udma_setup = cmd64x_udma_setup;
hwif->udma_stop = cmd64x_udma_stop;
hwif->udma_irq_status = cmd64x_udma_irq_status;
}
diff -urN linux-2.5.19/drivers/ide/cs5530.c linux/drivers/ide/cs5530.c
--- linux-2.5.19/drivers/ide/cs5530.c 2002-06-01 18:53:02.000000000 +0200
+++ linux/drivers/ide/cs5530.c 2002-06-02 11:47:25.000000000 +0200
@@ -191,7 +191,7 @@
return 0;
}
-int cs5530_dmaproc(struct ata_device *drive)
+static int cs5530_udma_setup(struct ata_device *drive)
{
return cs5530_config_dma(drive);
}
@@ -292,7 +292,7 @@
unsigned int basereg, d0_timings;
#ifdef CONFIG_BLK_DEV_IDEDMA
- hwif->XXX_udma = cs5530_dmaproc;
+ hwif->udma_setup = cs5530_udma_setup;
hwif->highmem = 1;
#else
hwif->autodma = 0;
diff -urN linux-2.5.19/drivers/ide/cy82c693.c linux/drivers/ide/cy82c693.c
--- linux-2.5.19/drivers/ide/cy82c693.c 2002-05-29 20:42:49.000000000 +0200
+++ linux/drivers/ide/cy82c693.c 2002-06-02 11:40:41.000000000 +0200
@@ -236,7 +236,7 @@
/*
* used to set DMA mode for CY82C693 (single and multi modes)
*/
-static int cy82c693_dmaproc(struct ata_device *drive)
+static int cy82c693_udma_setup(struct ata_device *drive)
{
/*
* Set dma mode for drive everything else is done by the defaul func.
@@ -443,7 +443,7 @@
#ifdef CONFIG_BLK_DEV_IDEDMA
if (hwif->dma_base) {
hwif->highmem = 1;
- hwif->XXX_udma = cy82c693_dmaproc;
+ hwif->udma_setup = cy82c693_udma_setup;
if (!noautodma)
hwif->autodma = 1;
}
diff -urN linux-2.5.19/drivers/ide/hpt34x.c linux/drivers/ide/hpt34x.c
--- linux-2.5.19/drivers/ide/hpt34x.c 2002-06-01 23:17:28.000000000 +0200
+++ linux/drivers/ide/hpt34x.c 2002-06-02 11:55:16.000000000 +0200
@@ -172,7 +172,7 @@
return !hpt34x_tune_chipset(drive, mode);
}
-static int config_drive_xfer_rate(struct ata_device *drive)
+static int hpt34x_udma_setup(struct ata_device *drive)
{
struct hd_driveid *id = drive->id;
int on = 1;
@@ -246,18 +246,23 @@
return (dma_stat & 7) != 4; /* verify good DMA status */
}
-static int do_udma(unsigned int reading, struct ata_device *drive, struct request *rq)
+static int hpt34x_udma_init(struct ata_device *drive, struct request *rq)
{
struct ata_channel *ch = drive->channel;
unsigned long dma_base = ch->dma_base;
unsigned int count;
+ u8 cmd;
if (!(count = udma_new_table(ch, rq)))
return 1; /* try PIO instead of DMA */
- outl(ch->dmatable_dma, dma_base + 4); /* PRD table */
- reading |= 0x01;
- outb(reading, dma_base); /* specify r/w */
+ if (rq_data_dir(rq) == READ)
+ cmd = 0x09;
+ else
+ cmd = 0x01;
+
+ outl(ch->dmatable_dma, dma_base + 4); /* PRD table */
+ outb(cmd, dma_base); /* specify r/w */
outb(inb(dma_base+2)|6, dma_base+2); /* clear INTR & ERROR flags */
drive->waiting_for_dma = 1;
@@ -265,30 +270,10 @@
return 0;
ide_set_handler(drive, ide_dma_intr, WAIT_CMD, NULL); /* issue cmd to drive */
- OUT_BYTE((reading == 9) ? WIN_READDMA : WIN_WRITEDMA, IDE_COMMAND_REG);
+ OUT_BYTE((cmd == 0x09) ? WIN_READDMA : WIN_WRITEDMA, IDE_COMMAND_REG);
return 0;
}
-
-static int hpt34x_udma_read(struct ata_device *drive, struct request *rq)
-{
- return do_udma(1 << 3, drive, rq);
-}
-
-static int hpt34x_udma_write(struct ata_device *drive, struct request *rq)
-{
- return do_udma(0, drive, rq);
-}
-
-/*
- * This is specific to the HPT343 UDMA bios-less chipset
- * and HPT345 UDMA bios chipset (stamped HPT363)
- * by HighPoint|Triones Technologies, Inc.
- */
-static int hpt34x_dmaproc(struct ata_device *drive)
-{
- return config_drive_xfer_rate(drive);
-}
#endif
/*
@@ -356,9 +341,8 @@
hwif->autodma = 0;
hwif->udma_stop = hpt34x_udma_stop;
- hwif->udma_read = hpt34x_udma_read;
- hwif->udma_write = hpt34x_udma_write;
- hwif->XXX_udma = hpt34x_dmaproc;
+ hwif->udma_init = hpt34x_udma_init;
+ hwif->udma_setup = hpt34x_udma_setup;
hwif->highmem = 1;
} else {
hwif->drives[0].autotune = 1;
diff -urN linux-2.5.19/drivers/ide/hpt366.c linux/drivers/ide/hpt366.c
--- linux-2.5.19/drivers/ide/hpt366.c 2002-06-01 23:17:28.000000000 +0200
+++ linux/drivers/ide/hpt366.c 2002-06-02 12:13:53.000000000 +0200
@@ -836,7 +836,7 @@
}
}
-static int config_drive_xfer_rate(struct ata_device *drive)
+static int hpt3xx_udma_setup(struct ata_device *drive)
{
struct hd_driveid *id = drive->id;
int on = 1;
@@ -903,15 +903,6 @@
pci_write_config_byte(drive->channel->pci_dev, 0x5a, reg5ah & ~0x10);
}
-/*
- * This is specific to the HPT366 UDMA bios chipset
- * by HighPoint|Triones Technologies, Inc.
- */
-static int hpt366_dmaproc(struct ata_device *drive)
-{
- return config_drive_xfer_rate(drive);
-}
-
static void do_udma_start(struct ata_device *drive)
{
struct ata_channel *ch = drive->channel;
@@ -992,11 +983,6 @@
return (dma_stat & 7) != 4 ? (0x10 | dma_stat) : 0; /* verify good DMA status */
}
-static int hpt370_dmaproc(struct ata_device *drive)
-{
- return config_drive_xfer_rate(drive);
-}
-
static int hpt374_udma_stop(struct ata_device *drive)
{
struct ata_channel *ch = drive->channel;
@@ -1019,11 +1005,6 @@
return (dma_stat & 7) != 4 ? (0x10 | dma_stat) : 0; /* verify good DMA status */
}
-
-static int hpt374_dmaproc(struct ata_device *drive)
-{
- return config_drive_xfer_rate(drive);
-}
#endif
/*
@@ -1364,27 +1345,27 @@
if (hpt_min_rev(dev, 7)) {
ch->udma_stop = hpt374_udma_stop;
- ch->XXX_udma = hpt374_dmaproc;
+ ch->udma_setup = hpt3xx_udma_setup;
} else if (hpt_min_rev(dev, 5)) {
ch->udma_stop = hpt374_udma_stop;
- ch->XXX_udma = hpt374_dmaproc;
+ ch->udma_setup = hpt3xx_udma_setup;
} else if (hpt_min_rev(dev, 3)) {
ch->udma_start = hpt370_udma_start;
ch->udma_stop = hpt370_udma_stop;
ch->udma_timeout = hpt370_udma_timeout;
ch->udma_irq_lost = hpt370_udma_irq_lost;
- ch->XXX_udma = hpt370_dmaproc;
+ ch->udma_setup = hpt3xx_udma_setup;
}
} else if (hpt_min_rev(dev, 2)) {
ch->udma_irq_lost = hpt366_udma_irq_lost;
// ch->resetproc = hpt3xx_reset;
// ch->busproc = hpt3xx_tristate;
- ch->XXX_udma = hpt366_dmaproc;
+ ch->udma_setup = hpt3xx_udma_setup;
} else {
ch->udma_irq_lost = hpt366_udma_irq_lost;
// ch->resetproc = hpt3xx_reset;
// ch->busproc = hpt3xx_tristate;
- ch->XXX_udma = hpt366_dmaproc;
+ ch->udma_setup = hpt3xx_udma_setup;
}
if (!noautodma)
ch->autodma = 1;
diff -urN linux-2.5.19/drivers/ide/icside.c linux/drivers/ide/icside.c
--- linux-2.5.19/drivers/ide/icside.c 2002-06-01 23:17:28.000000000 +0200
+++ linux/drivers/ide/icside.c 2002-06-02 11:54:10.000000000 +0200
@@ -544,7 +544,7 @@
return 0;
}
-static int icside_dma_write(struct ata_device *drive, struct request *rq)
+static int icside_dma_init(struct ata_device *drive, struct request *rq)
{
struct ata_channel *ch = drive->channel;
unsigned int cmd;
@@ -612,12 +612,11 @@
ch->dmatable_cpu = NULL;
ch->dmatable_dma = 0;
ch->speedproc = icside_set_speed;
- ch->XXX_udma = icside_dma_check;
+ ch->udma_setup = icside_dma_check;
ch->udma_enable = icside_dma_enable;
ch->udma_start = icside_dma_start;
ch->udma_stop = icside_dma_stop;
- ch->udma_read = icside_dma_read;
- ch->udma_write = icside_dma_write;
+ ch->udma_init = icside_dma_init;
ch->udma_irq_status = icside_irq_status;
ch->udma_timeout = icside_dma_timeout;
ch->udma_irq_lost = icside_irq_lost;
diff -urN linux-2.5.19/drivers/ide/ide.c linux/drivers/ide/ide.c
--- linux-2.5.19/drivers/ide/ide.c 2002-06-02 09:41:16.000000000 +0200
+++ linux/drivers/ide/ide.c 2002-06-02 12:32:10.000000000 +0200
@@ -184,31 +184,6 @@
spin_unlock_irqrestore(ch->lock, flags);
}
-static u8 auto_reduce_xfer(struct ata_device *drive)
-{
- if (!drive->crc_count)
- return drive->current_speed;
- drive->crc_count = 0;
-
- switch(drive->current_speed) {
- case XFER_UDMA_7: return XFER_UDMA_6;
- case XFER_UDMA_6: return XFER_UDMA_5;
- case XFER_UDMA_5: return XFER_UDMA_4;
- case XFER_UDMA_4: return XFER_UDMA_3;
- case XFER_UDMA_3: return XFER_UDMA_2;
- case XFER_UDMA_2: return XFER_UDMA_1;
- case XFER_UDMA_1: return XFER_UDMA_0;
- /*
- * OOPS we do not goto non Ultra DMA modes
- * without iCRC's available we force
- * the system to PIO and make the user
- * invoke the ATA-1 ATA-2 DMA modes.
- */
- case XFER_UDMA_0:
- default: return XFER_PIO_4;
- }
-}
-
static void check_crc_errors(struct ata_device *drive)
{
if (!drive->using_dma)
@@ -218,7 +193,34 @@
if (drive->crc_count) {
udma_enable(drive, 0, 0);
if (drive->channel->speedproc) {
- u8 pio = auto_reduce_xfer(drive);
+ u8 pio = XFER_PIO_4;
+ drive->crc_count = 0;
+
+ switch (drive->current_speed) {
+ case XFER_UDMA_7: pio = XFER_UDMA_6;
+ break;
+ case XFER_UDMA_6: pio = XFER_UDMA_5;
+ break;
+ case XFER_UDMA_5: pio = XFER_UDMA_4;
+ break;
+ case XFER_UDMA_4: pio = XFER_UDMA_3;
+ break;
+ case XFER_UDMA_3: pio = XFER_UDMA_2;
+ break;
+ case XFER_UDMA_2: pio = XFER_UDMA_1;
+ break;
+ case XFER_UDMA_1: pio = XFER_UDMA_0;
+ break;
+ /*
+ * OOPS we do not goto non Ultra DMA modes
+ * without iCRC's available we force
+ * the system to PIO and make the user
+ * invoke the ATA-1 ATA-2 DMA modes.
+ */
+ case XFER_UDMA_0:
+ default:
+ pio = XFER_PIO_4;
+ }
drive->channel->speedproc(drive, pio);
}
if (drive->current_speed >= XFER_SW_DMA_0)
@@ -408,7 +410,6 @@
ar->taskfile.low_cylinder = IN_BYTE(IDE_LCYL_REG);
ar->taskfile.high_cylinder = IN_BYTE(IDE_HCYL_REG);
ar->taskfile.device_head = IN_BYTE(IDE_SELECT_REG);
- ar->cmd = drive->status;
if ((drive->id->command_set_2 & 0x0400) &&
(drive->id->cfs_enable_2 & 0x0400) &&
(drive->addressing == 1)) {
diff -urN linux-2.5.19/drivers/ide/ide-cd.c linux/drivers/ide/ide-cd.c
--- linux-2.5.19/drivers/ide/ide-cd.c 2002-06-02 07:28:28.000000000 +0200
+++ linux/drivers/ide/ide-cd.c 2002-06-02 11:59:16.000000000 +0200
@@ -736,10 +736,8 @@
return startstop;
if (info->dma) {
- if (info->cmd == READ)
- info->dma = !udma_read(drive, rq);
- else if (info->cmd == WRITE)
- info->dma = !udma_write(drive, rq);
+ if (info->cmd == READ || info->cmd == WRITE)
+ info->dma = !udma_init(drive, rq);
else
printk("ide-cd: DMA set, but not allowed\n");
}
diff -urN linux-2.5.19/drivers/ide/ide-disk.c linux/drivers/ide/ide-disk.c
--- linux-2.5.19/drivers/ide/ide-disk.c 2002-06-02 09:41:16.000000000 +0200
+++ linux/drivers/ide/ide-disk.c 2002-06-02 11:34:39.000000000 +0200
@@ -517,7 +517,7 @@
if (!drive->driver)
return -EPERM;
- if (!drive->channel->XXX_udma)
+ if (!drive->channel->udma_setup)
return -EPERM;
if (arg == drive->queue_depth && drive->using_tcq)
@@ -629,7 +629,7 @@
ide_raw_taskfile(drive, &args);
/* if OK, compute maximum address value */
- if ((args.cmd & 0x01) == 0) {
+ if (!(drive->status & ERR_STAT)) {
addr = ((args.taskfile.device_head & 0x0f) << 24)
| (args.taskfile.high_cylinder << 16)
| (args.taskfile.low_cylinder << 8)
@@ -657,7 +657,7 @@
ide_raw_taskfile(drive, &args);
/* if OK, compute maximum address value */
- if ((args.cmd & 0x01) == 0) {
+ if (!(drive->status & ERR_STAT)) {
u32 high = (args.hobfile.high_cylinder << 16) |
(args.hobfile.low_cylinder << 8) |
args.hobfile.sector_number;
@@ -696,7 +696,7 @@
/* submit command request */
ide_raw_taskfile(drive, &args);
/* if OK, read new maximum address value */
- if ((args.cmd & 0x01) == 0) {
+ if (!(drive->status & ERR_STAT)) {
addr_set = ((args.taskfile.device_head & 0x0f) << 24)
| (args.taskfile.high_cylinder << 16)
| (args.taskfile.low_cylinder << 8)
@@ -731,7 +731,7 @@
/* submit command request */
ide_raw_taskfile(drive, &args);
/* if OK, compute maximum address value */
- if ((args.cmd & 0x01) == 0) {
+ if (!(drive->status & ERR_STAT)) {
u32 high = (args.hobfile.high_cylinder << 16) |
(args.hobfile.low_cylinder << 8) |
args.hobfile.sector_number;
diff -urN linux-2.5.19/drivers/ide/ide-floppy.c linux/drivers/ide/ide-floppy.c
--- linux-2.5.19/drivers/ide/ide-floppy.c 2002-06-02 09:41:16.000000000 +0200
+++ linux/drivers/ide/ide-floppy.c 2002-06-02 11:56:51.000000000 +0200
@@ -1060,12 +1060,8 @@
if (test_and_clear_bit (PC_DMA_ERROR, &pc->flags))
udma_enable(drive, 0, 1);
- if (test_bit (PC_DMA_RECOMMENDED, &pc->flags) && drive->using_dma) {
- if (test_bit (PC_WRITING, &pc->flags))
- dma_ok = !udma_write(drive, rq);
- else
- dma_ok = !udma_read(drive, rq);
- }
+ if (test_bit (PC_DMA_RECOMMENDED, &pc->flags) && drive->using_dma)
+ dma_ok = !udma_init(drive, rq);
#endif
ata_irq_enable(drive, 1);
diff -urN linux-2.5.19/drivers/ide/ide-pmac.c linux/drivers/ide/ide-pmac.c
--- linux-2.5.19/drivers/ide/ide-pmac.c 2002-06-01 23:17:28.000000000 +0200
+++ linux/drivers/ide/ide-pmac.c 2002-06-02 12:02:01.000000000 +0200
@@ -260,11 +260,9 @@
static void pmac_udma_enable(struct ata_device *drive, int on, int verbose);
static int pmac_udma_start(struct ata_device *drive, struct request *rq);
static int pmac_udma_stop(struct ata_device *drive);
-static int pmac_do_udma(unsigned int reading, struct ata_device *drive, struct request *rq);
-static int pmac_udma_read(struct ata_device *drive, struct request *rq);
-static int pmac_udma_write(struct ata_device *drive, struct request *rq);
+static int pmac_udma_init(struct ata_device *drive, struct request *rq);
static int pmac_udma_irq_status(struct ata_device *drive);
-static int pmac_ide_dmaproc(struct ata_device *drive);
+static int pmac_udma_setup(struct ata_device *drive);
static int pmac_ide_build_dmatable(struct ata_device *drive, struct request *rq, int ix, int wr);
static int pmac_ide_tune_chipset(struct ata_device *drive, byte speed);
static void pmac_ide_tuneproc(struct ata_device *drive, byte pio);
@@ -334,10 +332,9 @@
ide_hwifs[ix].udma_enable = pmac_udma_enable;
ide_hwifs[ix].udma_start = pmac_udma_start;
ide_hwifs[ix].udma_stop = pmac_udma_stop;
- ide_hwifs[ix].udma_read = pmac_udma_read;
- ide_hwifs[ix].udma_write = pmac_udma_write;
+ ide_hwifs[ix].udma_init = pmac_udma_init;
ide_hwifs[ix].udma_irq_status = pmac_udma_irq_status;
- ide_hwifs[ix].XXX_udma = pmac_ide_dmaproc;
+ ide_hwifs[ix].udma_setup = pmac_udma_setup;
#ifdef CONFIG_BLK_DEV_IDEDMA_PMAC_AUTO
if (!noautodma)
ide_hwifs[ix].autodma = 1;
@@ -1043,10 +1040,9 @@
ide_hwifs[ix].udma_enable = pmac_udma_enable;
ide_hwifs[ix].udma_start = pmac_udma_start;
ide_hwifs[ix].udma_stop = pmac_udma_stop;
- ide_hwifs[ix].udma_read = pmac_udma_read;
- ide_hwifs[ix].udma_write = pmac_udma_write;
+ ide_hwifs[ix].udma_init = pmac_udma_init;
ide_hwifs[ix].udma_irq_status = pmac_udma_irq_status;
- ide_hwifs[ix].XXX_udma = pmac_ide_dmaproc;
+ ide_hwifs[ix].udma_setup = pmac_udma_setup;
#ifdef CONFIG_BLK_DEV_IDEDMA_PMAC_AUTO
if (!noautodma)
ide_hwifs[ix].autodma = 1;
@@ -1405,11 +1401,12 @@
return (dstat & (RUN|DEAD|ACTIVE)) != RUN;
}
-static int pmac_do_udma(unsigned int reading, struct ata_device *drive, struct request *rq)
+static int pmac_udma_init(struct ata_device *drive, struct request *rq)
{
int ix, ata4;
volatile struct dbdma_regs *dma;
- byte unit = (drive->select.b.unit & 0x01);
+ u8 unit = (drive->select.b.unit & 0x01);
+ int reading;
/* Can we stuff a pointer to our intf structure in config_data
* or select_data in hwif ?
@@ -1417,6 +1414,12 @@
ix = pmac_ide_find(drive);
if (ix < 0)
return 0;
+
+ if (rq_data_dir(rq) == READ)
+ reading = 1;
+ else
+ reading = 0;
+
dma = pmac_ide[ix].dma_regs;
ata4 = (pmac_ide[ix].kind == controller_kl_ata4 ||
pmac_ide[ix].kind == controller_kl_ata4_80);
@@ -1447,16 +1450,6 @@
return udma_start(drive, rq);
}
-static int pmac_udma_read(struct ata_device *drive, struct request *rq)
-{
- return pmac_do_udma(1, drive, rq);
-}
-
-static int pmac_udma_write(struct ata_device *drive, struct request *rq)
-{
- return pmac_do_udma(0, drive, rq);
-}
-
/*
* FIXME: This should be attached to a channel as we can see now!
*/
@@ -1514,7 +1507,7 @@
return 0;
}
-static int pmac_ide_dmaproc(struct ata_device *drive)
+static int pmac_udma_setup(struct ata_device *drive)
{
/* Change this to better match ide-dma.c */
pmac_ide_check_dma(drive);
diff -urN linux-2.5.19/drivers/ide/ide-tape.c linux/drivers/ide/ide-tape.c
--- linux-2.5.19/drivers/ide/ide-tape.c 2002-06-02 09:41:16.000000000 +0200
+++ linux/drivers/ide/ide-tape.c 2002-06-02 11:55:34.000000000 +0200
@@ -2258,12 +2258,8 @@
printk (KERN_WARNING "ide-tape: DMA disabled, reverting to PIO\n");
udma_enable(drive, 0, 1);
}
- if (test_bit (PC_DMA_RECOMMENDED, &pc->flags) && drive->using_dma) {
- if (test_bit (PC_WRITING, &pc->flags))
- dma_ok = !udma_write(drive, rq);
- else
- dma_ok = !udma_read(drive, rq);
- }
+ if (test_bit (PC_DMA_RECOMMENDED, &pc->flags) && drive->using_dma)
+ dma_ok = !udma_init(drive, rq);
#endif
ata_irq_enable(drive, 1);
diff -urN linux-2.5.19/drivers/ide/ide-taskfile.c linux/drivers/ide/ide-taskfile.c
--- linux-2.5.19/drivers/ide/ide-taskfile.c 2002-06-02 09:41:16.000000000 +0200
+++ linux/drivers/ide/ide-taskfile.c 2002-06-02 11:59:28.000000000 +0200
@@ -350,19 +350,19 @@
return ar->prehandler(drive, rq);
} else {
/*
- * FIXME: this is a gross hack, need to unify tcq dma proc and
- * regular dma proc.
+ * FIXME: This is a gross hack, need to unify tcq dma proc and
+ * regular dma proc. It should now be easier.
*/
if (!drive->using_dma)
return ide_started;
/* for dma commands we don't set the handler */
- if (ar->cmd == WIN_WRITEDMA || ar->cmd == WIN_WRITEDMA_EXT)
- return !udma_write(drive, rq);
- else if (ar->cmd == WIN_READDMA
+ if (ar->cmd == WIN_WRITEDMA
+ || ar->cmd == WIN_WRITEDMA_EXT
+ || ar->cmd == WIN_READDMA
|| ar->cmd == WIN_READDMA_EXT)
- return !udma_read(drive, rq);
+ return !udma_init(drive, rq);
#ifdef CONFIG_BLK_DEV_IDE_TCQ
else if (ar->cmd == WIN_WRITEDMA_QUEUED
|| ar->cmd == WIN_WRITEDMA_QUEUED_EXT
@@ -371,7 +371,7 @@
return udma_tcq_taskfile(drive, rq);
#endif
else {
- printk("ata_taskfile: unknown command %x\n", ar->cmd);
+ printk(KERN_ERR "%s: unknown command %x\n", __FUNCTION__, ar->cmd);
return ide_stopped;
}
}
@@ -556,31 +556,28 @@
* more data left
*/
ide_set_handler(drive, task_mulin_intr, WAIT_CMD, NULL);
+
return ide_started;
}
/* Called to figure out the type of command being called.
*/
-void ide_cmd_type_parser(struct ata_taskfile *args)
+void ide_cmd_type_parser(struct ata_taskfile *ar)
{
- struct hd_drive_task_hdr *taskfile = &args->taskfile;
+ struct hd_drive_task_hdr *taskfile = &ar->taskfile;
- args->prehandler = NULL;
- args->handler = NULL;
+ ar->prehandler = NULL;
+ ar->handler = NULL;
- switch (args->cmd) {
+ switch (ar->cmd) {
case WIN_IDENTIFY:
case WIN_PIDENTIFY:
- args->handler = task_in_intr;
- args->command_type = IDE_DRIVE_TASK_IN;
- return;
-
case CFA_TRANSLATE_SECTOR:
case WIN_READ:
case WIN_READ_EXT:
case WIN_READ_BUFFER:
- args->handler = task_in_intr;
- args->command_type = IDE_DRIVE_TASK_IN;
+ ar->handler = task_in_intr;
+ ar->command_type = IDE_DRIVE_TASK_IN;
return;
case CFA_WRITE_SECT_WO_ERASE:
@@ -589,56 +586,56 @@
case WIN_WRITE_VERIFY:
case WIN_WRITE_BUFFER:
case WIN_DOWNLOAD_MICROCODE:
- args->prehandler = pre_task_out_intr;
- args->handler = task_out_intr;
- args->command_type = IDE_DRIVE_TASK_RAW_WRITE;
+ ar->prehandler = pre_task_out_intr;
+ ar->handler = task_out_intr;
+ ar->command_type = IDE_DRIVE_TASK_RAW_WRITE;
return;
case WIN_MULTREAD:
case WIN_MULTREAD_EXT:
- args->handler = task_mulin_intr;
- args->command_type = IDE_DRIVE_TASK_IN;
+ ar->handler = task_mulin_intr;
+ ar->command_type = IDE_DRIVE_TASK_IN;
return;
case CFA_WRITE_MULTI_WO_ERASE:
case WIN_MULTWRITE:
case WIN_MULTWRITE_EXT:
- args->prehandler = pre_task_mulout_intr;
- args->handler = task_mulout_intr;
- args->command_type = IDE_DRIVE_TASK_RAW_WRITE;
+ ar->prehandler = pre_task_mulout_intr;
+ ar->handler = task_mulout_intr;
+ ar->command_type = IDE_DRIVE_TASK_RAW_WRITE;
return;
case WIN_SECURITY_DISABLE:
case WIN_SECURITY_ERASE_UNIT:
case WIN_SECURITY_SET_PASS:
case WIN_SECURITY_UNLOCK:
- args->handler = task_out_intr;
- args->command_type = IDE_DRIVE_TASK_OUT;
+ ar->handler = task_out_intr;
+ ar->command_type = IDE_DRIVE_TASK_OUT;
return;
case WIN_SMART:
if (taskfile->feature == SMART_WRITE_LOG_SECTOR)
- args->prehandler = pre_task_out_intr;
+ ar->prehandler = pre_task_out_intr;
- args->taskfile.low_cylinder = SMART_LCYL_PASS;
- args->taskfile.high_cylinder = SMART_HCYL_PASS;
+ ar->taskfile.low_cylinder = SMART_LCYL_PASS;
+ ar->taskfile.high_cylinder = SMART_HCYL_PASS;
- switch(args->taskfile.feature) {
+ switch(ar->taskfile.feature) {
case SMART_READ_VALUES:
case SMART_READ_THRESHOLDS:
case SMART_READ_LOG_SECTOR:
- args->handler = task_in_intr;
- args->command_type = IDE_DRIVE_TASK_IN;
+ ar->handler = task_in_intr;
+ ar->command_type = IDE_DRIVE_TASK_IN;
return;
case SMART_WRITE_LOG_SECTOR:
- args->handler = task_out_intr;
- args->command_type = IDE_DRIVE_TASK_OUT;
+ ar->handler = task_out_intr;
+ ar->command_type = IDE_DRIVE_TASK_OUT;
return;
default:
- args->handler = task_no_data_intr;
- args->command_type = IDE_DRIVE_TASK_NO_DATA;
+ ar->handler = task_no_data_intr;
+ ar->command_type = IDE_DRIVE_TASK_NO_DATA;
return;
}
@@ -648,22 +645,22 @@
case WIN_READDMA_QUEUED:
case WIN_READDMA_EXT:
case WIN_READDMA_QUEUED_EXT:
- args->command_type = IDE_DRIVE_TASK_IN;
+ ar->command_type = IDE_DRIVE_TASK_IN;
return;
case WIN_WRITEDMA:
case WIN_WRITEDMA_QUEUED:
case WIN_WRITEDMA_EXT:
case WIN_WRITEDMA_QUEUED_EXT:
- args->command_type = IDE_DRIVE_TASK_RAW_WRITE;
+ ar->command_type = IDE_DRIVE_TASK_RAW_WRITE;
return;
#endif
case WIN_SETFEATURES:
- args->handler = task_no_data_intr;
- switch(args->taskfile.feature) {
+ ar->handler = task_no_data_intr;
+ switch (ar->taskfile.feature) {
case SETFEATURES_XFER:
- args->command_type = IDE_DRIVE_TASK_SET_XFER;
+ ar->command_type = IDE_DRIVE_TASK_SET_XFER;
return;
case SETFEATURES_DIS_DEFECT:
case SETFEATURES_EN_APM:
@@ -681,18 +678,18 @@
case SETFEATURES_DIS_RI:
case SETFEATURES_DIS_SI:
default:
- args->command_type = IDE_DRIVE_TASK_NO_DATA;
+ ar->command_type = IDE_DRIVE_TASK_NO_DATA;
return;
}
case WIN_SPECIFY:
- args->handler = task_no_data_intr;
- args->command_type = IDE_DRIVE_TASK_NO_DATA;
+ ar->handler = task_no_data_intr;
+ ar->command_type = IDE_DRIVE_TASK_NO_DATA;
return;
case WIN_RESTORE:
- args->handler = recal_intr;
- args->command_type = IDE_DRIVE_TASK_NO_DATA;
+ ar->handler = recal_intr;
+ ar->command_type = IDE_DRIVE_TASK_NO_DATA;
return;
case WIN_DIAGNOSE:
@@ -722,19 +719,10 @@
case WIN_DOORUNLOCK:
case DISABLE_SEAGATE:
case EXABYTE_ENABLE_NEST:
-
- args->handler = task_no_data_intr;
- args->command_type = IDE_DRIVE_TASK_NO_DATA;
- return;
-
case WIN_SETMULT:
- args->handler = task_no_data_intr;
- args->command_type = IDE_DRIVE_TASK_NO_DATA;
- return;
-
case WIN_NOP:
- args->handler = task_no_data_intr;
- args->command_type = IDE_DRIVE_TASK_NO_DATA;
+ ar->handler = task_no_data_intr;
+ ar->command_type = IDE_DRIVE_TASK_NO_DATA;
return;
case WIN_FORMAT:
@@ -743,7 +731,7 @@
case WIN_QUEUED_SERVICE:
case WIN_PACKETCMD:
default:
- args->command_type = IDE_DRIVE_TASK_INVALID;
+ ar->command_type = IDE_DRIVE_TASK_INVALID;
return;
}
}
diff -urN linux-2.5.19/drivers/ide/ioctl.c linux/drivers/ide/ioctl.c
--- linux-2.5.19/drivers/ide/ioctl.c 2002-06-02 09:41:16.000000000 +0200
+++ linux/drivers/ide/ioctl.c 2002-06-02 11:40:55.000000000 +0200
@@ -235,7 +235,7 @@
if (!drive->driver)
return -EPERM;
- if (!drive->id || !(drive->id->capability & 1) || !drive->channel->XXX_udma)
+ if (!drive->id || !(drive->id->capability & 1) || !drive->channel->udma_setup)
return -EPERM;
if (ide_spin_wait_hwgroup(drive))
diff -urN linux-2.5.19/drivers/ide/main.c linux/drivers/ide/main.c
--- linux-2.5.19/drivers/ide/main.c 2002-06-01 23:17:28.000000000 +0200
+++ linux/drivers/ide/main.c 2002-06-02 11:53:37.000000000 +0200
@@ -520,12 +520,11 @@
ch->ata_write = old.ata_write;
ch->atapi_read = old.atapi_read;
ch->atapi_write = old.atapi_write;
- ch->XXX_udma = old.XXX_udma;
+ ch->udma_setup = old.udma_setup;
ch->udma_enable = old.udma_enable;
ch->udma_start = old.udma_start;
ch->udma_stop = old.udma_stop;
- ch->udma_read = old.udma_read;
- ch->udma_write = old.udma_write;
+ ch->udma_init = old.udma_init;
ch->udma_irq_status = old.udma_irq_status;
ch->udma_timeout = old.udma_timeout;
ch->udma_irq_lost = old.udma_irq_lost;
@@ -1092,7 +1091,7 @@
spin_unlock_irqrestore(&ide_lock, flags);
/* Default autotune or requested autotune */
if (drive->autotune != 2) {
- if (drive->channel->XXX_udma) {
+ if (drive->channel->udma_setup) {
/*
* Force DMAing for the beginning of the check. Some
@@ -1103,7 +1102,7 @@
*/
udma_enable(drive, 0, 0);
- drive->channel->XXX_udma(drive);
+ drive->channel->udma_setup(drive);
#ifdef CONFIG_BLK_DEV_IDE_TCQ_DEFAULT
udma_tcq_enable(drive, 1);
#endif
diff -urN linux-2.5.19/drivers/ide/ns87415.c linux/drivers/ide/ns87415.c
--- linux-2.5.19/drivers/ide/ns87415.c 2002-06-02 07:28:28.000000000 +0200
+++ linux/drivers/ide/ns87415.c 2002-06-02 12:08:52.000000000 +0200
@@ -101,11 +101,11 @@
}
-static int ns87415_udma_read(struct ata_device *drive, struct request *rq)
+static int ns87415_udma_init(struct ata_device *drive, struct request *rq)
{
ns87415_prepare_drive(drive, 1); /* select DMA xfer */
- if (!ata_do_udma(1, drive, rq)) /* use standard DMA stuff */
+ if (!udma_pci_init(drive, rq)) /* use standard DMA stuff */
return 0;
ns87415_prepare_drive(drive, 0); /* DMA failed: select PIO xfer */
@@ -113,26 +113,14 @@
return 1;
}
-static int ns87415_udma_write(struct ata_device *drive, struct request *rq)
-{
- ns87415_prepare_drive(drive, 1); /* select DMA xfer */
-
- if (!ata_do_udma(0, drive, rq)) /* use standard DMA stuff */
- return 0;
-
- ns87415_prepare_drive(drive, 0); /* DMA failed: select PIO xfer */
-
- return 1;
-}
-
-static int ns87415_dmaproc(struct ata_device *drive)
+static int ns87415_udma_setup(struct ata_device *drive)
{
if (drive->type != ATA_DISK) {
udma_enable(drive, 0, 0);
return 0;
}
- return XXX_ide_dmaproc(drive);
+ return udma_pci_setup(drive);
}
#endif
@@ -218,9 +206,8 @@
#ifdef CONFIG_BLK_DEV_IDEDMA
if (hwif->dma_base) {
hwif->udma_stop = ns87415_udma_stop;
- hwif->udma_read = ns87415_udma_read;
- hwif->udma_write = ns87415_udma_write;
- hwif->XXX_udma = ns87415_dmaproc;
+ hwif->udma_init = ns87415_udma_init;
+ hwif->udma_setup = ns87415_udma_setup;
}
#endif
diff -urN linux-2.5.19/drivers/ide/pcidma.c linux/drivers/ide/pcidma.c
--- linux-2.5.19/drivers/ide/pcidma.c 2002-06-02 09:41:16.000000000 +0200
+++ linux/drivers/ide/pcidma.c 2002-06-02 12:10:14.000000000 +0200
@@ -164,7 +164,7 @@
/*
* Configure a device for DMA operation.
*/
-int XXX_ide_dmaproc(struct ata_device *drive)
+int udma_pci_setup(struct ata_device *drive)
{
int config_allows_dma = 1;
struct hd_driveid *id = drive->id;
@@ -427,16 +427,6 @@
return (dma_stat & 7) != 4 ? (0x10 | dma_stat) : 0; /* verify good DMA status */
}
-int udma_pci_read(struct ata_device *drive, struct request *rq)
-{
- return ata_do_udma(1, drive, rq);
-}
-
-int udma_pci_write(struct ata_device *drive, struct request *rq)
-{
- return ata_do_udma(0, drive, rq);
-}
-
/*
* FIXME: This should be attached to a channel as we can see now!
*/
@@ -490,18 +480,16 @@
* We could just assign them, and then leave it up to the chipset
* specific code to override these after they've called this function.
*/
- if (!ch->XXX_udma)
- ch->XXX_udma = XXX_ide_dmaproc;
+ if (!ch->udma_setup)
+ ch->udma_setup = udma_pci_setup;
if (!ch->udma_enable)
ch->udma_enable = udma_pci_enable;
if (!ch->udma_start)
ch->udma_start = udma_pci_start;
if (!ch->udma_stop)
ch->udma_stop = udma_pci_stop;
- if (!ch->udma_read)
- ch->udma_read = udma_pci_read;
- if (!ch->udma_write)
- ch->udma_write = udma_pci_write;
+ if (!ch->udma_init)
+ ch->udma_init = udma_pci_init;
if (!ch->udma_irq_status)
ch->udma_irq_status = udma_pci_irq_status;
if (!ch->udma_timeout)
@@ -528,16 +516,20 @@
* It's exported only for host chips which use it for fallback or (too) late
* capability checking.
*/
-
-int ata_do_udma(unsigned int reading, struct ata_device *drive, struct request *rq)
+int udma_pci_init(struct ata_device *drive, struct request *rq)
{
+ u8 cmd;
+
if (ata_start_dma(drive, rq))
return 1;
if (drive->type != ATA_DISK)
return 0;
- reading <<= 3;
+ if (rq_data_dir(rq) == READ)
+ cmd = 0x08;
+ else
+ cmd = 0x00;
ide_set_handler(drive, ide_dma_intr, WAIT_CMD, dma_timer_expiry); /* issue cmd to drive */
if ((rq->flags & REQ_DRIVE_ACB) && (drive->addressing == 1)) {
@@ -545,22 +537,19 @@
struct ata_taskfile *args = rq->special;
outb(args->cmd, IDE_COMMAND_REG);
- } else if (drive->addressing) {
- outb(reading ? WIN_READDMA_EXT : WIN_WRITEDMA_EXT, IDE_COMMAND_REG);
- } else {
- outb(reading ? WIN_READDMA : WIN_WRITEDMA, IDE_COMMAND_REG);
- }
+ } else if (drive->addressing)
+ outb(cmd ? WIN_READDMA_EXT : WIN_WRITEDMA_EXT, IDE_COMMAND_REG);
+ else
+ outb(cmd ? WIN_READDMA : WIN_WRITEDMA, IDE_COMMAND_REG);
return udma_start(drive, rq);
}
-EXPORT_SYMBOL(ata_do_udma);
EXPORT_SYMBOL(ide_dma_intr);
EXPORT_SYMBOL(udma_pci_enable);
EXPORT_SYMBOL(udma_pci_start);
EXPORT_SYMBOL(udma_pci_stop);
-EXPORT_SYMBOL(udma_pci_read);
-EXPORT_SYMBOL(udma_pci_write);
+EXPORT_SYMBOL(udma_pci_init);
EXPORT_SYMBOL(udma_pci_irq_status);
EXPORT_SYMBOL(udma_pci_timeout);
EXPORT_SYMBOL(udma_pci_irq_lost);
diff -urN linux-2.5.19/drivers/ide/pdc202xx.c linux/drivers/ide/pdc202xx.c
--- linux-2.5.19/drivers/ide/pdc202xx.c 2002-06-01 23:17:28.000000000 +0200
+++ linux/drivers/ide/pdc202xx.c 2002-06-02 11:51:21.000000000 +0200
@@ -563,7 +563,7 @@
return !(hwif->speedproc(drive, mode));
}
-static int config_drive_xfer_rate(struct ata_device *drive)
+static int pdc202xx_udma_setup(struct ata_device *drive)
{
struct hd_driveid *id = drive->id;
struct ata_channel *hwif = drive->channel;
@@ -670,7 +670,7 @@
return (dma_stat & 4) == 4; /* return 1 if INTR asserted */
}
-static void pdc202xx_bug (struct ata_device *drive)
+static void pdc202xx_bug(struct ata_device *drive)
{
if (!drive->channel->resetproc)
return;
@@ -678,10 +678,6 @@
drive->channel->resetproc(drive);
}
-static int pdc202xx_dmaproc(struct ata_device *drive)
-{
- return config_drive_xfer_rate(drive);
-}
#endif
void pdc202xx_new_reset(struct ata_device *drive)
@@ -838,7 +834,7 @@
if (hwif->dma_base) {
hwif->udma_irq_lost = pdc202xx_bug;
hwif->udma_timeout = pdc202xx_bug;
- hwif->XXX_udma = pdc202xx_dmaproc;
+ hwif->udma_setup = pdc202xx_udma_setup;
hwif->highmem = 1;
if (!noautodma)
hwif->autodma = 1;
diff -urN linux-2.5.19/drivers/ide/pdc4030.c linux/drivers/ide/pdc4030.c
--- linux-2.5.19/drivers/ide/pdc4030.c 2002-06-02 09:41:16.000000000 +0200
+++ linux/drivers/ide/pdc4030.c 2002-06-02 10:21:42.000000000 +0200
@@ -619,16 +619,11 @@
return ide_stopped;
}
- ata_irq_enable(drive, 1); /* clear nIEN */
+ ata_irq_enable(drive, 1);
ata_mask(drive);
- outb(taskfile->feature, IDE_FEATURE_REG);
- outb(taskfile->sector_count, IDE_NSECTOR_REG);
- /* refers to number of sectors to transfer */
- outb(taskfile->sector_number, IDE_SECTOR_REG);
- /* refers to sector offset or start sector */
- outb(taskfile->low_cylinder, IDE_LCYL_REG);
- outb(taskfile->high_cylinder, IDE_HCYL_REG);
+ ata_out_regfile(drive, taskfile);
+
outb(taskfile->device_head, IDE_SELECT_REG);
outb(args->cmd, IDE_COMMAND_REG);
@@ -708,14 +703,9 @@
args.taskfile.low_cylinder = (block>>=8);
args.taskfile.high_cylinder = (block>>=8);
args.taskfile.device_head = ((block>>8)&0x0f)|drive->select.all;
- args.cmd = (rq_data_dir(rq)==READ)?PROMISE_READ:PROMISE_WRITE;
-
- /* We can't call ide_cmd_type_parser here, since it won't understand
- our command, but that doesn't matter, since we don't use the
- generic interrupt handlers either. Setup the bits of args that we
- will need. */
- args.handler = NULL;
- rq->special = &args;
+ args.cmd = (rq_data_dir(rq) == READ) ? PROMISE_READ : PROMISE_WRITE;
+ args.handler = NULL;
+ rq->special = &args;
return do_pdc4030_io(drive, &args, rq);
}
diff -urN linux-2.5.19/drivers/ide/piix.c linux/drivers/ide/piix.c
--- linux-2.5.19/drivers/ide/piix.c 2002-06-01 18:53:02.000000000 +0200
+++ linux/drivers/ide/piix.c 2002-06-02 11:46:11.000000000 +0200
@@ -253,7 +253,7 @@
#ifdef CONFIG_BLK_DEV_IDEDMA
-int piix_dmaproc(struct ata_device *drive)
+static int piix_udma_setup(struct ata_device *drive)
{
short w80 = drive->channel->udma_four;
@@ -399,7 +399,7 @@
#ifdef CONFIG_BLK_DEV_IDEDMA
if (hwif->dma_base) {
hwif->highmem = 1;
- hwif->XXX_udma = piix_dmaproc;
+ hwif->udma_setup = piix_udma_setup;
# ifdef CONFIG_IDEDMA_AUTO
if (!noautodma)
hwif->autodma = 1;
diff -urN linux-2.5.19/drivers/ide/serverworks.c linux/drivers/ide/serverworks.c
--- linux-2.5.19/drivers/ide/serverworks.c 2002-06-01 18:53:02.000000000 +0200
+++ linux/drivers/ide/serverworks.c 2002-06-02 12:14:42.000000000 +0200
@@ -290,7 +290,7 @@
return !svwks_tune_chipset(drive, mode);
}
-static int config_drive_xfer_rate(struct ata_device *drive)
+static int svwks_udma_setup(struct ata_device *drive)
{
struct hd_driveid *id = drive->id;
int on = 1;
@@ -387,11 +387,6 @@
return (dma_stat & 7) != 4 ? (0x10 | dma_stat) : 0; /* verify good DMA status */
}
-
-static int svwks_dmaproc(struct ata_device *drive)
-{
- return config_drive_xfer_rate(drive);
-}
#endif
static unsigned int __init svwks_init_chipset(struct pci_dev *dev)
@@ -506,7 +501,7 @@
hwif->autodma = 1;
#endif
hwif->udma_stop = svwks_udma_stop;
- hwif->XXX_udma = svwks_dmaproc;
+ hwif->udma_setup = svwks_udma_setup;
hwif->highmem = 1;
} else {
hwif->autodma = 0;
diff -urN linux-2.5.19/drivers/ide/sis5513.c linux/drivers/ide/sis5513.c
--- linux-2.5.19/drivers/ide/sis5513.c 2002-06-01 18:53:02.000000000 +0200
+++ linux/drivers/ide/sis5513.c 2002-06-02 12:23:59.000000000 +0200
@@ -466,12 +466,14 @@
return !sis5513_tune_chipset(drive, mode);
}
-static int config_drive_xfer_rate(struct ata_device *drive)
+static int sis5513_udma_setup(struct ata_device *drive)
{
struct hd_driveid *id = drive->id;
int on = 0;
int verbose = 1;
+ config_drive_art_rwp(drive);
+ config_art_rwp_pio(drive, 5);
config_chipset_for_pio(drive, 5);
if (id && (id->capability & 1) && drive->channel->autodma) {
@@ -520,14 +522,6 @@
return 0;
}
-
-static int sis5513_dmaproc(struct ata_device *drive)
-{
- config_drive_art_rwp(drive);
- config_art_rwp_pio(drive, 5);
-
- return config_drive_xfer_rate(drive);
-}
#endif
/* Chip detection and general config */
@@ -633,7 +627,7 @@
if (chipset_family > ATA_16) {
hwif->autodma = noautodma ? 0 : 1;
hwif->highmem = 1;
- hwif->XXX_udma = sis5513_dmaproc;
+ hwif->udma_setup = sis5513_udma_setup;
} else {
#endif
hwif->autodma = 0;
diff -urN linux-2.5.19/drivers/ide/sl82c105.c linux/drivers/ide/sl82c105.c
--- linux-2.5.19/drivers/ide/sl82c105.c 2002-05-29 20:42:50.000000000 +0200
+++ linux/drivers/ide/sl82c105.c 2002-06-02 12:04:05.000000000 +0200
@@ -130,7 +130,7 @@
* Check to see if the drive and
* chipset is capable of DMA mode
*/
-static int sl82c105_check_drive(struct ata_device *drive)
+static int sl82c105_dma_setup(struct ata_device *drive)
{
int on = 0;
@@ -173,15 +173,6 @@
}
/*
- * Our very own dmaproc. We need to intercept various calls
- * to fix up the SL82C105 specific behaviour.
- */
-static int sl82c105_dmaproc(struct ata_device *drive)
-{
- return sl82c105_check_drive(drive);
-}
-
-/*
* The SL82C105 holds off all IDE interrupts while in DMA mode until
* all DMA activity is completed. Sometimes this causes problems (eg,
* when the drive wants to report an error condition).
@@ -215,16 +206,10 @@
* The generic IDE core will have disabled the BMEN bit before this
* function is called.
*/
-static int sl82c105_dma_read(struct ata_device *drive, struct request *rq)
-{
- sl82c105_reset_host(drive->channel->pci_dev);
- return udma_pci_read(drive, rq);
-}
-
-static int sl82c105_dma_write(struct ata_device *drive, struct request *rq)
+static int sl82c105_dma_init(struct ata_device *drive, struct request *rq)
{
sl82c105_reset_host(drive->channel->pci_dev);
- return udma_pci_write(drive, rq);
+ return udma_pci_init(drive, rq);
}
static void sl82c105_timeout(struct ata_device *drive)
@@ -354,12 +339,11 @@
ata_init_dma(ch, dma_base);
if (bridge_rev <= 5)
- ch->XXX_udma = NULL;
+ ch->udma_setup = NULL;
else {
- ch->XXX_udma = sl82c105_dmaproc;
+ ch->udma_setup = sl82c105_dma_setup;
ch->udma_enable = sl82c105_dma_enable;
- ch->udma_read = sl82c105_dma_read;
- ch->udma_write = sl82c105_dma_write;
+ ch->udma_init = sl82c105_dma_init;
ch->udma_timeout = sl82c105_timeout;
ch->udma_irq_lost = sl82c105_lostirq;
}
diff -urN linux-2.5.19/drivers/ide/trm290.c linux/drivers/ide/trm290.c
--- linux-2.5.19/drivers/ide/trm290.c 2002-06-01 23:17:28.000000000 +0200
+++ linux/drivers/ide/trm290.c 2002-06-02 12:08:38.000000000 +0200
@@ -191,10 +191,18 @@
return (inw(ch->dma_base + 2) != 0x00ff);
}
-static int do_udma(unsigned int reading, struct ata_device *drive, struct request *rq)
+static int trm290_udma_init(struct ata_device *drive, struct request *rq)
{
struct ata_channel *ch = drive->channel;
- unsigned int count, writing;
+ unsigned int count;
+ int writing;
+ int reading;
+
+
+ if (rq_data_dir(rq) == READ)
+ reading = 1;
+ else
+ reading = 0;
if (!reading) {
reading = 0;
@@ -228,24 +236,14 @@
return 0;
}
-static int trm290_udma_read(struct ata_device *drive, struct request *rq)
-{
- return do_udma(1, drive, rq);
-}
-
-static int trm290_udma_write(struct ata_device *drive, struct request *rq)
-{
- return do_udma(0, drive, rq);
-}
-
static int trm290_udma_irq_status(struct ata_device *drive)
{
return (inw(drive->channel->dma_base + 2) == 0x00ff);
}
-static int trm290_dmaproc(struct ata_device *drive)
+static int trm290_udma_setup(struct ata_device *drive)
{
- return XXX_ide_dmaproc(drive);
+ return udma_pci_setup(drive);
}
#endif
@@ -301,10 +299,9 @@
#ifdef CONFIG_BLK_DEV_IDEDMA
hwif->udma_start = trm290_udma_start;
hwif->udma_stop = trm290_udma_stop;
- hwif->udma_read = trm290_udma_read;
- hwif->udma_write = trm290_udma_write;
+ hwif->udma_init = trm290_udma_init;
hwif->udma_irq_status = trm290_udma_irq_status;
- hwif->XXX_udma = trm290_dmaproc;
+ hwif->udma_setup = trm290_udma_setup;
#endif
hwif->selectproc = &trm290_selectproc;
diff -urN linux-2.5.19/drivers/ide/via82cxxx.c linux/drivers/ide/via82cxxx.c
--- linux-2.5.19/drivers/ide/via82cxxx.c 2002-06-01 18:53:02.000000000 +0200
+++ linux/drivers/ide/via82cxxx.c 2002-06-02 11:42:53.000000000 +0200
@@ -223,7 +223,7 @@
}
#ifdef CONFIG_BLK_DEV_IDEDMA
-static int via82cxxx_dmaproc(struct ata_device *drive)
+static int via82cxxx_udma_setup(struct ata_device *drive)
{
short w80 = drive->channel->udma_four;
@@ -368,7 +368,7 @@
#ifdef CONFIG_BLK_DEV_IDEDMA
if (hwif->dma_base) {
hwif->highmem = 1;
- hwif->XXX_udma = &via82cxxx_dmaproc;
+ hwif->udma_setup = via82cxxx_udma_setup;
# ifdef CONFIG_IDEDMA_AUTO
if (!noautodma)
hwif->autodma = 1;
diff -urN linux-2.5.19/drivers/scsi/ide-scsi.c linux/drivers/scsi/ide-scsi.c
--- linux-2.5.19/drivers/scsi/ide-scsi.c 2002-06-02 09:41:16.000000000 +0200
+++ linux/drivers/scsi/ide-scsi.c 2002-06-02 11:53:22.000000000 +0200
@@ -407,12 +407,8 @@
pc->current_position=pc->buffer;
bcount = min(pc->request_transfer, 63 * 1024); /* Request to transfer the entire buffer at once */
- if (drive->using_dma && rq->bio) {
- if (test_bit (PC_WRITING, &pc->flags))
- dma_ok = !udma_write(drive, rq);
- else
- dma_ok = !udma_read(drive, rq);
- }
+ if (drive->using_dma && rq->bio)
+ dma_ok = !udma_init(drive, rq);
ata_select(drive, 10);
ata_irq_enable(drive, 1);
diff -urN linux-2.5.19/include/linux/ide.h linux/include/linux/ide.h
--- linux-2.5.19/include/linux/ide.h 2002-06-02 09:41:16.000000000 +0200
+++ linux/include/linux/ide.h 2002-06-02 12:33:06.000000000 +0200
@@ -425,7 +425,7 @@
* mode itself.
*/
- /* setup disk on a channel for a particular transfer mode */
+ /* setup disk on a channel for a particular PIO transfer mode */
void (*tuneproc) (struct ata_device *, byte pio);
/* setup the chipset timing for a particular transfer mode */
@@ -455,18 +455,13 @@
void (*atapi_read)(struct ata_device *, void *, unsigned int);
void (*atapi_write)(struct ata_device *, void *, unsigned int);
- int (*XXX_udma)(struct ata_device *);
+ int (*udma_setup)(struct ata_device *);
void (*udma_enable)(struct ata_device *, int, int);
-
int (*udma_start) (struct ata_device *, struct request *rq);
int (*udma_stop) (struct ata_device *);
-
- int (*udma_read) (struct ata_device *, struct request *rq);
- int (*udma_write) (struct ata_device *, struct request *rq);
-
+ int (*udma_init) (struct ata_device *, struct request *rq);
int (*udma_irq_status) (struct ata_device *);
-
void (*udma_timeout) (struct ata_device *);
void (*udma_irq_lost) (struct ata_device *);
@@ -770,14 +765,12 @@
return drive->channel->udma_stop(drive);
}
-static inline int udma_read(struct ata_device *drive, struct request *rq)
-{
- return drive->channel->udma_read(drive, rq);
-}
-
-static inline int udma_write(struct ata_device *drive, struct request *rq)
+/*
+ * Initiate actual DMA data transfer. The direction is encoded in the request.
+ */
+static inline int udma_init(struct ata_device *drive, struct request *rq)
{
- return drive->channel->udma_write(drive, rq);
+ return drive->channel->udma_init(drive, rq);
}
static inline int udma_irq_status(struct ata_device *drive)
@@ -797,14 +790,14 @@
#ifdef CONFIG_BLK_DEV_IDEDMA
-void udma_pci_enable(struct ata_device *drive, int on, int verbose);
-int udma_pci_start(struct ata_device *drive, struct request *rq);
-int udma_pci_stop(struct ata_device *drive);
-int udma_pci_read(struct ata_device *drive, struct request *rq);
-int udma_pci_write(struct ata_device *drive, struct request *rq);
-int udma_pci_irq_status(struct ata_device *drive);
-void udma_pci_timeout(struct ata_device *drive);
-void udma_pci_irq_lost(struct ata_device *);
+extern void udma_pci_enable(struct ata_device *drive, int on, int verbose);
+extern int udma_pci_start(struct ata_device *drive, struct request *rq);
+extern int udma_pci_stop(struct ata_device *drive);
+extern int udma_pci_init(struct ata_device *drive, struct request *rq);
+extern int udma_pci_irq_status(struct ata_device *drive);
+extern void udma_pci_timeout(struct ata_device *drive);
+extern void udma_pci_irq_lost(struct ata_device *);
+extern int udma_pci_setup(struct ata_device *);
extern int udma_new_table(struct ata_channel *, struct request *);
extern void udma_destroy_table(struct ata_channel *);
@@ -813,14 +806,11 @@
extern int udma_black_list(struct ata_device *);
extern int udma_white_list(struct ata_device *);
-extern int ata_do_udma(unsigned int reading, struct ata_device *drive, struct request *rq);
-
extern ide_startstop_t udma_tcq_taskfile(struct ata_device *, struct request *);
extern int udma_tcq_enable(struct ata_device *, int);
extern ide_startstop_t ide_dma_intr(struct ata_device *, struct request *);
extern int check_drive_lists(struct ata_device *, int good_bad);
-extern int XXX_ide_dmaproc(struct ata_device *);
extern void ide_release_dma(struct ata_channel *);
extern int ata_start_dma(struct ata_device *, struct request *rq);
^ permalink raw reply [flat|nested] 35+ messages in thread* [PATCH] 2.5.19 IDE 82
2002-05-29 18:50 Linux 2.5.19 Linus Torvalds
` (12 preceding siblings ...)
2002-06-02 19:45 ` [PATCH] 2.5.19 IDE 81 Martin Dalecki
@ 2002-06-02 20:13 ` Martin Dalecki
13 siblings, 0 replies; 35+ messages in thread
From: Martin Dalecki @ 2002-06-02 20:13 UTC (permalink / raw)
To: Linus Torvalds; +Cc: Kernel Mailing List
[-- Attachment #1: Type: text/plain, Size: 291 bytes --]
Sun Jun 2 22:41:45 CEST 2002 ide-clean-82
- PPC compilation fix by Paul Mackerras.
- Various fixes by Bartek:
fix ata_irq_enable() and ata_reset() for legacy ATA-1 devices
in start_request() for REQ_DRIVE_ACB
a) don't run ->prehandler() twice
b) return ata_taskfile() value
[-- Attachment #2: ide-clean-82.diff --]
[-- Type: text/plain, Size: 3143 bytes --]
diff -urN linux-2.5.19/drivers/ide/device.c linux/drivers/ide/device.c
--- linux-2.5.19/drivers/ide/device.c 2002-06-02 23:03:00.000000000 +0200
+++ linux/drivers/ide/device.c 2002-06-02 22:48:12.000000000 +0200
@@ -105,11 +105,12 @@
if (!ch->io_ports[IDE_CONTROL_OFFSET])
return 0;
+ /* 0x08 is for legacy ATA-1 devices */
if (on)
- OUT_BYTE(0x00, ch->io_ports[IDE_CONTROL_OFFSET]);
+ OUT_BYTE(0x08 | 0x00, ch->io_ports[IDE_CONTROL_OFFSET]);
else {
if (!ch->intrproc)
- OUT_BYTE(0x02, ch->io_ports[IDE_CONTROL_OFFSET]);
+ OUT_BYTE(0x08 | 0x02, ch->io_ports[IDE_CONTROL_OFFSET]);
else
ch->intrproc(drive);
}
@@ -131,9 +132,11 @@
return;
printk("%s: reset\n", ch->name);
- OUT_BYTE(0x04, ch->io_ports[IDE_CONTROL_OFFSET]);
+ /* 0x08 is for legacy ATA-1 devices */
+ OUT_BYTE(0x08 | 0x04, ch->io_ports[IDE_CONTROL_OFFSET]);
udelay(10);
- OUT_BYTE(0x00, ch->io_ports[IDE_CONTROL_OFFSET]);
+ /* 0x08 is for legacy ATA-1 devices */
+ OUT_BYTE(0x08 | 0x00, ch->io_ports[IDE_CONTROL_OFFSET]);
do {
mdelay(50);
stat = IN_BYTE(ch->io_ports[IDE_STATUS_OFFSET]);
diff -urN linux-2.5.19/drivers/ide/ide.c linux/drivers/ide/ide.c
--- linux-2.5.19/drivers/ide/ide.c 2002-06-02 23:03:06.000000000 +0200
+++ linux/drivers/ide/ide.c 2002-06-02 22:48:20.000000000 +0200
@@ -754,14 +754,7 @@
if (!(ar))
goto args_error;
- ata_taskfile(drive, ar, NULL);
-
- if (((ar->command_type == IDE_DRIVE_TASK_RAW_WRITE) ||
- (ar->command_type == IDE_DRIVE_TASK_OUT)) &&
- ar->prehandler && ar->handler)
- return ar->prehandler(drive, rq);
-
- return ide_started;
+ return ata_taskfile(drive, ar, NULL);
}
/* The normal way of execution is to pass and execute the request
diff -urN linux-2.5.19/drivers/ide/ide-pmac.c linux/drivers/ide/ide-pmac.c
--- linux-2.5.19/drivers/ide/ide-pmac.c 2002-06-02 23:03:06.000000000 +0200
+++ linux/drivers/ide/ide-pmac.c 2002-06-02 22:57:41.000000000 +0200
@@ -431,7 +431,7 @@
goto out;
}
udelay(10);
- ata_irq_enale(drive, 0);
+ ata_irq_enable(drive, 0);
OUT_BYTE(command, IDE_NSECTOR_REG);
OUT_BYTE(SETFEATURES_XFER, IDE_FEATURE_REG);
OUT_BYTE(WIN_SETFEATURES, IDE_COMMAND_REG);
@@ -1577,9 +1577,9 @@
*/
if (used_dma && !ide_spin_wait_hwgroup(drive)) {
/* Lock HW group */
- set_bit(IDE_BUSY, &drive->channel->active);
+ set_bit(IDE_BUSY, drive->channel->active);
pmac_ide_check_dma(drive);
- clear_bit(IDE_BUSY, &drive->channel->active);
+ clear_bit(IDE_BUSY, drive->channel->active);
spin_unlock_irq(drive->channel->lock);
}
#endif
@@ -1626,7 +1626,7 @@
return;
else {
/* Lock HW group */
- set_bit(IDE_BUSY, &drive->channel->active);
+ set_bit(IDE_BUSY, drive->channel->active);
/* Stop the device */
idepmac_sleep_device(drive, idx, base);
spin_unlock_irq(drive->channel->lock);
@@ -1656,7 +1656,7 @@
/* We resume processing on the lock group */
spin_lock_irq(drive->channel->lock);
- clear_bit(IDE_BUSY, &drive->channel->active);
+ clear_bit(IDE_BUSY, drive->channel->active);
if (!list_empty(&drive->queue.queue_head))
do_ide_request(&drive->queue);
spin_unlock_irq(drive->channel->lock);
^ permalink raw reply [flat|nested] 35+ messages in thread