aboutsummaryrefslogtreecommitdiff
path: root/stand/powerpc
diff options
context:
space:
mode:
authorWarner Losh <imp@FreeBSD.org>2021-12-15 04:09:53 +0000
committerWarner Losh <imp@FreeBSD.org>2021-12-15 04:09:53 +0000
commit9dc70af83e5992e543542adbf5a6edeb38f187f6 (patch)
tree2eda2dd772d217577c066bbae751b7a41f481df4 /stand/powerpc
parentaab8ed235a8efc646261fd664700654a4906c177 (diff)
downloadsrc-9dc70af83e5992e543542adbf5a6edeb38f187f6.tar.gz
src-9dc70af83e5992e543542adbf5a6edeb38f187f6.zip
stand/uboot: reorg
Build uboot ubldr and friends like we build efi binaries o move everything to be under stand/uboot o md code goes in arch/$ARCH o move everything over from the library - Had to rename console.c, disk.c and module.c due to conflicts o update version to 1.5 to reflect the new way of building This results in a more consistent build system and should represent no functional change, apart from powerpc version getting new help file. Also, moved to exlcuding uboot on powerpc64le by using BROKEN_OPTION instead of the incidental exclusion we had before due to Makefile reorgs. Sponsored by: Netflix Feedback by: stevek, jrtc27 Differential Revision: https://reviews.freebsd.org/D33362
Diffstat (limited to 'stand/powerpc')
-rw-r--r--stand/powerpc/Makefile4
-rw-r--r--stand/powerpc/uboot/Makefile36
-rw-r--r--stand/powerpc/uboot/conf.c114
-rw-r--r--stand/powerpc/uboot/ldscript.powerpc138
-rw-r--r--stand/powerpc/uboot/ppc64_elf_freebsd.c101
-rw-r--r--stand/powerpc/uboot/start.S100
-rw-r--r--stand/powerpc/uboot/version11
7 files changed, 0 insertions, 504 deletions
diff --git a/stand/powerpc/Makefile b/stand/powerpc/Makefile
index a16d3933ff7e..b5d11dd6cf57 100644
--- a/stand/powerpc/Makefile
+++ b/stand/powerpc/Makefile
@@ -6,10 +6,6 @@ NO_OBJ=t
SUBDIR.yes= boot1.chrp ofw
-.if "${MACHINE_ARCH}" != "powerpc64le"
-SUBDIR.${MK_FDT}+= uboot
-.endif
-
.if "${MACHINE_ARCH}" == "powerpc64"
SUBDIR.${MK_FDT}+= kboot
.endif
diff --git a/stand/powerpc/uboot/Makefile b/stand/powerpc/uboot/Makefile
deleted file mode 100644
index b0635104e454..000000000000
--- a/stand/powerpc/uboot/Makefile
+++ /dev/null
@@ -1,36 +0,0 @@
-# $FreeBSD$
-
-LOADER_UFS_SUPPORT?= yes
-LOADER_CD9660_SUPPORT?= no
-LOADER_EXT2FS_SUPPORT?= no
-LOADER_NET_SUPPORT?= yes
-LOADER_NFS_SUPPORT?= yes
-LOADER_TFTP_SUPPORT?= no
-LOADER_GZIP_SUPPORT?= no
-LOADER_BZIP2_SUPPORT?= no
-
-.include <bsd.init.mk>
-
-BINDIR= /boot/uboot
-PROG= ubldr
-NEWVERSWHAT= "U-Boot loader" ${MACHINE_ARCH}
-INSTALLFLAGS= -b
-
-# Architecture-specific loader code
-SRCS= start.S conf.c vers.c ppc64_elf_freebsd.c
-SRCS+= ucmpdi2.c
-
-# Always add MI sources
-.include "${BOOTSRC}/loader.mk"
-.PATH: ${SYSDIR}/libkern
-
-LDFLAGS= -nostdlib -static -T ${.CURDIR}/ldscript.powerpc
-
-.include "${BOOTSRC}/uboot.mk"
-
-DPADD= ${LDR_INTERP} ${LIBUBOOT} ${LIBFDT} ${LIBUBOOT_FDT} ${LIBSA}
-LDADD= ${LDR_INTERP} ${LIBUBOOT} ${LIBFDT} ${LIBUBOOT_FDT} ${LIBSA}
-
-MK_PIE= no
-
-.include <bsd.prog.mk>
diff --git a/stand/powerpc/uboot/conf.c b/stand/powerpc/uboot/conf.c
deleted file mode 100644
index 49658a47cbd4..000000000000
--- a/stand/powerpc/uboot/conf.c
+++ /dev/null
@@ -1,114 +0,0 @@
-/*-
- * Copyright (c) 1999 Michael Smith <msmith@freebsd.org>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include <stand.h>
-#include "bootstrap.h"
-#include "libuboot.h"
-
-#if defined(LOADER_NET_SUPPORT)
-#include "dev_net.h"
-#endif
-
-/* Make sure we have an explicit reference to exit so libsa's panic pulls in the MD exit */
-void (*exitfn)(int) = exit;
-
-/*
- * We could use linker sets for some or all of these, but
- * then we would have to control what ended up linked into
- * the bootstrap. So it's easier to conditionalise things
- * here.
- *
- * XXX rename these arrays to be consistent and less namespace-hostile
- */
-
-/* Exported for libstand */
-struct devsw *devsw[] = {
-#if defined(LOADER_DISK_SUPPORT) || defined(LOADER_CD9660_SUPPORT)
- &uboot_storage,
-#endif
-#if defined(LOADER_NET_SUPPORT)
- &netdev,
-#endif
- NULL
-};
-
-struct fs_ops *file_system[] = {
-#if defined(LOADER_UFS_SUPPORT)
- &ufs_fsops,
-#endif
-#if defined(LOADER_CD9660_SUPPORT)
- &cd9660_fsops,
-#endif
-#if defined(LOADER_EXT2FS_SUPPORT)
- &ext2fs_fsops,
-#endif
-#if defined(LOADER_NFS_SUPPORT)
- &nfs_fsops,
-#endif
-#if defined(LOADER_TFTP_SUPPORT)
- &tftp_fsops,
-#endif
-#if defined(LOADER_GZIP_SUPPORT)
- &gzipfs_fsops,
-#endif
-#if defined(LOADER_BZIP2_SUPPORT)
- &bzipfs_fsops,
-#endif
- NULL
-};
-
-struct netif_driver *netif_drivers[] = {
-#if defined(LOADER_NET_SUPPORT)
- &uboot_net,
-#endif
- NULL,
-};
-
-/* Exported for PowerPC only */
-/*
- * Sort formats so that those that can detect based on arguments
- * rather than reading the file go first.
- */
-extern struct file_format uboot_elf64;
-
-struct file_format *file_formats[] = {
- &uboot_elf,
- &uboot_elf64,
- NULL
-};
-
-/*
- * Consoles
- */
-extern struct console uboot_console;
-
-struct console *consoles[] = {
- &uboot_console,
- NULL
-};
diff --git a/stand/powerpc/uboot/ldscript.powerpc b/stand/powerpc/uboot/ldscript.powerpc
deleted file mode 100644
index 923838365793..000000000000
--- a/stand/powerpc/uboot/ldscript.powerpc
+++ /dev/null
@@ -1,138 +0,0 @@
-/* $FreeBSD$ */
-
-OUTPUT_FORMAT("elf32-powerpc-freebsd", "elf32-powerpc-freebsd",
- "elf32-powerpc-freebsd")
-OUTPUT_ARCH(powerpc:common)
-ENTRY(_start)
-SEARCH_DIR(/usr/lib);
-PROVIDE (__stack = 0);
-SECTIONS
-{
- /* Read-only sections, merged into text segment: */
- . = 0x00010000 + SIZEOF_HEADERS;
- .interp : { *(.interp) }
- .hash : { *(.hash) }
- .dynsym : { *(.dynsym) }
- .dynstr : { *(.dynstr) }
- .gnu.version : { *(.gnu.version) }
- .gnu.version_d : { *(.gnu.version_d) }
- .gnu.version_r : { *(.gnu.version_r) }
- .rela.text :
- { *(.rela.text) *(.rela.gnu.linkonce.t*) }
- .rela.data :
- { *(.rela.data) *(.rela.gnu.linkonce.d*) }
- .rela.rodata :
- { *(.rela.rodata) *(.rela.gnu.linkonce.r*) }
- .rela.got : { *(.rela.got) }
- .rela.got1 : { *(.rela.got1) }
- .rela.got2 : { *(.rela.got2) }
- .rela.ctors : { *(.rela.ctors) }
- .rela.dtors : { *(.rela.dtors) }
- .rela.init : { *(.rela.init) }
- .rela.fini : { *(.rela.fini) }
- .rela.bss : { *(.rela.bss) }
- .rela.plt : { *(.rela.plt) }
- .rela.sdata : { *(.rela.sdata) }
- .rela.sbss : { *(.rela.sbss) }
- .rela.sdata2 : { *(.rela.sdata2) }
- .rela.sbss2 : { *(.rela.sbss2) }
- .text :
- {
- *(.text)
- /* .gnu.warning sections are handled specially by elf32.em. */
- *(.gnu.warning)
- *(.gnu.linkonce.t*)
- } =0
- _etext = .;
- PROVIDE (etext = .);
- .init : { *(.init) } =0
- .fini : { *(.fini) } =0
- .rodata : { *(.rodata) *(.gnu.linkonce.r*) }
- .rodata1 : { *(.rodata1) }
- .sdata2 : { *(.sdata2) }
- .sbss2 : { *(.sbss2) }
- /* Adjust the address for the data segment to the next page up. */
- . = ((. + 0x1000) & ~(0x1000 - 1));
- .data :
- {
- *(.data)
- *(.gnu.linkonce.d*)
- CONSTRUCTORS
- }
- .data1 : { *(.data1) }
- .got1 : { *(.got1) }
- .dynamic : { *(.dynamic) }
- /* Put .ctors and .dtors next to the .got2 section, so that the pointers
- get relocated with -mrelocatable. Also put in the .fixup pointers.
- The current compiler no longer needs this, but keep it around for 2.7.2 */
- PROVIDE (_GOT2_START_ = .);
- .got2 : { *(.got2) }
- PROVIDE (__CTOR_LIST__ = .);
- .ctors : { *(.ctors) }
- PROVIDE (__CTOR_END__ = .);
- PROVIDE (__DTOR_LIST__ = .);
- .dtors : { *(.dtors) }
- PROVIDE (__DTOR_END__ = .);
- PROVIDE (_FIXUP_START_ = .);
- .fixup : { *(.fixup) }
- PROVIDE (_FIXUP_END_ = .);
- PROVIDE (_GOT2_END_ = .);
- PROVIDE (_GOT_START_ = .);
- .got : { *(.got) }
- .got.plt : { *(.got.plt) }
- PROVIDE (_GOT_END_ = .);
- /* We want the small data sections together, so single-instruction offsets
- can access them all, and initialized data all before uninitialized, so
- we can shorten the on-disk segment size. */
- .sdata : { *(.sdata) }
- _edata = .;
- PROVIDE (edata = .);
- .sbss :
- {
- PROVIDE (__sbss_start = .);
- *(.sbss)
- *(.scommon)
- *(.dynsbss)
- PROVIDE (__sbss_end = .);
- }
- .plt : { *(.plt) }
- .bss :
- {
- PROVIDE (__bss_start = .);
- *(.dynbss)
- *(.bss)
- *(COMMON)
- }
- _end = . ;
- PROVIDE (end = .);
- /* Stabs debugging sections. */
- .stab 0 : { *(.stab) }
- .stabstr 0 : { *(.stabstr) }
- /* DWARF debug sections.
- Symbols in the DWARF debugging sections are relative to the beginning
- of the section so we begin them at 0. */
- /* DWARF 1 */
- .debug 0 : { *(.debug) }
- .line 0 : { *(.line) }
- /* GNU DWARF 1 extensions */
- .debug_srcinfo 0 : { *(.debug_srcinfo) }
- .debug_sfnames 0 : { *(.debug_sfnames) }
- /* DWARF 1.1 and DWARF 2 */
- .debug_aranges 0 : { *(.debug_aranges) }
- .debug_pubnames 0 : { *(.debug_pubnames) }
- /* DWARF 2 */
- .debug_info 0 : { *(.debug_info) }
- .debug_abbrev 0 : { *(.debug_abbrev) }
- .debug_line 0 : { *(.debug_line) }
- .debug_frame 0 : { *(.debug_frame) }
- .debug_str 0 : { *(.debug_str) }
- .debug_loc 0 : { *(.debug_loc) }
- .debug_macinfo 0 : { *(.debug_macinfo) }
- /* SGI/MIPS DWARF 2 extensions */
- .debug_weaknames 0 : { *(.debug_weaknames) }
- .debug_funcnames 0 : { *(.debug_funcnames) }
- .debug_typenames 0 : { *(.debug_typenames) }
- .debug_varnames 0 : { *(.debug_varnames) }
- /* These must appear regardless of . */
-}
-
diff --git a/stand/powerpc/uboot/ppc64_elf_freebsd.c b/stand/powerpc/uboot/ppc64_elf_freebsd.c
deleted file mode 100644
index 57b2e791fbba..000000000000
--- a/stand/powerpc/uboot/ppc64_elf_freebsd.c
+++ /dev/null
@@ -1,101 +0,0 @@
-/*-
- * Copyright (c) 2001 Benno Rice <benno@FreeBSD.org>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#define __ELF_WORD_SIZE 64
-
-#include <sys/param.h>
-#include <sys/linker.h>
-
-#include <machine/metadata.h>
-#include <machine/elf.h>
-#include <machine/md_var.h>
-
-#include <stand.h>
-
-#include "bootstrap.h"
-#include "libuboot.h"
-
-vm_offset_t md_load64(char *args, vm_offset_t *modulep, vm_offset_t *dtb);
-extern char end[];
-extern vm_offset_t reloc; /* From <arch>/conf.c */
-
-int
-ppc64_uboot_elf_loadfile(char *filename, uint64_t dest,
- struct preloaded_file **result)
-{
- int r;
-
- r = __elfN(loadfile)(filename, dest, result);
- if (r != 0)
- return (r);
-
- /*
- * No need to sync the icache for modules: this will
- * be done by the kernel after relocation.
- */
- if (!strcmp((*result)->f_type, "elf kernel"))
- __syncicache((void *) (*result)->f_addr, (*result)->f_size);
- return (0);
-}
-
-int
-ppc64_uboot_elf_exec(struct preloaded_file *fp)
-{
- struct file_metadata *fmp;
- vm_offset_t mdp, dtbp;
- Elf_Ehdr *e;
- int error;
- void (*entry)(void *);
-
- if ((fmp = file_findmetadata(fp, MODINFOMD_ELFHDR)) == NULL) {
- return(EFTYPE);
- }
- e = (Elf_Ehdr *)&fmp->md_data;
-
- /* Handle function descriptor for ELFv1 kernels */
- if ((e->e_flags & 3) == 2)
- entry = (void (*)(void*))(intptr_t)e->e_entry;
- else
- entry = *(void (*)(void*))(uint64_t *)(intptr_t)e->e_entry;
-
- if ((error = md_load64(fp->f_args, &mdp, &dtbp)) != 0)
- return (error);
-
- dev_cleanup();
- printf("Kernel args: %s\n", fp->f_args);
-
- (*entry)((void *)mdp);
- panic("exec returned");
-}
-
-struct file_format uboot_elf64 =
-{
- ppc64_uboot_elf_loadfile,
- ppc64_uboot_elf_exec
-};
diff --git a/stand/powerpc/uboot/start.S b/stand/powerpc/uboot/start.S
deleted file mode 100644
index cee56e6ea75b..000000000000
--- a/stand/powerpc/uboot/start.S
+++ /dev/null
@@ -1,100 +0,0 @@
-/*-
- * Copyright (c) 2007 Semihalf, Rafal Jaworowski <raj@semihalf.com>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * $FreeBSD$
- */
-
-#include <machine/asm.h>
-
-/*
- * Entry point to the loader that U-Boot passes control to.
- */
- .text
- .globl _start
-_start:
- /* Hint where to look for the API signature */
- lis %r11, uboot_address@ha
- addi %r11, %r11, uboot_address@l
- stw %r1, 0(%r11)
- /* Save U-Boot's r14 and r30 */
- lis %r11, saved_regs@ha
- addi %r11, %r11, saved_regs@l
- stw %r14, 0(%r11)
- stw %r30, 4(%r11)
- /* Disable interrupts */
- mfmsr %r11
- andi. %r11, %r11, ~0x8000@l
- mtmsr %r11
- b main
-
-/*
- * syscall()
- */
-ENTRY(syscall)
- stwu %r1, -32(%r1)
- mflr %r0
- stw %r14, 8(%r1)
- stw %r30, 12(%r1)
- stw %r0, 36(%r1)
- /* Restore U-Boot's r14 and r30 */
- lis %r11, saved_regs@ha
- addi %r11, %r11, saved_regs@l
- lwz %r14, 0(%r11)
- lwz %r30, 4(%r11)
- /* Enable interrupts */
- mfmsr %r11
- ori %r11, %r11, 0x8000@l
- mtmsr %r11
- /* Call into U-Boot */
- lis %r11, syscall_ptr@ha
- addi %r11, %r11, syscall_ptr@l
- lwz %r11, 0(%r11)
- mtctr %r11
- bctrl
- /* Disable interrupts */
- mfmsr %r11
- andi. %r11, %r11, ~0x8000@l
- mtmsr %r11
- /* Epilogue */
- lwz %r11, 0(%r1)
- lwz %r0, 4(%r11)
- mtlr %r0
- lwz %r14, 8(%r1)
- lwz %r30, 12(%r1)
- mr %r1, %r11
- blr
-END(syscall)
-
-/*
- * Data section
- */
- .data
-GLOBAL(syscall_ptr)
- .long 0
-GLOBAL(saved_regs)
- .long 0 /* R14 */
- .long 0 /* R30 */
-GLOBAL(uboot_address)
- .long 0
diff --git a/stand/powerpc/uboot/version b/stand/powerpc/uboot/version
deleted file mode 100644
index 21556cff70e0..000000000000
--- a/stand/powerpc/uboot/version
+++ /dev/null
@@ -1,11 +0,0 @@
-$FreeBSD$
-
-NOTE ANY CHANGES YOU MAKE TO THE BOOTBLOCKS HERE. The format of this
-file is important. Make sure the current version number is on line 6.
-
-1.1: Flattened Device Tree blob support.
-1.0: Added storage support.
-0.6: Integrated with the new U-Boot API
-0.5: Full network functionality.
-0.2: Initial U-Boot/PowerPC version derived from the existing
- OpenFirmware-based.