Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 16 Jul 2011 19:35:44 +0000 (UTC)
From:      "Jayachandran C." <jchandra@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r224110 - in head/sys/mips/nlm: . hal
Message-ID:  <201107161935.p6GJZikO041327@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jchandra
Date: Sat Jul 16 19:35:44 2011
New Revision: 224110
URL: http://svn.freebsd.org/changeset/base/224110

Log:
  Add MIPS platform files for Netlogic XLP SoC.
  
  Processor, UART, PIC and Messaging Network code. Also add
  sys/mips/nlm/hal for on-chip device registers.
  
  In collaboration with: Prabhath Raman <prabhathpr at netlogicmicro com>
  
  Approved by:	bz(re), jmallett, imp(mips)

Added:
  head/sys/mips/nlm/
  head/sys/mips/nlm/board.c   (contents, props changed)
  head/sys/mips/nlm/board.h   (contents, props changed)
  head/sys/mips/nlm/bus_space_rmi.c   (contents, props changed)
  head/sys/mips/nlm/clock.h   (contents, props changed)
  head/sys/mips/nlm/cms.c   (contents, props changed)
  head/sys/mips/nlm/files.xlp   (contents, props changed)
  head/sys/mips/nlm/hal/
  head/sys/mips/nlm/hal/bridge.h   (contents, props changed)
  head/sys/mips/nlm/hal/cop0.h   (contents, props changed)
  head/sys/mips/nlm/hal/cop2.h   (contents, props changed)
  head/sys/mips/nlm/hal/cpucontrol.h   (contents, props changed)
  head/sys/mips/nlm/hal/fmn.c   (contents, props changed)
  head/sys/mips/nlm/hal/fmn.h   (contents, props changed)
  head/sys/mips/nlm/hal/iomap.h   (contents, props changed)
  head/sys/mips/nlm/hal/mips-extns.h   (contents, props changed)
  head/sys/mips/nlm/hal/mmio.h   (contents, props changed)
  head/sys/mips/nlm/hal/mmu.h   (contents, props changed)
  head/sys/mips/nlm/hal/pic.h   (contents, props changed)
  head/sys/mips/nlm/hal/sys.h   (contents, props changed)
  head/sys/mips/nlm/hal/uart.h   (contents, props changed)
  head/sys/mips/nlm/interrupt.h   (contents, props changed)
  head/sys/mips/nlm/intr_machdep.c   (contents, props changed)
  head/sys/mips/nlm/iodi.c   (contents, props changed)
  head/sys/mips/nlm/mpreset.S   (contents, props changed)
  head/sys/mips/nlm/msgring.h   (contents, props changed)
  head/sys/mips/nlm/std.xlp   (contents, props changed)
  head/sys/mips/nlm/tick.c   (contents, props changed)
  head/sys/mips/nlm/uart_bus_xlp_iodi.c   (contents, props changed)
  head/sys/mips/nlm/uart_cpu_mips_xlp.c   (contents, props changed)
  head/sys/mips/nlm/xlp.h   (contents, props changed)
  head/sys/mips/nlm/xlp_machdep.c   (contents, props changed)

Added: head/sys/mips/nlm/board.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/sys/mips/nlm/board.c	Sat Jul 16 19:35:44 2011	(r224110)
@@ -0,0 +1,80 @@
+/*-
+ * Copyright 2003-2011 Netlogic Microsystems (Netlogic). 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 Netlogic Microsystems ``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 NETLOGIC OR CONTRIBUTORS 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.
+ *
+ * NETLOGIC_BSD */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/bus.h>
+#include <sys/kernel.h>
+#include <sys/lock.h>
+#include <sys/mutex.h>
+
+#include <mips/nlm/hal/mips-extns.h>
+#include <mips/nlm/hal/mmio.h>
+#include <mips/nlm/hal/iomap.h>
+#include <mips/nlm/hal/fmn.h>
+#include <mips/nlm/hal/pic.h>
+#include <mips/nlm/hal/uart.h>
+
+#include <mips/nlm/board.h>
+
+struct xlp_board_info xlp_board_info;
+
+int nlm_setup_xlp_board(void);
+
+/*
+ * All our knowledge of chip and board that cannot be detected by probing
+ * at run-time goes here
+ */
+
+int
+nlm_setup_xlp_board(void)
+{
+	struct xlp_board_info	*boardp;
+	int	node;
+
+	/* start with a clean slate */
+	boardp = &xlp_board_info;
+	memset(boardp, 0, sizeof(xlp_board_info));
+	boardp->nodemask = 0x1;	/* only node 0 */
+
+	for (node = 0; node < XLP_MAX_NODES; node++) {
+		if ((boardp->nodemask & (1 << node)) == 0)
+			continue;
+	}
+	return 0;
+}
+
+int nlm_board_info_setup()
+{
+	nlm_setup_xlp_board();
+	return 0;
+}

