@@ -1012,6 +1012,47 @@ void pci_wakeup_bus(struct pci_bus *bus)
1012
1012
pci_walk_bus (bus , pci_wakeup , NULL );
1013
1013
}
1014
1014
1015
+ static int pci_dev_wait (struct pci_dev * dev , char * reset_type , int timeout )
1016
+ {
1017
+ int delay = 1 ;
1018
+ u32 id ;
1019
+
1020
+ /*
1021
+ * After reset, the device should not silently discard config
1022
+ * requests, but it may still indicate that it needs more time by
1023
+ * responding to them with CRS completions. The Root Port will
1024
+ * generally synthesize ~0 data to complete the read (except when
1025
+ * CRS SV is enabled and the read was for the Vendor ID; in that
1026
+ * case it synthesizes 0x0001 data).
1027
+ *
1028
+ * Wait for the device to return a non-CRS completion. Read the
1029
+ * Command register instead of Vendor ID so we don't have to
1030
+ * contend with the CRS SV value.
1031
+ */
1032
+ pci_read_config_dword (dev , PCI_COMMAND , & id );
1033
+ while (id == ~0 ) {
1034
+ if (delay > timeout ) {
1035
+ pci_warn (dev , "not ready %dms after %s; giving up\n" ,
1036
+ delay - 1 , reset_type );
1037
+ return - ENOTTY ;
1038
+ }
1039
+
1040
+ if (delay > 1000 )
1041
+ pci_info (dev , "not ready %dms after %s; waiting\n" ,
1042
+ delay - 1 , reset_type );
1043
+
1044
+ msleep (delay );
1045
+ delay *= 2 ;
1046
+ pci_read_config_dword (dev , PCI_COMMAND , & id );
1047
+ }
1048
+
1049
+ if (delay > 1000 )
1050
+ pci_info (dev , "ready %dms after %s\n" , delay - 1 ,
1051
+ reset_type );
1052
+
1053
+ return 0 ;
1054
+ }
1055
+
1015
1056
/**
1016
1057
* pci_power_up - Put the given device into D0
1017
1058
* @dev: PCI device to power up
@@ -4406,47 +4447,6 @@ int pci_wait_for_pending_transaction(struct pci_dev *dev)
4406
4447
}
4407
4448
EXPORT_SYMBOL (pci_wait_for_pending_transaction );
4408
4449
4409
- static int pci_dev_wait (struct pci_dev * dev , char * reset_type , int timeout )
4410
- {
4411
- int delay = 1 ;
4412
- u32 id ;
4413
-
4414
- /*
4415
- * After reset, the device should not silently discard config
4416
- * requests, but it may still indicate that it needs more time by
4417
- * responding to them with CRS completions. The Root Port will
4418
- * generally synthesize ~0 data to complete the read (except when
4419
- * CRS SV is enabled and the read was for the Vendor ID; in that
4420
- * case it synthesizes 0x0001 data).
4421
- *
4422
- * Wait for the device to return a non-CRS completion. Read the
4423
- * Command register instead of Vendor ID so we don't have to
4424
- * contend with the CRS SV value.
4425
- */
4426
- pci_read_config_dword (dev , PCI_COMMAND , & id );
4427
- while (id == ~0 ) {
4428
- if (delay > timeout ) {
4429
- pci_warn (dev , "not ready %dms after %s; giving up\n" ,
4430
- delay - 1 , reset_type );
4431
- return - ENOTTY ;
4432
- }
4433
-
4434
- if (delay > 1000 )
4435
- pci_info (dev , "not ready %dms after %s; waiting\n" ,
4436
- delay - 1 , reset_type );
4437
-
4438
- msleep (delay );
4439
- delay *= 2 ;
4440
- pci_read_config_dword (dev , PCI_COMMAND , & id );
4441
- }
4442
-
4443
- if (delay > 1000 )
4444
- pci_info (dev , "ready %dms after %s\n" , delay - 1 ,
4445
- reset_type );
4446
-
4447
- return 0 ;
4448
- }
4449
-
4450
4450
/**
4451
4451
* pcie_has_flr - check if a device supports function level resets
4452
4452
* @dev: device to check
0 commit comments