aboutsummaryrefslogtreecommitdiff
path: root/stand
Commit message (Collapse)AuthorAgeFilesLines
* Remove quotes around Makefile .error/.warn/.info stringsEd Maste5 days1-1/+1
| | | | | | | | The text after .error et al is emitted verbatim. Reviewed by: sjg Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D33904
* geliboot: Use the correct IV length for AES-XTS.John Baldwin13 days3-7/+6
| | | | | | | | | | | | - Use AES_XTS_IV_LEN instead of the key length as the IV length. - Use G_ELI_IVKEYLEN as the size of the zeroed iv[] array in g_eli_crypto_cipher() to match geli_io(). PR: 261172 Reported by: Malcolm Matalka <mmatalka@gmail.com>, mikael Reviewed by: markj Sponsored by: FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D33884
* geliboot: Use the multi-block functions for AES-XTS.John Baldwin2022-01-111-9/+5
| | | | | | Reviewed by: markj Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D33530
* loader: tslog: Add more log for module loadingEmmanuel Vadot2022-01-112-0/+23
| | | | | | | | | | | This helps mesuring what's happening when we load the kernel/modules/mfsroot. This also adds TSENTER2 which uses the third argument of TSRAW, same as in the kernel. MFC after: 2 weeks Sponsored by: Beckhoff Automation GmbH & Co. KG Differential Revision: https://reviews.freebsd.org/D33699
* mips: remove saf1761Warner Losh2022-01-041-8/+0
| | | | | | | | The saf1761 OTG support was only for mips targets (BERI?). Retire it. Sponsored by: Netflix Reviewed by: brooks Differential Revision: https://reviews.freebsd.org/D33706
* ufs: Rework shortlink handling to avoid subobject overflowsJessica Clarke2022-01-021-5/+2
| | | | | | | | | | | | | | | | | | | | Shortlinks occupy the space of both di_db and di_ib when used. However, everywhere that wants to read or write a shortlink takes a pointer do di_db and promptly runs off the end of it into di_ib. This is fine on most architectures, if a little dodgy. However, on CHERI, the compiler can optionally restrict the bounds on pointers to subobjects to just that subobject, in order to mitigate intra-object buffer overflows, and this is enabled in CheriBSD's pure-capability kernels. Instead, clean this up by inserting a union such that a new di_shortlink can be added with the right size and element type, avoiding the need to cast and allowing the use of the DIP macro to access the field. This also mirrors how the ext2fs code implements extents support, with the exact same structure other than having a uint32_t i_data[] instead of a char di_shortlink[]. Reviewed by: mckusick, jhb Differential Revision: https://reviews.freebsd.org/D33650
* kboot: move to generic syscall interfaceWarner Losh2021-12-305-91/+138
| | | | | | | | Just have the MD code provide syscall and have generic code for the rest. Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D33515
* kboot: Split out powerpc buildWarner Losh2021-12-308-12/+21
| | | | | | | | | Split the powerpc specific parts into kboot/arch/powerpc64. More may be needed here. Sponsored by: Netflix Reviewed by: jhibbits Differential Revision: https://reviews.freebsd.org/D33514
* kboot: Move powerpc kboot to top levelWarner Losh2021-12-3014-4/+3
| | | | | | | | As the first step at making this more generic, move kboot to top level. Sponsored by: Netflix Reviewed by: luporl, tsoome Differential Revision: https://reviews.freebsd.org/D33513
* loader: tftp: Copy the first block into the cacheEmmanuel Vadot2021-12-301-0/+7
| | | | | | | | | | | | tftp_open reads the first block so copy it in the cached data. If we have more than one block (i.e. we called tftp_read before tftp_preload) simply just reset the transfer. Reported by: mmel Reviewed by: mmel, tsoome MFC after: 2 weeks Sponsored by: Beckhoff Automation GmbH & Co. KG Differential Revision: https://reviews.freebsd.org/D33697
* loader.efi: to preserve heap space, use AllocatePages() for shadow_fbToomas Soome2021-12-222-2/+12
| | | | | | | | | shadow FB size could be rather large and depends on resolution, instead of using heap, allocate dedicated space outside of heap. Reviewed by: manu Differential Revision: https://reviews.freebsd.org/D33600 MFC after: 2 weeks
* gfx_fb: Fix a typo in a source code commentGordon Bergling2021-12-221-1/+1
| | | | | | - s/decriptor/descriptor/ MFC after: 3 days
* Add an loader command on arm64 to sync the cacheAndrew Turner2021-12-201-0/+38
| | | | | | | | | | | | | On boot we don't need to perform any CPU cache management when the IDC and DIC fields in the ctr_el0 register are set. Add a command to tell loader to ignore these fields. This could be useful, for example, if the hardware is misreporting the values and we are missing a quirk to enable it. It is not expected this will be needed, but is only intended as a workaround to ensure the kernel can still boot. Sponsored by: The FreeBSD Foundation
* Don't sync the I/D caches when they are coherentAndrew Turner2021-12-203-26/+45
| | | | | | | | | | | | In the arm64 loader we need to syncronise the I and D caches. On some newer CPUs the I and D caches are coherent so we don't need to perform these operations. While here remove the arguments to cpu_inval_icache as they are unneeded. Reported by: cperciva Tested by: cperciva Sponsored by: Innovate UK
* loader.efi: Do not use as frame buffer BLT-only GOPs.Alexander Motin2021-12-161-4/+16
| | | | | | | | | | | | Kernel needs physical frame buffer address and size, which Block Transfer-only Graphics Output Protocol instances do not have. Some recent ASUS boards like PRIME Z690M-PLUS D4 and PRIME H570-Plus report two GOPs, out of which the second one support ConOut protocol, that made it preferable, but is BLT-only, that made console unusable. Discussed with: tsoome (previous version) MFC after: 1 week
* loader: lua: test that /boot exists firstEmmanuel Vadot2021-12-161-0/+7
| | | | | | | | | | Otherwise on fs like tftp where no directory listing is possible we fail on the .dir method. Reviewed by: imp, kevans MFC after: 2 weeks Sponsored by: Beckhoff Automation GmbH & Co. KG Differential Revision: https://reviews.freebsd.org/D33414
* loader: bcache: Fix debug printfEmmanuel Vadot2021-12-161-3/+3
| | | | | | | | | Use %j to it works on 64 and 32 bits system. Reviewed by: imp, tsoome MFC after: 2 weeks Sponsored by: Beckhoff Automation GmbH & Co. KG Differential Revision: https://reviews.freebsd.org/D33430
* loader: tftp: Add preload methodEmmanuel Vadot2021-12-161-0/+60
| | | | | | | | | | The preload method will transfer the whole file in a buffer and cache it so read/lseek operations are faster. Reviewed by: imp, tsoome MFC after: 2 weeks Sponsored by: Beckhoff Automation GmbH & Co. KG Differential Revision: https://reviews.freebsd.org/D33410
* loader: Add preload operation to fs_opsEmmanuel Vadot2021-12-164-1/+49
| | | | | | | | | | | | | | | | When we load an ELF file (kernel or module) we do seek(2) a lot to parse/load the different sections of the ELF file. Protocol like TFTP suffers a lot from this as there is no resume or a way to start the tranfer from a specified offset in the file. fs_preload is added to help those protocol. Call preload just after opening the ELF file that we need to load so the underlying method can cache the hole file and then read/lseek operations are faster. Reviewed by: imp MFC after: 2 weeks Sponsored by: Beckhoff Automation GmbH & Co. KG Differential Revision: https://reviews.freebsd.org/D33409
* loader: ip: Do not call getsecs so muchEmmanuel Vadot2021-12-161-3/+2
| | | | | | | | | | | | getsecs is very costly, reuse the values we got before. Fetching a ~30MB kernel with the tftp command use to take ~26 seconds and now it's ~18 seconds. Reviewed by: imp, tsoome MFC after: 2 weeks Sponsored by: Beckhoff Automation GmbH & Co. KG Differential Revision: https://reviews.freebsd.org/D33408
* loader: tftp: Don't let tftp timeoutEmmanuel Vadot2021-12-161-1/+5
| | | | | | | | | | | | | | When we load a kernel or module we open/close it a few times. Since we're using the same port number each time and that we requested the same file the ACK that we send are valid on the server side and the server send us the file multiple times. This makes tftp loading time very inconsistant due to the UDP "flood" that we have to process. Reviewed by: imp, tsoome MFC after: 2 weeks Sponsored by: Beckhoff Automation GmbH & Co. KG Differential Revision: https://reviews.freebsd.org/D33407
* loader: Add a readtest commandEmmanuel Vadot2021-12-162-0/+32
| | | | | | | | | | readtest will simply load the file in memory, useful for timing loading on some filesystems. Reviewed by: tsoome MFC after: 2 weeks Sponsored by: Beckhoff Automation GmbH & Co. KG Differential Revision: https://reviews.freebsd.org/D33411
* loader: tftp: Don't error on tftp error 0Emmanuel Vadot2021-12-161-5/+10
| | | | | | | | | | | tftp-hpa sends NAK with tftp error set to 0 when trying to get a directory and this is the first thing that loader tries to do and this make it hangs. Reviewed by: imp, tsoome MFC after: 2 weeks Sponsored by: Beckhoff Automation GmbH & Co. KG Differential Revision: https://reviews.freebsd.org/D33406
* stand/module: skip is only used by veriexecWarner Losh2021-12-161-4/+3
| | | | Sponsored by: Netflix
* stand/userboot: Kill set but unused variablesWarner Losh2021-12-161-6/+0
| | | | | | | We never use 'dev' after fetching it from the varargs list. Skip the whole bother of fetching it, or setting up the meachinery to fetch it. Sponsored by: Netflix
* stand: netif kill set but unused variablesWarner Losh2021-12-161-2/+1
| | | | Sponsored by: Netflix
* stand/uboot: reorgWarner Losh2021-12-1539-217/+117
| | | | | | | | | | | | | | | | | | | Build uboot ubldr and friends like we build efi binaries o move everything to be under stand/uboot o md code goes in arch/$ARCH o move everything over from the library - Had to rename console.c, disk.c and module.c due to conflicts o update version to 1.5 to reflect the new way of building This results in a more consistent build system and should represent no functional change, apart from powerpc version getting new help file. Also, moved to exlcuding uboot on powerpc64le by using BROKEN_OPTION instead of the incidental exclusion we had before due to Makefile reorgs. Sponsored by: Netflix Feedback by: stevek, jrtc27 Differential Revision: https://reviews.freebsd.org/D33362
* loader: move all gfx_fb.c stubs to common/gfx_fb_stub.cWarner Losh2021-12-148-246/+9
| | | | | | | | | All these files are the same, modulo one comment. Move them all into common/gfx_fb_stub.c and adjust Makefiles accordingly. Sponsored by: Netflix Reviewed by: manu Differential Revision: https://reviews.freebsd.org/D33428
* loader: narrow the scope of gfx frame buffer wrt tg supported kernelsWarner Losh2021-12-146-52/+44
| | | | | | | | | | | | | | Store whether or not we found a vbefb module (eg, a tg supported kernel) in the preloaded_file structure. This automatically resets on reload and eliminates load_elf knowing about any gfx_* interface. Restrict this to i386, which is the only place it's used. Update libi386 to check in the preloaded_file struct. Eliminate this from the teken_gfx structure. Rewrite the parsing code to be more inline. Check this from the same place we check for a relocatable amd64 kernel. Sponsored by: Netflix Reviewed by: manu, tsoome Differential Revision: https://reviews.freebsd.org/D33427
* loader/kboot: minor style nitWarner Losh2021-12-131-1/+0
| | | | | | Kill trailing white space. Sponsored by: Netflix
* loader:prefix is only used for LOADER_VERIEXECWarner Losh2021-12-131-1/+8
| | | | | | | Only define and set prefix when LOADER_VERIEXEC is defined. It's only used by the LOADER_VERIEXEC code. Sponsored by: Netflix
* loader: framebuffer should only be written intoToomas Soome2021-12-114-47/+115
| | | | | | | | Reading from Write Combining memory can be very-very slow. Try to use shadow buffer to avoid such reads. MFC after: 1 month Differential Revision: https://reviews.freebsd.org/D33305
* stand: remove mips supportWarner Losh2021-12-1047-3965/+2
| | | | | | | | | | As part of decommissioning mips support, remove the boot loader support. Do this in advance of other boot loader work to limit the amount of work that will be thrown away. Sponsored by: Netflix Reviewed by: jrtc27 Differential Revision: https://reviews.freebsd.org/D33377
* loader.mk: Simplify a little bitWarner Losh2021-12-101-9/+3
| | | | | | | | | The elf loader needs to know how to reach into the gfx_fb code, so simplify how we include files to find that stuff. Sponsored by: Netflix Reviewed by: manu, tsoome Differential Revision: https://reviews.freebsd.org/D33376
* kboot: remove host_seekWarner Losh2021-12-092-10/+0
| | | | | | | host_llseek has replaced all instances of host_seek, so retire the latter. It's unused. Sponsored by: Netflix
* kboot: simplify _startWarner Losh2021-12-091-12/+1
| | | | | | | | _start can be implemented directly like this. The code generated is identical. It's also portable. Reviewed by: md5 Sponsored by: Netflix
* ficl: Fix a typo in a commentGordon Bergling2021-11-301-1/+1
| | | | | | - s/segement/segment/ MFC after: 3 days
* loader: abstract boot services exiting to libefi functionWarner Losh2021-11-212-4/+14
| | | | | | | | | Move direct call of ExitBootServices to efi_exit_boot_services. This function sets boot_services_active to false so callers don't have to do it everywhere (though currently only loader/bootinfo.c is affected). Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D32226
* ANSIify libsa functionsAlfonso2021-11-196-21/+9
| | | | | | | Convert libsa files to use ANSI function definitions. Pull request: https://github.com/freebsd/freebsd-src/pull/508 [ cut and paste error corrected ]
* loader: Do not force comconsole for arm and arm64Emmanuel Vadot2021-11-161-1/+1
| | | | | | | | | This makes GOP not probed on some situation (AMD Card on PCIe slot with EDK2 as we have a SERIAL_IO_PROTOCOL compatible uart). Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D32992 Sponsored by: Beckhoff Automation GmbH & Co. KG
* loader: lsefi: Print more informationEmmanuel Vadot2021-11-161-1/+25
| | | | | | | | | | | Printing the EFI_HANDLE pointer isn't very useful. If the handle have a IMAGE_DEVICE_PATH or a DEVICE_PATH protocol print it. This makes it easier to see which devices are present and what protocol they expose. Reviewed by: imp, tsoome Differential Revision: https://reviews.freebsd.org/D32991 Sponsored by: Beckhoff Automation GmbH & Co. KG
* Consolodate four copies of the STDSB define into a single place.Kirk McKusick2021-11-151-5/+0
| | | | | | | | | | | | | The STDSB macro is passed to the ffs_sbget() routine to fetch a UFS/FFS superblock "from the stadard place". It was identically defined in lib/libufs/libufs.h, stand/libsa/ufs.c, sys/ufs/ffs/ffs_extern.h, and sys/ufs/ffs/ffs_subr.c. Delete it from these four files and define it instead in sys/ufs/ffs/fs.h. All existing uses of this macro already include sys/ufs/ffs/fs.h so no include changes need to be made. No functional change intended. Sponsored by: Netflix
* loader: Add more bus name to pnpautoloadEmmanuel Vadot2021-11-141-6/+9
| | | | | | | | | | | | | | | | | Add ofwbus, iicbus and spibus to pnpautoload so modules under those buses will be loaded. On my rockpro64 now : OK pnpautoload -v Autoloading modules for simplebus Using DTB provided by EFI at 0x8100000. Autoloading modules for ofwbus /boot/kernel/rk_spi.ko text=0x14b2 text=0xd4c data=0x4d0+0x8 syms=[0x8+0xa98+0x8+0x807] /boot/kernel/dwwdt.ko text=0x12e2 text=0x78c data=0x4c8+0x10 syms=[0x8+0x990+0x8+0x6e1] Autoloading modules for iicbus Autoloading modules for spibus /boot/kernel/mx25l.ko text=0x1613 text=0x114c data=0x6e8+0x8 syms=[0x8+0xa08+0x8+0x665] loading required module 'fdt_slicer' /boot/kernel/fdt_slicer.ko text=0x95e text=0x340 data=0x290 syms=[0x8+0x6c0+0x8+0x4a0]
* loader: Fix pnpload and add some usageEmmanuel Vadot2021-11-141-4/+6
| | | | pnpload needs a busname and a compat data.
* loader: Fix pnpmatch and add some usageEmmanuel Vadot2021-11-141-5/+10
| | | | pnpmatch needs a busname and a compat data.
* efi(8): Fix a typo in a source code commentGordon Bergling2021-11-071-1/+1
| | | | | | - s/writting/writing/ MFC after: 3 days
* efi: switch boot_services_gone to boot_services_activeWarner Losh2021-11-045-22/+21
| | | | | | | | | | | Turn the presence or absence of boot services into a positive bool (and change its type to bool). Move declaration to efi.h in the global variables section. Sponsored by: Netflix Reviewed by: tsoome, kib Differential Revision: https://reviews.freebsd.org/D31814
* lualoader: fix the autoboot_delay countdown messageKatsuyuki Miyoshi2021-10-261-1/+1
| | | | | | | | | | When the timer drops from double to single digits, a spare 'e' is left on the end of the line as we don't overwrite it. Include an extra space at the end to account for this and overwrite the leftover character. PR: 259429 MFC after: 3 days Reviewed by: emaste
* powerpc64: tell kernel when radix is not availableLeandro Lupori2021-10-221-2/+8
| | | | | | | | If CAS detects that radix is not supported, set radix_mmu to 0 to avoid the kernel trying to use it and panic. MFC after: 2 weeks Sponsored by: Instituto de Pesquisas Eldorado (eldorado.org.br)
* powerpc64le: stand fixesLeandro Lupori2021-10-2012-245/+525
| | | | | | | | | | | | | | | | | | | | | | Fix boot1 and loader on PowerPC64 little-endian (LE). Due to endian issues, boot1 couldn't find the UFS boot partition and loader wasn't able to load the kernel. Most of the issues happened because boot1 and loader were BE binaries trying to access LE UFS partitions and because loader expects the kernel ELF image to use the same endian as itself. To fix these issues, boot1 and loader are now built as LE binaries on PPC64LE. To support this, the functions that call OpenFirmware were enhanced to correctly perform endian conversion on its input and output arguments and to change the CPU into BE mode before making the calls, as OpenFirmware always runs in BE. Besides that, some other small fixes were needed. Submitted by: bdragon (initial version) Reviewed by: alfredo, jhibbits Sponsored by: Instituto de Pesquisas Eldorado (eldorado.org.br) Differential Revision: https://reviews.freebsd.org/D32160