From owner-svn-soc-all@freebsd.org Sun Jul 3 16:46:48 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 BB0CDB909DF for ; Sun, 3 Jul 2016 16:46:48 +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 953352108 for ; Sun, 3 Jul 2016 16:46:48 +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 u63Gkmst073674 for ; Sun, 3 Jul 2016 16:46:48 GMT (envelope-from iateaca@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id u63GkmNY073672 for svn-soc-all@FreeBSD.org; Sun, 3 Jul 2016 16:46:48 GMT (envelope-from iateaca@FreeBSD.org) Date: Sun, 3 Jul 2016 16:46:48 GMT Message-Id: <201607031646.u63GkmNY073672@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: r305694 - 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: Sun, 03 Jul 2016 16:46:48 -0000 Author: iateaca Date: Sun Jul 3 16:46:47 2016 New Revision: 305694 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=305694 Log: fix the hda_write_reg: for one offset allow writes of sizes 1, 2, 3, 4 bytes 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 Jul 3 15:00:12 2016 (r305693) +++ soc2016/iateaca/bhyve-hda-head/usr.sbin/bhyve/pci_hda.c Sun Jul 3 16:46:47 2016 (r305694) @@ -120,7 +120,7 @@ static uint32_t hda_read(struct hda_softc *sc, uint32_t offset); static int -hda_write(struct hda_softc *sc, uint32_t offset, uint32_t value); +hda_write(struct hda_softc *sc, uint32_t offset, uint8_t size, uint32_t value); static void hda_print_cmd_ctl_data(struct hda_codec_cmd_ctl *p); @@ -616,12 +616,13 @@ } static int -hda_write(struct hda_softc *sc, uint32_t offset, uint32_t value) +hda_write(struct hda_softc *sc, uint32_t offset, uint8_t size, uint32_t value) { uint32_t old = hda_get_reg_by_offset(sc, offset); + uint32_t masks[] = {0x00000000, 0x000000ff, 0x0000ffff, 0x00ffffff, 0xffffffff}; hda_set_reg_handler set_reg_handler = hda_set_reg_table[offset]; - hda_set_reg_by_offset(sc, offset, value); + hda_set_field_by_offset(sc, offset, masks[size], value); if (set_reg_handler) set_reg_handler(sc, offset, old); @@ -853,8 +854,6 @@ 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_stream_reset(sc, stream_ind); } @@ -1069,7 +1068,7 @@ DPRINTF("offset: 0x%lx value: 0x%lx\n", offset, value); - err = hda_write(sc, offset, value); + err = hda_write(sc, offset, size, value); assert(!err); return;