Commit Graph

2105 Commits

Author SHA1 Message Date
Olivier Certner 1ee8714950 libsa: smbios_probe(): Strictly obey specified entry point address
When such an address is known, do not search elsewhere, contrary to what
we are doing on non-EFI boot (see SMBIOS_START and SMBIOS_LENGTH).

Reviewed by:    markj
MFC after:      2 weeks
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D49291
2025-03-11 14:54:10 +01:00
Olivier Certner 9dad0ba286 libsa: smbios_detect(): Return the entry point address
In particular, this allows the caller to know whether the detection was
successful.

Reviewed by:    imp, markj
MFC after:      2 weeks
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D49290
2025-03-11 14:54:10 +01:00
Olivier Certner c340797e08 libsa: smbios: Allow to run smbios_probe() multiple times
This is in preparation for modifying the EFI loader to favor a v3 table
if present.

As an impact, caller smbios_match() has been changed so that it only
calls smbios_probe() with NULL (non-EFI discovery) once.

While here, expand the original XXXRP comment in smbios_match().

Reviewed by:    imp, markj
MFC after:      2 weeks
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D49289
2025-03-11 14:54:09 +01:00
Olivier Certner 7f005c6699 libsa: smbios: Use 64-bit entry point if table below 4GB on non-EFI boot
On amd64, boot blocks and the non-EFI loader are 32-bit compiled as
clients of BTX, so cannot access addresses beyond 4GB.  However, the
64-bit entry point may refer to a structure table below 4GB, which we
want to use if the BIOS does not provide a 32-bit entry point.  The
situation is similar for powerpc64.

Consequently, always compile-in support for the 64-bit entry point, but
ensure that it is not selected on 32-bit-compiled boot loaders if the
structure table it points to grows beyond 4GB (as it is then not
accessible).

PR:             284460
Reviewed by:    markj
MFC after:      2 weeks
Relnotes:       yes
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D49288
2025-03-11 14:54:09 +01:00
Olivier Certner 3f744fb8b2 libsa: smbios: Favor the v3 (64-bit) entry point on non-EFI boot
When both the 32-bit and 64-bit entry points are present, the SMBIOS
specification says that the 64-bit entry point always has at least all
the structures the 32-bit entry point refers.  In other words, the
32-bit entry point is provided for compatibility, so we assume the
64-bit one has more chances to be filled with adequate values.

Doing this also increases consistency with the kernel's smbios(4)
driver.

Reviewed by:    imp, markj
MFC after:      2 weeks
Relnotes:       yes
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D49287
2025-03-11 14:54:09 +01:00
Olivier Certner 64fc51a9cf libsa: smbios: Reject a 64-bit entry point with revision 0
According to the specification, such an entry point may have different
data in bytes at offsets 0x0c to 0x17 (included).  In such a case,
interpreting them as the Structure Table Maximum Size and Address fields
could have catastrophic consequences.

Reviewed by:    imp, markj
MFC after:      2 weeks
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D49286
2025-03-11 14:54:09 +01:00
Olivier Certner 7e61fc7640 libsa: smbios: Stop parsing on an End-of-Table structure
This structure exists since SMBIOS v2.2 and indicates that there are no
structures to be parsed beyond this point.  For backwards compatibility,
the standard recommends that system software ensures that this structure
covers the rest of the SMBIOS structure table area as reported by the
Structure Table Address, and the Structure Table Maximum Size (64-bit
entry point) or the Structure Table Length (32-bit entry point), which
makes existing parsers continue to work correctly as they usually ignore
unknown structure types.  However, this is not a requirement, so be
bullet proof and immediately stop parsing in this case.

Reviewed by:    imp, markj
MFC after:      2 weeks
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D49285
2025-03-11 14:54:09 +01:00
Olivier Certner d1f351fcb2 libsa: smbios: probe: BCD revision parsing is v2-only code; Expand comments
The code parsing the BCD revision is only meaningful on v2, so move it
away into the appropriate 'if' branch to ease reading (and to avoid
a useless test).

