svn commit: r198608 - projects/mips/sys/dev/rmi/xlr

Randall Stewart rrs at FreeBSD.org
Thu Oct 29 15:55:59 UTC 2009


Author: rrs
Date: Thu Oct 29 15:55:58 2009
New Revision: 198608
URL: http://svn.freebsd.org/changeset/base/198608

Log:
  updates to rge to get it to compile

Modified:
  projects/mips/sys/dev/rmi/xlr/rge.c
  projects/mips/sys/dev/rmi/xlr/rge.h

Modified: projects/mips/sys/dev/rmi/xlr/rge.c
==============================================================================
--- projects/mips/sys/dev/rmi/xlr/rge.c	Thu Oct 29 15:55:25 2009	(r198607)
+++ projects/mips/sys/dev/rmi/xlr/rge.c	Thu Oct 29 15:55:58 2009	(r198608)
@@ -79,30 +79,33 @@
 #include <machine/param.h>
 #include <machine/intr_machdep.h>
 #include <machine/clock.h>	/* for DELAY */
-#include <machine/bus.h>
+#include <machine/bus.h>		/*  */
 #include <machine/resource.h>
-#include <mips/xlr/interrupt.h>
-#include <mips/xlr/msgring.h>
-#include <mips/xlr/iomap.h>
-#include <mips/xlr/debug.h>
-#include <mips/xlr/pic.h>
-#include <mips/xlr/xlrconfig.h>
-#include <mips/xlr/shared_structs.h>
-#include <mips/xlr/board.h>
+#include <mips/rmi/interrupt.h>
+#include <mips/rmi/msgring.h>
+#include <mips/rmi/iomap.h>
+#include <mips/rmi/debug.h>
+#include <mips/rmi/pic.h>
+#include <mips/rmi/xlrconfig.h>
+#include <mips/rmi/shared_structs.h>
+#include <mips/rmi/board.h>
 
 #include <dev/rmi/xlr/atx_cpld.h>
 #include <dev/rmi/xlr/xgmac_mdio.h>
-#include <dev/rmi/xlr/rge.h>
+
+
 
 #include <dev/mii/mii.h>
 #include <dev/mii/miivar.h>
-#include "miidevs.h"
 #include <dev/mii/brgphyreg.h>
-#include "miibus_if.h"
+
 #include <sys/sysctl.h>
+#include <dev/rmi/xlr/rge.h>
 
 /* #include "opt_rge.h" */
 
+#include "miibus_if.h"
+
 MODULE_DEPEND(rge, ether, 1, 1, 1);
 MODULE_DEPEND(rge, miibus, 1, 1, 1);
 
@@ -160,93 +163,6 @@ int		mac_debug = 0;
  *****************************************************************/
 
 extern uint32_t cpu_ltop_map[32];
-typedef enum {
-	xlr_mac_speed_10, xlr_mac_speed_100,
-	xlr_mac_speed_1000, xlr_mac_speed_rsvd
-}		xlr_mac_speed_t;
-
-typedef enum {
-	xlr_mac_duplex_auto, xlr_mac_duplex_half,
-	xlr_mac_duplex_full
-}		xlr_mac_duplex_t;
-
-typedef enum {
-	xlr_mac_link_down,
-	xlr_mac_link_up,
-}		xlr_mac_link_t;
-
-typedef enum {
-	xlr_mac_fc_auto, xlr_mac_fc_disabled, xlr_mac_fc_frame,
-	xlr_mac_fc_collision, xlr_mac_fc_carrier
-}		xlr_mac_fc_t;
-
-
-struct rge_softc_stats {
-	unsigned long	rx_frames;
-	unsigned long	tx_frames;
-	unsigned long	rx_packets;
-	unsigned long	rx_bytes;
-	unsigned long	tx_packets;
-	unsigned long	tx_bytes;
-};
-
-struct driver_data {
-
-	/*
-	 * Let these be the first fields in this structure the structure is
-	 * cacheline aligned when allocated in init_etherdev
-	 */
-	struct fr_desc *frin_spill;
-	struct fr_desc *frout_spill;
-	union rx_tx_desc *class_0_spill;
-	union rx_tx_desc *class_1_spill;
-	union rx_tx_desc *class_2_spill;
-	union rx_tx_desc *class_3_spill;
-	int		spill_configured;
-
-	struct rge_softc *sc;	/* pointer to freebsd device soft-pointer */
-	struct rge_softc_stats stats;
-	struct mtx	lock;
-
-	xlr_reg_t      *mmio;
-	xlr_reg_t      *mii_mmio;
-	xlr_reg_t      *pcs_mmio;
-	xlr_reg_t      *serdes_mmio;
-
-	int             txbucket;
-	int             rfrbucket;
-
-	int		phy_oldbmsr;
-	int		phy_oldanlpar;
-	int		phy_oldk1stsr;
-	int		phy_oldlinkstat;
-	unsigned char	phys_addr[2];
-
-	xlr_mac_speed_t	speed;	/* current speed */
-	xlr_mac_duplex_t duplex;/* current duplex */
-	xlr_mac_link_t	link;	/* current link */
-	xlr_mac_fc_t	flow_ctrl;	/* current flow control setting */
-	int		advertising;
-
-	int		id;
-	int		type;
-	int		mode;
-	int		instance;
-	int		phy_addr;
-	int		frin_to_be_sent[8];
-	int		init_frin_desc;
-};
-
-/* static int mac_frin_to_be_sent_thr[8]; */
-
-enum {
-	PORT_TX,
-	PORT_TX_COMPLETE,
-	PORT_STARTQ,
-	PORT_STOPQ,
-	PORT_START_DEV_STATE,
-	PORT_STOP_DEV_STATE,
-};
 
 #ifdef ENABLED_DEBUG
 static int	port_counters[4][8] __aligned(XLR_CACHELINE_SIZE);
