]> xenbits.xensource.com Git - seabios.git/log
seabios.git
8 years agovirtio: fix virtio-pci
Gerd Hoffmann [Fri, 16 Sep 2016 11:01:46 +0000 (13:01 +0200)]
virtio: fix virtio-pci

virtio-pci calls pci_enable_{io,mem}bar with the bar number,
but the functions expect the bar base register offset.

Reported-by: Igor Mammedov <imammedo@redhat.com>
Tested-by: Igor Mammedov <imammedo@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
8 years agokbd: Move extended and release events out of special key detection switch
Kevin O'Connor [Mon, 12 Sep 2016 14:43:30 +0000 (10:43 -0400)]
kbd: Move extended and release events out of special key detection switch

Move checking for extended scancodes and key release to the top of
__process_key().

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
8 years agopost: Map int 0x05 to entry point
Kevin O'Connor [Mon, 5 Sep 2016 17:49:18 +0000 (13:49 -0400)]
post: Map int 0x05 to entry point

int 0x05 was not assigned in the interrupt table - fix that.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
8 years agokbd: Generate interrupt events for SysReq, PrtScr, and Break
Kevin O'Connor [Mon, 5 Sep 2016 17:38:26 +0000 (13:38 -0400)]
kbd: Generate interrupt events for SysReq, PrtScr, and Break

Generate the appropriate interrupt events for the given keys.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
8 years agousb-hid: Generate Ctrl+Break and Alt+SysReq keys
Kevin O'Connor [Mon, 5 Sep 2016 17:05:36 +0000 (13:05 -0400)]
usb-hid: Generate Ctrl+Break and Alt+SysReq keys

Detect the sequences for generating Ctrl+Break and Alt+SysReq on USB
keyboards and produce the appropriate legacy scancodes.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
8 years agokbd: Ignore fake shift keys
Kevin O'Connor [Mon, 5 Sep 2016 15:56:03 +0000 (11:56 -0400)]
kbd: Ignore fake shift keys

AT keyboards can produce "fake" shift keys on some extended events.
It's not necessary to process these artificial events as the actual
extended keys are detected directly.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
8 years agokbd: Move checking for special keys in __process_keys() into switch
Kevin O'Connor [Sat, 3 Sep 2016 00:58:11 +0000 (20:58 -0400)]
kbd: Move checking for special keys in __process_keys() into switch

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
8 years agokbd: Extract out shift flag setting into new function
Kevin O'Connor [Fri, 2 Sep 2016 22:18:08 +0000 (18:18 -0400)]
kbd: Extract out shift flag setting into new function

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
8 years agokbd: Merge bda->kbd_flag0 and bda->kbd_flag1
Kevin O'Connor [Fri, 2 Sep 2016 20:45:08 +0000 (16:45 -0400)]
kbd: Merge bda->kbd_flag0 and bda->kbd_flag1

Merge the two consecutive u8 fields into a single u16 field.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
8 years agokbd: Suppress keys without mappings
Kevin O'Connor [Fri, 2 Sep 2016 20:18:53 +0000 (16:18 -0400)]
kbd: Suppress keys without mappings

Don't warn if a key without a mapping is pressed - it's known that
some keys aren't mapped to keycodes.  Suppress these keys instead of
sending 0x0000 to the keyboard buffer - as 0x0000 can confuse some
programs.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
8 years agokbd: Implement extended keycode mappings for keypad-enter and keypad-/
Kevin O'Connor [Fri, 2 Sep 2016 20:17:14 +0000 (16:17 -0400)]
kbd: Implement extended keycode mappings for keypad-enter and keypad-/

On a 101-key keyboard the keypad enter and keypad '/' keys have unique
BIOS keycodes that are distinct from the main keyboard enter and '/'
keys.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
8 years agokbd: Implement 101-key keyboard keycode mapping
Kevin O'Connor [Fri, 2 Sep 2016 20:11:23 +0000 (16:11 -0400)]
kbd: Implement 101-key keyboard keycode mapping

The current keyboard code only supports the keycode mappings for
83-key keyboards (plus handling for alt-esc and f11/f12).  Add a more
complete mapping of keycodes for 101-key keyboards.  This adds more
alt key and ctrl key mappings.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
8 years agopic: The default hardware interrupt handlers should not take a parameter
Kevin O'Connor [Fri, 26 Aug 2016 14:52:13 +0000 (10:52 -0400)]
pic: The default hardware interrupt handlers should not take a parameter

