Skip to contentSkip to conversation

PCI fixes for 2.6.7-rc1

PATCH New Greg KH 1 participant 7 messages May 28, 2004 PCI

lore
Share & tools
lore

Greg KH

author
#0 lore raw

PATCH 1/1 PCI fixes for 2.6.7-rc1

Hi,

Here are some small PCI patches for 2.6.7-rc1. They are a few pci id updates, janitor fixes, and a suspend bus fix patch. They have all been in the last few -mm releases.

Please pull from:

	bk://kernel.bkbits.net/gregkh/linux/pci-2.6

thanks,

greg k-h

p.s. I'll send these as patches in response to this email to lkml for those who want to see them.

 drivers/pci/pci-driver.c |   26 ++++++++++++++++++++++++--
 drivers/pci/pci.c        |    5 +++++
 drivers/pci/pci.ids      |   26 +++++++++++++-------------
 drivers/pci/probe.c      |    2 ++
 include/linux/pci.h      |    5 +++++
 include/linux/pci_ids.h  |   16 ++++++++++++++++
 6 files changed, 65 insertions(+), 15 deletions(-)

-----

<trimmer:infiniconsys.com>:
o PCI: Add InfiniCon PCI ID to pci_ids.h

Arjan van de Ven:
o PCI: restore pci config space on resume

Greg Kroah-Hartman:
o Reversed pci.ids changes, as Linus already fixed them in his tree
o PCI: fix up build warnings in pci.ids file

Luiz Capitulino:
o PCI: fix pci/probe.c possible NULL pointer

Roland Dreier:
o PCI: Add InfiniBand HCA IDs to pci_ids.h

author
#1 lore raw

PATCH 1/1 PCI fixes for 2.6.7-rc1

ChangeSet 1.1717.6.23, 2004/05/18 23:56:57-07:00, [email protected]

[PATCH] PCI: fix up build warnings in pci.ids file.

 drivers/pci/pci.ids |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)
drivers/pci/pci.ids +4 -4
diff -Nru a/drivers/pci/pci.ids b/drivers/pci/pci.ids
@@ -2331,7 +2331,7 @@
 	c801  PCI-GPIB
 	c831  PCI-GPIB bridge
 1094  First International Computers [FIC]
-1095  Silicon Image, Inc. (formerly CMD Technology Inc)
+1095  Silicon Image, Inc.
 	0240  Adaptec AAR-1210SA SATA HostRAID Controller
 	0640  PCI0640
 	0643  PCI0643
@@ -5155,7 +5155,7 @@
 	9132  Ethernet 100/10 MBit
 1283  Integrated Technology Express, Inc.
 	673a  IT8330G
-	8212  IT/ITE8212 Dual channel ATA RAID controller (PCI version seems to be IT8212, embedded seems to be ITE8212)
+	8212  IT/ITE8212 Dual channel ATA RAID controller
 	8330  IT8330G
 	8872  IT8874F PCI Dual Serial Port Controller
 	8888  IT8888F PCI to ISA Bridge with SMB
@@ -6098,7 +6098,7 @@
 	0340  PC4800
 	0350  PC4800
 	4500  PC4500
-	4800  Cisco Aironet 340 802.11b Wireless LAN Adapter/Aironet PC4800
+	4800  Cisco Aironet 340 802.11b Wireless LAN Adapter
 	a504  Cisco Aironet Wireless 802.11b
 	a505  Cisco Aironet CB20a 802.11a Wireless LAN Adapter
 14ba  INTERNIX Inc.
@@ -6824,7 +6824,7 @@
 1629  Kongsberg Spacetec AS
 	1003  Format synchronizer v3.0
 	2002  Fast Universal Data Output
-1638  Standard Microsystems Corp [SMC]
+1638  SMC
 	1100  SMC2602W EZConnect / Addtron AWA-100 / Eumitcom PCI WL11000
 163c  Smart Link Ltd.
 	3052  SmartLink SmartPCI562 56K Modem
author
#2 lore raw

ChangeSet 1.1717.6.24, 2004/05/18 23:57:17-07:00, [email protected]

[PATCH] PCI: Add InfiniBand HCA IDs to pci_ids.h

Add InfiniBand HCA IDs to pci_ids.h.

 include/linux/pci_ids.h |    7 +++++++
 1 files changed, 7 insertions(+)
include/linux/pci_ids.h +7 -0
diff -Nru a/include/linux/pci_ids.h b/include/linux/pci_ids.h
@@ -1870,6 +1870,11 @@
 #define PCI_VENDOR_ID_ZOLTRIX		0x15b0
 #define PCI_DEVICE_ID_ZOLTRIX_2BD0	0x2bd0 
 
