Merge from head
This commit is contained in:
commit
c69900f12f
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/projects/release-pkg/; revision=289119
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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.
|
||||
|
@ -1,6 +1,6 @@
|
||||
# $FreeBSD$
|
||||
|
||||
SUBDIR= dma \
|
||||
SUBDIR= dmagent \
|
||||
dma-mbox-create
|
||||
|
||||
.include <bsd.subdir.mk>
|
||||
|
@ -17,7 +17,7 @@ SRCS= aliases_parse.y \
|
||||
util.c
|
||||
MAN8= dma.8
|
||||
CONFS= dma.conf
|
||||
CONFSDIR= ${ETCDIR}/dma
|
||||
CONFSDIR= ${CONFIGDIR}/dma
|
||||
YFLAGS+= -i
|
||||
CLEANFILES= aliases_parse.i
|
||||
FILES= mailer.conf
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
|
@ -52,9 +52,9 @@ device driver provides support for VirtIO Ethernet devices.
|
||||
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
|
||||
|
@ -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 \
|
||||
|
@ -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}
|
||||
|
@ -213,7 +213,7 @@ NLSGRP?= ${SHAREGRP}
|
||||
NLSMODE?= ${NOBINMODE}
|
||||
|
||||
INCLUDEDIR?= /usr/include
|
||||
ETCDIR?= /etc
|
||||
CONFIGDIR?= /etc
|
||||
|
||||
#
|
||||
# install(1) parameters.
|
||||
|
@ -1,6 +1,7 @@
|
||||
/*-
|
||||
* Copyright (C) 2008-2009 Semihalf, Michal Hajduk
|
||||
* Copyright (c) 2012, 2013 The FreeBSD Foundation
|
||||
* Copyright (c) 2015 Ian Lepore <ian@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_size_t off, uint8_t mask)
|
||||
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 slave, int timeout)
|
||||
|
||||
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, int timeout)
|
||||
|
||||
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_char addr, u_char *oldadr)
|
||||
if (clkdiv_table[i].divisor >= div)
|
||||
break;
|
||||
}
|
||||
div = clkdiv_table[i].regcode;
|
||||
|
||||
mtx_lock(&sc->mutex);
|
||||
/*
|
||||
* 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);
|
||||
|
||||
/*
|
||||
* Disable the controller (do the reset), and set the new clock divisor.
|
||||
*/
|
||||
i2c_write_reg(sc, I2C_STATUS_REG, 0x0);
|
||||
i2c_write_reg(sc, I2C_CONTROL_REG, 0x0);
|
||||
i2c_write_reg(sc, I2C_STATUS_REG, 0x0);
|
||||
DELAY(1000);
|
||||
|
||||
i2c_write_reg(sc, I2C_FDR_REG, (uint8_t)div);
|
||||
i2c_write_reg(sc, I2C_CONTROL_REG, I2CCR_MEN);
|
||||
DELAY(1000);
|
||||
i2c_write_reg(sc, I2C_STATUS_REG, 0x0);
|
||||
mtx_unlock(&sc->mutex);
|
||||
|
||||
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 len, int *read, int last, int delay)
|
||||
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 len, int *sent, int timeout)
|
||||
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));
|
||||
}
|
||||
|
@ -232,7 +232,7 @@ i2c_repeated_start(device_t dev, u_char slave, int timeout)
|
||||
|
||||
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, int timeout)
|
||||
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 */
|
||||
|
@ -263,8 +263,8 @@ i2c_start(device_t dev, u_char slave, int timeout)
|
||||
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);
|
||||
|
@ -2671,7 +2671,7 @@ ar9300_fill_capability_info(struct ath_hal *ah)
|
||||
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;
|
||||
|
||||
|
@ -937,13 +937,7 @@ ar5416FillCapabilityInfo(struct ath_hal *ah)
|
||||
|
||||
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;
|
||||
|
||||
|
@ -99,7 +99,7 @@ static int abort_connection(struct c4iw_ep *ep);
|
||||
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_ep *ep)
|
||||
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 c4iw_ep *ep, int status)
|
||||
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(struct c4iw_ep *ep)
|
||||
}
|
||||
|
||||
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 @@ process_mpa_request(struct c4iw_ep *ep)
|
||||
|
||||
/* 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 *ep, int abrupt, gfp_t gfp)
|
||||
|
||||
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,
|
||||
|
@ -2527,10 +2527,8 @@ i915_gem_object_unbind(struct drm_i915_gem_object *obj)
|
||||
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)
|
||||
|
@ -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 *uio, int ioflag)
|
||||
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 *uio, int ioflag)
|
||||
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 *uio, int ioflag)
|
||||
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 *uio, int ioflag)
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
|
@ -39,6 +39,28 @@ __FBSDID("$FreeBSD$");
|
||||
#include <dev/iicbus/iicbus.h>
|
||||
#include "iicbus_if.h"
|
||||
|
||||
/*
|
||||
* Translate IIC_Exxxxx status values to vaguely-equivelent errno values.
|
||||
*/
|
||||
int
|
||||
iic2errno(int iic_status)
|
||||
{
|
||||
switch (iic_status) {
|
||||
case IIC_NOERR: return (0);
|
||||
case IIC_EBUSERR: return (EALREADY);
|
||||
case IIC_ENOACK: return (EIO);
|
||||
case IIC_ETIMEOUT: return (ETIMEDOUT);
|
||||
case IIC_EBUSBSY: return (EWOULDBLOCK);
|
||||
case IIC_ESTATUS: return (EPROTO);
|
||||
case IIC_EUNDERFLOW: return (EIO);
|
||||
case IIC_EOVERFLOW: return (EOVERFLOW);
|
||||
case IIC_ENOTSUPP: return (EOPNOTSUPP);
|
||||
case IIC_ENOADDR: return (EADDRNOTAVAIL);
|
||||
case IIC_ERESOURCE: return (ENOMEM);
|
||||
default: return (EIO);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* iicbus_intr()
|
||||
*/
|
||||
@ -70,7 +92,7 @@ iicbus_poll(struct iicbus_softc *sc, int how)
|
||||
break;
|
||||
|
||||
default:
|
||||
return (EWOULDBLOCK);
|
||||
return (IIC_EBUSBSY);
|
||||
}
|
||||
|
||||
return (error);
|
||||
@ -135,7 +157,7 @@ iicbus_release_bus(device_t bus, device_t dev)
|
||||
|
||||
if (sc->owner != dev) {
|
||||
IICBUS_UNLOCK(sc);
|
||||
return (EACCES);
|
||||
return (IIC_EBUSBSY);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -185,7 +207,7 @@ iicbus_start(device_t bus, u_char slave, int timeout)
|
||||
int error = 0;
|
||||
|
||||
if (sc->started)
|
||||
return (EINVAL); /* bus already started */
|
||||
return (IIC_ESTATUS); /* protocol error, bus already started */
|
||||
|
||||
if (!(error = IICBUS_START(device_get_parent(bus), slave, timeout)))
|
||||
sc->started = slave;
|
||||
@ -207,7 +229,7 @@ iicbus_repeated_start(device_t bus, u_char slave, int timeout)
|
||||
int error = 0;
|
||||
|
||||
if (!sc->started)
|
||||
return (EINVAL); /* bus should have been already started */
|
||||
return (IIC_ESTATUS); /* protocol error, bus not started */
|
||||
|
||||
if (!(error = IICBUS_REPEATED_START(device_get_parent(bus), slave, timeout)))
|
||||
sc->started = slave;
|
||||
@ -229,7 +251,7 @@ iicbus_stop(device_t bus)
|
||||
int error = 0;
|
||||
|
||||
if (!sc->started)
|
||||
return (EINVAL); /* bus not started */
|
||||
return (IIC_ESTATUS); /* protocol error, bus not started */
|
||||
|
||||
error = IICBUS_STOP(device_get_parent(bus));
|
||||
|
||||
@ -252,7 +274,7 @@ iicbus_write(device_t bus, const char *buf, int len, int *sent, int timeout)
|
||||
|
||||
/* a slave must have been started for writing */
|
||||
if (sc->started == 0 || (sc->strict != 0 && (sc->started & LSB) != 0))
|
||||
return (EINVAL);
|
||||
return (IIC_ESTATUS);
|
||||
|
||||
return (IICBUS_WRITE(device_get_parent(bus), buf, len, sent, timeout));
|
||||
}
|
||||
@ -270,7 +292,7 @@ iicbus_read(device_t bus, char *buf, int len, int *read, int last, int delay)
|
||||
|
||||
/* a slave must have been started for reading */
|
||||
if (sc->started == 0 || (sc->strict != 0 && (sc->started & LSB) == 0))
|
||||
return (EINVAL);
|
||||
return (IIC_ESTATUS);
|
||||
|
||||
return (IICBUS_READ(device_get_parent(bus), buf, len, read, last, delay));
|
||||
}
|
||||
@ -283,9 +305,14 @@ iicbus_read(device_t bus, char *buf, int len, int *read, int last, int delay)
|
||||
int
|
||||
iicbus_write_byte(device_t bus, char byte, int timeout)
|
||||
{
|
||||
struct iicbus_softc *sc = device_get_softc(bus);
|
||||
char data = byte;
|
||||
int sent;
|
||||
|
||||
/* a slave must have been started for writing */
|
||||
if (sc->started == 0 || (sc->strict != 0 && (sc->started & LSB) != 0))
|
||||
return (IIC_ESTATUS);
|
||||
|
||||
return (iicbus_write(bus, &data, 1, &sent, timeout));
|
||||
}
|
||||
|
||||
@ -297,8 +324,13 @@ iicbus_write_byte(device_t bus, char byte, int timeout)
|
||||
int
|
||||
iicbus_read_byte(device_t bus, char *byte, int timeout)
|
||||
{
|
||||
struct iicbus_softc *sc = device_get_softc(bus);
|
||||
int read;
|
||||
|
||||
/* a slave must have been started for reading */
|
||||
if (sc->started == 0 || (sc->strict != 0 && (sc->started & LSB) == 0))
|
||||
return (IIC_ESTATUS);
|
||||
|
||||
return (iicbus_read(bus, byte, 1, &read, IIC_LAST_READ, timeout));
|
||||
}
|
||||
|
||||
@ -359,6 +391,7 @@ iicbus_block_read(device_t bus, u_char slave, char *buf, int len, int *read)
|
||||
int
|
||||
iicbus_transfer(device_t bus, struct iic_msg *msgs, uint32_t nmsgs)
|
||||
{
|
||||
|
||||
return (IICBUS_TRANSFER(device_get_parent(bus), msgs, nmsgs));
|
||||
}
|
||||
|
||||
@ -375,10 +408,10 @@ iicbus_transfer_gen(device_t dev, struct iic_msg *msgs, uint32_t nmsgs)
|
||||
bool nostop;
|
||||
|
||||
if ((error = device_get_children(dev, &children, &nkid)) != 0)
|
||||
return (error);
|
||||
return (IIC_ERESOURCE);
|
||||
if (nkid != 1) {
|
||||
free(children, M_TEMP);
|
||||
return (EIO);
|
||||
return (IIC_ENOTSUPP);
|
||||
}
|
||||
bus = children[0];
|
||||
rpstart = 0;
|
||||
|
@ -43,6 +43,7 @@
|
||||
#define IIC_NOINTR 0
|
||||
#define IIC_WAIT 0x1
|
||||
#define IIC_INTR 0x2
|
||||
#define IIC_INTRWAIT (IIC_INTR | IIC_WAIT)
|
||||
|
||||
/*
|
||||
* i2c modes
|
||||
@ -82,16 +83,22 @@
|
||||
* adapter layer errors
|
||||
*/
|
||||
#define IIC_NOERR 0x0 /* no error occured */
|
||||
#define IIC_EBUSERR 0x1 /* bus error */
|
||||
#define IIC_EBUSERR 0x1 /* bus error (hardware not in expected state) */
|
||||
#define IIC_ENOACK 0x2 /* ack not received until timeout */
|
||||
#define IIC_ETIMEOUT 0x3 /* timeout */
|
||||
#define IIC_EBUSBSY 0x4 /* bus busy */
|
||||
#define IIC_EBUSBSY 0x4 /* bus busy (reserved by another client) */
|
||||
#define IIC_ESTATUS 0x5 /* status error */
|
||||
#define IIC_EUNDERFLOW 0x6 /* slave ready for more data */
|
||||
#define IIC_EOVERFLOW 0x7 /* too much data */
|
||||
#define IIC_ENOTSUPP 0x8 /* request not supported */
|
||||
#define IIC_ENOADDR 0x9 /* no address assigned to the interface */
|
||||
#define IIC_ERESOURCE 0xa /* resources (memory, whatever) unavailable */
|
||||
|
||||
/*
|
||||
* Note that all iicbus functions return IIC_Exxxxx status values,
|
||||
* except iic2errno() (obviously) and iicbus_started() (returns bool).
|
||||
*/
|
||||
extern int iic2errno(int);
|
||||
extern int iicbus_request_bus(device_t, device_t, int);
|
||||
extern int iicbus_release_bus(device_t, device_t);
|
||||
extern device_t iicbus_alloc_bus(device_t);
|
||||
|
@ -170,7 +170,7 @@ pcf_start(device_t dev, u_char slave, int timeout)
|
||||
printf("pcf: busy!\n");
|
||||
#endif
|
||||
PCF_UNLOCK(sc);
|
||||
return (IIC_EBUSBSY);
|
||||
return (IIC_EBUSERR);
|
||||
}
|
||||
|
||||
/* set slave address to PCF. Last bit (LSB) must be set correctly
|
||||
|
@ -119,6 +119,24 @@ g_nop_start(struct bio *bp)
|
||||
sc->sc_wrotebytes += bp->bio_length;
|
||||
failprob = sc->sc_wfailprob;
|
||||
break;
|
||||
case BIO_DELETE:
|
||||
sc->sc_deletes++;
|
||||
break;
|
||||
case BIO_GETATTR:
|
||||
sc->sc_getattrs++;
|
||||
break;
|
||||
case BIO_FLUSH:
|
||||
sc->sc_flushes++;
|
||||
break;
|
||||
case BIO_CMD0:
|
||||
sc->sc_cmd0s++;
|
||||
break;
|
||||
case BIO_CMD1:
|
||||
sc->sc_cmd1s++;
|
||||
break;
|
||||
case BIO_CMD2:
|
||||
sc->sc_cmd2s++;
|
||||
break;
|
||||
}
|
||||
mtx_unlock(&sc->sc_lock);
|
||||
if (failprob > 0) {
|
||||
@ -238,6 +256,12 @@ g_nop_create(struct gctl_req *req, struct g_class *mp, struct g_provider *pp,
|
||||
sc->sc_wfailprob = wfailprob;
|
||||
sc->sc_reads = 0;
|
||||
sc->sc_writes = 0;
|
||||
sc->sc_deletes = 0;
|
||||
sc->sc_getattrs = 0;
|
||||
sc->sc_flushes = 0;
|
||||
sc->sc_cmd0s = 0;
|
||||
sc->sc_cmd1s = 0;
|
||||
sc->sc_cmd2s = 0;
|
||||
sc->sc_readbytes = 0;
|
||||
sc->sc_wrotebytes = 0;
|
||||
mtx_init(&sc->sc_lock, "gnop lock", NULL, MTX_DEF);
|
||||
@ -602,6 +626,12 @@ g_nop_ctl_reset(struct gctl_req *req, struct g_class *mp)
|
||||
sc = pp->geom->softc;
|
||||
sc->sc_reads = 0;
|
||||
sc->sc_writes = 0;
|
||||
sc->sc_deletes = 0;
|
||||
sc->sc_getattrs = 0;
|
||||
sc->sc_flushes = 0;
|
||||
sc->sc_cmd0s = 0;
|
||||
sc->sc_cmd1s = 0;
|
||||
sc->sc_cmd2s = 0;
|
||||
sc->sc_readbytes = 0;
|
||||
sc->sc_wrotebytes = 0;
|
||||
}
|
||||
@ -659,6 +689,12 @@ g_nop_dumpconf(struct sbuf *sb, const char *indent, struct g_geom *gp,
|
||||
sbuf_printf(sb, "%s<Error>%d</Error>\n", indent, sc->sc_error);
|
||||
sbuf_printf(sb, "%s<Reads>%ju</Reads>\n", indent, sc->sc_reads);
|
||||
sbuf_printf(sb, "%s<Writes>%ju</Writes>\n", indent, sc->sc_writes);
|
||||
sbuf_printf(sb, "%s<Deletes>%ju</Deletes>\n", indent, sc->sc_deletes);
|
||||
sbuf_printf(sb, "%s<Getattrs>%ju</Getattrs>\n", indent, sc->sc_getattrs);
|
||||
sbuf_printf(sb, "%s<Flushes>%ju</Flushes>\n", indent, sc->sc_flushes);
|
||||
sbuf_printf(sb, "%s<Cmd0s>%ju</Cmd0s>\n", indent, sc->sc_cmd0s);
|
||||
sbuf_printf(sb, "%s<Cmd1s>%ju</Cmd1s>\n", indent, sc->sc_cmd1s);
|
||||
sbuf_printf(sb, "%s<Cmd2s>%ju</Cmd2s>\n", indent, sc->sc_cmd2s);
|
||||
sbuf_printf(sb, "%s<ReadBytes>%ju</ReadBytes>\n", indent,
|
||||
sc->sc_readbytes);
|
||||
sbuf_printf(sb, "%s<WroteBytes>%ju</WroteBytes>\n", indent,
|
||||
|
@ -65,6 +65,12 @@ struct g_nop_softc {
|
||||
u_int sc_wfailprob;
|
||||
uintmax_t sc_reads;
|
||||
uintmax_t sc_writes;
|
||||
uintmax_t sc_deletes;
|
||||
uintmax_t sc_getattrs;
|
||||
uintmax_t sc_flushes;
|
||||
uintmax_t sc_cmd0s;
|
||||
uintmax_t sc_cmd1s;
|
||||
uintmax_t sc_cmd2s;
|
||||
uintmax_t sc_readbytes;
|
||||
uintmax_t sc_wrotebytes;
|
||||
struct mtx sc_lock;
|
||||
|
@ -158,16 +158,12 @@ module_register(const moduledata_t *data, linker_file_t container)
|
||||
newmod = module_lookupbyname(data->name);
|
||||
if (newmod != NULL) {
|
||||
MOD_XUNLOCK;
|
||||
printf("module_register: module %s already exists!\n",
|
||||
data->name);
|
||||
printf("%s: cannot register %s from %s; already loaded from %s\n",
|
||||
__func__, data->name, container->filename, newmod->file->filename);
|
||||
return (EEXIST);
|
||||
}
|
||||
namelen = strlen(data->name) + 1;
|
||||
newmod = malloc(sizeof(struct module) + namelen, M_MODULE, M_WAITOK);
|
||||
if (newmod == NULL) {
|
||||
MOD_XUNLOCK;
|
||||
return (ENOMEM);
|
||||
}
|
||||
newmod->refs = 1;
|
||||
newmod->id = nextid++;
|
||||
newmod->name = (char *)(newmod + 1);
|
||||
|
@ -162,7 +162,7 @@ struct shminfo shminfo = {
|
||||
};
|
||||
|
||||
static int shm_use_phys;
|
||||
static int shm_allow_removed;
|
||||
static int shm_allow_removed = 1;
|
||||
|
||||
SYSCTL_ULONG(_kern_ipc, OID_AUTO, shmmax, CTLFLAG_RWTUN, &shminfo.shmmax, 0,
|
||||
"Maximum shared memory segment size");
|
||||
|
@ -127,6 +127,17 @@ hint.ath.0.eepromsize=16384
|
||||
#
|
||||
# bootargs=console=ttyS0,115200 root=31:02 rootfstype=jffs2 init=/sbin/init mtdparts=ath-nor0:256k(u-boot),64k(u-boot-env),6336k(rootfs),1408k(uImage),8256k(mib0),64k(ART)
|
||||
|
||||
# The default flash layout isn't enough to fit a freebsd kernel
|
||||
# now, so the layout has been shuffled around.
|
||||
#
|
||||
# By default it's set to:
|
||||
# 256KB uboot, 64KB uboot-env, 6336KB rootfs, 1344KB kernel, 64KB cfg, 8256MB mib0, 64KB ART
|
||||
# With 'bootcmd=bootm 0x9f680000' in the environment.
|
||||
#
|
||||
# Instead, now let's make it:
|
||||
# 256KB uboot, 64KB uboot-env, 2048MB kernel, 6144MB rootfs, 7644KB mib0, 64KB cfg, 64KB ART
|
||||
# .. and then you change the boot env to be:
|
||||
# 'bootcmd=bootm 0x9f050000'
|
||||
|
||||
# 256KiB u-boot
|
||||
hint.map.0.at="flash/spi0"
|
||||
@ -142,37 +153,37 @@ hint.map.1.end=0x00050000 # 64k u-boot-env
|
||||
hint.map.1.name="u-boot-env"
|
||||
hint.map.1.readonly=1
|
||||
|
||||
# 6336KiB rootfs
|
||||
# 2048KiB kernel
|
||||
hint.map.2.at="flash/spi0"
|
||||
hint.map.2.start=0x00050000
|
||||
hint.map.2.end=0x00680000 # 6336k rootfs
|
||||
hint.map.2.name="rootfs"
|
||||
hint.map.2.end=0x00250000 # 2048k rootfs
|
||||
hint.map.2.name="kernel"
|
||||
hint.map.2.readonly=1
|
||||
|
||||
# 1344KiB uImage
|
||||
# 6144KiB rootfs
|
||||
hint.map.3.at="flash/spi0"
|
||||
hint.map.3.start=0x00680000
|
||||
hint.map.3.end=0x007d0000 # 1408k uImage, 64k off the end..
|
||||
hint.map.3.name="uImage"
|
||||
hint.map.3.start=0x00250000
|
||||
hint.map.3.end=0x00850000
|
||||
hint.map.3.name="rootfs"
|
||||
hint.map.3.readonly=1
|
||||
|
||||
# 64KiB cfg
|
||||
# 7644KiB mib0
|
||||
hint.map.4.at="flash/spi0"
|
||||
hint.map.4.start=0x007d0000
|
||||
hint.map.4.end=0x007e0000
|
||||
hint.map.4.name="cfg"
|
||||
hint.map.4.start=0x00850000
|
||||
hint.map.4.end=0x00fe0000
|
||||
hint.map.4.name="mib0"
|
||||
hint.map.4.readonly=0
|
||||
|
||||
# 8256 KiB mib0
|
||||
# 64KiB cfg
|
||||
hint.map.5.at="flash/spi0"
|
||||
hint.map.5.start=0x007e0000
|
||||
hint.map.5.end=0x00ff0000 # 64k mib0
|
||||
hint.map.5.name="mib0"
|
||||
hint.map.5.readonly=1
|
||||
hint.map.5.start=0x00fe0000
|
||||
hint.map.5.end=0x00ff0000
|
||||
hint.map.5.name="cfg"
|
||||
hint.map.5.readonly=0
|
||||
|
||||
# 64KiB ART
|
||||
hint.map.6.at="flash/spi0"
|
||||
hint.map.6.start=0x007f0000
|
||||
hint.map.6.start=0x00ff0000
|
||||
hint.map.6.end=0x01000000 # 64k ART
|
||||
hint.map.6.name="ART"
|
||||
hint.map.6.readonly=1
|
||||
|
@ -50,16 +50,6 @@ device geom_uncompress
|
||||
# Used for the static uboot partition map
|
||||
device geom_map
|
||||
|
||||
# Boot off of the rootfs, as defined in the geom_map setup.
|
||||
# Probably, this should be a USB device as the memory available
|
||||
# compressed rootfs is simply too small for FreeBSD
|
||||
#options ROOTDEVNAME=\"ufs:map/rootfs.uncompress\"
|
||||
|
||||
# Boot off of a uboot tftp ramdisk kernel image. Because the flash
|
||||
# on this unit is so small, this is the only way to do dev work.
|
||||
# For full deployment, you will *have* to use a usb storage device
|
||||
# as a rootfs and use the flash to hold the kernel only.
|
||||
options MD_ROOT # md device usable as a potential root device
|
||||
options MD_ROOT_SIZE=10240
|
||||
#makeoptions MFS_IMAGE=/tftpboot/mfsroot-tl-mr3020.img.ulzma
|
||||
options ROOTDEVNAME=\"ufs:md0.uncompress\"
|
||||
# With only 4MB of flash, we are stuck using USB
|
||||
# for the rootfs.
|
||||
options ROOTDEVNAME=\"ufs:da0\"
|
||||
|
@ -284,7 +284,7 @@ i2c_start(device_t dev, u_char slave, int timeout)
|
||||
debugf("bus busy");
|
||||
mtx_unlock(&sc->mutex);
|
||||
i2c_stop(dev);
|
||||
return (IIC_EBUSBSY);
|
||||
return (IIC_EBUSERR);
|
||||
}
|
||||
|
||||
/* Set start condition */
|
||||
|
@ -21,6 +21,9 @@ PPP_NO_PAM=
|
||||
PPP_NO_RADIUS=
|
||||
PPP_NO_SUID=
|
||||
.endif
|
||||
CONFS= ppp.conf
|
||||
CONFSDIR= ${CONFIGDIR}/ppp
|
||||
CONFSMODE= 600
|
||||
|
||||
.if ${MK_ATM} == "no"
|
||||
PPP_NO_ATM=
|
||||
|
Loading…
Reference in New Issue
Block a user