| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
On QEMU it's necessary to manually reset the BIOS memory region
between 0xc0000-0x100000 on a reboot. After this manual memory reset
is completed, it's not valid to use the generic reset mechanisms.
Rename qemu_prep_reset() to qemu_reboot() and change the function to
immediately reboot after the code memcpy.
This fixes a bug that could cause code corruption on reboots - calling
the udelay() function (as invoked by i8042_reboot and/or pci_reboot)
was not valid after the BIOS was memcpy'd.
Reported-by: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
Tested-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
|
|
|
|
|
|
|
|
|
|
| |
Any pointers to BIOS-allocated memory that were written back to QEMU
fw_cfg files are replayed when resuming from S3 sleep.
Signed-off-by: Ben Warren <ben@skyportsystems.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This patch implements the main part of the TCG BIOS extensions. It provides
the following functionality:
- initialization of the TCPA ACPI table used for logging of measurements
- initialization of the TPM by sending a sequence of commands to it
- proper setup of the TPM before the BIOS hands over control to the bootloader
- support for S3 resume; BIOS sends TPM_Startup(ST_STATE) to TPM
- enable configuration of SeaBIOS to be built with TCGBIOS extensions
All TCG BIOS extensions are activated with CONFIG_TCGBIOS.
Structures that are needed in subsequent patches are also included in
tcgbios.h at this point.
The effect of this patch is that it initialized the TPM upon VM start
and S3 resume.
Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
On resume, the OS queries the power management event that
caused it. In order to complete this task, it executes some
reads to the piix pm io space. This all happens before the
OS has a chance to restore the PCI config space for devices,
so it is bios's responsibility to make sure the pm IO space
is configured correctly. (During suspend, the piix pm
configuration space is lost).
Note: For 'ordinary' pci devices the config space is
saved by the OS on sleep and restored on resume.
Signed-off-by: Marcel Apfelbaum <marcel.a@redhat.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
|
|
|
|
|
|
|
|
|
|
| |
Avoid hardware specific code in output.c. This will reduce the amount
of change needed to output.c as support for more serial hardware is
added.
This patch also renames some functions to improve the naming scheme.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
|
|
|
|
|
|
|
| |
Move the inb(), insb(), etc. code from ioport.h to x86.h. Move the
PORT_* definitions to their appropriate hardware files.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
|
|
|
|
|
|
|
|
|
|
|
| |
Move the DMA controller code in resume.c and hw/floppy.c to a new file
hw/dma.c. This centralizes the DMA controller code into one place.
Also, don't unmask the floppy DRQ during floppy setup - there is no
reason to unmask the DRQ prior to a command being programmed into the
DMA controller.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
|
|
|
|
|
|
|
|
|
| |
Group the Real Time Clock code into hw/rtc.[ch].
Also, use rtc_read/write/mask function naming (instead of
inb/outb_cmos) to be more consistent with other register accessors.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
|
|
|
|
| |
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
|
|
|
|
| |
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
|
|
|
|
|
|
| |
Also, sort the order of include files in the c files.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
|
|
|
|
| |
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
|
|
|
|
| |
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
|
|
|
|
|
|
| |
Move many C files from the src/ directory to the new src/fw/ directory.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
|
|
|
|
|
|
| |
Move many C files from the src/ directory to the new src/hw/ directory.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
|
|
|
|
|
|
|
|
|
|
|
|
| |
Preface PIC functions with a pic_ to provide a more consistent
naming.
Convert the irqmask code to a more consistent
pic_irqmask_read/write/mask form.
Move code from pic.h to pic.c.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
|
|
|
|
|
|
|
|
| |
There have been various kvm bugs that prevent reboots from working
properly. Generalize the existing test for a failed reboot to better
catch these cases.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
|
|
|
|
| |
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
|
|
|
|
|
|
|
|
|
|
|
| |
Convert all users of the alternative variable exports to VARFSEG.
There isn't a significant distinction between the existing types of
exports, so it's simpler to just use one type going forward.
The new VARFSEG declaration is only emitting when in 32bit mode, so
update and move some variables as needed.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
CONFIG_QEMU means compile to start from QEMU (and possibly
Xen/KVM/Bochs) and definitely running under QEMU (or Xen/KVM/Bochs).
CONFIG_COREBOOT means compile for coreboot and definitely running
under coreboot. Places that used CONFIG_COREBOOT to mean "running on
real hardware" have been changed to use !CONFIG_QEMU.
CONFIG_QEMU_HARDWARE enables support for some virtual hardware devices
even if QEMU didn't start SeaBIOS.
usingXen() is replaced by runningOnXen().
runningOnQEMU() is added to hardware devices that are only safe to
access when we are sure we are running under QEMU (or Xen/KVM/Bochs).
Neither the coreboot nor the csm code currently enable runningOnQEMU,
but future patches may.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
|
|
|
|
|
|
|
|
|
|
|
| |
The CPU cache is enabled and DMA is disabled on all real-world POST
entry situations, so no need to do this in the low-level "pre-init"
phase. Instead, move it to the platform hardware setup stage.
Also, move the setting of the reboot flags (which control reset-vector
entry point handling) to ivt_init().
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The POST phase has to invoke many initialization functions, and these
functions can have complex inter-dependencies. Try to categorize the
functions into 4 classes:
preinit - functions called very early in POST where function ordering
is very important and the code has limited access to other
interfaces.
init - functions that initialize internal interfaces and standard
external interfaces. This code is generally not dependent on
particular hardware and typically does not communicate directly
with any hardware devices.
setup - functions which access hardware or are dependent on particular
hardware or platform devices.
prepboot - functions that finalize internal interfaces and that
prepare for the boot phase.
This patch attempts to normalize the suffixes - functions that used
_init(), _setup(), _finalize(), or similar that did not follow the
above pattern were renamed. Other than function name changes, there
should be no code impact to this patch.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
|
|
|
|
| |
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
|
|
|
|
| |
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
|
|
|
|
|
|
|
|
|
|
| |
i8259 clears interrupt mask on reset. Interrupt need to be
masked again before enabling interrupts on CPU. Since option
roms are called with interrupts enabled, resume should mask
interrupts in i8259 before calling vgabios.
Signed-off-by: Gleb Natapov <gleb@redhat.com>
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Detect a resume/reboot by inspecting HaveRunPost instead of inspecting
the cmos reset code. Inspecting a global variable is both simpler and
safer.
Move the reboot logic from post.c to resume.c - this makes the code in
post.c simpler as it is now only called once on machine startup. This
also makes it easier to ensure all POST initialization code resides in
the relocatable "init" sections.
Also, rename _start() to handle_post() so that it is more in keeping
with the entry_xxx() and handle_xxx() function naming.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
|
|
|
|
|
|
|
|
|
|
|
|
| |
The compiler can get confused when referencing a C function in a
different mode. (It reasonably assumes that the C function in the
current mode is desired.) To avoid this compiler confusion, introduce
symbol prefixes (_cfunc16_, _cfunc32flat_, _cfunc32seg_) that must be
used on C function symbols that are referenced from other compilation
modes.
This makes it less likely compiler confusion will occur. It will also
makes it easier to implement and use vtable like operation structures.
|
|
|
|
|
|
| |
It's difficult to have a uniform view of the stack when transition
modes, so pass the return address in a register. As a result, the
transition functions only access memory via the %cs selector now.
|
|
|
|
|
|
| |
If the compiler can't restrict inlining by stack usage, then disable
inlining in 16bit mode. Otherwise, old compilers produce code that
uses too much stack space.
|
|
|
|
|
|
|
|
|
|
| |
Reduce the need for placing #if guards around functions that are
marked as VISIBLE in another code chunk by declaring the functions as
"weak" when they are not needed.
It's still necessary to ensure that no C code references the data from
a different chunk (or an -fwhole-program compile might try to keep a
local reference).
|
|
|
|
| |
Omitting "void" leads to a K&R style declaration which was not intended.
|
|
|
|
|
| |
Prepare for support of segmented 32bit code.
Add new MODESEGMENT definition, and clarify existing 32bit mode defs.
|
|
|
|
| |
Introduce 'struct segoff_s' to more places.
|
|
|
|
|
| |
Add support for running the vga rom when the option
CONFIG_S3_RESUME_VGA_INIT is set (default is off).
|
| |
|
|
|
|
|
| |
Enhance build to detect and avoid gcc with broken -fwhole-program
Also, remove workaround for older gcc that mess up global exports.
|
|
|
|
|
|
|
|
| |
Suppress __attribute__((externally_visible)) when no -fwhole-program
Add switch hack for compilers without -fno-jump-tables
Define memcpy() function (for compilers without -minline-all-stringops).
Define call16_simpint as a macro (a param needs to be inlined).
Make sure s3_resume is only defined in 32bit mode.
|
|
|
|
| |
Use linking magic to eliminate the need for the _code32_ prefix.
|
| |
|
|
|
|
|
|
|
|
| |
The term "far pointer" is used in many 16bit specs, and it is
different from what MAKE_FARPTR creates. So, use the term "flat
pointer" in the code to distinguish between the two meanings.
Also, use the suffix "_fl" consistently when working with "flat
pointers".
|
|
|
|
|
|
| |
The BDA offsets were adding in 0x400 twice.
Also, use lss insn instead of manually setting %ss and %sp.
Also, don't force segment value into %eax.
|
| |
|
|
|
|
|
|
|
|
| |
Change license of contributions from Kevin O'Connor from GPLv3 to
LGPLv3 (or later). Since the work as a whole is based on Kevin's
contributions and the "bochs bios" which has a license of LGPL (v2 or
later), this effectively makes the work as a whole available under
LGPLv3 (or later).
|
|
|
|
|
|
| |
When using AVOIDCOMBINE, macros can have global scope. This caused
the bda macro in resume.c to conflict with the bda variable in
post.c.
|
|
|
|
| |
The interrupt vector table is technically at 0x0000.
|
| |
|