diff options
Diffstat (limited to 'drivers/ide/falconide.c')
-rw-r--r-- | drivers/ide/falconide.c | 45 |
1 files changed, 34 insertions, 11 deletions
diff --git a/drivers/ide/falconide.c b/drivers/ide/falconide.c index a638e952d67a..b368a5effc3a 100644 --- a/drivers/ide/falconide.c +++ b/drivers/ide/falconide.c | |||
@@ -40,29 +40,48 @@ | |||
40 | * which is shared between several drivers. | 40 | * which is shared between several drivers. |
41 | */ | 41 | */ |
42 | 42 | ||
43 | int falconide_intr_lock; | 43 | static int falconide_intr_lock; |
44 | EXPORT_SYMBOL(falconide_intr_lock); | ||
45 | 44 | ||
46 | static void falconide_input_data(ide_drive_t *drive, struct request *rq, | 45 | static void falconide_release_lock(void) |
46 | { | ||
47 | if (falconide_intr_lock == 0) { | ||
48 | printk(KERN_ERR "%s: bug\n", __func__); | ||
49 | return; | ||
50 | } | ||
51 | falconide_intr_lock = 0; | ||
52 | stdma_release(); | ||
53 | } | ||
54 | |||
55 | static void falconide_get_lock(irq_handler_t handler, void *data) | ||
56 | { | ||
57 | if (falconide_intr_lock == 0) { | ||
58 | if (in_interrupt() > 0) | ||
59 | panic("Falcon IDE hasn't ST-DMA lock in interrupt"); | ||
60 | stdma_lock(handler, data); | ||
61 | falconide_intr_lock = 1; | ||
62 | } | ||
63 | } | ||
64 | |||
65 | static void falconide_input_data(ide_drive_t *drive, struct ide_cmd *cmd, | ||
47 | void *buf, unsigned int len) | 66 | void *buf, unsigned int len) |
48 | { | 67 | { |
49 | unsigned long data_addr = drive->hwif->io_ports.data_addr; | 68 | unsigned long data_addr = drive->hwif->io_ports.data_addr; |
50 | 69 | ||
51 | if (drive->media == ide_disk && rq && rq->cmd_type == REQ_TYPE_FS) | 70 | if (drive->media == ide_disk && cmd && (cmd->tf_flags & IDE_TFLAG_FS)) |
52 | return insw(data_addr, buf, (len + 1) / 2); | 71 | return insw(data_addr, buf, (len + 1) / 2); |
53 | 72 | ||
54 | insw_swapw(data_addr, buf, (len + 1) / 2); | 73 | raw_insw_swapw((u16 *)data_addr, buf, (len + 1) / 2); |
55 | } | 74 | } |
56 | 75 | ||
57 | static void falconide_output_data(ide_drive_t *drive, struct request *rq, | 76 | static void falconide_output_data(ide_drive_t *drive, struct ide_cmd *cmd, |
58 | void *buf, unsigned int len) | 77 | void *buf, unsigned int len) |
59 | { | 78 | { |
60 | unsigned long data_addr = drive->hwif->io_ports.data_addr; | 79 | unsigned long data_addr = drive->hwif->io_ports.data_addr; |
61 | 80 | ||
62 | if (drive->media == ide_disk && rq && rq->cmd_type == REQ_TYPE_FS) | 81 | if (drive->media == ide_disk && cmd && (cmd->tf_flags & IDE_TFLAG_FS)) |
63 | return outsw(data_addr, buf, (len + 1) / 2); | 82 | return outsw(data_addr, buf, (len + 1) / 2); |
64 | 83 | ||
65 | outsw_swapw(data_addr, buf, (len + 1) / 2); | 84 | raw_outsw_swapw((u16 *)data_addr, buf, (len + 1) / 2); |
66 | } | 85 | } |
67 | 86 | ||
68 | /* Atari has a byte-swapped IDE interface */ | 87 | /* Atari has a byte-swapped IDE interface */ |
@@ -81,8 +100,12 @@ static const struct ide_tp_ops falconide_tp_ops = { | |||
81 | }; | 100 | }; |
82 | 101 | ||
83 | static const struct ide_port_info falconide_port_info = { | 102 | static const struct ide_port_info falconide_port_info = { |
103 | .get_lock = falconide_get_lock, | ||
104 | .release_lock = falconide_release_lock, | ||
84 | .tp_ops = &falconide_tp_ops, | 105 | .tp_ops = &falconide_tp_ops, |
85 | .host_flags = IDE_HFLAG_NO_DMA | IDE_HFLAG_SERIALIZE, | 106 | .host_flags = IDE_HFLAG_MMIO | IDE_HFLAG_SERIALIZE | |
107 | IDE_HFLAG_NO_DMA, | ||
108 | .irq_flags = IRQF_SHARED, | ||
86 | }; | 109 | }; |
87 | 110 | ||
88 | static void __init falconide_setup_ports(hw_regs_t *hw) | 111 | static void __init falconide_setup_ports(hw_regs_t *hw) |
@@ -132,9 +155,9 @@ static int __init falconide_init(void) | |||
132 | goto err; | 155 | goto err; |
133 | } | 156 | } |
134 | 157 | ||
135 | ide_get_lock(NULL, NULL); | 158 | falconide_get_lock(NULL, NULL); |
136 | rc = ide_host_register(host, &falconide_port_info, hws); | 159 | rc = ide_host_register(host, &falconide_port_info, hws); |
137 | ide_release_lock(); | 160 | falconide_release_lock(); |
138 | 161 | ||
139 | if (rc) | 162 | if (rc) |
140 | goto err_free; | 163 | goto err_free; |