aboutsummaryrefslogtreecommitdiff
path: root/sys/boot
Commit message (Collapse)AuthorAgeFilesLines
...
* Encapsulate ZFS preferences into efi_zfs_is_preferredWarner Losh2017-10-063-8/+15
| | | | | | | | | | | Move the retrieval of the image information into loader's main instead of doing it in efizfs.c Differential Revision: https://reviews.freebsd.org/D12564 Submitted by: Eric McCorkle Notes: svn path=/head/; revision=324360
* Add efi_devpath_is_prefixWarner Losh2017-10-062-0/+30
| | | | | | | | | | efi_devpath_is_prefix determines if a path matches a passed-in prefix. Differential Revision: https://reviews.freebsd.org/D12564 Submitted by: Eric McCorkle Notes: svn path=/head/; revision=324359
* This README file was quite relevant for FreeBSD 3 or 4. However, theWarner Losh2017-10-051-238/+0
| | | | | | | | | | | information in this file is now somewhat dated, or is present mostly correct in the man pages. Retire this file rather than fix it. Noticed by: cognet@ Sponsored by: Netflix Notes: svn path=/head/; revision=324321
* Allow Raspberry Pi platform and drivers to be configured with upstream DTBs.Ian Lepore2017-10-021-1/+1
| | | | | | | | | | | | | | | | | | | | | | - Added more compatibility strings to drivers not yet converted - Added new RPI platform code compatibility string to match the ones used upstream - Adapted RPI and RPI2 DTS to match the new platform code compatibility string The goal is to use the upstream DTBs as a replacement for our custom one. This is now possible with these changes. Additionally, as the RPI firmware automatically chooses the right DTB for us, this would allow to have one common armv6 kernel for RPI0 and RPI1 (BCM2835-based), and one common armv7 kernel for RPI2 v1.1 (BCM2836-based), and RPI2 v1.2 / RPI3 (BCM2837-based). Submitted by: Sylvain Garrigues <sylgar@gmail.com> Differential Revision: https://reviews.freebsd.org/D12360 Notes: svn path=/head/; revision=324184
* Compile loader as Little-Endian on PPC64/POWER8Wojciech Macek2017-09-291-1/+9
| | | | | | | | | | | | | | | | | Add flag to the makefile to allow loader compilation as Little-Endian 32-bit executable. Usage: make WITH_LOADER_FORCE_LE=yes -C sys/boot all Submitted by: Wojciech Macek <wma@freebsd.org> Reviewed by: imp, nwhitehorn Obtained from: Semihalf Sponsored by: QCM Technologies Differential revision: https://reviews.freebsd.org/D12421 Notes: svn path=/head/; revision=324099
* libefi: efipart_floppy() will should not pass acpi pointer if the HID test failsToomas Soome2017-09-251-2/+2
| | | | | | | The current efipart_floppy() implementation is leaking the acpi pointer. Notes: svn path=/head/; revision=323991
* After the r317886 support for TFTP and NFS can be enable simultaneously.Mariusz Zaborski2017-09-231-2/+2
| | | | | | | | | | The cleanup of this distinction was done in the r318988, but this Makefile was omitted. Submitted by: kczekirda@ Notes: svn path=/head/; revision=323952
* libefi: define EISA PNP constantsToomas Soome2017-09-221-3/+8
| | | | | | | Define EISA PNP constants and use them, also fix ID for 0x701 Notes: svn path=/head/; revision=323909
* libefi: efipart_hdinfo_add_filepath should check strtol resultToomas Soome2017-09-221-0/+7
| | | | | | | Use errno for error checking. Notes: svn path=/head/; revision=323908
* libefi: efipart.c cstyle fix for efipart_print_common()Toomas Soome2017-09-221-1/+2
| | | | | | | The else statement should have { } Notes: svn path=/head/; revision=323907
* libefi: efipart_strategy() should return ENXIO when there is no mediaToomas Soome2017-09-221-1/+1
| | | | | | | | We should return ENXIO to indicate the situation with device present, but no media. Notes: svn path=/head/; revision=323906
* libefi: pdinfo_t pd_unit and pd_open should be unsignedToomas Soome2017-09-222-3/+3
| | | | | | | | | | The device index, partition index and reference counter are all positive numbers. However, since our internal partition number may be negative to indicate GPT table, the compare expression need to take care when comparing pdinfo_t and partition data. Notes: svn path=/head/; revision=323905
* efilib.h: typo in structure member descriptionToomas Soome2017-09-221-1/+1
| | | | | | | The link should be replaced by list. Notes: svn path=/head/; revision=323897
* r323885 did miss efilib.h updateToomas Soome2017-09-221-1/+2
| | | | | | | The efilib.h update was left out from r323885 by mistake. Notes: svn path=/head/; revision=323896
* libefi: efi_devpath_match local len should be unsignedToomas Soome2017-09-221-2/+2
| | | | | | | DevicePathNodeLength() will always return unsigned value. Notes: svn path=/head/; revision=323895
* libefi: efipart.c should use calloc()Toomas Soome2017-09-211-10/+5
| | | | | | | | The device specific *_add functions are using malloc() + memset, should use calloc instead. Notes: svn path=/head/; revision=323886
* libefi: efi_devpath_match() should return boolToomas Soome2017-09-212-9/+9
| | | | | | | | The current implementation of efi_devpath_match() is returning values 0 or 1, so it should be updated to return bool. Notes: svn path=/head/; revision=323885
* libefi: devicename.c cleanupsToomas Soome2017-09-211-16/+20
| | | | | | | | Remove duplicated free()+return statements, default unit to 0 and improve strtol error processing. Notes: svn path=/head/; revision=323867
* loader: biosmem allocate heap just below 4GBToomas Soome2017-09-181-5/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The current biosmem code is walking bios smap entries and looking for smap entry just below 4GB line, if there is such entry, its base and size is set for heap base and size. Instead of entry base, we should use last HEAP_MIN (currently 64MB) bytes just below 4GB, to make maximum space for kernel and modules. The problem was revealed on ASUS B350M-A system board, an AMD Ryzen 3 1200 CPU memory map: SMAP type=01 base=0000000000000000 len=000000000009d400 attr=01 SMAP type=02 base=000000000009d400 len=0000000000002c00 attr=01 SMAP type=02 base=00000000000e0000 len=0000000000020000 attr=01 SMAP type=01 base=0000000000100000 len=0000000009c00000 attr=01 SMAP type=02 base=0000000009d00000 len=0000000000300000 attr=01 SMAP type=01 base=000000000a000000 len=00000000be69b000 attr=01 SMAP type=03 base=00000000c869b000 len=0000000000016000 attr=01 SMAP type=01 base=00000000c86b1000 len=00000000124e7000 attr=01 SMAP type=02 base=00000000dab98000 len=0000000000138000 attr=01 SMAP type=03 base=00000000dacd0000 len=0000000000008000 attr=01 SMAP type=01 base=00000000dacd8000 len=0000000000100000 attr=01 SMAP type=04 base=00000000dadd8000 len=00000000003b3000 attr=01 SMAP type=02 base=00000000db18b000 len=0000000000d42000 attr=01 SMAP type=01 base=00000000dbecd000 len=0000000002133000 attr=01 SMAP type=01 base=0000000100000000 len=000000011f380000 attr=01 SMAP type=02 base=00000000de000000 len=0000000002000000 attr=01 SMAP type=02 base=00000000f8000000 len=0000000004000000 attr=01 SMAP type=02 base=00000000fdf00000 len=0000000000100000 attr=01 SMAP type=02 base=00000000fea00000 len=0000000000010000 attr=01 SMAP type=02 base=00000000feb80000 len=0000000000082000 attr=01 SMAP type=02 base=00000000fec10000 len=0000000000001000 attr=01 SMAP type=02 base=00000000fec30000 len=0000000000001000 attr=01 SMAP type=02 base=00000000fed00000 len=0000000000001000 attr=01 SMAP type=02 base=00000000fed40000 len=0000000000005000 attr=01 SMAP type=02 base=00000000fed80000 len=0000000000010000 attr=01 SMAP type=02 base=00000000fedc2000 len=000000000000e000 attr=01 SMAP type=02 base=00000000fedd4000 len=0000000000002000 attr=01 SMAP type=02 base=00000000fee00000 len=0000000000100000 attr=01 SMAP type=02 base=00000000ff000000 len=0000000001000000 attr=01 Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D12368 Notes: svn path=/head/; revision=323707
* loader: biosmem.c cstyle cleanupToomas Soome2017-09-141-121/+128
| | | | | | | | | | No functional changes, just cleanup. Reviewed by: allanjude, imp Differential Revision: https://reviews.freebsd.org/D12370 Notes: svn path=/head/; revision=323589
* Increase EFI boot file size frok 128k to 384kAllan Jude2017-09-1311-116/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | generate_fat.sh does the following: - create an 800kb zero-filled file - create an md device backed by this file - format the device fat12 - mount the filesystem - create the EFI ESP directory structure - create the EFI boot file (BOOTx64 for amd64, BOOTaa64 for aarch64, etc) - Adds a marker to the beginning of the file, and pad it to 384kb - 384kb was chosen as it is less than half of 800kb, thus allowing users to keep a backup of their older boot file in the small partition - Unmount the filesystem - Scan the image and find the offset where the marker was inserted - The process requires root, to make image generation easier, images for each architecture are pregenerated, compressed with xz, and checked into svn. The Makefile that generates boot1.efifat does the following: - Ensure the compiled boot1.efi file is no larger than the generated image - Decompress the template created by generate-fat.sh - dd the contents of boot1.efi into boot1.efifat starting at the offset where the marker is found. This allows any file less than the maximum size to be written into the fat filesystem without having to mount it, so no root privileges are required. Later work by imp and myself makes bsdinstall create a 200mb fat16 instead of using this process, but it is retained to make image generation easier. Submitted by: Eric McCorkle (original version) Reviewed by: emaste, tsoome, Eric McCorkle MFC after: 1 month Differential Revision: https://reviews.freebsd.org/D9680 Notes: svn path=/head/; revision=323554
* libefi: efipart_realstrategy rsize pointer may be NULLToomas Soome2017-09-131-1/+2
| | | | | | | Need to check rsize before dereferencing it. Notes: svn path=/head/; revision=323541
* libefi: efipart_open should check the status from disk_openToomas Soome2017-09-121-2/+13
| | | | | | | | | | In case of error from disk_open(), we should clean up properly. Reviewed by: allanjude, imp Differential Revision: https://reviews.freebsd.org/D12340 Notes: svn path=/head/; revision=323497
* loader should support large_dnodeToomas Soome2017-09-121-3/+4
| | | | | | | | | | The zfsonlinux feature large_dnode is not yet supported by the loader. Reviewed by: avg, allanjude Differential Revision: https://reviews.freebsd.org/D12288 Notes: svn path=/head/; revision=323494
* boot1: remove BOOT1_MAXSIZE default valueEd Maste2017-09-111-1/+0
| | | | | | | | | | | | This Makefile relies on Makefile.fat providing the correct value for BOOT1_MAXSIZE and BOOT1_OFFSET. Since BOOT1_OFFSET had no default value here the build would already fail if Makefile.fat did not provide correct values. Sponsored by: The FreeBSD Foundation Notes: svn path=/head/; revision=323436
* r323389 breaks the kernel build when WITHOUT_ZFS is defined in src.confToomas Soome2017-09-111-0/+4
| | | | | | | | | | Need to add #ifdef EFI_ZFS_BOOT guard into efi/loader/main.c PR: 222215 Reported by: Sylvain Garrigues Notes: svn path=/head/; revision=323428
* boot1 generate-fat: generate all templates at onceEd Maste2017-09-111-45/+48
| | | | | | | | | | | | | | | | | | | | | | | | | In advance of other changes to the fat template generation process, have generate-fat.sh create all template files at the same time so that they cannot get out of sync. Also correct a longstanding but where BOOT1_OFFSET was overwritten on each invocation. A previous version of this patch stored a per-arch offset (e.g. BOOT1_arm64_OFFSET) but that was deemed unnecessary. Instead just hardcode the known offset that applies to all archs (0x2d) and fail if the offset happens to be different. Ongiong work (using newfs_msdos in bsdinstall and adding msdosfs support to makefs) will eventually allow us to do away with this fat template hack altogether, but in the near term we have a few improvements that will build on this. Reviewed by: allanjude, imp, Eric McCorkle MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D10931 Notes: svn path=/head/; revision=323407
* loader.efi: chain loader should provide proper device handleToomas Soome2017-09-105-47/+77
| | | | | | | | | | | | Since the efipart rewrite, the chain command was looking for device handle using interface applicable only for net devices. Disk partitions and zfs pools need their own approach to find the proper handle. Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D12287 Notes: svn path=/head/; revision=323389
* It's been pointed out that init_script at least is useful w/oWarner Losh2017-09-091-6/+2
| | | | | | | | re-rooting. Remove deprecation notice for it. init_chroot likely is still better served with reroot. Notes: svn path=/head/; revision=323379
* Mark init_chroot and init_script variables as deprecated.Warner Losh2017-09-091-0/+14
| | | | Notes: svn path=/head/; revision=323367
* Be consistent and do return (1);Warner Losh2017-09-071-1/+1
| | | | | | | | Noticed by: tsoome@ Sponsored by: Netflix Notes: svn path=/head/; revision=323272
* Fix armv6 buildWarner Losh2017-09-071-0/+7
| | | | | | | | | | | We need to extend the -Wno-format hack to yet another Makefile to cope with %S meaning (CHAR16 *) not (wchar_t *) in the context of the EFI boot loaders. Sponsored by: Netflix Notes: svn path=/head/; revision=323261
* ucs2lenWarner Losh2017-09-073-12/+13
| | | | | | | | | | | | | Rename boot1's wcslen to ucs2len, which we can't use in userland because wchar in userland is unsigned, not short. Move it into efichar.c. Also spell '* 2' as '* sizeof(efi_char)' and add 1 for the trailing NUL to transition the FreeBSD boot env vars to being NUL terminated on the same line... Sponsored by: Netflix Notes: svn path=/head/; revision=323258
* Add smn(4) driver for AMD System Management NetworkConrad Meyer2017-09-051-0/+1
| | | | | | | | | | | | | AMD Family 17h CPUs have an internal network used to communicate between the host CPU and the PSP and SMU coprocessors. It exposes a simple 32-bit register space. Reviewed by: avg (no +1), mjoras, truckman Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D12217 Notes: svn path=/head/; revision=323184
* Fix loader bug causing too many pages allocation when bootloader is U-BootMarcin Wojtas2017-09-051-0/+7
| | | | | | | | | | | | | | | | | | | | | FreeBSD loader expects to have mmsz variable set by bootloader. U-Boot behaviour is that if buffer size is not big enough to keep whole memory map, assign the smallest correct buffer size to sz and return error. In other words U-Boot assumes that nobody will need mmsz value when buffer is not filled with memory map, which is not true, so calculated pages value was too big to allocate. Solution: Simply assign default value to mmsz. Submitted by: Patryk Duda <pdk@semihalf.com> Obtained from: Semihalf Sponsored by: Semihalf Differential Revision: https://reviews.freebsd.org/D12194 Notes: svn path=/head/; revision=323174
* Revert r322941: Eliminate redundant device matching functionsWarner Losh2017-09-021-1/+48
| | | | | | | | | | | Turns out, they are subtly different. I'll refactor anew in the future if it's worth it then. Sponsored by: Netflix Reported by: Tomoaki AOKI-san Notes: svn path=/head/; revision=323131
* Save where we're booted fromWarner Losh2017-08-312-1/+34
| | | | | | | | | | | | | | | | Record the file path for boot1.efi as the UEFI environemnt variable FreeBSDBootVarGUID:Boot1Path. Record the device this came from as FreeBSDBootVarGUID:Boot1Dev. While later stages of the boot may be able to guess these values by retrieving UEFIGlobal:BootCurrent and groveling through the correct UEFIGlobal:BootXXXX, this provides certanty in the face of behavior from any part of the boot loader chain that might "guess" what to do next. These env variables are volatile and will disappear on reboot. Sponsored by: Netflix Notes: svn path=/head/; revision=323065
* Exit rather than panic for most errors.Warner Losh2017-08-311-24/+26
| | | | | | | | | | | | | | | | In the FreeBSD UEFI boot protocol, boot1.efi exits back to UEFI if it can't boot the image for most reasons (so that further items in the EFI boot manger list can be tried). Rename panic to efi_panic, make it static and give it an extra status argument. Exit back to UEFI with that status argument so the next loader can be tried. Use malloc/free exclusively instead of mixing malloc/free and AllocatePool/FreePool. The code is smaller. Sponsored by: Netflix Notes: svn path=/head/; revision=323064
* boot1.efi: print more info about where boot1.efi is loaded fromWarner Losh2017-08-311-18/+22
| | | | | | | | | | | Print the device that boot1.efi was loaded from. Print the path as well (since it isn't included in DeviceHandle). Move block where we do this earlier so all the block handle code is now together. Sponsored by: Netflix Notes: svn path=/head/; revision=323063
* Make efichar.c routines available to libefi.Warner Losh2017-08-312-1/+7
| | | | | | | | | Make efichar.c routines available to libefi as well as libefivar. Define LIBEFI when building so we can conditionally include stand.h vs the normal userland stuff. Notes: svn path=/head/; revision=323062
* Eliminate redunant device path matching.Warner Losh2017-08-271-48/+1
| | | | | | | | | | | Use efi_devpath_match instead of device_paths_match. They are functionally the same. Remove device_paths_match from boot1.c and call efi_devpath_match instead. Sponsored by: Netflix Notes: svn path=/head/; revision=322941
* Use efi_devpath_str for debug path info.Warner Losh2017-08-264-184/+29
| | | | | | | | | | | | | | | | | | | | | | | Kill our own hand-rolled (and somewhat flawed) devpath_str in favor of the recently added efi_devpath_str in libefi. This gives us much better names at the expense of not being able to debug on EFI 1.2 machines (since the UEFI protocol efi_devpath_str depends on was added in UEFI 2.0). However, this isn't the first thing that requires newer than EFI 1.2, so it's quite possible that this doesn't change the universe of machines we can EFI boot from. This will now give us the full UEFI path, even for devices we don't yet know about. More importantly, it gives us the full HD(...) part of the path, which is sufficient by itself to locate disks that follow the rules (dd one disk (but not partition) to another still needs the rest of the path to disambiguate, but that isn't following the rules that require every GPT table to have globally unique GUIDs for every partion). This also has the side effect of shrinking boot1.efi by ~3k. Sponsored by: Netflix Notes: svn path=/head/; revision=322939
* Link in libefi for boot1Warner Losh2017-08-264-13/+8
| | | | | | | | | | | Add libefi to the list of libraries we'll link in. Move EFI table definitions back to libefi so we don't have drift between the two efi_main routines. Sponsored by: Netflix Notes: svn path=/head/; revision=322938
* Forward declare struct dsk to avoid warnings when building libi386.Warner Losh2017-08-261-0/+2
| | | | | | | Sponsored by: Netflix Notes: svn path=/head/; revision=322937
* Remove useless 'static' for an enum definition.Warner Losh2017-08-261-1/+1
| | | | | | | Sponsored by: Netflix Notes: svn path=/head/; revision=322936
* Fix warnings due to type mismatch.Warner Losh2017-08-261-3/+3
| | | | | | | | | | | | Cast ctxp to caddr_t to pass data as expected. While void * is a universal type, char * isn't (and that's what caddr_t is defined as). One could argue these prototypes should take void * rather than caddr_t, but changing that is much more invasive. Sponsored by: Netflix Notes: svn path=/head/; revision=322935
* _STAND is sometimes defined on the command line. Make the define here match.Warner Losh2017-08-261-1/+1
| | | | | | | Sponsored by: Netflix Notes: svn path=/head/; revision=322934
* No need for MK_ZFS around these: they are by their nature only activeWarner Losh2017-08-261-2/+0
| | | | | | | | | when MK_ZFS is true. Sponsored by: Netflix Notes: svn path=/head/; revision=322933
* Use the loader.efi conventions for the various EFI tables.Warner Losh2017-08-264-36/+35
| | | | | | | Sponsored by: Netflix Notes: svn path=/head/; revision=322932
* Cleanup efi_main return typeWarner Losh2017-08-264-7/+6
| | | | | | | | | | Make the return type of efi_main uniform. Declare the Exit() function as not returning. Move efi_main's declaration to the proper header. Sponsored by: Netflix Notes: svn path=/head/; revision=322931