Expand comments.  In particular, make it clear that setting
'smbios.count' to '-1' removes the limit of the number of structures to
parse.

No functional change.

Reviewed by:    imp, markj
MFC after:      2 weeks
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D49284
2025-03-11 14:54:08 +01:00
Olivier Certner 3b2303ba3d libsa: smbios: Export the used entry point type to the kernel
Via the kenv 'smbios.entry_point_type'.

Reviewed by:    imp, markj
MFC after:      2 weeks
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D49283
2025-03-11 14:54:08 +01:00
Olivier Certner a39ab17c9a libsa: smbios: Make 'is_64bit_ep' a field of 'smbios'
No functional change.

Reviewed by:    imp, markj
MFC after:      2 weeks
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D49282
2025-03-11 14:54:08 +01:00
Olivier Certner 2aa0067548 libsa: smbios: Rename 64-bit entry point's guards
Rename HAS_SMBV3 to SMBIOS_64BIT_EP, as it will soon be externally
defined in some cases, and 'isv3' to 'is_64bit_ep'.  These are more
accurate names for what they actually control/indicate.

No functional change.

Reviewed by:    imp, markj
MFC after:      2 weeks
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D49281
2025-03-11 14:54:08 +01:00
Olivier Certner a609592ddc libsa: smbios: style(9): Entry point parsing comments
Move the comments so that lines stay of reasonable length.

Remove comments that state the obvious.

Reviewed by:    markj
MFC after:      2 weeks
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D49280
2025-03-11 14:54:07 +01:00
Olivier Certner 085c8bdec5 libsa: smbios: style(9): SMBIOS_GET8(): Split overlong line
No functional change.

Reviewed by:    markj
MFC after:      2 weeks
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D49279
2025-03-11 14:54:02 +01:00
Toomas Soome e7c0cb7208 loader: dosfs should be able to work with different sector sizes
The current dosfs is only able to use 512B sector sizes, add
support for 4kn disks (incidentally this should also add support
for 1024B and 2048B sectors, have not tested those).

Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D49078
2025-03-03 23:54:23 +02:00
Toomas Soome ccf7b62bd8 loader: allow fs modules to use ioctl()
Currently only directly opened disk device is allowed to access
ioctl() - that is, when file has F_RAW flag set.

The problem is, file systems might need to determine the device parameters,
and we could use already opened device descriptor to communicate this
information.

Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D49077
2025-03-03 23:52:55 +02:00
Mitchell Horne 04a812ae94 riscv/stand: pass boot hart in loader metadata
Use the RISCV_EFI_BOOT_PROTOCOL to fetch the boot hart ID, and
communicate this to the kernel via new metadata field
(MODINFOMD_BOOT_HART).

If the boot hart is not found this way, fall back to the (now
deprecated) device-tree method.

The assumption that a hart ID can be represented with a 32-bit unsigned
integer is unchanged in the kernel, but from the loader we pass the full
64-bit value. This ensures that this API won't need to change in the
future, should the wider value become necessary.

Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D48887
2025-03-03 12:12:15 -04:00
Mitchell Horne 62c0997d43 efiprot.h: add definitions for RISCV_EFI_BOOT_PROTOCOL
It seems like this file was vendored (sorta) originally, but we have not
kept it in sync with the original source, if it still exists. Follow the
precedent in commit acf82d2659, and just add the definition to the
bottom of the file, keeping its style conventions.

Defined here: https://github.com/riscv-non-isa/riscv-uefi

Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D48885
2025-03-03 12:12:15 -04:00
Mitchell Horne e2a08ac9ce riscv: enable EFI framebuffer
Pass framebuffer information from loader(8) to the kernel via the
MODINFOMD_EFI_FB metadata field.

