diff options
author | jchandra <jchandra@FreeBSD.org> | 2012-03-29 11:46:29 +0000 |
---|---|---|
committer | jchandra <jchandra@FreeBSD.org> | 2012-03-29 11:46:29 +0000 |
commit | f9d3dd9f9cd77a6a9c306d500cd4ab48dba96cc4 (patch) | |
tree | 86bfee46367bcd2c8845d7bf0db36f268f741cb4 /sys/mips/nlm | |
parent | 15198de1061e6b058ebd50f9c8a4928199a11808 (diff) | |
download | FreeBSD-src-f9d3dd9f9cd77a6a9c306d500cd4ab48dba96cc4.zip FreeBSD-src-f9d3dd9f9cd77a6a9c306d500cd4ab48dba96cc4.tar.gz |
Remove unnecessary assembly code.
The compiler should generate lw/sw corresponding to register
operations.
Diffstat (limited to 'sys/mips/nlm')
-rw-r--r-- | sys/mips/nlm/dev/net/ucore/ucore.h | 54 | ||||
-rw-r--r-- | sys/mips/nlm/dev/net/ucore/ucore_app.c | 2 |
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 cd3b6bc..73fb090 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 57135e8..bd0489e 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 */ |