aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2009-10-12 09:49:27 -0400
committerKevin O'Connor <kevin@koconnor.net>2009-10-12 09:49:27 -0400
commit91031edcb2a6adf2510478bc81a4df68c5e3daf2 (patch)
tree04e7127058b975c1ab0ba9fa30838c786595f186
parent43562769f9736375f20ebde00601e479fdde9872 (diff)
downloadseabios-91031edcb2a6adf2510478bc81a4df68c5e3daf2.tar.gz
Move read/write[bwl] from smp.c to util.h.
Move them to the header so other code can use them.
-rw-r--r--src/smp.c30
-rw-r--r--src/util.h19
2 files changed, 19 insertions, 30 deletions
diff --git a/src/smp.c b/src/smp.c
index 68794729..ffeb5ae4 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 401e6ea9..ca3aa314 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))