* [PATCH] pata_atiixp: add proper ->prereset method
@ 2011-10-11 17:55 Bartlomiej Zolnierkiewicz
2011-10-11 19:57 ` Alan Cox
2011-10-12 10:31 ` Sergei Shtylyov
0 siblings, 2 replies; 3+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2011-10-11 17:55 UTC (permalink / raw)
To: Jeff Garzik; +Cc: linux-ide, linux-kernel
From: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Subject: [PATCH] pata_atiixp: add proper ->prereset method
Fixes PCI access before PCI resources are allocated.
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
---
earlier references:
https://lkml.org/lkml/2009/11/25/320
drivers/ata/pata_atiixp.c | 35 ++++++++++++++++++++++++++---------
1 file changed, 26 insertions(+), 9 deletions(-)
Index: b/drivers/ata/pata_atiixp.c
===================================================================
--- a/drivers/ata/pata_atiixp.c
+++ b/drivers/ata/pata_atiixp.c
@@ -49,6 +49,31 @@ static int atiixp_cable_detect(struct at
static DEFINE_SPINLOCK(atiixp_lock);
/**
+ * atiixp_prereset - perform reset handling
+ * @link: ATA link
+ * @deadline: deadline jiffies for the operation
+ *
+ * Reset sequence checking enable bits to see which ports are
+ * active.
+ */
+
+static int atiixp_prereset(struct ata_link *link, unsigned long deadline)
+{
+ static const struct pci_bits atiixp_enable_bits[] = {
+ { 0x48, 1, 0x01, 0x00 },
+ { 0x48, 1, 0x08, 0x00 }
+ };
+
+ struct ata_port *ap = link->ap;
+ struct pci_dev *pdev = to_pci_dev(ap->host->dev);
+
+ if (!pci_test_config_bits(pdev, &atiixp_enable_bits[ap->port_no]))
+ return -ENOENT;
+
+ return ata_sff_prereset(link, deadline);
+}
+
+/**
* atiixp_set_pio_timing - set initial PIO mode data
* @ap: ATA interface
* @adev: ATA device
@@ -221,6 +246,7 @@ static struct ata_port_operations atiixp
.bmdma_start = atiixp_bmdma_start,
.bmdma_stop = atiixp_bmdma_stop,
+ .prereset = atiixp_prereset,
.cable_detect = atiixp_cable_detect,
.set_piomode = atiixp_set_piomode,
.set_dmamode = atiixp_set_dmamode,
@@ -235,16 +261,7 @@ static int atiixp_init_one(struct pci_de
.udma_mask = ATA_UDMA5,
.port_ops = &atiixp_port_ops
};
- static const struct pci_bits atiixp_enable_bits[] = {
- { 0x48, 1, 0x01, 0x00 },
- { 0x48, 1, 0x08, 0x00 }
- };
const struct ata_port_info *ppi[] = { &info, &info };
- int i;
-
- for (i = 0; i < 2; i++)
- if (!pci_test_config_bits(pdev, &atiixp_enable_bits[i]))
- ppi[i] = &ata_dummy_port_info;
return ata_pci_bmdma_init_one(pdev, ppi, &atiixp_sht, NULL,
ATA_HOST_PARALLEL_SCAN);
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] pata_atiixp: add proper ->prereset method
2011-10-11 17:55 [PATCH] pata_atiixp: add proper ->prereset method Bartlomiej Zolnierkiewicz
@ 2011-10-11 19:57 ` Alan Cox
2011-10-12 10:31 ` Sergei Shtylyov
1 sibling, 0 replies; 3+ messages in thread
From: Alan Cox @ 2011-10-11 19:57 UTC (permalink / raw)
To: Bartlomiej Zolnierkiewicz; +Cc: Jeff Garzik, linux-ide, linux-kernel
On Tue, 11 Oct 2011 19:55:09 +0200
Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> wrote:
> From: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
> Subject: [PATCH] pata_atiixp: add proper ->prereset method
>
> Fixes PCI access before PCI resources are allocated.
>
> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Acked-by: Alan Cox <alan@linux.intel.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] pata_atiixp: add proper ->prereset method
2011-10-11 17:55 [PATCH] pata_atiixp: add proper ->prereset method Bartlomiej Zolnierkiewicz
2011-10-11 19:57 ` Alan Cox
@ 2011-10-12 10:31 ` Sergei Shtylyov
1 sibling, 0 replies; 3+ messages in thread
From: Sergei Shtylyov @ 2011-10-12 10:31 UTC (permalink / raw)
To: Bartlomiej Zolnierkiewicz; +Cc: Jeff Garzik, linux-ide, linux-kernel
Hello.
On 11-10-2011 21:55, Bartlomiej Zolnierkiewicz wrote:
> From: Bartlomiej Zolnierkiewicz<bzolnier@gmail.com>
> Subject: [PATCH] pata_atiixp: add proper ->prereset method
> Fixes PCI access before PCI resources are allocated.
Hm, didn't understand this...
> Signed-off-by: Bartlomiej Zolnierkiewicz<bzolnier@gmail.com>
> ---
> earlier references:
> https://lkml.org/lkml/2009/11/25/320
> drivers/ata/pata_atiixp.c | 35 ++++++++++++++++++++++++++---------
> 1 file changed, 26 insertions(+), 9 deletions(-)
> Index: b/drivers/ata/pata_atiixp.c
> ===================================================================
> --- a/drivers/ata/pata_atiixp.c
> +++ b/drivers/ata/pata_atiixp.c
[...]
> @@ -235,16 +261,7 @@ static int atiixp_init_one(struct pci_de
> .udma_mask = ATA_UDMA5,
> .port_ops =&atiixp_port_ops
> };
> - static const struct pci_bits atiixp_enable_bits[] = {
> - { 0x48, 1, 0x01, 0x00 },
> - { 0x48, 1, 0x08, 0x00 }
> - };
> const struct ata_port_info *ppi[] = {&info,&info };
> - int i;
> -
> - for (i = 0; i< 2; i++)
> - if (!pci_test_config_bits(pdev,&atiixp_enable_bits[i]))
> - ppi[i] =&ata_dummy_port_info;
But this seems more safe method than prereset() as it should really avoid
accessing the disabled IDE ports (which blows up on non-x86)... didn't
understand why this is incorrect...
WBR, Sergei
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2011-10-12 10:32 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-10-11 17:55 [PATCH] pata_atiixp: add proper ->prereset method Bartlomiej Zolnierkiewicz
2011-10-11 19:57 ` Alan Cox
2011-10-12 10:31 ` Sergei Shtylyov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).