svn commit: r289119 - in projects/release-pkg: . bin/ls/tests etc etc/ppp lib/libc/sys libexec/dma libexec/dma/dma libexec/dma/dmagent sbin/geom/class/nop sbin/mdconfig share/man/man4 share/mk sys/...
Baptiste Daroussin
bapt at FreeBSD.org
Sat Oct 10 23:12:39 UTC 2015
Author: bapt
Date: Sat Oct 10 23:12:36 2015
New Revision: 289119
URL: https://svnweb.freebsd.org/changeset/base/289119
Log:
Merge from head
Added:
projects/release-pkg/libexec/dma/dmagent/
- copied from r289118, head/libexec/dma/dmagent/
projects/release-pkg/usr.sbin/ppp/ppp.conf
- copied unchanged from r289118, head/usr.sbin/ppp/ppp.conf
Deleted:
projects/release-pkg/etc/ppp/
projects/release-pkg/libexec/dma/dma/
Modified:
projects/release-pkg/Makefile.inc1
projects/release-pkg/bin/ls/tests/ls_tests.sh
projects/release-pkg/etc/Makefile
projects/release-pkg/lib/libc/sys/shmctl.2
projects/release-pkg/libexec/dma/Makefile
projects/release-pkg/sbin/geom/class/nop/gnop.8
projects/release-pkg/sbin/mdconfig/mdconfig.8
projects/release-pkg/sbin/mdconfig/mdconfig.c
projects/release-pkg/share/man/man4/vtnet.4
projects/release-pkg/share/mk/Makefile
projects/release-pkg/share/mk/bsd.confs.mk
projects/release-pkg/share/mk/bsd.own.mk
projects/release-pkg/sys/arm/freescale/imx/imx_i2c.c
projects/release-pkg/sys/arm/freescale/vybrid/vf_i2c.c
projects/release-pkg/sys/arm/samsung/exynos/exynos5_i2c.c
projects/release-pkg/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_attach.c
projects/release-pkg/sys/dev/ath/ath_hal/ar5416/ar5416_attach.c
projects/release-pkg/sys/dev/cxgbe/iw_cxgbe/cm.c
projects/release-pkg/sys/dev/drm2/i915/i915_gem.c
projects/release-pkg/sys/dev/iicbus/icee.c
projects/release-pkg/sys/dev/iicbus/iicoc.c
projects/release-pkg/sys/dev/iicbus/iiconf.c
projects/release-pkg/sys/dev/iicbus/iiconf.h
projects/release-pkg/sys/dev/pcf/pcf.c
projects/release-pkg/sys/geom/nop/g_nop.c
projects/release-pkg/sys/geom/nop/g_nop.h
projects/release-pkg/sys/kern/kern_module.c
projects/release-pkg/sys/kern/sysv_shm.c
projects/release-pkg/sys/mips/conf/AP135.hints
projects/release-pkg/sys/mips/conf/TP-MR3020
projects/release-pkg/sys/powerpc/mpc85xx/i2c.c
projects/release-pkg/usr.sbin/ppp/Makefile
Directory Properties:
projects/release-pkg/ (props changed)
projects/release-pkg/lib/libc/ (props changed)
projects/release-pkg/sbin/ (props changed)
projects/release-pkg/share/ (props changed)
projects/release-pkg/share/man/man4/ (props changed)
projects/release-pkg/sys/ (props changed)
Modified: projects/release-pkg/Makefile.inc1
==============================================================================
--- projects/release-pkg/Makefile.inc1 Sat Oct 10 19:51:00 2015 (r289118)
+++ projects/release-pkg/Makefile.inc1 Sat Oct 10 23:12:36 2015 (r289119)
@@ -1035,7 +1035,9 @@ distrib-dirs: .MAKE
distribution: .MAKE
cd ${.CURDIR}/etc; ${CROSSENV} PATH=${TMPPATH} ${MAKE} \
${IMAKE_INSTALL} ${IMAKE_MTREE} METALOG=${METALOG} ${.TARGET}
- ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 installconfig
+ ${_+_}cd ${.CURDIR}; ${CROSSENV} PATH=${TMPPATH} \
+ ${MAKE} -f Makefile.inc1 ${IMAKE_INSTALL} \
+ METALOG=${METALOG} installconfig
#
# buildkernel and installkernel
Modified: projects/release-pkg/bin/ls/tests/ls_tests.sh
==============================================================================
--- projects/release-pkg/bin/ls/tests/ls_tests.sh Sat Oct 10 19:51:00 2015 (r289118)
+++ projects/release-pkg/bin/ls/tests/ls_tests.sh Sat Oct 10 23:12:36 2015 (r289119)
@@ -72,8 +72,6 @@ create_test_inputs()
atf_check -e empty -s exit:0 touch 0b00001101
atf_check -e empty -s exit:0 touch 0b00001110
atf_check -e empty -s exit:0 touch 0b00001111
-
- atf_check -e empty -s exit:0 sync
}
KB=1024
@@ -100,8 +98,6 @@ create_test_inputs2()
count=1 oseek=$(( $filesize / $MB )) conv=sparse
files="${files} ${filesize}.file"
done
-
- atf_check -e empty -s exit:0 sync
}
atf_test_case A_flag
@@ -815,16 +811,12 @@ t_flag_body()
atf_check -e empty -o empty -s exit:0 touch a.file
atf_check -e empty -o empty -s exit:0 touch b.file
- atf_check -e empty -s exit:0 sync
-
atf_check -e empty -o match:'a\.file' -s exit:0 sh -c 'ls -lt | tail -n 1'
atf_check -e empty -o match:'b\.file.*a\.file' -s exit:0 ls -Ct
atf_check -e empty -o empty -s exit:0 rm a.file
atf_check -e empty -o empty -s exit:0 sh -c 'echo "i am a" > a.file'
- atf_check -e empty -s exit:0 sync
-
atf_check -e empty -o match:'b\.file' -s exit:0 sh -c 'ls -lt | tail -n 1'
atf_check -e empty -o match:'a\.file.*b\.file' -s exit:0 ls -Ct
}
@@ -841,14 +833,12 @@ u_flag_body()
atf_check -e empty -o empty -s exit:0 touch a.file
atf_check -e empty -o empty -s exit:0 touch b.file
- atf_check -e empty -s exit:0 sync
atf_check -e empty -o match:'b\.file' -s exit:0 sh -c 'ls -lu | tail -n 1'
atf_check -e empty -o match:'a\.file.*b\.file' -s exit:0 ls -Cu
atf_check -e empty -o empty -s exit:0 sh -c 'echo "i am a" > a.file'
atf_check -e empty -o match:'i am a' -s exit:0 cat a.file
- atf_check -e empty -s exit:0 sync
atf_check -e empty -o match:'b\.file' -s exit:0 sh -c 'ls -lu | tail -n 1'
atf_check -e empty -o match:'a\.file.*b\.file' -s exit:0 ls -Cu
Modified: projects/release-pkg/etc/Makefile
==============================================================================
--- projects/release-pkg/etc/Makefile Sat Oct 10 19:51:00 2015 (r289118)
+++ projects/release-pkg/etc/Makefile Sat Oct 10 23:12:36 2015 (r289119)
@@ -291,10 +291,6 @@ distribution:
.endif
cd ${.CURDIR}/mtree; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
${MTREE} ${DESTDIR}/etc/mtree
-.if ${MK_PPP} != "no"
- cd ${.CURDIR}/ppp; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 600 \
- ${PPPCNF} ${DESTDIR}/etc/ppp
-.endif
.if ${MK_MAIL} != "no"
cd ${.CURDIR}/mail; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
${ETCMAIL} ${DESTDIR}/etc/mail
Modified: projects/release-pkg/lib/libc/sys/shmctl.2
==============================================================================
--- projects/release-pkg/lib/libc/sys/shmctl.2 Sat Oct 10 19:51:00 2015 (r289118)
+++ projects/release-pkg/lib/libc/sys/shmctl.2 Sat Oct 10 23:12:36 2015 (r289119)
@@ -25,7 +25,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd July 17, 1995
+.Dd October 10, 2015
.Dt SHMCTL 2
.Os
.Sh NAME
@@ -72,15 +72,18 @@ or it must have superuser privileges.
.It Dv IPC_RMID
Removes the segment from the system.
The removal will not take
-effect until all processes having attached the segment have exited;
-however, once the IPC_RMID operation has taken place, no further
-processes will be allowed to attach the segment.
+effect until all processes having attached the segment have exited.
For the operation
to succeed, the calling process's effective uid must match
.Fa shm_perm.uid
or
.Fa shm_perm.cuid ,
or the process must have superuser privileges.
+If the
+.Va kern.ipc.shm_allow_removed
+.Xr sysctl 3
+variable is set to 0, once the IPC_RMID operation has taken place,
+no further processes will be allowed to attach the segment.
.\" .It Dv SHM_LOCK
.\" Locks the segment in memory. The calling process must have
.\" superuser privileges. Not implemented in FreeBSD.
Modified: projects/release-pkg/libexec/dma/Makefile
==============================================================================
--- projects/release-pkg/libexec/dma/Makefile Sat Oct 10 19:51:00 2015 (r289118)
+++ projects/release-pkg/libexec/dma/Makefile Sat Oct 10 23:12:36 2015 (r289119)
@@ -1,6 +1,6 @@
# $FreeBSD$
-SUBDIR= dma \
+SUBDIR= dmagent \
dma-mbox-create
.include <bsd.subdir.mk>
Modified: projects/release-pkg/sbin/geom/class/nop/gnop.8
==============================================================================
--- projects/release-pkg/sbin/geom/class/nop/gnop.8 Sat Oct 10 19:51:00 2015 (r289118)
+++ projects/release-pkg/sbin/geom/class/nop/gnop.8 Sat Oct 10 23:12:36 2015 (r289119)
@@ -24,7 +24,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd September 15, 2015
+.Dd October 10, 2015
.Dt GNOP 8
.Os
.Sh NAME
@@ -72,9 +72,10 @@ The
utility is used for setting up transparent providers on existing ones.
Its main purpose is testing other GEOM classes, as it allows forced provider
removal and I/O error simulation with a given probability.
-It also gathers the following statistics: number of read requests, number of
-write requests, number of bytes read and number of bytes written.
-In addition, it can be used as a good starting point for implementing new GEOM
+It also gathers statistics on the number of read, write, delete,
+getattr, flush, and other requests, and the number of bytes read and written.
+.Nm
+can also be used as a good starting point for implementing new GEOM
classes.
.Pp
The first argument to
Modified: projects/release-pkg/sbin/mdconfig/mdconfig.8
==============================================================================
--- projects/release-pkg/sbin/mdconfig/mdconfig.8 Sat Oct 10 19:51:00 2015 (r289118)
+++ projects/release-pkg/sbin/mdconfig/mdconfig.8 Sat Oct 10 23:12:36 2015 (r289119)
@@ -37,7 +37,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd August 6, 2015
+.Dd October 10, 2015
.Dt MDCONFIG 8
.Os
.Sh NAME
@@ -159,11 +159,11 @@ prefix.
Size of the memory disk.
.Ar Size
is the number of 512 byte sectors unless suffixed with a
-.Cm b , k , m , g ,
+.Cm b , k , m , g , t ,
or
-.Cm t
+.Cm p
which
-denotes byte, kilobyte, megabyte, gigabyte and terabyte respectively.
+denotes byte, kilobyte, megabyte, gigabyte, terabyte and petabyte respectively.
When used without the
.Fl r
option, the
Modified: projects/release-pkg/sbin/mdconfig/mdconfig.c
==============================================================================
--- projects/release-pkg/sbin/mdconfig/mdconfig.c Sat Oct 10 19:51:00 2015 (r289118)
+++ projects/release-pkg/sbin/mdconfig/mdconfig.c Sat Oct 10 23:12:36 2015 (r289119)
@@ -88,8 +88,8 @@ usage(void)
fprintf(stderr, "\t\ttype = {malloc, vnode, swap}\n");
fprintf(stderr, "\t\toption = {cluster, compress, reserve}\n");
fprintf(stderr, "\t\tsize = %%d (512 byte blocks), %%db (B),\n");
- fprintf(stderr, "\t\t %%dk (kB), %%dm (MB), %%dg (GB) or\n");
- fprintf(stderr, "\t\t %%dt (TB)\n");
+ fprintf(stderr, "\t\t %%dk (kB), %%dm (MB), %%dg (GB), \n");
+ fprintf(stderr, "\t\t %%dt (TB), or %%dp (PB)\n");
exit(1);
}
@@ -217,6 +217,9 @@ main(int argc, char **argv)
else if (*p == 't' || *p == 'T') {
mdio.md_mediasize <<= 30;
mdio.md_mediasize <<= 10;
+ } else if (*p == 'p' || *p == 'P') {
+ mdio.md_mediasize <<= 30;
+ mdio.md_mediasize <<= 20;
} else
errx(1, "unknown suffix on -s argument");
break;
Modified: projects/release-pkg/share/man/man4/vtnet.4
==============================================================================
--- projects/release-pkg/share/man/man4/vtnet.4 Sat Oct 10 19:51:00 2015 (r289118)
+++ projects/release-pkg/share/man/man4/vtnet.4 Sat Oct 10 23:12:36 2015 (r289119)
@@ -52,9 +52,9 @@ device driver provides support for VirtI
If the hypervisor advertises the appreciate features, the
.Nm
driver supports TCP/UDP checksum offload for both transmit and receive,
-TCP segmentation offload (TSO), TCP large receive offload (LRO), and
-hardware VLAN tag stripping/insertion features, as well as a multicast
-hash filter, as well as Jumbo Frames (up to 9216 bytes), which can be
+TCP segmentation offload (TSO), TCP large receive offload (LRO),
+hardware VLAN tag stripping/insertion features, a multicast hash filter,
+as well as Jumbo Frames (up to 9216 bytes), which can be
configured via the interface MTU setting.
Selecting an MTU larger than 1500 bytes with the
.Xr ifconfig 8
Modified: projects/release-pkg/share/mk/Makefile
==============================================================================
--- projects/release-pkg/share/mk/Makefile Sat Oct 10 19:51:00 2015 (r289118)
+++ projects/release-pkg/share/mk/Makefile Sat Oct 10 23:12:36 2015 (r289119)
@@ -13,6 +13,7 @@ FILES= \
bsd.README \
bsd.arch.inc.mk \
bsd.compiler.mk \
+ bsd.confs.mk \
bsd.cpu.mk \
bsd.crunchgen.mk \
bsd.dep.mk \
Modified: projects/release-pkg/share/mk/bsd.confs.mk
==============================================================================
--- projects/release-pkg/share/mk/bsd.confs.mk Sat Oct 10 19:51:00 2015 (r289118)
+++ projects/release-pkg/share/mk/bsd.confs.mk Sat Oct 10 23:12:36 2015 (r289119)
@@ -22,7 +22,7 @@ all: buildconfig
${group}OWN?= ${SHAREOWN}
${group}GRP?= ${SHAREGRP}
${group}MODE?= ${CONFMODE}
-${group}DIR?= ${ETCDIR}/
+${group}DIR?= ${CONFIGDIR}/
STAGE_SETS+= ${group}
STAGE_DIR.${group}= ${STAGE_OBJTOP}${${group}DIR}
STAGE_SYMLINKS_DIR.${group}= ${STAGE_OBJTOP}
Modified: projects/release-pkg/share/mk/bsd.own.mk
==============================================================================
--- projects/release-pkg/share/mk/bsd.own.mk Sat Oct 10 19:51:00 2015 (r289118)
+++ projects/release-pkg/share/mk/bsd.own.mk Sat Oct 10 23:12:36 2015 (r289119)
@@ -213,7 +213,7 @@ NLSGRP?= ${SHAREGRP}
NLSMODE?= ${NOBINMODE}
INCLUDEDIR?= /usr/include
-ETCDIR?= /etc
+CONFIGDIR?= /etc
#
# install(1) parameters.
Modified: projects/release-pkg/sys/arm/freescale/imx/imx_i2c.c
==============================================================================
--- projects/release-pkg/sys/arm/freescale/imx/imx_i2c.c Sat Oct 10 19:51:00 2015 (r289118)
+++ projects/release-pkg/sys/arm/freescale/imx/imx_i2c.c Sat Oct 10 23:12:36 2015 (r289119)
@@ -1,6 +1,7 @@
/*-
* Copyright (C) 2008-2009 Semihalf, Michal Hajduk
* Copyright (c) 2012, 2013 The FreeBSD Foundation
+ * Copyright (c) 2015 Ian Lepore <ian at FreeBSD.org>
* All rights reserved.
*
* Portions of this software were developed by Oleksandr Rybalko
@@ -28,6 +29,19 @@
* SUCH DAMAGE.
*/
+/*
+ * I2C driver for Freescale i.MX hardware.
+ *
+ * Note that the hardware is capable of running as both a master and a slave.
+ * This driver currently implements only master-mode operations.
+ *
+ * This driver supports multi-master i2c busses, by detecting bus arbitration
+ * loss and returning IIC_EBUSBSY status. Notably, it does not do any kind of
+ * retries if some other master jumps onto the bus and interrupts one of our
+ * transfer cycles resulting in arbitration loss in mid-transfer. The caller
+ * must handle retries in a way that makes sense for the slave being addressed.
+ */
+
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
@@ -43,9 +57,6 @@ __FBSDID("$FreeBSD$");
#include <machine/resource.h>
#include <sys/rman.h>
-#include <sys/lock.h>
-#include <sys/mutex.h>
-
#include <arm/freescale/imx/imx_ccmvar.h>
#include <dev/iicbus/iiconf.h>
@@ -108,13 +119,6 @@ static struct clkdiv clkdiv_table[] = {
{ 2560, 0x1d }, { 3072, 0x1e }, { 3840, 0x1f }, {UINT_MAX, 0x1f}
};
-#ifdef DEBUG
-#define debugf(fmt, args...) do { printf("%s(): ", __func__); \
- printf(fmt,##args); } while (0)
-#else
-#define debugf(fmt, args...)
-#endif
-
static struct ofw_compat_data compat_data[] = {
{"fsl,imx6q-i2c", 1},
{"fsl,imx-i2c", 1},
@@ -125,10 +129,8 @@ struct i2c_softc {
device_t dev;
device_t iicbus;
struct resource *res;
- struct mtx mutex;
int rid;
- bus_space_handle_t bsh;
- bus_space_tag_t bst;
+ sbintime_t byte_time_sbt;
};
static phandle_t i2c_get_node(device_t, device_t);
@@ -158,7 +160,7 @@ static device_method_t i2c_methods[] = {
DEVMETHOD(iicbus_write, i2c_write),
DEVMETHOD(iicbus_transfer, iicbus_transfer_gen),
- { 0, 0 }
+ DEVMETHOD_END
};
static driver_t i2c_driver = {
@@ -184,14 +186,14 @@ static __inline void
i2c_write_reg(struct i2c_softc *sc, bus_size_t off, uint8_t val)
{
- bus_space_write_1(sc->bst, sc->bsh, off, val);
+ bus_write_1(sc->res, off, val);
}
static __inline uint8_t
i2c_read_reg(struct i2c_softc *sc, bus_size_t off)
{
- return (bus_space_read_1(sc->bst, sc->bsh, off));
+ return (bus_read_1(sc->res, off));
}
static __inline void
@@ -204,60 +206,77 @@ i2c_flag_set(struct i2c_softc *sc, bus_s
i2c_write_reg(sc, off, status);
}
-/* Wait for transfer interrupt flag */
+/* Wait for bus to become busy or not-busy. */
static int
-wait_for_iif(struct i2c_softc *sc)
+wait_for_busbusy(struct i2c_softc *sc, int wantbusy)
{
- int retry;
+ int retry, srb;
retry = 1000;
while (retry --) {
- if (i2c_read_reg(sc, I2C_STATUS_REG) & I2CSR_MIF)
+ srb = i2c_read_reg(sc, I2C_STATUS_REG) & I2CSR_MBB;
+ if ((srb && wantbusy) || (!srb && !wantbusy))
return (IIC_NOERR);
- DELAY(10);
+ DELAY(1);
}
-
return (IIC_ETIMEOUT);
}
-/* Wait for free bus */
+/* Wait for transfer to complete, optionally check RXAK. */
static int
-wait_for_nibb(struct i2c_softc *sc)
+wait_for_xfer(struct i2c_softc *sc, int checkack)
{
- int retry;
+ int retry, sr;
- retry = 1000;
+ /*
+ * Sleep for about the time it takes to transfer a byte (with precision
+ * set to tolerate 5% oversleep). We calculate the approximate byte
+ * transfer time when we set the bus speed divisor. Slaves are allowed
+ * to do clock-stretching so the actual transfer time can be larger, but
+ * this gets the bulk of the waiting out of the way without tying up the
+ * processor the whole time.
+ */
+ pause_sbt("imxi2c", sc->byte_time_sbt, sc->byte_time_sbt / 20, 0);
+
+ retry = 10000;
while (retry --) {
- if ((i2c_read_reg(sc, I2C_STATUS_REG) & I2CSR_MBB) == 0)
- return (IIC_NOERR);
- DELAY(10);
+ sr = i2c_read_reg(sc, I2C_STATUS_REG);
+ if (sr & I2CSR_MIF) {
+ if (sr & I2CSR_MAL)
+ return (IIC_EBUSERR);
+ else if (checkack && (sr & I2CSR_RXAK))
+ return (IIC_ENOACK);
+ else
+ return (IIC_NOERR);
+ }
+ DELAY(1);
}
-
return (IIC_ETIMEOUT);
}
-/* Wait for transfer complete+interrupt flag */
+/*
+ * Implement the error handling shown in the state diagram of the imx6 reference
+ * manual. If there was an error, then:
+ * - Clear master mode (MSTA and MTX).
+ * - Wait for the bus to become free or for a timeout to happen.
+ * - Disable the controller.
+ */
static int
-wait_for_icf(struct i2c_softc *sc)
+i2c_error_handler(struct i2c_softc *sc, int error)
{
- int retry;
- retry = 1000;
- while (retry --) {
-
- if ((i2c_read_reg(sc, I2C_STATUS_REG) &
- (I2CSR_MCF|I2CSR_MIF)) == (I2CSR_MCF|I2CSR_MIF))
- return (IIC_NOERR);
- DELAY(10);
+ if (error != 0) {
+ i2c_write_reg(sc, I2C_STATUS_REG, 0);
+ i2c_write_reg(sc, I2C_CONTROL_REG, I2CCR_MEN);
+ wait_for_busbusy(sc, false);
+ i2c_write_reg(sc, I2C_CONTROL_REG, 0);
}
-
- return (IIC_ETIMEOUT);
+ return (error);
}
static int
i2c_probe(device_t dev)
{
- struct i2c_softc *sc;
if (!ofw_bus_status_okay(dev))
return (ENXIO);
@@ -265,23 +284,7 @@ i2c_probe(device_t dev)
if (ofw_bus_search_compatible(dev, compat_data)->ocd_data == 0)
return (ENXIO);
- sc = device_get_softc(dev);
- sc->rid = 0;
-
- sc->res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &sc->rid,
- RF_ACTIVE);
- if (sc->res == NULL) {
- device_printf(dev, "could not allocate resources\n");
- return (ENXIO);
- }
-
- sc->bst = rman_get_bustag(sc->res);
- sc->bsh = rman_get_bushandle(sc->res);
-
- /* Enable I2C */
- i2c_write_reg(sc, I2C_CONTROL_REG, I2CCR_MEN);
- bus_release_resource(dev, SYS_RES_MEMORY, sc->rid, sc->res);
- device_set_desc(dev, "Freescale i.MX I2C bus controller");
+ device_set_desc(dev, "Freescale i.MX I2C");
return (BUS_PROBE_DEFAULT);
}
@@ -295,28 +298,21 @@ i2c_attach(device_t dev)
sc->dev = dev;
sc->rid = 0;
- mtx_init(&sc->mutex, device_get_nameunit(dev), "I2C", MTX_DEF);
-
sc->res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &sc->rid,
RF_ACTIVE);
if (sc->res == NULL) {
device_printf(dev, "could not allocate resources");
- mtx_destroy(&sc->mutex);
return (ENXIO);
}
- sc->bst = rman_get_bustag(sc->res);
- sc->bsh = rman_get_bushandle(sc->res);
-
sc->iicbus = device_add_child(dev, "iicbus", -1);
if (sc->iicbus == NULL) {
device_printf(dev, "could not add iicbus child");
- mtx_destroy(&sc->mutex);
return (ENXIO);
}
bus_generic_attach(dev);
- return (IIC_NOERR);
+ return (0);
}
static int
@@ -327,34 +323,20 @@ i2c_repeated_start(device_t dev, u_char
sc = device_get_softc(dev);
- mtx_lock(&sc->mutex);
-
- i2c_write_reg(sc, I2C_ADDR_REG, slave);
if ((i2c_read_reg(sc, I2C_STATUS_REG) & I2CSR_MBB) == 0) {
- mtx_unlock(&sc->mutex);
- return (IIC_EBUSBSY);
+ return (IIC_EBUSERR);
}
- /* Set repeated start condition */
- DELAY(10);
+ /*
+ * Set repeated start condition, delay (per reference manual, min 156nS)
+ * before writing slave address, wait for ack after write.
+ */
i2c_flag_set(sc, I2C_CONTROL_REG, I2CCR_RSTA);
- DELAY(10);
- /* Clear status */
+ DELAY(1);
i2c_write_reg(sc, I2C_STATUS_REG, 0x0);
- /* Write target address - LSB is R/W bit */
i2c_write_reg(sc, I2C_DATA_REG, slave);
-
- error = wait_for_iif(sc);
-
- /* Clear status */
- i2c_write_reg(sc, I2C_STATUS_REG, 0x0);
-
- mtx_unlock(&sc->mutex);
-
- if (error)
- return (error);
-
- return (IIC_NOERR);
+ error = wait_for_xfer(sc, true);
+ return (i2c_error_handler(sc, error));
}
static int
@@ -365,53 +347,30 @@ i2c_start(device_t dev, u_char slave, in
sc = device_get_softc(dev);
- mtx_lock(&sc->mutex);
- i2c_write_reg(sc, I2C_ADDR_REG, slave);
+ i2c_write_reg(sc, I2C_CONTROL_REG, I2CCR_MEN);
+ DELAY(10); /* Delay for controller to sample bus state. */
if (i2c_read_reg(sc, I2C_STATUS_REG) & I2CSR_MBB) {
- mtx_unlock(&sc->mutex);
- return (IIC_EBUSBSY);
+ return (i2c_error_handler(sc, IIC_EBUSERR));
}
-
- /* Set start condition */
- i2c_write_reg(sc, I2C_CONTROL_REG,
- I2CCR_MEN | I2CCR_MSTA | I2CCR_TXAK);
- DELAY(100);
- i2c_write_reg(sc, I2C_CONTROL_REG,
- I2CCR_MEN | I2CCR_MSTA | I2CCR_MTX | I2CCR_TXAK);
- /* Clear status */
- i2c_write_reg(sc, I2C_STATUS_REG, 0x0);
- /* Write target address - LSB is R/W bit */
+ i2c_write_reg(sc, I2C_CONTROL_REG, I2CCR_MEN | I2CCR_MSTA | I2CCR_MTX);
+ if ((error = wait_for_busbusy(sc, true)) != IIC_NOERR)
+ return (i2c_error_handler(sc, error));
+ i2c_write_reg(sc, I2C_STATUS_REG, 0);
i2c_write_reg(sc, I2C_DATA_REG, slave);
-
- error = wait_for_iif(sc);
-
- mtx_unlock(&sc->mutex);
- if (error)
- return (error);
-
- return (IIC_NOERR);
+ error = wait_for_xfer(sc, true);
+ return (i2c_error_handler(sc, error));
}
-
static int
i2c_stop(device_t dev)
{
struct i2c_softc *sc;
sc = device_get_softc(dev);
- mtx_lock(&sc->mutex);
- i2c_write_reg(sc, I2C_CONTROL_REG, I2CCR_MEN | I2CCR_TXAK);
- DELAY(100);
- /* Reset controller if bus still busy after STOP */
- if (wait_for_nibb(sc) == IIC_ETIMEOUT) {
- i2c_write_reg(sc, I2C_CONTROL_REG, 0);
- DELAY(1000);
- i2c_write_reg(sc, I2C_CONTROL_REG, I2CCR_MEN | I2CCR_TXAK);
-
- i2c_write_reg(sc, I2C_STATUS_REG, 0x0);
- }
- mtx_unlock(&sc->mutex);
+ i2c_write_reg(sc, I2C_CONTROL_REG, I2CCR_MEN);
+ wait_for_busbusy(sc, false);
+ i2c_write_reg(sc, I2C_CONTROL_REG, 0);
return (IIC_NOERR);
}
@@ -434,19 +393,23 @@ i2c_reset(device_t dev, u_char speed, u_
if (clkdiv_table[i].divisor >= div)
break;
}
- div = clkdiv_table[i].regcode;
- mtx_lock(&sc->mutex);
- i2c_write_reg(sc, I2C_CONTROL_REG, 0x0);
- i2c_write_reg(sc, I2C_STATUS_REG, 0x0);
- DELAY(1000);
+ /*
+ * Calculate roughly how long it will take to transfer a byte (which
+ * requires 9 clock cycles) at the new bus speed. This value is used to
+ * pause() while waiting for transfer-complete. With a 66MHz IPG clock
+ * and the actual i2c bus speeds that leads to, for nominal 100KHz and
+ * 400KHz bus speeds the transfer times are roughly 104uS and 22uS.
+ */
+ busfreq = ipgfreq / clkdiv_table[i].divisor;
+ sc->byte_time_sbt = SBT_1US * (9000000 / busfreq);
- i2c_write_reg(sc, I2C_FDR_REG, (uint8_t)div);
- i2c_write_reg(sc, I2C_CONTROL_REG, I2CCR_MEN);
- DELAY(1000);
+ /*
+ * Disable the controller (do the reset), and set the new clock divisor.
+ */
i2c_write_reg(sc, I2C_STATUS_REG, 0x0);
- mtx_unlock(&sc->mutex);
-
+ i2c_write_reg(sc, I2C_CONTROL_REG, 0x0);
+ i2c_write_reg(sc, I2C_FDR_REG, (uint8_t)clkdiv_table[i].regcode);
return (IIC_NOERR);
}
@@ -459,48 +422,42 @@ i2c_read(device_t dev, char *buf, int le
sc = device_get_softc(dev);
*read = 0;
- mtx_lock(&sc->mutex);
-
if (len) {
if (len == 1)
i2c_write_reg(sc, I2C_CONTROL_REG, I2CCR_MEN |
I2CCR_MSTA | I2CCR_TXAK);
-
else
i2c_write_reg(sc, I2C_CONTROL_REG, I2CCR_MEN |
I2CCR_MSTA);
-
- /* dummy read */
+ /* Dummy read to prime the receiver. */
+ i2c_write_reg(sc, I2C_STATUS_REG, 0x0);
i2c_read_reg(sc, I2C_DATA_REG);
- DELAY(1000);
}
+ error = 0;
+ *read = 0;
while (*read < len) {
- error = wait_for_icf(sc);
- if (error) {
- mtx_unlock(&sc->mutex);
- return (error);
- }
+ if ((error = wait_for_xfer(sc, false)) != IIC_NOERR)
+ break;
i2c_write_reg(sc, I2C_STATUS_REG, 0x0);
- if ((*read == len - 2) && last) {
- /* NO ACK on last byte */
- i2c_write_reg(sc, I2C_CONTROL_REG, I2CCR_MEN |
- I2CCR_MSTA | I2CCR_TXAK);
+ if (last) {
+ if (*read == len - 2) {
+ /* NO ACK on last byte */
+ i2c_write_reg(sc, I2C_CONTROL_REG, I2CCR_MEN |
+ I2CCR_MSTA | I2CCR_TXAK);
+ } else if (*read == len - 1) {
+ /* Transfer done, signal stop. */
+ i2c_write_reg(sc, I2C_CONTROL_REG, I2CCR_MEN |
+ I2CCR_TXAK);
+ wait_for_busbusy(sc, false);
+ }
}
-
- if ((*read == len - 1) && last) {
- /* Transfer done, remove master bit */
- i2c_write_reg(sc, I2C_CONTROL_REG, I2CCR_MEN |
- I2CCR_TXAK);
- }
-
reg = i2c_read_reg(sc, I2C_DATA_REG);
*buf++ = reg;
(*read)++;
}
- mtx_unlock(&sc->mutex);
- return (IIC_NOERR);
+ return (i2c_error_handler(sc, error));
}
static int
@@ -510,22 +467,16 @@ i2c_write(device_t dev, const char *buf,
int error;
sc = device_get_softc(dev);
- *sent = 0;
- mtx_lock(&sc->mutex);
+ error = 0;
+ *sent = 0;
while (*sent < len) {
i2c_write_reg(sc, I2C_STATUS_REG, 0x0);
i2c_write_reg(sc, I2C_DATA_REG, *buf++);
-
- error = wait_for_iif(sc);
- if (error) {
- mtx_unlock(&sc->mutex);
- return (error);
- }
-
+ if ((error = wait_for_xfer(sc, true)) != IIC_NOERR)
+ break;
(*sent)++;
}
- mtx_unlock(&sc->mutex);
- return (IIC_NOERR);
+ return (i2c_error_handler(sc, error));
}
Modified: projects/release-pkg/sys/arm/freescale/vybrid/vf_i2c.c
==============================================================================
--- projects/release-pkg/sys/arm/freescale/vybrid/vf_i2c.c Sat Oct 10 19:51:00 2015 (r289118)
+++ projects/release-pkg/sys/arm/freescale/vybrid/vf_i2c.c Sat Oct 10 23:12:36 2015 (r289119)
@@ -232,7 +232,7 @@ i2c_repeated_start(device_t dev, u_char
if ((READ1(sc, I2C_IBSR) & IBSR_IBB) == 0) {
mtx_unlock(&sc->mutex);
- return (IIC_EBUSBSY);
+ return (IIC_EBUSERR);
}
/* Set repeated start condition */
@@ -275,7 +275,7 @@ i2c_start(device_t dev, u_char slave, in
if (READ1(sc, I2C_IBSR) & IBSR_IBB) {
mtx_unlock(&sc->mutex);
vf_i2c_dbg(sc, "cant i2c start: IIC_EBUSBSY\n");
- return (IIC_EBUSBSY);
+ return (IIC_EBUSERR);
}
/* Set start condition */
Modified: projects/release-pkg/sys/arm/samsung/exynos/exynos5_i2c.c
==============================================================================
--- projects/release-pkg/sys/arm/samsung/exynos/exynos5_i2c.c Sat Oct 10 19:51:00 2015 (r289118)
+++ projects/release-pkg/sys/arm/samsung/exynos/exynos5_i2c.c Sat Oct 10 23:12:36 2015 (r289119)
@@ -263,8 +263,8 @@ i2c_start(device_t dev, u_char slave, in
error = wait_for_nibb(sc);
if (error) {
mtx_unlock(&sc->mutex);
- DPRINTF("cant i2c start: IIC_EBUSBSY\n");
- return (IIC_EBUSBSY);
+ DPRINTF("cant i2c start: IIC_EBUSERR\n");
+ return (IIC_EBUSERR);
}
reg = READ1(sc, I2CCON);
Modified: projects/release-pkg/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_attach.c
==============================================================================
--- projects/release-pkg/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_attach.c Sat Oct 10 19:51:00 2015 (r289118)
+++ projects/release-pkg/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_attach.c Sat Oct 10 23:12:36 2015 (r289119)
@@ -2671,7 +2671,7 @@ ar9300_fill_capability_info(struct ath_h
p_cap->halBurstSupport = AH_TRUE;
p_cap->halChapTuningSupport = AH_TRUE;
p_cap->halTurboPrimeSupport = AH_TRUE;
- p_cap->halFastFramesSupport = AH_FALSE;
+ p_cap->halFastFramesSupport = AH_TRUE;
p_cap->halTurboGSupport = p_cap->halWirelessModes & HAL_MODE_108G;
Modified: projects/release-pkg/sys/dev/ath/ath_hal/ar5416/ar5416_attach.c
==============================================================================
--- projects/release-pkg/sys/dev/ath/ath_hal/ar5416/ar5416_attach.c Sat Oct 10 19:51:00 2015 (r289118)
+++ projects/release-pkg/sys/dev/ath/ath_hal/ar5416/ar5416_attach.c Sat Oct 10 23:12:36 2015 (r289119)
@@ -937,13 +937,7 @@ ar5416FillCapabilityInfo(struct ath_hal
pCap->halCompressSupport = AH_FALSE;
pCap->halBurstSupport = AH_TRUE;
- /*
- * This is disabled for now; the net80211 layer needs to be
- * taught when it is and isn't appropriate to enable FF processing
- * with 802.11n NICs (it tries to enable both A-MPDU and
- * fast frames, with very tragic crash-y results.)
- */
- pCap->halFastFramesSupport = AH_FALSE;
+ pCap->halFastFramesSupport = AH_TRUE;
pCap->halChapTuningSupport = AH_TRUE;
pCap->halTurboPrimeSupport = AH_TRUE;
Modified: projects/release-pkg/sys/dev/cxgbe/iw_cxgbe/cm.c
==============================================================================
--- projects/release-pkg/sys/dev/cxgbe/iw_cxgbe/cm.c Sat Oct 10 19:51:00 2015 (r289118)
+++ projects/release-pkg/sys/dev/cxgbe/iw_cxgbe/cm.c Sat Oct 10 23:12:36 2015 (r289119)
@@ -99,7 +99,7 @@ static int abort_connection(struct c4iw_
static void peer_close_upcall(struct c4iw_ep *ep);
static void peer_abort_upcall(struct c4iw_ep *ep);
static void connect_reply_upcall(struct c4iw_ep *ep, int status);
-static void connect_request_upcall(struct c4iw_ep *ep);
+static int connect_request_upcall(struct c4iw_ep *ep);
static void established_upcall(struct c4iw_ep *ep);
static void process_mpa_reply(struct c4iw_ep *ep);
static void process_mpa_request(struct c4iw_ep *ep);
@@ -1216,7 +1216,6 @@ static int abort_connection(struct c4iw_
int err;
CTR2(KTR_IW_CXGBE, "%s:abB %p", __func__, ep);
- close_complete_upcall(ep, -ECONNRESET);
state_set(&ep->com, ABORTING);
abort_socket(ep);
err = close_socket(&ep->com, 0);
@@ -1319,9 +1318,10 @@ static void connect_reply_upcall(struct
CTR2(KTR_IW_CXGBE, "%s:cruE %p", __func__, ep);
}
-static void connect_request_upcall(struct c4iw_ep *ep)
+static int connect_request_upcall(struct c4iw_ep *ep)
{
struct iw_cm_event event;
+ int ret;
CTR3(KTR_IW_CXGBE, "%s: ep %p, mpa_v1 %d", __func__, ep,
ep->tried_with_mpa_v1);
@@ -1355,10 +1355,14 @@ static void connect_request_upcall(struc
}
c4iw_get_ep(&ep->com);
- ep->parent_ep->com.cm_id->event_handler(ep->parent_ep->com.cm_id,
+ ret = ep->parent_ep->com.cm_id->event_handler(ep->parent_ep->com.cm_id,
&event);
+ if(ret)
+ c4iw_put_ep(&ep->com);
+
set_bit(CONNREQ_UPCALL, &ep->com.history);
c4iw_put_ep(&ep->parent_ep->com);
+ return ret;
}
static void established_upcall(struct c4iw_ep *ep)
@@ -1835,9 +1839,11 @@ abort:
/* drive upcall */
mutex_lock(&ep->parent_ep->com.mutex);
- if (ep->parent_ep->com.state != DEAD)
- connect_request_upcall(ep);
- else
+ if (ep->parent_ep->com.state != DEAD) {
+ if(connect_request_upcall(ep)) {
+ abort_connection(ep);
+ }
+ }else
abort_connection(ep);
mutex_unlock(&ep->parent_ep->com.mutex);
}
@@ -2213,7 +2219,7 @@ int c4iw_ep_disconnect(struct c4iw_ep *e
CTR2(KTR_IW_CXGBE, "%s:ced1 %p", __func__, ep);
fatal = 1;
- close_complete_upcall(ep, -EIO);
+ close_complete_upcall(ep, -ECONNRESET);
ep->com.state = DEAD;
}
CTR3(KTR_IW_CXGBE, "%s:ced2 %p %s", __func__, ep,
Modified: projects/release-pkg/sys/dev/drm2/i915/i915_gem.c
==============================================================================
--- projects/release-pkg/sys/dev/drm2/i915/i915_gem.c Sat Oct 10 19:51:00 2015 (r289118)
+++ projects/release-pkg/sys/dev/drm2/i915/i915_gem.c Sat Oct 10 23:12:36 2015 (r289119)
@@ -2527,10 +2527,8 @@ i915_gem_object_unbind(struct drm_i915_g
if (obj->gtt_space == NULL)
return 0;
- if (obj->pin_count) {
- DRM_ERROR("Attempting to unbind pinned buffer\n");
+ if (obj->pin_count)
return -EINVAL;
- }
ret = i915_gem_object_finish_gpu(obj);
if (ret == -ERESTARTSYS || ret == -EINTR)
Modified: projects/release-pkg/sys/dev/iicbus/icee.c
==============================================================================
--- projects/release-pkg/sys/dev/iicbus/icee.c Sat Oct 10 19:51:00 2015 (r289118)
+++ projects/release-pkg/sys/dev/iicbus/icee.c Sat Oct 10 23:12:36 2015 (r289119)
@@ -48,7 +48,7 @@ __FBSDID("$FreeBSD$");
struct icee_softc {
device_t sc_dev; /* Myself */
- struct sx sc_lock; /* basically a perimeter lock */
+ device_t sc_busdev; /* Parent bus */
struct cdev *cdev; /* user interface */
int addr;
int size; /* How big am I? */
@@ -57,12 +57,6 @@ struct icee_softc {
int wr_sz; /* What's the write page size */
};
-#define ICEE_LOCK(_sc) sx_xlock(&(_sc)->sc_lock)
-#define ICEE_UNLOCK(_sc) sx_xunlock(&(_sc)->sc_lock)
-#define ICEE_LOCK_INIT(_sc) sx_init(&_sc->sc_lock, "icee")
-#define ICEE_LOCK_DESTROY(_sc) sx_destroy(&_sc->sc_lock);
-#define ICEE_ASSERT_LOCKED(_sc) sx_assert(&_sc->sc_lock, SA_XLOCKED);
-#define ICEE_ASSERT_UNLOCKED(_sc) sx_assert(&_sc->sc_lock, SA_UNLOCKED);
#define CDEV2SOFTC(dev) ((dev)->si_drv1)
/* cdev routines */
@@ -97,6 +91,7 @@ icee_attach(device_t dev)
int dunit, err;
sc->sc_dev = dev;
+ sc->sc_busdev = device_get_parent(sc->sc_dev);
sc->addr = iicbus_get_addr(dev);
err = 0;
dname = device_get_name(dev);
@@ -117,7 +112,6 @@ icee_attach(device_t dev)
goto out;
}
sc->cdev->si_drv1 = sc;
- ICEE_LOCK_INIT(sc);
out:
return (err);
}
@@ -155,7 +149,9 @@ icee_read(struct cdev *dev, struct uio *
return (EIO);
if (sc->type != 8 && sc->type != 16)
return (EINVAL);
- ICEE_LOCK(sc);
+ error = iicbus_request_bus(sc->sc_busdev, sc->sc_dev, IIC_INTRWAIT);
+ if (error!= 0)
+ return (iic2errno(error));
slave = error = 0;
while (uio->uio_resid > 0) {
if (uio->uio_offset >= sc->size)
@@ -180,13 +176,15 @@ icee_read(struct cdev *dev, struct uio *
for (i = 0; i < 2; i++)
msgs[i].slave = slave;
error = iicbus_transfer(sc->sc_dev, msgs, 2);
- if (error)
+ if (error) {
+ error = iic2errno(error);
break;
+ }
error = uiomove(data, len, uio);
if (error)
break;
}
- ICEE_UNLOCK(sc);
+ iicbus_release_bus(sc->sc_busdev, sc->sc_dev);
return (error);
}
@@ -214,7 +212,10 @@ icee_write(struct cdev *dev, struct uio
return (EIO);
if (sc->type != 8 && sc->type != 16)
return (EINVAL);
- ICEE_LOCK(sc);
+
+ error = iicbus_request_bus(sc->sc_busdev, sc->sc_dev, IIC_INTRWAIT);
+ if (error!= 0)
+ return (iic2errno(error));
slave = error = 0;
while (uio->uio_resid > 0) {
if (uio->uio_offset >= sc->size)
@@ -239,18 +240,22 @@ icee_write(struct cdev *dev, struct uio
if (error)
break;
error = iicbus_transfer(sc->sc_dev, wr, 1);
- if (error)
+ if (error) {
+ error = iic2errno(error);
break;
+ }
/* Read after write to wait for write-done. */
waitlimit = 10000;
rd[0].slave = slave;
do {
error = iicbus_transfer(sc->sc_dev, rd, 1);
} while (waitlimit-- > 0 && error != 0);
- if (error)
+ if (error) {
+ error = iic2errno(error);
break;
+ }
}
- ICEE_UNLOCK(sc);
+ iicbus_release_bus(sc->sc_busdev, sc->sc_dev);
return error;
}
Modified: projects/release-pkg/sys/dev/iicbus/iicoc.c
==============================================================================
--- projects/release-pkg/sys/dev/iicbus/iicoc.c Sat Oct 10 19:51:00 2015 (r289118)
+++ projects/release-pkg/sys/dev/iicbus/iicoc.c Sat Oct 10 23:12:36 2015 (r289119)
@@ -236,7 +236,7 @@ iicoc_detach(device_t dev)
static int
iicoc_start(device_t dev, u_char slave, int timeout)
{
- int error = IIC_EBUSBSY;
+ int error = IIC_EBUSERR;
struct iicoc_softc *sc;
sc = device_get_softc(dev);
Modified: projects/release-pkg/sys/dev/iicbus/iiconf.c
==============================================================================
--- projects/release-pkg/sys/dev/iicbus/iiconf.c Sat Oct 10 19:51:00 2015 (r289118)
+++ projects/release-pkg/sys/dev/iicbus/iiconf.c Sat Oct 10 23:12:36 2015 (r289119)
@@ -40,6 +40,28 @@ __FBSDID("$FreeBSD$");
#include "iicbus_if.h"
*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***
More information about the svn-src-projects
mailing list