Added: head/sys/mips/nlm/board.h
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/sys/mips/nlm/board.h	Sat Jul 16 19:35:44 2011	(r224110)
@@ -0,0 +1,75 @@
+/*-
+ * Copyright 2003-2011 Netlogic Microsystems (Netlogic). 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 Netlogic Microsystems ``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 NETLOGIC OR CONTRIBUTORS 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$
+ * NETLOGIC_BSD */
+
+#ifndef __NLM_BOARD_H__
+#define __NLM_BOARD_H__
+
+#define XLP_NAE_NBLOCKS		5
+#define XLP_NAE_NPORTS		4
+#define	XLP_I2C_MAXDEVICES	8
+
+struct xlp_i2c_devinfo {
+	u_int	addr;		/* keep first, for i2c ivars to work */
+	int	bus;
+	char	*device;
+};
+
+struct xlp_port_ivars {
+	int	port;
+	int	block;
+	int	type;
+	int	phy_addr;
+};
+
+struct xlp_block_ivars {
+	int	block;
+	int	type;
+	u_int	portmask;
+	struct xlp_port_ivars	port_ivars[XLP_NAE_NPORTS];
+};
+
+struct xlp_nae_ivars {
+	int 	node;
+	u_int	blockmask;
+	struct xlp_block_ivars	block_ivars[XLP_NAE_NBLOCKS];
+};
+
+struct xlp_board_info {
+	u_int	nodemask;
+	struct xlp_node_info {
+		struct xlp_i2c_devinfo	i2c_devs[XLP_I2C_MAXDEVICES];
+		struct xlp_nae_ivars	nae_ivars;
+	} nodes[XLP_MAX_NODES];
+};
+
+extern struct xlp_board_info xlp_board_info;
+int nlm_board_info_setup(void);
+
+#endif

