aboutsummaryrefslogtreecommitdiff
path: root/src/util.h
AgeCommit message (Collapse)AuthorFilesLines
2024-01-18util: Fix compiler warning by using proper function definitionHelge Deller1-1/+1
Signed-off-by: Helge Deller <deller@gmx.de>
2023-10-31parisc: Add timer2() wait function to cope with 32-bit timer limitHelge Deller1-0/+7
Signed-off-by: Helge Deller <deller@gmx.de>
2020-05-15acpi: add dsdt parserGerd Hoffmann1-0/+11
Create a list of devices found in the DSDT table. Add helper functions to find devices, walk the list and figure device informations like mmio ranges and irqs. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2020-05-15virtio-mmio: add support for block devices.Gerd Hoffmann1-0/+1
Add and use bootprio_find_mmio_device() to figure the boot priority of virtio-mmio block devices. Add init_virtio_blk_mmio to initialize one virtio-mmio block device. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2020-05-15virtio-mmio: add support for scsi devices.Gerd Hoffmann1-0/+1
Add new fields to struct virtio_lun_s for mmio support, add mmio parameter to virtio_scsi_init_lun(), so both pci and mmio devices can be handled. Add and use bootprio_find_scsi_mmio_device() to figure boot priority of devices connected to a virtio-mmio scsi controller. Finally add init_virtio_scsi_mmio() to initialize one virtio-mmio scsi controller. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2020-03-16timer: add tsctimer_setfreq()Gerd Hoffmann1-0/+1
Add function to set tsc frequency directly, without calibration. Also tweak timer setup functions a bit: skip setup in case TimerPort has not the default value any more, i.e. another timer has been setup already. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Message-id: 20200310102248.28412-1-kraxel@redhat.com
2020-01-14boot: Detect strict boot order (HALT record) in functionAlexey Kirillov1-0/+1
Introduce is_bootprio_strict(). We will reuse this function in the next commit. Signed-off-by: Alexey Kirillov <lekiravi@yandex-team.ru> Message-id: 20200107171917.7535-2-lekiravi@yandex-team.ru Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2019-11-18geometry: Add boot_lchs_find_*() utility functionsSam Eiderman1-0/+6
Adding the following utility functions: * boot_lchs_find_pci_device * boot_lchs_find_scsi_device * boot_lchs_find_ata_device These will be used to apply LCHS values received through fw_cfg. Reviewed-by: Karl Heubaum <karl.heubaum@oracle.com> Reviewed-by: Arbel Moshe <arbel.moshe@oracle.com> Signed-off-by: Sam Eiderman <shmuel.eiderman@oracle.com> Message-Id: <20190626123816.8907-5-shmuel.eiderman@oracle.com>
2019-11-18Revert "geometry: Add boot_lchs_find_*() utility functions"Gerd Hoffmann1-6/+0
This reverts commit ad2910949b1886deba24f574cee76cdc75e7cabe.
2019-11-06geometry: Add boot_lchs_find_*() utility functionsSam Eiderman1-0/+6
Adding the following utility functions: * boot_lchs_find_pci_device * boot_lchs_find_scsi_device * boot_lchs_find_ata_device These will be used to apply LCHS values received through fw_cfg. Reviewed-by: Karl Heubaum <karl.heubaum@oracle.com> Reviewed-by: Arbel Moshe <arbel.moshe@oracle.com> Signed-off-by: Sam Eiderman <shmuel.eiderman@oracle.com> Message-Id: <20190612093704.47175-4-shmuel.eiderman@oracle.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2019-05-17add get_keystroke_full() helperGerd Hoffmann1-0/+1
Switch get_raw_keystroke() to return ax instead of ah, so it returns both scan code and ascii code of the key pressed. Add get_keystroke_full() function which passes up ax to the caller. The get_keystroke() function continues to return the scancode only like it did before. It is a thin wrapper around get_keystroke_full() now though. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2019-02-04bootsplash: Added support for 16/24/32bpp in one functionJoseph Pacheco-Corwin1-1/+1
Specifically added support for 16 and 32bpp files, in addition to 24bpp. The function bmp_show() in bmp.c has had the hardcoded check for 24bpp replaced with a general bpp check that uses a % to check for remainder, and returns 1 if the remainder is >0. The previous method for adjusting the BMP data (raw_data_format_adjust_24bpp) relied on a preset 3*bytes_per_line_src, this has been changed and the multiplication is now performed in the function's arguments. This change still allows someone else to reuse the same function for 1/2/4bpp support if necessary. The file util.h has been modified to reflect this decision. The changes to raw_data_format_adjust() is based on an abandoned patch by Gert Menke (submitted March 14, 2017), credit to them for that change and the addition of *bpp to bmp_get_info(). Signed-off-by: Joseph S. Pacheco-Corwin <hammersamatom@gmail.com>
2018-10-05pretty boot menu entry for cdrom drivesGerd Hoffmann1-0/+1
Show the volume label of bootable cdroms. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2017-09-22add serial console supportGerd Hoffmann1-0/+4
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>
2017-09-22kbd: make enqueue_key public, add ascii_to_keycodeGerd Hoffmann1-0/+2
serial console wants queue key events and needs to map ascii chars to the keycode, so make enqueue_key public and also exports a helper function so sercon can use the scan_to_keycode mapping table. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2017-03-13resume: Don't attempt to use generic reboot mechanisms on QEMUKevin O'Connor1-1/+1
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>
2016-11-27acpi: Generalize find_fadt() and find_tcpa_by_rsdp() into find_acpi_table()Kevin O'Connor1-0/+1
The find_fadt() and find_tcpa_by_rsdp() functions are very similar. Create a new find_acpi_table() function and replace the two functions with this new function. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2016-08-05version: Update header files now that version.c is not auto generatedKevin O'Connor1-4/+3
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2016-07-07smp: restore MSRs on S3 resumePaolo Bonzini1-0/+1
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>
2016-02-03pci: Move code in pci.c that is specific to pciinit.c to pciinit.cKevin O'Connor1-0/+2
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2016-01-12post: Always set HaveRunPost prior to setting any other global variableKevin O'Connor1-0/+1
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>
2015-12-20tpm: Add a menu for TPM configurationStefan Berger1-0/+1
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. Select boot device: 1. ata0-1: QEMU HARDDISK ATA-7 Hard-Disk (6144 MiBytes) 2. Legacy option rom 3. iPXE (PCI 00:03.0) t. TPM Menu Upon pressing t the TPM submenu will be shown: The Trusted Platform Module (TPM) is a hardware device in this machine. It can help verify the integrity of system software. The current state of the TPM is: Enabled and active Ownership has not been taken A user can take ownership of the TPM Available options are: d. Disable the TPM v. Deactivate the TPM p. Prevent installation of an owner If no change is desired or if this menu was reached by mistake, press ESC to reboot the machine. The TPM menu only shows those options that are currently accessible considering the state of the TPM. The patch adds several functions for sending those messages to the TPM required for supporting those menu items. Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2015-11-20util.h: Minor - HaveRunPost is in misc.c not resume.cKevin O'Connor1-3/+1
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2015-10-15build: Report gcc and binutils versions in debug logKevin O'Connor1-1/+1
Attempt to extract the gcc and binutils versions. Report that information in the debug log. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2015-08-24Add minimal support for machines without hardware interruptsKevin O'Connor1-0/+1
Some Chromebooks (with Baytrail CPUs) apparently do not support routing of legacy interrupts. This patch adds minimal support for running SeaBIOS in such an environment. Even with this patch, it is known that old operating systems and even some recent bootloaders will not function without real hardware interrupts. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2015-07-24Minor - move declaration of CDRom_locks to code that uses itKevin O'Connor1-1/+0
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2015-07-14block: Rename process_XXX_op() functions to XXX_process_op()Kevin O'Connor1-4/+4
Rename disk driver dispatch functions to a consistent naming style. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2015-06-01Add multiboot support.Vladimir Serbinenko1-0/+3
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>
2015-05-21Support for BIOS interrupt handlerStefan Berger1-0/+1
This patch implements the TCG BIOS interrupt handler 1ah. It is for example used by trusted grub. This patch adds an implementation of SHA1 (following NIST specs., IETF RFC 3147 and Wikipedia) for speeding up measurements of code. Trusted Grub for example makes use of this interface and measures (calculates SHA1) of the Linux kernel and initrd. Those files can be rather large and hunting their bytes through the TIS interface as part of the int handler commands invoked by trusted grub does take quite some time due to the many vmexits the interface is creating (one per byte). There is also a threshold for the size of data to hash (100k) below which the TPM is used and above the internal faster SHA1 algorithm is used. This patch for example enables trusted grub to interact with the TPM and take additional measurements. Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com> Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2014-12-29sdcard: Initial support for SD cards on PCI SDHCI controllers on QEMUKevin O'Connor1-0/+4
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>
2014-06-06Abstract reset call (and possible 16bit mode switch) into reset() function.Kevin O'Connor1-3/+0
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2014-06-04Move most of the VAR16FIXED() defs to misc.c.Kevin O'Connor1-0/+1
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2014-06-04smp: Replace QEMU SMP init assembler code with C; run only in 32bit mode.Kevin O'Connor1-1/+0
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>
2014-06-04Move cdemu call interface and disk_ret helper code to disk.c.Kevin O'Connor1-1/+0
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2014-06-04cdemu: store internal cdemu fields in standard "el-torito" spec format.Kevin O'Connor1-1/+1
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>
2014-05-20acpi: remove PORT_ACPI_PM_BASE constantGerd Hoffmann1-0/+1
Use the new acpi_pm_base variable instead. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2014-05-06If an int 1587 call is made from an option rom, stay in bigreal mode.Kevin O'Connor1-0/+1
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>
2014-05-06SMBIOS: Check for aggregate tables & entry point in fw_cfgGabriel L. Somlo1-1/+2
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>
2014-04-11coreboot: Make coreboot table searching available to other code.Kevin O'Connor1-0/+3
Make the coreboot table searching code available to code outside coreboot.c, and make it runnable from 16bit mode. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2014-04-07Use biostables.c for copying bios tables even when generating them.Kevin O'Connor1-0/+3
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>
2014-04-07Move PirAddr definition from pirtable.c to biostables.c.Kevin O'Connor1-1/+1
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2014-04-07smbios: Move smbios parsing logic from smbios.c to biostables.c.Kevin O'Connor1-2/+2
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>
2014-04-07acpi: Move acpi parsing logic from acpi.c to biostables.c / paravirt.c.Kevin O'Connor1-7/+5
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>
2014-01-15resume: restore piix pm config registers after resumeMarcel Apfelbaum1-0/+1
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>
2013-12-04Move low-level hardware writing from output.c to new file hw/serialio.c.Kevin O'Connor1-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>
2013-11-06biostables: support looking up RSDPMichael S. Tsirkin1-0/+1
Will be used when it's loaded from QEMU. Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2013-10-26vgahooks: add SM720 VGA BIOS hooks for WIN Enterprises MB-60470Jonathan A. Kollasch1-0/+1
Add vgahooks to support the SMI SM720 VGA BIOS used on the WIN Enterprises MB-60470. The response from smi_157f14() is necessary for the CRT output to turn on. The response from smi_157f02() is used to configure which connector(s) output is routed to. As I lack hardware to test LCD panel output, I've selected CRT-only output on the MB-60470 as this prevents the CRT output from being scaled to the resolution of the LCD panel. Signed-off-by: Jonathan A. Kollasch <jakllsch@kollasch.net>
2013-09-28Move dma code to new file hw/dma.c.Kevin O'Connor1-1/+4
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>
2013-09-28Rename hw/cmos.h to hw/rtc.h and copy RTC code from clock.c to hw/rtc.c.Kevin O'Connor1-2/+0
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>
2013-09-28Move PIT setup from clock.c to hw/timer.c.Kevin O'Connor1-3/+4
Move the hardware setup to the hw/timer.c code. This eliminates the need for a separate hw/pit.h file with definitions. Also, move the IRQ counting code (which is dependent on the BDA) from hw/timer.c to clock.c. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>