aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/legacy
diff options
context:
space:
mode:
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-04-28 17:44:36 -0400
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-04-28 17:44:36 -0400
commit92d3ab27e8fd23d1a9dc3b69d17b2afb83e5c6f5 (patch)
treee58076cb0102443dfe76401931a41931f97053cf /drivers/ide/legacy
parent284aa76b5339ce79d5ad2ac1c7cbf717082816a7 (diff)
falconide/q40ide: add ->atapi_*put_bytes and ->ata_*put_data methods (take 2)
* 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(). v2: * Add 'struct request *rq' argument to ->ata_{in,out}put_data methods and don't byte-swap disk fs requests (we shouldn't un-swap fs requests because fs itself is stored byte-swapped on the disk) - this is how things were done before the patch (ideally device mapper should be used instead but it would break existing setups and would have some performance impact). Cc: Geert Uytterhoeven <geert@linux-m68k.org> Cc: Michael Schmitz <schmitz@debian.org> Cc: Roman Zippel <zippel@linux-m68k.org> Cc: Alan Cox <alan@lxorguk.ukuu.org.uk> Cc: Richard Zidlicky <rz@linux-m68k.org> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide/legacy')
-rw-r--r--drivers/ide/legacy/falconide.c36
-rw-r--r--drivers/ide/legacy/q40ide.c34
2 files changed, 70 insertions, 0 deletions
diff --git a/drivers/ide/legacy/falconide.c b/drivers/ide/legacy/falconide.c
index 56cdaa0eeea5..32c044b17d45 100644
--- a/drivers/ide/legacy/falconide.c
+++ b/drivers/ide/legacy/falconide.c
@@ -44,6 +44,36 @@
44int falconide_intr_lock; 44int falconide_intr_lock;
45EXPORT_SYMBOL(falconide_intr_lock); 45EXPORT_SYMBOL(falconide_intr_lock);
46 46
47static void falconide_atapi_input_bytes(ide_drive_t *drive, void *buf,
48 unsigned int len)
49{
50 insw_swapw(drive->hwif->io_ports.data_addr, buf, (len + 1) / 2);
51}
52
53static void falconide_atapi_output_bytes(ide_drive_t *drive, void *buf,
54 unsigned int len)
55{
56 outsw_swapw(drive->hwif->io_ports.data_addr, buf, (len + 1) / 2);
57}
58
59static void falconide_ata_input_data(ide_drive_t *drive, struct request *rq,
60 void *buf, unsigned int wcount)
61{
62 if (drive->media == ide_disk && rq && rq->cmd_type == REQ_TYPE_FS)
63 return insw(drive->hwif->io_ports.data_addr, buf, wcount * 2);
64
65 falconide_atapi_input_bytes(drive, buf, wcount * 4);
66}
67
68static void falconide_ata_output_data(ide_drive_t *drive, struct request *rq,
69 void *buf, unsigned int wcount)
70{
71 if (drive->media == ide_disk && rq && rq->cmd_type == REQ_TYPE_FS)
72 return outsw(drive->hwif->io_ports.data_addr, buf, wcount * 2);
73
74 falconide_atapi_output_bytes(drive, buf, wcount * 4);
75}
76
47static void __init falconide_setup_ports(hw_regs_t *hw) 77static void __init falconide_setup_ports(hw_regs_t *hw)
48{ 78{
49 int i; 79 int i;
@@ -90,6 +120,12 @@ static int __init falconide_init(void)
90 ide_init_port_data(hwif, index); 120 ide_init_port_data(hwif, index);
91 ide_init_port_hw(hwif, &hw); 121 ide_init_port_hw(hwif, &hw);
92 122
123 /* Atari has a byte-swapped IDE interface */
124 hwif->atapi_input_bytes = falconide_atapi_input_bytes;
125 hwif->atapi_output_bytes = falconide_atapi_output_bytes;
126 hwif->ata_input_data = falconide_ata_input_data;
127 hwif->ata_output_data = falconide_ata_output_data;
128
93 ide_get_lock(NULL, NULL); 129 ide_get_lock(NULL, NULL);
94 ide_device_add(idx, NULL); 130 ide_device_add(idx, NULL);
95 ide_release_lock(); 131 ide_release_lock();
diff --git a/drivers/ide/legacy/q40ide.c b/drivers/ide/legacy/q40ide.c
index f9210458aea0..deae3d2ca65e 100644
--- a/drivers/ide/legacy/q40ide.c
+++ b/drivers/ide/legacy/q40ide.c
@@ -72,7 +72,35 @@ static void q40_ide_setup_ports(hw_regs_t *hw, unsigned long base,
72 hw->ack_intr = ack_intr; 72 hw->ack_intr = ack_intr;
73} 73}
74 74
75static void q40ide_atapi_input_bytes(ide_drive_t *drive, void *buf,
76 unsigned int len)
77{
78 insw_swapw(drive->hwif->io_ports.data_addr, buf, (len + 1) / 2);
79}
75 80
81static void q40ide_atapi_output_bytes(ide_drive_t *drive, void *buf,
82 unsigned int len)
83{
84 outsw_swapw(drive->hwif->io_ports.data_addr, buf, (len + 1) / 2);
85}
86
87static void q40ide_ata_input_data(ide_drive_t *drive, struct request *rq,
88 void *buf, unsigned int wcount)
89{
90 if (drive->media == ide_disk && rq && rq->cmd_type == REQ_TYPE_FS)
91 return insw(drive->hwif->io_ports.data_addr, buf, wcount * 2);
92
93 q40ide_atapi_input_bytes(drive, buf, wcount * 4);
94}
95
96static void q40ide_ata_output_data(ide_drive_t *drive, struct request *rq,
97 void *buf, unsigned int wcount)
98{
99 if (drive->media == ide_disk && rq && rq->cmd_type == REQ_TYPE_FS)
100 return outsw(drive->hwif->io_ports.data_addr, buf, wcount * 2);
101
102 q40ide_atapi_output_bytes(drive, buf, wcount * 4);
103}
76 104
77/* 105/*
78 * the static array is needed to have the name reported in /proc/ioports, 106 * the static array is needed to have the name reported in /proc/ioports,
@@ -123,6 +151,12 @@ static int __init q40ide_init(void)
123 ide_init_port_data(hwif, hwif->index); 151 ide_init_port_data(hwif, hwif->index);
124 ide_init_port_hw(hwif, &hw); 152 ide_init_port_hw(hwif, &hw);
125 153
154 /* Q40 has a byte-swapped IDE interface */
155 hwif->atapi_input_bytes = q40ide_atapi_input_bytes;
156 hwif->atapi_output_bytes = q40ide_atapi_output_bytes;
157 hwif->ata_input_data = q40ide_ata_input_data;
158 hwif->ata_output_data = q40ide_ata_output_data;
159
126 idx[i] = hwif->index; 160 idx[i] = hwif->index;
127 } 161 }
128 } 162 }