PERFORCE change 89111 for review
Warner Losh
imp at FreeBSD.org
Tue Jan 3 14:37:40 PST 2006
http://perforce.freebsd.org/chv.cgi?CH=89111
Change 89111 by imp at imp_Speedy on 2006/01/03 22:37:30
compile
Affected files ...
.. //depot/projects/arm/src/sys/arm/at91/if_ate.c#2 edit
Differences ...
==== //depot/projects/arm/src/sys/arm/at91/if_ate.c#2 (text+ko) ====
@@ -29,8 +29,11 @@
#include <sys/systm.h>
#include <sys/bus.h>
#include <sys/kernel.h>
+#include <sys/mbuf.h>
#include <sys/malloc.h>
#include <sys/module.h>
+#include <sys/socket.h>
+#include <sys/sockio.h>
#include <net/ethernet.h>
#include <net/if.h>
@@ -53,6 +56,15 @@
{
struct ifnet *ifp;
struct mtx sc_mtx;
+ device_t dev;
+ void *intrhand;
+ struct resource *irq_res;
+ int irq_rid;
+ struct resource *port_res;
+ int port_rid;
+
+ // XXX bogus
+ int intr;
};
#define ATE_LOCK(_sc) mtx_lock(&(_sc)->sc_mtx)
@@ -82,6 +94,7 @@
static int ate_probe(device_t dev);
static int ate_attach(device_t dev);
static int ate_detach(device_t dev);
+static void ate_intr(void *);
/* helper routines */
static int ate_activate(device_t dev);
@@ -104,9 +117,11 @@
ate_attach(device_t dev)
{
struct ate_softc *sc = device_get_softc(dev);
- struct ifnet *ifp;
+ struct ifnet *ifp = NULL;
int err;
+ u_char eaddr[6];
+ sc->dev = dev;
err = ate_activate(dev);
if (err)
goto out;
@@ -114,7 +129,7 @@
/* calling atestop before ifp is set is OK */
atestop(sc);
ATE_LOCK_INIT(sc);
- ifp = sc->ifp = if_alloc(IFT_ETHER);
+ sc->ifp = ifp = if_alloc(IFT_ETHER);
ifp->if_softc = sc;
if_initname(ifp, device_get_name(dev), device_get_unit(dev));
ifp->if_mtu = ETHERMTU;
@@ -134,14 +149,14 @@
/*
* Activate the interrupt
*/
- err = bus_seutp_intr(dev, sc->irq_res, INTR_TYPE_NET | INTR_MPSAFE,
+ err = bus_setup_intr(dev, sc->irq_res, INTR_TYPE_NET | INTR_MPSAFE,
ate_intr, sc, &sc->intrhand);
if (err)
- ether_detach(ifp);
+ ether_ifdetach(ifp);
ATE_LOCK_DESTROY(sc);
out:;
if (err)
- ate_deactive(dev);
+ ate_deactivate(dev);
if (err && ifp)
if_free(ifp);
return (err);
@@ -150,6 +165,7 @@
static int
ate_detach(device_t dev)
{
+ return EBUSY; /* XXX */
}
static int
@@ -164,29 +180,38 @@
return EINVAL; /* XXX */
}
+static void
+ate_intr(void *xsc)
+{
+ struct ate_softc *sc = xsc;
+
+ sc->intr++;
+}
+
/*
* Reset and initialize the chip
*/
static void
-ateinit_locked(void *)
+ateinit_locked(void *xsc)
{
- struct sn_softc *sc = xsc;
- struct ifnet *ifp = sc->ifp;
+ struct ate_softc *sc = xsc;
+// struct ifnet *ifp = sc->ifp;
ATE_ASSERT_LOCKED(sc);
/* Insert code here */
+ sc->intr++;
}
/*
* dequeu packets and transmit
*/
static void
-atestart_locked(struct ifnet *)
+atestart_locked(struct ifnet *ifp)
{
- struct sn_softc *sc = ifp->if_softc;
+ struct ate_softc *sc = ifp->if_softc;
- SN_ASSERT_LOCKED(sc);
+ ATE_ASSERT_LOCKED(sc);
if (sc->ifp->if_drv_flags & IFF_DRV_OACTIVE)
return;
/* XXX deque packets and transmit */
@@ -215,18 +240,18 @@
* so be careful.
*/
static void
-atestop(struct ate_softc *)
+atestop(struct ate_softc *sc)
{
}
static void
-atewatchdog(struct ifnet *)
+atewatchdog(struct ifnet *ifp)
{
/* timeout, not sure what to do */
}
static int
-ateioctl(struct ifnet * ifp, u_long, caddr_t)
+ateioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
{
struct ate_softc *sc = ifp->if_softc;
int error = 0;
More information about the p4-projects
mailing list