diff options
author | Kevin O'Connor <kevin@koconnor.net> | 2014-10-17 21:17:48 -0400 |
---|---|---|
committer | Kevin O'Connor <kevin@koconnor.net> | 2014-10-27 11:00:32 -0400 |
commit | 9978d49d1c858087de518a1d7391ba88aa0f5109 (patch) | |
tree | 7454cfc81f2c55c6839d06da8814c0a012e9a6e6 /vgasrc | |
parent | 78c42e504c4a93cc5802415ae5e4f69534e6c0fd (diff) | |
download | seabios-9978d49d1c858087de518a1d7391ba88aa0f5109.tar.gz |
vgabios: Don't declare custom internal BDA storage in std/bda.h
The vgabios uses storage in the BDA at offset 0xb9 for internal custom
storage (the contents do not appear to be part of any bios standard).
Move the description of this custom vgabios area from std/bda.h to
vgasrc/vgabios.h. Add two new macros (GET_BDA_EXT and SET_BDA_EXT).
This should make it more clear that the area is for custom internal
storage.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'vgasrc')
-rw-r--r-- | vgasrc/vbe.c | 8 | ||||
-rw-r--r-- | vgasrc/vgabios.c | 8 | ||||
-rw-r--r-- | vgasrc/vgabios.h | 13 |
3 files changed, 21 insertions, 8 deletions
diff --git a/vgasrc/vbe.c b/vgasrc/vbe.c index 12bd9812..06ec22ef 100644 --- a/vgasrc/vbe.c +++ b/vgasrc/vbe.c @@ -217,7 +217,7 @@ vbe_104f02(struct bregs *regs) static void vbe_104f03(struct bregs *regs) { - regs->bx = GET_BDA(vbe_mode); + regs->bx = GET_BDA_EXT(vbe_mode); dprintf(1, "VBE current mode=%x\n", regs->bx); regs->ax = 0x004f; } @@ -247,7 +247,7 @@ vbe_104f05(struct bregs *regs) { if (regs->bh > 1 || regs->bl > 1) goto fail; - if (GET_BDA(vbe_mode) & MF_LINEARFB) { + if (GET_BDA_EXT(vbe_mode) & MF_LINEARFB) { regs->ah = VBE_RETURN_STATUS_INVALID; return; } @@ -382,10 +382,10 @@ vbe_104f10(struct bregs *regs) regs->bx = 0x0f30; break; case 0x01: - SET_BDA(vbe_flag, regs->bh); + SET_BDA_EXT(vbe_flag, regs->bh); break; case 0x02: - regs->bh = GET_BDA(vbe_flag); + regs->bh = GET_BDA_EXT(vbe_flag); break; default: regs->ax = 0x014f; diff --git a/vgasrc/vgabios.c b/vgasrc/vgabios.c index e87b7ebf..d36b62a3 100644 --- a/vgasrc/vgabios.c +++ b/vgasrc/vgabios.c @@ -252,7 +252,7 @@ bda_save_restore(int cmd, u16 seg, void *data) , sizeof(info->bda_0x49)); memcpy_far(seg, info->bda_0x84, SEG_BDA, (void*)0x84 , sizeof(info->bda_0x84)); - SET_FARVAR(seg, info->vbe_mode, GET_BDA(vbe_mode)); + SET_FARVAR(seg, info->vbe_mode, GET_BDA_EXT(vbe_mode)); SET_FARVAR(seg, info->font0, GET_IVT(0x1f)); SET_FARVAR(seg, info->font1, GET_IVT(0x43)); } @@ -261,7 +261,7 @@ bda_save_restore(int cmd, u16 seg, void *data) , sizeof(info->bda_0x49)); memcpy_far(SEG_BDA, (void*)0x84, seg, info->bda_0x84 , sizeof(info->bda_0x84)); - SET_BDA(vbe_mode, GET_FARVAR(seg, info->vbe_mode)); + SET_BDA_EXT(vbe_mode, GET_FARVAR(seg, info->vbe_mode)); SET_IVT(0x1f, GET_FARVAR(seg, info->font0)); SET_IVT(0x43, GET_FARVAR(seg, info->font1)); } @@ -276,7 +276,7 @@ bda_save_restore(int cmd, u16 seg, void *data) struct vgamode_s * get_current_mode(void) { - return vgahw_find_mode(GET_BDA(vbe_mode) & ~MF_VBEFLAGS); + return vgahw_find_mode(GET_BDA_EXT(vbe_mode) & ~MF_VBEFLAGS); } // Setup BDA after a mode switch. @@ -301,7 +301,7 @@ vga_set_mode(int mode, int flags) SET_BDA(video_mode, mode); else SET_BDA(video_mode, 0xff); - SET_BDA(vbe_mode, mode | (flags & MF_VBEFLAGS)); + SET_BDA_EXT(vbe_mode, mode | (flags & MF_VBEFLAGS)); if (memmodel == MM_TEXT) { SET_BDA(video_cols, width); SET_BDA(video_rows, height-1); diff --git a/vgasrc/vgabios.h b/vgasrc/vgabios.h index 02cf3e32..70682c95 100644 --- a/vgasrc/vgabios.h +++ b/vgasrc/vgabios.h @@ -75,6 +75,19 @@ struct gfx_op { #define GO_MEMSET 3 #define GO_MEMMOVE 4 +// Custom internal storage in BDA +#define VGA_CUSTOM_BDA 0xb9 + +struct vga_bda_s { + u8 vbe_flag; + u16 vbe_mode; +} PACKED; + +#define GET_BDA_EXT(var) \ + GET_FARVAR(SEG_BDA, ((struct vga_bda_s *)VGA_CUSTOM_BDA)->var) +#define SET_BDA_EXT(var, val) \ + SET_FARVAR(SEG_BDA, ((struct vga_bda_s *)VGA_CUSTOM_BDA)->var, (val)) + // Debug settings #define DEBUG_VGA_POST 1 #define DEBUG_VGA_10 3 |