summaryrefslogtreecommitdiff
path: root/src/post.c
Commit message (Collapse)AuthorAgeFilesLines
* add serial console supportGerd Hoffmann2017-09-221-0/+2
| | | | | | | | | Redirect int10 calls to serial console output. Parse serial input and queue key events. The serial console can work both as primary display and in parallel to another vga display (splitmode). Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* post: Map int 0x05 to entry pointKevin O'Connor2016-09-121-0/+1
| | | | | | int 0x05 was not assigned in the interrupt table - fix that. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* block: Move drive setup to new function block_setup()Kevin O'Connor2016-02-041-20/+2
| | | | | | | 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>
* post: Always set HaveRunPost prior to setting any other global variableKevin O'Connor2016-01-121-4/+16
| | | | | | | | | | | 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>
* memmap: Introduce SYMBOL() macro to access linker script symbolsKevin O'Connor2015-10-151-19/+16
| | | | | | | Use a macro to define and obtain the value of a symbol introduced by the linker scripts (scripts/layoutrom.py). Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* e820: Rename memmap.c to e820map.c and use consistent "e820_" prefixKevin O'Connor2015-10-151-3/+3
| | | | | | | | | Rename memmap.c to e820map.c as the code in that file only deals with maintaining the e820 map. Move all the e820 definitions to new file e820map.h and use a consistent "e820_" prefix on all exported functions. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* Always enable caching on transition32; backup/restore cr0 on call32Kevin O'Connor2015-10-091-3/+0
| | | | | | | | | | | Always enable caching at start of 32bit code and always make sure the paging flag is off. Because this alters the cr0 register, perform a backup and restore of it when using call32(). Also, rename get/setcr0() to cr0_read/write() to more closely match other register access functions. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* timer: Delay timestamp counter init until after pmtimer is probedKevin O'Connor2015-07-221-2/+4
| | | | | | | | | Delay call to timer_setup() until after the xxx_platform_setup() calls so that the pmtimer can be detected first. Most modern machines will have a pmtimer and calibrating the timestamp counter is frequently unnecessary. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* Don't enable interrupts prior to IVT and PIC setupKevin O'Connor2015-07-141-1/+1
| | | | | | | | | The machine may crash if an interrupt occurs prior to the setup of the interrupt vector table (IVT) and programmable interrupt controller (PIC). This patch makes sure that interrupts remain disabled until these components are setup. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* tcg: Use seabios setup()/prepboot() calling convention for tcgKevin O'Connor2015-06-111-6/+6
| | | | | | | | Rename tcg externally called functions to more closely match other subsystems. Signed-off-by: Kevin O'Connor <kevin@koconnor.net> Tested-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
* Add multiboot support.Vladimir Serbinenko2015-06-011-0/+1
| | | | | | | | | | | | | | | | | | | | I've been successfully using SeaBIOS as secondary bootloader. In more details I have GRUB2-as-payload in flash together with coreboot. SeaBIOS binary is on the HDD and loaded by GRUB when needed. This has an unfortunate consequence that I have to keep vga oprom in flash even if usually I boot without it. This patches makes bios.bin.elf multiboot executable with files passed as modules. Example: menuentry "SeaBIOS (mb)" --unrestricted { root=ahci0,2 multiboot /bios.bin.elf module /vgabios_x230.rom name=pci8086,0166.rom } the parameter name= specifies under which name SeaBIOS will see it. Signed-off-by: Vladimir Serbinenko <phcoder@gmail.com> Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* Implementation of the TCG BIOS extensionsStefan Berger2015-05-211-0/+7
| | | | | | | | | | | | | | | | | | | | 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>
* sdcard: Initial support for SD cards on PCI SDHCI controllers on QEMUKevin O'Connor2014-12-291-0/+1
| | | | | | | | This adds basic read/write support for SD cards emulated by QEMU. This code is not expected to work on real hardware, because the current controller and card initialization is not robust. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* Fix int 1589 calls when CONFIG_ENTRY_EXTRASTACK is enabled.Kevin O'Connor2014-05-081-1/+1
| | | | | | | | 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>
* If an int 1587 call is made from an option rom, stay in bigreal mode.Kevin O'Connor2014-05-061-0/+2
| | | | | | | | | | | 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>
* Replace CONFIG_THREAD_OPTIONROMS with a runtime config setting.Kevin O'Connor2014-04-071-3/+4
| | | | | | | | | | | | | | 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>
* debug: Unify the SeaBIOS debug version banner.Kevin O'Connor2014-01-221-1/+1
| | | | | | | Introduce debug_banner() and use it in all the places SeaBIOS version is displayed for debugging purposes. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* debug: Only call serial_debug_preinit() at startup.Kevin O'Connor2014-01-221-1/+2
| | | | | | | | | 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>
* Move low-level hardware writing from output.c to new file hw/serialio.c.Kevin O'Connor2013-12-041-1/+1
| | | | | | | | | | 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>
* Add pvscsi boot supportEvgeny Budilovsky2013-10-261-0/+2
| | | | | | | | | | | | | | Testing was done on windows images (win 2008/2012) taken from esx with vmware tools installed and boot disk configured to use pvscsi. Also I've used linux (ubuntu 12.04) where pvscsi drivers are installed by default and booted it using qemu cmd similar to this: ./x86_64-softmmu/qemu-system-x86_64 -snapshot -device pvscsi,id=pvscsi0 \ -device scsi-disk,bus=pvscsi0.0,drive=drive0 \ -drive id=drive0,if=none,file=ubuntu-12.04.qcow2 \ -bios roms/seabios/out/bios.bin Signed-off-by: Evgeny Budilovsky <evgeny.budilovsky@ravellosystems.com>
* Rename hw/cmos.h to hw/rtc.h and copy RTC code from clock.c to hw/rtc.c.Kevin O'Connor2013-09-281-2/+2
| | | | | | | | | 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>
* Merge bmp.h, boot.h, jpeg.h, and post.h into util.h.Kevin O'Connor2013-09-181-2/+0
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* Move standard bda type info from biosvar.h to std/bda.h.Kevin O'Connor2013-09-181-1/+1
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* Split disk.h into block.h and std/disk.h.Kevin O'Connor2013-09-181-1/+0
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* Move function definitions for output.c from util.h to new file output.h.Kevin O'Connor2013-09-181-13/+14
| | | | | | Also, sort the order of include files in the c files. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* Move malloc code from pmm.c to new files malloc.c and malloc.h.Kevin O'Connor2013-09-181-0/+1
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* Rename util.c to string.c and introduce string.h.Kevin O'Connor2013-09-181-1/+2
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* Move code cenetered around firmware initialization to src/fw/Kevin O'Connor2013-09-021-2/+2
| | | | | | Move many C files from the src/ directory to the new src/fw/ directory. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* Move code centered around specific hardware devices to src/hw/Kevin O'Connor2013-09-021-11/+11
| | | | | | Move many C files from the src/ directory to the new src/hw/ directory. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* Add config option to support memory allocations in 9-segment.Kevin O'Connor2013-08-101-3/+7
| | | | | | | | | | | Internal "low memory" allocations are currently placed in the UMB region (0xc0000-0xf0000). However, there have been reports of some real machines that do not support DMA to this area of memory. So, add a compile time config option (off by default) to support placing all internal low-memory allocations at the end of the 640K real-memory area (0x90000-0xa0000). Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* Move internal timer code from clock.c to a new file timer.c.Kevin O'Connor2013-07-201-0/+1
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* Separate out 16bit PCI-BIOS entry point from regular int 0x1a entry point.Kevin O'Connor2013-03-031-1/+1
| | | | | | | The PCI-BIOS entry point can be called in 16bit protected mode, so separate its entry code from the legacy 0x1a code. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* Minor - introduce numeric defines for the IVT offset of hw irqs.Kevin O'Connor2013-02-231-2/+2
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* Don't relocate "varlow" variable references at runtime.Kevin O'Connor2013-02-191-7/+1
| | | | | | | | | Since the final location of the "varlow" variables are known at build time, link the final locations into the binary during the build. The 16bit code was already done at link time - update the build so the 32bit code is also done at link time. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* Disable handle_post() on CSM builds.Kevin O'Connor2013-02-181-0/+3
| | | | | | This reduces the size of the CSM binary by a few bytes. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* Clarify build generated "zone low" values.Kevin O'Connor2013-02-171-6/+6
| | | | | | | | | Rename datalow_base (and similar) to zonelow_base, and datalow_start (and similar) to varlow_start. This helps distinguish between the bounds for the runtime dynamic memory pool and the compile time global variables. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* Group QEMU platform setup together and move to paravirt.c.Kevin O'Connor2013-02-131-24/+5
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* Integrate qemu_cfg_preinit() into qemu_romfile_init().Kevin O'Connor2013-02-121-2/+1
| | | | | | | Now that only qemu_romfile_init() uses the fw_cfg interface, it only needs to be detected in that function. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* The mathcp setup touches the PIC and thus move to the "setup" phase.Kevin O'Connor2013-02-121-1/+1
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* Start device_hardware_setup in mainint even with CONFIG_THREAD_OPTIONROMS.Kevin O'Connor2013-02-121-8/+6
| | | | | | | | There's no real gain to starting the device_hardware_setup in the middle of the platform setup. Always start it just prior to the VGA rom. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* Consistently use CONFIG_COREBOOT, CONFIG_QEMU, and runningOnXen().Kevin O'Connor2013-02-121-2/+2
| | | | | | | | | | | | | | | | | | | | | 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>
* No need to check both CONFIG_THREADS and CONFIG_THREAD_OPTIONROMS.Kevin O'Connor2013-02-091-2/+2
| | | | | | | CONFIG_THREAD_OPTIONROMS depends on CONFIG_THREADS, so the code can assume that the two are always on when CONFIG_THREAD_OPTIONROMS is on. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* Undo incorrect assumptions about Xen in commit 6ca0460f.Kevin O'Connor2013-02-081-23/+7
| | | | | | | Xen invokes SeaBIOS via entry_post, not entry_elf. As a result commit 6ca0460f broke Xen. This change effectively undoes that commit. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* POST: Move cpu caching and dma setup to platform_hardware_setup().Kevin O'Connor2013-02-071-10/+10
| | | | | | | | | | | 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>
* POST: Reorganize post entry and "preinit" functions.Kevin O'Connor2013-02-071-38/+38
| | | | | | | | | | | | Unlocking ram in handle_post() is tricky and only needed under qemu. Separate out that logic from the coreboot/xen paths by invoking handle_elf_post separately. This simplifies both the qemu and non-qemu code paths. Also, organize all the "pre-init" functions into one section of the file. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* POST: Move QEMU specific ramsize and BIOS table setup to paravirt.c.Kevin O'Connor2013-02-071-67/+10
| | | | | | | Don't clutter post.c with the gory details of QEMU memory sizing and BIOS table creation. Instead, move that code to paravirt.c. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* post: Export functions which will be used individually by CSMDavid Woodhouse2013-02-071-4/+5
| | | | Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
* Support calling a function other than maininit() from reloc_preinit().Kevin O'Connor2013-02-071-11/+13
| | | | | | | Pass a function pointer to reloc_preinit() instead of always running maininit() after relocating the init code. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* POST: Reorganize post init functions for better grouping and reusability.Kevin O'Connor2013-02-051-131/+142
| | | | | | | | | | | | Place the "interface initialization" functions together, "platform hardware initialization" functions together, and "prepare to boot" functions together. This may also be useful for using SeaBIOS as a CSM. This slightly changes the order of some function invocations, but should otherwise not change code behavior at all. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* Normalize POST initialization function name suffixes.Kevin O'Connor2013-02-051-54/+53
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>