aboutsummaryrefslogtreecommitdiff
path: root/sys/mips
diff options
context:
space:
mode:
authorJayachandran C. <jchandra@FreeBSD.org>2012-03-29 11:46:29 +0000
committerJayachandran C. <jchandra@FreeBSD.org>2012-03-29 11:46:29 +0000
commit7fb26c47df8edff4159a1052ca46eff3d921b6f1 (patch)
tree86bfee46367bcd2c8845d7bf0db36f268f741cb4 /sys/mips
parent50c603c4ec51b16d0712e44ed90c97a93bb965aa (diff)
downloadsrc-7fb26c47df8edff4159a1052ca46eff3d921b6f1.tar.gz
src-7fb26c47df8edff4159a1052ca46eff3d921b6f1.zip
Notes
Diffstat (limited to 'sys/mips')
-rw-r--r--sys/mips/nlm/dev/net/ucore/ucore.h54
-rw-r--r--sys/mips/nlm/dev/net/ucore/ucore_app.c2
2 files changed, 26 insertions, 30 deletions
diff --git a/sys/mips/nlm/dev/net/ucore/ucore.h b/sys/mips/nlm/dev/net/ucore/ucore.h
index cd3b6bce4ad9..73fb090f1b0b 100644
--- a/sys/mips/nlm/dev/net/ucore/ucore.h
+++ b/sys/mips/nlm/dev/net/ucore/ucore.h
@@ -45,8 +45,8 @@
#define UCORE_FR_FIFOEMPTY 0x802c
#define UCORE_PKT_DISTR 0x8030
-#define PACKET_MEMORY (0xFFE00)
-#define PACKET_DATA_OFFSET (64)
+#define PACKET_MEMORY 0xFFE00
+#define PACKET_DATA_OFFSET 64
#define SHARED_SCRATCH_MEM 0x18000
/* Distribution mode */
@@ -57,8 +57,8 @@
#define VAL_PDL(x) (((x) & 0xf) << 4)
/*output buffer done*/
-#define VAL_FSV(x) (x<<19)
-#define VAL_FFS(x) (x<<14)
+#define VAL_FSV(x) (x << 19)
+#define VAL_FFS(x) (x << 14)
#define FWD_DEST_ONLY 1
#define FWD_ENQ_DIST_VEC 2
@@ -69,37 +69,33 @@
#define USE_HASH_DST (1 << 20)
+static __inline unsigned int
+nlm_read_ucore_reg(int reg)
+{
+ volatile unsigned int *addr = (volatile void *)reg;
+
+ return (*addr);
+}
+
+static __inline void
+nlm_write_ucore_reg(int reg, unsigned int val)
+{
+ volatile unsigned int *addr = (volatile void *)reg;
+
+ *addr = val;
+}
#define NLM_DEFINE_UCORE(name, reg) \
-static __inline__ unsigned int nlm_read_ucore_##name(void) \
+static __inline unsigned int \
+nlm_read_ucore_##name(void) \
{ \
- unsigned int __rv; \
- __asm__ __volatile__ ( \
- ".set push\n" \
- ".set noreorder\n" \
- ".set mips32\n" \
- "li $8, %1\n" \
- "lw %0, ($8)\n" \
- ".set pop\n" \
- : "=r" (__rv) \
- : "i" (reg) \
- : "$8" \
- ); \
- return __rv; \
+ return nlm_read_ucore_reg(reg); \
} \
\
-static __inline__ void nlm_write_ucore_##name(unsigned int val) \
+static __inline void \
+nlm_write_ucore_##name(unsigned int v) \
{ \
- __asm__ __volatile__( \
- ".set push\n" \
- ".set noreorder\n" \
- ".set mips32\n" \
- "li $8, %1\n" \
- "sw %0, ($8)\n" \
- ".set pop\n" \
- :: "r" (val), "i" (reg) \
- : "$8" \
- ); \
+ nlm_write_ucore_reg(reg, v); \
} struct __hack
diff --git a/sys/mips/nlm/dev/net/ucore/ucore_app.c b/sys/mips/nlm/dev/net/ucore/ucore_app.c
index 57135e8c44a4..bd0489e4a810 100644
--- a/sys/mips/nlm/dev/net/ucore/ucore_app.c
+++ b/sys/mips/nlm/dev/net/ucore/ucore_app.c
@@ -38,7 +38,7 @@ int main(void)
int intf, hw_parser_error, context;
#endif
unsigned int pktrdy;
- int num_cachelines = 1518 >> 6; /* pktsize / L3 cacheline size */
+ int num_cachelines = 1518 / 64 ; /* pktsize / L3 cacheline size */
/* Spray packets to using distribution vector */