Deleted Added
full compact
48c48
< __FBSDID("$FreeBSD: head/sys/mips/rmi/dev/nlge/if_nlge.c 212553 2010-09-13 13:11:50Z jchandra $");
---
> __FBSDID("$FreeBSD: head/sys/mips/rmi/dev/nlge/if_nlge.c 212758 2010-09-16 19:13:55Z jchandra $");
303,305c303,304
< /* Function to atomically increment an integer with the given value. */
< static __inline__ unsigned int
< ldadd_wu(unsigned int value, unsigned long *addr)
---
> static __inline void
> atomic_incr_long(unsigned long *addr)
307,319c306,307
< __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;
< }
---
> /* XXX: fix for 64 bit */
> unsigned int *iaddr = (unsigned int *)addr;
321,327c309
< 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;
---
> xlr_ldaddwu(1, iaddr);
686c668
< ldadd_wu(1, (tx_error) ? &ifp->if_oerrors: &ifp->if_opackets);
---
> atomic_incr_long((tx_error) ? &ifp->if_oerrors: &ifp->if_opackets);
769c751
< ldadd_wu(1, &ifp->if_iqdrops);
---
> atomic_incr_long(&ifp->if_iqdrops);
777,779c759,762
< struct ifnet *ifp;
< struct mbuf *m;
< uint32_t tm, mag, sr;
---
> struct ifnet *ifp;
> struct mbuf *m;
> uint64_t tm, mag;
> uint32_t sr;
782,784c765,767
< tm = xlr_paddr_lw(paddr - XLR_CACHELINE_SIZE);
< mag = xlr_paddr_lw(paddr - XLR_CACHELINE_SIZE + sizeof(uint32_t));
< mips_wr_status(sr);
---
> tm = xlr_paddr_ld(paddr - XLR_CACHELINE_SIZE);
> mag = xlr_paddr_ld(paddr - XLR_CACHELINE_SIZE + sizeof(uint64_t));
> xlr_restore_kx(sr);
800c783
< ldadd_wu(1, &ifp->if_ipackets);
---
> atomic_incr_long(&ifp->if_ipackets);
1898,1902c1881,1882
< * As we currently use xlr_paddr_lw on a 32-bit
< * OS, both the pointers are laid out in one
< * 64-bit location - this makes it easy to
< * retrieve the pointers when processing the
< * tx free-back descriptor.
---
> * Save the virtual address in the descriptor,
> * it makes freeing easy.
1905,1906c1885
< (((uint64_t) (vm_offset_t) p2p) << 32) |
< ((vm_offset_t) mbuf_chain);
---
> (uint64_t)(vm_offset_t)p2p;
1935c1914
< (vm_offset_t) mbuf_chain;
---
> (vm_offset_t) mbuf_chain; /* XXX: fix 64 bit */
1976c1955
< uint32_t val1, val2;
---
> uint64_t vaddr;
1980,1983c1959,1960
< val1 = xlr_paddr_lw(paddr);
< paddr += sizeof(void *);
< val2 = xlr_paddr_lw(paddr);
< mips_wr_status(sr);
---
> vaddr = xlr_paddr_ld(paddr);
> xlr_restore_kx(sr);
1985c1962
< tx_desc = (struct nlge_tx_desc*)(intptr_t) val1;
---
> tx_desc = (struct nlge_tx_desc*)(intptr_t)vaddr;
1992,1994c1969,1973
< struct mbuf *m_new;
< vm_paddr_t temp1, temp2;
< unsigned int *md;
---
> struct mbuf *m_new;
> uint64_t *md;
> #ifdef INVARIANTS
> vm_paddr_t temp1, temp2;
> #endif
1997c1976
< return NULL;
---
> return (NULL);
2000,2001c1979,1980
< md = (unsigned int *)m_new->m_data;
< md[0] = (unsigned int)m_new; /* Back Ptr */
---
> md = (uint64_t *)m_new->m_data;
> md[0] = (intptr_t)m_new; /* Back Ptr */
2004a1984
> #ifdef INVARIANTS
2008a1989
> #endif