Date: Sun, 29 May 2016 18:40:20 GMT From: iateaca@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r304168 - soc2016/iateaca/bhyve-hda-head/usr.sbin/bhyve Message-ID: <201605291840.u4TIeKW1006036@socsvn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: iateaca Date: Sun May 29 18:40:19 2016 New Revision: 304168 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=304168 Log: run corb mechanism in loop while rp != wp increment corp rp pointer and turn to 0 when rp = corb->size M bhyve/pci_hda.c Modified: soc2016/iateaca/bhyve-hda-head/usr.sbin/bhyve/pci_hda.c Modified: soc2016/iateaca/bhyve-hda-head/usr.sbin/bhyve/pci_hda.c ============================================================================== --- soc2016/iateaca/bhyve-hda-head/usr.sbin/bhyve/pci_hda.c Sun May 29 17:35:38 2016 (r304167) +++ soc2016/iateaca/bhyve-hda-head/usr.sbin/bhyve/pci_hda.c Sun May 29 18:40:19 2016 (r304168) @@ -432,6 +432,24 @@ static int hda_corb_run(struct hda_softc *sc) { + struct hda_codec_cmd_ctl *corb = &sc->corb; + uint32_t verb = 0; + int err; + + corb->wp = hda_get_reg_by_offset(sc, HDAC_CORBWP); + + while (corb->rp != corb->wp && corb->run) { + corb->rp++; + corb->rp %= corb->size; + + verb = hda_dma_ld_dword(corb->dma_vaddr + HDA_CORB_ENTRY_LEN * corb->rp); + + err = hda_send_command(sc, verb); + assert(!err); + } + + hda_set_reg_by_offset(sc, HDAC_CORBRP, corb->rp); + return 0; } @@ -521,25 +539,7 @@ static void hda_set_corbwp(struct hda_softc *sc, uint32_t offset, uint32_t old) { - struct hda_codec_cmd_ctl *corb = &sc->corb; - uint32_t value = sc->regs[offset]; - uint32_t verb = 0; - int err; - - corb->wp = value; - - /* - * TODO do it in loop - */ - if (corb->wp != corb->rp && corb->run) { - corb->rp++; - verb = hda_dma_ld_dword(corb->dma_vaddr + HDA_CORB_ENTRY_LEN * corb->rp); - - err = hda_send_command(sc, verb); - assert(!err); - } - - hda_set_reg_by_offset(sc, HDAC_CORBRP, corb->rp); + hda_corb_run(sc); return; }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201605291840.u4TIeKW1006036>