aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2021-09-24boot: Fix qemu bootindex parameter on parisc architectureHelge Deller1-0/+4
On parisc qemu reports the main PCI bus as "/dino-pcihost" instead of "/pci@i0cf8". This is important when using the bootindex parameter for SCSI discs, because the seabios boot code uses this name as prefix when identifying and sorting the bootable discs. Signed-off-by: Helge Deller <deller@gmx.de>
2021-09-24boot: Allow boot order=g-m option to choose boot SCSI IDHelge Deller1-1/+10
Add support to boot from a specific SCSI ID by mapping drives g-m to SCSI IDs 0-7, e.g. -boot order=g for SCSI ID 0, and -boot order=l for SCSI ID 5 Signed-off-by: Helge Deller <deller@gmx.de>
2021-09-24ata.c: Add missing endianess conversion functionsHelge Deller1-10/+10
PA-RISC is big endian. Add necessary endianess conversion functions to get disc detection correct. Signed-off-by: Helge Deller <deller@gmx.de>
2021-09-24block.c: Allow PA-RISC to boot from ATA drivesHelge Deller1-1/+7
Boot directly from ATA drive without going through the process_op_32() function. Additionally PA-RISC can read/write chunks from disk which are bigger than 64kb, so don't abort when this is tried. Signed-off-by: Helge Deller <deller@gmx.de>
2021-09-24boot.c: Add boot disc chooser for PA-RISCHelge Deller1-0/+48
Signed-off-by: Helge Deller <deller@gmx.de>
2021-09-24string.c: reimplement mem*_far() functions for PA-RISCHelge Deller1-1/+26
Signed-off-by: Helge Deller <deller@gmx.de>
2021-09-24parisc: Add PA-RISC related codeHelge Deller16-1/+5762
This patch adds the various drivers for PA-RISC. To build the parisc firmware enable CONFIG_PARISC and run "make parisc". Signed-off-by: Helge Deller <deller@gmx.de>
2021-09-24x86.h: Provide replacement functions for PA-RISCHelge Deller1-0/+6
This header file is included from many places and provides low-level inline assembly functions used on the Intel CPU. On PA-RISC similiar functions exists, so provide replacement functions in an own header file and include that instead. Signed-off-by: Helge Deller <deller@gmx.de>
2021-09-24version.c: Mark version strings constHelge Deller1-2/+2
Signed-off-by: Helge Deller <deller@gmx.de>
2021-09-24stacks.h: Provide replacement for thread functions when !CONFIG_THREADSHelge Deller1-2/+15
Rearrange the thread functions and provide wrappers which evaluates to no code when !CONFIG_THREADS. The function call16_int() isn't used on PA-RISC, so replace it by an empty function call. Signed-off-by: Helge Deller <deller@gmx.de>
2021-09-24sercon.c: Use SEROFF_IIR constantHelge Deller1-1/+1
Signed-off-by: Helge Deller <deller@gmx.de>
2021-09-24romfile.c: return values are returned as little-endianHelge Deller1-1/+3
Convert from little-endian to host-endian when returning the value from romfile_loadint(). Signed-off-by: Helge Deller <deller@gmx.de>
2021-09-24output.c: Make printf() capable to print 64bit int valuesHelge Deller1-21/+23
On PA-RISC we want to print some numbers as 64-bits, so fix the bvprintf() function acordingly. On x86 printing integers was (and still is) limited to 32bit, probaby to avoid gcc to insert calls to __umoddi3 and __udivdi3 and thus getting undefined reference linker errors. Signed-off-by: Helge Deller <deller@gmx.de>
2021-09-24output.c: Add PA-RISC specific output behaviourHelge Deller1-2/+10
On PA-RISC call an own screenc() implementation which doesn't use int10, prevent the Intel-specific \r newline when printing \n and don't output to serial debug port. Signed-off-by: Helge Deller <deller@gmx.de>
2021-09-24malloc.c: Implement a PA-RISC specific malloc()Helge Deller2-4/+8
On x86 mremap() is used to provide malloc'ed memory. This can't be used on PA-RISC, so provide an own malloc() implementation. Since PA-RISC is fully 32-/64-bit use "unsigned long" instead of "u32". Signed-off-by: Helge Deller <deller@gmx.de>
2021-09-24serialio.h: Add serial port adresses for PA-RISCHelge Deller1-0/+8
Signed-off-by: Helge Deller <deller@gmx.de>
2021-09-24rtc.h: Add CMOS/RTC addresses for PA-RISCHelge Deller1-0/+7
Signed-off-by: Helge Deller <deller@gmx.de>
2021-09-24pci.c: Add PCI ports for PA-RISC and access PCI bus in little-endianHelge Deller1-4/+9
Add the IO-Ports for the PCI bus on PA-RISC. The PCI bus is little-endian on x86 and PA-RISC, so add the necessary conversions for PA-RISC. Signed-off-by: Helge Deller <deller@gmx.de>
2021-09-24lsi-scsi.c: Convert SCSI script to little endianHelge Deller1-0/+4
The lsi-scsi driver expects the SCSI script in little-endian format. Do this conversion on PA-RISC (which is big-endian). On x86 this conversion will be optimized away. Signed-off-by: Helge Deller <deller@gmx.de>
2021-09-24scsi: Add fields for specifying target and lun of SCSI devicesHelge Deller11-10/+14
On PA-RISC it's possible to boot from various SCSI targets and LUNs. Add fields to the drive_s struct to be able to store those. Signed-off-by: Helge Deller <deller@gmx.de>
2021-09-24blockcmd.c: Prevent unaligned access crash on PA-RISCHelge Deller1-5/+8
The cdbcmd pointer given to scsi_fill_cmd() can point to an unaligned address. On x86 writing a 64-bit value to an unaligned address will succeed, while on PA-RISC the machine will stop with an unaligned access error (esp. since the fault handlers are not implemented in the firmware). Work around that issue by using a temporary variable and copy it to the destination when finished. Signed-off-by: Helge Deller <deller@gmx.de>
2021-09-24ata.h: Add ATA IDE port addresses for PA-RISCHelge Deller1-0/+8
Signed-off-by: Helge Deller <deller@gmx.de>
2021-09-24ata.c: Allow to boot on PA-RISCHelge Deller1-1/+1
Fix linkage problem on PA-RISC, no functional change on x86. Signed-off-by: Helge Deller <deller@gmx.de>
2021-09-24Add portaddr_t typedef to specify I/O port addressesHelge Deller6-31/+39
On x86 I/O ports are located below address 0x4000, while on PA-RISC I/O ports are allowed in the whole 32/64 bit address space. So, introduce a portaddr_t typedef which defaults to the current u16 type on x86 and to unsigned long on PA-RISC. Signed-off-by: Helge Deller <deller@gmx.de>
2021-09-24shadow.c: Compile int3 inline assembly on x86 onlyHelge Deller1-0/+2
Signed-off-by: Helge Deller <deller@gmx.de>
2021-09-24pciinit.c: Initialize PA-RISC Dino PCI chipHelge Deller1-6/+47
Initialize the PA-RISC Dino PCI chip. On Dino, do not remap PCI IDE ports and allow PCI IO regions above address 0x4000. Signed-off-by: Helge Deller <deller@gmx.de>
2021-09-24paravirt.h: Add PORT_QEMU_CFG_CTL for pariscHelge Deller1-0/+7
Signed-off-by: Helge Deller <deller@gmx.de>
2021-09-24font.c: Disable built-in x86 font on pariscHelge Deller1-0/+2
Signed-off-by: Helge Deller <deller@gmx.de>
2021-09-24farptr.h: Add FLATPTR* accessor functions for pariscHelge Deller1-1/+13
Add wrappers for the FLATPTR_* functions for the parisc architecture. Signed-off-by: Helge Deller <deller@gmx.de>
2021-09-24byteorder.h: Add endianess conversion functionsHelge Deller1-0/+74
SeaBIOS until now only supported the little-endian x86 platform. PA-RISC is big endian, so add the necessary conversion functions depending on the architecture. Signed-off-by: Helge Deller <deller@gmx.de>
2021-09-24Drivers: Use get_bda_ptr() BDA accessorHelge Deller3-3/+3
Use the get_bda_ptr() accessor function instead of hardcoding with MAKE_FLATPTR(). Signed-off-by: Helge Deller <deller@gmx.de>
2021-09-24biosvar.h: Add accessors for various BIOS data areasHelge Deller1-0/+31
This patch adds or adjust the existing accessors to the various data areas in a x86 BIOS for usage with a PA-RISC BIOS. On PA-RISC the x86 areas are emulated as normal variables, stored in normal RAM and can be accessed directly. GET_IVT() and SET_IVT() are emulated by a static ivt_table[] array. Introduce a get_bda_ptr() inline function to return the address of the Bios Data Area (BDA). GET_BDA() and SET_BDA() are used to directly access variables from the BDA. GET_GLOBAL() is used to access variables directly. Signed-off-by: Helge Deller <deller@gmx.de>
2021-09-24Add config option for PA-RISC archHelge Deller1-16/+38
Add a config option to Kconfig to choose between building for Intel/AMD CPUs (x86) or HP PA-RISC CPUs (parisc/hppa). Add dependency for some config options based on the choosen architecture. Signed-off-by: Helge Deller <deller@gmx.de>
2021-09-23tcgbios: Disable platform hierarchy in case of failureupstreamStefan Berger1-0/+1
In the rare case of a TPM 2 failure, disable the platform hierarchy after disabling the endorsement and owner hierarchies. Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2021-06-30nvme: fix missing newline on sq full printAlex Martens via SeaBIOS1-1/+1
Signed-off-by: Alex Martens <alexmgit@protonmail.com>
2021-06-30tcgbios: Use The proper sha function for each PCR bankStefan Berger1-15/+43
Instead of just using sha1 for all PCR banks (and truncating the value or zero-padding it) use the proper hash function for each one of the banks. For unimplemented hashes, fill the buffer with 0xff. Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2021-06-30Add implementations for sha256, sha384, and sha512Stefan Berger8-14/+479
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2021-06-30tcgbios: Fix details in log entriesStefan Berger1-2/+3
Fix two details of the logs: - Set the field 'SpecErrata' to 2 as required by specs. - Write the separator into the log entry's event field. Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2021-06-09stacks: call check_irqs() after switch_next()Volker Rümelin1-3/+2
In function run_thread() the function check_irqs() gets called after the thread switch for atomic handoff reasons. In yield() it's the other way round. If check_irqs() is called after run_thread() and check_irqs() is called before switch_next() in yield(), it can happen in a constructed case that a background thread runs twice without a check_irqs() call in between. Call check_irqs() after switch_next() in yield() to prevent this. Signed-off-by: Volker Rümelin <vr_qemu@t-online.de>
2021-06-09stacks: call check_irqs() in run_thread()Volker Rümelin1-1/+7
The comment above the yield() function suggests that yield() allows interrupts for a short time. But yield() only briefly enables interrupts if seabios was built without CONFIG_THREADS or if yield() is called from the main thread. In order to guarantee that the interrupts were enabled once before yield() returns in a background thread, the main thread must call check_irqs() before or after every thread switch. The function run_thread() also switches threads, but the call to check_irqs() was forgotten. Add the missing check_irqs() call. This fixes PS/2 keyboard initialization failures. The code in src/hw/ps2port.c relies on yield() to briefly enable interrupts. There is a comment above the yield() function in __ps2_command(), where the author left a remark why the call to yield() is actually needed. Here is one of the call sequences leading to a PS/2 keyboard initialization failure. ps2_keyboard_setup() | ret = i8042_command(I8042_CMD_CTL_TEST, param); # This command will register an interrupt if the PS/2 device # controller raises interrupts for replies to a controller # command. | ret = ps2_kbd_command(ATKBD_CMD_RESET_BAT, param); | ps2_command(0, command, param); | ret = __ps2_command(aux, command, param); | // Flush any interrupts already pending. yield(); # yield() doesn't flush interrupts if the main thread # hasn't reached wait_threads(). | ret = ps2_sendbyte(aux, command, 1000); # Reset the PS/2 keyboard controller and wait for # PS2_RET_ACK. | ret = ps2_recvbyte(aux, 0, 4000); | for (;;) { | status = inb(PORT_PS2_STATUS); # I8042_STR_OBF isn't set because the keyboard self # test reply is still on wire. | yield(); # After a few yield()s the keyboard interrupt fires # and clears the I8042_STR_OBF status bit. If the # keyboard self test reply arrives before the # interrupt fires the keyboard reply is lost and # ps2_recvbyte() returns after the timeout. } Signed-off-by: Volker Rümelin <vr_qemu@t-online.de>
2021-06-04Increase BUILD_MIN_BIOSTABLE for large romsGerd Hoffmann1-0/+4
BUILD_MIN_BIOSTABLE reserves space in the f-segment. Some data structures -- for example disk drives known to seabios -- must be stored there, so the space available here limits the number of devices seabios is able to manage. This patch sets BUILD_MIN_BIOSTABLE to 8k for bios images being 256k or larger in size. 32bit code is moved off in that case, so we have more room in the f-segment then. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2021-05-31nvme: drive desc should not include the newlineGerd Hoffmann1-2/+2
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2021-05-31nvme: improve namespace allocationGerd Hoffmann2-25/+16
Instead of allocating a big array upfront go probe the namespaces and only allocate an nvme_namespace struct for those namespaces which are actually active. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2021-05-26vgasrc: ignore .node.gnu.property (binutils-2.36 support)Sergei Trofimovich1-1/+8
Modern binutils unconditionally tracks x86_64 ISA levels in intermediate files in .note.gnu.property. Custom liker script does not handle the section and complains about it: ld --gc-sections -T out/vgasrc/vgalayout.lds out/vgaccode16.o \ out/vgaentry.o out/vgaversion.o -o out/vgarom.o ld: section .note.gnu.property LMA [0000000000000000,0000000000000027] \ overlaps section .text LMA [0000000000000000,00000000000098af] The change ignores .note* sections. Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
2021-03-10usb-hid: Increase MAX_KBD_EVENTStefan Ott via SeaBIOS1-1/+1
Some USB keyboards use max packet sizes beyond the current maximum supported by SeaBIOS. This increases the available size to support keyboards such as the Matias Ergo Pro. Signed-off-by: Stefan Ott <stefan@ott.net>
2020-12-21Support booting USB drives with a write protect switch enabledMike Banon1-3/+7
At least some USB drives with a write protect switch (e.g. Netac U335) could report "MEDIUM NOT PRESENT" for a while if a write protection is enabled. Instead of stopping the initialization attempts immediately, stop only after getting this report for 3 times, to ensure the successful initialization of such a "broken hardware". Signed-off-by: Mike Banon <mikebdp2@gmail.com>
2020-11-16nvme: Clean up nvme_cmd_readwrite()David Woodhouse1-44/+33
This ended up with an odd mix of recursion (albeit *mostly* tail-recursion) and interation that could have been prettier. In addition, while recursing it potentially adjusted op->count which is used by callers to see the amount of I/O actually performed. Fix it by bringing nvme_build_prpl() into the normal loop using 'i' as the offset in the op. Fixes: 94f0510dc ("nvme: Split requests by maximum allowed size") Reviewed-by: Alexander Graf <graf@amazon.com> Signed-off-by: David Woodhouse <dwmw@amazon.co.uk>
2020-10-28nvme: Split requests by maximum allowed sizeAlexander Graf1-0/+16
Some NVMe controllers only support small maximum request sizes, such as the AWS EBS NVMe implementation which only supports NVMe requests of up to 32 pages (256kb) at once. BIOS callers can exceed those request sizes by defining sector counts above this threshold. Currently we fall back to the bounce buffer implementation for those. This is slow. This patch introduces splitting logic to the NVMe I/O request code so that every NVMe I/O request gets handled in a chunk size that is consumable by the NVMe adapter, while maintaining the fast path PRPL logic we just introduced. Signed-off-by: Alexander Graf <graf@amazon.com>
2020-10-28nvme: Pass large I/O requests as PRP listsAlexander Graf2-10/+82
Today, we split every I/O request into at most 4kb chunks and wait for these requests to finish. We encountered issues where the backing storage is network based, so every I/O request needs to go over the network with associated latency cost. A few ms of latency when loading 100MB initrd in 4kb chunks does add up. NVMe implements a feature to allow I/O requests spanning multiple pages, called PRP lists. This patch takes larger I/O operations and checks if they can be directly passed to the NVMe backing device as PRP list. At least for grub, read operations can always be mapped directly into PRP list items. This reduces the number of I/O operations required during a typical boot path by roughly a factor of 5. Signed-off-by: Alexander Graf <graf@amazon.com>
2020-10-28nvme: Allow to set PRP2Alexander Graf1-5/+6
When creating a PRP based I/O request, we pass in the pointer to operate on. Going forward, we will want to be able to pass additional pointers though for mappings above 4k. This patch adds a parameter to nvme_get_next_sqe() to pass in the PRP2 value of an NVMe I/O request, paving the way for a future patch to implement PRP lists. Signed-off-by: Alexander Graf <graf@amazon.com> Reviewed-by: Filippo Sironi <sironi@amazon.de>