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

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

Diff for /src/sys/dev/ieee1394/fwdev.c between version 1.19 and 1.20

version 1.19, 2010/04/29 06:53:48 version 1.20, 2010/05/10 12:17:32
Line 46  __KERNEL_RCSID(0, "$NetBSD$");
Line 46  __KERNEL_RCSID(0, "$NetBSD$");
 #include <sys/bus.h>  #include <sys/bus.h>
 #include <sys/conf.h>  #include <sys/conf.h>
 #include <sys/kernel.h>  #include <sys/kernel.h>
 #include <sys/malloc.h>  #include <sys/kmem.h>
 #include <sys/mbuf.h>  #include <sys/mbuf.h>
 #include <sys/poll.h>  #include <sys/poll.h>
 #include <sys/proc.h>  #include <sys/proc.h>
Line 91  struct fw_drv1 {
Line 91  struct fw_drv1 {
   
 static int fwdev_allocbuf(struct firewire_comm *, struct fw_xferq *,  static int fwdev_allocbuf(struct firewire_comm *, struct fw_xferq *,
                           struct fw_bufspec *);                            struct fw_bufspec *);
 static int fwdev_freebuf(struct fw_xferq *);  static int fwdev_freebuf(struct fw_xferq *, struct fw_bufspec *);
 static int fw_read_async(struct fw_drv1 *, struct uio *, int);  static int fw_read_async(struct fw_drv1 *, struct uio *, int);
 static int fw_write_async(struct fw_drv1 *, struct uio *, int);  static int fw_write_async(struct fw_drv1 *, struct uio *, int);
 static void fw_hand(struct fw_xfer *);  static void fw_hand(struct fw_xfer *);
Line 120  fw_open(dev_t dev, int flags, int fmt, s
Line 120  fw_open(dev_t dev, int flags, int fmt, s
         sc->si_drv1 = (void *)-1;          sc->si_drv1 = (void *)-1;
         mutex_exit(&sc->fc->fc_mtx);          mutex_exit(&sc->fc->fc_mtx);
   
         sc->si_drv1 = malloc(sizeof(struct fw_drv1), M_FW, M_WAITOK | M_ZERO);          sc->si_drv1 = kmem_zalloc(sizeof(struct fw_drv1), KM_SLEEP);
         if (sc->si_drv1 == NULL)          if (sc->si_drv1 == NULL)
                 return ENOMEM;                  return ENOMEM;
   
Line 170  fw_close(dev_t dev, int flags, int fmt, 
Line 170  fw_close(dev_t dev, int flags, int fmt, 
                         fc->irx_disable(fc, ir->dmach);                          fc->irx_disable(fc, ir->dmach);
                 }                  }
                 /* free extbuf */                  /* free extbuf */
                 fwdev_freebuf(ir);                  fwdev_freebuf(ir, &d->bufreq.rx);
                 /* drain receiving buffer */                  /* drain receiving buffer */
                 for (xfer = STAILQ_FIRST(&ir->q); xfer != NULL;                  for (xfer = STAILQ_FIRST(&ir->q); xfer != NULL;
                     xfer = STAILQ_FIRST(&ir->q)) {                      xfer = STAILQ_FIRST(&ir->q)) {
Line 195  fw_close(dev_t dev, int flags, int fmt, 
Line 195  fw_close(dev_t dev, int flags, int fmt, 
                         fc->itx_disable(fc, it->dmach);                          fc->itx_disable(fc, it->dmach);
                 }                  }
                 /* free extbuf */                  /* free extbuf */
                 fwdev_freebuf(it);                  fwdev_freebuf(it, &d->bufreq.tx);
                 it->flag &=                  it->flag &=
                     ~(FWXFERQ_OPEN | FWXFERQ_MODEMASK | FWXFERQ_CHTAGMASK);                      ~(FWXFERQ_OPEN | FWXFERQ_MODEMASK | FWXFERQ_CHTAGMASK);
                 d->it = NULL;                  d->it = NULL;
         }          }
         free(sc->si_drv1, M_FW);          kmem_free(sc->si_drv1, sizeof(struct fw_drv1));
         sc->si_drv1 = NULL;          sc->si_drv1 = NULL;
   
         return err;          return err;
Line 577  out:
Line 577  out:
                         err = EINVAL;                          err = EINVAL;
                         break;                          break;
                 }                  }
                 fwb = (struct fw_bind *)malloc(sizeof(struct fw_bind),                  fwb = (struct fw_bind *)kmem_alloc(sizeof(struct fw_bind),
                     M_FW, M_WAITOK);                      KM_SLEEP);
                 if (fwb == NULL) {                  if (fwb == NULL) {
                         err = ENOMEM;                          err = ENOMEM;
                         break;                          break;
Line 635  out:
Line 635  out:
                                 break;                                  break;
                         }                          }
                         /* myself */                          /* myself */
                         ptr = malloc(CROMSIZE, M_FW, M_WAITOK);                          ptr = kmem_alloc(CROMSIZE, KM_SLEEP);
                         len = CROMSIZE;                          len = CROMSIZE;
                         for (i = 0; i < CROMSIZE/4; i++)                          for (i = 0; i < CROMSIZE/4; i++)
                                 ((uint32_t *)ptr)[i] = ntohl(fc->config_rom[i]);                                  ((uint32_t *)ptr)[i] = ntohl(fc->config_rom[i]);
Line 735  fwdev_allocbuf(struct firewire_comm *fc,
Line 735  fwdev_allocbuf(struct firewire_comm *fc,
                 return EBUSY;                  return EBUSY;
   
         q->bulkxfer =          q->bulkxfer =
             (struct fw_bulkxfer *)malloc(sizeof(struct fw_bulkxfer) * b->nchunk,              kmem_alloc(sizeof(struct fw_bulkxfer) * b->nchunk, KM_SLEEP);
                                                                 M_FW, M_WAITOK);  
         if (q->bulkxfer == NULL)          if (q->bulkxfer == NULL)
                 return ENOMEM;                  return ENOMEM;
   
Line 745  fwdev_allocbuf(struct firewire_comm *fc,
Line 744  fwdev_allocbuf(struct firewire_comm *fc,
             b->nchunk * b->npacket, BUS_DMA_WAITOK);              b->nchunk * b->npacket, BUS_DMA_WAITOK);
   
         if (q->buf == NULL) {          if (q->buf == NULL) {
                 free(q->bulkxfer, M_FW);                  kmem_free(q->bulkxfer, sizeof(struct fw_bulkxfer) * b->nchunk);
                 q->bulkxfer = NULL;                  q->bulkxfer = NULL;
                 return ENOMEM;                  return ENOMEM;
         }          }
Line 773  fwdev_allocbuf(struct firewire_comm *fc,
Line 772  fwdev_allocbuf(struct firewire_comm *fc,
 }  }
   
 static int  static int
 fwdev_freebuf(struct fw_xferq *q)  fwdev_freebuf(struct fw_xferq *q, struct fw_bufspec *b)
 {  {
   
         if (q->flag & FWXFERQ_EXTBUF) {          if (q->flag & FWXFERQ_EXTBUF) {
                 if (q->buf != NULL)                  if (q->buf != NULL)
                         fwdma_free_multiseg(q->buf);                          fwdma_free_multiseg(q->buf);
                 q->buf = NULL;                  q->buf = NULL;
                 free(q->bulkxfer, M_FW);                  kmem_free(q->bulkxfer, sizeof(struct fw_bulkxfer) * b->nchunk);
                 q->bulkxfer = NULL;                  q->bulkxfer = NULL;
                 q->flag &= ~FWXFERQ_EXTBUF;                  q->flag &= ~FWXFERQ_EXTBUF;
                 q->psize = 0;                  q->psize = 0;

Legend:
Removed from v.1.19  
changed lines
  Added in v.1.20

CVSweb <webmaster@jp.NetBSD.org>