Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/hp300/stand Add sti(4) at sgc screen console suppor...
details: https://anonhg.NetBSD.org/src/rev/e939c83fd704
branches: trunk
changeset: 328685:e939c83fd704
user: tsutsui <tsutsui%NetBSD.org@localhost>
date: Sun Apr 13 15:45:26 2014 +0000
description:
Add sti(4) at sgc screen console support. From (the late) OpenBSD/hp300.
Tested on HP9000/425e, which was sent from Miod Vallat and
demonstrated at Open Source unConference 2014 Kagawa.
diffstat:
sys/arch/hp300/stand/Makefile.buildboot | 3 +-
sys/arch/hp300/stand/common/ite.c | 57 ++++-
sys/arch/hp300/stand/common/ite_sti.c | 365 ++++++++++++++++++++++++++++++++
sys/arch/hp300/stand/common/itevar.h | 10 +-
4 files changed, 431 insertions(+), 4 deletions(-)
diffs (truncated from 516 to 300 lines):
diff -r 8a6766a30cec -r e939c83fd704 sys/arch/hp300/stand/Makefile.buildboot
--- a/sys/arch/hp300/stand/Makefile.buildboot Sun Apr 13 15:43:26 2014 +0000
+++ b/sys/arch/hp300/stand/Makefile.buildboot Sun Apr 13 15:45:26 2014 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile.buildboot,v 1.33 2014/01/12 15:26:29 tsutsui Exp $
+# $NetBSD: Makefile.buildboot,v 1.34 2014/04/13 15:45:26 tsutsui Exp $
# RELOC=FFF00000 allows for boot prog up to FF000 (1044480) bytes long
RELOC= FFF00000
@@ -59,6 +59,7 @@
DRIVERSOURCE= apci.c ct.c dca.c dcm.c dnkbd.c fhpib.c hil.c \
hpib.c if_le.c ite.c ite_dumb.c ite_dv.c ite_gb.c \
ite_hy.c ite_rb.c ite_subr.c ite_tc.c ite_tvrx.c \
+ ite_sti.c \
kbd.c kbdconf.c nhpib.c rd.c scsi.c sd.c
.include <bsd.own.mk>
diff -r 8a6766a30cec -r e939c83fd704 sys/arch/hp300/stand/common/ite.c
--- a/sys/arch/hp300/stand/common/ite.c Sun Apr 13 15:43:26 2014 +0000
+++ b/sys/arch/hp300/stand/common/ite.c Sun Apr 13 15:45:26 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ite.c,v 1.16 2011/02/12 05:08:40 tsutsui Exp $ */
+/* $NetBSD: ite.c,v 1.17 2014/04/13 15:45:27 tsutsui Exp $ */
/*
* Copyright (c) 1988 University of Utah.
@@ -49,6 +49,8 @@
#include <hp300/stand/common/grfreg.h>
#include <hp300/dev/intioreg.h>
+#include <hp300/dev/sgcreg.h>
+#include <dev/ic/stireg.h>
#include <hp300/stand/common/device.h>
#include <hp300/stand/common/itevar.h>
@@ -60,6 +62,8 @@
static void ite_clrtoeol(struct ite_data *, struct itesw *, int, int);
static void itecheckwrap(struct ite_data *, struct itesw *);
+#define GID_STI 0x100 /* any value which is not a DIO fb, really */
+
struct itesw itesw[] = {
{ GID_TOPCAT,
topcat_init, ite_dio_clear, ite_dio_putc8bpp,
@@ -104,6 +108,10 @@
{ GID_A147xVGA,
dumb_init, dumb_clear, dumb_putc,
dumb_cursor, dumb_scroll },
+
+ { GID_STI,
+ sti_iteinit_sgc, sti_clear, sti_putc,
+ sti_cursor, sti_scroll },
};
int nitesw = sizeof(itesw) / sizeof(itesw[0]);
@@ -118,7 +126,8 @@
static void
iteconfig(void)
{
- int dtype, fboff, i;
+ int dtype, fboff, slotno, i;
+ uint8_t *va;
struct hp_hw *hw;
struct grfreg *gr;
struct ite_data *ip;
@@ -165,6 +174,50 @@
ip->alive = 1;
i++;
}
+
+ /*
+ * Now probe for SGC frame buffers.
+ */
+ switch (machineid) {
+ case HP_400:
+ case HP_425:
+ case HP_433:
+ break;
+ default:
+ return;
+ }
+
+ /* SGC frame buffers can only be STI... */
+ for (dtype = 0; dtype < __arraycount(itesw); dtype++) {
+ if (itesw[dtype].ite_hwid == GID_STI)
+ break;
+ }
+ if (dtype == __arraycount(itesw))
+ return;
+
+ for (slotno = 0; slotno < SGC_NSLOTS; slotno++) {
+ va = (uint8_t *)IIOV(SGC_BASE + (slotno * SGC_DEVSIZE));
+
+ /* Check to see if hardware exists. */
+ if (badaddr(va) != 0)
+ continue;
+
+ /* Check hardware. */
+ if (va[3] == STI_DEVTYPE1) {
+ if (i >= NITE)
+ break;
+ ip = &ite_data[i];
+ ip->scode = slotno;
+ ip->isw = &itesw[dtype];
+ /* to get CN_MIDPRI */
+ ip->regbase = (uint8_t *)(INTIOBASE + FB_BASE);
+ /* ...and do not need an ite_probe() check */
+ ip->alive = 1;
+ i++;
+ /* we only support one SGC frame buffer at the moment */
+ break;
+ }
+ }
}
#ifdef CONSDEBUG
diff -r 8a6766a30cec -r e939c83fd704 sys/arch/hp300/stand/common/ite_sti.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/hp300/stand/common/ite_sti.c Sun Apr 13 15:45:26 2014 +0000
@@ -0,0 +1,365 @@
+/* $NetBSD: ite_sti.c,v 1.1 2014/04/13 15:45:27 tsutsui Exp $ */
+/* $OpenBSD: ite_sti.c,v 1.2 2011/08/18 20:02:58 miod Exp $ */
+/*
+ * Copyright (c) 2006, 2011, Miodrag Vallat
+ * Copyright (c) 2000-2003 Michael Shalayeff
+ * 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 AUTHOR ``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 HIS RELATIVES 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 MIND, 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.
+ */
+
+#ifdef ITECONSOLE
+#include <sys/param.h>
+
+#include <lib/libsa/stand.h>
+
+#include <hp300/stand/common/samachdep.h>
+#include <hp300/stand/common/itevar.h>
+
+#if 0
+#include <hp300/dev/dioreg.h>
+#endif
+#include <hp300/dev/sgcreg.h>
+#include <dev/ic/stireg.h>
+
+/*
+ * sti-specific data not available in the ite_data structure.
+ * Since we will only configure one sti display, it is ok to use a global.
+ */
+static struct {
+ uint32_t codeptr[STI_CODECNT];
+ uint8_t *code;
+ uint32_t fontbase;
+ u_int firstchar, lastchar;
+ struct sti_cfg cfg;
+ struct sti_ecfg ecfg;
+} sti;
+
+#define parseshort1(addr, ofs) \
+ (((addr)[(ofs) + 3] << 8) | ((addr)[(ofs) + 7]))
+#define parseword1(addr, ofs) \
+ (((addr)[(ofs) + 3] << 24) | ((addr)[(ofs) + 7] << 16) | \
+ ((addr)[(ofs) + 11] << 8) | ((addr)[(ofs) + 15]))
+
+void sti_do_cursor(struct ite_data *);
+void sti_fontinfo(struct ite_data *);
+void sti_init(int);
+void sti_inqcfg(struct sti_inqconfout *);
+void sti_iteinit_common(struct ite_data *);
+
+#if 0 /* not yet */
+/* kinda similar to sti_dio_probe() */
+int
+sti_dio_probe(struct ite_data *ip)
+{
+ int scode = ip->scode;
+ uint8_t *id_reg;
+
+ id_reg = (uint8_t *)sctoaddr(scode);
+ if (id_reg[DIOII_SIZEOFF] < STI_DIO_SIZE - 1)
+ return ENODEV;
+
+ id_reg = (uint8_t *)sctoaddr(scode + STI_DIO_SCODE_OFFSET);
+ if (id_reg[3] != STI_DEVTYPE1)
+ return ENODEV;
+
+ return 0;
+}
+
+void
+sti_iteinit_dio(struct ite_data *ip)
+{
+
+ ip->fbbase = (caddr_t)sctoaddr(ip->scode + STI_DIO_SCODE_OFFSET);
+ sti_iteinit_common(ip);
+}
+#endif
+
+void
+sti_iteinit_sgc(struct ite_data *ip)
+{
+
+ ip->fbbase = (uint8_t *)IIOV(SGC_BASE + (ip->scode * SGC_DEVSIZE));
+ sti_iteinit_common(ip);
+}
+
+/*
+ * Initialize the sti device for ite's needs.
+ * We don't bother to check for failures since
+ * - we are in tight space already
+ * - since romputchar() does not work with sti devices, there is no way we
+ * can report errors (although we could switch to serial...)
+ */
+void
+sti_iteinit_common(struct ite_data *ip)
+{
+ int i;
+ size_t codesize, memsize;
+ uint8_t *va, *code;
+ u_int addr, eaddr, reglist, tmp;
+ struct sti_inqconfout cfg;
+ struct sti_einqconfout ecfg;
+
+ memset(&sti, 0, sizeof sti);
+ va = (uint8_t *)ip->fbbase;
+
+ /*
+ * Read the microcode.
+ */
+
+ for (i = 0; i < STI_CODECNT; i++)
+ sti.codeptr[i] =
+ parseword1(va, (STI_CODEBASE_M68K << 2) + i * 0x10);
+
+ for (i = STI_END; sti.codeptr[i] == 0; i--)
+ continue;
+ codesize = sti.codeptr[i] - sti.codeptr[STI_BEGIN];
+ codesize = (codesize + 3) / 4;
+
+ sti.code = (uint8_t *)alloc(codesize);
+ code = sti.code;
+ addr = (u_int)va + sti.codeptr[STI_BEGIN];
+ eaddr = addr + codesize * 4;
+ for (; addr < eaddr; addr += 4)
+ *code++ = *(uint8_t *)addr;
+
+ for (i = STI_CODECNT - 1; i != 0; i--)
+ if (sti.codeptr[i] != 0) {
+ sti.codeptr[i] -= sti.codeptr[0];
+ sti.codeptr[i] /= 4;
+ }
+
+ sti.codeptr[0] = 0;
+ for (i = STI_END; sti.codeptr[i] == 0; i--);
+ sti.codeptr[i] = 0;
+
+ /*
+ * Read the regions list.
+ */
+
+ reglist = parseword1(va, 0x60);
+ for (i = 0; i < STI_REGION_MAX; i++) {
+ tmp = parseword1(va, (reglist & ~3) + i * 0x10);
+ sti.cfg.regions[i] = (u_int)va + ((tmp >> 18) << 12);
+ if (tmp & 0x4000)
+ break;
+ }
+
+ /*
+ * Allocate scratch memory for the microcode if it needs it.
+ */
+
+ sti.cfg.ext_cfg = &sti.ecfg;
+ memsize = parseword1(va, 0xa0);
+ if (memsize != 0)
+ sti.ecfg.addr = alloc(memsize);
+
+ /*
+ * Initialize the display, and get geometry information.
+ */
+
+ sti_init(0);
Home |
Main Index |
Thread Index |
Old Index