[BACK]Return to bpp.c CVS log [TXT][DIR] Up to [cvs.NetBSD.org] / src / sys / dev / sbus

Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.

Diff for /src/sys/dev/sbus/bpp.c between version 1.8.2.7 and 1.9

version 1.8.2.7, 2002/12/11 06:38:39 version 1.9, 2001/09/26 20:53:14
Line 36 
Line 36 
  * POSSIBILITY OF SUCH DAMAGE.   * POSSIBILITY OF SUCH DAMAGE.
  */   */
   
 #include <sys/cdefs.h>  
 __KERNEL_RCSID(0, "$NetBSD$");  
   
 #include <sys/param.h>  #include <sys/param.h>
 #include <sys/ioctl.h>  #include <sys/ioctl.h>
 #include <sys/fcntl.h>  #include <sys/fcntl.h>
Line 57  __KERNEL_RCSID(0, "$NetBSD$");
Line 54  __KERNEL_RCSID(0, "$NetBSD$");
 #include <machine/bus.h>  #include <machine/bus.h>
 #include <machine/intr.h>  #include <machine/intr.h>
 #include <machine/autoconf.h>  #include <machine/autoconf.h>
   #include <machine/conf.h>
   
 #include <dev/ic/lsi64854reg.h>  #include <dev/ic/lsi64854reg.h>
 #include <dev/ic/lsi64854var.h>  #include <dev/ic/lsi64854var.h>
