1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-18 10:35:55 +00:00

The CD bits in the CBB_SOCKET_STATE register are 0 when the card is

present, and non-zero when it is (or may be) absent.  The test
cbb_child_present was backwards.  However, typical usage in the tree
would cause it to do the right thing because the card really wasn't
there the OK flag would be turned on.

Also, assume that if any of these bits are turned on we don't have a
card, rather than requiring both of them in the suspend/resume
routines.

Noticed by: cognet
This commit is contained in:
Warner Losh 2003-08-18 21:59:24 +00:00
parent 6a4b58230c
commit f2d72e24b3
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=119094

View File

@ -1376,8 +1376,7 @@ cbb_cardbus_power_enable_socket(device_t brdev, device_t child)
struct cbb_softc *sc = device_get_softc(brdev);
int err;
if ((cbb_get(sc, CBB_SOCKET_STATE) & CBB_STATE_CD) ==
CBB_STATE_CD)
if ((cbb_get(sc, CBB_SOCKET_STATE) & CBB_STATE_CD) != 0)
return (ENODEV);
err = cbb_do_power(brdev);
@ -2027,8 +2026,8 @@ cbb_child_present(device_t self)
uint32_t sockstate;
sockstate = cbb_get(sc, CBB_SOCKET_STATE);
return ((sockstate & CBB_STATE_CD) != 0 &&
(sc->flags & CBB_CARD_OK) != 0);
return ((sockstate & CBB_STATE_CD) == 0 &&
(sc->flags & CBB_CARD_OK) == CBB_CARD_OK);
}
static device_method_t cbb_methods[] = {