2000-10-16 10:46:22 +00:00
|
|
|
# $FreeBSD$
|
|
|
|
|
2017-11-08 14:44:45 +00:00
|
|
|
LOADER_CD9660_SUPPORT?= yes
|
|
|
|
LOADER_EXT2FS_SUPPORT?= no
|
|
|
|
LOADER_MSDOS_SUPPORT?= no
|
|
|
|
LOADER_UFS_SUPPORT?= yes
|
|
|
|
LOADER_NET_SUPPORT?= yes
|
|
|
|
LOADER_NFS_SUPPORT?= yes
|
|
|
|
LOADER_TFTP_SUPPORT?= no
|
|
|
|
LOADER_GZIP_SUPPORT?= yes
|
|
|
|
LOADER_BZIP2_SUPPORT?= no
|
|
|
|
|
2017-10-30 03:12:28 +00:00
|
|
|
.include <bsd.init.mk>
|
2006-03-17 18:54:44 +00:00
|
|
|
|
2004-02-09 21:54:54 +00:00
|
|
|
PROG= loader
|
2007-12-26 19:15:58 +00:00
|
|
|
NEWVERSWHAT= "Open Firmware loader" ${MACHINE_ARCH}
|
2001-09-12 10:25:50 +00:00
|
|
|
INSTALLFLAGS= -b
|
2000-10-16 10:46:22 +00:00
|
|
|
|
2004-02-09 21:54:54 +00:00
|
|
|
# Architecture-specific loader code
|
2018-03-03 23:39:07 +00:00
|
|
|
SRCS= conf.c vers.c main.c elf_freebsd.c ppc64_elf_freebsd.c start.c
|
2021-12-14 21:39:12 +00:00
|
|
|
SRCS+= ucmpdi2.c gfx_fb_stub.c
|
2021-01-04 16:51:58 +00:00
|
|
|
|
2021-12-14 21:39:12 +00:00
|
|
|
CFLAGS.gfx_fb_stub.c += -I${SRCTOP}/contrib/pnglite -I${SRCTOP}/sys/teken
|
2000-10-16 10:46:22 +00:00
|
|
|
|
2017-11-10 23:54:24 +00:00
|
|
|
.include "${BOOTSRC}/fdt.mk"
|
|
|
|
.if ${MK_FDT} == "yes"
|
2015-03-09 02:57:34 +00:00
|
|
|
SRCS+= ofwfdt.c
|
|
|
|
.endif
|
2000-10-16 10:46:22 +00:00
|
|
|
|
2021-10-20 18:48:33 +00:00
|
|
|
.if ${MACHINE_ARCH:Mpowerpc64*} != ""
|
[PPC64] Implement CAS
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
2019-07-31 20:31:36 +00:00
|
|
|
SRCS+= cas.c
|
|
|
|
CFLAGS+= -DCAS
|
|
|
|
.endif
|
|
|
|
|
2021-10-20 18:48:33 +00:00
|
|
|
.if ${MACHINE_ARCH} == "powerpc64le"
|
|
|
|
SRCS+= trampolineLE.S
|
|
|
|
.endif
|
|
|
|
|
2017-12-18 04:51:34 +00:00
|
|
|
HELP_FILES= ${FDTSRC}/help.fdt
|
2021-02-11 14:29:00 +00:00
|
|
|
HELP_FILENAME= loader.help.ofw
|
2017-11-10 23:54:58 +00:00
|
|
|
|
2004-02-09 21:54:54 +00:00
|
|
|
# Always add MI sources
|
2017-10-30 03:12:28 +00:00
|
|
|
.include "${BOOTSRC}/loader.mk"
|
2017-10-16 03:59:44 +00:00
|
|
|
|
2017-10-30 03:12:28 +00:00
|
|
|
.PATH: ${SYSDIR}/libkern
|
2000-10-16 10:46:22 +00:00
|
|
|
|
2004-07-08 12:52:35 +00:00
|
|
|
# load address. set in linker script
|
2003-12-10 09:16:22 +00:00
|
|
|
RELOC?= 0x1C00000
|
[PPC64] Implement CAS
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
2019-07-31 20:31:36 +00:00
|
|
|
CFLAGS+= -DRELOC=${RELOC} -g
|
2004-07-08 12:52:35 +00:00
|
|
|
|
2021-10-20 18:48:33 +00:00
|
|
|
LDFLAGS= -nostdlib -static
|
|
|
|
|
|
|
|
.if ${MACHINE_ARCH} == "powerpc64le"
|
|
|
|
LDFLAGS+= -T ${.CURDIR}/ldscript.powerpcle
|
|
|
|
.else
|
|
|
|
LDFLAGS+= -T ${.CURDIR}/ldscript.powerpc
|
|
|
|
.endif
|
2000-10-16 10:46:22 +00:00
|
|
|
|
2004-08-16 15:45:27 +00:00
|
|
|
# Open Firmware standalone support library
|
2020-01-02 04:34:22 +00:00
|
|
|
LIBOFW= ${BOOTOBJ}/libofw/libofw.a
|
|
|
|
CFLAGS+= -I${BOOTSRC}/libofw
|
2000-10-16 10:46:22 +00:00
|
|
|
|
2018-02-02 15:40:49 +00:00
|
|
|
DPADD= ${LDR_INTERP} ${LIBOFW} ${LIBFDT} ${LIBSA}
|
|
|
|
LDADD= ${LDR_INTERP} ${LIBOFW} ${LIBFDT} ${LIBSA}
|
2000-11-10 06:39:58 +00:00
|
|
|
|
2021-02-23 12:42:26 +00:00
|
|
|
MK_PIE= no
|
|
|
|
|
2000-10-16 10:46:22 +00:00
|
|
|
.include <bsd.prog.mk>
|