PERFORCE change 175721 for review

Rafal Jaworowski raj at FreeBSD.org
Mon Mar 15 23:05:55 UTC 2010


http://p4web.freebsd.org/chv.cgi?CH=175721

Change 175721 by raj at raj_fdt on 2010/03/15 23:05:41

	Initial support for statically embedded device tree blob (DTB).
	
	Platforms which do not (cannot) run loader(8) have to embedded the DTB
	as part of the kernel data.

Affected files ...

.. //depot/projects/fdt/Makefile#6 edit
.. //depot/projects/fdt/Makefile.inc1#9 edit
.. //depot/projects/fdt/sys/arm/mv/mv_machdep.c#10 edit
.. //depot/projects/fdt/sys/conf/files#17 edit
.. //depot/projects/fdt/sys/conf/options#8 edit
.. //depot/projects/fdt/sys/dev/fdt/fdt_common.h#8 edit
.. //depot/projects/fdt/sys/dev/fdt/fdt_static_dtb.S#1 add
.. //depot/projects/fdt/sys/tools/fdt/embed_dtb.sh#1 add
.. //depot/projects/fdt/sys/tools/fdt/make_dtbh.sh#1 add

Differences ...

==== //depot/projects/fdt/Makefile#6 (text+ko) ====

@@ -89,7 +89,8 @@
 	obj objlink regress rerelease showconfig tags toolchain update \
 	_worldtmp _legacy _bootstrap-tools _cleanobj _obj \
 	_build-tools _cross-tools _includes _libraries _depend \
-	build32 distribute32 install32 xdev xdev-build xdev-install
+	build32 builddtb distribute32 install32 xdev xdev-build xdev-install \
+
 TGTS+=	${SUBDIR_TARGETS}
 
 BITGTS=	files includes

==== //depot/projects/fdt/Makefile.inc1#9 (text+ko) ====

@@ -1442,3 +1442,26 @@
 			    ../../../../usr/bin/${XDDIR}${OSREL}-$$i; \
 		done
 .endif
+
+.if ${MK_FDT} != "no"
+DTBOUTPUTFILE= ${FDT_DTS_FILE}.dtb
+
+.if defined(FDT_DTS_OUTPUT)
+DTBOUTPUTPATH= ${FDT_DTS_OUTPUT}
+.else
+DTBOUTPUTPATH= ${KRNLOBJDIR}/${KERNCONF}/${DTBOUTPUTFILE}
+.endif
+
+DTC_PATH?= ${WORLDTMP}${.CURDIR}/gnu/usr.bin/dtc
+
+#
+# Build 'standalone' Device Tree Blob
+#
+builddtb:
+.if !exists(${.CURDIR}/sys/boot/fdt/dts/${FDT_DTS_FILE})
+.error ${.CURDIR}/sys/boot/fdt/dts/${FDT_DTS_FILE} not found!
+.endif
+	PATH=${DTC_PATH}  \
+	dtc -O dtb -o ${DTBOUTPUTPATH} -b 0 -p 1024  \
+	    ${.CURDIR}/sys/boot/fdt/dts/${FDT_DTS_FILE}
+.endif

==== //depot/projects/fdt/sys/arm/mv/mv_machdep.c#10 (text+ko) ====

@@ -37,6 +37,7 @@
 
 #include "opt_msgbuf.h"
 #include "opt_ddb.h"
+#include "opt_platform.h"
 
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD: src/sys/arm/mv/mv_machdep.c,v 1.11 2010/02/24 20:31:00 raj Exp $");
@@ -424,6 +425,15 @@
 		memsize = PHYSMEM_SIZE;
 	}
 
