More PCI fixes for 2.6.0-test2
Subsystems (3)
PATCH 1/1 More PCI fixes for 2.6.0-test2
Hi,
Here are a few more fixes for the PCI core code for 2.6.0-test2-bk. I've removed all of the struct device.name usages as that field is about to go away, and there is a fix from Ivan in here too.
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/char/agp/hp-agp.c | 2 +- drivers/net/eepro100.c | 2 +- drivers/pci/names.c | 2 +- drivers/pci/pci.c | 2 +- drivers/pci/pci.ids | 3 ++- drivers/pci/probe.c | 9 +++------ drivers/pci/proc.c | 7 ++++++- drivers/pci/quirks.c | 2 +- drivers/pci/setup-bus.c | 6 ++++-- drivers/pci/setup-res.c | 2 +- include/linux/pci.h | 3 +++ include/linux/pci_ids.h | 3 ++- 12 files changed, 26 insertions(+), 17 deletions(-)
-----
Alex Williamson:
o PCI: trivial 2.4/2.6 PCI name change/addition
Greg Kroah-Hartman:
o PCI: make eepro100 driver use pci_name() instead of dev.name
o PCI: remove all struct device.name usage from the PCI core code
Ivan Kokshaysky:
o PCI: pci_enable_device vs bridges bugs
PATCH 1/1 More PCI fixes for 2.6.0-test2
ChangeSet 1.1119.1.1, 2003/08/06 15:41:22-07:00, [email protected]
[PATCH] PCI: remove all struct device.name usage from the PCI core code.
This is because that field is going away shortly...
drivers/pci/names.c | 2 +- drivers/pci/probe.c | 9 +++------ drivers/pci/proc.c | 7 ++++++- drivers/pci/quirks.c | 2 +- drivers/pci/setup-bus.c | 2 +- drivers/pci/setup-res.c | 2 +- include/linux/pci.h | 3 +++ 7 files changed, 16 insertions(+), 11 deletions(-)
drivers/pci/names.c +1 -1
@@ -56,7 +56,7 @@ {const struct pci_vendor_info *vendor_p = pci_vendor_list;int i =VENDORS ; -char *name = dev->dev.name; +char *name = dev->pretty_name; do { if (vendor_p->vendor == dev->vendor)
drivers/pci/probe.c +3 -6
@@ -69,7 +69,7 @@for (pos=0 ; pos<howmany; pos = next) { next = pos+1 ; res = &dev->resource[pos]; - res->name = dev->dev.name; + res->name =pci_name (dev); reg =PCI_BASE_ADDRESS_0 + (pos <<2 );pci_read_config_dword (dev, reg, &l);pci_write_config_dword (dev, reg, ~0 );
@@ -120,7 +120,7 @@if (rom) { dev->rom_base_reg = rom; res = &dev->resource[PCI_ROM_RESOURCE ]; - res->name = dev->dev.name; + res->name =pci_name (dev);pci_read_config_dword (dev, rom, &l);pci_write_config_dword (dev, rom, ~PCI_ROM_ADDRESS_ENABLE );pci_read_config_dword (dev, rom, &sz);
@@ -153,7 +153,7 @@return ;if (dev->transparent) { -printk ("Transparent bridge - %s\n" , dev->dev.name); +printk ("Transparent bridge - %s\n" ,pci_name (dev));for (i =0 ; i <PCI_BUS_NUM_RESOURCES ; i++) child->resource[i] = child->parent->resource[i];return ;
@@ -406,8 +406,6 @@ dev->slot_name = dev->dev.bus_id;sprintf (pci_name (dev),"%04x:%02x:%02x.%d" ,pci_domain_nr (dev->bus), dev->bus->number,PCI_SLOT (dev->devfn),PCI_FUNC (dev->devfn)); -sprintf (dev->dev.name,"PCI device %04x:%04x" , - dev->vendor, dev->device);INIT_LIST_HEAD (&dev->pools);
@@ -663,7 +661,6 @@memset (b->dev,0 ,sizeof (*(b->dev))); b->dev->parent = parent;sprintf (b->dev->bus_id,"pci%04x:%02x" ,pci_domain_nr (b), bus); -strcpy (b->dev->name,"Host/PCI Bridge" );device_register (b->dev); b->number = b->secondary = bus;
drivers/pci/proc.c +6 -1
@@ -483,7 +483,12 @@seq_printf (m," %s" , class); else seq_printf(m, " Class %04x", class_rev >> 16); -seq_printf (m,": %s (rev %d).\n" , dev->dev.name, class_rev &0xff ); +#ifdef CONFIG_PCI_NAMES +seq_printf (m,": %s" , dev->pretty_name); +#else +seq_printf (m,": PCI device %04x:%04x" , dev->vendor, dev->device); +#endif +seq_printf (m," (rev %d).\n" , class_rev &0xff );if (dev->irq)seq_printf (m," IRQ %d.\n" , dev->irq);
drivers/pci/quirks.c +1 -1
@@ -219,7 +219,7 @@if (region) {struct resource *res = dev->resource + nr; - res->name = dev->dev.name; + res->name =pci_name (dev); res->start = region; res->end = region + size -1 ; res->flags =IORESOURCE_IO ;
drivers/pci/setup-bus.c +1 -1
@@ -141,7 +141,7 @@u32 l;DBGC ((KERN_INFO "PCI: Bus %d, bridge: %s\n" , - bus->number, bridge->dev.name)); + bus->number,pci_name (bridge)));/* Set up the top and bottom of the PCI I/O segment for this bus. */ pcibios_resource_to_bus (bridge, ®ion, bus->resource[0 ]);
drivers/pci/setup-res.c +1 -1
@@ -166,7 +166,7 @@if (!r_align) {printk (KERN_WARNING "PCI: Ignore bogus resource %d " "[%lx:%lx] of %s\n" , - i, r->start, r->end, dev->dev.name); + i, r->start, r->end,pci_name (dev));continue ; } r_align = (i <PCI_BRIDGE_RESOURCES ) ? r_align +1 : r->start;
include/linux/pci.h +3 -0
@@ -419,6 +419,9 @@/* These fields are used by common fixups */ unsigned int transparent:1; /* Transparent PCI bridge */ unsigned int multifunction:1;/* Part of multi-function device */ +#ifdef CONFIG_PCI_NAMES +char pretty_name[DEVICE_NAME_SIZE ];/* pretty name for users to see */ +#endif };#define pci_dev_g (n) list_entry(n, struct pci_dev, global_list)
ChangeSet 1.1119.1.2, 2003/08/06 15:41:35-07:00, [email protected]
[PATCH] PCI: make eepro100 driver use pci_name() instead of dev.name.
drivers/net/eepro100.c | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-)
drivers/net/eepro100.c +1 -1
@@ -743,7 +743,7 @@if (eeprom[3 ] &0x0100 ) product ="OEM i82557/i82558 10/100 Ethernet" ;else - product = pdev->dev.name; + product =pci_name (pdev);printk (KERN_INFO "%s: %s, " , dev->name, product);
ChangeSet 1.1119.1.3, 2003/08/06 16:16:40-07:00, [email protected]
[PATCH] PCI: trivial 2.4/2.6 PCI name change/addition
This patch renames the PCI-X adapter found in HP zx1 and sx1000
ia64 systems to something more generic and descriptive. It also adds an ID for the PCI adapter used in sx1000. Patches against 2.4.21+ia64 and 2.6.0-test2+ia64 attached. Thanks,
drivers/char/agp/hp-agp.c | 2 +- drivers/pci/pci.ids | 3 ++- include/linux/pci_ids.h | 3 ++- 3 files changed, 5 insertions(+), 3 deletions(-)
drivers/char/agp/hp-agp.c +1 -1
@@ -398,7 +398,7 @@ bridge->driver = &hp_zx1_driver; fake_bridge_dev.vendor =PCI_VENDOR_ID_HP ; - fake_bridge_dev.device =PCI_DEVICE_ID_HP_ZX1_LBA ; + fake_bridge_dev.device =PCI_DEVICE_ID_HP_PCIX_LBA ; bridge->dev = &fake_bridge_dev;return agp_add_bridge (bridge);
drivers/pci/pci.ids +2 -1
@@ -1286,6 +1286,7 @@ 103c 1226 Keystone SP2 103c 1227 Powerbar SP2 103c 1282 Everest SP2 + 1054 PCI Local Bus Adapter 1064 79C970 PCnet Ethernet Controller 108b Visualize FXe 10c1 NetServer Smart IRQ Router
@@ -1297,7 +1298,7 @@ 121c NetServer PCI COM Port Decoder 1229 zx1 System Bus Adapter 122a zx1 I/O Controller - 122e zx1 Local Bus Adapter + 122e PCI-X/AGP Local Bus Adapter 1290 Auxiliary Diva Serial Port 2910 E2910A PCIBus Exerciser 2925 E2925A 32 Bit, 33 MHzPCI Exerciser & Analyzer
include/linux/pci_ids.h +2 -1
@@ -608,6 +608,7 @@#define PCI_DEVICE_ID_HP_DIVA_TOSCA1 0x1049#define PCI_DEVICE_ID_HP_DIVA_TOSCA2 0x104A#define PCI_DEVICE_ID_HP_DIVA_MAESTRO 0x104B +#define PCI_DEVICE_ID_HP_PCI_LBA 0x1054#define PCI_DEVICE_ID_HP_REO_SBA 0x10f0#define PCI_DEVICE_ID_HP_REO_IOC 0x10f1#define PCI_DEVICE_ID_HP_VISUALIZE_FXE 0x108b
@@ -616,7 +617,7 @@#define PCI_DEVICE_ID_HP_DIVA_POWERBAR 0x1227#define PCI_DEVICE_ID_HP_ZX1_SBA 0x1229#define PCI_DEVICE_ID_HP_ZX1_IOC 0x122a -#define PCI_DEVICE_ID_HP_ZX1_LBA 0x122e +#define PCI_DEVICE_ID_HP_PCIX_LBA 0x122e#define PCI_DEVICE_ID_HP_SX1000_IOC 0x127c#define PCI_DEVICE_ID_HP_DIVA_EVEREST 0x1282#define PCI_DEVICE_ID_HP_DIVA_AUX 0x1290
ChangeSet 1.1119.1.4, 2003/08/08 17:03:19-07:00, [email protected]
[PATCH] PCI: pci_enable_device vs bridges bugs
Bug #1 (found by Jay Estabrook).
On Alpha, under certain circumstances the firmware may close the IO window of PCI-to-PCI bridge even if there is IO behind.
This wouldn't be a problem - linux PCI setup code does set up this window properly, but in addition the firmware clears the IO-enable bit in the PCI_COMMAND register of the bridge.
Since we don't call pci_enable_* routines for bridges in non-hotplug path, we end up with disabled IO. Fixed by adding pci_enable_bridges() to pci_assign_unassigned_resources().
Architectures which don't use the latter, but do use other setup-bus code (parisc?) also should call pci_enable_bridges() for each root bus.
Bug #2 (closely related to #1).
As it turns out, pci_enable_device() doesn't work for bridges at all, only for regular devices (header type 0) due to 0x3f mask passed to pci_enable_device_bars(). The mask should be (1 << PCI_NUM_RESOURCES) - 1.
Bug #3 (quite a few archs, including i386). pcibios_enable_device() does only check first 6 resources (regardless of the mask) to decide whether or not to enable IO and MEM. Bridge resources start at 7.
#2 and #3 affect hotplug. I wonder, has anybody ever tried *bridged* PCI card behind a hot-plug controller?
drivers/pci/pci.c | 2 +- drivers/pci/setup-bus.c | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-)
drivers/pci/pci.c +1 -1
@@ -359,7 +359,7 @@int pci_enable_device (struct pci_dev *dev) { -return pci_enable_device_bars (dev,0x3F ); +return pci_enable_device_bars (dev, (1 <<PCI_NUM_RESOURCES ) -1 ); }/**
drivers/pci/setup-bus.c +3 -1
@@ -530,6 +530,8 @@for (ln=pci_root_buses.next; ln != &pci_root_buses; ln=ln->next)pci_bus_size_bridges (pci_bus_b (ln));/* Depth last, allocate resources and update the hardware. */ -for (ln=pci_root_buses.next; ln != &pci_root_buses; ln=ln->next) +for (ln=pci_root_buses.next; ln != &pci_root_buses; ln=ln->next) {pci_bus_assign_resources (pci_bus_b (ln)); +pci_enable_bridges (pci_bus_b (ln)); + } }
Quoted 3 lines · Greg KH
Here are a few more fixes for the PCI core code for 2.6.0-test2-bk. I've removed all of the struct device.name usages as that field is about to go away, and there is a fix from Ivan in here too.
When was that decided? I don't remember seeing any discussion, and since it affects more than PCI... Seems like a backwards step to me.
Signature · 2 lines
Russell King ([email protected]) The developer of ARM Linux http://www.arm.linux.org.uk/personal/aboutme.html
Quoted 7 lines · Russell King
Quoted 3 lines · Greg KH
Here are a few more fixes for the PCI core code for 2.6.0-test2-bk. I've removed all of the struct device.name usages as that field is about to go away, and there is a fix from Ivan in here too.
When was that decided? I don't remember seeing any discussion, and since it affects more than PCI... Seems like a backwards step to me.
We discussed this at OLS/Kernel Summit. I sure thought you were there for that conversation. The PnP, USB, I2C, and PCI core is already cleaned up, with patches in 2.6.0-test3, and I have a patch around here that fixes up the rest of the kernel (SCSI, PCMCIA, and then the driver core.) I'll send them out next week.
Basically, we don't want to be carrying around info if we don't really need it (like the PCI names database.) All of this info can already be found from userspace programs, with a few exceptions. I2C is one such exception, so I've added the name back into the local structure (and will export it to sysfs once the driver core 'name' file removal patch is in.)
This is a nice memory savings for the majority of the users of the struct device structure.
thanks,
greg k-h