Enable the vt_efifb driver. A small tweak is required to work around the
lack of VM_MEMATTR_WRITE_COMBINING on this platform; we use
VM_MEMATTR_UNCACHEABLE instead.

Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D48884
2025-03-03 12:12:15 -04:00
Jose Luis Duran 7d1d7f4230 stand: Fix brand positioning on framebuffer console
The drawer.lua script ignores the values in loader_brand_x and
loader_brand_y on framebuffer consoles, always positioning the brand at
(1, 1).

Allow it to be positioned by accepting the x and y values just like the
text version.  For example:

/boot/lua/gfx-nanobsd.lua:

    return {
    	brand = {
    		graphic = {
    			""
    		},
    		requires_color = true,
    		image = "/boot/images/freebsd-logo-rev.png"
    	}
    }

/boot/loader.conf.d/bootloader.conf:

    loader_logo="none"
    loader_brand="nanobsd"
    loader_brand_x="15"

PR:		255202
Reviewed by:	manu, imp
Approved by:	emaste (mentor)
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D49092
2025-02-24 14:36:10 +00:00
Toomas Soome 21b5b8b38b loader.efi: add "gop blt <on|off>" command
Some systems have very slow console output and it may be about either
wrong memory attributes are set or gop->Blt() implementation is bad.

We do not have good way to set memory attributes, but we can
choose which Blt() to use (or we can set "gop off" to fall back on
use of SimpleTextOutput protocol).

This update adds argument for "gop" command to switch gop->Blt() use.
Note, this update does not fix the problem, but allows us to try to
understand the possible cause.

PR:		254381
Reported by:	Michael Galassi

Reviewed by:	manu, imp
Differential Revision:	https://reviews.freebsd.org/D49073
2025-02-20 21:50:20 +02:00
Warner Losh 36f1db7a37 loader.conf: Document boot_verbose
And for the moment, point people to loader.efi(8) for all boot_*
variables.

Sponsored by: Netflix
MFC After: 1 week
2025-02-09 11:24:22 -07:00
Colin Percival 44a768e1a8 stand: Use SOURCE_DATE_EPOCH in newvers.sh
The newvers.sh script is used to generate vers.c for 10 programs (at
latest count on amd64): 4 EFI loaders, 3 x86 loaders, two userboots,
and one kboot.  When building without MK_REPRODUCIBLE_BUILD this
resulted in 10 different timestamps being compiled into various files.

If SOURCE_DATE_EPOCH is set, use that value rather than the current
date and time.

Reviewed by:	emaste, imp
Sponsored by:	Amazon
Differential Revision:	https://reviews.freebsd.org/D48803
2025-02-03 15:58:32 -08:00
Kirk McKusick aa90fbed15 Standardize the definition of a UFS dinode.
Each program that operates on UFS on-disk inodes defines its own
version of a dinode. They all (of necessity) define the same
layout but use different names. This change adds a definition of
a dinode (a union of a UFS1 on-disk inode and a UFS2 on-disk inode)
as well as a dinodep (a union of a pointer to a UFS1 on-disk inode
and a pointer to a UFS2 on-disk inode) in sys/ufs/ufs/dinode.h.
It then deletes the definitions of dinode and dinodep in all the
programs that operate on them and instead uses these standard
definitions.

No functional change intended.

MFC-after: 1 week
2025-01-27 17:39:45 -08:00
Alexander Ziaee 066ef2aec1 ports/filesystems: Fix fallout
A new filesystems category was created in the ports tree, with 142
filesystem related ports moved to there, some of them renamed.
Update all references in the src tree to the new locations.

