svn commit: r289925 - head/lib/libc/gen

2015-10-25 Thread Garrett Cooper
Author: ngie
Date: Sun Oct 25 07:42:56 2015
New Revision: 289925
URL: https://svnweb.freebsd.org/changeset/base/289925

Log:
  Fix compiling with gcc [4.2.1] after r287797 when MK_HESOID == no and
  MK_NIS == no by converting `i` back to an int, and instead cast the loop
  comparison to `int`
  
  The loop comparison is iterating the len(ns_dtab)-1, because
  the last element is the sentinel tuple { NULL, NULL, NULL, }, so when
  both HESOID and NIS are off, len(ns_dtab)-1 == 1 - 1 == 0, and the loop
  is skipped because the expression is tautologically false
  
  While here, convert `(sizeof(x) / sizeof(x[0]))` to `nitems(x)`
  
  Tested with: clang 3.7.0, gcc 4.2.1, and gcc 4.9.4 [*] with MK_NIS={no,yes}
   and by running bash -lc 'id -u && id -g && id'
  
  * gcc 4.9.4 needs another patch in order for the compile to succeed
with -Werror with lib/libc/gen/getgrent.c
  
  Reported by: jhibbits

Modified:
  head/lib/libc/gen/getgrent.c
  head/lib/libc/gen/getpwent.c

Modified: head/lib/libc/gen/getgrent.c
==
--- head/lib/libc/gen/getgrent.cSun Oct 25 07:26:12 2015
(r289924)
+++ head/lib/libc/gen/getgrent.cSun Oct 25 07:42:56 2015
(r289925)
@@ -1239,14 +1239,13 @@ compat_setgrent(void *retval, void *mdat
int  rv, stayopen;
 
 #define set_setent(x, y) do {  \
-   unsigned int i; \
-   \
-   for (i = 0; i < (sizeof(x)/sizeof(x[0])) - 1; i++)  \
+   int i;  \
+   for (i = 0; i < (int)(nitems(x) - 1); i++)  \
x[i].mdata = (void *)y; \
 } while (0)
 
rv = compat_getstate();
-   if (rv != 0) 
+   if (rv != 0)
return (NS_UNAVAIL);
switch ((enum constants)mdata) {
case SETGRENT:
@@ -1309,9 +1308,8 @@ compat_group(void *retval, void *mdata, 
int  rv, stayopen, *errnop;
 
 #define set_lookup_type(x, y) do { \
-   unsigned int i; \
-   \
-   for (i = 0; i < (sizeof(x)/sizeof(x[0])) - 1; i++)  \
+   int i;  \
+   for (i = 0; i < (int)(nitems(x) - 1); i++)  \
x[i].mdata = (void *)y; \
 } while (0)
 

Modified: head/lib/libc/gen/getpwent.c
==
--- head/lib/libc/gen/getpwent.cSun Oct 25 07:26:12 2015
(r289924)
+++ head/lib/libc/gen/getpwent.cSun Oct 25 07:42:56 2015
(r289925)
@@ -1607,10 +1607,9 @@ compat_redispatch(struct compat_state *s
{ NULL, NULL, NULL }
};
void*discard;
-   int  rv, e;
-   unsigned int i;
+   int  e, i, rv;
 
-   for (i = 0; i < sizeof(dtab)/sizeof(dtab[0]) - 1; i++)
+   for (i = 0; i < (int)(nitems(dtab) - 1); i++)
dtab[i].mdata = (void *)lookup_how;
 more:
pwd_init(pwd);
@@ -1703,9 +1702,8 @@ compat_setpwent(void *retval, void *mdat
int  rv, stayopen;
 
 #define set_setent(x, y) do {  \
-   unsigned int i; \
-   \
-   for (i = 0; i < (sizeof(x)/sizeof(x[0])) - 1; i++)  \
+   int i;  \
+   for (i = 0; i < (int)(nitems(x) - 1); i++)  \
x[i].mdata = (void *)y; \
 } while (0)
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r289930 - head/sys/dev/isp

2015-10-25 Thread Alexander Motin
Author: mav
Date: Sun Oct 25 10:49:05 2015
New Revision: 289930
URL: https://svnweb.freebsd.org/changeset/base/289930

Log:
  Formalize/unify chip (re-)inits.

Modified:
  head/sys/dev/isp/isp.c
  head/sys/dev/isp/isp_freebsd.c
  head/sys/dev/isp/isp_pci.c
  head/sys/dev/isp/isp_sbus.c

Modified: head/sys/dev/isp/isp.c
==
--- head/sys/dev/isp/isp.c  Sun Oct 25 09:16:20 2015(r289929)
+++ head/sys/dev/isp/isp.c  Sun Oct 25 10:49:05 2015(r289930)
@@ -1368,6 +1368,8 @@ isp_scsi_init(ispsoftc_t *isp)
sdparam *sdp_chan0, *sdp_chan1;
mbreg_t mbs;
 
+   isp->isp_state = ISP_INITSTATE;
+
sdp_chan0 = SDPARAM(isp, 0);
sdp_chan1 = sdp_chan0;
if (IS_DUALBUS(isp)) {
@@ -1543,7 +1545,7 @@ isp_scsi_init(ispsoftc_t *isp)
}
}
 
-   isp->isp_state = ISP_INITSTATE;
+   isp->isp_state = ISP_RUNSTATE;
 }
 
 static void
@@ -1673,11 +1675,10 @@ isp_fibre_init(ispsoftc_t *isp)
 * We only support one channel on non-24XX cards
 */
fcp = FCPARAM(isp, 0);
-   if (fcp->role == ISP_ROLE_NONE) {
-   isp->isp_state = ISP_INITSTATE;
+   if (fcp->role == ISP_ROLE_NONE)
return;
-   }
 
+   isp->isp_state = ISP_INITSTATE;
ISP_MEMZERO(icbp, sizeof (*icbp));
icbp->icb_version = ICB_VERSION1;
icbp->icb_fwoptions = fcp->isp_fwoptions;
@@ -1978,7 +1979,7 @@ isp_fibre_init(ispsoftc_t *isp)
/*
 * Whatever happens, we're now committed to being here.
 */
-   isp->isp_state = ISP_INITSTATE;
+   isp->isp_state = ISP_RUNSTATE;
 }
 
 static void
@@ -2001,10 +2002,11 @@ isp_fibre_init_2400(ispsoftc_t *isp)
}
if (chan == isp->isp_nchan) {
isp_prt(isp, ISP_LOG_WARN1, "all %d channels with role 'none'", 
chan);
-   isp->isp_state = ISP_INITSTATE;
return;
}
 
+   isp->isp_state = ISP_INITSTATE;
+
/*
 * Start with channel 0.
 */
@@ -2285,7 +2287,7 @@ isp_fibre_init_2400(ispsoftc_t *isp)
/*
 * Whatever happens, we're now committed to being here.
 */
-   isp->isp_state = ISP_INITSTATE;
+   isp->isp_state = ISP_RUNSTATE;
 }
 
 static void
@@ -4349,16 +4351,6 @@ isp_start(XS_T *xs)
isp = XS_ISP(xs);
 
/*
-* Now make sure we're running.
-*/
-
-   if (isp->isp_state != ISP_RUNSTATE) {
-   isp_prt(isp, ISP_LOGERR, "Adapter not at RUNSTATE");
-   XS_SETERR(xs, HBA_BOTCH);
-   return (CMD_COMPLETE);
-   }
-
-   /*
 * Check command CDB length, etc.. We really are limited to 16 bytes
 * for Fibre Channel, but can do up to 44 bytes in parallel SCSI,
 * but probably only if we're running fairly new firmware (we'll
@@ -4387,6 +4379,12 @@ isp_start(XS_T *xs)
return (CMD_COMPLETE);
}
 
+   if (isp->isp_state != ISP_RUNSTATE) {
+   isp_prt(isp, ISP_LOGERR, "Adapter not at RUNSTATE");
+   XS_SETERR(xs, HBA_BOTCH);
+   return (CMD_COMPLETE);
+   }
+
/*
 * Try again later.
 */
