From owner-svn-soc-all@freebsd.org Sun May 29 05:48:36 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 C0994B51513 for ; Sun, 29 May 2016 05:48:36 +0000 (UTC) (envelope-from yuanxunzhang@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 B45D71DDA for ; Sun, 29 May 2016 05:48:36 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id u4T5maIp049885 for ; Sun, 29 May 2016 05:48:36 GMT (envelope-from yuanxunzhang@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id u4T5mZg3049867 for svn-soc-all@FreeBSD.org; Sun, 29 May 2016 05:48:35 GMT (envelope-from yuanxunzhang@FreeBSD.org) Date: Sun, 29 May 2016 05:48:35 GMT Message-Id: <201605290548.u4T5mZg3049867@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to yuanxunzhang@FreeBSD.org using -f From: yuanxunzhang@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r304134 - in soc2016/yuanxunzhang/head: targets/pseudo/userland usr.sbin/eaps 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, 29 May 2016 05:48:36 -0000 Author: yuanxunzhang Date: Sun May 29 05:48:34 2016 New Revision: 304134 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=304134 Log: add eaps commond modules Modified: soc2016/yuanxunzhang/head/targets/pseudo/userland/Makefile.depend soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Modified: soc2016/yuanxunzhang/head/targets/pseudo/userland/Makefile.depend ============================================================================== --- soc2016/yuanxunzhang/head/targets/pseudo/userland/Makefile.depend Sun May 29 04:56:48 2016 (r304133) +++ soc2016/yuanxunzhang/head/targets/pseudo/userland/Makefile.depend Sun May 29 05:48:34 2016 (r304134) @@ -569,6 +569,7 @@ usr.sbin/dnssec-settime \ usr.sbin/dnssec-signzone \ usr.sbin/dumpcis \ + usr.sbin/eaps \ usr.sbin/editmap \ usr.sbin/edquota \ usr.sbin/etcupdate \ Modified: soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c ============================================================================== --- soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Sun May 29 04:56:48 2016 (r304133) +++ soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Sun May 29 05:48:34 2016 (r304134) @@ -30,17 +30,6 @@ * SUCH DAMAGE. */ -#if 0 -#ifndef lint -static char const copyright[] = -"@(#) Copyright (c) 1984, 1993\n\ - The Regents of the University of California. All rights reserved.\n"; -#endif /* not lint */ - -#ifndef lint -static char const sccsid[] = "@(#)from: eaps.c 8.2 (Berkeley) 1/2/94"; -#endif /* not lint */ -#endif #include __FBSDID("$FreeBSD$"); From owner-svn-soc-all@freebsd.org Sun May 29 07:26:43 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 679EEB51775 for ; Sun, 29 May 2016 07:26:43 +0000 (UTC) (envelope-from yuanxunzhang@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 5B51D174B for ; Sun, 29 May 2016 07:26:43 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id u4T7QhkI021083 for ; Sun, 29 May 2016 07:26:43 GMT (envelope-from yuanxunzhang@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id u4T7Qg91021081 for svn-soc-all@FreeBSD.org; Sun, 29 May 2016 07:26:42 GMT (envelope-from yuanxunzhang@FreeBSD.org) Date: Sun, 29 May 2016 07:26:42 GMT Message-Id: <201605290726.u4T7Qg91021081@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to yuanxunzhang@FreeBSD.org using -f From: yuanxunzhang@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r304141 - soc2016/yuanxunzhang/head/usr.sbin/route6d 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, 29 May 2016 07:26:43 -0000 Author: yuanxunzhang Date: Sun May 29 07:26:42 2016 New Revision: 304141 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=304141 Log: add eaps commond modules Modified: soc2016/yuanxunzhang/head/usr.sbin/route6d/route6d.8 Modified: soc2016/yuanxunzhang/head/usr.sbin/route6d/route6d.8 ============================================================================== --- soc2016/yuanxunzhang/head/usr.sbin/route6d/route6d.8 Sun May 29 06:46:17 2016 (r304140) +++ soc2016/yuanxunzhang/head/usr.sbin/route6d/route6d.8 Sun May 29 07:26:42 2016 (r304141) @@ -21,7 +21,7 @@ .Os .Sh NAME .Nm route6d -.Nd RIP6 Routing Daemon +.Nd RIP6 Routing Daemon (TEST) .Sh SYNOPSIS .Nm .Op Fl adDhlnqsS From owner-svn-soc-all@freebsd.org Sun May 29 10:56:56 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 73D8DB525BB for ; Sun, 29 May 2016 10:56:56 +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 4A7E619B2 for ; Sun, 29 May 2016 10:56:56 +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 u4TAuuqu014966 for ; Sun, 29 May 2016 10:56:56 GMT (envelope-from iateaca@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id u4TAuskq014911 for svn-soc-all@FreeBSD.org; Sun, 29 May 2016 10:56:54 GMT (envelope-from iateaca@FreeBSD.org) Date: Sun, 29 May 2016 10:56:54 GMT Message-Id: <201605291056.u4TAuskq014911@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: r304147 - 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, 29 May 2016 10:56:56 -0000 Author: iateaca Date: Sun May 29 10:56:54 2016 New Revision: 304147 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=304147 Log: design the hda operations registered to codec (signal, repsonse, xfer) add codec reset function implement signal_status_chande; called by codec M bhyve/hda_codec.c M bhyve/pci_hda.c M bhyve/pci_hda.h Modified: soc2016/iateaca/bhyve-hda-head/usr.sbin/bhyve/hda_codec.c soc2016/iateaca/bhyve-hda-head/usr.sbin/bhyve/pci_hda.c soc2016/iateaca/bhyve-hda-head/usr.sbin/bhyve/pci_hda.h Modified: soc2016/iateaca/bhyve-hda-head/usr.sbin/bhyve/hda_codec.c ============================================================================== --- soc2016/iateaca/bhyve-hda-head/usr.sbin/bhyve/hda_codec.c Sun May 29 07:39:56 2016 (r304146) +++ soc2016/iateaca/bhyve-hda-head/usr.sbin/bhyve/hda_codec.c Sun May 29 10:56:54 2016 (r304147) @@ -2,6 +2,11 @@ #include "pci_hda.h" static int +hda_codec_init(struct hda_codec_inst *hci, const char *opts); +static int +hda_codec_reset(struct hda_codec_inst *hci); + +static int hda_codec_init(struct hda_codec_inst *hci, const char *opts) { DPRINTF("cad: 0x%x opts: %s\n", hci->cad, opts); @@ -9,9 +14,27 @@ return 0; } +static int +hda_codec_reset(struct hda_codec_inst *hci) +{ + struct hda_ops *hops = NULL; + + assert(hci); + + hops = hci->hops; + assert(hops); + + DPRINTF("cad: 0x%x\n", hci->cad); + + hops->signal(hci); + + return 0; +} + struct hda_codec_class hda_codec = { .name = "hda_codec", .init = hda_codec_init, + .reset = hda_codec_reset, }; HDA_EMUL_SET(hda_codec); 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 29 07:39:56 2016 (r304146) +++ soc2016/iateaca/bhyve-hda-head/usr.sbin/bhyve/pci_hda.c Sun May 29 10:56:54 2016 (r304147) @@ -12,7 +12,7 @@ #define HDA_OSS_NO 0x04 #define HDA_ISS_NO 0x04 -#define HDA_CODEC_MAX 0x10 +#define HDA_CODEC_MAX 0x0f #define HDA_LAST_OFFSET (0x80 + ((HDA_ISS_NO) * 0x20) + ((HDA_OSS_NO) * 0x20)) #define HDA_CORB_ENTRY_LEN 0x04 #define HDA_RIRB_ENTRY_LEN 0x08 @@ -61,7 +61,10 @@ static struct hda_codec_class * hda_find_codec_class(const char *name); -static void hda_reset_regs(struct hda_softc *sc); +static void +hda_reset(struct hda_softc *sc); +static void +hda_reset_regs(struct hda_softc *sc); static uint32_t hda_read(struct hda_softc *sc, uint32_t offset); static int @@ -97,6 +100,9 @@ static void hda_set_sdctl(struct hda_softc *sc, uint32_t offset, uint32_t old); +static int +hda_signal_state_change(struct hda_codec_inst *hci); + /* * PCI HDA function declarations */ @@ -151,6 +157,10 @@ [HDAC_RIRBSIZE_RIRBSIZE_MASK] = 0, }; +static struct hda_ops hops = { + .signal = hda_signal_state_change, +}; + struct pci_devemu pci_de_hda = { .pe_emu = "hda", .pe_init = pci_hda_init, @@ -246,7 +256,9 @@ return -1; hci->hda = sc; + hci->hops = &hops; hci->cad = sc->codecs_no; + hci->codec = codec; sc->codecs[sc->codecs_no++] = hci; @@ -271,7 +283,31 @@ return NULL; } -static void hda_reset_regs(struct hda_softc *sc) +static void +hda_reset(struct hda_softc *sc) +{ + int i; + struct hda_codec_inst *hci = NULL; + struct hda_codec_class *codec = NULL; + + hda_reset_regs(sc); + + /* Reset each codec */ + for (i = 0; i < sc->codecs_no; i++) { + hci = sc->codecs[i]; + assert(hci); + + codec = hci->codec; + assert(codec); + + codec->reset(hci); + } + + return; +} + +static void +hda_reset_regs(struct hda_softc *sc) { DPRINTF("Reset the HDA controller registers ...\n"); @@ -445,8 +481,7 @@ uint32_t value = sc->regs[offset]; if (!(value & HDAC_GCTL_CRST)) { - hda_reset_regs(sc); - hda_set_reg_by_offset(sc, HDAC_STATESTS, 0x0001); + hda_reset(sc); } return; @@ -525,6 +560,25 @@ return; } +static int +hda_signal_state_change(struct hda_codec_inst *hci) +{ + struct hda_softc *sc = NULL; + uint32_t sdiwake = 0; + + assert(hci); + assert(hci->hda); + + DPRINTF("cad: 0x%x\n", hci->cad); + + sc = hci->hda; + sdiwake = 1 << hci->cad; + + hda_set_field_by_offset(sc, HDAC_STATESTS, sdiwake, sdiwake); + + return 0; +} + /* * PCI HDA function definitions */ Modified: soc2016/iateaca/bhyve-hda-head/usr.sbin/bhyve/pci_hda.h ============================================================================== --- soc2016/iateaca/bhyve-hda-head/usr.sbin/bhyve/pci_hda.h Sun May 29 07:39:56 2016 (r304146) +++ soc2016/iateaca/bhyve-hda-head/usr.sbin/bhyve/pci_hda.h Sun May 29 10:56:54 2016 (r304147) @@ -26,9 +26,12 @@ #endif struct hda_softc; +struct hda_codec_class; struct hda_codec_inst { + struct hda_codec_class *codec; struct hda_softc *hda; + struct hda_ops *hops; uint8_t cad; void *priv; }; @@ -36,6 +39,11 @@ struct hda_codec_class { char *name; int (*init)(struct hda_codec_inst *hci, const char *opts); + int (*reset)(struct hda_codec_inst *hci); +}; + +struct hda_ops { + int (*signal)(struct hda_codec_inst *hci); }; #define HDA_EMUL_SET(x) DATA_SET(hda_codec_class_set, x); From owner-svn-soc-all@freebsd.org Sun May 29 12:02:32 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 71136B4E1B2 for ; Sun, 29 May 2016 12:02:32 +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 6455714BD for ; Sun, 29 May 2016 12:02:32 +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 u4TC2Wwl068761 for ; Sun, 29 May 2016 12:02:32 GMT (envelope-from iateaca@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id u4TC2Vil068381 for svn-soc-all@FreeBSD.org; Sun, 29 May 2016 12:02:31 GMT (envelope-from iateaca@FreeBSD.org) Date: Sun, 29 May 2016 12:02:31 GMT Message-Id: <201605291202.u4TC2Vil068381@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: r304150 - 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, 29 May 2016 12:02:32 -0000 Author: iateaca Date: Sun May 29 12:02:31 2016 New Revision: 304150 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=304150 Log: clone sys/dev/sound/pci/hda/hda_reg.h in bhyve Added: soc2016/iateaca/bhyve-hda-head/usr.sbin/bhyve/hda_reg.h - copied unchanged from r302727, soc2016/iateaca/bhyve-hda-head/sys/dev/sound/pci/hda/hda_reg.h Copied: soc2016/iateaca/bhyve-hda-head/usr.sbin/bhyve/hda_reg.h (from r302727, soc2016/iateaca/bhyve-hda-head/sys/dev/sound/pci/hda/hda_reg.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2016/iateaca/bhyve-hda-head/usr.sbin/bhyve/hda_reg.h Sun May 29 12:02:31 2016 (r304150, copy of r302727, soc2016/iateaca/bhyve-hda-head/sys/dev/sound/pci/hda/hda_reg.h) @@ -0,0 +1,1367 @@ +/*- + * Copyright (c) 2006 Stephane E. Potvin + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef _HDA_REG_H_ +#define _HDA_REG_H_ + +/**************************************************************************** + * HDA Device Verbs + ****************************************************************************/ + +/* HDA Command */ +#define HDA_CMD_VERB_MASK 0x000fffff +#define HDA_CMD_VERB_SHIFT 0 +#define HDA_CMD_NID_MASK 0x0ff00000 +#define HDA_CMD_NID_SHIFT 20 +#define HDA_CMD_CAD_MASK 0xf0000000 +#define HDA_CMD_CAD_SHIFT 28 + +#define HDA_CMD_VERB_4BIT_SHIFT 16 +#define HDA_CMD_VERB_12BIT_SHIFT 8 + +#define HDA_CMD_VERB_4BIT(verb, payload) \ + (((verb) << HDA_CMD_VERB_4BIT_SHIFT) | (payload)) +#define HDA_CMD_4BIT(cad, nid, verb, payload) \ + (((cad) << HDA_CMD_CAD_SHIFT) | \ + ((nid) << HDA_CMD_NID_SHIFT) | \ + (HDA_CMD_VERB_4BIT((verb), (payload)))) + +#define HDA_CMD_VERB_12BIT(verb, payload) \ + (((verb) << HDA_CMD_VERB_12BIT_SHIFT) | (payload)) +#define HDA_CMD_12BIT(cad, nid, verb, payload) \ + (((cad) << HDA_CMD_CAD_SHIFT) | \ + ((nid) << HDA_CMD_NID_SHIFT) | \ + (HDA_CMD_VERB_12BIT((verb), (payload)))) + +/* Get Parameter */ +#define HDA_CMD_VERB_GET_PARAMETER 0xf00 + +#define HDA_CMD_GET_PARAMETER(cad, nid, payload) \ + (HDA_CMD_12BIT((cad), (nid), \ + HDA_CMD_VERB_GET_PARAMETER, (payload))) + +/* Connection Select Control */ +#define HDA_CMD_VERB_GET_CONN_SELECT_CONTROL 0xf01 +#define HDA_CMD_VERB_SET_CONN_SELECT_CONTROL 0x701 + +#define HDA_CMD_GET_CONN_SELECT_CONTROL(cad, nid) \ + (HDA_CMD_12BIT((cad), (nid), \ + HDA_CMD_VERB_GET_CONN_SELECT_CONTROL, 0x0)) +#define HDA_CMD_SET_CONNECTION_SELECT_CONTROL(cad, nid, payload) \ + (HDA_CMD_12BIT((cad), (nid), \ + HDA_CMD_VERB_SET_CONN_SELECT_CONTROL, (payload))) + +/* Connection List Entry */ +#define HDA_CMD_VERB_GET_CONN_LIST_ENTRY 0xf02 + +#define HDA_CMD_GET_CONN_LIST_ENTRY(cad, nid, payload) \ + (HDA_CMD_12BIT((cad), (nid), \ + HDA_CMD_VERB_GET_CONN_LIST_ENTRY, (payload))) + +#define HDA_CMD_GET_CONN_LIST_ENTRY_SIZE_SHORT 1 +#define HDA_CMD_GET_CONN_LIST_ENTRY_SIZE_LONG 2 + +/* Processing State */ +#define HDA_CMD_VERB_GET_PROCESSING_STATE 0xf03 +#define HDA_CMD_VERB_SET_PROCESSING_STATE 0x703 + +#define HDA_CMD_GET_PROCESSING_STATE(cad, nid) \ + (HDA_CMD_12BIT((cad), (nid), \ + HDA_CMD_VERB_GET_PROCESSING_STATE, 0x0)) +#define HDA_CMD_SET_PROCESSING_STATE(cad, nid, payload) \ + (HDA_CMD_12BIT((cad), (nid), \ + HDA_CMD_VERB_SET_PROCESSING_STATE, (payload))) + +#define HDA_CMD_GET_PROCESSING_STATE_STATE_OFF 0x00 +#define HDA_CMD_GET_PROCESSING_STATE_STATE_ON 0x01 +#define HDA_CMD_GET_PROCESSING_STATE_STATE_BENIGN 0x02 + +/* Coefficient Index */ +#define HDA_CMD_VERB_GET_COEFF_INDEX 0xd +#define HDA_CMD_VERB_SET_COEFF_INDEX 0x5 + +#define HDA_CMD_GET_COEFF_INDEX(cad, nid) \ + (HDA_CMD_4BIT((cad), (nid), \ + HDA_CMD_VERB_GET_COEFF_INDEX, 0x0)) +#define HDA_CMD_SET_COEFF_INDEX(cad, nid, payload) \ + (HDA_CMD_4BIT((cad), (nid), \ + HDA_CMD_VERB_SET_COEFF_INDEX, (payload))) + +/* Processing Coefficient */ +#define HDA_CMD_VERB_GET_PROCESSING_COEFF 0xc +#define HDA_CMD_VERB_SET_PROCESSING_COEFF 0x4 + +#define HDA_CMD_GET_PROCESSING_COEFF(cad, nid) \ + (HDA_CMD_4BIT((cad), (nid), \ + HDA_CMD_VERB_GET_PROCESSING_COEFF, 0x0)) +#define HDA_CMD_SET_PROCESSING_COEFF(cad, nid, payload) \ + (HDA_CMD_4BIT((cad), (nid), \ + HDA_CMD_VERB_SET_PROCESSING_COEFF, (payload))) + +/* Amplifier Gain/Mute */ +#define HDA_CMD_VERB_GET_AMP_GAIN_MUTE 0xb +#define HDA_CMD_VERB_SET_AMP_GAIN_MUTE 0x3 + +#define HDA_CMD_GET_AMP_GAIN_MUTE(cad, nid, payload) \ + (HDA_CMD_4BIT((cad), (nid), \ + HDA_CMD_VERB_GET_AMP_GAIN_MUTE, (payload))) +#define HDA_CMD_SET_AMP_GAIN_MUTE(cad, nid, payload) \ + (HDA_CMD_4BIT((cad), (nid), \ + HDA_CMD_VERB_SET_AMP_GAIN_MUTE, (payload))) + +#define HDA_CMD_GET_AMP_GAIN_MUTE_INPUT 0x0000 +#define HDA_CMD_GET_AMP_GAIN_MUTE_OUTPUT 0x8000 +#define HDA_CMD_GET_AMP_GAIN_MUTE_RIGHT 0x0000 +#define HDA_CMD_GET_AMP_GAIN_MUTE_LEFT 0x2000 + +#define HDA_CMD_GET_AMP_GAIN_MUTE_MUTE_MASK 0x00000008 +#define HDA_CMD_GET_AMP_GAIN_MUTE_MUTE_SHIFT 7 +#define HDA_CMD_GET_AMP_GAIN_MUTE_GAIN_MASK 0x00000007 +#define HDA_CMD_GET_AMP_GAIN_MUTE_GAIN_SHIFT 0 + +#define HDA_CMD_GET_AMP_GAIN_MUTE_MUTE(rsp) \ + (((rsp) & HDA_CMD_GET_AMP_GAIN_MUTE_MUTE_MASK) >> \ + HDA_CMD_GET_AMP_GAIN_MUTE_MUTE_SHIFT) +#define HDA_CMD_GET_AMP_GAIN_MUTE_GAIN(rsp) \ + (((rsp) & HDA_CMD_GET_AMP_GAIN_MUTE_GAIN_MASK) >> \ + HDA_CMD_GET_AMP_GAIN_MUTE_GAIN_SHIFT) + +#define HDA_CMD_SET_AMP_GAIN_MUTE_OUTPUT 0x8000 +#define HDA_CMD_SET_AMP_GAIN_MUTE_INPUT 0x4000 +#define HDA_CMD_SET_AMP_GAIN_MUTE_LEFT 0x2000 +#define HDA_CMD_SET_AMP_GAIN_MUTE_RIGHT 0x1000 +#define HDA_CMD_SET_AMP_GAIN_MUTE_INDEX_MASK 0x0f00 +#define HDA_CMD_SET_AMP_GAIN_MUTE_INDEX_SHIFT 8 +#define HDA_CMD_SET_AMP_GAIN_MUTE_MUTE 0x0080 +#define HDA_CMD_SET_AMP_GAIN_MUTE_GAIN_MASK 0x0007 +#define HDA_CMD_SET_AMP_GAIN_MUTE_GAIN_SHIFT 0 + +#define HDA_CMD_SET_AMP_GAIN_MUTE_INDEX(index) \ + (((index) << HDA_CMD_SET_AMP_GAIN_MUTE_INDEX_SHIFT) & \ + HDA_CMD_SET_AMP_GAIN_MUTE_INDEX_MASK) +#define HDA_CMD_SET_AMP_GAIN_MUTE_GAIN(index) \ + (((index) << HDA_CMD_SET_AMP_GAIN_MUTE_GAIN_SHIFT) & \ + HDA_CMD_SET_AMP_GAIN_MUTE_GAIN_MASK) + +/* Converter format */ +#define HDA_CMD_VERB_GET_CONV_FMT 0xa +#define HDA_CMD_VERB_SET_CONV_FMT 0x2 + +#define HDA_CMD_GET_CONV_FMT(cad, nid) \ + (HDA_CMD_4BIT((cad), (nid), \ + HDA_CMD_VERB_GET_CONV_FMT, 0x0)) +#define HDA_CMD_SET_CONV_FMT(cad, nid, payload) \ + (HDA_CMD_4BIT((cad), (nid), \ + HDA_CMD_VERB_SET_CONV_FMT, (payload))) + +/* Digital Converter Control */ +#define HDA_CMD_VERB_GET_DIGITAL_CONV_FMT1 0xf0d +#define HDA_CMD_VERB_GET_DIGITAL_CONV_FMT2 0xf0e +#define HDA_CMD_VERB_SET_DIGITAL_CONV_FMT1 0x70d +#define HDA_CMD_VERB_SET_DIGITAL_CONV_FMT2 0x70e + +#define HDA_CMD_GET_DIGITAL_CONV_FMT(cad, nid) \ + (HDA_CMD_12BIT((cad), (nid), \ + HDA_CMD_VERB_GET_DIGITAL_CONV_FMT1, 0x0)) +#define HDA_CMD_SET_DIGITAL_CONV_FMT1(cad, nid, payload) \ + (HDA_CMD_12BIT((cad), (nid), \ + HDA_CMD_VERB_SET_DIGITAL_CONV_FMT1, (payload))) +#define HDA_CMD_SET_DIGITAL_CONV_FMT2(cad, nid, payload) \ + (HDA_CMD_12BIT((cad), (nid), \ + HDA_CMD_VERB_SET_DIGITAL_CONV_FMT2, (payload))) + +#define HDA_CMD_GET_DIGITAL_CONV_FMT_CC_MASK 0x7f00 +#define HDA_CMD_GET_DIGITAL_CONV_FMT_CC_SHIFT 8 +#define HDA_CMD_GET_DIGITAL_CONV_FMT_L_MASK 0x0080 +#define HDA_CMD_GET_DIGITAL_CONV_FMT_L_SHIFT 7 +#define HDA_CMD_GET_DIGITAL_CONV_FMT_PRO_MASK 0x0040 +#define HDA_CMD_GET_DIGITAL_CONV_FMT_PRO_SHIFT 6 +#define HDA_CMD_GET_DIGITAL_CONV_FMT_NAUDIO_MASK 0x0020 +#define HDA_CMD_GET_DIGITAL_CONV_FMT_NAUDIO_SHIFT 5 +#define HDA_CMD_GET_DIGITAL_CONV_FMT_COPY_MASK 0x0010 +#define HDA_CMD_GET_DIGITAL_CONV_FMT_COPY_SHIFT 4 +#define HDA_CMD_GET_DIGITAL_CONV_FMT_PRE_MASK 0x0008 +#define HDA_CMD_GET_DIGITAL_CONV_FMT_PRE_SHIFT 3 +#define HDA_CMD_GET_DIGITAL_CONV_FMT_VCFG_MASK 0x0004 +#define HDA_CMD_GET_DIGITAL_CONV_FMT_VCFG_SHIFT 2 +#define HDA_CMD_GET_DIGITAL_CONV_FMT_V_MASK 0x0002 +#define HDA_CMD_GET_DIGITAL_CONV_FMT_V_SHIFT 1 +#define HDA_CMD_GET_DIGITAL_CONV_FMT_DIGEN_MASK 0x0001 +#define HDA_CMD_GET_DIGITAL_CONV_FMT_DIGEN_SHIFT 0 + +#define HDA_CMD_GET_DIGITAL_CONV_FMT_CC(rsp) \ + (((rsp) & HDA_CMD_GET_DIGITAL_CONV_FMT_CC_MASK) >> \ + HDA_CMD_GET_DIGITAL_CONV_FMT_CC_SHIFT) +#define HDA_CMD_GET_DIGITAL_CONV_FMT_L(rsp) \ + (((rsp) & HDA_CMD_GET_DIGITAL_CONV_FMT_L_MASK) >> \ + HDA_CMD_GET_DIGITAL_CONV_FMT_L_SHIFT) +#define HDA_CMD_GET_DIGITAL_CONV_FMT_PRO(rsp) \ + (((rsp) & HDA_CMD_GET_DIGITAL_CONV_FMT_PRO_MASK) >> \ + HDA_CMD_GET_DIGITAL_CONV_FMT_PRO_SHIFT) +#define HDA_CMD_GET_DIGITAL_CONV_FMT_NAUDIO(rsp) \ + (((rsp) & HDA_CMD_GET_DIGITAL_CONV_FMT_NAUDIO_MASK) >> \ + HDA_CMD_GET_DIGITAL_CONV_FMT_NAUDIO_SHIFT) +#define HDA_CMD_GET_DIGITAL_CONV_FMT_COPY(rsp) \ + (((rsp) & HDA_CMD_GET_DIGITAL_CONV_FMT_COPY_MASK) >> \ + HDA_CMD_GET_DIGITAL_CONV_FMT_COPY_SHIFT) +#define HDA_CMD_GET_DIGITAL_CONV_FMT_PRE(rsp) \ + (((rsp) & HDA_CMD_GET_DIGITAL_CONV_FMT_PRE_MASK) >> \ + HDA_CMD_GET_DIGITAL_CONV_FMT_PRE_SHIFT) +#define HDA_CMD_GET_DIGITAL_CONV_FMT_VCFG(rsp) \ + (((rsp) & HDA_CMD_GET_DIGITAL_CONV_FMT_VCFG_MASK) >> \ + HDA_CMD_GET_DIGITAL_CONV_FMT_VCFG_SHIFT) +#define HDA_CMD_GET_DIGITAL_CONV_FMT_V(rsp) \ + (((rsp) & HDA_CMD_GET_DIGITAL_CONV_FMT_V_MASK) >> \ + HDA_CMD_GET_DIGITAL_CONV_FMT_V_SHIFT) +#define HDA_CMD_GET_DIGITAL_CONV_FMT_DIGEN(rsp) \ + (((rsp) & HDA_CMD_GET_DIGITAL_CONV_FMT_DIGEN_MASK) >> \ + HDA_CMD_GET_DIGITAL_CONV_FMT_DIGEN_SHIFT) + +#define HDA_CMD_SET_DIGITAL_CONV_FMT1_L 0x80 +#define HDA_CMD_SET_DIGITAL_CONV_FMT1_PRO 0x40 +#define HDA_CMD_SET_DIGITAL_CONV_FMT1_NAUDIO 0x20 +#define HDA_CMD_SET_DIGITAL_CONV_FMT1_COPY 0x10 +#define HDA_CMD_SET_DIGITAL_CONV_FMT1_PRE 0x08 +#define HDA_CMD_SET_DIGITAL_CONV_FMT1_VCFG 0x04 +#define HDA_CMD_SET_DIGITAL_CONV_FMT1_V 0x02 +#define HDA_CMD_SET_DIGITAL_CONV_FMT1_DIGEN 0x01 + +/* Power State */ +#define HDA_CMD_VERB_GET_POWER_STATE 0xf05 +#define HDA_CMD_VERB_SET_POWER_STATE 0x705 + +#define HDA_CMD_GET_POWER_STATE(cad, nid) \ + (HDA_CMD_12BIT((cad), (nid), \ + HDA_CMD_VERB_GET_POWER_STATE, 0x0)) +#define HDA_CMD_SET_POWER_STATE(cad, nid, payload) \ + (HDA_CMD_12BIT((cad), (nid), \ + HDA_CMD_VERB_SET_POWER_STATE, (payload))) + +#define HDA_CMD_POWER_STATE_D0 0x00 +#define HDA_CMD_POWER_STATE_D1 0x01 +#define HDA_CMD_POWER_STATE_D2 0x02 +#define HDA_CMD_POWER_STATE_D3 0x03 + +#define HDA_CMD_POWER_STATE_ACT_MASK 0x000000f0 +#define HDA_CMD_POWER_STATE_ACT_SHIFT 4 +#define HDA_CMD_POWER_STATE_SET_MASK 0x0000000f +#define HDA_CMD_POWER_STATE_SET_SHIFT 0 + +#define HDA_CMD_GET_POWER_STATE_ACT(rsp) \ + (((rsp) & HDA_CMD_POWER_STATE_ACT_MASK) >> \ + HDA_CMD_POWER_STATE_ACT_SHIFT) +#define HDA_CMD_GET_POWER_STATE_SET(rsp) \ + (((rsp) & HDA_CMD_POWER_STATE_SET_MASK) >> \ + HDA_CMD_POWER_STATE_SET_SHIFT) + +#define HDA_CMD_SET_POWER_STATE_ACT(ps) \ + (((ps) << HDA_CMD_POWER_STATE_ACT_SHIFT) & \ + HDA_CMD_POWER_STATE_ACT_MASK) +#define HDA_CMD_SET_POWER_STATE_SET(ps) \ + (((ps) << HDA_CMD_POWER_STATE_SET_SHIFT) & \ + HDA_CMD_POWER_STATE_ACT_MASK) + +/* Converter Stream, Channel */ +#define HDA_CMD_VERB_GET_CONV_STREAM_CHAN 0xf06 +#define HDA_CMD_VERB_SET_CONV_STREAM_CHAN 0x706 + +#define HDA_CMD_GET_CONV_STREAM_CHAN(cad, nid) \ + (HDA_CMD_12BIT((cad), (nid), \ + HDA_CMD_VERB_GET_CONV_STREAM_CHAN, 0x0)) +#define HDA_CMD_SET_CONV_STREAM_CHAN(cad, nid, payload) \ + (HDA_CMD_12BIT((cad), (nid), \ + HDA_CMD_VERB_SET_CONV_STREAM_CHAN, (payload))) + +#define HDA_CMD_CONV_STREAM_CHAN_STREAM_MASK 0x000000f0 +#define HDA_CMD_CONV_STREAM_CHAN_STREAM_SHIFT 4 +#define HDA_CMD_CONV_STREAM_CHAN_CHAN_MASK 0x0000000f +#define HDA_CMD_CONV_STREAM_CHAN_CHAN_SHIFT 0 + +#define HDA_CMD_GET_CONV_STREAM_CHAN_STREAM(rsp) \ + (((rsp) & HDA_CMD_CONV_STREAM_CHAN_STREAM_MASK) >> \ + HDA_CMD_CONV_STREAM_CHAN_STREAM_SHIFT) +#define HDA_CMD_GET_CONV_STREAM_CHAN_CHAN(rsp) \ + (((rsp) & HDA_CMD_CONV_STREAM_CHAN_CHAN_MASK) >> \ + HDA_CMD_CONV_STREAM_CHAN_CHAN_SHIFT) + +#define HDA_CMD_SET_CONV_STREAM_CHAN_STREAM(param) \ + (((param) << HDA_CMD_CONV_STREAM_CHAN_STREAM_SHIFT) & \ + HDA_CMD_CONV_STREAM_CHAN_STREAM_MASK) +#define HDA_CMD_SET_CONV_STREAM_CHAN_CHAN(param) \ + (((param) << HDA_CMD_CONV_STREAM_CHAN_CHAN_SHIFT) & \ + HDA_CMD_CONV_STREAM_CHAN_CHAN_MASK) + +/* Input Converter SDI Select */ +#define HDA_CMD_VERB_GET_INPUT_CONVERTER_SDI_SELECT 0xf04 +#define HDA_CMD_VERB_SET_INPUT_CONVERTER_SDI_SELECT 0x704 + +#define HDA_CMD_GET_INPUT_CONVERTER_SDI_SELECT(cad, nid) \ + (HDA_CMD_12BIT((cad), (nid), \ + HDA_CMD_VERB_GET_INPUT_CONVERTER_SDI_SELECT, 0x0)) +#define HDA_CMD_SET_INPUT_CONVERTER_SDI_SELECT(cad, nid, payload) \ + (HDA_CMD_12BIT((cad), (nid), \ + HDA_CMD_VERB_SET_INPUT_CONVERTER_SDI_SELECT, (payload))) + +/* Pin Widget Control */ +#define HDA_CMD_VERB_GET_PIN_WIDGET_CTRL 0xf07 +#define HDA_CMD_VERB_SET_PIN_WIDGET_CTRL 0x707 + +#define HDA_CMD_GET_PIN_WIDGET_CTRL(cad, nid) \ + (HDA_CMD_12BIT((cad), (nid), \ + HDA_CMD_VERB_GET_PIN_WIDGET_CTRL, 0x0)) +#define HDA_CMD_SET_PIN_WIDGET_CTRL(cad, nid, payload) \ + (HDA_CMD_12BIT((cad), (nid), \ + HDA_CMD_VERB_SET_PIN_WIDGET_CTRL, (payload))) + +#define HDA_CMD_GET_PIN_WIDGET_CTRL_HPHN_ENABLE_MASK 0x00000080 +#define HDA_CMD_GET_PIN_WIDGET_CTRL_HPHN_ENABLE_SHIFT 7 +#define HDA_CMD_GET_PIN_WIDGET_CTRL_OUT_ENABLE_MASK 0x00000040 +#define HDA_CMD_GET_PIN_WIDGET_CTRL_OUT_ENABLE_SHIFT 6 +#define HDA_CMD_GET_PIN_WIDGET_CTRL_IN_ENABLE_MASK 0x00000020 +#define HDA_CMD_GET_PIN_WIDGET_CTRL_IN_ENABLE_SHIFT 5 +#define HDA_CMD_GET_PIN_WIDGET_CTRL_VREF_ENABLE_MASK 0x00000007 +#define HDA_CMD_GET_PIN_WIDGET_CTRL_VREF_ENABLE_SHIFT 0 + +#define HDA_CMD_GET_PIN_WIDGET_CTRL_HPHN_ENABLE(rsp) \ + (((rsp) & HDA_CMD_GET_PIN_WIDGET_CTRL_HPHN_ENABLE_MASK) >> \ + HDA_CMD_GET_PIN_WIDGET_CTRL_HPHN_ENABLE_SHIFT) +#define HDA_CMD_GET_PIN_WIDGET_CTRL_OUT_ENABLE(rsp) \ + (((rsp) & HDA_CMD_GET_PIN_WIDGET_CTRL_OUT_ENABLE_MASK) >> \ + HDA_GET_CMD_PIN_WIDGET_CTRL_OUT_ENABLE_SHIFT) +#define HDA_CMD_GET_PIN_WIDGET_CTRL_IN_ENABLE(rsp) \ + (((rsp) & HDA_CMD_GET_PIN_WIDGET_CTRL_IN_ENABLE_MASK) >> \ + HDA_CMD_GET_PIN_WIDGET_CTRL_IN_ENABLE_SHIFT) +#define HDA_CMD_GET_PIN_WIDGET_CTRL_VREF_ENABLE(rsp) \ + (((rsp) & HDA_CMD_GET_PIN_WIDGET_CTRL_VREF_ENABLE_MASK) >> \ + HDA_CMD_GET_PIN_WIDGET_CTRL_VREF_ENABLE_SHIFT) + +#define HDA_CMD_SET_PIN_WIDGET_CTRL_HPHN_ENABLE 0x80 +#define HDA_CMD_SET_PIN_WIDGET_CTRL_OUT_ENABLE 0x40 +#define HDA_CMD_SET_PIN_WIDGET_CTRL_IN_ENABLE 0x20 +#define HDA_CMD_SET_PIN_WIDGET_CTRL_VREF_ENABLE_MASK 0x07 +#define HDA_CMD_SET_PIN_WIDGET_CTRL_VREF_ENABLE_SHIFT 0 + +#define HDA_CMD_SET_PIN_WIDGET_CTRL_VREF_ENABLE(param) \ + (((param) << HDA_CMD_SET_PIN_WIDGET_CTRL_VREF_ENABLE_SHIFT) & \ + HDA_CMD_SET_PIN_WIDGET_CTRL_VREF_ENABLE_MASK) + +#define HDA_CMD_PIN_WIDGET_CTRL_VREF_ENABLE_HIZ 0 +#define HDA_CMD_PIN_WIDGET_CTRL_VREF_ENABLE_50 1 +#define HDA_CMD_PIN_WIDGET_CTRL_VREF_ENABLE_GROUND 2 +#define HDA_CMD_PIN_WIDGET_CTRL_VREF_ENABLE_80 4 +#define HDA_CMD_PIN_WIDGET_CTRL_VREF_ENABLE_100 5 + +/* Unsolicited Response */ +#define HDA_CMD_VERB_GET_UNSOLICITED_RESPONSE 0xf08 +#define HDA_CMD_VERB_SET_UNSOLICITED_RESPONSE 0x708 + +#define HDA_CMD_GET_UNSOLICITED_RESPONSE(cad, nid) \ + (HDA_CMD_12BIT((cad), (nid), \ + HDA_CMD_VERB_GET_UNSOLICITED_RESPONSE, 0x0)) +#define HDA_CMD_SET_UNSOLICITED_RESPONSE(cad, nid, payload) \ + (HDA_CMD_12BIT((cad), (nid), \ + HDA_CMD_VERB_SET_UNSOLICITED_RESPONSE, (payload))) + +#define HDA_CMD_GET_UNSOLICITED_RESPONSE_ENABLE_MASK 0x00000080 +#define HDA_CMD_GET_UNSOLICITED_RESPONSE_ENABLE_SHIFT 7 +#define HDA_CMD_GET_UNSOLICITED_RESPONSE_TAG_MASK 0x0000001f +#define HDA_CMD_GET_UNSOLICITED_RESPONSE_TAG_SHIFT 0 + +#define HDA_CMD_GET_UNSOLICITED_RESPONSE_ENABLE(rsp) \ + (((rsp) & HDA_CMD_GET_UNSOLICITED_RESPONSE_ENABLE_MASK) >> \ + HDA_CMD_GET_UNSOLICITED_RESPONSE_ENABLE_SHIFT) +#define HDA_CMD_GET_UNSOLICITED_RESPONSE_TAG(rsp) \ + (((rsp) & HDA_CMD_GET_UNSOLICITED_RESPONSE_TAG_MASK) >> \ + HDA_CMD_GET_UNSOLICITED_RESPONSE_TAG_SHIFT) + +#define HDA_CMD_SET_UNSOLICITED_RESPONSE_ENABLE 0x80 +#define HDA_CMD_SET_UNSOLICITED_RESPONSE_TAG_MASK 0x3f +#define HDA_CMD_SET_UNSOLICITED_RESPONSE_TAG_SHIFT 0 + +#define HDA_CMD_SET_UNSOLICITED_RESPONSE_TAG(param) \ + (((param) << HDA_CMD_SET_UNSOLICITED_RESPONSE_TAG_SHIFT) & \ + HDA_CMD_SET_UNSOLICITED_RESPONSE_TAG_MASK) + +/* Pin Sense */ +#define HDA_CMD_VERB_GET_PIN_SENSE 0xf09 +#define HDA_CMD_VERB_SET_PIN_SENSE 0x709 + +#define HDA_CMD_GET_PIN_SENSE(cad, nid) \ + (HDA_CMD_12BIT((cad), (nid), \ + HDA_CMD_VERB_GET_PIN_SENSE, 0x0)) +#define HDA_CMD_SET_PIN_SENSE(cad, nid, payload) \ + (HDA_CMD_12BIT((cad), (nid), \ + HDA_CMD_VERB_SET_PIN_SENSE, (payload))) + +#define HDA_CMD_GET_PIN_SENSE_PRESENCE_DETECT 0x80000000 +#define HDA_CMD_GET_PIN_SENSE_ELD_VALID 0x40000000 +#define HDA_CMD_GET_PIN_SENSE_IMP_SENSE_MASK 0x7fffffff +#define HDA_CMD_GET_PIN_SENSE_IMP_SENSE_SHIFT 0 + +#define HDA_CMD_GET_PIN_SENSE_IMP_SENSE(rsp) \ + (((rsp) & HDA_CMD_GET_PIN_SENSE_IMP_SENSE_MASK) >> \ + HDA_CMD_GET_PIN_SENSE_IMP_SENSE_SHIFT) + +#define HDA_CMD_GET_PIN_SENSE_IMP_SENSE_INVALID 0x7fffffff + +#define HDA_CMD_SET_PIN_SENSE_LEFT_CHANNEL 0x00 +#define HDA_CMD_SET_PIN_SENSE_RIGHT_CHANNEL 0x01 + +/* EAPD/BTL Enable */ +#define HDA_CMD_VERB_GET_EAPD_BTL_ENABLE 0xf0c +#define HDA_CMD_VERB_SET_EAPD_BTL_ENABLE 0x70c + +#define HDA_CMD_GET_EAPD_BTL_ENABLE(cad, nid) \ + (HDA_CMD_12BIT((cad), (nid), \ + HDA_CMD_VERB_GET_EAPD_BTL_ENABLE, 0x0)) +#define HDA_CMD_SET_EAPD_BTL_ENABLE(cad, nid, payload) \ + (HDA_CMD_12BIT((cad), (nid), \ + HDA_CMD_VERB_SET_EAPD_BTL_ENABLE, (payload))) + +#define HDA_CMD_GET_EAPD_BTL_ENABLE_LR_SWAP_MASK 0x00000004 +#define HDA_CMD_GET_EAPD_BTL_ENABLE_LR_SWAP_SHIFT 2 +#define HDA_CMD_GET_EAPD_BTL_ENABLE_EAPD_MASK 0x00000002 +#define HDA_CMD_GET_EAPD_BTL_ENABLE_EAPD_SHIFT 1 +#define HDA_CMD_GET_EAPD_BTL_ENABLE_BTL_MASK 0x00000001 +#define HDA_CMD_GET_EAPD_BTL_ENABLE_BTL_SHIFT 0 + +#define HDA_CMD_GET_EAPD_BTL_ENABLE_LR_SWAP(rsp) \ + (((rsp) & HDA_CMD_GET_EAPD_BTL_ENABLE_LR_SWAP_MASK) >> \ + HDA_CMD_GET_EAPD_BTL_ENABLE_LR_SWAP_SHIFT) +#define HDA_CMD_GET_EAPD_BTL_ENABLE_EAPD(rsp) \ + (((rsp) & HDA_CMD_GET_EAPD_BTL_ENABLE_EAPD_MASK) >> \ + HDA_CMD_GET_EAPD_BTL_ENABLE_EAPD_SHIFT) +#define HDA_CMD_GET_EAPD_BTL_ENABLE_BTL(rsp) \ + (((rsp) & HDA_CMD_GET_EAPD_BTL_ENABLE_BTL_MASK) >> \ + HDA_CMD_GET_EAPD_BTL_ENABLE_BTL_SHIFT) + +#define HDA_CMD_SET_EAPD_BTL_ENABLE_LR_SWAP 0x04 +#define HDA_CMD_SET_EAPD_BTL_ENABLE_EAPD 0x02 +#define HDA_CMD_SET_EAPD_BTL_ENABLE_BTL 0x01 + +/* GPI Data */ +#define HDA_CMD_VERB_GET_GPI_DATA 0xf10 +#define HDA_CMD_VERB_SET_GPI_DATA 0x710 + +#define HDA_CMD_GET_GPI_DATA(cad, nid) \ + (HDA_CMD_12BIT((cad), (nid), \ + HDA_CMD_VERB_GET_GPI_DATA, 0x0)) +#define HDA_CMD_SET_GPI_DATA(cad, nid) \ + (HDA_CMD_12BIT((cad), (nid), \ + HDA_CMD_VERB_SET_GPI_DATA, (payload))) + +/* GPI Wake Enable Mask */ +#define HDA_CMD_VERB_GET_GPI_WAKE_ENABLE_MASK 0xf11 +#define HDA_CMD_VERB_SET_GPI_WAKE_ENABLE_MASK 0x711 + +#define HDA_CMD_GET_GPI_WAKE_ENABLE_MASK(cad, nid) \ + (HDA_CMD_12BIT((cad), (nid), \ + HDA_CMD_VERB_GET_GPI_WAKE_ENABLE_MASK, 0x0)) +#define HDA_CMD_SET_GPI_WAKE_ENABLE_MASK(cad, nid, payload) \ + (HDA_CMD_12BIT((cad), (nid), \ + HDA_CMD_VERB_SET_GPI_WAKE_ENABLE_MASK, (payload))) + +/* GPI Unsolicited Enable Mask */ +#define HDA_CMD_VERB_GET_GPI_UNSOLICITED_ENABLE_MASK 0xf12 +#define HDA_CMD_VERB_SET_GPI_UNSOLICITED_ENABLE_MASK 0x712 + +#define HDA_CMD_GET_GPI_UNSOLICITED_ENABLE_MASK(cad, nid) \ + (HDA_CMD_12BIT((cad), (nid), \ + HDA_CMD_VERB_GET_GPI_UNSOLICITED_ENABLE_MASK, 0x0)) +#define HDA_CMD_SET_GPI_UNSOLICITED_ENABLE_MASK(cad, nid, payload) \ + (HDA_CMD_12BIT((cad), (nid), \ + HDA_CMD_VERB_SET_GPI_UNSOLICITED_ENABLE_MASK, (payload))) + +/* GPI Sticky Mask */ +#define HDA_CMD_VERB_GET_GPI_STICKY_MASK 0xf13 +#define HDA_CMD_VERB_SET_GPI_STICKY_MASK 0x713 + +#define HDA_CMD_GET_GPI_STICKY_MASK(cad, nid) \ + (HDA_CMD_12BIT((cad), (nid), \ + HDA_CMD_VERB_GET_GPI_STICKY_MASK, 0x0)) +#define HDA_CMD_SET_GPI_STICKY_MASK(cad, nid, payload) \ + (HDA_CMD_12BIT((cad), (nid), \ + HDA_CMD_VERB_SET_GPI_STICKY_MASK, (payload))) + +/* GPO Data */ +#define HDA_CMD_VERB_GET_GPO_DATA 0xf14 +#define HDA_CMD_VERB_SET_GPO_DATA 0x714 + +#define HDA_CMD_GET_GPO_DATA(cad, nid) \ + (HDA_CMD_12BIT((cad), (nid), \ + HDA_CMD_VERB_GET_GPO_DATA, 0x0)) +#define HDA_CMD_SET_GPO_DATA(cad, nid, payload) \ + (HDA_CMD_12BIT((cad), (nid), \ + HDA_CMD_VERB_SET_GPO_DATA, (payload))) + +/* GPIO Data */ +#define HDA_CMD_VERB_GET_GPIO_DATA 0xf15 +#define HDA_CMD_VERB_SET_GPIO_DATA 0x715 + +#define HDA_CMD_GET_GPIO_DATA(cad, nid) \ + (HDA_CMD_12BIT((cad), (nid), \ + HDA_CMD_VERB_GET_GPIO_DATA, 0x0)) +#define HDA_CMD_SET_GPIO_DATA(cad, nid, payload) \ + (HDA_CMD_12BIT((cad), (nid), \ + HDA_CMD_VERB_SET_GPIO_DATA, (payload))) + +/* GPIO Enable Mask */ +#define HDA_CMD_VERB_GET_GPIO_ENABLE_MASK 0xf16 +#define HDA_CMD_VERB_SET_GPIO_ENABLE_MASK 0x716 + +#define HDA_CMD_GET_GPIO_ENABLE_MASK(cad, nid) \ + (HDA_CMD_12BIT((cad), (nid), \ + HDA_CMD_VERB_GET_GPIO_ENABLE_MASK, 0x0)) +#define HDA_CMD_SET_GPIO_ENABLE_MASK(cad, nid, payload) \ + (HDA_CMD_12BIT((cad), (nid), \ + HDA_CMD_VERB_SET_GPIO_ENABLE_MASK, (payload))) + +/* GPIO Direction */ +#define HDA_CMD_VERB_GET_GPIO_DIRECTION 0xf17 +#define HDA_CMD_VERB_SET_GPIO_DIRECTION 0x717 + +#define HDA_CMD_GET_GPIO_DIRECTION(cad, nid) \ + (HDA_CMD_12BIT((cad), (nid), \ + HDA_CMD_VERB_GET_GPIO_DIRECTION, 0x0)) +#define HDA_CMD_SET_GPIO_DIRECTION(cad, nid, payload) \ + (HDA_CMD_12BIT((cad), (nid), \ + HDA_CMD_VERB_SET_GPIO_DIRECTION, (payload))) + +/* GPIO Wake Enable Mask */ +#define HDA_CMD_VERB_GET_GPIO_WAKE_ENABLE_MASK 0xf18 +#define HDA_CMD_VERB_SET_GPIO_WAKE_ENABLE_MASK 0x718 + +#define HDA_CMD_GET_GPIO_WAKE_ENABLE_MASK(cad, nid) \ + (HDA_CMD_12BIT((cad), (nid), \ + HDA_CMD_VERB_GET_GPIO_WAKE_ENABLE_MASK, 0x0)) +#define HDA_CMD_SET_GPIO_WAKE_ENABLE_MASK(cad, nid, payload) \ + (HDA_CMD_12BIT((cad), (nid), \ + HDA_CMD_VERB_SET_GPIO_WAKE_ENABLE_MASK, (payload))) + +/* GPIO Unsolicited Enable Mask */ +#define HDA_CMD_VERB_GET_GPIO_UNSOLICITED_ENABLE_MASK 0xf19 +#define HDA_CMD_VERB_SET_GPIO_UNSOLICITED_ENABLE_MASK 0x719 + +#define HDA_CMD_GET_GPIO_UNSOLICITED_ENABLE_MASK(cad, nid) \ + (HDA_CMD_12BIT((cad), (nid), \ + HDA_CMD_VERB_GET_GPIO_UNSOLICITED_ENABLE_MASK, 0x0)) +#define HDA_CMD_SET_GPIO_UNSOLICITED_ENABLE_MASK(cad, nid, payload) \ + (HDA_CMD_12BIT((cad), (nid), \ + HDA_CMD_VERB_SET_GPIO_UNSOLICITED_ENABLE_MASK, (payload))) + +/* GPIO_STICKY_MASK */ +#define HDA_CMD_VERB_GET_GPIO_STICKY_MASK 0xf1a +#define HDA_CMD_VERB_SET_GPIO_STICKY_MASK 0x71a + +#define HDA_CMD_GET_GPIO_STICKY_MASK(cad, nid) \ + (HDA_CMD_12BIT((cad), (nid), \ + HDA_CMD_VERB_GET_GPIO_STICKY_MASK, 0x0)) +#define HDA_CMD_SET_GPIO_STICKY_MASK(cad, nid, payload) \ + (HDA_CMD_12BIT((cad), (nid), \ + HDA_CMD_VERB_SET_GPIO_STICKY_MASK, (payload))) + +/* Beep Generation */ +#define HDA_CMD_VERB_GET_BEEP_GENERATION 0xf0a +#define HDA_CMD_VERB_SET_BEEP_GENERATION 0x70a + +#define HDA_CMD_GET_BEEP_GENERATION(cad, nid) \ + (HDA_CMD_12BIT((cad), (nid), \ + HDA_CMD_VERB_GET_BEEP_GENERATION, 0x0)) +#define HDA_CMD_SET_BEEP_GENERATION(cad, nid, payload) \ + (HDA_CMD_12BIT((cad), (nid), \ + HDA_CMD_VERB_SET_BEEP_GENERATION, (payload))) + +/* Volume Knob */ +#define HDA_CMD_VERB_GET_VOLUME_KNOB 0xf0f +#define HDA_CMD_VERB_SET_VOLUME_KNOB 0x70f + +#define HDA_CMD_GET_VOLUME_KNOB(cad, nid) \ + (HDA_CMD_12BIT((cad), (nid), \ + HDA_CMD_VERB_GET_VOLUME_KNOB, 0x0)) +#define HDA_CMD_SET_VOLUME_KNOB(cad, nid, payload) \ + (HDA_CMD_12BIT((cad), (nid), \ + HDA_CMD_VERB_SET_VOLUME_KNOB, (payload))) + +/* Subsystem ID */ +#define HDA_CMD_VERB_GET_SUBSYSTEM_ID 0xf20 +#define HDA_CMD_VERB_SET_SUSBYSTEM_ID1 0x720 +#define HDA_CMD_VERB_SET_SUBSYSTEM_ID2 0x721 +#define HDA_CMD_VERB_SET_SUBSYSTEM_ID3 0x722 +#define HDA_CMD_VERB_SET_SUBSYSTEM_ID4 0x723 + +#define HDA_CMD_GET_SUBSYSTEM_ID(cad, nid) \ + (HDA_CMD_12BIT((cad), (nid), \ + HDA_CMD_VERB_GET_SUBSYSTEM_ID, 0x0)) +#define HDA_CMD_SET_SUBSYSTEM_ID1(cad, nid, payload) \ + (HDA_CMD_12BIT((cad), (nid), \ + HDA_CMD_VERB_SET_SUSBYSTEM_ID1, (payload))) +#define HDA_CMD_SET_SUBSYSTEM_ID2(cad, nid, payload) \ + (HDA_CMD_12BIT((cad), (nid), \ + HDA_CMD_VERB_SET_SUSBYSTEM_ID2, (payload))) +#define HDA_CMD_SET_SUBSYSTEM_ID3(cad, nid, payload) \ + (HDA_CMD_12BIT((cad), (nid), \ + HDA_CMD_VERB_SET_SUSBYSTEM_ID3, (payload))) +#define HDA_CMD_SET_SUBSYSTEM_ID4(cad, nid, payload) \ + (HDA_CMD_12BIT((cad), (nid), \ + HDA_CMD_VERB_SET_SUSBYSTEM_ID4, (payload))) + +/* Configuration Default */ +#define HDA_CMD_VERB_GET_CONFIGURATION_DEFAULT 0xf1c +#define HDA_CMD_VERB_SET_CONFIGURATION_DEFAULT1 0x71c +#define HDA_CMD_VERB_SET_CONFIGURATION_DEFAULT2 0x71d +#define HDA_CMD_VERB_SET_CONFIGURATION_DEFAULT3 0x71e +#define HDA_CMD_VERB_SET_CONFIGURATION_DEFAULT4 0x71f + +#define HDA_CMD_GET_CONFIGURATION_DEFAULT(cad, nid) \ + (HDA_CMD_12BIT((cad), (nid), \ + HDA_CMD_VERB_GET_CONFIGURATION_DEFAULT, 0x0)) +#define HDA_CMD_SET_CONFIGURATION_DEFAULT1(cad, nid, payload) \ + (HDA_CMD_12BIT((cad), (nid), \ + HDA_CMD_VERB_SET_CONFIGURATION_DEFAULT1, (payload))) +#define HDA_CMD_SET_CONFIGURATION_DEFAULT2(cad, nid, payload) \ + (HDA_CMD_12BIT((cad), (nid), \ + HDA_CMD_VERB_SET_CONFIGURATION_DEFAULT2, (payload))) +#define HDA_CMD_SET_CONFIGURATION_DEFAULT3(cad, nid, payload) \ + (HDA_CMD_12BIT((cad), (nid), \ + HDA_CMD_VERB_SET_CONFIGURATION_DEFAULT3, (payload))) +#define HDA_CMD_SET_CONFIGURATION_DEFAULT4(cad, nid, payload) \ + (HDA_CMD_12BIT((cad), (nid), \ + HDA_CMD_VERB_SET_CONFIGURATION_DEFAULT4, (payload))) + +/* Stripe Control */ +#define HDA_CMD_VERB_GET_STRIPE_CONTROL 0xf24 +#define HDA_CMD_VERB_SET_STRIPE_CONTROL 0x724 + +#define HDA_CMD_GET_STRIPE_CONTROL(cad, nid) \ + (HDA_CMD_12BIT((cad), (nid), \ + HDA_CMD_VERB_GET_STRIPE_CONTROL, 0x0)) +#define HDA_CMD_SET_STRIPE_CONTROL(cad, nid, payload) \ + (HDA_CMD_12BIT((cad), (nid), \ + HDA_CMD_VERB_SET_STRIPE_CONTROL, (payload))) + +/* Channel Count Control */ +#define HDA_CMD_VERB_GET_CONV_CHAN_COUNT 0xf2d +#define HDA_CMD_VERB_SET_CONV_CHAN_COUNT 0x72d + +#define HDA_CMD_GET_CONV_CHAN_COUNT(cad, nid) \ + (HDA_CMD_12BIT((cad), (nid), \ + HDA_CMD_VERB_GET_CONV_CHAN_COUNT, 0x0)) +#define HDA_CMD_SET_CONV_CHAN_COUNT(cad, nid, payload) \ + (HDA_CMD_12BIT((cad), (nid), \ + HDA_CMD_VERB_SET_CONV_CHAN_COUNT, (payload))) + +#define HDA_CMD_VERB_GET_HDMI_DIP_SIZE 0xf2e + +#define HDA_CMD_GET_HDMI_DIP_SIZE(cad, nid, arg) \ + (HDA_CMD_12BIT((cad), (nid), \ + HDA_CMD_VERB_GET_HDMI_DIP_SIZE, (arg))) + +#define HDA_CMD_VERB_GET_HDMI_ELDD 0xf2f + +#define HDA_CMD_GET_HDMI_ELDD(cad, nid, off) \ + (HDA_CMD_12BIT((cad), (nid), \ + HDA_CMD_VERB_GET_HDMI_ELDD, (off))) + +#define HDA_CMD_VERB_GET_HDMI_DIP_INDEX 0xf30 +#define HDA_CMD_VERB_SET_HDMI_DIP_INDEX 0x730 + +#define HDA_CMD_GET_HDMI_DIP_INDEX(cad, nid) \ + (HDA_CMD_12BIT((cad), (nid), \ + HDA_CMD_VERB_GET_HDMI_DIP_INDEX, 0x0)) +#define HDA_CMD_SET_HDMI_DIP_INDEX(cad, nid, payload) \ + (HDA_CMD_12BIT((cad), (nid), \ + HDA_CMD_VERB_SET_HDMI_DIP_INDEX, (payload))) + +#define HDA_CMD_VERB_GET_HDMI_DIP_DATA 0xf31 +#define HDA_CMD_VERB_SET_HDMI_DIP_DATA 0x731 + +#define HDA_CMD_GET_HDMI_DIP_DATA(cad, nid) \ + (HDA_CMD_12BIT((cad), (nid), \ + HDA_CMD_VERB_GET_HDMI_DIP_DATA, 0x0)) +#define HDA_CMD_SET_HDMI_DIP_DATA(cad, nid, payload) \ + (HDA_CMD_12BIT((cad), (nid), \ + HDA_CMD_VERB_SET_HDMI_DIP_DATA, (payload))) + +#define HDA_CMD_VERB_GET_HDMI_DIP_XMIT 0xf32 +#define HDA_CMD_VERB_SET_HDMI_DIP_XMIT 0x732 + +#define HDA_CMD_GET_HDMI_DIP_XMIT(cad, nid) \ + (HDA_CMD_12BIT((cad), (nid), \ + HDA_CMD_VERB_GET_HDMI_DIP_XMIT, 0x0)) +#define HDA_CMD_SET_HDMI_DIP_XMIT(cad, nid, payload) \ + (HDA_CMD_12BIT((cad), (nid), \ + HDA_CMD_VERB_SET_HDMI_DIP_XMIT, (payload))) + +#define HDA_CMD_VERB_GET_HDMI_CP_CTRL 0xf33 +#define HDA_CMD_VERB_SET_HDMI_CP_CTRL 0x733 + +#define HDA_CMD_VERB_GET_HDMI_CHAN_SLOT 0xf34 +#define HDA_CMD_VERB_SET_HDMI_CHAN_SLOT 0x734 + +#define HDA_CMD_GET_HDMI_CHAN_SLOT(cad, nid) \ + (HDA_CMD_12BIT((cad), (nid), \ + HDA_CMD_VERB_GET_HDMI_CHAN_SLOT, 0x0)) +#define HDA_CMD_SET_HDMI_CHAN_SLOT(cad, nid, payload) \ + (HDA_CMD_12BIT((cad), (nid), \ + HDA_CMD_VERB_SET_HDMI_CHAN_SLOT, (payload))) + +#define HDA_HDMI_CODING_TYPE_REF_STREAM_HEADER 0 +#define HDA_HDMI_CODING_TYPE_LPCM 1 +#define HDA_HDMI_CODING_TYPE_AC3 2 +#define HDA_HDMI_CODING_TYPE_MPEG1 3 +#define HDA_HDMI_CODING_TYPE_MP3 4 +#define HDA_HDMI_CODING_TYPE_MPEG2 5 +#define HDA_HDMI_CODING_TYPE_AACLC 6 +#define HDA_HDMI_CODING_TYPE_DTS 7 +#define HDA_HDMI_CODING_TYPE_ATRAC 8 +#define HDA_HDMI_CODING_TYPE_SACD 9 +#define HDA_HDMI_CODING_TYPE_EAC3 10 +#define HDA_HDMI_CODING_TYPE_DTS_HD 11 +#define HDA_HDMI_CODING_TYPE_MLP 12 +#define HDA_HDMI_CODING_TYPE_DST 13 +#define HDA_HDMI_CODING_TYPE_WMAPRO 14 +#define HDA_HDMI_CODING_TYPE_REF_CTX 15 + +/* Function Reset */ +#define HDA_CMD_VERB_FUNCTION_RESET 0x7ff + +#define HDA_CMD_FUNCTION_RESET(cad, nid) \ + (HDA_CMD_12BIT((cad), (nid), \ + HDA_CMD_VERB_FUNCTION_RESET, 0x0)) + + +/**************************************************************************** + * HDA Device Parameters + ****************************************************************************/ + +/* Vendor ID */ +#define HDA_PARAM_VENDOR_ID 0x00 + +#define HDA_PARAM_VENDOR_ID_VENDOR_ID_MASK 0xffff0000 +#define HDA_PARAM_VENDOR_ID_VENDOR_ID_SHIFT 16 +#define HDA_PARAM_VENDOR_ID_DEVICE_ID_MASK 0x0000ffff +#define HDA_PARAM_VENDOR_ID_DEVICE_ID_SHIFT 0 + +#define HDA_PARAM_VENDOR_ID_VENDOR_ID(param) \ + (((param) & HDA_PARAM_VENDOR_ID_VENDOR_ID_MASK) >> \ + HDA_PARAM_VENDOR_ID_VENDOR_ID_SHIFT) +#define HDA_PARAM_VENDOR_ID_DEVICE_ID(param) \ + (((param) & HDA_PARAM_VENDOR_ID_DEVICE_ID_MASK) >> \ + HDA_PARAM_VENDOR_ID_DEVICE_ID_SHIFT) + +/* Revision ID */ +#define HDA_PARAM_REVISION_ID 0x02 + +#define HDA_PARAM_REVISION_ID_MAJREV_MASK 0x00f00000 +#define HDA_PARAM_REVISION_ID_MAJREV_SHIFT 20 +#define HDA_PARAM_REVISION_ID_MINREV_MASK 0x000f0000 +#define HDA_PARAM_REVISION_ID_MINREV_SHIFT 16 +#define HDA_PARAM_REVISION_ID_REVISION_ID_MASK 0x0000ff00 +#define HDA_PARAM_REVISION_ID_REVISION_ID_SHIFT 8 +#define HDA_PARAM_REVISION_ID_STEPPING_ID_MASK 0x000000ff +#define HDA_PARAM_REVISION_ID_STEPPING_ID_SHIFT 0 + +#define HDA_PARAM_REVISION_ID_MAJREV(param) \ + (((param) & HDA_PARAM_REVISION_ID_MAJREV_MASK) >> \ + HDA_PARAM_REVISION_ID_MAJREV_SHIFT) +#define HDA_PARAM_REVISION_ID_MINREV(param) \ + (((param) & HDA_PARAM_REVISION_ID_MINREV_MASK) >> \ + HDA_PARAM_REVISION_ID_MINREV_SHIFT) +#define HDA_PARAM_REVISION_ID_REVISION_ID(param) \ + (((param) & HDA_PARAM_REVISION_ID_REVISION_ID_MASK) >> \ + HDA_PARAM_REVISION_ID_REVISION_ID_SHIFT) +#define HDA_PARAM_REVISION_ID_STEPPING_ID(param) \ + (((param) & HDA_PARAM_REVISION_ID_STEPPING_ID_MASK) >> \ + HDA_PARAM_REVISION_ID_STEPPING_ID_SHIFT) + +/* Subordinate Node Cound */ +#define HDA_PARAM_SUB_NODE_COUNT 0x04 + +#define HDA_PARAM_SUB_NODE_COUNT_START_MASK 0x00ff0000 +#define HDA_PARAM_SUB_NODE_COUNT_START_SHIFT 16 +#define HDA_PARAM_SUB_NODE_COUNT_TOTAL_MASK 0x000000ff +#define HDA_PARAM_SUB_NODE_COUNT_TOTAL_SHIFT 0 + +#define HDA_PARAM_SUB_NODE_COUNT_START(param) \ + (((param) & HDA_PARAM_SUB_NODE_COUNT_START_MASK) >> \ + HDA_PARAM_SUB_NODE_COUNT_START_SHIFT) +#define HDA_PARAM_SUB_NODE_COUNT_TOTAL(param) \ + (((param) & HDA_PARAM_SUB_NODE_COUNT_TOTAL_MASK) >> \ + HDA_PARAM_SUB_NODE_COUNT_TOTAL_SHIFT) + +/* Function Group Type */ +#define HDA_PARAM_FCT_GRP_TYPE 0x05 + +#define HDA_PARAM_FCT_GRP_TYPE_UNSOL_MASK 0x00000100 +#define HDA_PARAM_FCT_GRP_TYPE_UNSOL_SHIFT 8 +#define HDA_PARAM_FCT_GRP_TYPE_NODE_TYPE_MASK 0x000000ff +#define HDA_PARAM_FCT_GRP_TYPE_NODE_TYPE_SHIFT 0 + +#define HDA_PARAM_FCT_GRP_TYPE_UNSOL(param) \ + (((param) & HDA_PARAM_FCT_GRP_TYPE_UNSOL_MASK) >> \ + HDA_PARAM_FCT_GROUP_TYPE_UNSOL_SHIFT) +#define HDA_PARAM_FCT_GRP_TYPE_NODE_TYPE(param) \ + (((param) & HDA_PARAM_FCT_GRP_TYPE_NODE_TYPE_MASK) >> \ + HDA_PARAM_FCT_GRP_TYPE_NODE_TYPE_SHIFT) + +#define HDA_PARAM_FCT_GRP_TYPE_NODE_TYPE_AUDIO 0x01 +#define HDA_PARAM_FCT_GRP_TYPE_NODE_TYPE_MODEM 0x02 + +/* Audio Function Group Capabilities */ +#define HDA_PARAM_AUDIO_FCT_GRP_CAP 0x08 + +#define HDA_PARAM_AUDIO_FCT_GRP_CAP_BEEP_GEN_MASK 0x00010000 +#define HDA_PARAM_AUDIO_FCT_GRP_CAP_BEEP_GEN_SHIFT 16 +#define HDA_PARAM_AUDIO_FCT_GRP_CAP_INPUT_DELAY_MASK 0x00000f00 +#define HDA_PARAM_AUDIO_FCT_GRP_CAP_INPUT_DELAY_SHIFT 8 +#define HDA_PARAM_AUDIO_FCT_GRP_CAP_OUTPUT_DELAY_MASK 0x0000000f +#define HDA_PARAM_AUDIO_FCT_GRP_CAP_OUTPUT_DELAY_SHIFT 0 + +#define HDA_PARAM_AUDIO_FCT_GRP_CAP_BEEP_GEN(param) \ + (((param) & HDA_PARAM_AUDIO_FCT_GRP_CAP_BEEP_GEN_MASK) >> \ + HDA_PARAM_AUDIO_FCT_GRP_CAP_BEEP_GEN_SHIFT) +#define HDA_PARAM_AUDIO_FCT_GRP_CAP_INPUT_DELAY(param) \ + (((param) & HDA_PARAM_AUDIO_FCT_GRP_CAP_INPUT_DELAY_MASK) >> \ + HDA_PARAM_AUDIO_FCT_GRP_CAP_INPUT_DELAY_SHIFT) +#define HDA_PARAM_AUDIO_FCT_GRP_CAP_OUTPUT_DELAY(param) \ + (((param) & HDA_PARAM_AUDIO_FCT_GRP_CAP_OUTPUT_DELAY_MASK) >> \ + HDA_PARAM_AUDIO_FCT_GRP_CAP_OUTPUT_DELAY_SHIFT) + +/* Audio Widget Capabilities */ +#define HDA_PARAM_AUDIO_WIDGET_CAP 0x09 + +#define HDA_PARAM_AUDIO_WIDGET_CAP_TYPE_MASK 0x00f00000 +#define HDA_PARAM_AUDIO_WIDGET_CAP_TYPE_SHIFT 20 +#define HDA_PARAM_AUDIO_WIDGET_CAP_DELAY_MASK 0x000f0000 +#define HDA_PARAM_AUDIO_WIDGET_CAP_DELAY_SHIFT 16 +#define HDA_PARAM_AUDIO_WIDGET_CAP_CC_EXT_MASK 0x0000e000 +#define HDA_PARAM_AUDIO_WIDGET_CAP_CC_EXT_SHIFT 13 +#define HDA_PARAM_AUDIO_WIDGET_CAP_CP_MASK 0x00001000 +#define HDA_PARAM_AUDIO_WIDGET_CAP_CP_SHIFT 12 +#define HDA_PARAM_AUDIO_WIDGET_CAP_LR_SWAP_MASK 0x00000800 +#define HDA_PARAM_AUDIO_WIDGET_CAP_LR_SWAP_SHIFT 11 +#define HDA_PARAM_AUDIO_WIDGET_CAP_POWER_CTRL_MASK 0x00000400 +#define HDA_PARAM_AUDIO_WIDGET_CAP_POWER_CTRL_SHIFT 10 +#define HDA_PARAM_AUDIO_WIDGET_CAP_DIGITAL_MASK 0x00000200 +#define HDA_PARAM_AUDIO_WIDGET_CAP_DIGITAL_SHIFT 9 +#define HDA_PARAM_AUDIO_WIDGET_CAP_CONN_LIST_MASK 0x00000100 +#define HDA_PARAM_AUDIO_WIDGET_CAP_CONN_LIST_SHIFT 8 +#define HDA_PARAM_AUDIO_WIDGET_CAP_UNSOL_CAP_MASK 0x00000080 +#define HDA_PARAM_AUDIO_WIDGET_CAP_UNSOL_CAP_SHIFT 7 +#define HDA_PARAM_AUDIO_WIDGET_CAP_PROC_WIDGET_MASK 0x00000040 +#define HDA_PARAM_AUDIO_WIDGET_CAP_PROC_WIDGET_SHIFT 6 +#define HDA_PARAM_AUDIO_WIDGET_CAP_STRIPE_MASK 0x00000020 +#define HDA_PARAM_AUDIO_WIDGET_CAP_STRIPE_SHIFT 5 +#define HDA_PARAM_AUDIO_WIDGET_CAP_FORMAT_OVR_MASK 0x00000010 +#define HDA_PARAM_AUDIO_WIDGET_CAP_FORMAT_OVR_SHIFT 4 +#define HDA_PARAM_AUDIO_WIDGET_CAP_AMP_OVR_MASK 0x00000008 +#define HDA_PARAM_AUDIO_WIDGET_CAP_AMP_OVR_SHIFT 3 +#define HDA_PARAM_AUDIO_WIDGET_CAP_OUT_AMP_MASK 0x00000004 +#define HDA_PARAM_AUDIO_WIDGET_CAP_OUT_AMP_SHIFT 2 +#define HDA_PARAM_AUDIO_WIDGET_CAP_IN_AMP_MASK 0x00000002 +#define HDA_PARAM_AUDIO_WIDGET_CAP_IN_AMP_SHIFT 1 +#define HDA_PARAM_AUDIO_WIDGET_CAP_STEREO_MASK 0x00000001 +#define HDA_PARAM_AUDIO_WIDGET_CAP_STEREO_SHIFT 0 + +#define HDA_PARAM_AUDIO_WIDGET_CAP_TYPE(param) \ + (((param) & HDA_PARAM_AUDIO_WIDGET_CAP_TYPE_MASK) >> \ + HDA_PARAM_AUDIO_WIDGET_CAP_TYPE_SHIFT) +#define HDA_PARAM_AUDIO_WIDGET_CAP_DELAY(param) \ + (((param) & HDA_PARAM_AUDIO_WIDGET_CAP_DELAY_MASK) >> \ + HDA_PARAM_AUDIO_WIDGET_CAP_DELAY_SHIFT) +#define HDA_PARAM_AUDIO_WIDGET_CAP_CC(param) \ + ((((param) & HDA_PARAM_AUDIO_WIDGET_CAP_CC_EXT_MASK) >> \ + (HDA_PARAM_AUDIO_WIDGET_CAP_CC_EXT_SHIFT - 1)) | \ + (((param) & HDA_PARAM_AUDIO_WIDGET_CAP_STEREO_MASK) >> \ + HDA_PARAM_AUDIO_WIDGET_CAP_STEREO_SHIFT)) +#define HDA_PARAM_AUDIO_WIDGET_CAP_CP(param) \ + (((param) & HDA_PARAM_AUDIO_WIDGET_CAP_CP_MASK) >> \ + HDA_PARAM_AUDIO_WIDGET_CAP_CP_SHIFT) +#define HDA_PARAM_AUDIO_WIDGET_CAP_LR_SWAP(param) \ + (((param) & HDA_PARAM_AUDIO_WIDGET_CAP_LR_SWAP_MASK) >> \ + HDA_PARAM_AUDIO_WIDGET_CAP_LR_SWAP_SHIFT) +#define HDA_PARAM_AUDIO_WIDGET_CAP_POWER_CTRL(param) \ + (((param) & HDA_PARAM_AUDIO_WIDGET_CAP_POWER_CTRL_MASK) >> \ + HDA_PARAM_AUDIO_WIDGET_CAP_POWER_CTRL_SHIFT) +#define HDA_PARAM_AUDIO_WIDGET_CAP_DIGITAL(param) \ + (((param) & HDA_PARAM_AUDIO_WIDGET_CAP_DIGITAL_MASK) >> \ + HDA_PARAM_AUDIO_WIDGET_CAP_DIGITAL_SHIFT) +#define HDA_PARAM_AUDIO_WIDGET_CAP_CONN_LIST(param) \ + (((param) & HDA_PARAM_AUDIO_WIDGET_CAP_CONN_LIST_MASK) >> \ + HDA_PARAM_AUDIO_WIDGET_CAP_CONN_LIST_SHIFT) +#define HDA_PARAM_AUDIO_WIDGET_CAP_UNSOL_CAP(param) \ + (((param) & HDA_PARAM_AUDIO_WIDGET_CAP_UNSOL_CAP_MASK) >> \ + HDA_PARAM_AUDIO_WIDGET_CAP_UNSOL_CAP_SHIFT) +#define HDA_PARAM_AUDIO_WIDGET_CAP_PROC_WIDGET(param) \ + (((param) & HDA_PARAM_AUDIO_WIDGET_CAP_PROC_WIDGET_MASK) >> \ + HDA_PARAM_AUDIO_WIDGET_CAP_PROC_WIDGET_SHIFT) +#define HDA_PARAM_AUDIO_WIDGET_CAP_STRIPE(param) \ + (((param) & HDA_PARAM_AUDIO_WIDGET_CAP_STRIPE_MASK) >> \ + HDA_PARAM_AUDIO_WIDGET_CAP_STRIPE_SHIFT) +#define HDA_PARAM_AUDIO_WIDGET_CAP_FORMAT_OVR(param) \ + (((param) & HDA_PARAM_AUDIO_WIDGET_CAP_FORMAT_OVR_MASK) >> \ + HDA_PARAM_AUDIO_WIDGET_CAP_FORMAT_OVR_SHIFT) +#define HDA_PARAM_AUDIO_WIDGET_CAP_AMP_OVR(param) \ + (((param) & HDA_PARAM_AUDIO_WIDGET_CAP_AMP_OVR_MASK) >> \ + HDA_PARAM_AUDIO_WIDGET_CAP_AMP_OVR_SHIFT) +#define HDA_PARAM_AUDIO_WIDGET_CAP_OUT_AMP(param) \ + (((param) & HDA_PARAM_AUDIO_WIDGET_CAP_OUT_AMP_MASK) >> \ + HDA_PARAM_AUDIO_WIDGET_CAP_OUT_AMP_SHIFT) +#define HDA_PARAM_AUDIO_WIDGET_CAP_IN_AMP(param) \ + (((param) & HDA_PARAM_AUDIO_WIDGET_CAP_IN_AMP_MASK) >> \ + HDA_PARAM_AUDIO_WIDGET_CAP_IN_AMP_SHIFT) +#define HDA_PARAM_AUDIO_WIDGET_CAP_STEREO(param) \ + (((param) & HDA_PARAM_AUDIO_WIDGET_CAP_STEREO_MASK) >> \ + HDA_PARAM_AUDIO_WIDGET_CAP_STEREO_SHIFT) + +#define HDA_PARAM_AUDIO_WIDGET_CAP_TYPE_AUDIO_OUTPUT 0x0 +#define HDA_PARAM_AUDIO_WIDGET_CAP_TYPE_AUDIO_INPUT 0x1 +#define HDA_PARAM_AUDIO_WIDGET_CAP_TYPE_AUDIO_MIXER 0x2 +#define HDA_PARAM_AUDIO_WIDGET_CAP_TYPE_AUDIO_SELECTOR 0x3 +#define HDA_PARAM_AUDIO_WIDGET_CAP_TYPE_PIN_COMPLEX 0x4 +#define HDA_PARAM_AUDIO_WIDGET_CAP_TYPE_POWER_WIDGET 0x5 +#define HDA_PARAM_AUDIO_WIDGET_CAP_TYPE_VOLUME_WIDGET 0x6 +#define HDA_PARAM_AUDIO_WIDGET_CAP_TYPE_BEEP_WIDGET 0x7 +#define HDA_PARAM_AUDIO_WIDGET_CAP_TYPE_VENDOR_WIDGET 0xf + +/* Supported PCM Size, Rates */ + +#define HDA_PARAM_SUPP_PCM_SIZE_RATE 0x0a + +#define HDA_PARAM_SUPP_PCM_SIZE_RATE_32BIT_MASK 0x00100000 +#define HDA_PARAM_SUPP_PCM_SIZE_RATE_32BIT_SHIFT 20 +#define HDA_PARAM_SUPP_PCM_SIZE_RATE_24BIT_MASK 0x00080000 +#define HDA_PARAM_SUPP_PCM_SIZE_RATE_24BIT_SHIFT 19 +#define HDA_PARAM_SUPP_PCM_SIZE_RATE_20BIT_MASK 0x00040000 +#define HDA_PARAM_SUPP_PCM_SIZE_RATE_20BIT_SHIFT 18 +#define HDA_PARAM_SUPP_PCM_SIZE_RATE_16BIT_MASK 0x00020000 +#define HDA_PARAM_SUPP_PCM_SIZE_RATE_16BIT_SHIFT 17 +#define HDA_PARAM_SUPP_PCM_SIZE_RATE_8BIT_MASK 0x00010000 +#define HDA_PARAM_SUPP_PCM_SIZE_RATE_8BIT_SHIFT 16 +#define HDA_PARAM_SUPP_PCM_SIZE_RATE_8KHZ_MASK 0x00000001 +#define HDA_PARAM_SUPP_PCM_SIZE_RATE_8KHZ_SHIFT 0 +#define HDA_PARAM_SUPP_PCM_SIZE_RATE_11KHZ_MASK 0x00000002 +#define HDA_PARAM_SUPP_PCM_SIZE_RATE_11KHZ_SHIFT 1 +#define HDA_PARAM_SUPP_PCM_SIZE_RATE_16KHZ_MASK 0x00000004 +#define HDA_PARAM_SUPP_PCM_SIZE_RATE_16KHZ_SHIFT 2 +#define HDA_PARAM_SUPP_PCM_SIZE_RATE_22KHZ_MASK 0x00000008 +#define HDA_PARAM_SUPP_PCM_SIZE_RATE_22KHZ_SHIFT 3 +#define HDA_PARAM_SUPP_PCM_SIZE_RATE_32KHZ_MASK 0x00000010 +#define HDA_PARAM_SUPP_PCM_SIZE_RATE_32KHZ_SHIFT 4 +#define HDA_PARAM_SUPP_PCM_SIZE_RATE_44KHZ_MASK 0x00000020 +#define HDA_PARAM_SUPP_PCM_SIZE_RATE_44KHZ_SHIFT 5 +#define HDA_PARAM_SUPP_PCM_SIZE_RATE_48KHZ_MASK 0x00000040 +#define HDA_PARAM_SUPP_PCM_SIZE_RATE_48KHZ_SHIFT 6 +#define HDA_PARAM_SUPP_PCM_SIZE_RATE_88KHZ_MASK 0x00000080 +#define HDA_PARAM_SUPP_PCM_SIZE_RATE_88KHZ_SHIFT 7 +#define HDA_PARAM_SUPP_PCM_SIZE_RATE_96KHZ_MASK 0x00000100 +#define HDA_PARAM_SUPP_PCM_SIZE_RATE_96KHZ_SHIFT 8 +#define HDA_PARAM_SUPP_PCM_SIZE_RATE_176KHZ_MASK 0x00000200 +#define HDA_PARAM_SUPP_PCM_SIZE_RATE_176KHZ_SHIFT 9 +#define HDA_PARAM_SUPP_PCM_SIZE_RATE_192KHZ_MASK 0x00000400 +#define HDA_PARAM_SUPP_PCM_SIZE_RATE_192KHZ_SHIFT 10 +#define HDA_PARAM_SUPP_PCM_SIZE_RATE_384KHZ_MASK 0x00000800 +#define HDA_PARAM_SUPP_PCM_SIZE_RATE_384KHZ_SHIFT 11 + +#define HDA_PARAM_SUPP_PCM_SIZE_RATE_32BIT(param) \ + (((param) & HDA_PARAM_SUPP_PCM_SIZE_RATE_32BIT_MASK) >> \ + HDA_PARAM_SUPP_PCM_SIZE_RATE_32BIT_SHIFT) +#define HDA_PARAM_SUPP_PCM_SIZE_RATE_24BIT(param) \ + (((param) & HDA_PARAM_SUPP_PCM_SIZE_RATE_24BIT_MASK) >> \ + HDA_PARAM_SUPP_PCM_SIZE_RATE_24BIT_SHIFT) +#define HDA_PARAM_SUPP_PCM_SIZE_RATE_20BIT(param) \ *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-soc-all@freebsd.org Sun May 29 17:08:37 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 6AFD7B53CF4 for ; Sun, 29 May 2016 17:08:37 +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 5EABE1493 for ; Sun, 29 May 2016 17:08:37 +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 u4TH8bWP017800 for ; Sun, 29 May 2016 17:08:37 GMT (envelope-from iateaca@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id u4TH8aP7017771 for svn-soc-all@FreeBSD.org; Sun, 29 May 2016 17:08:36 GMT (envelope-from iateaca@FreeBSD.org) Date: Sun, 29 May 2016 17:08:36 GMT Message-Id: <201605291708.u4TH8aP7017771@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: r304163 - 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, 29 May 2016 17:08:37 -0000 Author: iateaca Date: Sun May 29 17:08:35 2016 New Revision: 304163 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=304163 Log: implement the send_command in controller and .command handler in codec implement the .response handler in controller (RIRB); used by to codec to send responses M bhyve/hda_codec.c M bhyve/pci_hda.c M bhyve/pci_hda.h Modified: soc2016/iateaca/bhyve-hda-head/usr.sbin/bhyve/hda_codec.c soc2016/iateaca/bhyve-hda-head/usr.sbin/bhyve/pci_hda.c soc2016/iateaca/bhyve-hda-head/usr.sbin/bhyve/pci_hda.h Modified: soc2016/iateaca/bhyve-hda-head/usr.sbin/bhyve/hda_codec.c ============================================================================== --- soc2016/iateaca/bhyve-hda-head/usr.sbin/bhyve/hda_codec.c Sun May 29 16:39:28 2016 (r304162) +++ soc2016/iateaca/bhyve-hda-head/usr.sbin/bhyve/hda_codec.c Sun May 29 17:08:35 2016 (r304163) @@ -1,10 +1,25 @@ #include "pci_hda.h" +/* + * HDA Codec defines + */ +#define HDA_CODEC_RESPONSE_EX_UNSOL 0x10 +#define HDA_CODEC_RESPONSE_EX_SOL 0x00 + +/* + * HDA Codec module function declarations + */ static int hda_codec_init(struct hda_codec_inst *hci, const char *opts); static int hda_codec_reset(struct hda_codec_inst *hci); +static int +hda_codec_command(struct hda_codec_inst *hci, uint32_t cmd_data); + +/* + * HDA Codec module function definitions + */ static int hda_codec_init(struct hda_codec_inst *hci, const char *opts) @@ -26,15 +41,48 @@ DPRINTF("cad: 0x%x\n", hci->cad); - hops->signal(hci); + if (!hops->signal) { + DPRINTF("The controller ops does not implement the signal function\n"); + return -1; + } - return 0; + return hops->signal(hci); +} + +static int +hda_codec_command(struct hda_codec_inst *hci, uint32_t cmd_data) +{ + struct hda_ops *hops = NULL; + 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 + + assert(cad == hci->cad); + assert(hci); + + hops = hci->hops; + assert(hops); + + DPRINTF("cad: 0x%x nid: 0x%x verb: 0x%x payload: 0x%x\n", cad, nid, verb, payload); + + if (!hops->response) { + DPRINTF("The controller ops does not implement the response function\n"); + return -1; + } + + return hops->response(hci, 0, HDA_CODEC_RESPONSE_EX_SOL); } struct hda_codec_class hda_codec = { - .name = "hda_codec", - .init = hda_codec_init, - .reset = hda_codec_reset, + .name = "hda_codec", + .init = hda_codec_init, + .reset = hda_codec_reset, + .command = hda_codec_command, }; HDA_EMUL_SET(hda_codec); 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 29 16:39:28 2016 (r304162) +++ soc2016/iateaca/bhyve-hda-head/usr.sbin/bhyve/pci_hda.c Sun May 29 17:08:35 2016 (r304163) @@ -61,6 +61,8 @@ static struct hda_codec_class * hda_find_codec_class(const char *name); +static int +hda_send_command(struct hda_softc *sc, uint32_t verb); static void hda_reset(struct hda_softc *sc); static void @@ -102,6 +104,8 @@ static int hda_signal_state_change(struct hda_codec_inst *hci); +static int +hda_response(struct hda_codec_inst *hci, uint32_t response, uint8_t unsol); /* * PCI HDA function declarations @@ -159,6 +163,7 @@ static struct hda_ops hops = { .signal = hda_signal_state_change, + .response = hda_response, }; struct pci_devemu pci_de_hda = { @@ -246,7 +251,6 @@ hda_codec_constructor(struct hda_softc *sc, struct hda_codec_class *codec) { struct hda_codec_inst *hci = NULL; - int err; if (sc->codecs_no >= HDA_CODEC_MAX) return -1; @@ -262,10 +266,12 @@ sc->codecs[sc->codecs_no++] = hci; - err = codec->init(hci, NULL); - assert(!err); + if (!codec->init) { + DPRINTF("This codec does not implement the init function\n"); + return -1; + } - return 0; + return codec->init(hci, NULL); } static struct hda_codec_class * @@ -283,6 +289,30 @@ return NULL; } +static int +hda_send_command(struct hda_softc *sc, uint32_t verb) +{ + struct hda_codec_inst *hci = NULL; + struct hda_codec_class *codec = NULL; + uint8_t cad = (verb >> HDA_CMD_CAD_SHIFT) & 0x0f; + + hci = sc->codecs[cad]; + if (!hci) + return -1; + + DPRINTF("cad: 0x%x verb: 0x%x\n", cad, verb); + + codec = hci->codec; + assert(codec); + + if (!codec->command) { + DPRINTF("This codec does not implement the command function\n"); + return -1; + } + + return codec->command(hci, verb); +} + static void hda_reset(struct hda_softc *sc) { @@ -300,7 +330,8 @@ codec = hci->codec; assert(codec); - codec->reset(hci); + if (codec->reset) + codec->reset(hci); } return; @@ -493,6 +524,7 @@ struct hda_codec_cmd_ctl *corb = &sc->corb; uint32_t value = sc->regs[offset]; uint32_t verb = 0; + int err; corb->wp = value; @@ -503,10 +535,8 @@ corb->rp++; verb = hda_dma_ld_dword(corb->dma_vaddr + HDA_CORB_ENTRY_LEN * corb->rp); - /* - * TODO get cad from verb and send command to codec[cad] - */ - DPRINTF("VERB: 0x%x\n", verb); + err = hda_send_command(sc, verb); + assert(!err); } hda_set_reg_by_offset(sc, HDAC_CORBRP, corb->rp); @@ -579,6 +609,36 @@ return 0; } +static int +hda_response(struct hda_codec_inst *hci, uint32_t response, uint8_t unsol) +{ + struct hda_softc *sc = NULL; + struct hda_codec_cmd_ctl *rirb = NULL; + uint32_t response_ex = 0; + + assert(hci); + assert(hci->cad <= HDA_CODEC_MAX); + + response_ex = hci->cad | unsol; + + sc = hci->hda; + assert(sc); + + rirb = &sc->rirb; + + if (rirb->run) { + rirb->wp++; + rirb->wp %= rirb->size; + + hda_dma_st_dword(rirb->dma_vaddr + HDA_RIRB_ENTRY_LEN * rirb->wp, response); + hda_dma_st_dword(rirb->dma_vaddr + HDA_RIRB_ENTRY_LEN * rirb->wp + 0x04, response_ex); + + hda_set_reg_by_offset(sc, HDAC_RIRBWP, rirb->wp); + } + + return 0; +} + /* * PCI HDA function definitions */ Modified: soc2016/iateaca/bhyve-hda-head/usr.sbin/bhyve/pci_hda.h ============================================================================== --- soc2016/iateaca/bhyve-hda-head/usr.sbin/bhyve/pci_hda.h Sun May 29 16:39:28 2016 (r304162) +++ soc2016/iateaca/bhyve-hda-head/usr.sbin/bhyve/pci_hda.h Sun May 29 17:08:35 2016 (r304163) @@ -12,6 +12,8 @@ #include #include +#include "hda_reg.h" + /* * HDA Debug Log */ @@ -40,10 +42,12 @@ char *name; int (*init)(struct hda_codec_inst *hci, const char *opts); int (*reset)(struct hda_codec_inst *hci); + int (*command)(struct hda_codec_inst *hci, uint32_t cmd_data); }; struct hda_ops { int (*signal)(struct hda_codec_inst *hci); + int (*response)(struct hda_codec_inst *hci, uint32_t response, uint8_t unsol); }; #define HDA_EMUL_SET(x) DATA_SET(hda_codec_class_set, x); From owner-svn-soc-all@freebsd.org Sun May 29 18:40: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 3D4EAB54CAB for ; Sun, 29 May 2016 18:40: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 2047F14B4 for ; Sun, 29 May 2016 18:40: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 u4TIeKEQ006095 for ; Sun, 29 May 2016 18:40:20 GMT (envelope-from iateaca@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id u4TIeKW1006036 for svn-soc-all@FreeBSD.org; Sun, 29 May 2016 18:40:20 GMT (envelope-from iateaca@FreeBSD.org) Date: Sun, 29 May 2016 18:40:20 GMT Message-Id: <201605291840.u4TIeKW1006036@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: r304168 - 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, 29 May 2016 18:40:21 -0000 Author: iateaca Date: Sun May 29 18:40:19 2016 New Revision: 304168 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=304168 Log: run corb mechanism in loop while rp != wp increment corp rp pointer and turn to 0 when rp = corb->size 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 29 17:35:38 2016 (r304167) +++ soc2016/iateaca/bhyve-hda-head/usr.sbin/bhyve/pci_hda.c Sun May 29 18:40:19 2016 (r304168) @@ -432,6 +432,24 @@ static int hda_corb_run(struct hda_softc *sc) { + struct hda_codec_cmd_ctl *corb = &sc->corb; + uint32_t verb = 0; + int err; + + corb->wp = hda_get_reg_by_offset(sc, HDAC_CORBWP); + + while (corb->rp != corb->wp && corb->run) { + corb->rp++; + corb->rp %= corb->size; + + verb = hda_dma_ld_dword(corb->dma_vaddr + HDA_CORB_ENTRY_LEN * corb->rp); + + err = hda_send_command(sc, verb); + assert(!err); + } + + hda_set_reg_by_offset(sc, HDAC_CORBRP, corb->rp); + return 0; } @@ -521,25 +539,7 @@ static void hda_set_corbwp(struct hda_softc *sc, uint32_t offset, uint32_t old) { - struct hda_codec_cmd_ctl *corb = &sc->corb; - uint32_t value = sc->regs[offset]; - uint32_t verb = 0; - int err; - - corb->wp = value; - - /* - * TODO do it in loop - */ - if (corb->wp != corb->rp && corb->run) { - corb->rp++; - verb = hda_dma_ld_dword(corb->dma_vaddr + HDA_CORB_ENTRY_LEN * corb->rp); - - err = hda_send_command(sc, verb); - assert(!err); - } - - hda_set_reg_by_offset(sc, HDAC_CORBRP, corb->rp); + hda_corb_run(sc); return; } From owner-svn-soc-all@freebsd.org Sun May 29 18:51:58 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 7B8E5B54EC7 for ; Sun, 29 May 2016 18:51:58 +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 6F3101BC0 for ; Sun, 29 May 2016 18:51:58 +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 u4TIpwrC037990 for ; Sun, 29 May 2016 18:51:58 GMT (envelope-from iateaca@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id u4TIpvsw037929 for svn-soc-all@FreeBSD.org; Sun, 29 May 2016 18:51:57 GMT (envelope-from iateaca@FreeBSD.org) Date: Sun, 29 May 2016 18:51:57 GMT Message-Id: <201605291851.u4TIpvsw037929@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: r304169 - 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, 29 May 2016 18:51:58 -0000 Author: iateaca Date: Sun May 29 18:51:57 2016 New Revision: 304169 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=304169 Log: use get_reg_by_offset instead of sc->regs 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 29 18:40:19 2016 (r304168) +++ soc2016/iateaca/bhyve-hda-head/usr.sbin/bhyve/pci_hda.c Sun May 29 18:51:57 2016 (r304169) @@ -527,7 +527,7 @@ static void hda_set_gctl(struct hda_softc *sc, uint32_t offset, uint32_t old) { - uint32_t value = sc->regs[offset]; + uint32_t value = hda_get_reg_by_offset(sc, offset); if (!(value & HDAC_GCTL_CRST)) { hda_reset(sc); @@ -547,7 +547,7 @@ static void hda_set_corbctl(struct hda_softc *sc, uint32_t offset, uint32_t old) { - uint32_t value = sc->regs[offset]; + uint32_t value = hda_get_reg_by_offset(sc, offset); int err; struct hda_codec_cmd_ctl *corb = NULL; @@ -565,7 +565,7 @@ static void hda_set_rirbctl(struct hda_softc *sc, uint32_t offset, uint32_t old) { - uint32_t value = sc->regs[offset]; + uint32_t value = hda_get_reg_by_offset(sc, offset); int err; struct hda_codec_cmd_ctl *rirb = NULL; From owner-svn-soc-all@freebsd.org Mon May 30 06:12:45 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 CC422B54A3A for ; Mon, 30 May 2016 06:12:45 +0000 (UTC) (envelope-from yuanxunzhang@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 BFBD51CE8 for ; Mon, 30 May 2016 06:12:45 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id u4U6Cjma069828 for ; Mon, 30 May 2016 06:12:45 GMT (envelope-from yuanxunzhang@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id u4U6Cj0n069191 for svn-soc-all@FreeBSD.org; Mon, 30 May 2016 06:12:45 GMT (envelope-from yuanxunzhang@FreeBSD.org) Date: Mon, 30 May 2016 06:12:45 GMT Message-Id: <201605300612.u4U6Cj0n069191@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to yuanxunzhang@FreeBSD.org using -f From: yuanxunzhang@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r304184 - soc2016/yuanxunzhang/head/usr.sbin/eaps 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: Mon, 30 May 2016 06:12:45 -0000 Author: yuanxunzhang Date: Mon May 30 06:12:44 2016 New Revision: 304184 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=304184 Log: update eaps commands modules Modified: soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Modified: soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c ============================================================================== --- soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Mon May 30 05:21:24 2016 (r304183) +++ soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Mon May 30 06:12:44 2016 (r304184) @@ -54,15 +54,25 @@ */ static void -usage(void) +usage(const char *cp) { - errx(EX_USAGE, "usage: eaps command args"); + if (cp != NULL) + warnx("bad keyword: %s", cp); + errx(EX_USAGE, "usage: eaps command [args]"); } int -main(int argc, char *argv[]) +main(int argc, char **argv) { int rtn = 0; - usage(); + if (argc < 3) + usage(NULL); + + if (*argv != NULL) + switch (keyword(*argv)) { + case K_CREATE: + case K_DELETE: + } + usage(*argv); return rtn; } \ No newline at end of file From owner-svn-soc-all@freebsd.org Mon May 30 06:35: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 8C9EEB54E1C for ; Mon, 30 May 2016 06:35:48 +0000 (UTC) (envelope-from yuanxunzhang@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 80A621711 for ; Mon, 30 May 2016 06:35:48 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id u4U6Zmwn055162 for ; Mon, 30 May 2016 06:35:48 GMT (envelope-from yuanxunzhang@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id u4U6ZlmV055159 for svn-soc-all@FreeBSD.org; Mon, 30 May 2016 06:35:47 GMT (envelope-from yuanxunzhang@FreeBSD.org) Date: Mon, 30 May 2016 06:35:47 GMT Message-Id: <201605300635.u4U6ZlmV055159@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to yuanxunzhang@FreeBSD.org using -f From: yuanxunzhang@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r304185 - soc2016/yuanxunzhang/head/usr.sbin/eaps 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: Mon, 30 May 2016 06:35:48 -0000 Author: yuanxunzhang Date: Mon May 30 06:35:47 2016 New Revision: 304185 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=304185 Log: update eaps commands modules Modified: soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Modified: soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c ============================================================================== --- soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Mon May 30 06:12:44 2016 (r304184) +++ soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Mon May 30 06:35:47 2016 (r304185) @@ -53,13 +53,18 @@ * eaps - display, and configure eaps */ -static void -usage(const char *cp) -{ - if (cp != NULL) - warnx("bad keyword: %s", cp); - errx(EX_USAGE, "usage: eaps command [args]"); -} +static struct keytab { + const char *kt_cp; + int kt_i; +} const keywords[] = { +#include "keywords.h" + {0, 0} +}; + +int keyword(const char *); +static void createdomain(int, char **); +static void deletedomain(int, char **); +static void usage(void); int main(int argc, char **argv) @@ -71,8 +76,30 @@ if (*argv != NULL) switch (keyword(*argv)) { case K_CREATE: + createdomain(argc, argv); + case K_DELETE: + deletedomain(argc, argv); + exit(0); } usage(*argv); return rtn; +} + +static void +usage(const char *cp) +{ + if (cp != NULL) + warnx("bad keyword: %s", cp); + errx(EX_USAGE, "usage: eaps command [args]"); +} + +int +keyword(const char *cp) +{ + const struct keytab *kt = keywords; + + while (kt->kt_cp != NULL && strcmp(kt->kt_cp, cp) != 0) + kt++; + return (kt->kt_i); } \ No newline at end of file From owner-svn-soc-all@freebsd.org Mon May 30 06:37:00 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 90034B54E64 for ; Mon, 30 May 2016 06:37:00 +0000 (UTC) (envelope-from yuanxunzhang@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 84083188A for ; Mon, 30 May 2016 06:37:00 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id u4U6b0Zf056857 for ; Mon, 30 May 2016 06:37:00 GMT (envelope-from yuanxunzhang@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id u4U6axBg056786 for svn-soc-all@FreeBSD.org; Mon, 30 May 2016 06:36:59 GMT (envelope-from yuanxunzhang@FreeBSD.org) Date: Mon, 30 May 2016 06:36:59 GMT Message-Id: <201605300636.u4U6axBg056786@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to yuanxunzhang@FreeBSD.org using -f From: yuanxunzhang@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r304186 - soc2016/yuanxunzhang/head/usr.sbin/eaps 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: Mon, 30 May 2016 06:37:00 -0000 Author: yuanxunzhang Date: Mon May 30 06:36:59 2016 New Revision: 304186 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=304186 Log: update eaps commands modules Modified: soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Modified: soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c ============================================================================== --- soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Mon May 30 06:35:47 2016 (r304185) +++ soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Mon May 30 06:36:59 2016 (r304186) @@ -64,7 +64,7 @@ int keyword(const char *); static void createdomain(int, char **); static void deletedomain(int, char **); -static void usage(void); +static void usage(const char *); int main(int argc, char **argv) From owner-svn-soc-all@freebsd.org Mon May 30 06:40:43 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 C6916B54EAD for ; Mon, 30 May 2016 06:40:43 +0000 (UTC) (envelope-from yuanxunzhang@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 BACFC1943 for ; Mon, 30 May 2016 06:40:43 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id u4U6ehTQ062659 for ; Mon, 30 May 2016 06:40:43 GMT (envelope-from yuanxunzhang@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id u4U6ehZF062656 for svn-soc-all@FreeBSD.org; Mon, 30 May 2016 06:40:43 GMT (envelope-from yuanxunzhang@FreeBSD.org) Date: Mon, 30 May 2016 06:40:43 GMT Message-Id: <201605300640.u4U6ehZF062656@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to yuanxunzhang@FreeBSD.org using -f From: yuanxunzhang@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r304187 - soc2016/yuanxunzhang/head/usr.sbin/eaps 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: Mon, 30 May 2016 06:40:43 -0000 Author: yuanxunzhang Date: Mon May 30 06:40:42 2016 New Revision: 304187 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=304187 Log: update eaps commands modules Modified: soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Modified: soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c ============================================================================== --- soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Mon May 30 06:36:59 2016 (r304186) +++ soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Mon May 30 06:40:42 2016 (r304187) @@ -87,6 +87,18 @@ } static void +createdomain(int argc, char **argv) +{ + return +} + +static void +deletedomain(int argc, char **argv) +{ + return +} + +static void usage(const char *cp) { if (cp != NULL) From owner-svn-soc-all@freebsd.org Mon May 30 06:41: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 78C1AB54F8F for ; Mon, 30 May 2016 06:41:48 +0000 (UTC) (envelope-from yuanxunzhang@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 6CF801ABC for ; Mon, 30 May 2016 06:41:48 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id u4U6fm9w067807 for ; Mon, 30 May 2016 06:41:48 GMT (envelope-from yuanxunzhang@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id u4U6flM7067747 for svn-soc-all@FreeBSD.org; Mon, 30 May 2016 06:41:47 GMT (envelope-from yuanxunzhang@FreeBSD.org) Date: Mon, 30 May 2016 06:41:47 GMT Message-Id: <201605300641.u4U6flM7067747@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to yuanxunzhang@FreeBSD.org using -f From: yuanxunzhang@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r304188 - soc2016/yuanxunzhang/head/usr.sbin/eaps 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: Mon, 30 May 2016 06:41:48 -0000 Author: yuanxunzhang Date: Mon May 30 06:41:47 2016 New Revision: 304188 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=304188 Log: update eaps commands modules Modified: soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Modified: soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c ============================================================================== --- soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Mon May 30 06:40:42 2016 (r304187) +++ soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Mon May 30 06:41:47 2016 (r304188) @@ -89,13 +89,13 @@ static void createdomain(int argc, char **argv) { - return + return; } static void deletedomain(int argc, char **argv) { - return + return; } static void From owner-svn-soc-all@freebsd.org Mon May 30 06:45:16 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 06AC0B54040 for ; Mon, 30 May 2016 06:45:16 +0000 (UTC) (envelope-from yuanxunzhang@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 EEC0C1D25 for ; Mon, 30 May 2016 06:45:15 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id u4U6jFoO075941 for ; Mon, 30 May 2016 06:45:15 GMT (envelope-from yuanxunzhang@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id u4U6jF5q075899 for svn-soc-all@FreeBSD.org; Mon, 30 May 2016 06:45:15 GMT (envelope-from yuanxunzhang@FreeBSD.org) Date: Mon, 30 May 2016 06:45:15 GMT Message-Id: <201605300645.u4U6jF5q075899@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to yuanxunzhang@FreeBSD.org using -f From: yuanxunzhang@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r304189 - soc2016/yuanxunzhang/head/usr.sbin/eaps 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: Mon, 30 May 2016 06:45:16 -0000 Author: yuanxunzhang Date: Mon May 30 06:45:14 2016 New Revision: 304189 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=304189 Log: update eaps commands modules Modified: soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Modified: soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c ============================================================================== --- soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Mon May 30 06:41:47 2016 (r304188) +++ soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Mon May 30 06:45:14 2016 (r304189) @@ -89,14 +89,16 @@ static void createdomain(int argc, char **argv) { - return; -} + int error = 0; + exit(error); +} static void deletedomain(int argc, char **argv) { - return; -} + int error = 0; + exit(error); +} static void usage(const char *cp) From owner-svn-soc-all@freebsd.org Mon May 30 20:08:19 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 81C8EB55CF4 for ; Mon, 30 May 2016 20:08:19 +0000 (UTC) (envelope-from yuanxunzhang@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 66A1A148A for ; Mon, 30 May 2016 20:08:19 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id u4UK8JwL098221 for ; Mon, 30 May 2016 20:08:19 GMT (envelope-from yuanxunzhang@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id u4UK8INl098195 for svn-soc-all@FreeBSD.org; Mon, 30 May 2016 20:08:18 GMT (envelope-from yuanxunzhang@FreeBSD.org) Date: Mon, 30 May 2016 20:08:18 GMT Message-Id: <201605302008.u4UK8INl098195@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to yuanxunzhang@FreeBSD.org using -f From: yuanxunzhang@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r304210 - soc2016/yuanxunzhang/head/sys/net 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: Mon, 30 May 2016 20:08:19 -0000 Author: yuanxunzhang Date: Mon May 30 20:08:18 2016 New Revision: 304210 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=304210 Log: add eaps protocol header file Added: soc2016/yuanxunzhang/head/sys/net/eaps.h Added: soc2016/yuanxunzhang/head/sys/net/eaps.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2016/yuanxunzhang/head/sys/net/eaps.h Mon May 30 20:08:18 2016 (r304210) @@ -0,0 +1,128 @@ +/*- + * Copyright (c) 2015 Bruce Simpson. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote + * products derived from this software without specific prior written + * permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef _NET_EAPS_H_ +#define _NET_EAPS_H_ + +/* + * Extreme Active Protection System (EAPS) definitions. + * Normative reference: draft-shah-extreme-rfc3619bis-02 [Expired I-D] + */ + +/* TODO: */ +/* EDP/EAPS packets are SNAP encapsulated on Ethernet. */ +/* dsap/ssap are LLV_SNAP_LSAP, llc_control is LLC_UI, oui is EXTREME_OUI, PID is EDP.*/ + +/* + * Extreme Networks proprietary MAC addresses. + */ +#define EXTREME_OUI_INIT { 0x00, 0xE0, 0x2B } +#define EDP_ETHERADDR_INIT { 0x00, 0xE0, 0x2B, 0x00, 0x00, 0x00 } +#define EAPS_ETHERADDR_INIT { 0x00, 0xE0, 0x2B, 0x00, 0x00, 0x04 } + +/* +const uint8_t eaps_etheraddr[] = EAPS_ETHERADDR_INIT; +const uint8_t edp_etheraddr[] = EDP_ETHERADDR_INIT; +*/ + +/* + * Extreme Discovery Protocol (EDP) header. + */ +struct edp_hdr { + uint8_t edp_version; /* EDP_VERSION_1 */ + uint8_t edp_reserved00; /* must be zero */ + uint16_t edp_len; /* Payload length including edp_hdr */ + uint16_t edp_cksum; /* RFC 1071-like */ + uint16_t edp_seq; /* simple monotonic */ + uint16_t edp_devid; /* 0 for MAC address */ + struct ether_addr edp_dev_mac; /* 48 bits */ + /* followed by 0..N TLVs. */ +} __packed; +#define EDP_VERSION_1 0x01 + +/* + * EDP Tag-Length-Value (TLV) header. + * Minimum length: 32 bits (length: 0x0004). + */ +struct edp_tlv_hdr { + uint8_t etv_marker; /* always set to EDP_MARKER 0x99 */ + uint8_t etv_tag; /* Tag: see below. */ + uint16_t etv_len; /* network-endian; includes this header */ + /* followed by [0..etv_len] octets */ +} __packed; + +#define EDP_MARKER 0x99 /* etv_marker constant */ +#define EDP_TAG_NULL 0x00 /* No-op, length must be 0x04. */ +#define EDP_TAG_ESRP 0x08 /* Extreme Standby Router Protocol (undocumented) */ +#define EDP_TAG_EAPS 0x0B /* RFC 3619 Extreme Active Protection System */ + +/* + * EAPS TLV payload. + */ +struct eaps_pdu { + uint8_t eaps_version; /* Always EAPS_VERSION_1 (for now) */ + uint8_t eaps_type; /* PDU type */ + uint16_t eaps_cvlan; /* Control VLAN Tag ID */ + uint32_t eaps_rsvd0; /* Reserved; set to zero */ + struct ether_addr eaps_origin; /* Originating MAC address */ + uint16_t eaps_hello; /* HELLO interval (hardcoded) */ + uint16_t eaps_fail; /* FAIL interval (set by master) */ + uint8_t eaps_state; /* EAPS_S_xxx; see below */ + uint8_t eaps_rsvd1; /* Reserved; set to zero */ + uint16_t eaps_seq; /* Health PDU sequence number */ + uint16_t eaps_rsvd1[38]; /* Reserved; set to zero */ +} __packed; + +#define EAPS_VERSION_1 0x01 /* EAPSv1; may support v2 in future */ +#define EAPS_HELLO_INTERVAL 0x04 /* hardcoded value of eaps_hello */ + +/* + * EAPS PDU Types + */ +#define EAPS_P_HEALTH 0x05 /* Polling for ring health */ +#define EAPS_P_RING_UP 0x06 /* Master indicates link is up */ +#define EAPS_P_RING_DOWN 0x07 /* Master indicates link is down */ +#define EAPS_P_LINK_DOWN 0x08 /* Peer indicates link is down */ +#define EAPS_P_FLUSH 0x0D /* Topology change: flush FDB for domain */ +#define EAPS_P_LINK_QUERY 0x0F /* Link status query from peer */ +#define EAPS_P_LINK_UP 0x10 /* Peer indicates link is up */ + +/* + * EAPS ring node states + */ +#define EAPS_S_IDLE 0x00 /* EAPS Domain (Master/Transit) not running */ +#define EAPS_S_COMPLETE 0x01 /* Master node in COMPLETE state */ +#define EAPS_S_FAILED 0x02 /* Master node in FAILED state */ +#define EAPS_S_LINKS_UP 0x03 /* Transit UP: Pri & Sec ring ports are up */ +#define EAPS_S_LINK_DOWN 0x04 /* Transit DOWN: Pri and/or Sec ports down */ +#define EAPS_S_PREFORWARD 0x05 /* Transit in PREFORWARDING State */ +#define EAPS_S_INIT 0x06 /* Master node in INIT state */ + +#endif /* _NET_EAPS_H_ */ From owner-svn-soc-all@freebsd.org Tue May 31 04:05:06 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 A6D5AB55856 for ; Tue, 31 May 2016 04:05:06 +0000 (UTC) (envelope-from yuanxunzhang@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 9A3F51C07 for ; Tue, 31 May 2016 04:05:06 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id u4V456Mi026605 for ; Tue, 31 May 2016 04:05:06 GMT (envelope-from yuanxunzhang@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id u4V455YG025749 for svn-soc-all@FreeBSD.org; Tue, 31 May 2016 04:05:05 GMT (envelope-from yuanxunzhang@FreeBSD.org) Date: Tue, 31 May 2016 04:05:05 GMT Message-Id: <201605310405.u4V455YG025749@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to yuanxunzhang@FreeBSD.org using -f From: yuanxunzhang@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r304215 - in soc2016/yuanxunzhang/head/usr.sbin: eaps route6d 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: Tue, 31 May 2016 04:05:06 -0000 Author: yuanxunzhang Date: Tue May 31 04:05:04 2016 New Revision: 304215 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=304215 Log: Modify eaps command modules Modified: soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c soc2016/yuanxunzhang/head/usr.sbin/eaps/keywords soc2016/yuanxunzhang/head/usr.sbin/route6d/route6d.8 Modified: soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c ============================================================================== --- soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Tue May 31 00:23:29 2016 (r304214) +++ soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Tue May 31 04:05:04 2016 (r304215) @@ -90,6 +90,7 @@ createdomain(int argc, char **argv) { int error = 0; + warnx("Create EAPS domain"); exit(error); } @@ -97,6 +98,7 @@ deletedomain(int argc, char **argv) { int error = 0; + warnx("Delete EAPS domain"); exit(error); } Modified: soc2016/yuanxunzhang/head/usr.sbin/eaps/keywords ============================================================================== --- soc2016/yuanxunzhang/head/usr.sbin/eaps/keywords Tue May 31 00:23:29 2016 (r304214) +++ soc2016/yuanxunzhang/head/usr.sbin/eaps/keywords Tue May 31 04:05:04 2016 (r304215) @@ -3,3 +3,4 @@ create delete +display Modified: soc2016/yuanxunzhang/head/usr.sbin/route6d/route6d.8 ============================================================================== --- soc2016/yuanxunzhang/head/usr.sbin/route6d/route6d.8 Tue May 31 00:23:29 2016 (r304214) +++ soc2016/yuanxunzhang/head/usr.sbin/route6d/route6d.8 Tue May 31 04:05:04 2016 (r304215) @@ -21,7 +21,7 @@ .Os .Sh NAME .Nm route6d -.Nd RIP6 Routing Daemon (TEST) +.Nd RIP6 Routing Daemon .Sh SYNOPSIS .Nm .Op Fl adDhlnqsS From owner-svn-soc-all@freebsd.org Tue May 31 04:12: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 19162B55B5E for ; Tue, 31 May 2016 04:12:24 +0000 (UTC) (envelope-from yuanxunzhang@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 038DC125A for ; Tue, 31 May 2016 04:12:24 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id u4V4CNrV093752 for ; Tue, 31 May 2016 04:12:23 GMT (envelope-from yuanxunzhang@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id u4V4CMqX093212 for svn-soc-all@FreeBSD.org; Tue, 31 May 2016 04:12:22 GMT (envelope-from yuanxunzhang@FreeBSD.org) Date: Tue, 31 May 2016 04:12:22 GMT Message-Id: <201605310412.u4V4CMqX093212@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to yuanxunzhang@FreeBSD.org using -f From: yuanxunzhang@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r304216 - soc2016/yuanxunzhang/head/usr.sbin/eaps 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: Tue, 31 May 2016 04:12:24 -0000 Author: yuanxunzhang Date: Tue May 31 04:12:21 2016 New Revision: 304216 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=304216 Log: Modify eaps command modules Modified: soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Modified: soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c ============================================================================== --- soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Tue May 31 04:05:04 2016 (r304215) +++ soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Tue May 31 04:12:21 2016 (r304216) @@ -73,7 +73,7 @@ if (argc < 3) usage(NULL); - if (*argv != NULL) + if (*(++argv) != NULL) switch (keyword(*argv)) { case K_CREATE: createdomain(argc, argv); From owner-svn-soc-all@freebsd.org Tue May 31 04:21:36 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 48FA2B55EEB for ; Tue, 31 May 2016 04:21:36 +0000 (UTC) (envelope-from yuanxunzhang@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 3CFA21C27 for ; Tue, 31 May 2016 04:21:36 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id u4V4LafJ031416 for ; Tue, 31 May 2016 04:21:36 GMT (envelope-from yuanxunzhang@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id u4V4LZqr031028 for svn-soc-all@FreeBSD.org; Tue, 31 May 2016 04:21:35 GMT (envelope-from yuanxunzhang@FreeBSD.org) Date: Tue, 31 May 2016 04:21:35 GMT Message-Id: <201605310421.u4V4LZqr031028@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to yuanxunzhang@FreeBSD.org using -f From: yuanxunzhang@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r304217 - soc2016/yuanxunzhang/head/usr.sbin/eaps 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: Tue, 31 May 2016 04:21:36 -0000 Author: yuanxunzhang Date: Tue May 31 04:21:35 2016 New Revision: 304217 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=304217 Log: Modify eaps command modules Modified: soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Modified: soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c ============================================================================== --- soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Tue May 31 04:12:21 2016 (r304216) +++ soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Tue May 31 04:21:35 2016 (r304217) @@ -90,7 +90,7 @@ createdomain(int argc, char **argv) { int error = 0; - warnx("Create EAPS domain"); + warnx("Create EAPS domain %s", *argv); exit(error); } @@ -98,7 +98,7 @@ deletedomain(int argc, char **argv) { int error = 0; - warnx("Delete EAPS domain"); + warnx("Delete EAPS domain %s", *argv); exit(error); } From owner-svn-soc-all@freebsd.org Tue May 31 10:22: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 E92A4B54E3A for ; Tue, 31 May 2016 10:22:28 +0000 (UTC) (envelope-from vincenzo@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 C4E4D1434 for ; Tue, 31 May 2016 10:22:28 +0000 (UTC) (envelope-from vincenzo@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id u4VAMSfv066569 for ; Tue, 31 May 2016 10:22:28 GMT (envelope-from vincenzo@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id u4VAMSpt066544 for svn-soc-all@FreeBSD.org; Tue, 31 May 2016 10:22:28 GMT (envelope-from vincenzo@FreeBSD.org) Date: Tue, 31 May 2016 10:22:28 GMT Message-Id: <201605311022.u4VAMSpt066544@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to vincenzo@FreeBSD.org using -f From: vincenzo@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r304243 - soc2016/vincenzo/head/sys/dev/netmap 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: Tue, 31 May 2016 10:22:29 -0000 Author: vincenzo Date: Tue May 31 10:22:27 2016 New Revision: 304243 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=304243 Log: freebsd: ptnet: per-queue data structure Modified: soc2016/vincenzo/head/sys/dev/netmap/if_ptnet.c Modified: soc2016/vincenzo/head/sys/dev/netmap/if_ptnet.c ============================================================================== --- soc2016/vincenzo/head/sys/dev/netmap/if_ptnet.c Tue May 31 09:24:16 2016 (r304242) +++ soc2016/vincenzo/head/sys/dev/netmap/if_ptnet.c Tue May 31 10:22:27 2016 (r304243) @@ -90,6 +90,14 @@ #error "No support for on-device CSB" #endif +struct ptnet_softc; + +struct ptnet_queue { + struct ptnet_softc *sc; + struct resource *irq; + int kring_id; +}; + struct ptnet_softc { device_t dev; struct ifnet *ifp; @@ -106,7 +114,7 @@ struct resource *msix_mem; unsigned int num_rings; - + struct ptnet_queue *queues; struct ptnet_csb *csb; }; @@ -183,6 +191,7 @@ struct ifnet *ifp; uint32_t macreg; int err, rid; + int i; device_printf(dev, "%s\n", __func__); @@ -216,6 +225,24 @@ num_rx_rings = bus_read_4(sc->iomem, PTNET_IO_NUM_RX_RINGS); sc->num_rings = num_tx_rings + num_rx_rings; + /* Allocate per-queue data structures. */ + sc->queues = malloc(sizeof(struct ptnet_queue) * sc->num_rings, + M_DEVBUF, M_NOWAIT | M_ZERO); + if (sc->queues == NULL) { + err = ENOMEM; + goto err_path; + } + + for (i = 0; i < sc->num_rings; i++) { + struct ptnet_queue *pq = sc->queues + i; + + pq->sc = sc; + pq->kring_id = i; + if (i >= num_tx_rings) { + pq->kring_id -= num_tx_rings; + } + } + /* Allocate CSB and carry out CSB allocation protocol (CSBBAH first, * then CSBBAL). */ sc->csb = malloc(sizeof(struct ptnet_csb), M_DEVBUF, @@ -311,6 +338,11 @@ sc->csb = NULL; } + if (sc->queues) { + free(sc->queues, M_DEVBUF); + sc->queues = NULL; + } + if (sc->iomem) { bus_release_resource(dev, SYS_RES_IOPORT, PCIR_BAR(PTNETMAP_IO_PCI_BAR), sc->iomem); From owner-svn-soc-all@freebsd.org Tue May 31 10:26:42 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 33513B54EE1 for ; Tue, 31 May 2016 10:26:42 +0000 (UTC) (envelope-from vincenzo@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 26E941648 for ; Tue, 31 May 2016 10:26:42 +0000 (UTC) (envelope-from vincenzo@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id u4VAQgCG072839 for ; Tue, 31 May 2016 10:26:42 GMT (envelope-from vincenzo@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id u4VAQf3F072837 for svn-soc-all@FreeBSD.org; Tue, 31 May 2016 10:26:41 GMT (envelope-from vincenzo@FreeBSD.org) Date: Tue, 31 May 2016 10:26:41 GMT Message-Id: <201605311026.u4VAQf3F072837@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to vincenzo@FreeBSD.org using -f From: vincenzo@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r304244 - soc2016/vincenzo/head/sys/dev/netmap 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: Tue, 31 May 2016 10:26:42 -0000 Author: vincenzo Date: Tue May 31 10:26:41 2016 New Revision: 304244 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=304244 Log: freebsd: ptnet: MSI-X interrupt setup Modified: soc2016/vincenzo/head/sys/dev/netmap/if_ptnet.c Modified: soc2016/vincenzo/head/sys/dev/netmap/if_ptnet.c ============================================================================== --- soc2016/vincenzo/head/sys/dev/netmap/if_ptnet.c Tue May 31 10:22:27 2016 (r304243) +++ soc2016/vincenzo/head/sys/dev/netmap/if_ptnet.c Tue May 31 10:26:41 2016 (r304244) @@ -93,9 +93,10 @@ struct ptnet_softc; struct ptnet_queue { - struct ptnet_softc *sc; - struct resource *irq; - int kring_id; + struct ptnet_softc *sc; + struct resource *irq; + void *cookie; + int kring_id; }; struct ptnet_softc { @@ -146,6 +147,9 @@ static int ptnet_irqs_init(struct ptnet_softc *sc); static void ptnet_irqs_fini(struct ptnet_softc *sc); +static void ptnet_tx_intr(void *opaque); +static void ptnet_rx_intr(void *opaque); + static device_method_t ptnet_methods[] = { DEVMETHOD(device_probe, ptnet_probe), DEVMETHOD(device_attach, ptnet_attach), @@ -391,27 +395,60 @@ { int rid = PCIR_BAR(PTNETMAP_MSIX_PCI_BAR); int nvecs = sc->num_rings; + unsigned int num_tx_rings; + device_t dev = sc->dev; int err = ENOSPC; + int i; + + num_tx_rings = bus_read_4(sc->iomem, PTNET_IO_NUM_TX_RINGS); - sc->msix_mem = bus_alloc_resource_any(sc->dev, SYS_RES_MEMORY, + sc->msix_mem = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, RF_ACTIVE); if (sc->msix_mem == NULL) { - device_printf(sc->dev, "Failed to allocate MSIX PCI BAR\n"); + device_printf(dev, "Failed to allocate MSIX PCI BAR\n"); return (ENXIO); } - if (pci_msix_count(sc->dev) < nvecs) { - device_printf(sc->dev, "Not enough MSI-X vectors\n"); + if (pci_msix_count(dev) < nvecs) { + device_printf(dev, "Not enough MSI-X vectors\n"); goto err_path; } - err = pci_alloc_msix(sc->dev, &nvecs); + err = pci_alloc_msix(dev, &nvecs); if (err) { - device_printf(sc->dev, "Failed to allocate MSI-X vectors\n"); + device_printf(dev, "Failed to allocate MSI-X vectors\n"); goto err_path; } - device_printf(sc->dev, "Allocated %d MSI-X vectors\n", nvecs); + for (i = 0; i < nvecs; i++) { + struct ptnet_queue *pq = sc->queues + i; + void (*handler)(void *) = ptnet_tx_intr; + int rid = i + i; + + if (i > num_tx_rings) { + handler = ptnet_rx_intr; + } + pq->irq = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid, + RF_ACTIVE); + if (pq->irq == NULL) { + device_printf(dev, "Failed to allocate interrupt" + "for queue #%d\n", i); + goto err_path; + } + + err = bus_setup_intr(dev, pq->irq, INTR_TYPE_NET | INTR_MPSAFE, + NULL, handler, pq, &pq->cookie); + if (err) { + device_printf(dev, "Failed to register intr handler " + "for queue #%d\n", i); + goto err_path; + } + + bus_describe_intr(dev, pq->irq, pq->cookie, "q%d", i); + //bus_bind_intr(); /* bind intr to CPU */ + } + + device_printf(dev, "Allocated %d MSI-X vectors\n", nvecs); return 0; err_path: @@ -422,15 +459,31 @@ static void ptnet_irqs_fini(struct ptnet_softc *sc) { - if (sc->msix_mem == NULL) { - return; + device_t dev = sc->dev; + int i; + + for (i = 0; i < sc->num_rings; i++) { + struct ptnet_queue *pq = sc->queues + i; + + if (pq->cookie) { + bus_teardown_intr(dev, pq->irq, pq->cookie); + pq->cookie = NULL; + } + + if (pq->irq) { + bus_release_resource(dev, SYS_RES_IRQ, i + i, pq->irq); + pq->irq = NULL; + } } - pci_release_msi(sc->dev); + if (sc->msix_mem) { + pci_release_msi(dev); - bus_release_resource(sc->dev, SYS_RES_MEMORY, - PCIR_BAR(PTNETMAP_MSIX_PCI_BAR), sc->msix_mem); - sc->msix_mem = NULL; + bus_release_resource(dev, SYS_RES_MEMORY, + PCIR_BAR(PTNETMAP_MSIX_PCI_BAR), + sc->msix_mem); + sc->msix_mem = NULL; + } } static void @@ -472,3 +525,13 @@ ifmr->ifm_active |= IFM_NONE; } } + +static void +ptnet_tx_intr(void *opaque) +{ +} + +static void +ptnet_rx_intr(void *opaque) +{ +} From owner-svn-soc-all@freebsd.org Tue May 31 10:27:22 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 12FDAB54F02 for ; Tue, 31 May 2016 10:27:22 +0000 (UTC) (envelope-from vincenzo@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 0726A165F for ; Tue, 31 May 2016 10:27:22 +0000 (UTC) (envelope-from vincenzo@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id u4VARLje073753 for ; Tue, 31 May 2016 10:27:21 GMT (envelope-from vincenzo@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id u4VARLk1073750 for svn-soc-all@FreeBSD.org; Tue, 31 May 2016 10:27:21 GMT (envelope-from vincenzo@FreeBSD.org) Date: Tue, 31 May 2016 10:27:21 GMT Message-Id: <201605311027.u4VARLk1073750@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to vincenzo@FreeBSD.org using -f From: vincenzo@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r304245 - soc2016/vincenzo/head/sys/dev/netmap 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: Tue, 31 May 2016 10:27:22 -0000 Author: vincenzo Date: Tue May 31 10:27:20 2016 New Revision: 304245 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=304245 Log: freebsd: ptnet: be verbose on interrupt Modified: soc2016/vincenzo/head/sys/dev/netmap/if_ptnet.c Modified: soc2016/vincenzo/head/sys/dev/netmap/if_ptnet.c ============================================================================== --- soc2016/vincenzo/head/sys/dev/netmap/if_ptnet.c Tue May 31 10:26:41 2016 (r304244) +++ soc2016/vincenzo/head/sys/dev/netmap/if_ptnet.c Tue May 31 10:27:20 2016 (r304245) @@ -437,7 +437,8 @@ } err = bus_setup_intr(dev, pq->irq, INTR_TYPE_NET | INTR_MPSAFE, - NULL, handler, pq, &pq->cookie); + NULL /* intr_filter */, handler, + pq, &pq->cookie); if (err) { device_printf(dev, "Failed to register intr handler " "for queue #%d\n", i); @@ -529,9 +530,17 @@ static void ptnet_tx_intr(void *opaque) { + struct ptnet_queue *pq = opaque; + struct ptnet_softc *sc = pq->sc; + + device_printf(sc->dev, "Tx interrupt #%d", pq->kring_id); } static void ptnet_rx_intr(void *opaque) { + struct ptnet_queue *pq = opaque; + struct ptnet_softc *sc = pq->sc; + + device_printf(sc->dev, "Rx interrupt #%d", pq->kring_id); } From owner-svn-soc-all@freebsd.org Tue May 31 10:27:41 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 24F27B54F1F for ; Tue, 31 May 2016 10:27:41 +0000 (UTC) (envelope-from vincenzo@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 192581679 for ; Tue, 31 May 2016 10:27:41 +0000 (UTC) (envelope-from vincenzo@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id u4VARe4Z074184 for ; Tue, 31 May 2016 10:27:40 GMT (envelope-from vincenzo@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id u4VAReS5074177 for svn-soc-all@FreeBSD.org; Tue, 31 May 2016 10:27:40 GMT (envelope-from vincenzo@FreeBSD.org) Date: Tue, 31 May 2016 10:27:40 GMT Message-Id: <201605311027.u4VAReS5074177@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to vincenzo@FreeBSD.org using -f From: vincenzo@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r304246 - soc2016/vincenzo/head/sys/dev/netmap 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: Tue, 31 May 2016 10:27:41 -0000 Author: vincenzo Date: Tue May 31 10:27:39 2016 New Revision: 304246 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=304246 Log: freebsd: ptnet: introduce ptnet_ioctl() Modified: soc2016/vincenzo/head/sys/dev/netmap/if_ptnet.c Modified: soc2016/vincenzo/head/sys/dev/netmap/if_ptnet.c ============================================================================== --- soc2016/vincenzo/head/sys/dev/netmap/if_ptnet.c Tue May 31 10:27:20 2016 (r304245) +++ soc2016/vincenzo/head/sys/dev/netmap/if_ptnet.c Tue May 31 10:27:39 2016 (r304246) @@ -139,6 +139,7 @@ static int ptnet_shutdown(device_t); static void ptnet_init(void *opaque); +static int ptnet_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data); static void ptnet_start(struct ifnet *ifp); static int ptnet_media_change(struct ifnet *ifp); @@ -283,6 +284,7 @@ ifp->if_softc = sc; ifp->if_flags = IFF_BROADCAST | IFF_MULTICAST | IFF_SIMPLEX; ifp->if_init = ptnet_init; + ifp->if_ioctl = ptnet_ioctl; ifp->if_start = ptnet_start; IFQ_SET_MAXLEN(&ifp->if_snd, 255); @@ -494,6 +496,19 @@ (void)sc; } +static int +ptnet_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) +{ + int err = 0; + + switch (cmd) { + default: + err = ether_ioctl(ifp, cmd, data); + } + + return err; +} + static void ptnet_start(struct ifnet *ifp) { From owner-svn-soc-all@freebsd.org Tue May 31 10:27:54 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 71416B54F55 for ; Tue, 31 May 2016 10:27:54 +0000 (UTC) (envelope-from vincenzo@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 658A016C1 for ; Tue, 31 May 2016 10:27:54 +0000 (UTC) (envelope-from vincenzo@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id u4VARsBE074525 for ; Tue, 31 May 2016 10:27:54 GMT (envelope-from vincenzo@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id u4VARrDC074507 for svn-soc-all@FreeBSD.org; Tue, 31 May 2016 10:27:53 GMT (envelope-from vincenzo@FreeBSD.org) Date: Tue, 31 May 2016 10:27:53 GMT Message-Id: <201605311027.u4VARrDC074507@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to vincenzo@FreeBSD.org using -f From: vincenzo@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r304247 - soc2016/vincenzo/head/sys/dev/netmap 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: Tue, 31 May 2016 10:27:54 -0000 Author: vincenzo Date: Tue May 31 10:27:53 2016 New Revision: 304247 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=304247 Log: freebsd: ptnet: prune some headers Modified: soc2016/vincenzo/head/sys/dev/netmap/if_ptnet.c Modified: soc2016/vincenzo/head/sys/dev/netmap/if_ptnet.c ============================================================================== --- soc2016/vincenzo/head/sys/dev/netmap/if_ptnet.c Tue May 31 10:27:39 2016 (r304246) +++ soc2016/vincenzo/head/sys/dev/netmap/if_ptnet.c Tue May 31 10:27:53 2016 (r304247) @@ -38,8 +38,6 @@ #include #include #include -#include -#include #include #include #include @@ -58,8 +56,6 @@ #include #include -#include - #include #include #include @@ -67,7 +63,6 @@ #include #include #include -#include #include #include From owner-svn-soc-all@freebsd.org Tue May 31 10:28:18 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 C038CB54FA5 for ; Tue, 31 May 2016 10:28:18 +0000 (UTC) (envelope-from vincenzo@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 9C4DE16F5 for ; Tue, 31 May 2016 10:28:18 +0000 (UTC) (envelope-from vincenzo@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id u4VASID7075157 for ; Tue, 31 May 2016 10:28:18 GMT (envelope-from vincenzo@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id u4VASIQp075153 for svn-soc-all@FreeBSD.org; Tue, 31 May 2016 10:28:18 GMT (envelope-from vincenzo@FreeBSD.org) Date: Tue, 31 May 2016 10:28:18 GMT Message-Id: <201605311028.u4VASIQp075153@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to vincenzo@FreeBSD.org using -f From: vincenzo@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r304248 - soc2016/vincenzo/head/sys/dev/netmap 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: Tue, 31 May 2016 10:28:18 -0000 Author: vincenzo Date: Tue May 31 10:28:17 2016 New Revision: 304248 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=304248 Log: freebsd: ptnet_ioctl: basic SIOCSIFFLAGS logic Modified: soc2016/vincenzo/head/sys/dev/netmap/if_ptnet.c Modified: soc2016/vincenzo/head/sys/dev/netmap/if_ptnet.c ============================================================================== --- soc2016/vincenzo/head/sys/dev/netmap/if_ptnet.c Tue May 31 10:27:53 2016 (r304247) +++ soc2016/vincenzo/head/sys/dev/netmap/if_ptnet.c Tue May 31 10:28:17 2016 (r304248) @@ -135,6 +135,8 @@ static void ptnet_init(void *opaque); static int ptnet_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data); +static void ptnet_init_locked(struct ptnet_softc *sc); +static void ptnet_stop(struct ptnet_softc *sc); static void ptnet_start(struct ifnet *ifp); static int ptnet_media_change(struct ifnet *ifp); @@ -488,15 +490,36 @@ ptnet_init(void *opaque) { struct ptnet_softc *sc = opaque; - (void)sc; + + PTNET_CORE_LOCK(sc); + ptnet_init_locked(sc); + PTNET_CORE_UNLOCK(sc); } static int ptnet_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) { + struct ptnet_softc *sc = ifp->if_softc; + device_t dev = sc->dev; int err = 0; switch (cmd) { + case SIOCSIFFLAGS: + device_printf(dev, "SIOCSIFFLAGS %x\n", ifp->if_flags); + PTNET_CORE_LOCK(sc); + if (ifp->if_flags & IFF_UP) { + /* Network stack wants the iff to be up. */ + if (!(ifp->if_drv_flags & IFF_DRV_RUNNING)) { + ptnet_init_locked(sc); + } + } else { + /* Network stack wants the iff to be down. */ + if (ifp->if_drv_flags & IFF_DRV_RUNNING) { + ptnet_stop(sc); + } + } + PTNET_CORE_UNLOCK(sc); + default: err = ether_ioctl(ifp, cmd, data); } @@ -505,6 +528,19 @@ } static void +ptnet_init_locked(struct ptnet_softc *sc) +{ + device_printf(sc->dev, "%s\n", __func__); +} + +/* To be called under core lock. */ +static void +ptnet_stop(struct ptnet_softc *sc) +{ + device_printf(sc->dev, "%s\n", __func__); +} + +static void ptnet_start(struct ifnet *ifp) { } From owner-svn-soc-all@freebsd.org Tue May 31 10:28:37 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 E328DB54FD8 for ; Tue, 31 May 2016 10:28:37 +0000 (UTC) (envelope-from vincenzo@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 D75AD17D1 for ; Tue, 31 May 2016 10:28:37 +0000 (UTC) (envelope-from vincenzo@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id u4VASbEb075618 for ; Tue, 31 May 2016 10:28:37 GMT (envelope-from vincenzo@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id u4VASb9p075614 for svn-soc-all@FreeBSD.org; Tue, 31 May 2016 10:28:37 GMT (envelope-from vincenzo@FreeBSD.org) Date: Tue, 31 May 2016 10:28:37 GMT Message-Id: <201605311028.u4VASb9p075614@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to vincenzo@FreeBSD.org using -f From: vincenzo@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r304249 - soc2016/vincenzo/head/sys/dev/netmap 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: Tue, 31 May 2016 10:28:38 -0000 Author: vincenzo Date: Tue May 31 10:28:36 2016 New Revision: 304249 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=304249 Log: freebsd: ptnet: move DRV_RUNNING check into inner functions Modified: soc2016/vincenzo/head/sys/dev/netmap/if_ptnet.c Modified: soc2016/vincenzo/head/sys/dev/netmap/if_ptnet.c ============================================================================== --- soc2016/vincenzo/head/sys/dev/netmap/if_ptnet.c Tue May 31 10:28:17 2016 (r304248) +++ soc2016/vincenzo/head/sys/dev/netmap/if_ptnet.c Tue May 31 10:28:36 2016 (r304249) @@ -509,14 +509,10 @@ PTNET_CORE_LOCK(sc); if (ifp->if_flags & IFF_UP) { /* Network stack wants the iff to be up. */ - if (!(ifp->if_drv_flags & IFF_DRV_RUNNING)) { - ptnet_init_locked(sc); - } + ptnet_init_locked(sc); } else { /* Network stack wants the iff to be down. */ - if (ifp->if_drv_flags & IFF_DRV_RUNNING) { - ptnet_stop(sc); - } + ptnet_stop(sc); } PTNET_CORE_UNLOCK(sc); @@ -530,14 +526,26 @@ static void ptnet_init_locked(struct ptnet_softc *sc) { + struct ifnet *ifp = sc->ifp; + device_printf(sc->dev, "%s\n", __func__); + + if (ifp->if_drv_flags & IFF_DRV_RUNNING) { + return; /* nothing to do */ + } } /* To be called under core lock. */ static void ptnet_stop(struct ptnet_softc *sc) { + struct ifnet *ifp = sc->ifp; + device_printf(sc->dev, "%s\n", __func__); + + if (!(ifp->if_drv_flags & IFF_DRV_RUNNING)) { + return; /* nothing to do */ + } } static void From owner-svn-soc-all@freebsd.org Tue May 31 19:55: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 4D374B57611 for ; Tue, 31 May 2016 19:55:28 +0000 (UTC) (envelope-from yuanxunzhang@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 321AF1CE7 for ; Tue, 31 May 2016 19:55:28 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id u4VJtStu099334 for ; Tue, 31 May 2016 19:55:28 GMT (envelope-from yuanxunzhang@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id u4VJtRj2099327 for svn-soc-all@FreeBSD.org; Tue, 31 May 2016 19:55:27 GMT (envelope-from yuanxunzhang@FreeBSD.org) Date: Tue, 31 May 2016 19:55:27 GMT Message-Id: <201605311955.u4VJtRj2099327@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to yuanxunzhang@FreeBSD.org using -f From: yuanxunzhang@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r304288 - soc2016/yuanxunzhang/head/usr.sbin/eaps 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: Tue, 31 May 2016 19:55:28 -0000 Author: yuanxunzhang Date: Tue May 31 19:55:27 2016 New Revision: 304288 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=304288 Log: eaps:create/delete eaps domain Modified: soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Modified: soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c ============================================================================== --- soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Tue May 31 18:45:52 2016 (r304287) +++ soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Tue May 31 19:55:27 2016 (r304288) @@ -1,9 +1,5 @@ /* - * Copyright (c) 1984, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * Sun Microsystems, Inc. + * Copyright (c) 2016 Yuanxun Zhang * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -13,14 +9,14 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. + * 3. The name of the author may not be used to endorse or promote + * products derived from this software without specific prior written + * permission. * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) @@ -28,6 +24,8 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. + * + * $FreeBSD$ */ #include @@ -90,7 +88,7 @@ createdomain(int argc, char **argv) { int error = 0; - warnx("Create EAPS domain %s", *argv); + warnx("Create EAPS domain %s", *(++argv)); exit(error); } @@ -98,7 +96,7 @@ deletedomain(int argc, char **argv) { int error = 0; - warnx("Delete EAPS domain %s", *argv); + warnx("Delete EAPS domain %s", *(++argv)); exit(error); } From owner-svn-soc-all@freebsd.org Fri Jun 3 03:23:03 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 24F76B66E83 for ; Fri, 3 Jun 2016 03:23:03 +0000 (UTC) (envelope-from yuanxunzhang@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 F30111C54 for ; Fri, 3 Jun 2016 03:23:02 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id u533N2tD027747 for ; Fri, 3 Jun 2016 03:23:02 GMT (envelope-from yuanxunzhang@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id u533N1Pb027286 for svn-soc-all@FreeBSD.org; Fri, 3 Jun 2016 03:23:01 GMT (envelope-from yuanxunzhang@FreeBSD.org) Date: Fri, 3 Jun 2016 03:23:01 GMT Message-Id: <201606030323.u533N1Pb027286@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to yuanxunzhang@FreeBSD.org using -f From: yuanxunzhang@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r304450 - in soc2016/yuanxunzhang/head: sys/net usr.sbin/eaps 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: Fri, 03 Jun 2016 03:23:03 -0000 Author: yuanxunzhang Date: Fri Jun 3 03:23:01 2016 New Revision: 304450 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=304450 Log: freeBSD:EAPS development Modified: soc2016/yuanxunzhang/head/sys/net/eaps.h soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Modified: soc2016/yuanxunzhang/head/sys/net/eaps.h ============================================================================== --- soc2016/yuanxunzhang/head/sys/net/eaps.h Fri Jun 3 00:48:50 2016 (r304449) +++ soc2016/yuanxunzhang/head/sys/net/eaps.h Fri Jun 3 03:23:01 2016 (r304450) @@ -31,6 +31,8 @@ #ifndef _NET_EAPS_H_ #define _NET_EAPS_H_ +#ifdef _KERNEL + /* * Extreme Active Protection System (EAPS) definitions. * Normative reference: draft-shah-extreme-rfc3619bis-02 [Expired I-D] @@ -100,6 +102,7 @@ uint16_t eaps_rsvd1[38]; /* Reserved; set to zero */ } __packed; + #define EAPS_VERSION_1 0x01 /* EAPSv1; may support v2 in future */ #define EAPS_HELLO_INTERVAL 0x04 /* hardcoded value of eaps_hello */ @@ -125,4 +128,6 @@ #define EAPS_S_PREFORWARD 0x05 /* Transit in PREFORWARDING State */ #define EAPS_S_INIT 0x06 /* Master node in INIT state */ +#endif /* _KERNEL */ + #endif /* _NET_EAPS_H_ */ Modified: soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c ============================================================================== --- soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Fri Jun 3 00:48:50 2016 (r304449) +++ soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Fri Jun 3 03:23:01 2016 (r304450) @@ -48,9 +48,19 @@ #include /* - * eaps - display, and configure eaps + * eaps - configure, and display eaps */ +/* +* EAPS Configuration Descriptor +*/ +struct eaps_d { + char eaps_name[32]; /* name of the EAPS domain */ + SLIST_ENTRY(eaps_d) eaps_entries; +}; + +static SLIST_HEAD(, eaps_d) eaps_head = SLIST_HEAD_INITIALIZER(eaps_head); + static struct keytab { const char *kt_cp; int kt_i; @@ -67,7 +77,7 @@ int main(int argc, char **argv) { - int rtn = 0; + int retval = 0; if (argc < 3) usage(NULL); @@ -78,10 +88,9 @@ case K_DELETE: deletedomain(argc, argv); - exit(0); } usage(*argv); - return rtn; + return retval; } static void From owner-svn-soc-all@freebsd.org Fri Jun 3 03:28:33 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 92235B66F72 for ; Fri, 3 Jun 2016 03:28:33 +0000 (UTC) (envelope-from yuanxunzhang@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 84F841FB8 for ; Fri, 3 Jun 2016 03:28:33 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id u533SXNj060393 for ; Fri, 3 Jun 2016 03:28:33 GMT (envelope-from yuanxunzhang@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id u533SWfX060007 for svn-soc-all@FreeBSD.org; Fri, 3 Jun 2016 03:28:32 GMT (envelope-from yuanxunzhang@FreeBSD.org) Date: Fri, 3 Jun 2016 03:28:32 GMT Message-Id: <201606030328.u533SWfX060007@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to yuanxunzhang@FreeBSD.org using -f From: yuanxunzhang@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r304451 - soc2016/yuanxunzhang/head/usr.sbin/eaps 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: Fri, 03 Jun 2016 03:28:33 -0000 Author: yuanxunzhang Date: Fri Jun 3 03:28:32 2016 New Revision: 304451 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=304451 Log: freeBSD:EAPS development Modified: soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Modified: soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c ============================================================================== --- soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Fri Jun 3 03:23:01 2016 (r304450) +++ soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Fri Jun 3 03:28:32 2016 (r304451) @@ -33,7 +33,7 @@ #include #include - +#include #include #include #include From owner-svn-soc-all@freebsd.org Fri Jun 3 03:51: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 04938B683A1 for ; Fri, 3 Jun 2016 03:51:21 +0000 (UTC) (envelope-from yuanxunzhang@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 E22A81B0D for ; Fri, 3 Jun 2016 03:51:20 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id u533pKPn029909 for ; Fri, 3 Jun 2016 03:51:20 GMT (envelope-from yuanxunzhang@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id u533pKDe029517 for svn-soc-all@FreeBSD.org; Fri, 3 Jun 2016 03:51:20 GMT (envelope-from yuanxunzhang@FreeBSD.org) Date: Fri, 3 Jun 2016 03:51:20 GMT Message-Id: <201606030351.u533pKDe029517@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to yuanxunzhang@FreeBSD.org using -f From: yuanxunzhang@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r304452 - soc2016/yuanxunzhang/head/usr.sbin/eaps 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: Fri, 03 Jun 2016 03:51:21 -0000 Author: yuanxunzhang Date: Fri Jun 3 03:51:19 2016 New Revision: 304452 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=304452 Log: freeBSD:EAPS development Modified: soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Modified: soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c ============================================================================== --- soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Fri Jun 3 03:28:32 2016 (r304451) +++ soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Fri Jun 3 03:51:19 2016 (r304452) @@ -97,7 +97,15 @@ createdomain(int argc, char **argv) { int error = 0; + struct eaps_d *eaps_new; + warnx("Create EAPS domain %s", *(++argv)); + eaps_new = (struct eaps_d *) malloc (sizeof(struct eaps_d)); + strlcpy(eaps_new->eaps_name, *(++argv), sizeof(eaps_new->eaps_name)); + + /* Add to keymap list */ + SLIST_INSERT_HEAD(&eaps_head, eaps_new, eaps_entries); + exit(error); } From owner-svn-soc-all@freebsd.org Fri Jun 3 03:53: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 AD76CB6848D for ; Fri, 3 Jun 2016 03:53:21 +0000 (UTC) (envelope-from yuanxunzhang@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 A19591D04 for ; Fri, 3 Jun 2016 03:53:21 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id u533rLZk087625 for ; Fri, 3 Jun 2016 03:53:21 GMT (envelope-from yuanxunzhang@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id u533rLZ2087228 for svn-soc-all@FreeBSD.org; Fri, 3 Jun 2016 03:53:21 GMT (envelope-from yuanxunzhang@FreeBSD.org) Date: Fri, 3 Jun 2016 03:53:21 GMT Message-Id: <201606030353.u533rLZ2087228@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to yuanxunzhang@FreeBSD.org using -f From: yuanxunzhang@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r304453 - soc2016/yuanxunzhang/head/usr.sbin/eaps 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: Fri, 03 Jun 2016 03:53:21 -0000 Author: yuanxunzhang Date: Fri Jun 3 03:53:20 2016 New Revision: 304453 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=304453 Log: freeBSD:EAPS development Modified: soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Modified: soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c ============================================================================== --- soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Fri Jun 3 03:51:19 2016 (r304452) +++ soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Fri Jun 3 03:53:20 2016 (r304453) @@ -98,14 +98,15 @@ { int error = 0; struct eaps_d *eaps_new; - - warnx("Create EAPS domain %s", *(++argv)); + char *domain_name = *(++argv); + + warnx("Create EAPS domain %s", domain_name); eaps_new = (struct eaps_d *) malloc (sizeof(struct eaps_d)); - strlcpy(eaps_new->eaps_name, *(++argv), sizeof(eaps_new->eaps_name)); + strlcpy(eaps_new->eaps_name, domain_name, sizeof(eaps_new->eaps_name)); /* Add to keymap list */ SLIST_INSERT_HEAD(&eaps_head, eaps_new, eaps_entries); - + exit(error); } From owner-svn-soc-all@freebsd.org Fri Jun 3 05:00:29 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 E1DF8B68E09 for ; Fri, 3 Jun 2016 05:00:29 +0000 (UTC) (envelope-from yuanxunzhang@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 D5B6F1498 for ; Fri, 3 Jun 2016 05:00:29 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id u5350TI0008915 for ; Fri, 3 Jun 2016 05:00:29 GMT (envelope-from yuanxunzhang@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id u5350TU7008660 for svn-soc-all@FreeBSD.org; Fri, 3 Jun 2016 05:00:29 GMT (envelope-from yuanxunzhang@FreeBSD.org) Date: Fri, 3 Jun 2016 05:00:29 GMT Message-Id: <201606030500.u5350TU7008660@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to yuanxunzhang@FreeBSD.org using -f From: yuanxunzhang@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r304458 - soc2016/yuanxunzhang/head/usr.sbin/eaps 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: Fri, 03 Jun 2016 05:00:30 -0000 Author: yuanxunzhang Date: Fri Jun 3 05:00:28 2016 New Revision: 304458 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=304458 Log: freeBSD:EAPS development Modified: soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Modified: soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c ============================================================================== --- soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Fri Jun 3 03:40:39 2016 (r304457) +++ soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Fri Jun 3 05:00:28 2016 (r304458) @@ -88,6 +88,9 @@ case K_DELETE: deletedomain(argc, argv); + + case K_DISPLAY: + displayeaps(argc, argv); } usage(*argv); return retval; @@ -99,8 +102,8 @@ int error = 0; struct eaps_d *eaps_new; char *domain_name = *(++argv); - - warnx("Create EAPS domain %s", domain_name); + + warnx("Create eaps domain %s", domain_name); eaps_new = (struct eaps_d *) malloc (sizeof(struct eaps_d)); strlcpy(eaps_new->eaps_name, domain_name, sizeof(eaps_new->eaps_name)); @@ -114,7 +117,25 @@ deletedomain(int argc, char **argv) { int error = 0; - warnx("Delete EAPS domain %s", *(++argv)); + warnx("Delete eaps domain %s", *(++argv)); + exit(error); +} + +static void +displayeaps(int argc, char **argv) +{ + int error = 0; + struct keymap *eaps, + warnx("Display eaps domain"); + + if (SLIST_EMPTY(&eaps_head)) { + warnx("No eaps Configuration!"); + } + /* Display EAPS information*/ + SLIST_FOREACH(eaps, &eaps_head, eaps_entries) { + printf("\t%s\n", eaps->eaps_name); + } + exit(error); } From owner-svn-soc-all@freebsd.org Fri Jun 3 05:02:41 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 5F378B68F4B for ; Fri, 3 Jun 2016 05:02:41 +0000 (UTC) (envelope-from yuanxunzhang@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 535A619A2 for ; Fri, 3 Jun 2016 05:02:41 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id u5352fJX047065 for ; Fri, 3 Jun 2016 05:02:41 GMT (envelope-from yuanxunzhang@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id u5352e3R047063 for svn-soc-all@FreeBSD.org; Fri, 3 Jun 2016 05:02:40 GMT (envelope-from yuanxunzhang@FreeBSD.org) Date: Fri, 3 Jun 2016 05:02:40 GMT Message-Id: <201606030502.u5352e3R047063@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to yuanxunzhang@FreeBSD.org using -f From: yuanxunzhang@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r304459 - soc2016/yuanxunzhang/head/usr.sbin/eaps 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: Fri, 03 Jun 2016 05:02:41 -0000 Author: yuanxunzhang Date: Fri Jun 3 05:02:40 2016 New Revision: 304459 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=304459 Log: freeBSD:EAPS development Modified: soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Modified: soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c ============================================================================== --- soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Fri Jun 3 05:00:28 2016 (r304458) +++ soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Fri Jun 3 05:02:40 2016 (r304459) @@ -125,7 +125,7 @@ displayeaps(int argc, char **argv) { int error = 0; - struct keymap *eaps, + struct eaps_d *eaps, warnx("Display eaps domain"); if (SLIST_EMPTY(&eaps_head)) { From owner-svn-soc-all@freebsd.org Fri Jun 3 05:07:08 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 45D0CB68178 for ; Fri, 3 Jun 2016 05:07:08 +0000 (UTC) (envelope-from yuanxunzhang@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 368321F21 for ; Fri, 3 Jun 2016 05:07:08 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id u535786g052875 for ; Fri, 3 Jun 2016 05:07:08 GMT (envelope-from yuanxunzhang@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id u53577Kr052873 for svn-soc-all@FreeBSD.org; Fri, 3 Jun 2016 05:07:07 GMT (envelope-from yuanxunzhang@FreeBSD.org) Date: Fri, 3 Jun 2016 05:07:07 GMT Message-Id: <201606030507.u53577Kr052873@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to yuanxunzhang@FreeBSD.org using -f From: yuanxunzhang@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r304460 - soc2016/yuanxunzhang/head/usr.sbin/eaps 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: Fri, 03 Jun 2016 05:07:08 -0000 Author: yuanxunzhang Date: Fri Jun 3 05:07:07 2016 New Revision: 304460 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=304460 Log: freeBSD:EAPS development Modified: soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Modified: soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c ============================================================================== --- soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Fri Jun 3 05:02:40 2016 (r304459) +++ soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Fri Jun 3 05:07:07 2016 (r304460) @@ -72,6 +72,7 @@ int keyword(const char *); static void createdomain(int, char **); static void deletedomain(int, char **); +static void displayeaps(int, char **); static void usage(const char *); int @@ -126,10 +127,9 @@ { int error = 0; struct eaps_d *eaps, - warnx("Display eaps domain"); if (SLIST_EMPTY(&eaps_head)) { - warnx("No eaps Configuration!"); + warn("No eaps Configuration!"); } /* Display EAPS information*/ SLIST_FOREACH(eaps, &eaps_head, eaps_entries) { From owner-svn-soc-all@freebsd.org Fri Jun 3 05:07:42 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 9D203B681E8 for ; Fri, 3 Jun 2016 05:07:42 +0000 (UTC) (envelope-from yuanxunzhang@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 8B1AD1F9F for ; Fri, 3 Jun 2016 05:07:42 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id u5357gOL053578 for ; Fri, 3 Jun 2016 05:07:42 GMT (envelope-from yuanxunzhang@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id u5357gBR053576 for svn-soc-all@FreeBSD.org; Fri, 3 Jun 2016 05:07:42 GMT (envelope-from yuanxunzhang@FreeBSD.org) Date: Fri, 3 Jun 2016 05:07:42 GMT Message-Id: <201606030507.u5357gBR053576@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to yuanxunzhang@FreeBSD.org using -f From: yuanxunzhang@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r304461 - soc2016/yuanxunzhang/head/usr.sbin/eaps 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: Fri, 03 Jun 2016 05:07:42 -0000 Author: yuanxunzhang Date: Fri Jun 3 05:07:41 2016 New Revision: 304461 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=304461 Log: freeBSD:EAPS development Modified: soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Modified: soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c ============================================================================== --- soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Fri Jun 3 05:07:07 2016 (r304460) +++ soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Fri Jun 3 05:07:41 2016 (r304461) @@ -126,7 +126,7 @@ displayeaps(int argc, char **argv) { int error = 0; - struct eaps_d *eaps, + struct eaps_d *eaps; if (SLIST_EMPTY(&eaps_head)) { warn("No eaps Configuration!"); From owner-svn-soc-all@freebsd.org Fri Jun 3 05:09:53 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 9EEA9B6822A for ; Fri, 3 Jun 2016 05:09:53 +0000 (UTC) (envelope-from yuanxunzhang@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 930EE1FEA for ; Fri, 3 Jun 2016 05:09:53 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id u5359rSG056817 for ; Fri, 3 Jun 2016 05:09:53 GMT (envelope-from yuanxunzhang@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id u5359qUA056770 for svn-soc-all@FreeBSD.org; Fri, 3 Jun 2016 05:09:52 GMT (envelope-from yuanxunzhang@FreeBSD.org) Date: Fri, 3 Jun 2016 05:09:52 GMT Message-Id: <201606030509.u5359qUA056770@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to yuanxunzhang@FreeBSD.org using -f From: yuanxunzhang@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r304462 - soc2016/yuanxunzhang/head/usr.sbin/eaps 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: Fri, 03 Jun 2016 05:09:53 -0000 Author: yuanxunzhang Date: Fri Jun 3 05:09:51 2016 New Revision: 304462 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=304462 Log: freeBSD:EAPS development Modified: soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Modified: soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c ============================================================================== --- soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Fri Jun 3 05:07:41 2016 (r304461) +++ soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Fri Jun 3 05:09:51 2016 (r304462) @@ -79,7 +79,7 @@ main(int argc, char **argv) { int retval = 0; - if (argc < 3) + if (argc < 2) usage(NULL); if (*(++argv) != NULL) From owner-svn-soc-all@freebsd.org Fri Jun 3 05:11:07 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 20BC2B6825C for ; Fri, 3 Jun 2016 05:11:07 +0000 (UTC) (envelope-from yuanxunzhang@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 150791079 for ; Fri, 3 Jun 2016 05:11:07 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id u535B69P061578 for ; Fri, 3 Jun 2016 05:11:06 GMT (envelope-from yuanxunzhang@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id u535B6iE061550 for svn-soc-all@FreeBSD.org; Fri, 3 Jun 2016 05:11:06 GMT (envelope-from yuanxunzhang@FreeBSD.org) Date: Fri, 3 Jun 2016 05:11:06 GMT Message-Id: <201606030511.u535B6iE061550@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to yuanxunzhang@FreeBSD.org using -f From: yuanxunzhang@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r304463 - soc2016/yuanxunzhang/head/usr.sbin/eaps 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: Fri, 03 Jun 2016 05:11:07 -0000 Author: yuanxunzhang Date: Fri Jun 3 05:11:05 2016 New Revision: 304463 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=304463 Log: freeBSD:EAPS development Modified: soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Modified: soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c ============================================================================== --- soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Fri Jun 3 05:09:51 2016 (r304462) +++ soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Fri Jun 3 05:11:05 2016 (r304463) @@ -129,7 +129,7 @@ struct eaps_d *eaps; if (SLIST_EMPTY(&eaps_head)) { - warn("No eaps Configuration!"); + printf("No eaps Configuration!\n"); } /* Display EAPS information*/ SLIST_FOREACH(eaps, &eaps_head, eaps_entries) { From owner-svn-soc-all@freebsd.org Fri Jun 3 05:15:17 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 CA6CDB683A7 for ; Fri, 3 Jun 2016 05:15:17 +0000 (UTC) (envelope-from yuanxunzhang@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 BDC7C1285 for ; Fri, 3 Jun 2016 05:15:17 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id u535FHcb071663 for ; Fri, 3 Jun 2016 05:15:17 GMT (envelope-from yuanxunzhang@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id u535FHEk071660 for svn-soc-all@FreeBSD.org; Fri, 3 Jun 2016 05:15:17 GMT (envelope-from yuanxunzhang@FreeBSD.org) Date: Fri, 3 Jun 2016 05:15:17 GMT Message-Id: <201606030515.u535FHEk071660@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to yuanxunzhang@FreeBSD.org using -f From: yuanxunzhang@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r304464 - soc2016/yuanxunzhang/head/usr.sbin/eaps 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: Fri, 03 Jun 2016 05:15:17 -0000 Author: yuanxunzhang Date: Fri Jun 3 05:15:16 2016 New Revision: 304464 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=304464 Log: freeBSD:EAPS development Modified: soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Modified: soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c ============================================================================== --- soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Fri Jun 3 05:11:05 2016 (r304463) +++ soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Fri Jun 3 05:15:16 2016 (r304464) @@ -128,9 +128,9 @@ int error = 0; struct eaps_d *eaps; - if (SLIST_EMPTY(&eaps_head)) { - printf("No eaps Configuration!\n"); - } + // if (SLIST_EMPTY(&eaps_head)) { + // printf("No eaps Configuration!\n"); + // } /* Display EAPS information*/ SLIST_FOREACH(eaps, &eaps_head, eaps_entries) { printf("\t%s\n", eaps->eaps_name); From owner-svn-soc-all@freebsd.org Fri Jun 3 05:25:16 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 8C9BCB685A0 for ; Fri, 3 Jun 2016 05:25:16 +0000 (UTC) (envelope-from yuanxunzhang@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 806581761 for ; Fri, 3 Jun 2016 05:25:16 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id u535PGqd092425 for ; Fri, 3 Jun 2016 05:25:16 GMT (envelope-from yuanxunzhang@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id u535PFNb092423 for svn-soc-all@FreeBSD.org; Fri, 3 Jun 2016 05:25:15 GMT (envelope-from yuanxunzhang@FreeBSD.org) Date: Fri, 3 Jun 2016 05:25:15 GMT Message-Id: <201606030525.u535PFNb092423@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to yuanxunzhang@FreeBSD.org using -f From: yuanxunzhang@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r304465 - soc2016/yuanxunzhang/head/usr.sbin/eaps 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: Fri, 03 Jun 2016 05:25:16 -0000 Author: yuanxunzhang Date: Fri Jun 3 05:25:15 2016 New Revision: 304465 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=304465 Log: freeBSD:EAPS development Modified: soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Modified: soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c ============================================================================== --- soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Fri Jun 3 05:15:16 2016 (r304464) +++ soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Fri Jun 3 05:25:15 2016 (r304465) @@ -59,7 +59,7 @@ SLIST_ENTRY(eaps_d) eaps_entries; }; -static SLIST_HEAD(, eaps_d) eaps_head = SLIST_HEAD_INITIALIZER(eaps_head); +static SLIST_HEAD(, eaps_d) head = SLIST_HEAD_INITIALIZER(head); static struct keytab { const char *kt_cp; @@ -109,7 +109,7 @@ strlcpy(eaps_new->eaps_name, domain_name, sizeof(eaps_new->eaps_name)); /* Add to keymap list */ - SLIST_INSERT_HEAD(&eaps_head, eaps_new, eaps_entries); + SLIST_INSERT_HEAD(&head, eaps_new, eaps_entries); exit(error); } @@ -128,12 +128,13 @@ int error = 0; struct eaps_d *eaps; - // if (SLIST_EMPTY(&eaps_head)) { - // printf("No eaps Configuration!\n"); - // } + if (SLIST_EMPTY(&head)) { + printf("No eaps Configuration!\n"); + } + /* Display EAPS information*/ - SLIST_FOREACH(eaps, &eaps_head, eaps_entries) { - printf("\t%s\n", eaps->eaps_name); + SLIST_FOREACH(eaps, &head, eaps_entries) { + printf("\t%s:\n", eaps->eaps_name); } exit(error); From owner-svn-soc-all@freebsd.org Fri Jun 3 05:25:53 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 64299B685B7 for ; Fri, 3 Jun 2016 05:25:53 +0000 (UTC) (envelope-from yuanxunzhang@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 582531775 for ; Fri, 3 Jun 2016 05:25:53 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id u535PrBN093154 for ; Fri, 3 Jun 2016 05:25:53 GMT (envelope-from yuanxunzhang@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id u535PqL9093093 for svn-soc-all@FreeBSD.org; Fri, 3 Jun 2016 05:25:52 GMT (envelope-from yuanxunzhang@FreeBSD.org) Date: Fri, 3 Jun 2016 05:25:52 GMT Message-Id: <201606030525.u535PqL9093093@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to yuanxunzhang@FreeBSD.org using -f From: yuanxunzhang@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r304466 - soc2016/yuanxunzhang/head/usr.sbin/eaps 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: Fri, 03 Jun 2016 05:25:53 -0000 Author: yuanxunzhang Date: Fri Jun 3 05:25:52 2016 New Revision: 304466 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=304466 Log: freeBSD:EAPS development Modified: soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Modified: soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c ============================================================================== --- soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Fri Jun 3 05:25:15 2016 (r304465) +++ soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Fri Jun 3 05:25:52 2016 (r304466) @@ -104,7 +104,7 @@ struct eaps_d *eaps_new; char *domain_name = *(++argv); - warnx("Create eaps domain %s", domain_name); + printf("Create eaps domain %s", domain_name); eaps_new = (struct eaps_d *) malloc (sizeof(struct eaps_d)); strlcpy(eaps_new->eaps_name, domain_name, sizeof(eaps_new->eaps_name)); @@ -118,7 +118,7 @@ deletedomain(int argc, char **argv) { int error = 0; - warnx("Delete eaps domain %s", *(++argv)); + printf("Delete eaps domain %s", *(++argv)); exit(error); } From owner-svn-soc-all@freebsd.org Fri Jun 3 05:29: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 0BBC8B686E6 for ; Fri, 3 Jun 2016 05:29:48 +0000 (UTC) (envelope-from yuanxunzhang@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 F3C14198E for ; Fri, 3 Jun 2016 05:29:47 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id u535Tlbv097730 for ; Fri, 3 Jun 2016 05:29:47 GMT (envelope-from yuanxunzhang@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id u535Tlg9097693 for svn-soc-all@FreeBSD.org; Fri, 3 Jun 2016 05:29:47 GMT (envelope-from yuanxunzhang@FreeBSD.org) Date: Fri, 3 Jun 2016 05:29:47 GMT Message-Id: <201606030529.u535Tlg9097693@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to yuanxunzhang@FreeBSD.org using -f From: yuanxunzhang@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r304467 - soc2016/yuanxunzhang/head/usr.sbin/eaps 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: Fri, 03 Jun 2016 05:29:48 -0000 Author: yuanxunzhang Date: Fri Jun 3 05:29:46 2016 New Revision: 304467 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=304467 Log: freeBSD:EAPS development Modified: soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Modified: soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c ============================================================================== --- soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Fri Jun 3 05:25:52 2016 (r304466) +++ soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Fri Jun 3 05:29:46 2016 (r304467) @@ -59,7 +59,7 @@ SLIST_ENTRY(eaps_d) eaps_entries; }; -static SLIST_HEAD(, eaps_d) head = SLIST_HEAD_INITIALIZER(head); +static SLIST_HEAD(slisthead, eaps_d) head = SLIST_HEAD_INITIALIZER(head); static struct keytab { const char *kt_cp; @@ -104,7 +104,7 @@ struct eaps_d *eaps_new; char *domain_name = *(++argv); - printf("Create eaps domain %s", domain_name); + printf("Create eaps domain %s!\n", domain_name); eaps_new = (struct eaps_d *) malloc (sizeof(struct eaps_d)); strlcpy(eaps_new->eaps_name, domain_name, sizeof(eaps_new->eaps_name)); @@ -118,7 +118,7 @@ deletedomain(int argc, char **argv) { int error = 0; - printf("Delete eaps domain %s", *(++argv)); + printf("Delete eaps domain %s!\n", *(++argv)); exit(error); } From owner-svn-soc-all@freebsd.org Fri Jun 3 05:38:55 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 AF6DCB688EA for ; Fri, 3 Jun 2016 05:38:55 +0000 (UTC) (envelope-from yuanxunzhang@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 A37071DCF for ; Fri, 3 Jun 2016 05:38:55 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id u535ctEG017120 for ; Fri, 3 Jun 2016 05:38:55 GMT (envelope-from yuanxunzhang@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id u535ctf7017062 for svn-soc-all@FreeBSD.org; Fri, 3 Jun 2016 05:38:55 GMT (envelope-from yuanxunzhang@FreeBSD.org) Date: Fri, 3 Jun 2016 05:38:55 GMT Message-Id: <201606030538.u535ctf7017062@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to yuanxunzhang@FreeBSD.org using -f From: yuanxunzhang@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r304468 - soc2016/yuanxunzhang/head/usr.sbin/eaps 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: Fri, 03 Jun 2016 05:38:55 -0000 Author: yuanxunzhang Date: Fri Jun 3 05:38:54 2016 New Revision: 304468 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=304468 Log: freeBSD:EAPS development Modified: soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Modified: soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c ============================================================================== --- soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Fri Jun 3 05:29:46 2016 (r304467) +++ soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Fri Jun 3 05:38:54 2016 (r304468) @@ -108,9 +108,13 @@ eaps_new = (struct eaps_d *) malloc (sizeof(struct eaps_d)); strlcpy(eaps_new->eaps_name, domain_name, sizeof(eaps_new->eaps_name)); - /* Add to keymap list */ + /* Add to eaps list */ SLIST_INSERT_HEAD(&head, eaps_new, eaps_entries); + if (SLIST_EMPTY(&head)) { + printf("No eaps Configuration!\n"); + } + exit(error); } From owner-svn-soc-all@freebsd.org Fri Jun 3 05:41:45 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 22E63B68A05 for ; Fri, 3 Jun 2016 05:41:45 +0000 (UTC) (envelope-from yuanxunzhang@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 16A371EC6 for ; Fri, 3 Jun 2016 05:41:45 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id u535fimt024638 for ; Fri, 3 Jun 2016 05:41:44 GMT (envelope-from yuanxunzhang@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id u535fiDw024095 for svn-soc-all@FreeBSD.org; Fri, 3 Jun 2016 05:41:44 GMT (envelope-from yuanxunzhang@FreeBSD.org) Date: Fri, 3 Jun 2016 05:41:44 GMT Message-Id: <201606030541.u535fiDw024095@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to yuanxunzhang@FreeBSD.org using -f From: yuanxunzhang@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r304469 - soc2016/yuanxunzhang/head/usr.sbin/eaps 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: Fri, 03 Jun 2016 05:41:45 -0000 Author: yuanxunzhang Date: Fri Jun 3 05:41:43 2016 New Revision: 304469 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=304469 Log: freeBSD:EAPS development Modified: soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Modified: soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c ============================================================================== --- soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Fri Jun 3 05:38:54 2016 (r304468) +++ soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Fri Jun 3 05:41:43 2016 (r304469) @@ -113,8 +113,15 @@ if (SLIST_EMPTY(&head)) { printf("No eaps Configuration!\n"); + } else { + + /* Display EAPS information*/ + SLIST_FOREACH(eaps, &head, eaps_entries) { + printf("\t%s:\n", eaps->eaps_name); + } } - + + exit(error); } From owner-svn-soc-all@freebsd.org Fri Jun 3 05:42: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 7320AB68A1F for ; Fri, 3 Jun 2016 05:42:21 +0000 (UTC) (envelope-from yuanxunzhang@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 66BBC1F4E for ; Fri, 3 Jun 2016 05:42:21 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id u535gLc1028913 for ; Fri, 3 Jun 2016 05:42:21 GMT (envelope-from yuanxunzhang@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id u535gKB4028837 for svn-soc-all@FreeBSD.org; Fri, 3 Jun 2016 05:42:20 GMT (envelope-from yuanxunzhang@FreeBSD.org) Date: Fri, 3 Jun 2016 05:42:20 GMT Message-Id: <201606030542.u535gKB4028837@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to yuanxunzhang@FreeBSD.org using -f From: yuanxunzhang@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r304470 - soc2016/yuanxunzhang/head/usr.sbin/eaps 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: Fri, 03 Jun 2016 05:42:21 -0000 Author: yuanxunzhang Date: Fri Jun 3 05:42:20 2016 New Revision: 304470 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=304470 Log: freeBSD:EAPS development Modified: soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Modified: soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c ============================================================================== --- soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Fri Jun 3 05:41:43 2016 (r304469) +++ soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Fri Jun 3 05:42:20 2016 (r304470) @@ -101,7 +101,7 @@ createdomain(int argc, char **argv) { int error = 0; - struct eaps_d *eaps_new; + struct eaps_d *eaps_new, *eaps; char *domain_name = *(++argv); printf("Create eaps domain %s!\n", domain_name); From owner-svn-soc-all@freebsd.org Fri Jun 3 05:59:27 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 2E8E4B68C3C for ; Fri, 3 Jun 2016 05:59:27 +0000 (UTC) (envelope-from yuanxunzhang@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 228071669 for ; Fri, 3 Jun 2016 05:59:27 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id u535xRCG059934 for ; Fri, 3 Jun 2016 05:59:27 GMT (envelope-from yuanxunzhang@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id u535xQhE059930 for svn-soc-all@FreeBSD.org; Fri, 3 Jun 2016 05:59:26 GMT (envelope-from yuanxunzhang@FreeBSD.org) Date: Fri, 3 Jun 2016 05:59:26 GMT Message-Id: <201606030559.u535xQhE059930@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to yuanxunzhang@FreeBSD.org using -f From: yuanxunzhang@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r304471 - soc2016/yuanxunzhang/head/usr.sbin/eaps 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: Fri, 03 Jun 2016 05:59:27 -0000 Author: yuanxunzhang Date: Fri Jun 3 05:59:26 2016 New Revision: 304471 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=304471 Log: freeBSD:EAPS development Modified: soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Modified: soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c ============================================================================== --- soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Fri Jun 3 05:42:20 2016 (r304470) +++ soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Fri Jun 3 05:59:26 2016 (r304471) @@ -48,7 +48,7 @@ #include /* - * eaps - configure, and display eaps + * EAPS - configure, and display eaps */ /* @@ -101,7 +101,7 @@ createdomain(int argc, char **argv) { int error = 0; - struct eaps_d *eaps_new, *eaps; + struct eaps_d *eaps_new; char *domain_name = *(++argv); printf("Create eaps domain %s!\n", domain_name); @@ -111,17 +111,6 @@ /* Add to eaps list */ SLIST_INSERT_HEAD(&head, eaps_new, eaps_entries); - if (SLIST_EMPTY(&head)) { - printf("No eaps Configuration!\n"); - } else { - - /* Display EAPS information*/ - SLIST_FOREACH(eaps, &head, eaps_entries) { - printf("\t%s:\n", eaps->eaps_name); - } - } - - exit(error); } @@ -139,7 +128,7 @@ int error = 0; struct eaps_d *eaps; - if (SLIST_EMPTY(&head)) { + if (SLIST_EMPTY(&fdsfds)) { printf("No eaps Configuration!\n"); } From owner-svn-soc-all@freebsd.org Fri Jun 3 05:59:52 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 749E7B68C5A for ; Fri, 3 Jun 2016 05:59:52 +0000 (UTC) (envelope-from yuanxunzhang@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 68B881680 for ; Fri, 3 Jun 2016 05:59:52 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id u535xqCw060432 for ; Fri, 3 Jun 2016 05:59:52 GMT (envelope-from yuanxunzhang@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id u535xpkU060430 for svn-soc-all@FreeBSD.org; Fri, 3 Jun 2016 05:59:51 GMT (envelope-from yuanxunzhang@FreeBSD.org) Date: Fri, 3 Jun 2016 05:59:51 GMT Message-Id: <201606030559.u535xpkU060430@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to yuanxunzhang@FreeBSD.org using -f From: yuanxunzhang@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r304472 - soc2016/yuanxunzhang/head/usr.sbin/eaps 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: Fri, 03 Jun 2016 05:59:52 -0000 Author: yuanxunzhang Date: Fri Jun 3 05:59:51 2016 New Revision: 304472 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=304472 Log: freeBSD:EAPS development Modified: soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Modified: soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c ============================================================================== --- soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Fri Jun 3 05:59:26 2016 (r304471) +++ soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Fri Jun 3 05:59:51 2016 (r304472) @@ -128,7 +128,7 @@ int error = 0; struct eaps_d *eaps; - if (SLIST_EMPTY(&fdsfds)) { + if (SLIST_EMPTY(&head)) { printf("No eaps Configuration!\n"); } From owner-svn-soc-all@freebsd.org Fri Jun 3 14:06:47 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 1FDCAB68F4D for ; Fri, 3 Jun 2016 14:06:47 +0000 (UTC) (envelope-from vincenzo@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 EE43419C3 for ; Fri, 3 Jun 2016 14:06:46 +0000 (UTC) (envelope-from vincenzo@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id u53E6kIP057205 for ; Fri, 3 Jun 2016 14:06:46 GMT (envelope-from vincenzo@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id u53E6kYW057181 for svn-soc-all@FreeBSD.org; Fri, 3 Jun 2016 14:06:46 GMT (envelope-from vincenzo@FreeBSD.org) Date: Fri, 3 Jun 2016 14:06:46 GMT Message-Id: <201606031406.u53E6kYW057181@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to vincenzo@FreeBSD.org using -f From: vincenzo@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r304508 - soc2016/vincenzo/head/sys/dev/netmap 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: Fri, 03 Jun 2016 14:06:47 -0000 Author: vincenzo Date: Fri Jun 3 14:06:45 2016 New Revision: 304508 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=304508 Log: freebsd: ptnet: netmap attach and detach Modified: soc2016/vincenzo/head/sys/dev/netmap/if_ptnet.c Modified: soc2016/vincenzo/head/sys/dev/netmap/if_ptnet.c ============================================================================== --- soc2016/vincenzo/head/sys/dev/netmap/if_ptnet.c Fri Jun 3 13:57:10 2016 (r304507) +++ soc2016/vincenzo/head/sys/dev/netmap/if_ptnet.c Fri Jun 3 14:06:45 2016 (r304508) @@ -112,6 +112,8 @@ unsigned int num_rings; struct ptnet_queue *queues; struct ptnet_csb *csb; + + struct netmap_pt_guest_adapter *ptna_nm; }; #define PTNET_CORE_LOCK_INIT(_sc) do { \ @@ -145,6 +147,8 @@ static int ptnet_irqs_init(struct ptnet_softc *sc); static void ptnet_irqs_fini(struct ptnet_softc *sc); +static uint32_t ptnet_nm_ptctl(struct ifnet *ifp, uint32_t cmd); + static void ptnet_tx_intr(void *opaque); static void ptnet_rx_intr(void *opaque); @@ -189,6 +193,8 @@ { uint32_t ptfeatures = NET_PTN_FEATURES_BASE; unsigned int num_rx_rings, num_tx_rings; + struct netmap_adapter na_arg; + unsigned int nifp_offset; struct ptnet_softc *sc; struct ifnet *ifp; uint32_t macreg; @@ -311,6 +317,22 @@ PTNET_CORE_LOCK_INIT(sc); + /* Prepare a netmap_adapter struct instance to do netmap_attach(). */ + nifp_offset = bus_read_4(sc->iomem, PTNET_IO_NIFP_OFS); + na_arg.ifp = ifp; + na_arg.num_tx_desc = bus_read_4(sc->iomem, PTNET_IO_NUM_TX_SLOTS); + na_arg.num_rx_desc = bus_read_4(sc->iomem, PTNET_IO_NUM_RX_SLOTS); + na_arg.num_tx_rings = num_tx_rings; + na_arg.num_rx_rings = num_rx_rings; + + netmap_pt_guest_attach(&na_arg, sc->csb, nifp_offset, ptnet_nm_ptctl); + + /* Now a netmap adapter for this ifp has been allocated, and it + * can be accessed through NA(ifp). We also have to initialize the CSB + * pointer. */ + sc->ptna_nm = (struct netmap_pt_guest_adapter *)NA(ifp); + sc->ptna_nm->csb = sc->csb; + return (0); err_path: @@ -327,6 +349,9 @@ if (sc->ifp) { ether_ifdetach(sc->ifp); + + netmap_detach(sc->ifp); + ifmedia_removeall(&sc->media); if_free(sc->ifp); sc->ifp = NULL; @@ -581,6 +606,19 @@ } } +static uint32_t +ptnet_nm_ptctl(struct ifnet *ifp, uint32_t cmd) +{ + struct ptnet_softc *sc = ifp->if_softc; + int ret; + + bus_write_4(sc->iomem, PTNET_IO_PTCTL, cmd); + ret = bus_read_4(sc->iomem, PTNET_IO_PTSTS); + device_printf(sc->dev, "PTCTL %u, ret %u\n", cmd, ret); + + return ret; +} + static void ptnet_tx_intr(void *opaque) { From owner-svn-soc-all@freebsd.org Fri Jun 3 14:07:09 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 6229EB68F6D for ; Fri, 3 Jun 2016 14:07:09 +0000 (UTC) (envelope-from vincenzo@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 5645619E0 for ; Fri, 3 Jun 2016 14:07:09 +0000 (UTC) (envelope-from vincenzo@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id u53E79fh057699 for ; Fri, 3 Jun 2016 14:07:09 GMT (envelope-from vincenzo@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id u53E78AR057697 for svn-soc-all@FreeBSD.org; Fri, 3 Jun 2016 14:07:08 GMT (envelope-from vincenzo@FreeBSD.org) Date: Fri, 3 Jun 2016 14:07:08 GMT Message-Id: <201606031407.u53E78AR057697@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to vincenzo@FreeBSD.org using -f From: vincenzo@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r304509 - soc2016/vincenzo/head/sys/dev/netmap 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: Fri, 03 Jun 2016 14:07:09 -0000 Author: vincenzo Date: Fri Jun 3 14:07:08 2016 New Revision: 304509 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=304509 Log: freebsd: ptnet: implement ptnet_nm_config() Modified: soc2016/vincenzo/head/sys/dev/netmap/if_ptnet.c Modified: soc2016/vincenzo/head/sys/dev/netmap/if_ptnet.c ============================================================================== --- soc2016/vincenzo/head/sys/dev/netmap/if_ptnet.c Fri Jun 3 14:06:45 2016 (r304508) +++ soc2016/vincenzo/head/sys/dev/netmap/if_ptnet.c Fri Jun 3 14:07:08 2016 (r304509) @@ -148,6 +148,8 @@ static void ptnet_irqs_fini(struct ptnet_softc *sc); static uint32_t ptnet_nm_ptctl(struct ifnet *ifp, uint32_t cmd); +static int ptnet_nm_config(struct netmap_adapter *na, unsigned *txr, + unsigned *txd, unsigned *rxr, unsigned *rxd); static void ptnet_tx_intr(void *opaque); static void ptnet_rx_intr(void *opaque); @@ -324,6 +326,7 @@ na_arg.num_rx_desc = bus_read_4(sc->iomem, PTNET_IO_NUM_RX_SLOTS); na_arg.num_tx_rings = num_tx_rings; na_arg.num_rx_rings = num_rx_rings; + na_arg.nm_config = ptnet_nm_config; netmap_pt_guest_attach(&na_arg, sc->csb, nifp_offset, ptnet_nm_ptctl); @@ -619,6 +622,23 @@ return ret; } +static int +ptnet_nm_config(struct netmap_adapter *na, unsigned *txr, unsigned *txd, + unsigned *rxr, unsigned *rxd) +{ + struct ptnet_softc *sc = na->ifp->if_softc; + + *txr = bus_read_4(sc->iomem, PTNET_IO_NUM_TX_RINGS); + *rxr = bus_read_4(sc->iomem, PTNET_IO_NUM_RX_RINGS); + *txd = bus_read_4(sc->iomem, PTNET_IO_NUM_TX_SLOTS); + *rxd = bus_read_4(sc->iomem, PTNET_IO_NUM_RX_SLOTS); + + device_printf(sc->dev, "txr %u, rxr %u, txd %u, rxd %u\n", + *txr, *rxr, *txd, *rxd); + + return 0; +} + static void ptnet_tx_intr(void *opaque) { From owner-svn-soc-all@freebsd.org Fri Jun 3 14:07: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 CBB60B68F8A for ; Fri, 3 Jun 2016 14:07:24 +0000 (UTC) (envelope-from vincenzo@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 A612A19FB for ; Fri, 3 Jun 2016 14:07:24 +0000 (UTC) (envelope-from vincenzo@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id u53E7OTI058123 for ; Fri, 3 Jun 2016 14:07:24 GMT (envelope-from vincenzo@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id u53E7Of7058035 for svn-soc-all@FreeBSD.org; Fri, 3 Jun 2016 14:07:24 GMT (envelope-from vincenzo@FreeBSD.org) Date: Fri, 3 Jun 2016 14:07:24 GMT Message-Id: <201606031407.u53E7Of7058035@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to vincenzo@FreeBSD.org using -f From: vincenzo@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r304510 - soc2016/vincenzo/head/sys/dev/netmap 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: Fri, 03 Jun 2016 14:07:24 -0000 Author: vincenzo Date: Fri Jun 3 14:07:23 2016 New Revision: 304510 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=304510 Log: freebsd: ptnet_queue: add ptring and kick fields Modified: soc2016/vincenzo/head/sys/dev/netmap/if_ptnet.c Modified: soc2016/vincenzo/head/sys/dev/netmap/if_ptnet.c ============================================================================== --- soc2016/vincenzo/head/sys/dev/netmap/if_ptnet.c Fri Jun 3 14:07:08 2016 (r304509) +++ soc2016/vincenzo/head/sys/dev/netmap/if_ptnet.c Fri Jun 3 14:07:23 2016 (r304510) @@ -92,6 +92,8 @@ struct resource *irq; void *cookie; int kring_id; + struct ptnet_ring *ptring; + unsigned int kick; }; struct ptnet_softc { @@ -231,11 +233,29 @@ } sc->ptfeatures = ptfeatures; + /* Allocate CSB and carry out CSB allocation protocol (CSBBAH first, + * then CSBBAL). */ + sc->csb = malloc(sizeof(struct ptnet_csb), M_DEVBUF, + M_NOWAIT | M_ZERO); + if (sc->csb == NULL) { + device_printf(dev, "Failed to allocate CSB\n"); + err = ENOMEM; + goto err_path; + } + + { + vm_paddr_t paddr = vtophys(sc->csb); + + bus_write_4(sc->iomem, PTNET_IO_CSBBAH, + (paddr >> 32) & 0xffffffff); + bus_write_4(sc->iomem, PTNET_IO_CSBBAL, paddr & 0xffffffff); + } + num_tx_rings = bus_read_4(sc->iomem, PTNET_IO_NUM_TX_RINGS); num_rx_rings = bus_read_4(sc->iomem, PTNET_IO_NUM_RX_RINGS); sc->num_rings = num_tx_rings + num_rx_rings; - /* Allocate per-queue data structures. */ + /* Allocate and initialize per-queue data structures. */ sc->queues = malloc(sizeof(struct ptnet_queue) * sc->num_rings, M_DEVBUF, M_NOWAIT | M_ZERO); if (sc->queues == NULL) { @@ -248,29 +268,13 @@ pq->sc = sc; pq->kring_id = i; + pq->kick = PTNET_IO_KICK_BASE + 4 * i; + pq->ptring = sc->csb->rings + i; if (i >= num_tx_rings) { pq->kring_id -= num_tx_rings; } } - /* Allocate CSB and carry out CSB allocation protocol (CSBBAH first, - * then CSBBAL). */ - sc->csb = malloc(sizeof(struct ptnet_csb), M_DEVBUF, - M_NOWAIT | M_ZERO); - if (sc->csb == NULL) { - device_printf(dev, "Failed to allocate CSB\n"); - err = ENOMEM; - goto err_path; - } - - { - vm_paddr_t paddr = vtophys(sc->csb); - - bus_write_4(sc->iomem, PTNET_IO_CSBBAH, - (paddr >> 32) & 0xffffffff); - bus_write_4(sc->iomem, PTNET_IO_CSBBAL, paddr & 0xffffffff); - } - err = ptnet_irqs_init(sc); if (err) { goto err_path; From owner-svn-soc-all@freebsd.org Fri Jun 3 14:07:38 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 F0795B68FC1 for ; Fri, 3 Jun 2016 14:07:38 +0000 (UTC) (envelope-from vincenzo@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 E4ACE1A4E for ; Fri, 3 Jun 2016 14:07:38 +0000 (UTC) (envelope-from vincenzo@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id u53E7cKc058409 for ; Fri, 3 Jun 2016 14:07:38 GMT (envelope-from vincenzo@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id u53E7cSZ058404 for svn-soc-all@FreeBSD.org; Fri, 3 Jun 2016 14:07:38 GMT (envelope-from vincenzo@FreeBSD.org) Date: Fri, 3 Jun 2016 14:07:38 GMT Message-Id: <201606031407.u53E7cSZ058404@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to vincenzo@FreeBSD.org using -f From: vincenzo@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r304511 - soc2016/vincenzo/head/sys/dev/netmap 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: Fri, 03 Jun 2016 14:07:39 -0000 Author: vincenzo Date: Fri Jun 3 14:07:37 2016 New Revision: 304511 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=304511 Log: freebsd: ptnet IRQ: add missing accesses to PTNET_IO_CTRL register Modified: soc2016/vincenzo/head/sys/dev/netmap/if_ptnet.c Modified: soc2016/vincenzo/head/sys/dev/netmap/if_ptnet.c ============================================================================== --- soc2016/vincenzo/head/sys/dev/netmap/if_ptnet.c Fri Jun 3 14:07:23 2016 (r304510) +++ soc2016/vincenzo/head/sys/dev/netmap/if_ptnet.c Fri Jun 3 14:07:37 2016 (r304511) @@ -482,6 +482,10 @@ device_printf(dev, "Allocated %d MSI-X vectors\n", nvecs); + /* Tell the hypervisor that we have allocated the MSI-X vectors, + * so that it can do its own setup. */ + bus_write_4(sc->iomem, PTNET_IO_CTRL, PTNET_CTRL_IRQINIT); + return 0; err_path: ptnet_irqs_fini(sc); @@ -494,6 +498,10 @@ device_t dev = sc->dev; int i; + /* Tell the hypervisor that we are going to deallocate the + * MSI-X vectors, so that it can do its own cleanup. */ + bus_write_4(sc->iomem, PTNET_IO_CTRL, PTNET_CTRL_IRQFINI); + for (i = 0; i < sc->num_rings; i++) { struct ptnet_queue *pq = sc->queues + i; From owner-svn-soc-all@freebsd.org Fri Jun 3 14:07:53 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 8A7DEB68FED for ; Fri, 3 Jun 2016 14:07:53 +0000 (UTC) (envelope-from vincenzo@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 7E9BD1A66 for ; Fri, 3 Jun 2016 14:07:53 +0000 (UTC) (envelope-from vincenzo@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id u53E7rDN058773 for ; Fri, 3 Jun 2016 14:07:53 GMT (envelope-from vincenzo@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id u53E7qDf058756 for svn-soc-all@FreeBSD.org; Fri, 3 Jun 2016 14:07:52 GMT (envelope-from vincenzo@FreeBSD.org) Date: Fri, 3 Jun 2016 14:07:52 GMT Message-Id: <201606031407.u53E7qDf058756@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to vincenzo@FreeBSD.org using -f From: vincenzo@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r304512 - soc2016/vincenzo/head/sys/dev/netmap 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: Fri, 03 Jun 2016 14:07:53 -0000 Author: vincenzo Date: Fri Jun 3 14:07:52 2016 New Revision: 304512 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=304512 Log: freebsd: ptnet: implement nm_txsync Modified: soc2016/vincenzo/head/sys/dev/netmap/if_ptnet.c Modified: soc2016/vincenzo/head/sys/dev/netmap/if_ptnet.c ============================================================================== --- soc2016/vincenzo/head/sys/dev/netmap/if_ptnet.c Fri Jun 3 14:07:37 2016 (r304511) +++ soc2016/vincenzo/head/sys/dev/netmap/if_ptnet.c Fri Jun 3 14:07:52 2016 (r304512) @@ -152,6 +152,7 @@ static uint32_t ptnet_nm_ptctl(struct ifnet *ifp, uint32_t cmd); static int ptnet_nm_config(struct netmap_adapter *na, unsigned *txr, unsigned *txd, unsigned *rxr, unsigned *rxd); +static int ptnet_nm_txsync(struct netmap_kring *kring, int flags); static void ptnet_tx_intr(void *opaque); static void ptnet_rx_intr(void *opaque); @@ -331,6 +332,7 @@ na_arg.num_tx_rings = num_tx_rings; na_arg.num_rx_rings = num_rx_rings; na_arg.nm_config = ptnet_nm_config; + na_arg.nm_txsync = ptnet_nm_txsync; netmap_pt_guest_attach(&na_arg, sc->csb, nifp_offset, ptnet_nm_ptctl); @@ -651,6 +653,21 @@ return 0; } +static int +ptnet_nm_txsync(struct netmap_kring *kring, int flags) +{ + struct ptnet_softc *sc = kring->na->ifp->if_softc; + struct ptnet_queue *pq = sc->queues + kring->ring_id; + bool notify; + + notify = netmap_pt_guest_txsync(pq->ptring, kring, flags); + if (notify) { + bus_write_4(sc->iomem, pq->kick, 0); + } + + return 0; +} + static void ptnet_tx_intr(void *opaque) { From owner-svn-soc-all@freebsd.org Fri Jun 3 14:08:04 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 EA625B6801D for ; Fri, 3 Jun 2016 14:08:04 +0000 (UTC) (envelope-from vincenzo@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 C54221A92 for ; Fri, 3 Jun 2016 14:08:04 +0000 (UTC) (envelope-from vincenzo@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id u53E849R059003 for ; Fri, 3 Jun 2016 14:08:04 GMT (envelope-from vincenzo@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id u53E84RF058974 for svn-soc-all@FreeBSD.org; Fri, 3 Jun 2016 14:08:04 GMT (envelope-from vincenzo@FreeBSD.org) Date: Fri, 3 Jun 2016 14:08:04 GMT Message-Id: <201606031408.u53E84RF058974@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to vincenzo@FreeBSD.org using -f From: vincenzo@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r304513 - soc2016/vincenzo/head/sys/dev/netmap 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: Fri, 03 Jun 2016 14:08:05 -0000 Author: vincenzo Date: Fri Jun 3 14:08:03 2016 New Revision: 304513 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=304513 Log: freebsd: ptnet: implement nm_rxsync Modified: soc2016/vincenzo/head/sys/dev/netmap/if_ptnet.c Modified: soc2016/vincenzo/head/sys/dev/netmap/if_ptnet.c ============================================================================== --- soc2016/vincenzo/head/sys/dev/netmap/if_ptnet.c Fri Jun 3 14:07:52 2016 (r304512) +++ soc2016/vincenzo/head/sys/dev/netmap/if_ptnet.c Fri Jun 3 14:08:03 2016 (r304513) @@ -113,6 +113,7 @@ unsigned int num_rings; struct ptnet_queue *queues; + struct ptnet_queue *rxqueues; struct ptnet_csb *csb; struct netmap_pt_guest_adapter *ptna_nm; @@ -153,6 +154,7 @@ static int ptnet_nm_config(struct netmap_adapter *na, unsigned *txr, unsigned *txd, unsigned *rxr, unsigned *rxd); static int ptnet_nm_txsync(struct netmap_kring *kring, int flags); +static int ptnet_nm_rxsync(struct netmap_kring *kring, int flags); static void ptnet_tx_intr(void *opaque); static void ptnet_rx_intr(void *opaque); @@ -263,6 +265,7 @@ err = ENOMEM; goto err_path; } + sc->rxqueues = sc->queues + num_tx_rings; for (i = 0; i < sc->num_rings; i++) { struct ptnet_queue *pq = sc->queues + i; @@ -333,6 +336,7 @@ na_arg.num_rx_rings = num_rx_rings; na_arg.nm_config = ptnet_nm_config; na_arg.nm_txsync = ptnet_nm_txsync; + na_arg.nm_rxsync = ptnet_nm_rxsync; netmap_pt_guest_attach(&na_arg, sc->csb, nifp_offset, ptnet_nm_ptctl); @@ -668,6 +672,21 @@ return 0; } +static int +ptnet_nm_rxsync(struct netmap_kring *kring, int flags) +{ + struct ptnet_softc *sc = kring->na->ifp->if_softc; + struct ptnet_queue *pq = sc->rxqueues + kring->ring_id; + bool notify; + + notify = netmap_pt_guest_rxsync(pq->ptring, kring, flags); + if (notify) { + bus_write_4(sc->iomem, pq->kick, 0); + } + + return 0; +} + static void ptnet_tx_intr(void *opaque) { From owner-svn-soc-all@freebsd.org Fri Jun 3 14:08:22 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 53DC2B6804C for ; Fri, 3 Jun 2016 14:08:22 +0000 (UTC) (envelope-from vincenzo@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 47F291AB3 for ; Fri, 3 Jun 2016 14:08:22 +0000 (UTC) (envelope-from vincenzo@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id u53E8Mpl059331 for ; Fri, 3 Jun 2016 14:08:22 GMT (envelope-from vincenzo@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id u53E8LlY059320 for svn-soc-all@FreeBSD.org; Fri, 3 Jun 2016 14:08:21 GMT (envelope-from vincenzo@FreeBSD.org) Date: Fri, 3 Jun 2016 14:08:21 GMT Message-Id: <201606031408.u53E8LlY059320@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to vincenzo@FreeBSD.org using -f From: vincenzo@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r304514 - soc2016/vincenzo/head/sys/dev/netmap 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: Fri, 03 Jun 2016 14:08:22 -0000 Author: vincenzo Date: Fri Jun 3 14:08:21 2016 New Revision: 304514 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=304514 Log: freebsd: ptnet: implement krings create/delete methods Modified: soc2016/vincenzo/head/sys/dev/netmap/if_ptnet.c Modified: soc2016/vincenzo/head/sys/dev/netmap/if_ptnet.c ============================================================================== --- soc2016/vincenzo/head/sys/dev/netmap/if_ptnet.c Fri Jun 3 14:08:03 2016 (r304513) +++ soc2016/vincenzo/head/sys/dev/netmap/if_ptnet.c Fri Jun 3 14:08:21 2016 (r304514) @@ -107,6 +107,10 @@ /* Mirror of PTFEAT register. */ uint32_t ptfeatures; + /* Reference counter used to track the regif operations on the + * passed-through netmap port. */ + int backend_regifs; + /* PCI BARs support. */ struct resource *iomem; struct resource *msix_mem; @@ -117,6 +121,7 @@ struct ptnet_csb *csb; struct netmap_pt_guest_adapter *ptna_nm; + struct netmap_pt_guest_adapter ptna_dr; }; #define PTNET_CORE_LOCK_INIT(_sc) do { \ @@ -153,6 +158,8 @@ static uint32_t ptnet_nm_ptctl(struct ifnet *ifp, uint32_t cmd); static int ptnet_nm_config(struct netmap_adapter *na, unsigned *txr, unsigned *txd, unsigned *rxr, unsigned *rxd); +static int ptnet_nm_krings_create(struct netmap_adapter *na); +static void ptnet_nm_krings_delete(struct netmap_adapter *na); static int ptnet_nm_txsync(struct netmap_kring *kring, int flags); static int ptnet_nm_rxsync(struct netmap_kring *kring, int flags); @@ -327,6 +334,8 @@ PTNET_CORE_LOCK_INIT(sc); + sc->backend_regifs = 0; + /* Prepare a netmap_adapter struct instance to do netmap_attach(). */ nifp_offset = bus_read_4(sc->iomem, PTNET_IO_NIFP_OFS); na_arg.ifp = ifp; @@ -335,6 +344,8 @@ na_arg.num_tx_rings = num_tx_rings; na_arg.num_rx_rings = num_rx_rings; na_arg.nm_config = ptnet_nm_config; + na_arg.nm_krings_create = ptnet_nm_krings_create; + na_arg.nm_krings_delete = ptnet_nm_krings_delete; na_arg.nm_txsync = ptnet_nm_txsync; na_arg.nm_rxsync = ptnet_nm_rxsync; @@ -346,6 +357,8 @@ sc->ptna_nm = (struct netmap_pt_guest_adapter *)NA(ifp); sc->ptna_nm->csb = sc->csb; + memset(&sc->ptna_dr, 0, sizeof(sc->ptna_dr)); + return (0); err_path: @@ -658,6 +671,50 @@ } static int +ptnet_nm_krings_create(struct netmap_adapter *na) +{ + /* Here (na == &sc->ptna_nm->hwup.up || na == &sc->ptna_dr.hwup.up). */ + struct ptnet_softc *sc = na->ifp->if_softc; + struct netmap_adapter *na_nm = &sc->ptna_nm->hwup.up; + struct netmap_adapter *na_dr = &sc->ptna_dr.hwup.up; + int ret; + + if (sc->backend_regifs) { + return 0; + } + + /* Create krings on the public netmap adapter. */ + ret = netmap_hw_krings_create(na_nm); + if (ret) { + return ret; + } + + /* Copy krings into the netmap adapter private to the driver. */ + na_dr->tx_rings = na_nm->tx_rings; + na_dr->rx_rings = na_nm->rx_rings; + + return 0; +} + +static void +ptnet_nm_krings_delete(struct netmap_adapter *na) +{ + /* Here (na == &sc->ptna_nm->hwup.up || na == &sc->ptna_dr.hwup.up). */ + struct ptnet_softc *sc = na->ifp->if_softc; + struct netmap_adapter *na_nm = &sc->ptna_nm->hwup.up; + struct netmap_adapter *na_dr = &sc->ptna_dr.hwup.up; + + if (sc->backend_regifs) { + return; + } + + na_dr->tx_rings = NULL; + na_dr->rx_rings = NULL; + + netmap_hw_krings_delete(na_nm); +} + +static int ptnet_nm_txsync(struct netmap_kring *kring, int flags) { struct ptnet_softc *sc = kring->na->ifp->if_softc; From owner-svn-soc-all@freebsd.org Fri Jun 3 14:08:34 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 618EFB6806D for ; Fri, 3 Jun 2016 14:08:34 +0000 (UTC) (envelope-from vincenzo@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 55C7A1ACE for ; Fri, 3 Jun 2016 14:08:34 +0000 (UTC) (envelope-from vincenzo@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id u53E8YfA059574 for ; Fri, 3 Jun 2016 14:08:34 GMT (envelope-from vincenzo@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id u53E8XBX059569 for svn-soc-all@FreeBSD.org; Fri, 3 Jun 2016 14:08:33 GMT (envelope-from vincenzo@FreeBSD.org) Date: Fri, 3 Jun 2016 14:08:33 GMT Message-Id: <201606031408.u53E8XBX059569@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to vincenzo@FreeBSD.org using -f From: vincenzo@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r304515 - soc2016/vincenzo/head/sys/dev/netmap 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: Fri, 03 Jun 2016 14:08:34 -0000 Author: vincenzo Date: Fri Jun 3 14:08:33 2016 New Revision: 304515 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=304515 Log: freebsd: ptnet: implement ptnet_nm_dtor Modified: soc2016/vincenzo/head/sys/dev/netmap/if_ptnet.c Modified: soc2016/vincenzo/head/sys/dev/netmap/if_ptnet.c ============================================================================== --- soc2016/vincenzo/head/sys/dev/netmap/if_ptnet.c Fri Jun 3 14:08:21 2016 (r304514) +++ soc2016/vincenzo/head/sys/dev/netmap/if_ptnet.c Fri Jun 3 14:08:33 2016 (r304515) @@ -160,6 +160,7 @@ unsigned *txd, unsigned *rxr, unsigned *rxd); static int ptnet_nm_krings_create(struct netmap_adapter *na); static void ptnet_nm_krings_delete(struct netmap_adapter *na); +static void ptnet_nm_dtor(struct netmap_adapter *na); static int ptnet_nm_txsync(struct netmap_kring *kring, int flags); static int ptnet_nm_rxsync(struct netmap_kring *kring, int flags); @@ -346,6 +347,7 @@ na_arg.nm_config = ptnet_nm_config; na_arg.nm_krings_create = ptnet_nm_krings_create; na_arg.nm_krings_delete = ptnet_nm_krings_delete; + na_arg.nm_dtor = ptnet_nm_dtor; na_arg.nm_txsync = ptnet_nm_txsync; na_arg.nm_rxsync = ptnet_nm_rxsync; @@ -714,6 +716,12 @@ netmap_hw_krings_delete(na_nm); } +static void +ptnet_nm_dtor(struct netmap_adapter *na) +{ + netmap_mem_pt_guest_ifp_del(na->nm_mem, na->ifp); +} + static int ptnet_nm_txsync(struct netmap_kring *kring, int flags) { From owner-svn-soc-all@freebsd.org Fri Jun 3 14:09:05 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 03632B680F6 for ; Fri, 3 Jun 2016 14:09:05 +0000 (UTC) (envelope-from vincenzo@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 EBB431BF2 for ; Fri, 3 Jun 2016 14:09:04 +0000 (UTC) (envelope-from vincenzo@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id u53E94J1060200 for ; Fri, 3 Jun 2016 14:09:04 GMT (envelope-from vincenzo@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id u53E94BV060197 for svn-soc-all@FreeBSD.org; Fri, 3 Jun 2016 14:09:04 GMT (envelope-from vincenzo@FreeBSD.org) Date: Fri, 3 Jun 2016 14:09:04 GMT Message-Id: <201606031409.u53E94BV060197@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to vincenzo@FreeBSD.org using -f From: vincenzo@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r304516 - soc2016/vincenzo/head/sys/dev/netmap 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: Fri, 03 Jun 2016 14:09:05 -0000 Author: vincenzo Date: Fri Jun 3 14:09:03 2016 New Revision: 304516 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=304516 Log: freebsd: ptnet: initialize driver netmap adapter Modified: soc2016/vincenzo/head/sys/dev/netmap/if_ptnet.c Modified: soc2016/vincenzo/head/sys/dev/netmap/if_ptnet.c ============================================================================== --- soc2016/vincenzo/head/sys/dev/netmap/if_ptnet.c Fri Jun 3 14:08:33 2016 (r304515) +++ soc2016/vincenzo/head/sys/dev/netmap/if_ptnet.c Fri Jun 3 14:09:03 2016 (r304516) @@ -359,7 +359,15 @@ sc->ptna_nm = (struct netmap_pt_guest_adapter *)NA(ifp); sc->ptna_nm->csb = sc->csb; + /* Initialize a separate pass-through netmap adapter that is going to + * be used by this driver only, and so never exposed to netmap. We + * only need a subset of the available fields. */ memset(&sc->ptna_dr, 0, sizeof(sc->ptna_dr)); + sc->ptna_dr.hwup.up.ifp = ifp; + sc->ptna_dr.hwup.up.nm_mem = sc->ptna_nm->hwup.up.nm_mem; + netmap_mem_get(sc->ptna_dr.hwup.up.nm_mem); + sc->ptna_dr.hwup.up.nm_config = ptnet_nm_config; + sc->ptna_dr.csb = sc->csb; return (0); @@ -378,6 +386,9 @@ if (sc->ifp) { ether_ifdetach(sc->ifp); + /* Uninitialize netmap adapters for this device. */ + netmap_mem_put(sc->ptna_dr.hwup.up.nm_mem); + memset(&sc->ptna_dr, 0, sizeof(sc->ptna_dr)); netmap_detach(sc->ifp); ifmedia_removeall(&sc->media); From owner-svn-soc-all@freebsd.org Fri Jun 3 14:09:16 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 4C9BBB68117 for ; Fri, 3 Jun 2016 14:09:16 +0000 (UTC) (envelope-from vincenzo@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 410A71DB1 for ; Fri, 3 Jun 2016 14:09:16 +0000 (UTC) (envelope-from vincenzo@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id u53E9G5F060459 for ; Fri, 3 Jun 2016 14:09:16 GMT (envelope-from vincenzo@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id u53E9FfZ060456 for svn-soc-all@FreeBSD.org; Fri, 3 Jun 2016 14:09:15 GMT (envelope-from vincenzo@FreeBSD.org) Date: Fri, 3 Jun 2016 14:09:15 GMT Message-Id: <201606031409.u53E9FfZ060456@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to vincenzo@FreeBSD.org using -f From: vincenzo@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r304517 - soc2016/vincenzo/head/sys/dev/netmap 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: Fri, 03 Jun 2016 14:09:16 -0000 Author: vincenzo Date: Fri Jun 3 14:09:15 2016 New Revision: 304517 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=304517 Log: freebsd: ptnet: add TODO comment Modified: soc2016/vincenzo/head/sys/dev/netmap/if_ptnet.c Modified: soc2016/vincenzo/head/sys/dev/netmap/if_ptnet.c ============================================================================== --- soc2016/vincenzo/head/sys/dev/netmap/if_ptnet.c Fri Jun 3 14:09:03 2016 (r304516) +++ soc2016/vincenzo/head/sys/dev/netmap/if_ptnet.c Fri Jun 3 14:09:15 2016 (r304517) @@ -122,6 +122,8 @@ struct netmap_pt_guest_adapter *ptna_nm; struct netmap_pt_guest_adapter ptna_dr; + /* XXX we should move ptna_dr and backend_regifs inside struct + * netmap_pt_guest_adapter and have just one instance of that. */ }; #define PTNET_CORE_LOCK_INIT(_sc) do { \ From owner-svn-soc-all@freebsd.org Fri Jun 3 14:09:39 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 1BE3FB68132 for ; Fri, 3 Jun 2016 14:09:39 +0000 (UTC) (envelope-from vincenzo@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 00C9F1DCD for ; Fri, 3 Jun 2016 14:09:39 +0000 (UTC) (envelope-from vincenzo@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id u53E9cvX060938 for ; Fri, 3 Jun 2016 14:09:38 GMT (envelope-from vincenzo@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id u53E9cVr060934 for svn-soc-all@FreeBSD.org; Fri, 3 Jun 2016 14:09:38 GMT (envelope-from vincenzo@FreeBSD.org) Date: Fri, 3 Jun 2016 14:09:38 GMT Message-Id: <201606031409.u53E9cVr060934@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to vincenzo@FreeBSD.org using -f From: vincenzo@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r304518 - soc2016/vincenzo/head/sys/dev/netmap 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: Fri, 03 Jun 2016 14:09:39 -0000 Author: vincenzo Date: Fri Jun 3 14:09:37 2016 New Revision: 304518 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=304518 Log: freebsd: ptnet: implement nm_register method Modified: soc2016/vincenzo/head/sys/dev/netmap/if_ptnet.c Modified: soc2016/vincenzo/head/sys/dev/netmap/if_ptnet.c ============================================================================== --- soc2016/vincenzo/head/sys/dev/netmap/if_ptnet.c Fri Jun 3 14:09:15 2016 (r304517) +++ soc2016/vincenzo/head/sys/dev/netmap/if_ptnet.c Fri Jun 3 14:09:37 2016 (r304518) @@ -163,6 +163,7 @@ static int ptnet_nm_krings_create(struct netmap_adapter *na); static void ptnet_nm_krings_delete(struct netmap_adapter *na); static void ptnet_nm_dtor(struct netmap_adapter *na); +static int ptnet_nm_register(struct netmap_adapter *na, int onoff); static int ptnet_nm_txsync(struct netmap_kring *kring, int flags); static int ptnet_nm_rxsync(struct netmap_kring *kring, int flags); @@ -350,6 +351,7 @@ na_arg.nm_krings_create = ptnet_nm_krings_create; na_arg.nm_krings_delete = ptnet_nm_krings_delete; na_arg.nm_dtor = ptnet_nm_dtor; + na_arg.nm_register = ptnet_nm_register; na_arg.nm_txsync = ptnet_nm_txsync; na_arg.nm_rxsync = ptnet_nm_rxsync; @@ -735,6 +737,146 @@ netmap_mem_pt_guest_ifp_del(na->nm_mem, na->ifp); } +static void +ptnet_sync_from_csb(struct ptnet_softc *sc, struct netmap_adapter *na) +{ + int i; + + /* Sync krings from the host, reading from + * CSB. */ + for (i = 0; i < sc->num_rings; i++) { + struct ptnet_ring *ptring = sc->queues[i].ptring; + struct netmap_kring *kring; + + if (i < na->num_tx_rings) { + kring = na->tx_rings + i; + } else { + kring = na->rx_rings + i - na->num_tx_rings; + } + kring->rhead = kring->ring->head = ptring->head; + kring->rcur = kring->ring->cur = ptring->cur; + kring->nr_hwcur = ptring->hwcur; + kring->nr_hwtail = kring->rtail = + kring->ring->tail = ptring->hwtail; + + ND("%d,%d: csb {hc %u h %u c %u ht %u}", t, i, + ptring->hwcur, ptring->head, ptring->cur, + ptring->hwtail); + ND("%d,%d: kring {hc %u rh %u rc %u h %u c %u ht %u rt %u t %u}", + t, i, kring->nr_hwcur, kring->rhead, kring->rcur, + kring->ring->head, kring->ring->cur, kring->nr_hwtail, + kring->rtail, kring->ring->tail); + } +} + +#define csb_notification_enable_all(_x, _na, _t, _fld, _v) \ + do { \ + struct ptnet_queue *queues = (_x)->queues; \ + int i; \ + if (_t == NR_RX) queues = (_x)->rxqueues; \ + for (i=0; i_fld = _v; \ + } \ + } while (0) \ + +static int +ptnet_nm_register(struct netmap_adapter *na, int onoff) +{ + /* device-specific */ + struct ifnet *ifp = na->ifp; + struct ptnet_softc *sc = ifp->if_softc; + int native = (na == &sc->ptna_nm->hwup.up); + enum txrx t; + int ret = 0; + int i; + + if (!onoff) { + sc->backend_regifs--; + } + + /* If this is the last netmap client, guest interrupt enable flags may + * be in arbitrary state. Since these flags are going to be used also + * by the netdevice driver, we have to make sure to start with + * notifications enabled. Also, schedule NAPI to flush pending packets + * in the RX rings, since we will not receive further interrupts + * until these will be processed. */ + if (native && !onoff && na->active_fds == 0) { + D("Exit netmap mode, re-enable interrupts"); + csb_notification_enable_all(sc, na, NR_TX, guest_need_kick, 1); + csb_notification_enable_all(sc, na, NR_RX, guest_need_kick, 1); + } + + if (onoff) { + if (sc->backend_regifs == 0) { + /* Initialize notification enable fields in the CSB. */ + csb_notification_enable_all(sc, na, NR_TX, host_need_kick, 1); + csb_notification_enable_all(sc, na, NR_TX, guest_need_kick, 0); + csb_notification_enable_all(sc, na, NR_RX, host_need_kick, 1); + csb_notification_enable_all(sc, na, NR_RX, guest_need_kick, 1); + + /* Make sure the host adapter passed through is ready + * for txsync/rxsync. */ + ret = ptnet_nm_ptctl(ifp, NET_PARAVIRT_PTCTL_REGIF); + if (ret) { + return ret; + } + } + + /* Sync from CSB must be done after REGIF PTCTL. Skip this + * step only if this is a netmap client and it is not the + * first one. */ + if ((!native && sc->backend_regifs == 0) || + (native && na->active_fds == 0)) { + ptnet_sync_from_csb(sc, na); + } + + /* If not native, don't call nm_set_native_flags, since we don't want + * to replace ndo_start_xmit method, nor set NAF_NETMAP_ON */ + if (native) { + for_rx_tx(t) { + for (i=0; inr_mode = NKR_NETMAP_ON; + } + } + } + nm_set_native_flags(na); + } + + } else { + if (native) { + nm_clear_native_flags(na); + for_rx_tx(t) { + for (i=0; inr_mode = NKR_NETMAP_OFF; + } + } + } + } + + /* Sync from CSB must be done before UNREGIF PTCTL, on the last + * netmap client. */ + if (native && na->active_fds == 0) { + ptnet_sync_from_csb(sc, na); + } + + if (sc->backend_regifs == 0) { + ret = ptnet_nm_ptctl(ifp, NET_PARAVIRT_PTCTL_UNREGIF); + } + } + + if (onoff) { + sc->backend_regifs++; + } + + return ret; +} + static int ptnet_nm_txsync(struct netmap_kring *kring, int flags) { From owner-svn-soc-all@freebsd.org Fri Jun 3 14:09:51 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 0E9A9B68189 for ; Fri, 3 Jun 2016 14:09:51 +0000 (UTC) (envelope-from vincenzo@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 030521F30 for ; Fri, 3 Jun 2016 14:09:51 +0000 (UTC) (envelope-from vincenzo@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id u53E9oAe061245 for ; Fri, 3 Jun 2016 14:09:50 GMT (envelope-from vincenzo@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id u53E9oO2061242 for svn-soc-all@FreeBSD.org; Fri, 3 Jun 2016 14:09:50 GMT (envelope-from vincenzo@FreeBSD.org) Date: Fri, 3 Jun 2016 14:09:50 GMT Message-Id: <201606031409.u53E9oO2061242@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to vincenzo@FreeBSD.org using -f From: vincenzo@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r304519 - soc2016/vincenzo/head/sys/dev/netmap 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: Fri, 03 Jun 2016 14:09:51 -0000 Author: vincenzo Date: Fri Jun 3 14:09:49 2016 New Revision: 304519 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=304519 Log: freebsd: ptnet: fix driver declaration Modified: soc2016/vincenzo/head/sys/dev/netmap/if_ptnet.c Modified: soc2016/vincenzo/head/sys/dev/netmap/if_ptnet.c ============================================================================== --- soc2016/vincenzo/head/sys/dev/netmap/if_ptnet.c Fri Jun 3 14:09:37 2016 (r304518) +++ soc2016/vincenzo/head/sys/dev/netmap/if_ptnet.c Fri Jun 3 14:09:49 2016 (r304519) @@ -185,11 +185,10 @@ ptnet_methods, sizeof(struct ptnet_softc) }; -static devclass_t ptnet_devclass; -DRIVER_MODULE(ptnet, pci, ptnet_driver, ptnet_devclass, 0, 0); -MODULE_VERSION(ptnet, 1); -MODULE_DEPEND(ptnet, netmap, 1, 1, 1); +static devclass_t ptnet_devclass; +DRIVER_MODULE(netmap, pci, ptnet_driver, ptnet_devclass, 0, 0); +MODULE_DEPEND(netmap, pci, 1, 1, 1); static int ptnet_probe(device_t dev) From owner-svn-soc-all@freebsd.org Fri Jun 3 14:10:02 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 42861B681BE for ; Fri, 3 Jun 2016 14:10:02 +0000 (UTC) (envelope-from vincenzo@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 36B5F1F5F for ; Fri, 3 Jun 2016 14:10:02 +0000 (UTC) (envelope-from vincenzo@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id u53EA2TV061576 for ; Fri, 3 Jun 2016 14:10:02 GMT (envelope-from vincenzo@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id u53EA1ce061574 for svn-soc-all@FreeBSD.org; Fri, 3 Jun 2016 14:10:01 GMT (envelope-from vincenzo@FreeBSD.org) Date: Fri, 3 Jun 2016 14:10:01 GMT Message-Id: <201606031410.u53EA1ce061574@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to vincenzo@FreeBSD.org using -f From: vincenzo@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r304520 - soc2016/vincenzo/head/sys/dev/netmap 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: Fri, 03 Jun 2016 14:10:02 -0000 Author: vincenzo Date: Fri Jun 3 14:10:01 2016 New Revision: 304520 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=304520 Log: freebsd: ptnetmap memdev: a few rearrangements Modified: soc2016/vincenzo/head/sys/dev/netmap/netmap_freebsd.c Modified: soc2016/vincenzo/head/sys/dev/netmap/netmap_freebsd.c ============================================================================== --- soc2016/vincenzo/head/sys/dev/netmap/netmap_freebsd.c Fri Jun 3 14:09:49 2016 (r304519) +++ soc2016/vincenzo/head/sys/dev/netmap/netmap_freebsd.c Fri Jun 3 14:10:01 2016 (r304520) @@ -562,8 +562,8 @@ #include #include /* - * ptnetmap memory device (memdev) for freebsd guest - * Used to expose host memory to the guest through PCI-BAR + * ptnetmap memory device (memdev) for freebsd guest, + * ssed to expose host netmap memory to the guest through a PCI BAR. */ /* @@ -582,7 +582,6 @@ static int ptn_memdev_shutdown(device_t); static device_method_t ptn_memdev_methods[] = { - /* Device interface */ DEVMETHOD(device_probe, ptn_memdev_probe), DEVMETHOD(device_attach, ptn_memdev_attach), DEVMETHOD(device_detach, ptn_memdev_detach), @@ -591,12 +590,13 @@ }; static driver_t ptn_memdev_driver = { - PTN_MEMDEV_NAME, ptn_memdev_methods, sizeof(struct ptnetmap_memdev), + PTN_MEMDEV_NAME, + ptn_memdev_methods, + sizeof(struct ptnetmap_memdev), }; static devclass_t ptnetmap_devclass; DRIVER_MODULE(netmap, pci, ptn_memdev_driver, ptnetmap_devclass, 0, 0); - MODULE_DEPEND(netmap, pci, 1, 1, 1); /* @@ -613,9 +613,8 @@ #endif /* unused */ /* - * map host netmap memory through PCI-BAR in the guest OS - * - * return physical (nm_paddr) and virtual (nm_addr) addresses + * Map host netmap memory through PCI-BAR in the guest OS, + * returning physical (nm_paddr) and virtual (nm_addr) addresses * of the netmap memory mapped in the guest. */ int @@ -649,9 +648,7 @@ return (0); } -/* - * unmap PCI-BAR - */ +/* Unmap host netmap memory. */ void nm_os_pt_memdev_iounmap(struct ptnetmap_memdev *ptn_dev) { @@ -664,14 +661,8 @@ } } -/********************************************************************* - * Device identification routine - * - * ixgbe_probe determines if the driver should be loaded on - * adapter based on PCI vendor/device id of the adapter. - * - * return BUS_PROBE_DEFAULT on success, positive on failure - *********************************************************************/ +/* Device identification routine, return BUS_PROBE_DEFAULT on success, + * positive on failure */ static int ptn_memdev_probe(device_t dev) { @@ -690,15 +681,7 @@ return (BUS_PROBE_DEFAULT); } -/********************************************************************* - * Device initialization routine - * - * The attach entry point is called when the driver is being loaded. - * This routine identifies the type of hardware, allocates all resources - * and initializes the hardware. - * - * return 0 on success, positive on failure - *********************************************************************/ +/* Device initialization routine. */ static int ptn_memdev_attach(device_t dev) { @@ -715,7 +698,7 @@ rid = PCIR_BAR(PTNETMAP_IO_PCI_BAR); ptn_dev->pci_io = bus_alloc_resource_any(dev, SYS_RES_IOPORT, &rid, - RF_ACTIVE); + RF_ACTIVE); if (ptn_dev->pci_io == NULL) { device_printf(dev, "cannot map I/O space\n"); return (ENXIO); @@ -736,15 +719,7 @@ return (0); } -/********************************************************************* - * Device removal routine - * - * The detach entry point is called when the driver is being removed. - * This routine stops the adapter and deallocates all the resources - * that were allocated for driver operation. - * - * return 0 on success, positive on failure - *********************************************************************/ +/* Device removal routine. */ static int ptn_memdev_detach(device_t dev) { @@ -771,29 +746,18 @@ return (0); } -/********************************************************************* - * - * Shutdown entry point - * - **********************************************************************/ static int ptn_memdev_shutdown(device_t dev) { - D("ptn_memdev_driver shutsown"); + D("ptn_memdev_driver shutdown"); return bus_generic_shutdown(dev); } int -nm_os_pt_memdev_init(void) -{ - return 0; -} +nm_os_pt_memdev_init(void) { return 0; } void -nm_os_pt_memdev_uninit(void) -{ - -} +nm_os_pt_memdev_uninit(void) { } #endif /* WITH_PTNETMAP_GUEST */ /* From owner-svn-soc-all@freebsd.org Fri Jun 3 17:25:06 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 37731B69BAF for ; Fri, 3 Jun 2016 17:25:06 +0000 (UTC) (envelope-from yuanxunzhang@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 1C12418F8 for ; Fri, 3 Jun 2016 17:25:06 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id u53HP5MM041074 for ; Fri, 3 Jun 2016 17:25:05 GMT (envelope-from yuanxunzhang@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id u53HP2I2040947 for svn-soc-all@FreeBSD.org; Fri, 3 Jun 2016 17:25:02 GMT (envelope-from yuanxunzhang@FreeBSD.org) Date: Fri, 3 Jun 2016 17:25:02 GMT Message-Id: <201606031725.u53HP2I2040947@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to yuanxunzhang@FreeBSD.org using -f From: yuanxunzhang@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r304528 - in soc2016/yuanxunzhang/head: sys/conf sys/modules sys/modules/eaps sys/net usr.sbin/eaps 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: Fri, 03 Jun 2016 17:25:06 -0000 Author: yuanxunzhang Date: Fri Jun 3 17:25:02 2016 New Revision: 304528 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=304528 Log: freeBSD-EAPS: Add eaps protocol module and makefile Added: soc2016/yuanxunzhang/head/sys/modules/eaps/ soc2016/yuanxunzhang/head/sys/modules/eaps/Makefile soc2016/yuanxunzhang/head/sys/net/eaps.c Modified: soc2016/yuanxunzhang/head/sys/conf/files soc2016/yuanxunzhang/head/sys/modules/Makefile soc2016/yuanxunzhang/head/sys/net/eaps.h soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Modified: soc2016/yuanxunzhang/head/sys/conf/files ============================================================================== --- soc2016/yuanxunzhang/head/sys/conf/files Fri Jun 3 16:17:36 2016 (r304527) +++ soc2016/yuanxunzhang/head/sys/conf/files Fri Jun 3 17:25:02 2016 (r304528) @@ -3490,6 +3490,7 @@ net/bpf_filter.c optional bpf | netgraph_bpf net/bpf_zerocopy.c optional bpf net/bridgestp.c optional bridge | if_bridge +net/eaps.c optional eaps net/flowtable.c optional flowtable inet | flowtable inet6 net/ieee8023ad_lacp.c optional lagg net/if.c standard Modified: soc2016/yuanxunzhang/head/sys/modules/Makefile ============================================================================== --- soc2016/yuanxunzhang/head/sys/modules/Makefile Fri Jun 3 16:17:36 2016 (r304527) +++ soc2016/yuanxunzhang/head/sys/modules/Makefile Fri Jun 3 17:25:02 2016 (r304528) @@ -104,6 +104,7 @@ ${_ed} \ ${_elink} \ ${_em} \ + eaps \ en \ ${_ep} \ ${_epic} \ Added: soc2016/yuanxunzhang/head/sys/modules/eaps/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2016/yuanxunzhang/head/sys/modules/eaps/Makefile Fri Jun 3 17:25:02 2016 (r304528) @@ -0,0 +1,7 @@ +# $FreeBSD$ + +.PATH: ${.CURDIR}/../../net +KMOD= eaps +SRCS= eaps.c + +.include Added: soc2016/yuanxunzhang/head/sys/net/eaps.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2016/yuanxunzhang/head/sys/net/eaps.c Fri Jun 3 17:25:02 2016 (r304528) @@ -0,0 +1,56 @@ +/*- + * Copyright (c) 2016 Yuanxun Zhang. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote + * products derived from this software without specific prior written + * permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* + * EAPS Protocol Module + */ + +static SLIST_HEAD(slisthead, eaps_d) head = SLIST_HEAD_INITIALIZER(head); Modified: soc2016/yuanxunzhang/head/sys/net/eaps.h ============================================================================== --- soc2016/yuanxunzhang/head/sys/net/eaps.h Fri Jun 3 16:17:36 2016 (r304527) +++ soc2016/yuanxunzhang/head/sys/net/eaps.h Fri Jun 3 17:25:02 2016 (r304528) @@ -33,6 +33,11 @@ #ifdef _KERNEL +struct eaps_d { + char eaps_name[32]; /* name of the EAPS domain */ + SLIST_ENTRY(eaps_d) eaps_entries; +}; + /* * Extreme Active Protection System (EAPS) definitions. * Normative reference: draft-shah-extreme-rfc3619bis-02 [Expired I-D] Modified: soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c ============================================================================== --- soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Fri Jun 3 16:17:36 2016 (r304527) +++ soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Fri Jun 3 17:25:02 2016 (r304528) @@ -48,18 +48,12 @@ #include /* - * EAPS - configure, and display eaps + * EAPS Command Line Module - configure, and display eaps */ /* * EAPS Configuration Descriptor */ -struct eaps_d { - char eaps_name[32]; /* name of the EAPS domain */ - SLIST_ENTRY(eaps_d) eaps_entries; -}; - -static SLIST_HEAD(slisthead, eaps_d) head = SLIST_HEAD_INITIALIZER(head); static struct keytab { const char *kt_cp; From owner-svn-soc-all@freebsd.org Fri Jun 3 21:34:38 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 B2966B6925A for ; Fri, 3 Jun 2016 21:34:38 +0000 (UTC) (envelope-from yuanxunzhang@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 98D1D16FD for ; Fri, 3 Jun 2016 21:34:38 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id u53LYcxG006551 for ; Fri, 3 Jun 2016 21:34:38 GMT (envelope-from yuanxunzhang@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id u53LYcvR006549 for svn-soc-all@FreeBSD.org; Fri, 3 Jun 2016 21:34:38 GMT (envelope-from yuanxunzhang@FreeBSD.org) Date: Fri, 3 Jun 2016 21:34:38 GMT Message-Id: <201606032134.u53LYcvR006549@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to yuanxunzhang@FreeBSD.org using -f From: yuanxunzhang@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r304539 - soc2016/yuanxunzhang/head/sbin/ifconfig 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: Fri, 03 Jun 2016 21:34:38 -0000 Author: yuanxunzhang Date: Fri Jun 3 21:34:37 2016 New Revision: 304539 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=304539 Log: freeBSD-EAPS: test Modified: soc2016/yuanxunzhang/head/sbin/ifconfig/iflagg.c Modified: soc2016/yuanxunzhang/head/sbin/ifconfig/iflagg.c ============================================================================== --- soc2016/yuanxunzhang/head/sbin/ifconfig/iflagg.c Fri Jun 3 20:49:49 2016 (r304538) +++ soc2016/yuanxunzhang/head/sbin/ifconfig/iflagg.c Fri Jun 3 21:34:37 2016 (r304539) @@ -16,8 +16,8 @@ #include #include -#include -#include +// #include +// #include #include #include From owner-svn-soc-all@freebsd.org Fri Jun 3 21:41:50 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 0EE71B6950A for ; Fri, 3 Jun 2016 21:41:50 +0000 (UTC) (envelope-from yuanxunzhang@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 02C851D5E for ; Fri, 3 Jun 2016 21:41:50 +0000 (UTC) (envelope-from yuanxunzhang@FreeBSD.org) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.15.2/8.15.2) with ESMTP id u53LfndJ020752 for ; Fri, 3 Jun 2016 21:41:49 GMT (envelope-from yuanxunzhang@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.15.2/8.15.2/Submit) id u53Lfnpc020749 for svn-soc-all@FreeBSD.org; Fri, 3 Jun 2016 21:41:49 GMT (envelope-from yuanxunzhang@FreeBSD.org) Date: Fri, 3 Jun 2016 21:41:49 GMT Message-Id: <201606032141.u53Lfnpc020749@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to yuanxunzhang@FreeBSD.org using -f From: yuanxunzhang@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r304540 - soc2016/yuanxunzhang/head/sbin/ifconfig 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: Fri, 03 Jun 2016 21:41:50 -0000 Author: yuanxunzhang Date: Fri Jun 3 21:41:48 2016 New Revision: 304540 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=304540 Log: freeBSD-EAPS: test Modified: soc2016/yuanxunzhang/head/sbin/ifconfig/iflagg.c Modified: soc2016/yuanxunzhang/head/sbin/ifconfig/iflagg.c ============================================================================== --- soc2016/yuanxunzhang/head/sbin/ifconfig/iflagg.c Fri Jun 3 21:34:37 2016 (r304539) +++ soc2016/yuanxunzhang/head/sbin/ifconfig/iflagg.c Fri Jun 3 21:41:48 2016 (r304540) @@ -16,8 +16,8 @@ #include #include -// #include -// #include +#include +#include #include #include 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);