diff options
author | Sergey Shtylyov <s.shtylyov@omp.ru> | 2022-02-07 15:26:13 +0100 |
---|---|---|
committer | Damien Le Moal <damien.lemoal@opensource.wdc.com> | 2022-02-19 03:18:42 +0100 |
commit | a565ed1b9b1dc11cabed10e1c7c1b245c8db1aef (patch) | |
tree | 52593d9c3b90f9567513eb90d53818442cfef939 /drivers/ata/pata_hpt3x2n.c | |
parent | ata: libata: make ata_host_suspend() *void* (diff) | |
download | linux-a565ed1b9b1dc11cabed10e1c7c1b245c8db1aef.tar.xz linux-a565ed1b9b1dc11cabed10e1c7c1b245c8db1aef.zip |
pata_hpt3x2n: check channel enable bits
The driver's prereset() method still doesn't check the channel enable bits.
The bug was there for the entire time the driver has existed. :-/
Alan Cox fixed the HPT37x driver in commit b5bf24b94c65 ("[PATCH] hpt37x:
Check the enablebits") but forgot to check the HPT3x2N driver which has
the same bug. :-/
Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>
Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
Diffstat (limited to 'drivers/ata/pata_hpt3x2n.c')
-rw-r--r-- | drivers/ata/pata_hpt3x2n.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/drivers/ata/pata_hpt3x2n.c b/drivers/ata/pata_hpt3x2n.c index 1d9d4eec5b8a..cbe57aba39bc 100644 --- a/drivers/ata/pata_hpt3x2n.c +++ b/drivers/ata/pata_hpt3x2n.c @@ -24,7 +24,7 @@ #include <linux/libata.h> #define DRV_NAME "pata_hpt3x2n" -#define DRV_VERSION "0.3.15" +#define DRV_VERSION "0.3.16" enum { HPT_PCI_FAST = (1 << 31), @@ -168,6 +168,13 @@ static int hpt3x2n_pre_reset(struct ata_link *link, unsigned long deadline) { struct ata_port *ap = link->ap; struct pci_dev *pdev = to_pci_dev(ap->host->dev); + static const struct pci_bits hpt3x2n_enable_bits[] = { + { 0x50, 1, 0x04, 0x04 }, + { 0x54, 1, 0x04, 0x04 } + }; + + if (!pci_test_config_bits(pdev, &hpt3x2n_enable_bits[ap->port_no])) + return -ENOENT; /* Reset the state machine */ pci_write_config_byte(pdev, 0x50 + 4 * ap->port_no, 0x37); |