2005-10-27 19:30:22

by Kristen Carlson Accardi

[permalink] [raw]
Subject: [patch 1/3] pci: store PCI_INTERRUPT_PIN in pci_dev

plain text document attachment (patch-interrupt-pin)
Store the value of the INTERRUPT_PIN in the pci_dev structure
so that it can be retrieved later.

Signed-off-by: Kristen Carlson Accardi <[email protected]>

drivers/pci/probe.c | 1 +
include/linux/pci.h | 1 +
2 files changed, 2 insertions(+)

Index: linux-2.6.13/drivers/pci/probe.c
===================================================================
--- linux-2.6.13.orig/drivers/pci/probe.c
+++ linux-2.6.13/drivers/pci/probe.c
@@ -571,6 +571,7 @@ static void pci_read_irq(struct pci_dev
unsigned char irq;

pci_read_config_byte(dev, PCI_INTERRUPT_PIN, &irq);
+ dev->pin = irq;
if (irq)
pci_read_config_byte(dev, PCI_INTERRUPT_LINE, &irq);
dev->irq = irq;
Index: linux-2.6.13/include/linux/pci.h
===================================================================
--- linux-2.6.13.orig/include/linux/pci.h
+++ linux-2.6.13/include/linux/pci.h
@@ -98,6 +98,7 @@ struct pci_dev {
unsigned int class; /* 3 bytes: (base,sub,prog-if) */
u8 hdr_type; /* PCI header type (`multi' flag masked out) */
u8 rom_base_reg; /* which config register controls the ROM */
+ u8 pin; /* which interrupt pin this device uses */

struct pci_driver *driver; /* which driver has allocated this device */
u64 dma_mask; /* Mask of the bits of bus address this

--


2005-10-27 23:07:16

by Rajesh Shah

[permalink] [raw]
Subject: Re: [patch 1/3] pci: store PCI_INTERRUPT_PIN in pci_dev

On Thu, Oct 27, 2005 at 12:30:09PM -0700, Kristen Accardi wrote:
> --- linux-2.6.13.orig/drivers/pci/probe.c
> +++ linux-2.6.13/drivers/pci/probe.c
> @@ -571,6 +571,7 @@ static void pci_read_irq(struct pci_dev
> unsigned char irq;
>
> pci_read_config_byte(dev, PCI_INTERRUPT_PIN, &irq);
> + dev->pin = irq;

pci_read_irq() is not called for PCI bridges, but some of them
may need an interrupt (e.g. for shpchp, pciehp). Did you check
if this patchset broke such bridges? You should call this
function for PCI bridges too.

Rajesh

2005-11-03 00:15:06

by Kristen Carlson Accardi

[permalink] [raw]
Subject: Re: [patch 1/3] pci: store PCI_INTERRUPT_PIN in pci_dev

On Thu, 2005-10-27 at 16:06 -0700, Rajesh Shah wrote:
> On Thu, Oct 27, 2005 at 12:30:09PM -0700, Kristen Accardi wrote:
> > --- linux-2.6.13.orig/drivers/pci/probe.c
> > +++ linux-2.6.13/drivers/pci/probe.c
> > @@ -571,6 +571,7 @@ static void pci_read_irq(struct pci_dev
> > unsigned char irq;
> >
> > pci_read_config_byte(dev, PCI_INTERRUPT_PIN, &irq);
> > + dev->pin = irq;
>
> pci_read_irq() is not called for PCI bridges, but some of them
> may need an interrupt (e.g. for shpchp, pciehp). Did you check
> if this patchset broke such bridges? You should call this
> function for PCI bridges too.
>
> Rajesh
>

You are correct, this does break for bridges on certain architectures.
Some archs seem to re-read the interrupt pin value in
pcibios_enable_device, but others don't. Adding pci_read_irq to the
bridge patch in this function does seem to fix the problem, and arch
specific code can still override this. I'll send a new patch for that.
thanks,
Kristen