PR:		283881
Fixes:		ports:6e2da9672f79f44 (filesystems: add new category)
MFC after:	1 month
Reviewed by:	fuz, mhorne, bapt
Accepted by:	mhorne (mentor)
Differential Revision:	https://reviews.freebsd.org/D48406
2025-01-27 15:03:10 -05:00
Ahmad Khalifa 86077f4fd1 stand: use globals for the kernel and module types
Reviewed by: imp, kib
Pull Request: https://github.com/freebsd/freebsd-src/pull/1394
2025-01-24 14:29:39 -07:00
Ahmad Khalifa c75ba31904 stand: file_loadraw: make 'type' a const char *
Reviewed by: imp, kib
Pull Request: https://github.com/freebsd/freebsd-src/pull/1394
2025-01-24 14:29:39 -07:00
Ahmad Khalifa 707136024f stand: remove unnecessary checks for "elfN kernel"
We never set the kernel type to either "elf64 kernel" nor "elf32
kernel".

Reviewed by: imp, kib
Pull Request: https://github.com/freebsd/freebsd-src/pull/1394
2025-01-24 14:25:52 -07:00
Andrew Turner d249bcb712 stand/efi: Limit where we load the arm64 kernel
When FEAT_LPA2 is implemented the hardware supports increasing the
physical address space from 48-bit to 52-bit.

As older kernels only support a 48-bit physical address space limit
where the kernel is loaded to this.

Reviewed by:	kib, markj
Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D46625
2025-01-24 12:09:28 +00:00
Andrew Turner 038457dde9 stand/efi: Add more pl011-like uarts
The Arm SBSA uarts are handled by the pl011 driver. Add them to the
list of pl011 uarts.

Reviewed by:	manu, imp
Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D48526
2025-01-23 17:26:25 +00:00
Andrew Turner 7eb3273a7b stand/efi: Use hex values to get the uart type
To keep the SPCR uart type to name map aligned always use the hex value
as an index in the types array.

Reviewed by:	manu, imp
Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D48525
2025-01-23 17:26:25 +00:00
Alexander Leidinger 2a44cccd40 Add option to clear caller-used registers on function return.
The WITH_ZEROREGS option for src.conf will zero caller-used register
contents just before returning from a function, ensuring that
temporary values are not leaked beyond the function boundary. This
means that register contents are less likely to be available for side
channel attacks and information exposures.

It reduces all except 1 of the simple "write-what-where" ROP gadgets in
/lib:
    grep "Gadget found" /tmp/before_lib* | wc -l
     197
    grep "Gadget found" /tmp/after_lib* | wc -l
       1
    grep "Gadget found" /tmp/after_lib*
    /tmp/after_libbsdxml.so.4.txt:  [+] Gadget found: 0x1b3f1 mov qword ptr [rdi], rcx ; pop rbp ; ret

To reproduce:
    for lib in *.so.*; do
        echo $lib:
        ROPgadget --ropchain --binary /tmp/be_mount.Sx87/lib/$lib | sed -n '/Step 1/,/Step 2/p' >! /tmp/before_$lib.txt
        ROPgadget --ropchain --binary $lib | sed -n '/Step 1/,/Step 2/p' >!  /tmp/after_$lib.txt
    done

Additionally, in some cases this reduces the number of all ROP gadgets
(quick check with /libs only):
libalias.so.7: reduction 10.000%
libavl.so.2: reduction 13.900%
libbsdxml.so.4: reduction 37.500%
libc.so.7: reduction 10.000%
libc++.so.1: reduction 14.800%
libcam.so.7: reduction 50.700%
libcap_netdb.so.1: reduction 5.800%
libcasper.so.1: reduction 14.600%
libcrypto.so.30: reduction 7.500%
libdtrace.so.2: reduction 3.900%
libelf.so.2: reduction 15.800%
libgcc_s.so.1: reduction 32.700%
libibverbs.so.1: reduction 5.300%
libicp.so.3: reduction 2.100%
libipt.so.0: reduction 28.200%
libirdma.so.1: reduction 1.600%
libkiconv.so.4: reduction 0%
libm.so.5: reduction 21.900%
libmd.so.6: reduction 0%
libmd.so.7: reduction 3.100%
libncursesw.so.9: reduction 11.200%
libnvpair.so.2: reduction 40.200%
libpcap.so.8: reduction 11.400%
libpjdlog.so.0: reduction 27.400%
libsbuf.so.6: reduction 2.900%
libspl.so.2: reduction 42.300%
libsys.so.7: reduction 2.700%
libthr.so.3: reduction 21.000%
libuutil.so.2: reduction 13.100%
libz.so.6: reduction 5.600%
libzpool.so.2: reduction 15.100%

