Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/pmppc Add missing files to the pmppc port.



details:   https://anonhg.NetBSD.org/src/rev/b3e8dad03e59
branches:  trunk
changeset: 532028:b3e8dad03e59
user:      augustss <augustss%NetBSD.org@localhost>
date:      Thu May 30 20:02:03 2002 +0000

description:
Add missing files to the pmppc port.

diffstat:

 sys/arch/pmppc/dev/cpc_mainbus.c   |   89 ++++
 sys/arch/pmppc/dev/ds17485.c       |  425 +++++++++++++++++++++
 sys/arch/pmppc/dev/flash.c         |   93 ++++
 sys/arch/pmppc/dev/if_cs_mainbus.c |  293 ++++++++++++++
 sys/arch/pmppc/include/mainbus.h   |   53 ++
 sys/arch/pmppc/include/pmppc.h     |   99 ++++
 sys/arch/pmppc/pmppc/bus_space.c   |  222 +++++++++++
 sys/arch/pmppc/pmppc/extintr.c     |  468 +++++++++++++++++++++++
 sys/arch/pmppc/pmppc/machdep.c     |  746 +++++++++++++++++++++++++++++++++++++
 sys/arch/pmppc/pmppc/mainbus.c     |  181 ++++++++
 10 files changed, 2669 insertions(+), 0 deletions(-)

diffs (truncated from 2709 to 300 lines):

