aboutsummaryrefslogtreecommitdiff
path: root/src/pmm.c
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2013-08-14 23:37:56 -0400
committerKevin O'Connor <kevin@koconnor.net>2013-08-14 23:37:56 -0400
commit915f64aee37159d21760d44cdc5778220468fe0b (patch)
tree6e817616cd23646829ef45bf394a64e307858972 /src/pmm.c
parentf96ff4484d1b49740c643c3cc5ff613fc0828e0f (diff)
downloadseabios-hppa-915f64aee37159d21760d44cdc5778220468fe0b.zip
seabios-hppa-915f64aee37159d21760d44cdc5778220468fe0b.tar.gz
seabios-hppa-915f64aee37159d21760d44cdc5778220468fe0b.tar.bz2
Minor - simplify rom_reserve().
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'src/pmm.c')
-rw-r--r--src/pmm.c17
1 files changed, 7 insertions, 10 deletions
diff --git a/src/pmm.c b/src/pmm.c
index 1c8da1e..9ea4313 100644
--- a/src/pmm.c
+++ b/src/pmm.c
@@ -348,17 +348,14 @@ rom_get_last(void)
struct rom_header *
rom_reserve(u32 size)
{
- if (!CONFIG_MALLOC_UPPERMEMORY) {
- if (RomEnd + size > rom_get_max())
- return NULL;
- return (void*)RomEnd;
- }
- u32 newend = ALIGN(RomEnd + size, OPTION_ROM_ALIGN) + OPROM_HEADER_RESERVE;
- if (newend > (u32)RomBase->allocend)
+ u32 newend = ALIGN(RomEnd + size, OPTION_ROM_ALIGN);
+ if (newend > rom_get_max())
return NULL;
- if (newend < (u32)zonelow_base + OPROM_HEADER_RESERVE)
- newend = (u32)zonelow_base + OPROM_HEADER_RESERVE;
- RomBase->data = RomBase->dataend = (void*)newend;
+ if (CONFIG_MALLOC_UPPERMEMORY) {
+ if (newend < (u32)zonelow_base)
+ newend = (u32)zonelow_base;
+ RomBase->data = RomBase->dataend = (void*)newend + OPROM_HEADER_RESERVE;
+ }
return (void*)RomEnd;
}