summaryrefslogtreecommitdiff
path: root/sys/arch/amd64/stand/efiboot
AgeCommit message (Collapse)Author
2022-01-02convension -> conventionJonathan Gray
2021-11-14Make sure efiboot is built with RELA/REL relocations and not RELR,Philip Guenther
as self_reloc.c only handles the former. ok deraadt@ kettenis@
2021-10-24#define open O_* flags in libsa/stand.h, so that bootblocks can useTheo de Raadt
O_RDONLY rather using 0 ok beck
2021-06-25Move unused eficall.h files to the Attic.Kenneth R Westerback
2021-06-10Sync efid_io() with the recent improvements kettenis@ made toKenneth R Westerback
arm64 efid_io(). ok kettenis@
2021-06-08Replace hand rolled memory allocation in efid_io() withKenneth R Westerback
BS->AllocatePages() and BS->FreePages() as in all the other efid_io() versions. Don't leak the pages on success. Bump boot version to 3.59. ok yasuoka@
2021-06-07"intrisic" -> "intrinsic" in a couple of comments.Kenneth R Westerback
2021-06-07Replace all uses of 'EFI_CALL(func, params)' withKenneth R Westerback
the expansion 'func(params)'. Allows upcoming removal of eficall.h.
2021-06-04Remove now unused eficall.S.Kenneth R Westerback
prodded by jsg@
2021-06-04yasuoka@ pointed out that amd64 clang now understandsKenneth R Westerback
'__attribute((ms_abi))', removing the need for the EFI_CALL abstraction. Nuke the amd64 EFI_CALL dance from all copies of eficall.h, remove eficall.S from the build. ok kettenis@ yasuoka@
2021-06-02Use the same logic in all copies of gpt_chk_mbr(), relaxing theKenneth R Westerback
media length check to allow EFI GPT partitions to be smaller that the entire disk. Consistently use GPTSECTOR instead of randomly tossing in some literal '1's. ok kettenis@
2021-05-23Some machines (e.g. some Intel Macs) have a EFI memory map with more thanMark Kettenis
64 entries. Instead of writing beyond the array that we use to construct a BIOS compatible memory map, check that we don't overflow the array and print a message if we do. Bump the size of the array from 64 to 128 entries. Issue reported and debugged by David N. Arnold. Further input from yasuoka@ ok deraadt@ (earlier version) and yasuaka@
2021-03-17Always use an allocated buffer for {Read,Write}Blocks() to makeYASUOKA Masahiko
efid_io() simpler. Also fixes the problem on some machines when boot from CD-ROM. It happened because the previous version passed unaligned pointers to the functions even if it is restricted by the IoAlign property of the media. idea from kettenis, work with asou ok kettenis
2021-03-11spellingJonathan Gray
2021-01-28bios_memmap[] should not be a commonTheo de Raadt
ok kettenis
2020-12-09Use daddr_t and not daddr32_t in boot media.Kenneth R Westerback
At a minimum, amd64/i386 should now boot from 4TB GPT formatted disks. More daddr32_t terminations with extreme prejudice to follow. Tested by various, in snaps for a few days. ok deraadt@
2020-10-30Use a 64MB block to load the kernel to deal with kernel growth.Mark Kettenis
Note that the first 16MB of the block are currently unused since we link our kernels at physical address 0x01000000. Therefore 32MB is no longer enough to load a kernel that is now larger than 16MB. Fixes the "entry point at 0x10010000" hang that people have reported on some machines. ok patrick@, naddy@, deraadt@
2020-09-01Fix write un-protecting of kernel memory. p was used uninitializedPatrick Wildt
at the beginning of the loop. We need to use cr3 at the start of each iteration for the top level page directory. From and ok sf@
2020-08-27Improve write un-protecting of kernel memory. For the Computrace modulePatrick Wildt
on the HP EliteBook 830 G6 we added a workaround which tries to re-map the pages where we want to place to kernel read-write. On some machines though this workaround causes a regression. Fix those by changing a few things: Only set the writeable bit if it isn't set yet. Un-protect write-protected page directories. Skip lower levels if large-page is set, since the next level is already a page. Don't do anything at all if paging is disabled. From Christian Ehrhardt ok bluhm@ tobhe@
2020-08-02additional files from libkern will be needed by clang10Theo de Raadt
from mortimer
2020-06-14crank version numberTheo de Raadt
2020-06-14rewrite mdrandom() in C. previously this XOR'd against rdrand if available,Theo de Raadt
and alternatively XOR'd against TSC. now always run both sequences, and also support rdseed as a third procedure. ok kettenis naddy
2020-05-26increment version numbers, due to recent RB_GOODSEED and fchmod +T changesTheo de Raadt
2020-05-25Adjust fwrandom() to return 0 for sucess, -1 for failureTheo de Raadt
2020-03-22Make efi_device_path_depth() return the full device path depth if we don'tMark Kettenis
find a media device path node. Fixes booting OpenBSD on some older U-Boot versions that are in wide circulation such as 2017.09 and 2017.11. ok patrick@
2020-03-05Allow amd64 boot(8) and friends to read from an ffs2 filesystem.Otto Moerbeek
Also enable ffs2 for floppy, so that its kernel kan access ffs2. ok deraadt@
2019-12-12On a HP EliteBook 830 G6 the Computrace executable is located inAlexander Bluhm
the area where the boot loader copies the kernel. Its EfiLoaderCode is write protected, so the boot loader hangs in memmove(). As we may use this memory after calling EFI ExitBootServices(), change the protection bit to writeable in the page table. OK deraadt@ mlarkin@ patrick@
2019-11-29Pass the EFI memory map to the kernel.Mark Kettenis
ok deraadt@
2019-11-28Implement a hexdump command in the boot loader. This helps toAlexander Bluhm
inspect the memory layout that the firmware has created. It is especially useful for UEFI debugging. OK deraadt@ kettenis@
2019-11-26Several functions expect that bootdev_dip is not NULL and can beAlexander Bluhm
dereferenced. But there is no boot disk when EFI bootloader has been received via TFPT. Fake a disk info that never maches a real disk. Fixes a hang in run_loadfile() during HP Elitebook UEFI boot. OK patrick@
2019-10-29Use arc4 to bit-spread the 512-byte random buffer over the .openbsd.randomdataTheo de Raadt
section, which has grown a fair bit with the introduction of retguard. Mortimer discovered the repeated 512-byte sequence as retguard keys, and this resolves the issue. (Chacha does not fit on the media, so 1.5K early drop RC4 is hopefully sufficient in our KARL link universe) Version crank the bootblocks. sysupgrade -s will install new bootblocks. ok djm mortimer
2019-08-20Network-based device paths use Messaging and not Media types. ThusPatrick Wildt
in reality the depth was always -1 which made the compare function a No-Op. Properly check the device path depth value and look for the Messaging type instead to find the correct NIC. This check never worked before and was uncovered by the last change. Regression noticed by bluhm@
2019-08-13Allow PXE booting using u-boot by relaxing our requirementsPatrick Wildt
of the EFI PXE protocol. This also brings us in line with the GRUB2 implementation. Tested by naddy@ to behave the same Tested by sven falempin on his Pine64
2019-08-04crank version, following fchmod changeTheo de Raadt
2019-08-03In the bootblocks, after discovering and opening /bsd.upgrade, fchmod -xTheo de Raadt
so the file cannot be re-executed upon the next boot. This provides a stronger one-shot-upgrade model than the upgrade script's rm /bsd.upgrade. Now various forms of upgrade failure will reboot into /bsd, which is probably more recoverable. Performing fchmod -x depends on (1) use of MI boot.c (not alpha/macppc/sparc64/sgi/octeon) and (2) "can write blocks" functionality in the IO layer. Most architectures have this support now. Two diagnostics "fchmod a-x %s: failed" and "/bsd.upgrade is not u+x" will remain in the tree while refinements happen for some of the laggard architectures. based upon a discussion florian tested in snapshots for more than a week without any complaints
2019-07-29Support disk write in efiboot. Requested by deraadt.YASUOKA Masahiko
2019-05-22Allow loading of bigger ucode. This implementation uses the UEFI memoryMark Kettenis
allocation service to allocate a block of memory below 16MB such that there is no risk of overwriting it when the bootloader moves the kernel in place. It removes the 128k limit that was previously there. Based on an earlier diff by patrick@ ok mlarkin@
2019-05-10Disentangle #ifdef EFIBOOT.Mike Larkin
Separate out files used by both BIOS and EFI boot modes. These files had many #ifdef EFIBOOT code paths that make it difficult to move forward with changes needed to support random base VA linked kernels. ok deraadt@
2019-05-05Add support for the EFI Random Number Generator Protocol and use it to XORMark Kettenis
random data into the buffer that we feed the kernel. ok deraadt@, mlarkin@
2019-04-25Add a check to tftp_open() that we are actually opening a TFTP device.Christian Weisgerber
When reading a file from a non-TFTP device, clear the bootmac variable to prevent the kernel from going into netboot mode. This allows loading a kernel from a disk device after having booted efiboot from PXE. style tweak and ok kettenis@
2019-04-20libsa's memcpy() is actually memmove(). make a proper memmove(), and giveTheo de Raadt
memcpy() correct behaviour. This also brings the bcopy() macro into line.
2019-04-10crank versionsTheo de Raadt
2019-04-08crank version; looks good deraadtFlorian Obser
2019-03-15Many machines with serial ports ship with uefi firmware which does notJonathan Gray
have the serial io protocol. Fallback to direct inb/outb hardware access in this case using code derived from arch/amd64/stand/libsa/bioscons.c ok kettenis@
2018-11-20Fix typos in memprobe address check. Diff from Andrew Daugherity.YASUOKA Masahiko
2018-10-20Bring over changes from aarch64 to fix building with ld.lld on amd64.Mark Kettenis
ok patrick@, naddy@
2018-10-13Tweak linker flags and objcopy invocation to make things build with lld.Mark Kettenis
BOOTIA32.EFI works but BOOTX64.EFI unfortunately doesn't work yet. ok patrick@
2018-08-24Don't treat UnicodeChar == 0 as a keyboard input.YASUOKA Masahiko
This fixes the problem that which prevents typing the passpharase for softraid on boot. It happened at least with some external keyboards on ThinkPad X2{6,8}0. diff from Frank Groeneveld ok tb
2018-08-10Bump boot loader versions for softraid passphrase handling change.Joel Sing
2018-08-10Retry on incorrect passphrase for softraid crypto boot.Joel Sing
Historically, the softraid crypto support in the boot loaders has only given one attempt to provide the correct passphrase. There were a few reasons for this, including the fact that pkcs5_pbkdf2() allows an empty passphrase and that returning EPERM allowed for another attempt. With the event of KARL and the need for bsd.booted with hibernate resumption, this becomes much more of an issue - if you get the passphrase wrong you fail to resume. There are also other situations like using /etc/boot.conf to switch serial console, but an incorrect passphrase results in the config not being read. Also, bcrypt_pbkdf() does not permit empty passphrases. This reworks the softraid crypto support in the boot loaders so that it loops requesting a valid passphrase until one is provided, or an empty passphrase is entered (at which point it will abort). ok mortimer@ tb@