Hardware interrupt handlers don't take a parameter.  Remove the
incorrect (and unused) parameter from handle_hwpic1/2().

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
8 years agops2: Remove stale check for timeout warning on reset
Kevin O'Connor [Mon, 15 Aug 2016 02:07:19 +0000 (22:07 -0400)]
ps2: Remove stale check for timeout warning on reset

Commit 4ce5d207 removed the code to wait for a possible second byte
from a keyboard reset command, but it did not remove the extra check
when warning in ps2_recvbyte().  Remove the now stale code in
ps2_recvbyte().

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
8 years agotpm: Append to TPM2 log the hashes used for PCR extension
Kevin O'Connor [Tue, 9 Aug 2016 17:24:51 +0000 (13:24 -0400)]
tpm: Append to TPM2 log the hashes used for PCR extension

Modify the function that writes the TPM logs to take the same digest
passed to tpm_extend.  Update the tpm2 acpi log header to describe the
digest format.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
8 years agotpm: Extend tpm20_extend to support extending to multiple PCR banks
Stefan Berger [Fri, 5 Aug 2016 15:07:11 +0000 (11:07 -0400)]
tpm: Extend tpm20_extend to support extending to multiple PCR banks

Extend the tpm20_extend function to support extending a hash to
multiple PCR banks. The sha1 hash that's being extended into the
sha256 bank for example, will be filled with zero-bytes to the
size of a sha256 hash.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
8 years agotpm: Refactor tpml_digest_values_sha1 structure
Stefan Berger [Fri, 5 Aug 2016 15:07:10 +0000 (11:07 -0400)]
tpm: Refactor tpml_digest_values_sha1 structure

Refactor the tpml_digest_values_sha1 structure so we can later cast it
to the more general tpml_digest_values structure. Move the count member
into this structure.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
8 years agotpm: Restructure tpm20_extend to use buffer and take hash as parameter
Stefan Berger [Fri, 5 Aug 2016 15:07:09 +0000 (11:07 -0400)]
tpm: Restructure tpm20_extend to use buffer and take hash as parameter

Restructure the tpm20_extend function to use a buffer for the
command to send to the TPM. The size of the buffer is calculated
from the size of tpm2_req_extend structure and the appended SHA1
hash.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
8 years agotpm: Retrieve the PCR Bank configuration
Stefan Berger [Fri, 5 Aug 2016 15:07:08 +0000 (11:07 -0400)]
tpm: Retrieve the PCR Bank configuration

Implement tpm20_get_capability and retrieve the PCR Bank configuration
from the TPM using this function.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
8 years agocheckstack: Handle conditional checks at start of functions
Kevin O'Connor [Wed, 10 Aug 2016 14:52:12 +0000 (10:52 -0400)]
checkstack: Handle conditional checks at start of functions

Recent versions of gcc will sometimes place conditional checks in the
code prior to setting up the function's stack frame.  Handle this case
correctly.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
8 years agopvscsi: Use high memory for rings
Dana Rubin [Thu, 4 Aug 2016 11:22:31 +0000 (14:22 +0300)]
pvscsi: Use high memory for rings

Avoid using the scarce ZoneLow memory.
This limits max number of pvscsi controllers.

As driver runs in 32bit mode, use ZoneHigh allocation instead.

Signed-off-by: Dana Rubin <dana.rubin@ravellosystems.com>
Signed-off-by: Shmulik Ladkani <shmulik.ladkani@ravellosystems.com>
8 years agopvscsi: Fix incorrect arguments order in call to memalign_low
Dana Rubin [Thu, 4 Aug 2016 11:22:30 +0000 (14:22 +0300)]
pvscsi: Fix incorrect arguments order in call to memalign_low

First argument should be 'align' and second 'size'.

Signed-off-by: <dana.rubin@ravellosystems.com>
Signed-off-by: <shmulik.ladkani@ravellosystems.com>
8 years agoversion: Update header files now that version.c is not auto generated
Kevin O'Connor [Fri, 5 Aug 2016 17:44:12 +0000 (13:44 -0400)]
version: Update header files now that version.c is not auto generated

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
8 years agovgautil: Move definitions from cbvga.h and clext.h to vgautil.h
Kevin O'Connor [Fri, 5 Aug 2016 15:53:32 +0000 (11:53 -0400)]
vgautil: Move definitions from cbvga.h and clext.h to vgautil.h

