diff options
author | Tejun Heo <htejun@gmail.com> | 2008-03-25 09:16:40 -0400 |
---|---|---|
committer | Jeff Garzik <jgarzik@redhat.com> | 2008-04-17 15:44:18 -0400 |
commit | 272f7884e8c0effe594e5537092b9c0ccc0140b0 (patch) | |
tree | c05ac4d9004943c2a47e74b88eba95483408809c /drivers/ata/libata-sff.c | |
parent | 21572ea58a1f99a59044febde90c31167d2f59ae (diff) |
libata: reorder functions in libata-sff.c
Reorder functions in drivers/ata/libata-sff.c such that functions
generally follow ops table order and init functions come last. This
is in preparation of SFF cleanup.
This patch strictly moves stuff around and as such doesn't cause any
functional difference.
Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/ata/libata-sff.c')
-rw-r--r-- | drivers/ata/libata-sff.c | 443 |
1 files changed, 220 insertions, 223 deletions
diff --git a/drivers/ata/libata-sff.c b/drivers/ata/libata-sff.c index 2a229a1d3211..40645ed125b1 100644 --- a/drivers/ata/libata-sff.c +++ b/drivers/ata/libata-sff.c | |||
@@ -39,6 +39,43 @@ | |||
39 | #include "libata.h" | 39 | #include "libata.h" |
40 | 40 | ||
41 | /** | 41 | /** |
42 | * ata_check_status - Read device status reg & clear interrupt | ||
43 | * @ap: port where the device is | ||
44 | * | ||
45 | * Reads ATA taskfile status register for currently-selected device | ||
46 | * and return its value. This also clears pending interrupts | ||
47 | * from this device | ||
48 | * | ||
49 | * LOCKING: | ||
50 | * Inherited from caller. | ||
51 | */ | ||
52 | u8 ata_check_status(struct ata_port *ap) | ||
53 | { | ||
54 | return ioread8(ap->ioaddr.status_addr); | ||
55 | } | ||
56 | |||
57 | /** | ||
58 | * ata_altstatus - Read device alternate status reg | ||
59 | * @ap: port where the device is | ||
60 | * | ||
61 | * Reads ATA taskfile alternate status register for | ||
62 | * currently-selected device and return its value. | ||
63 | * | ||
64 | * Note: may NOT be used as the check_altstatus() entry in | ||
65 | * ata_port_operations. | ||
66 | * | ||
67 | * LOCKING: | ||
68 | * Inherited from caller. | ||
69 | */ | ||
70 | u8 ata_altstatus(struct ata_port *ap) | ||
71 | { | ||
72 | if (ap->ops->check_altstatus) | ||
73 | return ap->ops->check_altstatus(ap); | ||
74 | |||
75 | return ioread8(ap->ioaddr.altstatus_addr); | ||
76 | } | ||
77 | |||
78 | /** | ||
42 | * ata_irq_on - Enable interrupts on a port. | 79 | * ata_irq_on - Enable interrupts on a port. |
43 | * @ap: Port on which interrupts are enabled. | 80 | * @ap: Port on which interrupts are enabled. |
44 | * | 81 | * |
@@ -66,6 +103,27 @@ u8 ata_irq_on(struct ata_port *ap) | |||
66 | } | 103 | } |
67 | 104 | ||
68 | /** | 105 | /** |
106 | * ata_bmdma_irq_clear - Clear PCI IDE BMDMA interrupt. | ||
107 | * @ap: Port associated with this ATA transaction. | ||
108 | * | ||
109 | * Clear interrupt and error flags in DMA status register. | ||
110 | * | ||
111 | * May be used as the irq_clear() entry in ata_port_operations. | ||
112 | * | ||
113 | * LOCKING: | ||
114 | * spin_lock_irqsave(host lock) | ||
115 | */ | ||
116 | void ata_bmdma_irq_clear(struct ata_port *ap) | ||
117 | { | ||
118 | void __iomem *mmio = ap->ioaddr.bmdma_addr; | ||
119 | |||
120 | if (!mmio) | ||
121 | return; | ||
122 | |||
123 | iowrite8(ioread8(mmio + ATA_DMA_STATUS), mmio + ATA_DMA_STATUS); | ||
124 | } | ||
125 | |||
126 | /** | ||
69 | * ata_tf_load - send taskfile registers to host controller | 127 | * ata_tf_load - send taskfile registers to host controller |
70 | * @ap: Port to which output is sent | 128 | * @ap: Port to which output is sent |
71 | * @tf: ATA taskfile register set | 129 | * @tf: ATA taskfile register set |
@@ -75,7 +133,6 @@ u8 ata_irq_on(struct ata_port *ap) | |||
75 | * LOCKING: | 133 | * LOCKING: |
76 | * Inherited from caller. | 134 | * Inherited from caller. |
77 | */ | 135 | */ |
78 | |||
79 | void ata_tf_load(struct ata_port *ap, const struct ata_taskfile *tf) | 136 | void ata_tf_load(struct ata_port *ap, const struct ata_taskfile *tf) |
80 | { | 137 | { |
81 | struct ata_ioports *ioaddr = &ap->ioaddr; | 138 | struct ata_ioports *ioaddr = &ap->ioaddr; |
@@ -126,25 +183,6 @@ void ata_tf_load(struct ata_port *ap, const struct ata_taskfile *tf) | |||
126 | } | 183 | } |
127 | 184 | ||
128 | /** | 185 | /** |
129 | * ata_exec_command - issue ATA command to host controller | ||
130 | * @ap: port to which command is being issued | ||
131 | * @tf: ATA taskfile register set | ||
132 | * | ||
133 | * Issues ATA command, with proper synchronization with interrupt | ||
134 | * handler / other threads. | ||
135 | * | ||
136 | * LOCKING: | ||
137 | * spin_lock_irqsave(host lock) | ||
138 | */ | ||
139 | void ata_exec_command(struct ata_port *ap, const struct ata_taskfile *tf) | ||
140 | { | ||
141 | DPRINTK("ata%u: cmd 0x%X\n", ap->print_id, tf->command); | ||
142 | |||
143 | iowrite8(tf->command, ap->ioaddr.command_addr); | ||
144 | ata_pause(ap); | ||
145 | } | ||
146 | |||
147 | /** | ||
148 | * ata_tf_read - input device's ATA taskfile shadow registers | 186 | * ata_tf_read - input device's ATA taskfile shadow registers |
149 | * @ap: Port from which input is read | 187 | * @ap: Port from which input is read |
150 | * @tf: ATA taskfile register set for storing input | 188 | * @tf: ATA taskfile register set for storing input |
@@ -185,169 +223,22 @@ void ata_tf_read(struct ata_port *ap, struct ata_taskfile *tf) | |||
185 | } | 223 | } |
186 | 224 | ||
187 | /** | 225 | /** |
188 | * ata_check_status - Read device status reg & clear interrupt | 226 | * ata_exec_command - issue ATA command to host controller |
189 | * @ap: port where the device is | 227 | * @ap: port to which command is being issued |
190 | * | 228 | * @tf: ATA taskfile register set |
191 | * Reads ATA taskfile status register for currently-selected device | ||
192 | * and return its value. This also clears pending interrupts | ||
193 | * from this device | ||
194 | * | ||
195 | * LOCKING: | ||
196 | * Inherited from caller. | ||
197 | */ | ||
198 | u8 ata_check_status(struct ata_port *ap) | ||
199 | { | ||
200 | return ioread8(ap->ioaddr.status_addr); | ||
201 | } | ||
202 | |||
203 | /** | ||
204 | * ata_altstatus - Read device alternate status reg | ||
205 | * @ap: port where the device is | ||
206 | * | ||
207 | * Reads ATA taskfile alternate status register for | ||
208 | * currently-selected device and return its value. | ||
209 | * | ||
210 | * Note: may NOT be used as the check_altstatus() entry in | ||
211 | * ata_port_operations. | ||
212 | * | ||
213 | * LOCKING: | ||
214 | * Inherited from caller. | ||
215 | */ | ||
216 | u8 ata_altstatus(struct ata_port *ap) | ||
217 | { | ||
218 | if (ap->ops->check_altstatus) | ||
219 | return ap->ops->check_altstatus(ap); | ||
220 | |||
221 | return ioread8(ap->ioaddr.altstatus_addr); | ||
222 | } | ||
223 | |||
224 | /** | ||
225 | * ata_bmdma_setup - Set up PCI IDE BMDMA transaction | ||
226 | * @qc: Info associated with this ATA transaction. | ||
227 | * | ||
228 | * LOCKING: | ||
229 | * spin_lock_irqsave(host lock) | ||
230 | */ | ||
231 | void ata_bmdma_setup(struct ata_queued_cmd *qc) | ||
232 | { | ||
233 | struct ata_port *ap = qc->ap; | ||
234 | unsigned int rw = (qc->tf.flags & ATA_TFLAG_WRITE); | ||
235 | u8 dmactl; | ||
236 | |||
237 | /* load PRD table addr. */ | ||
238 | mb(); /* make sure PRD table writes are visible to controller */ | ||
239 | iowrite32(ap->prd_dma, ap->ioaddr.bmdma_addr + ATA_DMA_TABLE_OFS); | ||
240 | |||
241 | /* specify data direction, triple-check start bit is clear */ | ||
242 | dmactl = ioread8(ap->ioaddr.bmdma_addr + ATA_DMA_CMD); | ||
243 | dmactl &= ~(ATA_DMA_WR | ATA_DMA_START); | ||
244 | if (!rw) | ||
245 | dmactl |= ATA_DMA_WR; | ||
246 | iowrite8(dmactl, ap->ioaddr.bmdma_addr + ATA_DMA_CMD); | ||
247 | |||
248 | /* issue r/w command */ | ||
249 | ap->ops->exec_command(ap, &qc->tf); | ||
250 | } | ||
251 | |||
252 | /** | ||
253 | * ata_bmdma_start - Start a PCI IDE BMDMA transaction | ||
254 | * @qc: Info associated with this ATA transaction. | ||
255 | * | ||
256 | * LOCKING: | ||
257 | * spin_lock_irqsave(host lock) | ||
258 | */ | ||
259 | void ata_bmdma_start(struct ata_queued_cmd *qc) | ||
260 | { | ||
261 | struct ata_port *ap = qc->ap; | ||
262 | u8 dmactl; | ||
263 | |||
264 | /* start host DMA transaction */ | ||
265 | dmactl = ioread8(ap->ioaddr.bmdma_addr + ATA_DMA_CMD); | ||
266 | iowrite8(dmactl | ATA_DMA_START, ap->ioaddr.bmdma_addr + ATA_DMA_CMD); | ||
267 | |||
268 | /* Strictly, one may wish to issue an ioread8() here, to | ||
269 | * flush the mmio write. However, control also passes | ||
270 | * to the hardware at this point, and it will interrupt | ||
271 | * us when we are to resume control. So, in effect, | ||
272 | * we don't care when the mmio write flushes. | ||
273 | * Further, a read of the DMA status register _immediately_ | ||
274 | * following the write may not be what certain flaky hardware | ||
275 | * is expected, so I think it is best to not add a readb() | ||
276 | * without first all the MMIO ATA cards/mobos. | ||
277 | * Or maybe I'm just being paranoid. | ||
278 | * | ||
279 | * FIXME: The posting of this write means I/O starts are | ||
280 | * unneccessarily delayed for MMIO | ||
281 | */ | ||
282 | } | ||
283 | |||
284 | /** | ||
285 | * ata_bmdma_irq_clear - Clear PCI IDE BMDMA interrupt. | ||
286 | * @ap: Port associated with this ATA transaction. | ||
287 | * | ||
288 | * Clear interrupt and error flags in DMA status register. | ||
289 | * | ||
290 | * May be used as the irq_clear() entry in ata_port_operations. | ||
291 | * | ||
292 | * LOCKING: | ||
293 | * spin_lock_irqsave(host lock) | ||
294 | */ | ||
295 | void ata_bmdma_irq_clear(struct ata_port *ap) | ||
296 | { | ||
297 | void __iomem *mmio = ap->ioaddr.bmdma_addr; | ||
298 | |||
299 | if (!mmio) | ||
300 | return; | ||
301 | |||
302 | iowrite8(ioread8(mmio + ATA_DMA_STATUS), mmio + ATA_DMA_STATUS); | ||
303 | } | ||
304 | |||
305 | /** | ||
306 | * ata_noop_irq_clear - Noop placeholder for irq_clear | ||
307 | * @ap: Port associated with this ATA transaction. | ||
308 | */ | ||
309 | void ata_noop_irq_clear(struct ata_port *ap) | ||
310 | { | ||
311 | } | ||
312 | |||
313 | /** | ||
314 | * ata_bmdma_status - Read PCI IDE BMDMA status | ||
315 | * @ap: Port associated with this ATA transaction. | ||
316 | * | ||
317 | * Read and return BMDMA status register. | ||
318 | * | ||
319 | * May be used as the bmdma_status() entry in ata_port_operations. | ||
320 | * | ||
321 | * LOCKING: | ||
322 | * spin_lock_irqsave(host lock) | ||
323 | */ | ||
324 | u8 ata_bmdma_status(struct ata_port *ap) | ||
325 | { | ||
326 | return ioread8(ap->ioaddr.bmdma_addr + ATA_DMA_STATUS); | ||
327 | } | ||
328 | |||
329 | /** | ||
330 | * ata_bmdma_stop - Stop PCI IDE BMDMA transfer | ||
331 | * @qc: Command we are ending DMA for | ||
332 | * | ||
333 | * Clears the ATA_DMA_START flag in the dma control register | ||
334 | * | 229 | * |
335 | * May be used as the bmdma_stop() entry in ata_port_operations. | 230 | * Issues ATA command, with proper synchronization with interrupt |
231 | * handler / other threads. | ||
336 | * | 232 | * |
337 | * LOCKING: | 233 | * LOCKING: |
338 | * spin_lock_irqsave(host lock) | 234 | * spin_lock_irqsave(host lock) |
339 | */ | 235 | */ |
340 | void ata_bmdma_stop(struct ata_queued_cmd *qc) | 236 | void ata_exec_command(struct ata_port *ap, const struct ata_taskfile *tf) |
341 | { | 237 | { |
342 | struct ata_port *ap = qc->ap; | 238 | DPRINTK("ata%u: cmd 0x%X\n", ap->print_id, tf->command); |
343 | void __iomem *mmio = ap->ioaddr.bmdma_addr; | ||
344 | |||
345 | /* clear start/stop bit */ | ||
346 | iowrite8(ioread8(mmio + ATA_DMA_CMD) & ~ATA_DMA_START, | ||
347 | mmio + ATA_DMA_CMD); | ||
348 | 239 | ||
349 | /* one-PIO-cycle guaranteed wait, per spec, for HDMA1:0 transition */ | 240 | iowrite8(tf->command, ap->ioaddr.command_addr); |
350 | ata_altstatus(ap); /* dummy read */ | 241 | ata_pause(ap); |
351 | } | 242 | } |
352 | 243 | ||
353 | /** | 244 | /** |
@@ -495,7 +386,6 @@ void ata_bmdma_post_internal_cmd(struct ata_queued_cmd *qc) | |||
495 | * LOCKING: | 386 | * LOCKING: |
496 | * Inherited from caller. | 387 | * Inherited from caller. |
497 | */ | 388 | */ |
498 | |||
499 | int ata_sff_port_start(struct ata_port *ap) | 389 | int ata_sff_port_start(struct ata_port *ap) |
500 | { | 390 | { |
501 | if (ap->ioaddr.bmdma_addr) | 391 | if (ap->ioaddr.bmdma_addr) |
@@ -503,20 +393,149 @@ int ata_sff_port_start(struct ata_port *ap) | |||
503 | return 0; | 393 | return 0; |
504 | } | 394 | } |
505 | 395 | ||
396 | /** | ||
397 | * ata_bmdma_setup - Set up PCI IDE BMDMA transaction | ||
398 | * @qc: Info associated with this ATA transaction. | ||
399 | * | ||
400 | * LOCKING: | ||
401 | * spin_lock_irqsave(host lock) | ||
402 | */ | ||
403 | void ata_bmdma_setup(struct ata_queued_cmd *qc) | ||
404 | { | ||
405 | struct ata_port *ap = qc->ap; | ||
406 | unsigned int rw = (qc->tf.flags & ATA_TFLAG_WRITE); | ||
407 | u8 dmactl; | ||
408 | |||
409 | /* load PRD table addr. */ | ||
410 | mb(); /* make sure PRD table writes are visible to controller */ | ||
411 | iowrite32(ap->prd_dma, ap->ioaddr.bmdma_addr + ATA_DMA_TABLE_OFS); | ||
412 | |||
413 | /* specify data direction, triple-check start bit is clear */ | ||
414 | dmactl = ioread8(ap->ioaddr.bmdma_addr + ATA_DMA_CMD); | ||
415 | dmactl &= ~(ATA_DMA_WR | ATA_DMA_START); | ||
416 | if (!rw) | ||
417 | dmactl |= ATA_DMA_WR; | ||
418 | iowrite8(dmactl, ap->ioaddr.bmdma_addr + ATA_DMA_CMD); | ||
419 | |||
420 | /* issue r/w command */ | ||
421 | ap->ops->exec_command(ap, &qc->tf); | ||
422 | } | ||
423 | |||
424 | /** | ||
425 | * ata_bmdma_start - Start a PCI IDE BMDMA transaction | ||
426 | * @qc: Info associated with this ATA transaction. | ||
427 | * | ||
428 | * LOCKING: | ||
429 | * spin_lock_irqsave(host lock) | ||
430 | */ | ||
431 | void ata_bmdma_start(struct ata_queued_cmd *qc) | ||
432 | { | ||
433 | struct ata_port *ap = qc->ap; | ||
434 | u8 dmactl; | ||
435 | |||
436 | /* start host DMA transaction */ | ||
437 | dmactl = ioread8(ap->ioaddr.bmdma_addr + ATA_DMA_CMD); | ||
438 | iowrite8(dmactl | ATA_DMA_START, ap->ioaddr.bmdma_addr + ATA_DMA_CMD); | ||
439 | |||
440 | /* Strictly, one may wish to issue an ioread8() here, to | ||
441 | * flush the mmio write. However, control also passes | ||
442 | * to the hardware at this point, and it will interrupt | ||
443 | * us when we are to resume control. So, in effect, | ||
444 | * we don't care when the mmio write flushes. | ||
445 | * Further, a read of the DMA status register _immediately_ | ||
446 | * following the write may not be what certain flaky hardware | ||
447 | * is expected, so I think it is best to not add a readb() | ||
448 | * without first all the MMIO ATA cards/mobos. | ||
449 | * Or maybe I'm just being paranoid. | ||
450 | * | ||
451 | * FIXME: The posting of this write means I/O starts are | ||
452 | * unneccessarily delayed for MMIO | ||
453 | */ | ||
454 | } | ||
455 | |||
456 | /** | ||
457 | * ata_bmdma_stop - Stop PCI IDE BMDMA transfer | ||
458 | * @qc: Command we are ending DMA for | ||
459 | * | ||
460 | * Clears the ATA_DMA_START flag in the dma control register | ||
461 | * | ||
462 | * May be used as the bmdma_stop() entry in ata_port_operations. | ||
463 | * | ||
464 | * LOCKING: | ||
465 | * spin_lock_irqsave(host lock) | ||
466 | */ | ||
467 | void ata_bmdma_stop(struct ata_queued_cmd *qc) | ||
468 | { | ||
469 | struct ata_port *ap = qc->ap; | ||
470 | void __iomem *mmio = ap->ioaddr.bmdma_addr; | ||
471 | |||
472 | /* clear start/stop bit */ | ||
473 | iowrite8(ioread8(mmio + ATA_DMA_CMD) & ~ATA_DMA_START, | ||
474 | mmio + ATA_DMA_CMD); | ||
475 | |||
476 | /* one-PIO-cycle guaranteed wait, per spec, for HDMA1:0 transition */ | ||
477 | ata_altstatus(ap); /* dummy read */ | ||
478 | } | ||
479 | |||
480 | /** | ||
481 | * ata_bmdma_status - Read PCI IDE BMDMA status | ||
482 | * @ap: Port associated with this ATA transaction. | ||
483 | * | ||
484 | * Read and return BMDMA status register. | ||
485 | * | ||
486 | * May be used as the bmdma_status() entry in ata_port_operations. | ||
487 | * | ||
488 | * LOCKING: | ||
489 | * spin_lock_irqsave(host lock) | ||
490 | */ | ||
491 | u8 ata_bmdma_status(struct ata_port *ap) | ||
492 | { | ||
493 | return ioread8(ap->ioaddr.bmdma_addr + ATA_DMA_STATUS); | ||
494 | } | ||
495 | |||
496 | /** | ||
497 | * ata_noop_irq_clear - Noop placeholder for irq_clear | ||
498 | * @ap: Port associated with this ATA transaction. | ||
499 | */ | ||
500 | void ata_noop_irq_clear(struct ata_port *ap) | ||
501 | { | ||
502 | } | ||
503 | |||
506 | #ifdef CONFIG_PCI | 504 | #ifdef CONFIG_PCI |
507 | 505 | ||
508 | static int ata_resources_present(struct pci_dev *pdev, int port) | 506 | /** |
507 | * ata_pci_clear_simplex - attempt to kick device out of simplex | ||
508 | * @pdev: PCI device | ||
509 | * | ||
510 | * Some PCI ATA devices report simplex mode but in fact can be told to | ||
511 | * enter non simplex mode. This implements the necessary logic to | ||
512 | * perform the task on such devices. Calling it on other devices will | ||
513 | * have -undefined- behaviour. | ||
514 | */ | ||
515 | int ata_pci_clear_simplex(struct pci_dev *pdev) | ||
509 | { | 516 | { |
510 | int i; | 517 | unsigned long bmdma = pci_resource_start(pdev, 4); |
518 | u8 simplex; | ||
511 | 519 | ||
512 | /* Check the PCI resources for this channel are enabled */ | 520 | if (bmdma == 0) |
513 | port = port * 2; | 521 | return -ENOENT; |
514 | for (i = 0; i < 2; i ++) { | 522 | |
515 | if (pci_resource_start(pdev, port + i) == 0 || | 523 | simplex = inb(bmdma + 0x02); |
516 | pci_resource_len(pdev, port + i) == 0) | 524 | outb(simplex & 0x60, bmdma + 0x02); |
517 | return 0; | 525 | simplex = inb(bmdma + 0x02); |
518 | } | 526 | if (simplex & 0x80) |
519 | return 1; | 527 | return -EOPNOTSUPP; |
528 | return 0; | ||
529 | } | ||
530 | |||
531 | unsigned long ata_pci_default_filter(struct ata_device *adev, unsigned long xfer_mask) | ||
532 | { | ||
533 | /* Filter out DMA modes if the device has been configured by | ||
534 | the BIOS as PIO only */ | ||
535 | |||
536 | if (adev->link->ap->ioaddr.bmdma_addr == NULL) | ||
537 | xfer_mask &= ~(ATA_MASK_MWDMA | ATA_MASK_UDMA); | ||
538 | return xfer_mask; | ||
520 | } | 539 | } |
521 | 540 | ||
522 | /** | 541 | /** |
@@ -576,6 +595,20 @@ int ata_pci_init_bmdma(struct ata_host *host) | |||
576 | return 0; | 595 | return 0; |
577 | } | 596 | } |
578 | 597 | ||
598 | static int ata_resources_present(struct pci_dev *pdev, int port) | ||
599 | { | ||
600 | int i; | ||
601 | |||
602 | /* Check the PCI resources for this channel are enabled */ | ||
603 | port = port * 2; | ||
604 | for (i = 0; i < 2; i ++) { | ||
605 | if (pci_resource_start(pdev, port + i) == 0 || | ||
606 | pci_resource_len(pdev, port + i) == 0) | ||
607 | return 0; | ||
608 | } | ||
609 | return 1; | ||
610 | } | ||
611 | |||
579 | /** | 612 | /** |
580 | * ata_pci_init_sff_host - acquire native PCI ATA resources and init host | 613 | * ata_pci_init_sff_host - acquire native PCI ATA resources and init host |
581 | * @host: target ATA host | 614 | * @host: target ATA host |
@@ -879,41 +912,5 @@ int ata_pci_init_one(struct pci_dev *pdev, | |||
879 | return rc; | 912 | return rc; |
880 | } | 913 | } |
881 | 914 | ||
882 | /** | ||
883 | * ata_pci_clear_simplex - attempt to kick device out of simplex | ||
884 | * @pdev: PCI device | ||
885 | * | ||
886 | * Some PCI ATA devices report simplex mode but in fact can be told to | ||
887 | * enter non simplex mode. This implements the necessary logic to | ||
888 | * perform the task on such devices. Calling it on other devices will | ||
889 | * have -undefined- behaviour. | ||
890 | */ | ||
891 | |||
892 | int ata_pci_clear_simplex(struct pci_dev *pdev) | ||
893 | { | ||
894 | unsigned long bmdma = pci_resource_start(pdev, 4); | ||
895 | u8 simplex; | ||
896 | |||
897 | if (bmdma == 0) | ||
898 | return -ENOENT; | ||
899 | |||
900 | simplex = inb(bmdma + 0x02); | ||
901 | outb(simplex & 0x60, bmdma + 0x02); | ||
902 | simplex = inb(bmdma + 0x02); | ||
903 | if (simplex & 0x80) | ||
904 | return -EOPNOTSUPP; | ||
905 | return 0; | ||
906 | } | ||
907 | |||
908 | unsigned long ata_pci_default_filter(struct ata_device *adev, unsigned long xfer_mask) | ||
909 | { | ||
910 | /* Filter out DMA modes if the device has been configured by | ||
911 | the BIOS as PIO only */ | ||
912 | |||
913 | if (adev->link->ap->ioaddr.bmdma_addr == NULL) | ||
914 | xfer_mask &= ~(ATA_MASK_MWDMA | ATA_MASK_UDMA); | ||
915 | return xfer_mask; | ||
916 | } | ||
917 | |||
918 | #endif /* CONFIG_PCI */ | 915 | #endif /* CONFIG_PCI */ |
919 | 916 | ||