Kevin O'Connor [Sat, 24 May 2014 14:49:50 +0000 (10:49 -0400)]
smp: Replace QEMU SMP init assembler code with C; run only in 32bit mode.
Change the multi-processor init code to trampoline into 32bit mode on
each of the additional processors. Implement an atomic lock so that
each processor performs its initialization serially.
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Kevin O'Connor [Mon, 7 Apr 2014 23:49:12 +0000 (19:49 -0400)]
smm: Replace SMI assembler code with C code.
Convert the SMI handler from assembly to C. This makes the handler
easier to understand and enhance.
The new handler will use references to the reserved memory at
0xf0000-0x100000. If the physical memory in that range is modified at
runtime, then the SMI handler will cease to function properly (and may
allow unintended code to run in SMM mode). However, that area is
marked as reserved and is normally made read-only at runtime, so there
is little risk in relying on it.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Paolo Bonzini [Thu, 15 May 2014 11:22:29 +0000 (13:22 +0200)]
smm: unify SMM handlers
The next patch will add shared code between the initial handler for
SMBASE relocation and the actual SMI handler. Combine the code of
the two handlers for simplicity.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Kevin O'Connor [Sat, 10 May 2014 05:20:46 +0000 (01:20 -0400)]
cdemu: store internal cdemu fields in standard "el-torito" spec format.
Store the fields necessary to export the "el-torito" spec information
directly in an internal copy of the "el-torito" struct. This
simplifies the interface and obviates the need for an internal home
grown struct with the same info.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Kevin O'Connor [Sat, 10 May 2014 15:54:48 +0000 (11:54 -0400)]
edd: Use sectors==-1 to detect removable media.
Don't look for DTYPE_ATA_ATAPI to determine if a removable media (such
as a cdrom) is present, instead look for a -1 in the sector count.
This improves the results for cdroms on controllers other than ATA
ATAPI.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
David Woodhouse [Mon, 2 Jun 2014 13:00:14 +0000 (14:00 +0100)]
Update EFI_COMPATIBILITY16_TABLE to match 0.98 spec update
Unless CONFIG_MALLOC_UPPERMEMORY is turned off, we expect to use the
space between the top of option ROMs and the bottom of our own BIOS code
as a stack. OVMF was previously marking the whole region from 0xC0000 to
0xFFFFF read-only before invoking our Legacy16Boot method. Read-only
stack considered harmful.
Version 0.98 of the CSM spec adds the UmaAddress and UmaSize fields which
allow the CSM to specify a memory region that needs to be writeable, so
provide that information.
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Kevin O'Connor [Thu, 22 May 2014 20:59:16 +0000 (16:59 -0400)]
python3 fixes for vgabios and csm builds.
Avoid using chr() as this produces unicode strings on python3. Make
sure to only use ord() on slices as the python3 bytearray type returns
an integer on a non-slice array access.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Gerd Hoffmann [Tue, 13 May 2014 12:09:00 +0000 (14:09 +0200)]
Allow using full io region on q35.
If qemu is new enough to support acpi table loading,
then go move pmbase out of the way. This allows to
use the whole 0x1000 -> 0xffff io address space on q35.
piix has hotplug ports in the 0xa000 -> 0xafff area,
so we can't do the same there.
Kevin O'Connor [Thu, 8 May 2014 22:32:32 +0000 (18:32 -0400)]
Fix int 1589 calls when CONFIG_ENTRY_EXTRASTACK is enabled.
The int 1589 call is entered in real mode and returns in protected
mode. However, the code to use the "extra stack" does not support
that. Fix this by never using the "extra stack" on int 1589 calls.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Kevin O'Connor [Sat, 19 Apr 2014 16:22:22 +0000 (12:22 -0400)]
If an int 1587 call is made from an option rom, stay in bigreal mode.
Modify the int 1587 handler to check if the POST phase is still
running. If it is, use bigreal mode segment limits so that the caller
remains in bigreal mode when the 1587 handler completes. This helps
with SeaVGABIOS' use of "direct" framebuffer accesses (an option rom
may attempt to display text during its option rom execution which can
cause SeaVGABIOS to make the int 1587 calls).
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Gabriel L. Somlo [Wed, 23 Apr 2014 19:04:49 +0000 (15:04 -0400)]
SMBIOS: Check for aggregate tables & entry point in fw_cfg
Check fw_cfg for the presence of an aggregate set of smbios
tables (etc/smbios/smbios-tables) and an entry point structure
(etc/smbios/smbios-anchor), and, if found, use them instead of
generating entries locally.
We ensure the presence of a type 0 (bios information) structure
by generating it locally if necessary, which is expected to be
the common case.
Signed-off-by: Gabriel L. Somlo <somlo@cmu.edu> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
hw/pci: check if pci2pci bridges implement optional limit registers
<I/O Base Register, I/O Limit Register> pair and
<Prefetchable Memory Base Register, Prefetchable Memory Limit Register> pair
are both optional.
Do not reserve ranges if the above registers are not implemented.
hw/pci: reserve IO and mem for pci-2-pci bridges with no devices attached
If a pci-2-pci bridge supports hot-plug functionality but there are no devices
connected to it, reserve IO/mem in order to be able to attach devices
later. Do not waste space, use minimum allowed.
Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Marcel Apfelbaum <marcel.a@redhat.com>
Kevin O'Connor [Sun, 6 Apr 2014 22:48:39 +0000 (18:48 -0400)]
vgabios: PMM scan was incorrectly depending on a zero %ds segment.
Make sure the PMM scanning code uses the GET_FARVAR macro. (The
existing code only worked because SeaBIOS happens to call the vgabios
in bigreal mode with %ds == %ss = 0.) Also, the scan doesn't require
bigreal mode - use accesses relative to the SEG_BIOS segment so that
the scan can work in regular real mode.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Kevin O'Connor [Mon, 24 Mar 2014 16:49:44 +0000 (12:49 -0400)]
vgabios: Rewrite vgafb.c graphics operations to set of 4 standard operators.
The vgabios graphics manipulations can all be implemented on top of 4
basic primitives: read 8 pixels, write 8 pixels, move pixels, and
clear pixels. Implement these four operators for all the graphics
modes and rewrite the graphics functions in vgafb.c to use them. This
simplifies the graphics code as the high level logic no longer needs
to be implemented for each graphical framebuffer type.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Kevin O'Connor [Fri, 21 Mar 2014 01:16:28 +0000 (21:16 -0400)]
vgabios: Split vgafb_scroll() into separate move and clear functions.
Rewrite the low-level scroll code so that it is implemented using two
basic operations: move text and clear text. This simplifies the
low-level code as it no longer needs to handle up scrolling vs down
scrolling. Determining the direction of the scroll is now done in the
higher level (vgabios.c) code.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Kevin O'Connor [Mon, 7 Apr 2014 21:31:43 +0000 (17:31 -0400)]
apm: Remove old Bochs mechanism for shutdown/suspend/standby.
Remove the old mechanism that used port 0x8900 to send apm signals.
Recent versions of QEMU no longer support this port. Bochs and QEMU
only ever supported shutdown anyway, and shutdown is already available
via an ACPI mechanism.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Kevin O'Connor [Mon, 7 Apr 2014 20:02:22 +0000 (16:02 -0400)]
Document no new changes to pirtable.c, mptable.c, acpi.c, and smbios.c.
Add a note to the code that generates the pir, mptable, smbios, and
smbios tables that no new changes are expected. Going forward, it is
expected that if any changes are needed to these bios tables that
SeaBIOS will get the tables passed in from upstream.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Kevin O'Connor [Mon, 7 Apr 2014 20:35:18 +0000 (16:35 -0400)]
Use biostables.c for copying bios tables even when generating them.
Use the biostables.c copy_pir(), copy_smbios(), copy_acpi_rsdp(), and
copy_mptable() code even when using the legacy bios table generation
code. This unifies the final bios table deployment code between qemu,
coreboot, and csm.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Kevin O'Connor [Mon, 7 Apr 2014 19:48:12 +0000 (15:48 -0400)]
smbios: Move smbios parsing logic from smbios.c to biostables.c.
After this change, src/fw/smbios.c only contains the legacy code for
generating SMBIOS tables. This change only contains code movement -
no logic is changed.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Kevin O'Connor [Mon, 7 Apr 2014 19:42:04 +0000 (15:42 -0400)]
acpi: Move acpi parsing logic from acpi.c to biostables.c / paravirt.c.
After this change, src/fw/acpi.c only contains the legacy code for
generating ACPI tables. This change only contains code movement - no
logic is changed.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Kevin O'Connor [Mon, 7 Apr 2014 16:15:34 +0000 (12:15 -0400)]
Replace CONFIG_THREAD_OPTIONROMS with a runtime config setting.
Replace the CONFIG_THREAD_OPTIONROMS option with the CBFS (or fw_cfg)
file "etc/threads". This allows for the "threads during optionrom"
capability to be enabled/disabled without requiring SeaBIOS to be
recompiled. A value of "2" in this file will enable threads to run
during option rom execution.
This change also allows for all threads to be disabled via the same
runtime config file. Setting the file to a value of "0" will cause
SeaBIOS to perform all hardware initialization serially.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Eric Northup [Wed, 12 Mar 2014 20:42:36 +0000 (13:42 -0700)]
vp_init_simple: enable PCI bus-mastering before relying on DMA.
An analogous change was made in the LSI scsi driver, commit 7d052575258ad2fc487ca3f9a6b62eff1b767900. Qemu works around guests that don't
correctly enable PCI bus mastering before using virtio queues' DMA (search for
VIRTIO_PCI_BUG_BUS_MASTER / VIRTIO_PCI_FLAG_BUS_MASTER_BUG ), but it'd be
better to be correct.
Signed-off-by: Eric Northup <digitaleric@google.com>
Kevin O'Connor [Tue, 11 Mar 2014 15:46:42 +0000 (11:46 -0400)]
smbios: Default all values to zero.
Make sure to initialize the entire smbios area to zero so that any
field not explicitly initialized does not have random values. (It was
found that the memory_error_information_handle field in smbios_type_17
was not being set.)
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Kevin O'Connor [Tue, 18 Feb 2014 18:48:09 +0000 (13:48 -0500)]
vgabios: Fix PMM allocation request size.
The size of a PMM memory request is in "paragraphs" so the size needs
to be divided by 16. Fix the request so only the desired 512 bytes is
allocated instead of 8K.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Kevin O'Connor [Fri, 17 Jan 2014 17:11:49 +0000 (12:11 -0500)]
coreboot: Add support for a "links" file to have aliases in CBFS.
The "links" file is a newline separated list where each line is a
"link name" followed by a "destination name" separated by a space
character. For each line, SeaBIOS will consider each "link name" to
be a CBFS file that has the contents found in the CBFS file with
"destination name".
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Kevin O'Connor [Sat, 8 Feb 2014 21:43:30 +0000 (16:43 -0500)]
vgabios: Refactor write_teletype and write_chars.
Factor out the common code of writing to the screen and advancing the
cursor position to a new function write_char(). Eliminate
write_chars() and then simplify write_teletype(). Also, eliminate the
separate scroll_one() function as it no longer reduces stack space.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Kevin O'Connor [Sat, 8 Feb 2014 17:29:20 +0000 (12:29 -0500)]
vgabios: Don't interpret TAB character.
Several sources document that the Bell, Backspace, newline, and
carriage return characters are interpreted by int 10/0e. There does
not seem to be any references to that function interpreting tab. The
original "lgpl vgabios" has code for interpreting tab, but the code is
incorrect. Finally, tests on an ATI vgabios indicate that tab is not
interpreted.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Kevin O'Connor [Thu, 6 Feb 2014 03:47:29 +0000 (22:47 -0500)]
vgabios: Attempt to detect old x86emu and force a fault.
Check for cases where the leal instruction does not work. This
instruction is known to not be emulated properly on old versions of
x86emu. If a broken version of x86emu is found, force a fault that
x86emu will easily detect. This should help prevent soft failures
when running old software.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Kevin O'Connor [Thu, 6 Feb 2014 00:29:08 +0000 (19:29 -0500)]
vgabios: Simplify the bios save state area.
The structure of the "bios save state area" as returned by
handle_101c() and vbe_104f04() does not follow any particular order.
(And there does not appear to be any documentation that would require
it to follow a particular order.)
So, rearrange the layout of the struct to make save and restore
simpler.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Kevin O'Connor [Wed, 5 Feb 2014 23:49:44 +0000 (18:49 -0500)]
vgabios: Make sure exported structs use PACKED.
Commit ca668640 introduced structs for data returned from the
handle_101b and handle_101c calls. However, the structs were not
declared as packed and that caused incorrect behavior for
handle_101b. This was seen to break some old DOS programs (Win3 setup
and DISPLAY.SYS). This patch adds in the necessary PACKED declaration
to the structs.
The 'struct saveBDAstate' remains un-packed, as it does not appear
that its contents are documented. (And, its format already differs
from what was in the previous "lgpl vgabios".)
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Kevin O'Connor [Mon, 20 Jan 2014 16:47:43 +0000 (11:47 -0500)]
Increase maximum size of permanent high memory area.
Some XHCI controllers can request a significant chunk of reserved
memory for scratch pad buffers. (At least one controller Intel
Haswell based controller has been seen to request 64KiB.) Unused
memory is returned after POST completes, so it should be okay to
increase the maximum permanent high memory zone from 64K to 256K.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Kevin O'Connor [Sat, 28 Dec 2013 02:09:53 +0000 (21:09 -0500)]
xhci: Eliminate 'struct xhci_device'.
Eliminate the xhci_device struct by storing the slotid in usbdevice_s
and in xhci_pipe. The remaining storage in that struct (xhci_devctx)
is available from xhci->devs.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Gerd Hoffmann [Thu, 23 Jan 2014 14:48:19 +0000 (15:48 +0100)]
pci: improve io address space allocation
This patch improves the io address space allocation. It adds a check
that the region above 0xc000 which is traditionally used for pci io
is actually big enougth. If it isn't it tries the larger window at
0x1000. If that is to small too it errors out.
When creating guests with multiple pci-pci bridges (and devices with
io regions behind them) the 0xc000 -> 0xffff region quickly becomes
too small.
While being at it document the io address space layout used by
qemu/seabios.
Kevin O'Connor [Wed, 15 Jan 2014 18:42:50 +0000 (13:42 -0500)]
debug: Only call serial_debug_preinit() at startup.
The serial_debug_preinit() function disables serial interrupts so that
the OS doesn't get confused by "transmit buffer empty" interrupts
caused when seabios writes to the serial port. It's unnecessary
paranoia to keep rechecking that interrupts are disabled.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Kevin O'Connor [Wed, 15 Jan 2014 18:34:19 +0000 (13:34 -0500)]
debug: Add runtime option to not report the debug serial port to the OS.
DOS resets the serial ports reported by the BIOS. This can mess up
debugging and timing when the serial baud rate changes on the debug
port. The new "etc/advertise-serial-debug-port" option allows one to
suppress the debug serial port from the normal list of serial ports
the BIOS reports to DOS.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Kevin O'Connor [Sat, 18 Jan 2014 01:21:20 +0000 (20:21 -0500)]
coreboot: Support alternative locations for CBFS.
The Google builds of SeaBIOS place the CBFS data in a non-standard
location. Add a config parameter to support non-standard locations.
This is based on a patch from Stefan Reinauer <reinauer@chromium.org>
in the Chromium seabios repo (commit 60534ec785).
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Kevin O'Connor [Mon, 20 Jan 2014 16:53:12 +0000 (11:53 -0500)]
build: Update kconfig to version in Linux 3.13.
Update kconfig (from Linux v3.11-rc6) to the latest version (Linux
v3.13).
This copyies kconfig from Linux with only the changes necessary to
work with the SeaBIOS build (the equivalent of the earlier SeaBIOS 0da7bfdf commit) and the changes necessary to always emit symbols
(SeaBIOS b623e7c5 commit).
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Gerd Hoffmann [Mon, 20 Jan 2014 13:32:54 +0000 (14:32 +0100)]
smbios: catch zero-length strings
qemu may pass us zero-length strings for smbios fields, when starting
qemu this way ...
qemu -smbios type=1,version=,serial=test
... for example.
Today we don't specifically handle them and simply append them to the
string list. Therefore we get two string-terminating zeros in a row.
Result is that we by accident create a end-of-entry marker in the middle
of the entry.
Fix this by handling zero-length strings like non-present strings.