These files only need to export simple function definitions - move
them to vgautil.h.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
8 years agovgautil: Move generic definitions from stdvga.h to vgautil.h
Kevin O'Connor [Fri, 5 Aug 2016 15:48:20 +0000 (11:48 -0400)]
vgautil: Move generic definitions from stdvga.h to vgautil.h

Don't use stdvga.h for function definitions of code in stdvgamodes.c
and stdvgaio.c.  Move them to vgautil.h.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
8 years agovgautil: Add new header file with misc function and variable definitions
Kevin O'Connor [Fri, 5 Aug 2016 15:14:58 +0000 (11:14 -0400)]
vgautil: Add new header file with misc function and variable definitions

Move the generic function and variable definitions from vgabios.h to a
new file vgautil.h.  This reduces the size and complexity of
vgabios.h.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
8 years agovgainit: Move video param setup to stdvga_build_video_param()
Kevin O'Connor [Fri, 5 Aug 2016 14:58:24 +0000 (10:58 -0400)]
vgainit: Move video param setup to stdvga_build_video_param()

Move the full video_param_table[] setup (including the updating of the
BDA) to stdvga_build_video_param().

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
8 years agovgafb: Move header definitions from vgabios.h to new file vgafb.h
Kevin O'Connor [Thu, 4 Aug 2016 21:53:45 +0000 (17:53 -0400)]
vgafb: Move header definitions from vgabios.h to new file vgafb.h

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
8 years agoswcursor: Concentrate swcursor logic in swcursor.c
Kevin O'Connor [Thu, 4 Aug 2016 21:02:16 +0000 (17:02 -0400)]
swcursor: Concentrate swcursor logic in swcursor.c

The software cursor code is not frequently used (only the coreboot
framebuffer vga code uses it).  Move its logic out of the main code
and into swcursor.c.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
8 years agoswcursor: Move swcursor code from vgafb.c to new file swcursor.c
Kevin O'Connor [Thu, 4 Aug 2016 20:25:33 +0000 (16:25 -0400)]
swcursor: Move swcursor code from vgafb.c to new file swcursor.c

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
8 years agoblockcmd: CMD_SCSI op is only used in 32bit mode
Kevin O'Connor [Thu, 4 Aug 2016 13:51:10 +0000 (09:51 -0400)]
blockcmd: CMD_SCSI op is only used in 32bit mode

Reduce the size of the 16bit code slightly by recognizing that
CMD_SCSI is only used in 32bit mode.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
8 years agovgabios: Simplify scroll logic
Kevin O'Connor [Fri, 15 Jul 2016 14:54:51 +0000 (10:54 -0400)]
vgabios: Simplify scroll logic

Introduce a new function vgafb_scroll() to scroll a window on the
screen and update vgabios.c to use only that function for scrolling.
This makes the low-level vgafb_move_chars() and vgafb_clear_chars()
local to vgafb.c, and it simplifies the callers.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
8 years agodocs: Note release date of 1.9.3
Kevin O'Connor [Wed, 13 Jul 2016 14:31:29 +0000 (10:31 -0400)]
docs: Note release date of 1.9.3

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
8 years agosmp: restore MSRs on S3 resume
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>
8 years agovgabios: Simplify set_cursor_pos()
Kevin O'Connor [Mon, 4 Jul 2016 16:31:50 +0000 (12:31 -0400)]
vgabios: Simplify set_cursor_pos()

Rework set_cursor_pos() to be slightly simpler.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
8 years agovgabios: Don't check for special case of page==0xff on external calls
Kevin O'Connor [Mon, 4 Jul 2016 16:27:38 +0000 (12:27 -0400)]
vgabios: Don't check for special case of page==0xff on external calls

The original "lgpl vgabios" internally used page=0xff as a mechanism
for specifying the current page.  It also would allow int1013 calls to
externally specify bh==0xff for the current page.  However, there is
no documentation supporting this as an externally available feature.
SeaVGABIOS does not need the internal shortcut; this patch removes the
code.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
8 years agovgabios: Remove special case of dh==0xff in handle_1013()
Kevin O'Connor [Mon, 4 Jul 2016 16:20:48 +0000 (12:20 -0400)]
vgabios: Remove special case of dh==0xff in handle_1013()

