aboutsummaryrefslogtreecommitdiff
path: root/stand/efi/loader/arch
Commit message (Collapse)AuthorAgeFilesLines
* stand/efi: allow not exiting boot servicesRoger Pau Monné2021-02-165-10/+13
| | | | | | | | | | | | | | | | | | Xen requires that UEFI BootServices are enabled in order to boot, so introduce a new parameter to bi_load in order to select whether BS should be exited. No functional change introduced in this patch, as all current users of bi_load request BS to be exited. Further changes will make use of this functionality. Note the memory map is still appended to the kernel metadata, even when it could be modified by further calls to the Boot Services, as it will be used to detect if the kernel has been booted from UEFI. Sponsored by: Citrix Systems R&D Reviewed by: tsoome, imp Differential revision: https://reviews.freebsd.org/D28495
* loader: Ignore the .interp section on RISC-VJessica Clarke2020-12-141-0/+1
| | | | | | | | | | | | | | Without this we risk having the .interp section be placed earlier in the file and mess with section offsets; in particular it has been seen to be placed at the start of the file and cause the PE/COFF header to not be at address 0. This is the same fix as was done for arm64 in r365578. Reviewed by: mhorne, imp Approved by: mhorne, imp Differential Revision: https://reviews.freebsd.org/D27603 Notes: svn path=/head/; revision=368626
* Use adrp in the arm64 efi loaderAndrew Turner2020-10-131-5/+10
| | | | | | | | | | | | | | | | | On startup the arm64 efi loaders need to know PC-relative addresses. Previously we used the adr instruction to find this address, however this instruction is limited to +/- 1MiB. Switch to adrp to find the 4k page the address is within and an add to set the bottom 12 bits. This lets us address +/- 4GiB which should be large enough for now. Reported by: imp MFC after: 2 weeks Sponsored by: Innovate UK Notes: svn path=/head/; revision=366670
* Ignore the .interp section in the arm64 EFI loaderAndrew Turner2020-09-101-0/+1
| | | | | | | | | | | | When building the loader an unneeded .interp section may be added. Move this to the unused section region so offsets of used sections don't change. Obtained from: CheriBSD Sponsored by: Innovate UK Notes: svn path=/head/; revision=365578
* loader: Avoid -Wpointer-to-int cast warnings for Arm and RISC-VJessica Clarke2020-07-262-2/+2
| | | | | | | | | | | | | | | | | On RISC-V, Clang warns with: cast to smaller integer type 'unsigned int' from 'void (*)(void *)' Instead, use %p as the standard format specifier for printing pointers. Whilst Arm's pointer size is the same as unsigned, it's still cleaner to use the right thing there too. Reviewed by: brooks (mentor), emaste Approved by: brooks (mentor), emaste Differential Revision: https://reviews.freebsd.org/D25718 Notes: svn path=/head/; revision=363572
* RISC-V boot1.efi and loader.efi supportMitchell Horne2020-07-064-0/+354
| | | | | | | | | | | | | | | | | | | | | This implementation doesn't have any major deviations from the other EFI ports. I've copied the boilerplate from arm and arm64. I've tested this with the following boot flows: OpenSBI (M-mode) -> u-boot (S-mode) -> loader.efi -> FreeBSD OpenSBI (M-mode) -> u-boot (S-mode) -> boot1.efi -> loader.efi -> FreeBSD Due to the way that u-boot handles secondary CPUs, OpenSBI >= v0.7 is required, as the HSM extension is needed to bring them up explicitly. Because of this, using BBL as the SBI implementation will not be possible. Additionally, there are a few recent u-boot changes that are required as well, all of which will be present in the upcoming v2020.07 release. Looks good: emaste Differential Revision: https://reviews.freebsd.org/D25135 Notes: svn path=/head/; revision=362973
* Stop setting PG_U in bootstrap mappings.Mark Johnston2020-04-241-3/+3
| | | | | | | | | | | | | | These mappings are never visible to userspace as they get replaced when the amd64 pmap is bootstrapped, but there is no need to set PG_U in the first place. Reviewed by: alc, kib MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D24547 Notes: svn path=/head/; revision=360260
* loader: add comconsole implementation on top of SIO protocolToomas Soome2020-03-142-0/+2
| | | | | | | Provide comconsole on top of SIO for arm platforms (x86 does use bios version). Notes: svn path=/head/; revision=358989
* veloader use vectx API for kernel and modulesSimon J. Gerraty2020-03-081-3/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The vectx API, computes the hash for verifying a file as it is read. This avoids the overhead of reading files twice - once to verify, then again to load. For doing an install via loader, avoiding the need to rewind large files is critical. This API is only used for modules, kernel and mdimage as these are the biggest files read by the loader. The reduction in boot time depends on how expensive the I/O is on any given platform. On a fast VM we see 6% improvement. For install via loader the first file to be verified is likely to be the kernel, so some of the prep work (finding manifest etc) done by verify_file() needs to be factored so it can be reused for vectx_open(). For missing or unrecognized fingerprint entries, we fail in vectx_open() unless verifying is disabled. Otherwise fingerprint check happens in vectx_close() and since this API is only used for files which must be verified (VE_MUST) we panic if we get an incorrect hash. Reviewed by: imp,tsoome MFC after: 1 week Sponsored by: Juniper Networks Differential Revision: https://reviews.freebsd.org//D23827 Notes: svn path=/head/; revision=358744
* loader: use teken teminal emulator for x86 and uefiToomas Soome2019-09-052-2/+2
| | | | | | | | | | | Replace mini cons25 emulator with teken, this does enable us proper console terminal for loader and will make it possible to implement different back end callbacks to draw to screen. At this time we still only "draw" in text mode. Notes: svn path=/head/; revision=351900
* EFI: don't call printf after ExitBootServices, since it uses Boot ServicesRebecca Cran2019-03-022-7/+15
| | | | | | | | | | | | | | | ExitBootServices terminates all boot services including console access. Attempting to call printf afterwards can result in a crash, depending on the implementation. Move any printf statements to before we call bi_load, and remove any that depend on calling bi_load first. Reviewed by: imp, tsoome Differential Revision: https://reviews.freebsd.org/D19374 Notes: svn path=/head/; revision=344718
* stand: Remove unused i386 EFI MD bitsKyle Evans2019-02-263-146/+0
| | | | | | | | | | | | | | | | | | r328169 removed the copy of bootinfo that would've made this somewhat functional. However, this is irrelevant- earlier work in r292338 was done to exit boot services in the MI bi_load() rather than having N copies of the GetMemoryMap/ExitBootServices dance. i386 never quite caught up to that; ldr_enter was still being called but the prereq for that, ldr_bootinfo, was no longer. As a consequence, this ExitBootServices() was being called with a mapkey=0, clearly bogus, and reportedly breaking the boot in some instances. Reported by: bcran MFC after: 1 week Notes: svn path=/head/; revision=344560
* Ensure we have a large enough stack for the lua loaderAndrew Turner2018-08-271-0/+17
| | | | | | | | | | | | | | | | | | | Lua has a few places where it allocates a large buffer on the stack. This is normally fine, except there are a few places where there can be multiple frames with this buffer. This can cause a stack overflow on some arm64 SoCs. Fix this by allocating our own stack in loader.efi large enough for these objects. The required size has been found by tracing how the stack pointer changes in a virtual machine and found to be no larger than 50kB. A larger stack is allocated to reduce the likelihood of overflow from future changes. Reviewed by: kevans Approved by: re (kib) Differential Revision: https://reviews.freebsd.org/D16886 Notes: svn path=/head/; revision=338337
* Fix casts between 64-bit physical addresses and pointers in EFI.John Baldwin2018-08-181-6/+6
| | | | | | | | | | | | | | | Compiling FreeBSD/i386 with modern GCC triggers warnings for various places that convert 64-bit EFI_ADDRs to pointers and vice versa. - Cast pointers to uintptr_t rather than to uint64_t when assigning to a 64-bit integer. - Cast 64-bit integers to uintptr_t before a cast to a pointer. Reviewed by: kevans MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D16586 Notes: svn path=/head/; revision=338022
* Prefer uintXX_t to u_intXX_tWarner Losh2018-03-131-1/+1
| | | | | | | | | A foolish consistency is the hobgoblin of little minds, adored by little statesmen and philosophers and divines. With consistency a great soul has simply nothing to do. -- Ralph Waldo Emerson Notes: svn path=/head/; revision=330864
* Remove extra copy of bootinfo.c. It's a bit rotted copy of the one inWarner Losh2018-01-191-275/+0
| | | | | | | | | efi/loader. Differential Review: https://reviews.freebsd.org/D13986 Notes: svn path=/head/; revision=328169
* stand: Move sections around to fix stand/ build with ld.lld on armv7Kyle Evans2018-01-181-1/+1
| | | | | | | | | | | | | | | | | | | | When building loader bits, lld fails with the following error: "ld: error: section: .dynamic is not contiguous with other relro sections" on both ubldr and EFI loader. Move .dynamic up to make ld.lld happy, adjust .got as necessary for ubldr. Tested on: OrangePi One (ld.lld, ubldr) Tested on: Banana Pi-M3 (ld.lld, ubldr) Tested on: qemu-armv7 (ld.lld, EFI) Tested on: qemu-armv7 (ld.bfd, EFI) Tested on: Raspberry Pi 2 (ld.bfd, ubldr) [manu] Tested on: Banana Pi-M2 (ld.bfd, ubldr) [manu] Reviewed by: andrew, emaste, imp Differential Revision: https://reviews.freebsd.org/D13942 Notes: svn path=/head/; revision=328156
* Move sys/boot to stand. Fix all references to new locationWarner Losh2017-11-1423-0/+2563
Sponsored by: Netflix Notes: svn path=/head/; revision=325834