Date: Wed, 01 Dec 1999 17:19:18 -0800 From: Mike Smith <msmith@freebsd.org> To: Warner Losh <imp@village.org> Cc: mobile@FreeBSD.ORG Subject: Re: cvs commit: src/sys/pccard pccard.c src/sys/isa sio.c src/sys/dev/ed if_ed_pccard.c src/sys/dev/ep if_ep_pccard.c Message-ID: <199912020119.RAA03619@mass.cdrom.com> In-Reply-To: Your message of "Wed, 01 Dec 1999 17:57:07 MST." <199912020057.RAA05497@harmony.village.org>
next in thread | previous in thread | raw e-mail | index | archive | help
> In message <199912020044.QAA03272@mass.cdrom.com> Mike Smith writes: > : > > In the old old code this only > : > > worked because the pcic interrupt handler wasn't masked, so the detach > : > > routine could preempt the device interrupt handler and set the gone flag. > : > > : > Do you have a better solution than this? This was the 'most' correct > : > solution I could come up with. (I'd love to hear about a better > : > solution than this). > : > : I've already proposed it; a bus method that a child can use to verify via > : a hardware accessor in the parent bus that the hardware it "owns" is > : still physically present. > > The problem with this is that the device is gone. The child is > detached and therefore can't be used to call a bus method unless the > child driver caches a pointer to its parent. No. As I keep saying, the device is _not_ gone until the driver lets it go. The child is in complete control of this, and can easily call a bus method to verify whether it should give up on I/O even _before_ it's notified by the parent that the hardware is gone. > : > The only other solution I could envision was one involving re-writing > : > all of the drivers to modify them so they would have timeouts reading > : > hardware (difficult and time consuming), but this wouldn't work in > : > newbus due to softc going away. :( > : > : Again, the softc _can't_ go away until the driver lets it. The driver > : shouldn't let it until it's finished with it. End of story. > > Agreed. However, the only way that it can do this currently is to > block in detach until all references to softc have gone out of scope. Exactly. Now we're getting somewhere. You also need to consider that if the device interrupt handler is spinning, the detach routine may never run even though the hardware is gone. This is why it's imperative for the child to be able to determine _for_itself_ that the hardware has gone. There's no guarantee that any form of notification will ever be _able_ to be delivered by the parent code, so the child has to be able to make up its own mind when to give up. -- \\ Give a man a fish, and you feed him for a day. \\ Mike Smith \\ Tell him he should learn how to fish himself, \\ msmith@freebsd.org \\ and he'll hate you for a lifetime. \\ msmith@cdrom.com To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-mobile" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199912020119.RAA03619>