The original "lgpl vgabios" had a special case for dh==0xff in its
int1013 (write string) code.  There does not appear to be any VGABIOS
documentation supporting this as an externally available feature.  It
appears this was for its own internal use when writing its strings to
the screen.  SeaVGABIOS doesn't use this hack; this patch removes it
from the code.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
8 years agofw/msr_feature_control: add support to set MSR_IA32_FEATURE_CONTROL
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>
8 years agovirtio: pci cfg access
Gerd Hoffmann [Fri, 3 Jul 2015 09:07:05 +0000 (11:07 +0200)]
virtio: pci cfg access

virtio regions can also be accessed using a window in pci cfg space.
Add support for it.  Enable it in case the virtio regions are mapped
high (above 4g), so direct mmio access doesn't work for us even in
32bit mode.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
8 years agovirtio: uninline _vp_{read,write}
Gerd Hoffmann [Fri, 17 Jun 2016 09:45:43 +0000 (11:45 +0200)]
virtio: uninline _vp_{read,write}

Next patch makes it larger, and I don't think it makes sense to
continue inlining it.  Uninline and move from header to c file.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
8 years agosplash: Skip the RGB555 mode
Zheng Bao [Fri, 20 May 2016 15:26:32 +0000 (15:26 +0000)]
splash: Skip the RGB555 mode

Current JPEG decoding uses the RGB888 or RGB565. So we need to skip
RGB555 mode.

Signed-off-by: Zheng Bao <fishbaozi@gmail.com>
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
8 years agofw/pci: Add support for mapping Intel IGD via QEMU
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>
8 years agotcgbios: Remove unused const variable
Kevin O'Connor [Tue, 17 May 2016 00:51:17 +0000 (20:51 -0400)]
tcgbios: Remove unused const variable

Remove the unused array `PhysicalPresence_CMD_DISABLE` to fix GCC 6
warnings.

Signed-off-by: Paul Menzel <paulepanter@users.sourceforge.net>
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
8 years agousb-xhci: Remove unused const variables
Kevin O'Connor [Tue, 17 May 2016 00:50:28 +0000 (20:50 -0400)]
usb-xhci: Remove unused const variables

Remove the unused arrays `eptype_to_xhci_in` and `eptype_to_xhci_out` to
fix GCC 6 warnings.

Signed-off-by: Paul Menzel <paulepanter@users.sourceforge.net>
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
9 years agodocs: Note release date of 1.9.2
Kevin O'Connor [Fri, 22 Apr 2016 12:32:13 +0000 (08:32 -0400)]
docs: Note release date of 1.9.2

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
9 years agoscsi: Launch a thread when scanning for drives in the scsi drivers
Kevin O'Connor [Tue, 5 Apr 2016 17:04:07 +0000 (13:04 -0400)]
scsi: Launch a thread when scanning for drives in the scsi drivers

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
9 years agovirtio: Use threads when scanning for virtio devices
Kevin O'Connor [Sat, 2 Apr 2016 00:05:45 +0000 (20:05 -0400)]
virtio: Use threads when scanning for virtio devices

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
9 years agoshadow: Batch PCI config writes
Kevin O'Connor [Fri, 1 Apr 2016 19:45:29 +0000 (15:45 -0400)]
shadow: Batch PCI config writes

Enabling and disabling shadow ram on QEMU is slow.  Batch the PCI
writes to reduce the number of memory changes QEMU must implement.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
9 years agooptionroms: Drop support for CONFIG_OPTIONROMS_DEPLOYED
Kevin O'Connor [Fri, 1 Apr 2016 18:23:36 +0000 (14:23 -0400)]
optionroms: Drop support for CONFIG_OPTIONROMS_DEPLOYED

No modern software uses this option and it complicates the code.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
9 years agodisk: Avoid stack_hop() path if already on the extra stack
Kevin O'Connor [Thu, 31 Mar 2016 18:29:07 +0000 (14:29 -0400)]
disk: Avoid stack_hop() path if already on the extra stack

If CONFIG_ENTRY_EXTRASTACK is set (enabled by default) then the 16bit
disk interface code is already running on the extra stack and it is
not necessary to support stack switching on each disk request.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
9 years agoblock: Move send_disk_op() from block.c to disk.c
Kevin O'Connor [Thu, 31 Mar 2016 18:20:30 +0000 (14:20 -0400)]
block: Move send_disk_op() from block.c to disk.c

