Kevin O'Connor [Wed, 3 Feb 2016 03:23:55 +0000 (22:23 -0500)]
sdcard: Convert to new PCI BAR helper functions
Use the pci_enable_x() functions.
After this change, the sdcard driver will no longer enable
PCI_COMMAND_IO or PCI_COMMAND_MASTER accesses, as the sdcard driver
doesn't actually use IO BARs or implement DMA.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Kevin O'Connor [Wed, 3 Feb 2016 03:19:35 +0000 (22:19 -0500)]
megasas: Convert to new PCI BAR helper functions
Use the pci_enable_x() functions.
After this change, the megasas driver will no longer enable
PCI_COMMAND_MEMORY accesses, as the megasas driver doesn't actually
map any BARs as memory.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Kevin O'Connor [Wed, 3 Feb 2016 03:11:30 +0000 (22:11 -0500)]
ahci: Convert to new PCI BAR helper functions
Use the pci_enable_x() functions.
This patch also converts cntl->iobase from a 'u32' to a 'void*' so
that it is clear that the address is a virtual memory address.
After this change, the AHCI driver will no longer enable
PCI_COMMAND_IO io accesses, as the AHCI driver doesn't actually
attempt IO accesses to the device.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Kevin O'Connor [Wed, 3 Feb 2016 03:09:57 +0000 (22:09 -0500)]
pci: Add helper functions for internal driver BAR handling
Add functions to verify and obtain PCI BARs (Base Address Registers).
These new functions check that the requested BAR is of the right type
and appears valid.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Kevin O'Connor [Tue, 2 Feb 2016 19:35:55 +0000 (14:35 -0500)]
usb: Eliminate USB controller setup thread
There are no longer any sleep or yield calls during the usb controller
device scans, so there is no need to run these device scans in a
separate thread.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Kevin O'Connor [Tue, 2 Feb 2016 19:28:13 +0000 (14:28 -0500)]
ehci: Only delay UHCI/OHCI port scan until after EHCI setup completes
EHCI controller setup needs to occur prior to checking any UHCI or
OHCI ports to ensure a high speed device is not mistakenly configured
on a full speed "companion" controller. However, only the UHCI/OHCI
port scan needs to be delayed, not the full UHCI/OHCI controller init.
This change moves back the ehci controller setup check until port
scan in UHCI/OHCI.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
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.
Kevin O'Connor [Tue, 12 Jan 2016 19:22:33 +0000 (14:22 -0500)]
post: Always set HaveRunPost prior to setting any other global variable
The HaveRunPost flag controls whether post or reboot handling is
entered on a reset signal. The flag needs to be set before any other
global variable because an external reboot signal could occur at any
time. (If any global variable is modified prior to setting
HaveRunPost then the code might enter post with global variables in a
dirty state.)
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Kevin O'Connor [Mon, 9 Nov 2015 20:00:19 +0000 (15:00 -0500)]
resume: Make KVM soft reboot loop detection more flexible
Move the check for soft reboot loops from resume.c to shadow.c and
directly check for the case where the copy of the BIOS in flash
appears to be a memory alias instead. This prevents a hang if an
external reboot request occurs during the BIOS memcpy.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
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>
Stefan Berger [Thu, 7 Jan 2016 17:02:51 +0000 (12:02 -0500)]
tpm: Do not set TPM in failure mode if menu command fails
Since we may detect that HW physical presence is enabled but we do not detect
whether it is actually asserted, we may fail on the TPM menu commands that
require the assertion of physical presence. We therefore cannot set the TPM
into failure mode if we hit this case. Failure should never occur in these
cases if SW physical presence has been asserted.
Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
Stefan Berger [Thu, 7 Jan 2016 17:02:49 +0000 (12:02 -0500)]
tpm: Rework the assertion of physical presence
Rework the assertion of physical presence by calling assert_physical_presence
in tpm_setup. This call will assert physical presence if SW assertion is
possible or by checking whether HW physical presence is enabled.
The TPM menu will only be shown if physical presence is asserted or HW
physical presence is enabled after this call.
Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
Stefan Berger [Thu, 7 Jan 2016 17:02:47 +0000 (12:02 -0500)]
tpm: Move assert_physical_presence and dependencies
Move assert_physical_presence and dependencies in front of tpm_startup
so that the next patches can assert physical presence after TPM_ORD_Startup
ran.
Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
Kevin O'Connor [Wed, 30 Dec 2015 04:04:15 +0000 (23:04 -0500)]
tpm: Don't use 16bit BIOS return codes in TPM menu functions
Don't use the return codes from the 16bit BIOS spec in the internal
menu functions. Only the 16bit BIOS interface code should need to
handle the details of that spec. For functions that need to return
the TIS command status, return those codes directly instead of via a
pointer parameter.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Kevin O'Connor [Wed, 30 Dec 2015 17:51:27 +0000 (12:51 -0500)]
tpm: Don't use 16bit BIOS return codes in tpmhw_* functions
Don't use the return codes from the 16bit BIOS spec in the internal
tpmhw functions. Only the 16bit BIOS interface code should need to
handle the details of that spec.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Kevin O'Connor [Wed, 30 Dec 2015 17:40:11 +0000 (12:40 -0500)]
tpm: Don't use 16bit BIOS return codes in tpm_log_event()
Don't use the return codes from the 16bit BIOS spec in the internal
tpm_log_event() and tpm_log_extend_event() functions. Only the 16bit
BIOS interface code should need to handle the details of that spec.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Kevin O'Connor [Tue, 29 Dec 2015 22:54:37 +0000 (17:54 -0500)]
tpm: Don't use 16bit BIOS return codes in build_and_send_cmd()
Don't use the return codes from the 16bit BIOS spec in the internal
function build_and_send_cmd(). Instead, return the TIS command status
code of the command or -1 if there was a command transmission failure.
This eliminates the need for a returnCode pointer parameter.
Also, implement debugging dprintf() in build_and_send_cmd() instead of
in every caller. This replaces the command name with the integer
command id, but it does make the debugging more consistent.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Kevin O'Connor [Wed, 30 Dec 2015 05:48:57 +0000 (00:48 -0500)]
tpm: Don't call tpm_set_failure() from tpm_log_extend_event()
The 16bit BIOS interface shouldn't be able to shutdown the TPM. Move
the check for tpm_is_working() and tpm_set_failure() to the only
caller of tpm_log_extend_event() that may shutdown the TPM.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Kevin O'Connor [Sat, 28 Nov 2015 19:25:41 +0000 (14:25 -0500)]
tpm: Simplify tcpa probe
The TPM ACPI tables are only scanned once at startup and the code can
rely on that. Merge find_tcpa_table() into find_tcpa_by_rsdp(), merge
get_lasa_base_ptr() into reset_acpi_log(), and merge tpm_acpi_init()
into tpm_setup().
The tpm_state structure is now only used for TCPA tracking.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Kevin O'Connor [Sat, 28 Nov 2015 18:55:09 +0000 (13:55 -0500)]
tpm: Rework TPM interface shutdown support
The 16bit BIOS interface should only shutdown on request from that
interface - errors from the tcp or acpi log setup should not shutdown
the interface. (Errors from those functions will cause the TPM to be
in a "not working" state which will cause all the 16bit interface
functions to fail.)
Centralize the checking for the interface shutdown condition in
tpm_interrupt_handler32().
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Kevin O'Connor [Sat, 28 Nov 2015 18:43:22 +0000 (13:43 -0500)]
tpm: Move TPM hardware functions from tcgbios.c to hw/tpm_drivers.c
Move the hardware interface functions (tpmhw_probe, tpmhw_is_present,
tpmhw_transmit, and tpmhw_set_timeouts) to tpm_drivers.c code, and
only export those functions. This simplifies the hardware interface.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Kevin O'Connor [Sat, 28 Nov 2015 13:08:57 +0000 (08:08 -0500)]
tpm: Avoid macro expansion of tpm request / response structs
Avoid macros and use regular struct definitions for the request and
response headers. This simplifies the header and reduces the need for
casts in the code.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
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
Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Kevin O'Connor [Wed, 23 Dec 2015 20:42:35 +0000 (15:42 -0500)]
block: Report drive->sectors using "%u" instead of "%d"
The sector count is a 64bit number that is often reported as a 32bit
number (due to limitations in dprintf). Consistently use "%u"
reporting to avoid confusing negative numbers.
Reported-by: Tobias Diedrich <tobiasdiedrich@gmail.com> Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
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>
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.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
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>
Stefan Berger [Mon, 30 Nov 2015 16:14:19 +0000 (11:14 -0500)]
tpm: Add a menu for TPM configuration
This patch adds an new menu entry to the main menu. This menu item enables
the user to enter a TPM control menu which allows control of those aspects
of the TPM's state that can only be controlled while in the firmware
and while physical presence can be asserted.
If the machine has a TPM, the boot menu will look as follows, with
the new menu item accessible by pressing the 't' key.
Stefan Berger [Mon, 30 Nov 2015 16:14:17 +0000 (11:14 -0500)]
tpm: Remove check for working TPM from TPM interrupt handler
Remove the check for a working TPM from the TPM interrupt handler. This then
allows the individual API calls to return information even if the TPM was not
working correctly. Some API calls will still run into the check.
Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
Kevin O'Connor [Mon, 23 Nov 2015 00:16:16 +0000 (19:16 -0500)]
tpm: Merge tpm_log_extend_event() and tpm_extend(); extend before logging
Merge tpm_extend() into tpm_log_extend_event(). Also, the spec states
that a log entry should only be added if the extend succeeds, so
attempt the extend prior to adding to the log.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Kevin O'Connor [Sun, 22 Nov 2015 23:51:31 +0000 (18:51 -0500)]
tpm: Merge tpm_log_event() and tpm_extend_acpi_log()
Merge tpm_extend_acpi_log() and tpm_log_event(). Move error checking
and handling to callers. Don't shutdown the TPM on a failure from the
16bit BIOS interface.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
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>