* ngbe_set_pcie_master - Disable or Enable PCI-express master access * @hw: pointer to hardware structure * * Disables PCI-Express master access and verifies there are no pending * requests. NGBE_ERR_MASTER_REQUESTS_PENDING is returned if master disable * bit hasn't caused the master requests to be disabled, else 0 * is returned signifying master requests disabled. **/
| 1070 | * is returned signifying master requests disabled. |
| 1071 | **/ |
| 1072 | s32 ngbe_set_pcie_master(struct ngbe_hw *hw, bool enable) |
| 1073 | { |
| 1074 | struct rte_pci_device *pci_dev = (struct rte_pci_device *)hw->back; |
| 1075 | s32 status = 0; |
| 1076 | u32 i; |
| 1077 | |
| 1078 | if (rte_pci_set_bus_master(pci_dev, enable) < 0) { |
| 1079 | DEBUGOUT("Cannot configure PCI bus master"); |
| 1080 | return -1; |
| 1081 | } |
| 1082 | |
| 1083 | if (enable) |
| 1084 | goto out; |
| 1085 | |
| 1086 | /* Exit if master requests are blocked */ |
| 1087 | if (!(rd32(hw, NGBE_BMEPEND)) || |
| 1088 | NGBE_REMOVED(hw->hw_addr)) |
| 1089 | goto out; |
| 1090 | |
| 1091 | /* Poll for master request bit to clear */ |
| 1092 | for (i = 0; i < NGBE_PCI_MASTER_DISABLE_TIMEOUT; i++) { |
| 1093 | usec_delay(100); |
| 1094 | if (!(rd32(hw, NGBE_BMEPEND))) |
| 1095 | goto out; |
| 1096 | } |
| 1097 | |
| 1098 | DEBUGOUT("PCIe transaction pending bit also did not clear."); |
| 1099 | status = NGBE_ERR_MASTER_REQUESTS_PENDING; |
| 1100 | |
| 1101 | out: |
| 1102 | return status; |
| 1103 | } |
| 1104 | |
| 1105 | /** |
| 1106 | * ngbe_acquire_swfw_sync - Acquire SWFW semaphore |
no test coverage detected