aboutsummaryrefslogtreecommitdiff
path: root/stand/libofw
Commit message (Collapse)AuthorAgeFilesLines
* Remove residual blank line at start of MakefileWarner Losh2024-07-151-1/+0
| | | | | | | This is a residual of the $FreeBSD$ removal. MFC After: 3 days (though I'll just run the command on the branches) Sponsored by: Netflix
* loader: fix stupid typosWarner Losh2024-05-201-1/+1
| | | | Sponsored by: Netflix
* loader/ofw: Style(9) pass over return statementsWarner Losh2024-05-206-20/+20
| | | | | | | | Make these consistent. Some files weren't even consistent with themselves. Make them all either return <space> ( <value> ); or return; Sponsored by: Netflix
* ofw: Use C99 initializers for the console structWarner Losh2024-05-201-8/+7
| | | | Sponsored by: Netflix
* libsa: Remove redundant sys/cdefs.hWarner Losh2024-02-227-7/+0
| | | | Sponsored by: Netflix
* loader/libofw: Fix disk size truncationJustin Hibbits2024-02-211-1/+1
| | | | | | | At present OF_ioctl first multiplies, then casts to 64-bit, meaning at the asm level it truncates the result to 32-bit, then zero-extends it to 64-bit to return. Cast `n` to 64-bit before multiplying, so that the correct result is returned.
* stand: Use modern function definitionsWarner Losh2024-01-282-6/+6
| | | | | | Use modern function definitions for functions with no args. Sponsored by: Netflix
* stand: Automated cleanup of cdefs and other formattingWarner Losh2023-11-274-4/+0
| | | | | | | | | | | | | | | | Apply the following automated changes to try to eliminate no-longer-needed sys/cdefs.h includes as well as now-empty blank lines in a row. Remove /^#if.*\n#endif.*\n#include\s+<sys/cdefs.h>.*\n/ Remove /\n+#include\s+<sys/cdefs.h>.*\n+#if.*\n#endif.*\n+/ Remove /\n+#if.*\n#endif.*\n+/ Remove /^#if.*\n#endif.*\n/ Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/types.h>/ Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/param.h>/ Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/capsicum.h>/ Sponsored by: Netflix
* Remove $FreeBSD$: one-line sh patternWarner Losh2023-08-161-1/+0
| | | | Remove /^\s*#[#!]?\s*\$FreeBSD\$.*$\n/
* Remove $FreeBSD$: one-line .c patternWarner Losh2023-08-1610-20/+0
| | | | Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/
* Remove $FreeBSD$: two-line .h patternWarner Losh2023-08-162-4/+0
| | | | Remove /^\s*\*\n \*\s+\$FreeBSD\$$\n/
* stand/ofw: dev can't be NULL hereWarner Losh2023-01-131-2/+1
| | | | | | | | | | | | dev can't be NULL here. ofw_common_parsedev is always called via devparse (indirectly through dv_parsedev() calls there which call it with the args unchanged). In the past, ofw_getdev could call us with NULL pointer for the parse-only case, but that's now all handled inside of devparse for simplicity. Sponsored by: Netflix Reviewed by: kevans Differential Revision: https://reviews.freebsd.org/D38041
* stand: Create common gen_setcurrdev and replace codeWarner Losh2023-01-112-15/+0
| | | | | | | | | | 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: update prototypes for md_load and md_load64Warner Losh2022-12-051-4/+0
| | | | | | | | | | | These are declared as extern in a number of files (some with the wrong return type). Centralize this in modinfo.h and remove a few extra stray declarations as well that are no longer used. No functional change. Note: I've not tried to cope with the bi_load() functions which are the same logical thing. These will be handled separately. Sponsored by: Netflix
* stand/ofw: Refactor ofw parsedevWarner Losh2022-11-304-34/+27
| | | | | | | | | Both ofw_disk and ofw_net use the same parsedev routine, except for the string passed in to match the ofw device node's type. Create a routine to do that and connect these two users up to that. Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D37560
* stand/ofw: Use devparseWarner Losh2022-11-301-81/+12
| | | | | | | Retire the custom parsedev routine and use the standard devparse. Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D37559
* ofw/disk: Add parsedev supportWarner Losh2022-11-301-1/+36
| | | | | | | | | | Add a parsedev support for OpenFirmware disks. We must look at characteristics of the OFW node to know if we match this device (so supply a match routine) or not. Add a parsing routine to allocate devdesc for OpenFirmware disks as well. Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D37558
* stand/ofw: Subclass devnet to cope with ofw's unique needsWarner Losh2022-11-302-0/+76
| | | | | | | | | We need to match devices in a slightly special way: We have to look up the path and see if the device is a 'network' device in order to use it. Sponsored by: Netflix Tested by: grehan@ (with tweaks to my original patch) Differential Revision: https://reviews.freebsd.org/D37557
* stand/ofw: Add ofw_path_to_handleWarner Losh2022-11-302-0/+35
| | | | | | | | | ofw_path_to_handle converts a path string to a phandle_t. It searches down the path for the first device whose type matches the passed-in string. Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D37556
* stand: Implement ofw disk print routineWarner Losh2022-11-301-0/+24
| | | | | | | Have lsdev show openfirmware devices. Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D37555
* 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/ofw: ofw_disk isn't really a diskWarner Losh2022-11-302-3/+13
| | | | | | | | | | | | | | The rest of the code in the tree assumes that a DEVT_DISK uses a disk_devdesc to represent the device. However ofw_disk diesn't, so we can't use disk_fmtdev, nor disk_parsedev. ofw needs to have a dv_match-like routine to use devpasrse, though, since we have two drivers (net and block) that claim the same sort of devices (eg /path/to/ofw-dev) based on the device-type property. In the interim, we can't use devmatch and ofw_disk's and the default net driver's parsing is offloaded ofw_parsedev. Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D37347
* zfs: Remove devicename_stubsWarner Losh2022-11-301-4/+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/ofw: Access the parsing routine more directlyWarner Losh2022-11-301-4/+4
| | | | | | | | | We don't need to check if something is a ZFS device. Instead, if the found device has a parse routine, call it. Otherwise, just copy the path. Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D37343
* 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-2/+2
| | | | | | | | | | | 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
* ofw_net: Use c99 initializersWarner Losh2022-11-291-11/+15
| | | | | | | | | Update to use c99 initializers, although there's no plans to change anything that this would make easier... Sponsored by: Netflix Reviewed by: zlei Differential Revision: https://reviews.freebsd.org/D37442
* stand/ofw: Use strpbrk instead of two strchrsWarner Losh2022-11-291-19/+16
| | | | | | | | No need to call strchr twice, when one call to strpbrk will do the job.. Test booted with qemu-powerpc + mac99 successfully. Minor style(9) tweaks as well. Sponsored by: Netflix
* ofw: Remove old K&R function declarationWarner Losh2022-11-271-2/+0
| | | | | | We don't need to forward declar strchr anymore. Sponsored by: Netflix
* ofw: Cast function pointer to proper typeWarner Losh2022-11-271-1/+2
| | | | | | | | | clang 15 insists that we call entry() via a function prototype. Rather than copping out and using (...), cast it to the same prototype that's used elsewhere (with tweaks to pointers to make them fit into that prototype). No functional change. Sponsored by: Netflix
* stand: Add disk_fmtdev for dv_fmtdev for all the disk devicesWarner Losh2022-08-111-1/+2
| | | | | | | | | | 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: Make sure nobody has a NULL pointer for dv_cleanupWarner Losh2022-07-271-0/+1
| | | | | | | | | | 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 ofw's block deviceWarner Losh2022-07-241-8/+8
| | | | | | Use c99 structure init for devsw. Sponsored by: Netflix
* powerpc64le: stand fixesLeandro Lupori2021-10-202-202/+149
| | | | | | | | | | | | | | | | | | | | | | Fix boot1 and loader on PowerPC64 little-endian (LE). Due to endian issues, boot1 couldn't find the UFS boot partition and loader wasn't able to load the kernel. Most of the issues happened because boot1 and loader were BE binaries trying to access LE UFS partitions and because loader expects the kernel ELF image to use the same endian as itself. To fix these issues, boot1 and loader are now built as LE binaries on PPC64LE. To support this, the functions that call OpenFirmware were enhanced to correctly perform endian conversion on its input and output arguments and to change the CPU into BE mode before making the calls, as OpenFirmware always runs in BE. Besides that, some other small fixes were needed. Submitted by: bdragon (initial version) Reviewed by: alfredo, jhibbits Sponsored by: Instituto de Pesquisas Eldorado (eldorado.org.br) Differential Revision: https://reviews.freebsd.org/D32160
* loader: implement mount/unmount rootfsToomas Soome2021-09-081-7/+7
| | | | | | | | | We want to keep our root file system open to preserve bcache segment between file accesses, thus reducing physical disk IO. Reviewed by: imp, allanjude, kevans (previous version) Differential Revision: https://reviews.freebsd.org/D30848 MFC after: 1 month
* Fix 64-bit build of libofw.Brandon Bergren2020-09-081-10/+10
| | | | | | | | | | | | | | Adjust a couple of printf() lines that deal with dumping out addresses to cast to uintmax_t. This allows building a 64-bit libofw for use in things like a future Petitboot loader for PowerPC64, and other FDT platforms that require a 64-bit loader binary and want to use forth. Sponsored by: Tag1 Consulting, Inc. Notes: svn path=/head/; revision=365483
* loader: libofw build is missing sys/list.h after r362431Toomas Soome2020-06-201-0/+1
| | | | | | | Add another include path Notes: svn path=/head/; revision=362433
* loader: fix libofw build after r362431Toomas Soome2020-06-201-1/+1
| | | | Notes: svn path=/head/; revision=362432
* Redo r360540 to retain the ifndef sparc code, not delete it.Warner Losh2020-05-011-4/+10
| | | | | | | | | Also undo the BROKEN stuff, since it was based on the same misreading. Noticed by: Jens Schweikhardt Notes: svn path=/head/; revision=360543
* Remove more stray sparc64 ifdefs.Warner Losh2020-05-011-18/+4
| | | | | | | | | Also, dmabuf appears to only be set for sparc64 case, but there was a comment at its only use that says it was broken for some apple adapters. #ifdef it all of that out now that nothing sets it. Notes: svn path=/head/; revision=360540
* veloader use vectx API for kernel and modulesSimon J. Gerraty2020-03-082-3/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Remove sparc64 support from the boot loader.Warner Losh2020-02-031-2/+0
| | | | | | | Remove all the sparc64 specific bits, both files and ifdefs. Notes: svn path=/head/; revision=357454
* 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
* Move stand/ofw/libofw to stand/libofw.Brandon Bergren2020-01-0213-0/+2225
Since rS330365, there has been no particular reason for libofw to be in a subdirectory of ofw. Move libofw up a level to make it fit in better with the other top level libraries. Also add a LIBOFWSRC to stand/defs.mk to match what all the other libraries are doing. Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D23000 Notes: svn path=/head/; revision=356266