From: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
To: linux-ide@vger.kernel.org
Cc: linux-kernel@vger.kernel.org,
Geert Uytterhoeven <geert@linux-m68k.org>,
Michael Schmitz <schmitz@debian.org>
Subject: [PATCH 5/5] falconide/q40ide: add ->atapi_*put_bytes and ->ata_*put_data methods
Date: Sun, 30 Mar 2008 17:14:04 +0200 [thread overview]
Message-ID: <200803301714.04527.bzolnier@gmail.com> (raw)
* Add ->atapi_{in,out}put_bytes and ->ata_{in,out}put_data methods to
falconide and q40ide host drivers (->ata_* methods are implemented on
top of ->atapi_* methods so they also do byte-swapping now).
* Cleanup atapi_{in,out}put_bytes().
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Michael Schmitz <schmitz@debian.org>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
---
PS one of future patches will merge ->atapi_ and ->ata_ methods for IDE
drivers/ide/ide-iops.c | 14 --------------
drivers/ide/legacy/falconide.c | 30 ++++++++++++++++++++++++++++++
drivers/ide/legacy/q40ide.c | 28 ++++++++++++++++++++++++++++
3 files changed, 58 insertions(+), 14 deletions(-)
Index: b/drivers/ide/ide-iops.c
===================================================================
--- a/drivers/ide/ide-iops.c
+++ b/drivers/ide/ide-iops.c
@@ -248,13 +248,6 @@ static void atapi_input_bytes(ide_drive_
ide_hwif_t *hwif = HWIF(drive);
++bytecount;
-#if defined(CONFIG_ATARI) || defined(CONFIG_Q40)
- if (MACH_IS_ATARI || MACH_IS_Q40) {
- /* Atari has a byte-swapped IDE interface */
- insw_swapw(hwif->io_ports.data_addr, buffer, bytecount / 2);
- return;
- }
-#endif /* CONFIG_ATARI || CONFIG_Q40 */
hwif->ata_input_data(drive, buffer, bytecount / 4);
if ((bytecount & 0x03) >= 2)
hwif->INSW(hwif->io_ports.data_addr,
@@ -266,13 +259,6 @@ static void atapi_output_bytes(ide_drive
ide_hwif_t *hwif = HWIF(drive);
++bytecount;
-#if defined(CONFIG_ATARI) || defined(CONFIG_Q40)
- if (MACH_IS_ATARI || MACH_IS_Q40) {
- /* Atari has a byte-swapped IDE interface */
- outsw_swapw(hwif->io_ports.data_addr, buffer, bytecount / 2);
- return;
- }
-#endif /* CONFIG_ATARI || CONFIG_Q40 */
hwif->ata_output_data(drive, buffer, bytecount / 4);
if ((bytecount & 0x03) >= 2)
hwif->OUTSW(hwif->io_ports.data_addr,
Index: b/drivers/ide/legacy/falconide.c
===================================================================
--- a/drivers/ide/legacy/falconide.c
+++ b/drivers/ide/legacy/falconide.c
@@ -44,6 +44,30 @@
int falconide_intr_lock;
EXPORT_SYMBOL(falconide_intr_lock);
+static void falconide_atapi_input_bytes(ide_drive_t *drive, void *buf,
+ unsigned int len)
+{
+ insw_swapw(drive->hwif->io_ports.data_addr, buf, (len + 1) / 2);
+}
+
+static void falconide_atapi_output_bytes(ide_drive_t *drive, void *buf,
+ unsigned int len)
+{
+ outsw_swapw(drive->hwif->io_ports.data_addr, buf, (len + 1) / 2);
+}
+
+static void falconide_ata_input_data(ide_drive_t *drive, void *buf,
+ unsigned int wcount)
+{
+ falconide_atapi_input_bytes(drive, buf, wcount * 4);
+}
+
+static void falconide_ata_output_data(ide_drive_t *drive, void *buf,
+ unsigned int wcount)
+{
+ falconide_atapi_output_bytes(drive, buf, wcount * 4);
+}
+
static void __init falconide_setup_ports(hw_regs_t *hw)
{
int i;
@@ -89,6 +113,12 @@ static int __init falconide_init(void)
ide_init_port_hw(hwif, &hw);
+ /* Atari has a byte-swapped IDE interface */
+ hwif->atapi_input_bytes = falconide_atapi_input_bytes;
+ hwif->atapi_output_bytes = falconide_atapi_output_bytes;
+ hwif->ata_input_data = falconide_ata_input_data;
+ hwif->ata_output_data = falconide_ata_output_data;
+
ide_get_lock(NULL, NULL);
ide_device_add(idx, NULL);
ide_release_lock();
Index: b/drivers/ide/legacy/q40ide.c
===================================================================
--- a/drivers/ide/legacy/q40ide.c
+++ b/drivers/ide/legacy/q40ide.c
@@ -90,7 +90,29 @@ void q40_ide_setup_ports ( hw_regs_t *hw
hw->ack_intr = ack_intr;
}
+static void q40ide_atapi_input_bytes(ide_drive_t *drive, void *buf,
+ unsigned int len)
+{
+ insw_swapw(drive->hwif->io_ports.data_addr, buf, (len + 1) / 2);
+}
+static void q40ide_atapi_output_bytes(ide_drive_t *drive, void *buf,
+ unsigned int len)
+{
+ outsw_swapw(drive->hwif->io_ports.data_addr, buf, (len + 1) / 2);
+}
+
+static void q40ide_ata_input_data(ide_drive_t *drive, void *buf,
+ unsigned int wcount)
+{
+ q40ide_atapi_input_bytes(drive, buf, wcount * 4);
+}
+
+static void q40ide_ata_output_data(ide_drive_t *drive, void *buf,
+ unsigned int wcount)
+{
+ q40ide_atapi_output_bytes(drive, buf, wcount * 4);
+}
/*
* the static array is needed to have the name reported in /proc/ioports,
@@ -141,6 +163,12 @@ static int __init q40ide_init(void)
if (hwif) {
ide_init_port_hw(hwif, &hw);
+ /* Q40 has a byte-swapped IDE interface */
+ hwif->atapi_input_bytes = q40ide_atapi_input_bytes;
+ hwif->atapi_output_bytes = q40ide_atapi_output_bytes;
+ hwif->ata_input_data = q40ide_ata_input_data;
+ hwif->ata_output_data = q40ide_ata_output_data;
+
idx[i] = hwif->index;
}
}
next reply other threads:[~2008-03-30 15:32 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-03-30 15:14 Bartlomiej Zolnierkiewicz [this message]
2008-03-30 18:18 ` [PATCH 5/5] falconide/q40ide: add ->atapi_*put_bytes and ->ata_*put_data methods Geert Uytterhoeven
2008-03-30 19:34 ` Bartlomiej Zolnierkiewicz
2008-03-31 5:53 ` Geert Uytterhoeven
2008-03-31 6:04 ` Geert Uytterhoeven
2008-03-31 9:37 ` Alan Cox
2008-04-07 19:13 ` Bartlomiej Zolnierkiewicz
2008-04-08 9:40 ` Richard Zidlicky
2008-04-09 1:40 ` Michael Schmitz
2008-04-09 18:13 ` Richard Zidlicky
2008-04-09 18:49 ` Bartlomiej Zolnierkiewicz
-- strict thread matches above, loose matches on Subject: below --
2008-03-31 21:41 Roman Zippel
2008-03-31 21:43 ` Alan Cox
2008-03-31 22:02 ` Roman Zippel
2008-04-01 3:20 ` Michael Schmitz
2008-04-01 8:12 ` Alan Cox
2008-04-01 8:32 ` Mikael Pettersson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200803301714.04527.bzolnier@gmail.com \
--to=bzolnier@gmail.com \
--cc=geert@linux-m68k.org \
--cc=linux-ide@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=schmitz@debian.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).