Messages in this thread | | | Date | Sun, 23 Nov 2008 15:52:23 -0800 | From | "H. Peter Anvin" <> | Subject | Re: [PATCH 1/1] edac x38: new MC driver module |
| |
Hitoshi Mitake wrote: > --- a/arch/x86/include/asm/io.h > +++ b/arch/x86/include/asm/io.h > @@ -57,6 +57,14 @@ build_mmio_write(__writeq, "q", unsigned long, "r", ) > /* Let people know we have them */ > #define readq readq > #define writeq writeq > + > +#else /* CONFIG_X86_32 */ > + > +static inline unsigned long readq(const volatile void __iomem *addr) > +{ > + return readl(addr) | (((u64)readl(addr + 4)) << 32); > +} > + > #endif >
Let's see:
* undefined ordering of operations (at least on x86, they really should be performed in LSB first order.)
* Using "unsigned long" for a 64-bit number on a 32-bit architecture.
* Arithmetic on a void pointer.
Try something like:
static inline u64 readq(const volative void __iomem *addr) { volatile u32 __iomem *__p = addr; u32 __l, __h;
__l = readl(p); __h = readl(p+1);
return __l + ((u64)__h << 32); }
-hpa
| |