From owner-svn-soc-all@freebsd.org Sat Jun 4 18:53:28 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 0ABC7B6A737 for ; Sat, 4 Jun 2016 18:53:28 +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 F2E071E85 for ; Sat, 4 Jun 2016 18:53:27 +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 u54IrRh5014336 for ; Sat, 4 Jun 2016 18:53:27 GMT (envelope-from iateaca@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id u54IrRcU014334 for svn-soc-all@FreeBSD.org; Sat, 4 Jun 2016 18:53:27 GMT (envelope-from iateaca@FreeBSD.org) Date: Sat, 4 Jun 2016 18:53:27 GMT Message-Id: <201606041853.u54IrRcU014334@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: r304659 - 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, 04 Jun 2016 18:53:28 -0000 Author: iateaca Date: Sat Jun 4 18:53:26 2016 New Revision: 304659 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=304659 Log: decode the (verb, payload) content from the cmd_data function of 12bit or 4bit Modified: soc2016/iateaca/bhyve-hda-head/usr.sbin/bhyve/hda_codec.c Modified: soc2016/iateaca/bhyve-hda-head/usr.sbin/bhyve/hda_codec.c ============================================================================== --- soc2016/iateaca/bhyve-hda-head/usr.sbin/bhyve/hda_codec.c Sat Jun 4 17:40:23 2016 (r304658) +++ soc2016/iateaca/bhyve-hda-head/usr.sbin/bhyve/hda_codec.c Sat Jun 4 18:53:26 2016 (r304659) @@ -56,11 +56,16 @@ uint8_t cad = 0, nid = 0; uint16_t verb = 0, payload = 0; - // TODO find if the cmd is 12bit or 4bit cad = (cmd_data >> HDA_CMD_CAD_SHIFT) & 0x0f; // 4 bits nid = (cmd_data >> HDA_CMD_NID_SHIFT) & 0xff; // 8 bits - verb = (cmd_data >> HDA_CMD_VERB_12BIT_SHIFT) & 0x0fff; // 12 bits - payload = cmd_data & 0xff; // 8 bits + + if ((cmd_data & 0x70000) == 0x70000) { + verb = (cmd_data >> HDA_CMD_VERB_12BIT_SHIFT) & 0x0fff; // 12 bits + payload = cmd_data & 0xff; // 8 bits + } else { + verb = (cmd_data >> HDA_CMD_VERB_4BIT_SHIFT) & 0x0f; // 4 bits + payload = cmd_data & 0xffff; // 16 bits + } assert(cad == hci->cad); assert(hci);