pci: store PCI_INTERRUPT_PIN in pci_dev
A message that is not in the archive (sent off-list or not yet received): 20051027192603.488616000@whizzy
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.
drivers/pci/probe.c | 1 + include/linux/pci.h | 1 + 2 files changed, 2 insertions(+)
drivers/pci/probe.c +1 -0
@@ -571,6 +571,7 @@ static void pci_read_irq(struct pci_devunsigned 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;
include/linux/pci.h +1 -0
@@ -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
--
drivers/pci/probe.c static void pci_read_irq(struct pci_dev · line 574
Quoted 7 lines · Kristen Accardi
drivers/pci/probe.c +1
-0@@ -571,6 +571,7 @@ static void pci_read_irq(struct pci_devunsigned 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
Quoted 14 lines · Rajesh Shah
drivers/pci/probe.c static void pci_read_irq(struct pci_dev · line 574
Quoted 7 lines · Kristen Accardi
drivers/pci/probe.c +1
-0@@ -571,6 +571,7 @@ static void pci_read_irq(struct pci_devunsigned 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.
Quoted 2 lines
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
PATCH 2/3 apci: use stored value of pin from pci_dev
In reply to a message not in the archiveplain text document attachment (patch-interrupt-pin-acpi) Use the stored value of the Interrupt Pin, rather than try to read it again.
drivers/acpi/pci_irq.c | 7 +++---- 1 files changed, 3 insertions(+), 4 deletions(-)
drivers/acpi/pci_irq.c +3 -4
@@ -361,8 +361,7 @@ acpi_pci_irq_derive(struct pci_dev *dev,if ((bridge->class >>8 ) ==PCI_CLASS_BRIDGE_CARDBUS ) {/* PC card has the same IRQ as its cardbridge */ -pci_read_config_byte (bridge,PCI_INTERRUPT_PIN , - &bridge_pin); + bridge_pin = bridge->pin;if (!bridge_pin) { ACPI_DEBUG_PRINT((ACPI_DB_INFO, "No interrupt pin configured for device %s\n",
@@ -412,7 +411,7 @@ int acpi_pci_irq_enable(struct pci_dev *if (!dev)return_VALUE (-EINVAL ); -pci_read_config_byte (dev,PCI_INTERRUPT_PIN , &pin); + pin = dev->pin;if (!pin) { ACPI_DEBUG_PRINT((ACPI_DB_INFO, "No interrupt pin configured for device %s\n",
@@ -503,7 +502,7 @@ void acpi_pci_irq_disable(struct pci_devif (!dev || !dev->bus) return_VOID; -pci_read_config_byte (dev,PCI_INTERRUPT_PIN , &pin); + pin = dev->pin;if (!pin) return_VOID; pin--;
--
PATCH 3/3 pci: use stored value of pin from pci_dev
In reply to a message not in the archiveplain text document attachment (patch-interrupt-pin-pci) Use the stored value of the interrupt pin rather than try to read the config again.
drivers/pci/pci.c | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-)
drivers/pci/pci.c +1 -1
@@ -567,7 +567,7 @@ pci_get_interrupt_pin(struct pci_dev *de {u8 pin; -pci_read_config_byte (dev,PCI_INTERRUPT_PIN , &pin); + pin = dev->pin;if (!pin)return -1 ; pin--;
--