diff options
-rw-r--r-- | stand/ofw/common/Makefile.inc | 3 | ||||
-rw-r--r-- | stand/ofw/libofw/Makefile | 6 | ||||
-rw-r--r-- | stand/ofw/libofw/libofw.h | 8 | ||||
-rw-r--r-- | stand/powerpc/ofw/Makefile | 6 | ||||
-rw-r--r-- | stand/powerpc/ofw/conf.c | 3 | ||||
-rw-r--r-- | stand/powerpc/ofw/elf_freebsd.c (renamed from stand/ofw/libofw/elf_freebsd.c) | 4 | ||||
-rw-r--r-- | stand/powerpc/ofw/main.c (renamed from stand/ofw/common/main.c) | 21 | ||||
-rw-r--r-- | stand/powerpc/ofw/ppc64_elf_freebsd.c (renamed from stand/ofw/libofw/ppc64_elf_freebsd.c) | 0 |
8 files changed, 28 insertions, 23 deletions
diff --git a/stand/ofw/common/Makefile.inc b/stand/ofw/common/Makefile.inc deleted file mode 100644 index 5d20372..0000000 --- a/stand/ofw/common/Makefile.inc +++ /dev/null @@ -1,3 +0,0 @@ -# $FreeBSD$ - -SRCS+= main.c diff --git a/stand/ofw/libofw/Makefile b/stand/ofw/libofw/Makefile index 80ca993..5ab94e0 100644 --- a/stand/ofw/libofw/Makefile +++ b/stand/ofw/libofw/Makefile @@ -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 diff --git a/stand/ofw/libofw/libofw.h b/stand/ofw/libofw/libofw.h index 24a5d08..6e2cc81 100644 --- a/stand/ofw/libofw/libofw.h +++ b/stand/ofw/libofw/libofw.h @@ -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 diff --git a/stand/powerpc/ofw/Makefile b/stand/powerpc/ofw/Makefile index b1f4135..de5d5e0 100644 --- a/stand/powerpc/ofw/Makefile +++ b/stand/powerpc/ofw/Makefile @@ -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 diff --git a/stand/powerpc/ofw/conf.c b/stand/powerpc/ofw/conf.c index 7cad372..ac815bf 100644 --- a/stand/powerpc/ofw/conf.c +++ b/stand/powerpc/ofw/conf.c @@ -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, diff --git a/stand/ofw/libofw/elf_freebsd.c b/stand/powerpc/ofw/elf_freebsd.c index 456b0cd..78bebf4 100644 --- a/stand/ofw/libofw/elf_freebsd.c +++ b/stand/powerpc/ofw/elf_freebsd.c @@ -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); diff --git a/stand/ofw/common/main.c b/stand/powerpc/ofw/main.c index b8c7a17..d3ada31 100644 --- a/stand/ofw/common/main.c +++ b/stand/powerpc/ofw/main.c @@ -33,6 +33,8 @@ __FBSDID("$FreeBSD$"); #include "libofw.h" #include "bootstrap.h" +#include <machine/psl.h> + struct arch_switch archsw; /* MI/MD interface boundary */ extern char end[]; @@ -47,6 +49,16 @@ static char heap[HEAP_SIZE]; // In BSS, so uses no space #define OF_puts(fd, text) OF_write(fd, text, strlen(text)) +static __inline register_t +mfmsr(void) +{ + register_t value; + + __asm __volatile ("mfmsr %0" : "=r"(value)); + + return (value); +} + void init_heap(void) { @@ -145,6 +157,15 @@ main(int (*openfirm)(void *)) env_nounset); setenv("LINES", "24", 1); /* optional */ + /* + * On non-Apple hardware, where it works reliably, pass flattened + * device trees to the kernel by default instead of OF CI pointers. + * Apple hardware is the only virtual-mode OF implementation in + * existence, so far as I am aware, so use that as a flag. + */ + if (!(mfmsr() & PSL_DR)) + setenv("usefdt", "1", 1); + archsw.arch_getdev = ofw_getdev; archsw.arch_copyin = ofw_copyin; archsw.arch_copyout = ofw_copyout; diff --git a/stand/ofw/libofw/ppc64_elf_freebsd.c b/stand/powerpc/ofw/ppc64_elf_freebsd.c index 6d85029..6d85029 100644 --- a/stand/ofw/libofw/ppc64_elf_freebsd.c +++ b/stand/powerpc/ofw/ppc64_elf_freebsd.c |