Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 30 Jan 2008 10:57:15 GMT
From:      "Randall R. Stewart" <rrs@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 134466 for review
Message-ID:  <200801301057.m0UAvFHu024819@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=134466

Change 134466 by rrs@rrs-mips2-jnpr on 2008/01/30 10:57:09

	Ok, gets the rgmii driver compiling and into my config.

Affected files ...

.. //depot/projects/mips2-jnpr/src/sys/dev/rgmii/octeon_fau.h#3 edit
.. //depot/projects/mips2-jnpr/src/sys/dev/rgmii/octeon_fpa.c#3 edit
.. //depot/projects/mips2-jnpr/src/sys/dev/rgmii/octeon_fpa.h#3 edit
.. //depot/projects/mips2-jnpr/src/sys/dev/rgmii/octeon_ipd.h#3 edit
.. //depot/projects/mips2-jnpr/src/sys/dev/rgmii/octeon_pko.c#3 edit
.. //depot/projects/mips2-jnpr/src/sys/dev/rgmii/octeon_rgmx.c#3 edit
.. //depot/projects/mips2-jnpr/src/sys/dev/rgmii/octeon_rgmx.h#3 edit
.. //depot/projects/mips2-jnpr/src/sys/mips/conf/OCTEON_rrs#5 edit
.. //depot/projects/mips2-jnpr/src/sys/mips/mips32/octeon32/octeon_machdep.c#3 edit
.. //depot/projects/mips2-jnpr/src/sys/mips/mips32/octeon32/octeon_pcmap_regs.h#2 edit

Differences ...

==== //depot/projects/mips2-jnpr/src/sys/dev/rgmii/octeon_fau.h#3 (text+ko) ====

@@ -50,7 +50,7 @@
 
 #ifndef ___OCTEON_FAU__H___
 #define ___OCTEON_FAU__H___
-
+#include "../../mips32/octeon32/octeon_pcmap_regs.h"
 
 
 

==== //depot/projects/mips2-jnpr/src/sys/dev/rgmii/octeon_fpa.c#3 (text+ko) ====

@@ -210,13 +210,13 @@
 	 * about growth, we already preallocated extra
 	 */
 #ifdef FPA_DEBUG
-	printf(" %% Huge MemBlock  0x%X   Bytes %u\n", memory, bytes);
+	printf(" %% Huge MemBlock  0x%p   Bytes %u\n", memory, bytes);
 #endif
 
 	memory = (void *)OCTEON_ALIGN(memory);
 
 #ifdef FPA_DEBUG_TERSE