+#if defined(FDT_DTB_STATIC)
+	/*
+	 * In case the device tree blob was not retrieved (from metadata) try
+	 * to use the statically embedded one.
+	 */
+	if (dtbp == (vm_offset_t)NULL)
+		dtbp = (vm_offset_t)&fdt_static_dtb;
+#endif
+
 	/*
 	 * If memsize is invalid, we can neither proceed nor panic (too
 	 * early for console output).

==== //depot/projects/fdt/sys/conf/files#17 (text+ko) ====

@@ -55,6 +55,14 @@
 	compile-with	"CC='${CC}' AWK=${AWK} sh $S/tools/sound/emu10k1-mkalsa.sh $S/gnu/dev/sound/pci/emu10k1-alsa.h emu10k1-alsa%diked.h" \
 	no-obj no-implicit-rule before-depend				   \
 	clean		"emu10k1-alsa%diked.h"
+fdt_static_dtb.h		optional fdt fdt_dtb_static \
+	compile-with "sh $S/tools/fdt/make_dtbh.sh ${FDT_DTS_FILE} ." \
+	no-obj no-implicit-rule before-depend \
+	clean		"${FDT_DTS_FILE}.dtb fdt_static_dtb.h"
+${FDT_DTS_FILE}.dtb		optional fdt fdt_dtb_static	\
+	dependency "$S/boot/fdt/dts/${FDT_DTS_FILE}"	\
+	compile-with "dtc -O dtb -o ${FDT_DTS_FILE}.dtb -b 0 -p 1024 $S/boot/fdt/dts/${FDT_DTS_FILE}" \
+	no-obj no-implicit-rule before-depend
 p16v-alsa%diked.h		optional snd_emu10kx pci			   \
 	dependency	"$S/tools/sound/emu10k1-mkalsa.sh $S/gnu/dev/sound/pci/p16v-alsa.h" \
 	compile-with	"CC='${CC}' AWK=${AWK} sh $S/tools/sound/emu10k1-mkalsa.sh $S/gnu/dev/sound/pci/p16v-alsa.h p16v-alsa%diked.h" \
@@ -962,9 +970,10 @@
 dev/exca/exca.c			optional cbb
 dev/fatm/if_fatm.c		optional fatm pci
 dev/fb/splash.c			optional splash
-dev/fdt/fdt_common.c		optional	fdt
-dev/fdt/fdtbus.c		optional	fdt
-dev/fdt/simplebus.c		optional	fdt
+dev/fdt/fdt_common.c		optional fdt
+dev/fdt/fdtbus.c		optional fdt
+dev/fdt/simplebus.c		optional fdt
+dev/fdt/fdt_static_dtb.S	optional fdt fdt_dtb_static
 dev/fe/if_fe.c			optional fe
 dev/fe/if_fe_pccard.c		optional fe pccard
 dev/firewire/firewire.c		optional firewire

==== //depot/projects/fdt/sys/conf/options#8 (text+ko) ====

@@ -76,6 +76,7 @@
 DEADLKRES	opt_watchdog.h
 DIRECTIO
 FDT		opt_platform.h
+FDT_DTB_STATIC	opt_platform.h
 FULL_PREEMPTION	opt_sched.h
 IPI_PREEMPTION	opt_sched.h
 GEOM_AES	opt_geom.h

==== //depot/projects/fdt/sys/dev/fdt/fdt_common.h#8 (text+ko) ====

@@ -1,5 +1,5 @@
 /*-
- * Copyright (c) 2009 The FreeBSD Foundation
+ * Copyright (c) 2009-2010 The FreeBSD Foundation
  * All rights reserved.
  *
  * This software was developed by Semihalf under sponsorship from
@@ -25,6 +25,8 @@
  * 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$
  */
 
 #ifndef _FDT_COMMON_H_
@@ -50,6 +52,10 @@
 };
 extern struct fdt_fixup_entry fdt_fixup_table[];
 
+#if defined(FDT_DTB_STATIC)
+extern u_char fdt_static_dtb;
+#endif
+
 int fdt_addrsize_cells(phandle_t, int *, int *);
 u_long fdt_data_get(void *, int);
 int fdt_parent_addr_cells(phandle_t);


More information about the p4-projects mailing list