aboutsummaryrefslogtreecommitdiff
path: root/stand
Commit message (Collapse)AuthorAgeFilesLines
* loader.efi: use and prefer coninex interfaceToomas Soome2019-09-021-7/+66
| | | | | | | Add support for EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL. Notes: svn path=/head/; revision=351696
* loader.efi: some systems do not translate scan code 0x8 to backspaceToomas Soome2019-09-021-5/+8
| | | | | | | Add scancode translation for backspace. Notes: svn path=/head/; revision=351695
* Move CAS check in powerpc64 ofw loader until after the PVR check.Brandon Bergren2019-09-011-4/+4
| | | | | | | | | | This unbreaks using the powerpc64 loader on a 32-bit processor. Approved by: jhibbits (mentor) Differential Revision: https://reviews.freebsd.org/D21297 Notes: svn path=/head/; revision=351669
* loader.efi: use shift 16 in efipart as it is max ashift supported by zfsToomas Soome2019-08-311-2/+3
| | | | Notes: svn path=/head/; revision=351637
* qemu-system-aarch64 does list block device with very large block sizeToomas Soome2019-08-301-1/+4
| | | | | | | | | | Also insert Vendor device as "parent" disk (found in qemu-system-aarch64 -cpu cortex-a57). This does fix lsdev in loader.efi on this platform. Notes: svn path=/head/; revision=351630
* stand: boot2: fix amd64-xtoolchain-gcc buildKyle Evans2019-08-231-1/+1
| | | | | | | | | | | -Wno-missing-declarations is the GCC equivalent of -Wno-missing-prototypes... this was overlooked in r351135. MFC after: 3 days X-MFC-With: r351135 Notes: svn path=/head/; revision=351412
* libsa: mips: fix typo that had slipped into the diff on local machineKyle Evans2019-08-221-1/+1
| | | | | | | | MFC after: 1 week X-MFC-With: r351408 Notes: svn path=/head/; revision=351410
* libsa: mips: use _JB_* from machine/asm.h, remove regnum depKyle Evans2019-08-221-27/+26
| | | | | | | | | | | | This brings the libsa/mips _setjmp implementation closer to parity with the libc version. Reviewed by: imp, jhb MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D21330 Notes: svn path=/head/; revision=351408
* loader.efi: efipart should be more careful about constructing block device listsToomas Soome2019-08-201-351/+284
| | | | | | | | | | | | | | | The cd handles should be collected as list of partitions. Some systems also provide base name for block device (like PciRoot(0x0)/Pci(0x5,0x0)), we need to be careful about those. To make out life a bit easier, we prepare not just an array of handles, but we allocate pdinfo struct for each handle and devicepath, then we can simplify our work to sort the devices. Differential Revision: https://reviews.freebsd.org/D21187 Notes: svn path=/head/; revision=351274
* Reduce size of EFI_STAGING_SIZE to 32 on armTom Jones2019-08-171-0/+2
| | | | | | | | | | | | | | Reduce the size of the EFI_STAGING area we allocate on arm to 32. On arm SBC such as the NanoPi-NEOLTS the staging area allocation will fail on the 256MB model with a staging size of 64. Reviewed by: bcran, manu Approved by: bz (mentor) MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D21016 Notes: svn path=/head/; revision=351166
* stand: gptboot: fix build with xtoolchain-llvm90Kyle Evans2019-08-163-478/+10
| | | | | | | | | | | | | | | | ufsread.c grows a dependency on __ashldi3 with llvm90. For gptboot, just start pulling in ashldi3.c ashrdi3.c lshrdi3.c into libsa for all archs as the number of archs requiring one or more of them keeps growing. qdivrem.c and quad.h can be trivially kicked out of libsa if we start pulling these from compiler-rt as qdivrem was only used to implement umoddi3, divdi3, moddi3 (also in qdivrem.c). Reviewed by: imp MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D21291 Notes: svn path=/head/; revision=351136
* stand: boot2: fix build with xtoolchain-llvm90Kyle Evans2019-08-161-1/+6
| | | | | | | | | | | | | ufsread.c grows a dependency on __ashldi3 with llvm90. Grab ashldi3.c out of compiler-rt rather than trying to link against libsa (for now). -Wno-missing-prototypes is necessary to compile ashldi3.c standalone. Reviewed by: imp MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D21291 Notes: svn path=/head/; revision=351135
* stand: push LIBC_SRC up into defs.mkKyle Evans2019-08-162-9/+9
| | | | | | | | | | | | | | Other parts of stand/ that don't use libsa will need to grab bits from libc shortly. Push LIBC_SRC up to defs.mk in advance of this so that they can use it, and rename it to LIBCSRC to match the convention of the rest of the *SRC variables in this file. Reviewed by: imp MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D21282 Notes: svn path=/head/; revision=351119
* gptzfsboot: remove CLANG_NO_IASEd Maste2019-08-151-3/+0
| | | | | | | | | | | | | | | | Many components under stand/ had CLANG_NO_IAS added when Clang's Integrated Assembler did not handle .codeNN directives. Clang gained support quite some time ago, so we can build stand/ with IAS. In some cases there were small differences in generated object output. In the case of gptzfsboot however using GNU as or Clang IAS to assemble gptldr.S resulted in identical final gptzfsboot binary output. Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D11115 Notes: svn path=/head/; revision=351097
* stand: remove CLANG_NO_IAS from pxeldrEd Maste2019-08-151-3/+0
| | | | | | | | | | | | | | | | | | | | | | | Many components under stand/ had CLANG_NO_IAS added when Clang's Integrated Assembler (IAS) did not handle .codeNN directives. Clang gained support quite some time ago, and we can now build stand/ with IAS. In most cases IAS- and GNU as-assembled boot components were identical, and CLANG_NO_IAS was already removed from other components. Clang IAS produces different output for some components, including pxeldr, so CLANG_NO_IAS was not previously removed for those. In the case of pxeldr the difference is that IAS adds a size override prefix (67h) to three instructions to specify a 32-bit address, even though the two high bytes are zero and the address fits in 16 bits. this wastes three bytes per instruction and causes some additional nop npadding to be required elsewhere in the object, but pxeboot is not size-constrained so it doesn't matter. Sponsored by: The FreeBSD Foundation Notes: svn path=/head/; revision=351096
* stand: remove CLANG_NO_IAS from cdbootEd Maste2019-08-151-3/+0
| | | | | | | | | | | | | | | | | | | | | | | | Many components under stand/ had CLANG_NO_IAS added when Clang's Integrated Assembler (IAS) did not handle .codeNN directives. Clang gained support quite some time ago, and we can now build stand/ with IAS. In most cases IAS- and GNU as-assembled boot components were identical, and CLANG_NO_IAS was already removed from other components. Clang IAS produces different output for some components, including cdboot, so CLANG_NO_IAS was not previously removed for those. In the case of cdboot the difference is that IAS adds a size override prefix (67h) to many instructions to specify a 32-bit address, even though the two high bytes are zero. This wastes three bytes per instance, but as cdboot is not size-constrained it doesn't matter. Padding is also different in one case; Clang used two one-byte nops while GNU as used a single two-byte xchg %eax, %eax. In any case, there is no functional change. Sponsored by: The FreeBSD Foundation Notes: svn path=/head/; revision=351092
* Revert r351078, r351085: stand/quad.h evictionKyle Evans2019-08-152-1/+114
| | | | | | | It did not go well; further examination is required... Notes: svn path=/head/; revision=351088
* stand: kick out quad.hKyle Evans2019-08-152-114/+1
| | | | | | | | | | | | | | Use quad.h from libc instead for the time being. This reduces the number of nearly-identical-quad.h we have in tree to two with only minor changes. Prototypes for some *sh*di3 have been added to match the copy in libkern. The differences between the two are likely few enough that they can perhaps be merged with little additional effort to bring us down to 1. MFC after: 3 days Notes: svn path=/head/; revision=351078
* stand: remove CLANG_NO_IAS from boot2Ed Maste2019-08-151-3/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Many components under stand/ had CLANG_NO_IAS added when Clang's Integrated Assembler (IAS) did not handle .codeNN directives. Clang gained support quite some time ago, and we can now build stand/ with IAS. In most cases IAS- and GNU as-assembled boot components were identical, and CLANG_NO_IAS was already removed from other components. Clang IAS produces different output for some components, including boot2, so CLANG_NO_IAS was not previously removed for those. In the case of boot2 the difference is that IAS produces a larger encoding for one instruction (the testb at the beginning of read). GNU as produces: 2e f6 06 b0 08 80 while IAS includes an address size override prefix (67) and produces: 2e 67 f6 05 b3 08 00 00 80 This results in three fewer NOPs elsewhere in boot2 but no functional change, so switch to IAS for boot2. (We can separately pursue improved 16-bit IAS support with the LLVM developers.) Sponsored by: The FreeBSD Foundation Notes: svn path=/head/; revision=351073
* loader: add error check for vdev_indirect callsToomas Soome2019-08-091-0/+12
| | | | | | | | We can error out due to memory allocation errors, we can not recover from those and need to get out. Notes: svn path=/head/; revision=350825
* loader: support com.delphix:removingToomas Soome2019-08-085-17/+707
| | | | | | | | | | | | We should support removing vdev from boot pool. Update loader zfs reader to support com.delphix:removing. Reviewed by: allanjude MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D18901 Notes: svn path=/head/; revision=350772
* Verify files loaded in chain command.Marcin Wojtas2019-08-082-0/+16
| | | | | | | | | | | | | | | | The chain command can be used to chain load another binary. If veriexec is enabled we should verify it first. Note that on EFI systems the verification was already done through firmware, assuming that Secure Boot was enabled there. Submitted by: Kornel Duleba <mindal@semihalf.com> Reviewed by: sjg MFC after: 1 week Obtained from: Semihalf Differential Revision: https://reviews.freebsd.org/D20952 Notes: svn path=/head/; revision=350761
* loader.efi: efilib.h and libefi.c were left out of 350654Toomas Soome2019-08-062-0/+8
| | | | | | | And this is second followup for 350654 Notes: svn path=/head/; revision=350656
* loader.efi: boot1.c was left out of 350654Toomas Soome2019-08-061-5/+6
| | | | | | | Followup for 350654. Notes: svn path=/head/; revision=350655
* loader.efi: replace HandleProtocol() with OpenProtocol()Toomas Soome2019-08-068-22/+25
| | | | | | | | | | | | | | The HandleProtocol() is deprecated interface and we should use OpenProtocol() instead. Moreover, in some firmware implementation(s), the HandleProtocol() does return device path using static storage, so we can not keep the value returned there. With same firmware, the OpenProtocol() does return data we do not need to clone. Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D21162 Notes: svn path=/head/; revision=350654
* [PPC64] Implement CASLeandro Lupori2019-07-313-1/+251
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Guest PPC OSs running under a hypervisor may communicate the features they support, in order for the hypervisor to expose a virtualized machine in the way the client (guest OS) expects (see LoPAPR 1.1 - B.6.2.3). This is done by calling the "/ibm,client-architecture-support" (CAS) method, informing supported features in option vectors. Until now, FreeBSD wasn't using CAS, but instead relied on hypervisor/QEMU's defaults. The problem is that, without CAS, it is very inconvenient to run POWER9 VMs on a POWER9 host running with radix enabled. This happens because, in this case, the QEMU default is to present the guest OS a dual MMU (HPT/RPT), instead of presenting a regular HPT MMU, as FreeBSD expects, resulting in an early panic. The known workarounds required either changing the host to disable radix or passing a flag to QEMU to run in a POWER8 compatible mode. With CAS, FreeBSD is now able to communicate that it wants an HPT MMU, independent of the host setup, which now makes FreeBSD work on POWER9/pseries, with KVM enabled and without hugepages (support added in a previous commit). As CAS is invoked through OpenFirmware's call-method interface, it needs to be performed early, when OpenFirmware is still operational. Besides, now that FDT is the default way to inspect the device tree on PPC, OFW call-method feature will be unavailable by default, when control is passed to the kernel. Because of this, the call to CAS is being performed at the loader, instead of at the kernel. To avoid regressions with old platforms, this change uses CAS only on POWER8/POWER9. Reviewed by: jhibbits Differential Revision: https://reviews.freebsd.org/D20827 Notes: svn path=/head/; revision=350485
* Fix EFI loader build when LOADER_NET_SUPPORT=no.Ruslan Bukin2019-07-301-0/+4
| | | | | | | Sponsored by: DARPA, AFRL Notes: svn path=/head/; revision=350444
* loader: ignore some variable settings if input unverifiedSimon J. Gerraty2019-07-171-0/+30
| | | | | | | | | | | | | | | libsecureboot can tell us if the most recent file opened was verfied or not. If it's state is VE_UNVERIFIED_OK, skip if variable matches one of the restricted prefixes. Reviewed by: stevek MFC after: 1 week Sponsored by: Juniper Networks Differential Revision: https://reviews.freebsd.org//D20909 Notes: svn path=/head/; revision=350099
* Allow efi loader to get network params from ubootJustin Hibbits2019-07-122-0/+74
| | | | | | | | | | | | | | | Summary: efi loader does not work with static network parameters. It always uses BOOTP/DHCP and also uses RARP as a fallback. Problems with DHCP servers can cause the loader to fail to populate network parameters. Submitted by: Siddharth Tuli <siddharthtuli_gmail.com> Reviewed by: imp Sponsored by: Juniper Networks, Inc. Differential Revision: https://reviews.freebsd.org/D20811 Notes: svn path=/head/; revision=349928
* efihttp: mac and err can be used uninitializedToomas Soome2019-07-021-5/+8
| | | | | | | | While there, also check if mac != NULL, and use pointer compare for ipv4 and dns. Notes: svn path=/head/; revision=349613
* efihttp: mark unused arguments with __unusedToomas Soome2019-06-301-5/+7
| | | | | | | we do have __unused, lets use it. Notes: svn path=/head/; revision=349566
* efihttp: comparison of integers of different signsToomas Soome2019-06-301-1/+1
| | | | | | | message.HeaderCount is UINTN (unsigned int), so should be i. Notes: svn path=/head/; revision=349565
* Clean efihttp pointer-sign warningsToomas Soome2019-06-301-14/+14
| | | | | | | | The Http protocol structure is using unsigned char strings, Use type casts where needed. Notes: svn path=/head/; revision=349564
* Increase EFI_STAGING_SIZE to 100MB on x64Rebecca Cran2019-06-271-0/+4
| | | | | | | | | To avoid failures when the large 18MB nvidia.ko module is being loaded, increase EFI_STAGING_SIZE from 64MB to 100MB on x64 systems. Leave the other platforms at 64MB. Notes: svn path=/head/; revision=349471
* Re-enable loader efi http boot and fix dv_open bug if dv_init failedRebecca Cran2019-06-262-0/+12
| | | | | | | | | | | The code in efihttp.c was assuming that dv_open wouldn't be called if dv_init failed. But the dv_init return value is currently ignored. Add a new variable, `efihttp_init_done` and only proceed in dv_open if it's true. This fixes the loader on systems without efi http support. Notes: svn path=/head/; revision=349404
* Disconnect EFI HTTP supportRebecca Cran2019-06-251-2/+0
| | | | | | | | The EFI HTTP code has been causing boot failures for people, so disable it while a fix is being worked on. Notes: svn path=/head/; revision=349395
* Remove NAND and NANDFS supportWarner Losh2019-06-2511-1086/+2
| | | | | | | | | | | | | | | | | | | | | NANDFS has been broken for years. Remove it. The NAND drivers that remain are for ancient parts that are no longer relevant. They are polled, have terrible performance and just for ancient arm hardware. NAND parts have evolved significantly from this early work and little to none of it would be relevant should someone need to update to support raw nand. This code has been off by default for years and has violated the vnode protocol leading to panics since it was committed. Numerous posts to arch@ and other locations have found no actual users for this software. Relnotes: Yes No Objection From: arch@ Differential Revision: https://reviews.freebsd.org/D20745 Notes: svn path=/head/; revision=349352
* loader: add HTTP support using UEFIRebecca Cran2019-06-249-0/+1735
| | | | | | | | | | | | | | | | | | | | | | Add support for an HTTP "network filesystem" using the UEFI's HTTP stack. This also supports HTTPS, but TianoCore EDK2 implementations currently crash while fetching loader files. Only IPv4 is supported at the moment. IPv6 support is planned for a follow-up changeset. Note that we include some headers from the TianoCore EDK II project in stand/efi/include/Protocol verbatim, including links to the license instead of including the full text because that's their preferred way of communicating it, despite not being normal FreeBSD project practice. Submitted by: scottph Reviewed by: imp, bcran Differential Revision: https://reviews.freebsd.org/D20643 Notes: svn path=/head/; revision=349349
* Move to using a common kernel path between the boot / laoder bits andWarner Losh2019-06-242-3/+7
| | | | | | | the kernel. Notes: svn path=/head/; revision=349343
* Tell loader to ignore newer features enabled on the root pool.Matt Macy2019-06-191-0/+6
| | | | | | | | | | | | | There are many new features in ZoF. Most, if not all, do not effect read only usage. Encryption in particular is enabled at the pool level but used at the dataset level. The loader obviously will not be able to boot if the boot dataset is encrypted, but should not care if some other dataset in the root pool is encrypted. Reviewed by: allanjude MFC after: 1 week Notes: svn path=/head/; revision=349217
* efinet: Defer exclusively opening the network handlesRebecca Cran2019-06-191-14/+18
| | | | | | | | | | | | | | | Don't commit to exclusive access to the network device handle by efinet until the loader has decided to load something through the network. This allows for the possibility of other users of the network device. Submitted by: scottph Reviewed by: tsoome, emaste Tested by: tsoome, bcran Differential Revision: https://reviews.freebsd.org/D20642 Notes: svn path=/head/; revision=349201
* [PPC] Fix loader input with newer QEMU versionsLeandro Lupori2019-06-191-1/+5
| | | | | | | | | | | | | | At least since version 4.0.0, QEMU became bug-compatible with PowerVM's vty, by inserting a \0 after every \r. As this confuses loader's interpreter and as a \0 coming from the console doesn't seem reasonable, it's now being filtered at OFW console input. Reviewed by: jhibbits MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D20676 Notes: svn path=/head/; revision=349188
* Separate kernel crc32() implementation to its own header (gsb_crc32.h) andXin LI2019-06-171-1/+1
| | | | | | | | | | | | | rename the source to gsb_crc32.c. This is a prerequisite of unifying kernel zlib instances. PR: 229763 Submitted by: Yoshihiro Ota <ota at j.email.ne.jp> Differential Revision: https://reviews.freebsd.org/D20193 Notes: svn path=/head/; revision=349151
* Fix gcc build by removing redeclarationLi-Wen Hsu2019-06-131-1/+0
| | | | | | | | | Reviewed by: imp Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D20622 Notes: svn path=/head/; revision=349008
* Add stuff to disable warning for %SWarner Losh2019-06-081-0/+2
| | | | | | | | | Add the customary warnings to disable format checking on armv7. Code move to new files, and the unconditional setting of WARNS to 6 provoked it on tinerbox... Notes: svn path=/head/; revision=348814
* Create gptboot.efiWarner Losh2019-06-084-1/+338
| | | | | | | | | | | | | | | | | This is a primary boot loader that is intended to implement the gptboot partition selection algorithm just like we did for BIOS booting. While the preferred method for UEFI is to use the UEFI Boot Manager protocol, there are situations where that can't be done: some BIOS makers interfere with the protocol in unhelpful ways, there's a new standard for a zero variable write from the client OS, and finally for USB drives that might be mobile between systems with multiple partitions there needs to be a media stable way to select. Reviewed by: tsoome, bcran Differential Revision: https://reviews.freebsd.org/D20547 Notes: svn path=/head/; revision=348812
* Break out the disk selection protocol from the rest of boot1.Warner Losh2019-06-085-196/+280
| | | | | | | | | | | Segregate the disk probing and selection protocol from the rest of the boot loader. Reviewed by: tsoome, bcran Differential Revision: https://reviews.freebsd.org/D20547 Notes: svn path=/head/; revision=348811
* Rework the reporting of the priority.Warner Losh2019-06-071-55/+34
| | | | | | | | | | | Simplify the code a bit and rework how we report the results of the probing. Reviewed by: tsoome@ Differential Revision: https://reviews.freebsd.org/D20537 Notes: svn path=/head/; revision=348768
* Remove left-over status variablesWarner Losh2019-06-072-2/+0
| | | | Notes: svn path=/head/; revision=348766
* Fix when NOFAT is definedWarner Losh2019-06-061-2/+3
| | | | | | | | We need to add the *efi file to the list of things that get built, even if we're not creating the efifat stuff. Notes: svn path=/head/; revision=348763