Move "common" Open Firmware parts of the loader used only on PowerPC to

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.
This commit is contained in:
Nathan Whitehorn 2018-03-03 23:39:07 +00:00
parent 9d5beec1b9
commit e05bc4f98f
8 changed files with 7 additions and 23 deletions

View File

@ -1,3 +0,0 @@
# $FreeBSD$
SRCS+= main.c

View File

@ -4,7 +4,7 @@
LIB= ofw
SRCS= devicename.c elf_freebsd.c ofw_console.c ofw_copy.c ofw_disk.c \
SRCS= devicename.c ofw_console.c ofw_copy.c ofw_disk.c \
ofw_memory.c ofw_module.c ofw_net.c ofw_reboot.c \
ofw_time.c openfirm.c
.PATH: ${ZFSSRC}
@ -13,10 +13,6 @@ SRCS+= devicename_stubs.c
# Pick up the bootstrap header for some interface items
CFLAGS+= -I${LDRSRC}
.if ${MACHINE_CPUARCH} == "powerpc"
SRCS+= ppc64_elf_freebsd.c
.endif
.ifdef(BOOT_DISK_DEBUG)
# Make the disk code more talkative
CFLAGS+= -DDISK_DEBUG

View File

@ -62,18 +62,10 @@ void ofw_memmap(int);
struct preloaded_file;
struct file_format;
int ofw_elf_loadfile(char *, vm_offset_t, struct preloaded_file **);
int ofw_elf_exec(struct preloaded_file *);
/* MD code implementing MI interfaces */
vm_offset_t md_load(char *args, vm_offset_t *modulep, vm_offset_t *dtb);
vm_offset_t md_load64(char *args, vm_offset_t *modulep, vm_offset_t *dtb);
extern struct file_format ofw_elf;
#ifdef __powerpc__
extern struct file_format ofw_elf64;
#endif
extern void reboot(void);
struct ofw_reg

View File

@ -17,7 +17,7 @@ NEWVERSWHAT= "Open Firmware loader" ${MACHINE_ARCH}
INSTALLFLAGS= -b
# Architecture-specific loader code
SRCS= conf.c vers.c start.c
SRCS= conf.c vers.c main.c elf_freebsd.c ppc64_elf_freebsd.c start.c
SRCS+= ucmpdi2.c
.include "${BOOTSRC}/fdt.mk"
@ -38,10 +38,6 @@ CFLAGS+= -DRELOC=${RELOC}
LDFLAGS= -nostdlib -static -T ${.CURDIR}/ldscript.powerpc
# Pull in common loader code
.PATH: ${BOOTSRC}/ofw/common
.include "${BOOTSRC}/ofw/common/Makefile.inc"
# Open Firmware standalone support library
LIBOFW= ${BOOTOBJ}/ofw/libofw/libofw.a
CFLAGS+= -I${BOOTSRC}/ofw/libofw

View File

@ -97,6 +97,9 @@ struct netif_driver *netif_drivers[] = {
* rather than reading the file go first.
*/
struct file_format ofw_elf;
struct file_format ofw_elf64;
struct file_format *file_formats[] = {
&ofw_elf,
&ofw_elf64,

View File

@ -89,8 +89,8 @@ __elfN(ofw_exec)(struct preloaded_file *fp)
dev_cleanup();
if (dtbp != 0) {
OF_quiesce();
((int (*)(u_long, u_long, u_long, void *, u_long))entry)(dtbp, 0, 0,
(void *)mdp, sizeof(mdp));
((int (*)(u_long, u_long, u_long, void *, u_long))entry)(dtbp,
0, 0, (void *)mdp, 0xfb5d104d);
} else {
OF_chain((void *)reloc, end - (char *)reloc, (void *)entry,
(void *)mdp, 0xfb5d104d);