| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
| |
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
|
|
|
|
|
|
|
|
|
| |
Consistently use 'u32' for physical addresses and pointers for virtual
addresses in the malloc code. Introduce and use memremap() where a
physical address needs to be converted to a virtual address. Use
virt_to_phys() for the inverse.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
|
|
|
|
|
|
|
|
|
| |
The PMM handle argument will almost always be 0xffffffff. Use
separate code for the few rare cases where it may not be the default
value. Gcc produces better code if _malloc() only requires three
parameters.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
|
|
|
|
| |
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
|
|
|
|
|
|
|
| |
The segoff_s definition is used by a number of header files that would
not otherwise need farptr.h, so move it to a more central location.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
|
|
|
|
|
|
| |
Also, sort the order of include files in the c files.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
|
|
|
|
| |
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
|
|
|
|
| |
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
|
|
|
|
| |
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
|
|
|
|
| |
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
|
|
|
|
| |
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
|
|
|
|
|
|
|
|
|
|
|
| |
Internal "low memory" allocations are currently placed in the UMB
region (0xc0000-0xf0000). However, there have been reports of some
real machines that do not support DMA to this area of memory. So, add
a compile time config option (off by default) to support placing all
internal low-memory allocations at the end of the 640K real-memory
area (0x90000-0xa0000).
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
|
|
|
|
|
|
|
|
|
|
|
| |
Although the previous patch does fix hlist_for_each_entry_safe for the
common case, it doesn't work correctly when deleting the current
node. To fix this, introduce two macros - hlist_for_each_entry_safe
for iterating through a list that can be modified, and
hlist_for_each_entry_pprev for those users that only need access to
the "pprev" pointer.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
|
|
|
|
| |
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
|
|
|
|
|
|
|
| |
Move the "pmm_malloc" code closer to the low level alloc functions it
calls.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
|
|
|
|
|
|
|
|
| |
Enable the recently added build check on global variables that are (or
contain) pointers to memory allocated by malloc_tmp(). This helps
detect cases where temporary memory is accessed after POST.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
|
|
|
|
|
|
|
| |
Rename remaining "build" settings in config.h that used the CONFIG_
prefix to use a BUILD_ prefix.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The BiosTableSpace variable was used to ensure there was sufficient
space in the f-segment for malloc_fseg() calls. However, it added 2K
to the final image size to reserve that space.
Update the build to determine where to put the f-segment allocations.
In most cases (when code relocation is enabled) allocations can be
done in the space free'd from the "init" sections and no additional
space needs to be reserved in the final image. This also has the
benefit of not fragmenting the f-segment allocation space.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
|
|
|
|
|
|
|
|
|
|
| |
Calculate a LegacyRamSize directly from the e820 map for use by
handle_1588() and handle_15e801() (the only two external interfaces
that require "RamSize"). All other users of the existing RamSize (and
RamSizeOver4G) variables are specific to QEMU, so move the
declarations to paravirt.c.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
|
|
|
|
|
|
|
| |
This reduces some duplicate code between malloc_preinit() and
csm_malloc_preinit().
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
|
|
|
|
|
|
|
|
|
| |
Since the final location of the "varlow" variables are known at build
time, link the final locations into the binary during the build. The
16bit code was already done at link time - update the build so the
32bit code is also done at link time.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
|
|
|
|
|
|
|
|
|
|
|
| |
Convert all users of the alternative variable exports to VARFSEG.
There isn't a significant distinction between the existing types of
exports, so it's simpler to just use one type going forward.
The new VARFSEG declaration is only emitting when in 32bit mode, so
update and move some variables as needed.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
|
|
|
|
|
|
|
|
|
| |
Rename datalow_base (and similar) to zonelow_base, and datalow_start
(and similar) to varlow_start. This helps distinguish between the
bounds for the runtime dynamic memory pool and the compile time global
variables.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
|
|
|
|
|
|
|
|
| |
Some old DOS programs can also use f-segment space as Upper Memory
Blocks (UMB), so also report on what space is available in debug
messages.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
|
|
|
|
|
|
|
| |
Rename rom_get_top and try to make the difference between it and
rom_get_last more clear.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
|
|
|
|
|
|
|
|
|
|
|
|
| |
Unlocking ram in handle_post() is tricky and only needed under qemu.
Separate out that logic from the coreboot/xen paths by invoking
handle_elf_post separately. This simplifies both the qemu and
non-qemu code paths.
Also, organize all the "pre-init" functions into one section of the
file.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
|
|
|
|
|
| |
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
|
|
|
|
|
|
|
| |
Due to a rebase error, commit 8a0a972f caused LOWMEM variables to not
be initialized correctly.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The POST phase has to invoke many initialization functions, and these
functions can have complex inter-dependencies. Try to categorize the
functions into 4 classes:
preinit - functions called very early in POST where function ordering
is very important and the code has limited access to other
interfaces.
init - functions that initialize internal interfaces and standard
external interfaces. This code is generally not dependent on
particular hardware and typically does not communicate directly
with any hardware devices.
setup - functions which access hardware or are dependent on particular
hardware or platform devices.
prepboot - functions that finalize internal interfaces and that
prepare for the boot phase.
This patch attempts to normalize the suffixes - functions that used
_init(), _setup(), _finalize(), or similar that did not follow the
above pattern were renamed. Other than function name changes, there
should be no code impact to this patch.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
|
|
|
|
|
|
|
|
|
|
|
| |
Minor cleanup - use 'struct segoff_s' instead of a manual
segment/offset pair.
Also, while at it, define the header signature at compile time instead
of at run-time. (Defining at run-time is a hold over from when
variable changes were persistent across soft-reboots.)
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
|
|
|
|
|
|
|
| |
Zero the space - some old applications can use the space for UMB if it
is zeroed.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Some 16bit accesses to "low" mem variables use 16bit relocations
instead of the normal 32bit relocations. This causes build problems
if the "low" mem sections move more than 64K during relocation.
The final location of the "low" memory can be determined during the
build, so link the 16bit code with the final post-reloc location of
the "low" mem variables instead. This eliminates the need to do these
runtime relocations on the 16bit code.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
|
|
|
|
|
|
|
| |
The CanPreempt check in pmm is a leftover from when memory could be
allocated from the 9-segment. It is no longer needed.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
|
|
|
|
| |
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
|
|
|
|
|
|
|
|
|
|
| |
Allow both optionroms and "low mem" allocations to use the e-segment.
(Space is allocated on a "first come, first serve" basis). This
allows more flexibility in resource assignment.
Also, allow the "low mem" area to use a full 64K.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
|
|
|
|
|
|
|
|
|
| |
Use the e-segment for ZoneLow allocations. There is plenty of
e-segment space (there has been since SeaBIOS supported code
relocation), while using the 9-segment space can impact old real-mode
applications.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
|
|
|
|
| |
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
|
| |
|
|
|
|
|
|
|
| |
Now that the PMM code is only run in 32bit mode, remove the
GET/SET_PMMVAR macros and other 16bit wrappers.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
|
|
|
|
|
|
|
| |
Use call32() to jump into handle_pmm(). This reduces the amount of
16bit code needed.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
|
|
|
|
|
| |
Now that a soft-reboot forces a hard-reboot, it is no longer necessary
to manually reset global variables.
|
|
|
|
|
|
|
| |
The space in the e-segment is available for option roms after
relocating the init code.
Also, zero all of the option rom space when !CONFIG_OPTIONROMS_DEPLOYED.
|
|
|
|
|
|
|
|
|
|
| |
Move the shadow calls from _start() to post() - this ensures all the
one time init code is in post().
Also, reorg post so that malloc setup is done before ivt/bda/ebda
setup.
This is in preparation for relocating the 32bit flat init code.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The existing malloc implementation effectively uses a stack - all new
allocations come from the top of the stack. When allocating memory
with a large alignment, the pad used to align the new memory is
unavailable to other users. Also, memory released by calling free()
is only available to other users when all memory allocated after it is
also freed.
This new malloc scheme uses a first fit approach to finding available
memory. It makes it possible to use alignment padding and freed space
for new allocations.
This helps reduce the required memory in the permanent memory zones
(ZoneHigh and ZoneLow) where users have the need to allocate
structures with high alignment (eg, virtio and usb).
|
| |
|
|
|
|
|
| |
Moving the ebda while an optionrom is running could confuse it. So,
avoid doing that.
|
|
|
|
| |
Omitting "void" leads to a K&R style declaration which was not intended.
|
|
|
|
|
|
|
|
|
| |
Create a new code blob (code32seg) with support for 32bit functions
that need to utilize explicit segment accesses.
This code blob uses global variables relative to %gs and with a
dynamic code offset (determined by get_global_offset()).
Add BIOS32 structure and code.
Add code for 32bit PCI BIOS code.
|
|
|
|
| |
Extract out addr32 to a parameter to the READx/WRITEx_SEG macros.
|