On Sat, Sep 15, 2012 at 04:03:13PM +0200, Christian Gmeiner wrote:
2012/9/11 Kevin O'Connor kevin@koconnor.net:
On Mon, Sep 03, 2012 at 12:37:53PM -0400, Kevin O'Connor wrote:
It would be nice if the geode code could use the same style register access functions that the stdvga code uses. I put together a patch (totally untested) below. Is this okay?
FYI - I pushed this patch.
something is wrong with this patch... or even logical :/
Indeed - the u64_u32 union was confusingly named. Does the patch below fix it for you?
-Kevin
From 30e6af0dcd8d967c083311f3a105a68ac5e158e7 Mon Sep 17 00:00:00 2001
From: Kevin O'Connor kevin@koconnor.net Date: Sat, 15 Sep 2012 12:17:37 -0400 Subject: [PATCH] Fix 'union u64_u32_u' member names. To: seabios@seabios.org
Use 'lo' to mean the low bits and 'hi' to mean the high bits of a 64bit value.
Signed-off-by: Kevin O'Connor kevin@koconnor.net --- src/byteorder.h | 2 +- src/farptr.h | 4 ++-- src/types.h | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/byteorder.h b/src/byteorder.h index 94e3a3b..5a8a64a 100644 --- a/src/byteorder.h +++ b/src/byteorder.h @@ -17,8 +17,8 @@ static inline u32 __swab32(u32 val) { static inline u64 __swab64(u64 val) { union u64_u32_u i, o; i.val = val; - o.hi = __swab32(i.lo); o.lo = __swab32(i.hi); + o.hi = __swab32(i.lo); return o.val; }
diff --git a/src/farptr.h b/src/farptr.h index 3a85c6b..5b6c5c1 100644 --- a/src/farptr.h +++ b/src/farptr.h @@ -26,8 +26,8 @@ extern u16 __segment_FS, __segment_GS; #define READ64_SEG(prefix, SEG, value, var) do { \ union u64_u32_u __value; \ union u64_u32_u *__r64_ptr = (union u64_u32_u *)&(var); \ - READ32_SEG(prefix, SEG, __value.hi, __r64_ptr->hi); \ READ32_SEG(prefix, SEG, __value.lo, __r64_ptr->lo); \ + READ32_SEG(prefix, SEG, __value.hi, __r64_ptr->hi); \ *(u64*)&(value) = __value.val; \ } while (0) #define WRITE8_SEG(prefix, SEG, var, value) \ @@ -44,8 +44,8 @@ extern u16 __segment_FS, __segment_GS; union u64_u32_u *__w64_ptr = (union u64_u32_u *)&(var); \ typeof(var) __value_tmp = (value); \ __value.val = *(u64*)&__value_tmp; \ - WRITE32_SEG(prefix, SEG, __w64_ptr->hi, __value.hi); \ WRITE32_SEG(prefix, SEG, __w64_ptr->lo, __value.lo); \ + WRITE32_SEG(prefix, SEG, __w64_ptr->hi, __value.hi); \ } while (0)
// Macros for automatically choosing the appropriate memory size diff --git a/src/types.h b/src/types.h index b10f3b3..24b078e 100644 --- a/src/types.h +++ b/src/types.h @@ -17,7 +17,7 @@ typedef signed long long s64; typedef u32 size_t;
union u64_u32_u { - struct { u32 hi, lo; }; + struct { u32 lo, hi; }; u64 val; };
2012/9/15 Kevin O'Connor kevin@koconnor.net:
On Sat, Sep 15, 2012 at 04:03:13PM +0200, Christian Gmeiner wrote:
2012/9/11 Kevin O'Connor kevin@koconnor.net:
On Mon, Sep 03, 2012 at 12:37:53PM -0400, Kevin O'Connor wrote:
It would be nice if the geode code could use the same style register access functions that the stdvga code uses. I put together a patch (totally untested) below. Is this okay?
FYI - I pushed this patch.
something is wrong with this patch... or even logical :/
Hi Kevin
Indeed - the u64_u32 union was confusingly named. Does the patch below fix it for you?
Yes works - hope you will commit this patch soon.
--- Christian Gmeiner, MSc