- 在drivers/pci/quirks.c 中可以注册函数修复pcie的bug。例如
- static void quirk_mellanox_tavor(struct pci_dev *dev)
- {
- dev->broken_parity_status = 1; /* This device gives false positives */
- }
- DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_MELLANOX, PCI_DEVICE_ID_MELLANOX_TAVOR_BRIDGE, quirk_mellanox_tavor);
- 当在scan root port的时候发现vendor id是PCI_VENDOR_ID_MELLANOX的话,就会调用quirk_mellanox_tavor。
- 从这里可以通过DECLARE_PCI_FIXUP_FINAL 来注册回调函数来修复硬件bug
- 与之类似的函数还有很多,这些函数都定义在drivers/pci/pci.h 中
- #define DECLARE_PCI_FIXUP_CLASS_EARLY(vendor, device, class, \
- class_shift, hook) \
- DECLARE_PCI_FIXUP_SECTION(.pci_fixup_early, \
- hook, vendor, device, class, class_shift, hook)
- #define DECLARE_PCI_FIXUP_CLASS_HEADER(vendor, device, class, \
- class_shift, hook) \
- DECLARE_PCI_FIXUP_SECTION(.pci_fixup_header, \
- hook, vendor, device, class, class_shift, hook)
- #define DECLARE_PCI_FIXUP_CLASS_FINAL(vendor, device, class, \
- class_shift, hook) \
- DECLARE_PCI_FIXUP_SECTION(.pci_fixup_final, \
- hook, vendor, device, class, class_shift, hook)
- 这些回调函数会在pcie 初始化的不同阶段执行,可以从下面看到,总共可以在pcie运行过程中总共有8个点可以执行quirk的回调函数
- enum pci_fixup_pass {
- pci_fixup_early, /* Before probing BARs */
- 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_device_resume() */
- pci_fixup_suspend, /* pci_device_suspend() */
- pci_fixup_resume_early, /* pci_device_resume_early() */
- pci_fixup_suspend_late, /* pci_device_suspend_late() */
- };
PCI quirks.c介绍
最新推荐文章于 2024-09-10 19:50:13 发布