aboutsummaryrefslogtreecommitdiff
path: root/sys/mips/rmi/dev/xlr/rge.c
diff options
context:
space:
mode:
authorJayachandran C. <jchandra@FreeBSD.org>2010-09-16 19:13:55 +0000
committerJayachandran C. <jchandra@FreeBSD.org>2010-09-16 19:13:55 +0000
commitf0613ab15b5d3060331332a023e1fc862817fd7a (patch)
tree3d36a0aa1661a8ab219dca596e9d3c2ae29adcc3 /sys/mips/rmi/dev/xlr/rge.c
parentd0d7bcdf92d0eece07efe24d418433980b517898 (diff)
downloadsrc-f0613ab15b5d3060331332a023e1fc862817fd7a.tar.gz
src-f0613ab15b5d3060331332a023e1fc862817fd7a.zip
Network driver updates.
- Move RMI MIPS extension to atomic increment word (LDADDWU) to common header file sys/mips/rmi/rmi_mips_exts.h - Fix xlr_ldaddwu() for 64 bit, it is a 32 bit operation, use unsigned int* instead of unsigned long* argument - Provide dummy xlr_enable_kx/xlr_restore_kx for n32 and n64. - Provide xlr_paddr_ld() instead of xlr_paddr_lw(), so that the descriptor formats are same for 32 and 64 bit - update nlge and rge for the changes These changes are also needed by the security driver which will be added later.
Notes
Notes: svn path=/head/; revision=212758
Diffstat (limited to 'sys/mips/rmi/dev/xlr/rge.c')
-rw-r--r--sys/mips/rmi/dev/xlr/rge.c66
1 files changed, 11 insertions, 55 deletions
diff --git a/sys/mips/rmi/dev/xlr/rge.c b/sys/mips/rmi/dev/xlr/rge.c
index c7a02c261d13..09045f4bdcf3 100644
--- a/sys/mips/rmi/dev/xlr/rge.c
+++ b/sys/mips/rmi/dev/xlr/rge.c
@@ -184,35 +184,8 @@ int xlr_rge_tx_ok_done[MAXCPU];
int xlr_rge_rx_done[MAXCPU];
int xlr_rge_repl_done[MAXCPU];
-static __inline__ unsigned int
-ldadd_wu(unsigned int value, unsigned long *addr)
-{
- __asm__ __volatile__(".set push\n"
- ".set noreorder\n"
- "move $8, %2\n"
- "move $9, %3\n"
- /* "ldaddwu $8, $9\n" */
- ".word 0x71280011\n"
- "move %0, $8\n"
- ".set pop\n"
- : "=&r"(value), "+m"(*addr)
- : "0"(value), "r"((unsigned long)addr)
- : "$8", "$9");
-
- return value;
-}
-
-static __inline__ uint32_t
-xlr_enable_kx(void)
-{
- uint32_t sr = mips_rd_status();
-
- mips_wr_status((sr & ~MIPS_SR_INT_IE) | MIPS_SR_KX);
- return sr;
-}
-
/* #define mac_stats_add(x, val) ({(x) += (val);}) */
-#define mac_stats_add(x, val) ldadd_wu(val, &x)
+#define mac_stats_add(x, val) xlr_ldaddwu(val, &x)
#define XLR_MAX_CORE 8
#define RGE_LOCK_INIT(_sc, _name) \
@@ -611,25 +584,16 @@ static void
free_buf(vm_paddr_t paddr)
{
struct mbuf *m;
- uint32_t mag;
-#ifdef __mips_n64
- uint64_t *vaddr;
-
- vaddr = (uint64_t *)MIPS_PHYS_TO_XKPHYS_CACHED(paddr);
- m = (struct mbuf *)vaddr[0];
- mag = (uint32_t)vaddr[1];
-#else
+ uint64_t mag;
uint32_t sr;
sr = xlr_enable_kx();
- m = (struct mbuf *)(intptr_t)xlr_paddr_lw(paddr - XLR_CACHELINE_SIZE + sizeof(uint32_t));
- mag = xlr_paddr_lw(paddr - XLR_CACHELINE_SIZE + 3 * sizeof(uint32_t));
- mips_wr_status(sr);
-#endif
-
+ m = (struct mbuf *)(intptr_t)xlr_paddr_ld(paddr - XLR_CACHELINE_SIZE);
+ mag = xlr_paddr_ld(paddr - XLR_CACHELINE_SIZE + sizeof(uint64_t));
+ xlr_restore_kx(sr);
if (mag != 0xf00bad) {
- printf("Something is wrong kseg:%lx found mag:%x not 0xf00bad\n",
- (u_long)paddr, mag);
+ printf("Something is wrong kseg:%lx found mag:%lx not 0xf00bad\n",
+ (u_long)paddr, (u_long)mag);
return;
}
if (m != NULL)
@@ -2022,15 +1986,8 @@ static void
rge_rx(struct rge_softc *sc, vm_paddr_t paddr, int len)
{
struct mbuf *m;
- uint32_t mag;
struct ifnet *ifp = sc->rge_ifp;
-#ifdef __mips_n64
- uint64_t *vaddr;
-
- vaddr =(uint64_t *)MIPS_PHYS_TO_XKPHYS_CACHED(paddr - XLR_CACHELINE_SIZE);
- m = (struct mbuf *)vaddr[0];
- mag = (uint32_t)vaddr[1];
-#else
+ uint64_t mag;
uint32_t sr;
/*
* On 32 bit machines we use XKPHYS to get the values stores with
@@ -2038,10 +1995,9 @@ rge_rx(struct rge_softc *sc, vm_paddr_t paddr, int len)
* KX is enabled to prevent this setting leaking to other code.
*/
sr = xlr_enable_kx();
- m = (struct mbuf *)(intptr_t)xlr_paddr_lw(paddr - XLR_CACHELINE_SIZE + sizeof(uint32_t));
- mag = xlr_paddr_lw(paddr - XLR_CACHELINE_SIZE + 3 * sizeof(uint32_t));
- mips_wr_status(sr);
-#endif
+ m = (struct mbuf *)(intptr_t)xlr_paddr_ld(paddr - XLR_CACHELINE_SIZE);
+ mag = xlr_paddr_ld(paddr - XLR_CACHELINE_SIZE + sizeof(uint64_t));
+ xlr_restore_kx(sr);
if (mag != 0xf00bad) {
/* somebody else packet Error - FIXME in intialization */
printf("cpu %d: *ERROR* Not my packet paddr %p\n",