EBDA cleanups.
Clean up includes of biosvar.h.
Rename GET/SET_EBDA2 to GET/SET_EBDA - nearly all users use the
extended form now anyway.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
diff --git a/src/acpi.c b/src/acpi.c
index 30888b9..5387183 100644
--- a/src/acpi.c
+++ b/src/acpi.c
@@ -8,9 +8,9 @@
#include "acpi.h" // struct rsdp_descriptor
#include "util.h" // memcpy
#include "pci.h" // pci_find_init_device
-#include "biosvar.h" // GET_EBDA
#include "pci_ids.h" // PCI_VENDOR_ID_INTEL
#include "pci_regs.h" // PCI_INTERRUPT_LINE
+#include "ioport.h" // inl
#include "paravirt.h"
/****************************************************/
diff --git a/src/ahci.c b/src/ahci.c
index 4abfec5..1176dcc 100644
--- a/src/ahci.c
+++ b/src/ahci.c
@@ -7,7 +7,7 @@
#include "types.h" // u8
#include "ioport.h" // inb
#include "util.h" // dprintf
-#include "biosvar.h" // GET_EBDA
+#include "biosvar.h" // GET_GLOBAL
#include "pci.h" // foreachpci
#include "pci_ids.h" // PCI_CLASS_STORAGE_OTHER
#include "pci_regs.h" // PCI_INTERRUPT_LINE
diff --git a/src/biosvar.h b/src/biosvar.h
index a0e11a8..fb56f73 100644
--- a/src/biosvar.h
+++ b/src/biosvar.h
@@ -198,14 +198,10 @@
ASSERT32FLAT();
return MAKE_FLATPTR(get_ebda_seg(), 0);
}
-#define GET_EBDA2(eseg, var) \
+#define GET_EBDA(eseg, var) \
GET_FARVAR(eseg, ((struct extended_bios_data_area_s *)0)->var)
-#define SET_EBDA2(eseg, var, val) \
+#define SET_EBDA(eseg, var, val) \
SET_FARVAR(eseg, ((struct extended_bios_data_area_s *)0)->var, (val))
-#define GET_EBDA(var) \
- GET_EBDA2(get_ebda_seg(), var)
-#define SET_EBDA(var, val) \
- SET_EBDA2(get_ebda_seg(), var, (val))
/****************************************************************
diff --git a/src/bootsplash.c b/src/bootsplash.c
index 76b72c1..f85f734 100644
--- a/src/bootsplash.c
+++ b/src/bootsplash.c
@@ -10,7 +10,6 @@
#include "config.h" // CONFIG_*
#include "util.h" // dprintf
#include "jpeg.h" // splash
-#include "biosvar.h" // SET_EBDA
#include "paravirt.h" // romfile_find
#include "vbe.h" // struct vbe_info
#include "bmp.h"
diff --git a/src/memmap.c b/src/memmap.c
index 56865b4..3783518 100644
--- a/src/memmap.c
+++ b/src/memmap.c
@@ -5,8 +5,8 @@
// This file may be distributed under the terms of the GNU LGPLv3 license.
#include "memmap.h" // struct e820entry
+#include "config.h" // CONFIG_*
#include "util.h" // dprintf.h
-#include "biosvar.h" // SET_EBDA
/****************************************************************
diff --git a/src/mouse.c b/src/mouse.c
index e26cf69..237c8ff 100644
--- a/src/mouse.c
+++ b/src/mouse.c
@@ -52,7 +52,8 @@
static void
mouse_15c20001(struct bregs *regs)
{
- u8 mouse_flags_2 = GET_EBDA(mouse_flag2);
+ u16 ebda_seg = get_ebda_seg();
+ u8 mouse_flags_2 = GET_EBDA(ebda_seg, mouse_flag2);
if ((mouse_flags_2 & 0x80) == 0) {
set_code_invalid(regs, RET_ENOHANDLER);
return;
@@ -158,8 +159,8 @@
return;
}
u16 ebda_seg = get_ebda_seg();
- SET_EBDA2(ebda_seg, mouse_flag1, 0x00);
- SET_EBDA2(ebda_seg, mouse_flag2, regs->bh);
+ SET_EBDA(ebda_seg, mouse_flag1, 0x00);
+ SET_EBDA(ebda_seg, mouse_flag2, regs->bh);
// Reset Mouse
mouse_15c201(regs);
@@ -227,7 +228,7 @@
{
struct segoff_s farptr = SEGOFF(regs->es, regs->bx);
u16 ebda_seg = get_ebda_seg();
- u8 mouse_flags_2 = GET_EBDA2(ebda_seg, mouse_flag2);
+ u8 mouse_flags_2 = GET_EBDA(ebda_seg, mouse_flag2);
if (! farptr.segoff) {
/* remove handler */
if ((mouse_flags_2 & 0x80) != 0) {
@@ -238,8 +239,8 @@
/* install handler */
mouse_flags_2 |= 0x80;
}
- SET_EBDA2(ebda_seg, mouse_flag2, mouse_flags_2);
- SET_EBDA2(ebda_seg, far_call_pointer, farptr);
+ SET_EBDA(ebda_seg, mouse_flag2, mouse_flags_2);
+ SET_EBDA(ebda_seg, far_call_pointer, farptr);
set_code_success(regs);
}
@@ -279,8 +280,8 @@
return;
u16 ebda_seg = get_ebda_seg();
- u8 mouse_flags_1 = GET_EBDA2(ebda_seg, mouse_flag1);
- u8 mouse_flags_2 = GET_EBDA2(ebda_seg, mouse_flag2);
+ u8 mouse_flags_1 = GET_EBDA(ebda_seg, mouse_flag1);
+ u8 mouse_flags_2 = GET_EBDA(ebda_seg, mouse_flag2);
if (! (mouse_flags_2 & 0x80))
// far call handler not installed
@@ -288,20 +289,20 @@
u8 package_count = mouse_flags_2 & 0x07;
u8 index = mouse_flags_1 & 0x07;
- SET_EBDA2(ebda_seg, mouse_data[index], data);
+ SET_EBDA(ebda_seg, mouse_data[index], data);
if ((index+1) < package_count) {
mouse_flags_1++;
- SET_EBDA2(ebda_seg, mouse_flag1, mouse_flags_1);
+ SET_EBDA(ebda_seg, mouse_flag1, mouse_flags_1);
return;
}
- u16 status = GET_EBDA2(ebda_seg, mouse_data[0]);
- u16 X = GET_EBDA2(ebda_seg, mouse_data[1]);
- u16 Y = GET_EBDA2(ebda_seg, mouse_data[2]);
- SET_EBDA2(ebda_seg, mouse_flag1, 0);
+ u16 status = GET_EBDA(ebda_seg, mouse_data[0]);
+ u16 X = GET_EBDA(ebda_seg, mouse_data[1]);
+ u16 Y = GET_EBDA(ebda_seg, mouse_data[2]);
+ SET_EBDA(ebda_seg, mouse_flag1, 0);
- struct segoff_s func = GET_EBDA2(ebda_seg, far_call_pointer);
+ struct segoff_s func = GET_EBDA(ebda_seg, far_call_pointer);
dprintf(16, "mouse farcall s=%04x x=%04x y=%04x func=%04x:%04x\n"
, status, X, Y, func.seg, func.offset);
diff --git a/src/mtrr.c b/src/mtrr.c
index ec3be4f..0957834 100644
--- a/src/mtrr.c
+++ b/src/mtrr.c
@@ -5,7 +5,7 @@
// This file may be distributed under the terms of the GNU LGPLv3 license.
#include "util.h" // dprintf
-#include "biosvar.h" // GET_EBDA
+#include "config.h" // CONFIG_*
#include "xen.h" // usingXen
#define MSR_MTRRcap 0x000000fe
diff --git a/src/pcibios.c b/src/pcibios.c
index 8b792fb..d10cdfd 100644
--- a/src/pcibios.c
+++ b/src/pcibios.c
@@ -9,7 +9,7 @@
#include "util.h" // handle_1ab1
#include "pci.h" // pci_config_readl
#include "bregs.h" // struct bregs
-#include "biosvar.h" // GET_EBDA
+#include "biosvar.h" // GET_GLOBAL
#include "pci_regs.h" // PCI_VENDOR_ID
// romlayout.S
diff --git a/src/pciinit.c b/src/pciinit.c
index f265662..613a9c0 100644
--- a/src/pciinit.c
+++ b/src/pciinit.c
@@ -7,9 +7,10 @@
#include "util.h" // dprintf
#include "pci.h" // pci_config_readl
-#include "biosvar.h" // GET_EBDA
#include "pci_ids.h" // PCI_VENDOR_ID_INTEL
#include "pci_regs.h" // PCI_COMMAND
+#include "ioport.h" // PORT_ATA1_CMD_BASE
+#include "config.h" // CONFIG_*
#include "xen.h" // usingXen
#define PCI_DEVICE_MEM_MIN 0x1000
diff --git a/src/pirtable.c b/src/pirtable.c
index 4c3f1ff..2c328d8 100644
--- a/src/pirtable.c
+++ b/src/pirtable.c
@@ -6,8 +6,8 @@
// This file may be distributed under the terms of the GNU LGPLv3 license.
#include "pci.h" // struct pir_header
+#include "config.h" // CONFIG_*
#include "util.h" // checksum
-#include "biosvar.h" // SET_EBDA
u16 PirOffset VAR16VISIBLE;
diff --git a/src/post.c b/src/post.c
index 71e69fd..aa29151 100644
--- a/src/post.c
+++ b/src/post.c
@@ -93,7 +93,7 @@
memset(ebda, 0, sizeof(*ebda));
ebda->size = esize;
- add_e820((u32)MAKE_FLATPTR(ebda_seg, 0), GET_EBDA2(ebda_seg, size) * 1024
+ add_e820((u32)MAKE_FLATPTR(ebda_seg, 0), GET_EBDA(ebda_seg, size) * 1024
, E820_RESERVED);
}
diff --git a/src/smbios.c b/src/smbios.c
index fe1e183..20d2d47 100644
--- a/src/smbios.c
+++ b/src/smbios.c
@@ -6,7 +6,6 @@
// This file may be distributed under the terms of the GNU LGPLv3 license.
#include "util.h" // dprintf
-#include "biosvar.h" // GET_EBDA
#include "paravirt.h" // qemu_cfg_smbios_load_field
#include "smbios.h" // struct smbios_entry_point
diff --git a/src/xen.h b/src/xen.h
index dbd4a37..cc506a6 100644
--- a/src/xen.h
+++ b/src/xen.h
@@ -1,7 +1,8 @@
#ifndef __XEN_H
#define __XEN_H
-#include "util.h"
+#include "config.h" // CONFIG_*
+#include "types.h" // u32
extern u32 xen_cpuid_base;