In some cases it adds some ROP gadgets despite removing the simple ROP
gadgets:
lib80211.so.1: reduction -32.700%
libbe.so.1: reduction -22.300%
libbegemot.so.4: reduction -20.500%
libcap_dns.so.2: reduction -58.000%
libcap_fileargs.so.1: reduction -28.200%
libcap_grp.so.1: reduction -54.000%
libcap_net.so.1: reduction -28.800%
libcap_pwd.so.1: reduction -38.800%
libcap_sysctl.so.2: reduction -71.100%
libcap_syslog.so.1: reduction -15.000%
libcrypt.so.5: reduction -14.600%
libctf.so.2: reduction -.300%
libcxxrt.so.1: reduction -14.000%
libdevstat.so.7: reduction -1.600%
libedit.so.8: reduction -4.200%
libgeom.so.5: reduction -16.500%
libicp_rescue.so.3: reduction -2.300%
libipsec.so.4: reduction -31.800%
libjail.so.1: reduction -21.700%
libkvm.so.7: reduction -5.300%
libmlx5.so.1: reduction -6.300%
libmt.so.5: reduction -23.000%
libnv.so.1: reduction -.400%
librss.so.1: reduction -3.800%
librt.so.1: reduction -24.000%
libssp.so.0: reduction -21.100%
libstats.so.0: reduction -9.000%
libtinfow.so.9: reduction -3.500%
libtpool.so.2: reduction -36.500%
libufs.so.8: reduction -11.900%
libulog.so.0: reduction -67.400%
libumem.so.2: reduction -2.000%
libutil.so.9: reduction -7.200%
libxo.so.0: reduction -9.000%
libzdb.so.2: reduction -11.700%
libzfs_core.so.2: reduction -17.700%
libzfs.so.4: reduction -.300%
libzfsbootenv.so.1: reduction -26.900%
libzutil.so.2: reduction -5.600%

To reproduce:
    for lib in *.so.*; do
        echo -n $lib:
        before="$(ROPgadget --nosys --nojop --binary /tmp/be_mount.Sx87/lib/$lib | tail -n1 | cut -d : -f 2)"
        after="$(ROPgadget --nosys --nojop --binary $lib | tail -n1 | cut -d : -f 2)"
        echo " reduction" $(bc -S 3 -e "(1-${after}/${before})*100")%
    done >/tmp/reduction.txt

