aboutsummaryrefslogtreecommitdiff
path: root/stand
Commit message (Collapse)AuthorAgeFilesLines
* 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
* loader: net_open() should not replace f->f_devdataToomas Soome2021-10-193-6/+13
| | | | | | | | | | | | | | | net_open() does replace f_devdata with pointer to netdev_sock, this will cause memory leak when device is closed, but also does alter the devopen() logic. We should store &netdev_sock to dev->d_opendata instead, this would preserve and follow the devopen() logic. Fixes network boot on aarch64 (tested by bz). Reviewed-by: imp MFC After: 2 weeks Differential Revision: https://reviews.freebsd.org/D32227
* powerpc64: make radix with superpages defaultLeandro Lupori2021-10-141-3/+3
| | | | | | | | | | As Radix MMU with superpages enabled is now stable, make it the default choice on supported hardware (POWER9 and above), since its performance is greater than that of HPT MMU. Reviewed by: alfredo, jhibbits Sponsored by: Instituto de Pesquisas Eldorado (eldorado.org.br) Differential Revision: https://reviews.freebsd.org/D30797
* stand: fix build after recent opencrypto changesKyle Evans2021-10-073-5/+6
| | | | | | | Pass the ivlen along through, and just drop this KASSERT() if we're building _STANDALONE for the time being. Fixes: 1833d6042c9a ("crypto: Permit variable-sized IVs ...")
* loader bcache: Allow readahead up to 256 kB I/OsColin Percival2021-10-031-1/+4
| | | | | | | | | | | | | | | | | | Prior to this commit, the loader would perform readaheads of up to 128 kB; when booting on a UFS filesystem this resulted in a series of 160 kB reads (32 kB request + 128 kB readahead). This commit allows readaheads to be longer, subject to a total I/O size limit of 256 kB; i.e. 32 kB read requests will have added readaheads of up to 224 kB. In my testing on an EC2 c5.xlarge instance, this change reduces the boot time by roughly 80 ms. Reviewed by: tsoome MFC after: 1 week Sponsored by: https://www.patreon.com/cperciva Differential Revision: https://reviews.freebsd.org/D32251
* loader bcache: Track unconsumed readaheadColin Percival2021-10-031-2/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The loader bcache attempts to determine whether readahead is useful, increasing or decreasing its readahead length based on whether a read could be serviced out of the cache. This resulted in two unfortunate behaviours: 1. A series of consecutive 32 kB reads are requested and bcache performs 16 kB readaheads. For each read, bcache determines that, since only the first 16 kB is already in the cache, the readahead was not useful, and keeps the readahead at the minimum (16 kB) level. 2. A series of consecutive 32 kB reads are requested and bcache starts with a 32 kB readahead resulting in a 64 kB being read on the first request. The second 32 kB request can be serviced out of the cache, and bcache responds by doubling its readahead length to 64 kB. The third 32 kB request cannot be serviced out of the cache, and bcache reduces its readahead length back down to 32 kB. The first syndrome converts a series of 32 kB reads into a series of (misaligned) 32 kB reads, while the second syndrome converts a series of 32 kB reads into a series of 64 kB reads; in both cases we do not increase the readahead length to its limit (currently 128 kB) no matter how many consecutive read requests are made. This change avoids this problem by tracking the "unconsumed readahead" length; readahead is deemed to be useful (and the read-ahead length is potentially increased) not only if a request was completely serviced out of the cache, but also if *any* of the request was serviced out of the cache and that length matches the amount of unconsumed readahead. Conversely, we now only reduce the readahead length in cases where there was unconsumed readahead data. In my testing on an EC2 c5.xlarge instance, this change reduces the boot time by roughly 120 ms. Reviewed by: imp, tsoome MFC after: 1 week Sponsored by: https://patreon.com/cperciva Differential Revision: https://reviews.freebsd.org/D32250
* loader: Refactor readahead adjustment in bcacheColin Percival2021-10-031-4/+14
| | | | | | | | | | | While I'm here, add an explanatory comment. No functional change intended. Reviewed by: imp, tsoome (previous version) MFC after: 1 week Sponsored by: https://patreon.com/cperciva Differential Revision: https://reviews.freebsd.org/D32249
* EFI loader: Don't free bcache for DEVT_DISK devsColin Percival2021-09-301-2/+4
| | | | | | | | | | | | | | | | Booting on an EC2 c5.xlarge instance, this reduces the number of I/Os performed from 609 to 432, reduces the total number of blocks read from 61963 to 60797, and reduces the time spent in the loader by 39 ms. Note that b4cb3fe0e39a allowed the bcache to be retained for most of the boot process, but relies on mounting filesystems; this commit allows the bcache to be retained at the start of the boot process, before the root filesystem has been located. Reviewed by: imp, tsoome MFC after: 1 week Sponsored by: https://www.patreon.com/cperciva Differential Revision: https://reviews.freebsd.org/D32239
* loader.efi: remove extra extern STWarner Losh2021-09-301-2/+0
| | | | | | | | The definition for 'ST' is in efilib.h, so we don't need extern ST here. Sponsored by: Netflix Reviewed by: tsoome, kevans Differential Revision: https://reviews.freebsd.org/D32225
* loader_lua.8: Fix first versionWarner Losh2021-09-291-11/+1
| | | | | | | | | Lua bindings appeared in FreeBSD 12.0. Delete the authors section of the man page, since it's unclear who wrote different parts of the man page. Noted by: Trond Endrestol Sponsored by: Netflix
* loader: create separate man pages for each of the loadersWarner Losh2021-09-295-1064/+911
| | | | | | | | | | | | | | | Create a man page per loader. Loader(8) will have information common to all of them, while loader_${INTERP}(8) will have information relevant to that specific loader. Rewrite loader(8) to give an overview and point to the appropriate man page. Rewrite each of the loader_${INTER}(8) man pages to contain only the relevant information to that loader. Put all the common commands, environment variables, etc in loader_simp(8) and refernce that from the loader_lua or loader_4th man pages. The loader_lua(8) could use more details about the Lua integration. Additional organization may be benefitial. Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D31340
* loader: Set twiddle globaldiv to 16 by defaultColin Percival2021-09-285-5/+8
| | | | | | | | | | | | | | | | | | | | | | | | Booting FreeBSD on an EC2 c5.xlarge instance, the loader "twiddles" 810 times over the course of 510 ms, a rate of 1.59 kHz. Even accepting that many systems are slower than this particular VM and will take longer to boot (especially if using spinning-rust disks), this seems like an unhelpfully large amount of twiddling when compared to the ~60 Hz frame rate of many displays; printing the twiddles also consumes roughly 10% of the boot time on the aforementioned VM. Setting the default globaldiv to 16 dramatically reduces the time spent printing twiddles to the console while still twiddling at roughly 100 Hz; this should be ample even for systems which take longer to boot and consequently twiddle slower. Note that this can adjusted via the twiddle_divisor variable in loader.conf, but that file is not processed until nearly halfway through the loader's runtime. Reviewed by: allanjude, jrtc27, kevans MFC after: 1 week Sponsored by: https://www.patreon.com/cperciva Differential Revision: <https://reviews.freebsd.org/D32163>
* efi loader: Call tslog_init from efi_mainColin Percival2021-09-252-2/+4
| | | | | | | We were calling tslog_init from main; no reason to wait that long. Fixes: f49381ccb6bc efi/loader: Call tslog_init Sponsored by: https://www.patreon.com/cperciva
* loader printf: Profile with TSLOGColin Percival2021-09-251-1/+4
| | | | | | | | | | Now that the loader tslog code doesn't call printf, we can profile printf using TSLOG. On an EC2 c5.xlarge instance, we spend roughly 45 ms here (out of roughly 500 ms), presumably due to the time spent writing output to the console. MFC after: 1 week Sponsored by: https://www.patreon.com/cperciva
* loader tslog: Don't use sprintfColin Percival2021-09-251-7/+43
| | | | | | | Instead, append the log entry "manually". MFC after: 1 week Sponsored by: https://www.patreon.com/cperciva
* loader: dev_net.c should use __func__ with printfToomas Soome2021-09-241-14/+16
| | | | | | | We have printf calls with function name hardwired to string, sometimes wrong name. Use __func__ instead. MFC after: 1 week
* powerpc64: fix loader regressionLeandro Lupori2021-09-211-11/+11
| | | | | | | | | | | | | | After b4cb3fe0e39a, loader started crashing on PowerPC64, with a Program Exception (700) error. The problem was that archsw was used before being initialized, with the new mount feature. This change fixes the issue by initializing archsw earlier, before setting currdev, that triggers the mount. Reviewed by: tsoome MFC after: 1 month X-MFC-With: b4cb3fe0e39a Sponsored by: Instituto de Pesquisas Eldorado (eldorado.org.br) Differential Revision: https://reviews.freebsd.org/D32027
* efi loader: TypoMark Johnston2021-09-211-1/+1
| | | | MFC after: 3 days
* style: Fix leading whitespace in bcache.cColin Percival2021-09-191-3/+3
| | | | | MFC after: 2 weeks X-MFC-with: Further bcache changes to come
* powerpc64: change CAS to support Radix MMULeandro Lupori2021-09-151-46/+74
| | | | | | | | | | | | | | | | | Use radix_mmu environment variable to select between Hash or Radix MMU, when performing the CAS method call. This matches kernel's behavior, by selecting Hash MMU by default and Radix if radix_mmu is not zero, to make sure that both loader and kernel always select the same MMU. The device tree is queried to detect Radix/GTSE support and to find out if CAS is supported, making the old CPU version and HV bit checks unnecessary now. Reviewed by: jhibbits MFC after: 2 weeks Sponsored by: Instituto de Pesquisas Eldorado (eldorado.org.br) Differential Revision: https://reviews.freebsd.org/D31951
* lualoader: use more concise verbiage for autobootKyle Evans2021-09-091-2/+1
| | | | | | | | | | The behavior remains the same, but lualoader now uses the more concise verbiage that forthloader used. This is particularly important because the previous line would exceed the right boundary of the menu and run straight into space that would typically be allowed for the logo. This makes it slightly easier to port logos from forthloader to lualoader.
* lualoader: allow brands to specify a shiftKyle Evans2021-09-091-0/+5
| | | | | Some brands will want to specify a shift to make sure they're properly centered; let it happen.
* lualoader: remove shadowed local from graphics:drawitem()Kyle Evans2021-09-091-1/+0
| | | | | for loop vars are local already and distinct from this earlier declaration; remove it.
* loader: implement mount/unmount rootfsToomas Soome2021-09-0827-191/+752
| | | | | | | | | We want to keep our root file system open to preserve bcache segment between file accesses, thus reducing physical disk IO. Reviewed by: imp, allanjude, kevans (previous version) Differential Revision: https://reviews.freebsd.org/D30848 MFC after: 1 month
* i386 loaders: avoid lld 13 garbage collecting linker setsDimitry Andric2021-09-081-0/+6
| | | | | | | | | | | | Because lld 13 and higher default to garbage collecting start/stop symbols when using --gc-sections, the linker sets used in the i386 boot loaders will disappear. This leads to the loaders not recognizing any commands, and failure to boot. Until we have a good set of linker scripts for the loaders, work around it by disabling the start-stop-gc feature. MFC after: 1 week
* loader.efi: fix console output after BS offToomas Soome2021-09-022-10/+26
| | | | | | | | | | | | | When Boot Services (BS) are switched off, we can not use BS functions any more. Since drawn console does implement our own Blt(), we can use it to draw the console. However, SimpleTextOutput protocol based console output must be blocked. Tested by inserting printf() after ExitBootServices() call. MFC after: 1 week
* libsa: Fix a typo in source code commentsGordon Bergling2021-08-291-2/+2
| | | | | | - s/mininum/minimum/ MFC after: 3 days
* efi loader: disallow user to configure staging area size less than defaultKonstantin Belousov2021-08-271-4/+9
| | | | | | | | | | We need to round it up to 2M, for instance. Having staging area too small might cause the first resize to use negative size for memmove()/memcpy(), which kills loader. Tested by: Harry Schmalzbauer <freebsd@omnilan.de> Sponsored by: The FreeBSD Foundation MFC after: 1 week
* Restore the definition of EFI_STAGING_SIZEKonstantin Belousov2021-08-271-3/+3
| | | | | | | | | | The definition can be overridden by users, and before f75caed644a5c it was in MBs. Make the symbol' unit MB, to be compatible with users customizations. Reported and tested by: Harry Schmalzbauer <freebsd@omnilan.de> Sponsored by: The FreeBSD Foundation MFC after: 1 week
* pxeboot: improve and simplify rx handlingKyle Evans2021-08-261-48/+106
| | | | | | | | | | | | | | | | | | | This pushes the bulk of the rx servicing into a single loop that's only slightly convoluted, and it addresses a problem with rx handling in the process. If we hit a tx interrupt while we're processing, we'd previously drop the frame on the floor completely and ultimately timeout, increasing boot time on particularly busy hosts as we keep having to backoff and resend. After this patch, we don't seem to hit timeouts at all on zoo anymore though loading a 27M kernel is still relatively slow (~1m20s). Reviewed by: tsoome Triage by: Ash Gokhale <ashfixit gmail com> Sponsored By: National Bureau of Economic Research Sponsored by: Klara, Inc. MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D31512
* amd64 UEFI loader: enable automatic disable of staging area copyingKonstantin Belousov2021-08-251-1/+1
| | | | | | Discussed with: emaste Sponsored by: The FreeBSD Foundation MFC after: 1 month
* loader: loader_lua can run command_more twiceToomas Soome2021-08-211-4/+1
| | | | | | | | | | | | When we quit pager, the return value 1 is returned and command_more() interprets it as error. when lua loader gets error from command, it will try to interpret it once more, so we get the same file shown once more. There is no reason why we should return error from command_more(). MFC after: 1 week
* loader: FB console does leave garbage on screen while scrollingToomas Soome2021-08-211-7/+13
| | | | | | | | Scrolling screen will leave "trail" of chars from first column. Apparently caused by cursor location mismanagement. Make sure we do not [attempt to] set cursor out of the screen. MFC after: 1 week
* Only trigger read-ahead if two adjacent blocks have been requested.Maxim Sobolev2021-08-201-2/+15
| | | | | | | | | | | | | | | | | | The change makes block caching algorithm to work better for remote media on low-BW/high-delay links. This cuts boot time over IP KVMs noticeably, since the initialization stage reads bunch of small 4th (and now lua) files that are not in the same cache stripe (usually), thus wasting lot of bandwidth and increasing latency even further. The original regression came in 2017 with revision 87ed2b7f5. We've seen increase of time it takes for the loader to get to the kernel loading from under a minute to 10-15 minutes in many cases. Reviewed by: tsoome MFC after: 1 month Differential Revision: https://reviews.freebsd.org/D31623
* libsa: cstyle cleanup of dosfs.cToomas Soome2021-08-191-580/+595
| | | | | | No functional changes intended. MFC after: 1 week
* Fix a few typos in source code commentsGordon Bergling2021-08-141-1/+1
| | | | | | - s/becase/because/ MFC after: 5 days
* loader: cstyle cleanup of userboot/devicename.cToomas Soome2021-08-111-128/+132
| | | | | | No functional changes intended. MFC after: 1 week
* loader: fix multiboot loading on UEFIRoger Pau Monné2021-08-121-1/+6
| | | | | | | | | | | | | | | | | | The Xen kernel has no symbol tables, so calling lookup_symbol against it triggers the following Divide by Zero fault: Loading Xen kernel... /boot/xen data=0x2809c8+0x149638 | !!!! X64 Exception Type - 00(#DE - Divide Error) CPU Apic ID - 00000000 !!!! Fix lookup_symbol to prevent the #DE fault from happening if the symbol table is not loaded and also fix loadfile_raw to mark multiboot kernels as relocatable, since the only multiboot kernel supported is Xen and was already unconditionally booted as relocatable. Fixes: f75caed644a5 ('amd64 UEFI loader: stop copying staging area to 2M physical') Reviewed by: imp, kib Differential Revision: https://reviews.freebsd.org/D31507
* loader: open file list should be dynamicToomas Soome2021-08-1013-115/+227
| | | | | | | | | | | | | | | Summary: Open file list is currently created as statically allocated array (64 items). Once this array is filled up, loader will not be able to operate with files. In most cases, this mechanism is good enough, but the problem appears, when we have many disks with zfs pool(s). In current loader implementation, all discovered zfs pool configurations are kept in memory and disk devices open - consuming the open file array. Rewrite the open file mechanism to use dynamically allocated list. Reviewed by: imp MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D31364
* stand: Add MK_PIE=no to defs.mkWarner Losh2021-08-111-0/+1
| | | | | | | | | | There's no need to build both pie and non-pie .o's for stand. There's some other build thing with MK_BEAR_SSL=yes and/or MK_LOADER_VERIEXEC=yes that causes the pie build to fail that the 'ar' stage now. Since we don't need the PIE stuff and the non-PIE stuff, disable PIE for the boot loader. Reviewed by: emaste Sponsored by: Netflix
* amd64 UEFI loader: stop copying staging area to 2M physicalKonstantin Belousov2021-08-086-60/+348
| | | | | | | | | | | | | | | | | | | | | On amd64, add a possibility to activate kernel with staging area in place. Add 'copy_staging' command to control this. For now, by default the old mode of copying kernel to 2M phys is retained. It is going to be changed in several weeks. On amd64, add some slop to the staging area to satisfy both requirements of the kernel startup allocator, and to have space for minor staging data increase after the final size is calculated. Add a new command 'staging_slop' to control its size. Improve staging area resizing, in particular, reallocate it anew if we cannot grow it neither down nor up. Reviewed by: kevans, markj Discussed with: emaste (the delivery plan) Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D31121
* Prefer MK_SSP=no to SSP_CFLAGS=Mitchell Horne2021-08-041-2/+0
| | | | | | | | | It is more idiomatic. CFLAGS is only augmented with $SSP_CFLAGS when $MK_SSP != "no". Reviewed by: imp MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D31401