-	printf("FPA fill: %u  Count: %u  SizeBytes: %u  SizeBytesAligned: %u  1st: 0x%X = 0x%X\n",
+	printf("FPA fill: %u  Count: %u  SizeBytes: %u  SizeBytesAligned: %u  1st: 0x%p = 0x%X\n",
 	    pool, elem_num, elem_size_bytes, block_size, memory, OCTEON_PTR2PHYS(memory));
 #endif
 
@@ -225,7 +225,7 @@
 	while (elem_num--) {
 #ifdef FPA_DEBUG
 		if (((elems - elem_num) < 4) || (elem_num < 4))
-			printf(" %% Block %d:  0x%X  Phys 0x%X   Bytes %u\n", block, memory, OCTEON_PTR2PHYS(memory), elem_size_bytes);
+			printf(" %% Block %d:  0x%p  Phys 0x%X   Bytes %u\n", block, memory, OCTEON_PTR2PHYS(memory), elem_size_bytes);
 		block++;
 #endif
 		octeon_fpa_free(memory, pool, 0);

==== //depot/projects/mips2-jnpr/src/sys/dev/rgmii/octeon_fpa.h#3 (text+ko) ====

@@ -48,7 +48,7 @@
 
 #ifndef ___OCTEON_FPA__H___
 #define ___OCTEON_FPA__H___
-
+#include "../../mips32/octeon32/octeon_pcmap_regs.h"
 
 #define OCTEON_FPA_FPA_OUTPUT_BUFFER_POOL           2	/* Same in octeon_rgmx.h */
 

==== //depot/projects/mips2-jnpr/src/sys/dev/rgmii/octeon_ipd.h#3 (text+ko) ====

@@ -49,7 +49,7 @@
 
 #ifndef ___OCTEON_IPD__H___
 #define ___OCTEON_IPD__H___
-
+#include "../../mips32/octeon32/octeon_pcmap_regs.h"
 
 
 typedef enum {

==== //depot/projects/mips2-jnpr/src/sys/dev/rgmii/octeon_pko.c#3 (text+ko) ====

@@ -223,7 +223,7 @@
 	octeon_pko_port_status_t status;
 
 	octeon_pko_get_port_status(port, 0, &status);
-	printf("\n Port #%d  Pkts %d   Bytes %lld  DoorBell %lld",
+	printf("\n Port #%lld  Pkts %ld   Bytes %lld  DoorBell %lld",
 	    port, status.packets, status.octets, status.doorbell);
 }
 
@@ -260,7 +260,7 @@
 	gmx_int0_ports = (16 >> octeon_pko_gmx_mode.bits.mode0);
 	gmx_int1_ports = (16 >> octeon_pko_gmx_mode.bits.mode1);
 	octeon_pko_crc_ports.word64 = oct_read64(OCTEON_PKO_REG_CRC_ENABLE);
-	printf("\n Total Queues: 0..%d  Ports GMX0 %d   GMX1 %d  CRC 0x%llX",
+	printf("\n Total Queues: 0..%d  Ports GMX0 %d   GMX1 %d  CRC 0x%x",
 	    queue_max - 1, gmx_int0_ports, gmx_int1_ports,
 	    octeon_pko_crc_ports.bits.crc_ports_mask);
 
@@ -279,17 +279,19 @@
 		if (!octeon_pko_queue_cfg.bits.buf_ptr)
 			continue;
 		printf("\n  Port # %d   Queue %3d   [%d]  BufPtr: 0x%llX Mask: %X%s",
-		    octeon_pko_queue_cfg.bits.port, octeon_pko_queue_cfg.bits.queue,
-		    octeon_pko_queue_cfg.bits.index,
-		    octeon_pko_queue_cfg.bits.buf_ptr, octeon_pko_queue_cfg.bits.qos_mask,
-		    (octeon_pko_queue_cfg.bits.tail) ? "  Last" : "");
+		       octeon_pko_queue_cfg.bits.port,
+		       octeon_pko_queue_cfg.bits.queue,
+		       octeon_pko_queue_cfg.bits.index,
+		       octeon_pko_queue_cfg.bits.buf_ptr,
+		       octeon_pko_queue_cfg.bits.qos_mask,
+		       (octeon_pko_queue_cfg.bits.tail) ? "  Last" : "");
 	}
 	printf("\n");
 
 	for (port = start_port; port < (end_port + 1); port++) {
 
 		octeon_pko_get_port_status(port, 0, &status);
-		printf("\n Port #%d  Packets %d   Bytes %lld  DoorBell %lld",
+		printf("\n Port #%d  Packets %ld   Bytes %lld  DoorBell %lld",
 		    port, status.packets, status.octets, status.doorbell);
 		octeon_pko_doorbell_data_dump(port);
 
@@ -318,7 +320,7 @@
 	octeon_pko_queue_cfg_t qconfig;
 
 	if ((port >= OCTEON_PKO_PORTS_MAX) && (port != OCTEON_PKO_PORT_ILLEGAL)) {
-		printf("\n%% Error: octeon_pko_config_port: Invalid port %llu", port);
+		printf("\n%% Error: octeon_pko_config_port: Invalid port %u", port);
 		return (OCTEON_PKO_INVALID_PORT);
 	}
 	if ((base_queue + num_queues) > OCTEON_PKO_QUEUES_MAX) {

==== //depot/projects/mips2-jnpr/src/sys/dev/rgmii/octeon_rgmx.c#3 (text+ko) ====

@@ -194,7 +194,9 @@
 static void octeon_rgmx_stop(struct rgmx_softc_dev *sc);
 static void octeon_rgmx_config_speed(u_int port, u_int);
 static void octeon_dump_rgmx_stats(u_int port);
+#ifdef __not_used__
 static void rgmx_timer_periodic(void);
+#endif
 static void octeon_rgmx_enable_RED_all(int, int);
 
 #ifdef OCTEON_RGMX_SCHEDULED_ISRS
@@ -215,7 +217,7 @@
 
 /* Standard driver entry points.  These can be static.  */
 static void octeon_rgmx_init(void *);
-//static driver_intr_t rgmx_intr;
+/* static driver_intr_t rgmx_intr; */
 static int octeon_rgmx_ioctl(struct ifnet *, u_long, caddr_t);
 static void octeon_rgmx_output_start(struct ifnet *);
 static void octeon_rgmx_output_start_locked(struct ifnet *);
@@ -353,14 +355,14 @@
 	ifp->if_capenable = ifp->if_capabilities;
 	ifp->if_init = octeon_rgmx_init;
 	ifp->if_linkmib = NULL;
-	//&sc->mibdata;
+	/*&sc->mibdata; */
 	ifp->if_linkmiblen = 0;
-	//sizeof(sc->mibdata);
+	/*sizeof(sc->mibdata);*/
 	/*
 	 * Set fixed interface flags.
 	 */
 	ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST;
-	//|IFF_NEEDSGIANT;
+	/*|IFF_NEEDSGIANT; */
 	if (ifp->if_snd.ifq_maxlen == 0)
 		ifp->if_snd.ifq_maxlen = ifqmaxlen;
 
@@ -609,7 +611,7 @@
  *
  *********************************************************************/
 
-//
+
 #define OCTEON_RGMX_POW_TIME_THR_INTS 1
 
 
@@ -780,7 +782,7 @@
 
 
 
-//
+
 #define DEBUG_RX 1
 
 static void 
@@ -792,7 +794,6 @@
 	void *data_start, *new_data_start;
 	struct mbuf *mbuf;
 
-	//
 #define DEBUG_RX_PKT_DUMP 1
 #ifdef DEBUG_RX_PKT_DUMP
 	    int i;
@@ -802,12 +803,11 @@
 
 	data_start = octeon_pow_pktptr_to_kbuffer(work->packet_ptr);
 
-	//
 #define DEBUG_RX2
 #ifdef DEBUG_RX2
-	    printf(" WQE 0x%X: port:%u  ", work, port);
-	printf(" Grp: %u, %llX  Tag: %u  %llX  type: %u 0x%llx\n",
-	    work->grp, work->grp, work->tag, work->tag, work->tag_type, work->tag_type);
+	    printf(" WQE 0x%p: port:%u  ", work, port);
+	printf(" Grp: %u, %x  Tag: %x    type: %u 0x%x\n",
+	    work->grp, work->grp, work->tag, work->tag_type, work->tag_type);
 #endif
 
 	if ((port >= OCTEON_RGMX_MIN_PORT) || (port <= OCTEON_RGMX_MAX_PORT)) {
@@ -860,7 +860,7 @@
 
 					mbuf = octeon_rgmx_build_new_rx_mbuf(ifp, new_data_start, len);
 					if (mbuf) {
-						//printf(" Passing pkt to ifp: pkt_len: %u len: %u ", mbuf->m_pkthdr.len, mbuf->m_len);
+					  /*printf(" Passing pkt to ifp: pkt_len: %u len: %u ", mbuf->m_pkthdr.len, mbuf->m_len); */
 #ifdef DEBUG_RX_PKT_DUMP
 
 						dc = mtod(mbuf, u_char *);
@@ -910,7 +910,6 @@
  * ------------------------------------------------------------------- */
 
 
-//
 #define OCTEON_VISUAL_RGMX 1
 #ifdef OCTEON_VISUAL_RGMX
 static int where0 = 0;
@@ -1012,16 +1011,17 @@
 	uint64_t xmit_cmd_state;
 	int queue = 0;
 
-	//we should randomize queue
-#based on core num. Using same
-	    // queue 0 for this
-		port, by all cores on is less efficient.
-
-		/*
-		 * Prepare the PKO buffer and command word. Cmd Buf Word 0
-		 * No FAU Set #-segs and #-bytes
-		 */
-		    pko_cmd.word64 = 0;
+	/*
+	 * we should randomize queue 
+         * based on core num. Using same
+	 * queue 0 for this
+	 * port, by all cores on is less efficient.
+	 */
+	/*
+	 * Prepare the PKO buffer and command word. Cmd Buf Word 0
+	 * No FAU Set #-segs and #-bytes
+	 */
+	pko_cmd.word64 = 0;
 	pko_cmd.bits.segs = 1;
 	pko_cmd.bits.total_bytes = len;
 	if (checksum) {
@@ -1035,7 +1035,7 @@
 	pko_pkt_word.bits.addr = OCTEON_PTR2PHYS(out_buff);
 	pko_pkt_word.bits.pool = OCTEON_FPA_TX_PACKET_POOL;
 	pko_pkt_word.bits.size = 2048;
-	//dummy.Actual len is above.
+	/*dummy.Actual len is above. */
 
 #ifdef DEBUG_TX
 	    printf(" PKO: 0x%llX  0x%llX ", pko_cmd.word64, pko_pkt_word.word64);
@@ -1133,7 +1133,7 @@
 			IF_DEQUEUE(&sc->tx_pending_queue, m);
 			if (!m) {
 				break;
-				//Queue became empty now.Break out.
+				/*Queue became empty now.Break out. */
 			}
 			/*
 			 * Return the mbuf to system.
@@ -1143,7 +1143,7 @@
 	}
 	if (!i) {
 		return;
-		//Nothing removed from queue.
+		/*Nothing removed from queue. */
 	}
 	/*
 	 * The transmitter is no more active. Reset output active flag and
@@ -1157,8 +1157,10 @@
 #define OCTEON_RGMX_FLUSH_N_XMIT_MBUFS_EACH_LOOP	5
 #define OCTEON_RGMX_FLUSH_PENDING_MBUFS_MAX		1000
 
+#ifdef __not_used__
+/* Used in not_used fucntion */
 /*
- * octeon_rgmx_output_flush
+ * octeon_rgmx_output_flush timer_periodic
  *
  * Drop all packets queued at ifnet layer.
  */
@@ -1184,6 +1186,7 @@
 	}
 }
 
+#endif
 
 /*
  * octeon_rgmx_output_start
@@ -1288,7 +1291,6 @@
 		/*
 		 * put the mbuf onto pending queue
 		 */
-		//
 #define DEBUG_TX_PKT_DUMP 1
 #ifdef DEBUG_TX_PKT_DUMP
 		    int ii;
@@ -1329,7 +1331,7 @@
 	 * outgoing packets in the transmission buffer.
 	 */
 	ifp->if_oerrors++;
-	//sc->mibdata.dot3StatsInternalMacTransmitErrors++;
+	/*sc->mibdata.dot3StatsInternalMacTransmitErrors++;*/
 	ifp->if_drv_flags |= IFF_DRV_OACTIVE;
 	return;
 }
@@ -1460,7 +1462,7 @@
 	struct {
 		uint64_t rsvd3:4;
 		uint64_t thr_freq:28;
-		       //R / O
+ 	                 /*R / O */
 		         uint64_t rsvd2:4;
 		uint64_t thr_period:20;
 		uint64_t rsvd:8;
@@ -1535,8 +1537,9 @@
 
 #else
 	thr.bits.ds_thr = thr.bits.iq_thr = 1;
-	//Only if doing
-		absolute queue - cnt interrupts.
+	/*Only if doing
+	 *absolute queue - cnt interrupts.
+	 */
 		    oct_write64(OCTEON_POW_WORKQUEUE_INT_THRESHOLD(OCTEON_POW_RX_GROUP_NUM), thr.word64);
 #endif
 
@@ -1947,7 +1950,6 @@
 
 	if (link_status.bits.status != old_link_status.bits.status) {
 
-		//
 #define DEBUG_LINESTATUS
 		    if (link_status.bits.status) {
 #ifdef DEBUG_LINESTATUS
@@ -1975,7 +1977,7 @@
 
 }
 
-
+#ifdef _not_used_
 static void 
 rgmx_timer_periodic(void)
 {
@@ -2002,18 +2004,18 @@
 		 * Now look for anamolous conditions
 		 */
 		if (sc != get_rgmx_softc(port)) {
-			printf(" port %u  sc 0x%X not in sync with index: %u\n",
+			printf(" port %u  sc 0x%p not in sync with index: %u\n",
 			    port, sc, index);
 			continue;
 		}
 		if (sc->port != port) {
-			printf(" port %u  sc 0x%X port-> %u  not in sync with index: %u\n",
+			printf(" port %u  sc 0x%p port-> %u  not in sync with index: %u\n",
 			    port, sc, sc->port, index);
 			continue;
 		}
 		ifp = sc->ifp;
 		if (ifp == NULL) {
-			printf(" port %u  sc 0x%X . Bad ifp 0x%X\n", port, sc, ifp);
+			printf(" port %u  sc 0x%p . Bad ifp 0x%p\n", port, sc, ifp);
 			continue;
 		}
 		/*
@@ -2032,7 +2034,7 @@
 		octeon_rgmx_config_speed(port, 1);
 	}
 }
-
+#endif
 
 static void 
 octeon_dump_pow_stats(void)
@@ -2104,16 +2106,15 @@
 		}
 	}
 
-	//
 #define DEBUG_RGMX_DUMP
 #ifdef DEBUG_RGMX_DUMP
 	    static int count = 0;
 
 	if (++count > 5) {
 		count = 0;
-		//octeon_dump_fpa_pool(OCTEON_FPA_RX_PACKET_POOL);
-		//octeon_dump_fpa_pool(OCTEON_FPA_WQE_RX_POOL);
-		//octeon_dump_fpa_pool(OCTEON_FPA_TX_PACKET_POOL);
+		/*octeon_dump_fpa_pool(OCTEON_FPA_RX_PACKET_POOL);*/
+		/*octeon_dump_fpa_pool(OCTEON_FPA_WQE_RX_POOL);*/
+		/*octeon_dump_fpa_pool(OCTEON_FPA_TX_PACKET_POOL);*/
 		octeon_dump_rgmx_stats(16);
 		octeon_dump_pow_stats();
 	}
@@ -2291,7 +2292,7 @@
 	return (retcode);
 }
 
-
+#ifdef __not_used__
 /*
  * octeon_rgmx_free_intr
  *
@@ -2324,7 +2325,7 @@
 #endif
 
 }
-
+#endif
 
 static device_method_t rgmii_methods[] = {
 	/* Device interface */

==== //depot/projects/mips2-jnpr/src/sys/dev/rgmii/octeon_rgmx.h#3 (text+ko) ====

@@ -507,8 +507,11 @@
 
 	result.word64 = oct_read64(ptr.word64);
 
-	printf("WQE Result: 0x%llX  No-work %llX   Addr %llX  Ptr: %llX\n",
-	    result.word64, result.s_work.no_work, result.s_work.addr, OCTEON_PHYS2PTR(result.s_work.addr));
+	printf("WQE Result: 0x%llX  No-work %x   Addr %llX  Ptr: %p\n",
+	       result.word64,
+	       result.s_work.no_work,
+	       result.s_work.addr,
+	       OCTEON_PHYS2PTR(result.s_work.addr));
 
 	if (result.s_work.no_work || !result.s_work.addr) {
 		return NULL;

==== //depot/projects/mips2-jnpr/src/sys/mips/conf/OCTEON_rrs#5 (text+ko) ====

@@ -66,7 +66,7 @@
 device		md
 device		mem
 device		uart
-#device 		rgmii
+device 		rgmii
 #options 	VERBOSE_SYSINIT
 #options		SMP
 

==== //depot/projects/mips2-jnpr/src/sys/mips/mips32/octeon32/octeon_machdep.c#3 (text+ko) ====

@@ -77,19 +77,9 @@
 #include "cpuinfo_octeon.h"
 
 static struct pcpu pcpu0;
-#ifdef OCTEON_SMP
-#define pcpup PCPUP
-#else
-/*struct pcpu *pcpup = &pcpu0;*/
-
-#endif
 struct cpu_info cpu_info_store;
 
 
-/* Coble core id that was put in pcpu.h by Cavium */
-#define OCTEON_CORE_ID 0
-
-
 /*-
  * Warner, these I pulled from cpufunc.h in Cavium to
  * get things compiling they may not be right.. and

==== //depot/projects/mips2-jnpr/src/sys/mips/mips32/octeon32/octeon_pcmap_regs.h#2 (text+ko) ====

@@ -1,6 +1,3 @@
-
-
-
 #ifndef __OCTEON_PCMAP_REGS_H__
 #define __OCTEON_PCMAP_REGS_H__
 
@@ -11,6 +8,17 @@
 
 #ifndef LOCORE
 
+/* From include/pcpu.h  in octeon's port */
+#ifndef OCTEON_SMP
+#define OCTEON_CORE_ID 0
+#else
+/*#define OCTEON_CORE_ID ((mips_rd_ebase() & 0x3ff))*/
+#define OCTEON_CORE_ID (mips_rd_coreid())
+#endif
+
+
+
+
 /*
  * Utility inlines & macros
  */



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200801301057.m0UAvFHu024819>