summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
...
* stacks: Don't update the A20 settings if they haven't changedKevin O'Connor2017-05-163-6/+11
| | | | | | | The A20 setting is almost always enabled - only issue an outb() if the A20 is actually changing. This reduces the number of outb() calls. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* stacks: Make sure to initialize Call16DataKevin O'Connor2017-05-161-0/+1
| | | | | | | | Initialize the Call16Data at startup - otherwise some early yield() calls may check for interrupts without using the preferred A20 setting. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* smm: Backup and restore A20 on an SMI based mode switchKevin O'Connor2017-05-161-1/+8
| | | | | | | | QEMU does not store the A20 setting in the SMM cpu environment area (and it does not look like real CPUs do either). So, manually backup and restore A20 on a mode switch. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* NVMe: Allow NVMe to be enabled on real hardwareKevin O'Connor2017-05-102-2/+2
| | | | | | | A couple of users have reported success with the NVMe driver on real hardware, so allow it to be enabled outside of QEMU. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* src: Minor - remove tab characters that slipped into SeaBIOS C codeKevin O'Connor2017-05-022-5/+5
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* lsi-scsi: try to enumerate luns with REPORT LUNSRoman Kagan2017-05-021-11/+26
| | | | | | | | | | | | | | Enumerate active luns with REPORT LUNS and, if that fails[*], fall back to sequentially enumerating them up to (arbitrarily chosen) #8 [**]. [*] in current QEMU, REPORT LUNS does fail in lsi53c895a because the returned data is smaller than the allocation length which is (wrongly) considered an underflow [**] in current QEMU, luns above 0 are not supported in lsi53c895a, so this patch is here only for completeness. Signed-off-by: Roman Kagan <rkagan@virtuozzo.com>
* lsi-scsi: reset in case of a serious problemRoman Kagan2017-05-021-0/+2
| | | | | | | | | | | | When the device reports a serious problem via SIST[01] registers, it needs to be reset, otherwise the following requests will most likely fail, too. In particular, REPORT LUNS which fails (wrongly) with underflow in QEMU makes all the following requests fail, too, rendering the device unusable. Signed-off-by: Roman Kagan <rkagan@virtuozzo.com>
* mpt-scsi: try to enumerate luns with REPORT LUNSRoman Kagan2017-05-021-14/+26
| | | | | | | | | | | | | | | Enumerate active luns with REPORT LUNS and, if that fails[*], fall back to sequentially enumerating them up to (arbitrarily chosen) #8. Note that this patch also makes mpt_scsi_cmd accept luns other than 0; I've no idea what was the original motivation not to, and what can break due to this change (nothing broke in my basic tests with QEMU). [*] in current QEMU, REPORT LUNS does fail in mptsas1068 because the returned data is smaller than the allocation length which is (wrongly) considered an underflow. Signed-off-by: Roman Kagan <rkagan@virtuozzo.com>
* pvscsi: fix the comment about lun enumerationRoman Kagan2017-05-021-1/+1
| | | | | | | | | | | | | The comment in pvscsi_scan_target (presumably c&p-ed from another driver) reads that REPORTS LUNS should better be used to enumerate the luns on the target. However, according to the Linux driver, the device supports no more than a single lun per target. So adjust the comment to tell exactly that. Signed-off-by: Roman Kagan <rkagan@virtuozzo.com>
* usb-uas: enumerate luns with REPORT LUNSRoman Kagan2017-05-021-16/+29
| | | | Signed-off-by: Roman Kagan <rkagan@virtuozzo.com>
* esp-scsi: enumerate luns with REPORT LUNSRoman Kagan2017-05-021-10/+25
| | | | Signed-off-by: Roman Kagan <rkagan@virtuozzo.com>
* virtio-scsi: enumerate luns with REPORT LUNSRoman Kagan2017-05-021-12/+26
| | | | Signed-off-by: Roman Kagan <rkagan@virtuozzo.com>
* blockcmd: generic SCSI luns enumerationRoman Kagan2017-05-022-0/+98
| | | | | | | | | | | | | | | | | | | Add two generic functions to discover active LUNs on a SCSI target. The functions take a temporary drive descriptor on the target, and a callback to create a new drive descriptor with a new LUN using the temporary one as a template. One of the functions performs REPORT LUNS on the temporary drive to obtain the list of candidate luns; the other sequentially iterates the lun numbers up to the given maximum, and is meant as a fallback. Both functions return the number of successfully created drive descriptors, or a negative number if an error occured. This will allow to lift the limitation of most of the SCSI drivers that support booting off the LUN #0 only. Signed-off-by: Roman Kagan <rkagan@virtuozzo.com>
* blockcmd: accept only disks and CD-ROMsRoman Kagan2017-05-021-0/+3
| | | | | | | | | | Luns that report to INQUIRY with a type other than CD-ROM are considered disks. This isn't necessarily the case; working with such luns as disks may lead to unpredictable results. So bail out if the lun is neither CD-ROM nor disk. Signed-off-by: Roman Kagan <rkagan@virtuozzo.com>
* boot: Increase description size in boot menuKevin O'Connor2017-04-251-1/+1
| | | | | | | | Increase the boot menu description size so that menu items up to 80 characters display without truncation. Reported-by: Rene Shuster <rene.shuster@bcsemail.org> Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* coreboot: Adapt to upstream CBMEM console changesJulius Werner2017-04-251-6/+15
| | | | | | | | | | | | coreboot's CBMEM console format changed with https://review.coreboot.org/#/c/18301. This patch adapts the SeaBIOS implementation to support the new format. (SeaBIOS versions with this patch will continue to work fine with older version of coreboot. SeaBIOS versions without this patch may fail to log messages to the CBMEM console if run with newer versions of coreboot, but should not experience any more serious issues than that.) Signed-off-by: Julius Werner <jwerner@chromium.org>
* config: Add function to check if fw_cfg existsPetr Berky2017-03-292-1/+12
| | | | | | | | | It was found qemu_get_present_cpus_count may return impossible number of cpus because of not checking if fw_cfg exists before using it. That may lead to undefined behavior of emulator, in particular Bochs that freezes. Signed-off-by: Petr Berky <petr.berky@email.cz>
* resume: Don't attempt to use generic reboot mechanisms on QEMUKevin O'Connor2017-03-135-5/+18
| | | | | | | | | | | | | | | | 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>
* nvme: fix copy-paste mistake in commentDaniel Verkamp2017-03-021-1/+1
| | | | | Signed-off-by: Daniel Verkamp <daniel@drv.nu> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
* nvme: fix extraction of status code bitsDaniel Verkamp2017-03-021-1/+1
| | | | | | | | The status code field is 8 bits wide starting at bit 1; the previous code would truncate the top bit. Signed-off-by: Daniel Verkamp <daniel@drv.nu> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
* nvme: fix reversed loop condition in cmd_readwriteDaniel Verkamp2017-03-021-1/+1
| | | | | | | | It looks like the intent was to exit the loop if a command failed, but the current code would actually continue looping in that case. Signed-off-by: Daniel Verkamp <daniel@drv.nu> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
* nvme: extend command timeout to 5 secondsDaniel Verkamp2017-03-021-1/+1
| | | | | | | 500 ms is not sufficient for the admin commands used during initialization on some real hardware. Signed-off-by: Daniel Verkamp <daniel@drv.nu>
* nvme: support NVMe 1.0 controllersDaniel Verkamp2017-03-021-33/+6
| | | | | | | | | | | | | | | | | | | | | | Rather than using the Identify command with CNS 01b (GET_NS_LIST), which was added in NVMe 1.1, we can just enumerate all of the possible namespace IDs. The relevant part of the NVMe spec reads: Namespaces shall be allocated in order (starting with 1) and packed sequentially. Since the previously-used GET_NS_LIST only returns active namespaces, we also need a check in nvme_probe_ns() to ensure that inactive namespaces are not reported as boot devices. This can be accomplished by checking for non-zero block count - the spec indicates that Identify Namespace for an inactive namespace ID will return all zeroes. This should have no impact on the QEMU NVMe device model, since it always reports exactly one namespace (NSID 1). Signed-off-by: Daniel Verkamp <daniel@drv.nu>
* docs: Note release dates for 1.10.1 and 1.10.2Kevin O'Connor2017-03-021-0/+11
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* QEMU fw_cfg: Write fw_cfg back on S3 resumeBen Warren2017-02-213-0/+43
| | | | | | | | | | 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>
* QEMU fw_cfg: Add functions for accessing files by keyBen Warren2017-02-212-11/+32
| | | | | | | | | | Due to memory contraints, when resuming from S3 the fw_cfg "files" API isn't available. This adds a simple API to get a file 'key', and to write to the file using the key as a reference. Signed-off-by: Ben Warren <ben@skyportsystems.com> Reviewed-by: Igor Mammedov <imammedo@redhat.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com>
* QEMU fw_cfg: Add command to write back address of fileBen Warren2017-02-212-3/+65
| | | | | | | | | This command is similar to ADD_POINTER, but instead of patching memory, it writes the pointer back to QEMU over the DMA interface. Signed-off-by: Ben Warren <ben@skyportsystems.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Igor Mammedov <imammedo@redhat.com>
* romfile-loader: Switch to using named structsBen Warren2017-02-212-37/+37
| | | | | | | | | This is a little cleaner and matches how the command structures are defined in QEMU. Signed-off-by: Ben Warren <ben@skyportsystems.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Igor Mammedov <imammedo@redhat.com>
* QEMU DMA: Add DMA write capabilityBen Warren2017-02-212-0/+52
| | | | | | | | | This allows BIOS to write data back to QEMU using the DMA interface and provides a higher-level abstraction to write to a fw_cfg file Signed-off-by: Ben Warren <ben@skyportsystems.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Igor Mammedov <imammedo@redhat.com>
* block: add NVMe boot supportJulian Stecklina2017-02-208-1/+884
| | | | | | | | | | | | This patch enables SeaBIOS to boot from NVMe. Finding namespaces and basic I/O works. Testing has been done in qemu and so far it works with Grub, syslinux, and the FreeBSD loader. You need a recent Qemu (>= 2.7.0), because older versions have buggy NVMe support. The NVMe code is currently only enabled on Qemu due to lack of testing on real hardware. Signed-off-by: Julian Stecklina <jsteckli@amazon.de>
* ps2port: Disable keyboard/mouse prior to resetting ps2 controllerKevin O'Connor2017-02-111-1/+12
| | | | | | | | | | | | If one of the ps2 ports is enabled prior to the ps2 controller reset then it is possible a device event (eg, key press or mouse move) could be mistaken for the controller reset response code. This would result in a failure and the keyboard would be disabled during the boot. Always disabling the keyboard and mouse prior to reset ensures that the controller reset return code can be read properly. Tested-by: Paul Menzel <paulepanter@users.sourceforge.net> Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* vgasrc: Increase debug levelPaul Menzel2017-01-291-1/+1
| | | | | | | | | | You only want this information for debugging. As it also slows down the boot considerably, as, for example, for every character of the GRUB menu, something is sent over the serial console. Therefore, increase the debugging level to 9. Signed-off-by: Paul Menzel <pmenzel@molgen.mpg.de>
* ahci: Set upper 32-bit registers to zeroLadi Prosek2017-01-171-0/+5
| | | | | | | | | If the HBA supports 64-bit addressing, the registers may contain non-zero values, for example after reboot as a leftover from the OS driving the adapter. Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Ladi Prosek <lprosek@redhat.com>
* serialio: Support for mmap serial portsRicardo Ribalda Delgado2016-12-302-10/+47
| | | | | | | | | Some chipsets have memory mapped serial ports. The protocol is the same as an standard uart, but with memory read/write instead of inb/outb. Tested-by: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com> Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com> Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* tpm: Log TPM 2 digest structure in little endian formatStefan Berger2016-11-271-7/+18
| | | | | | | | | | | | | The parameters for extending the PCRs of a TPM 2 are written in big endian format when sent to the TPM. However, the log needs to be written in little endian format, so we cannot just copy the structure into the log as-is. To support the little endian format in the log, we extend the function writing the TPM 2 digest structure with a parameter that allows us to choose the endianess of a few parameters. We then rewrite the digest structure in little endian format for the log. Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
* tpm: Rework tpm_build_and_send_cmd() into tpm_simple_cmd()Kevin O'Connor2016-11-272-109/+53
| | | | | | | | | | Instead of passing an arbitrary buffer as a parameter to tpm_build_and_send_cmd(), just support the simpler case of a parameter that is only 0, 1, or 2 bytes in length. This allows the callers to pass the parameter directly and not worry about the big-endian encoding. Rename the function to tpm_simple_cmd(). Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* tpm: Don't call tpm_build_and_send_cmd() from tpm20_stirrandom()Kevin O'Connor2016-11-272-5/+12
| | | | | | Instead call tpmhw_transmit() directly. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* acpi: Generalize find_fadt() and find_tcpa_by_rsdp() into find_acpi_table()Kevin O'Connor2016-11-274-49/+11
| | | | | | | | 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>
* tpm: Move code around in tcgbios.c to keep like code togetherKevin O'Connor2016-11-271-207/+210
| | | | | | No code changes; just code movement. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* tpm: Don't call tpm_set_failure() from tpm12_get_capability()Kevin O'Connor2016-11-271-5/+1
| | | | | | | | | In the event of a failure in the low-level tpm12_get_capability() code, just return an error code. The caller can shutdown the TPM if needed - the only place where that is needed is during a failure in tpm12_determine_timeouts(). Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* tpm: Add comment banners to tcg.c separating major parts of specKevin O'Connor2016-11-271-101/+91
| | | | | | No code changes; just code movement. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* drop "etc/boot-cpus" fw_cfg file and reuse legacy QEMU_CFG_NB_CPUSIgor Mammedov2016-11-213-33/+7
| | | | | | | | | | since QEMU_CFG_NB_CPUS not going away anytime soon and serves the same purpose as just added "etc/boot-cpus" fw_cfg drop support for "etc/boot-cpus" while this code is not in use yet (i.e. QEMU with "etc/boot-cpus" hasn't been released) and reuse QEMU_CFG_NB_CPUS instead of it. Signed-off-by: Igor Mammedov <imammedo@redhat.com>
* usb: Make usb_time_sigatt variable staticKevin O'Connor2016-10-261-1/+1
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* docs: Note v1.10.0 releaserel-1.10.0Kevin O'Connor2016-10-261-0/+11
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* build: Add -fno-pie to the gcc flags when availableKevin O'Connor2016-10-261-0/+1
| | | | | Reported-by: Paul Menzel <paulepanter@users.sourceforge.net> Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* support booting with more than 255 CPUsIgor Mammedov2016-10-252-4/+21
| | | | | | | | | | | | | | | | SDM[*1] says that if there are CPUs with APIC ID greater than 254, BIOS is to pass control to OS in x2APIC mode. Use the fact that QEMU passes in "etc/max-cpus" max possible "APIC ID + 1" to detect need for x2APIC mode. Also instead of CMOS_BIOS_SMP_COUNT which is limited to 256 CPUs use a new rom file "etc/boot-cpus" that QEMU supporting more than 256 CPUs will provide. *1) SDM: Volume 3: EXTENDED XAPIC (X2APIC): Initialization by System Software Signed-off-by: Igor Mammedov <imammedo@redhat.com>
* add helpers to read etc/boot-cpus at resume timeIgor Mammedov2016-10-253-5/+47
| | | | Signed-off-by: Igor Mammedov <imammedo@redhat.com>
* smp: consolidate CPU APIC ID detection and accountingKevin O'Connor2016-10-251-10/+15
| | | | | Signed-off-by: "Kevin O'Connor" <kevin@koconnor.net> Signed-off-by: Igor Mammedov <imammedo@redhat.com>
* paravirt: disable legacy bios tables in case of more than 255 CPUsIgor Mammedov2016-10-251-2/+4
| | | | | | | | | | MPTable doesn't support more than 255 CPUs and QEMU supplies an alternative MADT table which guest will use instead of it. So do not install legacy tables if more than 254 CPUs are provided Signed-off-by: Igor Mammedov <imammedo@redhat.com> Acked-by: Michael S. Tsirkin <mst@redhat.com>
* build: Be sure to also include out/*.d in MakefileKevin O'Connor2016-10-211-1/+1
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>