diff options
author | simokawa <simokawa@FreeBSD.org> | 2003-02-01 15:04:33 +0000 |
---|---|---|
committer | simokawa <simokawa@FreeBSD.org> | 2003-02-01 15:04:33 +0000 |
commit | 1071276d73a46218289f668a110e136c0cc96301 (patch) | |
tree | 0d5b2f262240d24b6ece98e694cb1abb3cd06baa | |
parent | 375273946c2b76fc637721f147763ec5cb3c61d0 (diff) | |
download | FreeBSD-src-1071276d73a46218289f668a110e136c0cc96301.zip FreeBSD-src-1071276d73a46218289f668a110e136c0cc96301.tar.gz |
Define new malloc type M_FW and use it.
-rw-r--r-- | sys/dev/firewire/firewire.c | 52 | ||||
-rw-r--r-- | sys/dev/firewire/firewirereg.h | 2 | ||||
-rw-r--r-- | sys/dev/firewire/fwdev.c | 54 | ||||
-rw-r--r-- | sys/dev/firewire/fwmem.c | 2 | ||||
-rw-r--r-- | sys/dev/firewire/fwohci.c | 38 | ||||
-rw-r--r-- | sys/dev/firewire/fwohci_pci.c | 1 | ||||
-rw-r--r-- | sys/dev/firewire/if_fwe.c | 4 | ||||
-rw-r--r-- | sys/dev/firewire/sbp.c | 4 |
8 files changed, 81 insertions, 76 deletions
diff --git a/sys/dev/firewire/firewire.c b/sys/dev/firewire/firewire.c index 4311643..77c1ce6 100644 --- a/sys/dev/firewire/firewire.c +++ b/sys/dev/firewire/firewire.c @@ -65,6 +65,8 @@ SYSCTL_NODE(_hw, OID_AUTO, firewire, CTLFLAG_RD, 0, "FireWire Subsystem"); SYSCTL_INT(_hw_firewire, OID_AUTO, try_bmr, CTLFLAG_RW, &try_bmr, 0, "Try to be a bus manager"); +MALLOC_DEFINE(M_FW, "firewire", "FireWire"); + #define FW_MAXASYRTY 4 #define FW_MAXDEVRCNT 4 @@ -434,8 +436,8 @@ firewire_detach( device_t dev ) callout_stop(&sc->fc->bmr_callout); callout_stop(&sc->fc->retry_probe_callout); callout_stop(&sc->fc->busprobe_callout); - free(sc->fc->topology_map, M_DEVBUF); - free(sc->fc->speed_map, M_DEVBUF); + free(sc->fc->topology_map, M_FW); + free(sc->fc->speed_map, M_FW); bus_generic_detach(dev); return(0); } @@ -610,10 +612,10 @@ void fw_init(struct firewire_comm *fc) /* Initialize csr registers */ fc->topology_map = (struct fw_topology_map *)malloc( sizeof(struct fw_topology_map), - M_DEVBUF, M_NOWAIT | M_ZERO); + M_FW, M_NOWAIT | M_ZERO); fc->speed_map = (struct fw_speed_map *)malloc( sizeof(struct fw_speed_map), - M_DEVBUF, M_NOWAIT | M_ZERO); + M_FW, M_NOWAIT | M_ZERO); CSRARC(fc, TOPO_MAP) = 0x3f1 << 16; CSRARC(fc, TOPO_MAP + 4) = 1; CSRARC(fc, SPED_MAP) = 0x3f1 << 16; @@ -626,7 +628,7 @@ void fw_init(struct firewire_comm *fc) SLIST_INIT(&fc->ongocsr); SLIST_INIT(&fc->csrfree); for( i = 0 ; i < FWMAXCSRDIR ; i++){ - csrd = (struct csrdir *) malloc(sizeof(struct csrdir), M_DEVBUF,M_NOWAIT); + csrd = (struct csrdir *) malloc(sizeof(struct csrdir), M_FW,M_NOWAIT); if(csrd == NULL) break; SLIST_INSERT_HEAD(&fc->csrfree, csrd, link); } @@ -657,7 +659,7 @@ void fw_init(struct firewire_comm *fc) xfer = fw_xfer_alloc(); if(xfer == NULL) return; - fwb = (struct fw_bind *)malloc(sizeof (struct fw_bind), M_DEVBUF, M_NOWAIT); + fwb = (struct fw_bind *)malloc(sizeof (struct fw_bind), M_FW, M_NOWAIT); if(fwb == NULL){ fw_xfer_free(xfer); } @@ -772,7 +774,7 @@ fw_tl_free(struct firewire_comm *fc, struct fw_xfer *xfer) tl = STAILQ_NEXT(tl, link)){ if(tl->xfer == xfer){ STAILQ_REMOVE(&fc->tlabels[xfer->tl], tl, tlabel, link); - free(tl, M_DEVBUF); + free(tl, M_FW); splx(s); return; } @@ -811,7 +813,7 @@ fw_xfer_alloc() { struct fw_xfer *xfer; - xfer = malloc(sizeof(struct fw_xfer), M_DEVBUF, M_NOWAIT | M_ZERO); + xfer = malloc(sizeof(struct fw_xfer), M_FW, M_NOWAIT | M_ZERO); if (xfer == NULL) return xfer; @@ -871,15 +873,15 @@ fw_xfer_free( struct fw_xfer* xfer) } } if(xfer->send.buf != NULL){ - free(xfer->send.buf, M_DEVBUF); + free(xfer->send.buf, M_FW); } if(xfer->recv.buf != NULL){ - free(xfer->recv.buf, M_DEVBUF); + free(xfer->recv.buf, M_FW); } if(xfer->fc != NULL){ fw_tl_free(xfer->fc, xfer); } - free(xfer, M_DEVBUF); + free(xfer, M_FW); } static void @@ -914,7 +916,7 @@ fw_phy_config(struct firewire_comm *fc, int root_node, int gap_count) xfer->act.hand = fw_asy_callback_free; xfer->send.buf = malloc(sizeof(u_int32_t), - M_DEVBUF, M_NOWAIT | M_ZERO); + M_FW, M_NOWAIT | M_ZERO); fp = (struct fw_pkt *)xfer->send.buf; fp->mode.ld[1] = 0; if (root_node >= 0) @@ -1066,7 +1068,7 @@ void fw_sidrcv(struct firewire_comm* fc, caddr_t buf, u_int len, u_int off) CSRARC(fc, BUS_MGR_ID)); #endif } - free(buf, M_DEVBUF); + free(buf, M_FW); if(fc->irm == ((CSRARC(fc, NODE_IDS) >> 16 ) & 0x3f)){ /* I am BMGR */ fw_bmr(fc); @@ -1101,7 +1103,7 @@ fw_bus_probe(struct firewire_comm *fc) fwdev->rcnt ++; } else { STAILQ_REMOVE(&fc->devices, fwdev, fw_device, link); - free(fwdev, M_DEVBUF); + free(fwdev, M_FW); } } fc->ongonode = 0; @@ -1165,7 +1167,7 @@ loop: fc->ongoeui.hi = 0xffffffff; fc->ongoeui.lo = 0xffffffff; goto loop; } - fwdev = malloc(sizeof(struct fw_device), M_DEVBUF, M_NOWAIT); + fwdev = malloc(sizeof(struct fw_device), M_FW, M_NOWAIT); if(fwdev == NULL) return; fwdev->fc = fc; @@ -1215,7 +1217,7 @@ loop: } xfer->send.len = 16; xfer->spd = 0; - xfer->send.buf = malloc(16, M_DEVBUF, M_NOWAIT); + xfer->send.buf = malloc(16, M_FW, M_NOWAIT); if(xfer->send.buf == NULL){ fw_xfer_free( xfer); return; @@ -1266,7 +1268,7 @@ asyreqq(struct firewire_comm *fc, u_int8_t spd, u_int8_t tl, u_int8_t rt, } xfer->send.len = 16; xfer->spd = spd; /* XXX:min(spd, fc->spd) */ - xfer->send.buf = malloc(16, M_DEVBUF, M_NOWAIT); + xfer->send.buf = malloc(16, M_FW, M_NOWAIT); if(xfer->send.buf == NULL){ fw_xfer_free( xfer); return NULL; @@ -1595,7 +1597,7 @@ fw_get_tlabel(struct firewire_comm *fc, struct fw_xfer *xfer) if(tmptl->xfer->dst == xfer->dst) break; } if(tmptl == NULL) { - tl = malloc(sizeof(struct tlabel),M_DEVBUF,M_NOWAIT); + tl = malloc(sizeof(struct tlabel),M_FW,M_NOWAIT); if (tl == NULL) { splx(s); return (-1); @@ -1710,7 +1712,7 @@ fw_rcv(struct firewire_comm* fc, caddr_t buf, u_int len, u_int sub, u_int off, u return; } xfer->spd = spd; - xfer->send.buf = malloc(16, M_DEVBUF, M_NOWAIT); + xfer->send.buf = malloc(16, M_FW, M_NOWAIT); resfp = (struct fw_pkt *)xfer->send.buf; switch(fp->mode.common.tcode){ case FWTCODE_WREQQ: @@ -1838,7 +1840,7 @@ fw_rcv(struct firewire_comm* fc, caddr_t buf, u_int len, u_int sub, u_int off, u break; } err: - free(buf, M_DEVBUF); + free(buf, M_FW); } /* @@ -1898,7 +1900,7 @@ fw_try_bmr(void *arg) } xfer->send.len = 24; xfer->spd = 0; - xfer->send.buf = malloc(24, M_DEVBUF, M_NOWAIT); + xfer->send.buf = malloc(24, M_FW, M_NOWAIT); if(xfer->send.buf == NULL){ fw_xfer_free( xfer); return; @@ -1956,7 +1958,7 @@ fw_vmaccess(struct fw_xfer *xfer){ switch(rfp->mode.hdr.tcode){ /* XXX need fix for 64bit arch */ case FWTCODE_WREQB: - xfer->send.buf = malloc(12, M_DEVBUF, M_NOWAIT); + xfer->send.buf = malloc(12, M_FW, M_NOWAIT); xfer->send.len = 12; sfp = (struct fw_pkt *)xfer->send.buf; bcopy(rfp->mode.wreqb.payload, @@ -1965,14 +1967,14 @@ fw_vmaccess(struct fw_xfer *xfer){ sfp->mode.wres.rtcode = 0; break; case FWTCODE_WREQQ: - xfer->send.buf = malloc(12, M_DEVBUF, M_NOWAIT); + xfer->send.buf = malloc(12, M_FW, M_NOWAIT); xfer->send.len = 12; sfp->mode.wres.tcode = FWTCODE_WRES; *((u_int32_t *)(ntohl(rfp->mode.wreqb.dest_lo))) = rfp->mode.wreqq.data; sfp->mode.wres.rtcode = 0; break; case FWTCODE_RREQB: - xfer->send.buf = malloc(16 + rfp->mode.rreqb.len, M_DEVBUF, M_NOWAIT); + xfer->send.buf = malloc(16 + rfp->mode.rreqb.len, M_FW, M_NOWAIT); xfer->send.len = 16 + ntohs(rfp->mode.rreqb.len); sfp = (struct fw_pkt *)xfer->send.buf; bcopy((caddr_t)ntohl(rfp->mode.rreqb.dest_lo), @@ -1983,7 +1985,7 @@ fw_vmaccess(struct fw_xfer *xfer){ sfp->mode.rresb.extcode = 0; break; case FWTCODE_RREQQ: - xfer->send.buf = malloc(16, M_DEVBUF, M_NOWAIT); + xfer->send.buf = malloc(16, M_FW, M_NOWAIT); xfer->send.len = 16; sfp = (struct fw_pkt *)xfer->send.buf; sfp->mode.rresq.data = *(u_int32_t *)(ntohl(rfp->mode.rreqq.dest_lo)); diff --git a/sys/dev/firewire/firewirereg.h b/sys/dev/firewire/firewirereg.h index 1c71eca..7eb9e02 100644 --- a/sys/dev/firewire/firewirereg.h +++ b/sys/dev/firewire/firewirereg.h @@ -362,3 +362,5 @@ extern devclass_t firewire_devclass; #undef vtophys #define vtophys(va) alpha_XXX_dmamap((vm_offset_t)(va)) #endif /* __alpha__ */ + +MALLOC_DECLARE(M_FW); diff --git a/sys/dev/firewire/fwdev.c b/sys/dev/firewire/fwdev.c index 4652eb6..1ef9ec4 100644 --- a/sys/dev/firewire/fwdev.c +++ b/sys/dev/firewire/fwdev.c @@ -140,38 +140,38 @@ fw_close (dev_t dev, int flags, int fmt, fw_proc *td) struct fw_dvbuf *dvbuf; if((dvbuf = sc->fc->it[sub]->dvproc) != NULL){ - free(dvbuf->buf, M_DEVBUF); + free(dvbuf->buf, M_FW); sc->fc->it[sub]->dvproc = NULL; } if((dvbuf = sc->fc->it[sub]->dvdma) != NULL){ - free(dvbuf->buf, M_DEVBUF); + free(dvbuf->buf, M_FW); sc->fc->it[sub]->dvdma = NULL; } while((dvbuf = STAILQ_FIRST(&sc->fc->it[sub]->dvvalid)) != NULL){ STAILQ_REMOVE_HEAD(&sc->fc->it[sub]->dvvalid, link); - free(dvbuf->buf, M_DEVBUF); + free(dvbuf->buf, M_FW); } while((dvbuf = STAILQ_FIRST(&sc->fc->it[sub]->dvfree)) != NULL){ STAILQ_REMOVE_HEAD(&sc->fc->it[sub]->dvfree, link); - free(dvbuf->buf, M_DEVBUF); + free(dvbuf->buf, M_FW); } - free(sc->fc->it[sub]->dvbuf, M_DEVBUF); + free(sc->fc->it[sub]->dvbuf, M_FW); sc->fc->it[sub]->dvbuf = NULL; } #endif if(sc->fc->ir[sub]->flag & FWXFERQ_EXTBUF){ - free(sc->fc->ir[sub]->buf, M_DEVBUF); + free(sc->fc->ir[sub]->buf, M_FW); sc->fc->ir[sub]->buf = NULL; - free(sc->fc->ir[sub]->bulkxfer, M_DEVBUF); + free(sc->fc->ir[sub]->bulkxfer, M_FW); sc->fc->ir[sub]->bulkxfer = NULL; sc->fc->ir[sub]->flag &= ~FWXFERQ_EXTBUF; sc->fc->ir[sub]->psize = PAGE_SIZE; sc->fc->ir[sub]->maxq = FWMAXQUEUE; } if(sc->fc->it[sub]->flag & FWXFERQ_EXTBUF){ - free(sc->fc->it[sub]->buf, M_DEVBUF); + free(sc->fc->it[sub]->buf, M_FW); sc->fc->it[sub]->buf = NULL; - free(sc->fc->it[sub]->bulkxfer, M_DEVBUF); + free(sc->fc->it[sub]->bulkxfer, M_FW); sc->fc->it[sub]->bulkxfer = NULL; #ifdef FWXFERQ_DV sc->fc->it[sub]->dvbuf = NULL; @@ -199,7 +199,7 @@ fw_close (dev_t dev, int flags, int fmt, fw_proc *td) fwb = STAILQ_FIRST(&sc->fc->ir[sub]->binds)){ STAILQ_REMOVE(&sc->fc->binds, fwb, fw_bind, fclist); STAILQ_REMOVE_HEAD(&sc->fc->ir[sub]->binds, chlist); - free(fwb, M_DEVBUF); + free(fwb, M_FW); } sc->fc->ir[sub]->flag &= ~FWXFERQ_MODEMASK; sc->fc->it[sub]->flag &= ~FWXFERQ_MODEMASK; @@ -460,7 +460,7 @@ dvloop: err = ENOMEM; return err; } - xfer->send.buf = malloc(uio->uio_resid, M_DEVBUF, M_NOWAIT); + xfer->send.buf = malloc(uio->uio_resid, M_FW, M_NOWAIT); if(xfer->send.buf == NULL){ fw_xfer_free( xfer); err = ENOBUFS; @@ -569,7 +569,7 @@ fw_ioctl (dev_t dev, u_long cmd, caddr_t data, int flag, fw_proc *td) #ifdef FWXFERQ_DV case FW_SSTDV: ibufreq = (struct fw_isobufreq *) - malloc(sizeof(struct fw_isobufreq), M_DEVBUF, M_NOWAIT); + malloc(sizeof(struct fw_isobufreq), M_FW, M_NOWAIT); if(ibufreq == NULL){ err = ENOMEM; break; @@ -590,7 +590,7 @@ fw_ioctl (dev_t dev, u_long cmd, caddr_t data, int flag, fw_proc *td) err = fw_ioctl(dev, FW_SSTBUF, (caddr_t)ibufreq, flag, td); sc->fc->it[sub]->dvpacket = FWDVPACKET; - free(ibufreq, M_DEVBUF); + free(ibufreq, M_FW); /* reserve a buffer space */ #define NDVCHUNK 8 sc->fc->it[sub]->dvproc = NULL; @@ -598,13 +598,13 @@ fw_ioctl (dev_t dev, u_long cmd, caddr_t data, int flag, fw_proc *td) sc->fc->it[sub]->flag |= FWXFERQ_DV; /* XXX check malloc failure */ sc->fc->it[sub]->dvbuf - = (struct fw_dvbuf *)malloc(sizeof(struct fw_dvbuf) * NDVCHUNK, M_DEVBUF, M_NOWAIT); + = (struct fw_dvbuf *)malloc(sizeof(struct fw_dvbuf) * NDVCHUNK, M_FW, M_NOWAIT); STAILQ_INIT(&sc->fc->it[sub]->dvvalid); STAILQ_INIT(&sc->fc->it[sub]->dvfree); for( i = 0 ; i < NDVCHUNK ; i++){ /* XXX check malloc failure */ sc->fc->it[sub]->dvbuf[i].buf - = malloc(FWDVPMAX * sc->fc->it[sub]->dvpacket, M_DEVBUF, M_NOWAIT); + = malloc(FWDVPMAX * sc->fc->it[sub]->dvpacket, M_FW, M_NOWAIT); STAILQ_INSERT_TAIL(&sc->fc->it[sub]->dvfree, &sc->fc->it[sub]->dvbuf[i], link); } @@ -631,12 +631,12 @@ fw_ioctl (dev_t dev, u_long cmd, caddr_t data, int flag, fw_proc *td) return(EINVAL); } ir->bulkxfer - = (struct fw_bulkxfer *)malloc(sizeof(struct fw_bulkxfer) * ibufreq->rx.nchunk, M_DEVBUF, M_NOWAIT); + = (struct fw_bulkxfer *)malloc(sizeof(struct fw_bulkxfer) * ibufreq->rx.nchunk, M_FW, M_NOWAIT); if(ir->bulkxfer == NULL){ return(ENOMEM); } it->bulkxfer - = (struct fw_bulkxfer *)malloc(sizeof(struct fw_bulkxfer) * ibufreq->tx.nchunk, M_DEVBUF, M_NOWAIT); + = (struct fw_bulkxfer *)malloc(sizeof(struct fw_bulkxfer) * ibufreq->tx.nchunk, M_FW, M_NOWAIT); if(it->bulkxfer == NULL){ return(ENOMEM); } @@ -645,10 +645,10 @@ fw_ioctl (dev_t dev, u_long cmd, caddr_t data, int flag, fw_proc *td) /* XXX psize must be 2^n and less or equal to PAGE_SIZE */ * ((ibufreq->rx.psize + 3) &~3), - M_DEVBUF, M_NOWAIT); + M_FW, M_NOWAIT); if(ir->buf == NULL){ - free(ir->bulkxfer, M_DEVBUF); - free(it->bulkxfer, M_DEVBUF); + free(ir->bulkxfer, M_FW); + free(it->bulkxfer, M_FW); ir->bulkxfer = NULL; it->bulkxfer = NULL; it->buf = NULL; @@ -659,11 +659,11 @@ fw_ioctl (dev_t dev, u_long cmd, caddr_t data, int flag, fw_proc *td) /* XXX psize must be 2^n and less or equal to PAGE_SIZE */ * ((ibufreq->tx.psize + 3) &~3), - M_DEVBUF, M_NOWAIT); + M_FW, M_NOWAIT); if(it->buf == NULL){ - free(ir->bulkxfer, M_DEVBUF); - free(it->bulkxfer, M_DEVBUF); - free(ir->buf, M_DEVBUF); + free(ir->bulkxfer, M_FW); + free(it->bulkxfer, M_FW); + free(ir->buf, M_FW); ir->bulkxfer = NULL; it->bulkxfer = NULL; it->buf = NULL; @@ -765,7 +765,7 @@ fw_ioctl (dev_t dev, u_long cmd, caddr_t data, int flag, fw_proc *td) } xfer->spd = asyreq->req.sped; xfer->send.len = asyreq->req.len; - xfer->send.buf = malloc(xfer->send.len, M_DEVBUF, M_NOWAIT); + xfer->send.buf = malloc(xfer->send.len, M_FW, M_NOWAIT); if(xfer->send.buf == NULL){ return ENOMEM; } @@ -801,7 +801,7 @@ error: } STAILQ_REMOVE(&sc->fc->binds, fwb, fw_bind, fclist); STAILQ_REMOVE(&sc->fc->ir[sub]->binds, fwb, fw_bind, chlist); - free(fwb, M_DEVBUF); + free(fwb, M_FW); break; case FW_SBINDADDR: if(bindreq->len <= 0 ){ @@ -812,7 +812,7 @@ error: err = EINVAL; break; } - fwb = (struct fw_bind *)malloc(sizeof (struct fw_bind), M_DEVBUF, M_NOWAIT); + fwb = (struct fw_bind *)malloc(sizeof (struct fw_bind), M_FW, M_NOWAIT); if(fwb == NULL){ err = ENOMEM; break; diff --git a/sys/dev/firewire/fwmem.c b/sys/dev/firewire/fwmem.c index 478bcbf..2f59253 100644 --- a/sys/dev/firewire/fwmem.c +++ b/sys/dev/firewire/fwmem.c @@ -92,7 +92,7 @@ fwmem_xfer_req( else xfer->spd = min(spd, fwdev->speed); xfer->send.len = len; - xfer->send.buf = malloc(len, M_DEVBUF, M_NOWAIT | M_ZERO); + xfer->send.buf = malloc(len, M_FW, M_NOWAIT | M_ZERO); if (xfer->send.buf == NULL) { fw_xfer_free(xfer); diff --git a/sys/dev/firewire/fwohci.c b/sys/dev/firewire/fwohci.c index 2f196da..3889d2e 100644 --- a/sys/dev/firewire/fwohci.c +++ b/sys/dev/firewire/fwohci.c @@ -636,7 +636,7 @@ fwohci_init(struct fwohci_softc *sc, device_t dev) sc->fc.tcode = tinfo; - sc->cromptr = (u_int32_t *) malloc(CROMSIZE * 2, M_DEVBUF, M_NOWAIT); + sc->cromptr = (u_int32_t *) malloc(CROMSIZE * 2, M_FW, M_NOWAIT); if(sc->cromptr == NULL){ device_printf(dev, "cromptr alloc failed."); @@ -657,7 +657,7 @@ fwohci_init(struct fwohci_softc *sc, device_t dev) /* SID recieve buffer must allign 2^11 */ #define OHCI_SIDSIZE (1 << 11) - sc->fc.sid_buf = (u_int32_t *) malloc(OHCI_SIDSIZE, M_DEVBUF, M_NOWAIT); + sc->fc.sid_buf = (u_int32_t *) malloc(OHCI_SIDSIZE, M_FW, M_NOWAIT); if (sc->fc.sid_buf == NULL) { device_printf(dev, "sid_buf alloc failed.\n"); return ENOMEM; @@ -735,9 +735,9 @@ fwohci_detach(struct fwohci_softc *sc, device_t dev) int i; if (sc->fc.sid_buf != NULL) - free((void *)(uintptr_t)sc->fc.sid_buf, M_DEVBUF); + free((void *)(uintptr_t)sc->fc.sid_buf, M_FW); if (sc->cromptr != NULL) - free((void *)sc->cromptr, M_DEVBUF); + free((void *)sc->cromptr, M_FW); fwohci_db_free(&sc->arrq); fwohci_db_free(&sc->arrs); @@ -1117,7 +1117,7 @@ fwohci_db_free(struct fwohci_dbch *dbch) idb < dbch->ndb; db_tr = STAILQ_NEXT(db_tr, link), idb++){ if (db_tr->buf != NULL) { - free(db_tr->buf, M_DEVBUF); + free(db_tr->buf, M_FW); db_tr->buf = NULL; } } @@ -1125,8 +1125,8 @@ fwohci_db_free(struct fwohci_dbch *dbch) dbch->ndb = 0; db_tr = STAILQ_FIRST(&dbch->db_trq); for (i = 0; i < dbch->npages; i++) - free(dbch->pages[i], M_DEVBUF); - free(db_tr, M_DEVBUF); + free(dbch->pages[i], M_FW); + free(db_tr, M_FW); STAILQ_INIT(&dbch->db_trq); dbch->flags &= ~FWOHCI_DBCH_INIT; } @@ -1146,7 +1146,7 @@ fwohci_db_init(struct fwohci_dbch *dbch) STAILQ_INIT(&dbch->db_trq); db_tr = (struct fwohcidb_tr *) malloc(sizeof(struct fwohcidb_tr) * dbch->ndb, - M_DEVBUF, M_NOWAIT | M_ZERO); + M_FW, M_NOWAIT | M_ZERO); if(db_tr == NULL){ printf("fwohci_db_init: malloc(1) failed\n"); return; @@ -1163,13 +1163,13 @@ fwohci_db_init(struct fwohci_dbch *dbch) return; } for (i = 0; i < dbch->npages; i++) { - dbch->pages[i] = malloc(PAGE_SIZE, M_DEVBUF, + dbch->pages[i] = malloc(PAGE_SIZE, M_FW, M_NOWAIT | M_ZERO); if (dbch->pages[i] == NULL) { printf("fwohci_db_init: malloc(2) failed\n"); for (j = 0; j < i; j ++) - free(dbch->pages[j], M_DEVBUF); - free(db_tr, M_DEVBUF); + free(dbch->pages[j], M_FW); + free(db_tr, M_FW); return; } } @@ -1231,7 +1231,7 @@ fwohci_irx_disable(struct firewire_comm *fc, int dmach) /* XXX we cannot free buffers until the DMA really stops */ tsleep((void *)&dummy, FWPRI, "fwirxd", hz); if(sc->ir[dmach].dummy != NULL){ - free(sc->ir[dmach].dummy, M_DEVBUF); + free(sc->ir[dmach].dummy, M_FW); } sc->ir[dmach].dummy = NULL; fwohci_db_free(&sc->ir[dmach]); @@ -1594,7 +1594,7 @@ fwohci_irxbuf_enable(struct firewire_comm *fc, int dmach) ir->queued = 0; dbch->ndb = ir->bnpacket * ir->bnchunk; dbch->dummy = malloc(sizeof(u_int32_t) * dbch->ndb, - M_DEVBUF, M_NOWAIT); + M_FW, M_NOWAIT); if (dbch->dummy == NULL) { err = ENOMEM; return err; @@ -1891,7 +1891,7 @@ fwohci_intr_body(struct fwohci_softc *sc, u_int32_t stat, int count) goto sidout; } plen -= 4; /* chop control info */ - buf = malloc(OHCI_SIDSIZE, M_DEVBUF, M_NOWAIT); + buf = malloc(OHCI_SIDSIZE, M_FW, M_NOWAIT); if(buf == NULL) goto sidout; bcopy((void *)(uintptr_t)(volatile void *)(fc->sid_buf + 1), buf, plen); @@ -2419,7 +2419,7 @@ fwohci_add_rx_buf(struct fwohcidb_tr *db_tr, unsigned short size, int mode, int dsiz[2]; if(buf == 0){ - buf = malloc(size, M_DEVBUF, M_NOWAIT); + buf = malloc(size, M_FW, M_NOWAIT); if(buf == NULL) return 0; db_tr->buf = buf; db_tr->dbcnt = 1; @@ -2528,7 +2528,7 @@ device_printf(sc->fc.dev, "%04x %2x 0x%08x 0x%08x 0x%08x 0x%08x\n", len, fw_rcv(&sc->fc, buf, plen - sizeof(u_int32_t), dmach, sizeof(u_int32_t), spd); break; default: - free(buf, M_DEVBUF); + free(buf, M_FW); device_printf(sc->fc.dev, "Isochronous receive err %02x\n", stat); break; } @@ -2697,10 +2697,10 @@ fwohci_arcv(struct fwohci_softc *sc, struct fwohci_dbch *dbch, int count) } if(resCount > 0 || len > 0){ buf = malloc( dbch->xferq.psize, - M_DEVBUF, M_NOWAIT); + M_FW, M_NOWAIT); if(buf == NULL){ printf("cannot malloc!\n"); - free(db_tr->buf, M_DEVBUF); + free(db_tr->buf, M_FW); goto out; } bcopy(ld, buf, plen); @@ -2750,7 +2750,7 @@ fwohci_arcv(struct fwohci_softc *sc, struct fwohci_dbch *dbch, int count) fw_rcv(&sc->fc, buf, plen - sizeof(struct fwohci_trailer), 0, 0, spd); break; case FWOHCIEV_BUSRST: - free(buf, M_DEVBUF); + free(buf, M_FW); if (sc->fc.status != FWBUSRESET) printf("got BUSRST packet!?\n"); break; diff --git a/sys/dev/firewire/fwohci_pci.c b/sys/dev/firewire/fwohci_pci.c index 7ace8b7..45d2646 100644 --- a/sys/dev/firewire/fwohci_pci.c +++ b/sys/dev/firewire/fwohci_pci.c @@ -41,6 +41,7 @@ #include <sys/queue.h> #include <machine/bus.h> #include <sys/rman.h> +#include <sys/malloc.h> #include <machine/resource.h> #include <pci/pcivar.h> diff --git a/sys/dev/firewire/if_fwe.c b/sys/dev/firewire/if_fwe.c index 6565807..1b7885d 100644 --- a/sys/dev/firewire/if_fwe.c +++ b/sys/dev/firewire/if_fwe.c @@ -500,7 +500,7 @@ static void fwe_free(void *buf, void *args) { FWEDEBUG("fwe_free:\n"); - free(buf, M_DEVBUF); + free(buf, M_FW); } #else @@ -512,7 +512,7 @@ fwe_free(caddr_t buf, u_int size) p = (int *)buf; (*p) --; if (*p < 1) - free(buf, M_DEVBUF); + free(buf, M_FW); } static void diff --git a/sys/dev/firewire/sbp.c b/sys/dev/firewire/sbp.c index 81d5711..e37727b 100644 --- a/sys/dev/firewire/sbp.c +++ b/sys/dev/firewire/sbp.c @@ -1053,9 +1053,9 @@ sbp_write_cmd(struct sbp_dev *sdev, int tcode, int offset) else xfer->send.len = 24; - xfer->send.buf = malloc(xfer->send.len, M_DEVBUF, M_NOWAIT); + xfer->send.buf = malloc(xfer->send.len, M_FW, M_NOWAIT); if(xfer->send.buf == NULL){ - fw_xfer_free( xfer); + fw_xfer_free(xfer); return NULL; } |