attansic: Upgrade to FreeBSD 12.

This commit is contained in:
Augustin Cavalier
2018-12-27 16:53:47 -05:00
parent ca813faa3c
commit 3bfc859a38
10 changed files with 45 additions and 34 deletions
@@ -1,4 +1,6 @@
/*- /*-
* SPDX-License-Identifier: BSD-2-Clause-FreeBSD
*
* Copyright (c) 2008, Pyun YongHyeon <[email protected]> * Copyright (c) 2008, Pyun YongHyeon <[email protected]>
* All rights reserved. * All rights reserved.
* *
@@ -28,7 +30,7 @@
/* Driver for Attansic Technology Corp. L1 Gigabit Ethernet. */ /* Driver for Attansic Technology Corp. L1 Gigabit Ethernet. */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__FBSDID("$FreeBSD$"); __FBSDID("$FreeBSD: releng/12.0/sys/dev/age/if_age.c 338948 2018-09-26 17:12:14Z imp $");
#include <sys/param.h> #include <sys/param.h>
#include <sys/systm.h> #include <sys/systm.h>
@@ -181,6 +183,8 @@ static driver_t age_driver = {
static devclass_t age_devclass; static devclass_t age_devclass;
DRIVER_MODULE(age, pci, age_driver, age_devclass, 0, 0); DRIVER_MODULE(age, pci, age_driver, age_devclass, 0, 0);
MODULE_PNP_INFO("U16:vendor;U16:device;D:#", pci, age, age_devs,
nitems(age_devs));
DRIVER_MODULE(miibus, age, miibus_driver, miibus_devclass, 0, 0); DRIVER_MODULE(miibus, age, miibus_driver, miibus_devclass, 0, 0);
static struct resource_spec age_res_spec_mem[] = { static struct resource_spec age_res_spec_mem[] = {
@@ -1401,11 +1405,7 @@ age_setwol(struct age_softc *sc)
} }
} }
AGE_UNLOCK(sc); AGE_UNLOCK(sc);
#ifdef __HAIKU__
DELAY(1);
#else
pause("agelnk", hz); pause("agelnk", hz);
#endif
AGE_LOCK(sc); AGE_LOCK(sc);
} }
if (i == MII_ANEGTICKS_GIGE) if (i == MII_ANEGTICKS_GIGE)
@@ -2165,11 +2165,6 @@ age_int_task(void *arg, int pending)
sc->age_cdata.age_cmb_block_map, sc->age_cdata.age_cmb_block_map,
BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE);
#if 0
printf("INTR: 0x%08x\n", status);
status &= ~INTR_DIS_DMA;
CSR_WRITE_4(sc, AGE_INTR_STATUS, status | INTR_DIS_INT);
#endif
ifp = sc->age_ifp; ifp = sc->age_ifp;
if ((ifp->if_drv_flags & IFF_DRV_RUNNING) != 0) { if ((ifp->if_drv_flags & IFF_DRV_RUNNING) != 0) {
if ((status & INTR_CMB_RX) != 0) if ((status & INTR_CMB_RX) != 0)
@@ -1,4 +1,6 @@
/*- /*-
* SPDX-License-Identifier: BSD-2-Clause-FreeBSD
*
* Copyright (c) 2008, Pyun YongHyeon <yongari@FreeBSD.org> * Copyright (c) 2008, Pyun YongHyeon <yongari@FreeBSD.org>
* All rights reserved. * All rights reserved.
* *
@@ -24,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE. * SUCH DAMAGE.
* *
* $FreeBSD$ * $FreeBSD: releng/12.0/sys/dev/age/if_agereg.h 326255 2017-11-27 14:52:40Z pfg $
*/ */
#ifndef _IF_AGEREG_H #ifndef _IF_AGEREG_H
@@ -1,4 +1,6 @@
/*- /*-
* SPDX-License-Identifier: BSD-2-Clause-FreeBSD
*
* Copyright (c) 2008, Pyun YongHyeon <yongari@FreeBSD.org> * Copyright (c) 2008, Pyun YongHyeon <yongari@FreeBSD.org>
* All rights reserved. * All rights reserved.
* *
@@ -24,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE. * SUCH DAMAGE.
* *
* $FreeBSD$ * $FreeBSD: releng/12.0/sys/dev/age/if_agevar.h 326255 2017-11-27 14:52:40Z pfg $
*/ */
#ifndef _IF_AGEVAR_H #ifndef _IF_AGEVAR_H
@@ -1,4 +1,6 @@
/*- /*-
* SPDX-License-Identifier: BSD-2-Clause-FreeBSD
*
* Copyright (c) 2008, Pyun YongHyeon <yongari@FreeBSD.org> * Copyright (c) 2008, Pyun YongHyeon <yongari@FreeBSD.org>
* All rights reserved. * All rights reserved.
* *
@@ -26,7 +28,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__FBSDID("$FreeBSD$"); __FBSDID("$FreeBSD: releng/12.0/sys/dev/mii/atphy.c 326255 2017-11-27 14:52:40Z pfg $");
/* /*
* Driver for the Attansic/Atheros F1 10/100/1000 PHY. * Driver for the Attansic/Atheros F1 10/100/1000 PHY.
@@ -1,4 +1,6 @@
/*- /*-
* SPDX-License-Identifier: BSD-2-Clause-FreeBSD
*
* Copyright (c) 2008, Pyun YongHyeon * Copyright (c) 2008, Pyun YongHyeon
* All rights reserved. * All rights reserved.
* *
@@ -24,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE. * SUCH DAMAGE.
* *
* $FreeBSD$ * $FreeBSD: releng/12.0/sys/dev/mii/atphyreg.h 326255 2017-11-27 14:52:40Z pfg $
*/ */
#ifndef _DEV_MII_ATPHYREG_H_ #ifndef _DEV_MII_ATPHYREG_H_
@@ -1,4 +1,6 @@
/*- /*-
* SPDX-License-Identifier: BSD-2-Clause-FreeBSD
*
* Copyright (c) 2008 Stanislav Sedov <stas@FreeBSD.org>. * Copyright (c) 2008 Stanislav Sedov <stas@FreeBSD.org>.
* All rights reserved. * All rights reserved.
* *
@@ -28,7 +30,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__FBSDID("$FreeBSD$"); __FBSDID("$FreeBSD: releng/12.0/sys/dev/ae/if_ae.c 339735 2018-10-25 17:00:39Z brooks $");
#include <sys/param.h> #include <sys/param.h>
#include <sys/systm.h> #include <sys/systm.h>
@@ -175,6 +177,8 @@ static driver_t ae_driver = {
static devclass_t ae_devclass; static devclass_t ae_devclass;
DRIVER_MODULE(ae, pci, ae_driver, ae_devclass, 0, 0); DRIVER_MODULE(ae, pci, ae_driver, ae_devclass, 0, 0);
MODULE_PNP_INFO("U16:vendor;U16:device;D:#", pci, ae, ae_devs,
nitems(ae_devs));
DRIVER_MODULE(miibus, ae, miibus_driver, miibus_devclass, 0, 0); DRIVER_MODULE(miibus, ae, miibus_driver, miibus_devclass, 0, 0);
MODULE_DEPEND(ae, pci, 1, 1, 1); MODULE_DEPEND(ae, pci, 1, 1, 1);
MODULE_DEPEND(ae, ether, 1, 1, 1); MODULE_DEPEND(ae, ether, 1, 1, 1);
@@ -310,7 +314,7 @@ ae_attach(device_t dev)
goto fail; goto fail;
} }
} }
ae_init_tunables(sc); ae_init_tunables(sc);
ae_phy_reset(sc); /* Reset PHY. */ ae_phy_reset(sc); /* Reset PHY. */
@@ -395,7 +399,7 @@ ae_attach(device_t dev)
fail: fail:
if (error != 0) if (error != 0)
ae_detach(dev); ae_detach(dev);
return (error); return (error);
} }
@@ -499,7 +503,7 @@ ae_reset(ae_softc_t *sc)
AE_WRITE_4(sc, AE_MASTER_REG, AE_MASTER_SOFT_RESET); AE_WRITE_4(sc, AE_MASTER_REG, AE_MASTER_SOFT_RESET);
bus_barrier(sc->mem[0], AE_MASTER_REG, 4, bus_barrier(sc->mem[0], AE_MASTER_REG, 4,
BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE); BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE);
/* /*
* Wait for reset to complete. * Wait for reset to complete.
*/ */
@@ -1018,7 +1022,7 @@ ae_get_vpd_eaddr(ae_softc_t *sc, uint32_t *eaddr)
if (found < 2) if (found < 2)
return (ENOENT); return (ENOENT);
eaddr[1] &= 0xffff; /* Only last 2 bytes are used. */ eaddr[1] &= 0xffff; /* Only last 2 bytes are used. */
if (AE_CHECK_EADDR_VALID(eaddr) != 0) { if (AE_CHECK_EADDR_VALID(eaddr) != 0) {
if (bootverbose) if (bootverbose)
@@ -1065,11 +1069,7 @@ ae_retrieve_address(ae_softc_t *sc)
if (bootverbose) if (bootverbose)
device_printf(sc->dev, device_printf(sc->dev,
"Generating random ethernet address.\n"); "Generating random ethernet address.\n");
#ifdef __HAIKU__
eaddr[0] = random();
#else
eaddr[0] = arc4random(); eaddr[0] = arc4random();
#endif
/* /*
* Set OUI to ASUSTek COMPUTER INC. * Set OUI to ASUSTek COMPUTER INC.
@@ -1288,7 +1288,7 @@ static void
ae_powersave_disable(ae_softc_t *sc) ae_powersave_disable(ae_softc_t *sc)
{ {
uint32_t val; uint32_t val;
AE_LOCK_ASSERT(sc); AE_LOCK_ASSERT(sc);
AE_PHY_WRITE(sc, AE_PHY_DBG_ADDR, 0); AE_PHY_WRITE(sc, AE_PHY_DBG_ADDR, 0);
@@ -1304,7 +1304,7 @@ static void
ae_powersave_enable(ae_softc_t *sc) ae_powersave_enable(ae_softc_t *sc)
{ {
uint32_t val; uint32_t val;
AE_LOCK_ASSERT(sc); AE_LOCK_ASSERT(sc);
/* /*
@@ -1362,7 +1362,7 @@ ae_pm_init(ae_softc_t *sc)
IFM_FDX) != 0) IFM_FDX) != 0)
val |= AE_MAC_FULL_DUPLEX; val |= AE_MAC_FULL_DUPLEX;
AE_WRITE_4(sc, AE_MAC_REG, val); AE_WRITE_4(sc, AE_MAC_REG, val);
} else { /* No link. */ } else { /* No link. */
AE_WRITE_4(sc, AE_WOL_REG, AE_WOL_LNKCHG | \ AE_WRITE_4(sc, AE_WOL_REG, AE_WOL_LNKCHG | \
AE_WOL_LNKCHG_PME); AE_WOL_LNKCHG_PME);
@@ -1430,7 +1430,7 @@ static unsigned int
ae_tx_avail_size(ae_softc_t *sc) ae_tx_avail_size(ae_softc_t *sc)
{ {
unsigned int avail; unsigned int avail;
if (sc->txd_cur >= sc->txd_ack) if (sc->txd_cur >= sc->txd_ack)
avail = AE_TXD_BUFSIZE_DEFAULT - (sc->txd_cur - sc->txd_ack); avail = AE_TXD_BUFSIZE_DEFAULT - (sc->txd_cur - sc->txd_ack);
else else
@@ -1451,7 +1451,7 @@ ae_encap(ae_softc_t *sc, struct mbuf **m_head)
m0 = *m_head; m0 = *m_head;
len = m0->m_pkthdr.len; len = m0->m_pkthdr.len;
if ((sc->flags & AE_FLAG_TXAVAIL) == 0 || if ((sc->flags & AE_FLAG_TXAVAIL) == 0 ||
len + sizeof(ae_txd_t) + 3 > ae_tx_avail_size(sc)) { len + sizeof(ae_txd_t) + 3 > ae_tx_avail_size(sc)) {
#ifdef AE_DEBUG #ifdef AE_DEBUG
@@ -1599,7 +1599,7 @@ ae_link_task(void *arg, int pending)
AE_UNLOCK(sc); /* XXX: could happen? */ AE_UNLOCK(sc); /* XXX: could happen? */
return; return;
} }
sc->flags &= ~AE_FLAG_LINK; sc->flags &= ~AE_FLAG_LINK;
if ((mii->mii_media_status & (IFM_AVALID | IFM_ACTIVE)) == if ((mii->mii_media_status & (IFM_AVALID | IFM_ACTIVE)) ==
(IFM_AVALID | IFM_ACTIVE)) { (IFM_AVALID | IFM_ACTIVE)) {
@@ -1700,7 +1700,7 @@ ae_stop_txmac(ae_softc_t *sc)
/* /*
* Wait for IDLE state. * Wait for IDLE state.
*/ */
for (i = 0; i < AE_IDLE_TIMEOUT; i--) { for (i = 0; i < AE_IDLE_TIMEOUT; i++) {
val = AE_READ_4(sc, AE_IDLE_REG); val = AE_READ_4(sc, AE_IDLE_REG);
if ((val & (AE_IDLE_TXMAC | AE_IDLE_DMAREAD)) == 0) if ((val & (AE_IDLE_TXMAC | AE_IDLE_DMAREAD)) == 0)
break; break;
@@ -1,4 +1,6 @@
/*- /*-
* SPDX-License-Identifier: BSD-2-Clause-FreeBSD
*
* Copyright (c) 2008 Stanislav Sedov <stas@FreeBSD.org>. * Copyright (c) 2008 Stanislav Sedov <stas@FreeBSD.org>.
* All rights reserved. * All rights reserved.
* *
@@ -22,7 +24,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* *
* $FreeBSD$ * $FreeBSD: releng/12.0/sys/dev/ae/if_aereg.h 326255 2017-11-27 14:52:40Z pfg $
*/ */
/* /*
@@ -1,4 +1,6 @@
/*- /*-
* SPDX-License-Identifier: BSD-2-Clause-FreeBSD
*
* Copyright (c) 2008 Stanislav Sedov <stas@FreeBSD.org>. * Copyright (c) 2008 Stanislav Sedov <stas@FreeBSD.org>.
* All rights reserved. * All rights reserved.
* *
@@ -22,7 +24,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* *
* $FreeBSD$ * $FreeBSD: releng/12.0/sys/dev/ae/if_aevar.h 326255 2017-11-27 14:52:40Z pfg $
*/ */
#ifndef IF_AEVAR_H #ifndef IF_AEVAR_H
@@ -1,6 +1,8 @@
/* $NetBSD: ukphy.c,v 1.2 1999/04/23 04:24:32 thorpej Exp $ */ /* $NetBSD: ukphy.c,v 1.2 1999/04/23 04:24:32 thorpej Exp $ */
/*- /*-
* SPDX-License-Identifier: BSD-2-Clause-NetBSD
*
* Copyright (c) 1998, 1999 The NetBSD Foundation, Inc. * Copyright (c) 1998, 1999 The NetBSD Foundation, Inc.
* All rights reserved. * All rights reserved.
* *
@@ -55,7 +57,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__FBSDID("$FreeBSD$"); __FBSDID("$FreeBSD: releng/12.0/sys/dev/mii/ukphy.c 326255 2017-11-27 14:52:40Z pfg $");
/* /*
* driver for generic unknown PHYs * driver for generic unknown PHYs
@@ -1,6 +1,8 @@
/* $NetBSD: ukphy_subr.c,v 1.2 1998/11/05 04:08:02 thorpej Exp $ */ /* $NetBSD: ukphy_subr.c,v 1.2 1998/11/05 04:08:02 thorpej Exp $ */
/*- /*-
* SPDX-License-Identifier: BSD-2-Clause-NetBSD
*
* Copyright (c) 1998 The NetBSD Foundation, Inc. * Copyright (c) 1998 The NetBSD Foundation, Inc.
* All rights reserved. * All rights reserved.
* *
@@ -31,7 +33,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__FBSDID("$FreeBSD$"); __FBSDID("$FreeBSD: releng/12.0/sys/dev/mii/ukphy_subr.c 326255 2017-11-27 14:52:40Z pfg $");
/* /*
* Subroutines shared by the ukphy driver and other PHY drivers. * Subroutines shared by the ukphy driver and other PHY drivers.