From owner-svn-src-projects@FreeBSD.ORG Thu Oct 15 21:05:09 2009 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 829AD1065676; Thu, 15 Oct 2009 21:05:09 +0000 (UTC) (envelope-from rrs@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 68BA88FC15; Thu, 15 Oct 2009 21:05:09 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n9FL59kZ084684; Thu, 15 Oct 2009 21:05:09 GMT (envelope-from rrs@svn.freebsd.org) Received: (from rrs@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9FL59p5084681; Thu, 15 Oct 2009 21:05:09 GMT (envelope-from rrs@svn.freebsd.org) Message-Id: <200910152105.n9FL59p5084681@svn.freebsd.org> From: Randall Stewart Date: Thu, 15 Oct 2009 21:05:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r198155 - projects/mips/sys/mips/rmi X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 15 Oct 2009 21:05:09 -0000 Author: rrs Date: Thu Oct 15 21:05:09 2009 New Revision: 198155 URL: http://svn.freebsd.org/changeset/base/198155 Log: Adds the first files from the RMI work with my re-work of their intr_machdep.c to use updated interfaces etc. More coming.. and some day it may compile ;-) Added: projects/mips/sys/mips/rmi/files.xlr projects/mips/sys/mips/rmi/intr_machdep.c projects/mips/sys/mips/rmi/std.xlr Added: projects/mips/sys/mips/rmi/files.xlr ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ projects/mips/sys/mips/rmi/files.xlr Thu Oct 15 21:05:09 2009 (r198155) @@ -0,0 +1,24 @@ +# $FreeBSD$ +mips/rmi/xlr_boot1_console.c standard +mips/rmi/xlr_machdep.c standard +#mips/rmi/clock.c standard +mips/rmi/iodi.c standard +mips/rmi/msgring.c standard +mips/rmi/msgring_xls.c standard +mips/rmi/board.c standard +mips/rmi/on_chip.c standard +mips/rmip/intr_machdep.c standard +mips/rmi/xlr_i2c.c optional iic +mips/rmi/uart_bus_xlr_iodi.c optional uart +mips/rmi/uart_cpu_mips_xlr.c optional uart +mips/rmi/perfmon_kern.c optional xlr_perfmon +mips/rmi/perfmon_percpu.c optional xlr_perfmon +mips/rmi/pcibus.c optional pci +mips/rmi/xlr_pci.c optional pci +mips/rmi/xls_ehci.c optional usb ehci +dev/rmi/xlr/rge.c optional rge +dev/iicbus/xlr_rtc.c optional xlr_rtc +dev/iicbus/xlr_temperature.c optional xlr_temperature +dev/iicbus/xlr_eeprom.c optional xlr_eeprom +dev/rmi/sec/rmisec.c optional rmisec +dev/rmi/sec/rmilib.c optional rmisec Added: projects/mips/sys/mips/rmi/intr_machdep.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ projects/mips/sys/mips/rmi/intr_machdep.c Thu Oct 15 21:05:09 2009 (r198155) @@ -0,0 +1,175 @@ +/*- + * Copyright (c) 2006 Fill this file and put your name here + * Copyright (c) 2002-2004 Juli Mallett + * 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, + * without modification, immediately at the beginning of the file. + * 2. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``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 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. + * + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +struct mips_intrhand mips_intr_handlers[XLR_MAX_INTR]; + +static void +mips_mask_hard_irq(void *source) +{ + uintptr_t irq = (uintptr_t)source; + + write_c0_eimr64(read_c0_eimr64() & ~(1ULL< XLR_MAX_INTR) + panic("%s called for unknown hard intr %d", __func__, intr); + + /* FIXME locking - not needed now, because we do this only on startup from + CPU0 */ + mih = &mips_intr_handlers[irq]; + mih->cntp = &intrcnt[irq]; + ie = mih->mih_event; + if (ie == NULL) { + errcode = intr_event_create(&event, (void *)(uintptr_t)irq, 0, + irq, mips_mask_hard_irq, mips_unmask_hard_irq, + NULL, NULL, "hard intr%d:", irq); + + if (errcode) { + printf("Could not create event for intr %d\n", irq); + return; + } + } + intr_event_add_handler(event, name, filt, handler, arg, + intr_priority(flags), flags, cookiep); + mih->mih_event = ie; + mips_unmask_hard_irq((void*)(uintptr_t)irq); +} + + +void +cpu_establish_softintr(const char *name, driver_filter_t *filt, + void (*handler)(void*), void *arg, int irq, int flags, + void **cookiep) +{ + /* we don't separate them into soft/hard like other mips */ + cpu_establish_hardintr(name, filt, handler, arg, intr, flags, cookiep); +} + +void +cpu_intr(struct trapframe *tf) +{ + struct mips_intrhand *mih; + struct intr_handler *ih; + struct intr_event *ie; + register_t eirr; + int i, thread, error; + + critical_enter(); + eirr = read_c0_eirr64(); + if (eirr == 0) { + critical_exit(); + return; + } + + /* No need to clear the EIRR here. the handler is gonna + * write to compare which clears eirr also + */ + if (eirr & (1 << IRQ_TIMER)) { + count_compare_clockhandler(tf); + critical_exit(); + return; + } + + /* FIXME sched pin >? LOCK>? */ + for(i = sizeof(eirr)*8 - 1; i>=0; i--) { + if ((eirr & 1ULL<cntp, 1); + ie = mih->mih_event; + + write_c0_eirr64(1ULL << i); + if (!ie || TAILQ_EMPTY(&ie->ie_handlers)) { + printf("stray interrupt %d\n", i); + continue; + } + + if (intr_event_handle(ie, tf) != 0) { + printf("stray %s interrupt %d\n", + hard ? "hard" : "soft", i); + } + + } + critical_exit(); +} Added: projects/mips/sys/mips/rmi/std.xlr ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ projects/mips/sys/mips/rmi/std.xlr Thu Oct 15 21:05:09 2009 (r198155) @@ -0,0 +1,10 @@ +# $FreeBSD$ +files "../xlr/files.xlr" + +# +# XXXMIPS: It's a stub, isn't it? +# +cpu CPU_MIPSXLR +option NOFPU +# Kludge for now +options TARGET_XLR_XLS