From owner-freebsd-hackers Thu Apr 9 23:54:35 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id XAA08196 for freebsd-hackers-outgoing; Thu, 9 Apr 1998 23:54:35 -0700 (PDT) (envelope-from owner-freebsd-hackers@FreeBSD.ORG) Received: from labinfo.iet.unipi.it (labinfo.iet.unipi.it [131.114.9.5]) by hub.freebsd.org (8.8.8/8.8.8) with SMTP id XAA08121 for ; Thu, 9 Apr 1998 23:53:35 -0700 (PDT) (envelope-from luigi@labinfo.iet.unipi.it) Received: from localhost (luigi@localhost) by labinfo.iet.unipi.it (8.6.5/8.6.5) id HAA07607; Fri, 10 Apr 1998 07:22:26 +0200 From: Luigi Rizzo Message-Id: <199804100522.HAA07607@labinfo.iet.unipi.it> Subject: Re: PnP driver question To: archie@whistle.com (Archie Cobbs) Date: Fri, 10 Apr 1998 07:22:26 +0200 (MET DST) Cc: freebsd-hackers@FreeBSD.ORG In-Reply-To: <199804092038.NAA29720@bubba.whistle.com> from "Archie Cobbs" at Apr 9, 98 01:38:18 pm X-Mailer: ELM [version 2.4 PL23] Content-Type: text Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG > 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