Author: andrew
Date: Sat Jun  3 19:11:32 2017
New Revision: 319552
URL: https://svnweb.freebsd.org/changeset/base/319552

Log:
  Port the Xilinx code to use PLATFORM and PLATFORM_SMP. This will help move
  it to be part of the armv6 GENERIC kernel.

Added:
  head/sys/arm/xilinx/zy7_mp.h   (contents, props changed)
Modified:
  head/sys/arm/conf/ZEDBOARD
  head/sys/arm/xilinx/zy7_machdep.c
  head/sys/arm/xilinx/zy7_mp.c

Modified: head/sys/arm/conf/ZEDBOARD
==============================================================================
--- head/sys/arm/conf/ZEDBOARD  Sat Jun  3 18:29:18 2017        (r319551)
+++ head/sys/arm/conf/ZEDBOARD  Sat Jun  3 19:11:32 2017        (r319552)
@@ -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
 

Modified: head/sys/arm/xilinx/zy7_machdep.c
==============================================================================
--- head/sys/arm/xilinx/zy7_machdep.c   Sat Jun  3 18:29:18 2017        
(r319551)
+++ head/sys/arm/xilinx/zy7_machdep.c   Sat Jun  3 19:11:32 2017        
(r319552)
@@ -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);

Modified: head/sys/arm/xilinx/zy7_mp.c
==============================================================================
--- head/sys/arm/xilinx/zy7_mp.c        Sat Jun  3 18:29:18 2017        
(r319551)
+++ head/sys/arm/xilinx/zy7_mp.c        Sat Jun  3 19:11:32 2017        
(r319552)
@@ -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;

Added: head/sys/arm/xilinx/zy7_mp.h
==============================================================================
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/arm/xilinx/zy7_mp.h        Sat Jun  3 19:11:32 2017        
(r319552)
@@ -0,0 +1,34 @@
+/*-
+ * Copyright (c) 2017 Andrew Turner <and...@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_ */
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to