[Midnightbsd-cvs] src [10067] trunk/sys/dev/smc: sync up
laffer1 at midnightbsd.org
laffer1 at midnightbsd.org
Sun May 27 19:10:36 EDT 2018
Revision: 10067
http://svnweb.midnightbsd.org/src/?rev=10067
Author: laffer1
Date: 2018-05-27 19:10:35 -0400 (Sun, 27 May 2018)
Log Message:
-----------
sync up
Modified Paths:
--------------
trunk/sys/dev/sio/sio.c
trunk/sys/dev/sio/sio_isa.c
trunk/sys/dev/sio/sio_pccard.c
trunk/sys/dev/sio/sio_pci.c
trunk/sys/dev/sio/sio_puc.c
trunk/sys/dev/sio/sioreg.h
trunk/sys/dev/sio/siovar.h
trunk/sys/dev/sis/if_sis.c
trunk/sys/dev/sis/if_sisreg.h
trunk/sys/dev/sk/if_sk.c
trunk/sys/dev/sk/if_skreg.h
trunk/sys/dev/sk/xmaciireg.h
trunk/sys/dev/sk/yukonreg.h
trunk/sys/dev/smbus/smb.c
trunk/sys/dev/smbus/smb.h
trunk/sys/dev/smbus/smbconf.c
trunk/sys/dev/smbus/smbconf.h
trunk/sys/dev/smbus/smbus.c
trunk/sys/dev/smbus/smbus.h
trunk/sys/dev/smbus/smbus_if.m
trunk/sys/dev/smc/if_smc.c
trunk/sys/dev/smc/if_smcreg.h
trunk/sys/dev/smc/if_smcvar.h
Property Changed:
----------------
trunk/sys/dev/smbus/smbus_if.m
Modified: trunk/sys/dev/sio/sio.c
===================================================================
--- trunk/sys/dev/sio/sio.c 2018-05-27 23:10:16 UTC (rev 10066)
+++ trunk/sys/dev/sio/sio.c 2018-05-27 23:10:35 UTC (rev 10067)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 1991 The Regents of the University of California.
* All rights reserved.
@@ -31,7 +32,7 @@
*/
#include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/sys/dev/sio/sio.c 237693 2012-06-28 07:28:39Z imp $");
#include "opt_compat.h"
#include "opt_gdb.h"
@@ -278,6 +279,11 @@
/* table and macro for fast conversion from a unit number to its com struct */
devclass_t sio_devclass;
+/*
+ * XXX Assmues that devclass_get_device, devclass_get_softc and
+ * device_get_softc are fast interrupt safe. The current implementation
+ * of these functions are.
+ */
#define com_addr(unit) ((struct com_s *) \
devclass_get_softc(sio_devclass, unit)) /* XXX */
Modified: trunk/sys/dev/sio/sio_isa.c
===================================================================
--- trunk/sys/dev/sio/sio_isa.c 2018-05-27 23:10:16 UTC (rev 10066)
+++ trunk/sys/dev/sio/sio_isa.c 2018-05-27 23:10:35 UTC (rev 10067)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 2001 M. Warner Losh. All rights reserved.
*
@@ -23,7 +24,7 @@
*/
#include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/sys/dev/sio/sio_isa.c 242996 2012-11-13 20:38:55Z eadler $");
#include "opt_sio.h"
Modified: trunk/sys/dev/sio/sio_pccard.c
===================================================================
--- trunk/sys/dev/sio/sio_pccard.c 2018-05-27 23:10:16 UTC (rev 10066)
+++ trunk/sys/dev/sio/sio_pccard.c 2018-05-27 23:10:35 UTC (rev 10067)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 2001 M. Warner Losh. All rights reserved.
*
@@ -23,7 +24,7 @@
*/
#include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/sys/dev/sio/sio_pccard.c 162294 2006-09-14 03:47:59Z jmg $");
#include <sys/param.h>
#include <sys/systm.h>
Modified: trunk/sys/dev/sio/sio_pci.c
===================================================================
--- trunk/sys/dev/sio/sio_pci.c 2018-05-27 23:10:16 UTC (rev 10066)
+++ trunk/sys/dev/sio/sio_pci.c 2018-05-27 23:10:35 UTC (rev 10067)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 2001 M. Warner Losh. All rights reserved.
*
@@ -23,7 +24,7 @@
*/
#include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/sys/dev/sio/sio_pci.c 227532 2011-11-15 17:15:09Z eadler $");
#include <sys/param.h>
#include <sys/systm.h>
Modified: trunk/sys/dev/sio/sio_puc.c
===================================================================
--- trunk/sys/dev/sio/sio_puc.c 2018-05-27 23:10:16 UTC (rev 10066)
+++ trunk/sys/dev/sio/sio_puc.c 2018-05-27 23:10:35 UTC (rev 10067)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 2002 JF Hay. All rights reserved.
* Copyright (c) 2001 M. Warner Losh. All rights reserved.
@@ -24,7 +25,7 @@
*/
#include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/sys/dev/sio/sio_puc.c 185059 2008-11-18 21:01:54Z jhb $");
#include <sys/param.h>
#include <sys/systm.h>
Modified: trunk/sys/dev/sio/sioreg.h
===================================================================
--- trunk/sys/dev/sio/sioreg.h 2018-05-27 23:10:16 UTC (rev 10066)
+++ trunk/sys/dev/sio/sioreg.h 2018-05-27 23:10:35 UTC (rev 10067)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 1991 The Regents of the University of California.
* All rights reserved.
@@ -27,7 +28,7 @@
* SUCH DAMAGE.
*
* from: @(#)comreg.h 7.2 (Berkeley) 5/9/91
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/dev/sio/sioreg.h 128019 2004-04-07 20:46:16Z imp $
*/
/* Receiver clock frequency for "standard" pc serial ports. */
Modified: trunk/sys/dev/sio/siovar.h
===================================================================
--- trunk/sys/dev/sio/siovar.h 2018-05-27 23:10:16 UTC (rev 10066)
+++ trunk/sys/dev/sio/siovar.h 2018-05-27 23:10:35 UTC (rev 10067)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 1991 The Regents of the University of California.
* All rights reserved.
@@ -26,7 +27,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/dev/sio/siovar.h 128019 2004-04-07 20:46:16Z imp $
*/
#ifdef PC98
Modified: trunk/sys/dev/sis/if_sis.c
===================================================================
--- trunk/sys/dev/sis/if_sis.c 2018-05-27 23:10:16 UTC (rev 10066)
+++ trunk/sys/dev/sis/if_sis.c 2018-05-27 23:10:35 UTC (rev 10067)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 2005 Poul-Henning Kamp <phk at FreeBSD.org>
* Copyright (c) 1997, 1998, 1999
@@ -32,7 +33,7 @@
*/
#include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/sys/dev/sis/if_sis.c 280657 2015-03-26 04:55:22Z yongari $");
/*
* SiS 900/SiS 7016 fast ethernet PCI NIC driver. Datasheets are
@@ -757,7 +758,8 @@
if_maddr_runlock(ifp);
}
- CSR_WRITE_4(sc, SIS_RXFILT_CTL, filter);
+ /* Turn the receive filter on */
+ CSR_WRITE_4(sc, SIS_RXFILT_CTL, filter | SIS_RXFILTCTL_ENABLE);
CSR_READ_4(sc, SIS_RXFILT_CTL);
}
@@ -779,7 +781,7 @@
filter = CSR_READ_4(sc, SIS_RXFILT_CTL);
if (filter & SIS_RXFILTCTL_ENABLE) {
- CSR_WRITE_4(sc, SIS_RXFILT_CTL, filter & ~SIS_RXFILT_CTL);
+ CSR_WRITE_4(sc, SIS_RXFILT_CTL, filter & ~SIS_RXFILTCTL_ENABLE);
CSR_READ_4(sc, SIS_RXFILT_CTL);
}
filter &= ~(SIS_RXFILTCTL_ALLPHYS | SIS_RXFILTCTL_BROAD |
@@ -819,7 +821,8 @@
CSR_WRITE_4(sc, SIS_RXFILT_DATA, hashes[i]);
}
- CSR_WRITE_4(sc, SIS_RXFILT_CTL, filter);
+ /* Turn the receive filter on */
+ CSR_WRITE_4(sc, SIS_RXFILT_CTL, filter | SIS_RXFILTCTL_ENABLE);
CSR_READ_4(sc, SIS_RXFILT_CTL);
}
@@ -1054,7 +1057,6 @@
}
ifp->if_softc = sc;
if_initname(ifp, device_get_name(dev), device_get_unit(dev));
- ifp->if_mtu = ETHERMTU;
ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST;
ifp->if_ioctl = sis_ioctl;
ifp->if_start = sis_start;
@@ -1617,11 +1619,9 @@
{
struct sis_softc *sc;
struct mii_data *mii;
- struct ifnet *ifp;
sc = xsc;
SIS_LOCK_ASSERT(sc);
- ifp = sc->sis_ifp;
mii = device_get_softc(sc->sis_miibus);
mii_tick(mii);
@@ -2017,8 +2017,6 @@
}
sis_rxfilter(sc);
- /* Turn the receive filter on */
- SIS_SETBIT(sc, SIS_RXFILT_CTL, SIS_RXFILTCTL_ENABLE);
/*
* Load the address of the RX and TX lists.
@@ -2140,7 +2138,8 @@
case SIOCADDMULTI:
case SIOCDELMULTI:
SIS_LOCK(sc);
- sis_rxfilter(sc);
+ if ((ifp->if_drv_flags & IFF_DRV_RUNNING) != 0)
+ sis_rxfilter(sc);
SIS_UNLOCK(sc);
break;
case SIOCGIFMEDIA:
Modified: trunk/sys/dev/sis/if_sisreg.h
===================================================================
--- trunk/sys/dev/sis/if_sisreg.h 2018-05-27 23:10:16 UTC (rev 10066)
+++ trunk/sys/dev/sis/if_sisreg.h 2018-05-27 23:10:35 UTC (rev 10067)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 1997, 1998, 1999
* Bill Paul <wpaul at ee.columbia.edu>. All rights reserved.
@@ -29,7 +30,7 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/dev/sis/if_sisreg.h 248456 2013-03-18 04:46:17Z yongari $
*/
/*
Modified: trunk/sys/dev/sk/if_sk.c
===================================================================
--- trunk/sys/dev/sk/if_sk.c 2018-05-27 23:10:16 UTC (rev 10066)
+++ trunk/sys/dev/sk/if_sk.c 2018-05-27 23:10:35 UTC (rev 10067)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/* $OpenBSD: if_sk.c,v 2.33 2003/08/12 05:23:06 nate Exp $ */
/*-
@@ -48,7 +49,7 @@
*/
#include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/sys/dev/sk/if_sk.c 266921 2014-05-31 11:08:22Z brueffer $");
/*
* SysKonnect SK-NET gigabit ethernet driver for FreeBSD. Supports
@@ -138,11 +139,6 @@
/* "device miibus" required. See GENERIC if you get errors here. */
#include "miibus_if.h"
-#ifndef lint
-static const char rcsid[] =
- "$MidnightBSD$";
-#endif
-
static const struct sk_type sk_devs[] = {
{
VENDORID_SK,
@@ -1353,7 +1349,6 @@
}
ifp->if_softc = sc_if;
if_initname(ifp, device_get_name(dev), device_get_unit(dev));
- ifp->if_mtu = ETHERMTU;
ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST;
/*
* SK_GENESIS has a bug in checksum offload - From linux.
@@ -2882,13 +2877,11 @@
sk_txeof(sc_if)
struct sk_if_softc *sc_if;
{
- struct sk_softc *sc;
struct sk_txdesc *txd;
struct sk_tx_desc *cur_tx;
struct ifnet *ifp;
u_int32_t idx, sk_ctl;
- sc = sc_if->sk_softc;
ifp = sc_if->sk_ifp;
txd = STAILQ_FIRST(&sc_if->sk_cdata.sk_txbusyq);
Modified: trunk/sys/dev/sk/if_skreg.h
===================================================================
--- trunk/sys/dev/sk/if_skreg.h 2018-05-27 23:10:16 UTC (rev 10066)
+++ trunk/sys/dev/sk/if_skreg.h 2018-05-27 23:10:35 UTC (rev 10067)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/* $OpenBSD: if_skreg.h,v 1.10 2003/08/12 05:23:06 nate Exp $ */
/*-
@@ -31,7 +32,7 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/dev/sk/if_skreg.h 251133 2013-05-30 12:16:55Z marius $
*/
/*-
Modified: trunk/sys/dev/sk/xmaciireg.h
===================================================================
--- trunk/sys/dev/sk/xmaciireg.h 2018-05-27 23:10:16 UTC (rev 10066)
+++ trunk/sys/dev/sk/xmaciireg.h 2018-05-27 23:10:35 UTC (rev 10067)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 1997, 1998, 1999, 2000
* Bill Paul <wpaul at ctr.columbia.edu>. All rights reserved.
@@ -29,7 +30,7 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/dev/sk/xmaciireg.h 158070 2006-04-27 05:59:09Z yongari $
*/
/*
Modified: trunk/sys/dev/sk/yukonreg.h
===================================================================
--- trunk/sys/dev/sk/yukonreg.h 2018-05-27 23:10:16 UTC (rev 10066)
+++ trunk/sys/dev/sk/yukonreg.h 2018-05-27 23:10:35 UTC (rev 10067)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/* $OpenBSD: yukonreg.h,v 1.2 2003/08/12 05:23:06 nate Exp $ */
/*-
* Copyright (c) 2003 Nathan L. Binkert <binkertn at umich.edu>
@@ -14,7 +15,7 @@
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/dev/sk/yukonreg.h 158070 2006-04-27 05:59:09Z yongari $
*/
/* General Purpose Status Register (GPSR) */
Modified: trunk/sys/dev/smbus/smb.c
===================================================================
--- trunk/sys/dev/smbus/smb.c 2018-05-27 23:10:16 UTC (rev 10066)
+++ trunk/sys/dev/smbus/smb.c 2018-05-27 23:10:35 UTC (rev 10067)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 1998, 2001 Nicolas Souchu
* All rights reserved.
@@ -23,7 +24,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/dev/smbus/smb.c 188077 2009-02-03 16:14:37Z jhb $
*/
#ifdef HAVE_KERNEL_OPTION_HEADERS
Modified: trunk/sys/dev/smbus/smb.h
===================================================================
--- trunk/sys/dev/smbus/smb.h 2018-05-27 23:10:16 UTC (rev 10066)
+++ trunk/sys/dev/smbus/smb.h 2018-05-27 23:10:35 UTC (rev 10067)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 1998 Nicolas Souchu
* All rights reserved.
@@ -23,7 +24,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/dev/smbus/smb.h 162234 2006-09-11 20:52:41Z jhb $
*
*/
#ifndef __SMB_H
Modified: trunk/sys/dev/smbus/smbconf.c
===================================================================
--- trunk/sys/dev/smbus/smbconf.c 2018-05-27 23:10:16 UTC (rev 10066)
+++ trunk/sys/dev/smbus/smbconf.c 2018-05-27 23:10:35 UTC (rev 10067)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 1998, 2001 Nicolas Souchu
* All rights reserved.
@@ -27,7 +28,7 @@
*/
#include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/sys/dev/smbus/smbconf.c 162234 2006-09-11 20:52:41Z jhb $");
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/lock.h>
Modified: trunk/sys/dev/smbus/smbconf.h
===================================================================
--- trunk/sys/dev/smbus/smbconf.h 2018-05-27 23:10:16 UTC (rev 10066)
+++ trunk/sys/dev/smbus/smbconf.h 2018-05-27 23:10:35 UTC (rev 10067)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 1998 Nicolas Souchu
* All rights reserved.
@@ -23,7 +24,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/dev/smbus/smbconf.h 310062 2016-12-14 15:38:28Z avg $
*/
#ifndef __SMBONF_H
#define __SMBONF_H
@@ -34,6 +35,10 @@
#define n(flags) (~(flags) & (flags))
+/* Order constants for smbus children. */
+#define SMBUS_ORDER_HINTED 20
+#define SMBUS_ORDER_PNP 40
+
/*
* How tsleep() is called in smb_request_bus().
*/
@@ -70,7 +75,9 @@
/*
* ivars codes
*/
-#define SMBUS_IVAR_ADDR 0x1 /* slave address of the device */
+enum smbus_ivars {
+ SMBUS_IVAR_ADDR, /* slave address of the device */
+};
int smbus_request_bus(device_t, device_t, int);
int smbus_release_bus(device_t, device_t);
@@ -79,8 +86,13 @@
void smbus_intr(device_t, u_char, char low, char high, int error);
-u_char smbus_get_addr(device_t);
+#define SMBUS_ACCESSOR(var, ivar, type) \
+ __BUS_ACCESSOR(smbus, var, SMBUS, ivar, type)
+SMBUS_ACCESSOR(addr, ADDR, int)
+
+#undef SMBUS_ACCESSOR
+
extern driver_t smbus_driver;
extern devclass_t smbus_devclass;
Modified: trunk/sys/dev/smbus/smbus.c
===================================================================
--- trunk/sys/dev/smbus/smbus.c 2018-05-27 23:10:16 UTC (rev 10066)
+++ trunk/sys/dev/smbus/smbus.c 2018-05-27 23:10:35 UTC (rev 10067)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 1998, 2001 Nicolas Souchu
* All rights reserved.
@@ -27,53 +28,28 @@
*/
#include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/sys/dev/smbus/smbus.c 308042 2016-10-28 15:02:24Z avg $");
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/lock.h>
+#include <sys/malloc.h>
#include <sys/module.h>
#include <sys/mutex.h>
-#include <sys/bus.h>
+#include <sys/bus.h>
#include <dev/smbus/smbconf.h>
#include <dev/smbus/smbus.h>
-/*
- * Autoconfiguration and support routines for System Management bus
- */
-/*
- * Device methods
- */
-static int smbus_probe(device_t);
-static int smbus_attach(device_t);
-static int smbus_detach(device_t);
-
-static device_method_t smbus_methods[] = {
- /* device interface */
- DEVMETHOD(device_probe, smbus_probe),
- DEVMETHOD(device_attach, smbus_attach),
- DEVMETHOD(device_detach, smbus_detach),
-
- /* bus interface */
- DEVMETHOD(bus_add_child, bus_generic_add_child),
-
- DEVMETHOD_END
+struct smbus_ivar
+{
+ uint8_t addr;
};
-driver_t smbus_driver = {
- "smbus",
- smbus_methods,
- sizeof(struct smbus_softc),
-};
-
-devclass_t smbus_devclass;
-
/*
- * At 'probe' time, we add all the devices which we know about to the
- * bus. The generic attach routine will probe and attach them if they
- * are alive.
+ * Autoconfiguration and support routines for System Management bus
*/
+
static int
smbus_probe(device_t dev)
{
@@ -90,6 +66,7 @@
mtx_init(&sc->lock, device_get_nameunit(dev), "smbus", MTX_DEF);
bus_generic_probe(dev);
+ bus_enumerate_hinted_children(dev);
bus_generic_attach(dev);
return (0);
@@ -104,6 +81,7 @@
error = bus_generic_detach(dev);
if (error)
return (error);
+ device_delete_children(dev);
mtx_destroy(&sc->lock);
return (0);
@@ -114,4 +92,154 @@
{
}
+static device_t
+smbus_add_child(device_t dev, u_int order, const char *name, int unit)
+{
+ struct smbus_ivar *devi;
+ device_t child;
+
+ child = device_add_child_ordered(dev, order, name, unit);
+ if (child == NULL)
+ return (child);
+ devi = malloc(sizeof(struct smbus_ivar), M_DEVBUF, M_NOWAIT | M_ZERO);
+ if (devi == NULL) {
+ device_delete_child(dev, child);
+ return (NULL);
+ }
+ device_set_ivars(child, devi);
+ return (child);
+}
+
+static void
+smbus_hinted_child(device_t bus, const char *dname, int dunit)
+{
+ struct smbus_ivar *devi;
+ device_t child;
+ int addr;
+
+ addr = 0;
+ resource_int_value(dname, dunit, "addr", &addr);
+ if (addr > UINT8_MAX) {
+ device_printf(bus, "ignored incorrect slave address hint 0x%x"
+ " for %s%d\n", addr, dname, dunit);
+ return;
+ }
+ child = BUS_ADD_CHILD(bus, SMBUS_ORDER_HINTED, dname, dunit);
+ if (child == NULL)
+ return;
+ devi = device_get_ivars(child);
+ devi->addr = addr;
+}
+
+
+static int
+smbus_child_location_str(device_t parent, device_t child, char *buf,
+ size_t buflen)
+{
+ struct smbus_ivar *devi;
+
+ devi = device_get_ivars(child);
+ if (devi->addr != 0)
+ snprintf(buf, buflen, "addr=0x%x", devi->addr);
+ else if (buflen)
+ buf[0] = 0;
+ return (0);
+}
+
+static int
+smbus_print_child(device_t parent, device_t child)
+{
+ struct smbus_ivar *devi;
+ int retval;
+
+ devi = device_get_ivars(child);
+ retval = bus_print_child_header(parent, child);
+ if (devi->addr != 0)
+ retval += printf(" at addr 0x%x", devi->addr);
+ retval += bus_print_child_footer(parent, child);
+
+ return (retval);
+}
+
+static int
+smbus_read_ivar(device_t parent, device_t child, int which, uintptr_t *result)
+{
+ struct smbus_ivar *devi;
+
+ devi = device_get_ivars(child);
+ switch (which) {
+ case SMBUS_IVAR_ADDR:
+ if (devi->addr != 0)
+ *result = devi->addr;
+ else
+ *result = -1;
+ break;
+ default:
+ return (ENOENT);
+ }
+ return (0);
+}
+
+static int
+smbus_write_ivar(device_t parent, device_t child, int which, uintptr_t value)
+{
+ struct smbus_ivar *devi;
+
+ devi = device_get_ivars(child);
+ switch (which) {
+ case SMBUS_IVAR_ADDR:
+ /* Allow to set but no change the slave address. */
+ if (devi->addr != 0)
+ return (EINVAL);
+ devi->addr = value;
+ break;
+ default:
+ return (ENOENT);
+ }
+ return (0);
+}
+
+static void
+smbus_probe_nomatch(device_t bus, device_t child)
+{
+ struct smbus_ivar *devi = device_get_ivars(child);
+
+ /*
+ * Ignore (self-identified) devices without a slave address set.
+ * For example, smb(4).
+ */
+ if (devi->addr != 0)
+ device_printf(bus, "<unknown device> at addr %#x\n",
+ devi->addr);
+}
+
+/*
+ * Device methods
+ */
+static device_method_t smbus_methods[] = {
+ /* device interface */
+ DEVMETHOD(device_probe, smbus_probe),
+ DEVMETHOD(device_attach, smbus_attach),
+ DEVMETHOD(device_detach, smbus_detach),
+
+ /* bus interface */
+ DEVMETHOD(bus_add_child, smbus_add_child),
+ DEVMETHOD(bus_hinted_child, smbus_hinted_child),
+ DEVMETHOD(bus_probe_nomatch, smbus_probe_nomatch),
+ DEVMETHOD(bus_child_location_str, smbus_child_location_str),
+ DEVMETHOD(bus_print_child, smbus_print_child),
+ DEVMETHOD(bus_read_ivar, smbus_read_ivar),
+ DEVMETHOD(bus_write_ivar, smbus_write_ivar),
+
+ DEVMETHOD_END
+};
+
+driver_t smbus_driver = {
+ "smbus",
+ smbus_methods,
+ sizeof(struct smbus_softc),
+};
+
+devclass_t smbus_devclass;
+
MODULE_VERSION(smbus, SMBUS_MODVER);
Modified: trunk/sys/dev/smbus/smbus.h
===================================================================
--- trunk/sys/dev/smbus/smbus.h 2018-05-27 23:10:16 UTC (rev 10066)
+++ trunk/sys/dev/smbus/smbus.h 2018-05-27 23:10:35 UTC (rev 10067)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 1998 Nicolas Souchu
* All rights reserved.
@@ -23,7 +24,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/dev/smbus/smbus.h 189580 2009-03-09 13:30:00Z imp $
*
*/
#ifndef __SMBUS_H
Modified: trunk/sys/dev/smbus/smbus_if.m
===================================================================
--- trunk/sys/dev/smbus/smbus_if.m 2018-05-27 23:10:16 UTC (rev 10066)
+++ trunk/sys/dev/smbus/smbus_if.m 2018-05-27 23:10:35 UTC (rev 10067)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
#-
# Copyright (c) 1998 Nicolas Souchu
# All rights reserved.
@@ -23,7 +24,7 @@
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
#
-# $MidnightBSD$
+# $FreeBSD: stable/10/sys/dev/smbus/smbus_if.m 162234 2006-09-11 20:52:41Z jhb $
#
#include <sys/bus.h>
Property changes on: trunk/sys/dev/smbus/smbus_if.m
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/sys/dev/smc/if_smc.c
===================================================================
--- trunk/sys/dev/smc/if_smc.c 2018-05-27 23:10:16 UTC (rev 10066)
+++ trunk/sys/dev/smc/if_smc.c 2018-05-27 23:10:35 UTC (rev 10067)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 2008 Benno Rice. All rights reserved.
*
@@ -23,7 +24,7 @@
*/
#include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/sys/dev/smc/if_smc.c 244169 2012-12-13 03:33:01Z gonzo $");
/*
* Driver for SMSC LAN91C111, may work for older variants.
@@ -807,6 +808,10 @@
struct smc_softc *sc;
sc = (struct smc_softc *)context;
+ /*
+ * Block interrupts in order to let smc_task_intr to kick in
+ */
+ smc_write_1(sc, MSK, 0);
taskqueue_enqueue_fast(sc->smc_tq, &sc->smc_intr);
return (FILTER_HANDLED);
}
@@ -827,13 +832,6 @@
smc_select_bank(sc, 2);
/*
- * Get the current mask, and then block all interrupts while we're
- * working.
- */
- if ((ifp->if_capenable & IFCAP_POLLING) == 0)
- smc_write_1(sc, MSK, 0);
-
- /*
* Find out what interrupts are flagged.
*/
status = smc_read_1(sc, IST) & sc->smc_mask;
@@ -1237,10 +1235,11 @@
{
struct ifnet *ifp;
+ SMC_ASSERT_LOCKED(sc);
ifp = sc->smc_ifp;
+ if ((ifp->if_drv_flags & IFF_DRV_RUNNING) != 0)
+ return;
- SMC_ASSERT_LOCKED(sc);
-
smc_reset(sc);
smc_enable(sc);
Modified: trunk/sys/dev/smc/if_smcreg.h
===================================================================
--- trunk/sys/dev/smc/if_smcreg.h 2018-05-27 23:10:16 UTC (rev 10066)
+++ trunk/sys/dev/smc/if_smcreg.h 2018-05-27 23:10:35 UTC (rev 10067)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 2006 Benno Rice. All rights reserved.
*
@@ -21,7 +22,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/dev/smc/if_smcreg.h 179592 2008-06-06 05:00:49Z benno $
*
*/
Modified: trunk/sys/dev/smc/if_smcvar.h
===================================================================
--- trunk/sys/dev/smc/if_smcvar.h 2018-05-27 23:10:16 UTC (rev 10066)
+++ trunk/sys/dev/smc/if_smcvar.h 2018-05-27 23:10:35 UTC (rev 10067)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 2008 Benno Rice. All rights reserved.
*
@@ -21,7 +22,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/dev/smc/if_smcvar.h 194024 2009-06-11 17:14:54Z avg $
*
*/
More information about the Midnightbsd-cvs
mailing list