- 在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() */
- };
本文来自互联网用户投稿,文章观点仅代表作者本人,不代表本站立场,不承担相关法律责任。如若转载,请注明出处。 如若内容造成侵权/违法违规/事实不符,请点击【内容举报】进行投诉反馈!