Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/hpcmips Experimental MQ200 video driver. It's just ...
details: https://anonhg.NetBSD.org/src/rev/f206b307f62d
branches: trunk
changeset: 495123:f206b307f62d
user: takemura <takemura%NetBSD.org@localhost>
date: Sat Jul 22 08:53:33 2000 +0000
description:
Experimental MQ200 video driver. It's just copy of bivideo plus power
management routine.
diffstat:
sys/arch/hpcmips/conf/GENERIC | 7 +-
sys/arch/hpcmips/conf/files.hpcmips | 7 +-
sys/arch/hpcmips/dev/bivideo.c | 12 +-
sys/arch/hpcmips/dev/bivideovar.h | 30 ++
sys/arch/hpcmips/dev/hpcapm.c | 30 +-
sys/arch/hpcmips/dev/mq200.c | 437 +++++++++++++++++++++++++++++++++
sys/arch/hpcmips/dev/mq200reg.h | 57 ++++
sys/arch/hpcmips/dev/mq200var.h | 54 ++++
sys/arch/hpcmips/hpcmips/mainbus.c | 4 +-
sys/arch/hpcmips/include/config_hook.h | 8 +-
sys/arch/hpcmips/vr/mq200_vrip.c | 100 +++++++
11 files changed, 724 insertions(+), 22 deletions(-)
diffs (truncated from 916 to 300 lines):
diff -r 3af4597c447f -r f206b307f62d sys/arch/hpcmips/conf/GENERIC
--- a/sys/arch/hpcmips/conf/GENERIC Sat Jul 22 08:26:00 2000 +0000
+++ b/sys/arch/hpcmips/conf/GENERIC Sat Jul 22 08:53:33 2000 +0000
@@ -2,11 +2,11 @@
# Distribution kernel (NEC VR based model) kernel config file
#
-# $NetBSD: GENERIC,v 1.58 2000/07/20 21:03:36 jeffs Exp $
+# $NetBSD: GENERIC,v 1.59 2000/07/22 08:53:33 takemura Exp $
#
include "arch/hpcmips/conf/std.hpcmips"
-#ident "GENERIC-$Revision: 1.58 $"
+#ident "GENERIC-$Revision: 1.59 $"
maxusers 8
@@ -115,6 +115,9 @@
vrdsu* at vrip? addr 0x0b0000e0 size 0x08
vrpiu* at vrip? addr 0x0b000120 size 0x1a0 intr 5
+#mqvideo0 at vrip? addr 0x0a000000 size 0x800000 # MQ200 video controller
+#hpcfb* at mqvideo?
+
# Workstation Console attachments
bivideo0 at mainbus0
hpcfb* at bivideo0
diff -r 3af4597c447f -r f206b307f62d sys/arch/hpcmips/conf/files.hpcmips
--- a/sys/arch/hpcmips/conf/files.hpcmips Sat Jul 22 08:26:00 2000 +0000
+++ b/sys/arch/hpcmips/conf/files.hpcmips Sat Jul 22 08:53:33 2000 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: files.hpcmips,v 1.34 2000/07/02 10:01:30 takemura Exp $
+# $NetBSD: files.hpcmips,v 1.35 2000/07/22 08:53:34 takemura Exp $
# maxpartitions must be first item in files.${ARCH}.
maxpartitions 8
@@ -174,6 +174,11 @@
attach ohci at vrip with ohci_vrip
file arch/hpcmips/dev/ohci_vrip.c ohci_vrip
+device mqvideo: hpcfbif
+attach mqvideo at vrip with mqvideo_vrip
+file arch/hpcmips/vr/mq200_vrip.c mqvideo_vrip
+file arch/hpcmips/dev/mq200.c mqvideo
+
#
# TOSHIBA TX3912/3922
#
diff -r 3af4597c447f -r f206b307f62d sys/arch/hpcmips/dev/bivideo.c
--- a/sys/arch/hpcmips/dev/bivideo.c Sat Jul 22 08:26:00 2000 +0000
+++ b/sys/arch/hpcmips/dev/bivideo.c Sat Jul 22 08:53:33 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: bivideo.c,v 1.9 2000/07/02 10:01:31 takemura Exp $ */
+/* $NetBSD: bivideo.c,v 1.10 2000/07/22 08:53:35 takemura Exp $ */
/*-
* Copyright (c) 1999
@@ -37,7 +37,7 @@
static const char _copyright[] __attribute__ ((unused)) =
"Copyright (c) 1999 Shin Takemura. All rights reserved.";
static const char _rcsid[] __attribute__ ((unused)) =
- "$Id: bivideo.c,v 1.9 2000/07/02 10:01:31 takemura Exp $";
+ "$Id: bivideo.c,v 1.10 2000/07/22 08:53:35 takemura Exp $";
#include <sys/param.h>
#include <sys/systm.h>
@@ -68,6 +68,11 @@
#include <arch/hpcmips/dev/hpccmapvar.h>
/*
+ * global variables
+ */
+int bivideo_dont_attach = 0;
+
+/*
* function prototypes
*/
int bivideomatch __P((struct device *, struct cfdata *, void *));
@@ -109,7 +114,8 @@
{
struct mainbus_attach_args *ma = aux;
- if (strcmp(ma->ma_name, match->cf_driver->cd_name))
+ if (bivideo_dont_attach ||
+ strcmp(ma->ma_name, match->cf_driver->cd_name))
return 0;
return (1);
diff -r 3af4597c447f -r f206b307f62d sys/arch/hpcmips/dev/bivideovar.h
--- a/sys/arch/hpcmips/dev/bivideovar.h Sat Jul 22 08:26:00 2000 +0000
+++ b/sys/arch/hpcmips/dev/bivideovar.h Sat Jul 22 08:53:33 2000 +0000
@@ -1,1 +1,31 @@
+/* $NetBSD: bivideovar.h,v 1.2 2000/07/22 08:53:35 takemura Exp $ */
+
+/*
+ * Copyright (c) 2000 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.
+ *
+ * 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.
+ *
+ */
+
+extern int bivideo_dont_attach;
int bivideo_getcnfb __P((struct hpcfb_fbconf* fb));
diff -r 3af4597c447f -r f206b307f62d sys/arch/hpcmips/dev/hpcapm.c
--- a/sys/arch/hpcmips/dev/hpcapm.c Sat Jul 22 08:26:00 2000 +0000
+++ b/sys/arch/hpcmips/dev/hpcapm.c Sat Jul 22 08:53:33 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: hpcapm.c,v 1.1 2000/07/02 10:01:31 takemura Exp $ */
+/* $NetBSD: hpcapm.c,v 1.2 2000/07/22 08:53:35 takemura Exp $ */
/*
* Copyright (c) 2000 Takemura Shin
@@ -79,8 +79,8 @@
struct apmhpc_softc {
struct device sc_dev;
void *sc_apmdev;
- unsigned int events;
- int power_state;
+ volatile unsigned int events;
+ volatile int power_state;
config_hook_tag sc_standby_hook;
config_hook_tag sc_suspend_hook;
};
@@ -157,22 +157,18 @@
s = splhigh();
switch (id) {
case CONFIG_HOOK_PMEVENT_STANDBYREQ:
- if (sc->power_state == APM_SYS_STANDBY) {
- sc->power_state = APM_SYS_READY;
+ if (sc->power_state != APM_SYS_STANDBY) {
+ sc->events |= (1 << APM_USER_STANDBY_REQ);
+ } else {
sc->events |= (1 << APM_NORMAL_RESUME);
- } else {
- DPRINTF(("hpcapm: standby req\n"));
- sc->events |= (1 << APM_USER_STANDBY_REQ);
}
break;
case CONFIG_HOOK_PMEVENT_SUSPENDREQ:
- if (sc->power_state == APM_SYS_SUSPEND) {
- sc->power_state = APM_SYS_READY;
- DPRINTF(("hpcapm: resume\n"));
- sc->events |= (1 << APM_NORMAL_RESUME);
- } else {
+ if (sc->power_state != APM_SYS_SUSPEND) {
DPRINTF(("hpcapm: suspend req\n"));
sc->events |= (1 << APM_USER_SUSPEND_REQ);
+ } else {
+ sc->events |= (1 << APM_NORMAL_RESUME);
}
break;
}
@@ -225,6 +221,9 @@
case APM_SYS_SUSPEND:
DPRINTF(("hpcapm: set power state SUSPEND...\n"));
s = splhigh();
+ config_hook_call(CONFIG_HOOK_PMEVENT,
+ CONFIG_HOOK_PMEVENT_HARDPOWER,
+ (void *)PWR_SUSPEND);
sc->power_state = APM_SYS_SUSPEND;
#if NVRIP > 0
if (platid_match(&platid, &platid_mask_CPU_MIPS_VR_41XX)) {
@@ -252,6 +251,10 @@
vrip_intr_resume();
}
#endif
+ config_hook_call(CONFIG_HOOK_PMEVENT,
+ CONFIG_HOOK_PMEVENT_HARDPOWER,
+ (void *)PWR_RESUME);
+ DPRINTF(("hpcapm: resume\n"));
splx(s);
break;
case APM_SYS_OFF:
@@ -303,6 +306,7 @@
*event_type == APM_CRIT_RESUME) {
/* pccard power off in the suspend state */
*event_info = 1;
+ sc->power_state = APM_SYS_READY;
} else
*event_info = 0;
return (0);
diff -r 3af4597c447f -r f206b307f62d sys/arch/hpcmips/dev/mq200.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/hpcmips/dev/mq200.c Sat Jul 22 08:53:33 2000 +0000
@@ -0,0 +1,437 @@
+/* $NetBSD: mq200.c,v 1.1 2000/07/22 08:53:36 takemura Exp $ */
+
+/*-
+ * Copyright (c) 2000 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/param.h>
+#include <sys/kernel.h>
+#include <sys/device.h>
+#include <sys/systm.h>
+
+#include <uvm/uvm_extern.h>
+
+#include <dev/wscons/wsconsio.h>
+
+#include <machine/bootinfo.h>
+#include <machine/bus.h>
+#include <machine/autoconf.h>
+#include <machine/config_hook.h>
+#include <machine/platid.h>
+#include <machine/platid_mask.h>
+
+#include <hpcmips/dev/mq200reg.h>
+#include <hpcmips/dev/mq200var.h>
+#include <hpcmips/dev/bivideovar.h>
+
+#define MQ200DEBUG
+#ifdef MQ200DEBUG
+#ifndef MQ200DEBUG_CONF
+#define MQ200DEBUG_CONF 1
+#endif
+int mq200_debug = MQ200DEBUG_CONF;
+#define DPRINTF(arg) do { if (mq200_debug) printf arg; } while(0);
+#define DPRINTFN(n, arg) do { if (mq200_debug > (n)) printf arg; } while (0);
+#else
+#define DPRINTF(arg) do { } while (0);
+#define DPRINTFN(n, arg) do { } while (0);
+#endif
+
+/*
+ * function prototypes
+ */
+static void mq200_power __P((int, void *));
+static int mq200_hardpower __P((void *, int, long, void *));
+static int mq200_fbinit __P((struct hpcfb_fbconf *));
+static int mq200_ioctl __P((void *, u_long, caddr_t, int, struct proc *));
+static paddr_t mq200_mmap __P((void *, off_t offset, int));
+
+/*
+ * static variables
+ */
+struct hpcfb_accessops mq200_ha = {
+ mq200_ioctl, mq200_mmap
+};
+
+int
+mq200_probe(iot, ioh)
+ bus_space_tag_t iot;
+ bus_space_handle_t ioh;
+{
+ unsigned long regval;
+
+ regval = bus_space_read_4(iot, ioh, MQ200_PC00R);
+ DPRINTF(("mq200 probe: vendor id=%04lx product id=%04lx\n",
+ regval & 0xffff, (regval >> 16) & 0xffff));
+ if (regval != ((MQ200_PRODUCT_ID << 16) | MQ200_VENDOR_ID))
+ return (0);
+
+ return (1);
+}
Home |
Main Index |
Thread Index |
Old Index