Kevin O'Connor [Thu, 22 Oct 2015 15:59:47 +0000 (11:59 -0400)]
build: Allow official tarball builds to be considered "clean"
If building from an official tarball and EXTRAVERSION info is
provided, then consider the build to be "clean" (don't include
hostname/build timestamp). This is done on the expectation that
EXTRAVERSION will have enough information to allow developers to find
the builder and build environment should a defect be reported, and
therefore the hostname/timestamp is not necessary.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Kevin O'Connor [Thu, 22 Oct 2015 15:58:16 +0000 (11:58 -0400)]
docs: Document 'make EXTRAVERSION=xyz' and scripts/tarball.sh
Document the existence of the EXTRAVERSION field and the information
expected to be present in it. Document the use of tarball.sh in build
environments that lack git.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Kevin O'Connor [Thu, 22 Oct 2015 00:35:50 +0000 (20:35 -0400)]
build: Be more permissive in buildversion.py tool version scan
There is some variation in version strings between various tool chain
builds. Make the version tool scan more permissive to attempt to
handle these variations.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Kevin O'Connor [Fri, 9 Oct 2015 15:53:02 +0000 (11:53 -0400)]
stacks: Use macro wrappers for call32() and stack_hop_back()
The C code only uses _cfuncX_ prefixes for parameters to the call32(),
stack_hop_back(), and call32_params() functions. It's simpler to use
macro wrappers around those functions which provide the required
prefix.
This also changes the parameter order of stack_hop() and
stack_hop_back() to use the more natural (func, params) ordering.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Kevin O'Connor [Tue, 13 Oct 2015 19:49:03 +0000 (15:49 -0400)]
build: Generate "reproducible" version strings on "clean" builds
If the build environment looks "clean" then don't add the build
hostname or build time to the version string. This makes the default
build string reproducible across builds.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Kevin O'Connor [Tue, 13 Oct 2015 19:09:40 +0000 (15:09 -0400)]
build: Rework version generation; don't allow make version override
Convert the script to generate the build version from a shell script
to a python script.
Remove the ability to override the version at build time via "make
VERSION=xyz". Replace it with ability to add extra version
information at build time via "make EXTRAVERSION=xyz".
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Kevin O'Connor [Tue, 22 Sep 2015 18:45:25 +0000 (14:45 -0400)]
malloc: Don't mix virtual and physical addresses
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>
Kevin O'Connor [Tue, 29 Sep 2015 13:40:46 +0000 (09:40 -0400)]
e820: Rename memmap.c to e820map.c and use consistent "e820_" prefix
Rename memmap.c to e820map.c as the code in that file only deals with
maintaining the e820 map. Move all the e820 definitions to new file
e820map.h and use a consistent "e820_" prefix on all exported
functions.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Kevin O'Connor [Tue, 29 Sep 2015 12:53:38 +0000 (08:53 -0400)]
e820: Introduce e820_remove() and avoid exporting E820_HOLE
The E820_HOLE definition is used internally in the e820 manipulation
code to remove entries from the e820 map. Introduce the e820_remove()
function so that the E820_HOLE definition does not need to be exported
from the memmap.c code.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Kevin O'Connor [Tue, 22 Sep 2015 16:35:00 +0000 (12:35 -0400)]
Always enable caching on transition32; backup/restore cr0 on call32
Always enable caching at start of 32bit code and always make sure the
paging flag is off. Because this alters the cr0 register, perform a
backup and restore of it when using call32().
Also, rename get/setcr0() to cr0_read/write() to more closely match
other register access functions.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Kevin O'Connor [Tue, 22 Sep 2015 18:38:14 +0000 (14:38 -0400)]
Consolidate code16*() functions
Introduce code16_override() for cases where call16() should not
restore the previous 16bit state. All callers now use call16_back()
to invoke 16bit code, so rename call16_back() to call16().
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Kevin O'Connor [Fri, 11 Sep 2015 20:19:02 +0000 (16:19 -0400)]
Use transition32_nmi_off from call32() and call16_back()
The call32() and call16_back() functions will always disable NMI and
enable a20 (via the call32_prep() function) so it is safe to use the
_nmi_off variant of transition32.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Kevin O'Connor [Fri, 11 Sep 2015 20:07:59 +0000 (16:07 -0400)]
Unify inline assembler in variants of call16 functions
The assembler between call16(), call16big() and call16_sloppy() are
very similar. Rework the functions so that a single version of the
inline assembly can be used for all variants.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Kevin O'Connor [Fri, 11 Sep 2015 19:38:43 +0000 (15:38 -0400)]
Unify smm/sloppy variants of call32_prep/post and call16_helper
The "smm" and "sloppy" variants of the 16bit to 32bit trampoline
backup/restore code are very similar. They can be unified into a
single copy of each function.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Magnus Granberg [Fri, 11 Sep 2015 21:38:40 +0000 (17:38 -0400)]
build: use -fstack-check=no when available
Some compilers (such as the one in hardened/Gentoo) default this
option to on which leads to build failures:
src/stacks.c: In function 'call16_back':
src/stacks.c:139:5: error: 'asm' operand has impossible constraints
asm volatile(
^
URL: https://bugs.gentoo.org/559980 Reported-by: Alon Bar-Lev <alonbl@gentoo.org> Signed-off-by: Magnus Granberg <zorry@gentoo.org> Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Kevin O'Connor [Mon, 24 Aug 2015 19:12:10 +0000 (15:12 -0400)]
docs: Don't use an add-symbol-file offset when describing gdb debugging
Recent versions of gdb will only add an offset to the '.text' section
of object files via the add-symbol-file command. The SeaBIOS build
doesn't place code directly in a '.text' section, so update the
documentation to obtain the same result via an 'objcopy' call instead.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Kevin O'Connor [Mon, 10 Aug 2015 16:51:41 +0000 (12:51 -0400)]
sdcard: Allow sdcard addresses to be specified in CBFS files
Allow a hardcoded address to be specified in cbfs files with a prefix
of "etc/sdcard". Some real-world devices have valid SDHCI controllers
that do not show up as PCI devices.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Kevin O'Connor [Mon, 10 Aug 2015 20:14:48 +0000 (16:14 -0400)]
Add minimal support for machines without hardware interrupts
Some Chromebooks (with Baytrail CPUs) apparently do not support
routing of legacy interrupts. This patch adds minimal support for
running SeaBIOS in such an environment. Even with this patch, it is
known that old operating systems and even some recent bootloaders will
not function without real hardware interrupts.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Kevin O'Connor [Wed, 12 Aug 2015 16:58:23 +0000 (12:58 -0400)]
sdcard: Implement timeout on every block read in sdcard_pio_transfer()
The sdcard specs don't specify a maximum time for arbitrary transfers.
Instead, each block has a maximum timeout. So, change the code to
check for a timeout on each block transferred.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Kevin O'Connor [Mon, 10 Aug 2015 19:37:13 +0000 (15:37 -0400)]
optionroms: Don't run option rom on PCI bar if CBFS/fw_cfg version exists
If there exists a "pci%04x,%04x.rom" file in CBFS/fw_cfg then the code
should not attempt to run a rom found on the PCI device itself - even
if the one in CBFS/fw_cfg is not a valid rom. This makes the code
match the documentation.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Julius Werner [Sat, 8 Aug 2015 03:07:12 +0000 (20:07 -0700)]
xhci: Count new Max Scratchpad Bufs bits from XHCI 1.1
The 1.1 revision of the XHCI specification added an extra 5 bits to the
Max Scratchpad Bufs field of HCSPARAMS2 that newer controllers make use
of. Not honoring these bits means we're not allocating as many
scratchpad buffers as the controller expects, which means it will
interpret some uninitialized values from the end of the pointer array as
scratchpad buffer pointers.
We just fixed this in libpayload and it seems to apply the same way to
SeaBIOS (I only compile-tested this, though... sorry).
Signed-off-by: Julius Werner <jwerner@chromium.org>
Kevin O'Connor [Mon, 3 Aug 2015 14:16:39 +0000 (10:16 -0400)]
mptable: Don't create mptable if it is very large
Very large mptable structures can fill up the space in the f-segment
and cause other important f-segment allocations to fail. Limit the
maximum size of the mptable to prevent this.
On QEMU, with the current maximum size of 600 bytes, the mptable will
not be created in configurations of ~20 cpus or more. The mptable is
rarely used in modern OSes so this should not be a problem.
Reported-by: Huaitong Han <huaitong.han@intel.com> Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Kevin O'Connor [Thu, 23 Jul 2015 13:19:23 +0000 (09:19 -0400)]
ramdisk: Allow ramdisk support (CONFIG_FLASH_FLOPPY) under QEMU
Don't require coreboot to use CONFIG_FLASH_FLOPPY - with the latest
QEMU, it's possible to place a floppy image into fw_cfg using the qemu
command line (eg, "-fw_cfg name=floppyimg/MyFloppy,file=file.img").
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Kevin O'Connor [Thu, 23 Jul 2015 12:36:01 +0000 (08:36 -0400)]
timer: Add CONFIG_TSC_TIMER build option to disable the CPU TSC timer
Allow users to remove the CPU timestamp counter support at compile
time. The PMTIMER is frequently used instead of the TSC and this
compile time option allows one to strip a few bytes from the final
binary. This change also defaults the internal timer to use the PIT
based timer until the PMTIMER or TSC is detected.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Kevin O'Connor [Wed, 22 Jul 2015 20:06:27 +0000 (16:06 -0400)]
timer: Delay timestamp counter init until after pmtimer is probed
Delay call to timer_setup() until after the xxx_platform_setup() calls
so that the pmtimer can be detected first. Most modern machines will
have a pmtimer and calibrating the timestamp counter is frequently
unnecessary.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Kevin O'Connor [Wed, 22 Jul 2015 18:32:28 +0000 (14:32 -0400)]
ps2: Don't wait 100ms to discard possible extra reset receive byte
The existing PS2 port code waits 100ms to see if the device attached
to the keyboard port responds to a reset command with two bytes
(instead of the normal one byte). If an extra byte is received, it is
discarded.
Receiving two bytes would be unusual and waiting to check for that
event is unnecessary because the next command in the keyboard init
sequence already seamlessly discards any extra bytes in the command
queue.
This patch eliminates the 100ms wait, which notably reduces the
SeaBIOS boot time on QEMU. This patch also forces PS2 mice to always
respond with two bytes during a reset sequence (instead of just one
byte), which is a good sanity check.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Kevin O'Connor [Tue, 14 Jul 2015 19:44:26 +0000 (15:44 -0400)]
Don't enable interrupts prior to IVT and PIC setup
The machine may crash if an interrupt occurs prior to the setup of the
interrupt vector table (IVT) and programmable interrupt controller
(PIC). This patch makes sure that interrupts remain disabled until
these components are setup.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Kevin O'Connor [Tue, 14 Jul 2015 19:12:25 +0000 (15:12 -0400)]
ata: Make sure "chanid" is relative to PCI device for bootorder file
When specifying drives in the bootorder file, the "drive@x" parameter
should be relative to the given PCI device and not relative to the
total number of ATA controllers in the machine. This patch separates
the tracking of "chanid" (channel number relative to a given PCI
devices) from the "ataid" (channel number relative to the total number
of ATA channels).
Reported-by: Jonathan A. Kollasch <jakllsch@kollasch.net> Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Kevin O'Connor [Wed, 12 Nov 2014 17:15:34 +0000 (12:15 -0500)]
ps2: Support mode for polling the PS2 port instead of using irqs
Some recent hardware has trouble with routing PS2 port interrupts
while the interrupt controller is in legacy routing mode. This patch
adds a config mechanism (via "etc/ps2-poll-only") to force the PS2
code into a polling only mode so that interrupts are not required.
It is not recommended to use this polling mode on hardware that does
properly support PS2 irqs, because some very old (DOS-era) programs
depend on the BIOS PS2 irq behavior.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Kevin O'Connor [Wed, 8 Jul 2015 23:05:54 +0000 (19:05 -0400)]
coreboot: Try to auto-detect if the CBFS anchor pointer is a relative pointer
If CONFIG_CBFS_LOCATION is set to a non-zero value then it means the
CBFS flash is not at the very end of memory. In this case, it's
unclear if the anchor pointer is an absolute pointer or if it is
relative to CONFIG_CBFS_LOCATION. Some devices have been using
absolute pointers, but it appears some devices are now using relative
pointers there. Since the anchor pointer almost always points to a
structure in the last 64K of the rom, it should be possible to
auto-detect if the pointer is relative or not.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>