The send_disk_op() function is only called from the 16bit handlers
found in disk.c.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
9 years agompt-scsi: Declare 'int i' outside of for loop for older compilers
Kevin O'Connor [Thu, 31 Mar 2016 01:38:56 +0000 (21:38 -0400)]
mpt-scsi: Declare 'int i' outside of for loop for older compilers

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
9 years agoSupport for booting from LSI Logic LSI53C1030, SAS1068, SAS1068e
Don Slutz [Fri, 25 Mar 2016 16:04:31 +0000 (17:04 +0100)]
Support for booting from LSI Logic LSI53C1030, SAS1068, SAS1068e

Also known as Fusion MPT disk; this controller model is supported
by VirtualBox and VMware, and QEMU support patches have been
posted.

Signed-off-by: Don Slutz <Don.Slutz@Gmail.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
9 years agosdcard: skip detection of PCI sdhci controllers if etc/sdcard used
Matt DeVillier [Thu, 17 Mar 2016 01:37:35 +0000 (20:37 -0500)]
sdcard: skip detection of PCI sdhci controllers if etc/sdcard used

Some BayTrail ChromeOS devices have the eMMC controller hidden (thus
requiring the use of etc/sdcard), while others do not, making it
problematic to have a single payload which serves all devices
properly.   Therefore, if the CBFS contains etc/sdcard entries, skip
detection of any visible PCI sdhci controllers in order to avoid
duplicate entries in the boot menu.

Signed-off-by: Matt DeVillier <matt.devillier@gmail.com>
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
9 years agofw/pci: add Q35 S3 support
Marcel Apfelbaum [Tue, 1 Mar 2016 14:06:45 +0000 (16:06 +0200)]
fw/pci: add Q35 S3 support

Following the i440fx example, save the LPC, SMBUS and PCIEXBAR bdfs
between OS sleeps and use them to re-configure the
corresponding registers.

Tested-by: Gal Hammer <ghammer@redhat.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Marcel Apfelbaum <marcel@redhat.com>
9 years agoahci: set transfer mode according to the capabilities of connected drive
Gerd Hoffmann [Sat, 20 Feb 2016 14:20:15 +0000 (15:20 +0100)]
ahci: set transfer mode according to the capabilities of connected drive

Use case: cf cards behind sata-ide bridge, which might not support
the default transfer mode.

Based on a patch by Werner Zeh <werner.zeh@siemens.com>,
with some minor tweaks applied.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
9 years agotpm: Write logs in TPM 2 format
Kevin O'Connor [Sat, 6 Feb 2016 03:28:17 +0000 (22:28 -0500)]
tpm: Write logs in TPM 2 format

Add support for the TPM 2 format of log messages.

Write the logs in the format that is appropriate for the version of
the host's TPM. For TPM 1.2 write it in the 'pcpes' structure's
format, for TPM 2 in the new TPM 2 format.

By using this method we can keep the API interface on systems with a
TPM 2 even though applications pass in the 'pcpes' structures
directly. The log will still be written in the appropriate format.

The TPM 2 log contains a TPM 1.2 type of entry of event type
EV_NO_ACTION and entry of type TCG_EfiSpeIdEventStruct as the first
entry. This is described in the EFI specification (section 5.3):

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
9 years agobuild: fix .text section address alignment
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>

9 years agodocs: Note release date of 1.9.1
Kevin O'Connor [Sat, 20 Feb 2016 02:09:19 +0000 (21:09 -0500)]
docs: Note release date of 1.9.1

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
9 years agotpm: Unify tpm_fill_hash()/tpm_log_extend_event() and use in BIOS interface
Kevin O'Connor [Sat, 6 Feb 2016 02:05:27 +0000 (21:05 -0500)]
tpm: Unify tpm_fill_hash()/tpm_log_extend_event() and use in BIOS interface

Don't call tpm_fill_hash() or tpm_log_extend_event() from any internal
code (ie, tpm_add_measurement_to_log).  The internal code does not
require the additional checks that these functions provide.

Unify the tpm_fill_hash() and tpm_log_extend_event() into a new
function hash_log_extend(), and use this function only in the 16bit
BIOS interface code.  With the code now specific to the BIOS interface
it can more easily return a BIOS specific error return code.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
9 years agotpm: Filter TPM commands in passthrough API
Stefan Berger [Tue, 2 Feb 2016 18:09:19 +0000 (13:09 -0500)]
tpm: Filter TPM commands in passthrough API

