![]() |
|
|||
0001 /* 0002 * PPC EDAC common defs 0003 * 0004 * Author: Dave Jiang <djiang@mvista.com> 0005 * 0006 * 2007 (c) MontaVista Software, Inc. This file is licensed under 0007 * the terms of the GNU General Public License version 2. This program 0008 * is licensed "as is" without any warranty of any kind, whether express 0009 * or implied. 0010 */ 0011 #ifndef ASM_EDAC_H 0012 #define ASM_EDAC_H 0013 /* 0014 * ECC atomic, DMA, SMP and interrupt safe scrub function. 0015 * Implements the per arch edac_atomic_scrub() that EDAC use for software 0016 * ECC scrubbing. It reads memory and then writes back the original 0017 * value, allowing the hardware to detect and correct memory errors. 0018 */ 0019 static __inline__ void edac_atomic_scrub(void *va, u32 size) 0020 { 0021 unsigned int *virt_addr = va; 0022 unsigned int temp; 0023 unsigned int i; 0024 0025 for (i = 0; i < size / sizeof(*virt_addr); i++, virt_addr++) { 0026 /* Very carefully read and write to memory atomically 0027 * so we are interrupt, DMA and SMP safe. 0028 */ 0029 __asm__ __volatile__ ("\n\ 0030 1: lwarx %0,0,%1\n\ 0031 stwcx. %0,0,%1\n\ 0032 bne- 1b\n\ 0033 isync" 0034 : "=&r"(temp) 0035 : "r"(virt_addr) 0036 : "cr0", "memory"); 0037 } 0038 } 0039 0040 #endif
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.1.0 LXR engine. The LXR team |
![]() ![]() |