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

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

Diff for /src/sys/dev/ic/com.c between version 1.188.2.5 and 1.189

version 1.188.2.5, 2001/10/13 17:42:46 version 1.189, 2001/09/17 02:47:13
Line 115 
Line 115 
 #include <sys/malloc.h>  #include <sys/malloc.h>
 #include <sys/timepps.h>  #include <sys/timepps.h>
 #include <sys/vnode.h>  #include <sys/vnode.h>
 #include <miscfs/specfs/specdev.h>  
   
 #include <machine/intr.h>  #include <machine/intr.h>
 #include <machine/bus.h>  #include <machine/bus.h>
Line 769  com_shutdown(sc)
Line 768  com_shutdown(sc)
 }  }
   
 int  int
 comopen(devvp, flag, mode, p)  comopen(dev, flag, mode, p)
         struct vnode *devvp;          dev_t dev;
         int flag, mode;          int flag, mode;
         struct proc *p;          struct proc *p;
 {  {
Line 778  comopen(devvp, flag, mode, p)
Line 777  comopen(devvp, flag, mode, p)
         struct tty *tp;          struct tty *tp;
         int s, s2;          int s, s2;
         int error;          int error;
         dev_t rdev;  
   
         rdev = vdev_rdev(devvp);          sc = device_lookup(&com_cd, COMUNIT(dev));
         sc = device_lookup(&com_cd, COMUNIT(rdev));  
         if (sc == NULL || !ISSET(sc->sc_hwflags, COM_HW_DEV_OK) ||          if (sc == NULL || !ISSET(sc->sc_hwflags, COM_HW_DEV_OK) ||
                 sc->sc_rbuf == NULL)                  sc->sc_rbuf == NULL)
                 return (ENXIO);                  return (ENXIO);
Line 804  comopen(devvp, flag, mode, p)
Line 801  comopen(devvp, flag, mode, p)
                 p->p_ucred->cr_uid != 0)                  p->p_ucred->cr_uid != 0)
                 return (EBUSY);                  return (EBUSY);
   
         vdev_setprivdata(devvp, sc);  
   
         s = spltty();          s = spltty();
   
         /*          /*
Line 814  comopen(devvp, flag, mode, p)
Line 809  comopen(devvp, flag, mode, p)
         if (!ISSET(tp->t_state, TS_ISOPEN) && tp->t_wopen == 0) {          if (!ISSET(tp->t_state, TS_ISOPEN) && tp->t_wopen == 0) {
                 struct termios t;                  struct termios t;
   
                 tp->t_dev = rdev;                  tp->t_dev = dev;
   
                 s2 = splserial();                  s2 = splserial();
                 COM_LOCK(sc);                  COM_LOCK(sc);
Line 903  comopen(devvp, flag, mode, p)
Line 898  comopen(devvp, flag, mode, p)
   
         splx(s);          splx(s);
   
         error = ttyopen(tp, COMDIALOUT(rdev), ISSET(flag, O_NONBLOCK));          error = ttyopen(tp, COMDIALOUT(dev), ISSET(flag, O_NONBLOCK));
         if (error)          if (error)
                 goto bad;                  goto bad;
   
         error = (*tp->t_linesw->l_open)(devvp, tp);          error = (*tp->t_linesw->l_open)(dev, tp);
         if (error)          if (error)
                 goto bad;                  goto bad;
   
Line 926  bad:
Line 921  bad:
 }  }
   
 int  int
 comclose(devvp, flag, mode, p)  comclose(dev, flag, mode, p)
         struct vnode *devvp;          dev_t dev;
         int flag, mode;          int flag, mode;
         struct proc *p;          struct proc *p;
 {  {
         struct com_softc *sc;          struct com_softc *sc = device_lookup(&com_cd, COMUNIT(dev));
         struct tty *tp;          struct tty *tp = sc->sc_tty;
   
         sc = vdev_privdata(devvp);  
   
         /* XXX This is for cons.c. */          /* XXX This is for cons.c. */
         if (sc == NULL)  
                 return (0);  
         tp = sc->sc_tty;  
         if (!ISSET(tp->t_state, TS_ISOPEN))          if (!ISSET(tp->t_state, TS_ISOPEN))
                 return (0);                  return (0);
   