Filter TPM commands in the passthrough API call by matching the
type of tag in the header with the version of the underlying TPM.
Return an error code if the tag indicates that the command is
for the wrong TPM version.

Fix a size check on the way.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
9 years agotpm: Implement TPM 2's tpm_set_failure part
Stefan Berger [Tue, 2 Feb 2016 18:09:17 +0000 (13:09 -0500)]
tpm: Implement TPM 2's tpm_set_failure part

Implement TPM 2's tpm_set_failure part.

We follow this specification:

TCG PC Client Specific Platform Firmware Profile for TPM 2.0 Systems Revision 1.0 Version 21

It can be found on this page:

http://www.trustedcomputinggroup.org/resources/specifications_in_public_review

Make the TPM unavailable for OS-present applications following 6.2 item 2.d.i .

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
9 years agotpm: Implement tpm20_menu
Stefan Berger [Tue, 2 Feb 2016 18:09:16 +0000 (13:09 -0500)]
tpm: Implement tpm20_menu

In the TPM 2 menu we currently only allow to run the TPM2_Clear operation.
For this we follow the TCG Physical Presence Interface Specification
to be found here:

http://www.trustedcomputinggroup.org/resources/tcg_physical_presence_interface_specification

Table 3 shows the 'Clear' operation and the sequence of commands to send.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
9 years agotpm: Implement tpm20_extend
Stefan Berger [Tue, 2 Feb 2016 18:09:15 +0000 (13:09 -0500)]
tpm: Implement tpm20_extend

Implement the tpm20_extend function. We use it with only SHA1.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
9 years agotpm: Implement tpm20_prepboot
Stefan Berger [Tue, 2 Feb 2016 18:09:14 +0000 (13:09 -0500)]
tpm: Implement tpm20_prepboot

Implement tpm20_preboot.

Here we set the platform password to a random password that prevents
higher layers (OS) to get this password. This avoids bad things like users
clearing the TPM, erasing EK (primary key) certificates, changing the
primary key etc.

The clearing of the TPM will still be possible through the TPM 2 menu.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
9 years agotpm: Implement tpm20_set_timeouts
Stefan Berger [Tue, 2 Feb 2016 18:09:13 +0000 (13:09 -0500)]
tpm: Implement tpm20_set_timeouts

The TIS timeouts for TPM 2 are different than for TPM 1.2.
Also the timeouts indicating a failed TPM 2 command are different.
Further, the  command durations and timeouts cannot be read from the device.

We take the command timeout values for short, medium, and long running
commands from table 15 of the following specification:

TCG PC Client Platform TPM Profile (PTP) Specification

http://www.trustedcomputinggroup.org/resources/pc_client_platform_tpm_profile_ptp_specification

The values should work for all physical TPMs.

The tricky thing with virtualized environments is that the values
may need to be longer for a system where a vTPM cannot get sufficient
cycles. So a future patch _may_ need to multiply those values here
with some factor.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
9 years agotpm: Implement tpm20_startup and tpm20_s3_resume
Stefan Berger [Tue, 2 Feb 2016 18:09:12 +0000 (13:09 -0500)]
tpm: Implement tpm20_startup and tpm20_s3_resume

Implement tpm20_startup and tpm20_s3_resume and their dependencies.

We follow this specification:

TCG PC Client Specific Platform Firmware Profile for TPM 2.0 Systems Revision 1.0 Version 21

It can be found on this page:

http://www.trustedcomputinggroup.org/resources/specifications_in_public_review

Power on: Figure 7 & 7.3.2 item 4.
S3: Figure 9 & 7.3.2 item 4.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
9 years agotpm: Prepare code for TPM 2 functions
Stefan Berger [Tue, 2 Feb 2016 18:09:11 +0000 (13:09 -0500)]
tpm: Prepare code for TPM 2 functions

This patch prepares the tcgbios.c file for extension with TPM 2
specific code by:

 o prefixing all TPM 1.2 specific functions with tpm12_
 o where necessary, introduce switch statements in tpm_ - prefixed functions;
   here we branch into TPM versions specific code
 o introduce tpm_ - prefixed functions where necessary; mostly in those
   cases where tpm12_ functions are too large and where the tpm_ function
   then only holds the switch statement
 o leave FIXMEs where we need to write TPM 2 specific code; subsequent patches
   will replace those FIXMEs

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
9 years agotpm: Factor out tpm_extend
Stefan Berger [Tue, 2 Feb 2016 18:09:10 +0000 (13:09 -0500)]
tpm: Factor out tpm_extend

