diff options
Diffstat (limited to 'sys/dev')
-rw-r--r-- | sys/dev/ieee1394/fwnode.c | 64 | ||||
-rw-r--r-- | sys/dev/ieee1394/fwohci.c | 136 | ||||
-rw-r--r-- | sys/dev/ieee1394/fwscsi.c | 81 | ||||
-rw-r--r-- | sys/dev/std/ieee1212.c | 98 | ||||
-rw-r--r-- | sys/dev/std/sbp2.c | 130 |
5 files changed, 262 insertions, 247 deletions
diff --git a/sys/dev/ieee1394/fwnode.c b/sys/dev/ieee1394/fwnode.c index 583bc3cbbd6..642df0ebe59 100644 --- a/sys/dev/ieee1394/fwnode.c +++ b/sys/dev/ieee1394/fwnode.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fwnode.c,v 1.4 2002/12/13 02:52:04 tdeval Exp $ */ +/* $OpenBSD: fwnode.c,v 1.5 2002/12/13 21:35:11 tdeval Exp $ */ /* $NetBSD: fwnode.c,v 1.13 2002/04/03 04:15:59 jmc Exp $ */ /* @@ -88,8 +88,12 @@ int fwnode_oldlog; fwnode_oldlog = log_open; log_open = 1; \ addlog x; log_open = fwnode_oldlog; \ } while (0) +#ifdef FW_MALLOC_DEBUG #define MPRINTF(x,y) DPRINTF(("%s[%d]: %s 0x%08x\n", \ __func__, __LINE__, (x), (u_int32_t)(y))) +#else /* !FW_MALLOC_DEBUG */ +#define MPRINTF(x,y) +#endif /* FW_MALLOC_DEBUG */ int fwnodedebug = 0; #else /* FWNODE_DEBUG */ @@ -135,14 +139,14 @@ fwnode_attach(struct device *parent, struct device *self, void *aux) #ifdef M_ZERO MALLOC(ab, struct ieee1394_abuf *, sizeof(*ab), M_1394DATA, M_WAITOK|M_ZERO); - //MPRINTF_OLD("MALLOC(1394DATA)", ab); + MPRINTF("MALLOC(1394DATA)", ab); #else MALLOC(ab, struct ieee1394_abuf *, sizeof(*ab), M_1394DATA, M_WAITOK); - //MPRINTF_OLD("MALLOC(1394DATA)", ab); + MPRINTF("MALLOC(1394DATA)", ab); bzero(ab, sizeof(*ab)); #endif ab->ab_data = malloc(4, M_1394DATA, M_WAITOK); - //MPRINTF_OLD("malloc(1394DATA)", ab->ab_data); + MPRINTF("malloc(1394DATA)", ab->ab_data); ab->ab_data[0] = 0; sc->sc_sc1394.sc1394_node_id = fwa->nodeid; @@ -184,14 +188,14 @@ fwnode_detach(struct device *self, int flags) children++; } free(sc->sc_children, M_DEVBUF); - //MPRINTF_OLD("free(DEVBUF)", sc->sc_children); + MPRINTF("free(DEVBUF)", sc->sc_children); sc->sc_children = NULL; } if (sc->sc_sc1394.sc1394_configrom && sc->sc_sc1394.sc1394_configrom_len) { free(sc->sc_sc1394.sc1394_configrom, M_1394DATA); - //MPRINTF_OLD("free(1394DATA)", sc->sc_sc1394.sc1394_configrom); + MPRINTF("free(1394DATA)", sc->sc_sc1394.sc1394_configrom); sc->sc_sc1394.sc1394_configrom = NULL; } @@ -235,14 +239,14 @@ fwnode_configrom_input(struct ieee1394_abuf *ab, int rcode) #endif /* FWNODE_DEBUG */ if (cc != NULL) { FREE(cc, M_1394DATA); - //MPRINTF_OLD("FREE(1394DATA)", cc); + MPRINTF("FREE(1394DATA)", cc); cc = NULL; /* XXX */ } free(ab->ab_data, M_1394DATA); - //MPRINTF_OLD("free(1394DATA)", ab->ab_data); + MPRINTF("free(1394DATA)", ab->ab_data); ab->ab_data = NULL; FREE(ab, M_1394DATA); - //MPRINTF_OLD("FREE(1394DATA)", ab); + MPRINTF("FREE(1394DATA)", ab); ab = NULL; /* XXX */ return; } @@ -252,10 +256,10 @@ fwnode_configrom_input(struct ieee1394_abuf *ab, int rcode) "%d. Not attaching\n", sc->sc_sc1394.sc1394_dev.dv_xname, ab->ab_length, ab->ab_retlen)); free(ab->ab_data, M_1394DATA); - //MPRINTF_OLD("free(1394DATA)", ab->ab_data); + MPRINTF("free(1394DATA)", ab->ab_data); ab->ab_data = NULL; FREE(ab, M_1394DATA); - //MPRINTF_OLD("FREE(1394DATA)", ab); + MPRINTF("FREE(1394DATA)", ab); ab = NULL; /* XXX */ return; } @@ -263,10 +267,10 @@ fwnode_configrom_input(struct ieee1394_abuf *ab, int rcode) DPRINTF(("%s: configrom read of invalid length: %d\n", sc->sc_sc1394.sc1394_dev.dv_xname, ab->ab_retlen)); free(ab->ab_data, M_1394DATA); - //MPRINTF_OLD("free(1394DATA)", ab->ab_data); + MPRINTF("free(1394DATA)", ab->ab_data); ab->ab_data = NULL; FREE(ab, M_1394DATA); - //MPRINTF_OLD("FREE(1394DATA)", ab); + MPRINTF("FREE(1394DATA)", ab); ab = NULL; /* XXX */ return; } @@ -287,13 +291,13 @@ fwnode_configrom_input(struct ieee1394_abuf *ab, int rcode) return; } else { free(ab->ab_data, M_1394DATA); - //MPRINTF_OLD("free(1394DATA)", ab->ab_data); + MPRINTF("free(1394DATA)", ab->ab_data); ab->ab_data = NULL; ab->ab_data = &cc->cc_buf[0]; ab->ab_retlen = cc->cc_retlen; ab->ab_length = cc->cc_retlen * 4; FREE(cc, M_1394DATA); - //MPRINTF_OLD("FREE(1394DATA)", cc); + MPRINTF("FREE(1394DATA)", cc); cc = NULL; /* XXX */ ab->ab_cbarg = NULL; } @@ -303,10 +307,10 @@ fwnode_configrom_input(struct ieee1394_abuf *ab, int rcode) DPRINTF(("%s: configrom parse error\n", sc->sc_sc1394.sc1394_dev.dv_xname)); free(ab->ab_data, M_1394DATA); - //MPRINTF_OLD("free(1394DATA)", ab->ab_data); + MPRINTF("free(1394DATA)", ab->ab_data); ab->ab_data = NULL; /* XXX */ FREE(ab, M_1394DATA); - //MPRINTF_OLD("FREE(1394DATA)", ab); + MPRINTF("FREE(1394DATA)", ab); ab = NULL; /* XXX */ return; } @@ -322,26 +326,26 @@ fwnode_configrom_input(struct ieee1394_abuf *ab, int rcode) DPRINTF(("%s: cbarg not NULL\n", sc->sc_sc1394.sc1394_dev.dv_xname)); free(ab->ab_data, M_1394DATA); - //MPRINTF_OLD("free(1394DATA)", ab->ab_data); + MPRINTF("free(1394DATA)", ab->ab_data); ab->ab_data = NULL; /* XXX */ FREE(ab, M_1394DATA); - //MPRINTF_OLD("FREE(1394DATA)", ab); + MPRINTF("FREE(1394DATA)", ab); ab = NULL; /* XXX */ return; } free(ab->ab_data, M_1394DATA); - //MPRINTF_OLD("free(1394DATA)", ab->ab_data); + MPRINTF("free(1394DATA)", ab->ab_data); ab->ab_data = NULL; /* XXX */ if (ab->ab_length == 4) { /* reread whole rom */ #ifdef M_ZERO ab->ab_data = malloc(ab->ab_retlen * 4, M_1394DATA, M_WAITOK|M_ZERO); - //MPRINTF_OLD("malloc(1394DATA)",ab->ab_data); + MPRINTF("malloc(1394DATA)",ab->ab_data); #else ab->ab_data = malloc(ab->ab_retlen * 4, M_1394DATA, M_WAITOK); - //MPRINTF_OLD("malloc(1394DATA)",ab->ab_data); + MPRINTF("malloc(1394DATA)",ab->ab_data); bzero(ab->ab_data, ab->ab_retlen * 4); #endif @@ -359,17 +363,17 @@ fwnode_configrom_input(struct ieee1394_abuf *ab, int rcode) #ifdef M_ZERO cbuf = malloc(ab->ab_retlen * 4, M_1394DATA, M_WAITOK|M_ZERO); - //MPRINTF_OLD("malloc(1394DATA)", cbuf); + MPRINTF("malloc(1394DATA)", cbuf); MALLOC(cc, struct cfgrom_cbarg *, sizeof(*cc), M_1394DATA, M_WAITOK|M_ZERO); - //MPRINTF_OLD("MALLOC(1394DATA)", cc); + MPRINTF("MALLOC(1394DATA)", cc); #else cbuf = malloc(ab->ab_retlen * 4, M_1394DATA, M_WAITOK); - //MPRINTF_OLD("malloc(1394DATA)", cbuf); + MPRINTF("malloc(1394DATA)", cbuf); bzero(cbuf, ab->ab_retlen * 4); MALLOC(cc, struct cfgrom_cbarg *, sizeof(*cc), M_1394DATA, M_WAITOK); - //MPRINTF_OLD("MALLOC(1394DATA)", cc); + MPRINTF("MALLOC(1394DATA)", cc); bzero(cc, sizeof(*cc)); #endif cc->cc_type = 0x31333934; @@ -378,7 +382,7 @@ fwnode_configrom_input(struct ieee1394_abuf *ab, int rcode) cc->cc_buf = cbuf; ab->ab_data = malloc(4, M_1394DATA, M_WAITOK); - //MPRINTF_OLD("malloc(1394DATA)", ab->ab_data); + MPRINTF("malloc(1394DATA)", ab->ab_data); ab->ab_data[0] = 0; ab->ab_addr = CSR_BASE + CSR_CONFIG_ROM; ab->ab_length = 4; @@ -395,7 +399,7 @@ fwnode_configrom_input(struct ieee1394_abuf *ab, int rcode) ab->ab_data = NULL; FREE(ab, M_1394DATA); - //MPRINTF_OLD("FREE(1394DATA)", ab); + MPRINTF("FREE(1394DATA)", ab); ab = NULL; /* XXX */ /* @@ -420,7 +424,7 @@ fwnode_configrom_input(struct ieee1394_abuf *ab, int rcode) if (sc->sc_configrom) p1212_free(sc->sc_configrom); free(sc->sc_sc1394.sc1394_configrom, M_1394DATA); - //MPRINTF_OLD("free(1394DATA)", sc->sc_sc1394.sc1394_configrom); + MPRINTF("free(1394DATA)", sc->sc_sc1394.sc1394_configrom); sc->sc_sc1394.sc1394_configrom = NULL; sc->sc_sc1394.sc1394_configrom_len = 0; return; @@ -436,7 +440,7 @@ fwnode_configrom_input(struct ieee1394_abuf *ab, int rcode) #endif /* FWNODE_DEBUG */ p1212_free(sc->sc_configrom); free(sc->sc_sc1394.sc1394_configrom, M_1394DATA); - //MPRINTF_OLD("free(1394DATA)", sc->sc_sc1394.sc1394_configrom); + MPRINTF("free(1394DATA)", sc->sc_sc1394.sc1394_configrom); sc->sc_sc1394.sc1394_configrom = NULL; sc->sc_sc1394.sc1394_configrom_len = 0; return; diff --git a/sys/dev/ieee1394/fwohci.c b/sys/dev/ieee1394/fwohci.c index 05116581f96..ca73df18e61 100644 --- a/sys/dev/ieee1394/fwohci.c +++ b/sys/dev/ieee1394/fwohci.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fwohci.c,v 1.5 2002/12/13 02:52:04 tdeval Exp $ */ +/* $OpenBSD: fwohci.c,v 1.6 2002/12/13 21:35:11 tdeval Exp $ */ /* $NetBSD: fwohci.c,v 1.54 2002/03/29 05:06:42 jmc Exp $ */ /* @@ -212,8 +212,12 @@ int fwohci_oldlog; fwohci_oldlog = log_open; log_open = 1; \ addlog x; log_open = fwohci_oldlog; \ } while (0) +#ifdef FW_MALLOC_DEBUG #define MPRINTF(x,y) DPRINTF(("%s[%d]: %s 0x%08x\n", \ __func__, __LINE__, (x), (u_int32_t)(y))) +#else /* !FW_MALLOC_DEBUG */ +#define MPRINTF(x,y) +#endif /* FW_MALLOC_DEBUG */ int fwohcidebug = 0; int fwintr = 0; @@ -325,7 +329,7 @@ fwohci_init(struct fwohci_softc *sc, const struct evcnt *ev) #endif MALLOC(sc->sc_dying, int *, sizeof(int), M_DEVBUF, M_WAITOK); - //MPRINTF_OLD("MALLOC(DEVBUF)", sc->sc_dying); + MPRINTF("MALLOC(DEVBUF)", sc->sc_dying); DPRINTF(("%s: sc_dying 0x%08x\n", __func__, (u_int32_t)sc->sc_dying)); *sc->sc_dying = 0; sc->sc_nodeid = 0xffff; /* invalid */ @@ -591,7 +595,7 @@ fwohci_thread_init(void *arg) OHCI_CTX_ASYNC_TX_RESPONSE, FWOHCI_CTX_ASYNC); sc->sc_ctx_ir = malloc(sizeof(sc->sc_ctx_ir[0]) * sc->sc_isoctx, M_DEVBUF, M_WAITOK); - //MPRINTF_OLD("malloc(DEVBUF)", sc->sc_ctx_ir); + MPRINTF("malloc(DEVBUF)", sc->sc_ctx_ir); for (i = 0; i < sc->sc_isoctx; i++) sc->sc_ctx_ir[i] = NULL; @@ -627,7 +631,7 @@ fwohci_thread_init(void *arg) if (sc->sc_uidtbl != NULL) { free(sc->sc_uidtbl, M_DEVBUF); - //MPRINTF_OLD("free(DEVBUF)", sc->sc_uidtbl); + MPRINTF("free(DEVBUF)", sc->sc_uidtbl); sc->sc_uidtbl = NULL; } @@ -635,7 +639,7 @@ fwohci_thread_init(void *arg) fwohci_buf_free(sc, &sc->sc_buf_cnfrom); free(sc->sc_ctx_ir, M_DEVBUF); - //MPRINTF_OLD("free(DEVBUF)", sc->sc_ctx_ir); + MPRINTF("free(DEVBUF)", sc->sc_ctx_ir); sc->sc_ctx_ir = NULL; /* XXX */ fwohci_ctx_free(sc, sc->sc_ctx_atrs); fwohci_ctx_free(sc, sc->sc_ctx_atrq); @@ -697,7 +701,7 @@ fwohci_event_thread(struct fwohci_softc *sc) // splx(s); if (sc->sc_uidtbl != NULL) { free(sc->sc_uidtbl, M_DEVBUF); - //MPRINTF_OLD("free(DEVBUF)", sc->sc_uidtbl); + MPRINTF("free(DEVBUF)", sc->sc_uidtbl); sc->sc_uidtbl = NULL; } @@ -799,7 +803,7 @@ fwohci_event_dispatch(struct fwohci_softc *sc) // splx(s); if (sc->sc_uidtbl != NULL) { free(sc->sc_uidtbl, M_DEVBUF); - //MPRINTF_OLD("free(DEVBUF)", sc->sc_uidtbl); + MPRINTF("free(DEVBUF)", sc->sc_uidtbl); sc->sc_uidtbl = NULL; } @@ -892,7 +896,7 @@ fwohci_dmamem_alloc(struct fwohci_softc *sc, int size, int alignment, segs, 1, &nsegs, flags); if (error) goto cleanup; - //MPRINTF_OLD("bus_dmamem_alloc", segs->ds_addr); + MPRINTF("bus_dmamem_alloc", segs->ds_addr); steps = 1; error = bus_dmamem_map(sc->sc_dmat, segs, nsegs, segs[0].ds_len, @@ -905,7 +909,7 @@ fwohci_dmamem_alloc(struct fwohci_softc *sc, int size, int alignment, size, flags, mapp); if (error) goto cleanup; - //MPRINTF_OLD("bus_dmamap_create", mapp); + MPRINTF("bus_dmamap_create", mapp); if (error == 0) error = bus_dmamap_load(sc->sc_dmat, *mapp, *kvap, size, NULL, @@ -917,7 +921,7 @@ fwohci_dmamem_alloc(struct fwohci_softc *sc, int size, int alignment, switch (steps) { case 1: bus_dmamem_free(sc->sc_dmat, segs, nsegs); - //MPRINTF_OLD("bus_dmamem_free", segs->ds_addr); + MPRINTF("bus_dmamem_free", segs->ds_addr); } return error; @@ -1212,10 +1216,10 @@ fwohci_desc_alloc(struct fwohci_softc *sc) mapsize = howmany(sc->sc_descsize, NBBY); #ifdef M_ZERO sc->sc_descmap = malloc(mapsize, M_DEVBUF, M_WAITOK|M_ZERO); - //MPRINTF_OLD("malloc(DEVBUF)", sc->sc_descmap); + MPRINTF("malloc(DEVBUF)", sc->sc_descmap); #else sc->sc_descmap = malloc(mapsize, M_DEVBUF, M_WAITOK); - //MPRINTF_OLD("malloc(DEVBUF)", sc->sc_descmap); + MPRINTF("malloc(DEVBUF)", sc->sc_descmap); bzero(sc->sc_descmap, mapsize); #endif @@ -1229,7 +1233,7 @@ fwohci_desc_alloc(struct fwohci_softc *sc) "error = %d\n", sc->sc_sc1394.sc1394_dev.dv_xname, error); goto fail_0; } - //MPRINTF_OLD("bus_dmamap_create", sc->sc_ddmamap); + MPRINTF("bus_dmamap_create", sc->sc_ddmamap); if ((error = bus_dmamem_alloc(sc->sc_dmat, dsize, PAGE_SIZE, 0, &sc->sc_dseg, 1, &sc->sc_dnseg, BUS_DMA_WAITOK)) != 0) { @@ -1237,7 +1241,7 @@ fwohci_desc_alloc(struct fwohci_softc *sc) sc->sc_sc1394.sc1394_dev.dv_xname, error); goto fail_1; } - //MPRINTF_OLD("bus_dmamem_alloc", sc->sc_dseg.ds_addr); + MPRINTF("bus_dmamem_alloc", sc->sc_dseg.ds_addr); if ((error = bus_dmamem_map(sc->sc_dmat, &sc->sc_dseg, sc->sc_dnseg, dsize, (caddr_t *)&sc->sc_desc, BUS_DMA_COHERENT | BUS_DMA_WAITOK)) @@ -1265,10 +1269,10 @@ fwohci_desc_alloc(struct fwohci_softc *sc) bus_dmamem_unmap(sc->sc_dmat, (caddr_t)sc->sc_desc, dsize); fail_2: bus_dmamem_free(sc->sc_dmat, &sc->sc_dseg, sc->sc_dnseg); - //MPRINTF_OLD("bus_dmamem_free", sc->sc_dseg.ds_addr); + MPRINTF("bus_dmamem_free", sc->sc_dseg.ds_addr); fail_1: bus_dmamap_destroy(sc->sc_dmat, sc->sc_ddmamap); - //MPRINTF_OLD("bus_dmamap_destroy", sc->sc_ddmamap); + MPRINTF("bus_dmamap_destroy", sc->sc_ddmamap); fail_0: return error; } @@ -1281,12 +1285,12 @@ fwohci_desc_free(struct fwohci_softc *sc) bus_dmamap_unload(sc->sc_dmat, sc->sc_ddmamap); bus_dmamem_unmap(sc->sc_dmat, (caddr_t)sc->sc_desc, dsize); bus_dmamem_free(sc->sc_dmat, &sc->sc_dseg, sc->sc_dnseg); - //MPRINTF_OLD("bus_dmamem_free", sc->sc_dseg.ds_addr); + MPRINTF("bus_dmamem_free", sc->sc_dseg.ds_addr); bus_dmamap_destroy(sc->sc_dmat, sc->sc_ddmamap); - //MPRINTF_OLD("bus_dmamap_destroy", sc->sc_ddmamap); + MPRINTF("bus_dmamap_destroy", sc->sc_ddmamap); free(sc->sc_descmap, M_DEVBUF); - //MPRINTF_OLD("free(DEVBUF)", sc->sc_descmap); + MPRINTF("free(DEVBUF)", sc->sc_descmap); sc->sc_descmap = NULL; /* XXX */ } @@ -1345,10 +1349,10 @@ fwohci_ctx_alloc(struct fwohci_softc *sc, struct fwohci_ctx **fcp, #ifdef M_ZERO MALLOC(fc, struct fwohci_ctx *, sizeof(*fc), M_DEVBUF, M_WAITOK|M_ZERO); - //MPRINTF_OLD("MALLOC(DEVBUF)", fc); + MPRINTF("MALLOC(DEVBUF)", fc); #else MALLOC(fc, struct fwohci_ctx *, sizeof(*fc), M_DEVBUF, M_WAITOK); - //MPRINTF_OLD("MALLOC(DEVBUF)", fc); + MPRINTF("MALLOC(DEVBUF)", fc); bzero(fc, sizeof(*fc)); #endif LIST_INIT(&fc->fc_handler); @@ -1357,10 +1361,10 @@ fwohci_ctx_alloc(struct fwohci_softc *sc, struct fwohci_ctx **fcp, #ifdef M_ZERO fc->fc_buffers = fb = malloc(sizeof(*fb) * bufcnt, M_DEVBUF, M_WAITOK|M_ZERO); - //MPRINTF_OLD("malloc(DEVBUF)", fc->fc_buffers); + MPRINTF("malloc(DEVBUF)", fc->fc_buffers); #else fc->fc_buffers = fb = malloc(sizeof(*fb) * bufcnt, M_DEVBUF, M_WAITOK); - //MPRINTF_OLD("malloc(DEVBUF)", fc->fc_buffers); + MPRINTF("malloc(DEVBUF)", fc->fc_buffers); bzero(fb, sizeof(*fb) * bufcnt); #endif fc->fc_bufcnt = bufcnt; @@ -1438,7 +1442,7 @@ fwohci_ctx_alloc(struct fwohci_softc *sc, struct fwohci_ctx **fcp, fwohci_buf_free(sc, fb); } FREE(fc, M_DEVBUF); - //MPRINTF_OLD("FREE(DEVBUF)", fc); + MPRINTF("FREE(DEVBUF)", fc); fc = NULL; /* XXX */ return error; } @@ -1477,10 +1481,10 @@ fwohci_ctx_free(struct fwohci_softc *sc, struct fwohci_ctx *fc) } #endif /* DOUBLEBUF */ free(fc->fc_buffers, M_DEVBUF); - //MPRINTF_OLD("free(DEVBUF)", fc->fc_buffers); + MPRINTF("free(DEVBUF)", fc->fc_buffers); fc->fc_buffers = NULL; /* XXX */ FREE(fc, M_DEVBUF); - //MPRINTF_OLD("FREE(DEVBUF)", fc); + MPRINTF("FREE(DEVBUF)", fc); fc = NULL; /* XXX */ } @@ -1570,7 +1574,7 @@ fwohci_buf_alloc(struct fwohci_softc *sc, struct fwohci_buf *fb) error); goto fail_0; } - //MPRINTF_OLD("bus_dmamap_create", fb->fb_dmamap); + MPRINTF("bus_dmamap_create", fb->fb_dmamap); if ((error = bus_dmamem_alloc(sc->sc_dmat, PAGE_SIZE, PAGE_SIZE, PAGE_SIZE, &fb->fb_seg, 1, &fb->fb_nseg, BUS_DMA_WAITOK)) != 0) { @@ -1578,7 +1582,7 @@ fwohci_buf_alloc(struct fwohci_softc *sc, struct fwohci_buf *fb) sc->sc_sc1394.sc1394_dev.dv_xname, error); goto fail_1; } - //MPRINTF_OLD("bus_dmamem_alloc", fb->fb_seg.ds_addr); + MPRINTF("bus_dmamem_alloc", fb->fb_seg.ds_addr); if ((error = bus_dmamem_map(sc->sc_dmat, &fb->fb_seg, fb->fb_nseg, PAGE_SIZE, &fb->fb_buf, @@ -1608,10 +1612,10 @@ fwohci_buf_alloc(struct fwohci_softc *sc, struct fwohci_buf *fb) bus_dmamem_unmap(sc->sc_dmat, fb->fb_buf, PAGE_SIZE); fail_2: bus_dmamem_free(sc->sc_dmat, &fb->fb_seg, fb->fb_nseg); - //MPRINTF_OLD("bus_dmamem_free", fb->fb_seg.ds_addr); + MPRINTF("bus_dmamem_free", fb->fb_seg.ds_addr); fail_1: bus_dmamap_destroy(sc->sc_dmat, fb->fb_dmamap); - //MPRINTF_OLD("bus_dmamap_destroy", fb->fb_dmamap); + MPRINTF("bus_dmamap_destroy", fb->fb_dmamap); fail_0: return error; } @@ -1623,9 +1627,9 @@ fwohci_buf_free(struct fwohci_softc *sc, struct fwohci_buf *fb) bus_dmamap_unload(sc->sc_dmat, fb->fb_dmamap); bus_dmamem_unmap(sc->sc_dmat, fb->fb_buf, PAGE_SIZE); bus_dmamem_free(sc->sc_dmat, &fb->fb_seg, fb->fb_nseg); - //MPRINTF_OLD("bus_dmamem_free", fb->fb_seg.ds_addr); + MPRINTF("bus_dmamem_free", fb->fb_seg.ds_addr); bus_dmamap_destroy(sc->sc_dmat, fb->fb_dmamap); - //MPRINTF_OLD("bus_dmamap_destroy", fb->fb_dmamap); + MPRINTF("bus_dmamap_destroy", fb->fb_dmamap); } void @@ -2075,7 +2079,7 @@ fwohci_handler_set(struct fwohci_softc *sc, int tcode, u_int32_t key1, if (fh != NULL) { LIST_REMOVE(fh, fh_list); FREE(fh, M_DEVBUF); - //MPRINTF_OLD("FREE(DEVBUF)", fh); + MPRINTF("FREE(DEVBUF)", fh); fh = NULL; /* XXX */ } if (tcode == IEEE1394_TCODE_ISOCHRONOUS_DATABLOCK) { @@ -2090,7 +2094,7 @@ fwohci_handler_set(struct fwohci_softc *sc, int tcode, u_int32_t key1, if (fh == NULL) { MALLOC(fh, struct fwohci_handler *, sizeof(*fh), M_DEVBUF, M_WAITOK); - //MPRINTF_OLD("MALLOC(DEVBUF)", fh); + MPRINTF("MALLOC(DEVBUF)", fh); bzero(fh, sizeof(*fh)); } fh->fh_tcode = tcode; @@ -2228,7 +2232,7 @@ fwohci_arrs_input(struct fwohci_softc *sc, struct fwohci_ctx *fc) (*fh->fh_handler)(sc, fh->fh_handarg, &pkt); LIST_REMOVE(fh, fh_list); FREE(fh, M_DEVBUF); - //MPRINTF_OLD("FREE(DEVBUF)", fh); + MPRINTF("FREE(DEVBUF)", fh); fh = NULL; /* XXX */ break; } @@ -2388,7 +2392,7 @@ fwohci_at_output(struct fwohci_softc *sc, struct fwohci_ctx *fc, for (off = 0; off < pkt->fp_dlen; off += len) { if (m0 == NULL) { MGETHDR(m0, M_DONTWAIT, MT_DATA); - //MPRINTF_OLD("MGETHDR", m0); + MPRINTF("MGETHDR", m0); if (m0 != NULL) { #ifdef __NetBSD__ M_COPY_PKTHDR(m0, pkt->fp_m); @@ -2399,14 +2403,14 @@ fwohci_at_output(struct fwohci_softc *sc, struct fwohci_ctx *fc, m = m0; } else { MGET(m->m_next, M_DONTWAIT, MT_DATA); - //MPRINTF_OLD("MGET", m->m_next); + MPRINTF("MGET", m->m_next); m = m->m_next; } if (m != NULL) MCLGET(m, M_DONTWAIT); if (m == NULL || (m->m_flags & M_EXT) == 0) { m_freem(m0); - //MPRINTF_OLD("m_freem", m0); + MPRINTF("m_freem", m0); return ENOMEM; } len = pkt->fp_dlen - off; @@ -2418,7 +2422,7 @@ fwohci_at_output(struct fwohci_softc *sc, struct fwohci_ctx *fc, ndesc++; } m_freem(pkt->fp_m); - //MPRINTF_OLD("m_freem", pkt->fp_m); + MPRINTF("m_freem", pkt->fp_m); pkt->fp_m = m0; } } else @@ -2431,12 +2435,12 @@ fwohci_at_output(struct fwohci_softc *sc, struct fwohci_ctx *fc, return ENOBUFS; fb = malloc(sizeof(*fb), M_DEVBUF, M_WAITOK); - //MPRINTF_OLD("malloc(DEVBUF)", fb); + MPRINTF("malloc(DEVBUF)", fb); fb->fb_nseg = ndesc; fb->fb_desc = fwohci_desc_get(sc, ndesc); if (fb->fb_desc == NULL) { free(fb, M_DEVBUF); - //MPRINTF_OLD("free(DEVBUF)", fb); + MPRINTF("free(DEVBUF)", fb); fb = NULL; /* XXX */ return ENOBUFS; } @@ -2452,11 +2456,11 @@ fwohci_at_output(struct fwohci_softc *sc, struct fwohci_ctx *fc, PAGE_SIZE, 0, BUS_DMA_WAITOK, &fb->fb_dmamap)) != 0) { fwohci_desc_put(sc, fb->fb_desc, ndesc); free(fb, M_DEVBUF); - //MPRINTF_OLD("free(DEVBUF)", fb); + MPRINTF("free(DEVBUF)", fb); fb = NULL; /* XXX */ return error; } - //MPRINTF_OLD("bus_dmamap_create", fb->fb_dmamap); + MPRINTF("bus_dmamap_create", fb->fb_dmamap); if (pkt->fp_m != NULL) error = bus_dmamap_load_mbuf(sc->sc_dmat, fb->fb_dmamap, @@ -2466,10 +2470,10 @@ fwohci_at_output(struct fwohci_softc *sc, struct fwohci_ctx *fc, &pkt->fp_uio, BUS_DMA_WAITOK); if (error != 0) { bus_dmamap_destroy(sc->sc_dmat, fb->fb_dmamap); - //MPRINTF_OLD("bus_dmamap_destroy", fb->fb_dmamap); + MPRINTF("bus_dmamap_destroy", fb->fb_dmamap); fwohci_desc_put(sc, fb->fb_desc, ndesc); free(fb, M_DEVBUF); - //MPRINTF_OLD("free(DEVBUF)", fb); + MPRINTF("free(DEVBUF)", fb); fb = NULL; /* XXX */ return error; } @@ -2603,7 +2607,7 @@ fwohci_at_done(struct fwohci_softc *sc, struct fwohci_ctx *fc, int force) fwohci_desc_put(sc, fb->fb_desc, fb->fb_nseg); if (fb->fb_nseg > 2) { bus_dmamap_destroy(sc->sc_dmat, fb->fb_dmamap); - //MPRINTF_OLD("bus_dmamap_destroy", fb->fb_dmamap); + MPRINTF("bus_dmamap_destroy", fb->fb_dmamap); } fc->fc_bufcnt--; if (fb->fb_callback) { @@ -2611,10 +2615,10 @@ fwohci_at_done(struct fwohci_softc *sc, struct fwohci_ctx *fc, int force) fb->fb_callback = NULL; } else if (fb->fb_m != NULL) { m_freem(fb->fb_m); - //MPRINTF_OLD("m_freem", fb->fb_m); + MPRINTF("m_freem", fb->fb_m); } free(fb, M_DEVBUF); - //MPRINTF_OLD("free(DEVBUF)", fb); + MPRINTF("free(DEVBUF)", fb); fb = NULL; /* XXX */ } } @@ -3164,17 +3168,17 @@ fwohci_uid_collect(struct fwohci_softc *sc) if (sc->sc_uidtbl != NULL) { free(sc->sc_uidtbl, M_DEVBUF); - //MPRINTF_OLD("free(DEVBUF)", sc->sc_uidtbl); + MPRINTF("free(DEVBUF)", sc->sc_uidtbl); sc->sc_uidtbl = NULL; /* XXX */ } #ifdef M_ZERO sc->sc_uidtbl = malloc(sizeof(*fu) * (sc->sc_rootid + 1), M_DEVBUF, M_NOWAIT|M_ZERO); /* XXX M_WAITOK requires locks. */ - //MPRINTF_OLD("malloc(DEVBUF)", sc->sc_uidtbl); + MPRINTF("malloc(DEVBUF)", sc->sc_uidtbl); #else sc->sc_uidtbl = malloc(sizeof(*fu) * (sc->sc_rootid + 1), M_DEVBUF, M_NOWAIT); /* XXX M_WAITOK requires locks. */ - //MPRINTF_OLD("malloc(DEVBUF)", sc->sc_uidtbl); + MPRINTF("malloc(DEVBUF)", sc->sc_uidtbl); #endif if (sc->sc_uidtbl == NULL) return; @@ -3420,7 +3424,7 @@ fwohci_if_input(struct fwohci_softc *sc, void *arg, struct fwohci_pkt *pkt) MCLGET(m, M_DONTWAIT); if ((m->m_flags & M_EXT) == 0) { m_freem(m); - //MPRINTF_OLD("m_freem", m); + MPRINTF("m_freem", m); return IEEE1394_RCODE_COMPLETE; } } @@ -3430,7 +3434,7 @@ fwohci_if_input(struct fwohci_softc *sc, void *arg, struct fwohci_pkt *pkt) printf("%s: packet from unknown node: phy id %d\n", sc->sc_sc1394.sc1394_dev.dv_xname, n); m_freem(m); - //MPRINTF_OLD("m_freem", m); + MPRINTF("m_freem", m); fwohci_uid_req(sc, n); return IEEE1394_RCODE_COMPLETE; } @@ -3517,7 +3521,7 @@ fwohci_if_input_iso(struct fwohci_softc *sc, void *arg, struct fwohci_pkt *pkt) MCLGET(m, M_DONTWAIT); if ((m->m_flags & M_EXT) == 0) { m_freem(m); - //MPRINTF_OLD("m_freem", m); + MPRINTF("m_freem", m); return IEEE1394_RCODE_COMPLETE; } } @@ -3531,7 +3535,7 @@ fwohci_if_input_iso(struct fwohci_softc *sc, void *arg, struct fwohci_pkt *pkt) printf("%s: packet from unknown node: phy id %d\n", sc->sc_sc1394.sc1394_dev.dv_xname, n); m_freem(m); - //MPRINTF_OLD("m_freem", m); + MPRINTF("m_freem", m); return IEEE1394_RCODE_COMPLETE; } bcopy(sc->sc_uidtbl[n].fu_uid, mtod(m, caddr_t), 8); @@ -3695,7 +3699,7 @@ fwohci_if_output(struct device *self, struct mbuf *m0, (*callback)(sc->sc_sc1394.sc1394_if, m0); } else { m_freem(m0); - //MPRINTF_OLD("m_freem", m0); + MPRINTF("m_freem", m0); } } return error; @@ -3765,7 +3769,7 @@ fwohci_read(struct ieee1394_abuf *ab) return -1; MALLOC(fcb, struct fwohci_cb *, sizeof(*fcb), M_DEVBUF, M_WAITOK); - //MPRINTF_OLD("MALLOC(DEVBUF)", fcb); + MPRINTF("MALLOC(DEVBUF)", fcb); fcb->ab = ab; fcb->count = 0; fcb->abuf_valid = 1; @@ -3931,7 +3935,7 @@ fwohci_read_resp(struct fwohci_softc *sc, void *arg, struct fwohci_pkt *pkt) if (fcb->abuf_valid == 0) { if (fcb->count == 0) { FREE(fcb, M_DEVBUF); - //MPRINTF_OLD("FREE(DEVBUF)", fcb); + MPRINTF("FREE(DEVBUF)", fcb); fcb = NULL; /* XXX */ } return IEEE1394_RCODE_COMPLETE; @@ -4051,7 +4055,7 @@ fwohci_read_resp(struct fwohci_softc *sc, void *arg, struct fwohci_pkt *pkt) fcb->abuf_valid = 0; if (fcb->count == 0) { FREE(fcb, M_DEVBUF); - //MPRINTF_OLD("FREE(DEVBUF)", fcb); + MPRINTF("FREE(DEVBUF)", fcb); fcb = NULL; } return IEEE1394_RCODE_COMPLETE; @@ -4145,7 +4149,7 @@ fwohci_read_multi_resp(struct fwohci_softc *sc, void *arg, fcb->abuf_valid = 0; if (fcb->count == 0) { FREE(fcb, M_DEVBUF); - //MPRINTF_OLD("FREE(DEVBUF)", fcb); + MPRINTF("FREE(DEVBUF)", fcb); fcb = NULL; } return IEEE1394_RCODE_COMPLETE; @@ -4170,11 +4174,11 @@ fwohci_write_ack(struct fwohci_softc *sc, void *arg, struct fwohci_pkt *pkt) else { if (ab->ab_data) { free(ab->ab_data, M_1394DATA); - //MPRINTF_OLD("free(1394DATA)", ab->ab_data); + MPRINTF("free(1394DATA)", ab->ab_data); ab->ab_data = NULL; /* XXX */ } FREE(ab, M_1394DATA); - //MPRINTF_OLD("FREE(1394DATA)", ab); + MPRINTF("FREE(1394DATA)", ab); ab = NULL; /* XXX */ } return IEEE1394_RCODE_COMPLETE; @@ -4307,7 +4311,7 @@ fwohci_parse_input(struct fwohci_softc *sc, void *arg, struct fwohci_pkt *pkt) if ((caddr_t)ab->ab_data > (caddr_t)1) { free(ab->ab_data, M_1394DATA); - //MPRINTF_OLD("free(1394DATA)", ab->ab_data); + MPRINTF("free(1394DATA)", ab->ab_data); ab->ab_data = NULL; } break; @@ -4333,11 +4337,11 @@ fwohci_parse_input(struct fwohci_softc *sc, void *arg, struct fwohci_pkt *pkt) if ((caddr_t)ab->ab_data > (caddr_t)1) { free(ab->ab_data, M_1394DATA); - //MPRINTF_OLD("free(1394DATA)", ab->ab_data); + MPRINTF("free(1394DATA)", ab->ab_data); ab->ab_data = NULL; } ab->ab_data = malloc(ab->ab_retlen, M_1394DATA, M_WAITOK); - //MPRINTF_OLD("malloc(1394DATA)", ab->ab_data); + MPRINTF("malloc(1394DATA)", ab->ab_data); if (ab->ab_tcode == IEEE1394_TCODE_WRITE_REQUEST_QUADLET) ab->ab_data[0] = pkt->fp_hdr[3]; @@ -4406,7 +4410,7 @@ fwohci_detach(struct fwohci_softc *sc, int flags) tsleep(sc->sc_dying, PZERO, "detach", 3 * hz); DPRINTF(("%s: woken up...\n", __func__)); FREE(sc->sc_dying, M_DEVBUF); - //MPRINTF_OLD("FREE(DEVBUF)", sc->sc_dying); + MPRINTF("FREE(DEVBUF)", sc->sc_dying); sc->sc_dying = NULL; /* XXX */ if (sc->sc_sc1394.sc1394_if != NULL) { diff --git a/sys/dev/ieee1394/fwscsi.c b/sys/dev/ieee1394/fwscsi.c index 00328086ba5..5c254efe150 100644 --- a/sys/dev/ieee1394/fwscsi.c +++ b/sys/dev/ieee1394/fwscsi.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fwscsi.c,v 1.1 2002/12/13 02:57:50 tdeval Exp $ */ +/* $OpenBSD: fwscsi.c,v 1.2 2002/12/13 21:35:11 tdeval Exp $ */ /* * Copyright (c) 2002 Thierry Deval. All rights reserved. @@ -60,12 +60,6 @@ #include <dev/ieee1394/fwnodevar.h> #include <dev/ieee1394/fwnodereg.h> -#ifdef MALLOC_DEBUG -#include <dev/ieee1394/malloc_debug.h> /* MPRINTF(x,y) */ -#else /* !MALLOC_DEBUG */ -#define MPRINTF(x,y) -#endif /* MALLOC_DEBUG */ - #ifdef FWSCSI_DEBUG #include <sys/syslog.h> extern int log_open; @@ -78,11 +72,18 @@ int fwscsi_oldlog; fwscsi_oldlog = log_open; log_open = 1; \ addlog x; log_open = fwscsi_oldlog; \ } while (0) +#ifdef FW_MALLOC_DEBUG +#define MPRINTF(x,y) DPRINTF(("%s[%d]: %s 0x%08x\n", \ + __func__, __LINE__, (x), (u_int32_t)(y))) +#else /* !FW_MALLOC_DEBUG */ +#define MPRINTF(x,y) +#endif /* FW_MALLOC_DEBUG */ int fwscsidebug = 0; #else /* FWSCSI_DEBUG */ #define DPRINTF(x) #define DPRINTFN(n,x) -#endif /* ! FWSCSI_DEBUG */ +#define MPRINTF(x,y) +#endif /* !FWSCSI_DEBUG */ #ifdef __NetBSD__ int fwscsi_match(struct device *, struct cfdata *, void *); @@ -224,13 +225,13 @@ fwscsi_match(struct device *parent, void *match, void *aux) if (!key || key[0]->val != SBP2_UNIT_SPEC_ID) { if (key != NULL) { free(key, M_DEVBUF); - //MPRINTF_OLD("free(DEVBUF)", key); + MPRINTF("free(DEVBUF)", key); key = NULL; /* XXX */ } return 0; } free(key, M_DEVBUF); - //MPRINTF_OLD("free(DEVBUF)", key); + MPRINTF("free(DEVBUF)", key); key = NULL; /* XXX */ key = p1212_find(*udirs, P1212_KEYTYPE_Immediate, @@ -238,13 +239,13 @@ fwscsi_match(struct device *parent, void *match, void *aux) if (!key || key[0]->val != SBP2_UNIT_SW_VERSION) { if (key != NULL) { free(key, M_DEVBUF); - //MPRINTF_OLD("free(DEVBUF)", key); + MPRINTF("free(DEVBUF)", key); key = NULL; /* XXX */ } return 0; } free(key, M_DEVBUF); - //MPRINTF_OLD("free(DEVBUF)", key); + MPRINTF("free(DEVBUF)", key); key = NULL; /* XXX */ key = p1212_find(*udirs, P1212_KEYTYPE_Immediate, @@ -252,13 +253,13 @@ fwscsi_match(struct device *parent, void *match, void *aux) if (!key || key[0]->val != 0x00609E) { if (key != NULL) { free(key, M_DEVBUF); - //MPRINTF_OLD("free(DEVBUF)", key); + MPRINTF("free(DEVBUF)", key); key = NULL; /* XXX */ } return 0; } free(key, M_DEVBUF); - //MPRINTF_OLD("free(DEVBUF)", key); + MPRINTF("free(DEVBUF)", key); key = NULL; /* XXX */ key = p1212_find(*udirs, P1212_KEYTYPE_Immediate, @@ -266,13 +267,13 @@ fwscsi_match(struct device *parent, void *match, void *aux) if (!key || key[0]->val != 0x0104D8) { if (key != NULL) { free(key, M_DEVBUF); - //MPRINTF_OLD("free(DEVBUF)", key); + MPRINTF("free(DEVBUF)", key); key = NULL; /* XXX */ } return 0; } free(key, M_DEVBUF); - //MPRINTF_OLD("free(DEVBUF)", key); + MPRINTF("free(DEVBUF)", key); key = NULL; /* XXX */ return 1; @@ -329,7 +330,7 @@ fwscsi_attach(struct device *parent, struct device *self, void *aux) while (udir[n++]) {}; sc->sc_unitdir = malloc(n * sizeof(*sc->sc_unitdir), M_DEVBUF, M_WAITOK); - //MPRINTF_OLD("malloc(DEVBUF)", sc->sc_unitdir); + MPRINTF("malloc(DEVBUF)", sc->sc_unitdir); bcopy(udir, sc->sc_unitdir, n * sizeof(*sc->sc_unitdir)); sc->sc_speed = psc->sc1394_link_speed; @@ -373,7 +374,7 @@ fwscsi_init(void *aux) #endif /* FWSCSI_DEBUG */ login_orb = malloc(sizeof(struct sbp2_login_orb), M_1394DATA, M_WAITOK); - //MPRINTF_OLD("malloc(1394DATA)", login_orb); + MPRINTF("malloc(1394DATA)", login_orb); bzero(login_orb, sizeof(struct sbp2_login_orb)); login_orb->lun = htons(sc->sc_lun); @@ -409,7 +410,7 @@ fwscsi_login_cb(void *arg, struct sbp2_status_notification *notification) if (login_orb != NULL) { free(login_orb, M_1394DATA); - //MPRINTF_OLD("free(1394DATA)", login_orb); + MPRINTF("free(1394DATA)", login_orb); login_orb = NULL; /* XXX */ } @@ -454,7 +455,7 @@ fwscsi_config_thread(void *arg) if (error == EWOULDBLOCK) { DPRINTF(("%s: SBP Login failure\n", __func__)); free(login_orb, M_1394DATA); - //MPRINTF_OLD("free(1394DATA)", login_orb); + MPRINTF("free(1394DATA)", login_orb); login_orb = NULL; /* XXX */ kthread_exit(1); } @@ -463,12 +464,12 @@ fwscsi_config_thread(void *arg) status = ((struct sbp2_status_block **)login_orb)[0]; if (status != NULL) { free(status, M_1394DATA); - //MPRINTF_OLD("free(1394DATA)", status); + MPRINTF("free(1394DATA)", status); status = NULL; /* XXX */ } #endif free(login_orb, M_1394DATA); - //MPRINTF_OLD("free(1394DATA)", login_orb); + MPRINTF("free(1394DATA)", login_orb); login_orb = NULL; /* XXX */ TAILQ_INIT(&sc->sc_data); @@ -529,7 +530,7 @@ fwscsi_detach(struct device *self, int flags) } sbp2_clean(sc->sc_fwnode, *sc->sc_unitdir, 0); free(sc->sc_unitdir, M_DEVBUF); - //MPRINTF_OLD("free(DEVBUF)", sc->sc_unitdir); + MPRINTF("free(DEVBUF)", sc->sc_unitdir); sc->sc_unitdir = NULL; /* XXX */ return (rv); @@ -648,7 +649,7 @@ fwscsi_scsi_cmd(struct scsi_xfer *xs) splx(s); return (TRY_AGAIN_LATER); } - //MPRINTF_OLD("malloc(1394DATA)", cmd_orb); + MPRINTF("malloc(1394DATA)", cmd_orb); bzero(cmd_orb, sizeof(struct sbp2_command_orb) + 8); options = 0x8000 | ((fwsc->sc_sc1394.sc1394_link_speed & 0x7) << 8); @@ -673,14 +674,14 @@ fwscsi_scsi_cmd(struct scsi_xfer *xs) MALLOC(data_elm, struct fwscsi_orb_data *, sizeof(*data_elm), M_1394CTL, M_NOWAIT); - //MPRINTF_OLD("MALLOC(1394CTL)", data_elm); + MPRINTF("MALLOC(1394CTL)", data_elm); if (data_elm == NULL) { printf("%s: can't alloc data_elm for target %d lun" " %d\n", sc->sc_dev.dv_xname, xs->sc_link->target, xs->sc_link->lun); xs->error = XS_DRIVER_STUFFUP; free(cmd_orb, M_1394DATA); - //MPRINTF_OLD("free(1394DATA)", cmd_orb); + MPRINTF("free(1394DATA)", cmd_orb); splx(s); return (TRY_AGAIN_LATER); } @@ -692,16 +693,16 @@ fwscsi_scsi_cmd(struct scsi_xfer *xs) MALLOC(data_ab, struct ieee1394_abuf *, sizeof(*data_ab), M_1394DATA, M_NOWAIT); - //MPRINTF_OLD("MALLOC(1394DATA)", data_ab); + MPRINTF("MALLOC(1394DATA)", data_ab); if (data_ab == NULL) { printf("%s: can't alloc data_ab for target %d lun" " %d\n", sc->sc_dev.dv_xname, xs->sc_link->target, xs->sc_link->lun); xs->error = XS_DRIVER_STUFFUP; free(data_elm, M_1394CTL); - //MPRINTF_OLD("FREE(1394CTL)", data_elm); + MPRINTF("FREE(1394CTL)", data_elm); free(cmd_orb, M_1394DATA); - //MPRINTF_OLD("free(1394DATA)", cmd_orb); + MPRINTF("free(1394DATA)", cmd_orb); splx(s); return (TRY_AGAIN_LATER); } @@ -872,11 +873,11 @@ fwscsi_command_wait(void *aux, struct sbp2_status_notification *notification) sc->sc_fwnode->sc1394_unreg(data_ab, TRUE); if ((void *)data_ab->ab_data > (void *)1) { /* XXX */ free(data_ab->ab_data, M_1394DATA); - //MPRINTF_OLD("free(1394DATA)", data_ab->ab_data); + MPRINTF("free(1394DATA)", data_ab->ab_data); data_ab->ab_data = NULL; /* XXX */ } FREE(data_ab, M_1394DATA); - //MPRINTF_OLD("FREE(1394DATA)", data_ab); + MPRINTF("FREE(1394DATA)", data_ab); data_ab = NULL; /* XXX */ } @@ -885,7 +886,7 @@ fwscsi_command_wait(void *aux, struct sbp2_status_notification *notification) TAILQ_REMOVE(&sc->sc_data, data_elm, data_chain); splx(s); FREE(data_elm, M_1394CTL); - //MPRINTF_OLD("FREE(1394CTL)", data_elm); + MPRINTF("FREE(1394CTL)", data_elm); data_elm = NULL; /* XXX */ } @@ -950,11 +951,11 @@ fwscsi_command_wait(void *aux, struct sbp2_status_notification *notification) } FREE(status, M_1394DATA); - //MPRINTF_OLD("FREE(1394DATA)", status); + MPRINTF("FREE(1394DATA)", status); status = NULL; /* XXX */ sbp2_command_del(sc->sc_fwnode, sc->sc_lun, cmd_orb); free(cmd_orb, M_1394DATA); - //MPRINTF_OLD("free(1394DATA)", cmd_orb); + MPRINTF("free(1394DATA)", cmd_orb); cmd_orb = NULL; /* XXX */ s = splbio(); @@ -992,7 +993,7 @@ fwscsi_command_wait(void *aux, struct sbp2_status_notification *notification) DPRINTF(("%s: Free status(0x%08x)\n", __func__, (u_int32_t)status)); FREE(status, M_1394DATA); - //MPRINTF_OLD("FREE(1394DATA)", status); + MPRINTF("FREE(1394DATA)", status); status = NULL; /* XXX */ } if (cmd_orb != NULL) { @@ -1001,7 +1002,7 @@ fwscsi_command_wait(void *aux, struct sbp2_status_notification *notification) cmd_orb->options = htons(SBP2_DUMMY_TYPE); sbp2_command_del(sc->sc_fwnode, sc->sc_lun, cmd_orb); free(cmd_orb, M_1394DATA); - //MPRINTF_OLD("free(1394DATA)", cmd_orb); + MPRINTF("free(1394DATA)", cmd_orb); cmd_orb = NULL; /* XXX */ } @@ -1037,7 +1038,7 @@ fwscsi_command_data(struct ieee1394_abuf *ab, int rcode) #endif /* FWSCSI_DEBUG */ if ((void *)ab->ab_data > (void *)1) { /* XXX */ free(ab->ab_data, M_1394DATA); - //MPRINTF_OLD("free(1394DATA)", ab->ab_data); + MPRINTF("free(1394DATA)", ab->ab_data); ab->ab_data = NULL; } return; @@ -1059,7 +1060,7 @@ fwscsi_command_data(struct ieee1394_abuf *ab, int rcode) #endif /* FWSCSI_DEBUG */ if ((void *)ab->ab_data > (void *)1) { /* XXX */ free(ab->ab_data, M_1394DATA); - //MPRINTF_OLD("free(1394DATA)", ab->ab_data); + MPRINTF("free(1394DATA)", ab->ab_data); ab->ab_data = NULL; } return; @@ -1076,11 +1077,11 @@ fwscsi_command_data(struct ieee1394_abuf *ab, int rcode) MALLOC(data_ab, struct ieee1394_abuf *, sizeof(*data_ab), M_1394DATA, M_WAITOK); - //MPRINTF_OLD("MALLOC(1394DATA)", data_ab); + MPRINTF("MALLOC(1394DATA)", data_ab); bcopy(ab, data_ab, sizeof(*data_ab)); data_ab->ab_data = malloc(datalen, M_1394DATA, M_WAITOK); - //MPRINTF_OLD("malloc(1394DATA)", data_ab->ab_data); + MPRINTF("malloc(1394DATA)", data_ab->ab_data); bzero(data_ab->ab_data, datalen); bcopy(dataptr, data_ab->ab_data, MIN(data_elm->data_len, datalen)); diff --git a/sys/dev/std/ieee1212.c b/sys/dev/std/ieee1212.c index b0872ce1fc4..b238e5582f2 100644 --- a/sys/dev/std/ieee1212.c +++ b/sys/dev/std/ieee1212.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ieee1212.c,v 1.3 2002/12/13 02:52:11 tdeval Exp $ */ +/* $OpenBSD: ieee1212.c,v 1.4 2002/12/13 21:35:11 tdeval Exp $ */ /* $NetBSD: ieee1212.c,v 1.3 2002/05/23 00:10:46 jmc Exp $ */ /* @@ -74,8 +74,12 @@ int p1212_oldlog; p1212_oldlog = log_open; log_open = 1; \ addlog x; log_open = p1212_oldlog; \ } while (0) +#ifdef FW_MALLOC_DEBUG #define MPRINTF(x,y) DPRINTF(("%s[%d]: %s 0x%08x\n", \ __func__, __LINE__, (x), (u_int32_t)(y))) +#else /* !FW_MALLOC_DEBUG */ +#define MPRINTF(x,y) +#endif /* FW_MALLOC_DEBUG */ int p1212debug = 0; #else /* P1212_DEBUG */ @@ -253,11 +257,11 @@ p1212_iscomplete(u_int32_t *t, u_int32_t *size) #else /* __NetBSD__ */ p = malloc(sizeof(int) * (numdirs + 1), M_DEVBUF, M_WAITOK); - //MPRINTF_OLD("malloc(DEVBUF)", p); + MPRINTF("malloc(DEVBUF)", p); if (dirs != NULL) { bcopy(dirs, p, sizeof(int) * numdirs); free(dirs, M_DEVBUF); - //MPRINTF_OLD("free(DEVBUF)", dirs); + MPRINTF("free(DEVBUF)", dirs); dirs = NULL; /* XXX */ } dirs = p; @@ -275,7 +279,7 @@ p1212_iscomplete(u_int32_t *t, u_int32_t *size) /* Cleanup. */ if (dirs) { free(dirs, M_DEVBUF); - //MPRINTF_OLD("free(DEVBUF)", dirs); + MPRINTF("free(DEVBUF)", dirs); dirs = NULL; /* XXX */ } break; @@ -289,15 +293,15 @@ p1212_iscomplete(u_int32_t *t, u_int32_t *size) #else /* __NetBSD__ */ p = malloc(sizeof(int) * numdirs, M_DEVBUF, M_WAITOK); - //MPRINTF_OLD("malloc(DEVBUF)", p); + MPRINTF("malloc(DEVBUF)", p); bcopy(dirs, p, sizeof(int) * numdirs); free(dirs, M_DEVBUF); - //MPRINTF_OLD("free(DEVBUF)", dirs); + MPRINTF("free(DEVBUF)", dirs); dirs = p; #endif /* ! __NetBSD__ */ } else { free(dirs, M_DEVBUF); - //MPRINTF_OLD("free(DEVBUF)", dirs); + MPRINTF("free(DEVBUF)", dirs); dirs = NULL; } } else @@ -359,14 +363,14 @@ p1212_parse(u_int32_t *t, u_int32_t size, u_int32_t mask) /* Get the initial offset for the root dir. */ MALLOC(rom, struct p1212_rom *, sizeof(*rom), M_DEVBUF, M_WAITOK); - //MPRINTF_OLD("MALLOC(DEVBUF)", rom); + MPRINTF("MALLOC(DEVBUF)", rom); rom->len = P1212_ROMFMT_GET_INFOLEN((ntohl(t[0]))); next = rom->len + 1; if ((rom->len < 1) || (rom->len > size)) { DPRINTF(("Invalid ROM info length: %d\n", rom->len)); FREE(rom, M_DEVBUF); - //MPRINTF_OLD("FREE(DEVBUF)", rom); + MPRINTF("FREE(DEVBUF)", rom); rom = NULL; /* XXX */ return NULL; } @@ -377,7 +381,7 @@ p1212_parse(u_int32_t *t, u_int32_t size, u_int32_t mask) if (rom->len) { rom->data = malloc(sizeof(u_int32_t) * rom->len, M_DEVBUF, M_WAITOK); - //MPRINTF_OLD("malloc(DEVBUF)", rom->data); + MPRINTF("malloc(DEVBUF)", rom->data); /* Add 2 to account for info/crc and bus name skipped. */ for (i = 0; i < rom->len; i++) rom->data[i] = t[i + 2]; @@ -395,11 +399,11 @@ p1212_parse(u_int32_t *t, u_int32_t size, u_int32_t mask) #ifdef M_ZERO MALLOC(rom->root, struct p1212_dir *, sizeof(*rom->root), M_DEVBUF, M_WAITOK|M_ZERO); - //MPRINTF_OLD("MALLOC(DEVBUF)", rom->root); + MPRINTF("MALLOC(DEVBUF)", rom->root); #else /* M_ZERO */ MALLOC(rom->root, struct p1212_dir *, sizeof(*rom->root), M_DEVBUF, M_WAITOK); - //MPRINTF_OLD("MALLOC(DEVBUF)", rom->root); + MPRINTF("MALLOC(DEVBUF)", rom->root); bzero(rom->root, sizeof(*rom->root)); #endif /* ! M_ZERO */ rom->root->com.key.key_type = P1212_KEYTYPE_Directory; @@ -681,12 +685,12 @@ p1212_parse_directory(struct p1212_dir *root, u_int32_t *addr, u_int32_t mask) #else /* __NetBSD__ */ p = malloc(size * (com->textcnt + 1), M_DEVBUF, M_WAITOK); - //MPRINTF_OLD("malloc(DEVBUF)", p); + MPRINTF("malloc(DEVBUF)", p); if (com->text != NULL) { bcopy(com->text, p, size * com->textcnt); free(com->text, M_DEVBUF); - //MPRINTF_OLD("free(DEVBUF)", com->text); + MPRINTF("free(DEVBUF)", com->text); com->text = NULL; /* XXX */ } com->text = p; @@ -699,7 +703,7 @@ p1212_parse_directory(struct p1212_dir *root, u_int32_t *addr, u_int32_t mask) "offset 0x%0x\n", &t[leafoff]-&addr[0])); free(com->text, M_DEVBUF); - //MPRINTF_OLD("free(DEVBUF)", com->text); + MPRINTF("free(DEVBUF)", com->text); com->text = NULL; /* XXX */ return 1; } @@ -719,11 +723,11 @@ p1212_parse_directory(struct p1212_dir *root, u_int32_t *addr, u_int32_t mask) #ifdef M_ZERO MALLOC(data, struct p1212_data *, sizeof(*data), M_DEVBUF, M_WAITOK|M_ZERO); - //MPRINTF_OLD("MALLOC(DEVBUF)", data); + MPRINTF("MALLOC(DEVBUF)", data); #else /* M_ZERO */ MALLOC(data, struct p1212_data *, sizeof(*data), M_DEVBUF, M_WAITOK); - //MPRINTF_OLD("MALLOC(DEVBUF)", data); + MPRINTF("MALLOC(DEVBUF)", data); bzero(data, sizeof(struct p1212_data)); #endif /* ! M_ZERO */ data->com.key.key_type = type; @@ -763,11 +767,11 @@ p1212_parse_directory(struct p1212_dir *root, u_int32_t *addr, u_int32_t mask) #ifdef M_ZERO MALLOC(sdir, struct p1212_dir *, sizeof(*sdir), M_DEVBUF, M_WAITOK|M_ZERO); - //MPRINTF_OLD("MALLOC(DEVBUF)", sdir); + MPRINTF("MALLOC(DEVBUF)", sdir); #else /* M_ZERO */ MALLOC(sdir, struct p1212_dir *, sizeof(*sdir), M_DEVBUF, M_WAITOK); - //MPRINTF_OLD("MALLOC(DEVBUF)", sdir); + MPRINTF("MALLOC(DEVBUF)", sdir); bzero(sdir, sizeof(struct p1212_dir)); #endif /* ! M_ZERO */ sdir->parent = dir; @@ -867,10 +871,10 @@ p1212_parse_leaf(u_int32_t *t) MALLOC(leafdata, struct p1212_leafdata *, sizeof(*leafdata), M_DEVBUF, M_WAITOK); - //MPRINTF_OLD("MALLOC(DEVBUF)", leafdata); + MPRINTF("MALLOC(DEVBUF)", leafdata); leafdata->data = malloc((sizeof(u_int32_t) * crclen), M_DEVBUF, M_WAITOK); - //MPRINTF_OLD("malloc(DEVBUF)", leafdata->data); + MPRINTF("malloc(DEVBUF)", leafdata->data); leafdata->len = crclen; for (i = 0; i < crclen; i++) leafdata->data[i] = ntohl(t[i]); @@ -933,12 +937,12 @@ p1212_parse_textdir(struct p1212_com *com, u_int32_t *addr) M_DEVBUF, M_WAITOK); #else /* __NetBSD__ */ p = malloc(size * (com->textcnt + 1), M_DEVBUF, M_WAITOK); - //MPRINTF_OLD("malloc(DEVBUF)", p); + MPRINTF("malloc(DEVBUF)", p); bzero(&p[com->textcnt], size); if (com->text != NULL) { bcopy(com->text, p, size * (com->textcnt)); free(com->text, M_DEVBUF); - //MPRINTF_OLD("free(DEVBUF)", com->text); + MPRINTF("free(DEVBUF)", com->text); com->text = NULL; /* XXX */ } com->text = p; @@ -947,7 +951,7 @@ p1212_parse_textdir(struct p1212_com *com, u_int32_t *addr) DPRINTF(("Got an error parsing text descriptor.\n")); if (com->textcnt == 0) { free(com->text, M_DEVBUF); - //MPRINTF_OLD("free(DEVBUF)", com->text); + MPRINTF("free(DEVBUF)", com->text); com->text = NULL; /* XXX */ } return 1; @@ -993,7 +997,7 @@ p1212_parse_text_desc(u_int32_t *addr) t++; MALLOC(text, struct p1212_textdata *, sizeof(*text), M_DEVBUF, M_WAITOK); - //MPRINTF_OLD("MALLOC(DEVBUF)", text); + MPRINTF("MALLOC(DEVBUF)", text); text->spec_type = P1212_TEXT_GET_Spec_Type((ntohl(t[0]))); text->spec_id = P1212_TEXT_GET_Spec_Id((ntohl(t[0]))); text->lang_id = ntohl(t[1]); @@ -1005,10 +1009,10 @@ p1212_parse_text_desc(u_int32_t *addr) #ifdef M_ZERO text->text = malloc(size + 1, M_DEVBUF, M_WAITOK|M_ZERO); - //MPRINTF_OLD("malloc(DEVBUF)", text->text); + MPRINTF("malloc(DEVBUF)", text->text); #else /* M_ZERO */ text->text = malloc(size + 1, M_DEVBUF, M_WAITOK); - //MPRINTF_OLD("malloc(DEVBUF)", text->text); + MPRINTF("malloc(DEVBUF)", text->text); bzero(text->text, size + 1); #endif /* ! M_ZERO */ @@ -1073,12 +1077,12 @@ p1212_find(struct p1212_dir *root, int type, int value, int flags) #else /* __NetBSD__ */ p = malloc(sizeof(struct p1212_key *) * (numkeys + 1), M_DEVBUF, M_WAITOK); - //MPRINTF_OLD("malloc(DEVBUF)", p); + MPRINTF("malloc(DEVBUF)", p); if (retkeys != NULL) { bcopy(retkeys, p, numkeys * sizeof(struct p1212_key *)); free(retkeys, M_DEVBUF); - //MPRINTF_OLD("free(DEVBUF)", retkeys); + MPRINTF("free(DEVBUF)", retkeys); retkeys = NULL; /* XXX */ } retkeys = p; @@ -1106,12 +1110,12 @@ p1212_find(struct p1212_dir *root, int type, int value, int flags) #else /* __NetBSD__ */ p = malloc(sizeof(struct p1212_key *) * (numkeys + 1), M_DEVBUF, M_WAITOK); - //MPRINTF_OLD("malloc(DEVBUF)", p); + MPRINTF("malloc(DEVBUF)", p); if (retkeys != NULL) { bcopy(retkeys, p, numkeys * sizeof(struct p1212_key *)); free(retkeys, M_DEVBUF); - //MPRINTF_OLD("free(DEVBUF)", retkeys); + MPRINTF("free(DEVBUF)", retkeys); retkeys = NULL; /* XXX */ } retkeys = p; @@ -1333,29 +1337,29 @@ p1212_free(struct p1212_rom *rom) if (data->leafdata) { if (data->leafdata->data) { free(data->leafdata->data, M_DEVBUF); - //MPRINTF_OLD("free(DEVBUF)", data->leafdata->data); + MPRINTF("free(DEVBUF)", data->leafdata->data); data->leafdata->data = NULL; /* XXX */ } FREE(data->leafdata, M_DEVBUF); - //MPRINTF_OLD("FREE(DEVBUF)", data->leafdata); + MPRINTF("FREE(DEVBUF)", data->leafdata); data->leafdata = NULL; /* XXX */ } TAILQ_REMOVE(&dir->data_root, data, data); if (data->com.textcnt) { for (i = 0; i < data->com.textcnt; i++) { free(data->com.text[i]->text, M_DEVBUF); - //MPRINTF_OLD("free(DEVBUF)", data->com.text[i]->text); + MPRINTF("free(DEVBUF)", data->com.text[i]->text); data->com.text[i]->text = NULL; /* XXX */ FREE(data->com.text[i], M_DEVBUF); - //MPRINTF_OLD("FREE(DEVBUF)", data->com.text[i]); + MPRINTF("FREE(DEVBUF)", data->com.text[i]); data->com.text[i] = NULL; /* XXX */ } free(data->com.text, M_DEVBUF); - //MPRINTF_OLD("free(DEVBUF)", data->com.text); + MPRINTF("free(DEVBUF)", data->com.text); data->com.text = NULL; /* XXX */ } FREE(data, M_DEVBUF); - //MPRINTF_OLD("FREE(DEVBUF)", data); + MPRINTF("FREE(DEVBUF)", data); data = NULL; /* XXX */ } sdir = dir; @@ -1366,24 +1370,24 @@ p1212_free(struct p1212_rom *rom) if (sdir->com.textcnt) { for (i = 0; i < sdir->com.textcnt; i++) { FREE(sdir->com.text[i], M_DEVBUF); - //MPRINTF_OLD("FREE(DEVBUF)", sdir->com.text[i]); + MPRINTF("FREE(DEVBUF)", sdir->com.text[i]); sdir->com.text[i] = NULL; /* XXX */ } free(sdir->com.text, M_DEVBUF); - //MPRINTF_OLD("free(DEVBUF)", sdir->com.text); + MPRINTF("free(DEVBUF)", sdir->com.text); sdir->com.text = NULL; /* XXX */ } FREE(sdir, M_DEVBUF); - //MPRINTF_OLD("FREE(DEVBUF)", sdir); + MPRINTF("FREE(DEVBUF)", sdir); sdir = NULL; /* XXX */ } if (rom->len) { free(rom->data, M_DEVBUF); - //MPRINTF_OLD("free(DEVBUF)", rom->data); + MPRINTF("free(DEVBUF)", rom->data); rom->data = NULL; /* XXX */ } FREE(rom, M_DEVBUF); - //MPRINTF_OLD("FREE(DEVBUF)", rom); + MPRINTF("FREE(DEVBUF)", rom); rom = NULL; /* XXX */ } @@ -1459,7 +1463,7 @@ p1212_match_units(struct device *sc, struct p1212_dir *dir, numdev = 0; devret = malloc(sizeof(struct device *) * 2, M_DEVBUF, M_WAITOK); - //MPRINTF_OLD("malloc(DEVBUF)", devret); + MPRINTF("malloc(DEVBUF)", devret); devret[0] = devret[1] = NULL; udirs = (struct p1212_dir **)p1212_find(dir, P1212_KEYTYPE_Directory, @@ -1478,11 +1482,11 @@ p1212_match_units(struct device *sc, struct p1212_dir *dir, #else /* __NetBSD__ */ p = malloc(sizeof(struct device *) * (numdev + 2), M_DEVBUF, M_WAITOK); - //MPRINTF_OLD("malloc(DEVBUF)", p); + MPRINTF("malloc(DEVBUF)", p); bcopy(devret, p, numdev * sizeof(struct device *)); free(devret, M_DEVBUF); - //MPRINTF_OLD("free(DEVBUF)", devret); + MPRINTF("free(DEVBUF)", devret); devret = p; #endif /* ! __NetBSD__ */ devret[numdev++] = dev; @@ -1494,12 +1498,12 @@ p1212_match_units(struct device *sc, struct p1212_dir *dir, } while (udirs[++i]); free(udirs, M_DEVBUF); - //MPRINTF_OLD("free(DEVBUF)", udirs); + MPRINTF("free(DEVBUF)", udirs); udirs = NULL; /* XXX */ } if (numdev == 0) { free(devret, M_DEVBUF); - //MPRINTF_OLD("free(DEVBUF)", devret); + MPRINTF("free(DEVBUF)", devret); devret = NULL; /* XXX */ return NULL; } diff --git a/sys/dev/std/sbp2.c b/sys/dev/std/sbp2.c index 8c7e311cecc..8cd7242ac15 100644 --- a/sys/dev/std/sbp2.c +++ b/sys/dev/std/sbp2.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sbp2.c,v 1.1 2002/12/13 02:57:56 tdeval Exp $ */ +/* $OpenBSD: sbp2.c,v 1.2 2002/12/13 21:35:11 tdeval Exp $ */ /* * Copyright (c) 2002 Thierry Deval. All rights reserved. @@ -89,12 +89,6 @@ void sbp2_login_send(struct ieee1394_abuf *, int); void sbp2_status_resp(struct ieee1394_abuf *, int); void sbp2_command_send(struct ieee1394_abuf *, int); -#ifdef MALLOC_DEBUG -#include <dev/ieee1394/malloc_debug.h> /* MPRINTF(x,y) */ -#else /* !MALLOC_DEBUG */ -#define MPRINTF(x,y) -#endif /* MALLOC_DEBUG */ - #ifdef SBP2_DEBUG #include <sys/syslog.h> extern int log_open; @@ -111,10 +105,18 @@ int sbp2_oldlog; addlog x; log_open = sbp2_oldlog; \ } \ } while (0) +#ifdef FW_MALLOC_DEBUG +#define MPRINTF(x,y) DPRINTF(("%s[%d]: %s 0x%08x\n", \ + __func__, __LINE__, (x), (u_int32_t)(y))) +#else /* !FW_MALLOC_DEBUG */ +#define MPRINTF(x,y) +#endif /* FW_MALLOC_DEBUG */ + int sbp2debug = 0; #else /* SBP2_DEBUG */ #define DPRINTF(x) #define DPRINTFN(n,x) +#define MPRINTF(x,y) #endif /* ! SBP2_DEBUG */ typedef struct sbp2_orb_element { @@ -274,7 +276,7 @@ sbp2_init(struct fwnode_softc *sc, struct p1212_dir *unitdir) } MALLOC(ac, struct sbp2_account *, sizeof(*ac), M_1394CTL, M_WAITOK); - //MPRINTF_OLD("MALLOC(1394CTL)", ac); + MPRINTF("MALLOC(1394CTL)", ac); bzero(ac, sizeof(*ac)); loc = key[0]->val; @@ -285,7 +287,7 @@ sbp2_init(struct fwnode_softc *sc, struct p1212_dir *unitdir) sc->sc_sc1394.sc1394_guid[4], sc->sc_sc1394.sc1394_guid[5], sc->sc_sc1394.sc1394_guid[6], sc->sc_sc1394.sc1394_guid[7])); free(key, M_DEVBUF); - //MPRINTF_OLD("free(DEVBUF)", key); + MPRINTF("free(DEVBUF)", key); key = NULL; /* XXX */ ac->ac_softc = sc; @@ -297,20 +299,20 @@ sbp2_init(struct fwnode_softc *sc, struct p1212_dir *unitdir) SBP2_KEYVALUE_Logical_Unit_Number, 0)) != NULL) { ac->ac_lun = (*key)->val & 0xffff; free(key, M_DEVBUF); - //MPRINTF_OLD("free(DEVBUF)", key); + MPRINTF("free(DEVBUF)", key); key = NULL; /* XXX */ } else if ((key = p1212_find(unitdir, P1212_KEYTYPE_Directory, SBP2_KEYVALUE_Logical_Unit_Directory, 0)) != NULL) { dir = (struct p1212_dir *)*key; free(key, M_DEVBUF); - //MPRINTF_OLD("free(DEVBUF)", key); + MPRINTF("free(DEVBUF)", key); key = NULL; /* XXX */ key = p1212_find(dir, P1212_KEYTYPE_Immediate, SBP2_KEYVALUE_Logical_Unit_Number, 0); if (key != NULL) { ac->ac_lun = (*key)->val & 0xffff; free(key, M_DEVBUF); - //MPRINTF_OLD("free(DEVBUF)", key); + MPRINTF("free(DEVBUF)", key); key = NULL; /* XXX */ } } @@ -351,7 +353,7 @@ sbp2_clean(struct fwnode_softc *sc, struct p1212_dir *unitdir, int logout) TAILQ_REMOVE(&ac->ac_orb_head, elm, elm_chain); FREE(elm, M_1394CTL); - //MPRINTF_OLD("FREE(1394CTL)", elm); + MPRINTF("FREE(1394CTL)", elm); //elm = NULL; /* XXX */ } } @@ -360,20 +362,20 @@ sbp2_clean(struct fwnode_softc *sc, struct p1212_dir *unitdir, int logout) if (ac->ac_status_ab) { sc->sc1394_unreg(ac->ac_status_ab, FALSE); FREE(ac->ac_status_ab, M_1394DATA); - //MPRINTF_OLD("FREE(1394DATA)", ac->ac_status_ab); + MPRINTF("FREE(1394DATA)", ac->ac_status_ab); ac->ac_status_ab = NULL; /* XXX */ } if (ac->ac_status_block) { FREE(ac->ac_status_block, M_1394DATA); - //MPRINTF_OLD("FREE(1394DATA)", ac->ac_status_block); + MPRINTF("FREE(1394DATA)", ac->ac_status_block); ac->ac_status_block = NULL; /* XXX */ } FREE(ac, M_1394CTL); - //MPRINTF_OLD("FREE(1394CTL)", ac); + MPRINTF("FREE(1394CTL)", ac); ac = NULL; /* XXX */ } free(key, M_DEVBUF); - //MPRINTF_OLD("free(DEVBUF)", key); + MPRINTF("free(DEVBUF)", key); key = NULL; /* XXX */ } else if ((key = p1212_find(unitdir, P1212_KEYTYPE_Directory, SBP2_KEYVALUE_Logical_Unit_Directory, 0)) != NULL) { @@ -392,7 +394,7 @@ sbp2_clean(struct fwnode_softc *sc, struct p1212_dir *unitdir, int logout) elm_chain) { if (elm != NULL) { FREE(elm, M_1394CTL); - //MPRINTF_OLD("FREE(1394CTL)", elm); + MPRINTF("FREE(1394CTL)", elm); elm = NULL; /* XXX */ } } @@ -403,27 +405,27 @@ sbp2_clean(struct fwnode_softc *sc, struct p1212_dir *unitdir, int logout) ->ac_status_ab, FALSE); FREE(ac->ac_status_ab, M_1394DATA); - //MPRINTF_OLD("FREE(1394DATA)", ac->ac_status_ab); + MPRINTF("FREE(1394DATA)", ac->ac_status_ab); ac->ac_status_ab = NULL; /* XXX */ } if (ac->ac_status_block) { FREE(ac->ac_status_block, M_1394DATA); - //MPRINTF_OLD("FREE(1394DATA)", ac->ac_status_block); + MPRINTF("FREE(1394DATA)", ac->ac_status_block); ac->ac_status_block = NULL; /* XXX */ } FREE(ac, M_1394CTL); - //MPRINTF_OLD("FREE(1394CTL)", ac); + MPRINTF("FREE(1394CTL)", ac); ac = NULL; /* XXX */ } free(key, M_DEVBUF); - //MPRINTF_OLD("free(DEVBUF)", key); + MPRINTF("free(DEVBUF)", key); key = NULL; /* XXX */ } d = dir[i++]; } free(dir, M_DEVBUF); - //MPRINTF_OLD("free(DEVBUF)", dir); + MPRINTF("free(DEVBUF)", dir); dir = NULL; /* XXX */ } else { DPRINTF(("%s: no LUN in configrom 0x%08x ???\n", __func__, @@ -454,10 +456,10 @@ sbp2_login(struct fwnode_softc *sc, struct sbp2_login_orb *orb, } MALLOC(ab, struct ieee1394_abuf *, sizeof(*ab), M_1394DATA, M_WAITOK); - //MPRINTF_OLD("MALLOC(1394DATA)", ab); + MPRINTF("MALLOC(1394DATA)", ab); bzero(ab, sizeof(*ab)); MALLOC(ab2, struct ieee1394_abuf *, sizeof(*ab2), M_1394DATA, M_WAITOK); - //MPRINTF_OLD("MALLOC(1394DATA)", ab2); + MPRINTF("MALLOC(1394DATA)", ab2); bzero(ab2, sizeof(*ab2)); ab->ab_req = (struct ieee1394_softc *)sc; @@ -469,7 +471,7 @@ sbp2_login(struct fwnode_softc *sc, struct sbp2_login_orb *orb, ab->ab_tcode = IEEE1394_TCODE_WRITE_REQUEST_DATABLOCK; ab->ab_data = malloc(8, M_1394DATA, M_WAITOK); - //MPRINTF_OLD("malloc(1394DATA)", ab->ab_data); + MPRINTF("malloc(1394DATA)", ab->ab_data); ab->ab_data[0] = htonl((u_int32_t)(SBP2_LOGIN_ORB >> 32)); ab->ab_data[1] = htonl((u_int32_t)(SBP2_LOGIN_ORB & 0xFFFFFFFF)); DPRINTF((" CSR = 0x%016qx", ac->ac_mgmt_agent)); @@ -507,38 +509,38 @@ sbp2_login_send(struct ieee1394_abuf *ab, int rcode) DPRINTF(("%s: Bad return code: %d\n", __func__, rcode)); if (ab->ab_data) { free(ab->ab_data, M_1394DATA); - //MPRINTF_OLD("free(1394DATA)", ab->ab_data); + MPRINTF("free(1394DATA)", ab->ab_data); ab->ab_data = NULL; /* XXX */ } FREE(ab, M_1394DATA); - //MPRINTF_OLD("FREE(1394DATA)", ab); + MPRINTF("FREE(1394DATA)", ab); ab = NULL; /* XXX */ return; } MALLOC(orb_ab, struct ieee1394_abuf *, sizeof(*orb_ab), M_1394DATA, M_WAITOK); - //MPRINTF_OLD("MALLOC(1394DATA)", orb_ab); + MPRINTF("MALLOC(1394DATA)", orb_ab); bcopy(ab, orb_ab, sizeof(*orb_ab)); sc->sc1394_unreg(ab, FALSE); if (ab->ab_data) { free(ab->ab_data, M_1394DATA); - //MPRINTF_OLD("free(1394DATA)", ab->ab_data); + MPRINTF("free(1394DATA)", ab->ab_data); ab->ab_data = NULL; /* XXX */ orb_ab->ab_data = NULL; } FREE(ab, M_1394DATA); - //MPRINTF_OLD("FREE(1394DATA)", ab); + MPRINTF("FREE(1394DATA)", ab); ab = NULL; /* XXX */ MALLOC(resp_ab, struct ieee1394_abuf *, sizeof(*resp_ab), M_1394DATA, M_WAITOK); - //MPRINTF_OLD("MALLOC(1394DATA)", resp_ab); + MPRINTF("MALLOC(1394DATA)", resp_ab); MALLOC(stat_ab, struct ieee1394_abuf *, sizeof(*stat_ab), M_1394DATA, M_WAITOK); - //MPRINTF_OLD("MALLOC(1394DATA)", stat_ab); + MPRINTF("MALLOC(1394DATA)", stat_ab); bzero(resp_ab, sizeof(*resp_ab)); bzero(stat_ab, sizeof(*stat_ab)); @@ -587,7 +589,7 @@ sbp2_login_send(struct ieee1394_abuf *ab, int rcode) DPRINTF((", STATUS_ORB = 0x%016qx", SBP2_LOGIN_STATUS)); orb_ab->ab_data = malloc(sizeof(*login_orb), M_1394DATA, M_WAITOK); - //MPRINTF_OLD("malloc(1394DATA)", orb_ab->ab_data); + MPRINTF("malloc(1394DATA)", orb_ab->ab_data); bcopy(login_orb, orb_ab->ab_data, sizeof(*login_orb)); #ifdef SBP2_DEBUG for (i = 0; i < (sizeof(*login_orb) / 4); i++) { @@ -625,12 +627,12 @@ sbp2_status_resp(struct ieee1394_abuf *ab, int rcode) DPRINTF(("%s: Bad return code: %d\n", __func__, rcode)); if (ab->ab_data) { free(ab->ab_data, M_1394DATA); - //MPRINTF_OLD("free(1394DATA)", ab->ab_data); + MPRINTF("free(1394DATA)", ab->ab_data); ab->ab_data = NULL; /* XXX */ } if (ab->ab_addr != SBP2_LOGIN_STATUS) { FREE(ab, M_1394DATA); - //MPRINTF_OLD("FREE(1394DATA)", ab); + MPRINTF("FREE(1394DATA)", ab); ab = NULL; /* XXX */ } return; @@ -665,7 +667,7 @@ sbp2_status_resp(struct ieee1394_abuf *ab, int rcode) if (ab->ab_addr == SBP2_LOGIN_STATUS) { MALLOC(cmd_status, struct sbp2_status_block *, sizeof(*cmd_status), M_1394DATA, M_WAITOK); - //MPRINTF_OLD("MALLOC(1394DATA)", cmd_status); + MPRINTF("MALLOC(1394DATA)", cmd_status); bzero(cmd_status, sizeof(*cmd_status)); bcopy(ab->ab_data, cmd_status, ab->ab_retlen); @@ -692,24 +694,24 @@ sbp2_status_resp(struct ieee1394_abuf *ab, int rcode) " 0x%08x\n", __func__, (u_int32_t)(csr & 0xFFFFFFFF))); FREE(cmd_status, M_1394DATA); - //MPRINTF_OLD("FREE(1394DATA)", cmd_status); + MPRINTF("FREE(1394DATA)", cmd_status); cmd_status = NULL; /* XXX */ goto leave; } MALLOC(status_notify, struct sbp2_status_notification *, sizeof(*status_notify), M_1394CTL, M_WAITOK); - //MPRINTF_OLD("MALLOC(1394CTL)", status_notify); + MPRINTF("MALLOC(1394CTL)", status_notify); status_notify->origin = elm->elm_orb; status_notify->status = cmd_status; elm->elm_cb(elm->elm_cbarg, status_notify); FREE(status_notify, M_1394CTL); - //MPRINTF_OLD("FREE(1394CTL)", status_notify); + MPRINTF("FREE(1394CTL)", status_notify); status_notify = NULL; /* XXX */ } else if (((src & 2) == 0) && (resp == 0) && (dead == 0) && (status == 0) && (csr == SBP2_LOGIN_ORB)) { if (ac->ac_status_block) { FREE(ac->ac_status_block, M_1394DATA); - //MPRINTF_OLD("FREE(1394DATA)", ac->ac_status_block); + MPRINTF("FREE(1394DATA)", ac->ac_status_block); ac->ac_status_block = NULL; /* XXX */ } ac->ac_status_block = cmd_status; @@ -717,7 +719,7 @@ sbp2_status_resp(struct ieee1394_abuf *ab, int rcode) ac->ac_valid |= 2; } else { FREE(cmd_status, M_1394DATA); - //MPRINTF_OLD("FREE(1394DATA)", cmd_status); + MPRINTF("FREE(1394DATA)", cmd_status); cmd_status = NULL; /* XXX */ } } @@ -726,12 +728,12 @@ sbp2_status_resp(struct ieee1394_abuf *ab, int rcode) if (ac->ac_cb != NULL) { MALLOC(status_notify, struct sbp2_status_notification *, sizeof(*status_notify), M_1394CTL, M_WAITOK); - //MPRINTF_OLD("MALLOC(1394CTL)", status_notify); + MPRINTF("MALLOC(1394CTL)", status_notify); status_notify->origin = ac->ac_mgmt_orb; status_notify->status = cmd_status; ac->ac_cb(ac->ac_cbarg, status_notify); FREE(status_notify, M_1394CTL); - //MPRINTF_OLD("FREE(1394CTL)", status_notify); + MPRINTF("FREE(1394CTL)", status_notify); status_notify = NULL; /* XXX */ } ac->ac_valid |= 4; @@ -745,14 +747,14 @@ sbp2_status_resp(struct ieee1394_abuf *ab, int rcode) leave: if (ab->ab_data != NULL) { free(ab->ab_data, M_1394DATA); - //MPRINTF_OLD("free(1394DATA)", ab->ab_data); + MPRINTF("free(1394DATA)", ab->ab_data); ab->ab_data = NULL; } if (ab->ab_addr != SBP2_LOGIN_STATUS) { sc->sc1394_unreg(ab, FALSE); FREE(ab, M_1394DATA); - //MPRINTF_OLD("FREE(1394DATA)", ab); + MPRINTF("FREE(1394DATA)", ab); ab = NULL; /* XXX */ } @@ -795,7 +797,7 @@ sbp2_command_add(struct fwnode_softc *sc, int lun, MALLOC(elm, struct sbp2_orb_element *, sizeof(*elm), M_1394CTL, M_WAITOK); - //MPRINTF_OLD("MALLOC(1394CTL)", elm); + MPRINTF("MALLOC(1394CTL)", elm); bzero(elm, sizeof(*elm)); elm->elm_hash = ehash; elm->elm_orb = orb; @@ -807,7 +809,7 @@ sbp2_command_add(struct fwnode_softc *sc, int lun, TAILQ_INSERT_TAIL(&ac->ac_orb_head, elm, elm_chain); MALLOC(ab2, struct ieee1394_abuf *, sizeof(*ab2), M_1394DATA, M_WAITOK); - //MPRINTF_OLD("MALLOC(1394DATA)", ab2); + MPRINTF("MALLOC(1394DATA)", ab2); bzero(ab2, sizeof(*ab2)); ab2->ab_length = sizeof(u_int32_t) * qlen; @@ -827,7 +829,7 @@ sbp2_command_add(struct fwnode_softc *sc, int lun, } else { MALLOC(ab, struct ieee1394_abuf *, sizeof(*ab), M_1394DATA, M_WAITOK); - //MPRINTF_OLD("MALLOC(1394DATA)", ab); + MPRINTF("MALLOC(1394DATA)", ab); bzero(ab, sizeof(*ab)); ab->ab_req = (struct ieee1394_softc *)sc; @@ -839,7 +841,7 @@ sbp2_command_add(struct fwnode_softc *sc, int lun, ab->ab_tcode = IEEE1394_TCODE_WRITE_REQUEST_DATABLOCK; ab->ab_data = malloc(8, M_1394DATA, M_WAITOK); - //MPRINTF_OLD("malloc(1394DATA)", ab->ab_data); + MPRINTF("malloc(1394DATA)", ab->ab_data); ab->ab_data[0] = htonl((u_int32_t)(SBP2_CMD_ORB >> 32)); ab->ab_data[1] = htonl(ehash); DPRINTF((" CSR = 0x%016qx", ab->ab_addr)); @@ -884,17 +886,17 @@ sbp2_command_del(struct fwnode_softc *sc, int lun, struct sbp2_command_orb *orb) sc->sc1394_unreg(elm->elm_orb_ab, FALSE); if (elm->elm_orb_ab->ab_data != NULL) { free(elm->elm_orb_ab->ab_data, M_1394DATA); - //MPRINTF_OLD("free(1394DATA)", elm->elm_orb_ab->ab_data); + MPRINTF("free(1394DATA)", elm->elm_orb_ab->ab_data); elm->elm_orb_ab->ab_data = NULL; /* XXX */ } FREE(elm->elm_orb_ab, M_1394DATA); - //MPRINTF_OLD("FREE(1394DATA)", elm->elm_orb_ab); + MPRINTF("FREE(1394DATA)", elm->elm_orb_ab); elm->elm_orb_ab = NULL; /* XXX */ } TAILQ_REMOVE(&ac->ac_orb_head, elm, elm_chain); FREE(elm, M_1394CTL); - //MPRINTF_OLD("FREE(1394CTL)", elm); + MPRINTF("FREE(1394CTL)", elm); elm = NULL; /* XXX */ if (TAILQ_EMPTY(&ac->ac_orb_head)) @@ -919,18 +921,18 @@ sbp2_command_send(struct ieee1394_abuf *ab, int rcode) #endif /* SBP2_DEBUG */ if (ab->ab_data) { free(ab->ab_data, M_1394DATA); - //MPRINTF_OLD("free(1394DATA)", ab->ab_data); + MPRINTF("free(1394DATA)", ab->ab_data); ab->ab_data = NULL; /* XXX */ } FREE(ab, M_1394DATA); - //MPRINTF_OLD("FREE(1394DATA)", ab); + MPRINTF("FREE(1394DATA)", ab); ab = NULL; /* XXX */ return; } if (ab->ab_data != NULL) { free(ab->ab_data, M_1394DATA); - //MPRINTF_OLD("free(1394DATA)", ab->ab_data); + MPRINTF("free(1394DATA)", ab->ab_data); ab->ab_data = NULL; } @@ -942,11 +944,11 @@ sbp2_command_send(struct ieee1394_abuf *ab, int rcode) #endif /* SBP2_DEBUG */ if (ab->ab_data != NULL) { free(ab->ab_data, M_1394DATA); - //MPRINTF_OLD("free(1394DATA)", ab->ab_data); + MPRINTF("free(1394DATA)", ab->ab_data); ab->ab_data = NULL; /* XXX */ } FREE(ab, M_1394DATA); - //MPRINTF_OLD("FREE(1394DATA)", ab); + MPRINTF("FREE(1394DATA)", ab); ab = NULL; /* XXX */ return; } @@ -958,7 +960,7 @@ sbp2_command_send(struct ieee1394_abuf *ab, int rcode) MALLOC(cmd_ab, struct ieee1394_abuf *, sizeof(*cmd_ab), M_1394DATA, M_WAITOK); - //MPRINTF_OLD("MALLOC(1394DATA)", cmd_ab); + MPRINTF("MALLOC(1394DATA)", cmd_ab); bcopy(ab, cmd_ab, sizeof(*cmd_ab)); /* Fill in a command packet. */ @@ -982,7 +984,7 @@ sbp2_command_send(struct ieee1394_abuf *ab, int rcode) cmd_ab->ab_length = ab->ab_retlen; cmd_ab->ab_data = malloc(elm->elm_orblen * 4, M_1394DATA, M_WAITOK); - //MPRINTF_OLD("malloc(1394DATA)", cmd_ab->ab_data); + MPRINTF("malloc(1394DATA)", cmd_ab->ab_data); bcopy(cmd_orb, cmd_ab->ab_data, elm->elm_orblen * 4); for (i = 0; i < elm->elm_orblen; i++) { if ((i % 8) == 0) DPRINTF((" ")); @@ -1008,7 +1010,7 @@ sbp2_agent_reset(struct fwnode_softc *sc, int lun) DPRINTF(("%s:", __func__)); MALLOC(ab, struct ieee1394_abuf *, sizeof(*ab), M_1394DATA, M_WAITOK); - //MPRINTF_OLD("MALLOC(1394DATA)", ab); + MPRINTF("MALLOC(1394DATA)", ab); bzero(ab, sizeof(*ab)); ab->ab_req = (struct ieee1394_softc *)sc; @@ -1020,7 +1022,7 @@ sbp2_agent_reset(struct fwnode_softc *sc, int lun) ab->ab_tcode = IEEE1394_TCODE_WRITE_REQUEST_QUADLET; ab->ab_data = malloc(4, M_1394DATA, M_WAITOK); - //MPRINTF_OLD("malloc(1394DATA)", ab->ab_data); + MPRINTF("malloc(1394DATA)", ab->ab_data); ab->ab_data[0] = 0; DPRINTF((" CSR = 0x%016qx\n", ab->ab_addr)); @@ -1044,7 +1046,7 @@ sbp2_agent_tickle(struct fwnode_softc *sc, int lun) DPRINTF(("%s:", __func__)); MALLOC(ab, struct ieee1394_abuf *, sizeof(*ab), M_1394DATA, M_WAITOK); - //MPRINTF_OLD("MALLOC(1394DATA)", ab); + MPRINTF("MALLOC(1394DATA)", ab); bzero(ab, sizeof(*ab)); ab->ab_req = (struct ieee1394_softc *)sc; @@ -1056,7 +1058,7 @@ sbp2_agent_tickle(struct fwnode_softc *sc, int lun) ab->ab_tcode = IEEE1394_TCODE_WRITE_REQUEST_QUADLET; ab->ab_data = malloc(4, M_1394DATA, M_WAITOK); - //MPRINTF_OLD("malloc(1394DATA)", ab->ab_data); + MPRINTF("malloc(1394DATA)", ab->ab_data); ab->ab_data[0] = 0; DPRINTF((" CSR = 0x%016qx\n", ab->ab_addr)); |