@@ -285,37 +201,6 @@ ldadd_wu(unsigned int value, unsigned lo
 /* #define mac_stats_add(x, val) ({(x) += (val);}) */
 #define mac_stats_add(x, val) ldadd_wu(val, &x)
 
-struct rge_softc {
-	int		unit;
-	int		irq;
-	unsigned char	dev_addr[6];
-	unsigned long	base_addr;
-	unsigned long	mem_end;
-	struct ifnet   *rge_ifp;/* interface info */
-	device_t	rge_dev;
-	int		mtu;
-	int		flags;
-	struct driver_data priv;
-	struct mtx	rge_mtx;
-	device_t	rge_miibus;
-	struct mii_data	rge_mii;/* MII/media information */
-	bus_space_handle_t rge_bhandle;
-	bus_space_tag_t	rge_btag;
-	void           *rge_intrhand;
-	struct resource	rge_irq;
-	struct resource *rge_res;
-	struct ifmedia	rge_ifmedia;	/* TBI media info */
-	int		rge_if_flags;
-	int		rge_link;	/* link state */
-	int		rge_link_evt;	/* pending link event */
-	struct callout	rge_stat_ch;
-	void            (*xmit) (struct ifnet *);
-	void            (*stop) (struct rge_softc *);
-	int             (*ioctl) (struct ifnet *, u_long, caddr_t);
-	struct rge_softc_stats *(*get_stats) (struct rge_softc *);
-	int active;
-	int link_up;
-};
 
 #define XLR_MAX_CORE 8
 #define RGE_LOCK_INIT(_sc, _name) \
@@ -354,7 +239,7 @@ static int	rge_ioctl(struct ifnet *, u_l
 static void	rge_init(void *);
 static void	rge_stop(struct rge_softc *);
 static void	rge_watchdog(struct ifnet *);
-static void	rge_shutdown(device_t);
+static int 	rge_shutdown(device_t);
 static void	rge_reset(struct rge_softc *);
 
 static struct mbuf *get_mbuf(void);
@@ -367,8 +252,8 @@ static void	rmi_xlr_mac_set_enable(struc
 static void	rmi_xlr_xgmac_init(struct driver_data *priv);
 static void	rmi_xlr_gmac_init(struct driver_data *priv);
 static void	mac_common_init(void);
-static void	rge_mii_write(struct device *, int, int, int);
-static int	rge_mii_read(struct device *, int, int);
+static int	rge_mii_write(device_t, int, int, int);
+static int	rge_mii_read(device_t, int, int);
 static void	rmi_xlr_mac_mii_statchg(device_t);
 static int	rmi_xlr_mac_mediachange(struct ifnet *);
 static void	rmi_xlr_mac_mediastatus(struct ifnet *, struct ifmediareq *);
@@ -418,8 +303,8 @@ static device_method_t rge_methods[] = {
 
 	/* MII interface */
 	DEVMETHOD(miibus_readreg, rge_mii_read),
-	DEVMETHOD(miibus_writereg, rge_mii_write),
 	DEVMETHOD(miibus_statchg, rmi_xlr_mac_mii_statchg),
+	DEVMETHOD(miibus_writereg, rge_mii_write),
 	{0, 0}
 };
 
@@ -693,7 +578,7 @@ build_frag_list(struct mbuf *m_head, str
 				p1 = vtophys(taddr);
 
 				if ((p2 + len2) != p1) {
-					printf("p1 = %llx p2 = %llx\n", p1, p2);
+					printf("p1 = %p p2 = %p\n", (void *)p1, (void *)p2);
 					printf("len1 = %x len2 = %x\n", len1,
 					       len2);
 					printf("m_data %p\n", m->m_data);
@@ -989,7 +874,7 @@ rge_mii_read_internal(xlr_reg_t *mii_mmi
 }
 
 static int 
-rge_mii_read(struct device *dev, int phyaddr, int regidx)
+rge_mii_read(device_t dev, int phyaddr, int regidx)
 {
 	struct rge_softc *sc = device_get_softc(dev);
 	return rge_mii_read_internal(sc->priv.mii_mmio, phyaddr, regidx);
@@ -1051,7 +936,7 @@ rmi_xlr_mac_mediastatus(struct ifnet *if
  *  Return value:
  *  	   nothing
  ********************************************************************* */
-static void 
+static void
 rge_mii_write_internal(xlr_reg_t *mii_mmio, int phyaddr, int regidx, int regval)
 {
 	int		i = 0;
@@ -1071,16 +956,17 @@ rge_mii_write_internal(xlr_reg_t *mii_mm
 	return;
 }
 
-static void 
-rge_mii_write(struct device *dev, int phyaddr, int regidx, int regval)
+static int
+rge_mii_write(device_t dev, int phyaddr, int regidx, int regval)
 {
 	struct rge_softc *sc = device_get_softc(dev);
 
 	rge_mii_write_internal(sc->priv.mii_mmio, phyaddr, regidx, regval);
+	return (0);
 }
 
 static void 
-rmi_xlr_mac_mii_statchg(device_t dev)
+rmi_xlr_mac_mii_statchg(struct device *dev)
 {
 }
 
@@ -1906,8 +1792,7 @@ static void xlr_tx_q_wakeup(void *addr)
 }
 
 static int
-rge_attach(dev)
-	device_t	dev;
+rge_attach(device_t dev)
 {
 	struct ifnet   *ifp;
 	struct rge_softc *sc;
@@ -2017,12 +1902,12 @@ rge_attach(dev)
 
 	/* Initialize the rge_softc */
 	sc->irq = gmac_conf->baseirq + priv->instance % 4;
-	sc->rge_irq.r_flags = (u_int) sc->irq;	/* We will use r_flags for
-						 * storing irq which
-						 * iodi_setup_intr can check */
+
+	/* Set the IRQ into the rid field */
+	rman_set_rid(&sc->rge_irq, sc->irq);
 
 	ret = bus_setup_intr(dev, &sc->rge_irq, INTR_FAST | INTR_TYPE_NET | INTR_MPSAFE,
-			     rge_intr, sc, &sc->rge_intrhand);
+			     NULL, rge_intr, sc, &sc->rge_intrhand);
 
 	if (ret) {
 		rge_detach(dev);
@@ -2047,7 +1932,7 @@ rge_attach(dev)
 	 */
 	sc->rge_mii.mii_ifp = ifp;
 	sc->rge_mii.mii_readreg = rge_mii_read;
-	sc->rge_mii.mii_writereg = rge_mii_write;
+	sc->rge_mii.mii_writereg = (mii_writereg_t)rge_mii_write;
 	sc->rge_mii.mii_statchg = rmi_xlr_mac_mii_statchg;
 	ifmedia_init(&sc->rge_mii.mii_media, 0, rmi_xlr_mac_mediachange,
 		     rmi_xlr_mac_mediastatus);
@@ -2235,7 +2120,7 @@ rge_rx(struct rge_softc *sc, vm_paddr_t 
 
 	if (mag != 0xf00bad) {
 		/* somebody else packet Error - FIXME in intialization */
-		printf("cpu %d: *ERROR* Not my packet paddr %llx\n", xlr_cpu_id(), paddr); 
+		printf("cpu %d: *ERROR* Not my packet paddr %p\n", xlr_cpu_id(), (void *)paddr); 
 		return;
 	}
 
@@ -2469,7 +2354,7 @@ rge_watchdog(struct ifnet *sc)
 {
 }
 
-static void 
+static int
 rge_shutdown(device_t dev)
 {
 	struct rge_softc *sc;
@@ -2480,7 +2365,7 @@ rge_shutdown(device_t dev)
 	rge_reset(sc);
 	RGE_UNLOCK(sc);
 
-	return;
+	return(0);
 }
 
 static int 
@@ -2800,7 +2685,7 @@ mac_common_init(void)
 		}
 	}
 
-#if notyet
+	/* Not yet
 	if (xlr_board_atx_ii()) {
 		if (register_msgring_handler
 		    (TX_STN_XGS_0, rmi_xlr_mac_msgring_handler, NULL)) {
@@ -2811,5 +2696,5 @@ mac_common_init(void)
 			panic("Couldn't register msgring handler for TX_STN_XGS_1\n");
 		}
 	}
-#endif
+	*/
 }

Modified: projects/mips/sys/dev/rmi/xlr/rge.h
==============================================================================
--- projects/mips/sys/dev/rmi/xlr/rge.h	Thu Oct 29 15:55:25 2009	(r198607)
+++ projects/mips/sys/dev/rmi/xlr/rge.h	Thu Oct 29 15:55:58 2009	(r198608)
@@ -940,6 +940,125 @@
 #define R_CC_CPU6_0                         0x3b0
 #define R_CC_CPU7_0                         0x3b8
 
+typedef enum {
+	xlr_mac_speed_10, xlr_mac_speed_100,
+	xlr_mac_speed_1000, xlr_mac_speed_rsvd
+}		xlr_mac_speed_t;
+
+typedef enum {
+	xlr_mac_duplex_auto, xlr_mac_duplex_half,
+	xlr_mac_duplex_full
+}		xlr_mac_duplex_t;
+
+typedef enum {
+	xlr_mac_link_down,
+	xlr_mac_link_up,
+}		xlr_mac_link_t;
+
+typedef enum {
+	xlr_mac_fc_auto, xlr_mac_fc_disabled, xlr_mac_fc_frame,
+	xlr_mac_fc_collision, xlr_mac_fc_carrier
+}		xlr_mac_fc_t;
+
+/* static int mac_frin_to_be_sent_thr[8]; */
+
+enum {
+	PORT_TX,
+	PORT_TX_COMPLETE,
+	PORT_STARTQ,
+	PORT_STOPQ,
+	PORT_START_DEV_STATE,
+	PORT_STOP_DEV_STATE,
+};
+
+struct rge_softc_stats {
+	unsigned long	rx_frames;
+	unsigned long	tx_frames;
+	unsigned long	rx_packets;
+	unsigned long	rx_bytes;
+	unsigned long	tx_packets;
+	unsigned long	tx_bytes;
+};
+
+struct driver_data {
+
+	/*
+	 * Let these be the first fields in this structure the structure is
+	 * cacheline aligned when allocated in init_etherdev
+	 */
+	struct fr_desc *frin_spill;
+	struct fr_desc *frout_spill;
+	union rx_tx_desc *class_0_spill;
+	union rx_tx_desc *class_1_spill;
+	union rx_tx_desc *class_2_spill;
+	union rx_tx_desc *class_3_spill;
+	int		spill_configured;
+
+	struct rge_softc *sc;	/* pointer to freebsd device soft-pointer */
+	struct rge_softc_stats stats;
+	struct mtx	lock;
+
+	xlr_reg_t      *mmio;
+	xlr_reg_t      *mii_mmio;
+	xlr_reg_t      *pcs_mmio;
+	xlr_reg_t      *serdes_mmio;
+
+	int             txbucket;
+	int             rfrbucket;
+
+	int		phy_oldbmsr;
+	int		phy_oldanlpar;
+	int		phy_oldk1stsr;
+	int		phy_oldlinkstat;
+	unsigned char	phys_addr[2];
+
+	xlr_mac_speed_t	speed;	/* current speed */
+	xlr_mac_duplex_t duplex;/* current duplex */
+	xlr_mac_link_t	link;	/* current link */
+	xlr_mac_fc_t	flow_ctrl;	/* current flow control setting */
+	int		advertising;
+
+	int		id;
+	int		type;
+	int		mode;
+	int		instance;
+	int		phy_addr;
+	int		frin_to_be_sent[8];
+	int		init_frin_desc;
+};
+
+struct rge_softc {
+	int		unit;
+	int		irq;
+	unsigned char	dev_addr[6];
+	unsigned long	base_addr;
+	unsigned long	mem_end;
+	struct ifnet   *rge_ifp;/* interface info */
+	device_t	rge_dev;
+	int		mtu;
+	int		flags;
+	struct driver_data priv;
+	struct mtx	rge_mtx;
+	device_t	rge_miibus;
+	struct mii_data	rge_mii;/* MII/media information */
+	bus_space_handle_t rge_bhandle;
+	bus_space_tag_t	rge_btag;
+	void           *rge_intrhand;
+	struct resource	rge_irq;
+	struct resource *rge_res;
+	struct ifmedia	rge_ifmedia;	/* TBI media info */
+	int		rge_if_flags;
+	int		rge_link;	/* link state */
+	int		rge_link_evt;	/* pending link event */
+	struct callout	rge_stat_ch;
+	void            (*xmit) (struct ifnet *);
+	void            (*stop) (struct rge_softc *);
+	int             (*ioctl) (struct ifnet *, u_long, caddr_t);
+	struct rge_softc_stats *(*get_stats) (struct rge_softc *);
+	int active;
+	int link_up;
+};
+
 struct size_1_desc {
 	uint64_t	entry0;
 };


More information about the svn-src-projects mailing list