pci: Fix multiple problems with VIA hardware
Subsystems (3)
PATCH 1/1 pci: Fix multiple problems with VIA hardware
This patch is designed to fix:
- Disk eating corruptor on KT7 after resume from RAM
- VIA IRQ handling
- VIA fixups for bus lockups after resume from RAM
The core of this is to add a table of resume fixups run at resume time. We need to do this for a variety of boards and features, but particularly we need to do this to get various critical VIA fixups done on resume.
The second part of the problem is to handle VIA IRQ number rules which are a bit odd and need special handling for PIC interrupts. Various patches broke various boxes and while this one may not be perfect (hopefully it is) it ensures the workaround is applied to the right devices only.
Signed-off-by Alan Cox <[email protected]>
arch/i386/pci/fixup.c +10 -3
@@ -117,7 +117,7 @@#define VIA_8363_KL133_REVISION_ID 0x81#define VIA_8363_KM133_REVISION_ID 0x84 -static void __devinit pci_fixup_via_northbridge_bug (struct pci_dev *d) +static void pci_fixup_via_northbridge_bug (struct pci_dev *d) {u8 v;u8 revision;
@@ -153,6 +153,10 @@DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_VIA ,PCI_DEVICE_ID_VIA_8622 , pci_fixup_via_northbridge_bug);DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_VIA ,PCI_DEVICE_ID_VIA_8361 , pci_fixup_via_northbridge_bug);DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_VIA ,PCI_DEVICE_ID_VIA_8367_0 , pci_fixup_via_northbridge_bug); +DECLARE_PCI_FIXUP_RESUME (PCI_VENDOR_ID_VIA ,PCI_DEVICE_ID_VIA_8363_0 , pci_fixup_via_northbridge_bug); +DECLARE_PCI_FIXUP_RESUME (PCI_VENDOR_ID_VIA ,PCI_DEVICE_ID_VIA_8622 , pci_fixup_via_northbridge_bug); +DECLARE_PCI_FIXUP_RESUME (PCI_VENDOR_ID_VIA ,PCI_DEVICE_ID_VIA_8361 , pci_fixup_via_northbridge_bug); +DECLARE_PCI_FIXUP_RESUME (PCI_VENDOR_ID_VIA ,PCI_DEVICE_ID_VIA_8367_0 , pci_fixup_via_northbridge_bug);/* * For some reasons Intel decided that certain parts of their
@@ -183,7 +187,7 @@* issue another HALT within 80 ns of the initial HALT, the failure condition * is avoided. */ -static void __init pci_fixup_nforce2 (struct pci_dev *dev) +static void pci_fixup_nforce2 (struct pci_dev *dev) {u32 val;
@@ -206,6 +210,7 @@ } }DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_NVIDIA ,PCI_DEVICE_ID_NVIDIA_NFORCE2 , pci_fixup_nforce2); +DECLARE_PCI_FIXUP_RESUME (PCI_VENDOR_ID_NVIDIA ,PCI_DEVICE_ID_NVIDIA_NFORCE2 , pci_fixup_nforce2);/* Max PCI Express root ports */ #define MAX_PCIEROOT 6
@@ -421,7 +426,7 @@* Prevent the BIOS trapping accesses to the Cyrix CS5530A video device * configuration space. */ -static void __devinit pci_early_fixup_cyrix_5530 (struct pci_dev *dev) +static void pci_early_fixup_cyrix_5530 (struct pci_dev *dev) {u8 r;/* clear 'F4 Video Configuration Trap' bit */
@@ -431,3 +436,5 @@ }DECLARE_PCI_FIXUP_EARLY (PCI_VENDOR_ID_CYRIX ,PCI_DEVICE_ID_CYRIX_5530_LEGACY , pci_early_fixup_cyrix_5530); +DECLARE_PCI_FIXUP_RESUME (PCI_VENDOR_ID_CYRIX ,PCI_DEVICE_ID_CYRIX_5530_LEGACY , + pci_early_fixup_cyrix_5530);
drivers/pci/pci-driver.c +2 -0
@@ -357,6 +357,8 @@struct pci_dev * pci_dev =to_pci_dev (dev);struct pci_driver * drv = pci_dev->driver; +pci_fixup_device (pci_fixup_resume, pci_dev); +if (drv && drv->resume_early) error = drv->resume_early (pci_dev);return error;
drivers/pci/quirks.c +112 -54
399 lines not on this page · raw message
drivers/pci/search.c +22 -17
@@ -413,6 +413,24 @@return dev; } +const struct pci_device_id *pci_find_present (const struct pci_device_id *ids) +{ +struct pci_dev *dev; +struct pci_device_id * found =NULL ; + +WARN_ON (in_interrupt ()); +down_read (&pci_bus_sem); +while (ids->vendor || ids->subvendor || ids->class_mask) { +list_for_each_entry (dev, &pci_devices, global_list) { +if ((found =pci_match_one_device (ids, dev)) !=NULL ) +break ; + } + ids++; + } +up_read (&pci_bus_sem); +return found; +} +/** * pci_dev_present - Returns 1 if device matching the device list is present, 0 if not. * @ids: A pointer to a null terminated list of struct pci_device_id structures
@@ -424,27 +442,14 @@* find devices that are usually built into a system, or for a general hint as * to if another device happens to be present at this specific moment in time. */ +int pci_dev_present (const struct pci_device_id *ids) { -struct pci_dev *dev; -int found =0 ; - -WARN_ON (in_interrupt ()); -down_read (&pci_bus_sem); -while (ids->vendor || ids->subvendor || ids->class_mask) { -list_for_each_entry (dev, &pci_devices, global_list) { -if (pci_match_one_device (ids, dev)) { - found =1 ; - goto exit; - } - } - ids++; - } -exit: -up_read (&pci_bus_sem); -return found; +return pci_find_present (ids) ==NULL ?0 :1 ; } +EXPORT_SYMBOL (pci_dev_present); +EXPORT_SYMBOL (pci_find_present);EXPORT_SYMBOL (pci_find_device);EXPORT_SYMBOL (pci_find_device_reverse);
include/asm-generic/vmlinux.lds.h +3 -0
@@ -35,6 +35,9 @@ VMLINUX_SYMBOL(__start_pci_fixups_enable) = .; \ *(.pci_fixup_enable) \ VMLINUX_SYMBOL(__end_pci_fixups_enable) = .; \ + VMLINUX_SYMBOL(__start_pci_fixups_resume) = .; \ + *(.pci_fixup_resume) \ + VMLINUX_SYMBOL(__end_pci_fixups_resume) = .; \ } \ \/* RapidIO route ops */ \
include/linux/libata.h +0 -4
@@ -110,10 +110,6 @@#define ATA_TAG_POISON 0xfafbfcfdU/* move to PCI layer? */ -#define PCI_VDEVICE (vendor, device) \ - PCI_VENDOR_ID_##vendor, (device), \ - PCI_ANY_ID, PCI_ANY_ID, 0, 0 -static inline struct device *pci_dev_to_dev (struct pci_dev *pdev) {return &pdev->dev;
include/linux/pci.h +21 -0
@@ -389,6 +389,21 @@ .vendor = PCI_ANY_ID, .device = PCI_ANY_ID, \ .subvendor = PCI_ANY_ID, .subdevice = PCI_ANY_ID +/** +* PCI_VDEVICE - macro used to describe a specific pci device in short form +* @vend: the vendor name +* @dev: the 16 bit PCI Device ID +* +* This macro is used to create a struct pci_device_id that matches a +* specific PCI device. The subvendor, and subdevice fields will be set +* to PCI_ANY_ID. The macro allows the next field to follow as the device +* private data. + */ + +#define PCI_VDEVICE (vendor, device) \ + PCI_VENDOR_ID_##vendor, (device), \ + PCI_ANY_ID, PCI_ANY_ID, 0, 0 +/* these external functions are only available when PCI support is enabled */ #ifdef CONFIG_PCI
@@ -461,6 +476,7 @@struct pci_dev *pci_get_bus_and_slot (unsigned int bus,unsigned int devfn);struct pci_dev *pci_get_class (unsigned int class,struct pci_dev *from);int pci_dev_present (const struct pci_device_id *ids); +const struct pci_device_id *pci_find_present (const struct pci_device_id *ids);int pci_bus_read_config_byte (struct pci_bus *bus,unsigned int devfn,int where,u8 *val);int pci_bus_read_config_word (struct pci_bus *bus,unsigned int devfn,int where,u16 *val);
@@ -684,6 +700,7 @@ {return NULL ; }#define pci_dev_present (ids) (0) +#define pci_find_present (ids) (NULL)#define pci_dev_put (dev) do { } while (0)static inline void pci_set_master (struct pci_dev *dev) { }
@@ -786,6 +803,7 @@ pci_fixup_header,/* After reading configuration header */ pci_fixup_final,/* Final phase of device fixups */ pci_fixup_enable,/* pci_enable_device() time */ + pci_fixup_resume, /* pci_enable_device() time */ };/* Anonymous variables would be nice... */
@@ -804,6 +822,9 @@#define DECLARE_PCI_FIXUP_ENABLE (vendor, device, hook) \ DECLARE_PCI_FIXUP_SECTION(.pci_fixup_enable, \ vendor##device##hook, vendor, device, hook) +#define DECLARE_PCI_FIXUP_RESUME (vendor, device, hook) \ + DECLARE_PCI_FIXUP_SECTION(.pci_fixup_resume, \ + resume##vendor##device##hook, vendor, device, hook)void pci_fixup_device (enum pci_fixup_pass pass,struct pci_dev *dev);