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>
Kevin O'Connor [Tue, 7 Jul 2015 13:53:54 +0000 (09:53 -0400)]
block: Route scsi style commands through 'struct disk_op_s'
Support sending scsi style "command data block" commands (cdbcmd)
through the 'struct disk_op_s' command request structure. And change
the blockcmd.c and cdrom.c code to route these commands through the
process_op() code.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Kevin O'Connor [Tue, 7 Jul 2015 13:01:52 +0000 (09:01 -0400)]
block: Introduce default_process_op() with common command handling codes
Most disk drivers only implement a couple of the available bios
commands. Unify the common fallback handling code into a new function
default_process_op() to reduce boiler-plate code.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Kevin O'Connor [Tue, 7 Jul 2015 12:35:51 +0000 (08:35 -0400)]
block: Split process_op() command dispatch up into multiple functions
Introduce process_op_32(), process_op_16(), and process_op_both() and
split the disk driver command dispatch by its runtime mode
requirements. This makes it more clear which modes each driver runs
in. It also reduces the call32() boiler-plate code.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>