[SeaBIOS] [PATCH 8/8] EBDA cleanups.
Kevin O'Connor
kevin at koconnor.net
Mon May 14 05:37:29 CEST 2012
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 at koconnor.net>
---
src/acpi.c | 2 +-
src/ahci.c | 2 +-
src/ata.c | 2 +-
src/biosvar.h | 11 +++--------
src/block.c | 2 +-
src/blockcmd.h | 2 ++
src/bootsplash.c | 1 -
src/coreboot.c | 3 ++-
src/disk.c | 2 +-
src/memmap.c | 2 +-
src/mouse.c | 31 ++++++++++++++++---------------
src/mtrr.c | 2 +-
src/pcibios.c | 2 +-
src/pciinit.c | 3 ++-
src/pirtable.c | 2 +-
src/post.c | 2 +-
src/smbios.c | 1 -
src/stacks.c | 8 ++++----
src/xen.h | 3 ++-
19 files changed, 41 insertions(+), 42 deletions(-)
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/ata.c b/src/ata.c
index b8b0cb3..8e3089a 100644
--- a/src/ata.c
+++ b/src/ata.c
@@ -10,7 +10,7 @@
#include "util.h" // dprintf
#include "cmos.h" // inb_cmos
#include "pic.h" // enable_hwirq
-#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 5993718..0716877 100644
--- a/src/biosvar.h
+++ b/src/biosvar.h
@@ -8,8 +8,7 @@
#include "types.h" // u8
#include "farptr.h" // GET_FARVAR
-#include "config.h" // CONFIG_*
-#include "disk.h" // struct chs_s
+#include "config.h" // SEG_BDA
/****************************************************************
@@ -199,14 +198,10 @@ get_ebda_ptr(void)
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/block.c b/src/block.c
index 1ea2b60..44ba9bd 100644
--- a/src/block.c
+++ b/src/block.c
@@ -350,7 +350,7 @@ __send_disk_op(struct disk_op_s *op_far, u16 op_seg)
return status;
}
-// Execute a "disk_op_s" request by jumping to a stack in the ebda.
+// Execute a "disk_op_s" request by jumping to the extra 16bit stack.
int
send_disk_op(struct disk_op_s *op)
{
diff --git a/src/blockcmd.h b/src/blockcmd.h
index 8459d3e..b45bbb7 100644
--- a/src/blockcmd.h
+++ b/src/blockcmd.h
@@ -101,6 +101,7 @@ struct cdbres_mode_sense_geom {
// blockcmd.c
int cdb_is_read(u8 *cdbcmd, u16 blocksize);
+struct disk_op_s;
int cdb_get_inquiry(struct disk_op_s *op, struct cdbres_inquiry *data);
int cdb_get_sense(struct disk_op_s *op, struct cdbres_request_sense *data);
int cdb_test_unit_ready(struct disk_op_s *op);
@@ -111,6 +112,7 @@ int cdb_read(struct disk_op_s *op);
int cdb_write(struct disk_op_s *op);
int scsi_is_ready(struct disk_op_s *op);
+struct drive_s;
int scsi_init_drive(struct drive_s *drive, const char *s, int prio);
#endif // blockcmd.h
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/coreboot.c b/src/coreboot.c
index 4ae44e5..e116a14 100644
--- a/src/coreboot.c
+++ b/src/coreboot.c
@@ -6,10 +6,11 @@
#include "memmap.h" // add_e820
#include "util.h" // dprintf
-#include "biosvar.h" // GET_EBDA
#include "lzmadecode.h" // LzmaDecode
#include "smbios.h" // smbios_init
#include "boot.h" // boot_add_cbfs
+#include "disk.h" // MAXDESCSIZE
+#include "config.h" // CONFIG_*
/****************************************************************
diff --git a/src/disk.c b/src/disk.c
index a0f0dc3..8095581 100644
--- a/src/disk.c
+++ b/src/disk.c
@@ -60,7 +60,7 @@ fillLCHS(struct drive_s *drive_g, u16 *nlc, u16 *nlh, u16 *nlspt)
{
if (CONFIG_CDROM_EMU
&& drive_g == GLOBALFLAT2GLOBAL(GET_GLOBAL(cdemu_drive_gf))) {
- // Emulated drive - get info from ebda. (It's not possible to
+ // Emulated drive - get info from CDEmu. (It's not possible to
// populate the geometry directly in the driveid because the
// geometry is only known after the bios segment is made
// read-only).
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 @@ mouse_15c20000(struct bregs *regs)
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 @@ mouse_15c205(struct bregs *regs)
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 @@ mouse_15c207(struct bregs *regs)
{
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 @@ mouse_15c207(struct bregs *regs)
/* 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 @@ process_mouse(u8 data)
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 @@ process_mouse(u8 data)
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 3561c0d..695f43f 100644
--- a/src/post.c
+++ b/src/post.c
@@ -93,7 +93,7 @@ init_bda(void)
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/stacks.c b/src/stacks.c
index 659e5bf..9c84d1f 100644
--- a/src/stacks.c
+++ b/src/stacks.c
@@ -4,7 +4,7 @@
//
// This file may be distributed under the terms of the GNU LGPLv3 license.
-#include "biosvar.h" // get_ebda_seg
+#include "biosvar.h" // GET_GLOBAL
#include "util.h" // dprintf
#include "bregs.h" // CR0_PE
@@ -149,13 +149,13 @@ wait_irq(void)
/****************************************************************
- * Stack in EBDA
+ * Extra 16bit stack
****************************************************************/
// Space for a stack for 16bit code.
char ExtraStack[BUILD_EXTRA_STACK_SIZE] VARLOW __aligned(16);
-// Switch to the extra stack in ebda and call a function.
+// Switch to the extra stack and call a function.
inline u32
stack_hop(u32 eax, u32 edx, void *func)
{
@@ -166,7 +166,7 @@ stack_hop(u32 eax, u32 edx, void *func)
// Backup current %ss/%esp values.
"movw %%ss, %w3\n"
"movl %%esp, %4\n"
- // Copy ebda seg to %ds/%ss and set %esp
+ // Copy stack seg to %ds/%ss and set %esp
"movw %w6, %%ds\n"
"movw %w6, %%ss\n"
"movl %5, %%esp\n"
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;
--
1.7.6.5
More information about the SeaBIOS
mailing list