From: visa Date: Fri, 1 Jul 2016 15:12:37 +0000 (+0000) Subject: Add fdt init for octeon. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=8a4f0236dd3f0e9ab0f4bb5f9fa91ff19975cd34;p=openbsd Add fdt init for octeon. --- diff --git a/sys/arch/octeon/conf/files.octeon b/sys/arch/octeon/conf/files.octeon index 08a67b2fc00..093da55b75e 100644 --- a/sys/arch/octeon/conf/files.octeon +++ b/sys/arch/octeon/conf/files.octeon @@ -1,4 +1,4 @@ -# $OpenBSD: files.octeon,v 1.29 2016/03/18 05:38:10 jmatthew Exp $ +# $OpenBSD: files.octeon,v 1.30 2016/07/01 15:12:37 visa Exp $ # Standard stanzas config(8) can't run without maxpartitions 16 @@ -13,6 +13,7 @@ major { octcf = 15 } major { amdcf = 19 } file dev/cninit.c +file dev/ofw/fdt.c file arch/octeon/octeon/autoconf.c file arch/octeon/octeon/bus_dma.c file arch/octeon/octeon/conf.c diff --git a/sys/arch/octeon/include/octeonvar.h b/sys/arch/octeon/include/octeonvar.h index 60c9474577e..02cee40fa87 100644 --- a/sys/arch/octeon/include/octeonvar.h +++ b/sys/arch/octeon/include/octeonvar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: octeonvar.h,v 1.28 2016/06/22 13:09:35 visa Exp $ */ +/* $OpenBSD: octeonvar.h,v 1.29 2016/07/01 15:12:37 visa Exp $ */ /* $NetBSD: maltavar.h,v 1.3 2002/03/18 10:10:16 simonb Exp $ */ /*- @@ -260,6 +260,8 @@ struct boot_info { uint64_t led_display_addr; uint32_t dfaclock; uint32_t config_flags; + /* The fields below are available when ver_minor >= 3. */ + uint64_t fdt_addr; }; struct octeon_bootmem_desc { diff --git a/sys/arch/octeon/octeon/machdep.c b/sys/arch/octeon/octeon/machdep.c index 5872fe54b51..f323024960a 100644 --- a/sys/arch/octeon/octeon/machdep.c +++ b/sys/arch/octeon/octeon/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.73 2016/03/21 14:20:57 visa Exp $ */ +/* $OpenBSD: machdep.c,v 1.74 2016/07/01 15:12:37 visa Exp $ */ /* * Copyright (c) 2009, 2010 Miodrag Vallat. @@ -78,6 +78,7 @@ #include #include +#include #include #include @@ -98,6 +99,8 @@ vm_map_t phys_map; struct boot_desc *octeon_boot_desc; struct boot_info *octeon_boot_info; +void *octeon_fdt; + char uboot_rootdev[OCTEON_ARGV_MAX]; /* @@ -355,6 +358,24 @@ mips_init(__register_t a0, __register_t a1, __register_t a2 __unused, process_bootargs(); + /* + * Save the FDT and let the system use it. + */ + if (octeon_boot_info->ver_minor >= 3 && + octeon_boot_info->fdt_addr != 0) { + void *fdt; + size_t fdt_size; + + fdt = (void *)PHYS_TO_XKPHYS(octeon_boot_info->fdt_addr, + CCA_CACHED); + if (fdt_init(fdt) != 0 && (fdt_size = fdt_get_size(fdt)) != 0) { + octeon_fdt = (void *)pmap_steal_memory(fdt_size, NULL, + NULL); + memcpy(octeon_fdt, fdt, fdt_size); + fdt_init(octeon_fdt); + } + } + /* * Get a console, very early but after initial mapping setup. */ @@ -407,6 +428,8 @@ mips_init(__register_t a0, __register_t a1, __register_t a2 __unused, DUMP_BOOT_INFO(led_display_addr, %#llx); DUMP_BOOT_INFO(dfaclock, %d); DUMP_BOOT_INFO(config_flags, %#x); + if (octeon_boot_info->ver_minor >= 3) + DUMP_BOOT_INFO(fdt_addr, %#llx); #endif /*