13 #include <linux/types.h>
18 #include <linux/module.h>
26 #define Q40IDE_NUM_HWIFS 2
28 #define PCIDE_BASE1 0x1f0
29 #define PCIDE_BASE2 0x170
30 #define PCIDE_BASE3 0x1e8
31 #define PCIDE_BASE4 0x168
32 #define PCIDE_BASE5 0x1e0
33 #define PCIDE_BASE6 0x160
40 static int q40ide_default_irq(
unsigned long base)
43 case 0x1f0:
return 14;
44 case 0x170:
return 15;
45 case 0x1e8:
return 11;
55 static void q40_ide_setup_ports(
struct ide_hw *
hw,
unsigned long base,
int irq)
57 memset(hw, 0,
sizeof(*hw));
60 hw->
io_ports.data_addr = Q40_ISA_IO_W(base);
61 hw->
io_ports.error_addr = Q40_ISA_IO_B(base + 1);
62 hw->
io_ports.nsect_addr = Q40_ISA_IO_B(base + 2);
63 hw->
io_ports.lbal_addr = Q40_ISA_IO_B(base + 3);
64 hw->
io_ports.lbam_addr = Q40_ISA_IO_B(base + 4);
65 hw->
io_ports.lbah_addr = Q40_ISA_IO_B(base + 5);
66 hw->
io_ports.device_addr = Q40_ISA_IO_B(base + 6);
67 hw->
io_ports.status_addr = Q40_ISA_IO_B(base + 7);
68 hw->
io_ports.ctl_addr = Q40_ISA_IO_B(base + 0x206);
74 void *
buf,
unsigned int len)
83 raw_insw_swapw((
u16 *)data_addr, buf, (len + 1) / 2);
87 void *buf,
unsigned int len)
89 unsigned long data_addr = drive->
hwif->io_ports.data_addr;
96 raw_outsw_swapw((
u16 *)data_addr, buf, (len + 1) / 2);
100 static const struct ide_tp_ops q40ide_tp_ops = {
110 .input_data = q40ide_input_data,
111 .output_data = q40ide_output_data,
115 .tp_ops = &q40ide_tp_ops,
133 static int __init q40ide_init(
void)
144 const char *
name = q40_ide_names[
i];
147 printk(
"could not reserve ports %lx-%lx for %s\n",
148 pcide_bases[i],pcide_bases[i]+8,name);
152 printk(
"could not reserve port %lx for %s\n",
153 pcide_bases[i]+0x206,name);
157 q40_ide_setup_ports(&hw[i], pcide_bases[i],
158 q40ide_default_irq(pcide_bases[i]));