2 * The PCI Utilities -- Margining utility main header
4 * Copyright (c) 2023 KNS Group LLC (YADRO)
6 * Can be freely distributed and used under the terms of the GNU GPL v2+.
8 * SPDX-License-Identifier: GPL-2.0-or-later
18 /* PCI Device wrapper for margining functions */
26 /* Saved Device settings to restore after margining */
28 bool hasd; // Hardware Autonomous Speed Disable
29 bool hawd; // Hardware Autonomous Width Disable
33 struct margin_dev down_port;
34 struct margin_dev up_port;
39 /* Verify that devices form the link with 16 GT/s or 32 GT/s data rate */
40 bool margin_verify_link(struct pci_dev *down_port, struct pci_dev *up_port);
42 /* Check Margining Ready bit from Margining Port Status Register */
43 bool margin_check_ready_bit(struct pci_dev *dev);
45 /* Verify link and fill wrappers */
46 bool margin_fill_link(struct pci_dev *down_port, struct pci_dev *up_port,
47 struct margin_link *wrappers);
49 /* Disable ASPM, set Hardware Autonomous Speed/Width Disable bits */
50 bool margin_prep_link(struct margin_link *link);
52 /* Restore ASPM, Hardware Autonomous Speed/Width settings */
53 void margin_restore_link(struct margin_link *link);