Skip to contentSkip to conversation

pci: store PCI_INTERRUPT_PIN in pci_dev

PATCH In review Kristen Accardi 1 participant 5 messages Nov 3, 2005 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): 20051103001540.365407000@whizzy

#1 lore raw

PATCH 1/4 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
Index: 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;
include/linux/pci.h +1 -0
Index: 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

--

#2 lore raw

PATCH 2/4 apci: use pin stored in pci_dev

In reply to a message not in the archive

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
Index: linux-2.6.13/drivers/acpi/pci_irq.c
===================================================================
@@ -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_dev
 	if (!dev || !dev->bus)
 		return_VOID;
 
-	pci_read_config_byte(dev, PCI_INTERRUPT_PIN, &pin);
+	pin = dev->pin;
 	if (!pin)
 		return_VOID;
 	pin--;

--

-------------------------------------------------------
SF.Net email is sponsored by:
Tame your development challenges with Apache's Geronimo App Server. Download it for free - -and be entered to win a 42" plasma tv or your very own Sony(tm)PSP. Click here to play: http://sourceforge.net/geronimo.php

#3 lore raw

PATCH 3/4 pci: use pin stored in pci_dev

In reply to a message not in the archive

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
Index: linux-2.6.13/drivers/pci/pci.c
===================================================================
@@ -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--;

--

-------------------------------------------------------
SF.Net email is sponsored by:
Tame your development challenges with Apache's Geronimo App Server. Download it for free - -and be entered to win a 42" plasma tv or your very own Sony(tm)PSP. Click here to play: http://sourceforge.net/geronimo.php

#4 lore raw

PATCH 4/4 pci: call pci_read_irq for bridges

In reply to a message not in the archive

Call pci_read_irq() for bridges too, this ensures that the pin value is stored for later use for bridges that require interrupts.

 drivers/pci/probe.c |    1 +
 1 files changed, 1 insertion(+)
drivers/pci/probe.c +1 -0
Index: linux-2.6.13/drivers/pci/probe.c
===================================================================
@@ -624,6 +624,7 @@ static int pci_setup_device(struct pci_d
 		/* The PCI-to-PCI bridge spec requires that subtractive
 		   decoding (i.e. transparent) bridge must have programming
 		   interface code of 0x01. */ 
+		pci_read_irq(dev);
 		dev->transparent = ((dev->class & 0xff) == 1);
 		pci_read_bases(dev, 2, PCI_ROM_ADDRESS1);
 		break;

--

#5 lore raw

Re: [patch 4/4] pci: call pci_read_irq for bridges

Call pci_read_irq() for bridges too, so that the pin value is stored for bridges that require interrupts.

 drivers/pci/probe.c |    1 +
 1 files changed, 1 insertion(+)
drivers/pci/probe.c +1 -0
Index: linux-2.6.13/drivers/pci/probe.c
===================================================================
@@ -624,6 +624,7 @@ static int pci_setup_device(struct pci_d
 		/* The PCI-to-PCI bridge spec requires that subtractive
 		   decoding (i.e. transparent) bridge must have programming
 		   interface code of 0x01. */ 
+		pci_read_irq(dev);
 		dev->transparent = ((dev->class & 0xff) == 1);
 		pci_read_bases(dev, 2, PCI_ROM_ADDRESS1);
 		break;

-------------------------------------------------------
SF.Net email is sponsored by:
Tame your development challenges with Apache's Geronimo App Server. Download it for free - -and be entered to win a 42" plasma tv or your very own Sony(tm)PSP. Click here to play: http://sourceforge.net/geronimo.php