Added: head/sys/mips/nlm/bus_space_rmi.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/sys/mips/nlm/bus_space_rmi.c	Sat Jul 16 19:35:44 2011	(r224110)
@@ -0,0 +1,688 @@
+/*
+ * Copyright 2003-2011 Netlogic Microsystems (Netlogic). 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 Netlogic Microsystems ``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 NETLOGIC OR CONTRIBUTORS 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.
+ *
+ * NETLOGIC_BSD */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/bus.h>
+#include <sys/kernel.h>
+#include <sys/endian.h>
+#include <sys/malloc.h>
+#include <sys/ktr.h>
+
+#include <vm/vm.h>
+#include <vm/pmap.h>
+#include <vm/vm_kern.h>
+#include <vm/vm_extern.h>
+
+#include <machine/bus.h>
+#include <machine/cache.h>
+
+static int
+rmi_bus_space_map(void *t, bus_addr_t addr,
+    bus_size_t size, int flags,
+    bus_space_handle_t *bshp);
+
+static void
+rmi_bus_space_unmap(void *t, bus_space_handle_t bsh,
+    bus_size_t size);
+
+static int
+rmi_bus_space_subregion(void *t,
+    bus_space_handle_t bsh,
+    bus_size_t offset, bus_size_t size,
+    bus_space_handle_t *nbshp);
+
+static u_int8_t
+rmi_bus_space_read_1(void *t,
+    bus_space_handle_t handle,
+    bus_size_t offset);
+
+static u_int16_t
+rmi_bus_space_read_2(void *t,
+    bus_space_handle_t handle,
+    bus_size_t offset);
+
+static u_int32_t
+rmi_bus_space_read_4(void *t,
+    bus_space_handle_t handle,
+    bus_size_t offset);
+
+static void
+rmi_bus_space_read_multi_1(void *t,
+    bus_space_handle_t handle,
+    bus_size_t offset, u_int8_t *addr,
+    size_t count);
+
+static void
+rmi_bus_space_read_multi_2(void *t,
+    bus_space_handle_t handle,
+    bus_size_t offset, u_int16_t *addr,
+    size_t count);
+
+static void
+rmi_bus_space_read_multi_4(void *t,
+    bus_space_handle_t handle,
+    bus_size_t offset, u_int32_t *addr,
+    size_t count);
+
+static void
+rmi_bus_space_read_region_1(void *t,
+    bus_space_handle_t bsh,
+    bus_size_t offset, u_int8_t *addr,
+    size_t count);
+
+static void
+rmi_bus_space_read_region_2(void *t,
+    bus_space_handle_t bsh,
+    bus_size_t offset, u_int16_t *addr,
+    size_t count);
+
+static void
+rmi_bus_space_read_region_4(void *t,
+    bus_space_handle_t bsh,
+    bus_size_t offset, u_int32_t *addr,
+    size_t count);
+
+static void
+rmi_bus_space_write_1(void *t,
+    bus_space_handle_t handle,
+    bus_size_t offset, u_int8_t value);
+
+static void
+rmi_bus_space_write_2(void *t,
+    bus_space_handle_t handle,
+    bus_size_t offset, u_int16_t value);
+
+static void
+rmi_bus_space_write_4(void *t,
+    bus_space_handle_t handle,
+    bus_size_t offset, u_int32_t value);
+
+static void
+rmi_bus_space_write_multi_1(void *t,
+    bus_space_handle_t handle,
+    bus_size_t offset,
+    const u_int8_t *addr,
+    size_t count);
+
+static void
+rmi_bus_space_write_multi_2(void *t,
+    bus_space_handle_t handle,
+    bus_size_t offset,
+    const u_int16_t *addr,
+    size_t count);
+
+static void
+rmi_bus_space_write_multi_4(void *t,
+    bus_space_handle_t handle,
+    bus_size_t offset,
+    const u_int32_t *addr,
+    size_t count);
+
+static void
+rmi_bus_space_write_region_2(void *t,
+    bus_space_handle_t bsh,
+    bus_size_t offset,
+    const u_int16_t *addr,
+    size_t count);
+
+static void
+rmi_bus_space_write_region_4(void *t,
+    bus_space_handle_t bsh,
+    bus_size_t offset,
+    const u_int32_t *addr,
+    size_t count);
+
+
+static void
+rmi_bus_space_set_region_2(void *t,
+    bus_space_handle_t bsh,
+    bus_size_t offset, u_int16_t value,
+    size_t count);
+static void
+rmi_bus_space_set_region_4(void *t,
+    bus_space_handle_t bsh,
+    bus_size_t offset, u_int32_t value,
+    size_t count);
+
+static void
+rmi_bus_space_barrier(void *tag __unused, bus_space_handle_t bsh __unused,
+    bus_size_t offset __unused, bus_size_t len __unused, int flags);
+
+static void
+rmi_bus_space_copy_region_2(void *t,
+    bus_space_handle_t bsh1,
+    bus_size_t off1,
+    bus_space_handle_t bsh2,
+    bus_size_t off2, size_t count);
+
+u_int8_t
+rmi_bus_space_read_stream_1(void *t, bus_space_handle_t handle,
+    bus_size_t offset);
+
+static u_int16_t
+rmi_bus_space_read_stream_2(void *t, bus_space_handle_t handle,
+    bus_size_t offset);
+
+static u_int32_t
+rmi_bus_space_read_stream_4(void *t, bus_space_handle_t handle,
+    bus_size_t offset);
+static void
+rmi_bus_space_read_multi_stream_1(void *t,
+    bus_space_handle_t handle,
+    bus_size_t offset, u_int8_t *addr,
+    size_t count);
+
+static void
+rmi_bus_space_read_multi_stream_2(void *t,
+    bus_space_handle_t handle,
+    bus_size_t offset, u_int16_t *addr,
+    size_t count);
+
+static void
+rmi_bus_space_read_multi_stream_4(void *t,
+    bus_space_handle_t handle,
+    bus_size_t offset, u_int32_t *addr,
+    size_t count);
+
+void
+rmi_bus_space_write_stream_1(void *t, bus_space_handle_t bsh,
+    bus_size_t offset, u_int8_t value);
+static void
+rmi_bus_space_write_stream_2(void *t, bus_space_handle_t handle,
+    bus_size_t offset, u_int16_t value);
+
+static void
+rmi_bus_space_write_stream_4(void *t, bus_space_handle_t handle,
+    bus_size_t offset, u_int32_t value);
+
+static void
+rmi_bus_space_write_multi_stream_1(void *t,
+    bus_space_handle_t handle,
+    bus_size_t offset,
+    const u_int8_t *addr,
+    size_t count);
+static void
+rmi_bus_space_write_multi_stream_2(void *t,
+    bus_space_handle_t handle,
+    bus_size_t offset,
+    const u_int16_t *addr,
+    size_t count);
+
+static void
+rmi_bus_space_write_multi_stream_4(void *t,
+    bus_space_handle_t handle,
+    bus_size_t offset,
+    const u_int32_t *addr,
+    size_t count);
+
+#define TODO() printf("XLP bus space: '%s' unimplemented\n", __func__)
+
+static struct bus_space local_rmi_bus_space = {
+	/* cookie */
+	(void *)0,
+
+	/* mapping/unmapping */
+	rmi_bus_space_map,
+	rmi_bus_space_unmap,
+	rmi_bus_space_subregion,
+
+	/* allocation/deallocation */
+	NULL,
+	NULL,
+
+	/* barrier */
+	rmi_bus_space_barrier,
+
+	/* read (single) */
+	rmi_bus_space_read_1,
+	rmi_bus_space_read_2,
+	rmi_bus_space_read_4,
+	NULL,
+
+	/* read multiple */
+	rmi_bus_space_read_multi_1,
+	rmi_bus_space_read_multi_2,
+	rmi_bus_space_read_multi_4,
+	NULL,
+
+	/* read region */
+	rmi_bus_space_read_region_1,
+	rmi_bus_space_read_region_2,
+	rmi_bus_space_read_region_4,
+	NULL,
+
+	/* write (single) */
+	rmi_bus_space_write_1,
+	rmi_bus_space_write_2,
+	rmi_bus_space_write_4,
+	NULL,
+
+	/* write multiple */
+	rmi_bus_space_write_multi_1,
+	rmi_bus_space_write_multi_2,
+	rmi_bus_space_write_multi_4,
+	NULL,
+
+	/* write region */
+	NULL,
+	rmi_bus_space_write_region_2,
+	rmi_bus_space_write_region_4,
+	NULL,
+
+	/* set multiple */
+	NULL,
+	NULL,
+	NULL,
+	NULL,
+
+	/* set region */
+	NULL,
+	rmi_bus_space_set_region_2,
+	rmi_bus_space_set_region_4,
+	NULL,
+
+	/* copy */
+	NULL,
+	rmi_bus_space_copy_region_2,
+	NULL,
+	NULL,
+
+	/* read (single) stream */
+	rmi_bus_space_read_stream_1,
+	rmi_bus_space_read_stream_2,
+	rmi_bus_space_read_stream_4,
+	NULL,
+
+	/* read multiple stream */
+	rmi_bus_space_read_multi_stream_1,
+	rmi_bus_space_read_multi_stream_2,
+	rmi_bus_space_read_multi_stream_4,
+	NULL,
+
+	/* read region stream */
+	rmi_bus_space_read_region_1,
+	rmi_bus_space_read_region_2,
+	rmi_bus_space_read_region_4,
+	NULL,
+
+	/* write (single) stream */
+	rmi_bus_space_write_stream_1,
+	rmi_bus_space_write_stream_2,
+	rmi_bus_space_write_stream_4,
+	NULL,
+
+	/* write multiple stream */
+	rmi_bus_space_write_multi_stream_1,
+	rmi_bus_space_write_multi_stream_2,
+	rmi_bus_space_write_multi_stream_4,
+	NULL,
+
+	/* write region stream */
+	NULL,
+	rmi_bus_space_write_region_2,
+	rmi_bus_space_write_region_4,
+	NULL,
+};
+
+/* generic bus_space tag */
+bus_space_tag_t rmi_bus_space = &local_rmi_bus_space;
+
+/*
+ * Map a region of device bus space into CPU virtual address space.
+ */
+static int
+rmi_bus_space_map(void *t __unused, bus_addr_t addr,
+    bus_size_t size __unused, int flags __unused,
+    bus_space_handle_t *bshp)
+{
+
+	*bshp = addr;
+	return (0);
+}
+
+/*
+ * Unmap a region of device bus space.
+ */
+static void
+rmi_bus_space_unmap(void *t __unused, bus_space_handle_t bsh __unused,
+    bus_size_t size __unused)
+{
+}
+
+/*
+ * Get a new handle for a subregion of an already-mapped area of bus space.
+ */
+
+static int
+rmi_bus_space_subregion(void *t __unused, bus_space_handle_t bsh,
+    bus_size_t offset, bus_size_t size __unused,
+    bus_space_handle_t *nbshp)
+{
+	*nbshp = bsh + offset;
+	return (0);
+}
+
+/*
+ * Read a 1, 2, 4, or 8 byte quantity from bus space
+ * described by tag/handle/offset.
+ */
+
+static u_int8_t
+rmi_bus_space_read_1(void *tag, bus_space_handle_t handle,
+    bus_size_t offset)
+{
+	return (u_int8_t) (*(volatile u_int32_t *)(handle + offset));
+}
+
+static u_int16_t
+rmi_bus_space_read_2(void *tag, bus_space_handle_t handle,
+    bus_size_t offset)
+{
+	return (u_int16_t)(*(volatile u_int32_t *)(handle + offset));
+}
+
+static u_int32_t
+rmi_bus_space_read_4(void *tag, bus_space_handle_t handle,
+    bus_size_t offset)
+{
+	return (*(volatile u_int32_t *)(handle + offset));
+}
+
+
+/*
+ * Read `count' 1, 2, 4, or 8 byte quantities from bus space
+ * described by tag/handle/offset and copy into buffer provided.
+ */
+static void
+rmi_bus_space_read_multi_1(void *tag, bus_space_handle_t handle,
+    bus_size_t offset, u_int8_t *addr, size_t count)
+{
+	TODO();
+}
+
+static void
+rmi_bus_space_read_multi_2(void *tag, bus_space_handle_t handle,
+    bus_size_t offset, u_int16_t *addr, size_t count)
+{
+	TODO();
+}
+
+static void
+rmi_bus_space_read_multi_4(void *tag, bus_space_handle_t handle,
+    bus_size_t offset, u_int32_t *addr, size_t count)
+{
+	TODO();
+}
+
+/*
+ * Write the 1, 2, 4, or 8 byte value `value' to bus space
+ * described by tag/handle/offset.
+ */
+
+static void
+rmi_bus_space_write_1(void *tag, bus_space_handle_t handle,
+    bus_size_t offset, u_int8_t value)
+{
+	*(volatile u_int32_t *)(handle + offset) =  (u_int32_t)value;
+}
+
+static void
+rmi_bus_space_write_2(void *tag, bus_space_handle_t handle,
+    bus_size_t offset, u_int16_t value)
+{
+	*(volatile u_int32_t *)(handle + offset) = (u_int32_t)value;
+}
+
+static void
+rmi_bus_space_write_4(void *tag, bus_space_handle_t handle,
+    bus_size_t offset, u_int32_t value)
+{
+	*(volatile u_int32_t *)(handle + offset) = value;
+}
+
+
+/*
+ * Write `count' 1, 2, 4, or 8 byte quantities from the buffer
+ * provided to bus space described by tag/handle/offset.
+ */
+
+
+static void
+rmi_bus_space_write_multi_1(void *tag, bus_space_handle_t handle,
+    bus_size_t offset, const u_int8_t *addr, size_t count)
+{
+	TODO();
+}
+
+static void
+rmi_bus_space_write_multi_2(void *tag, bus_space_handle_t handle,
+    bus_size_t offset, const u_int16_t *addr, size_t count)
+{
+	TODO();
+}
+
+static void
+rmi_bus_space_write_multi_4(void *tag, bus_space_handle_t handle,
+    bus_size_t offset, const u_int32_t *addr, size_t count)
+{
+	TODO();
+}
+
+/*
+ * Write `count' 1, 2, 4, or 8 byte value `val' to bus space described
+ * by tag/handle starting at `offset'.
+ */
+
+static void
+rmi_bus_space_set_region_2(void *t, bus_space_handle_t bsh,
+    bus_size_t offset, u_int16_t value, size_t count)
+{
+	bus_addr_t addr = bsh + offset;
+
+	for (; count != 0; count--, addr += 2)
+		(*(volatile u_int32_t *)(addr)) = value;
+}
+
+static void
+rmi_bus_space_set_region_4(void *t, bus_space_handle_t bsh,
+    bus_size_t offset, u_int32_t value, size_t count)
+{
+	bus_addr_t addr = bsh + offset;
+
+	for (; count != 0; count--, addr += 4)
+		(*(volatile u_int32_t *)(addr)) = value;
+}
+
+
+/*
+ * Copy `count' 1, 2, 4, or 8 byte values from bus space starting
+ * at tag/bsh1/off1 to bus space starting at tag/bsh2/off2.
+ */
+static void
+rmi_bus_space_copy_region_2(void *t, bus_space_handle_t bsh1,
+    bus_size_t off1, bus_space_handle_t bsh2,
+    bus_size_t off2, size_t count)
+{
+	printf("bus_space_copy_region_2 - unimplemented\n");
+}
+
+/*
+ * Read `count' 1, 2, 4, or 8 byte quantities from bus space
+ * described by tag/handle/offset and copy into buffer provided.
+ */
+
+u_int8_t
+rmi_bus_space_read_stream_1(void *t, bus_space_handle_t handle,
+    bus_size_t offset)
+{
+
+	return *((volatile u_int8_t *)(handle + offset));
+}
+
+
+static u_int16_t
+rmi_bus_space_read_stream_2(void *t, bus_space_handle_t handle,
+    bus_size_t offset)
+{
+	return *(volatile u_int16_t *)(handle + offset);
+}
+
+
+static u_int32_t
+rmi_bus_space_read_stream_4(void *t, bus_space_handle_t handle,
+    bus_size_t offset)
+{
+	return (*(volatile u_int32_t *)(handle + offset));
+}
+
+
+static void
+rmi_bus_space_read_multi_stream_1(void *tag, bus_space_handle_t handle,
+    bus_size_t offset, u_int8_t *addr, size_t count)
+{
+	TODO();
+}
+
+static void
+rmi_bus_space_read_multi_stream_2(void *tag, bus_space_handle_t handle,
+    bus_size_t offset, u_int16_t *addr, size_t count)
+{
+	TODO();
+}
+
+static void
+rmi_bus_space_read_multi_stream_4(void *tag, bus_space_handle_t handle,
+    bus_size_t offset, u_int32_t *addr, size_t count)
+{
+	TODO();
+}
+
+
+/*
+ * Read `count' 1, 2, 4, or 8 byte quantities from bus space
+ * described by tag/handle and starting at `offset' and copy into
+ * buffer provided.
+ */
+void
+rmi_bus_space_read_region_1(void *t, bus_space_handle_t bsh,
+    bus_size_t offset, u_int8_t *addr, size_t count)
+{
+	TODO();
+}
+
+void
+rmi_bus_space_read_region_2(void *t, bus_space_handle_t bsh,
+    bus_size_t offset, u_int16_t *addr, size_t count)
+{
+	TODO();
+}
+
+void
+rmi_bus_space_read_region_4(void *t, bus_space_handle_t bsh,
+    bus_size_t offset, u_int32_t *addr, size_t count)
+{
+	bus_addr_t baddr = bsh + offset;
+
+	while (count--) {
+		*addr++ = (*(volatile u_int32_t *)(baddr));
+		baddr += 4;
+	}
+}
+
+void
+rmi_bus_space_write_stream_1(void *t, bus_space_handle_t handle,
+    bus_size_t offset, u_int8_t value)
+{
+	TODO();
+}
+
+
+static void
+rmi_bus_space_write_stream_2(void *t, bus_space_handle_t handle,
+    bus_size_t offset, u_int16_t value)
+{
+	TODO();
+}
+
+
+static void
+rmi_bus_space_write_stream_4(void *t, bus_space_handle_t handle,
+    bus_size_t offset, u_int32_t value)
+{
+	TODO();
+}
+
+
+static void
+rmi_bus_space_write_multi_stream_1(void *tag, bus_space_handle_t handle,
+    bus_size_t offset, const u_int8_t *addr, size_t count)
+{
+	TODO();
+}
+
+static void
+rmi_bus_space_write_multi_stream_2(void *tag, bus_space_handle_t handle,
+    bus_size_t offset, const u_int16_t *addr, size_t count)
+{
+	TODO();
+}
+
+static void
+rmi_bus_space_write_multi_stream_4(void *tag, bus_space_handle_t handle,
+    bus_size_t offset, const u_int32_t *addr, size_t count)
+{
+	TODO();
+}
+
+void
+rmi_bus_space_write_region_2(void *t,
+    bus_space_handle_t bsh,
+    bus_size_t offset,
+    const u_int16_t *addr,
+    size_t count)
+{
+	TODO();
+}
+
+void
+rmi_bus_space_write_region_4(void *t, bus_space_handle_t bsh,
+    bus_size_t offset, const u_int32_t *addr, size_t count)
+{
+	TODO();
+}
+
+static void
+rmi_bus_space_barrier(void *tag __unused, bus_space_handle_t bsh __unused,
+    bus_size_t offset __unused, bus_size_t len __unused, int flags)
+{
+}

