Date: Fri, 10 Apr 1998 07:22:26 +0200 (MET DST) From: Luigi Rizzo <luigi@labinfo.iet.unipi.it> To: archie@whistle.com (Archie Cobbs) Cc: freebsd-hackers@FreeBSD.ORG Subject: Re: PnP driver question Message-ID: <199804100522.HAA07607@labinfo.iet.unipi.it> In-Reply-To: <199804092038.NAA29720@bubba.whistle.com> from "Archie Cobbs" at Apr 9, 98 01:38:18 pm
next in thread | previous in thread | raw e-mail | index | archive | help
> Need a little help understanding how to write a PnP aware device driver. > > Suppose I have a PnP card that I want to do a self-test on before > claiming that it's been officially detected. Since the attach() routine > in struct pnp_device returns NULL, then this has to be done in the > probe routine, right? > > In order to talk to the card to do the self-test, I have to set > the PnP params and enable the card during the probe routine... > > My question is.. is this safe? Is this this right way to proceed? > > I'm wondering because in Luigi's paper "PnP support in FreeBSD", > the example has a very simple probe routine (which just compares the > unqiue identifiers), while the attach routine does all the initialization > work. i am not quite sure if mine is the correct way. However, after some thinking, i took the following decisions: - the probe routines should avoid changing the configuration of PnP devices, since this belongs elsewhere. Pragmatically, I do not enable anything, but allow a driver to disable resources that the driver does not use (e.g. in the case of audio driver, all the synth/midi stuff for which i currently have no support. - the probe routine, for non-pnp devices, just tries to figure out if the device is there and it is properly configured. Since PnP tells you all of this, there is little to be done in the probe routine, so the only thing is to check the PnP id - the attach routine does all the initialization. Unfortunately there is no check on the return code from the isa attach routine, so you cannot report up if the attach fails... cheers luigi -----------------------------+-------------------------------------- Luigi Rizzo | Dip. di Ingegneria dell'Informazione email: luigi@iet.unipi.it | Universita' di Pisa tel: +39-50-568533 | via Diotisalvi 2, 56126 PISA (Italy) fax: +39-50-568522 | http://www.iet.unipi.it/~luigi/ _____________________________|______________________________________ To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199804100522.HAA07607>