Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/hpcmips BUGFIX: Xhpc dumps core on SigmarionII.
details: https://anonhg.NetBSD.org/src/rev/7cea245f5d17
branches: trunk
changeset: 526809:7cea245f5d17
user: takemura <takemura%NetBSD.org@localhost>
date: Sat May 11 14:10:04 2002 +0000
description:
BUGFIX: Xhpc dumps core on SigmarionII.
Attached MQ200 video controller at PCI bus.
diffstat:
sys/arch/hpcmips/conf/GENERIC | 11 ++-
sys/arch/hpcmips/conf/files.hpcmips | 4 +-
sys/arch/hpcmips/dev/mq200_pci.c | 117 ++++++++++++++++++++++++++++++++++++
sys/arch/hpcmips/dev/mq200reg.h | 24 +++---
sys/arch/hpcmips/dev/mq200subr.c | 7 +-
sys/arch/hpcmips/vr/mq200_vrip.c | 7 +-
6 files changed, 146 insertions(+), 24 deletions(-)
diffs (267 lines):
diff -r 132232b73478 -r 7cea245f5d17 sys/arch/hpcmips/conf/GENERIC
--- a/sys/arch/hpcmips/conf/GENERIC Sat May 11 12:23:53 2002 +0000
+++ b/sys/arch/hpcmips/conf/GENERIC Sat May 11 14:10:04 2002 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.125 2002/05/11 08:56:39 takemura Exp $
+# $NetBSD: GENERIC,v 1.126 2002/05/11 14:10:04 takemura Exp $
#
# GENERIC machine description file
#
@@ -24,7 +24,7 @@
options INCLUDE_CONFIG_FILE # embed config file in kernel binary
-#ident "GENERIC-$Revision: 1.125 $"
+#ident "GENERIC-$Revision: 1.126 $"
maxusers 16
@@ -138,10 +138,10 @@
options MQ200_DEBUG
#options MQ200_USECRT
-mqvideo0 at vr4102ip? addr 0x0a000000 size 0x800000 # MQ200 video
+mqvideo* at vr4102ip? addr 0x0a000000 size 0x800000 # MQ200 video
hpcfb* at mqvideo?
-ite8181video0 at vr4102ip? addr 0x0a000000 size 0x800000 # ITE8181 video
+ite8181video* at vr4102ip? addr 0x0a000000 size 0x800000 # ITE8181 video
hpcfb* at ite8181video?
vrc4172pwm* at vr4102ip? addr 0x15003880 size 0x6 platform NEC_MCR_430
@@ -452,6 +452,9 @@
ohci* at pci? dev ? function ? # Open Host Controller
#options OHCI_DEBUG, USB_DEBUG, UHUB_DEBUG
+# miscellaneous PCI devices
+mqvideo* at pci? dev ? function ? # MQ200 video
+
# PCMCIA bus support
pcmcia* at plumpcmcia? controller ? socket ?
pcmcia* at pcic? controller 0 socket ?
diff -r 132232b73478 -r 7cea245f5d17 sys/arch/hpcmips/conf/files.hpcmips
--- a/sys/arch/hpcmips/conf/files.hpcmips Sat May 11 12:23:53 2002 +0000
+++ b/sys/arch/hpcmips/conf/files.hpcmips Sat May 11 14:10:04 2002 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: files.hpcmips,v 1.84 2002/05/03 11:45:04 takemura Exp $
+# $NetBSD: files.hpcmips,v 1.85 2002/05/11 14:10:05 takemura Exp $
# maxpartitions must be first item in files.${ARCH}.
maxpartitions 8
@@ -178,7 +178,7 @@
file arch/hpcmips/dev/mq200machdep.c mqvideo
attach mqvideo at pci with mqvideo_pci
-file arch/hpcmips/pci/mq200_pci.c mqvideo_pci
+file arch/hpcmips/dev/mq200_pci.c mqvideo_pci
device ite8181video: hpcfbif, hpccmap
attach ite8181video at vripif with ite8181video_vrip
diff -r 132232b73478 -r 7cea245f5d17 sys/arch/hpcmips/dev/mq200_pci.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/hpcmips/dev/mq200_pci.c Sat May 11 14:10:04 2002 +0000
@@ -0,0 +1,117 @@
+/* $NetBSD: mq200_pci.c,v 1.1 2002/05/11 14:10:06 takemura Exp $ */
+
+/*-
+ * Copyright (c) 2002 TAKEMURA Shin
+ * 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.
+ * 3. 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 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.
+ *
+ */
+
+#include <sys/cdefs.h>
+__KERNEL_RCSID(0, "$NetBSD: mq200_pci.c,v 1.1 2002/05/11 14:10:06 takemura Exp $");
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/kernel.h>
+#include <sys/device.h>
+#include <sys/malloc.h>
+
+#include <dev/pci/pcireg.h>
+#include <dev/pci/pcivar.h>
+#include <dev/pci/pcidevs.h>
+#include <dev/pci/pciio.h>
+
+#include <hpcmips/dev/mq200var.h>
+
+struct mq200_pci_softc {
+ struct mq200_softc sc_mq200;
+ pci_chipset_tag_t sc_pc;
+ pcitag_t sc_pcitag;
+};
+
+int mq200_pci_match(struct device *, struct cfdata *, void *);
+void mq200_pci_attach(struct device *, struct device *, void *);
+
+struct cfattach mqvideo_pci_ca = {
+ sizeof(struct mq200_pci_softc),
+ mq200_pci_match,
+ mq200_pci_attach,
+};
+
+int
+mq200_pci_match(struct device *parent, struct cfdata *match, void *aux)
+{
+ struct pci_attach_args *pa = aux;
+
+ /* check vendor id and product id */
+ if (pa->pa_id !=
+ PCI_ID_CODE(PCI_VENDOR_MEDIAQ, PCI_PRODUCT_MEDIAQ_MQ200))
+ return (0);
+
+ return (1);
+}
+
+void
+mq200_pci_attach(struct device *parent, struct device *self, void *aux)
+{
+ struct mq200_pci_softc *psc = (void *) self;
+ struct mq200_softc *sc = &psc->sc_mq200;
+ struct pci_attach_args *pa = aux;
+// char devinfo[256];
+ int res;
+
+ psc->sc_pc = pa->pa_pc;
+ psc->sc_pcitag = pa->pa_tag;
+
+#if 0
+ pci_devinfo(pa->pa_id, pa->pa_class, 0, devinfo);
+ printf(": %s (rev. 0x%02x)\n", devinfo,
+ PCI_REVISION(pa->pa_class));
+#endif
+ /* check whether it is disabled by firmware */
+ if (!(pci_conf_read(pa->pa_pc, pa->pa_tag, PCI_COMMAND_STATUS_REG) &
+ PCI_COMMAND_MEM_ENABLE)) {
+ printf("%s: disabled\n", sc->sc_dev.dv_xname);
+ return;
+ }
+
+ /* Base Address Register 0: base address of control registers */
+ res = pci_mapreg_map(pa, PCI_MAPREG_START, PCI_MAPREG_TYPE_MEM,
+ 0, &sc->sc_iot, &sc->sc_ioh, NULL, NULL);
+ if (res != 0) {
+ printf("%s: can't map registers\n", sc->sc_dev.dv_xname);
+ return;
+ }
+
+ /* Base Address Register 1: base address of frame buffer */
+ res = pci_mapreg_info(psc->sc_pc, psc->sc_pcitag, PCI_MAPREG_START+4,
+ PCI_MAPREG_TYPE_MEM, &sc->sc_baseaddr, NULL, NULL);
+ if (res != 0) {
+ printf("%s: can't map frame buffer\n", sc->sc_dev.dv_xname);
+ return;
+ }
+
+ mq200_attach(sc);
+}
diff -r 132232b73478 -r 7cea245f5d17 sys/arch/hpcmips/dev/mq200reg.h
--- a/sys/arch/hpcmips/dev/mq200reg.h Sat May 11 12:23:53 2002 +0000
+++ b/sys/arch/hpcmips/dev/mq200reg.h Sat May 11 14:10:04 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: mq200reg.h,v 1.6 2001/03/25 13:06:53 takemura Exp $ */
+/* $NetBSD: mq200reg.h,v 1.7 2002/05/11 14:10:06 takemura Exp $ */
/*-
* Copyright (c) 2000, 2001 TAKEMURA Shin
@@ -43,17 +43,17 @@
#define MQ200_CLOCK_PLL2 2
#define MQ200_CLOCK_PLL3 3
-#define MQ200_FRAMEBUFFER 0x000000 /* frame buffer base address */
-#define MQ200_PM 0x600000 /* power management */
-#define MQ200_CC 0x602000 /* CPU interface */
-#define MQ200_MM 0x604000 /* memory interface unit */
-#define MQ200_IN 0x608000 /* interrupt controller */
-#define MQ200_GC(n) (0x60a000+0x80*(n))
-#define MQ200_GE 0x60c000 /* graphics engine */
-#define MQ200_FP 0x60e000 /* flat panel controller*/
-#define MQ200_CP1 0x610000 /* color palette 1 */
-#define MQ200_DC 0x614000 /* device configration */
-#define MQ200_PC 0x616000 /* PCI configration */
+#define MQ200_REGADDR 0x600000 /* register base address */
+#define MQ200_PM 0x000000 /* power management */
+#define MQ200_CC 0x002000 /* CPU interface */
+#define MQ200_MM 0x004000 /* memory interface unit */
+#define MQ200_IN 0x008000 /* interrupt controller */
+#define MQ200_GC(n) (0x00a000+0x80*(n))
+#define MQ200_GE 0x00c000 /* graphics engine */
+#define MQ200_FP 0x00e000 /* flat panel controller*/
+#define MQ200_CP1 0x010000 /* color palette 1 */
+#define MQ200_DC 0x014000 /* device configration */
+#define MQ200_PC 0x016000 /* PCI configration */
/*
* Power Management
diff -r 132232b73478 -r 7cea245f5d17 sys/arch/hpcmips/dev/mq200subr.c
--- a/sys/arch/hpcmips/dev/mq200subr.c Sat May 11 12:23:53 2002 +0000
+++ b/sys/arch/hpcmips/dev/mq200subr.c Sat May 11 14:10:04 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: mq200subr.c,v 1.1 2001/03/25 13:06:53 takemura Exp $ */
+/* $NetBSD: mq200subr.c,v 1.2 2002/05/11 14:10:06 takemura Exp $ */
/*-
* Copyright (c) 2001 TAKEMURA Shin
@@ -193,8 +193,9 @@
for (i = 0; i < sizeof(offsets)/sizeof(*offsets); i++) {
if (offsets[i] == 0)
#ifdef MQ200_DEBUG
- panic("%s(%d): register context %d is empty\n",
- __FILE__, __LINE__, i);
+ if (i != MQ200_I_PMC)
+ panic("%s(%d): register context %d is empty\n",
+ __FILE__, __LINE__, i);
#endif
sc->sc_regctxs[i].offset = offsets[i];
}
diff -r 132232b73478 -r 7cea245f5d17 sys/arch/hpcmips/vr/mq200_vrip.c
--- a/sys/arch/hpcmips/vr/mq200_vrip.c Sat May 11 12:23:53 2002 +0000
+++ b/sys/arch/hpcmips/vr/mq200_vrip.c Sat May 11 14:10:04 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: mq200_vrip.c,v 1.6 2002/01/27 14:18:12 takemura Exp $ */
+/* $NetBSD: mq200_vrip.c,v 1.7 2002/05/11 14:10:06 takemura Exp $ */
/*-
* Copyright (c) 2000 Takemura Shin
@@ -39,6 +39,7 @@
#include <hpcmips/vr/vrcpudef.h>
#include <hpcmips/vr/vripif.h>
#include <hpcmips/dev/mq200var.h>
+#include <hpcmips/dev/mq200reg.h>
#include "bivideo.h"
#if NBIVIDEO > 0
#include <dev/hpc/bivideovar.h>
@@ -93,8 +94,8 @@
sc->sc_baseaddr = va->va_addr;
sc->sc_iot = va->va_iot;
- if (bus_space_map(va->va_iot, va->va_addr, va->va_size, 0,
- &sc->sc_ioh)) {
+ if (bus_space_map(va->va_iot, va->va_addr + MQ200_REGADDR,
+ va->va_size - MQ200_REGADDR, 0, &sc->sc_ioh)) {
printf(": can't map bus space\n");
return;
}
Home |
Main Index |
Thread Index |
Old Index