Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 09 Feb 2003 10:06:54 -0700 (MST)
From:      "M. Warner Losh" <imp@bsdimp.com>
To:        simokawa@sat.t.u-tokyo.ac.jp
Cc:        andrea@webcom.it, current@FreeBSD.ORG
Subject:   Re: firewire hangs on Thinkpad
Message-ID:  <20030209.100654.133045082.imp@bsdimp.com>
In-Reply-To: <ybsy94psbp8.wl@ett.sat.t.u-tokyo.ac.jp>
References:  <20030129114951.GA3635@webcom.it> <ybs8yx3x6s0.wl@ett.sat.t.u-tokyo.ac.jp> <ybsy94psbp8.wl@ett.sat.t.u-tokyo.ac.jp>

next in thread | previous in thread | raw e-mail | index | archive | help
P.S.  With full debugs

hw.cbb.debug: 1
hw.cardbus.debug: 1
hw.cardbus.cis_debug: 1
hw.pccard.debug: 1
hw.pccard.cis_debug: 1

I see the following sequence of events in my /var/log/messages:
Feb  9 09:52:35 hammer sudo:      imp : TTY=ttyp1 ; PWD=/dell/imp ; USER=root ;
COMMAND=/sbin/kldload if_rl
Feb  9 09:52:40 hammer kernel: cbb_pcic_socket_enable:
Feb  9 09:52:40 hammer kernel: cbb1: cbb_power: CARD_VCC_0V and CARD_VPP_0V [44]
Feb  9 09:52:40 hammer kernel: cbb1: cbb_power: CARD_VCC_5V and CARD_VPP_VCC [15
]
Feb  9 09:52:40 hammer kernel: an0: RID access failed

Most cards do *NOT* like being turned off.

This suggests that the following code may be wrong:

static void
cardbus_driver_added(device_t cbdev, driver_t *driver)
{
...
	device_get_children(cbdev, &devlist, &numdevs);

	DEVICE_IDENTIFY(driver, cbdev);
-->	POWER_ENABLE_SOCKET(device_get_parent(cbdev), cbdev);
	for (tmp = 0; tmp < numdevs; tmp++) {
		if (device_get_state(devlist[tmp]) == DS_NOTPRESENT) {
			dinfo = device_get_ivars(devlist[tmp]);
...
}

At a guess, the POWER_ENABLE_SOCKET should be done later.  Or maybe
not even at all (the pccard code that does this works :-).  In fact,
I'm positive that this is what's causing the breakage.

Maybe something more like the following would be closer to correct:

static void
cardbus_driver_added(device_t cbdev, driver_t *driver)
{
	int numdevs;
	device_t *devlist;
	int tmp;
	struct cardbus_devinfo *dinfo;

	DEVICE_IDENTIFY(driver, cbdev);
	device_get_children(cbdev, &devlist, &numdevs);
	for (tmp = 0; tmp < numdevs; tmp++) {
		if (device_get_state(devlist[tmp]) != DS_NOTPRESENT)
			continue;
		dinfo = device_get_ivars(devlist[tmp]);
		cardbus_print_verbose(dinfo);
		resource_list_init(&dinfo->pci.resources);
		cardbus_do_cis(cbdev, dinfo->pci.cfg.dev);
		if (device_probe_and_attach(dinfo->pci.cfg.dev) != 0)
			cardbus_release_all_resources(cbdev, dinfo);
	}
	free(devlist, M_TEMP);
}

Warner

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030209.100654.133045082.imp>