/* Reset the adapter. Older PCIe cards lose their config space during reset, PCI-X ones don't.  */
int t3_reset_adapter(struct adapter *adapter)
/* Reset the adapter. Older PCIe cards lose their config space during reset, PCI-X ones don't.  */
int t3_reset_adapter(struct adapter *adapter)
{
	int i, save_and_restore_pcie =
	    adapter->params.rev < T3_REV_B2 && is_pcie(adapter);
	uint16_t devid = 0;
	if (save_and_restore_pcie)
		pci_save_state(adapter->pdev);
	t3_write_reg(adapter, A_PL_RST, F_CRSTWRM | F_CRSTWRMMODE);
	for (i = 0; i < 10; i++) {
		msleep(50);
		pci_read_config_word(adapter->pdev, 0x00, &devid);
		if (devid == 0x1425)
			break;
	}
	if (devid != 0x1425)
		return -1;
	if (save_and_restore_pcie)
		pci_restore_state(adapter->pdev);
	return 0;
}