Line 119  static void bppattach __P((struct device
Line 117  static void bppattach __P((struct device
 static int      bppintr         __P((void *));  static int      bppintr         __P((void *));
 static void     bpp_setparams   __P((struct bpp_softc *, struct hwstate *));  static void     bpp_setparams   __P((struct bpp_softc *, struct hwstate *));
   
 CFATTACH_DECL(bpp, sizeof(struct bpp_softc),  struct cfattach bpp_ca = {
     bppmatch, bppattach, NULL, NULL);          sizeof(struct bpp_softc), bppmatch, bppattach
   
 extern struct cfdriver bpp_cd;  
   
 dev_type_open(bppopen);  
 dev_type_close(bppclose);  
 dev_type_write(bppwrite);  
 dev_type_ioctl(bppioctl);  
 dev_type_poll(bpppoll);  
 dev_type_kqfilter(bppkqfilter);  
   
 const struct cdevsw bpp_cdevsw = {  
         bppopen, bppclose, noread, bppwrite, bppioctl,  
         nostop, notty, bpppoll, nommap, bppkqfilter,  
 };  };
   
   extern struct cfdriver bpp_cd;
 #define BPPUNIT(dev)    (minor(dev))  #define BPPUNIT(dev)    (minor(dev))
   
   
Line 166  bppattach(parent, self, aux)
Line 152  bppattach(parent, self, aux)
         node = sa->sa_node;          node = sa->sa_node;
   
         /* Map device registers */          /* Map device registers */
         if (sbus_bus_map(sa->sa_bustag,          if (bus_space_map2(sa->sa_bustag,
                          sa->sa_slot, sa->sa_offset, sa->sa_size,                             sa->sa_slot,
                          0, &sc->sc_regs) != 0) {                             sa->sa_offset,
                              sa->sa_size,
                              BUS_SPACE_MAP_LINEAR,
                              0, &sc->sc_regs) != 0) {
                 printf("%s: cannot map registers\n", self->dv_xname);                  printf("%s: cannot map registers\n", self->dv_xname);
                 return;                  return;
         }          }
Line 204  bppattach(parent, self, aux)
Line 193  bppattach(parent, self, aux)
         if (sa->sa_nintr) {          if (sa->sa_nintr) {
                 sc->sc_intrchain = bppintr;                  sc->sc_intrchain = bppintr;
                 sc->sc_intrchainarg = dsc;                  sc->sc_intrchainarg = dsc;
                 (void)bus_intr_establish(sa->sa_bustag, sa->sa_pri, IPL_TTY,                  (void)bus_intr_establish(sa->sa_bustag, sa->sa_pri, IPL_TTY, 0,
                                          bppintr, sc);                                           bppintr, sc);
         }          }
   
Line 310  bppclose(dev, flags, mode, p)
Line 299  bppclose(dev, flags, mode, p)
 }  }
   
 int  int
   bppread(dev, uio, flags)
           dev_t dev;
           struct uio *uio;
           int flags;
   {
   
           return (ENXIO);
   }
   
   int
 bppwrite(dev, uio, flags)  bppwrite(dev, uio, flags)
         dev_t dev;          dev_t dev;
         struct uio *uio;          struct uio *uio;
Line 504  bpppoll(dev, events, p)
Line 503  bpppoll(dev, events, p)
         return (revents);          return (revents);
 }  }
   
 static void  
 filt_bpprdetach(struct knote *kn)  
 {  
         struct bpp_softc *sc = kn->kn_hook;  
         int s;  
   
         s = splbpp();  
         SLIST_REMOVE(&sc->sc_rsel.sel_klist, kn, knote, kn_selnext);  
         splx(s);  
 }  
   
 static int  
 filt_bppread(struct knote *kn, long hint)  
 {  
         /* XXX Read not yet implemented. */  
         return (0);  
 }  
   
 static const struct filterops bppread_filtops =  
         { 1, NULL, filt_bpprdetach, filt_bppread };  
   
 static void  
 filt_bppwdetach(struct knote *kn)  
 {  
         struct bpp_softc *sc = kn->kn_hook;  
         int s;  
   
         s = splbpp();  
         SLIST_REMOVE(&sc->sc_wsel.sel_klist, kn, knote, kn_selnext);  
         splx(s);  
 }  
   
 static int  
 filt_bpfwrite(struct knote *kn, long hint)  
 {  
         struct bpp_softc *sc = kn->kn_hook;  
   
         if (sc->sc_flags & BPP_LOCKED)  
                 return (0);  
   
         kn->kn_data = 0;        /* XXXLUKEM (thorpej): what to put here? */  
         return (1);  
 }  
   
 static const struct filterops bppwrite_filtops =  
         { 1, NULL, filt_bppwdetach, filt_bpfwrite };  
   
 int  
 bppkqfilter(dev_t dev, struct knote *kn)  
 {  
         struct bpp_softc *sc = bpp_cd.cd_devs[BPPUNIT(dev)];  
         struct klist *klist;  
         int s;  
   
         switch (kn->kn_filter) {  
         case EVFILT_READ:  
                 klist = &sc->sc_rsel.sel_klist;  
                 kn->kn_fop = &bppread_filtops;  
                 break;  
   
         case EVFILT_WRITE:  
                 klist = &sc->sc_wsel.sel_klist;  
                 kn->kn_fop = &bppwrite_filtops;  
                 break;  
   
         default:  
                 return (1);  
         }  
   
         kn->kn_hook = sc;  
   
         s = splbpp();  
         SLIST_INSERT_HEAD(klist, kn, kn_selnext);  
         splx(s);  
   
         return (0);  
 }  
   
 int  int
 bppintr(arg)  bppintr(arg)
         void *arg;          void *arg;
Line 610  bppintr(arg)
Line 531  bppintr(arg)
                 sc->sc_flags &= ~BPP_WANT;                  sc->sc_flags &= ~BPP_WANT;
                 wakeup(sc->sc_buf);                  wakeup(sc->sc_buf);
         } else {          } else {
                 selnotify(&sc->sc_wsel, 0);                  selwakeup(&sc->sc_wsel);
                 if (sc->sc_asyncproc != NULL)                  if (sc->sc_asyncproc != NULL)
                         psignal(sc->sc_asyncproc, SIGIO);                          psignal(sc->sc_asyncproc, SIGIO);
         }          }

Legend:
Removed from v.1.8.2.7  
changed lines
  Added in v.1.9

CVSweb <webmaster@jp.NetBSD.org>