Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 62996
b: refs/heads/master
c: 39c2965
h: refs/heads/master
v: v3
  • Loading branch information
Doug Thompson authored and Linus Torvalds committed Jul 26, 2007
1 parent f35da85 commit 360ef36
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: d4c1465b7de9686c4c5aa533b15c09ab014aab3a
refs/heads/master: 39c29657fcf6060d71e04f1e52e5bb4b2999644f
35 changes: 35 additions & 0 deletions trunk/include/asm-mips/edac.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#ifndef ASM_EDAC_H
#define ASM_EDAC_H

/* ECC atomic, DMA, SMP and interrupt safe scrub function */

static inline void atomic_scrub(void *va, u32 size)
{
unsigned long *virt_addr = va;
unsigned long temp;
u32 i;

for (i = 0; i < size / sizeof(unsigned long); i++, virt_addr++) {

/*
* Very carefully read and write to memory atomically
* so we are interrupt, DMA and SMP safe.
*
* Intel: asm("lock; addl $0, %0"::"m"(*virt_addr));
*/

__asm__ __volatile__ (
" .set mips3 \n"
"1: ll %0, %1 # atomic_add \n"
" ll %0, %1 # atomic_add \n"
" addu %0, $0 \n"
" sc %0, %1 \n"
" beqz %0, 1b \n"
" .set mips0 \n"
: "=&r" (temp), "=m" (*virt_addr)
: "m" (*virt_addr));

}
}

#endif

0 comments on commit 360ef36

Please sign in to comment.