+#define PCI_VENDOR_ID_MELLANOX		0x15b3
+#define PCI_DEVICE_ID_MELLANOX_TAVOR	0x5a44
+#define PCI_DEVICE_ID_MELLANOX_ARBEL_COMPAT 0x6278
+#define PCI_DEVICE_ID_MELLANOX_ARBEL	0x6282
+
 #define PCI_VENDOR_ID_PDC		0x15e9
 #define PCI_DEVICE_ID_PDC_1841		0x1841
 
@@ -1890,6 +1895,8 @@
 #define PCI_VENDOR_ID_S2IO		0x17d5
 #define	PCI_DEVICE_ID_S2IO_WIN		0x5731
 #define	PCI_DEVICE_ID_S2IO_UNI		0x5831
+
+#define PCI_VENDOR_ID_TOPSPIN		0x1867
 
 #define PCI_VENDOR_ID_ARC               0x192E
 #define PCI_DEVICE_ID_ARC_EHCI          0x0101
author
#3 lore raw

ChangeSet 1.1717.6.25, 2004/05/19 10:33:24-07:00, [email protected]

Reversed pci.ids changes, as Linus already fixed them in his tree

 drivers/pci/pci.ids |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)
drivers/pci/pci.ids +4 -4
diff -Nru a/drivers/pci/pci.ids b/drivers/pci/pci.ids
@@ -2331,7 +2331,7 @@
 	c801  PCI-GPIB
 	c831  PCI-GPIB bridge
 1094  First International Computers [FIC]
-1095  Silicon Image, Inc.
+1095  Silicon Image, Inc. (formerly CMD Technology Inc)
 	0240  Adaptec AAR-1210SA SATA HostRAID Controller
 	0640  PCI0640
 	0643  PCI0643
@@ -5155,7 +5155,7 @@
 	9132  Ethernet 100/10 MBit
 1283  Integrated Technology Express, Inc.
 	673a  IT8330G
-	8212  IT/ITE8212 Dual channel ATA RAID controller
+	8212  IT/ITE8212 Dual channel ATA RAID controller (PCI version seems to be IT8212, embedded seems to be ITE8212)
 	8330  IT8330G
 	8872  IT8874F PCI Dual Serial Port Controller
 	8888  IT8888F PCI to ISA Bridge with SMB
@@ -6098,7 +6098,7 @@
 	0340  PC4800
 	0350  PC4800
 	4500  PC4500
-	4800  Cisco Aironet 340 802.11b Wireless LAN Adapter
+	4800  Cisco Aironet 340 802.11b Wireless LAN Adapter/Aironet PC4800
 	a504  Cisco Aironet Wireless 802.11b
 	a505  Cisco Aironet CB20a 802.11a Wireless LAN Adapter
 14ba  INTERNIX Inc.
@@ -6824,7 +6824,7 @@
 1629  Kongsberg Spacetec AS
 	1003  Format synchronizer v3.0
 	2002  Fast Universal Data Output
-1638  SMC
+1638  Standard Microsystems Corp [SMC]
 	1100  SMC2602W EZConnect / Addtron AWA-100 / Eumitcom PCI WL11000
 163c  Smart Link Ltd.
 	3052  SmartLink SmartPCI562 56K Modem
author
#4 lore raw

ChangeSet 1.1717.6.26, 2004/05/26 15:37:25-07:00, [email protected]

[PATCH] PCI: restore pci config space on resume

The patch below enhances the PCI layer with 2 things
1) enable and busmaster state are stored in the pci device struct
2) pci config space is stored to the pci device struct

with that, it is possible to make a generic pci resume method that restores config space and reenables the device, including busmaster when appropriate.

One can rightfully argue that the driver resume method should do this, and yes that is right. So the patch only does it for devices that don't have a resume method. Like the main PCI bridge on my testbox of which the bios so nicely forgets to restore the bus master bit during resume.. With this patch my testbox resumes just fine while it, well, wasn't all too happy as you can imagine without a busmaster pci bridge.

 drivers/pci/pci-driver.c |   26 ++++++++++++++++++++++++--
 drivers/pci/pci.c        |    5 +++++
 include/linux/pci.h      |    5 +++++
 3 files changed, 34 insertions(+), 2 deletions(-)
drivers/pci/pci-driver.c +24 -2
diff -Nru a/drivers/pci/pci-driver.c b/drivers/pci/pci-driver.c
@@ -299,10 +299,30 @@
 {
 	struct pci_dev * pci_dev = to_pci_dev(dev);
 	struct pci_driver * drv = pci_dev->driver;
+	int i = 0;
 
 	if (drv && drv->suspend)
-		return drv->suspend(pci_dev,state);
-	return 0;
+		i = drv->suspend(pci_dev,state);
+		
+	pci_save_state(pci_dev, pci_dev->saved_config_space);
+	return i;
+}
+
+
+/* 
+ * Default resume method for devices that have no driver provided resume,
+ * or not even a driver at all.
+ */
+static void pci_default_resume(struct pci_dev *pci_dev)
+{
+	/* restore the PCI config space */
+	pci_restore_state(pci_dev, pci_dev->saved_config_space);
+	/* if the device was enabled before suspend, reenable */
+	if (pci_dev->is_enabled)
+		pci_enable_device(pci_dev);
+	/* if the device was busmaster before the suspend, make it busmaster again */
+	if (pci_dev->is_busmaster)
+		pci_set_master(pci_dev);
 }
 
 static int pci_device_resume(struct device * dev)
