It turns out that checking the first DWORD register is more reliable

on a variety of cards.  Adjust the comments accordingly to match the
code.  Even if the vendor chose 0xffff for the device ID, the vendor
ID can't be 0xffff, so the test is still valid from a standards
perspective.
This commit is contained in:
Warner Losh 2008-08-09 15:55:10 +00:00
parent 66863836a9
commit e6501bf131
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=181470

View File

@ -946,19 +946,21 @@ cbb_cardbus_reset(device_t brdev, int on)
*/
if (on && CBB_CARD_PRESENT(cbb_get(sc, CBB_SOCKET_STATE))) {
/*
* After clearing reset, wait up to 1.1s for the vendor of
* device 0.0 to become != 0xffff. The PCMCIA PC Card Host
* System Specification says that when powering up the card,
* the PCI Spec v2.1 must be followed. In PCI spec v2.2 Table
* 4-6, Trhfa (Reset High to first Config Access) is at most
* 2^25 clocks, or just over 1s. Secont 2.2.1 states any card
* not ready to participate in bus transactions must tristate
* its outputs. Therefore, any access to its configuration
* registers must be ignored. In that state, the vendor will
* read 0xffff. Section 6.2.1 states a vendor id of 0xffff is
* invalid, so this can never match a real card. Print a
* warning if it never returns a real id. The PCMCIA PC Card
* Electrical Spec Section 5.2.7.1 implies only device 0.
* After clearing reset, wait up to 1.1s for the first
* configuration register (vendor/product) configuration
* register of device 0.0 to become != 0xffffffff. The PCMCIA
* PC Card Host System Specification says that when powering
* up the card, the PCI Spec v2.1 must be followed. In PCI
* spec v2.2 Table 4-6, Trhfa (Reset High to first Config
* Access) is at most 2^25 clocks, or just over 1s. Secont
* 2.2.1 states any card not ready to participate in bus
* transactions must tristate its outputs. Therefore, any
* access to its configuration registers must be ignored. In
* that state, the config reg will read 0xffffffff. Section
* 6.2.1 states a vendor id of 0xffff is invalid, so this can
* never match a real card. Print a warning if it never
* returns a real id. The PCMCIA PC Card Electrical Spec
* Section 5.2.7.1 implies only device 0.
*/
PCI_MASK_CONFIG(brdev, CBBR_BRIDGECTRL,
&~CBBM_BRIDGECTRL_RESET, 2);
@ -966,8 +968,8 @@ cbb_cardbus_reset(device_t brdev, int on)
count = 1100 / 20;
do {
pause("cbbP4", hz * 2 / 100);
} while (PCIB_READ_CONFIG(brdev, b, 0, 0, PCIR_DEVVENDOR, 2) ==
0xfffful && --count >= 0);
} while (PCIB_READ_CONFIG(brdev, b, 0, 0, PCIR_DEVVENDOR, 4) ==
0xfffffffful && --count >= 0);
if (count < 0)
device_printf(brdev, "Warning: Bus reset timeout\n");
}