aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/pci/alim15x3.c
diff options
context:
space:
mode:
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2007-10-11 17:54:01 -0400
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2007-10-11 17:54:01 -0400
commita6fe837ed63aa812bea029a24b7aafc72ba8de88 (patch)
tree7f13ed5e930ec8a782c7c412ce4d0cab82e21872 /drivers/ide/pci/alim15x3.c
parentffe5415c3d6138aff412af7e455b3df4d53c0aa0 (diff)
alim15x3: PIO mode setup fixes
* Return failure in ->speedproc method for unsupported/invalid transfer modes passed from user-space (fixes theoretical OOPS in ali_tune_pio() and/or setting random PIO timings on host controller + disabling UDMA bit + setting unsupported/invalid transfer mode on the device). * Don't disable UDMA bit when programming PIO modes. * Add FIXME about DMA timings never being set. * Bump driver version. Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide/pci/alim15x3.c')
-rw-r--r--drivers/ide/pci/alim15x3.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/drivers/ide/pci/alim15x3.c b/drivers/ide/pci/alim15x3.c
index 005402ab748b..f15c8879d2c1 100644
--- a/drivers/ide/pci/alim15x3.c
+++ b/drivers/ide/pci/alim15x3.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * linux/drivers/ide/pci/alim15x3.c Version 0.25 Jun 9 2007 2 * linux/drivers/ide/pci/alim15x3.c Version 0.26 Jul 14 2007
3 * 3 *
4 * Copyright (C) 1998-2000 Michel Aubry, Maintainer 4 * Copyright (C) 1998-2000 Michel Aubry, Maintainer
5 * Copyright (C) 1998-2000 Andrzej Krzysztofowicz, Maintainer 5 * Copyright (C) 1998-2000 Andrzej Krzysztofowicz, Maintainer
@@ -418,6 +418,14 @@ static int ali15x3_tune_chipset(ide_drive_t *drive, const u8 speed)
418 u8 tmpbyte = 0x00; 418 u8 tmpbyte = 0x00;
419 int m5229_udma = (hwif->channel) ? 0x57 : 0x56; 419 int m5229_udma = (hwif->channel) ? 0x57 : 0x56;
420 420
421 if (speed < XFER_PIO_0)
422 return 1;
423
424 if (speed >= XFER_PIO_0 && speed <= XFER_PIO_5) {
425 ali_tune_pio(drive, speed - XFER_PIO_0);
426 return ide_config_drive_speed(drive, speed);
427 }
428
421 if (speed == XFER_UDMA_6) 429 if (speed == XFER_UDMA_6)
422 speed1 = 0x47; 430 speed1 = 0x47;
423 431
@@ -430,8 +438,9 @@ static int ali15x3_tune_chipset(ide_drive_t *drive, const u8 speed)
430 tmpbyte &= ultra_enable; 438 tmpbyte &= ultra_enable;
431 pci_write_config_byte(dev, m5229_udma, tmpbyte); 439 pci_write_config_byte(dev, m5229_udma, tmpbyte);
432 440
433 if (speed < XFER_SW_DMA_0) 441 /*
434 ali_tune_pio(drive, speed - XFER_PIO_0); 442 * FIXME: Oh, my... DMA timings are never set.
443 */
435 } else { 444 } else {
436 pci_read_config_byte(dev, m5229_udma, &tmpbyte); 445 pci_read_config_byte(dev, m5229_udma, &tmpbyte);
437 tmpbyte &= (0x0f << ((1-unit) << 2)); 446 tmpbyte &= (0x0f << ((1-unit) << 2));