Kevin O'Connor [Sun, 22 Nov 2015 21:54:18 +0000 (16:54 -0500)]
tpm: Perform hashing separately from logging
Instead of calculating the hash in hash_log_event(), create a new
function (tpm_fill_hash) that will create the hash, and update all
callers to use tpm_fill_hash() before calling hash_log_event(). This
reduce the number of parameters to hash_log_event().
Rename hash_log_event() and hash_log_extent_event() to tpm_log_event()
and tpm_log_extend_event() now that these functions no longer
implement the hashing.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Kevin O'Connor [Sun, 22 Nov 2015 16:28:14 +0000 (11:28 -0500)]
tpm: Change tpm_add_measurement() to tpm_add_action()
Make the only caller of tpm_add_measurement() with EV_SEPARATOR
directly call tpm_add_measurement_to_log(). Rename to
tpm_add_action() and change all callers with EV_ACTION to use this
function.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Kevin O'Connor [Sun, 22 Nov 2015 16:00:06 +0000 (11:00 -0500)]
tpm: Move error recovery from tpm_extend_acpi_log() to only caller
Move tpm state checking and error handling from tpm_extend_acpi_log()
to its only caller hash_log_event(). This makes tpm_extend_acpi_log()
specific to just ACPI table handling.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Kevin O'Connor [Sun, 22 Nov 2015 15:57:52 +0000 (10:57 -0500)]
tpm: Move code around in tcgbios.c
Move like functions near each other. Reduce forward function
declarations. This is only code movement - no code changes.
This groups the code into six sections: TPM state tracking, TPM
hardware interface, ACPI TCPA table interface, Helper functions, Setup
and Measurements, BIOS interface.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Stefan Berger [Sat, 21 Nov 2015 19:54:43 +0000 (14:54 -0500)]
tpm: Refactor pass_through_to_tpm
Refactor the signature of the pass_through_to_tpm function to take
individual pointers as parameters and introduce pass_through_to_tpm_int
as a function to be called with the parameters passed from the BIOS
interrupt.
Refactor existing callers that now do not have to build up the data
structure expected by the BIOS interface.
Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
Stefan Berger [Sat, 21 Nov 2015 19:54:42 +0000 (14:54 -0500)]
tpm: Cache all log related pointers in tpm_state
Move the tpm_state to RAM area and add all log related pointers
to it so they can be cached. Remove functions that previously
determined these pointers by searching for the TCPA ACPI table
and walking the log.
Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
Stefan Berger [Thu, 12 Nov 2015 15:14:49 +0000 (10:14 -0500)]
tpm: Refactor hash_log_extend_event
Refactor the signature of the hash_log_extend_event to take individual
pointers as parameters and introduce hash_log_extend_event_int as a
function to be called with the parameters passed from the BIOS interrupt.
Refactor existing callers to hash_log_extend_event that now do not
have to build up the data structure expected by the BIOS interface.
Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
Stefan Berger [Thu, 12 Nov 2015 15:14:48 +0000 (10:14 -0500)]
tpm: Refactor hash_log_event BIOS interface function
Refactor the signature of hash_log_event to take individual pointers
as parameters and introduce hash_log_event_int as an function to
be called with the parameters passed from the BIOS interrupt.
Refactor existing callers to hash_log_event that now do not
have to build up the data structures expected by the BIOS interface.
Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
Stefan Berger [Thu, 12 Nov 2015 15:14:46 +0000 (10:14 -0500)]
tpm: Refactor function building TPM commands
Refactor the function building TPM commands to get rid of one of
the buffers it uses for building a command. To do that, have it use
the iovec also for the 'append' array that's being passed to the
function.
Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
Stefan Berger [Thu, 12 Nov 2015 15:14:45 +0000 (10:14 -0500)]
tpm: Temporarily deactivate the TPM in case of failure
Temporarily deactivate the TPM in case of failure of TPM commands
and failure to log measurements. Introduce the tpm_set_failure()
function replacing occurrences of 'tpm_state.tpm_working = 0' and
invoke it in error paths.
Temporarily deactivating the TPM means that it will be active again
upon reboot.
Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
Kevin O'Connor [Tue, 17 Nov 2015 23:45:41 +0000 (18:45 -0500)]
acpi: Don't build SSDT files on every build; store them in git
The SSDT files are rarely modified - recent QEMU versions don't use
them at all and adding features to them in SeaBIOS has been
deprecated. It no longer makes sense to generate them on every build.
The content will remain (for use on old machine types in QEMU) in
static files committed to the SeaBIOS git repo. If the contents do
need to be generated a new build target (make iasl) is available.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Kevin O'Connor [Tue, 17 Nov 2015 23:36:17 +0000 (18:36 -0500)]
acpi_extract: Make the generated .hex files more human readable
Add a comment to the top of the generated file indicating that is is
an automatically generated file. Compress output so that up to eight
hex values are placed on a single line.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
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.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
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.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Kevin O'Connor [Mon, 9 Nov 2015 17:00:52 +0000 (12:00 -0500)]
usb: Allow configuration of sigatt time (in etc/usb-time-sigatt)
Several users have reported devices that take more than 100ms to
announce their presence on a USB port. Allow the sigatt timeout to be
specified at runtime as a way to extend the default timeout.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
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>