Most of the time the size difference is very small (<1% for >50% of the
files and >10% for only 2 files):
lib80211.so.1: size change .100%
libalias.so.7: size change 0%
libavl.so.2: size change 0%
libbe.so.1: size change .100%
libbegemot.so.4: size change .100%
libbsdxml.so.4: size change 0%
libc.so.7: size change 1.200%
libc++.so.1: size change 1.600%
libcam.so.7: size change 1.900%
libcap_dns.so.2: size change .100%
libcap_fileargs.so.1: size change .100%
libcap_grp.so.1: size change .100%
libcap_net.so.1: size change .100%
libcap_netdb.so.1: size change .100%
libcap_pwd.so.1: size change .100%
libcap_sysctl.so.2: size change .100%
libcap_syslog.so.1: size change .100%
libcasper.so.1: size change 0%
libcrypt.so.5: size change 3.900%
libcrypto.so.30: size change 1.400%
libctf.so.2: size change .100%
libcxxrt.so.1: size change .100%
libdevstat.so.7: size change 15.400%		exceptional
libdtrace.so.2: size change .600%
libedit.so.8: size change 1.800%
libelf.so.2: size change .100%
libgcc_s.so.1: size change 3.000%
libgeom.so.5: size change 0%
libibverbs.so.1: size change .100%
libicp_rescue.so.3: size change .100%
libicp.so.3: size change 1.500%
libipsec.so.4: size change .100%
libipt.so.0: size change 3.100%
libirdma.so.1: size change .100%
libjail.so.1: size change .100%
libkiconv.so.4: size change .100%
libkvm.so.7: size change .100%
libm.so.5: size change 1.700%
libmd.so.6: size change 0%
libmd.so.7: size change .100%
libmlx5.so.1: size change 0%
libmt.so.5: size change .100%
libncursesw.so.9: size change 1.900%
libnv.so.1: size change 4.300%
libnvpair.so.2: size change 4.300%
libpcap.so.8: size change 1.200%
libpjdlog.so.0: size change .100%
librss.so.1: size change .200%
librt.so.1: size change .100%
libsbuf.so.6: size change .100%
libspl.so.2: size change 0%
libssp.so.0: size change .100%
libstats.so.0: size change .100%
libsys.so.7: size change .100%
libthr.so.3: size change 2.400%
libtinfow.so.9: size change 1.600%
libtpool.so.2: size change .100%
libufs.so.8: size change .100%
libulog.so.0: size change .100%
libumem.so.2: size change 54.300%		exceptional
libutil.so.9: size change .100%
libuutil.so.2: size change .100%
libxo.so.0: size change .100%
libz.so.6: size change .100%
libzdb.so.2: size change .300%
libzfs_core.so.2: size change .100%
libzfs.so.4: size change 2.000%
libzfsbootenv.so.1: size change .100%
libzpool.so.2: size change 1.200%
libzutil.so.2: size change 0%
2025-01-22 19:33:23 +01:00
Yongbo Yao 2f35419fb2 stand/efihttp: Add device type check to efihttp_fs_open()
Ensure the open operation targets an HTTP device. Return EINVAL if
not, to prevent potential system crashes when used on other devices.

Differential Revision: https://reviews.freebsd.org/D48439
Reviewed by: dab, imp, vangyzen
Sponsored by: Dell Technologies
2025-01-19 11:00:26 -06:00
John Baldwin 40d7ba0877 stand/kshim: Replace devclass_equal with calls to strcmp
Reviewed by:	imp, markj, emaste
Differential Revision:	https://reviews.freebsd.org/D48412
2025-01-10 23:03:32 -05:00
John Baldwin f6f5aa8a2d stand/usb: Quiet warnings so this builds again
Reviewed by:	markj, emaste
Differential Revision:	https://reviews.freebsd.org/D48411
2025-01-10 23:03:32 -05:00
John Baldwin 8e4535ee58 stand/kshim: Implement bus_detach_children
While here, update bus_generic_detach to delete devices as in the
kernel.

Reviewed by:	imp, markj
Differential Revision:	https://reviews.freebsd.org/D48410
2025-01-10 23:03:32 -05:00
John Baldwin ee15875c01 stand/kshim: Update for devclass being removed from DRIVER_MODULE
The kshim code abused the devclass argument to DRIVER_MODULE in some
odd ways.  Instead, refactor the devclass handling to more closely
mirror what new-bus does in the kernel by having a linked list of
devclasses looked up by name and associate devices with a devclass.

Devices are now only associated with a module while probing and
attaching.

Reviewed by:	imp, markj
Differential Revision:	https://reviews.freebsd.org/D48409
2025-01-10 23:03:32 -05:00
John Baldwin 4378bd382e stand/kshim: Replace bus_generic_attach with bus_attach_children
Fixes:	18250ec6c0 Replace calls to bus_generic_attach with bus_attach_children
Differential Revision:	https://reviews.freebsd.org/D48404
2025-01-10 23:03:28 -05:00
Emmanuel Vadot ee233742a5 loader: Rework kernel menu section
With pkgbase we can have long kernel name, so create a new section
for the kernel name.
Do not show the "default" text, we already show the "1 of X" part at
the end of the line and the default kernel is always number 1 so it's a bit
redundant.

