diff options
| author | Myron Stowe <myron.stowe@redhat.com> | 2012-07-09 17:36:46 -0400 |
|---|---|---|
| committer | Bjorn Helgaas <bhelgaas@google.com> | 2012-07-09 22:56:45 -0400 |
| commit | 735bff10c157fdbba2291e10ca3e28a59c7acc1c (patch) | |
| tree | 2cae34fe274546d5a9ab4e7a24699833aab0e8eb /drivers/pci | |
| parent | 3274c8eb26896fc4cae3b199de71e985e20771a9 (diff) | |
PCI: call final fixups hot-added devices
Final fixups are currently applied only at boot-time by
pci_apply_final_quirks(), which is an fs_initcall(). Hot-added devices
don't get these fixups, so they may not be completely initialized.
This patch makes us run final fixups for hot-added devices in
pci_bus_add_device() just before the new device becomes eligible for driver
binding.
This patch keeps the fs_initcall() for devices present at boot because we
do resource assignment between pci_bus_add_device and the fs_initcall(),
and we don't want to break any fixups that depend on that assignment. This
is a design issue that may be addressed in the future -- any resource
assignment should be done *before* device_add().
[bhelgaas: changelog]
Signed-off-by: Myron Stowe <myron.stowe@redhat.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Diffstat (limited to 'drivers/pci')
| -rw-r--r-- | drivers/pci/bus.c | 4 | ||||
| -rw-r--r-- | drivers/pci/quirks.c | 18 |
2 files changed, 22 insertions, 0 deletions
diff --git a/drivers/pci/bus.c b/drivers/pci/bus.c index 4ce5ef2f2826..b511bd4e3f7c 100644 --- a/drivers/pci/bus.c +++ b/drivers/pci/bus.c | |||
| @@ -164,6 +164,10 @@ pci_bus_alloc_resource(struct pci_bus *bus, struct resource *res, | |||
| 164 | int pci_bus_add_device(struct pci_dev *dev) | 164 | int pci_bus_add_device(struct pci_dev *dev) |
| 165 | { | 165 | { |
| 166 | int retval; | 166 | int retval; |
| 167 | extern bool pci_fixup_final_inited; | ||
| 168 | |||
| 169 | if (pci_fixup_final_inited) | ||
| 170 | pci_fixup_device(pci_fixup_final, dev); | ||
| 167 | retval = device_add(&dev->dev); | 171 | retval = device_add(&dev->dev); |
| 168 | if (retval) | 172 | if (retval) |
| 169 | return retval; | 173 | return retval; |
diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c index 4565f4ff8ae3..d8e9a0edf93c 100644 --- a/drivers/pci/quirks.c +++ b/drivers/pci/quirks.c | |||
| @@ -3028,6 +3028,22 @@ void pci_fixup_device(enum pci_fixup_pass pass, struct pci_dev *dev) | |||
| 3028 | } | 3028 | } |
| 3029 | EXPORT_SYMBOL(pci_fixup_device); | 3029 | EXPORT_SYMBOL(pci_fixup_device); |
| 3030 | 3030 | ||
| 3031 | |||
| 3032 | /* | ||
| 3033 | * The global variable 'pci_fixup_final_inited' is being used as a interim | ||
| 3034 | * solution for calling the final quirks only during hot-plug events (not | ||
| 3035 | * during boot processing). | ||
| 3036 | * | ||
| 3037 | * When the boot path's PCI device setup sequencing is addressed, we can | ||
| 3038 | * remove the instance, and usages of, 'pci_fixup_final_inited' along with | ||
| 3039 | * removing 'fs_initcall_sync(pci_apply_final_quirks);' and end up with a | ||
| 3040 | * single, uniform, solution that satisfies both the boot path and the | ||
| 3041 | * various hot-plug event paths. | ||
| 3042 | * | ||
| 3043 | * ToDo: Remove 'pci_fixup_final_inited' | ||
| 3044 | */ | ||
| 3045 | bool pci_fixup_final_inited; | ||
| 3046 | |||
| 3031 | static int __init pci_apply_final_quirks(void) | 3047 | static int __init pci_apply_final_quirks(void) |
| 3032 | { | 3048 | { |
| 3033 | struct pci_dev *dev = NULL; | 3049 | struct pci_dev *dev = NULL; |
| @@ -3058,6 +3074,8 @@ static int __init pci_apply_final_quirks(void) | |||
| 3058 | pci_cache_line_size = pci_dfl_cache_line_size; | 3074 | pci_cache_line_size = pci_dfl_cache_line_size; |
| 3059 | } | 3075 | } |
| 3060 | } | 3076 | } |
| 3077 | pci_fixup_final_inited = 1; | ||
| 3078 | |||
| 3061 | if (!pci_cache_line_size) { | 3079 | if (!pci_cache_line_size) { |
| 3062 | printk(KERN_DEBUG "PCI: CLS %u bytes, default %u\n", | 3080 | printk(KERN_DEBUG "PCI: CLS %u bytes, default %u\n", |
| 3063 | cls << 2, pci_dfl_cache_line_size << 2); | 3081 | cls << 2, pci_dfl_cache_line_size << 2); |
