From owner-svn-soc-all@freebsd.org Sat May 7 19:19:24 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 9CAB3B31F2C for ; Sat, 7 May 2016 19:19:24 +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 76F471846 for ; Sat, 7 May 2016 19:19:24 +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 u47JJOh6079336 for ; Sat, 7 May 2016 19:19:24 GMT (envelope-from iateaca@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id u47JJN06079290 for svn-soc-all@FreeBSD.org; Sat, 7 May 2016 19:19:23 GMT (envelope-from iateaca@FreeBSD.org) Date: Sat, 7 May 2016 19:19:23 GMT Message-Id: <201605071919.u47JJN06079290@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: r302358 - soc2015/iateaca/bhyve-ne2000-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, 07 May 2016 19:19:24 -0000 Author: iateaca Date: Sat May 7 19:19:23 2016 New Revision: 302358 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=302358 Log: probe the HDA controller - set the PCI configuration space, allocate BAR0 memory addresses and request IRQ Modified: soc2015/iateaca/bhyve-ne2000-head/usr.sbin/bhyve/pci_hda.c Modified: soc2015/iateaca/bhyve-ne2000-head/usr.sbin/bhyve/pci_hda.c ============================================================================== --- soc2015/iateaca/bhyve-ne2000-head/usr.sbin/bhyve/pci_hda.c Sat May 7 18:58:07 2016 (r302357) +++ soc2015/iateaca/bhyve-ne2000-head/usr.sbin/bhyve/pci_hda.c Sat May 7 19:19:23 2016 (r302358) @@ -7,7 +7,7 @@ /* * HDA Debug Log */ -#define DEBUG_HDA 0 +#define DEBUG_HDA 1 #if DEBUG_HDA == 1 static FILE *dbg; #define DPRINTF(fmt, arg...) \ @@ -20,6 +20,8 @@ /* * HDA defines */ +#define INTEL_VENDORID 0x8086 +#define HDA_INTEL_82801G 0x27d8 /* * HDA data structures @@ -63,6 +65,28 @@ static int pci_hda_init(struct vmctx *ctx, struct pci_devinst *pi, char *opts) { + assert(ctx != NULL); + assert(pi != NULL); + +#if DEBUG_HDA == 1 + dbg = fopen("/tmp/bhyve_hda.log", "w+"); +#endif + + DPRINTF("PCI HDA\n"); + + pci_set_cfgdata16(pi, PCIR_VENDOR, INTEL_VENDORID); + pci_set_cfgdata16(pi, PCIR_DEVICE, HDA_INTEL_82801G); + + pci_set_cfgdata8(pi, PCIR_SUBCLASS, PCIS_MULTIMEDIA_HDA); + pci_set_cfgdata8(pi, PCIR_CLASS, PCIC_MULTIMEDIA); + + /* TODO check the right size */ + /* allocate one BAR register for the Memory address offsets */ + pci_emul_alloc_bar(pi, 0, PCIBAR_MEM32, 0x0fff); + + /* allocate an IRQ pin for our slot */ + pci_lintr_request(pi); + return 0; } @@ -70,6 +94,10 @@ pci_hda_write(struct vmctx *ctx, int vcpu, struct pci_devinst *pi, int baridx, uint64_t offset, int size, uint64_t value) { + assert(baridx == 0); + + DPRINTF("offset: 0x%lx size: %d\n", offset, size); + return; } @@ -77,6 +105,10 @@ pci_hda_read(struct vmctx *ctx, int vcpu, struct pci_devinst *pi, int baridx, uint64_t offset, int size) { + assert(baridx == 0); + + DPRINTF("offset: 0x%lx size: %d\n", offset, size); + return 0; }