aboutsummaryrefslogtreecommitdiff
path: root/stand/i386
Commit message (Collapse)AuthorAgeFilesLines
...
* Revert "stand: Remove double words in source code comments"Gordon Bergling2023-04-181-1/+1
| | | | | | | | | The sentence, "The base address that we the boot0 code to to run it." is correct. Reported by: jrtc27 This reverts commit b12ccd0bb1b37f32e972bb3e945e4025fe409e2f.
* stand: Remove double words in source code commentsGordon Bergling2023-04-181-1/+1
| | | | | | | - s/to to/to/ - s/value value/value/ MFC after: 5 days
* loader: comconsole: don't unconditionally wipe out hw.uart.consoleKyle Evans2023-04-141-1/+2
| | | | | | | | | | | It may be the case that we need to set hw.uart.console manually in some scenarios that comconsole can't necessarily support. Avoid clobbering hw.uart.console unless we've actually selected comconsole so that one could at least get kernel console output.. Discussed with: imp Sponsored by: Zenith Electronics LLC Sponsored by: Klara, Inc.
* amd64 loader: Use efiserialio for Hyper-V booted systemsWei Hu2023-03-181-0/+14
| | | | | | | | | | | | | | | | | | | | | | | UEFI provides ConIn/ConOut handles for consoles that it supports, which include the text-video and serial ports. When the serial port is available, use the UEFI driver instead of direct io-port accesses to avoid conflicts between the firmware and direct hardware access, as happens on Hyper-V (Azure) setups. This change enables efiserialio to be built for efi-amd64 and has higher order priority vs comconsole, and only uses efiserialio if the hypervisor is Hyper-V. When efiserialio successfully probes, it will set efi_comconsole_avail=true which will prevent comconsole from probing in this setup. Tested on Hyper-V, ESXi and Azure VMs. PR: 264267 Reviewed by: kevans, whu Tested by: whu Obtained from: Rubicon Communications, LLC (Netgate) MFC after: 2 weeks Sponsored by: Rubicon Communications, LLC (Netgate)
* loader: always install help filesMitchell Horne2023-02-031-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Address two issues with current help file logic: The existing condition prevents the common help file from being installed when there are no additional help files defined. This results in no loader.help on EFI platforms, for example. Second, due to the fact that we build and install multiple loader types, each successive install will clobber the previous loader.help. The result is that we could lose type-specific commands, or possibly list them in loaders that do not have such commands. Instead, give each loader type a uniquely named help file. The EFI loader will look for /boot/loader.help.efi, userboot will look for /boot/loader.help.userboot, etc. The interpreter variant has no effect on which help file is loaded. This leaves the old /boot/loader.help unused. Some credit for the final approach goes to Mathieu <sigsys@gmail.com> for their version of the fix in https://reviews.freebsd.org/D22951. PR: 267134 Reported by: Daniel O'Connor <darius@dons.net.au> Reviewed by: imp MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D28591
* stand: create common set_currdevWarner Losh2023-01-111-4/+1
| | | | | | | | | | | | Pull together the nearly identical copies of set_currdev in i386, userboot and efi. Other boot loaders have variances that might be fine to use the common routine, or not. Since they are harder to test for me, and ofw and uboot do handle these setting differently, leave them be for now. Sponsored by: Netflix Reviewed by: kevans Differential Revision: https://reviews.freebsd.org/D38005
* stand: Create common gen_setcurrdev and replace codeWarner Losh2023-01-114-21/+4
| | | | | | | | | | Replace 4 identical copies of *_setcurrdev with gen_setcurrdev to avoid having to create a 5th copy. uboot_setcurrdev is actually different and needs to remain separate (even though it's quite similar). Sponsored by: Netflix Reviewed by: fuz@fuz.su, kevans Differential Revision: https://reviews.freebsd.org/D38003
* stand/zfs: Add a third argument to zfs_probe_dev: part_tooWarner Losh2023-01-082-3/+3
| | | | | | | | | Pass in 'true' if you'd like to search this device's partitions or 'false' if you should just search the device. EFI and (in the future) kboot have discrete partitions that aren't accessed via the full disk device. Weird things happen if you try to search in these cases. Sponsored by: Netflix
* stand: parsedev API change: devspec now points to start of full device nameWarner Losh2022-11-301-1/+1
| | | | | | | | | | | | | | | | | | | | To support more flexible device matching, we now pass in the full devspec to the parsedev routines. For everything execpt uboot, this is just a drop in (since everything except uboot and openfirmware always uses disk...: and/or zfs:, but openfirmware isn't really affected). uboot we kludge around it by subtracting 4 from where the rest of the device name starts. This is unforunate, and can compute the address one before the string. But we never dereference that address. uboot needs more work, and this is an acceptable UB until that other work happens. OFW doesn't really use the parsedev routines these days (since none of the supported device uses this... yet). It too needs more work, but it needs device matching support first. Sponsored by: Netflix Reviewed by: delphij Differential Revision: https://reviews.freebsd.org/D37553
* stand: create devinitWarner Losh2022-11-302-11/+2
| | | | | | | | devinit() marches through all the devices, calling the inint routines if any exist. Replace all the identical copies of this code. Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D37349
* zfs: Remove devicename_stubsWarner Losh2022-11-301-5/+0
| | | | | | | | We no longer need the zfs stubs since we're no longer referencing these functions outside of zfs.c. Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D37345
* stand/i386: Move to using common devparse()Warner Losh2022-11-301-104/+5
| | | | | | | | We no longer need to have to hand-code this for each boot loader since devparse() handles them all with dv_parsedev(). Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D37341
* stand: For all disk drivers, connect dv_parsedev to disk_parsedevWarner Losh2022-11-301-0/+1
| | | | | Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D37339
* stand: Change zfs_parsedev() APIWarner Losh2022-11-301-5/+1
| | | | | | | | | | | Change the first argument to zfs_parsedev() to be a pointer to a struct devdesc *. This now gets filled in with a malloc'd structure that's returned to the caller that the caller is repsonsible for freeing. Most nplaces in the tree passed in a malloc'd pointer anyway, and this moves knowledge of zfs_devdesc more firmly into the zfs.c code. Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D37336
* stand: Change disk_parsedev() APIWarner Losh2022-11-302-11/+9
| | | | | | | | | | | Change the first argument to disk_parsedev() to be a pointer to a struct devdesc *. This now gets filled in with a malloc'd structure that's returned to the caller that the caller is repsonsible for freeing. Most places in the tree passed in a malloc'd pointer anyway, and this moves knowledge of disk_devdesc more firmly into the disk.[ch] code. Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D37335
* stand: Remove i386-only support fire firewireWarner Losh2022-11-1811-1303/+3
| | | | | | | | | | | | Remove support for booting off of firewire, and for having dcons via firewire in the loader. Kernel support for these things is unchanged. Discussed on arch@ and the current state is not working (and the build was wrong to boot). Sponsored by: Netflix Discussed: https://lists.freebsd.org/archives/freebsd-arch/2022-November/000267.html Reviewed by: kevans, melifaro, emaste Differential Revision: https://reviews.freebsd.org/D37334
* stand: Pass in the proper size for bootinfoWarner Losh2022-09-171-1/+1
| | | | | | | | | Missed one sizeof(bi) -> sizeof(*bi) in 9758dd3de1cdd conversion to allocating bootinfo. Noticed by: tijl@ Fixes: 9758dd3de1cdd Sponsored by: Netflix
* stand: Allocate bootinfo rather than have it be staticWarner Losh2022-09-161-14/+15
| | | | | | | | | This saves 80 bytes (the new bootinfo structure was 84 bytes, and a pointer is 4 bytes). The bi_load32 code is the same size. Sponsored by: Netflix Reviewed by: tsoome Differential Revision: https://reviews.freebsd.org/D36575
* stand: Stop support booting 4.x and earlier kernelsWarner Losh2022-09-162-31/+0
| | | | | | | | | | | | FreeBSD 4.x and earlier used the bi_bios_geom to get the geometry of the device. Starting in 5.x, with the wdc -> ata rewrite, it was used only in pc98 kernels to report geometry of the drives. It can be safely removed as booting kernels this old is no longer supported. This saves 176 bytes in the BIOS loader. Sponsored by: Netflix Reviewed by: adrian, emaste Differential Revision: https://reviews.freebsd.org/D36543
* stand: Remove dead store to bi_kernelnameWarner Losh2022-09-161-3/+0
| | | | | | | | | | | We set this value twice: once to 0 and once to the VA that has the name of the kernel. The first store is redundant. In addition, these two stores of 0 are also redundant. Since we never set them, they will always be zero, even if we're called multiple times. This saves 21 bytes on BIOS loader. Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D36541
* stand: collapse all copies of *copyenv into md_copyenvWarner Losh2022-09-164-31/+2
| | | | | | | | Use the efi's bi_copyenv to md_copyenv and place it in modinfo.c. Remove all other nearly identical and efi's has the best error handling. Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D36574
* stand: Move md_copymodules into modinfo.c and reduce copiesWarner Losh2022-09-162-69/+4
| | | | | | | | | | md_copymodules, bi_copymdoules, bi_copymodules32 (x2) and bi_copymodules64 (x2) are all the same routine... Replace them all with md_copymodules. This saves about 800 bytes on i386 BIOS loader, which is a nice bonus. Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D36572
* stand: Create common/modinfo.hWarner Losh2022-09-162-112/+6
| | | | | | | | | | Move all the MOD_xxx macros to this header. Each user of this interface is currently required to define MOD_ALIGNMENT(l). modinfo was selected because it sits inbetween modules and metadata and will make it easier to migrate to new, shared intefaces. Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D36571
* stand: Create MOD_ALIGN macro and use it everywhereWarner Losh2022-09-162-6/+8
| | | | | | | | To further reduce the differences between the different MOD_xxx macros, use MOD_ALIGN to do the proper alignment for the given use. Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D36570
* stand: use archsw.arch_copyin instead of i386_copyinWarner Losh2022-09-163-13/+13
| | | | | | | | | | Since archsw.arch_copyin is always i386_copyin, this will be a nop in terms of functionality. This is a diff reduction against other copies of the code that differ only by what copyin routine they call. Sponsored by: Netflix Reviewed by: tsoome Differential Revision: https://reviews.freebsd.org/D36568
* stand: i386: take into account disk sector size for blk calculationKyle Evans2022-09-081-1/+2
| | | | | | | | | | | | disk_blocks assumes BIOSDISK_SECSIZE, but the media may not be using it. In particular, bioscd on Parallels presents a 2K sector size, so we end up with a short disk_blocks and subsequent validation fails when trying to read /boot/lua. PR: 233098 Reviewed by: imp, tsoome MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D36490
* stand: Stop setting hints for bios loader tooWarner Losh2022-09-011-12/+0
| | | | | | Catch up to 2753bbe71b5a and remove the old hints. Sponsored by: Netflix
* stand: Document that boot0 uses BIOSWarner Losh2022-08-271-0/+7
| | | | | | | | | | | | | And thus has a limited range of supported baud rates. Also add that setting BOOT_BOOT0_COMCONSOLE_SPEED=0 will leave it unchanged which sometimes can give you 115200 if the BIOS initialized things outside of the normal BIOS baud rates (which many x86 enbedded-targetted boards do). Sponsored by: Netflix Reviewed by: emaste, manu (earlier versions) Suggestions by: jhb Differential Revision: https://reviews.freebsd.org/D36300
* stand: Fix a couple of comment typos in f8a199f28f9dJessica Clarke2022-08-131-2/+2
| | | | | | | The commit message documented it as /etc/src.conf but the comment in the source mentioned the non-existent /etc/loader.conf. Fixes: f8a199f28f9d ("stand: Raise limit to 550,000 bytes for loader")
* stand: Raise limit to 550,000 bytes for loaderWarner Losh2022-08-131-2/+16
| | | | | | | | | | | | | | | | | | | | | | Raise the limit for /boot/loader to be 550k. The IBM PC imposes a limit of 640k of RAM below 1MB, which is needed for real mode calls. BTX takes 40k of that. The BIOS takes some amount (25k seems a good "99% take less than or equal to this" estimate for that, though some systems consume more). Most typical setups need 25k of stack. This leaves 550k for code. We set the limit to 550,000 which gives about an extra 13,000 bytes of buffer for machines that whose setups use a little more stack or whose BIOS reserves a bit more... Add this derivation in the Makefile. Also recommend setting LOADERSIZE lower in /etc/src.conf when the loader has to run on a system whose BIOS takes up more space, or for a complex setup. Add a recipe for how to find how much RAM your BIOS uses as well (thanks to jhb@ for the trick). Network cards that boot via PXE and HBAs with their BIOS enabled are known to be large consumers of lomem space. Sponsored by: Netflix Reviewed by: jhb Differential Revision: https://reviews.freebsd.org/D36152
* stand: Go back to a.out format for /boot/loaderWarner Losh2022-08-112-10/+9
| | | | | | | | | | | | | | | | | | | Turns out there's two hidden a.out dependencies. pxeldr.S assumes it has access to the a.out header from /boot/loader and cdboot.S assumes that /boot/loader is also a.out and doesn't use boot2. So, go back to making a.out files for these and adjust the size checks to use ls, but we only need to check loader.bin. Trim the size we check against by 2,000. The difference in size between loader and loader.bin is about 3000 bytes, but clang15 produces binaries that are a smidge bigger so we need to relax the check just a little and accept some additional risk for the moment. Add some comments to loader's Makefile about this. Sponsored by: Netflix Reviewed by: emaste Differential Revision: https://reviews.freebsd.org/D36142
* stand: Make BIOS loader size limits settableWarner Losh2022-08-112-2/+2
| | | | | | | | | It's sometimes desirable to override the size limit: It's a soft limit and there are times we exceed the limit by just a little bit and don't want the build to fail (or we are hitting runtime failures below the 510,000 byte limit). Sponsored by: Netflix
* stand: i386_fmtdev can be reduced to devformatWarner Losh2022-08-114-32/+5
| | | | | | | | | devformat produces the same output as i386_fmtdev, so just use it to reduce on the dependencies. Sponsored by: Netflix Reviewed by: tsoome Differential Revision: https://reviews.freebsd.org/D35927
* stand: Replace zfs_fmtdev with generic devformat()Warner Losh2022-08-112-3/+3
| | | | | Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D35973
* stand: Add disk_fmtdev for dv_fmtdev for all the disk devicesWarner Losh2022-08-111-0/+1
| | | | | | | | | | All of the archsw fmtdev functions treat DEVT_DISK as a call to disk_fmtdev. Set all disks' dv_fmtdev to disk_fmtdev so devformat will return the same thing. Sponsored by: Netflix Reviewed by: tsoome (prior version) Differential Revision: https://reviews.freebsd.org/D35917
* stand: Change zfs_fmtdev to take a struct devdesc *Warner Losh2022-08-112-2/+2
| | | | | Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D35974
* stand: Move i386_devdesc to a unionWarner Losh2022-08-113-37/+32
| | | | | | | | | | | Rather than have the magic, hand-crafted fields that have to align with fields in other structures at the end of i386_devdesc, make it into anonymous union and adjust the code accordingly. This is safer and similar to what CAM does. Sponsored by: Netflix Reviewed by: kevans, tsoome (prior version) Differential Revision: https://reviews.freebsd.org/D35965
* stand: Remove unnecessary includeWarner Losh2022-08-111-1/+0
| | | | | | stdbool.h is implied by stand.h, so remove it. Sponsored by: Netflix
* stand: impose 510,000 byte limit for /boot/loader and /boot/pxeldrWarner Losh2022-08-112-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The BIOS method of booting imposes an absolute limit of 640k for the size of the program being run due to btx. In practice, this means that programs larger than about 500kiB will fail in odd ways as the stack / heap will overflow. Pick 510,000 as the cutoff line semi-arbitrarily. loader_lua is now almost too big and we want to break the build when it crosses this threshold. In my experience, below 500,000 always works, above 520,000 always seems to fail with things getting bad somewhere between 512,000 to 515,000. 510,000 is as close to the line as I think we can go, though experience may dictate we need to lower this in the future. This is at-best a stop-breakage until we have a better way to subset the boot loader for BIOS booting to allow better, more fined-tuned /boot/loaders for the many different environments they have to run in. This likely means we'll have a graphical loader than understands a few filesystmes for installation, and a non-graphical loader that understands the most filesystems possible for everything else in the future. Our build infrastructure needs some work before we can do that, however. At this late date, it likely isn't worth the efforts to move parts of the loader into high memory. There's a number of assumptions about where the stack is, where buffers reside, etc that are fulfilled when it lives in the first 640k that would need bounce buffers and/or other counter measures if we were to split it up. All BIOS calls are done in 16-bit mode with SEG:OFF addresses, requiring them to be in the first 640k of RAM. And nearly all machines in the last decade can boot with UEFI (though there's some exceptions, so it isn't worth killing outright yet). Sponsored by: Netflix Reviewed by: kevans Differential Revision: https://reviews.freebsd.org/D36129
* stand: i386/amd64: Always use elf format for /boot/loader and pxeldrWarner Losh2022-08-112-2/+2
| | | | | | | | | | | | | | | | The first level boot blocks have understood how to load ELF code since 1999. Switch /boot/loader and /boot/pxeldr over to being ELF format so that in-tree tools can examine them more closely. In addition, one could, in theory, now have a 'lo-mem' and a 'hi-mem' segment (though a lot of work would need to be done with bounce buffers, btx, code segment marking, etc for an arrangement like that to work). As far as I can tell, this is the last a.out binary in the tree. There are several raw binaries left, but everything else is ELF. Reviewed by: emaste, kevans Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D36130
* stand: Make sure nobody has a NULL pointer for dv_cleanupWarner Losh2022-07-272-4/+4
| | | | | | | | | | dv_cleanup is specified almost everywhere. Use nullsys instead of NULL to indicate 'do nothing'. Also, be consistent in trailing commas that were missing before. Sponsored by: Netflix Reviewed by: tsoome Differential Revision: https://reviews.freebsd.org/D35913
* stand: Use c99 structure initialization for fwohci deviceWarner Losh2022-07-241-9/+9
| | | | | | Use c99 structure init for devsw. Sponsored by: Netflix
* Adjust parse() definition in boot2 to avoid clang 15 warningDimitry Andric2022-07-151-1/+1
| | | | | | | | | | | | With clang 15, the following -Werror warning is produced: stand/i386/boot2/boot2.c:358:6: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes] This is because parse() is declared with a (void) argument list, and defined with an empty argument list. Make the definition match the declaration. MFC after: 3 days
* stand: s/libstand/libsa/g to catch up with renameWarner Losh2022-04-302-2/+2
| | | | | | | We renamed libstand to libsa years ago with the move from sys/boot to stand. Catch up in the comments. Sponsored by: Netflix
* stand: Fix a common typo in source code commentsGordon Bergling2022-03-281-1/+1
| | | | | | - s/existance/existence/ MFC after: 3 days
* gptboot.8: Fix a typo and fix lint warningsMateusz Piotrowski2022-03-181-3/+4
| | | | MFC after: 3 days
* teken: color #3 is yellow not brown - use TC_YELLOW as the nameEd Maste2022-03-121-1/+1
| | | | | | | | | | | The console escape code standard (ECMA-48) specifies color #3 (escape code 33) as yellow. A brown console color is an artifact of the VGA palette, which replaces dim (but not bright) yellow with brown. Reviewed by: adrian, imp MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D34531
* loader: accept "yellow" as a named colorEd Maste2022-03-111-1/+1
| | | | | | | | | | | | | | | | For historical reasons console color number 3 may be either yellow (most consoles) or brown (VGA palette). The console escape code standard uses "yellow", but teken color name constants appear to be based on the VGA scheme and use TC_BROWN for color 3. Even so, the palette table used 50,50,0 as the RGB percentage tuple, resulting in a dim yellow for framebuffer consoles at the time teken was introduced. Amusingly, in 19e2ce2d8367 the comment on the palette entry was changed from "brown" to "dark yellow" but the colour itself was changed from a pure yellow to being somewhat brown. MFC after: 1 week Sponsored by: The FreeBSD Foundation
* loader: support numeric and named bright colors (8-15)Ed Maste2022-03-111-12/+22
| | | | | | | | | | | | Accept "bright" or "light" prefix for named colors. For numeric colors, update error message to specify that values 0 to 15 are allowed, and verify that values are in that range. Reviewed by: imp, tsoome (both earlier version) MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D34512
* Remove quotes around Makefile .error/.warn/.info stringsEd Maste2022-01-221-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