diff -r 90037d3d7209 -r b3e8dad03e59 sys/arch/pmppc/dev/cpc_mainbus.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/pmppc/dev/cpc_mainbus.c  Thu May 30 20:02:03 2002 +0000
@@ -0,0 +1,89 @@
+/*     $NetBSD: cpc_mainbus.c,v 1.1 2002/05/30 20:02:03 augustss Exp $ */
+
+/*
+ * Copyright (c) 2002 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Lennart Augustsson (lennart%augustsson.net@localhost) at Sandburst Corp.
+ *
+ * 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.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *        This product includes software developed by the NetBSD
+ *        Foundation, Inc. and its contributors.
+ * 4. Neither the name of The NetBSD Foundation nor the names of its
+ *    contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. 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 FOUNDATION 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 <sys/param.h>
+#include <sys/extent.h>
+#include <sys/device.h>
+#include <sys/malloc.h>
+#include <sys/systm.h>
+
+#include <machine/bus.h>
+#include "locators.h"
+
+#include <dev/pci/pcivar.h>
+#include <dev/pci/pcireg.h>
+#include <dev/pci/pciconf.h>
+
+#include <dev/ic/cpc700reg.h>
+#include <dev/ic/cpc700var.h>
+#include <dev/ic/cpc700uic.h>
+
+#include <machine/pmppc.h>
+#include <machine/mainbus.h>
+
+
+void
+cpc_attach(struct device *self, pci_chipset_tag_t pc, bus_space_tag_t mem,
+          bus_space_tag_t pciio, bus_dma_tag_t tag, int attachpci,
+          uint freq);
+
+static int     cpc_mainbus_match(struct device *, struct cfdata *, void *);
+static void    cpc_mainbus_attach(struct device *, struct device *, void *);
+
+struct cfattach cpc_mainbus_ca = {
+       sizeof(struct device), cpc_mainbus_match, cpc_mainbus_attach
+};
+
+int
+cpc_mainbus_match(struct device *parent, struct cfdata *cf, void *aux)
+{
+       struct mainbus_attach_args *maa = aux;
+
+       return (strcmp(maa->mb_name, "cpc") == 0);
+}
+
+void
+cpc_mainbus_attach(struct device *parent, struct device *self, void *aux)
+{
+       cpc_attach(self, 0, &pmppc_mem_tag, &pmppc_pci_io_tag,
+                  &pci_bus_dma_tag, a_config.a_is_monarch,
+                  a_config.a_bus_freq);
+
+       if (!a_config.a_is_monarch)
+               printf("%s: not Monarch, pci not attached\n", self->dv_xname);
+}
diff -r 90037d3d7209 -r b3e8dad03e59 sys/arch/pmppc/dev/ds17485.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/pmppc/dev/ds17485.c      Thu May 30 20:02:03 2002 +0000
@@ -0,0 +1,425 @@
+/*     $NetBSD: ds17485.c,v 1.1 2002/05/30 20:02:03 augustss Exp $     */
+
+/*
+ * Copyright (c) 2002 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Lennart Augustsson (lennart%augustsson.net@localhost) at Sandburst Corp.
+ *
+ * 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.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *        This product includes software developed by the NetBSD
+ *        Foundation, Inc. and its contributors.
+ * 4. Neither the name of The NetBSD Foundation nor the names of its
+ *    contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. 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 FOUNDATION 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.
+ */
+
+/*-
+ * Copyright (c) 1993, 1994 Charles M. Hannum.
+ * Copyright (c) 1990 The Regents of the University of California.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * William Jolitz and Don Ahn.
+ *
+ * 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.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *     This product includes software developed by the University of
+ *     California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
+ *
+ *     @(#)clock.c     7.2 (Berkeley) 5/12/91
+ */
+/* 
+ * Mach Operating System
+ * Copyright (c) 1991,1990,1989 Carnegie Mellon University
+ * All Rights Reserved.
+ * 
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ * 
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ * 
+ * Carnegie Mellon requests users of this software to return to
+ * 
+ *  Software Distribution Coordinator  or  Software.Distribution%CS.CMU.EDU@localhost
+ *  School of Computer Science
+ *  Carnegie Mellon University
+ *  Pittsburgh PA 15213-3890
+ * 
+ * any improvements or extensions that they make and grant Carnegie Mellon
+ * the rights to redistribute these changes.
+ */
+/*
+  Copyright 1988, 1989 by Intel Corporation, Santa Clara, California.
+
+               All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and
+its documentation for any purpose and without fee is hereby
+granted, provided that the above copyright notice appears in all
+copies and that both the copyright notice and this permission notice
+appear in supporting documentation, and that the name of Intel
+not be used in advertising or publicity pertaining to distribution
+of the software without specific, written prior permission.
+
+INTEL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE
+INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS,
+IN NO EVENT SHALL INTEL BE LIABLE FOR ANY SPECIAL, INDIRECT, OR
+CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
+LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT,
+NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+*/
+
+/*
+ * Primitive clock interrupt routines.
+ */
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/kernel.h>
+#include <sys/device.h>
+
+#include <dev/ic/mc146818reg.h>
+
+#include <machine/cpu.h>
+#include <machine/intr.h>
+#include <machine/bus.h>
+
+#include <machine/mainbus.h>
+#include <machine/pmppc.h>
+
+void   rtcinit(void);
+int    rtcget(mc_todregs *);
+void   rtcput(mc_todregs *);
+static int yeartoday(int);
+int    hexdectodec(int);
+int    dectohexdec(int);
+void   rtc_print(void);
+
+__inline u_int mc146818_read(void *, u_int);
+__inline void mc146818_write(void *, u_int, u_int);
+
+#define        SECMIN  ((unsigned)60)                  /* seconds per minute */
+#define        SECHOUR ((unsigned)(60*SECMIN))         /* seconds per hour */
+#define        SECDAY  ((unsigned)(24*SECHOUR))        /* seconds per day */
+#define        SECYR   ((unsigned)(365*SECDAY))        /* seconds per common year */
+
+struct rtc_softc {
+       struct device sc_dev;
+       bus_space_tag_t sc_tag;
+       bus_space_handle_t sc_handle;
+};
+struct rtc_softc *rtc_sc = NULL;
+
+static int     rtc_match(struct device *, struct cfdata *, void *);
+static void    rtc_attach(struct device *, struct device *, void *);
+
+struct cfattach rtc_ca = {
+       sizeof(struct rtc_softc), rtc_match, rtc_attach
+};
+
+void
+rtc_print(void)
+{
+       /* Print clock as debug */
+       mc_todregs rtclk;
+
+       if (rtcget(&rtclk) == 0) {
+               printf("%s: %02x-%02x-%02x %02x:%02x:%02x\n",
+                      rtc_sc->sc_dev.dv_xname, rtclk[MC_YEAR], rtclk[MC_MONTH],
+                      rtclk[MC_DOM], rtclk[MC_HOUR], rtclk[MC_MIN],
+                      rtclk[MC_SEC]);
+       } else {
+               printf("%s: clock not set\n", rtc_sc->sc_dev.dv_xname);
+       }
+}
+
+int
+rtc_match(struct device *parent, struct cfdata *cf, void *aux)
+{
+       struct mainbus_attach_args *maa = aux;
+
+       return (!rtc_sc && strcmp(maa->mb_name, "tod") == 0);
+}
+
+void
+rtc_attach(struct device *parent, struct device *self, void *aux)
+{
+       struct rtc_softc *sc = (struct rtc_softc *)self;
+       struct mainbus_attach_args *maa = aux;
+
+       printf(": Dallas Semiconductor DS17485\n");
+
+       sc->sc_tag = maa->mb_bt;



Home | Main Index | Thread Index | Old Index