Port the Xilinx code to use PLATFORM and PLATFORM_SMP. This will help move

it to be part of the armv6 GENERIC kernel.
This commit is contained in:
Andrew Turner 2017-06-03 19:11:32 +00:00
parent 07c19c27d3
commit dc59c854ca
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=319552
4 changed files with 66 additions and 29 deletions

View File

@ -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

View File

@ -33,6 +33,8 @@
* (v1.4) November 16, 2012. Xilinx doc UG585.
*/
#include "opt_platform.h"
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
@ -47,41 +49,22 @@ __FBSDID("$FreeBSD$");
#include <machine/bus.h>
#include <machine/machdep.h>
#include <machine/platform.h>
#include <machine/platformvar.h>
#include <arm/xilinx/zy7_mp.h>
#include <arm/xilinx/zy7_reg.h>
#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);

View File

@ -22,6 +22,8 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "opt_platform.h"
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
#include <sys/param.h>
@ -38,7 +40,9 @@ __FBSDID("$FreeBSD$");
#include <machine/smp.h>
#include <machine/fdt.h>
#include <machine/intr.h>
#include <machine/platformvar.h>
#include <arm/xilinx/zy7_mp.h>
#include <arm/xilinx/zy7_reg.h>
#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;

34
sys/arm/xilinx/zy7_mp.h Normal file
View File

@ -0,0 +1,34 @@
/*-
* Copyright (c) 2017 Andrew Turner <andrew@FreeBSD.org>
* 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_ */