Line 962  comclose(devvp, flag, mode, p)
Line 952  comclose(devvp, flag, mode, p)
 }  }
   
 int  int
 comread(devvp, uio, flag)  comread(dev, uio, flag)
         struct vnode *devvp;          dev_t dev;
         struct uio *uio;          struct uio *uio;
         int flag;          int flag;
 {  {
         struct com_softc *sc;          struct com_softc *sc = device_lookup(&com_cd, COMUNIT(dev));
         struct tty *tp;          struct tty *tp = sc->sc_tty;
   
         sc = vdev_privdata(devvp);  
         tp = sc->sc_tty;  
   
         if (COM_ISALIVE(sc) == 0)          if (COM_ISALIVE(sc) == 0)
                 return (EIO);                  return (EIO);
Line 980  comread(devvp, uio, flag)
Line 967  comread(devvp, uio, flag)
 }  }
   
 int  int
 comwrite(devvp, uio, flag)  comwrite(dev, uio, flag)
         struct vnode *devvp;          dev_t dev;
         struct uio *uio;          struct uio *uio;
         int flag;          int flag;
 {  {
         struct com_softc *sc;          struct com_softc *sc = device_lookup(&com_cd, COMUNIT(dev));
         struct tty *tp;          struct tty *tp = sc->sc_tty;
   
         sc = vdev_privdata(devvp);  
         tp = sc->sc_tty;  
   
         if (COM_ISALIVE(sc) == 0)          if (COM_ISALIVE(sc) == 0)
                 return (EIO);                  return (EIO);
Line 998  comwrite(devvp, uio, flag)
Line 982  comwrite(devvp, uio, flag)
 }  }
   
 int  int
 compoll(devvp, events, p)  compoll(dev, events, p)
         struct vnode *devvp;          dev_t dev;
         int events;          int events;
         struct proc *p;          struct proc *p;
 {  {
         struct com_softc *sc;          struct com_softc *sc = device_lookup(&com_cd, COMUNIT(dev));
         struct tty *tp;          struct tty *tp = sc->sc_tty;
   
         sc = vdev_privdata(devvp);  
         tp = sc->sc_tty;  
   
         if (COM_ISALIVE(sc) == 0)          if (COM_ISALIVE(sc) == 0)
                 return (EIO);                  return (EIO);
Line 1016  compoll(devvp, events, p)
Line 997  compoll(devvp, events, p)
 }  }
   
 struct tty *  struct tty *
 comtty(devvp)  comtty(dev)
         struct vnode *devvp;          dev_t dev;
 {  {
         struct com_softc *sc;          struct com_softc *sc = device_lookup(&com_cd, COMUNIT(dev));
         struct tty *tp;          struct tty *tp = sc->sc_tty;
   
         sc = vdev_privdata(devvp);  
         tp = sc->sc_tty;  
   
         return (tp);          return (tp);
 }  }
   
 int  int
 comioctl(devvp, cmd, data, flag, p)  comioctl(dev, cmd, data, flag, p)
         struct vnode *devvp;          dev_t dev;
         u_long cmd;          u_long cmd;
         caddr_t data;          caddr_t data;
         int flag;          int flag;
         struct proc *p;          struct proc *p;
 {  {
         struct com_softc *sc;          struct com_softc *sc = device_lookup(&com_cd, COMUNIT(dev));
         struct tty *tp;          struct tty *tp = sc->sc_tty;
         int error;          int error;
         int s;          int s;
   
         sc = vdev_privdata(devvp);  
         tp = sc->sc_tty;  
   
         if (COM_ISALIVE(sc) == 0)          if (COM_ISALIVE(sc) == 0)
                 return (EIO);                  return (EIO);
   
Line 1051  comioctl(devvp, cmd, data, flag, p)
Line 1026  comioctl(devvp, cmd, data, flag, p)
         if (error >= 0)          if (error >= 0)
                 return (error);                  return (error);
   
         error = ttioctl(tp, devvp, cmd, data, flag, p);          error = ttioctl(tp, cmd, data, flag, p);
         if (error >= 0)          if (error >= 0)
                 return (error);                  return (error);
   
Line 1382  comparam(tp, t)
Line 1357  comparam(tp, t)
         struct tty *tp;          struct tty *tp;
         struct termios *t;          struct termios *t;
 {  {
         struct com_softc *sc;          struct com_softc *sc = device_lookup(&com_cd, COMUNIT(tp->t_dev));
         int ospeed;          int ospeed;
         u_char lcr;          u_char lcr;
         int s;          int s;
   
         sc = device_lookup(&com_cd, COMUNIT(tp->t_dev));  
   
         if (COM_ISALIVE(sc) == 0)          if (COM_ISALIVE(sc) == 0)
                 return (EIO);                  return (EIO);
   
Line 1641  comhwiflow(tp, block)
Line 1614  comhwiflow(tp, block)
         struct tty *tp;          struct tty *tp;
         int block;          int block;
 {  {
         struct com_softc *sc;          struct com_softc *sc = device_lookup(&com_cd, COMUNIT(tp->t_dev));
         int s;          int s;
   
         sc = device_lookup(&com_cd, COMUNIT(tp->t_dev));  
   
         if (COM_ISALIVE(sc) == 0)          if (COM_ISALIVE(sc) == 0)
                 return (0);                  return (0);
   
Line 1704  void
Line 1675  void
 comstart(tp)  comstart(tp)
         struct tty *tp;          struct tty *tp;
 {  {
         struct com_softc *sc;          struct com_softc *sc = device_lookup(&com_cd, COMUNIT(tp->t_dev));
         bus_space_tag_t iot;          bus_space_tag_t iot = sc->sc_iot;
         bus_space_handle_t ioh;          bus_space_handle_t ioh = sc->sc_ioh;
         int s;          int s;
   
         sc = device_lookup(&com_cd, COMUNIT(tp->t_dev));  
   
         iot = sc->sc_iot;  
         ioh = sc->sc_ioh;  
   
         if (COM_ISALIVE(sc) == 0)          if (COM_ISALIVE(sc) == 0)
                 return;                  return;
   
Line 1782  comstop(tp, flag)
Line 1748  comstop(tp, flag)
         struct tty *tp;          struct tty *tp;
         int flag;          int flag;
 {  {
         struct com_softc *sc;          struct com_softc *sc = device_lookup(&com_cd, COMUNIT(tp->t_dev));
         int s;          int s;
   
         sc = device_lookup(&com_cd, COMUNIT(tp->t_dev));  
   
         s = splserial();          s = splserial();
         COM_LOCK(sc);          COM_LOCK(sc);
         if (ISSET(tp->t_state, TS_BUSY)) {          if (ISSET(tp->t_state, TS_BUSY)) {

Legend:
Removed from v.1.188.2.5  
changed lines
  Added in v.1.189

CVSweb <webmaster@jp.NetBSD.org>