Added: head/sys/mips/nlm/clock.h
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/sys/mips/nlm/clock.h	Sat Jul 16 19:35:44 2011	(r224110)
@@ -0,0 +1,41 @@
+/*-
+ * Copyright 2003-2011 Netlogic Microsystems (Netlogic). 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 Netlogic Microsystems ``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 NETLOGIC OR CONTRIBUTORS 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$
+ * NETLOGIC_BSD */
+
+#ifndef _RMI_CLOCK_H_
+#define _RMI_CLOCK_H_
+
+#define XLP_PIC_HZ 133000000U
+#define XLP_CPU_HZ (nlm_cpu_frequency)
+
+void count_compare_clockhandler(struct trapframe *);
+void pic_hardclockhandler(struct trapframe *);
+void pic_timecounthandler(struct trapframe *);
+
+#endif /* _RMI_CLOCK_H_ */

Added: head/sys/mips/nlm/cms.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/sys/mips/nlm/cms.c	Sat Jul 16 19:35:44 2011	(r224110)
@@ -0,0 +1,451 @@
+/*-
+ * Copyright 2003-2011 Netlogic Microsystems (Netlogic). 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 Netlogic Microsystems ``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 NETLOGIC OR CONTRIBUTORS 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.
+ *
+ * NETLOGIC_BSD */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+#include <sys/types.h>
+#include <sys/systm.h>
+#include <sys/param.h>
+#include <sys/lock.h>
+#include <sys/mutex.h>
+#include <sys/proc.h>
+#include <sys/limits.h>
+#include <sys/bus.h>
+
+#include <sys/ktr.h>
+#include <sys/kernel.h>
+#include <sys/kthread.h>
+#include <sys/proc.h>
+#include <sys/resourcevar.h>
+#include <sys/sched.h>
+#include <sys/unistd.h>
+#include <sys/sysctl.h>
+#include <sys/malloc.h>
+
+#include <machine/reg.h>
+#include <machine/cpu.h>
+#include <machine/hwfunc.h>
+#include <machine/mips_opcode.h>
+#include <machine/param.h>
+#include <machine/intr_machdep.h>
+
+#include <mips/nlm/hal/mips-extns.h>
+#include <mips/nlm/hal/mmio.h>
+#include <mips/nlm/hal/iomap.h>
+#include <mips/nlm/hal/cop0.h>
+#include <mips/nlm/hal/cop2.h>
+#include <mips/nlm/hal/fmn.h>
+#include <mips/nlm/hal/pic.h>
+
+#include <mips/nlm/msgring.h>
+#include <mips/nlm/interrupt.h>
+#include <mips/nlm/xlp.h>
+#include <mips/nlm/board.h>
+
+#define MSGRNG_NSTATIONS 1024
+/*
+ * Keep track of our message ring handler threads, each core has a
+ * different message station. Ideally we will need to start a few
+ * message handling threads every core, and wake them up depending on
+ * load
+ */
+struct msgring_thread {
+	struct thread	*thread; /* msgring handler threads */
+	int	needed;		/* thread needs to wake up */
+};
+static struct msgring_thread msgring_threads[XLP_MAX_CORES * XLP_MAX_THREADS];
+static struct proc *msgring_proc;	/* all threads are under a proc */
+
+/*
+ * The device drivers can register a handler for the the messages sent
+ * from a station (corresponding to the device).
+ */
+struct tx_stn_handler {
+	msgring_handler action;
+	void *arg;
+};
+static struct tx_stn_handler msgmap[MSGRNG_NSTATIONS];
+static struct mtx	msgmap_lock;
+uint64_t xlp_cms_base;
+uint32_t xlp_msg_thread_mask;
+static int xlp_msg_threads_per_core = 3; /* Make tunable */
+
+static void create_msgring_thread(int hwtid);
+static int msgring_process_fast_intr(void *arg);
+/*

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201107161935.p6GJZikO041327>