From owner-svn-soc-all@freebsd.org Sun May 15 12:25:21 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 E7A12B3A3CE for ; Sun, 15 May 2016 12:25:21 +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 C1B2A1E8B for ; Sun, 15 May 2016 12:25:21 +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 u4FCPLig023316 for ; Sun, 15 May 2016 12:25:21 GMT (envelope-from iateaca@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id u4FCPKfP023243 for svn-soc-all@FreeBSD.org; Sun, 15 May 2016 12:25:20 GMT (envelope-from iateaca@FreeBSD.org) Date: Sun, 15 May 2016 12:25:20 GMT Message-Id: <201605151225.u4FCPKfP023243@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: r303011 - 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, 15 May 2016 12:25:22 -0000 Author: iateaca Date: Sun May 15 12:25:20 2016 New Revision: 303011 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=303011 Log: change the prototype of the set_reg_handler: add the offset parameter design the layout of the callbacks for the stream description registers add a callback for the SDCTL stream register implement a function to get the stream index from the offset register 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 15 08:36:12 2016 (r303010) +++ soc2016/iateaca/bhyve-hda-head/usr.sbin/bhyve/pci_hda.c Sun May 15 12:25:20 2016 (r303011) @@ -105,7 +105,7 @@ struct hda_softc; -typedef void (*hda_set_reg_handler)(struct hda_softc *sc, uint32_t old); +typedef void (*hda_set_reg_handler)(struct hda_softc *sc, uint32_t offset, uint32_t old); struct hda_softc { uint32_t regs[HDA_LAST_OFFSET]; @@ -128,6 +128,12 @@ static int hda_write(struct hda_softc *sc, uint32_t offset, uint32_t value); +static inline uint8_t +hda_get_stream_by_offsets(uint32_t offset, uint8_t reg_offset); + +static void +hda_set_sdctl(struct hda_softc *sc, uint32_t offset, uint32_t old); + /* * PCI HDA function declarations */ @@ -144,6 +150,22 @@ */ static const hda_set_reg_handler hda_set_reg_table[] = { +#define HDAC_ISTREAM(n, iss, oss) \ + [_HDAC_ISDCTL(n, iss, oss)] = hda_set_sdctl, \ + +#define HDAC_OSTREAM(n, iss, oss) \ + [_HDAC_OSDCTL(n, iss, oss)] = hda_set_sdctl, \ + + HDAC_ISTREAM(0, HDA_ISS_NO, HDA_OSS_NO) + HDAC_ISTREAM(1, HDA_ISS_NO, HDA_OSS_NO) + HDAC_ISTREAM(2, HDA_ISS_NO, HDA_OSS_NO) + HDAC_ISTREAM(3, HDA_ISS_NO, HDA_OSS_NO) + + HDAC_OSTREAM(0, HDA_ISS_NO, HDA_OSS_NO) + HDAC_OSTREAM(1, HDA_ISS_NO, HDA_OSS_NO) + HDAC_OSTREAM(2, HDA_ISS_NO, HDA_OSS_NO) + HDAC_OSTREAM(3, HDA_ISS_NO, HDA_OSS_NO) + [HDA_LAST_OFFSET] = NULL, }; @@ -236,11 +258,27 @@ hda_set_reg_by_offset(sc, offset, value); if (set_reg_handler) - set_reg_handler(sc, old); + set_reg_handler(sc, offset, old); return 0; } +static inline uint8_t +hda_get_stream_by_offsets(uint32_t offset, uint8_t reg_offset) +{ + return (offset - reg_offset - 0x80) / 0x20; +} + +static void +hda_set_sdctl(struct hda_softc *sc, uint32_t offset, uint32_t old) +{ + uint8_t stream_ind = hda_get_stream_by_offsets(offset, 0x00); + + DPRINTF("stream_ind: 0x%x old: 0x%x\n", stream_ind, old); + + return; +} + /* * PCI HDA function definitions */