Paolo Bonzini [Thu, 7 Jul 2016 14:00:40 +0000 (16:00 +0200)]
smp: restore MSRs on S3 resume
Currently the MTRRs and MSR_IA32_FEATURE_CONTROL are not restored on S3
resume. Because these have to be applied to all processors, SMP setup
has to be added to S3 resume.
There are two differences between the boot and resume paths. First,
romfile_* is not usable in the resume paths so we separate out the
remaining common code to a new smp_scan function. Second, smp_msr has
to be walked on the BSP as well, so we extract that out of handle_smp
and into a new function smp_write_msrs. Then, resume can call
smp_write_msrs on the BSP followed by smp_scan to initialize the APs.
Reported-by: Laszlo Ersek <lersek@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
(cherry picked from commit 54e3a88609da074aaae2f04e592026ebf82169dc)
Haozhong Zhang [Wed, 22 Jun 2016 06:53:24 +0000 (14:53 +0800)]
fw/msr_feature_control: add support to set MSR_IA32_FEATURE_CONTROL
OS usually expects BIOS to set certain bits in MSR_IA32_FEATURE_CONTROL
for some features (e.g. VMX and LMCE). QEMU provides a fw_cfg file
"etc/msr_feature_control" to advise bits that should be set in
MSR_IA32_FEATURE_CONTROL. If this file exists, SeaBIOS will set the
advised bits in that MSR.
Signed-off-by: Haozhong Zhang <haozhong.zhang@intel.com> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Message-id: 20160622065324.23812-1-haozhong.zhang@intel.com Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
(cherry picked from commit 20f83d5c7c0f9ae5f775b6701c205349abe003fb)
Alex Williamson [Tue, 17 May 2016 20:44:32 +0000 (14:44 -0600)]
fw/pci: Add support for mapping Intel IGD via QEMU
QEMU provides two fw_cfg files to support IGD. The first holds the
OpRegion data which holds the Video BIOS Table (VBT). This needs to
be copied into reserved memory and the address stored in the ASL
Storage register of the device at 0xFC offset in PCI config space.
The OpRegion is generally 8KB. This file is named "etc/igd-opregion".
The second file tells us the required size of the stolen memory space
for the device. This space requires 1MB alignment and is generally
either 1MB to 8MB depending on hardware config, but may be hundreds of
MB for user specified stolen memory. The base address of the reserved
memory allocated for this is written back to the Base Data of Stolen
Memory register (BDSM) at PCI config offset 0x5C on the device. This
file is named "etc/igd-bdsm-size".
QEMU documents these fw_cfg entries in docs/igd-assign.txt.
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Message-id: 20160517203151.6996.95545.stgit@gimli.home Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
(cherry picked from commit 04259c5817edc6d23f0aed76fd20ab220efcddc6)
Kevin O'Connor [Sat, 20 Feb 2016 02:34:16 +0000 (21:34 -0500)]
build: fix .text section address alignment
Some linkers verify that sections have a start address that is aligned
with the minimum alignment of that section. Add extra padding to the
".text" section to ensure it is always aligned with the maximum
alignment of any section placed in ".text".
Signed-off-by: Kevin O'Connor <kevin@koconnor.net> Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Reported by: Ed Maste <emaste@FreeBSD.org>
Cole Robinson [Fri, 15 Jan 2016 15:49:32 +0000 (10:49 -0500)]
biostables: Support SMBIOS 2.6+ UUID format
SMBIOS 2.6+ stores the UUID in a different format, with the first 3
fields in little endian format. This is what modern qemu delivers
and what dmidecode also handles, so let's follow suit too.
fw/pci: do not automatically allocate IO region for PCIe bridges
PCIe downstream ports (Root Ports and switches Downstream Ports) appear
to firmware as PCI-PCI bridges and a 4K IO space is allocated for them
even if there is no device behind them requesting IO space,
all that for hotplug purpose.
However, PCIe devices can work without IO, so there is no need
to allocate IO space for hotplug.
Acked-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Marcel Apfelbaum <marcel@redhat.com>
(cherry picked from commit 76327b9f32a009245c215f4a3c5d58a01b5310ae)
Kevin O'Connor [Tue, 12 Jan 2016 18:36:50 +0000 (13:36 -0500)]
coreboot: Check for unaligned cbfs header
If the CBFS header is invalid and points to 0xffffffff it could cause
SeaBIOS to read past the 4GB boundary and cause an exception. Check
the alignment of the header pointer before attempting to access fields
within the header.
Reported-by: "Alex G." <mr.nuke.me@gmail.com> Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
(cherry picked from commit 3e8d75f3bef0f36a807303d58523ef5eba4a386f)
Kevin O'Connor [Wed, 23 Dec 2015 20:37:51 +0000 (15:37 -0500)]
scsi: Do not call printf() from scsi_is_ready()
The scsi_is_ready() function may be called from a thread, and it is
not valid to call printf() from a thread. Convert printf() to
dprintf() to avoid this possibility.
This does mean that cdrom detection (from cdrom_boot() ) may not give
notification of slow cdrom drives to a user. However, the extra
medium detection time is unlikely to be large anyway.
Reported-by: Tobias Diedrich <tobiasdiedrich@gmail.com> Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
(cherry picked from commit 82f327976865ba151153a04b584fc5d0a1fc5d9b)
Kevin O'Connor [Tue, 17 Nov 2015 19:52:23 +0000 (14:52 -0500)]
sdcard: Only enable error_irq_enable for bits defined in SDHCI v1 spec
The SDHCI v1 spec only defines the first 9 error_irq_enable bits and
reserves other bits in the field. Don't enable the 10th bit (which
was defined in the v2 spec) as it's not needed anyway.
Kevin O'Connor [Sun, 13 Dec 2015 19:49:41 +0000 (14:49 -0500)]
xhci: Wait for port enable even for USB3 devices
Some USB3 controllers (and/or devices) need additional time after the
device is detected to place the port in an enabled state. Wait for
the controller to report enabled before proceeding. This fixes
several reports of devices that showed a "stall" error (cc 4) during
set address.
Kevin O'Connor [Tue, 10 Nov 2015 13:50:52 +0000 (08:50 -0500)]
xhci: Check for device disconnects during USB2 reset polling
Some XHCI controllers register super-speed devices on high-speed ports
and then disconnect them when the super-speed detection completes.
Make sure to recognize these disconnect events during the reset
process.
Roger Pau Monne [Mon, 28 Dec 2015 12:50:41 +0000 (13:50 +0100)]
build: fix typo in buildversion.py
Fixes the following build error:
Building ld scripts
Traceback (most recent call last):
File "./scripts/buildversion.py", line 134, in <module>
main()
File "./scripts/buildversion.py", line 114, in main
cleanbuild, toolstr = tool_versions(options.tools)
File "./scripts/buildversion.py", line 90, in tool_versions
vers[isbinutils] = "mixed"
NameError: global name 'vers' is not defined
Makefile:160: recipe for target 'out/romlayout16.lds' failed
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>