-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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
Showing
2 changed files
with
36 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
--- | ||
refs/heads/master: d4c1465b7de9686c4c5aa533b15c09ab014aab3a | ||
refs/heads/master: 39c29657fcf6060d71e04f1e52e5bb4b2999644f |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |