linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 2/4] libata-core.c: add another IRQ calls
@ 2007-01-16 10:46 Akira Iguchi
  0 siblings, 0 replies; 11+ messages in thread
From: Akira Iguchi @ 2007-01-16 10:46 UTC (permalink / raw)
  To: linux-ide; +Cc: jeff, arnd, linuxppc-dev, paulus, alan

When enabling IRQ, ap->ops->irq_on is checked.
Because most drivers can use ata_irq_on() as is, this
patch allows ap->ops->irq_on to be NULL.
If it is NULL, ata_irq_on() are used.

Similarly, ap->ops->irq_ack is checked when acknowledging a IRQ.
If it is NULL, ata_irq_ack() are used.

And this patch exports ata_dev_try_classify(). It is used in
pata_scc.c to reduce the code duplication.
This driver has the copy of ata_std_softreset(), which has
low-level accessors and cannot be used as is.

Signed-off-by: Kou Ishizaki <kou.ishizaki@toshiba.co.jp>
Signed-off-by: Akira Iguchi <akira2.iguchi@toshiba.co.jp>
---

--- linux-2.6.20-rc4/drivers/ata/libata-core.c.orig	2007-01-17 01:45:44.000000000 +0900
+++ linux-2.6.20-rc4/drivers/ata/libata-core.c	2007-01-17 02:16:48.000000000 +0900
@@ -767,7 +767,7 @@ unsigned int ata_dev_classify(const stru
  *	Device type - %ATA_DEV_ATA, %ATA_DEV_ATAPI or %ATA_DEV_NONE.
  */
 
-static unsigned int
+unsigned int
 ata_dev_try_classify(struct ata_port *ap, unsigned int device, u8 *r_err)
 {
 	struct ata_taskfile tf;
@@ -2754,8 +2754,12 @@ void ata_bus_reset(struct ata_port *ap)
 		ap->device[1].class = ata_dev_try_classify(ap, 1, &err);
 
 	/* re-enable interrupts */
-	if (ap->ioaddr.ctl_addr)	/* FIXME: hack. create a hook instead */
-		ata_irq_on(ap);
+	if (ap->ioaddr.ctl_addr) {	/* FIXME: hack. create a hook instead */
+		if (ap->ops->irq_on)
+			ap->ops->irq_on(ap);
+		else
+			ata_irq_on(ap);
+	}
 
 	/* is double-select really necessary? */
 	if (ap->device[1].class != ATA_DEV_NONE)
@@ -3149,8 +3153,12 @@ void ata_std_postreset(struct ata_port *
 	/* re-enable interrupts */
 	if (!ap->ops->error_handler) {
 		/* FIXME: hack. create a hook instead */
-		if (ap->ioaddr.ctl_addr)
-			ata_irq_on(ap);
+		if (ap->ioaddr.ctl_addr) {
+			if (ap->ops->irq_on)
+				ap->ops->irq_on(ap);
+			else
+				ata_irq_on(ap);
+		}
 	}
 
 	/* is double-select really necessary? */
@@ -4329,7 +4337,10 @@ static void ata_hsm_qc_complete(struct a
 			qc = ata_qc_from_tag(ap, qc->tag);
 			if (qc) {
 				if (likely(!(qc->err_mask & AC_ERR_HSM))) {
-					ata_irq_on(ap);
+					if (ap->ops->irq_on)
+						ap->ops->irq_on(ap);
+					else
+						ata_irq_on(ap);
 					ata_qc_complete(qc);
 				} else
 					ata_port_freeze(ap);
@@ -4345,7 +4356,10 @@ static void ata_hsm_qc_complete(struct a
 	} else {
 		if (in_wq) {
 			spin_lock_irqsave(ap->lock, flags);
-			ata_irq_on(ap);
+			if (ap->ops->irq_on)
+				ap->ops->irq_on(ap);
+			else
+				ata_irq_on(ap);
 			ata_qc_complete(qc);
 			spin_unlock_irqrestore(ap->lock, flags);
 		} else
@@ -5170,7 +5184,10 @@ idle_irq:
 
 #ifdef ATA_IRQ_TRAP
 	if ((ap->stats.idle_irq % 1000) == 0) {
-		ata_irq_ack(ap, 0); /* debug trap */
+		if (ap->ops->irq_ack)
+			ap->ops->irq_ack(ap, 0);
+		else
+			ata_irq_ack(ap, 0); /* debug trap */
 		ata_port_printk(ap, KERN_WARNING, "irq trap\n");
 		return 1;
 	}
@@ -6500,3 +6517,5 @@ EXPORT_SYMBOL_GPL(ata_eh_thaw_port);
 EXPORT_SYMBOL_GPL(ata_eh_qc_complete);
 EXPORT_SYMBOL_GPL(ata_eh_qc_retry);
 EXPORT_SYMBOL_GPL(ata_do_eh);
+EXPORT_SYMBOL_GPL(ata_dev_try_classify);
+EXPORT_SYMBOL_GPL(ata_probe_ent_alloc);

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

* Re: [PATCH 2/4] libata-core.c: add another IRQ calls
       [not found] <200701161046.l0GAk5Go019691@toshiba.co.jp>
@ 2007-01-16 12:03 ` Alan
  2007-01-16 22:04   ` Jeff Garzik
  0 siblings, 1 reply; 11+ messages in thread
From: Alan @ 2007-01-16 12:03 UTC (permalink / raw)
  To: Akira Iguchi; +Cc: jeff, arnd, linuxppc-dev, linux-ide, paulus

On Tue, 16 Jan 2007 19:46:14 +0900
Akira Iguchi <akira2.iguchi@toshiba.co.jp> wrote:

> When enabling IRQ, ap->ops->irq_on is checked.
> Because most drivers can use ata_irq_on() as is, this
> patch allows ap->ops->irq_on to be NULL.
> If it is NULL, ata_irq_on() are used.


Acked-by: Alan Cox <alan@redhat.com>


Jeff - at some point we could eliminate a lot of the NULL checks like
these by having the registration code fill in the defaults where
appropriate ?

Alan

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

* Re: [PATCH 2/4] libata-core.c: add another IRQ calls
  2007-01-16 12:03 ` [PATCH 2/4] libata-core.c: add another IRQ calls Alan
@ 2007-01-16 22:04   ` Jeff Garzik
  0 siblings, 0 replies; 11+ messages in thread
From: Jeff Garzik @ 2007-01-16 22:04 UTC (permalink / raw)
  To: Alan, benh; +Cc: arnd, linuxppc-dev, linux-ide, paulus

Alan wrote:
> Jeff - at some point we could eliminate a lot of the NULL checks like
> these by having the registration code fill in the defaults where
> appropriate ?

libata policy up until this point has been to require all drivers fill 
in the hook, either with the commonly-used default, or with their own 
variant.  Thus, no NULL checks for required hooks, and you get an oops 
if you fail this requirement.  I like that better than defaults buried 
inside libata-core, where it is easier for programmers to forget them.

But actually, it's an open question for the compiler guys whether this 
case is preferred:

	if (ap->ops->hook)
		ap->ops->hook(foo, bar);
	else
		commonly_used_default(foo, bar);

or this:

	ap->ops->hook(foo, bar);

With advanced branch prediction in modern CPUs, ISTR the first case may 
be worth considering, even with the branch.

If the second case is preferred, then Akira should make a bombing run 
through each driver, applying the patch
+	.irq_on		= ata_irq_on

No NULL checks or registration code bother, in that case.

Comments welcome...

	Jeff

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

* Re: [PATCH 2/4] libata-core.c: add another IRQ calls
@ 2007-01-17  9:24 Mikael Pettersson
  2007-01-17 16:49 ` Jeff Garzik
  0 siblings, 1 reply; 11+ messages in thread
From: Mikael Pettersson @ 2007-01-17  9:24 UTC (permalink / raw)
  To: alan, benh, jeff; +Cc: arnd, linuxppc-dev, linux-ide, paulus

On Tue, 16 Jan 2007 17:04:27 -0500, Jeff Garzik wrote:
>Alan wrote:
>> Jeff - at some point we could eliminate a lot of the NULL checks like
>> these by having the registration code fill in the defaults where
>> appropriate ?
>
>libata policy up until this point has been to require all drivers fill 
>in the hook, either with the commonly-used default, or with their own 
>variant.  Thus, no NULL checks for required hooks, and you get an oops 
>if you fail this requirement.  I like that better than defaults buried 
>inside libata-core, where it is easier for programmers to forget them.
>
>But actually, it's an open question for the compiler guys whether this 
>case is preferred:
>
>	if (ap->ops->hook)
>		ap->ops->hook(foo, bar);
>	else
>		commonly_used_default(foo, bar);
>
>or this:
>
>	ap->ops->hook(foo, bar);
>
>With advanced branch prediction in modern CPUs, ISTR the first case may 
>be worth considering, even with the branch.

Indirect function calls incur at least two main costs:
- the 'call *' instruction itself suffers from poor branch
  prediction unless the HW is clever and the call patterns
  are highly biased -- most machines have worse branch
  predictors for indirect jumps than for direct jumps
- the compiler must generate code for setting up parameters
  and spilling the caller's registers, and for reloading the
  caller's registers after the call

If there is a highly common case, the code for that case
is available, and the code is cheap to execute (doesn't
require too many additional variables), then having an
explicit test + inline code is preferred. If any of these
conditions isn't met, then I wouldn't bother converting
the call to the if/inline/call combo.

There are compilers for OOP languages that routinely use
rewrites like the one above in order to optimise method calls.

/Mikael

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

* Re: [PATCH 2/4] libata-core.c: add another IRQ calls
  2007-01-17  9:24 [PATCH 2/4] libata-core.c: add another IRQ calls Mikael Pettersson
@ 2007-01-17 16:49 ` Jeff Garzik
  2007-01-17 20:31   ` Mikael Pettersson
  0 siblings, 1 reply; 11+ messages in thread
From: Jeff Garzik @ 2007-01-17 16:49 UTC (permalink / raw)
  To: Mikael Pettersson; +Cc: arnd, linuxppc-dev, linux-ide, paulus, alan

Mikael Pettersson wrote:
> If there is a highly common case, the code for that case
> is available, and the code is cheap to execute (doesn't
> require too many additional variables), then having an
> explicit test + inline code is preferred. If any of these
> conditions isn't met, then I wouldn't bother converting
> the call to the if/inline/call combo.


To be a bit more specific, the branch being taken, or not, depends on 
the system setup.  For example, in sata_promise's case, with no other 
SATA controllers in use,

	if (ap->ops->irq_on)
		ap->ops->irq_on(ap);
	else
		ata_irq_on(ap);

the direct function call will ALWAYS be called.  But if you had a weird 
system with both Cell and Promise PDC203xx, then the branch is dependent 
on whether the activity comes from the Cell SATA or Promise SATA.

So it's highly predictable in a great many cases.

And it should be noted that it is a direct function call not inline, 
thus its if/indirect/direct not if/indirect/inline.

Does that change the answer at all?

	Jeff

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

* Re: [PATCH 2/4] libata-core.c: add another IRQ calls
  2007-01-17 16:49 ` Jeff Garzik
@ 2007-01-17 20:31   ` Mikael Pettersson
  2007-01-18  0:55     ` Akira Iguchi
       [not found]     ` <200701180055.l0I0tl6M021051@toshiba.co.jp>
  0 siblings, 2 replies; 11+ messages in thread
From: Mikael Pettersson @ 2007-01-17 20:31 UTC (permalink / raw)
  To: Jeff Garzik
  Cc: Mikael Pettersson, arnd, linuxppc-dev, linux-ide, paulus, alan

Jeff Garzik writes:
 > Mikael Pettersson wrote:
 > > If there is a highly common case, the code for that case
 > > is available, and the code is cheap to execute (doesn't
 > > require too many additional variables), then having an
 > > explicit test + inline code is preferred. If any of these
 > > conditions isn't met, then I wouldn't bother converting
 > > the call to the if/inline/call combo.
 > 
 > 
 > To be a bit more specific, the branch being taken, or not, depends on 
 > the system setup.  For example, in sata_promise's case, with no other 
 > SATA controllers in use,
 > 
 > 	if (ap->ops->irq_on)
 > 		ap->ops->irq_on(ap);
 > 	else
 > 		ata_irq_on(ap);
 > 
 > the direct function call will ALWAYS be called.  But if you had a weird 
 > system with both Cell and Promise PDC203xx, then the branch is dependent 
 > on whether the activity comes from the Cell SATA or Promise SATA.
 > 
 > So it's highly predictable in a great many cases.
 > 
 > And it should be noted that it is a direct function call not inline, 
 > thus its if/indirect/direct not if/indirect/inline.
 > 
 > Does that change the answer at all?

The real benefits from identifying a common case is to inline
the code for it. So the fact that the common case is still a
full-blown function call here and not inline code means that
there's much less benefit from rewriting an indirect call as
an if/indirect/direct sequence.

There is some branch prediction benefit from having
if/call-indirect/call-direct-to-common-case instead of a
single call-indirect, but only if the common case really is
much more common than other cases, or if the other cases
are limited to just one (so there's two common cases).

I wouldn't change a call-indirect to if/call-indirect/call-direct
unless it's on a very hot path with a known dominant common case.

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

* Re: [PATCH 2/4] libata-core.c: add another IRQ calls
  2007-01-17 20:31   ` Mikael Pettersson
@ 2007-01-18  0:55     ` Akira Iguchi
       [not found]     ` <200701180055.l0I0tl6M021051@toshiba.co.jp>
  1 sibling, 0 replies; 11+ messages in thread
From: Akira Iguchi @ 2007-01-18  0:55 UTC (permalink / raw)
  To: Mikael Pettersson
  Cc: Jeff Garzik, arnd, linuxppc-dev, linux-ide, paulus, alan


>The real benefits from identifying a common case is to inline
>the code for it. So the fact that the common case is still a
>full-blown function call here and not inline code means that
>there's much less benefit from rewriting an indirect call as
>an if/indirect/direct sequence.

According to your comment, this patch adds IRQ calls (irq_on, irq_ack)
to each driver and always uses these indirect calls.

For irq_on, most drivers use ata_irq_on(). Some drivers
(ahci.c, sata_sil24.c) use ata_dummy_irq_on() because they
don't have either explicit or implicit assignment (ex: ata_pci_init_one)
of ctl_addr.

For irq_ack, ata_irq_ack() is used.

Signed-off-by: Kou Ishizaki <kou.ishizaki@toshiba.co.jp>
Signed-off-by: Akira Iguchi <akira2.iguchi@toshiba.co.jp>
---

diff -uprN -X linux-2.6.20-rc4/Documentation/dontdiff linux-2.6.20-rc4/drivers/ata/ahci.c linux-2.6.20-rc4.mod/drivers/ata/ahci.c
--- linux-2.6.20-rc4/drivers/ata/ahci.c	2007-01-07 14:45:51.000000000 +0900
+++ linux-2.6.20-rc4.mod/drivers/ata/ahci.c	2007-01-17 23:07:11.000000000 +0900
@@ -261,6 +261,8 @@ static const struct ata_port_operations 
 
 	.irq_handler		= ahci_interrupt,
 	.irq_clear		= ahci_irq_clear,
+	.irq_on			= ata_dummy_irq_on,
+	.irq_ack		= ata_irq_ack,
 
 	.scr_read		= ahci_scr_read,
 	.scr_write		= ahci_scr_write,
@@ -292,6 +294,8 @@ static const struct ata_port_operations 
 
 	.irq_handler		= ahci_interrupt,
 	.irq_clear		= ahci_irq_clear,
+	.irq_on			= ata_dummy_irq_on,
+	.irq_ack		= ata_irq_ack,
 
 	.scr_read		= ahci_scr_read,
 	.scr_write		= ahci_scr_write,
diff -uprN -X linux-2.6.20-rc4/Documentation/dontdiff linux-2.6.20-rc4/drivers/ata/ata_generic.c linux-2.6.20-rc4.mod/drivers/ata/ata_generic.c
--- linux-2.6.20-rc4/drivers/ata/ata_generic.c	2007-01-07 14:45:51.000000000 +0900
+++ linux-2.6.20-rc4.mod/drivers/ata/ata_generic.c	2007-01-17 21:14:41.000000000 +0900
@@ -148,6 +148,8 @@ static struct ata_port_operations generi
 
 	.irq_handler	= ata_interrupt,
 	.irq_clear	= ata_bmdma_irq_clear,
+	.irq_on		= ata_irq_on,
+	.irq_ack	= ata_irq_ack,
 
 	.port_start	= ata_port_start,
 	.port_stop	= ata_port_stop,
diff -uprN -X linux-2.6.20-rc4/Documentation/dontdiff linux-2.6.20-rc4/drivers/ata/ata_piix.c linux-2.6.20-rc4.mod/drivers/ata/ata_piix.c
--- linux-2.6.20-rc4/drivers/ata/ata_piix.c	2007-01-07 14:45:51.000000000 +0900
+++ linux-2.6.20-rc4.mod/drivers/ata/ata_piix.c	2007-01-17 23:07:11.000000000 +0900
@@ -306,6 +306,8 @@ static const struct ata_port_operations 
 
 	.irq_handler		= ata_interrupt,
 	.irq_clear		= ata_bmdma_irq_clear,
+	.irq_on			= ata_irq_on,
+	.irq_ack		= ata_irq_ack,
 
 	.port_start		= ata_port_start,
 	.port_stop		= ata_port_stop,
@@ -339,6 +341,8 @@ static const struct ata_port_operations 
 
 	.irq_handler		= ata_interrupt,
 	.irq_clear		= ata_bmdma_irq_clear,
+	.irq_on			= ata_irq_on,
+	.irq_ack		= ata_irq_ack,
 
 	.port_start		= ata_port_start,
 	.port_stop		= ata_port_stop,
@@ -369,6 +373,8 @@ static const struct ata_port_operations 
 
 	.irq_handler		= ata_interrupt,
 	.irq_clear		= ata_bmdma_irq_clear,
+	.irq_on			= ata_irq_on,
+	.irq_ack		= ata_irq_ack,
 
 	.port_start		= ata_port_start,
 	.port_stop		= ata_port_stop,
diff -uprN -X linux-2.6.20-rc4/Documentation/dontdiff linux-2.6.20-rc4/drivers/ata/libata-core.c linux-2.6.20-rc4.mod/drivers/ata/libata-core.c
--- linux-2.6.20-rc4/drivers/ata/libata-core.c	2007-01-07 14:45:51.000000000 +0900
+++ linux-2.6.20-rc4.mod/drivers/ata/libata-core.c	2007-01-17 22:28:05.000000000 +0900
@@ -2754,8 +2754,7 @@ void ata_bus_reset(struct ata_port *ap)
 		ap->device[1].class = ata_dev_try_classify(ap, 1, &err);
 
 	/* re-enable interrupts */
-	if (ap->ioaddr.ctl_addr)	/* FIXME: hack. create a hook instead */
-		ata_irq_on(ap);
+	ap->ops->irq_on(ap);
 
 	/* is double-select really necessary? */
 	if (ap->device[1].class != ATA_DEV_NONE)
@@ -3147,11 +3146,8 @@ void ata_std_postreset(struct ata_port *
 		sata_scr_write(ap, SCR_ERROR, serror);
 
 	/* re-enable interrupts */
-	if (!ap->ops->error_handler) {
-		/* FIXME: hack. create a hook instead */
-		if (ap->ioaddr.ctl_addr)
-			ata_irq_on(ap);
-	}
+	if (!ap->ops->error_handler)
+		ap->ops->irq_on(ap);
 
 	/* is double-select really necessary? */
 	if (classes[0] != ATA_DEV_NONE)
@@ -4329,7 +4325,7 @@ static void ata_hsm_qc_complete(struct a
 			qc = ata_qc_from_tag(ap, qc->tag);
 			if (qc) {
 				if (likely(!(qc->err_mask & AC_ERR_HSM))) {
-					ata_irq_on(ap);
+					ap->ops->irq_on(ap);
 					ata_qc_complete(qc);
 				} else
 					ata_port_freeze(ap);
@@ -4345,7 +4341,7 @@ static void ata_hsm_qc_complete(struct a
 	} else {
 		if (in_wq) {
 			spin_lock_irqsave(ap->lock, flags);
-			ata_irq_on(ap);
+			ap->ops->irq_on(ap);
 			ata_qc_complete(qc);
 			spin_unlock_irqrestore(ap->lock, flags);
 		} else
@@ -5170,7 +5166,7 @@ idle_irq:
 
 #ifdef ATA_IRQ_TRAP
 	if ((ap->stats.idle_irq % 1000) == 0) {
-		ata_irq_ack(ap, 0); /* debug trap */
+		ap->ops->irq_ack(ap, 0); /* debug trap */
 		ata_port_printk(ap, KERN_WARNING, "irq trap\n");
 		return 1;
 	}
@@ -6500,3 +6496,4 @@ EXPORT_SYMBOL_GPL(ata_eh_thaw_port);
 EXPORT_SYMBOL_GPL(ata_eh_qc_complete);
 EXPORT_SYMBOL_GPL(ata_eh_qc_retry);
 EXPORT_SYMBOL_GPL(ata_do_eh);
+EXPORT_SYMBOL_GPL(ata_irq_on);
diff -uprN -X linux-2.6.20-rc4/Documentation/dontdiff linux-2.6.20-rc4/drivers/ata/libata-sff.c linux-2.6.20-rc4.mod/drivers/ata/libata-sff.c
--- linux-2.6.20-rc4/drivers/ata/libata-sff.c	2007-01-07 14:45:51.000000000 +0900
+++ linux-2.6.20-rc4.mod/drivers/ata/libata-sff.c	2007-01-17 21:14:41.000000000 +0900
@@ -724,8 +724,7 @@ void ata_bmdma_thaw(struct ata_port *ap)
 	/* clear & re-enable interrupts */
 	ata_chk_status(ap);
 	ap->ops->irq_clear(ap);
-	if (ap->ioaddr.ctl_addr)	/* FIXME: hack. create a hook instead */
-		ata_irq_on(ap);
+	ap->ops->irq_on(ap);
 }
 
 /**
diff -uprN -X linux-2.6.20-rc4/Documentation/dontdiff linux-2.6.20-rc4/drivers/ata/pata_ali.c linux-2.6.20-rc4.mod/drivers/ata/pata_ali.c
--- linux-2.6.20-rc4/drivers/ata/pata_ali.c	2007-01-07 14:45:51.000000000 +0900
+++ linux-2.6.20-rc4.mod/drivers/ata/pata_ali.c	2007-01-17 21:14:41.000000000 +0900
@@ -374,6 +374,8 @@ static struct ata_port_operations ali_ea
 
 	.irq_handler	= ata_interrupt,
 	.irq_clear	= ata_bmdma_irq_clear,
+	.irq_on		= ata_irq_on,
+	.irq_ack	= ata_irq_ack,
 
 	.port_start	= ata_port_start,
 	.port_stop	= ata_port_stop,
@@ -415,6 +417,8 @@ static struct ata_port_operations ali_20
 
 	.irq_handler	= ata_interrupt,
 	.irq_clear	= ata_bmdma_irq_clear,
+	.irq_on		= ata_irq_on,
+	.irq_ack	= ata_irq_ack,
 
 	.port_start	= ata_port_start,
 	.port_stop	= ata_port_stop,
@@ -453,6 +457,8 @@ static struct ata_port_operations ali_c2
 
 	.irq_handler	= ata_interrupt,
 	.irq_clear	= ata_bmdma_irq_clear,
+	.irq_on		= ata_irq_on,
+	.irq_ack	= ata_irq_ack,
 
 	.port_start	= ata_port_start,
 	.port_stop	= ata_port_stop,
@@ -490,6 +496,8 @@ static struct ata_port_operations ali_c5
 
 	.irq_handler	= ata_interrupt,
 	.irq_clear	= ata_bmdma_irq_clear,
+	.irq_on		= ata_irq_on,
+	.irq_ack	= ata_irq_ack,
 
 	.port_start	= ata_port_start,
 	.port_stop	= ata_port_stop,
diff -uprN -X linux-2.6.20-rc4/Documentation/dontdiff linux-2.6.20-rc4/drivers/ata/pata_amd.c linux-2.6.20-rc4.mod/drivers/ata/pata_amd.c
--- linux-2.6.20-rc4/drivers/ata/pata_amd.c	2007-01-07 14:45:51.000000000 +0900
+++ linux-2.6.20-rc4.mod/drivers/ata/pata_amd.c	2007-01-17 21:14:41.000000000 +0900
@@ -366,6 +366,8 @@ static struct ata_port_operations amd33_
 
 	.irq_handler	= ata_interrupt,
 	.irq_clear	= ata_bmdma_irq_clear,
+	.irq_on		= ata_irq_on,
+	.irq_ack	= ata_irq_ack,
 
 	.port_start	= ata_port_start,
 	.port_stop	= ata_port_stop,
@@ -400,6 +402,8 @@ static struct ata_port_operations amd66_
 
 	.irq_handler	= ata_interrupt,
 	.irq_clear	= ata_bmdma_irq_clear,
+	.irq_on		= ata_irq_on,
+	.irq_ack	= ata_irq_ack,
 
 	.port_start	= ata_port_start,
 	.port_stop	= ata_port_stop,
@@ -434,6 +438,8 @@ static struct ata_port_operations amd100
 
 	.irq_handler	= ata_interrupt,
 	.irq_clear	= ata_bmdma_irq_clear,
+	.irq_on		= ata_irq_on,
+	.irq_ack	= ata_irq_ack,
 
 	.port_start	= ata_port_start,
 	.port_stop	= ata_port_stop,
@@ -468,6 +474,8 @@ static struct ata_port_operations amd133
 
 	.irq_handler	= ata_interrupt,
 	.irq_clear	= ata_bmdma_irq_clear,
+	.irq_on		= ata_irq_on,
+	.irq_ack	= ata_irq_ack,
 
 	.port_start	= ata_port_start,
 	.port_stop	= ata_port_stop,
@@ -502,6 +510,8 @@ static struct ata_port_operations nv100_
 
 	.irq_handler	= ata_interrupt,
 	.irq_clear	= ata_bmdma_irq_clear,
+	.irq_on		= ata_irq_on,
+	.irq_ack	= ata_irq_ack,
 
 	.port_start	= ata_port_start,
 	.port_stop	= ata_port_stop,
@@ -536,6 +546,8 @@ static struct ata_port_operations nv133_
 
 	.irq_handler	= ata_interrupt,
 	.irq_clear	= ata_bmdma_irq_clear,
+	.irq_on		= ata_irq_on,
+	.irq_ack	= ata_irq_ack,
 
 	.port_start	= ata_port_start,
 	.port_stop	= ata_port_stop,
diff -uprN -X linux-2.6.20-rc4/Documentation/dontdiff linux-2.6.20-rc4/drivers/ata/pata_artop.c linux-2.6.20-rc4.mod/drivers/ata/pata_artop.c
--- linux-2.6.20-rc4/drivers/ata/pata_artop.c	2007-01-07 14:45:51.000000000 +0900
+++ linux-2.6.20-rc4.mod/drivers/ata/pata_artop.c	2007-01-17 21:14:41.000000000 +0900
@@ -345,6 +345,8 @@ static const struct ata_port_operations 
 
 	.irq_handler		= ata_interrupt,
 	.irq_clear		= ata_bmdma_irq_clear,
+	.irq_on			= ata_irq_on,
+	.irq_ack		= ata_irq_ack,
 
 	.port_start		= ata_port_start,
 	.port_stop		= ata_port_stop,
@@ -377,6 +379,8 @@ static const struct ata_port_operations 
 
 	.irq_handler		= ata_interrupt,
 	.irq_clear		= ata_bmdma_irq_clear,
+	.irq_on			= ata_irq_on,
+	.irq_ack		= ata_irq_ack,
 
 	.port_start		= ata_port_start,
 	.port_stop		= ata_port_stop,
diff -uprN -X linux-2.6.20-rc4/Documentation/dontdiff linux-2.6.20-rc4/drivers/ata/pata_atiixp.c linux-2.6.20-rc4.mod/drivers/ata/pata_atiixp.c
--- linux-2.6.20-rc4/drivers/ata/pata_atiixp.c	2007-01-07 14:45:51.000000000 +0900
+++ linux-2.6.20-rc4.mod/drivers/ata/pata_atiixp.c	2007-01-17 21:14:41.000000000 +0900
@@ -249,6 +249,8 @@ static struct ata_port_operations atiixp
 
 	.irq_handler	= ata_interrupt,
 	.irq_clear	= ata_bmdma_irq_clear,
+	.irq_on		= ata_irq_on,
+	.irq_ack	= ata_irq_ack,
 
 	.port_start	= ata_port_start,
 	.port_stop	= ata_port_stop,
diff -uprN -X linux-2.6.20-rc4/Documentation/dontdiff linux-2.6.20-rc4/drivers/ata/pata_cmd64x.c linux-2.6.20-rc4.mod/drivers/ata/pata_cmd64x.c
--- linux-2.6.20-rc4/drivers/ata/pata_cmd64x.c	2007-01-07 14:45:51.000000000 +0900
+++ linux-2.6.20-rc4.mod/drivers/ata/pata_cmd64x.c	2007-01-17 21:14:41.000000000 +0900
@@ -308,6 +308,8 @@ static struct ata_port_operations cmd64x
 
 	.irq_handler	= ata_interrupt,
 	.irq_clear	= ata_bmdma_irq_clear,
+	.irq_on		= ata_irq_on,
+	.irq_ack	= ata_irq_ack,
 
 	.port_start	= ata_port_start,
 	.port_stop	= ata_port_stop,
@@ -342,6 +344,8 @@ static struct ata_port_operations cmd646
 
 	.irq_handler	= ata_interrupt,
 	.irq_clear	= ata_bmdma_irq_clear,
+	.irq_on		= ata_irq_on,
+	.irq_ack	= ata_irq_ack,
 
 	.port_start	= ata_port_start,
 	.port_stop	= ata_port_stop,
@@ -376,6 +380,8 @@ static struct ata_port_operations cmd648
 
 	.irq_handler	= ata_interrupt,
 	.irq_clear	= ata_bmdma_irq_clear,
+	.irq_on		= ata_irq_on,
+	.irq_ack	= ata_irq_ack,
 
 	.port_start	= ata_port_start,
 	.port_stop	= ata_port_stop,
diff -uprN -X linux-2.6.20-rc4/Documentation/dontdiff linux-2.6.20-rc4/drivers/ata/pata_cs5520.c linux-2.6.20-rc4.mod/drivers/ata/pata_cs5520.c
--- linux-2.6.20-rc4/drivers/ata/pata_cs5520.c	2007-01-07 14:45:51.000000000 +0900
+++ linux-2.6.20-rc4.mod/drivers/ata/pata_cs5520.c	2007-01-17 21:14:41.000000000 +0900
@@ -197,6 +197,8 @@ static struct ata_port_operations cs5520
 
 	.irq_handler		= ata_interrupt,
 	.irq_clear		= ata_bmdma_irq_clear,
+	.irq_on			= ata_irq_on,
+	.irq_ack		= ata_irq_ack,
 
 	.port_start		= ata_port_start,
 	.port_stop		= ata_port_stop,
diff -uprN -X linux-2.6.20-rc4/Documentation/dontdiff linux-2.6.20-rc4/drivers/ata/pata_cs5530.c linux-2.6.20-rc4.mod/drivers/ata/pata_cs5530.c
--- linux-2.6.20-rc4/drivers/ata/pata_cs5530.c	2007-01-07 14:45:51.000000000 +0900
+++ linux-2.6.20-rc4.mod/drivers/ata/pata_cs5530.c	2007-01-17 21:14:41.000000000 +0900
@@ -214,6 +214,8 @@ static struct ata_port_operations cs5530
 
 	.irq_handler	= ata_interrupt,
 	.irq_clear	= ata_bmdma_irq_clear,
+	.irq_on		= ata_irq_on,
+	.irq_ack	= ata_irq_ack,
 
 	.port_start	= ata_port_start,
 	.port_stop	= ata_port_stop,
diff -uprN -X linux-2.6.20-rc4/Documentation/dontdiff linux-2.6.20-rc4/drivers/ata/pata_cs5535.c linux-2.6.20-rc4.mod/drivers/ata/pata_cs5535.c
--- linux-2.6.20-rc4/drivers/ata/pata_cs5535.c	2007-01-07 14:45:51.000000000 +0900
+++ linux-2.6.20-rc4.mod/drivers/ata/pata_cs5535.c	2007-01-17 21:14:41.000000000 +0900
@@ -218,6 +218,8 @@ static struct ata_port_operations cs5535
 
 	.irq_handler	= ata_interrupt,
 	.irq_clear	= ata_bmdma_irq_clear,
+	.irq_on		= ata_irq_on,
+	.irq_ack	= ata_irq_ack,
 
 	.port_start	= ata_port_start,
 	.port_stop	= ata_port_stop,
diff -uprN -X linux-2.6.20-rc4/Documentation/dontdiff linux-2.6.20-rc4/drivers/ata/pata_cypress.c linux-2.6.20-rc4.mod/drivers/ata/pata_cypress.c
--- linux-2.6.20-rc4/drivers/ata/pata_cypress.c	2007-01-07 14:45:51.000000000 +0900
+++ linux-2.6.20-rc4.mod/drivers/ata/pata_cypress.c	2007-01-17 21:14:41.000000000 +0900
@@ -169,6 +169,8 @@ static struct ata_port_operations cy82c6
 
 	.irq_handler	= ata_interrupt,
 	.irq_clear	= ata_bmdma_irq_clear,
+	.irq_on		= ata_irq_on,
+	.irq_ack	= ata_irq_ack,
 
 	.port_start	= ata_port_start,
 	.port_stop	= ata_port_stop,
diff -uprN -X linux-2.6.20-rc4/Documentation/dontdiff linux-2.6.20-rc4/drivers/ata/pata_efar.c linux-2.6.20-rc4.mod/drivers/ata/pata_efar.c
--- linux-2.6.20-rc4/drivers/ata/pata_efar.c	2007-01-07 14:45:51.000000000 +0900
+++ linux-2.6.20-rc4.mod/drivers/ata/pata_efar.c	2007-01-17 21:14:41.000000000 +0900
@@ -265,6 +265,8 @@ static const struct ata_port_operations 
 
 	.irq_handler		= ata_interrupt,
 	.irq_clear		= ata_bmdma_irq_clear,
+	.irq_on			= ata_irq_on,
+	.irq_ack		= ata_irq_ack,
 
 	.port_start		= ata_port_start,
 	.port_stop		= ata_port_stop,
diff -uprN -X linux-2.6.20-rc4/Documentation/dontdiff linux-2.6.20-rc4/drivers/ata/pata_hpt366.c linux-2.6.20-rc4.mod/drivers/ata/pata_hpt366.c
--- linux-2.6.20-rc4/drivers/ata/pata_hpt366.c	2007-01-07 14:45:51.000000000 +0900
+++ linux-2.6.20-rc4.mod/drivers/ata/pata_hpt366.c	2007-01-17 21:14:41.000000000 +0900
@@ -375,6 +375,8 @@ static struct ata_port_operations hpt366
 
 	.irq_handler	= ata_interrupt,
 	.irq_clear	= ata_bmdma_irq_clear,
+	.irq_on		= ata_irq_on,
+	.irq_ack	= ata_irq_ack,
 
 	.port_start	= ata_port_start,
 	.port_stop	= ata_port_stop,
diff -uprN -X linux-2.6.20-rc4/Documentation/dontdiff linux-2.6.20-rc4/drivers/ata/pata_hpt37x.c linux-2.6.20-rc4.mod/drivers/ata/pata_hpt37x.c
--- linux-2.6.20-rc4/drivers/ata/pata_hpt37x.c	2007-01-07 14:45:51.000000000 +0900
+++ linux-2.6.20-rc4.mod/drivers/ata/pata_hpt37x.c	2007-01-17 23:07:11.000000000 +0900
@@ -811,6 +811,8 @@ static struct ata_port_operations hpt370
 
 	.irq_handler	= ata_interrupt,
 	.irq_clear	= ata_bmdma_irq_clear,
+	.irq_on		= ata_irq_on,
+	.irq_ack	= ata_irq_ack,
 
 	.port_start	= ata_port_start,
 	.port_stop	= ata_port_stop,
@@ -850,6 +852,8 @@ static struct ata_port_operations hpt370
 
 	.irq_handler	= ata_interrupt,
 	.irq_clear	= ata_bmdma_irq_clear,
+	.irq_on		= ata_irq_on,
+	.irq_ack	= ata_irq_ack,
 
 	.port_start	= ata_port_start,
 	.port_stop	= ata_port_stop,
@@ -890,6 +894,8 @@ static struct ata_port_operations hpt372
 
 	.irq_handler	= ata_interrupt,
 	.irq_clear	= ata_bmdma_irq_clear,
+	.irq_on		= ata_irq_on,
+	.irq_ack	= ata_irq_ack,
 
 	.port_start	= ata_port_start,
 	.port_stop	= ata_port_stop,
@@ -930,6 +936,8 @@ static struct ata_port_operations hpt374
 
 	.irq_handler	= ata_interrupt,
 	.irq_clear	= ata_bmdma_irq_clear,
+	.irq_on		= ata_irq_on,
+	.irq_ack	= ata_irq_ack,
 
 	.port_start	= ata_port_start,
 	.port_stop	= ata_port_stop,
diff -uprN -X linux-2.6.20-rc4/Documentation/dontdiff linux-2.6.20-rc4/drivers/ata/pata_hpt3x2n.c linux-2.6.20-rc4.mod/drivers/ata/pata_hpt3x2n.c
--- linux-2.6.20-rc4/drivers/ata/pata_hpt3x2n.c	2007-01-07 14:45:51.000000000 +0900
+++ linux-2.6.20-rc4.mod/drivers/ata/pata_hpt3x2n.c	2007-01-17 21:14:41.000000000 +0900
@@ -377,6 +377,8 @@ static struct ata_port_operations hpt3x2
 
 	.irq_handler	= ata_interrupt,
 	.irq_clear	= ata_bmdma_irq_clear,
+	.irq_on		= ata_irq_on,
+	.irq_ack	= ata_irq_ack,
 
 	.port_start	= ata_port_start,
 	.port_stop	= ata_port_stop,
diff -uprN -X linux-2.6.20-rc4/Documentation/dontdiff linux-2.6.20-rc4/drivers/ata/pata_hpt3x3.c linux-2.6.20-rc4.mod/drivers/ata/pata_hpt3x3.c
--- linux-2.6.20-rc4/drivers/ata/pata_hpt3x3.c	2007-01-07 14:45:51.000000000 +0900
+++ linux-2.6.20-rc4.mod/drivers/ata/pata_hpt3x3.c	2007-01-17 21:14:41.000000000 +0900
@@ -152,6 +152,8 @@ static struct ata_port_operations hpt3x3
 
 	.irq_handler	= ata_interrupt,
 	.irq_clear	= ata_bmdma_irq_clear,
+	.irq_on		= ata_irq_on,
+	.irq_ack	= ata_irq_ack,
 
 	.port_start	= ata_port_start,
 	.port_stop	= ata_port_stop,
diff -uprN -X linux-2.6.20-rc4/Documentation/dontdiff linux-2.6.20-rc4/drivers/ata/pata_isapnp.c linux-2.6.20-rc4.mod/drivers/ata/pata_isapnp.c
--- linux-2.6.20-rc4/drivers/ata/pata_isapnp.c	2007-01-07 14:45:51.000000000 +0900
+++ linux-2.6.20-rc4.mod/drivers/ata/pata_isapnp.c	2007-01-17 21:14:41.000000000 +0900
@@ -57,6 +57,8 @@ static struct ata_port_operations isapnp
 
 	.irq_handler	= ata_interrupt,
 	.irq_clear	= ata_bmdma_irq_clear,
+	.irq_on		= ata_irq_on,
+	.irq_ack	= ata_irq_ack,
 
 	.port_start	= ata_port_start,
 	.port_stop	= ata_port_stop,
diff -uprN -X linux-2.6.20-rc4/Documentation/dontdiff linux-2.6.20-rc4/drivers/ata/pata_it821x.c linux-2.6.20-rc4.mod/drivers/ata/pata_it821x.c
--- linux-2.6.20-rc4/drivers/ata/pata_it821x.c	2007-01-07 14:45:51.000000000 +0900
+++ linux-2.6.20-rc4.mod/drivers/ata/pata_it821x.c	2007-01-17 21:14:41.000000000 +0900
@@ -708,6 +708,8 @@ static struct ata_port_operations it821x
 
 	.irq_handler	= ata_interrupt,
 	.irq_clear	= ata_bmdma_irq_clear,
+	.irq_on		= ata_irq_on,
+	.irq_ack	= ata_irq_ack,
 
 	.port_start	= it821x_port_start,
 	.port_stop	= it821x_port_stop,
@@ -744,6 +746,8 @@ static struct ata_port_operations it821x
 
 	.irq_clear	= ata_bmdma_irq_clear,
 	.irq_handler	= ata_interrupt,
+	.irq_on		= ata_irq_on,
+	.irq_ack	= ata_irq_ack,
 
 	.port_start	= it821x_port_start,
 	.port_stop	= it821x_port_stop,
diff -uprN -X linux-2.6.20-rc4/Documentation/dontdiff linux-2.6.20-rc4/drivers/ata/pata_ixp4xx_cf.c linux-2.6.20-rc4.mod/drivers/ata/pata_ixp4xx_cf.c
--- linux-2.6.20-rc4/drivers/ata/pata_ixp4xx_cf.c	2007-01-07 14:45:51.000000000 +0900
+++ linux-2.6.20-rc4.mod/drivers/ata/pata_ixp4xx_cf.c	2007-01-17 21:14:41.000000000 +0900
@@ -138,6 +138,8 @@ static struct ata_port_operations ixp4xx
 
 	.irq_handler	= ata_interrupt,
 	.irq_clear	= ixp4xx_irq_clear,
+	.irq_on		= ata_irq_on,
+	.irq_ack	= ata_irq_ack,
 
 	.port_start	= ata_port_start,
 	.port_stop	= ata_port_stop,
diff -uprN -X linux-2.6.20-rc4/Documentation/dontdiff linux-2.6.20-rc4/drivers/ata/pata_jmicron.c linux-2.6.20-rc4.mod/drivers/ata/pata_jmicron.c
--- linux-2.6.20-rc4/drivers/ata/pata_jmicron.c	2007-01-07 14:45:51.000000000 +0900
+++ linux-2.6.20-rc4.mod/drivers/ata/pata_jmicron.c	2007-01-17 21:14:41.000000000 +0900
@@ -166,6 +166,8 @@ static const struct ata_port_operations 
 	/* IRQ-related hooks */
 	.irq_handler		= ata_interrupt,
 	.irq_clear		= ata_bmdma_irq_clear,
+	.irq_on			= ata_irq_on,
+	.irq_ack		= ata_irq_ack,
 
 	/* Generic PATA PCI ATA helpers */
 	.port_start		= ata_port_start,
diff -uprN -X linux-2.6.20-rc4/Documentation/dontdiff linux-2.6.20-rc4/drivers/ata/pata_legacy.c linux-2.6.20-rc4.mod/drivers/ata/pata_legacy.c
--- linux-2.6.20-rc4/drivers/ata/pata_legacy.c	2007-01-07 14:45:51.000000000 +0900
+++ linux-2.6.20-rc4.mod/drivers/ata/pata_legacy.c	2007-01-17 21:14:41.000000000 +0900
@@ -166,6 +166,8 @@ static struct ata_port_operations simple
 
 	.irq_handler	= ata_interrupt,
 	.irq_clear	= ata_bmdma_irq_clear,
+	.irq_on		= ata_irq_on,
+	.irq_ack	= ata_irq_ack,
 
 	.port_start	= ata_port_start,
 	.port_stop	= ata_port_stop,
@@ -191,6 +193,8 @@ static struct ata_port_operations legacy
 
 	.irq_handler	= ata_interrupt,
 	.irq_clear	= ata_bmdma_irq_clear,
+	.irq_on		= ata_irq_on,
+	.irq_ack	= ata_irq_ack,
 
 	.port_start	= ata_port_start,
 	.port_stop	= ata_port_stop,
@@ -301,6 +305,8 @@ static struct ata_port_operations pdc202
 
 	.irq_handler	= ata_interrupt,
 	.irq_clear	= ata_bmdma_irq_clear,
+	.irq_on		= ata_irq_on,
+	.irq_ack	= ata_irq_ack,
 
 	.port_start	= ata_port_start,
 	.port_stop	= ata_port_stop,
@@ -353,6 +359,8 @@ static struct ata_port_operations ht6560
 
 	.irq_handler	= ata_interrupt,
 	.irq_clear	= ata_bmdma_irq_clear,
+	.irq_on		= ata_irq_on,
+	.irq_ack	= ata_irq_ack,
 
 	.port_start	= ata_port_start,
 	.port_stop	= ata_port_stop,
@@ -416,6 +424,8 @@ static struct ata_port_operations ht6560
 
 	.irq_handler	= ata_interrupt,
 	.irq_clear	= ata_bmdma_irq_clear,
+	.irq_on		= ata_irq_on,
+	.irq_ack	= ata_irq_ack,
 
 	.port_start	= ata_port_start,
 	.port_stop	= ata_port_stop,
@@ -534,6 +544,8 @@ static struct ata_port_operations opti82
 
 	.irq_handler	= ata_interrupt,
 	.irq_clear	= ata_bmdma_irq_clear,
+	.irq_on		= ata_irq_on,
+	.irq_ack	= ata_irq_ack,
 
 	.port_start	= ata_port_start,
 	.port_stop	= ata_port_stop,
@@ -664,6 +676,8 @@ static struct ata_port_operations opti82
 
 	.irq_handler	= ata_interrupt,
 	.irq_clear	= ata_bmdma_irq_clear,
+	.irq_on		= ata_irq_on,
+	.irq_ack	= ata_irq_ack,
 
 	.port_start	= ata_port_start,
 	.port_stop	= ata_port_stop,
diff -uprN -X linux-2.6.20-rc4/Documentation/dontdiff linux-2.6.20-rc4/drivers/ata/pata_marvell.c linux-2.6.20-rc4.mod/drivers/ata/pata_marvell.c
--- linux-2.6.20-rc4/drivers/ata/pata_marvell.c	2007-01-07 14:45:51.000000000 +0900
+++ linux-2.6.20-rc4.mod/drivers/ata/pata_marvell.c	2007-01-17 21:14:41.000000000 +0900
@@ -134,6 +134,8 @@ static const struct ata_port_operations 
 	/* Timeout handling */
 	.irq_handler		= ata_interrupt,
 	.irq_clear		= ata_bmdma_irq_clear,
+	.irq_on			= ata_irq_on,
+	.irq_ack		= ata_irq_ack,
 
 	/* Generic PATA PCI ATA helpers */
 	.port_start		= ata_port_start,
diff -uprN -X linux-2.6.20-rc4/Documentation/dontdiff linux-2.6.20-rc4/drivers/ata/pata_mpiix.c linux-2.6.20-rc4.mod/drivers/ata/pata_mpiix.c
--- linux-2.6.20-rc4/drivers/ata/pata_mpiix.c	2007-01-07 14:45:51.000000000 +0900
+++ linux-2.6.20-rc4.mod/drivers/ata/pata_mpiix.c	2007-01-17 21:14:41.000000000 +0900
@@ -192,6 +192,8 @@ static struct ata_port_operations mpiix_
 
 	.irq_handler	= ata_interrupt,
 	.irq_clear	= ata_bmdma_irq_clear,
+	.irq_on		= ata_irq_on,
+	.irq_ack	= ata_irq_ack,
 
 	.port_start	= ata_port_start,
 	.port_stop	= ata_port_stop,
diff -uprN -X linux-2.6.20-rc4/Documentation/dontdiff linux-2.6.20-rc4/drivers/ata/pata_netcell.c linux-2.6.20-rc4.mod/drivers/ata/pata_netcell.c
--- linux-2.6.20-rc4/drivers/ata/pata_netcell.c	2007-01-07 14:45:51.000000000 +0900
+++ linux-2.6.20-rc4.mod/drivers/ata/pata_netcell.c	2007-01-17 21:14:41.000000000 +0900
@@ -94,6 +94,8 @@ static const struct ata_port_operations 
 	/* IRQ-related hooks */
 	.irq_handler		= ata_interrupt,
 	.irq_clear		= ata_bmdma_irq_clear,
+	.irq_on			= ata_irq_on,
+	.irq_ack		= ata_irq_ack,
 
 	/* Generic PATA PCI ATA helpers */
 	.port_start		= ata_port_start,
diff -uprN -X linux-2.6.20-rc4/Documentation/dontdiff linux-2.6.20-rc4/drivers/ata/pata_ns87410.c linux-2.6.20-rc4.mod/drivers/ata/pata_ns87410.c
--- linux-2.6.20-rc4/drivers/ata/pata_ns87410.c	2007-01-07 14:45:51.000000000 +0900
+++ linux-2.6.20-rc4.mod/drivers/ata/pata_ns87410.c	2007-01-17 21:14:41.000000000 +0900
@@ -183,6 +183,8 @@ static struct ata_port_operations ns8741
 
 	.irq_handler	= ata_interrupt,
 	.irq_clear	= ata_bmdma_irq_clear,
+	.irq_on		= ata_irq_on,
+	.irq_ack	= ata_irq_ack,
 
 	.port_start	= ata_port_start,
 	.port_stop	= ata_port_stop,
diff -uprN -X linux-2.6.20-rc4/Documentation/dontdiff linux-2.6.20-rc4/drivers/ata/pata_oldpiix.c linux-2.6.20-rc4.mod/drivers/ata/pata_oldpiix.c
--- linux-2.6.20-rc4/drivers/ata/pata_oldpiix.c	2007-01-07 14:45:51.000000000 +0900
+++ linux-2.6.20-rc4.mod/drivers/ata/pata_oldpiix.c	2007-01-17 21:14:41.000000000 +0900
@@ -263,6 +263,8 @@ static const struct ata_port_operations 
 
 	.irq_handler		= ata_interrupt,
 	.irq_clear		= ata_bmdma_irq_clear,
+	.irq_on			= ata_irq_on,
+	.irq_ack		= ata_irq_ack,
 
 	.port_start		= ata_port_start,
 	.port_stop		= ata_port_stop,
diff -uprN -X linux-2.6.20-rc4/Documentation/dontdiff linux-2.6.20-rc4/drivers/ata/pata_opti.c linux-2.6.20-rc4.mod/drivers/ata/pata_opti.c
--- linux-2.6.20-rc4/drivers/ata/pata_opti.c	2007-01-07 14:45:51.000000000 +0900
+++ linux-2.6.20-rc4.mod/drivers/ata/pata_opti.c	2007-01-17 21:14:41.000000000 +0900
@@ -209,6 +209,8 @@ static struct ata_port_operations opti_p
 
 	.irq_handler	= ata_interrupt,
 	.irq_clear	= ata_bmdma_irq_clear,
+	.irq_on		= ata_irq_on,
+	.irq_ack	= ata_irq_ack,
 
 	.port_start	= ata_port_start,
 	.port_stop	= ata_port_stop,
diff -uprN -X linux-2.6.20-rc4/Documentation/dontdiff linux-2.6.20-rc4/drivers/ata/pata_optidma.c linux-2.6.20-rc4.mod/drivers/ata/pata_optidma.c
--- linux-2.6.20-rc4/drivers/ata/pata_optidma.c	2007-01-07 14:45:51.000000000 +0900
+++ linux-2.6.20-rc4.mod/drivers/ata/pata_optidma.c	2007-01-17 21:14:41.000000000 +0900
@@ -393,6 +393,8 @@ static struct ata_port_operations optidm
 
 	.irq_handler	= ata_interrupt,
 	.irq_clear	= ata_bmdma_irq_clear,
+	.irq_on		= ata_irq_on,
+	.irq_ack	= ata_irq_ack,
 
 	.port_start	= ata_port_start,
 	.port_stop	= ata_port_stop,
@@ -428,6 +430,8 @@ static struct ata_port_operations optipl
 
 	.irq_handler	= ata_interrupt,
 	.irq_clear	= ata_bmdma_irq_clear,
+	.irq_on		= ata_irq_on,
+	.irq_ack	= ata_irq_ack,
 
 	.port_start	= ata_port_start,
 	.port_stop	= ata_port_stop,
diff -uprN -X linux-2.6.20-rc4/Documentation/dontdiff linux-2.6.20-rc4/drivers/ata/pata_pcmcia.c linux-2.6.20-rc4.mod/drivers/ata/pata_pcmcia.c
--- linux-2.6.20-rc4/drivers/ata/pata_pcmcia.c	2007-01-07 14:45:51.000000000 +0900
+++ linux-2.6.20-rc4.mod/drivers/ata/pata_pcmcia.c	2007-01-17 21:14:41.000000000 +0900
@@ -92,6 +92,8 @@ static struct ata_port_operations pcmcia
 
 	.irq_handler	= ata_interrupt,
 	.irq_clear	= ata_bmdma_irq_clear,
+	.irq_on		= ata_irq_on,
+	.irq_ack	= ata_irq_ack,
 
 	.port_start	= ata_port_start,
 	.port_stop	= ata_port_stop,
diff -uprN -X linux-2.6.20-rc4/Documentation/dontdiff linux-2.6.20-rc4/drivers/ata/pata_pdc2027x.c linux-2.6.20-rc4.mod/drivers/ata/pata_pdc2027x.c
--- linux-2.6.20-rc4/drivers/ata/pata_pdc2027x.c	2007-01-07 14:45:51.000000000 +0900
+++ linux-2.6.20-rc4.mod/drivers/ata/pata_pdc2027x.c	2007-01-17 21:14:41.000000000 +0900
@@ -169,6 +169,8 @@ static struct ata_port_operations pdc202
 
 	.irq_handler		= ata_interrupt,
 	.irq_clear		= ata_bmdma_irq_clear,
+	.irq_on			= ata_irq_on,
+	.irq_ack		= ata_irq_ack,
 
 	.port_start		= ata_port_start,
 	.port_stop		= ata_port_stop,
@@ -203,6 +205,8 @@ static struct ata_port_operations pdc202
 
 	.irq_handler		= ata_interrupt,
 	.irq_clear		= ata_bmdma_irq_clear,
+	.irq_on			= ata_irq_on,
+	.irq_ack		= ata_irq_ack,
 
 	.port_start		= ata_port_start,
 	.port_stop		= ata_port_stop,
diff -uprN -X linux-2.6.20-rc4/Documentation/dontdiff linux-2.6.20-rc4/drivers/ata/pata_pdc202xx_old.c linux-2.6.20-rc4.mod/drivers/ata/pata_pdc202xx_old.c
--- linux-2.6.20-rc4/drivers/ata/pata_pdc202xx_old.c	2007-01-07 14:45:51.000000000 +0900
+++ linux-2.6.20-rc4.mod/drivers/ata/pata_pdc202xx_old.c	2007-01-17 21:14:41.000000000 +0900
@@ -301,6 +301,8 @@ static struct ata_port_operations pdc202
 
 	.irq_handler	= ata_interrupt,
 	.irq_clear	= ata_bmdma_irq_clear,
+	.irq_on		= ata_irq_on,
+	.irq_ack	= ata_irq_ack,
 
 	.port_start	= ata_port_start,
 	.port_stop	= ata_port_stop,
@@ -335,6 +337,8 @@ static struct ata_port_operations pdc202
 
 	.irq_handler	= ata_interrupt,
 	.irq_clear	= ata_bmdma_irq_clear,
+	.irq_on		= ata_irq_on,
+	.irq_ack	= ata_irq_ack,
 
 	.port_start	= ata_port_start,
 	.port_stop	= ata_port_stop,
diff -uprN -X linux-2.6.20-rc4/Documentation/dontdiff linux-2.6.20-rc4/drivers/ata/pata_platform.c linux-2.6.20-rc4.mod/drivers/ata/pata_platform.c
--- linux-2.6.20-rc4/drivers/ata/pata_platform.c	2007-01-07 14:45:51.000000000 +0900
+++ linux-2.6.20-rc4.mod/drivers/ata/pata_platform.c	2007-01-17 21:14:41.000000000 +0900
@@ -103,6 +103,8 @@ static struct ata_port_operations pata_p
 
 	.irq_handler		= ata_interrupt,
 	.irq_clear		= ata_bmdma_irq_clear,
+	.irq_on			= ata_irq_on,
+	.irq_ack		= ata_irq_ack,
 
 	.port_start		= ata_port_start,
 	.port_stop		= ata_port_stop,
diff -uprN -X linux-2.6.20-rc4/Documentation/dontdiff linux-2.6.20-rc4/drivers/ata/pata_qdi.c linux-2.6.20-rc4.mod/drivers/ata/pata_qdi.c
--- linux-2.6.20-rc4/drivers/ata/pata_qdi.c	2007-01-07 14:45:51.000000000 +0900
+++ linux-2.6.20-rc4.mod/drivers/ata/pata_qdi.c	2007-01-17 21:14:41.000000000 +0900
@@ -189,6 +189,8 @@ static struct ata_port_operations qdi650
 
 	.irq_handler	= ata_interrupt,
 	.irq_clear	= ata_bmdma_irq_clear,
+	.irq_on		= ata_irq_on,
+	.irq_ack	= ata_irq_ack,
 
 	.port_start	= ata_port_start,
 	.port_stop	= ata_port_stop,
@@ -217,6 +219,8 @@ static struct ata_port_operations qdi658
 
 	.irq_handler	= ata_interrupt,
 	.irq_clear	= ata_bmdma_irq_clear,
+	.irq_on		= ata_irq_on,
+	.irq_ack	= ata_irq_ack,
 
 	.port_start	= ata_port_start,
 	.port_stop	= ata_port_stop,
diff -uprN -X linux-2.6.20-rc4/Documentation/dontdiff linux-2.6.20-rc4/drivers/ata/pata_radisys.c linux-2.6.20-rc4.mod/drivers/ata/pata_radisys.c
--- linux-2.6.20-rc4/drivers/ata/pata_radisys.c	2007-01-07 14:45:51.000000000 +0900
+++ linux-2.6.20-rc4.mod/drivers/ata/pata_radisys.c	2007-01-17 21:14:41.000000000 +0900
@@ -259,6 +259,8 @@ static const struct ata_port_operations 
 
 	.irq_handler		= ata_interrupt,
 	.irq_clear		= ata_bmdma_irq_clear,
+	.irq_on			= ata_irq_on,
+	.irq_ack		= ata_irq_ack,
 
 	.port_start		= ata_port_start,
 	.port_stop		= ata_port_stop,
diff -uprN -X linux-2.6.20-rc4/Documentation/dontdiff linux-2.6.20-rc4/drivers/ata/pata_rz1000.c linux-2.6.20-rc4.mod/drivers/ata/pata_rz1000.c
--- linux-2.6.20-rc4/drivers/ata/pata_rz1000.c	2007-01-07 14:45:51.000000000 +0900
+++ linux-2.6.20-rc4.mod/drivers/ata/pata_rz1000.c	2007-01-17 21:14:41.000000000 +0900
@@ -122,6 +122,8 @@ static struct ata_port_operations rz1000
 
 	.irq_handler	= ata_interrupt,
 	.irq_clear	= ata_bmdma_irq_clear,
+	.irq_on		= ata_irq_on,
+	.irq_ack	= ata_irq_ack,
 
 	.port_start	= ata_port_start,
 	.port_stop	= ata_port_stop,
diff -uprN -X linux-2.6.20-rc4/Documentation/dontdiff linux-2.6.20-rc4/drivers/ata/pata_sc1200.c linux-2.6.20-rc4.mod/drivers/ata/pata_sc1200.c
--- linux-2.6.20-rc4/drivers/ata/pata_sc1200.c	2007-01-07 14:45:51.000000000 +0900
+++ linux-2.6.20-rc4.mod/drivers/ata/pata_sc1200.c	2007-01-17 21:14:41.000000000 +0900
@@ -224,6 +224,8 @@ static struct ata_port_operations sc1200
 
 	.irq_handler	= ata_interrupt,
 	.irq_clear	= ata_bmdma_irq_clear,
+	.irq_on		= ata_irq_on,
+	.irq_ack	= ata_irq_ack,
 
 	.port_start	= ata_port_start,
 	.port_stop	= ata_port_stop,
diff -uprN -X linux-2.6.20-rc4/Documentation/dontdiff linux-2.6.20-rc4/drivers/ata/pata_serverworks.c linux-2.6.20-rc4.mod/drivers/ata/pata_serverworks.c
--- linux-2.6.20-rc4/drivers/ata/pata_serverworks.c	2007-01-07 14:45:51.000000000 +0900
+++ linux-2.6.20-rc4.mod/drivers/ata/pata_serverworks.c	2007-01-17 21:14:41.000000000 +0900
@@ -359,6 +359,8 @@ static struct ata_port_operations server
 
 	.irq_handler	= ata_interrupt,
 	.irq_clear	= ata_bmdma_irq_clear,
+	.irq_on		= ata_irq_on,
+	.irq_ack	= ata_irq_ack,
 
 	.port_start	= ata_port_start,
 	.port_stop	= ata_port_stop,
@@ -394,6 +396,8 @@ static struct ata_port_operations server
 
 	.irq_handler	= ata_interrupt,
 	.irq_clear	= ata_bmdma_irq_clear,
+	.irq_on		= ata_irq_on,
+	.irq_ack	= ata_irq_ack,
 
 	.port_start	= ata_port_start,
 	.port_stop	= ata_port_stop,
diff -uprN -X linux-2.6.20-rc4/Documentation/dontdiff linux-2.6.20-rc4/drivers/ata/pata_sil680.c linux-2.6.20-rc4.mod/drivers/ata/pata_sil680.c
--- linux-2.6.20-rc4/drivers/ata/pata_sil680.c	2007-01-07 14:45:51.000000000 +0900
+++ linux-2.6.20-rc4.mod/drivers/ata/pata_sil680.c	2007-01-17 21:14:41.000000000 +0900
@@ -256,6 +256,8 @@ static struct ata_port_operations sil680
 
 	.irq_handler	= ata_interrupt,
 	.irq_clear	= ata_bmdma_irq_clear,
+	.irq_on		= ata_irq_on,
+	.irq_ack	= ata_irq_ack,
 
 	.port_start	= ata_port_start,
 	.port_stop	= ata_port_stop,
diff -uprN -X linux-2.6.20-rc4/Documentation/dontdiff linux-2.6.20-rc4/drivers/ata/pata_sis.c linux-2.6.20-rc4.mod/drivers/ata/pata_sis.c
--- linux-2.6.20-rc4/drivers/ata/pata_sis.c	2007-01-07 14:45:51.000000000 +0900
+++ linux-2.6.20-rc4.mod/drivers/ata/pata_sis.c	2007-01-17 21:14:41.000000000 +0900
@@ -577,6 +577,8 @@ static const struct ata_port_operations 
 
 	.irq_handler		= ata_interrupt,
 	.irq_clear		= ata_bmdma_irq_clear,
+	.irq_on			= ata_irq_on,
+	.irq_ack		= ata_irq_ack,
 
 	.port_start		= ata_port_start,
 	.port_stop		= ata_port_stop,
@@ -610,6 +612,8 @@ static const struct ata_port_operations 
 
 	.irq_handler		= ata_interrupt,
 	.irq_clear		= ata_bmdma_irq_clear,
+	.irq_on			= ata_irq_on,
+	.irq_ack		= ata_irq_ack,
 
 	.port_start		= ata_port_start,
 	.port_stop		= ata_port_stop,
@@ -644,6 +648,8 @@ static const struct ata_port_operations 
 
 	.irq_handler		= ata_interrupt,
 	.irq_clear		= ata_bmdma_irq_clear,
+	.irq_on			= ata_irq_on,
+	.irq_ack		= ata_irq_ack,
 
 	.port_start		= ata_port_start,
 	.port_stop		= ata_port_stop,
@@ -677,6 +683,8 @@ static const struct ata_port_operations 
 
 	.irq_handler		= ata_interrupt,
 	.irq_clear		= ata_bmdma_irq_clear,
+	.irq_on			= ata_irq_on,
+	.irq_ack		= ata_irq_ack,
 
 	.port_start		= ata_port_start,
 	.port_stop		= ata_port_stop,
@@ -710,6 +718,8 @@ static const struct ata_port_operations 
 
 	.irq_handler		= ata_interrupt,
 	.irq_clear		= ata_bmdma_irq_clear,
+	.irq_on			= ata_irq_on,
+	.irq_ack		= ata_irq_ack,
 
 	.port_start		= ata_port_start,
 	.port_stop		= ata_port_stop,
diff -uprN -X linux-2.6.20-rc4/Documentation/dontdiff linux-2.6.20-rc4/drivers/ata/pata_sl82c105.c linux-2.6.20-rc4.mod/drivers/ata/pata_sl82c105.c
--- linux-2.6.20-rc4/drivers/ata/pata_sl82c105.c	2007-01-07 14:45:51.000000000 +0900
+++ linux-2.6.20-rc4.mod/drivers/ata/pata_sl82c105.c	2007-01-17 21:14:41.000000000 +0900
@@ -266,6 +266,8 @@ static struct ata_port_operations sl82c1
 
 	.irq_handler	= ata_interrupt,
 	.irq_clear	= ata_bmdma_irq_clear,
+	.irq_on		= ata_irq_on,
+	.irq_ack	= ata_irq_ack,
 
 	.port_start	= ata_port_start,
 	.port_stop	= ata_port_stop,
diff -uprN -X linux-2.6.20-rc4/Documentation/dontdiff linux-2.6.20-rc4/drivers/ata/pata_triflex.c linux-2.6.20-rc4.mod/drivers/ata/pata_triflex.c
--- linux-2.6.20-rc4/drivers/ata/pata_triflex.c	2007-01-07 14:45:51.000000000 +0900
+++ linux-2.6.20-rc4.mod/drivers/ata/pata_triflex.c	2007-01-17 21:14:41.000000000 +0900
@@ -225,6 +225,8 @@ static struct ata_port_operations trifle
 
 	.irq_handler	= ata_interrupt,
 	.irq_clear	= ata_bmdma_irq_clear,
+	.irq_on		= ata_irq_on,
+	.irq_ack	= ata_irq_ack,
 
 	.port_start	= ata_port_start,
 	.port_stop	= ata_port_stop,
diff -uprN -X linux-2.6.20-rc4/Documentation/dontdiff linux-2.6.20-rc4/drivers/ata/pata_via.c linux-2.6.20-rc4.mod/drivers/ata/pata_via.c
--- linux-2.6.20-rc4/drivers/ata/pata_via.c	2007-01-07 14:45:51.000000000 +0900
+++ linux-2.6.20-rc4.mod/drivers/ata/pata_via.c	2007-01-17 21:14:41.000000000 +0900
@@ -336,6 +336,8 @@ static struct ata_port_operations via_po
 
 	.irq_handler	= ata_interrupt,
 	.irq_clear	= ata_bmdma_irq_clear,
+	.irq_on		= ata_irq_on,
+	.irq_ack	= ata_irq_ack,
 
 	.port_start	= ata_port_start,
 	.port_stop	= ata_port_stop,
@@ -371,6 +373,8 @@ static struct ata_port_operations via_po
 
 	.irq_handler	= ata_interrupt,
 	.irq_clear	= ata_bmdma_irq_clear,
+	.irq_on		= ata_irq_on,
+	.irq_ack	= ata_irq_ack,
 
 	.port_start	= ata_port_start,
 	.port_stop	= ata_port_stop,
diff -uprN -X linux-2.6.20-rc4/Documentation/dontdiff linux-2.6.20-rc4/drivers/ata/pata_winbond.c linux-2.6.20-rc4.mod/drivers/ata/pata_winbond.c
--- linux-2.6.20-rc4/drivers/ata/pata_winbond.c	2007-01-07 14:45:51.000000000 +0900
+++ linux-2.6.20-rc4.mod/drivers/ata/pata_winbond.c	2007-01-17 21:14:41.000000000 +0900
@@ -158,6 +158,8 @@ static struct ata_port_operations winbon
 
 	.irq_handler	= ata_interrupt,
 	.irq_clear	= ata_bmdma_irq_clear,
+	.irq_on		= ata_irq_on,
+	.irq_ack	= ata_irq_ack,
 
 	.port_start	= ata_port_start,
 	.port_stop	= ata_port_stop,
diff -uprN -X linux-2.6.20-rc4/Documentation/dontdiff linux-2.6.20-rc4/drivers/ata/pdc_adma.c linux-2.6.20-rc4.mod/drivers/ata/pdc_adma.c
--- linux-2.6.20-rc4/drivers/ata/pdc_adma.c	2007-01-07 14:45:51.000000000 +0900
+++ linux-2.6.20-rc4.mod/drivers/ata/pdc_adma.c	2007-01-17 21:14:41.000000000 +0900
@@ -170,6 +170,8 @@ static const struct ata_port_operations 
 	.data_xfer		= ata_mmio_data_xfer,
 	.irq_handler		= adma_intr,
 	.irq_clear		= adma_irq_clear,
+	.irq_on			= ata_irq_on,
+	.irq_ack		= ata_irq_ack,
 	.port_start		= adma_port_start,
 	.port_stop		= adma_port_stop,
 	.host_stop		= adma_host_stop,
diff -uprN -X linux-2.6.20-rc4/Documentation/dontdiff linux-2.6.20-rc4/drivers/ata/sata_mv.c linux-2.6.20-rc4.mod/drivers/ata/sata_mv.c
--- linux-2.6.20-rc4/drivers/ata/sata_mv.c	2007-01-07 14:45:51.000000000 +0900
+++ linux-2.6.20-rc4.mod/drivers/ata/sata_mv.c	2007-01-17 23:07:11.000000000 +0900
@@ -412,6 +412,8 @@ static const struct ata_port_operations 
 
 	.irq_handler		= mv_interrupt,
 	.irq_clear		= mv_irq_clear,
+	.irq_on			= ata_irq_on,
+	.irq_ack		= ata_irq_ack,
 
 	.scr_read		= mv5_scr_read,
 	.scr_write		= mv5_scr_write,
@@ -440,6 +442,8 @@ static const struct ata_port_operations 
 
 	.irq_handler		= mv_interrupt,
 	.irq_clear		= mv_irq_clear,
+	.irq_on			= ata_irq_on,
+	.irq_ack		= ata_irq_ack,
 
 	.scr_read		= mv_scr_read,
 	.scr_write		= mv_scr_write,
@@ -468,6 +472,8 @@ static const struct ata_port_operations 
 
 	.irq_handler		= mv_interrupt,
 	.irq_clear		= mv_irq_clear,
+	.irq_on			= ata_irq_on,
+	.irq_ack		= ata_irq_ack,
 
 	.scr_read		= mv_scr_read,
 	.scr_write		= mv_scr_write,
diff -uprN -X linux-2.6.20-rc4/Documentation/dontdiff linux-2.6.20-rc4/drivers/ata/sata_nv.c linux-2.6.20-rc4.mod/drivers/ata/sata_nv.c
--- linux-2.6.20-rc4/drivers/ata/sata_nv.c	2007-01-07 14:45:51.000000000 +0900
+++ linux-2.6.20-rc4.mod/drivers/ata/sata_nv.c	2007-01-17 21:14:41.000000000 +0900
@@ -343,6 +343,8 @@ static const struct ata_port_operations 
 	.data_xfer		= ata_pio_data_xfer,
 	.irq_handler		= nv_generic_interrupt,
 	.irq_clear		= ata_bmdma_irq_clear,
+	.irq_on			= ata_irq_on,
+	.irq_ack		= ata_irq_ack,
 	.scr_read		= nv_scr_read,
 	.scr_write		= nv_scr_write,
 	.port_start		= ata_port_start,
@@ -370,6 +372,8 @@ static const struct ata_port_operations 
 	.data_xfer		= ata_pio_data_xfer,
 	.irq_handler		= nv_nf2_interrupt,
 	.irq_clear		= ata_bmdma_irq_clear,
+	.irq_on			= ata_irq_on,
+	.irq_ack		= ata_irq_ack,
 	.scr_read		= nv_scr_read,
 	.scr_write		= nv_scr_write,
 	.port_start		= ata_port_start,
@@ -397,6 +401,8 @@ static const struct ata_port_operations 
 	.data_xfer		= ata_pio_data_xfer,
 	.irq_handler		= nv_ck804_interrupt,
 	.irq_clear		= ata_bmdma_irq_clear,
+	.irq_on			= ata_irq_on,
+	.irq_ack		= ata_irq_ack,
 	.scr_read		= nv_scr_read,
 	.scr_write		= nv_scr_write,
 	.port_start		= ata_port_start,
@@ -425,6 +431,8 @@ static const struct ata_port_operations 
 	.data_xfer		= ata_mmio_data_xfer,
 	.irq_handler		= nv_adma_interrupt,
 	.irq_clear		= nv_adma_irq_clear,
+	.irq_on			= ata_irq_on,
+	.irq_ack		= ata_irq_ack,
 	.scr_read		= nv_scr_read,
 	.scr_write		= nv_scr_write,
 	.port_start		= nv_adma_port_start,
diff -uprN -X linux-2.6.20-rc4/Documentation/dontdiff linux-2.6.20-rc4/drivers/ata/sata_promise.c linux-2.6.20-rc4.mod/drivers/ata/sata_promise.c
--- linux-2.6.20-rc4/drivers/ata/sata_promise.c	2007-01-07 14:45:51.000000000 +0900
+++ linux-2.6.20-rc4.mod/drivers/ata/sata_promise.c	2007-01-17 23:07:11.000000000 +0900
@@ -149,6 +149,8 @@ static const struct ata_port_operations 
 	.data_xfer		= ata_mmio_data_xfer,
 	.irq_handler		= pdc_interrupt,
 	.irq_clear		= pdc_irq_clear,
+	.irq_on			= ata_irq_on,
+	.irq_ack		= ata_irq_ack,
 
 	.scr_read		= pdc_sata_scr_read,
 	.scr_write		= pdc_sata_scr_write,
@@ -173,6 +175,8 @@ static const struct ata_port_operations 
 	.eng_timeout		= pdc_eng_timeout,
 	.irq_handler		= pdc_interrupt,
 	.irq_clear		= pdc_irq_clear,
+	.irq_on			= ata_irq_on,
+	.irq_ack		= ata_irq_ack,
 
 	.port_start		= pdc_port_start,
 	.port_stop		= pdc_port_stop,
diff -uprN -X linux-2.6.20-rc4/Documentation/dontdiff linux-2.6.20-rc4/drivers/ata/sata_qstor.c linux-2.6.20-rc4.mod/drivers/ata/sata_qstor.c
--- linux-2.6.20-rc4/drivers/ata/sata_qstor.c	2007-01-07 14:45:51.000000000 +0900
+++ linux-2.6.20-rc4.mod/drivers/ata/sata_qstor.c	2007-01-17 21:14:41.000000000 +0900
@@ -161,6 +161,8 @@ static const struct ata_port_operations 
 	.eng_timeout		= qs_eng_timeout,
 	.irq_handler		= qs_intr,
 	.irq_clear		= qs_irq_clear,
+	.irq_on			= ata_irq_on,
+	.irq_ack		= ata_irq_ack,
 	.scr_read		= qs_scr_read,
 	.scr_write		= qs_scr_write,
 	.port_start		= qs_port_start,
diff -uprN -X linux-2.6.20-rc4/Documentation/dontdiff linux-2.6.20-rc4/drivers/ata/sata_sil.c linux-2.6.20-rc4.mod/drivers/ata/sata_sil.c
--- linux-2.6.20-rc4/drivers/ata/sata_sil.c	2007-01-07 14:45:51.000000000 +0900
+++ linux-2.6.20-rc4.mod/drivers/ata/sata_sil.c	2007-01-17 21:14:41.000000000 +0900
@@ -207,6 +207,8 @@ static const struct ata_port_operations 
 	.post_internal_cmd	= ata_bmdma_post_internal_cmd,
 	.irq_handler		= sil_interrupt,
 	.irq_clear		= ata_bmdma_irq_clear,
+	.irq_on			= ata_irq_on,
+	.irq_ack		= ata_irq_ack,
 	.scr_read		= sil_scr_read,
 	.scr_write		= sil_scr_write,
 	.port_start		= ata_port_start,
diff -uprN -X linux-2.6.20-rc4/Documentation/dontdiff linux-2.6.20-rc4/drivers/ata/sata_sil24.c linux-2.6.20-rc4.mod/drivers/ata/sata_sil24.c
--- linux-2.6.20-rc4/drivers/ata/sata_sil24.c	2007-01-07 14:45:51.000000000 +0900
+++ linux-2.6.20-rc4.mod/drivers/ata/sata_sil24.c	2007-01-17 21:14:41.000000000 +0900
@@ -406,6 +406,8 @@ static const struct ata_port_operations 
 
 	.irq_handler		= sil24_interrupt,
 	.irq_clear		= sil24_irq_clear,
+	.irq_on			= ata_dummy_irq_on,
+	.irq_ack		= ata_irq_ack,
 
 	.scr_read		= sil24_scr_read,
 	.scr_write		= sil24_scr_write,
diff -uprN -X linux-2.6.20-rc4/Documentation/dontdiff linux-2.6.20-rc4/drivers/ata/sata_sis.c linux-2.6.20-rc4.mod/drivers/ata/sata_sis.c
--- linux-2.6.20-rc4/drivers/ata/sata_sis.c	2007-01-07 14:45:51.000000000 +0900
+++ linux-2.6.20-rc4.mod/drivers/ata/sata_sis.c	2007-01-17 21:14:41.000000000 +0900
@@ -119,6 +119,8 @@ static const struct ata_port_operations 
 	.post_internal_cmd	= ata_bmdma_post_internal_cmd,
 	.irq_handler		= ata_interrupt,
 	.irq_clear		= ata_bmdma_irq_clear,
+	.irq_on			= ata_irq_on,
+	.irq_ack		= ata_irq_ack,
 	.scr_read		= sis_scr_read,
 	.scr_write		= sis_scr_write,
 	.port_start		= ata_port_start,
diff -uprN -X linux-2.6.20-rc4/Documentation/dontdiff linux-2.6.20-rc4/drivers/ata/sata_svw.c linux-2.6.20-rc4.mod/drivers/ata/sata_svw.c
--- linux-2.6.20-rc4/drivers/ata/sata_svw.c	2007-01-07 14:45:51.000000000 +0900
+++ linux-2.6.20-rc4.mod/drivers/ata/sata_svw.c	2007-01-17 21:14:41.000000000 +0900
@@ -356,6 +356,8 @@ static const struct ata_port_operations 
 	.post_internal_cmd	= ata_bmdma_post_internal_cmd,
 	.irq_handler		= ata_interrupt,
 	.irq_clear		= ata_bmdma_irq_clear,
+	.irq_on			= ata_irq_on,
+	.irq_ack		= ata_irq_ack,
 	.scr_read		= k2_sata_scr_read,
 	.scr_write		= k2_sata_scr_write,
 	.port_start		= ata_port_start,
diff -uprN -X linux-2.6.20-rc4/Documentation/dontdiff linux-2.6.20-rc4/drivers/ata/sata_sx4.c linux-2.6.20-rc4.mod/drivers/ata/sata_sx4.c
--- linux-2.6.20-rc4/drivers/ata/sata_sx4.c	2007-01-07 14:45:51.000000000 +0900
+++ linux-2.6.20-rc4.mod/drivers/ata/sata_sx4.c	2007-01-17 21:14:41.000000000 +0900
@@ -209,6 +209,8 @@ static const struct ata_port_operations 
 	.eng_timeout		= pdc_eng_timeout,
 	.irq_handler		= pdc20621_interrupt,
 	.irq_clear		= pdc20621_irq_clear,
+	.irq_on			= ata_irq_on,
+	.irq_ack		= ata_irq_ack,
 	.port_start		= pdc_port_start,
 	.port_stop		= pdc_port_stop,
 	.host_stop		= pdc20621_host_stop,
diff -uprN -X linux-2.6.20-rc4/Documentation/dontdiff linux-2.6.20-rc4/drivers/ata/sata_uli.c linux-2.6.20-rc4.mod/drivers/ata/sata_uli.c
--- linux-2.6.20-rc4/drivers/ata/sata_uli.c	2007-01-07 14:45:51.000000000 +0900
+++ linux-2.6.20-rc4.mod/drivers/ata/sata_uli.c	2007-01-17 21:14:41.000000000 +0900
@@ -117,6 +117,8 @@ static const struct ata_port_operations 
 
 	.irq_handler		= ata_interrupt,
 	.irq_clear		= ata_bmdma_irq_clear,
+	.irq_on			= ata_irq_on,
+	.irq_ack		= ata_irq_ack,
 
 	.scr_read		= uli_scr_read,
 	.scr_write		= uli_scr_write,
diff -uprN -X linux-2.6.20-rc4/Documentation/dontdiff linux-2.6.20-rc4/drivers/ata/sata_via.c linux-2.6.20-rc4.mod/drivers/ata/sata_via.c
--- linux-2.6.20-rc4/drivers/ata/sata_via.c	2007-01-07 14:45:51.000000000 +0900
+++ linux-2.6.20-rc4.mod/drivers/ata/sata_via.c	2007-01-17 21:14:41.000000000 +0900
@@ -134,6 +134,8 @@ static const struct ata_port_operations 
 
 	.irq_handler		= ata_interrupt,
 	.irq_clear		= ata_bmdma_irq_clear,
+	.irq_on			= ata_irq_on,
+	.irq_ack		= ata_irq_ack,
 
 	.port_start		= ata_port_start,
 	.port_stop		= ata_port_stop,
@@ -165,6 +167,8 @@ static const struct ata_port_operations 
 
 	.irq_handler		= ata_interrupt,
 	.irq_clear		= ata_bmdma_irq_clear,
+	.irq_on			= ata_irq_on,
+	.irq_ack		= ata_irq_ack,
 
 	.scr_read		= svia_scr_read,
 	.scr_write		= svia_scr_write,
diff -uprN -X linux-2.6.20-rc4/Documentation/dontdiff linux-2.6.20-rc4/drivers/ata/sata_vsc.c linux-2.6.20-rc4.mod/drivers/ata/sata_vsc.c
--- linux-2.6.20-rc4/drivers/ata/sata_vsc.c	2007-01-07 14:45:51.000000000 +0900
+++ linux-2.6.20-rc4.mod/drivers/ata/sata_vsc.c	2007-01-17 21:14:41.000000000 +0900
@@ -308,6 +308,8 @@ static const struct ata_port_operations 
 	.post_internal_cmd	= ata_bmdma_post_internal_cmd,
 	.irq_handler		= vsc_sata_interrupt,
 	.irq_clear		= ata_bmdma_irq_clear,
+	.irq_on			= ata_irq_on,
+	.irq_ack		= ata_irq_ack,
 	.scr_read		= vsc_sata_scr_read,
 	.scr_write		= vsc_sata_scr_write,
 	.port_start		= ata_port_start,
diff -uprN -X linux-2.6.20-rc4/Documentation/dontdiff linux-2.6.20-rc4/include/linux/libata.h linux-2.6.20-rc4.mod/include/linux/libata.h
--- linux-2.6.20-rc4/include/linux/libata.h	2007-01-17 23:23:27.000000000 +0900
+++ linux-2.6.20-rc4.mod/include/linux/libata.h	2007-01-17 23:24:49.000000000 +0900
@@ -638,6 +638,8 @@ struct ata_port_operations {
 
 	irq_handler_t irq_handler;
 	void (*irq_clear) (struct ata_port *);
+	u8 (*irq_on) (struct ata_port *);
+	u8 (*irq_ack) (struct ata_port *ap, unsigned int chk_drq);
 
 	u32 (*scr_read) (struct ata_port *ap, unsigned int sc_reg);
 	void (*scr_write) (struct ata_port *ap, unsigned int sc_reg,
@@ -761,6 +763,7 @@ extern void ata_port_queue_task(struct a
 extern u32 ata_wait_register(void __iomem *reg, u32 mask, u32 val,
 			     unsigned long interval_msec,
 			     unsigned long timeout_msec);
+u8 ata_irq_on(struct ata_port *ap);
 
 /*
  * Default driver ops implementations
@@ -1202,6 +1205,8 @@ static inline u8 ata_irq_ack(struct ata_
 	return status;
 }
 
+static inline u8 ata_dummy_irq_on (struct ata_port *ap)	{ return 0; }
+
 static inline int ata_try_flush_cache(const struct ata_device *dev)
 {
 	return ata_id_wcache_enabled(dev->id) ||

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

* [PATCH] driver/ata: PATA driver for Celleb
       [not found]     ` <200701180055.l0I0tl6M021051@toshiba.co.jp>
@ 2007-01-18  1:29       ` Akira Iguchi
  2007-01-25  1:17       ` [PATCH 2/4] libata-core.c: add another IRQ calls Jeff Garzik
       [not found]       ` <200701180129.l0I1TL48013407@toshiba.co.jp>
  2 siblings, 0 replies; 11+ messages in thread
From: Akira Iguchi @ 2007-01-18  1:29 UTC (permalink / raw)
  To: Akira Iguchi
  Cc: Mikael Pettersson, Jeff Garzik, arnd, linuxppc-dev, linux-ide,
	paulus, alan

This is the patch for PATA controller of Celleb.
It depends on the previous "add another IRQ calls" patch.

Because this driver needs special taskfile accesses, there is
a copy of ata_std_softreset(). ata_dev_try_classify() is exported
so that it can be used in this function.

Signed-off-by: Kou Ishizaki <kou.ishizaki@toshiba.co.jp>
Signed-off-by: Akira Iguchi <akira2.iguchi@toshiba.co.jp>
---

diff -uprN -X linux-2.6.20-rc4/Documentation/dontdiff linux-2.6.20-rc4/drivers/ata/Kconfig linux-2.6.20-rc4.mod/drivers/ata/Kconfig
--- linux-2.6.20-rc4/drivers/ata/Kconfig	2007-01-18 18:05:30.000000000 +0900
+++ linux-2.6.20-rc4.mod/drivers/ata/Kconfig	2007-01-18 18:05:53.000000000 +0900
@@ -518,6 +518,15 @@ config PATA_IXP4XX_CF
 
 	  If unsure, say N.
 
+config PATA_SCC
+	tristate "Toshiba's Cell Reference Set IDE support"
+	depends on PCI
+	help
+	  This option enables support for the built-in IDE controller on
+	  Toshiba Cell Reference Board.
+
+	  If unsure, say N.
+
 endif
 endmenu
 
diff -uprN -X linux-2.6.20-rc4/Documentation/dontdiff linux-2.6.20-rc4/drivers/ata/Makefile linux-2.6.20-rc4.mod/drivers/ata/Makefile
--- linux-2.6.20-rc4/drivers/ata/Makefile	2007-01-18 18:05:36.000000000 +0900
+++ linux-2.6.20-rc4.mod/drivers/ata/Makefile	2007-01-18 18:05:56.000000000 +0900
@@ -56,6 +56,7 @@ obj-$(CONFIG_PATA_WINBOND_VLB)	+= pata_w
 obj-$(CONFIG_PATA_SIS)		+= pata_sis.o
 obj-$(CONFIG_PATA_TRIFLEX)	+= pata_triflex.o
 obj-$(CONFIG_PATA_IXP4XX_CF)	+= pata_ixp4xx_cf.o
+obj-$(CONFIG_PATA_SCC)		+= pata_scc.o
 obj-$(CONFIG_PATA_PLATFORM)	+= pata_platform.o
 # Should be last but one libata driver
 obj-$(CONFIG_ATA_GENERIC)	+= ata_generic.o
diff -uprN -X linux-2.6.20-rc4/Documentation/dontdiff linux-2.6.20-rc4/drivers/ata/libata-core.c linux-2.6.20-rc4.mod/drivers/ata/libata-core.c
--- linux-2.6.20-rc4/drivers/ata/libata-core.c	2007-01-18 18:04:02.000000000 +0900
+++ linux-2.6.20-rc4.mod/drivers/ata/libata-core.c	2007-01-18 18:06:32.000000000 +0900
@@ -767,7 +767,7 @@ unsigned int ata_dev_classify(const stru
  *	Device type - %ATA_DEV_ATA, %ATA_DEV_ATAPI or %ATA_DEV_NONE.
  */
 
-static unsigned int
+unsigned int
 ata_dev_try_classify(struct ata_port *ap, unsigned int device, u8 *r_err)
 {
 	struct ata_taskfile tf;
@@ -6497,3 +6497,5 @@ EXPORT_SYMBOL_GPL(ata_eh_qc_complete);
 EXPORT_SYMBOL_GPL(ata_eh_qc_retry);
 EXPORT_SYMBOL_GPL(ata_do_eh);
 EXPORT_SYMBOL_GPL(ata_irq_on);
+EXPORT_SYMBOL_GPL(ata_dev_try_classify);
+EXPORT_SYMBOL_GPL(ata_probe_ent_alloc);
diff -uprN -X linux-2.6.20-rc4/Documentation/dontdiff linux-2.6.20-rc4/drivers/ata/pata_scc.c linux-2.6.20-rc4.mod/drivers/ata/pata_scc.c
--- linux-2.6.20-rc4/drivers/ata/pata_scc.c	2007-01-18 18:05:39.000000000 +0900
+++ linux-2.6.20-rc4.mod/drivers/ata/pata_scc.c	2007-01-18 18:05:59.000000000 +0900
@@ -0,0 +1,1349 @@
+/*
+ * Support for IDE interfaces on Celleb platform
+ *
+ * (C) Copyright 2006 TOSHIBA CORPORATION
+ *
+ * This code is based on drivers/ata/ata_piix.c:
+ *  Copyright 2003-2005 Red Hat Inc
+ *  Copyright 2003-2005 Jeff Garzik
+ *  Copyright (C) 1998-1999 Andrzej Krzysztofowicz, Author and Maintainer
+ *  Copyright (C) 1998-2000 Andre Hedrick <andre@linux-ide.org>
+ *  Copyright (C) 2003 Red Hat Inc <alan@redhat.com>
+ *
+ * and drivers/ata/libata-core.c:
+ *  Copyright 2003-2004 Red Hat, Inc.  All rights reserved.
+ *  Copyright 2003-2004 Jeff Garzik
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * 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.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/pci.h>
+#include <linux/init.h>
+#include <linux/blkdev.h>
+#include <linux/delay.h>
+#include <linux/device.h>
+#include <scsi/scsi_host.h>
+#include <linux/libata.h>
+
+#define DRV_NAME		"pata_scc"
+#define DRV_VERSION		"0.1"
+
+#define PCI_DEVICE_ID_TOSHIBA_SCC_ATA		0x01b4
+
+/* offset of CTRL registers */
+#define SCC_CTL_PIOSHT		0x000
+#define SCC_CTL_PIOCT		0x004
+#define SCC_CTL_MDMACT		0x008
+#define SCC_CTL_MCRCST		0x00C
+#define SCC_CTL_SDMACT		0x010
+#define SCC_CTL_SCRCST		0x014
+#define SCC_CTL_UDENVT		0x018
+#define SCC_CTL_TDVHSEL 	0x020
+#define SCC_CTL_MODEREG 	0x024
+#define SCC_CTL_ECMODE		0xF00
+#define SCC_CTL_MAEA0		0xF50
+#define SCC_CTL_MAEC0		0xF54
+#define SCC_CTL_CCKCTRL 	0xFF0
+
+/* offset of BMID registers */
+#define SCC_DMA_CMD		0x000
+#define SCC_DMA_STATUS		0x004
+#define SCC_DMA_TABLE_OFS	0x008
+#define SCC_DMA_INTMASK 	0x010
+#define SCC_DMA_INTST		0x014
+#define SCC_DMA_PTERADD 	0x018
+#define SCC_REG_CMD_ADDR	0x020
+#define SCC_REG_DATA		0x000
+#define SCC_REG_ERR		0x004
+#define SCC_REG_FEATURE 	0x004
+#define SCC_REG_NSECT		0x008
+#define SCC_REG_LBAL		0x00C
+#define SCC_REG_LBAM		0x010
+#define SCC_REG_LBAH		0x014
+#define SCC_REG_DEVICE		0x018
+#define SCC_REG_STATUS		0x01C
+#define SCC_REG_CMD		0x01C
+#define SCC_REG_ALTSTATUS	0x020
+
+/* register value */
+#define TDVHSEL_MASTER		0x00000001
+#define TDVHSEL_SLAVE		0x00000004
+
+#define MODE_JCUSFEN		0x00000080
+
+#define ECMODE_VALUE		0x01
+
+#define CCKCTRL_ATARESET	0x00040000
+#define CCKCTRL_BUFCNT		0x00020000
+#define CCKCTRL_CRST		0x00010000
+#define CCKCTRL_OCLKEN		0x00000100
+#define CCKCTRL_ATACLKOEN	0x00000002
+#define CCKCTRL_LCLKEN		0x00000001
+
+#define QCHCD_IOS_SS		0x00000001
+
+#define QCHSD_STPDIAG		0x00020000
+
+#define INTMASK_MSK		0xD1000012
+#define INTSTS_SERROR		0x80000000
+#define INTSTS_PRERR		0x40000000
+#define INTSTS_RERR		0x10000000
+#define INTSTS_ICERR		0x01000000
+#define INTSTS_BMSINT		0x00000010
+#define INTSTS_BMHE		0x00000008
+#define INTSTS_IOIRQS		0x00000004
+#define INTSTS_INTRQ		0x00000002
+#define INTSTS_ACTEINT		0x00000001
+
+
+typedef struct scc_ports {
+	void __iomem *ctl_base;
+	void __iomem *dma_base;
+} scc_ports;
+
+/* PIO transfer mode table */
+/* JCHST */
+static const unsigned long JCHSTtbl[2][7] = {
+	{0x0E, 0x05, 0x02, 0x03, 0x02, 0x00, 0x00},	/* 100MHz */
+	{0x13, 0x07, 0x04, 0x04, 0x03, 0x00, 0x00}	/* 133MHz */
+};
+
+/* JCHHT */
+static const unsigned long JCHHTtbl[2][7] = {
+	{0x0E, 0x02, 0x02, 0x02, 0x02, 0x00, 0x00},	/* 100MHz */
+	{0x13, 0x03, 0x03, 0x03, 0x03, 0x00, 0x00}	/* 133MHz */
+};
+
+/* JCHCT */
+static const unsigned long JCHCTtbl[2][7] = {
+	{0x1D, 0x1D, 0x1C, 0x0B, 0x06, 0x00, 0x00},	/* 100MHz */
+	{0x27, 0x26, 0x26, 0x0E, 0x09, 0x00, 0x00}	/* 133MHz */
+};
+
+/* DMA transfer mode  table */
+/* JCHDCTM/JCHDCTS */
+static const unsigned long JCHDCTxtbl[2][7] = {
+	{0x0A, 0x06, 0x04, 0x03, 0x01, 0x00, 0x00},	/* 100MHz */
+	{0x0E, 0x09, 0x06, 0x04, 0x02, 0x01, 0x00}	/* 133MHz */
+};
+
+/* JCSTWTM/JCSTWTS  */
+static const unsigned long JCSTWTxtbl[2][7] = {
+	{0x06, 0x04, 0x03, 0x02, 0x02, 0x02, 0x00},	/* 100MHz */
+	{0x09, 0x06, 0x04, 0x02, 0x02, 0x02, 0x02}	/* 133MHz */
+};
+
+/* JCTSS */
+static const unsigned long JCTSStbl[2][7] = {
+	{0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x00},	/* 100MHz */
+	{0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05}	/* 133MHz */
+};
+
+/* JCENVT */
+static const unsigned long JCENVTtbl[2][7] = {
+	{0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00},	/* 100MHz */
+	{0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02}	/* 133MHz */
+};
+
+/* JCACTSELS/JCACTSELM */
+static const unsigned long JCACTSELtbl[2][7] = {
+	{0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00},	/* 100MHz */
+	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01}	/* 133MHz */
+};
+
+static const struct pci_device_id scc_pci_tbl[] = {
+	{PCI_VENDOR_ID_TOSHIBA_2, PCI_DEVICE_ID_TOSHIBA_SCC_ATA,
+	 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
+	{ }	/* terminate list */
+};
+
+/**
+ *	scc_set_piomode - Initialize host controller PATA PIO timings
+ *	@ap: Port whose timings we are configuring
+ *	@adev: um
+ *
+ *	Set PIO mode for device.
+ *
+ *	LOCKING:
+ *	None (inherited from caller).
+ */
+
+static void scc_set_piomode (struct ata_port *ap, struct ata_device *adev)
+{
+	unsigned int pio = adev->pio_mode - XFER_PIO_0;
+	struct scc_ports *ports = ap->host->private_data;
+	void __iomem *cckctrl_port = ports->ctl_base + SCC_CTL_CCKCTRL;
+	void __iomem *piosht_port = ports->ctl_base + SCC_CTL_PIOSHT;
+	void __iomem *pioct_port = ports->ctl_base + SCC_CTL_PIOCT;
+	unsigned long reg;
+	int offset;
+
+	reg = in_be32(cckctrl_port);
+	if (reg & CCKCTRL_ATACLKOEN)
+		offset = 1;	/* 133MHz */
+	else
+		offset = 0;	/* 100MHz */
+
+	reg = JCHSTtbl[offset][pio] << 16 | JCHHTtbl[offset][pio];
+	out_be32(piosht_port, reg);
+	reg = JCHCTtbl[offset][pio];
+	out_be32(pioct_port, reg);
+}
+
+/**
+ *	scc_set_dmamode - Initialize host controller PATA DMA timings
+ *	@ap: Port whose timings we are configuring
+ *	@adev: um
+ *	@udma: udma mode, 0 - 6
+ *
+ *	Set UDMA mode for device.
+ *
+ *	LOCKING:
+ *	None (inherited from caller).
+ */
+
+static void scc_set_dmamode (struct ata_port *ap, struct ata_device *adev)
+{
+	unsigned int udma = adev->dma_mode;
+	unsigned int is_slave = (adev->devno != 0);
+	u8 speed = udma;
+	struct scc_ports *ports = ap->host->private_data;
+	void __iomem *cckctrl_port = ports->ctl_base + SCC_CTL_CCKCTRL;
+	void __iomem *mdmact_port = ports->ctl_base + SCC_CTL_MDMACT;
+	void __iomem *mcrcst_port = ports->ctl_base + SCC_CTL_MCRCST;
+	void __iomem *sdmact_port = ports->ctl_base + SCC_CTL_SDMACT;
+	void __iomem *scrcst_port = ports->ctl_base + SCC_CTL_SCRCST;
+	void __iomem *udenvt_port = ports->ctl_base + SCC_CTL_UDENVT;
+	void __iomem *tdvhsel_port = ports->ctl_base + SCC_CTL_TDVHSEL;
+	int offset, idx;
+
+	if (in_be32(cckctrl_port) & CCKCTRL_ATACLKOEN) 
+		offset = 1;	/* 133MHz */
+	else
+		offset = 0;	/* 100MHz */
+
+	if (speed >= XFER_UDMA_0)
+		idx = speed - XFER_UDMA_0;
+	else
+		return;
+
+	if (is_slave) {
+		out_be32(sdmact_port, JCHDCTxtbl[offset][idx]);
+		out_be32(scrcst_port, JCSTWTxtbl[offset][idx]);
+		out_be32(tdvhsel_port,
+			 (in_be32(tdvhsel_port) & ~TDVHSEL_SLAVE) | (JCACTSELtbl[offset][idx] << 2));
+	} else {
+		out_be32(mdmact_port, JCHDCTxtbl[offset][idx]);
+		out_be32(mcrcst_port, JCSTWTxtbl[offset][idx]);
+		out_be32(tdvhsel_port,
+			 (in_be32(tdvhsel_port) & ~TDVHSEL_MASTER) | JCACTSELtbl[offset][idx]);
+	}
+	out_be32(udenvt_port,
+		 JCTSStbl[offset][idx] << 16 | JCENVTtbl[offset][idx]);
+}
+
+/**
+ *	scc_tf_load - send taskfile registers to host controller
+ *	@ap: Port to which output is sent
+ *	@tf: ATA taskfile register set
+ *
+ *	Note: Original code is ata_tf_load_pio().
+ */
+
+static void scc_tf_load (struct ata_port *ap, const struct ata_taskfile *tf)
+{
+	struct ata_ioports *ioaddr = &ap->ioaddr;
+	unsigned int is_addr = tf->flags & ATA_TFLAG_ISADDR;
+
+	if (tf->ctl != ap->last_ctl) {
+		out_be32((void __iomem *)ap->ioaddr.ctl_addr, tf->ctl);
+		ap->last_ctl = tf->ctl;
+		ata_wait_idle(ap);
+	}
+
+	if (is_addr && (tf->flags & ATA_TFLAG_LBA48)) {
+		out_be32((void __iomem *)ioaddr->feature_addr, tf->hob_feature);
+		out_be32((void __iomem *)ioaddr->nsect_addr, tf->hob_nsect);
+		out_be32((void __iomem *)ioaddr->lbal_addr, tf->hob_lbal);
+		out_be32((void __iomem *)ioaddr->lbam_addr, tf->hob_lbam);
+		out_be32((void __iomem *)ioaddr->lbah_addr, tf->hob_lbah);
+		VPRINTK("hob: feat 0x%X nsect 0x%X, lba 0x%X 0x%X 0x%X\n",
+			tf->hob_feature,
+			tf->hob_nsect,
+			tf->hob_lbal,
+			tf->hob_lbam,
+			tf->hob_lbah);
+	}
+
+	if (is_addr) {
+		out_be32((void __iomem *)ioaddr->feature_addr, tf->feature);
+		out_be32((void __iomem *)ioaddr->nsect_addr, tf->nsect);
+		out_be32((void __iomem *)ioaddr->lbal_addr, tf->lbal);
+		out_be32((void __iomem *)ioaddr->lbam_addr, tf->lbam);
+		out_be32((void __iomem *)ioaddr->lbah_addr, tf->lbah);
+		VPRINTK("feat 0x%X nsect 0x%X lba 0x%X 0x%X 0x%X\n",
+			tf->feature,
+			tf->nsect,
+			tf->lbal,
+			tf->lbam,
+			tf->lbah);
+	}
+
+	if (tf->flags & ATA_TFLAG_DEVICE) {
+		out_be32((void __iomem *)ioaddr->device_addr, tf->device);
+		VPRINTK("device 0x%X\n", tf->device);
+	}
+
+	ata_wait_idle(ap);
+}
+
+/**
+ *	scc_check_status - Read device status reg & clear interrupt
+ *	@ap: port where the device is
+ *
+ *	Note: Original code is ata_check_status_pio().
+ */
+
+static u8 scc_check_status (struct ata_port *ap)
+{
+	return in_be32((void __iomem *)ap->ioaddr.status_addr);
+}
+
+/**
+ *	scc_tf_read - input device's ATA taskfile shadow registers
+ *	@ap: Port from which input is read
+ *	@tf: ATA taskfile register set for storing input
+ *
+ *	Note: Original code is ata_tf_read_pio().
+ */
+
+static void scc_tf_read (struct ata_port *ap, struct ata_taskfile *tf)
+{
+	struct ata_ioports *ioaddr = &ap->ioaddr;
+
+	tf->command = scc_check_status(ap);
+	tf->feature = in_be32((void __iomem *)ioaddr->error_addr);
+	tf->nsect = in_be32((void __iomem *)ioaddr->nsect_addr);
+	tf->lbal = in_be32((void __iomem *)ioaddr->lbal_addr);
+	tf->lbam = in_be32((void __iomem *)ioaddr->lbam_addr);
+	tf->lbah = in_be32((void __iomem *)ioaddr->lbah_addr);
+	tf->device = in_be32((void __iomem *)ioaddr->device_addr);
+
+	if (tf->flags & ATA_TFLAG_LBA48) {
+		out_be32((void __iomem *)ap->ioaddr.ctl_addr, tf->ctl | ATA_HOB);
+		tf->hob_feature = in_be32((void __iomem *)ioaddr->error_addr);
+		tf->hob_nsect = in_be32((void __iomem *)ioaddr->nsect_addr);
+		tf->hob_lbal = in_be32((void __iomem *)ioaddr->lbal_addr);
+		tf->hob_lbam = in_be32((void __iomem *)ioaddr->lbam_addr);
+		tf->hob_lbah = in_be32((void __iomem *)ioaddr->lbah_addr);
+	}
+}
+
+/**
+ *	scc_exec_command - issue ATA command to host controller
+ *	@ap: port to which command is being issued
+ *	@tf: ATA taskfile register set
+ *
+ *	Note: Original code is ata_exec_command_pio().
+ */
+
+static void scc_exec_command (struct ata_port *ap,
+			      const struct ata_taskfile *tf)
+{
+	DPRINTK("ata%u: cmd 0x%X\n", ap->id, tf->command);
+
+	out_be32((void __iomem *)ap->ioaddr.command_addr, tf->command);
+	ata_pause(ap);
+}
+
+/**
+ *	scc_check_altstatus - Read device alternate status reg
+ *	@ap: port where the device is
+ */
+
+static u8 scc_check_altstatus (struct ata_port *ap)
+{
+	return in_be32((void __iomem *)ap->ioaddr.altstatus_addr);
+}
+
+/**
+ *	scc_std_dev_select - Select device 0/1 on ATA bus
+ *	@ap: ATA channel to manipulate
+ *	@device: ATA device (numbered from zero) to select
+ *
+ *	Note: Original code is ata_std_dev_select().
+ */
+
+static void scc_std_dev_select (struct ata_port *ap, unsigned int device)
+{
+	u8 tmp;
+
+	if (device == 0)
+		tmp = ATA_DEVICE_OBS;
+	else
+		tmp = ATA_DEVICE_OBS | ATA_DEV1;
+
+	out_be32((void __iomem *)ap->ioaddr.device_addr, tmp);
+	ata_pause(ap);
+}
+
+/**
+ *	scc_bmdma_setup - Set up PCI IDE BMDMA transaction
+ *	@qc: Info associated with this ATA transaction.
+ *
+ *	Note: Original code is ata_bmdma_setup_pio().
+ */
+
+static void scc_bmdma_setup (struct ata_queued_cmd *qc)
+{
+	struct ata_port *ap = qc->ap;
+	unsigned int rw = (qc->tf.flags & ATA_TFLAG_WRITE);
+	u8 dmactl;
+	void __iomem *mmio = (void __iomem *) ap->ioaddr.bmdma_addr;
+
+	/* load PRD table addr */
+	out_be32(mmio + SCC_DMA_TABLE_OFS, ap->prd_dma);
+
+	/* specify data direction, triple-check start bit is clear */
+	dmactl = in_be32(mmio + SCC_DMA_CMD);
+	dmactl &= ~(ATA_DMA_WR | ATA_DMA_START);
+	if (!rw)
+		dmactl |= ATA_DMA_WR;
+	out_be32(mmio + SCC_DMA_CMD, dmactl);
+
+	/* issue r/w command */
+	ap->ops->exec_command(ap, &qc->tf);
+}
+
+/**
+ *	scc_bmdma_start - Start a PCI IDE BMDMA transaction
+ *	@qc: Info associated with this ATA transaction.
+ *
+ *	Note: Original code is ata_bmdma_start_pio().
+ */
+
+static void scc_bmdma_start (struct ata_queued_cmd *qc)
+{
+	struct ata_port *ap = qc->ap;
+	u8 dmactl;
+	void __iomem *mmio = (void __iomem *) ap->ioaddr.bmdma_addr;
+
+	/* start host DMA transaction */
+	dmactl = in_be32(mmio + SCC_DMA_CMD);
+	out_be32(mmio + SCC_DMA_CMD, dmactl | ATA_DMA_START);
+}
+
+/**
+ *	scc_devchk - PATA device presence detection
+ *	@ap: ATA channel to examine
+ *	@device: Device to examine (starting at zero)
+ *
+ *	Note: Original code is ata_pio_devchk().
+ */
+
+static unsigned int scc_devchk (struct ata_port *ap,
+				unsigned int device)
+{
+	struct ata_ioports *ioaddr = &ap->ioaddr;
+	u8 nsect, lbal;
+
+	ap->ops->dev_select(ap, device);
+
+	out_be32((void __iomem *)ioaddr->nsect_addr, 0x55);
+	out_be32((void __iomem *)ioaddr->lbal_addr, 0xaa);
+
+	out_be32((void __iomem *)ioaddr->nsect_addr, 0xaa);
+	out_be32((void __iomem *)ioaddr->lbal_addr, 0x55);
+
+	out_be32((void __iomem *)ioaddr->nsect_addr, 0x55);
+	out_be32((void __iomem *)ioaddr->lbal_addr, 0xaa);
+
+	nsect = in_be32((void __iomem *)ioaddr->nsect_addr);
+	lbal = in_be32((void __iomem *)ioaddr->lbal_addr);
+
+	if ((nsect == 0x55) && (lbal == 0xaa))
+		return 1;	/* we found a device */
+
+	return 0;		/* nothing found */
+}
+
+/**
+ *	scc_bus_post_reset - PATA device post reset
+ *
+ *	Note: Original code is ata_bus_post_reset().
+ */
+
+static void scc_bus_post_reset (struct ata_port *ap, unsigned int devmask)
+{
+	struct ata_ioports *ioaddr = &ap->ioaddr;
+	unsigned int dev0 = devmask & (1 << 0);
+	unsigned int dev1 = devmask & (1 << 1);
+	unsigned long timeout;
+
+	/* if device 0 was found in ata_devchk, wait for its
+	 * BSY bit to clear
+	 */
+	if (dev0)
+		ata_busy_sleep(ap, ATA_TMOUT_BOOT_QUICK, ATA_TMOUT_BOOT);
+
+	/* if device 1 was found in ata_devchk, wait for
+	 * register access, then wait for BSY to clear
+	 */
+	timeout = jiffies + ATA_TMOUT_BOOT;
+	while (dev1) {
+		u8 nsect, lbal;
+
+		ap->ops->dev_select(ap, 1);
+		nsect = in_be32((void __iomem *)ioaddr->nsect_addr);
+		lbal = in_be32((void __iomem *)ioaddr->lbal_addr);
+		if ((nsect == 1) && (lbal == 1))
+			break;
+		if (time_after(jiffies, timeout)) {
+			dev1 = 0;
+			break;
+		}
+		msleep(50);	/* give drive a breather */
+	}
+	if (dev1)
+		ata_busy_sleep(ap, ATA_TMOUT_BOOT_QUICK, ATA_TMOUT_BOOT);
+
+	/* is all this really necessary? */
+	ap->ops->dev_select(ap, 0);
+	if (dev1)
+		ap->ops->dev_select(ap, 1);
+	if (dev0)
+		ap->ops->dev_select(ap, 0);
+}
+
+/**
+ *	scc_bus_softreset - PATA device software reset
+ *
+ *	Note: Original code is ata_bus_softreset().
+ */
+
+static unsigned int scc_bus_softreset (struct ata_port *ap,
+				       unsigned int devmask)
+{
+	struct ata_ioports *ioaddr = &ap->ioaddr;
+
+	DPRINTK("ata%u: bus reset via SRST\n", ap->id);
+
+	/* software reset.  causes dev0 to be selected */
+	out_be32((void __iomem *)ioaddr->ctl_addr, ap->ctl);
+	udelay(10);
+	out_be32((void __iomem *)ioaddr->ctl_addr, ap->ctl | ATA_SRST);
+	udelay(10);
+	out_be32((void __iomem *)ioaddr->ctl_addr, ap->ctl);
+
+	/* spec mandates ">= 2ms" before checking status.
+	 * We wait 150ms, because that was the magic delay used for
+	 * ATAPI devices in Hale Landis's ATADRVR, for the period of time
+	 * between when the ATA command register is written, and then
+	 * status is checked.  Because waiting for "a while" before
+	 * checking status is fine, post SRST, we perform this magic
+	 * delay here as well.
+	 *
+	 * Old drivers/ide uses the 2mS rule and then waits for ready
+	 */
+	msleep(150);
+
+	/* Before we perform post reset processing we want to see if
+	 * the bus shows 0xFF because the odd clown forgets the D7
+	 * pulldown resistor.
+	 */
+	if (scc_check_status(ap) == 0xFF)
+		return 0;
+
+	scc_bus_post_reset(ap, devmask);
+
+	return 0;
+}
+
+/**
+ *	scc_std_softreset - reset host port via ATA SRST
+ *	@ap: port to reset
+ *	@classes: resulting classes of attached devices
+ *
+ *	Note: Original code is ata_std_softreset().
+ */
+
+static int scc_std_softreset (struct ata_port *ap, unsigned int *classes)
+{
+	unsigned int slave_possible = ap->flags & ATA_FLAG_SLAVE_POSS;
+	unsigned int devmask = 0, err_mask;
+	u8 err;
+
+	DPRINTK("ENTER\n");
+
+	if (ata_port_offline(ap)) {
+		classes[0] = ATA_DEV_NONE;
+		goto out;
+	}
+
+	/* determine if device 0/1 are present */
+	if (scc_devchk(ap, 0))
+		devmask |= (1 << 0);
+	if (slave_possible && scc_devchk(ap, 1))
+		devmask |= (1 << 1);
+
+	/* select device 0 again */
+	ap->ops->dev_select(ap, 0);
+
+	/* issue bus reset */
+	DPRINTK("about to softreset, devmask=%x\n", devmask);
+	err_mask = scc_bus_softreset(ap, devmask);
+	if (err_mask) {
+		ata_port_printk(ap, KERN_ERR, "SRST failed (err_mask=0x%x)\n",
+				err_mask);
+		return -EIO;
+	}
+
+	/* determine by signature whether we have ATA or ATAPI devices */
+	classes[0] = ata_dev_try_classify(ap, 0, &err);
+	if (slave_possible && err != 0x81)
+		classes[1] = ata_dev_try_classify(ap, 1, &err);
+
+ out:
+	DPRINTK("EXIT, classes[0]=%u [1]=%u\n", classes[0], classes[1]);
+	return 0;
+}
+
+/**
+ *	scc_bmdma_stop - Stop PCI IDE BMDMA transfer
+ *	@qc: Command we are ending DMA for
+ *
+ *	Note: Original code is ata_bmdma_stop().
+ */
+
+static void scc_bmdma_stop (struct ata_queued_cmd *qc)
+{
+	struct ata_port *ap = qc->ap;
+	struct scc_ports *ports = ap->host->private_data;
+	u32 reg;
+
+	while (1) {
+		reg = in_be32(ports->dma_base + SCC_DMA_INTST);
+
+		if (reg & INTSTS_SERROR) {
+			printk(KERN_WARNING "%s: SERROR\n", DRV_NAME);
+			out_be32(ports->dma_base + SCC_DMA_INTST, INTSTS_SERROR|INTSTS_BMSINT);
+			out_be32(ports->dma_base + SCC_DMA_CMD,
+				 in_be32(ports->dma_base + SCC_DMA_CMD) & ~ATA_DMA_START);
+			continue;
+		}
+
+		if (reg & INTSTS_PRERR) {
+			u32 maea0, maec0;
+			maea0 = in_be32(ports->ctl_base + SCC_CTL_MAEA0);
+			maec0 = in_be32(ports->ctl_base + SCC_CTL_MAEC0);
+			printk(KERN_WARNING "%s: PRERR [addr:%x cmd:%x]\n", DRV_NAME, maea0, maec0);
+			out_be32(ports->dma_base + SCC_DMA_INTST, INTSTS_PRERR|INTSTS_BMSINT);
+			out_be32(ports->dma_base + SCC_DMA_CMD,
+				 in_be32(ports->dma_base + SCC_DMA_CMD) & ~ATA_DMA_START);
+			continue;
+		}
+
+		if (reg & INTSTS_RERR) {
+			printk(KERN_WARNING "%s: Response Error\n", DRV_NAME);
+			out_be32(ports->dma_base + SCC_DMA_INTST, INTSTS_RERR|INTSTS_BMSINT);
+			out_be32(ports->dma_base + SCC_DMA_CMD,
+				 in_be32(ports->dma_base + SCC_DMA_CMD) & ~ATA_DMA_START);
+			continue;
+		}
+
+		if (reg & INTSTS_ICERR) {
+			out_be32(ports->dma_base + SCC_DMA_CMD,
+				 in_be32(ports->dma_base + SCC_DMA_CMD) & ~ATA_DMA_START);
+			printk(KERN_WARNING "%s: Illegal Configuration\n", DRV_NAME);
+			out_be32(ports->dma_base + SCC_DMA_INTST, INTSTS_ICERR|INTSTS_BMSINT);
+			continue;
+		}
+
+		if (reg & INTSTS_BMSINT) {
+			unsigned int classes;
+			printk(KERN_WARNING "%s: Internal Bus Error\n", DRV_NAME);
+			out_be32(ports->dma_base + SCC_DMA_INTST, INTSTS_BMSINT);
+			/* TBD: SW reset */
+			scc_std_softreset(ap, &classes);
+			continue;
+		}
+
+		if (reg & INTSTS_BMHE) {
+			out_be32(ports->dma_base + SCC_DMA_INTST, INTSTS_BMHE);
+			continue;
+		}
+
+		if (reg & INTSTS_ACTEINT) {
+			out_be32(ports->dma_base + SCC_DMA_INTST, INTSTS_ACTEINT);
+			continue;
+		}
+
+		if (reg & INTSTS_IOIRQS) {
+			out_be32(ports->dma_base + SCC_DMA_INTST, INTSTS_IOIRQS);
+			continue;
+		}
+		break;
+	}
+
+	/* clear start/stop bit */
+	out_be32(ports->dma_base + SCC_DMA_CMD,
+		 in_be32(ports->dma_base + SCC_DMA_CMD) & ~ATA_DMA_START);
+
+	/* one-PIO-cycle guaranteed wait, per spec, for HDMA1:0 transition */
+	ata_altstatus(ap);	/* dummy read */
+}
+
+/**
+ *	scc_bmdma_status - Read PCI IDE BMDMA status
+ *	@ap: Port associated with this ATA transaction.
+ *
+ *	Note: Original code is ata_bmdma_status().
+ */
+
+static u8 scc_bmdma_status (struct ata_port *ap)
+{
+	u8 host_stat;
+	void __iomem *mmio = (void __iomem *) ap->ioaddr.bmdma_addr;
+
+	host_stat = in_be32(mmio + SCC_DMA_STATUS);
+	return host_stat;
+}
+
+/**
+ *	scc_data_xfer - Transfer data by MMIO
+ *	@adev: device for this I/O
+ *	@buf: data buffer
+ *	@buflen: buffer length
+ *	@write_data: read/write
+ *
+ *	Note: Original code is ata_mmio_data_xfer().
+ */
+
+static void scc_data_xfer (struct ata_device *adev, unsigned char *buf,
+			   unsigned int buflen, int write_data)
+{
+	struct ata_port *ap = adev->ap;
+	unsigned int i;
+	unsigned int words = buflen >> 1;
+	u16 *buf16 = (u16 *) buf;
+	void __iomem *mmio = (void __iomem *) ap->ioaddr.data_addr;
+
+	/* Transfer multiple of 2 bytes */
+	if (write_data) {
+		for (i = 0; i < words; i++)
+			out_be32(mmio, cpu_to_le16(buf16[i]));
+	} else {
+		for (i = 0; i < words; i++)
+			buf16[i] = le16_to_cpu(in_be32(mmio));
+	}
+
+	/* Transfer trailing 1 byte, if any. */
+	if (unlikely(buflen & 0x01)) {
+		u16 align_buf[1] = { 0 };
+		unsigned char *trailing_buf = buf + buflen - 1;
+
+		if (write_data) {
+			memcpy(align_buf, trailing_buf, 1);
+			out_be32(mmio, cpu_to_le16(align_buf[0]));
+		} else {
+			align_buf[0] = le16_to_cpu(in_be32(mmio));
+			memcpy(trailing_buf, align_buf, 1);
+		}
+	}
+}
+
+/**
+ *	scc_irq_on - Enable interrupts on a port.
+ *	@ap: Port on which interrupts are enabled.
+ *
+ *	Note: Original code is ata_irq_on().
+ */
+
+static inline u8 scc_irq_on (struct ata_port *ap)
+{
+	struct ata_ioports *ioaddr = &ap->ioaddr;
+	u8 tmp;
+
+	ap->ctl &= ~ATA_NIEN;
+	ap->last_ctl = ap->ctl;
+
+	out_be32((void __iomem *)ioaddr->ctl_addr, ap->ctl);
+	tmp = ata_wait_idle(ap);
+
+	ap->ops->irq_clear(ap);
+
+	return tmp;
+}
+
+/**
+ *	scc_irq_ack - Acknowledge a device interrupt.
+ *	@ap: Port on which interrupts are enabled.
+ *
+ *	Note: Original code is ata_irq_ack().
+ */
+
+static inline u8 scc_irq_ack (struct ata_port *ap, unsigned int chk_drq)
+{
+	unsigned int bits = chk_drq ? ATA_BUSY | ATA_DRQ : ATA_BUSY;
+	u8 host_stat, post_stat, status;
+
+	status = ata_busy_wait(ap, bits, 1000);
+	if (status & bits)
+		if (ata_msg_err(ap))
+			printk(KERN_ERR "abnormal status 0x%X\n", status);
+
+	/* get controller status; clear intr, err bits */
+	host_stat = in_be32((void __iomem *)ap->ioaddr.bmdma_addr + SCC_DMA_STATUS);
+	out_be32((void __iomem *)ap->ioaddr.bmdma_addr + SCC_DMA_STATUS, host_stat | ATA_DMA_INTR | ATA_DMA_ERR);
+
+	post_stat = in_be32((void __iomem *)ap->ioaddr.bmdma_addr + SCC_DMA_STATUS);
+
+	if (ata_msg_intr(ap))
+		printk(KERN_INFO "%s: irq ack: host_stat 0x%X, new host_stat 0x%X, drv_stat 0x%X\n",
+		       __FUNCTION__,
+		       host_stat, post_stat, status);
+
+	return status;
+}
+
+/**
+ *	scc_bmdma_freeze - Freeze BMDMA controller port
+ *	@ap: port to freeze
+ *
+ *	Note: Original code is ata_bmdma_freeze().
+ */
+
+static void scc_bmdma_freeze (struct ata_port *ap)
+{
+	struct ata_ioports *ioaddr = &ap->ioaddr;
+
+	ap->ctl |= ATA_NIEN;
+	ap->last_ctl = ap->ctl;
+
+	out_be32((void __iomem *)ioaddr->ctl_addr, ap->ctl);
+}
+
+/**
+ *	scc_pata_prereset - prepare for reset
+ *	@ap: ATA port to be reset
+ *
+ */
+
+static int scc_pata_prereset (struct ata_port *ap)
+{
+	ap->cbl = ATA_CBL_PATA80;
+	return ata_std_prereset(ap);
+}
+
+/**
+ *	scc_std_postreset - standard postreset callback
+ *	@ap: the target ata_port
+ *	@classes: classes of attached devices
+ *
+ *	Note: Original code is ata_std_postreset().
+ */
+
+static void scc_std_postreset (struct ata_port *ap, unsigned int *classes)
+{
+	DPRINTK("ENTER\n");
+
+	/* re-enable interrupts */
+	if (!ap->ops->error_handler)
+		ap->ops->irq_on(ap);
+
+	/* is double-select really necessary? */
+	if (classes[0] != ATA_DEV_NONE)
+		ap->ops->dev_select(ap, 1);
+	if (classes[1] != ATA_DEV_NONE)
+		ap->ops->dev_select(ap, 0);
+
+	/* bail out if no device is present */
+	if (classes[0] == ATA_DEV_NONE && classes[1] == ATA_DEV_NONE) {
+		DPRINTK("EXIT, no device\n");
+		return;
+	}
+
+	/* set up device control */
+	if (ap->ioaddr.ctl_addr)
+		out_be32((void __iomem *) ap->ioaddr.ctl_addr, ap->ctl);
+
+	DPRINTK("EXIT\n");
+}
+
+/**
+ *	scc_error_handler - Stock error handler for BMDMA controller
+ *	@ap: port to handle error for
+ *
+ */
+
+static void scc_error_handler (struct ata_port *ap)
+{
+	ata_bmdma_drive_eh(ap, scc_pata_prereset, scc_std_softreset, NULL,
+			   scc_std_postreset);
+}
+
+/**
+ *	scc_bmdma_irq_clear - Clear PCI IDE BMDMA interrupt.
+ *	@ap: Port associated with this ATA transaction.
+ *
+ *	Note: Original code is ata_bmdma_irq_clear().
+ */
+
+static void scc_bmdma_irq_clear (struct ata_port *ap)
+{
+	void __iomem *mmio = ((void __iomem *) ap->ioaddr.bmdma_addr) + SCC_DMA_STATUS;
+	if (!ap->ioaddr.bmdma_addr)
+		return;
+
+	out_be32(mmio, in_be32(mmio));
+}
+
+/**
+ *	scc_port_start - Set port up for dma.
+ *	@ap: Port to initialize
+ *
+ *	Allocate space for PRD table using ata_port_start().
+ *	Set PRD table address for PTERADD. (PRD Transfer End Read)
+ */
+
+static int scc_port_start (struct ata_port *ap)
+{
+	struct scc_ports *ports = ap->host->private_data;
+	int rc;
+
+	rc = ata_port_start(ap);
+	if (rc)
+		return rc;
+
+	out_be32(ports->dma_base + SCC_DMA_PTERADD, ap->prd_dma);
+	return 0;
+}
+
+/**
+ *	scc_port_stop - Undo scc_port_start()
+ *	@ap: Port to shut down
+ *
+ *	Reset PTERADD and Free the PRD table.
+ */
+
+static void scc_port_stop (struct ata_port *ap)
+{
+	struct scc_ports *ports = ap->host->private_data;
+
+	out_be32(ports->dma_base + SCC_DMA_PTERADD, 0);
+	ata_port_stop(ap);
+}
+
+/**
+ *	remove_mmio_scc - Free the private data
+ *	@pdev: pci_dev to shut down
+ */
+
+static void remove_mmio_scc (struct pci_dev *pdev)
+{
+	struct scc_ports *ports = pci_get_drvdata(pdev);
+	unsigned long ctl_addr = pci_resource_start(pdev, 0);
+	unsigned long dma_addr = pci_resource_start(pdev, 1);
+	unsigned long ctl_size = pci_resource_len(pdev, 0);
+	unsigned long dma_size = pci_resource_len(pdev, 1);
+
+	pci_set_drvdata(pdev, NULL);
+	iounmap(ports->dma_base);
+	iounmap(ports->ctl_base);
+	release_mem_region(dma_addr, dma_size);
+	release_mem_region(ctl_addr, ctl_size);
+}
+
+static void scc_host_stop (struct ata_host *host)
+{
+	struct scc_ports *ports = host->private_data;
+
+	ata_host_stop(host);
+	remove_mmio_scc(to_pci_dev(host->dev));
+	kfree(ports);
+}
+
+/**
+ *	scc_std_ports - initialize ioaddr with SCC PATA port offsets.
+ *	@ioaddr: IO address structure to be initialized
+ *
+ */
+
+static void scc_std_ports (struct ata_ioports *ioaddr)
+{
+	ioaddr->data_addr = ioaddr->cmd_addr + SCC_REG_DATA;
+	ioaddr->error_addr = ioaddr->cmd_addr + SCC_REG_ERR;
+	ioaddr->feature_addr = ioaddr->cmd_addr + SCC_REG_FEATURE;
+	ioaddr->nsect_addr = ioaddr->cmd_addr + SCC_REG_NSECT;
+	ioaddr->lbal_addr = ioaddr->cmd_addr + SCC_REG_LBAL;
+	ioaddr->lbam_addr = ioaddr->cmd_addr + SCC_REG_LBAM;
+	ioaddr->lbah_addr = ioaddr->cmd_addr + SCC_REG_LBAH;
+	ioaddr->device_addr = ioaddr->cmd_addr + SCC_REG_DEVICE;
+	ioaddr->status_addr = ioaddr->cmd_addr + SCC_REG_STATUS;
+	ioaddr->command_addr = ioaddr->cmd_addr + SCC_REG_CMD;
+}
+
+/**
+ *	scc_pci_init_native_mode - Initialize native-mode driver
+ *	@pdev:  pci device to be initialized
+ *	@port:  array[2] of pointers to port info structures.
+ *	@ports: bitmap of ports present
+ *
+ *	Note: Original code is ata_pci_init_native_mode().
+ */
+
+static struct ata_probe_ent *
+scc_pci_init_native_mode (struct pci_dev *pdev, struct ata_port_info **port,
+			  int ports)
+{
+	struct ata_probe_ent *probe_ent =
+		ata_probe_ent_alloc(pci_dev_to_dev(pdev), port[0]);
+	int p = 0;
+	unsigned long bmdma;
+	struct scc_ports *scc_port = pci_get_drvdata(pdev);
+
+	if (!probe_ent)
+		return NULL;
+
+	probe_ent->irq = pdev->irq;
+	probe_ent->irq_flags = IRQF_SHARED;
+
+	if (ports & ATA_PORT_PRIMARY) {
+		probe_ent->port[p].cmd_addr = (unsigned long)scc_port->dma_base + SCC_REG_CMD_ADDR;
+		probe_ent->port[p].altstatus_addr =
+			probe_ent->port[p].ctl_addr =
+			probe_ent->port[p].cmd_addr + SCC_REG_ALTSTATUS;
+		bmdma = (unsigned long)scc_port->dma_base;
+		if (bmdma)
+			probe_ent->port[p].bmdma_addr = bmdma;
+		scc_std_ports(&probe_ent->port[p]);
+		p++;
+	}
+
+	probe_ent->n_ports = p;
+	return probe_ent;
+}
+
+/**
+ *	scc_pci_init_one - Initialize/register PCI IDE host controller
+ *	@pdev: Controller to be initialized
+ *	@port_info: Information from low-level host driver
+ *	@n_ports: Number of ports attached to host controller
+ *
+ *	Note: Original code is ata_pci_init_one().
+ */
+
+static int scc_pci_init_one (struct pci_dev *pdev,
+			     struct ata_port_info **port_info,
+			     unsigned int n_ports)
+{
+	struct ata_probe_ent *probe_ent = NULL;
+	struct ata_port_info *port[2];
+	int rc;
+
+	DPRINTK("ENTER\n");
+
+	BUG_ON(n_ports < 1 || n_ports > 2);
+
+	port[0] = port_info[0];
+	if (n_ports > 1)
+		port[1] = port_info[1];
+	else
+		port[1] = port[0];
+
+	/* FIXME: Really for ATA it isn't safe because the device may be
+	   multi-purpose and we want to leave it alone if it was already
+	   enabled. Secondly for shared use as Arjan says we want refcounting
+
+	   Checking dev->is_enabled is insufficient as this is not set at
+	   boot for the primary video which is BIOS enabled
+	*/
+
+	rc = pci_enable_device(pdev);
+	if (rc)
+		return rc;
+
+	/* TODO: If we get no DMA mask we should fall back to PIO */
+	rc = pci_set_dma_mask(pdev, ATA_DMA_MASK);
+	if (rc)
+		goto err_out;
+	rc = pci_set_consistent_dma_mask(pdev, ATA_DMA_MASK);
+	if (rc)
+		goto err_out;
+
+	if (n_ports == 2)
+		probe_ent = scc_pci_init_native_mode(pdev, port, ATA_PORT_PRIMARY | ATA_PORT_SECONDARY);
+	else
+		probe_ent = scc_pci_init_native_mode(pdev, port, ATA_PORT_PRIMARY);
+
+	if (!probe_ent) {
+		rc = -ENOMEM;
+		goto err_out;
+	}
+
+	pci_set_master(pdev);
+
+	if (!ata_device_add(probe_ent)) {
+		rc = -ENODEV;
+		goto err_out_ent;
+	}
+
+	kfree(probe_ent);
+
+	return 0;
+
+err_out_ent:
+	kfree(probe_ent);
+err_out:
+	pci_disable_device(pdev);
+	return rc;
+}
+
+/**
+ *	setup_mmio_scc	-	map CTRL/BMID region
+ *	@pdev: PCI device we are configuring
+ *	@name: device name
+ */
+
+static int setup_mmio_scc (struct pci_dev *pdev, const char *name)
+{
+	unsigned long ctl_addr = pci_resource_start(pdev, 0);
+	unsigned long dma_addr = pci_resource_start(pdev, 1);
+	unsigned long ctl_size = pci_resource_len(pdev, 0);
+	unsigned long dma_size = pci_resource_len(pdev, 1);
+	struct scc_ports *scc_port;
+	void __iomem *ctl_base, *dma_base;
+
+	scc_port = (struct scc_ports*)kzalloc(sizeof(struct scc_ports), GFP_KERNEL);
+	if (!scc_port)
+		return -ENOMEM;
+
+	if (!request_mem_region(ctl_addr, ctl_size, name)) {
+		printk(KERN_WARNING "%s: IDE controller MMIO ports not available.\n", DRV_NAME);
+		goto fail_0;
+	}
+
+	if (!request_mem_region(dma_addr, dma_size, name)) {
+		printk(KERN_WARNING "%s: IDE controller MMIO ports not available.\n", DRV_NAME);
+		goto fail_1;
+	}
+
+	if ((ctl_base = ioremap(ctl_addr, ctl_size)) == NULL)
+		goto fail_2;
+
+	if ((dma_base = ioremap(dma_addr, dma_size)) == NULL)
+		goto fail_3;
+
+	pci_set_master(pdev);
+	scc_port->ctl_base = ctl_base;
+	scc_port->dma_base = dma_base;
+	pci_set_drvdata(pdev, (void *)scc_port);
+
+	return 0;
+
+fail_3:
+	iounmap(ctl_base);
+fail_2:
+	release_mem_region(dma_addr, dma_size);
+fail_1:
+	release_mem_region(ctl_addr, ctl_size);
+fail_0:
+	kfree(scc_port);
+	return -ENOMEM;
+}
+
+static struct scsi_host_template scc_sht = {
+	.module			= THIS_MODULE,
+	.name			= DRV_NAME,
+	.ioctl			= ata_scsi_ioctl,
+	.queuecommand		= ata_scsi_queuecmd,
+	.can_queue		= ATA_DEF_QUEUE,
+	.this_id		= ATA_SHT_THIS_ID,
+	.sg_tablesize		= LIBATA_MAX_PRD,
+	.cmd_per_lun		= ATA_SHT_CMD_PER_LUN,
+	.emulated		= ATA_SHT_EMULATED,
+	.use_clustering		= ATA_SHT_USE_CLUSTERING,
+	.proc_name		= DRV_NAME,
+	.dma_boundary		= ATA_DMA_BOUNDARY,
+	.slave_configure	= ata_scsi_slave_config,
+	.slave_destroy		= ata_scsi_slave_destroy,
+	.bios_param		= ata_std_bios_param,
+	.resume			= ata_scsi_device_resume,
+	.suspend		= ata_scsi_device_suspend,
+};
+
+static const struct ata_port_operations scc_pata_ops = {
+	.port_disable		= ata_port_disable,
+	.set_piomode		= scc_set_piomode,
+	.set_dmamode		= scc_set_dmamode,
+	.mode_filter		= ata_pci_default_filter,
+
+	.tf_load		= scc_tf_load,
+	.tf_read		= scc_tf_read,
+	.exec_command		= scc_exec_command,
+	.check_status		= scc_check_status,
+	.check_altstatus	= scc_check_altstatus,
+	.dev_select		= scc_std_dev_select,
+
+	.bmdma_setup		= scc_bmdma_setup,
+	.bmdma_start		= scc_bmdma_start,
+	.bmdma_stop		= scc_bmdma_stop,
+	.bmdma_status		= scc_bmdma_status,
+	.data_xfer		= scc_data_xfer,
+
+	.qc_prep		= ata_qc_prep,
+	.qc_issue		= ata_qc_issue_prot,
+
+	.freeze			= scc_bmdma_freeze,
+	.error_handler		= scc_error_handler,
+	.post_internal_cmd	= scc_bmdma_stop,
+
+	.irq_handler		= ata_interrupt,
+	.irq_clear		= scc_bmdma_irq_clear,
+	.irq_on			= scc_irq_on,
+	.irq_ack		= scc_irq_ack,
+
+	.port_start		= scc_port_start,
+	.port_stop		= scc_port_stop,
+	.host_stop		= scc_host_stop,
+};
+
+static struct ata_port_info scc_port_info[] = {
+	{
+		.sht		= &scc_sht,
+		.flags		= ATA_FLAG_SLAVE_POSS | ATA_FLAG_MMIO | ATA_FLAG_NO_LEGACY,
+		.pio_mask	= 0x1f,	/* pio0-4 */
+		.mwdma_mask	= 0x00,
+		.udma_mask	= ATA_UDMA6,
+		.port_ops	= &scc_pata_ops,
+	},
+};
+
+/**
+ *	scc_init_one - Register SCC PATA device with kernel services
+ *	@pdev: PCI device to register
+ *	@ent: Entry in scc_pci_tbl matching with @pdev
+ *
+ *	LOCKING:
+ *	Inherited from PCI layer (may sleep).
+ *
+ *	RETURNS:
+ *	Zero on success, or -ERRNO value.
+ */
+
+static int scc_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
+{
+	static int printed_version;
+	struct ata_port_info port_info[2];
+	struct ata_port_info *ppinfo[2] = { &port_info[0], &port_info[1] };
+	struct scc_ports *ports;
+	unsigned long port_flags;
+	int rc;
+	void __iomem *cckctrl_port, *intmask_port, *mode_port, *ecmode_port;
+	u32 reg = 0;
+
+	if (!printed_version++)
+		dev_printk(KERN_DEBUG, &pdev->dev,
+			   "version " DRV_VERSION "\n");
+
+	rc = setup_mmio_scc(pdev, DRV_NAME);
+	if (rc < 0)
+		return rc;
+
+	ports = pci_get_drvdata(pdev);
+	cckctrl_port = ports->ctl_base + SCC_CTL_CCKCTRL;
+	mode_port = ports->ctl_base + SCC_CTL_MODEREG;
+	ecmode_port = ports->ctl_base + SCC_CTL_ECMODE;
+	intmask_port = ports->dma_base + SCC_DMA_INTMASK;
+
+	/* controller initialization */
+	reg = 0;
+	out_be32(cckctrl_port, reg);
+	reg |= CCKCTRL_ATACLKOEN;
+	out_be32(cckctrl_port, reg);
+	reg |= CCKCTRL_LCLKEN | CCKCTRL_OCLKEN;
+	out_be32(cckctrl_port, reg);
+	reg |= CCKCTRL_CRST;
+	out_be32(cckctrl_port, reg);
+
+	for (;;) {
+		reg = in_be32(cckctrl_port);
+		if (reg & CCKCTRL_CRST)
+			break;
+		udelay(5000);
+	}
+
+	reg |= CCKCTRL_ATARESET;
+	out_be32(cckctrl_port, reg);
+	out_be32(ecmode_port, ECMODE_VALUE);
+	out_be32(mode_port, MODE_JCUSFEN);
+	out_be32(intmask_port, INTMASK_MSK);
+
+	if (in_be32(ports->dma_base + SCC_DMA_STATUS) & QCHSD_STPDIAG) {
+		printk(KERN_WARNING "%s: failed to detect 80c cable. (PDIAG# is high)\n", DRV_NAME);
+		remove_mmio_scc(pdev);
+		kfree(ports);
+		return -EIO;
+	}
+
+	port_info[0] = scc_port_info[ent->driver_data];
+	port_info[1] = scc_port_info[ent->driver_data];
+	port_info[0].private_data = ports;
+	port_info[1].private_data = ports;
+
+	port_flags = port_info[0].flags;
+
+	return scc_pci_init_one(pdev, ppinfo, 1);	/* n_ports must be 1 */
+}
+
+static struct pci_driver scc_pci_driver = {
+	.name			= DRV_NAME,
+	.id_table		= scc_pci_tbl,
+	.probe			= scc_init_one,
+	.remove			= ata_pci_remove_one,
+#ifdef CONFIG_PM
+	.suspend		= ata_pci_device_suspend,
+	.resume			= ata_pci_device_resume,
+#endif
+};
+
+static int __init scc_init (void)
+{
+	int rc;
+
+	DPRINTK("pci_register_driver\n");
+	rc = pci_register_driver(&scc_pci_driver);
+	if (rc)
+		return rc;
+
+	DPRINTK("done\n");
+	return 0;
+}
+
+static void __exit scc_exit (void)
+{
+	pci_unregister_driver(&scc_pci_driver);
+}
+
+module_init(scc_init);
+module_exit(scc_exit);
+
+MODULE_AUTHOR("Toshiba corp");
+MODULE_DESCRIPTION("SCSI low-level driver for Toshiba SCC PATA controller");
+MODULE_LICENSE("GPL");
+MODULE_DEVICE_TABLE(pci, scc_pci_tbl);
+MODULE_VERSION(DRV_VERSION);
diff -uprN -X linux-2.6.20-rc4/Documentation/dontdiff linux-2.6.20-rc4/include/linux/libata.h linux-2.6.20-rc4.mod/include/linux/libata.h
--- linux-2.6.20-rc4/include/linux/libata.h	2007-01-18 18:04:02.000000000 +0900
+++ linux-2.6.20-rc4.mod/include/linux/libata.h	2007-01-18 18:07:03.000000000 +0900
@@ -764,6 +764,9 @@ extern u32 ata_wait_register(void __iome
 			     unsigned long interval_msec,
 			     unsigned long timeout_msec);
 u8 ata_irq_on(struct ata_port *ap);
+unsigned int ata_dev_try_classify(struct ata_port *, unsigned int, u8 *);
+struct ata_probe_ent *ata_probe_ent_alloc(struct device *,
+					  const struct ata_port_info *);
 
 /*
  * Default driver ops implementations

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

* Re: [PATCH 2/4] libata-core.c: add another IRQ calls
       [not found]     ` <200701180055.l0I0tl6M021051@toshiba.co.jp>
  2007-01-18  1:29       ` [PATCH] driver/ata: PATA driver for Celleb Akira Iguchi
@ 2007-01-25  1:17       ` Jeff Garzik
       [not found]       ` <200701180129.l0I1TL48013407@toshiba.co.jp>
  2 siblings, 0 replies; 11+ messages in thread
From: Jeff Garzik @ 2007-01-25  1:17 UTC (permalink / raw)
  To: Akira Iguchi
  Cc: Mikael Pettersson, arnd, linuxppc-dev, linux-ide, paulus, alan

Akira Iguchi wrote:
>> The real benefits from identifying a common case is to inline
>> the code for it. So the fact that the common case is still a
>> full-blown function call here and not inline code means that
>> there's much less benefit from rewriting an indirect call as
>> an if/indirect/direct sequence.
> 
> According to your comment, this patch adds IRQ calls (irq_on, irq_ack)
> to each driver and always uses these indirect calls.
> 
> For irq_on, most drivers use ata_irq_on(). Some drivers
> (ahci.c, sata_sil24.c) use ata_dummy_irq_on() because they
> don't have either explicit or implicit assignment (ex: ata_pci_init_one)
> of ctl_addr.
> 
> For irq_ack, ata_irq_ack() is used.
> 
> Signed-off-by: Kou Ishizaki <kou.ishizaki@toshiba.co.jp>
> Signed-off-by: Akira Iguchi <akira2.iguchi@toshiba.co.jp>

very close to perfect :)

ahci and sata_sil24 need dummy functions for ->irq_ack().  As you can 
see, ata_irq_ack() is only used in debug situations, and it [the current 
code] is very wrong for ahci and sata_sil24.

Also, please split up the patch into two pieces:  (1) update core and 
headers, and (2) update every driver.


> diff -uprN -X linux-2.6.20-rc4/Documentation/dontdiff linux-2.6.20-rc4/include/linux/libata.h linux-2.6.20-rc4.mod/include/linux/libata.h
> --- linux-2.6.20-rc4/include/linux/libata.h	2007-01-17 23:23:27.000000000 +0900
> +++ linux-2.6.20-rc4.mod/include/linux/libata.h	2007-01-17 23:24:49.000000000 +0900
> @@ -638,6 +638,8 @@ struct ata_port_operations {
>  
>  	irq_handler_t irq_handler;
>  	void (*irq_clear) (struct ata_port *);
> +	u8 (*irq_on) (struct ata_port *);
> +	u8 (*irq_ack) (struct ata_port *ap, unsigned int chk_drq);
>  
>  	u32 (*scr_read) (struct ata_port *ap, unsigned int sc_reg);
>  	void (*scr_write) (struct ata_port *ap, unsigned int sc_reg,
> @@ -761,6 +763,7 @@ extern void ata_port_queue_task(struct a
>  extern u32 ata_wait_register(void __iomem *reg, u32 mask, u32 val,
>  			     unsigned long interval_msec,
>  			     unsigned long timeout_msec);
> +u8 ata_irq_on(struct ata_port *ap);
>  
>  /*
>   * Default driver ops implementations
> @@ -1202,6 +1205,8 @@ static inline u8 ata_irq_ack(struct ata_
>  	return status;
>  }
>  
> +static inline u8 ata_dummy_irq_on (struct ata_port *ap)	{ return 0; }
> +

This won't work, you need to create a non-inline function and 
EXPORT_SYMBOL_GPL it.

	Jeff

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

* Re: [PATCH] driver/ata: PATA driver for Celleb
       [not found]       ` <200701180129.l0I1TL48013407@toshiba.co.jp>
@ 2007-01-25  1:20         ` Jeff Garzik
  2007-01-25  3:45           ` Benjamin Herrenschmidt
  0 siblings, 1 reply; 11+ messages in thread
From: Jeff Garzik @ 2007-01-25  1:20 UTC (permalink / raw)
  To: Akira Iguchi
  Cc: Mikael Pettersson, arnd, linuxppc-dev, linux-ide, paulus, alan

Akira Iguchi wrote:
> This is the patch for PATA controller of Celleb.
> It depends on the previous "add another IRQ calls" patch.
> 
> Because this driver needs special taskfile accesses, there is
> a copy of ata_std_softreset(). ata_dev_try_classify() is exported
> so that it can be used in this function.
> 
> Signed-off-by: Kou Ishizaki <kou.ishizaki@toshiba.co.jp>
> Signed-off-by: Akira Iguchi <akira2.iguchi@toshiba.co.jp>

The driver looks OK, the only thing I wonder is:  can you use the iomap 
interface to eliminate the rest of the duplicated code?

See Tejun's latest patchset "[PATCHSET] Managed device resources, take 
#3" which completes the conversion of libata to using the lib/iomap.c 
interface.

	Jeff

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

* Re: [PATCH] driver/ata: PATA driver for Celleb
  2007-01-25  1:20         ` [PATCH] driver/ata: PATA driver for Celleb Jeff Garzik
@ 2007-01-25  3:45           ` Benjamin Herrenschmidt
  0 siblings, 0 replies; 11+ messages in thread
From: Benjamin Herrenschmidt @ 2007-01-25  3:45 UTC (permalink / raw)
  To: Jeff Garzik
  Cc: Mikael Pettersson, arnd, linuxppc-dev, linux-ide, paulus, alan

On Wed, 2007-01-24 at 20:20 -0500, Jeff Garzik wrote:
> Akira Iguchi wrote:
> > This is the patch for PATA controller of Celleb.
> > It depends on the previous "add another IRQ calls" patch.
> > 
> > Because this driver needs special taskfile accesses, there is
> > a copy of ata_std_softreset(). ata_dev_try_classify() is exported
> > so that it can be used in this function.
> > 
> > Signed-off-by: Kou Ishizaki <kou.ishizaki@toshiba.co.jp>
> > Signed-off-by: Akira Iguchi <akira2.iguchi@toshiba.co.jp>
> 
> The driver looks OK, the only thing I wonder is:  can you use the iomap 
> interface to eliminate the rest of the duplicated code?
> 
> See Tejun's latest patchset "[PATCHSET] Managed device resources, take 
> #3" which completes the conversion of libata to using the lib/iomap.c 
> interface.

That would be a bit nasty :-) The powerpc kernel can have any number of
platforms compiled into the same kernel. Some of the base things, like
PCI IOs, iomap, etc... are common to all platforms. In this case, what
they want is hook only accesses on one given device, one one given
platform (or rather, on all platforms using that device, which is even
worse, it's not even platform specific, at least not in theory).

While we do now provide a mecanism to add hooks to all PCI MMIO and IO
accessors (to workaround HW bugs on some chipsets), again, it would be a
a serious abuse to have a driver hook on that to change the access
method on a given device :-)

How much copied code remains ? I wonder if the accesses to nsect/lba for
example can be done using the taskfile accessors, possibly with a new
flag indicating to only read/write those 2 registers ?

Ben.

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

end of thread, other threads:[~2007-01-25  3:46 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-01-17  9:24 [PATCH 2/4] libata-core.c: add another IRQ calls Mikael Pettersson
2007-01-17 16:49 ` Jeff Garzik
2007-01-17 20:31   ` Mikael Pettersson
2007-01-18  0:55     ` Akira Iguchi
     [not found]     ` <200701180055.l0I0tl6M021051@toshiba.co.jp>
2007-01-18  1:29       ` [PATCH] driver/ata: PATA driver for Celleb Akira Iguchi
2007-01-25  1:17       ` [PATCH 2/4] libata-core.c: add another IRQ calls Jeff Garzik
     [not found]       ` <200701180129.l0I1TL48013407@toshiba.co.jp>
2007-01-25  1:20         ` [PATCH] driver/ata: PATA driver for Celleb Jeff Garzik
2007-01-25  3:45           ` Benjamin Herrenschmidt
     [not found] <200701161046.l0GAk5Go019691@toshiba.co.jp>
2007-01-16 12:03 ` [PATCH 2/4] libata-core.c: add another IRQ calls Alan
2007-01-16 22:04   ` Jeff Garzik
  -- strict thread matches above, loose matches on Subject: below --
2007-01-16 10:46 Akira Iguchi

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