From: Kevin O'Connor Date: Mon, 12 Oct 2009 13:49:27 +0000 (-0400) Subject: Move read/write[bwl] from smp.c to util.h. X-Git-Tag: rel-0.5.0~65 X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=91031edcb2a6adf2510478bc81a4df68c5e3daf2;p=seabios.git Move read/write[bwl] from smp.c to util.h. Move them to the header so other code can use them. --- diff --git a/src/smp.c b/src/smp.c index 6879472..ffeb5ae 100644 --- a/src/smp.c +++ b/src/smp.c @@ -16,36 +16,6 @@ #define APIC_ENABLED 0x0100 -static inline void writel(void *addr, u32 val) -{ - *(volatile u32 *)addr = val; -} - -static inline void writew(void *addr, u16 val) -{ - *(volatile u16 *)addr = val; -} - -static inline void writeb(void *addr, u8 val) -{ - *(volatile u8 *)addr = val; -} - -static inline u32 readl(const void *addr) -{ - return *(volatile const u32 *)addr; -} - -static inline u16 readw(const void *addr) -{ - return *(volatile const u16 *)addr; -} - -static inline u8 readb(const void *addr) -{ - return *(volatile const u8 *)addr; -} - struct { u32 ecx, eax, edx; } smp_mtrr[16] VAR16VISIBLE; u32 smp_mtrr_count VAR16VISIBLE; diff --git a/src/util.h b/src/util.h index 401e6ea..ca3aa31 100644 --- a/src/util.h +++ b/src/util.h @@ -94,6 +94,25 @@ static inline u32 __ffs(u32 word) return word; } +static inline void writel(void *addr, u32 val) { + *(volatile u32 *)addr = val; +} +static inline void writew(void *addr, u16 val) { + *(volatile u16 *)addr = val; +} +static inline void writeb(void *addr, u8 val) { + *(volatile u8 *)addr = val; +} +static inline u32 readl(const void *addr) { + return *(volatile const u32 *)addr; +} +static inline u16 readw(const void *addr) { + return *(volatile const u16 *)addr; +} +static inline u8 readb(const void *addr) { + return *(volatile const u8 *)addr; +} + // GDT bit manipulation #define GDT_BASE(v) ((((u64)(v) & 0xff000000) << 32) \ | (((u64)(v) & 0x00ffffff) << 16))