@@ -312,6 +332,8 @@
 
 	if (drv && drv->resume)
 		drv->resume(pci_dev);
+	else
+		pci_default_resume(pci_dev);
 	return 0;
 }
 
drivers/pci/pci.c +5 -0
diff -Nru a/drivers/pci/pci.c b/drivers/pci/pci.c
@@ -385,6 +385,7 @@
 int
 pci_enable_device(struct pci_dev *dev)
 {
+	dev->is_enabled = 1;
 	return pci_enable_device_bars(dev, (1 << PCI_NUM_RESOURCES) - 1);
 }
 
@@ -399,6 +400,9 @@
 pci_disable_device(struct pci_dev *dev)
 {
 	u16 pci_command;
+	
+	dev->is_enabled = 0;
+	dev->is_busmaster = 0;
 
 	pci_read_config_word(dev, PCI_COMMAND, &pci_command);
 	if (pci_command & PCI_COMMAND_MASTER) {
@@ -601,6 +605,7 @@
 		cmd |= PCI_COMMAND_MASTER;
 		pci_write_config_word(dev, PCI_COMMAND, cmd);
 	}
+	dev->is_busmaster = 1;
 	pcibios_set_master(dev);
 }
 
include/linux/pci.h +5 -0
diff -Nru a/include/linux/pci.h b/include/linux/pci.h
@@ -488,6 +488,11 @@
 	/* These fields are used by common fixups */
 	unsigned int	transparent:1;	/* Transparent PCI bridge */
 	unsigned int	multifunction:1;/* Part of multi-function device */
+	/* keep track of device state */
+	unsigned int	is_enabled:1;	/* pci_enable_device has been called */
+	unsigned int	is_busmaster:1; /* device is busmaster */
+	
+	unsigned int 	saved_config_space[16]; /* config space saved at suspend time */
 #ifdef CONFIG_PCI_NAMES
 #define PCI_NAME_SIZE	96
 #define PCI_NAME_HALF	__stringify(43)	/* less than half to handle slop */
author
#5 lore raw

ChangeSet 1.1758, 2004/05/28 13:36:07-07:00, [email protected]

[PATCH] PCI: Add InfiniCon PCI ID to pci_ids.h

We would like to have the InfiniCon PCI Vendor ID added to pci_ids.h Below is a context diff, which would would greatly appreciate if you applied and included in future kernel releases.

 include/linux/pci_ids.h |    2 ++
 1 files changed, 2 insertions(+)
include/linux/pci_ids.h +2 -0
diff -Nru a/include/linux/pci_ids.h b/include/linux/pci_ids.h
@@ -1910,6 +1910,8 @@
 #define	PCI_DEVICE_ID_S2IO_WIN		0x5731
 #define	PCI_DEVICE_ID_S2IO_UNI		0x5831
 
+#define PCI_VENDOR_ID_INFINICON		0x1820
+
 #define PCI_VENDOR_ID_TOPSPIN		0x1867
 
 #define PCI_VENDOR_ID_ARC               0x192E
author
#6 lore raw

ChangeSet 1.1759, 2004/05/28 13:37:08-07:00, [email protected]

[PATCH] PCI: fix pci/probe.c possible NULL pointer.

In drivers/pci/probe.c::pci_scan_bridge() the call for pci_alloc_child_bus()
can return NULL, but it is not handled by the function (detected by Coverity's checker).

The patch bellow fix that returning `max' if we got the NULL, but
I do not know if it is right. I guess it is, because in that case the function will act in the same way as with `pass != 0'.

Signed-off by: Luiz Capitulino <[email protected]>

 drivers/pci/probe.c |    2 ++
 1 files changed, 2 insertions(+)
drivers/pci/probe.c +2 -0
diff -Nru a/drivers/pci/probe.c b/drivers/pci/probe.c
@@ -366,6 +366,8 @@
 			return max;
 		busnr = (buses >> 8) & 0xFF;
 		child = pci_alloc_child_bus(bus, dev, busnr);
+		if (!child)
+			return max;
 		child->primary = buses & 0xFF;
 		child->subordinate = (buses >> 16) & 0xFF;
 		child->bridge_ctl = bctl;