]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/2.6.33.2/ide-fix-promise-udma33-ide-driver-pdc202xx_old.patch
5.0-stable patches
[thirdparty/kernel/stable-queue.git] / releases / 2.6.33.2 / ide-fix-promise-udma33-ide-driver-pdc202xx_old.patch
1 From 5e249f8401d4955d7a5f18e36d9b2654a1ed4da3 Mon Sep 17 00:00:00 2001
2 From: Russell King <rmk@arm.linux.org.uk>
3 Date: Sun, 3 Jan 2010 12:35:42 +0000
4 Subject: ide: Fix Promise UDMA33 IDE driver (pdc202xx_old)
5
6 From: Russell King <rmk@arm.linux.org.uk>
7
8 [ Upstream commit c3be57b6f35ef96a980ce84e59d6a5a8ca6184ad ]
9
10 On Sun, Jan 03, 2010 at 12:23:14AM +0000, Russell King wrote:
11 > - with IDE
12 > - locks the interrupt line, and makes the machine extremely painful -
13 > about an hour to get to the point of being able to unload the
14 > pdc202xx_old module.
15
16 Having manually bisected kernel versions, I've narrowed it down to some
17 change between 2.6.30 and 2.6.31. There's not much which has changed
18 between the two kernels, but one change stands out like a sore thumb:
19
20 +static int pdc202xx_test_irq(ide_hwif_t *hwif)
21 +{
22 + struct pci_dev *dev = to_pci_dev(hwif->dev);
23 + unsigned long high_16 = pci_resource_start(dev, 4);
24 + u8 sc1d = inb(high_16 + 0x1d);
25 +
26 + if (hwif->channel) {
27 + /*
28 + * bit 7: error, bit 6: interrupting,
29 + * bit 5: FIFO full, bit 4: FIFO empty
30 + */
31 + return ((sc1d & 0x50) == 0x40) ? 1 : 0;
32 + } else {
33 + /*
34 + * bit 3: error, bit 2: interrupting,
35 + * bit 1: FIFO full, bit 0: FIFO empty
36 + */
37 + return ((sc1d & 0x05) == 0x04) ? 1 : 0;
38 + }
39 +}
40
41 Reading the (documented as a 32-bit) system control register when the
42 interface is idle gives: 0x01da110c
43
44 So, the byte at 0x1d is 0x11, which is documented as meaning that the
45 primary and secondary FIFOs are empty.
46
47 The code above, which is trying to see whether an IRQ is pending, checks
48 for the IRQ bit to be one, and the FIFO bit to be zero - or in English,
49 to be non-empty.
50
51 Since during a BM-DMA read, the FIFOs will naturally be drained to the
52 PCI bus, the chance of us getting to the interface before this happens
53 are extremely small - and if we don't, it means we decide not to service
54 the interrupt. Hence, the screaming interrupt problem with drivers/ide.
55
56 Fix this by only indicating an interrupt is ready if both the interrupt
57 and FIFO empty bits are at '1'.
58
59 This bug only affects PDC20246/PDC20247 (Promise Ultra33) based cards,
60 and has been tested on 2.6.31 and 2.6.33-rc2.
61
62 Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
63 Tested-by: Russell King <rmk+kernel@arm.linux.org.uk>
64 Signed-off-by: David S. Miller <davem@davemloft.net>
65 Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
66
67 ---
68 drivers/ide/pdc202xx_old.c | 4 ++--
69 1 file changed, 2 insertions(+), 2 deletions(-)
70
71 --- a/drivers/ide/pdc202xx_old.c
72 +++ b/drivers/ide/pdc202xx_old.c
73 @@ -100,13 +100,13 @@ static int pdc202xx_test_irq(ide_hwif_t
74 * bit 7: error, bit 6: interrupting,
75 * bit 5: FIFO full, bit 4: FIFO empty
76 */
77 - return ((sc1d & 0x50) == 0x40) ? 1 : 0;
78 + return ((sc1d & 0x50) == 0x50) ? 1 : 0;
79 } else {
80 /*
81 * bit 3: error, bit 2: interrupting,
82 * bit 1: FIFO full, bit 0: FIFO empty
83 */
84 - return ((sc1d & 0x05) == 0x04) ? 1 : 0;
85 + return ((sc1d & 0x05) == 0x05) ? 1 : 0;
86 }
87 }
88