/* Disables PCI-Express master access and verifies there are no pending requests.  */
s32 igb_disable_pcie_master(struct e1000_hw *hw)
/* Disables PCI-Express master access and verifies there are no pending requests.  */
s32 igb_disable_pcie_master(struct e1000_hw *hw)
{
	u32 ctrl;
	s32 timeout = MASTER_DISABLE_TIMEOUT;
	s32 ret_val = 0;
	if (hw->bus.type != e1000_bus_type_pci_express)
		goto out;
	ctrl = rd32(E1000_CTRL);
	ctrl |= E1000_CTRL_GIO_MASTER_DISABLE;
	wr32(E1000_CTRL, ctrl);
	while (timeout) {
		if (!(rd32(E1000_STATUS) &
		      E1000_STATUS_GIO_MASTER_ENABLE))
			break;
		udelay(100);
		timeout--;
	}
	if (!timeout) {
		hw_dbg("Master requests are pending.\n");
		ret_val = -E1000_ERR_MASTER_REQUESTS_PENDING;
		goto out;
	}
out:
	return ret_val;
}