From owner-svn-soc-all@freebsd.org Sat Jun 18 16:54:44 2016 Return-Path: Delivered-To: svn-soc-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1CEB3A787EA for ; Sat, 18 Jun 2016 16:54:44 +0000 (UTC) (envelope-from iateaca@FreeBSD.org) Received: from socsvn.freebsd.org (socsvn.freebsd.org [IPv6:2001:1900:2254:206a::50:2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id EC2B01B7D for ; Sat, 18 Jun 2016 16:54:43 +0000 (UTC) (envelope-from iateaca@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id u5IGshuk079845 for ; Sat, 18 Jun 2016 16:54:43 GMT (envelope-from iateaca@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id u5IGshAd079800 for svn-soc-all@FreeBSD.org; Sat, 18 Jun 2016 16:54:43 GMT (envelope-from iateaca@FreeBSD.org) Date: Sat, 18 Jun 2016 16:54:43 GMT Message-Id: <201606181654.u5IGshAd079800@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to iateaca@FreeBSD.org using -f From: iateaca@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r305335 - soc2016/iateaca/bhyve-hda-head/usr.sbin/bhyve MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 18 Jun 2016 16:54:44 -0000 Author: iateaca Date: Sat Jun 18 16:54:42 2016 New Revision: 305335 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=305335 Log: fix the write to the SDCTL2 offset get strm tag from the SDCTL register and map it to the stream_ind stream 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 Sat Jun 18 15:21:08 2016 (r305334) +++ soc2016/iateaca/bhyve-hda-head/usr.sbin/bhyve/pci_hda.c Sat Jun 18 16:54:42 2016 (r305335) @@ -138,6 +138,8 @@ hda_set_rirbctl(struct hda_softc *sc, uint32_t offset, uint32_t old); static void hda_set_sdctl(struct hda_softc *sc, uint32_t offset, uint32_t old); +static void +hda_set_sdctl2(struct hda_softc *sc, uint32_t offset, uint32_t old); static int hda_signal_state_change(struct hda_codec_inst *hci); @@ -167,9 +169,11 @@ #define HDAC_ISTREAM(n, iss, oss) \ [_HDAC_ISDCTL(n, iss, oss)] = hda_set_sdctl, \ + [_HDAC_ISDCTL(n, iss, oss) + 2] = hda_set_sdctl2, \ #define HDAC_OSTREAM(n, iss, oss) \ [_HDAC_OSDCTL(n, iss, oss)] = hda_set_sdctl, \ + [_HDAC_OSDCTL(n, iss, oss) + 2] = hda_set_sdctl2, \ HDAC_ISTREAM(0, HDA_ISS_NO, HDA_OSS_NO) HDAC_ISTREAM(1, HDA_ISS_NO, HDA_OSS_NO) @@ -246,7 +250,7 @@ reg_value = hda_get_reg_by_offset(sc, offset); reg_value &= ~mask; - reg_value |= value; + reg_value |= (value & mask); hda_set_reg_by_offset(sc, offset, reg_value); @@ -429,6 +433,8 @@ uint64_t bdle_paddr = 0; void *bdle_vaddr = NULL; uint32_t off = hda_get_offset_stream(stream_ind); + uint32_t sdctl = 0; + uint8_t strm = 0; int i; assert(!st->run); @@ -470,6 +476,13 @@ bdle_desc->ioc = bdle->ioc; } + sdctl = hda_get_reg_by_offset(sc, off + HDAC_SDCTL0); + strm = (sdctl >> 20) & 0x0f; + + DPRINTF("strm: 0x%x\n", strm); + + sc->stream_map[strm] = stream_ind; + return 0; } @@ -715,7 +728,9 @@ uint32_t value = hda_get_reg_by_offset(sc, offset); int err; - DPRINTF("stream_ind: 0x%x old: 0x%x\n", stream_ind, old); + DPRINTF("stream_ind: 0x%x old: 0x%x value: 0x%x\n", stream_ind, old, value); + + hda_set_field_by_offset(sc, offset, 0x00ffff00, old); if (value & HDAC_SDCTL_SRST) { hda_reset_stream(sc, stream_ind); @@ -729,6 +744,16 @@ return; } +static void +hda_set_sdctl2(struct hda_softc *sc, uint32_t offset, uint32_t old) +{ + uint32_t value = hda_get_reg_by_offset(sc, offset); + + hda_set_field_by_offset(sc, offset - 2, 0x00ff0000, value << 16); + + return; +} + static int hda_signal_state_change(struct hda_codec_inst *hci) {