diff --git a/sys/arm/conf/ZEDBOARD b/sys/arm/conf/ZEDBOARD index 2de7571dd89..c743a69c1cc 100644 --- a/sys/arm/conf/ZEDBOARD +++ b/sys/arm/conf/ZEDBOARD @@ -27,6 +27,8 @@ include "../xilinx/std.zynq7" makeoptions MODULES_EXTRA="dtb/zynq" options SCHED_ULE # ULE scheduler +options PLATFORM # Platform based SoC +options PLATFORM_SMP #options NFSSD # Network Filesystem Server options SMP # Enable multiple cores diff --git a/sys/arm/xilinx/zy7_machdep.c b/sys/arm/xilinx/zy7_machdep.c index 3349dd1cb81..8eac5be88b4 100644 --- a/sys/arm/xilinx/zy7_machdep.c +++ b/sys/arm/xilinx/zy7_machdep.c @@ -33,6 +33,8 @@ * (v1.4) November 16, 2012. Xilinx doc UG585. */ +#include "opt_platform.h" + #include __FBSDID("$FreeBSD$"); @@ -47,41 +49,22 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include +#include #include +#include "platform_if.h" + void (*zynq7_cpu_reset)(void); -vm_offset_t -platform_lastaddr(void) -{ - - return (devmap_lastaddr()); -} - -void -platform_probe_and_attach(void) -{ - -} - -void -platform_gpio_init(void) -{ -} - -void -platform_late_init(void) -{ -} - /* * Set up static device mappings. Not strictly necessary -- simplebus will * dynamically establish mappings as needed -- but doing it this way gets us * nice efficient 1MB section mappings. */ -int -platform_devmap_init(void) +static int +zynq7_devmap_init(platform_t plat) { devmap_add_entry(ZYNQ7_PSIO_HWBASE, ZYNQ7_PSIO_SIZE); @@ -90,8 +73,8 @@ platform_devmap_init(void) return (0); } -void -cpu_reset(void) +static void +zynq7_do_cpu_reset(platform_t plat) { if (zynq7_cpu_reset != NULL) (*zynq7_cpu_reset)(); @@ -100,3 +83,17 @@ cpu_reset(void) for (;;) ; } + +static platform_method_t zynq7_methods[] = { + PLATFORMMETHOD(platform_devmap_init, zynq7_devmap_init), + PLATFORMMETHOD(platform_cpu_reset, zynq7_do_cpu_reset), + +#ifdef SMP + PLATFORMMETHOD(platform_mp_setmaxid, zynq7_mp_setmaxid), + PLATFORMMETHOD(platform_mp_start_ap, zynq7_mp_start_ap), +#endif + + PLATFORMMETHOD_END, +}; + +FDT_PLATFORM_DEF(zynq7, "zynq7", 0, "xlnx,zynq-7000", 0); diff --git a/sys/arm/xilinx/zy7_mp.c b/sys/arm/xilinx/zy7_mp.c index 9ed06e4c5cb..cb6a359fea1 100644 --- a/sys/arm/xilinx/zy7_mp.c +++ b/sys/arm/xilinx/zy7_mp.c @@ -22,6 +22,8 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +#include "opt_platform.h" + #include __FBSDID("$FreeBSD$"); #include @@ -38,7 +40,9 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include +#include #include #define ZYNQ7_CPU1_ENTRY 0xfffffff0 @@ -47,7 +51,7 @@ __FBSDID("$FreeBSD$"); #define SCU_CONTROL_ENABLE (1 << 0) void -platform_mp_setmaxid(void) +zynq7_mp_setmaxid(platform_t plat) { mp_maxid = 1; @@ -55,7 +59,7 @@ platform_mp_setmaxid(void) } void -platform_mp_start_ap(void) +zynq7_mp_start_ap(platform_t plat) { bus_space_handle_t scu_handle; bus_space_handle_t ocm_handle; diff --git a/sys/arm/xilinx/zy7_mp.h b/sys/arm/xilinx/zy7_mp.h new file mode 100644 index 00000000000..c339c264f09 --- /dev/null +++ b/sys/arm/xilinx/zy7_mp.h @@ -0,0 +1,34 @@ +/*- + * Copyright (c) 2017 Andrew Turner + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 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 _ZY7_MP_H_ +#define _ZY7_MP_H_ + +void zynq7_mp_setmaxid(platform_t); +void zynq7_mp_start_ap(platform_t); + +#endif /* _ZY7_MP_H_ */