aboutsummaryrefslogtreecommitdiff
path: root/stand/powerpc
Commit message (Collapse)AuthorAgeFilesLines
* Disable PIE for powerpc bootloaders.Marcin Wojtas2021-02-244-0/+8
| | | | | | | | | | | | | Bootloaders for powerpc are not built as position independent code. Since bsd.prog.mk is used for building, when PIE is enabled, the PIE flags are added and that causes the build to fail. Adding MK_PIE=no stops bsd.prog.mk from adding PIE specific flags. Submitted by: Dawid Gorecki <dgr@semihalf.com> Reviewed by: emaste Obtained from: Semihalf Sponsored by: Stormshield Differential Revision: https://reviews.freebsd.org/D28893
* loader: fix powerpc build with gfx_fbToomas Soome2021-01-044-2/+164
| | | | Need to add stub data and gfx functions to make linking happy.
* Add CFI start/end proc directives to arm64, i386, and ppcConrad Meyer2020-12-052-0/+14
| | | | | | | | | | | | | | Follow-up to r353959 and r368070: do the same for other architectures. arm32 already seems to use its own .fnstart/.fnend directives, which appear to be ARM-specific variants of the same thing. Likewise, MIPS uses .frame directives. Reviewed by: arichardson Differential Revision: https://reviews.freebsd.org/D27387 Notes: svn path=/head/; revision=368354
* stand/ficl 64-bit compatibilityBrandon Bergren2020-09-141-1/+1
| | | | | | | | | | | | | | | | | | | Currently, the only thing that prevents a functioning 64-bit FICL build is a few integer types that were intended to be fixed-width. Changing them to C99 integer types allows building a functioning 64-bit FICL. While this isn't applicable to the default settings of any in-tree loaders, it is necessary for a future Petitboot loader, due to the requirement that it be compiled as a 64-bit program. Reviewed by: tsoome, imp (earlier revision) Sponsored by: Tag1 Consulting, Inc. Differential Revision: https://reviews.freebsd.org/D26364 Notes: svn path=/head/; revision=365724
* [PowerPC] Set fixed boot1.elf load addressBrandon Bergren2020-05-011-1/+14
| | | | | | | | | | | | | | | | | | | Due to the way claiming works, we need to ensure on AIM OFW machines that we don't have overlapping ranges on any step of the load. Load boot1.elf at 0x38000 so it will not overlap with anything even if the entire PReP partition gets loaded by OFW. Tested on an iBook G4, a PowerBook G4, a PowerMac G5, and qemu pseries. (qemu pseries is broken without this patch due to the high address used by lld10.) Reviewed by: adalava Sponsored by: Tag1 Consulting, Inc. Differential Revision: https://reviews.freebsd.org/D24623 Notes: svn path=/head/; revision=360537
* Add support to MSDOS FS in PPC loaderLeandro Lupori2020-04-071-0/+3
| | | | | | | | | | | | | | | Although PPC OFW loader already had a LOADER_MSDOS_SUPPORT option, a few lines were missing in conf.c, in order to support FAT filesystems. This is useful when running FreeBSD under QEMU, to be able to easily change the kernel and modules when running on hosts without UFS read/write support. Reviewed by: jhibbits Sponsored by: Eldorado Research Institute (eldorado.org.br) Differential Revision: https://reviews.freebsd.org/D24328 Notes: svn path=/head/; revision=359716
* stand: -fno-common fixes for !x86 loadersKyle Evans2020-04-071-2/+2
| | | | | | | | | | | | | | | - beriloader: archsw is declared extern and defined elsewhere - ofwloader: ofw_elf{,64} are defined in elf_freebsd.c and ppc64_elf_freebsd.c respectively - ubldr: syscall_ptr is defined in start.S for whichever ubldr platform is building -fno-common will become the default in GCC10/LLVM11. MFC after: 3 days Notes: svn path=/head/; revision=359688
* [PPC] Fix loader call to instantiate-rtasLeandro Lupori2020-04-071-1/+1
| | | | | | | | | | | | | | OpenFirmware (OF) method instantiate-rtas was being called with a wrong rtas-base-address argument. It must use the memory that is already being allocated to this end instead. This issue was causing QEMU netboot to hang when building the FDT from OF DT. Reviewed by: jhibbits Sponsored by: Eldorado Research Institute (eldorado.org.br) Differential Revision: https://reviews.freebsd.org/D24313 Notes: svn path=/head/; revision=359687
* veloader use vectx API for kernel and modulesSimon J. Gerraty2020-03-081-4/+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
* [PowerPC] Fix LLD10 linking of ofw loader on ppcBrandon Bergren2020-02-251-1/+5
| | | | | | | | | | | | | | | | | | | | | Before this change, LLD10 was creating several extra PT_LOAD sections, which OFW does not understand. Like we do for the kernel already, specify the program headers manually. Additionally, to work around a crash in our base ld.bfd, we need to actually assign something to the output section. LLD does not need this. One side effect of this change is the removal of the GNU_STACK header. This is more correct, since we are using a statically-allocated stack and RWX mappings across the board this early in boot. Reviewed by: jhibbits, Fangrui Song <i@maskray.me> Sponsored by: Tag1 Consulting, Inc. Differential Revision: https://reviews.freebsd.org/D23778 Notes: svn path=/head/; revision=358304
* [PowerPC] Fix 32-bit ubldr calling conventionBrandon Bergren2020-01-191-4/+9
| | | | | | | | | | | | | | | | | | | Due to the way u-boot for 32-bit powerpc is compiled, the interrupt code assumes that the GOT pointer (r30) on u-boot is always intact. When making syscalls to u-boot, ensure that we have restored r30 like we found it before we enable interrupts to prevent u-boot from crashing if a timer interrupt was pending. This fixes ubldr on e500 qemu (assuming you have recompiled qemu's u-boot with API support!) Reviewed by: jhibbits Sponsored by: Tag1 Consulting, Inc. Differential Revision: https://reviews.freebsd.org/D23258 Notes: svn path=/head/; revision=356878
* Move stand/ofw/libofw to stand/libofw.Brandon Bergren2020-01-021-2/+2
| | | | | | | | | | | | | | | 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
* powerpc: Use builtins for fls/flslJustin Hibbits2019-12-081-1/+0
| | | | | | | | | | | | | | Summary: There's no need to use the fallback fls() and flsl() libkern functions when the PowerISA includes instructions that already do the bulk of the work. Take advantage of this through the GCC builtins __builtin_clz() and __builtin_clzl(). Reviewed by: luporl Differential Revision: https://reviews.freebsd.org/D22340 Notes: svn path=/head/; revision=355521
* loader/powerpc64: Include generic PVR values in CAS architecture listJustin Hibbits2019-10-081-15/+21
| | | | | | | | | | Add generic PVR values for PowerISA 2.07 and 3.00. This allows booting pseries in QEMU with compatibilty mode enabled. Submitted by: Shawn Anastasio <shawn@anastas.io> Notes: svn path=/head/; revision=353297
* Revert r352557: powerpc/loader: Install ubldr without strippingKyle Evans2019-10-071-1/+0
| | | | | | | | | | | This was committed due to what was later diagnosed as an msdosfs bug preventing in-place strip. This bug was fixed in r352564, and we agreed to keep the workaround in for a bit to allow the driver fix a suitable amount of propagation time for folks building/installing powerpc/ubldr, seeing as how we were not in any hurry to revert. Notes: svn path=/head/; revision=353161
* loader/powerpc64: Fix HV check for CAS usageJustin Hibbits2019-10-071-1/+1
| | | | | | | | | | | Logic was backwards. The function returns true if it *is* running as a hypervisor, whereas we want to only call the CAS utility if we're running as a guest. Reported by: Shawn Anastasio <shawn@anastas.io> Notes: svn path=/head/; revision=353160
* powerpc/loader: Install ubldr without strippingJustin Hibbits2019-09-201-0/+1
| | | | | | | | | | | | | | | | | | | | | Summary: Install's strip capability, by way of strip(1), doesn't seem to work correctly on msdosfs, and instead ends up truncating the resulting binary to 0-length. As a workaround, don't strip ubldr(8). This fixes installworld on Book-E ubldr-based platforms, which prior to this would need to manually install ubldr separately after installworld, in order to have a functional ubldr. The same thing could be done on PowerNV platforms that use msdosfs /boot volumes, since loader and loader.kboot, etc, all get truncated to 0 on install. However, PowerNV does not use loader, instead loading from petitboot, so it's not really necessary at this time. Reviewed by: kevans Differential Revision: https://reviews.freebsd.org/D21725 Notes: svn path=/head/; revision=352557
* Move CAS check in powerpc64 ofw loader until after the PVR check.Brandon Bergren2019-09-011-4/+4
| | | | | | | | | | This unbreaks using the powerpc64 loader on a 32-bit processor. Approved by: jhibbits (mentor) Differential Revision: https://reviews.freebsd.org/D21297 Notes: svn path=/head/; revision=351669
* [PPC64] Implement CASLeandro Lupori2019-07-313-1/+251
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Guest PPC OSs running under a hypervisor may communicate the features they support, in order for the hypervisor to expose a virtualized machine in the way the client (guest OS) expects (see LoPAPR 1.1 - B.6.2.3). This is done by calling the "/ibm,client-architecture-support" (CAS) method, informing supported features in option vectors. Until now, FreeBSD wasn't using CAS, but instead relied on hypervisor/QEMU's defaults. The problem is that, without CAS, it is very inconvenient to run POWER9 VMs on a POWER9 host running with radix enabled. This happens because, in this case, the QEMU default is to present the guest OS a dual MMU (HPT/RPT), instead of presenting a regular HPT MMU, as FreeBSD expects, resulting in an early panic. The known workarounds required either changing the host to disable radix or passing a flag to QEMU to run in a POWER8 compatible mode. With CAS, FreeBSD is now able to communicate that it wants an HPT MMU, independent of the host setup, which now makes FreeBSD work on POWER9/pseries, with KVM enabled and without hugepages (support added in a previous commit). As CAS is invoked through OpenFirmware's call-method interface, it needs to be performed early, when OpenFirmware is still operational. Besides, now that FDT is the default way to inspect the device tree on PPC, OFW call-method feature will be unavailable by default, when control is passed to the kernel. Because of this, the call to CAS is being performed at the loader, instead of at the kernel. To avoid regressions with old platforms, this change uses CAS only on POWER8/POWER9. Reviewed by: jhibbits Differential Revision: https://reviews.freebsd.org/D20827 Notes: svn path=/head/; revision=350485
* stand: TARGET_ARCH is spelled MACHINE_ARCH in MakefilesJustin Hibbits2019-05-211-1/+1
| | | | | | | Reported by: imp Notes: svn path=/head/; revision=348040
* stand/powerpc: Only build loader.kboot for powerpc64Justin Hibbits2019-05-211-0/+3
| | | | | | | | | | | kboot is only made for powerpc64 systems, not 32-bit systems. This unbreaks the build for powerpcspe. Reported by: ngie Notes: svn path=/head/; revision=348028
* [PowerPC64] stand: fix build using clang 8 as compilerLeandro Lupori2019-05-205-5/+13
| | | | | | | | | | | | This change fixes "stand" build issues when using clang 8 as compiler. Submitted by: alfredo.junior_eldorado.org.br Reviewed by: jhibbits Differential Revision: https://reviews.freebsd.org/D20026 Notes: svn path=/head/; revision=348005
* stand: refactor overlay loading a little bitKyle Evans2019-04-112-0/+12
| | | | | | | | | | | | | | | | | | | | | It was pointed out that manually loading a .dtb to be used rather than relying on platform-specific method for loading .dtb will result in overlays not being applied. This was true because overlay loading was hacked into fdt_platform_load_dtb, rather than done in a way more independent from how the .dtb is loaded. Instead, push overlay loading (for now) out into an fdt_platform_load_overlays. This method easily allows ubldr to pull in any fdt_overlays specified in the ub env, and omits overlay-checking on platforms where they're not tested and/or not desired (e.g. powerpc). If we eventually stop caring about fdt_overlays from ubenv (if we ever cared), this method should get chopped out in favor of just calling fdt_load_dtb_overlays() directly. Reported by: Manuel Stühn (freebsdnewbie freenet de) Notes: svn path=/head/; revision=346132
* powerpc/boot: Move ubldr to /boot/uboot, and make this a separate filesystemJustin Hibbits2019-02-181-0/+1
| | | | | | | | | | | | Summary: Now that mpc85xx can boot via ubldr, move ubldr to a separate filesystem, mounted on /boot/uboot, so that a fresh install can boot correctly. Reviewed By: nwhitehorn Differential Revision: https://reviews.freebsd.org/D18709 Notes: svn path=/head/; revision=344242
* powerpc/ubldr: Teach powerpc's ubldr to boot 64-bit kernelsJustin Hibbits2018-12-103-1/+104
| | | | | | | | | | This is just a copy of powerpc/ofw's ppc64_elf_freebsd.c modified to fit ubldr's boot format. MFC after: 1 week Notes: svn path=/head/; revision=341780
* bootprog_info is generated in vers.c. Move it's definition toWarner Losh2018-06-142-3/+0
| | | | | | | | | bootstrap.h and remove all the redundant copies. Sponsored by: Netflix Notes: svn path=/head/; revision=335117
* Prefer uintXX_t to u_intXX_tWarner Losh2018-03-135-11/+11
| | | | | | | | | A foolish consistency is the hobgoblin of little minds, adored by little statesmen and philosophers and divines. With consistency a great soul has simply nothing to do. -- Ralph Waldo Emerson Notes: svn path=/head/; revision=330864
* Where we can, pass the kernel an FDT facsimile of the OF device tree ratherNathan Whitehorn2018-03-041-0/+21
| | | | | | | | | | | | | | | | than a pointer to Open Firmware by default. This eliminates a number of potentially unsafe calls to firmware from the kernel and provides better performance. This feature is meant to be expanded until it is on by default unconditionally and, ideally, we can then garbage-collect the nightmare pile of hacks required to call into Open Firmware from a live kernel. Reviewed by: jhibbits Notes: svn path=/head/; revision=330371
* Move "common" Open Firmware parts of the loader used only on PowerPC toNathan Whitehorn2018-03-035-5/+399
| | | | | | | | | | | the powerpc/ subdirectory. These have never used by SPARC and we have no other (and almost certainly will have no other) Open Firmware platforms. This makes the directory structure simpler and lets us avoid some cargo-cult MI patterns on code that is, and always was, architecture-specific. Notes: svn path=/head/; revision=330365
* stand: Fix build after r330249Kyle Evans2018-03-011-1/+1
| | | | | | | | One does not simply convert to SUBDIR.yes in stand without making everything else in the affected files SUBDIR.yes -- there are better ways to do this. Notes: svn path=/head/; revision=330250
* stand: Makefile SUBDIR cleanupKyle Evans2018-03-011-3/+1
| | | | | | | | | | Use SUBDIR.${MK_*} where appropriate. r330248 eliminated most of the offenders, sweep the rest under the rug. Differential Revision: https://reviews.freebsd.org/D14545 Notes: svn path=/head/; revision=330249
* Add NO_OBJ to those directories that don't make anything.Warner Losh2018-02-261-0/+2
| | | | | | | | | | | For directories that don't many anything, add NO_OBJ=t just before we include bsd.init.mk. This prevents them from creating an OBJ directory. In addition, prevent defs.mk from creating the machine related links in these cases. They aren't needed and break, at least on stable, the read-only src tree build. Notes: svn path=/head/; revision=330004
* Unify metadata load files for arm, mips, powerpc, sparc64Justin Hibbits2018-02-135-699/+3
| | | | | | | | | | | | Summary: All metadata.c files are very similar, with only trivial changes. Unify them into a single common file, with minor special-casing where needed. Reviewed By: imp Differential Revision: https://reviews.freebsd.org/D13978 Notes: svn path=/head/; revision=329190
* Fix regression introduced in r328806, preventing boot at least on allNathan Whitehorn2018-02-031-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | PowerPC Apple hardware, and likely all Open Firmware systems. The loader would allocate memory for its heap at whatever address Open Firmware gave it, which would in general be the lowest unallocated address, usually starting a page or two above 0. As the kernel is linked at 1 MB, and loader insists on running the kernel at its link address, any heap larger than 1 MB would overlap the kernel, causing loader memory allocations to corrupt the kernel and vice versa. Although r328806 made this problem much worse by increasing the heap size to 8 MB, causing 88% of the loader heap to overlap with the kernel, the problem has always existed. The old heap size was 1 MB and, unless that started exactly at zero, which would cause other problems, some number of pages of the loader heap still overlapped with the kernel. This patch solves the issue in two ways and cleans up some related code: - Moves the loader heap inside of the loader. This guarantees that the heap will be contiguous with the loader and simplifies the heap allocation code at no cost, since the heap lives in BSS. - Moves the loader, previously at 28 MB and dangerously close to the kernel it loads, a bit higher to 44 MB. This has the effect of breaking loader on non-embedded PPC machines with < 48 MB of RAM, but we did not support those anyway. The fundamental problem is that the way loader loads ELF files is incredibly fragile, but that can't be fixed without fundamental architectural changes. MFC after: 10 days Notes: svn path=/head/; revision=328835
* Invent new LDR_INTERP for the loader interpreter to use. Use this inWarner Losh2018-02-023-6/+6
| | | | | | | | | | preference to LIBFICL{,32}. LIBFICL{,32} are now always defined, but LDR_INTERP{,32} is defined empty when building w/o forth (aka the simple interpreter) and defined to LIBFICL{,32} when we are building forth. Notes: svn path=/head/; revision=328783
* Centralize several variables.Warner Losh2018-02-024-7/+0
| | | | | | | | | | MK_CTF, MK_SSP, MK_PROFILE, NO_PIC, and INTERNALLIB are always the same, so set them in defs.mk. MAN= is common, so set it here too. This removes a lot of boring repetition from the Makefiles that added almost no value. Notes: svn path=/head/; revision=328769
* loader: support for mixed-endianness ELF/loader and POWER8Wojciech Macek2018-01-298-43/+349
| | | | | | | | | | | | | | | On POWER8 with current petitpoot, the loader.kboot might be run as little-endian application. The FreeBSD kernel is always big-endian, so the load_elf_* routines must be aware of proper endianness of all fields. Submitted by: Wojciech Macek <wma@semihalf.com> Obtained from: Semihalf Sponsored by: IBM, QCM Technologies Differential revision: https://reviews.freebsd.org/D12422 Notes: svn path=/head/; revision=328536
* Tag unreachable places as such. I left the while (1); in place sinceWarner Losh2018-01-261-0/+1
| | | | | | | | | in this context we want to busy wait to stop. Suggested by: pfg@ Notes: svn path=/head/; revision=328449
* Make exit() never return until host_exit can be written.Warner Losh2018-01-261-1/+1
| | | | Notes: svn path=/head/; revision=328448
* Garbage-collect loader.ps3. It is currently disconnected from the build andNathan Whitehorn2017-12-3023-3510/+0
| | | | | | | | is superseded by either direct loading of the kernel by petitboot (soon to become the installer default) or loader.kboot. Notes: svn path=/head/; revision=327390
* Interact is always called with NULL. Simplify code a little byWarner Losh2017-12-192-2/+2
| | | | | | | | | | | | removing this argument, and expanding when rc is NULL. This effectively completes the back out of custom scripts for tftp booted loaders from r269153 that was started in r292344 with the new path tricks that obsoleted it. Submitted by: Netflix Notes: svn path=/head/; revision=326961
* Move loader help file definitions to being 100% inside of loader.mk.Warner Losh2017-12-184-6/+1
| | | | | | | | | | | | HELP_FILES is a loader only thing, so move it to loader.mk. Only generate the help file if HELP_FILES is defined. Adjust Makefiles to new convention. Fix a few cases where ${.CURDIR}/ was missing resulting in missing bits from the help files. Sponsored by: Netflix Notes: svn path=/head/; revision=326926
* Revert r326792, r326784, r326772, r326712Warner Losh2017-12-122-2/+2
| | | | | | | | | | Something subtle is creating problems for disk access on ubldr. Back it out unti that can be sorted out. Sponsored by: Netflix Notes: svn path=/head/; revision=326812
* Fix regression with lua importWarner Losh2017-12-112-2/+2
| | | | | | | | | | | | | | Don't print when we can't find a file. Copy it instead to the error buffer. Higher level routines determine if it's appropriate to print the error message. Also, remove dead code (labeled bogusly lost functionality) since we never used that functionality. Remove unused arg from interact() too. Sponsored by: Netflix Notes: svn path=/head/; revision=326772
* Provide a md_load64 prototype.Warner Losh2017-12-031-0/+2
| | | | | | | Sponsored by: Netflix Notes: svn path=/head/; revision=326493
* Cast void * pointer to char * so the arg matches the %s format.Warner Losh2017-12-031-1/+1
| | | | | | | Sponsored by: Netflix Notes: svn path=/head/; revision=326492
* Disconnet ps3 from the build. There's too many warnings to fix. Also,Warner Losh2017-12-031-3/+0
| | | | | | | | | | | | it's going to be removed soon anyway once the final lingering issues with kboot are resolved. Go ahead and disconnect it from the build a little early. Sponsored by: Netflix OK'd by: nathanw@ Notes: svn path=/head/; revision=326491
* Declare our strange brand of main().Warner Losh2017-12-031-0/+2
| | | | | | | Sponsored by: Netflix Notes: svn path=/head/; revision=326490
* Include machine/md_var to pick up __syncicache prototype.Warner Losh2017-12-031-2/+1
| | | | | | | Sponsored by: Netflix Notes: svn path=/head/; revision=326486
* Cleanup CFALGS usage hereWarner Losh2017-12-021-3/+1
| | | | | | | | | | | Only define the CFLAGS we need. SSP_CFLAGS is now defined globally, no need to define it here. Define -D_STANDALONE globally for src/stand builds. Sponsored by: Netflix Notes: svn path=/head/; revision=326442