Differential Revision:	https://reviews.freebsd.org/D48354
Reviewed by:	imp, tsoome
Sponsored by:	Beckhoff Automation GmbH & Co. KG
2025-01-09 08:13:43 +01:00
Emmanuel Vadot 1b4e117131 loader: Fix orb position
Fix the orb position to be aligned with the menu

Differential Revision:	https://reviews.freebsd.org/D48353
Reviewed by:	imp, tsoome
Sponsored by:	Beckhoff Automation GmbH & Co. KG
2025-01-09 08:13:05 +01:00
Emmanuel Vadot a0f06dfb0d loader: Add a list of firmware name mapping
Since we started to ship raw firmware for iwm(4), users who loads
the driver from loader are having problems as loader don't know that
the firmwares are now raw files and not kernel modules anymore.
Start a list of default entry for iwm(4) firmwares name mapping so it will
still works when loaded from loader.

Differential Revision:	https://reviews.freebsd.org/D48211
Reviewed by:	bz, imp, kevans
Sponsored by: Beckhoff Automation GmbH & Co. KG
2025-01-06 08:34:02 +01:00
Kyle Evans 48b05b8fc2 loader: set boot_safe when safe mode is selected
This may be used to disable or limit functionality of some services
when safe mode is selected. The particular value of boot_safe should not
be considered significant, only its presence in the environment.

Reviewed by:	imp, tsoome
Differential Revision:	https://reviews.freebsd.org/D32172
2024-12-13 22:31:28 -06:00
Ahmad Khalifa 3f960a05ba loader: remove check for 2M alignment
Instead of listing every arch we support, always define
EFI_STAGING_2M_ALIGN to 1.

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1446
2024-12-04 17:19:18 -07:00
Ahmad Khalifa 5e8bd45ffb stand/elf64_freebsd.c: use headers instead of doing things ourselves
Try our best to use headers instead of doing things ourselves. With
i386's headers, there are some holes we need to fill manually.

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1446
2024-12-04 17:19:17 -07:00
Ahmad Khalifa ea0f267c8b stand/efi: move G(x) and M(x) macros to loader_efi.h
These are often needed for copying to the staging area or just general
page table calculations on amd64.

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1446
2024-12-04 17:19:17 -07:00
Ahmad Khalifa a2c48b865e stand: move 'staging' to loader_efi.h
On amd64, we need this to setup the page tables.

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1446
2024-12-04 17:19:17 -07:00
Ahmad Khalifa 35cb62e126 kboot/aarch64: remove redundant include
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1446
2024-12-04 17:19:17 -07:00
Ahmad Khalifa 66b9db032b stand: move efi's bi_load into loader_efi.h
For kboot, we still have to declare it manually since we don't always
include loader_efi.h

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1446
2024-12-04 17:19:17 -07:00
Ahmad Khalifa 9e239e67c4 stand: further restrict f_kernphys_relocatable and f_tg_kernel_support
f_tg_kernel_support isn't used by any EFI code, and
f_kernphys_relocatable isn't used by the non-EFI i386 code.

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1446
2024-12-04 17:19:17 -07:00
Warner Losh 780f289297 stand: drop inttypes.h from safe list
Nothing uses it anymore, so drop it from the 'safe' list. Also, move
stand/efi/loader/main.c to using machine/_inttypes.h which is all it
really needs.

Sponsored by:		Netflix
2024-11-20 12:49:48 -07:00
Warner Losh 17be774ee7 stand: unistd.h is no longer safe
unistd.h includes too much extra stuff for the boot loader. This creates
a fair amount of namespace pollution and it's best to just make it an
alias for stand.h like the other include files already are.

Sponsored by:		Netflix
2024-11-19 20:35:04 -07:00