diff --git a/usr.sbin/bhyve/pci_hda.h b/usr.sbin/bhyve/pci_hda.h --- a/usr.sbin/bhyve/pci_hda.h +++ b/usr.sbin/bhyve/pci_hda.h @@ -46,12 +46,14 @@ /* * HDA Debug Log */ -#define DEBUG_HDA 1 #if DEBUG_HDA == 1 extern FILE *dbg; #define DPRINTF(fmt, arg...) \ do {fprintf(dbg, "%s-%d: " fmt "\n", __func__, __LINE__, ##arg); \ fflush(dbg); } while (0) +#ifndef HDA_DEBUG_FILE +#define HDA_DEBUG_FILE "/tmp/bhyve_hda.log" +#endif #else #define DPRINTF(fmt, arg...) #endif diff --git a/usr.sbin/bhyve/pci_hda.c b/usr.sbin/bhyve/pci_hda.c --- a/usr.sbin/bhyve/pci_hda.c +++ b/usr.sbin/bhyve/pci_hda.c @@ -166,7 +166,9 @@ static int hda_write(struct hda_softc *sc, uint32_t offset, uint8_t size, uint32_t value); +#if DEBUG_HDA == 1 static inline void hda_print_cmd_ctl_data(struct hda_codec_cmd_ctl *p); +#endif static int hda_corb_start(struct hda_softc *sc); static int hda_corb_run(struct hda_softc *sc); static int hda_rirb_start(struct hda_softc *sc); @@ -324,7 +326,7 @@ int err; #if DEBUG_HDA == 1 - dbg = fopen("/tmp/bhyve_hda.log", "w+"); + dbg = fopen(HDA_DEBUG_FILE, "w+"); #endif sc = calloc(1, sizeof(*sc)); @@ -726,17 +728,17 @@ return (0); } +#if DEBUG_HDA == 1 static inline void hda_print_cmd_ctl_data(struct hda_codec_cmd_ctl *p) { -#if DEBUG_HDA == 1 const char *name = p->name; -#endif DPRINTF("%s size: %d", name, p->size); DPRINTF("%s dma_vaddr: %p", name, p->dma_vaddr); DPRINTF("%s wp: 0x%x", name, p->wp); DPRINTF("%s rp: 0x%x", name, p->rp); } +#endif static int hda_corb_start(struct hda_softc *sc) @@ -776,7 +778,9 @@ corb->run = 1; +#if DEBUG_HDA == 1 hda_print_cmd_ctl_data(corb); +#endif return (0); } @@ -847,7 +851,9 @@ rirb->run = 1; +#if DEBUG_HDA == 1 hda_print_cmd_ctl_data(rirb); +#endif return (0); }