In preparation for TPM 2 code support, factor out the TPM 1.2 specific
code from tpm_log_extend_event and put it into tpm_extend().

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
9 years agotpm: Extend TPM TIS with TPM 2 support.
Stefan Berger [Tue, 2 Feb 2016 18:09:09 +0000 (13:09 -0500)]
tpm: Extend TPM TIS with TPM 2 support.

Extend the probing of the interface with TPM 2 specifics.

Use the new interface ID register of the TIS to check whether
a TPM 1.2 or a TPM 2 is underneath.

We select the TIS if possible and lock it so we can issue commands
during S3 for example and prevent the OS from changing to CRB type
of interface.

The register is described in table 13 here:

http://www.trustedcomputinggroup.org/resources/pc_client_platform_tpm_profile_ptp_specification

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
9 years agoblock: Move drive setup to new function block_setup()
Kevin O'Connor [Wed, 3 Feb 2016 16:00:17 +0000 (11:00 -0500)]
block: Move drive setup to new function block_setup()

Move the list of drive setup calls from post.c to a new function in
block.c.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
9 years agoscsi: Always use MAXDESCSIZE when building drive description
Kevin O'Connor [Wed, 3 Feb 2016 08:27:36 +0000 (03:27 -0500)]
scsi: Always use MAXDESCSIZE when building drive description

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
9 years agopci: Split low-level pci code from higher-level 'struct pci_device' code
Kevin O'Connor [Wed, 3 Feb 2016 06:28:20 +0000 (01:28 -0500)]
pci: Split low-level pci code from higher-level 'struct pci_device' code

Split pci.c into pci.c and pcidevice.c.  The low-level code that
interacts directly with the PCI devices remains in pci.c, while
functions dealing with the higher level pci_device cache move to
pcidevice.c.  Only pci.c is needed in 16bit mode.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
9 years agopci: Move code in pci.c that is specific to pciinit.c to pciinit.c
Kevin O'Connor [Wed, 3 Feb 2016 05:47:27 +0000 (00:47 -0500)]
pci: Move code in pci.c that is specific to pciinit.c to pciinit.c

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
9 years agopci: Implement '%pP' printf handler for 'struct pci_device' pointers
Kevin O'Connor [Wed, 3 Feb 2016 08:03:15 +0000 (03:03 -0500)]
pci: Implement '%pP' printf handler for 'struct pci_device' pointers

Handle '%pP' format descriptions as a pointer to a 'struct pci_device'
and display it in bus:device.function (%02x:%02x.%x) format.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
9 years agopci: Consistently set pci->have_drivers for devices with internal drivers
Kevin O'Connor [Wed, 3 Feb 2016 03:50:33 +0000 (22:50 -0500)]
pci: Consistently set pci->have_drivers for devices with internal drivers

Set the pci->have_drivers flag for any device that calls
pci_enable_x() to ensure that the flag is consistently set on any
device with an internal driver.  Setting this flag prevents an option
rom on the device from being executed.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
9 years agovirtio: Convert to new PCI BAR helper functions
Kevin O'Connor [Wed, 3 Feb 2016 03:34:27 +0000 (22:34 -0500)]
virtio: Convert to new PCI BAR helper functions

Use the pci_enable_x() functions.

This patch also converts cap->addr from a 'u32' to a union storing a
'u32' or a 'void*'.  This makes it more clear when the address is a
virtual memory address.

The virtio controller code will now explicitly set PCI_COMMAND_MEMORY
and/or PCI_COMMAND_IO instead of assuming it has already been enabled.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
9 years agoxhci: Convert to new PCI BAR helper functions
Kevin O'Connor [Wed, 3 Feb 2016 03:33:17 +0000 (22:33 -0500)]
xhci: Convert to new PCI BAR helper functions

Use the pci_enable_x() functions.

The xhci controller code will now explicitly set PCI_COMMAND_MEMORY
instead of assuming it has already been enabled.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
9 years agouhci: Convert to new PCI BAR helper functions
Kevin O'Connor [Wed, 3 Feb 2016 03:29:49 +0000 (22:29 -0500)]
uhci: Convert to new PCI BAR helper functions

Use the pci_enable_x() functions.

