aboutsummaryrefslogtreecommitdiff
path: root/stand/i386
Commit message (Collapse)AuthorAgeFilesLines
* loader: edd_device_path_v3 is too smallToomas Soome2020-10-121-18/+1
| | | | | | | | | | | | | | | The EDD v3[1], see table 13, page 33, does define device path as double qword, that is, 16 bytes, we have only qword. Also remove edd_device_path_v4 and edd_params_v4 because those are not used, and there is no size difference in v3 versus v4. [1] http://www.t13.org/documents/UploadedDocuments/docs2004/d1572r3-EDD3.pdf MFC after: 2 weeks Notes: svn path=/head/; revision=366631
* loader: fix non-zfs buildToomas Soome2020-09-232-1/+3
| | | | | | | | | We can not include zfs headers while building without zfs. Reported by: Oscar Holmlund Notes: svn path=/head/; revision=366087
* Work around cp breakage in current from last weekWarner Losh2020-09-231-1/+1
| | | | | | | | | | | | | | | There was a small window cp was broken. Work around this by using :> instead of cp /dev/null. Ideally, we'd keep the cp /dev/null in the build as a regression test, but doing so breaks people that upgraded during the cp breakage and this is simpler than bootstrapping a working cp since there's no good __FreeBSD_version sign posts for that. Suggested by: lots of people Too stubborn for his own good: imp Notes: svn path=/head/; revision=366042
* loader: zfs should support bootonce an nextbootToomas Soome2020-09-215-5/+37
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | bootonce feature is temporary, one time boot, activated by "bectl activate -t BE", "bectl activate -T BE" will reset the bootonce flag. By default, the bootonce setting is reset on attempt to boot and the next boot will use previously active BE. By setting zfs_bootonce_activate="YES" in rc.conf, the bootonce BE will be set permanently active. bootonce dataset name is recorded in boot pool labels, bootenv area. in case of nextboot, the nextboot_enable boolean variable is recorded in freebsd:nvstore nvlist, also stored in boot pool label bootenv area. On boot, the loader will process /boot/nextboot.conf if nextboot_enable is "YES", and will set nextboot_enable to "NO", preventing /boot/nextboot.conf processing on next boot. bootonce and nextboot features are usable in both UEFI and BIOS boot. To use bootonce/nextboot features, the boot loader needs to be updated on disk; if loader.efi is stored on ESP, then ESP needs to be updated and for BIOS boot, stage2 (zfsboot or gptzfsboot) needs to be updated (gpart or other tools). At this time, only lua loader is updated. Sponsored by: Netflix, Klara Inc. Differential Revision: https://reviews.freebsd.org/D25512 Notes: svn path=/head/; revision=365938
* When we have a command returned by zfs_nextboot() that is longerGleb Smirnoff2020-08-201-1/+6
| | | | | | | | | | | | | than command in the loader.conf, the latter needs to be nul terminated, otherwise garbage trailer left from zfs_nextboot() will be passed to parse_cmd() together with loader.conf command. While here, reset cmd to empty string if read() returns error. Reviewed by: tsoome Notes: svn path=/head/; revision=364441
* zfs: add an option to the bootloader to rewind the ZFS checkpointMariusz Zaborski2020-08-181-1/+1
| | | | | | | | | | | | | | | | | | The checkpoints are another way of keeping the state of ZFS. During the rewind, the pool has to be exported. This makes checkpoints unusable when using ZFS as root. Add the option to rewind the ZFS checkpoint at the boot time. If checkpoint exists, a new option for rewinding a checkpoint will appear in the bootloader menu. We fully support boot environments. If the rewind option is selected, the boot loader will show a list of boot environments that existed before the checkpoint. Reviewed by: tsoome, allanjude, kevans (ok with high-level overview) Differential Revision: https://reviews.freebsd.org/D24920 Notes: svn path=/head/; revision=364355
* Allow overriding the tool used for stripping binariesAlex Richardson2020-08-111-1/+1
| | | | | | | | | | | | | | | | | | | Since the make variable STRIP is already used for other purposes, this uses STRIPBIN (which is also used for the same purpose by install(1). This allows using LLVM objcopy to strip binaries instead of the in-tree elftoolchain objcopy. We make use of this in CheriBSD since passing binaries generated by our toolchain to elftoolchain strip sometimes results in assertion failures. This allows working around https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=248516 by specifying STRIPBIN=/path/to/llvm-strip Obtained from: CheriBSD Reviewed By: emaste, brooks Differential Revision: https://reviews.freebsd.org/D25988 Notes: svn path=/head/; revision=364119
* Revert that!Simon J. Gerraty2020-07-191-7/+3
| | | | Notes: svn path=/head/; revision=363351
* Oops missed Makefile.configSimon J. Gerraty2020-07-191-3/+7
| | | | Notes: svn path=/head/; revision=363350
* loader: cstyle cleanupToomas Soome2020-07-191-229/+250
| | | | | | | | | No functional changes intended. Sponsored by: Netflix, Klara Inc. Notes: svn path=/head/; revision=363318
* loader: implement GELI writesToomas Soome2020-07-111-1/+1
| | | | | | | | | | | | | Bug: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=247482 This patch is based on initial work from allanjude. PR: 247482 Obtained from: https://reviews.freebsd.org/D10236 Differential Revision: https://reviews.freebsd.org/D25605 Notes: svn path=/head/; revision=363090
* Revert r362466Baptiste Daroussin2020-06-221-2/+2
| | | | | | | | | Such change should not have happen without prior discussion and review. With hat: transitioning core Notes: svn path=/head/; revision=362488
* Improve wording to be more precise and clear.Hans Petter Selasky2020-06-211-2/+2
| | | | | | | | | | | | No functional change intended. s/Master Boot/Main Boot/ (also called MBR) MFC after: 1 week Sponsored by: Mellanox Technologies Notes: svn path=/head/; revision=362466
* loader: create single zfs nextboot implementationToomas Soome2020-06-204-852/+349
| | | | | | | | | | | | | | | | | | | | We should have nextboot feature implemented in libsa zfs code. To get there, I have created zfs_nextboot() implementation based on two sources, our current simple textual string based approach with added structured boot label PAD structure from OpenZFS. Secondly, all nvlist details are moved to separate source file and restructured a bit. This is done to provide base support to add nvlist add/update feature in followup updates. And finally, the zfsboot/gptzfsboot disk access functions are swapped to use libi386 and libsa. Sponsored by: Netflix, Klara Inc. Differential Revision: https://reviews.freebsd.org/D25324 Notes: svn path=/head/; revision=362431
* loader: vidc_init should also erase the screenToomas Soome2020-06-171-5/+2
| | | | | | | | | | | | Inject \e[J to erase the initial loader screen. We have two options, find where out cursor is and use BIOS scroll for data from boot2 or erase the display and start from origin. Erasing the screen is easier and we also get the screen buffer initialized. Sponsored by: Netflix, Klara Inc. Notes: svn path=/head/; revision=362259
* boot2: need to expand tab output and mask getcharToomas Soome2020-06-161-2/+28
| | | | | | | | | | The BIOS ouput char function does not expand tab. Mask getchar with 0xFF. Sponsored by: Netflix, Klara Inc. Notes: svn path=/head/; revision=362239
* zfsboot: cstyle cleanupToomas Soome2020-06-141-644/+673
| | | | | | | | | No functional changes intended. Sponsored by: Netflix, Klara Inc. Notes: svn path=/head/; revision=362184
* Remove tests for obsolete compilers in the build systemEric van Gyzen2020-05-122-6/+0
| | | | | | | | | | | | | | Assume gcc is at least 6.4, the oldest xtoolchain in the ports tree. Assume clang is at least 6, which was in 11.2-RELEASE. Drop conditions for older compilers. Reviewed by: imp (earlier version), emaste, jhb MFC after: 2 weeks Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D24802 Notes: svn path=/head/; revision=360964
* Avoid using non-portable dd conv=osync optionAlex Richardson2020-05-113-3/+3
| | | | | | | | | | | | The same thing can be achieved using the bs=$SIZE and conv=sync options. Unlike conv=osync, conv=sync is support on both Linux and macOS. Reviewed By: imp, jhb (earlier version) Obtained from: CheriBSD Differential Revision: https://reviews.freebsd.org/D24788 Notes: svn path=/head/; revision=360894
* Stop setting PG_U in bootstrap mappings.Mark Johnston2020-04-241-4/+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: remove libsa/crc32.c and use version from zlibToomas Soome2020-03-192-0/+2
| | | | | | | | | | | | | we have crc32(const void *, size_t) in libsa. Unfortunately zlib has crc32(long, const unigned char *, unsigned) and we have conflict. Since we do build libsa with zlib, we can use zlib version instead. Reviewed by: allanjude Differential Revision: https://reviews.freebsd.org/D24068 Notes: svn path=/head/; revision=359153
* test if port does exist via using scratch registerToomas Soome2020-03-121-0/+10
| | | | | | | | | | | | | | The SCR, scratch register was not present on the 8250 and 8250B UART, so we can use to test if we actually do have serial port. We need this test because some systems will get long delays while attempting to write to non-existing port and this will slow down the console IO to extreme. MFC after: 1 week Notes: svn path=/head/; revision=358906
* veloader use vectx API for kernel and modulesSimon J. Gerraty2020-03-091-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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=358813
* veloader use vectx API for kernel and modulesSimon J. Gerraty2020-03-083-6/+33
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Link stand/i386 components using a linker scriptDimitry Andric2020-03-048-21/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | LLD 10.0.0 changed the behavior of the -Ttext option, so that using -Ttext=0x0 now causes linking of the loaders to fail with: ld: error: output file too large: 18446744073707016908 bytes I reported this in https://bugs.llvm.org/show_bug.cgi?id=44715, and initially reverted the upstream change in r357259 to work around it. However, after some discussion with Fangrui Song in the upstream ticket, I think we can classify this as an unfortunate interaction between using -Ttext=0 in combination with --no-rosegment. (We added the latter in r332090, because btxld does not correctly handle input with more than 2 PT_LOAD segments.) Fangrui suggested to use a linker script instead, and Warner was already attempting this in r305353, but had to revert it due to "crypto-using boot problems" (not sure what those were :). This review updates the stand/i386/boot.ldscript to handle more sections, inserts some symbols like _edata and such that we use in libsa, and also discards any .interp section. It uses ORG which is defined on the linker command line using --defsym ORG=value to set the start of all the sections. Reviewed by: imp MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D23952 Notes: svn path=/head/; revision=358643
* loader: crc32 is provided by libsaToomas Soome2020-03-042-4/+4
| | | | | | | Seems like leftover from moving crc32.c to libsa. Notes: svn path=/head/; revision=358632
* Move smbios.c to libsa.Warner Losh2020-02-204-495/+2
| | | | | | | | | | | | | smbios used to be an i386 only kinda weird quirk to the x86 architecture. But UEFI picked it up, dusted it off and now it's many other locations. Make it base technology by moving it to libsa and fixing up the compliation. The code has issues with unaligned access still, but that will be addressed in a followup commit. Differential Revision: https://reviews.freebsd.org/D23660 Notes: svn path=/head/; revision=358136
* Create ptov() function.Warner Losh2020-02-202-8/+7
| | | | | | | | | | | | | Create a ptov() function. It's basically the same as the btx PTOV macro, but works everywhere. smbios needs this to translate addresses, but the translation differs between BIOS booting and EFI booting. Make it a function so one smbios.o can be used everywhere. Provide definitions for it in the two loaders affected. Differential Revision: https://reviews.freebsd.org/D23660 Notes: svn path=/head/; revision=358135
* zfsboot: vdev_read_pad2 does allocate buffer with wrong sizeToomas Soome2020-02-051-1/+1
| | | | | | | | | | | | vdev_read_pad2() does read VDEV_PAD_SIZE of data, and will copy size bytes of it, hence, we need buffer of VDEV_PAD_SIZE bytes. Issue introduced in r357497. Reported by: se Notes: svn path=/head/; revision=357569
* vdev_read_pad2: freeing wrong pointerToomas Soome2020-02-051-1/+1
| | | | | | | | | | Shoud free previously allocated tmp buffer instead. Issue introduced in r357497. Reported by: rpokala Notes: svn path=/head/; revision=357567
* loader: rewrite zfs reader zap code to use mallocToomas Soome2020-02-041-9/+20
| | | | | | | | | | First step on removing zfs_alloc. Reviewed by: delphij Differential Revision: https://reviews.freebsd.org/D23433 Notes: svn path=/head/; revision=357497
* loader: bc_add can not use any other probes than ah=0x4bToomas Soome2020-02-031-50/+97
| | | | | | | | | | | | | CD boot is broken for some systems since bioscd and biosdisk merge. The issue is that we can not use anything else than int 13 ah=0x4b to query cd information. The patch does restore the same probe as was originally used in bioscd.c. Additionally extra buffer padding is used to avoid memory corruption caused by some systems. PR: 234031 Reported by: ultramage and others MFC after: 1 day Notes: svn path=/head/; revision=357442
* Work around assembler error from clang 10.0.0 in gptboot:Dimitry Andric2020-01-281-1/+1
| | | | | | | | | | | | | | stand/i386/gptboot/gptldr.S:141:3: error: value of 36878 is too large for field of 2 bytes. jmp MEM_JMP # Start BTX ^ Use the same construct as in stand/i386/boot2/boot1.S, which ensures the jump distance does not become too large. MFC after: 3 days Notes: svn path=/projects/clang1000-import/; revision=357231
* Add support for Hygon Dhyana Family 18h processor.Konstantin Belousov2020-01-211-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As a new x86 CPU vendor, Chengdu Haiguang IC Design Co., Ltd (Hygon) is a joint venture between AMD and Haiguang Information Technology Co., Ltd., aims at providing x86 processors for China server market. The first generation Hygon processor(Dhyana) shares most architecture with AMD's family 17h, but with different CPU vendor ID("HygonGenuine") and PCI vendor ID(0x1d94) and family series number 18h(Hygon negotiated with AMD to confirm that only Hygon use family 18h). To enable Hygon Dhyana support in FreeBSD, add new definitions HYGON_VENDOR_ID("HygonGenuine") and X86_VENDOR_HYGON(0x1d94) to identify Hygon Dhyana CPU. Initialize the CPU features(topology, local APIC ext, MSI, TSC, hwpstate, MCA, DEBUG_CTL, etc) for amd64 and i386 mode by sharing the code path of AMD family 17h. The changes have been applied on FreeBSD 13.0-CURRENT and tested successfully on Hygon Dhyana processor. References: [1] Linux kernel patches for Hygon Dhyana, merged in 4.20: https://git.kernel.org/tip/c9661c1e80b609cd038db7c908e061f0535804ef [2] MSR and CPUID definition: https://www.amd.com/system/files/TechDocs/54945_PPR_Family_17h_Models_00h-0Fh.pdf Submitted by: Pu Wen <puwen@hygon.cn> MFC after: 1 week Differential revision: https://reviews.freebsd.org/D23163 Notes: svn path=/head/; revision=356940
* Backout 356693. The libsa malloc does provide necessary alignment andToomas Soome2020-01-131-1/+1
| | | | | | | | memalign by 4 will reduce alignment for some platforms. Thanks for Ian for pointing this out. Notes: svn path=/head/; revision=356700
* loader: allocate properly aligned buffer for network packetToomas Soome2020-01-131-1/+1
| | | | | | | | | Use memalign(4, size) to ensure we have properly aligned buffer. MFC after: 2 weeks Notes: svn path=/head/; revision=356693
* loader: bioscd probe can get sector size 0Toomas Soome2020-01-091-2/+4
| | | | | | | | | | With buggy BIOS, it may happen we get sector size reported 0 for cd, and then the default 512 is used, which is quite wrong. PR: 238749 Notes: svn path=/head/; revision=356570
* In gptboot, don't assume a partition number is a single digit, 1-9. GPTIan Lepore2019-12-221-3/+5
| | | | | | | | | | | partitions can have 128 partitions, so parse contiguous digits and then validate that the number is between 1-128 inclusive. I'm not sure 128 is a hard limit in the GPT standard, but it's the common number in use, and it's a better upper limit than 9. Notes: svn path=/head/; revision=356031
* Move all sources from the llvm project into contrib/llvm-project.Dimitry Andric2019-12-201-1/+1
| | | | | | | | | | | | | This uses the new layout of the upstream repository, which was recently migrated to GitHub, and converted into a "monorepo". That is, most of the earlier separate sub-projects with their own branches and tags were consolidated into one top-level directory, and are now branched and tagged together. Updating the vendor area to match this layout is next. Notes: svn path=/head/; revision=355940
* Use symbolic names for int13 callsWarner Losh2019-12-162-25/+43
| | | | | | | | | For all the INT13 calls, use symbolic names instead of magic numbers. This makes it easier to understand what the code is doing w/o a trip to google to find what these numbers mean. Notes: svn path=/head/; revision=355825
* Update Makefile.depend filesSimon J. Gerraty2019-12-111-0/+17
| | | | | | | | | | | | | Update a bunch of Makefile.depend files as a result of adding Makefile.depend.options files Reviewed by: bdrewery MFC after: 1 week Sponsored by: Juniper Networks Differential Revision: https://reviews.freebsd.org/D22494 Notes: svn path=/head/; revision=355617
* cstyle cleanup for i386_copy.cToomas Soome2019-11-081-18/+18
| | | | | | | No functional changes are intended. Notes: svn path=/head/; revision=354535
* Remove duplicate lz4 implementationsToomas Soome2019-11-022-0/+2
| | | | | | | | | | | | | | Port illumos change: https://www.illumos.org/issues/11667 Move lz4.c out of zfs tree to opensolaris/common/lz4, adjust it to be usable from kernel/stand/userland builds, so we can use just one single source. Add lz4.h to declare lz4_compress() and lz4_decompress(). MFC after: 1 month Differential Revision: https://reviews.freebsd.org/D22037 Notes: svn path=/head/; revision=354253
* loader: libi386/comconsole.c cstyle cleanupToomas Soome2019-11-021-123/+123
| | | | | | | Only cstyle, no functional changes. Notes: svn path=/head/; revision=354252
* We don't support configuring serial PCI cards in EFI. Make this clearer in theWarner Losh2019-11-011-2/+4
| | | | | | | | source rather than obfuscaring it behind NO_PCI (nothing else declares that, so it's not making the ifdefs clearer). Notes: svn path=/head/; revision=354240
* Add support for hypervisor check on x86Simon J. Gerraty2019-10-241-0/+1
| | | | | | | | | | | | | | Add ficl words for isvirtualized and move ficl inb and outb words to ficl/x86/sysdep.c so can be shared by i386 and amd64 Reviewed by: imp bdrewery MFC after: 1 week Sponsored by: Juniper Networks Differential Revision: https://reviews.freebsd.org/D22069 Notes: svn path=/head/; revision=354043
* loader: fix indentation in efi_console and vidconsoleToomas Soome2019-09-251-1/+1
| | | | | | | | | Remove extra tab. Reported by: yuripv Notes: svn path=/head/; revision=352670
* loader: add teken.fg_color and teken.bg_color variablesToomas Soome2019-09-251-4/+101
| | | | | | | | | | | | Add settable variables to control teken default color attributes. The supported colors are 0-7 or basic color names: black, red, green, brown, blue, magenta, cyan, white. The current implementation does add some duplication which will be addressed later. Notes: svn path=/head/; revision=352669
* loader: vidconsole should set LINES and COLUMNSToomas Soome2019-09-102-1/+6
| | | | | | | Set LINES and COLUMNS based on terminal dimensions. Notes: svn path=/head/; revision=352195
* loader: --gc-sections needs sections to work withToomas Soome2019-09-081-1/+1
| | | | | | | | | | --gc-sections is not really useful unless we generate sections with -ffunction-sections -fdata-sections While there, i386/loader would win from --gc-sections too. Notes: svn path=/head/; revision=352032