@@ -4423,6 +4421,13 @@ isp_start(XS_T *xs)
XS_SETERR(xs, HBA_SELTIMEOUT);
return (CMD_COMPLETE);
}
+
+   if (isp->isp_state != ISP_RUNSTATE) {
+   isp_prt(isp, ISP_LOGERR, "Adapter not at RUNSTATE");
+   XS_SETERR(xs, HBA_BOTCH);
+   return (CMD_COMPLETE);
+   }
+
if (sdp->update) {
isp_spi_update(isp, XS_CHANNEL(xs));
}
@@ -7915,7 +7920,8 @@ isp_reinit(ispsoftc_t *isp, int do_load_
 {
int i, res = 0;
 
-   isp_reset(isp, do_load_defaults);
+   if (isp->isp_state != ISP_RESETSTATE)
+   isp_reset(isp, do_load_defaults);
if (isp->isp_state != ISP_RESETSTATE) {
res = EIO;
isp_prt(isp, ISP_LOGERR, "%s: cannot reset card", __func__);
@@ -7924,15 +7930,10 @@ isp_reinit(ispsoftc_t *isp, int do_load_
}
 
isp_init(isp);
-   if (isp->isp_state == ISP_INITSTATE) {
-   isp->isp_state = ISP_RUNSTATE;
-   }
-
-   if (isp->isp_state != ISP_RUNSTATE) {
+   if (isp->isp_state > ISP_RESETSTATE &&
+   isp->isp_state != ISP_RUNSTATE) {
res = EIO;
-#ifndefISP_TARGET_MODE
-   isp_prt(isp, ISP_LOGWARN, "%s: not at runstate", __func__);
-#endif
+   isp_prt(isp, ISP_LOGERR, "%s: cannot init card", __func__);
ISP_DISABLE_INTS(isp);
if (IS_FC(isp)) {
/*

Modified: head/sys/dev/isp/isp_freebsd.c

svn commit: r289932 - head/sys/net

2015-10-25 Thread Kristof Provost
Author: kp
Date: Sun Oct 25 13:14:53 2015
New Revision: 289932
URL: https://svnweb.freebsd.org/changeset/base/289932

Log:
  PF_ANEQ() macro will in most situations returns TRUE comparing two identical
  IPv4 packets (when it should return FALSE). It happens because PF_ANEQ() 
doesn't
  stop if first 32 bits of IPv4 packets are equal and starts to check next 3*32
  bits (like for IPv6 packet). Those bits containt some garbage and in result
  PF_ANEQ() wrongly returns TRUE.
  
  Fix: Check if packet is of AF_INET type and if it is then compare only first 
32
  bits of data.
  
  PR:   204005
  Submitted by: Miłosz Kaniewski

Modified:
  head/sys/net/pfvar.h

Modified: head/sys/net/pfvar.h
==
--- head/sys/net/pfvar.hSun Oct 25 12:09:28 2015(r289931)
+++ head/sys/net/pfvar.hSun Oct 25 13:14:53 2015(r289932)
@@ -198,10 +198,11 @@ extern struct rwlock pf_rules_lock;
(a)->addr32[0] == (b)->addr32[0])) \
 
 #define PF_ANEQ(a, b, c) \
-   ((a)->addr32[0] != (b)->addr32[0] || \
+   ((c == AF_INET && (a)->addr32[0] != (b)->addr32[0]) || \
+   (c == AF_INET6 && (a)->addr32[3] != (b)->addr32[3] && \
(a)->addr32[1] != (b)->addr32[1] || \
(a)->addr32[2] != (b)->addr32[2] || \
-   (a)->addr32[3] != (b)->addr32[3]) \
+   (a)->addr32[3] != (b)->addr32[3])) \
 
 #define PF_AZERO(a, c) \
((c == AF_INET && !(a)->addr32[0]) || \
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

svn commit: r289931 - head/lib/libc/stdio

2015-10-25 Thread Andrey A. Chernov
Author: ache
Date: Sun Oct 25 12:09:28 2015
New Revision: 289931
URL: https://svnweb.freebsd.org/changeset/base/289931

Log:
  According to POSIX, a write operation shall start at the current size of
  the stream (if mode had 'a' as the first character).
  
  MFC after:  1 week

Modified:
  head/lib/libc/stdio/fmemopen.c

Modified: head/lib/libc/stdio/fmemopen.c
==
--- head/lib/libc/stdio/fmemopen.c  Sun Oct 25 10:49:05 2015
(r289930)
+++ head/lib/libc/stdio/fmemopen.c  Sun Oct 25 12:09:28 2015
(r289931)
@@ -149,6 +149,9 @@ fmemopen(void * __restrict buf, size_t s
return (NULL);
}
 
+   if (mode[0] == 'a')
+   f->_flags |= __SAPP;
+
/*
 * Turn off buffering, so a write past the end of the buffer
 * correctly returns a short object count.
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r289951 - head/sys/dev/mge

2015-10-25 Thread Zbigniew Bodek
Author: zbb
Date: Sun Oct 25 22:20:13 2015
New Revision: 289951
URL: https://svnweb.freebsd.org/changeset/base/289951

Log:
  Improve style in mge driver
  
  Minor improvements introduced to ensure code follows FreeBSD style
  guidelines.
  
  Reviewed by:adrian
  Obtained from:  Semihalf
  Submitted by:   Bartosz Szczepanek 
  Differential revision: https://reviews.freebsd.org/D3904

Modified:
  head/sys/dev/mge/if_mge.c

Modified: head/sys/dev/mge/if_mge.c
==
--- head/sys/dev/mge/if_mge.c   Sun Oct 25 22:19:11 2015(r289950)
+++ head/sys/dev/mge/if_mge.c   Sun Oct 25 22:20:13 2015(r289951)
@@ -133,13 +133,15 @@ static void mge_set_ucast_address(struct
 static void mge_set_prom_mode(struct mge_softc *sc, uint8_t queue);
 static int mge_allocate_dma(struct mge_softc *sc);
 static int mge_alloc_desc_dma(struct mge_softc *sc,
-struct mge_desc_wrapper* desc_tab, uint32_t size, bus_dma_tag_t 
*buffer_tag);
+struct mge_desc_wrapper* desc_tab, uint32_t size,
+bus_dma_tag_t *buffer_tag);
 static int mge_new_rxbuf(bus_dma_tag_t tag, bus_dmamap_t map,
 struct mbuf **mbufp, bus_addr_t *paddr);
-static void mge_get_dma_addr(void *arg, bus_dma_segment_t *segs, int nseg, int 
error);
+static void mge_get_dma_addr(void *arg, bus_dma_segment_t *segs, int nseg,
+int error);
 static void mge_free_dma(struct mge_softc *sc);
-static void mge_free_desc(struct mge_softc *sc, struct mge_desc_wrapper* tab, 
uint32_t size,
-bus_dma_tag_t buffer_tag, uint8_t free_mbufs);
+static void mge_free_desc(struct mge_softc *sc, struct mge_desc_wrapper* tab,
+uint32_t size, bus_dma_tag_t buffer_tag, uint8_t free_mbufs);
 static void mge_offload_process_frame(struct ifnet *ifp, struct mbuf *frame,
 uint32_t status, uint16_t bufsize);
 static void mge_offload_setup_descriptor(struct mge_softc *sc,
@@ -692,6 +694,7 @@ mge_free_desc(struct mge_softc *sc, stru
 static void
 mge_free_dma(struct mge_softc *sc)
 {
+
/* Free desciptors and mbufs */
mge_free_desc(sc, sc->mge_rx_desc, MGE_RX_DESC_NUM, sc->mge_rx_dtag, 1);
mge_free_desc(sc, sc->mge_tx_desc, MGE_TX_DESC_NUM, sc->mge_tx_dtag, 0);
@@ -815,8 +818,10 @@ mge_attach(device_t dev)
mge_ver_params(sc);
 
/* Initialize mutexes */
-   mtx_init(>transmit_lock, device_get_nameunit(dev), "mge TX lock", 
MTX_DEF);
-   mtx_init(>receive_lock, device_get_nameunit(dev), "mge RX lock", 
MTX_DEF);
+   mtx_init(>transmit_lock, device_get_nameunit(dev), "mge TX lock",
+   MTX_DEF);
+   mtx_init(>receive_lock, device_get_nameunit(dev), "mge RX lock",
+   MTX_DEF);
 
/* Allocate IO and IRQ resources */
error = bus_alloc_resources(dev, res_spec, sc->res);
@@ -951,7 +956,8 @@ mge_detach(device_t dev)
if (!sc->ih_cookie[i])
continue;
 
-   error = bus_teardown_intr(dev, sc->res[1 + i], 
sc->ih_cookie[i]);
+   error = bus_teardown_intr(dev, sc->res[1 + i],
+   sc->ih_cookie[i]);
if (error)
device_printf(dev, "could not release %s\n",
mge_intrs[(sc->mge_intr_cnt == 1 ? 0 : i + 
1)].description);
@@ -982,9 +988,10 @@ mge_detach(device_t dev)
 static void
 mge_ifmedia_sts(struct ifnet *ifp, struct ifmediareq *ifmr)
 {
-   struct mge_softc *sc = ifp->if_softc;
+   struct mge_softc *sc;
struct mii_data *mii;
 
+   sc = ifp->if_softc;
MGE_GLOBAL_LOCK(sc);
 
if (!sc->phy_attached) {
@@ -1066,8 +1073,9 @@ mge_ifmedia_upd(struct ifnet *ifp)
 static void
 mge_init(void *arg)
 {
-   struct mge_softc *sc = arg;
+   struct mge_softc *sc;
 
+   sc = arg;
MGE_GLOBAL_LOCK(sc);
 
mge_init_locked(arg);
@@ -1213,9 +1221,10 @@ mge_init_locked(void *arg)
 static void
 mge_intr_rxtx(void *arg)
 {
-   struct mge_softc *sc = arg;
+   struct mge_softc *sc;
uint32_t int_cause, int_cause_ext;
 
+   sc = arg;
MGE_GLOBAL_LOCK(sc);
 
 #ifdef DEVICE_POLLING
@@ -1248,9 +1257,10 @@ mge_intr_rxtx(void *arg)
 static void
 mge_intr_err(void *arg)
 {
-   struct mge_softc *sc = arg;
+   struct mge_softc *sc;
struct ifnet *ifp;
 
+   sc = arg;
ifp = sc->ifp;
if_printf(ifp, "%s\n", __FUNCTION__);
 }
@@ -1258,18 +1268,20 @@ mge_intr_err(void *arg)
 static void
 mge_intr_misc(void *arg)
 {
-   struct mge_softc *sc = arg;
+   struct mge_softc *sc;
struct ifnet *ifp;
 
+   sc = arg;
ifp = sc->ifp;
if_printf(ifp, "%s\n", __FUNCTION__);
 }
 
 static void
 mge_intr_rx(void *arg) {
-   struct mge_softc *sc = arg;
+   struct mge_softc *sc;
uint32_t int_cause, int_cause_ext;
 
+   sc = arg;
MGE_RECEIVE_LOCK(sc);
 
 #ifdef DEVICE_POLLING
@@ -1411,7 +1423,6 @@ mge_intr_tx(void *arg)

svn commit: r289948 - head/sys/dev/mge

2015-10-25 Thread Zbigniew Bodek
Author: zbb
Date: Sun Oct 25 22:17:10 2015
New Revision: 289948
URL: https://svnweb.freebsd.org/changeset/base/289948

Log:
  Change improper locking assertion in mge
  
  Assertion used here was invalid. If current thread helds any of locks,
  we never want to recurse on them.
  
  Obtained from:  Semihalf
  Submitted by:   Bartosz Szczepanek 
  Differential revision: https://reviews.freebsd.org/D3903

Modified:
  head/sys/dev/mge/if_mgevar.h

Modified: head/sys/dev/mge/if_mgevar.h
==
--- head/sys/dev/mge/if_mgevar.hSun Oct 25 22:14:04 2015
(r289947)
+++ head/sys/dev/mge/if_mgevar.hSun Oct 25 22:17:10 2015
(r289948)
@@ -137,10 +137,8 @@ struct mge_softc {
 #define MGE_RECEIVE_LOCK_ASSERT(sc)mtx_assert(&(sc)->receive_lock, 
MA_OWNED)
 
 #define MGE_GLOBAL_LOCK(sc) do {   
\
-   if ((mtx_owned(&(sc)->transmit_lock) ? 1 : 0) !=
\
-   (mtx_owned(&(sc)->receive_lock) ? 1 : 0)) { 
\
-   panic("mge deadlock possibility detection!");   
\
-   }   
\
+   mtx_assert(&(sc)->transmit_lock, MA_NOTOWNED);  
\
+   mtx_assert(&(sc)->receive_lock, MA_NOTOWNED);   
\
mtx_lock(&(sc)->transmit_lock); 
\
mtx_lock(&(sc)->receive_lock);  
\
 } while (0)
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r289966 - head/sys/arm64/cavium

2015-10-25 Thread Zbigniew Bodek
Author: zbb
Date: Sun Oct 25 23:22:40 2015
New Revision: 289966
URL: https://svnweb.freebsd.org/changeset/base/289966

Log:
  Add support for unspecified ranges on ThunderX system
  
  When one tries to allocate a resource with unspecified range,
  read already configured BAR values (by UEFI or whatever).
  This is necessary to make VNIC VFs working and to allow them to be
  properly allocated.
  
  Obtained from: Semihalf
  Sponsored by:  The FreeBSD Foundation
  Differential revision: https://reviews.freebsd.org/D3752

Modified:
  head/sys/arm64/cavium/thunder_pcie.c

Modified: head/sys/arm64/cavium/thunder_pcie.c
==
--- head/sys/arm64/cavium/thunder_pcie.cSun Oct 25 23:03:04 2015
(r289965)
+++ head/sys/arm64/cavium/thunder_pcie.cSun Oct 25 23:22:40 2015
(r289966)
@@ -35,6 +35,8 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
+#include 
 #include 
 #include 
 #include 
@@ -47,6 +49,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -96,6 +99,15 @@ struct thunder_pcie_softc {
device_tdev;
 };
 
+/*
+ * ThunderX supports up to 4 ethernet interfaces, so it's good
+ * value to use as default for numbers of VFs, since each eth
+ * interface represents separate virtual function.
+ */
+static int thunder_pcie_max_vfs = 4;
+SYSCTL_INT(_hw, OID_AUTO, thunder_pcie_max_vfs, CTLFLAG_RWTUN,
+_pcie_max_vfs, 0, "Max VFs supported by ThunderX internal PCIe");
+
 /* Forward prototypes */
 static struct resource *thunder_pcie_alloc_resource(device_t,
 device_t, int, int *, u_long, u_long, u_long, u_int);
@@ -424,6 +436,7 @@ thunder_pcie_alloc_resource(device_t dev
struct thunder_pcie_softc *sc = device_get_softc(dev);
struct rman *rm = NULL;
struct resource *res;
+   pci_addr_t map, testval;
 
switch (type) {
case SYS_RES_IOPORT:
@@ -438,9 +451,32 @@ thunder_pcie_alloc_resource(device_t dev
};
 
if ((start == 0UL) && (end == ~0UL)) {
-   device_printf(dev,
-   "Cannot allocate resource with unspecified range\n");
-   goto fail;
+
+   /* Read BAR manually to get resource address and size */
+   pci_read_bar(child, *rid, , , NULL);
+
+   /* Mask the information bits */
+   if (PCI_BAR_MEM(map))
+   map &= PCIM_BAR_MEM_BASE;
+   else
+   map &= PCIM_BAR_IO_BASE;
+
+   if (PCI_BAR_MEM(testval))
+   testval &= PCIM_BAR_MEM_BASE;
+   else
+   testval &= PCIM_BAR_IO_BASE;
+
+   start = map;
+   count = (~testval) + 1;
+   /*
+* Internal ThunderX devices supports up to 3 64-bit BARs.
+* If we're allocating anything above, that means upper layer
+* wants us to allocate VF-BAR. In that case reserve bigger
+* slice to make a room for other VFs adjacent to this one.
+*/
+   if (*rid > PCIR_BAR(5))
+   count = count * thunder_pcie_max_vfs;
+   end = start + count - 1;
}
 
/* Convert input BUS address to required PHYS */
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r289979 - in head/sys: dev/ioat sys

2015-10-25 Thread Conrad E. Meyer
Author: cem
Date: Mon Oct 26 02:21:19 2015
New Revision: 289979
URL: https://svnweb.freebsd.org/changeset/base/289979

Log:
  ioat: Introduce KTR probes
  
  Sponsored by: EMC / Isilon Storage Division

Modified:
  head/sys/dev/ioat/ioat.c
  head/sys/dev/ioat/ioat_internal.h
  head/sys/sys/ktr_class.h

Modified: head/sys/dev/ioat/ioat.c
==
--- head/sys/dev/ioat/ioat.cMon Oct 26 00:28:05 2015(r289978)
+++ head/sys/dev/ioat/ioat.cMon Oct 26 02:21:19 2015(r289979)
@@ -567,7 +567,7 @@ ioat_process_events(struct ioat_softc *i
comp_update = *ioat->comp_update;
status = comp_update & IOAT_CHANSTS_COMPLETED_DESCRIPTOR_MASK;
 
-   ioat_log_message(3, "%s\n", __func__);
+   CTR0(KTR_IOAT, __func__);
 
if (status == ioat->last_seen)
goto out;
@@ -575,7 +575,7 @@ ioat_process_events(struct ioat_softc *i
while (1) {
desc = ioat_get_ring_entry(ioat, ioat->tail);
dmadesc = >bus_dmadesc;
-   ioat_log_message(3, "completing desc %d\n", ioat->tail);
+   CTR1(KTR_IOAT, "completing desc %d", ioat->tail);
 
if (dmadesc->callback_fn)
(*dmadesc->callback_fn)(dmadesc->callback_arg);
@@ -629,7 +629,7 @@ ioat_acquire(bus_dmaengine_t dmaengine)
 
ioat = to_ioat_softc(dmaengine);
mtx_lock(>submit_lock);
-   ioat_log_message(3, "%s\n", __func__);
+   CTR0(KTR_IOAT, __func__);
 }
 
 void
@@ -638,7 +638,7 @@ ioat_release(bus_dmaengine_t dmaengine)
struct ioat_softc *ioat;
 
ioat = to_ioat_softc(dmaengine);
-   ioat_log_message(3, "%s\n", __func__);
+   CTR0(KTR_IOAT, __func__);
ioat_write_2(ioat, IOAT_DMACOUNT_OFFSET, (uint16_t)ioat->head);
mtx_unlock(>submit_lock);
 }
@@ -660,7 +660,7 @@ ioat_null(bus_dmaengine_t dmaengine, bus
if (ioat_reserve_space_and_lock(ioat, 1) != 0)
return (NULL);
 
-   ioat_log_message(3, "%s\n", __func__);
+   CTR0(KTR_IOAT, __func__);
 
desc = ioat_get_ring_entry(ioat, ioat->head);
hw_desc = desc->u.dma;
@@ -707,7 +707,7 @@ ioat_copy(bus_dmaengine_t dmaengine, bus
if (ioat_reserve_space_and_lock(ioat, 1) != 0)
return (NULL);
 
-   ioat_log_message(3, "%s\n", __func__);
+   CTR0(KTR_IOAT, __func__);
 
desc = ioat_get_ring_entry(ioat, ioat->head);
hw_desc = desc->u.dma;

Modified: head/sys/dev/ioat/ioat_internal.h
==
--- head/sys/dev/ioat/ioat_internal.h   Mon Oct 26 00:28:05 2015
(r289978)
+++ head/sys/dev/ioat/ioat_internal.h   Mon Oct 26 02:21:19 2015
(r289979)
@@ -29,7 +29,8 @@ __FBSDID("$FreeBSD$");
 #ifndef __IOAT_INTERNAL_H__
 #define __IOAT_INTERNAL_H__
 
-#define DEVICE2SOFTC(dev) ((struct ioat_softc *) device_get_softc(dev))
+#defineDEVICE2SOFTC(dev)   ((struct ioat_softc *) 
device_get_softc(dev))
+#defineKTR_IOATKTR_SPARE3
 
 #defineioat_read_chancnt(ioat) \
ioat_read_1((ioat), IOAT_CHANCNT_OFFSET)

Modified: head/sys/sys/ktr_class.h
==
--- head/sys/sys/ktr_class.hMon Oct 26 00:28:05 2015(r289978)
+++ head/sys/sys/ktr_class.hMon Oct 26 02:21:19 2015(r289979)
@@ -55,7 +55,7 @@
 #defineKTR_PROC0x1000  /* Process scheduling */
 #defineKTR_SYSC0x2000  /* System call */
 #defineKTR_INIT0x4000  /* System 
initialization */
-#defineKTR_SPARE3  0x8000  /* cxgb, drm2, ntb */
+#defineKTR_SPARE3  0x8000  /* cxgb, drm2, ioat, 
ntb */
 #defineKTR_SPARE4  0x0001  /* geom_sched */
 #defineKTR_EVH 0x0002  /* Eventhandler */
 #defineKTR_VFS 0x0004  /* VFS events */
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r289980 - head/sys/dev/ioat

2015-10-25 Thread Conrad E. Meyer
Author: cem
Date: Mon Oct 26 02:21:32 2015
New Revision: 289980
URL: https://svnweb.freebsd.org/changeset/base/289980

Log:
  ioat: Expose more softc members in sysctls
  
  Kill some unused softc variables while we're here.
  
  Sponsored by: EMC / Isilon Storage Division

Modified:
  head/sys/dev/ioat/ioat.c
  head/sys/dev/ioat/ioat_internal.h

Modified: head/sys/dev/ioat/ioat.c
==
--- head/sys/dev/ioat/ioat.cMon Oct 26 02:21:19 2015(r289979)
+++ head/sys/dev/ioat/ioat.cMon Oct 26 02:21:32 2015(r289980)
@@ -381,7 +381,6 @@ ioat3_attach(device_t device)
ioat->is_completion_pending = FALSE;
ioat->is_reset_pending = FALSE;
ioat->is_channel_running = FALSE;
-   ioat->is_waiting_for_ack = FALSE;
 
bus_dma_tag_create(bus_get_dma_tag(ioat->device), sizeof(uint64_t), 0x0,
BUS_SPACE_MAXADDR, BUS_SPACE_MAXADDR, NULL, NULL,
@@ -1129,6 +1128,11 @@ ioat_setup_sysctl(device_t device)
tree = device_get_sysctl_tree(device);
par = SYSCTL_CHILDREN(tree);
 
+   SYSCTL_ADD_INT(ctx, par, OID_AUTO, "version", CTLFLAG_RD,
+   >version, 0, "HW version (0xMM form)");
+   SYSCTL_ADD_UINT(ctx, par, OID_AUTO, "max_xfer_size", CTLFLAG_RD,
+   >max_xfer_size, 0, "HW maximum transfer size");
+
SYSCTL_ADD_UINT(ctx, par, OID_AUTO, "ring_size_order", CTLFLAG_RD,
>ring_size_order, 0, "HW descriptor ring size order");
SYSCTL_ADD_UINT(ctx, par, OID_AUTO, "head", CTLFLAG_RD, >head, 0,
@@ -1136,6 +1140,18 @@ ioat_setup_sysctl(device_t device)
SYSCTL_ADD_UINT(ctx, par, OID_AUTO, "tail", CTLFLAG_RD, >tail, 0,
"HW descriptor tail pointer index");
 
+   SYSCTL_ADD_UQUAD(ctx, par, OID_AUTO, "last_completion", CTLFLAG_RD,
+   ioat->comp_update, "HW addr of last completion");
+
+   SYSCTL_ADD_INT(ctx, par, OID_AUTO, "is_resize_pending", CTLFLAG_RD,
+   >is_resize_pending, 0, "resize pending");
+   SYSCTL_ADD_INT(ctx, par, OID_AUTO, "is_completion_pending", CTLFLAG_RD,
+   >is_completion_pending, 0, "completion pending");
+   SYSCTL_ADD_INT(ctx, par, OID_AUTO, "is_reset_pending", CTLFLAG_RD,
+   >is_reset_pending, 0, "reset pending");
+   SYSCTL_ADD_INT(ctx, par, OID_AUTO, "is_channel_running", CTLFLAG_RD,
+   >is_channel_running, 0, "channel running");
+
SYSCTL_ADD_PROC(ctx, par, OID_AUTO, "force_hw_reset",
CTLTYPE_INT | CTLFLAG_RW, ioat, 0, sysctl_handle_reset, "I",
"Set to non-zero to reset the hardware");

Modified: head/sys/dev/ioat/ioat_internal.h
==
--- head/sys/dev/ioat/ioat_internal.h   Mon Oct 26 02:21:19 2015
(r289979)
+++ head/sys/dev/ioat/ioat_internal.h   Mon Oct 26 02:21:32 2015
(r289980)
@@ -333,7 +333,6 @@ struct ioat_softc {
int version;
 
struct mtx  submit_lock;
-   int num_interrupts;
device_tdevice;
bus_space_tag_t pci_bus_tag;
bus_space_handle_t  pci_bus_handle;
@@ -359,12 +358,9 @@ struct ioat_softc {
boolean_t   is_completion_pending;
boolean_t   is_reset_pending;
boolean_t   is_channel_running;
-   boolean_t   is_waiting_for_ack;
 
-   uint32_txfercap_log;
uint32_thead;
uint32_ttail;
-   uint16_treserved;
uint32_tring_size_order;
bus_addr_t  last_seen;
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r289945 - in head/sys: arm/conf conf dev/mge

2015-10-25 Thread Zbigniew Bodek
Author: zbb
Date: Sun Oct 25 22:00:56 2015
New Revision: 289945
URL: https://svnweb.freebsd.org/changeset/base/289945

Log:
  Add etherswitch support to mge
  
  This commit introduces support for etherswitch devices that utilize SMI as
  a way of accessing its registers. SMI register is located in address space
  of mge -- access to it was exported through MDIO interface.
  
  Attachment functions were enhanced so as to ensure proper initialisation
  in both cases: 1) PHYs attached directly to mge, 2) PHYs attached to
  switch device and switch attached to mge. Attachment of etherswitch device
  depends on dts entry with compatible="mrvl,sw" property. If none is found,
  typical PHY attachment procedure follows.
  
  In case of switch attached, PHYs' status and configuration is accessible
  via etherswitchcfg, and ifconfig shows always-up, non-configurable mge
  interfaces.
  
  Due to the fact that there may be simultaneous accessess to SMI
  registers (e.g. from PHY attached to one of mge instances and switch
  to the other), SMI access interlock was added. It is SX lock,
  because sleep ability is necessary -- busy-waiting would result
  in poor performance due to long delays required by hardware.
  Underlying switch driver is obliged to use sleepable locks as well.
  
  Reviewed by:adrian
  Obtained from:  Semihalf
  Submitted by:   Bartosz Szczepanek 
  Differential revision: https://reviews.freebsd.org/D3900

Modified:
  head/sys/arm/conf/ARMADAXP
  head/sys/arm/conf/DB-78XXX
  head/sys/arm/conf/DB-88F5XXX
  head/sys/arm/conf/DB-88F6XXX
  head/sys/arm/conf/DOCKSTAR
  head/sys/arm/conf/DREAMPLUG-1001
  head/sys/arm/conf/SHEEVAPLUG
  head/sys/arm/conf/TS7800
  head/sys/conf/files
  head/sys/dev/mge/if_mge.c
  head/sys/dev/mge/if_mgevar.h

Modified: head/sys/arm/conf/ARMADAXP
==
--- head/sys/arm/conf/ARMADAXP  Sun Oct 25 21:48:45 2015(r289944)
+++ head/sys/arm/conf/ARMADAXP  Sun Oct 25 22:00:56 2015(r289945)
@@ -95,6 +95,7 @@ deviceiicbus
 device ether
 device mge # Marvell Gigabit Ethernet controller
 device mii
+device mdio
 device e1000phy
 device bpf
 optionsDEVICE_POLLING

Modified: head/sys/arm/conf/DB-78XXX
==
--- head/sys/arm/conf/DB-78XXX  Sun Oct 25 21:48:45 2015(r289944)
+++ head/sys/arm/conf/DB-78XXX  Sun Oct 25 22:00:56 2015(r289945)
@@ -66,6 +66,7 @@ deviceuart
 device ether
 device mge # Marvell Gigabit Ethernet controller
 device mii
+device mdio
 device e1000phy
 device bpf
 

Modified: head/sys/arm/conf/DB-88F5XXX
==
--- head/sys/arm/conf/DB-88F5XXXSun Oct 25 21:48:45 2015
(r289944)
+++ head/sys/arm/conf/DB-88F5XXXSun Oct 25 22:00:56 2015
(r289945)
@@ -65,6 +65,7 @@ deviceuart
 device ether
 device mge # Marvell Gigabit Ethernet controller
 device mii
+device mdio
 device e1000phy
 device bpf
 optionsDEVICE_POLLING

Modified: head/sys/arm/conf/DB-88F6XXX
==
--- head/sys/arm/conf/DB-88F6XXXSun Oct 25 21:48:45 2015
(r289944)
+++ head/sys/arm/conf/DB-88F6XXXSun Oct 25 22:00:56 2015
(r289945)
@@ -67,6 +67,7 @@ deviceuart
 device ether
 device mge # Marvell Gigabit Ethernet controller
 device mii
+device mdio
 device e1000phy
 device bpf
 

Modified: head/sys/arm/conf/DOCKSTAR
==
--- head/sys/arm/conf/DOCKSTAR  Sun Oct 25 21:48:45 2015(r289944)
+++ head/sys/arm/conf/DOCKSTAR  Sun Oct 25 22:00:56 2015(r289945)
@@ -96,6 +96,7 @@ deviceuart
 # Networking
 device mge # Marvell Gigabit Ethernet controller
 device mii
+device mdio
 device e1000phy
 
 # USB

Modified: head/sys/arm/conf/DREAMPLUG-1001
==
--- head/sys/arm/conf/DREAMPLUG-1001Sun Oct 25 21:48:45 2015
(r289944)
+++ head/sys/arm/conf/DREAMPLUG-1001Sun Oct 25 22:00:56 2015
(r289945)
@@ -100,6 +100,7 @@ device  uart
 # Networking
 device mge # Marvell Gigabit Ethernet controller
 device mii
+device mdio
 device e1000phy
 
 # USB

Modified: head/sys/arm/conf/SHEEVAPLUG
==
--- 

svn commit: r289967 - head/sys/arm64/arm64

2015-10-25 Thread Zbigniew Bodek
Author: zbb
Date: Sun Oct 25 23:27:08 2015
New Revision: 289967
URL: https://svnweb.freebsd.org/changeset/base/289967

Log:
  Fix bus numbering in ThunderX ITS quirk
  
  Internal busses (thus ECAM access) should be mapped to
  all values from 0 to 143.
  
  Obtained from: Semihalf
  Sponsored by:  The FreeBSD Foundation
  Differential revision: https://reviews.freebsd.org/D3753

Modified:
  head/sys/arm64/arm64/gic_v3_its.c

Modified: head/sys/arm64/arm64/gic_v3_its.c
==
--- head/sys/arm64/arm64/gic_v3_its.c   Sun Oct 25 23:22:40 2015
(r289966)
+++ head/sys/arm64/arm64/gic_v3_its.c   Sun Oct 25 23:27:08 2015
(r289967)
@@ -59,6 +59,8 @@ __FBSDID("$FreeBSD$");
 #include "gic_v3_reg.h"
 #include "gic_v3_var.h"
 
+#defineGIC_V3_ITS_QUIRK_THUNDERX_PEM_BUS_OFFSET144
+
 #include "pic_if.h"
 
 /* Device and PIC methods */
@@ -1475,8 +1477,8 @@ its_get_devid_thunder(device_t pci_dev)
bsf = PCI_RID(pci_get_bus(pci_dev), pci_get_slot(pci_dev),
pci_get_function(pci_dev));
 
-   /* ECAM is on bus=0 */
-   if (bus == 0) {
+   /* Check if accessing internal PCIe (low bus numbers) */
+   if (bus < GIC_V3_ITS_QUIRK_THUNDERX_PEM_BUS_OFFSET) {
return ((pci_get_domain(pci_dev) << PCI_RID_DOMAIN_SHIFT) |
bsf);
/* PEM otherwise */
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r289947 - head/sys/dev/etherswitch/e6000sw

2015-10-25 Thread Zbigniew Bodek
Author: zbb
Date: Sun Oct 25 22:14:04 2015
New Revision: 289947
URL: https://svnweb.freebsd.org/changeset/base/289947

Log:
  Introduce e6000sw etherswitch support
  
  Add e6000sw driver supporting Marvell 88E6352, 88E6172, 88E6176 switches.
  It needs to be attached to mdio interface, exporting SMI access
  functionality. e6000sw supports port-based VLAN configuration, per-port
  media changing, accessing PHY and switch registers.
  
  e6000sw attaches miibuses and PHY drivers as children. Instead of typical
  tick as callout, kthread-based tick is used. This combined with SX locks
  allows MDIO read/write calls to sleep. It is expected, because this
  hardware requires long delays in SMI read/write procedures, which can not
  be handled by busy-waiting.
  
  Reviewed by:adrian
  Obtained from:  Semihalf
  Submitted by:   Bartosz Szczepanek 
  Differential revision: https://reviews.freebsd.org/D3902

Added:
  head/sys/dev/etherswitch/e6000sw/
  head/sys/dev/etherswitch/e6000sw/e6000sw.c   (contents, props changed)
  head/sys/dev/etherswitch/e6000sw/e6000swreg.h   (contents, props changed)

Added: head/sys/dev/etherswitch/e6000sw/e6000sw.c
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/dev/etherswitch/e6000sw/e6000sw.c  Sun Oct 25 22:14:04 2015
(r289947)
@@ -0,0 +1,976 @@
+/*-
+ * Copyright (c) 2015 Semihalf
+ * Copyright (c) 2015 Stormshield
+ * 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.
+ */
+
+#include 
+__FBSDID("$FreeBSD$");
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+
+#include 
+#include 
+
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "e6000swreg.h"
+#include "etherswitch_if.h"
+#include "miibus_if.h"
+#include "mdio_if.h"
+
+MALLOC_DECLARE(M_E6000SW);
+MALLOC_DEFINE(M_E6000SW, "e6000sw", "e6000sw switch");
+
+#define E6000SW_LOCK(_sc)  \
+   sx_xlock(&(_sc)->sx)
+#define E6000SW_UNLOCK(_sc)\
+   sx_unlock(&(_sc)->sx)
+#define E6000SW_LOCK_ASSERT(_sc, _what)\
+   sx_assert(&(_sc)->sx, (_what))
+#define E6000SW_TRYLOCK(_sc)   \
+   sx_tryxlock(&(_sc)->sx)
+
+typedef struct e6000sw_softc {
+   device_tdev;
+
+   struct sx   sx;
+   struct ifnet*ifp[E6000SW_NUM_PHYS];
+   char*ifname[E6000SW_NUM_PHYS];
+   device_tmiibus[E6000SW_NUM_PHYS];
+   struct mii_data *mii[E6000SW_NUM_PHYS];
+   struct callout  tick_callout;
+
+   uint32_tcpuports_mask;
+
+   int vid[E6000SW_NUM_VGROUPS];
+   int members[E6000SW_NUM_VGROUPS];
+   int vgroup[E6000SW_NUM_PORTS];
+} e6000sw_softc_t;
+
+static etherswitch_info_t etherswitch_info = {
+   .es_nports =E6000SW_NUM_PORTS,
+   .es_nvlangroups =   E6000SW_NUM_VGROUPS,
+   .es_name =  "Marvell 6000 series switch"
+};
+
+static void e6000sw_identify(driver_t *driver, device_t parent);
+static int e6000sw_probe(device_t dev);
+static int e6000sw_attach(device_t dev);
+static int e6000sw_detach(device_t dev);
+static int e6000sw_readphy(device_t dev, int phy, int reg);
+static int e6000sw_writephy(device_t dev, int phy, int reg, int data);
+static etherswitch_info_t* e6000sw_getinfo(device_t dev);
+static void e6000sw_lock(device_t 

svn commit: r289982 - head/sys/dev/ioat

2015-10-25 Thread Conrad E. Meyer
Author: cem
Date: Mon Oct 26 03:30:38 2015
New Revision: 289982
URL: https://svnweb.freebsd.org/changeset/base/289982

Log:
  ioat: Allocate memory for ring resize sanely
  
  Add a new flag for DMA operations, DMA_NO_WAIT.  It behaves much like
  other NOWAIT flags -- if queueing an operation would sleep, abort and
  return NULL instead.
  
  When growing the internal descriptor ring, the memory allocation is
  performed outside of all locks.  A lock-protected flag is used to avoid
  duplicated work.  Threads that cannot sleep and attempt to queue
  operations when the descriptor ring is full allocate a larger ring with
  M_NOWAIT, or bail if that fails.
  
  ioat_reserve_space() could become an external API if is important to
  callers that they have room for a sequence of operations, or that those
  operations succeed each other directly in the hardware ring.
  
  This patch splits the internal head index (->head) from the hardware's
  head-of-chain (DMACOUNT) register (->hw_head).  In the future, for
  simplicity's sake, we could drop the 'ring' array entirely and just use
  a linked list (with head and tail pointers rather than indices).
  
  Suggested by: Witness
  Sponsored by: EMC / Isilon Storage Division

Modified:
  head/sys/dev/ioat/ioat.c
  head/sys/dev/ioat/ioat.h
  head/sys/dev/ioat/ioat_internal.h

Modified: head/sys/dev/ioat/ioat.c
==
--- head/sys/dev/ioat/ioat.cMon Oct 26 03:15:06 2015(r289981)
+++ head/sys/dev/ioat/ioat.cMon Oct 26 03:30:38 2015(r289982)
@@ -68,13 +68,21 @@ static boolean_t ioat_model_resets_msix(
 static void ioat_process_events(struct ioat_softc *ioat);
 static inline uint32_t ioat_get_active(struct ioat_softc *ioat);
 static inline uint32_t ioat_get_ring_space(struct ioat_softc *ioat);
+static void ioat_free_ring(struct ioat_softc *, uint32_t size,
+struct ioat_descriptor **);
 static void ioat_free_ring_entry(struct ioat_softc *ioat,
 struct ioat_descriptor *desc);
-static struct ioat_descriptor *ioat_alloc_ring_entry(struct ioat_softc *ioat);
-static int ioat_reserve_space_and_lock(struct ioat_softc *ioat, int num_descs);
+static struct ioat_descriptor *ioat_alloc_ring_entry(struct ioat_softc *,
+int mflags);
+static int ioat_reserve_space(struct ioat_softc *, uint32_t, int mflags);
 static struct ioat_descriptor *ioat_get_ring_entry(struct ioat_softc *ioat,
 uint32_t index);
-static boolean_t resize_ring(struct ioat_softc *ioat, int order);
+static struct ioat_descriptor **ioat_prealloc_ring(struct ioat_softc *,
+uint32_t size, boolean_t need_dscr, int mflags);
+static int ring_grow(struct ioat_softc *, uint32_t oldorder,
+struct ioat_descriptor **);
+static int ring_shrink(struct ioat_softc *, uint32_t oldorder,
+struct ioat_descriptor **);
 static void ioat_timer_callback(void *arg);
 static void dump_descriptor(void *hw_desc);
 static void ioat_submit_single(struct ioat_softc *ioat);
@@ -276,7 +284,6 @@ static int
 ioat_detach(device_t device)
 {
struct ioat_softc *ioat;
-   uint32_t i;
 
ioat = DEVICE2SOFTC(device);
 
@@ -292,11 +299,8 @@ ioat_detach(device_t device)
bus_release_resource(device, SYS_RES_MEMORY,
ioat->pci_resource_id, ioat->pci_resource);
 
-   if (ioat->ring != NULL) {
-   for (i = 0; i < (1 << ioat->ring_size_order); i++)
-   ioat_free_ring_entry(ioat, ioat->ring[i]);
-   free(ioat->ring, M_IOAT);
-   }
+   if (ioat->ring != NULL)
+   ioat_free_ring(ioat, 1 << ioat->ring_size_order, ioat->ring);
 
if (ioat->comp_update != NULL) {
bus_dmamap_unload(ioat->comp_update_tag, ioat->comp_update_map);
@@ -409,13 +413,13 @@ ioat3_attach(device_t device)
>hw_desc_tag);
 
ioat->ring = malloc(num_descriptors * sizeof(*ring), M_IOAT,
-   M_ZERO | M_NOWAIT);
+   M_ZERO | M_WAITOK);
if (ioat->ring == NULL)
return (ENOMEM);
 
ring = ioat->ring;
for (i = 0; i < num_descriptors; i++) {
-   ring[i] = ioat_alloc_ring_entry(ioat);
+   ring[i] = ioat_alloc_ring_entry(ioat, M_WAITOK);
if (ring[i] == NULL)
return (ENOMEM);
 
@@ -431,7 +435,7 @@ ioat3_attach(device_t device)
 
ring[i]->u.dma->next = ring[0]->hw_desc_bus_addr;
 
-   ioat->head = 0;
+   ioat->head = ioat->hw_head = 0;
ioat->tail = 0;
ioat->last_seen = 0;
return (0);
@@ -598,6 +602,7 @@ out:
mtx_unlock(>cleanup_lock);
 
ioat_putn(ioat, completed, IOAT_ACTIVE_DESCR_REF);
+   wakeup(>tail);
 }
 
 /*
@@ -638,7 +643,7 @@ ioat_release(bus_dmaengine_t dmaengine)
 
ioat = to_ioat_softc(dmaengine);
CTR0(KTR_IOAT, __func__);
-   ioat_write_2(ioat, IOAT_DMACOUNT_OFFSET, (uint16_t)ioat->head);
+   ioat_write_2(ioat, 

svn commit: r289983 - head/sys/dev/ioat

2015-10-25 Thread Conrad E. Meyer
Author: cem
Date: Mon Oct 26 03:30:50 2015
New Revision: 289983
URL: https://svnweb.freebsd.org/changeset/base/289983

Log:
  ioat: Add %b format string for CHANERR codes
  
  Sponsored by: EMC / Isilon Storage Division

Modified:
  head/sys/dev/ioat/ioat.c
  head/sys/dev/ioat/ioat_hw.h

Modified: head/sys/dev/ioat/ioat.c
==
--- head/sys/dev/ioat/ioat.cMon Oct 26 03:30:38 2015(r289982)
+++ head/sys/dev/ioat/ioat.cMon Oct 26 03:30:50 2015(r289983)
@@ -349,7 +349,8 @@ ioat_start_channel(struct ioat_softc *io
 
chanerr = ioat_read_4(ioat, IOAT_CHANERR_OFFSET);
ioat_log_message(0, "could not start channel: "
-   "status = %#jx error = %x\n", (uintmax_t)status, chanerr);
+   "status = %#jx error = %b\n", (uintmax_t)status, (int)chanerr,
+   IOAT_CHANERR_STR);
return (ENXIO);
 }
 
@@ -1105,7 +1106,8 @@ ioat_halted_debug(struct ioat_softc *ioa
 {
struct ioat_descriptor *desc;
 
-   ioat_log_message(0, "Channel halted (%x)\n", chanerr);
+   ioat_log_message(0, "Channel halted (%b)\n", (int)chanerr,
+   IOAT_CHANERR_STR);
if (chanerr == 0)
return;
 

Modified: head/sys/dev/ioat/ioat_hw.h
==
--- head/sys/dev/ioat/ioat_hw.h Mon Oct 26 03:30:38 2015(r289982)
+++ head/sys/dev/ioat/ioat_hw.h Mon Oct 26 03:30:50 2015(r289983)
@@ -126,6 +126,13 @@ __FBSDID("$FreeBSD$");
 #defineIOAT_CHANERR_RATVERR(1 << 26)
 #defineIOAT_CHANERR_RRTVERR(1 << 27)
 
+#defineIOAT_CHANERR_STR \
+"\20\34RRTVERR\33RATVERR\32RGTVERR\31RDIFFERR\30BBERR\27RTVERR\26ATVERR" \
+"\25GTVERR\24DIFFERR\23DCNTERR\21CXPERR\20UNAFFERR\17SEDERR\16INTCFGERR" \
+"\15CMPADDERR\14DXSERR\13DCERR\12WDERR\11RDERR\10DUNCORERR\07CUNCORERR" \
+"\06CCMDERR\05CHADDERR\04DERR\03NDADDERR\02XDADDERR\01XSADDERR"
+
+
 #defineIOAT_CFG_CHANERR_INT_OFFSET 0x180
 #defineIOAT_CFG_CHANERRMASK_INT_OFFSET 0x184
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r289934 - head/sys/dev/drm2/i915

2015-10-25 Thread Jean-Sébastien Pédron
Author: dumbbell
Date: Sun Oct 25 14:42:56 2015
New Revision: 289934
URL: https://svnweb.freebsd.org/changeset/base/289934

Log:
  drm/i915: Reduce diff with Linux 3.8
  
  There is no functional change. The goal is to ease the future update to
  Linux 3.8's i915 driver.
  
  MFC after:2 months

Modified:
  head/sys/dev/drm2/i915/i915_irq.c
  head/sys/dev/drm2/i915/intel_display.c

Modified: head/sys/dev/drm2/i915/i915_irq.c
==
--- head/sys/dev/drm2/i915/i915_irq.c   Sun Oct 25 14:34:07 2015
(r289933)
+++ head/sys/dev/drm2/i915/i915_irq.c   Sun Oct 25 14:42:56 2015
(r289934)
@@ -132,8 +132,7 @@ i915_pipe_enabled(struct drm_device *dev
 /* Called from drm generic code, passed a 'crtc', which
  * we use as a pipe index
  */
-static u32
-i915_get_vblank_counter(struct drm_device *dev, int pipe)
+static u32 i915_get_vblank_counter(struct drm_device *dev, int pipe)
 {
drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private;
unsigned long high_frame;
@@ -141,7 +140,7 @@ i915_get_vblank_counter(struct drm_devic
u32 high1, high2, low;
 
if (!i915_pipe_enabled(dev, pipe)) {
-   DRM_DEBUG("trying to get vblank count for disabled "
+   DRM_DEBUG_DRIVER("trying to get vblank count for disabled "
"pipe %c\n", pipe_name(pipe));
return 0;
}
@@ -165,14 +164,13 @@ i915_get_vblank_counter(struct drm_devic
return (high1 << 8) | low;
 }
 
-static u32
-gm45_get_vblank_counter(struct drm_device *dev, int pipe)
+static u32 gm45_get_vblank_counter(struct drm_device *dev, int pipe)
 {
drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private;
int reg = PIPE_FRMCOUNT_GM45(pipe);
 
if (!i915_pipe_enabled(dev, pipe)) {
-   DRM_DEBUG("i915: trying to get vblank count for disabled "
+   DRM_DEBUG_DRIVER("trying to get vblank count for disabled "
 "pipe %c\n", pipe_name(pipe));
return 0;
}
@@ -180,9 +178,8 @@ gm45_get_vblank_counter(struct drm_devic
return I915_READ(reg);
 }
 
-static int
-i915_get_crtc_scanoutpos(struct drm_device *dev, int pipe,
-int *vpos, int *hpos)
+static int i915_get_crtc_scanoutpos(struct drm_device *dev, int pipe,
+int *vpos, int *hpos)
 {
drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private;
u32 vbl = 0, position = 0;
@@ -191,7 +188,7 @@ i915_get_crtc_scanoutpos(struct drm_devi
int ret = 0;
 
if (!i915_pipe_enabled(dev, pipe)) {
-   DRM_DEBUG("i915: trying to get scanoutpos for disabled "
+   DRM_DEBUG_DRIVER("trying to get scanoutpos for disabled "
 "pipe %c\n", pipe_name(pipe));
return 0;
}
@@ -247,9 +244,10 @@ i915_get_crtc_scanoutpos(struct drm_devi
return ret;
 }
 
-static int
-i915_get_vblank_timestamp(struct drm_device *dev, int pipe, int *max_error,
-struct timeval *vblank_time, unsigned flags)
+static int i915_get_vblank_timestamp(struct drm_device *dev, int pipe,
+ int *max_error,
+ struct timeval *vblank_time,
+ unsigned flags)
 {
struct drm_i915_private *dev_priv = dev->dev_private;
struct drm_crtc *crtc;
@@ -268,7 +266,7 @@ i915_get_vblank_timestamp(struct drm_dev
 
if (!crtc->enabled) {
 #if 0
-   DRM_DEBUG("crtc %d is disabled\n", pipe);
+   DRM_DEBUG_KMS("crtc %d is disabled\n", pipe);
 #endif
return -EBUSY;
}
@@ -282,19 +280,14 @@ i915_get_vblank_timestamp(struct drm_dev
 /*
  * Handle hotplug events outside the interrupt handler proper.
  */
-static void
-i915_hotplug_work_func(void *context, int pending)
+static void i915_hotplug_work_func(void *context, int pending)
 {
drm_i915_private_t *dev_priv = context;
struct drm_device *dev = dev_priv->dev;
-   struct drm_mode_config *mode_config;
+   struct drm_mode_config *mode_config = >mode_config;
struct intel_encoder *encoder;
 
DRM_DEBUG("running encoder hotplug functions\n");
-   dev_priv = context;
-   dev = dev_priv->dev;
-
-   mode_config = >mode_config;
 
sx_xlock(_config->mutex);
DRM_DEBUG_KMS("running encoder hotplug functions\n");
@@ -350,29 +343,25 @@ static void notify_ring(struct drm_devic
if (ring->obj == NULL)
return;
 
-   CTR2(KTR_DRM, "request_complete %s %d", ring->name,
-   ring->get_seqno(ring));
+   CTR2(KTR_DRM, "request_complete %s %d", ring->name, 
ring->get_seqno(ring));
 
mtx_lock(_priv->irq_lock);
wakeup(ring);
mtx_unlock(_priv->irq_lock);
-
if (i915_enable_hangcheck) {

svn commit: r289935 - in head/usr.bin: . dtc

2015-10-25 Thread David Chisnall
Author: theraven
Date: Sun Oct 25 14:52:16 2015
New Revision: 289935
URL: https://svnweb.freebsd.org/changeset/base/289935

Log:
  Lots of improvements to the BSD-licensed dtc
  
  - Various fixes to includes (including recursive includes)
  - Lots of testing that the output exactly matches GPL'd dtc
  - Lots of bug fixes to merging
  - Fix incorrect mmap usage
  - Ad-hoc memory management replaced with C++11 unique_ptr and similar
  
  Patrick Wildt has successfully run many (all?) of the GPL dtc test suite.

Modified:
  head/usr.bin/Makefile
  head/usr.bin/dtc/checking.cc
  head/usr.bin/dtc/checking.hh
  head/usr.bin/dtc/dtb.cc
  head/usr.bin/dtc/dtc.cc
  head/usr.bin/dtc/fdt.cc
  head/usr.bin/dtc/fdt.hh
  head/usr.bin/dtc/input_buffer.cc
  head/usr.bin/dtc/input_buffer.hh
  head/usr.bin/dtc/string.hh

Modified: head/usr.bin/Makefile
==
--- head/usr.bin/Makefile   Sun Oct 25 14:42:56 2015(r289934)
+++ head/usr.bin/Makefile   Sun Oct 25 14:52:16 2015(r289935)
@@ -210,8 +210,10 @@ SUBDIR.${MK_GAMES}+=   pom
 SUBDIR.${MK_GAMES}+=   primes
 SUBDIR.${MK_GAMES}+=   random
 .if ${MK_GPL_DTC} != "yes"
+.if ${COMPILER_FEATURES:Mc++11}
 SUBDIR+=   dtc
 .endif
+.endif
 SUBDIR.${MK_GROFF}+=   vgrind
 SUBDIR.${MK_HESIOD}+=  hesinfo
 SUBDIR.${MK_ICONV}+=   iconv

Modified: head/usr.bin/dtc/checking.cc
==
--- head/usr.bin/dtc/checking.ccSun Oct 25 14:42:56 2015
(r289934)
+++ head/usr.bin/dtc/checking.ccSun Oct 25 14:52:16 2015
(r289935)
@@ -51,7 +51,7 @@ namespace
struct address_cells_checker : public checker
{
address_cells_checker(const char *name) : checker(name) {}
-   virtual bool check_node(device_tree *tree, node *n)
+   virtual bool check_node(device_tree *tree, const node_ptr )
{
// If this has no children, it trivially meets the
// conditions.
@@ -61,8 +61,7 @@ namespace
}
bool found_address = false;
bool found_size = false;
-   for (node::property_iterator i=n->property_begin(),
-e=n->property_end() ; i!=e ; ++i)
+   for (auto i=n->property_begin(), e=n->property_end() ; 
i!=e ; ++i)
{
if (!found_address)
{
@@ -91,7 +90,7 @@ namespace
 } // anonymous namespace
 
 bool
-checker::visit_node(device_tree *tree, node *n)
+checker::visit_node(device_tree *tree, const node_ptr )
 {
path.push_back(std::make_pair(n->name, n->unit_address));
// Check this node
@@ -100,8 +99,7 @@ checker::visit_node(device_tree *tree, n
return false;
}
// Now check its properties
-   for (node::property_iterator i=n->property_begin(), e=n->property_end()
-; i!=e ; ++i)
+   for (auto i=n->property_begin(), e=n->property_end() ; i!=e ; ++i)
{
if (!check_property(tree, n, *i))
{
@@ -125,22 +123,21 @@ void
 checker::report_error(const char *errmsg)
 {
fprintf(stderr, "Error: %s, while checking node: ", errmsg);
-   for (device_tree::node_path::iterator p=path.begin()+1, pe=path.end() ;
-p!=pe ; ++p)
+   for (auto  : path)
{
putc('/', stderr);
-   p->first.dump();
-   if (!(p->second.empty()))
+   p.first.dump();
+   if (!(p.second.empty()))
{
putc('@', stderr);
-   p->second.dump();
+   p.second.dump();
}
}
fprintf(stderr, " [-W%s]\n", checker_name);
 }
 
 bool
-property_checker::check_property(device_tree *tree, node *n, property *p)
+property_checker::check_property(device_tree *tree, const node_ptr , 
property_ptr p)
 {
if (p->get_key() == key)
{
@@ -154,7 +151,7 @@ property_checker::check_property(device_
 }
 
 bool
-property_size_checker::check(device_tree *tree, node *n, property *p)
+property_size_checker::check(device_tree *tree, const node_ptr , 
property_ptr p)
 {
uint32_t psize = 0;
for (property::value_iterator i=p->begin(),e=p->end() ; i!=e ; ++i)
@@ -216,10 +213,9 @@ bool
 check_manager::run_checks(device_tree *tree, bool keep_going)
 {
bool success = true;
-   for (std::map::iterator i=checkers.begin(),
-e=checkers.end() ; i!=e ; ++i)
+   for (auto  : checkers)
{
-   success &= i->second->check_tree(tree);
+   success &= i.second->check_tree(tree);
if (!(success || keep_going))
{
break;
@@ 

svn commit: r289936 - head/sys/dev/drm2/i915

2015-10-25 Thread Jean-Sébastien Pédron
Author: dumbbell
Date: Sun Oct 25 14:57:53 2015
New Revision: 289936
URL: https://svnweb.freebsd.org/changeset/base/289936

Log:
  drm/i915: Reduce diff with Linux 3.8
  
  There is no functional change. The goal is to ease the future update to
  Linux 3.8's i915 driver.
  
  MFC after:2 month

Modified:
  head/sys/dev/drm2/i915/intel_crt.c

Modified: head/sys/dev/drm2/i915/intel_crt.c
==
--- head/sys/dev/drm2/i915/intel_crt.c  Sun Oct 25 14:52:16 2015
(r289935)
+++ head/sys/dev/drm2/i915/intel_crt.c  Sun Oct 25 14:57:53 2015
(r289936)
@@ -498,16 +498,16 @@ static int intel_crt_get_modes(struct dr
struct drm_device *dev = connector->dev;
struct drm_i915_private *dev_priv = dev->dev_private;
int ret;
-   device_t iic;
+   device_t i2c;
 
-   iic = intel_gmbus_get_adapter(dev_priv, dev_priv->crt_ddc_pin);
-   ret = intel_ddc_get_modes(connector, iic);
+   i2c = intel_gmbus_get_adapter(dev_priv, dev_priv->crt_ddc_pin);
+   ret = intel_ddc_get_modes(connector, i2c);
if (ret || !IS_G4X(dev))
return ret;
 
/* Try to probe digital port for output in DVI-I -> VGA mode. */
-   iic = intel_gmbus_get_adapter(dev_priv, GMBUS_PORT_DPB);
-   return intel_ddc_get_modes(connector, iic);
+   i2c = intel_gmbus_get_adapter(dev_priv, GMBUS_PORT_DPB);
+   return intel_ddc_get_modes(connector, i2c);
 }
 
 static int intel_crt_set_property(struct drm_connector *connector,
@@ -522,8 +522,9 @@ static void intel_crt_reset(struct drm_c
struct drm_device *dev = connector->dev;
struct intel_crt *crt = intel_attached_crt(connector);
 
-   if (HAS_PCH_SPLIT(dev))
+   if (HAS_PCH_SPLIT(dev)) {
crt->force_hotplug_required = 1;
+   }
 }
 
 /*
@@ -596,6 +597,7 @@ void intel_crt_init(struct drm_device *d
return;
 
crt = malloc(sizeof(struct intel_crt), DRM_MEM_KMS, M_WAITOK | M_ZERO);
+
intel_connector = malloc(sizeof(struct intel_connector), DRM_MEM_KMS,
M_WAITOK | M_ZERO);
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r289937 - head/sys/dev/isp

2015-10-25 Thread Alexander Motin
Author: mav
Date: Sun Oct 25 16:04:31 2015
New Revision: 289937
URL: https://svnweb.freebsd.org/changeset/base/289937

Log:
  Try to keep Loop IDs persistent across chip reinits.

Modified:
  head/sys/dev/isp/isp.c
  head/sys/dev/isp/ispmbox.h

Modified: head/sys/dev/isp/isp.c
==
--- head/sys/dev/isp/isp.c  Sun Oct 25 14:57:53 2015(r289936)
+++ head/sys/dev/isp/isp.c  Sun Oct 25 16:04:31 2015(r289937)
@@ -1669,7 +1669,6 @@ isp_fibre_init(ispsoftc_t *isp)
fcparam *fcp;
isp_icb_t local, *icbp = 
mbreg_t mbs;
-   int ownloopid;
 
/*
 * We only support one channel on non-24XX cards
@@ -1743,19 +1742,12 @@ isp_fibre_init(ispsoftc_t *isp)
}
icbp->icb_retry_delay = fcp->isp_retry_delay;
icbp->icb_retry_count = fcp->isp_retry_count;
-   icbp->icb_hardaddr = fcp->isp_loopid;
-   ownloopid = (isp->isp_confopts & ISP_CFG_OWNLOOPID) != 0;
-   if (icbp->icb_hardaddr >= LOCAL_LOOP_LIM) {
-   icbp->icb_hardaddr = 0;
-   ownloopid = 0;
-   }
-
-   /*
-* Our life seems so much better with 2200s and later with
-* the latest f/w if we set Hard Address.
-*/
-   if (ownloopid || ISP_FW_NEWER_THAN(isp, 2, 2, 5)) {
-   icbp->icb_fwoptions |= ICBOPT_HARD_ADDRESS;
+   if (fcp->isp_loopid < LOCAL_LOOP_LIM) {
+   icbp->icb_hardaddr = fcp->isp_loopid;
+   if (isp->isp_confopts & ISP_CFG_OWNLOOPID)
+   icbp->icb_fwoptions |= ICBOPT_HARD_ADDRESS;
+   else
+   icbp->icb_fwoptions |= ICBOPT_PREV_ADDRESS;
}
 
/*
@@ -1989,7 +1981,6 @@ isp_fibre_init_2400(ispsoftc_t *isp)
isp_icb_2400_t local, *icbp = 
mbreg_t mbs;
int chan;
-   int ownloopid = 0;
 
/*
 * Check to see whether all channels have *some* kind of role
@@ -2024,16 +2015,20 @@ isp_fibre_init_2400(ispsoftc_t *isp)
 
ISP_MEMZERO(icbp, sizeof (*icbp));
icbp->icb_fwoptions1 = fcp->isp_fwoptions;
-   if (fcp->role & ISP_ROLE_TARGET) {
-   icbp->icb_fwoptions1 |= ICB2400_OPT1_TGT_ENABLE;
-   } else {
-   icbp->icb_fwoptions1 &= ~ICB2400_OPT1_TGT_ENABLE;
-   }
-
-   if (fcp->role & ISP_ROLE_INITIATOR) {
+   icbp->icb_fwoptions2 = fcp->isp_xfwoptions;
+   icbp->icb_fwoptions3 = fcp->isp_zfwoptions;
+   if (isp->isp_nchan > 1 && (isp->isp_fwattr & ISP2400_FW_ATTR_VP0)) {
icbp->icb_fwoptions1 &= ~ICB2400_OPT1_INI_DISABLE;
+   icbp->icb_fwoptions1 |= ICB2400_OPT1_TGT_ENABLE;
} else {
-   icbp->icb_fwoptions1 |= ICB2400_OPT1_INI_DISABLE;
+   if (fcp->role & ISP_ROLE_TARGET)
+   icbp->icb_fwoptions1 |= ICB2400_OPT1_TGT_ENABLE;
+   else
+   icbp->icb_fwoptions1 &= ~ICB2400_OPT1_TGT_ENABLE;
+   if (fcp->role & ISP_ROLE_INITIATOR)
+   icbp->icb_fwoptions1 &= ~ICB2400_OPT1_INI_DISABLE;
+   else
+   icbp->icb_fwoptions1 |= ICB2400_OPT1_INI_DISABLE;
}
 
icbp->icb_version = ICB_VERSION1;
@@ -2058,18 +2053,14 @@ isp_fibre_init_2400(ispsoftc_t *isp)
icbp->icb_xchgcnt >>= 1;
}
 
-
-   ownloopid = (isp->isp_confopts & ISP_CFG_OWNLOOPID) != 0;
-   icbp->icb_hardaddr = fcp->isp_loopid;
-   if (icbp->icb_hardaddr >= LOCAL_LOOP_LIM) {
-   icbp->icb_hardaddr = 0;
-   ownloopid = 0;
+   if (fcp->isp_loopid < LOCAL_LOOP_LIM) {
+   icbp->icb_hardaddr = fcp->isp_loopid;
+   if (isp->isp_confopts & ISP_CFG_OWNLOOPID)
+   icbp->icb_fwoptions1 |= ICB2400_OPT1_HARD_ADDRESS;
+   else
+   icbp->icb_fwoptions1 |= ICB2400_OPT1_PREV_ADDRESS;
}
 
-   if (ownloopid)
-   icbp->icb_fwoptions1 |= ICB2400_OPT1_HARD_ADDRESS;
-
-   icbp->icb_fwoptions2 = fcp->isp_xfwoptions;
if (isp->isp_confopts & ISP_CFG_NOFCTAPE) {
icbp->icb_fwoptions2 &= ~ICB2400_OPT2_FCTAPE;
}
@@ -2113,7 +2104,6 @@ isp_fibre_init_2400(ispsoftc_t *isp)
break;
}
 
-   icbp->icb_fwoptions3 = fcp->isp_zfwoptions;
if ((icbp->icb_fwoptions3 & ICB2400_OPT3_RSPSZ_MASK) == 0) {
icbp->icb_fwoptions3 |= ICB2400_OPT3_RSPSZ_24;
}
@@ -2129,9 +2119,6 @@ isp_fibre_init_2400(ispsoftc_t *isp)
} else {
icbp->icb_fwoptions3 |= ICB2400_OPT3_RATE_AUTO;
}
-   if (ownloopid == 0) {
-   icbp->icb_fwoptions3 |= ICB2400_OPT3_SOFTID;
-   }
icbp->icb_logintime = ICB_LOGIN_TOV;
 
if (fcp->isp_wwnn && fcp->isp_wwpn) {
@@ -2238,6 +2225,13 @@ isp_fibre_init_2400(ispsoftc_t *isp)
if 

Re: svn commit: r289932 - head/sys/net

2015-10-25 Thread Kristof Provost

> On 25 Oct 2015, at 17:48, Ian Lepore  wrote:
> 
> On Sun, 2015-10-25 at 13:14 +, Kristof Provost wrote:
>> Author: kp
>> Date: Sun Oct 25 13:14:53 2015
>> New Revision: 289932
>> URL: https://svnweb.freebsd.org/changeset/base/289932
>> 
>> Log:
>>  PF_ANEQ() macro will in most situations returns TRUE comparing two
>> identical
> 
> It looks like this change is causing warnings when compiled with gcc:
> 
> cc1: warnings being treated as errors
> /local/build/staging/freebsd/dpcur/src/sys/netpfil/pf/if_pfsync.c: In 
> function 'pfsync_state_import':
> /local/build/staging/freebsd/dpcur/src/sys/netpfil/pf/if_pfsync.c:467: 
> warning: suggest parentheses around && within || [-Wparentheses]
> /local/build/staging/freebsd/dpcur/src/sys/netpfil/pf/if_pfsync.c:468: 
> warning: suggest parentheses around && within || [-Wparentheses]
> --- if_pfsync.o ---
> *** [if_pfsync.o] Error code 1
> 
> (and many more just the same building other pf files).
Ouch, yes, it looks like I messed that up.

The fix is on its way.

Regards,
Kristof
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r289939 - head/sys/dev/isp

2015-10-25 Thread Alexander Motin
Author: mav
Date: Sun Oct 25 17:24:37 2015
New Revision: 289939
URL: https://svnweb.freebsd.org/changeset/base/289939

Log:
  Rework r289933 using already existing macro.

Modified:
  head/sys/dev/isp/isp.c

Modified: head/sys/dev/isp/isp.c
==
--- head/sys/dev/isp/isp.c  Sun Oct 25 17:17:50 2015(r289938)
+++ head/sys/dev/isp/isp.c  Sun Oct 25 17:24:37 2015(r289939)
@@ -6073,11 +6073,10 @@ isp_parse_async_fc(ispsoftc_t *isp, uint
if (IS_24XX(isp)) {
nphdl = ISP_READ(isp, OUTMAILBOX1);
nlstate = ISP_READ(isp, OUTMAILBOX2);
-   reason = ISP_READ(isp, OUTMAILBOX3);
-   chan = reason & 0xff;
+   reason = ISP_READ(isp, OUTMAILBOX3) >> 8;
+   GET_24XX_BUS(isp, chan, "ASYNC_CHANGE_NOTIFY");
echan = (nphdl == NIL_HANDLE) ?
isp->isp_nchan - 1 : chan;
-   reason = reason >> 8;
} else {
nphdl = NIL_HANDLE;
nlstate = reason = 0;
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r289940 - head/sys/net

2015-10-25 Thread Kristof Provost
Author: kp
Date: Sun Oct 25 18:09:03 2015
New Revision: 289940
URL: https://svnweb.freebsd.org/changeset/base/289940

Log:
  pf: Fix compliation warning with gcc
  
  While fixing the PF_ANEQ() macro I messed up the parentheses, leading to
  compliation warnings with gcc.
  
  Spotted by: ian
  Pointy Hat: kp

Modified:
  head/sys/net/pfvar.h

Modified: head/sys/net/pfvar.h
==
--- head/sys/net/pfvar.hSun Oct 25 17:24:37 2015(r289939)
+++ head/sys/net/pfvar.hSun Oct 25 18:09:03 2015(r289940)
@@ -199,10 +199,10 @@ extern struct rwlock pf_rules_lock;
 
 #define PF_ANEQ(a, b, c) \
((c == AF_INET && (a)->addr32[0] != (b)->addr32[0]) || \
-   (c == AF_INET6 && (a)->addr32[3] != (b)->addr32[3] && \
+   (c == AF_INET6 && ((a)->addr32[0] != (b)->addr32[0] || \
(a)->addr32[1] != (b)->addr32[1] || \
(a)->addr32[2] != (b)->addr32[2] || \
-   (a)->addr32[3] != (b)->addr32[3])) \
+   (a)->addr32[3] != (b)->addr32[3]))) \
 
 #define PF_AZERO(a, c) \
((c == AF_INET && !(a)->addr32[0]) || \
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r289932 - head/sys/net

2015-10-25 Thread Ian Lepore
On Sun, 2015-10-25 at 13:14 +, Kristof Provost wrote:
> Author: kp
> Date: Sun Oct 25 13:14:53 2015
> New Revision: 289932
> URL: https://svnweb.freebsd.org/changeset/base/289932
> 
> Log:
>   PF_ANEQ() macro will in most situations returns TRUE comparing two
> identical
>   IPv4 packets (when it should return FALSE). It happens because
> PF_ANEQ() doesn't
>   stop if first 32 bits of IPv4 packets are equal and starts to check
> next 3*32
>   bits (like for IPv6 packet). Those bits containt some garbage and
> in result
>   PF_ANEQ() wrongly returns TRUE.
>   
>   Fix: Check if packet is of AF_INET type and if it is then compare
> only first 32
>   bits of data.
>   
>   PR: 204005
>   Submitted by:   Miłosz Kaniewski
> 
> Modified:
>   head/sys/net/pfvar.h
> 
> Modified: head/sys/net/pfvar.h
> =
> =
> --- head/sys/net/pfvar.h  Sun Oct 25 12:09:28 2015(r289
> 931)
> +++ head/sys/net/pfvar.h  Sun Oct 25 13:14:53 2015(r289
> 932)
> @@ -198,10 +198,11 @@ extern struct rwlock pf_rules_lock;
>   (a)->addr32[0] == (b)->addr32[0])) \
>  
>  #define PF_ANEQ(a, b, c) \
> - ((a)->addr32[0] != (b)->addr32[0] || \
> + ((c == AF_INET && (a)->addr32[0] != (b)->addr32[0]) || \
> + (c == AF_INET6 && (a)->addr32[3] != (b)->addr32[3] && \
>   (a)->addr32[1] != (b)->addr32[1] || \
>   (a)->addr32[2] != (b)->addr32[2] || \
> - (a)->addr32[3] != (b)->addr32[3]) \
> + (a)->addr32[3] != (b)->addr32[3])) \
>  
>  #define PF_AZERO(a, c) \
>   ((c == AF_INET && !(a)->addr32[0]) || \
> 

It looks like this change is causing warnings when compiled with gcc:

cc1: warnings being treated as errors
/local/build/staging/freebsd/dpcur/src/sys/netpfil/pf/if_pfsync.c: In function 
'pfsync_state_import':
/local/build/staging/freebsd/dpcur/src/sys/netpfil/pf/if_pfsync.c:467: warning: 
suggest parentheses around && within || [-Wparentheses]
/local/build/staging/freebsd/dpcur/src/sys/netpfil/pf/if_pfsync.c:468: warning: 
suggest parentheses around && within || [-Wparentheses]
--- if_pfsync.o ---
*** [if_pfsync.o] Error code 1

(and many more just the same building other pf files).

-- Ian

___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r289933 - head/sys/dev/isp

2015-10-25 Thread Alexander Motin
Author: mav
Date: Sun Oct 25 14:34:07 2015
New Revision: 289933
URL: https://svnweb.freebsd.org/changeset/base/289933

Log:
  Improve Port Database Changed handling and reporting.

Modified:
  head/sys/dev/isp/isp.c
  head/sys/dev/isp/isp_freebsd.c

Modified: head/sys/dev/isp/isp.c
==
--- head/sys/dev/isp/isp.c  Sun Oct 25 13:14:53 2015(r289932)
+++ head/sys/dev/isp/isp.c  Sun Oct 25 14:34:07 2015(r289933)
@@ -6074,21 +6074,22 @@ isp_parse_async_fc(ispsoftc_t *isp, uint
 
case ASYNC_PDB_CHANGED:
{
-   int nphdl, nlstate, reason;
-   /*
-* We *should* get a channel out of the 24XX, but we don't seem
-* to get more than a PDB CHANGED on channel 0, so turn it into
-* a broadcast event.
-*/
+   int echan, nphdl, nlstate, reason;
+
if (IS_24XX(isp)) {
nphdl = ISP_READ(isp, OUTMAILBOX1);
nlstate = ISP_READ(isp, OUTMAILBOX2);
-   reason = ISP_READ(isp, OUTMAILBOX3) >> 8;
+   reason = ISP_READ(isp, OUTMAILBOX3);
+   chan = reason & 0xff;
+   echan = (nphdl == NIL_HANDLE) ?
+   isp->isp_nchan - 1 : chan;
+   reason = reason >> 8;
} else {
nphdl = NIL_HANDLE;
nlstate = reason = 0;
+   chan = echan = 0;
}
-   for (chan = 0; chan < isp->isp_nchan; chan++) {
+   for (; chan <= echan; chan++) {
fcparam *fcp = FCPARAM(isp, chan);
 
if (fcp->role == ISP_ROLE_NONE) {

Modified: head/sys/dev/isp/isp_freebsd.c
==
--- head/sys/dev/isp/isp_freebsd.c  Sun Oct 25 13:14:53 2015
(r289932)
+++ head/sys/dev/isp/isp_freebsd.c  Sun Oct 25 14:34:07 2015
(r289933)
@@ -382,14 +382,16 @@ isp_freeze_loopdown(ispsoftc_t *isp, int
if (IS_FC(isp)) {
struct isp_fc *fc = ISP_FC_PC(isp, chan);
if (fc->simqfrozen == 0) {
-   isp_prt(isp, ISP_LOGDEBUG0, "%s: freeze simq (loopdown) 
chan %d", msg, chan);
+   isp_prt(isp, ISP_LOGDEBUG0,
+   "Chan %d %s -- freeze simq (loopdown)", chan, msg);
fc->simqfrozen = SIMQFRZ_LOOPDOWN;
 #if __FreeBSD_version >= 139
xpt_hold_boot();
 #endif
xpt_freeze_simq(fc->sim, 1);
} else {
-   isp_prt(isp, ISP_LOGDEBUG0, "%s: mark frozen (loopdown) 
chan %d", msg, chan);
+   isp_prt(isp, ISP_LOGDEBUG0,
+   "Chan %d %s -- mark frozen (loopdown)", chan, msg);
fc->simqfrozen |= SIMQFRZ_LOOPDOWN;
}
}
@@ -4988,11 +4990,11 @@ changed:
fc = ISP_FC_PC(isp, bus);
 
if (evt == ISPASYNC_CHANGE_PDB) {
-   msg = "Chan %d Port Database Changed";
+   msg = "Port Database Changed";
} else if (evt == ISPASYNC_CHANGE_SNS) {
-   msg = "Chan %d Name Server Database Changed";
+   msg = "Name Server Database Changed";
} else {
-   msg = "Chan %d Other Change Notify";
+   msg = "Other Change Notify";
}
 
/*
@@ -5002,7 +5004,7 @@ changed:
isp_prt(isp, ISP_LOG_SANCFG|ISP_LOGDEBUG0, "Stopping 
Loop Down Timer @ %lu", (unsigned long) time_uptime);
callout_stop(>ldt);
}
-   isp_prt(isp, ISP_LOGINFO, msg, bus);
+   isp_prt(isp, ISP_LOGINFO, "Chan %d %s", bus, msg);
if (FCPARAM(isp, bus)->role & ISP_ROLE_INITIATOR) {
isp_freeze_loopdown(isp, bus, msg);
}
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r289941 - head/sys/kern

2015-10-25 Thread Pawel Jakub Dawidek
Author: pjd
Date: Sun Oct 25 18:48:09 2015
New Revision: 289941
URL: https://svnweb.freebsd.org/changeset/base/289941

Log:
  The aio_waitcomplete(2) syscall should not sleep when the given timeout
  is 0. Without this change it was sleeping for one tick. Maybe not a big
  deal, but it makes share/dtrace/blocking script to report that.
  
  Reviewed by:  jhb
  Differential Revision:https://reviews.freebsd.org/D3814
  Sponsored by: Wheel Systems, http://wheelsystems.com

Modified:
  head/sys/kern/vfs_aio.c

Modified: head/sys/kern/vfs_aio.c
==
--- head/sys/kern/vfs_aio.c Sun Oct 25 18:09:03 2015(r289940)
+++ head/sys/kern/vfs_aio.c Sun Oct 25 18:48:09 2015(r289941)
@@ -2494,8 +2494,11 @@ kern_aio_waitcomplete(struct thread *td,
 
ops->store_aiocb(aiocbp, NULL);
 
-   timo = 0;
-   if (ts) {
+   if (ts == NULL) {
+   timo = 0;
+   } else if (ts->tv_sec == 0 && ts->tv_nsec == 0) {
+   timo = -1;
+   } else {
if ((ts->tv_nsec < 0) || (ts->tv_nsec >= 10))
return (EINVAL);
 
@@ -2513,6 +2516,10 @@ kern_aio_waitcomplete(struct thread *td,
cb = NULL;
AIO_LOCK(ki);
while ((cb = TAILQ_FIRST(>kaio_done)) == NULL) {
+   if (timo == -1) {
+   error = EWOULDBLOCK;
+   break;
+   }
ki->kaio_flags |= KAIO_WAKEUP;
error = msleep(>p_aioinfo, AIO_MTX(ki), PRIBIO | PCATCH,
"aiowc", timo);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r287395 - head/sys/compat/linux

2015-10-25 Thread Chagin Dmitry
On Wed, Sep 02, 2015 at 02:04:14PM +, Edward Tomasz Napierala wrote:
> Author: trasz
> Date: Wed Sep  2 14:04:13 2015
> New Revision: 287395
> URL: https://svnweb.freebsd.org/changeset/base/287395
> 
> Log:
>   Fixes a panic triggered by threaded Linux applications when running
>   with RACCT/RCTL enabled.
Thank you, Edward!

-- 
Have fun!
chd
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r289942 - head/sys/dev/isp

2015-10-25 Thread Alexander Motin
Author: mav
Date: Sun Oct 25 19:55:48 2015
New Revision: 289942
URL: https://svnweb.freebsd.org/changeset/base/289942

Log:
  Deliver INOTs only to enabled virtual ports.

Modified:
  head/sys/dev/isp/isp_target.c

Modified: head/sys/dev/isp/isp_target.c
==
--- head/sys/dev/isp/isp_target.c   Sun Oct 25 18:48:09 2015
(r289941)
+++ head/sys/dev/isp/isp_target.c   Sun Oct 25 19:55:48 2015
(r289942)
@@ -1889,6 +1889,8 @@ isp_handle_24xx_inotify(ispsoftc_t *isp,
}
isp_prt(isp, ISP_LOGTDEBUG1, "%s: Immediate Notify Channels %d..%d 
status=0x%x seqid=0x%x", __func__, lochan, hichan-1, inot_24xx->in_status, 
inot_24xx->in_rxid);
for (chan = lochan; chan < hichan; chan++) {
+   if (FCPARAM(isp, chan)->role == ISP_ROLE_NONE)
+   continue;
switch (inot_24xx->in_status) {
case IN24XX_LIP_RESET:
case IN24XX_LINK_RESET:
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"