The uhci controller code will now explicitly set PCI_COMMAND_IO
instead of assuming it has already been enabled.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
9 years agoohci: Convert to new PCI BAR helper functions
Kevin O'Connor [Wed, 3 Feb 2016 03:29:14 +0000 (22:29 -0500)]
ohci: Convert to new PCI BAR helper functions

Use the pci_enable_x() functions.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
9 years agoehci: Convert to new PCI BAR helper functions
Kevin O'Connor [Wed, 3 Feb 2016 03:28:06 +0000 (22:28 -0500)]
ehci: Convert to new PCI BAR helper functions

Use the pci_enable_x() functions.

The ehci controller code will now explicitly set PCI_COMMAND_MEMORY
instead of assuming it has already been enabled.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
9 years agosdcard: Convert to new PCI BAR helper functions
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>
9 years agopvscsi: Convert to new PCI BAR helper functions
Kevin O'Connor [Wed, 3 Feb 2016 03:21:49 +0000 (22:21 -0500)]
pvscsi: Convert to new PCI BAR helper functions

Use the pci_enable_x() functions.

The pvscsi controller code will now explicitly set PCI_COMMAND_MEMORY
instead of assuming it has already been enabled.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
9 years agomegasas: Convert to new PCI BAR helper functions
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>
9 years agolsi-scsi: Convert to new PCI BAR helper functions
Kevin O'Connor [Wed, 3 Feb 2016 03:18:54 +0000 (22:18 -0500)]
lsi-scsi: Convert to new PCI BAR helper functions

Use the pci_enable_x() functions.

The lsi-scsi controller code will now explicitly set PCI_COMMAND_IO
instead of assuming it has already been enabled.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
9 years agoesp-scsi: Convert to new PCI BAR helper functions
Kevin O'Connor [Wed, 3 Feb 2016 03:17:01 +0000 (22:17 -0500)]
esp-scsi: Convert to new PCI BAR helper functions

Use the pci_enable_x() functions.

The esp-scsi controller code will now explicitly set PCI_COMMAND_IO
instead of assuming it has already been enabled.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
9 years agoata: Convert to new PCI BAR helper functions
Kevin O'Connor [Wed, 3 Feb 2016 03:14:49 +0000 (22:14 -0500)]
ata: Convert to new PCI BAR helper functions

Use the pci_enable_x() functions.

The ATA controller code will now explicitly set PCI_COMMAND_IO instead
of assuming it has already been enabled.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
9 years agoahci: Convert to new PCI BAR helper functions
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>
9 years agopci: Add helper functions for internal driver BAR handling
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>
9 years agousb: Eliminate USB controller setup thread
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>
9 years agoehci: Only delay UHCI/OHCI port scan until after EHCI setup completes
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>
9 years agoFix comment typo
Cao jin [Sat, 30 Jan 2016 07:50:38 +0000 (15:50 +0800)]
Fix comment typo

Signed-off-by: Cao jin <caoj.fnst@cn.fujitsu.com>
9 years agobiostables: Support SMBIOS 2.6+ UUID format
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.

Signed-off-by: Cole Robinson <crobinso@redhat.com>
9 years agokbd: Refactor capslock and numlock handling
Kevin O'Connor [Sun, 10 Jan 2016 18:26:26 +0000 (13:26 -0500)]
kbd: Refactor capslock and numlock handling

Simplify the scan_to_keycode[] table by implementing numlock and
capslock checking in the code.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
9 years agokbd: Don't treat scancode and asciicode as separate values
Kevin O'Connor [Sun, 10 Jan 2016 18:01:48 +0000 (13:01 -0500)]
kbd: Don't treat scancode and asciicode as separate values

The scancode/asciicode pair can be more easily handled as a single
16bit value.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
9 years agopost: Always set HaveRunPost prior to setting any other global variable
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>
9 years agoresume: Make KVM soft reboot loop detection more flexible
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>
9 years agocoreboot: Check for unaligned cbfs header
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>
9 years agotpm: Do not set TPM in failure mode if menu command fails
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>
9 years agotpm: Remove usage of PP_CMD_ENABLE from all but one place
Stefan Berger [Thu, 7 Jan 2016 17:02:50 +0000 (12:02 -0500)]
tpm: Remove usage of PP_CMD_ENABLE from all but one place

Remove the usage of PhysicalPresence_CMD_ENABLE from all but
the assert_physical_presence function.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>