aboutsummaryrefslogtreecommitdiffstats
path: root/src/optionroms.c
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2009-09-20 19:47:45 -0400
committerKevin O'Connor <kevin@koconnor.net>2009-09-20 19:47:45 -0400
commit5b8f80992019371e640b9957f3e5d1a2fb570776 (patch)
treead2b21c521d5dbe3e65dff30a00e379536e9ae7d /src/optionroms.c
parent31ae638cda019e9098127dba7a2f3f150fb65c0c (diff)
downloadseabios-5b8f80992019371e640b9957f3e5d1a2fb570776.tar.gz
Allow rom to grow beyond 64K.
If rom is over 64K then use part of e-segment for 32bit code. Push 32bit code as high as it can go in the f-segment. Do version building before layoutrom.py - this way layoutrom knows full size of rom. Make layoutrom.py build the full ld script - remove now unused ld scripts that just imported the output of layoutrom.py. Also, use "objdump" instead of "nm" - reduce toolchain requirements. Enhance tools/checkrom.py so that it can pad bios.bin to size qemu is happy with. Also, add dependencies to build rules for local tools - if tool changes automatically rerun it. Make sure option roms don't overwrite the 32bit code (should the 32bit code be in the e-segment). Make sure shadow code works even if part of the code is in the e-segment.
Diffstat (limited to 'src/optionroms.c')
-rw-r--r--src/optionroms.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/src/optionroms.c b/src/optionroms.c
index 7d93a87b..18526f4b 100644
--- a/src/optionroms.c
+++ b/src/optionroms.c
@@ -164,12 +164,22 @@ get_pci_rom(struct rom_header *rom)
return pci;
}
+// Return the memory position up to which roms may be located.
+static inline u32
+max_rom()
+{
+ extern u8 code32_start[];
+ if ((u32)code32_start > BUILD_BIOS_ADDR)
+ return BUILD_BIOS_ADDR;
+ return (u32)code32_start;
+}
+
// Copy a rom to its permanent location below 1MiB
static struct rom_header *
copy_rom(struct rom_header *rom)
{
u32 romsize = rom->size * 512;
- if (RomEnd + romsize > BUILD_BIOS_ADDR) {
+ if (RomEnd + romsize > max_rom()) {
// Option rom doesn't fit.
dprintf(1, "Option rom %p doesn't fit.\n", rom);
return NULL;
@@ -213,8 +223,7 @@ lookup_hardcode(u32 vendev)
&& ((OPTIONROM_VENDEV_2 >> 16)
| ((OPTIONROM_VENDEV_2 & 0xffff)) << 16) == vendev)
return copy_rom((void*)OPTIONROM_MEM_2);
- int ret = cbfs_copy_optionrom((void*)RomEnd, BUILD_BIOS_ADDR - RomEnd
- , vendev);
+ int ret = cbfs_copy_optionrom((void*)RomEnd, max_rom() - RomEnd, vendev);
if (ret < 0)
return NULL;
return (void*)RomEnd;
@@ -229,7 +238,7 @@ run_cbfs_roms(const char *prefix, int isvga)
file = cbfs_findprefix(prefix, file);
if (!file)
break;
- int ret = cbfs_copyfile(file, (void*)RomEnd, BUILD_BIOS_ADDR - RomEnd);
+ int ret = cbfs_copyfile(file, (void*)RomEnd, max_rom() - RomEnd);
if (ret > 0)
init_optionrom((void*)RomEnd, 0, isvga);
}
@@ -343,7 +352,7 @@ optionrom_setup()
if (CONFIG_OPTIONROMS_DEPLOYED) {
// Option roms are already deployed on the system.
u32 pos = RomEnd;
- while (pos < BUILD_BIOS_ADDR) {
+ while (pos < max_rom()) {
int ret = init_optionrom((void*)pos, 0, 0);
if (ret)
pos += OPTION_ROM_ALIGN;