diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2011-08-18 20:02:59 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2011-08-18 20:02:59 +0000 |
commit | d8a6b2508d19a028506f1028b66d6c2162f5b865 (patch) | |
tree | e7bea31207a9a2c323968f95a4b8ecec9206b9fb /sys/arch/hp300 | |
parent | 10bf584eedef89396c2517839d033fced9385366 (diff) |
So, it turns out that models 362 and 382 built-in frame buffer only shows up
in DIO-II space, as a fat device spanning four select codes (i.e. 16MB of
memory). This is way too much for an at-most 2 Mpixel 8bit frame buffer, and
it turns out that this is because the device provides both a regular DIO-II
frame buffer (spanning two select codes) and a regular STI frame buffer
(spanning the other two select codes).
This commit introduces a straightforward sti@dio attachment to get a working
sti(4) and wsdisplay(4) in a ridiculously small number of lines; however
the console code needs some changes to avoid duplicating globals.
While there, add sti@dio support for the bootblocks, and I couldn't help
myself but clean the most rotten parts of them, and try to have them reuse
various files in sys/arch/hp300/dev instead of rolling their outdated ones.
Tested on a real 382 with the low-resolution frame buffer:
sti0 at dio0 scode 132: rev 8.02;129, ID 0x27134CB440A00499
sti0: 382V, 2048x512 frame buffer, 640x480x8 display
sti0: 8x16 font type 1, 16 bpc, charset 0-255
wsdisplay0 at sti0 mux 1: console (std, vt100 emulation)
Boot blocks updates tested on DIO-II 425t (serial/glass console), SGC 425e
(serial/glass console) and 382 (serial/glass console). And will be tested
on SGC 425t soon as well.
Diffstat (limited to 'sys/arch/hp300')
29 files changed, 584 insertions, 432 deletions
diff --git a/sys/arch/hp300/conf/files.hp300 b/sys/arch/hp300/conf/files.hp300 index 68ad296b964..de89cc0fec4 100644 --- a/sys/arch/hp300/conf/files.hp300 +++ b/sys/arch/hp300/conf/files.hp300 @@ -1,4 +1,4 @@ -# $OpenBSD: files.hp300,v 1.33 2010/06/29 20:30:32 guenther Exp $ +# $OpenBSD: files.hp300,v 1.34 2011/08/18 20:02:57 miod Exp $ # $NetBSD: files.hp300,v 1.28 1997/05/12 08:23:28 thorpej Exp $ # # hp300-specific configuration info @@ -69,6 +69,8 @@ file arch/hp300/hp300/wscons_machdep.c wsdisplay # # Frame buffer devices # +file arch/hp300/dev/sti_machdep.c sti + define diofb define diofb_mono file arch/hp300/dev/diofb.c diofb | diofb_mono @@ -93,6 +95,9 @@ attach rbox at intio with rbox_intio attach rbox at dio with rbox_dio file arch/hp300/dev/rbox.c rbox needs-flag +attach sti at dio with sti_dio +file arch/hp300/dev/sti_dio.c sti_dio + device topcat: wsemuldisplaydev, diofb, rasops8 attach topcat at intio with topcat_intio attach topcat at dio with topcat_dio diff --git a/sys/arch/hp300/dev/dio.c b/sys/arch/hp300/dev/dio.c index 89a38c94df9..b419537945f 100644 --- a/sys/arch/hp300/dev/dio.c +++ b/sys/arch/hp300/dev/dio.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dio.c,v 1.15 2011/08/18 19:52:08 miod Exp $ */ +/* $OpenBSD: dio.c,v 1.16 2011/08/18 20:02:57 miod Exp $ */ /* $NetBSD: dio.c,v 1.7 1997/05/05 21:00:32 thorpej Exp $ */ /*- @@ -110,10 +110,13 @@ dioattach(parent, self, aux) * Temporarily map the space corresponding to * the current select code unless: * - this is the internal hpib select code, - * - this is the console select code. + * - this is the console select code, and + * the console driver actually has a mapping + * of the beginning of the select code space + * (sti@dio doesn't). */ pa = dio_scodetopa(scode); - if (scode == conscode) + if (scode == conscode && conaddr != 0) va = conaddr; else if ((scode == 7) && internalhpib) va = internalhpib = (caddr_t)IIOV(pa); diff --git a/sys/arch/hp300/dev/diodevs b/sys/arch/hp300/dev/diodevs index f09af60a7e2..def0f9d106b 100644 --- a/sys/arch/hp300/dev/diodevs +++ b/sys/arch/hp300/dev/diodevs @@ -1,4 +1,4 @@ -$OpenBSD: diodevs,v 1.9 2008/06/26 05:42:10 ray Exp $ +$OpenBSD: diodevs,v 1.10 2011/08/18 20:02:57 miod Exp $ /* $NetBSD: diodevs,v 1.7 2003/11/23 01:57:35 tsutsui Exp $ */ /*- @@ -68,15 +68,15 @@ framebuffer HRCCATSEYE 0x06 1 high-res color catseye display framebuffer HRMCATSEYE 0x07 1 high-res mono catseye display framebuffer DAVINCI 0x08 2 98730/98731 (\"davinci\") display framebuffer XXXCATSEYE 0x09 1 catseye display +framebuffer TIGERSHARK 0x0c 3 TurboVRX (\"tigershark\") display framebuffer HYPERION 0x0e 1 A1096A (\"hyperion\") display +framebuffer FB3X2_A 0x10 4 362/382 internal display #1 +framebuffer FB3X2_B 0x11 4 362/382 internal display #2 /* Unsupported framebuffers. */ framebuffer XGENESIS 0x0b 1 x-genesis display -framebuffer TIGERSHARK 0x0c 3 TurboVRX (\"tigershark\") display framebuffer YGENESIS 0x0d 1 y-genesis display -framebuffer FB3X2_A 0x10 4 362/382 internal display #1 -framebuffer FB3X2_B 0x11 4 362/382 internal display #2 /* Devices not yet supported. Descriptions are lacking. */ diff --git a/sys/arch/hp300/dev/diofbreg.h b/sys/arch/hp300/dev/diofbreg.h index 386def50b2a..3df02c729e6 100644 --- a/sys/arch/hp300/dev/diofbreg.h +++ b/sys/arch/hp300/dev/diofbreg.h @@ -1,4 +1,4 @@ -/* $OpenBSD: diofbreg.h,v 1.3 2007/01/07 15:13:52 miod Exp $ */ +/* $OpenBSD: diofbreg.h,v 1.4 2011/08/18 20:02:57 miod Exp $ */ /* * Copyright (c) 1988 University of Utah. @@ -44,19 +44,21 @@ /* 300 internal bitmapped display address */ #define GRFIADDR 0x560000 -/* 300 hardware secondary ids */ -#define GID_GATORBOX 1 -#define GID_TOPCAT 2 -#define GID_RENAISSANCE 4 -#define GID_LRCATSEYE 5 -#define GID_HRCCATSEYE 6 -#define GID_HRMCATSEYE 7 -#define GID_DAVINCI 8 -#define GID_XXXCATSEYE 9 -#define GID_XGENESIS 11 -#define GID_TIGER 12 -#define GID_YGENESIS 13 -#define GID_HYPERION 14 +/* 300 hardware secondary ids - XXX duplicates some diodevs.h values */ +#define GID_GATORBOX 0x01 +#define GID_TOPCAT 0x02 +#define GID_RENAISSANCE 0x04 +#define GID_LRCATSEYE 0x05 +#define GID_HRCCATSEYE 0x06 +#define GID_HRMCATSEYE 0x07 +#define GID_DAVINCI 0x08 +#define GID_XXXCATSEYE 0x09 +#define GID_XGENESIS 0x0b +#define GID_TIGER 0x0c +#define GID_YGENESIS 0x0d +#define GID_HYPERION 0x0e +#define GID_FB3X2_A 0x10 +#define GID_FB3X2_B 0x11 #ifndef _LOCORE struct diofbreg { diff --git a/sys/arch/hp300/dev/sti_dio.c b/sys/arch/hp300/dev/sti_dio.c new file mode 100644 index 00000000000..c2204b6275c --- /dev/null +++ b/sys/arch/hp300/dev/sti_dio.c @@ -0,0 +1,176 @@ +/* $OpenBSD: sti_dio.c,v 1.1 2011/08/18 20:02:57 miod Exp $ */ + +/* + * Copyright (c) 2005, 2011, Miodrag Vallat + * + * 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 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/systm.h> +#include <sys/conf.h> +#include <sys/device.h> + +#include <machine/autoconf.h> +#include <machine/bus.h> +#include <machine/cpu.h> + +#include <hp300/dev/dioreg.h> +#include <hp300/dev/diovar.h> +#include <hp300/dev/diodevs.h> + +#include <dev/wscons/wsdisplayvar.h> +#include <dev/wscons/wsconsio.h> + +#include <dev/ic/stireg.h> +#include <dev/ic/stivar.h> +#include <hp300/dev/sti_machdep.h> + +#include <uvm/uvm_extern.h> + +void sti_dio_attach(struct device *, struct device *, void *); +int sti_dio_match(struct device *, void *, void *); + +struct cfattach sti_dio_ca = { + sizeof(struct sti_softc), sti_dio_match, sti_dio_attach +}; + +extern struct hp300_bus_space_tag hp300_mem_tag; + +int +sti_dio_match(struct device *parent, void *match, void *aux) +{ + struct dio_attach_args *da = aux; + + if (da->da_id != DIO_DEVICE_ID_FRAMEBUFFER || + (da->da_secid != DIO_DEVICE_SECID_FB3X2_A && + da->da_secid != DIO_DEVICE_SECID_FB3X2_B)) + return (0); + + /* + * If we already probed it successfully as a console device, go ahead, + * since we will not be able to bus_space_map() again. + */ + if (da->da_scode == conscode) + return (1); + + return (sti_dio_probe(da->da_scode)); +} + +void +sti_dio_attach(struct device *parent, struct device *self, void *aux) +{ + struct sti_softc *sc = (void *)self; + struct dio_attach_args *da = aux; + bus_addr_t base; + bus_space_tag_t iot; + bus_space_handle_t romh; + u_int romend; + int i; + + /* + * If we already probed it successfully as a console device, go ahead, + * since we will not be able to bus_space_map() again. + */ + if (da->da_scode == conscode) { + sc->sc_flags |= STI_CONSOLE | STI_ATTACHED; + sc->sc_rom = &sticn_rom; + sc->sc_scr = &sticn_scr; + bcopy(sticn_bases, sc->bases, sizeof(sc->bases)); + + sti_describe(sc); + } else { + base = (bus_addr_t) + dio_scodetopa(da->da_scode + STI_DIO_SCODE_OFFSET); + iot = &hp300_mem_tag; + + if (bus_space_map(iot, base, PAGE_SIZE, 0, &romh)) { + printf(": can't map frame buffer"); + return; + } + + /* + * Compute real PROM size + */ + romend = sti_rom_size(iot, romh); + + bus_space_unmap(iot, romh, PAGE_SIZE); + + if (bus_space_map(iot, base, romend, 0, &romh)) { + printf(": can't map frame buffer"); + return; + } + + sc->bases[0] = romh; + for (i = 1; i < STI_REGION_MAX; i++) + sc->bases[i] = base; + + if (sti_attach_common(sc, iot, iot, romh, + STI_CODEBASE_M68K) != 0) + return; + } + + sti_end_attach(sc); +} + +int +sti_dio_probe(int scode) +{ + bus_space_tag_t iot; + bus_space_handle_t ioh; + int devtype; + uint span; + + iot = &hp300_mem_tag; + + /* + * Sanity checks: + * these devices provide both a DIO and an STI ROM. We expect the + * DIO ROM to be a DIO-II ROM (i.e. to be at a DIO-II select code) + * and report the device as spanning at least four select codes. + */ + + if (!DIO_ISDIOII(scode)) + return 0; + + if (bus_space_map(iot, (bus_addr_t)dio_scodetopa(scode), + PAGE_SIZE, 0, &ioh)) + return 0; + span = bus_space_read_1(iot, ioh, DIOII_SIZEOFF); + bus_space_unmap(iot, ioh, PAGE_SIZE); + + if (span < STI_DIO_SIZE - 1) + return 0; + + if (bus_space_map(iot, + (bus_addr_t)dio_scodetopa(scode + STI_DIO_SCODE_OFFSET), + PAGE_SIZE, 0, &ioh)) + return 0; + devtype = bus_space_read_1(iot, ioh, 3); + bus_space_unmap(iot, ioh, PAGE_SIZE); + + if (devtype != STI_DEVTYPE1 && devtype != STI_DEVTYPE4) + return 0; + + return 1; +} diff --git a/sys/arch/hp300/dev/sti_machdep.c b/sys/arch/hp300/dev/sti_machdep.c new file mode 100644 index 00000000000..7f454f4b481 --- /dev/null +++ b/sys/arch/hp300/dev/sti_machdep.c @@ -0,0 +1,85 @@ +/* $OpenBSD: sti_machdep.c,v 1.1 2011/08/18 20:02:57 miod Exp $ */ + +/* + * Copyright (c) 2005, 2011, Miodrag Vallat + * + * 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 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/systm.h> +#include <sys/device.h> + +#include <machine/autoconf.h> +#include <machine/bus.h> + +#include <hp300/dev/diovar.h> +#include <hp300/dev/sgcvar.h> + +#include <dev/wscons/wsdisplayvar.h> +#include <dev/wscons/wsconsio.h> + +#include <dev/ic/stireg.h> +#include <dev/ic/stivar.h> +#include <hp300/dev/sti_machdep.h> + +extern struct hp300_bus_space_tag hp300_mem_tag; + +/* Console data */ +struct sti_rom sticn_rom; +struct sti_screen sticn_scr; +bus_addr_t sticn_bases[STI_REGION_MAX]; + +void +sticninit() +{ + bus_space_tag_t iot; + bus_addr_t base; + int i; + + /* + * We are not interested by the *first* console pass. + */ + if (consolepass == 0) + return; + + iot = &hp300_mem_tag; + if (conscode >= SGC_SLOT_TO_CONSCODE(0)) + base = (bus_addr_t)sgc_slottopa(CONSCODE_TO_SGC_SLOT(conscode)); + else + base = + (bus_addr_t)dio_scodetopa(conscode + STI_DIO_SCODE_OFFSET); + + /* sticn_bases[0] will be fixed in sti_cnattach() */ + for (i = 0; i < STI_REGION_MAX; i++) + sticn_bases[i] = base; + + sti_cnattach(&sticn_rom, &sticn_scr, iot, sticn_bases, + STI_CODEBASE_M68K); + + /* + * Since the copyright notice could not be displayed before, + * display it again now. + */ + printf("%s\n", copyright); +} diff --git a/sys/arch/hp300/dev/sti_machdep.h b/sys/arch/hp300/dev/sti_machdep.h new file mode 100644 index 00000000000..d1acf1e5df7 --- /dev/null +++ b/sys/arch/hp300/dev/sti_machdep.h @@ -0,0 +1,43 @@ +/* $OpenBSD: sti_machdep.h,v 1.1 2011/08/18 20:02:57 miod Exp $ */ + +/* + * Copyright (c) 2005, 2011, Miodrag Vallat + * + * 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 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. + * + */ + +#ifndef STANDALONE +/* Console data */ +extern struct sti_rom sticn_rom; +extern struct sti_screen sticn_scr; +extern bus_addr_t sticn_bases[STI_REGION_MAX]; + +void sticninit(void); +int sti_dio_probe(int); +int sti_sgc_probe(bus_space_tag_t, int); +#endif + +/* DIO attachment defines */ +#define STI_DIO_SCODE_OFFSET 0x02 /* offset to SGC rom, in select codes */ +#define STI_DIO_SIZE 0x10 /* expected total device size + in DIO-II size units */ diff --git a/sys/arch/hp300/dev/sti_sgc.c b/sys/arch/hp300/dev/sti_sgc.c index 089dde3b9a4..2bfbba78dda 100644 --- a/sys/arch/hp300/dev/sti_sgc.c +++ b/sys/arch/hp300/dev/sti_sgc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sti_sgc.c,v 1.15 2009/02/06 22:51:03 miod Exp $ */ +/* $OpenBSD: sti_sgc.c,v 1.16 2011/08/18 20:02:57 miod Exp $ */ /* * Copyright (c) 2005, Miodrag Vallat @@ -43,22 +43,17 @@ #include <dev/ic/stireg.h> #include <dev/ic/stivar.h> +#include <hp300/dev/sti_machdep.h> #include <uvm/uvm_extern.h> void sti_sgc_attach(struct device *, struct device *, void *); int sti_sgc_match(struct device *, void *, void *); -int sti_sgc_probe(bus_space_tag_t, int); struct cfattach sti_sgc_ca = { sizeof(struct sti_softc), sti_sgc_match, sti_sgc_attach }; -/* Console data */ -struct sti_rom sticn_rom; -struct sti_screen sticn_scr; -bus_addr_t sticn_bases[STI_REGION_MAX]; - int sti_sgc_match(struct device *parent, void *match, void *aux) { @@ -152,51 +147,3 @@ sti_sgc_probe(bus_space_tag_t iot, int slot) return (1); } - -/* - * Console code - */ - -int sti_console_scan(int); -void sticninit(void); - -int -sti_console_scan(int slot) -{ - extern struct hp300_bus_space_tag hp300_mem_tag; - bus_space_tag_t iot; - - iot = &hp300_mem_tag; - return (sti_sgc_probe(iot, slot)); -} - -void -sticninit() -{ - extern struct hp300_bus_space_tag hp300_mem_tag; - bus_space_tag_t iot; - bus_addr_t base; - int i; - - /* - * We are not interested by the *first* console pass. - */ - if (consolepass == 0) - return; - - iot = &hp300_mem_tag; - base = (bus_addr_t)sgc_slottopa(CONSCODE_TO_SGC_SLOT(conscode)); - - /* sticn_bases[0] will be fixed in sti_cnattach() */ - for (i = 0; i < STI_REGION_MAX; i++) - sticn_bases[i] = base; - - sti_cnattach(&sticn_rom, &sticn_scr, iot, sticn_bases, - STI_CODEBASE_M68K); - - /* - * Since the copyright notice could not be displayed before, - * display it again now. - */ - printf("%s\n", copyright); -} diff --git a/sys/arch/hp300/hp300/wscons_machdep.c b/sys/arch/hp300/hp300/wscons_machdep.c index 2e67b116217..409a3e3eb4b 100644 --- a/sys/arch/hp300/hp300/wscons_machdep.c +++ b/sys/arch/hp300/hp300/wscons_machdep.c @@ -1,7 +1,7 @@ -/* $OpenBSD: wscons_machdep.c,v 1.11 2011/04/07 15:30:15 miod Exp $ */ +/* $OpenBSD: wscons_machdep.c,v 1.12 2011/08/18 20:02:58 miod Exp $ */ /* - * Copyright (c) 2005, Miodrag Vallat + * Copyright (c) 2005, 2011, Miodrag Vallat * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -59,6 +59,7 @@ #include <sys/device.h> #include <machine/autoconf.h> +#include <machine/bus.h> #include <machine/cpu.h> #include <machine/hp300spu.h> @@ -78,9 +79,11 @@ #include "gbox.h" #include "hyper.h" #include "rbox.h" +#include "sti.h" #include "topcat.h" #include "tvrx.h" -#if NDVBOX > 0 || NGBOX > 0 || NHYPER > 0 || NRBOX > 0 || NTOPCAT > 0 || NTVRX > 0 + +#if NDVBOX > 0 || NGBOX > 0 || NHYPER > 0 || NRBOX > 0 || NSTI_DIO > 0 || NTOPCAT > 0 || NTVRX > 0 #include <hp300/dev/dioreg.h> #include <hp300/dev/diovar.h> #include <hp300/dev/diofbreg.h> @@ -88,31 +91,29 @@ struct diofb diofb_cn; #endif -#include "sti.h" #if NSTI > 0 -#include <machine/bus.h> #include <hp300/dev/sgcreg.h> #include <hp300/dev/sgcvar.h> #include <dev/ic/stireg.h> #include <dev/ic/stivar.h> -extern int sti_console_scan(int); -extern void sticninit(void); +#include <hp300/dev/sti_machdep.h> #endif +extern struct hp300_bus_space_tag hp300_mem_tag; extern caddr_t internalhpib; cons_decl(ws); void (*wsfbcninit)(void) = NULL; -#if NDVBOX > 0 || NGBOX > 0 || NHYPER > 0 || NRBOX > 0 || NTOPCAT > 0 || NTVRX > 0 -int dio_fbidentify(struct diofbreg *); +#if NDVBOX > 0 || NGBOX > 0 || NHYPER > 0 || NRBOX > 0 || NSTI_DIO > 0 || NTOPCAT > 0 || NTVRX > 0 +int dio_fbidentify(int, struct diofbreg *); /* * Identify a DIO frame buffer and set up wsfbcninit accordingly. */ int -dio_fbidentify(struct diofbreg *fbr) +dio_fbidentify(int scode, struct diofbreg *fbr) { if (fbr->id == GRFHWID) switch (fbr->fbid) { @@ -136,6 +137,15 @@ dio_fbidentify(struct diofbreg *fbr) wsfbcninit = rboxcninit; return (1); #endif +#if NSTI_DIO > 0 + case GID_FB3X2_A: + case GID_FB3X2_B: + if (scode >= 0 && sti_dio_probe(scode) != 0) { + wsfbcninit = sticninit; + return (1); + } + break; +#endif #if NTOPCAT > 0 case GID_TOPCAT: case GID_LRCATSEYE: @@ -172,7 +182,7 @@ wscnprobe(struct consdev *cp) int maj, tmpconscode; vsize_t mapsize; vaddr_t va; -#if NDVBOX > 0 || NGBOX > 0 || NHYPER > 0 || NRBOX > 0 || NTOPCAT > 0 || NTVRX > 0 +#if NDVBOX > 0 || NGBOX > 0 || NHYPER > 0 || NRBOX > 0 || NSTI_DIO > 0 || NTOPCAT > 0 || NTVRX > 0 paddr_t pa; u_int scode, sctop, sctmp; struct diofbreg *fbr; @@ -193,7 +203,7 @@ wscnprobe(struct consdev *cp) va = IIOV(GRFIADDR); fbr = (struct diofbreg *)va; if (!badaddr((caddr_t)va)) { - if (dio_fbidentify(fbr)) { + if (dio_fbidentify(-1, fbr)) { tmpconscode = CONSCODE_INTERNAL; mapsize = 0; goto found; @@ -201,7 +211,7 @@ wscnprobe(struct consdev *cp) } #endif -#if NDVBOX > 0 || NGBOX > 0 || NHYPER > 0 || NRBOX > 0 || NTOPCAT > 0 || NTVRX > 0 +#if NDVBOX > 0 || NGBOX > 0 || NHYPER > 0 || NRBOX > 0 || NSTI_DIO > 0 || NTOPCAT > 0 || NTVRX > 0 /* * Scan the DIO bus. */ @@ -232,20 +242,29 @@ wscnprobe(struct consdev *cp) /* Check hardware. */ fbr = (struct diofbreg *)va; - if (dio_fbidentify(fbr)) { + if (dio_fbidentify(scode, fbr)) { tmpconscode = scode; mapsize = DIO_SIZE(scode, va); iounmap((caddr_t)va, PAGE_SIZE); - va = (vaddr_t)iomap((caddr_t)pa, mapsize); - if (va == 0) - continue; + +#if NSTI_DIO > 0 + if (wsfbcninit == sticninit) { + mapsize = 0; + va = 0; + } else +#endif + { + va = (vaddr_t)iomap((caddr_t)pa, mapsize); + if (va == 0) + continue; + } goto found; } else iounmap((caddr_t)va, PAGE_SIZE); } #endif -#if NSTI > 0 +#if NSTI_SGC > 0 /* * Scan the SGC bus. */ @@ -265,7 +284,7 @@ wscnprobe(struct consdev *cp) continue; /* Check hardware. */ - if (sti_console_scan(scode) != 0) { + if (sti_sgc_probe(&hp300_mem_tag, scode) != 0) { wsfbcninit = sticninit; tmpconscode = SGC_SLOT_TO_CONSCODE(scode); mapsize = 0; @@ -304,9 +323,10 @@ void wscninit(struct consdev *cp) { /* - * Note that this relies on the fact that DIO frame buffers will cause - * cn_tab to switch to wsdisplaycons, so their cninit function will - * never get invoked a second time during the second console pass. + * Note that this relies on the fact that DIO frame buffers (except + * for sti@dio) will cause cn_tab to switch to wsdisplaycons, so + * their cninit function will never get invoked a second time during + * the second console pass. */ if (wsfbcninit != NULL) (*wsfbcninit)(); diff --git a/sys/arch/hp300/stand/Makefile.inc b/sys/arch/hp300/stand/Makefile.inc index 9b7c413124e..72a997874e5 100644 --- a/sys/arch/hp300/stand/Makefile.inc +++ b/sys/arch/hp300/stand/Makefile.inc @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile.inc,v 1.10 2011/03/18 06:21:40 matthew Exp $ +# $OpenBSD: Makefile.inc,v 1.11 2011/08/18 20:02:58 miod Exp $ # $NetBSD: Makefile.inc,v 1.7 1997/05/12 07:43:18 thorpej Exp $ BINDIR= /usr/mdec @@ -10,9 +10,8 @@ CFLAGS+= -Wall -Wstrict-prototypes -Wmissing-prototypes \ -fno-stack-protector -msoft-float CPPFLAGS+= -DAPCICONSOLE -DDCACONSOLE -DDCMCONSOLE -DITECONSOLE -CPPFLAGS+= -DHIL_KEYBOARD -DUK_KEYBOARD -CPPFLAGS+= -DDOMAIN_KEYBOARD -CPPFLAGS+= -DSTANDALONE -Dhp300 +CPPFLAGS+= -DHIL_KEYBOARD -DDOMAIN_KEYBOARD +CPPFLAGS+= -DSTANDALONE -D__hp300__ CPPFLAGS+= -DCOMPAT_UFS -DNO_LSEEK # Limit the alloc() heap to below the msgbuf and ROM scratch pages. diff --git a/sys/arch/hp300/stand/cdboot/cdboot.c b/sys/arch/hp300/stand/cdboot/cdboot.c index 928e81758ae..3d4352b54f9 100644 --- a/sys/arch/hp300/stand/cdboot/cdboot.c +++ b/sys/arch/hp300/stand/cdboot/cdboot.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cdboot.c,v 1.7 2007/05/29 00:03:09 deraadt Exp $ */ +/* $OpenBSD: cdboot.c,v 1.8 2011/08/18 20:02:58 miod Exp $ */ /* $NetBSD: uboot.c,v 1.3 1997/04/27 21:17:13 thorpej Exp $ */ /*- @@ -47,8 +47,6 @@ * information. */ -char line[100]; - extern u_int opendev; extern char *lowram; extern int noconsole; @@ -58,7 +56,6 @@ extern const char version[]; /* * XXX UFS accepts a /, NFS doesn't. */ -char *name; char *names[] = { #ifdef OSREV OSREV "/hp300/bsd.rd", @@ -67,21 +64,26 @@ char *names[] = { }; #define NUMNAMES (sizeof(names) / sizeof(char *)) +#if 0 static int bdev, badapt, bctlr, bunit, bpart; +#endif int -main() +main(void) { int currname = 0; + char *name; printf("\n>> OpenBSD [%dKB] CDROM BOOT %s HP 9000/%s CPU\n", (__LDPGSZ / 1024), version, getmachineid()); +#if 0 bdev = B_TYPE(bootdev); badapt = B_ADAPTOR(bootdev); bctlr = B_CONTROLLER(bootdev); bunit = B_UNIT(bootdev); bpart = B_PARTITION(bootdev); +#endif for (;;) { name = names[currname++]; diff --git a/sys/arch/hp300/stand/cdboot/conf.c b/sys/arch/hp300/stand/cdboot/conf.c index 123a57554f2..ce0ad14d5b3 100644 --- a/sys/arch/hp300/stand/cdboot/conf.c +++ b/sys/arch/hp300/stand/cdboot/conf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: conf.c,v 1.6 2011/03/13 00:13:52 deraadt Exp $ */ +/* $OpenBSD: conf.c,v 1.7 2011/08/18 20:02:58 miod Exp $ */ /* $NetBSD: conf.c,v 1.12 1996/10/14 07:29:15 thorpej Exp $ */ /* @@ -87,7 +87,6 @@ struct punitsw punitsw[] = { { xxpunit }, { sdpunit }, }; -int npunit = (sizeof(punitsw) / sizeof(punitsw[0])); /* * Filesystem configuration diff --git a/sys/arch/hp300/stand/common/autoconf.c b/sys/arch/hp300/stand/common/autoconf.c index b5c6effaa7c..505e09dc95f 100644 --- a/sys/arch/hp300/stand/common/autoconf.c +++ b/sys/arch/hp300/stand/common/autoconf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: autoconf.c,v 1.8 2011/08/18 19:54:19 miod Exp $ */ +/* $OpenBSD: autoconf.c,v 1.9 2011/08/18 20:02:58 miod Exp $ */ /* $NetBSD: autoconf.c,v 1.12 1997/01/30 10:32:51 thorpej Exp $ */ /* @@ -46,7 +46,10 @@ #include "consdefs.h" #include "rominfo.h" #include "device.h" -#include "grfreg.h" + +#include <hp300/dev/dioreg.h> +#include <hp300/dev/diodevs.h> +#include <hp300/dev/diofbreg.h> void configure(void); void find_devs(void); @@ -137,13 +140,12 @@ configure() * PARTITION is set to 0 ('a') * UNIT comes from MSUS unit (almost always 0) * CONTROLLER comes from MSUS primary address - * ADAPTER comes from SCSI/HPIB driver logical unit number - * (passed back via unused hw_pa field) + * ADAPTER comes from SCSI/HPIB driver logical unit number (hw_ctrl) */ u_long msustobdev() { - struct rominfo *rp = (struct rominfo *) ROMADDR; + struct rominfo *rp = (struct rominfo *)ROMADDR; u_long bdev = 0; struct hp_hw *hw; int sc, type, ctlr, slave, punit; @@ -154,7 +156,7 @@ msustobdev() break; type = rom2mdev[(rp->msus >> 24) & 0x1F]; - ctlr = (int)hw->hw_pa; + ctlr = hw->hw_ctrl; slave = (rp->msus & 0xFF); punit = ((rp->msus >> 16) & 0xFF); @@ -167,23 +169,23 @@ msustobdev() } u_long -sctoaddr(sc) - int sc; +sctoaddr(int sc) { if (sc == -1) - return(GRFIADDR); + return (GRFIADDR); if (sc == 7 && internalhpib) - return(internalhpib); - if (sc < 32) - return(DIOBASE + sc * DIOCSIZE); - if (sc >= 132) - return(DIOIIBASE + (sc - 132) * DIOIICSIZE); - return(sc); + return (internalhpib); + if (DIO_ISDIO(sc)) + return (DIO_BASE + sc * DIO_DEVSIZE); + if (DIO_ISDIOII(sc)) + return (DIOII_BASE + (sc - DIOII_SCBASE) * DIOII_DEVSIZE); + return 0; } /* * Probe all DIO select codes (0 - 32), the internal display address, - * and DIO-II select codes (132 - 256). + * and DIO-II select codes (132 - 256). SGC frame buffers are probed + * separately. * * Note that we only care about displays, LANCEs, SCSIs and HP-IBs. */ @@ -196,23 +198,20 @@ find_devs() struct hp_hw *hw; hw = sc_table; - sctop = machineid == HP_320 ? 32 : 256; + sctop = machineid == HP_320 ? 32 : 256; /* DIO_SCMAX(machineid); */ + /* starting at -1 to probe the intio framebuffer, if any */ for (sc = -1; sc < sctop; sc++) { - if (sc >= 32 && sc < 132) + if (sc >= 32 && sc < DIOII_SCBASE) continue; - addr = (caddr_t) sctoaddr(sc); + addr = (caddr_t)sctoaddr(sc); if (badaddr(addr)) continue; - id_reg = (u_char *) addr; - hw->hw_pa = 0; /* XXX used to pass back LUN from driver */ - if (sc >= 132) - hw->hw_size = (id_reg[0x101] + 1) * 0x100000; - else - hw->hw_size = DIOCSIZE; + id_reg = (u_char *)addr; hw->hw_kva = addr; - hw->hw_id = id_reg[1]; + hw->hw_type = 0; hw->hw_sc = sc; + hw->hw_ctrl = 0; /* * Not all internal HP-IBs respond rationally to id requests @@ -224,44 +223,48 @@ find_devs() continue; } - switch (hw->hw_id) { - case 5: /* 98642A */ - case 5+128: /* 98642A remote */ + switch (id_reg[DIO_IDOFF]) { + case DIO_DEVICE_ID_DCM: + case DIO_DEVICE_ID_DCMREM: hw->hw_type = D_COMMDCM; break; - case 8: /* 98625B */ - case 128: /* 98624A */ + case DIO_DEVICE_ID_FHPIB: + case DIO_DEVICE_ID_NHPIB: hw->hw_type = C_HPIB; break; - case 21: /* LANCE */ + case DIO_DEVICE_ID_LAN: + case DIO_DEVICE_ID_LANREM: /* does this even make sense? */ hw->hw_type = D_LAN; break; - case 57: /* Displays */ + case DIO_DEVICE_ID_FRAMEBUFFER: hw->hw_type = D_BITMAP; - hw->hw_secid = id_reg[0x15]; - switch (hw->hw_secid) { - case 4: /* renaissance */ - case 8: /* davinci */ - sc++; /* occupy 2 select codes */ + switch(id_reg[DIO_SECIDOFF]) { + case DIO_DEVICE_SECID_RENAISSANCE: + case DIO_DEVICE_SECID_DAVINCI: + sc += 2 - 1; /* occupy 2 select codes */ + break; + case DIO_DEVICE_SECID_TIGERSHARK: + sc += 3 - 1; /* occupy 3 select codes */ break; - case 0x11: /* 3x2 internal display */ - sc += 3; /* occupy 4 select codes */ + case DIO_DEVICE_SECID_FB3X2_A: + case DIO_DEVICE_SECID_FB3X2_B: + sc += 4 - 1; /* occupy 4 select codes */ break; } break; - case 9: - hw->hw_type = D_KEYBOARD; - break; - case 7: - case 7+32: - case 7+64: - case 7+96: + case DIO_DEVICE_ID_SCSI0: + case DIO_DEVICE_ID_SCSI1: + case DIO_DEVICE_ID_SCSI2: + case DIO_DEVICE_ID_SCSI3: hw->hw_type = C_SCSI; break; default: /* who cares */ - hw->hw_type = D_MISC; break; } + if (hw->hw_type == 0) + continue; hw++; + if (hw == sc_table + MAXCTLRS) + break; /* oflows are so boring */ } } diff --git a/sys/arch/hp300/stand/common/dca.c b/sys/arch/hp300/stand/common/dca.c index 2ade07ab9c2..b639b411725 100644 --- a/sys/arch/hp300/stand/common/dca.c +++ b/sys/arch/hp300/stand/common/dca.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dca.c,v 1.7 2008/01/23 16:37:56 jsing Exp $ */ +/* $OpenBSD: dca.c,v 1.8 2011/08/18 20:02:58 miod Exp $ */ /* $NetBSD: dca.c,v 1.10 1996/10/06 01:42:48 mycroft Exp $ */ /* @@ -45,7 +45,7 @@ #include "samachdep.h" #include "consdefs.h" -struct dcadevice *dcacnaddr = 0; +struct dcadevice *dcacnaddr = NULL; #define DCACONSCODE 9 /* XXX */ @@ -54,7 +54,7 @@ dcaprobe(struct consdev *cp) { struct dcadevice *dca; - dcacnaddr = (struct dcadevice *) sctoaddr(DCACONSCODE); + dcacnaddr = (struct dcadevice *)sctoaddr(DCACONSCODE); if (badaddr((char *)dcacnaddr)) return; diff --git a/sys/arch/hp300/stand/common/hpib.c b/sys/arch/hp300/stand/common/hpib.c index 2f3d92b0610..7064ebd16fb 100644 --- a/sys/arch/hp300/stand/common/hpib.c +++ b/sys/arch/hp300/stand/common/hpib.c @@ -1,4 +1,4 @@ -/* $OpenBSD: hpib.c,v 1.4 2006/08/17 06:31:10 miod Exp $ */ +/* $OpenBSD: hpib.c,v 1.5 2011/08/18 20:02:58 miod Exp $ */ /* $NetBSD: hpib.c,v 1.2 1997/05/12 07:48:23 thorpej Exp $ */ /* @@ -69,7 +69,7 @@ hpibinit() continue; if (howto & RB_ASKNAME) printf("hpib%d at sc%d\n", i, hw->hw_sc); - hw->hw_pa = (caddr_t) i; /* XXX for autoconfig */ + hw->hw_ctrl = i; hs->sc_alive = 1; i++; } diff --git a/sys/arch/hp300/stand/common/if_le.c b/sys/arch/hp300/stand/common/if_le.c index 402917bbc98..97bbd4a1dd0 100644 --- a/sys/arch/hp300/stand/common/if_le.c +++ b/sys/arch/hp300/stand/common/if_le.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_le.c,v 1.7 2010/12/06 18:44:49 jasper Exp $ */; +/* $OpenBSD: if_le.c,v 1.8 2011/08/18 20:02:58 miod Exp $ */; /* $NetBSD: if_le.c,v 1.9 1997/01/30 10:32:54 thorpej Exp $ */ /* @@ -199,7 +199,7 @@ leinit() printf("le%d at sc%d physical address %s\n", i, hw->hw_sc, ether_sprintf(sc->sc_addr)); #endif - hw->hw_pa = (caddr_t) i; /* XXX for autoconfig */ + hw->hw_ctrl = i; i++; } } diff --git a/sys/arch/hp300/stand/common/ite.c b/sys/arch/hp300/stand/common/ite.c index 5db82642333..0b8032a3ce0 100644 --- a/sys/arch/hp300/stand/common/ite.c +++ b/sys/arch/hp300/stand/common/ite.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ite.c,v 1.10 2011/08/18 19:54:19 miod Exp $ */ +/* $OpenBSD: ite.c,v 1.11 2011/08/18 20:02:58 miod Exp $ */ /* $NetBSD: ite.c,v 1.12 1997/01/30 10:32:55 thorpej Exp $ */ /* @@ -47,13 +47,14 @@ #include <sys/param.h> +#include <hp300/dev/dioreg.h> #include <hp300/dev/sgcreg.h> +#include <hp300/dev/diofbreg.h> #include <dev/ic/stireg.h> #include "samachdep.h" #include "consdefs.h" #include "device.h" -#include "grfreg.h" #include "itevar.h" #include "kbdvar.h" @@ -61,48 +62,57 @@ void itecheckwrap(struct ite_data *, struct itesw *); void iteconfig(void); void ite_clrtoeol(struct ite_data *, struct itesw *, int, int); +#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, - ite_dio_cursor, ite_dio_scroll }, + NULL, topcat_init, + ite_dio_clear, ite_dio_putc8bpp, ite_dio_cursor, ite_dio_scroll }, { GID_GATORBOX, - gbox_init, ite_dio_clear, ite_dio_putc8bpp, - ite_dio_cursor, gbox_scroll }, + NULL, gbox_init, + ite_dio_clear, ite_dio_putc8bpp, ite_dio_cursor, gbox_scroll }, { GID_RENAISSANCE, - rbox_init, ite_dio_clear, ite_dio_putc8bpp, - ite_dio_cursor, ite_dio_scroll }, + NULL, rbox_init, + ite_dio_clear, ite_dio_putc8bpp, ite_dio_cursor, ite_dio_scroll }, { GID_LRCATSEYE, - topcat_init, ite_dio_clear, ite_dio_putc8bpp, - ite_dio_cursor, ite_dio_scroll }, + NULL, topcat_init, + ite_dio_clear, ite_dio_putc8bpp, ite_dio_cursor, ite_dio_scroll }, { GID_HRCCATSEYE, - topcat_init, ite_dio_clear, ite_dio_putc8bpp, - ite_dio_cursor, ite_dio_scroll }, + NULL, topcat_init, + ite_dio_clear, ite_dio_putc8bpp, ite_dio_cursor, ite_dio_scroll }, { GID_HRMCATSEYE, - topcat_init, ite_dio_clear, ite_dio_putc8bpp, - ite_dio_cursor, ite_dio_scroll }, + NULL, topcat_init, + ite_dio_clear, ite_dio_putc8bpp, ite_dio_cursor, ite_dio_scroll }, { GID_DAVINCI, - dvbox_init, ite_dio_clear, ite_dio_putc8bpp, - ite_dio_cursor, ite_dio_scroll }, + NULL, dvbox_init, + ite_dio_clear, ite_dio_putc8bpp, ite_dio_cursor, ite_dio_scroll }, { GID_HYPERION, - hyper_init, ite_dio_clear, ite_dio_putc1bpp, - ite_dio_cursor, ite_dio_scroll }, + NULL, hyper_init, + ite_dio_clear, ite_dio_putc1bpp, ite_dio_cursor, ite_dio_scroll }, { GID_TIGER, - tvrx_init, ite_dio_clear, ite_dio_putc1bpp, - ite_dio_cursor, ite_dio_scroll }, + NULL, tvrx_init, + ite_dio_clear, ite_dio_putc1bpp, ite_dio_cursor, ite_dio_scroll }, + + { GID_FB3X2_A, + sti_dio_probe, sti_iteinit_dio, + sti_clear, sti_putc, sti_cursor, sti_scroll }, + + { GID_FB3X2_B, + sti_dio_probe, sti_iteinit_dio, + sti_clear, sti_putc, sti_cursor, sti_scroll }, { GID_STI, - sti_iteinit, sti_clear, sti_putc, - sti_cursor, sti_scroll }, + NULL, sti_iteinit_sgc, + sti_clear, sti_putc, sti_cursor, sti_scroll } }; -int nitesw = sizeof(itesw) / sizeof(itesw[0]); /* these guys need to be in initialized data */ int itecons = -1; @@ -118,36 +128,37 @@ iteconfig() int dtype, fboff, slotno, i; u_int8_t *va; struct hp_hw *hw; - struct grfreg *gr; + struct diofbreg *fb; struct ite_data *ip; i = 0; for (hw = sc_table; hw < &sc_table[MAXCTLRS]; hw++) { if (!HW_ISDEV(hw, D_BITMAP)) continue; - gr = (struct grfreg *) hw->hw_kva; + fb = (struct diofbreg *)hw->hw_kva; /* XXX: redundent but safe */ - if (badaddr((caddr_t)gr) || gr->gr_id != GRFHWID) + if (badaddr((caddr_t)fb) || fb->id != GRFHWID) continue; - for (dtype = 0; dtype < nitesw; dtype++) - if (itesw[dtype].ite_hwid == gr->gr_id2) + for (dtype = 0; dtype < nitems(itesw); dtype++) + if (itesw[dtype].ite_hwid == fb->fbid) break; - if (dtype == nitesw) + if (dtype == nitems(itesw)) continue; if (i >= NITE) break; ip = &ite_data[i]; + ip->scode = hw->hw_sc; ip->isw = &itesw[dtype]; - ip->regbase = (caddr_t) gr; - fboff = (gr->gr_fbomsb << 8) | gr->gr_fbolsb; + ip->regbase = (caddr_t)fb; + fboff = (fb->fbomsb << 8) | fb->fbolsb; ip->fbbase = (caddr_t) (*((u_char *)ip->regbase+fboff) << 16); /* DIO II: FB offset is relative to select code space */ - if (ip->regbase >= (caddr_t)DIOIIBASE) + if (DIO_ISDIOII(ip->scode)) ip->fbbase += (int)ip->regbase; - ip->fbwidth = gr->gr_fbwidth_h << 8 | gr->gr_fbwidth_l; - ip->fbheight = gr->gr_fbheight_h << 8 | gr->gr_fbheight_l; - ip->dwidth = gr->gr_dwidth_h << 8 | gr->gr_dwidth_l; - ip->dheight = gr->gr_dheight_h << 8 | gr->gr_dheight_l; + ip->fbwidth = fb->fbwmsb << 8 | fb->fbwlsb; + ip->fbheight = fb->fbhmsb << 8 | fb->fbhlsb; + ip->dwidth = fb->dwmsb << 8 | fb->dwlsb; + ip->dheight = fb->dhmsb << 8 | fb->dhlsb; /* * XXX some displays (e.g. the davinci) appear * to return a display height greater than the @@ -159,6 +170,10 @@ iteconfig() ip->dwidth = ip->fbwidth; if (ip->dheight > ip->fbheight) ip->dheight = ip->fbheight; + /* confirm hardware is what we think it is */ + if (itesw[dtype].ite_probe != NULL && + (*itesw[dtype].ite_probe)(ip) != 0) + continue; ip->alive = 1; i++; } @@ -175,10 +190,11 @@ iteconfig() return; } - for (dtype = 0; dtype < nitesw; dtype++) + /* SGC frame buffers can only be STI... */ + for (dtype = 0; dtype < nitems(itesw); dtype++) if (itesw[dtype].ite_hwid == GID_STI) break; - if (dtype == nitesw) + if (dtype == nitems(itesw)) return; for (slotno = 0; slotno < SGC_NSLOTS; slotno++) { @@ -193,9 +209,10 @@ iteconfig() if (i >= NITE) break; ip = &ite_data[i]; + ip->scode = slotno; ip->isw = &itesw[dtype]; ip->regbase = (caddr_t)GRFIADDR; /* to get CN_MIDPRI */ - ip->fbbase = (caddr_t)slotno; + /* ...and do not need an ite_probe() check */ ip->alive = 1; i++; /* we only support one SGC frame buffer at the moment */ diff --git a/sys/arch/hp300/stand/common/ite_sti.c b/sys/arch/hp300/stand/common/ite_sti.c index 44ac12bbfb0..e035fd7b178 100644 --- a/sys/arch/hp300/stand/common/ite_sti.c +++ b/sys/arch/hp300/stand/common/ite_sti.c @@ -1,6 +1,6 @@ -/* $OpenBSD: ite_sti.c,v 1.1 2006/08/17 06:31:10 miod Exp $ */ +/* $OpenBSD: ite_sti.c,v 1.2 2011/08/18 20:02:58 miod Exp $ */ /* - * Copyright (c) 2006, Miodrag Vallat + * Copyright (c) 2006, 2011, Miodrag Vallat * Copyright (c) 2000-2003 Michael Shalayeff * All rights reserved. * @@ -35,7 +35,9 @@ #include "consdefs.h" #include "itevar.h" +#include <hp300/dev/dioreg.h> #include <hp300/dev/sgcreg.h> +#include <hp300/dev/sti_machdep.h> #include <dev/ic/stireg.h> /* @@ -61,6 +63,39 @@ 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 *); + +/* 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); +} + +void +sti_iteinit_sgc(struct ite_data *ip) +{ + ip->fbbase = (caddr_t)IIOV(SGC_BASE + (ip->scode * SGC_DEVSIZE)); + sti_iteinit_common(ip); +} /* * Initialize the sti device for ite's needs. @@ -70,9 +105,9 @@ void sti_inqcfg(struct sti_inqconfout *); * can report errors (although we could switch to serial...) */ void -sti_iteinit(struct ite_data *ip) +sti_iteinit_common(struct ite_data *ip) { - int slotno, i; + int i; size_t codesize, memsize; u_int8_t *va, *code; u_int addr, eaddr, reglist, tmp; @@ -80,8 +115,7 @@ sti_iteinit(struct ite_data *ip) struct sti_einqconfout ecfg; bzero(&sti, sizeof sti); - slotno = (int)ip->fbbase; - ip->fbbase = va = (u_int8_t *)IIOV(SGC_BASE + (slotno * SGC_DEVSIZE)); + va = (u_int8_t *)ip->fbbase; /* * Read the microcode. diff --git a/sys/arch/hp300/stand/common/ite_tc.c b/sys/arch/hp300/stand/common/ite_tc.c index 40bdf8908c4..f968282efc3 100644 --- a/sys/arch/hp300/stand/common/ite_tc.c +++ b/sys/arch/hp300/stand/common/ite_tc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ite_tc.c,v 1.5 2006/08/17 06:31:10 miod Exp $ */ +/* $OpenBSD: ite_tc.c,v 1.6 2011/08/18 20:02:58 miod Exp $ */ /* $NetBSD: ite_tc.c,v 1.8 1996/03/03 04:23:41 thorpej Exp $ */ /* @@ -46,7 +46,9 @@ #include "samachdep.h" #include "itevar.h" #include "itereg.h" -#include "grfreg.h" + +#include <hp300/dev/diofbreg.h> + #include "grf_tcreg.h" #define REGBASE ((struct tcboxfb *)(ip->regbase)) diff --git a/sys/arch/hp300/stand/common/scsi.c b/sys/arch/hp300/stand/common/scsi.c index bd9384aa6b1..fb5321dd0d3 100644 --- a/sys/arch/hp300/stand/common/scsi.c +++ b/sys/arch/hp300/stand/common/scsi.c @@ -1,4 +1,4 @@ -/* $OpenBSD: scsi.c,v 1.7 2011/03/13 00:13:52 deraadt Exp $ */ +/* $OpenBSD: scsi.c,v 1.8 2011/08/18 20:02:58 miod Exp $ */ /* $NetBSD: scsi.c,v 1.7 1997/01/30 10:32:57 thorpej Exp $ */ /* @@ -86,7 +86,7 @@ scsiinit() scsireset(i); if (howto & RB_ASKNAME) printf("scsi%d at sc%d\n", i, hw->hw_sc); - hw->hw_pa = (caddr_t) i; /* XXX for autoconfig */ + hw->hw_ctrl = i; hs->sc_alive = 1; i++; } diff --git a/sys/arch/hp300/stand/common/version.c b/sys/arch/hp300/stand/common/version.c index 458c9e7ea00..bd02be8a131 100644 --- a/sys/arch/hp300/stand/common/version.c +++ b/sys/arch/hp300/stand/common/version.c @@ -1,4 +1,4 @@ -/* $OpenBSD: version.c,v 1.9 2010/04/15 20:35:22 miod Exp $ */ +/* $OpenBSD: version.c,v 1.10 2011/08/18 20:02:58 miod Exp $ */ /* * Record major changes in the boot code here, and increment the version @@ -16,8 +16,11 @@ * 2.7 Minor syncs with the kernel (recognize more models * and use the same logic to pick the console on 425e). * 2.8 TurboVRX frame buffer support. - * 2.9 SGC frame buffers support, bug fixes and code cleanup - * 2.10 SGC support on models 362 and 382. + * 2.9 SGC frame buffers support, bug fixes and code cleanup. + * 2.10 blind SGC support on models 362 and 382, turned out + * to be useless. + * 2.11 sti@dio frame buffer support (for models 362 and 382), + * and various cleanups. */ -const char version[] = "2.10"; +const char version[] = "2.11"; diff --git a/sys/arch/hp300/stand/include/device.h b/sys/arch/hp300/stand/include/device.h index f8f5ca3f7f0..1147efa30c2 100644 --- a/sys/arch/hp300/stand/include/device.h +++ b/sys/arch/hp300/stand/include/device.h @@ -1,4 +1,4 @@ -/* $OpenBSD: device.h,v 1.2 2003/06/02 23:27:46 millert Exp $ */ +/* $OpenBSD: device.h,v 1.3 2011/08/18 20:02:58 miod Exp $ */ /* $NetBSD: device.h,v 1.1 1997/01/30 10:31:44 thorpej Exp $ */ /* @@ -33,43 +33,24 @@ */ struct hp_hw { - caddr_t hw_pa; /* physical address of control space */ - int hw_size; /* size of control space */ caddr_t hw_kva; /* kernel virtual address of control space */ - short hw_id; /* HW returned id */ - short hw_secid; /* secondary HW id (displays) */ short hw_type; /* type (defined below) */ short hw_sc; /* select code (if applicable) */ + int hw_ctrl; /* controller number */ }; #define MAXCTLRS 16 /* Size of HW table (arbitrary) */ -#define MAXSLAVES 8 /* Slaves per controller (HPIB/SCSI limit) */ -/* bus types */ -#define B_MASK 0xE000 -#define B_DIO 0x2000 -#define B_DIOII 0x4000 -#define B_VME 0x6000 /* controller types */ -#define C_MASK 0x8F -#define C_FLAG 0x80 -#define C_HPIB 0x81 -#define C_SCSI 0x82 -#define C_VME 0x83 +#define C_MASK 0xF0 +#define C_HPIB 0x10 +#define C_SCSI 0x20 /* device types (controllers with no slaves) */ -#define D_MASK 0x8F +#define D_MASK 0x0F #define D_BITMAP 0x01 #define D_LAN 0x02 -#define D_FPA 0x03 -#define D_KEYBOARD 0x04 -#define D_COMMDCA 0x05 -#define D_COMMDCM 0x06 -#define D_COMMDCL 0x07 -#define D_PPORT 0x08 -#define D_MISC 0x7F +#define D_COMMDCM 0x03 -#define HW_ISCTLR(hw) ((hw)->hw_type & C_FLAG) -#define HW_ISDIOII(hw) ((hw)->hw_type & B_DIOII) #define HW_ISHPIB(hw) (((hw)->hw_type & C_MASK) == C_HPIB) #define HW_ISSCSI(hw) (((hw)->hw_type & C_MASK) == C_SCSI) #define HW_ISDEV(hw,d) (((hw)->hw_type & D_MASK) == (d)) diff --git a/sys/arch/hp300/stand/include/grfreg.h b/sys/arch/hp300/stand/include/grfreg.h deleted file mode 100644 index 8daff3aa39a..00000000000 --- a/sys/arch/hp300/stand/include/grfreg.h +++ /dev/null @@ -1,90 +0,0 @@ -/* $OpenBSD: grfreg.h,v 1.2 2006/08/17 06:31:10 miod Exp $ */ -/* $NetBSD: grfreg.h,v 1.2 1994/10/26 07:24:09 cgd Exp $ */ - -/* - * Copyright (c) 1991 University of Utah. - * Copyright (c) 1990, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * the Systems Programming Group of the University of Utah Computer - * Science Department. - * - * 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. 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. - * - * from: Utah $Hdr: grfreg.h 1.6 92/01/31$ - * - * @(#)grfreg.h 8.1 (Berkeley) 6/10/93 - */ - -/* 300 bitmapped display hardware primary id */ -#define GRFHWID 0x39 - -/* 300 internal bitmapped display address */ -#define GRFIADDR 0x560000 - -/* 300 hardware secondary ids */ -#define GID_GATORBOX 1 -#define GID_TOPCAT 2 -#define GID_RENAISSANCE 4 -#define GID_LRCATSEYE 5 -#define GID_HRCCATSEYE 6 -#define GID_HRMCATSEYE 7 -#define GID_DAVINCI 8 -#define GID_XXXCATSEYE 9 -#define GID_XGENESIS 11 -#define GID_TIGER 12 -#define GID_YGENESIS 13 -#define GID_HYPERION 14 -#define GID_STI 42/* any value which is not a dio frame buffer, really */ - -typedef unsigned char grftype; - -struct grfreg { - grftype gr_pad0, - gr_id, /* +0x01 */ - gr_pad1[0x3], - gr_fbwidth_h, /* +0x05 */ - gr_pad2, - gr_fbwidth_l, /* +0x07 */ - gr_pad3, - gr_fbheight_h, /* +0x09 */ - gr_pad4, - gr_fbheight_l, /* +0x0B */ - gr_pad5, - gr_dwidth_h, /* +0x0D */ - gr_pad6, - gr_dwidth_l, /* +0x0F */ - gr_pad7, - gr_dheight_h, /* +0x11 */ - gr_pad8, - gr_dheight_l, /* +0x13 */ - gr_pad9, - gr_id2, /* +0x15 */ - gr_pad10[0x47], - gr_fbomsb, /* +0x5d */ - gr_pad11, - gr_fbolsb; /* +0x5f */ -}; diff --git a/sys/arch/hp300/stand/include/itevar.h b/sys/arch/hp300/stand/include/itevar.h index 35191ccf820..12c46c0f330 100644 --- a/sys/arch/hp300/stand/include/itevar.h +++ b/sys/arch/hp300/stand/include/itevar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: itevar.h,v 1.5 2006/08/17 06:31:10 miod Exp $ */ +/* $OpenBSD: itevar.h,v 1.6 2011/08/18 20:02:58 miod Exp $ */ /* $NetBSD: itevar.h,v 1.1 1996/03/03 04:23:42 thorpej Exp $ */ /* @@ -50,6 +50,7 @@ typedef void (*ite_windowmover)(struct ite_data *, int, int, int, int, int, struct ite_data { int alive; + int scode; /* DIO select code or SGC slot # */ struct itesw *isw; caddr_t regbase, fbbase; short curx, cury; @@ -67,6 +68,7 @@ struct ite_data { struct itesw { int ite_hwid; + int (*ite_probe)(struct ite_data *); void (*ite_init)(struct ite_data *); void (*ite_clear)(struct ite_data *, int, int, int, int); void (*ite_putc)(struct ite_data *, int, int, int); @@ -125,7 +127,9 @@ void dvbox_init(struct ite_data *); void hyper_init(struct ite_data *); void tvrx_init(struct ite_data *); -void sti_iteinit(struct ite_data *); +int sti_dio_probe(struct ite_data *); +void sti_iteinit_dio(struct ite_data *); +void sti_iteinit_sgc(struct ite_data *); void sti_clear(struct ite_data *, int, int, int, int); void sti_putc(struct ite_data *, int, int, int); void sti_cursor(struct ite_data *, int); diff --git a/sys/arch/hp300/stand/include/samachdep.h b/sys/arch/hp300/stand/include/samachdep.h index 089d07bdcfb..f604013680e 100644 --- a/sys/arch/hp300/stand/include/samachdep.h +++ b/sys/arch/hp300/stand/include/samachdep.h @@ -1,4 +1,4 @@ -/* $OpenBSD: samachdep.h,v 1.6 2008/02/13 21:20:32 miod Exp $ */ +/* $OpenBSD: samachdep.h,v 1.7 2011/08/18 20:02:58 miod Exp $ */ /* $NetBSD: samachdep.h,v 1.3 1997/05/12 07:54:45 thorpej Exp $ */ /* @@ -44,13 +44,8 @@ #define NITE 4 /* from cpu.h */ -#define INTIOBASE (0x00400000) #undef IIOV #define IIOV(x) (x) -#define DIOBASE (0x600000) -#define DIOCSIZE (0x10000) -#define DIOIIBASE (0x01000000) -#define DIOIICSIZE (0x00400000) #define MHZ_8 1 #define MHZ_16 2 @@ -83,13 +78,6 @@ struct punitsw { int (*p_punit)(int, int, int *); }; extern struct punitsw punitsw[]; -extern int npunit; - -extern struct devsw devsw_net[]; -extern int ndevs_net; - -extern struct devsw devsw_general[]; -extern int ndevs_general; extern struct fs_ops file_system_rawfs[]; extern struct fs_ops file_system_ufs[]; diff --git a/sys/arch/hp300/stand/mkboot/mkboot.c b/sys/arch/hp300/stand/mkboot/mkboot.c index 4b6e952c7f6..6349431b629 100644 --- a/sys/arch/hp300/stand/mkboot/mkboot.c +++ b/sys/arch/hp300/stand/mkboot/mkboot.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mkboot.c,v 1.6 2009/10/27 23:59:34 deraadt Exp $ */ +/* $OpenBSD: mkboot.c,v 1.7 2011/08/18 20:02:58 miod Exp $ */ /* * Copyright (c) 1990, 1993 @@ -83,9 +83,7 @@ void usage(void); * sector 32-: LIF file 0, LIF file 1, etc. */ int -main(argc, argv) - int argc; - char **argv; +main(int argc, char **argv) { int ac; char **av; diff --git a/sys/arch/hp300/stand/uboot/conf.c b/sys/arch/hp300/stand/uboot/conf.c index 19f2740175b..f9abd637d67 100644 --- a/sys/arch/hp300/stand/uboot/conf.c +++ b/sys/arch/hp300/stand/uboot/conf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: conf.c,v 1.7 2011/03/13 00:13:52 deraadt Exp $ */ +/* $OpenBSD: conf.c,v 1.8 2011/08/18 20:02:58 miod Exp $ */ /* $NetBSD: conf.c,v 1.12 1996/10/14 07:29:15 thorpej Exp $ */ /* @@ -127,7 +127,6 @@ struct punitsw punitsw[] = { { xxpunit }, { lepunit }, }; -int npunit = (sizeof(punitsw) / sizeof(punitsw[0])); /* * Filesystem configuration diff --git a/sys/arch/hp300/stand/uboot/netio.c b/sys/arch/hp300/stand/uboot/netio.c index 2b74173bb40..afbce4820f2 100644 --- a/sys/arch/hp300/stand/uboot/netio.c +++ b/sys/arch/hp300/stand/uboot/netio.c @@ -1,4 +1,4 @@ -/* $OpenBSD: netio.c,v 1.4 2011/03/13 00:13:52 deraadt Exp $ */ +/* $OpenBSD: netio.c,v 1.5 2011/08/18 20:02:58 miod Exp $ */ /* $NetBSD: netio.c,v 1.5 1997/01/30 10:32:56 thorpej Exp $ */ /* @@ -68,20 +68,16 @@ extern int nfs_root_node[]; /* XXX - get from nfs_mount() */ -struct in_addr myip, rootip, gateip; +/* Why be any different? */ +#define SUN_BOOTPARAMS + +#ifndef SUN_BOOTPARAMS n_long netmask; -char rootpath[FNAME_SIZE]; +#endif int netdev_sock = -1; static int open_count; -int netio_ask = 0; /* default to bootparam, can override */ - -static char input_line[100]; - -/* Why be any different? */ -#define SUN_BOOTPARAMS - int netclose(struct open_file *); int netmountroot(struct open_file *, char *); int netopen(struct open_file *, char *); @@ -132,69 +128,10 @@ netstrategy(void *devdata, int func, daddr32_t dblk, size_t size, void *v_buf, int netmountroot(struct open_file *f, char *devname) { - int error; - struct iodesc *d; - #ifdef DEBUG printf("netmountroot: %s\n", devname); #endif - if (netio_ask) { - get_my_ip: - printf("My IP address? "); - bzero(input_line, sizeof(input_line)); - gets(input_line); - if ((myip.s_addr = inet_addr(input_line)) == - htonl(INADDR_NONE)) { - printf("invalid IP address: %s\n", input_line); - goto get_my_ip; - } - - get_my_netmask: - printf("My netmask? "); - bzero(input_line, sizeof(input_line)); - gets(input_line); - if ((netmask = inet_addr(input_line)) == - htonl(INADDR_NONE)) { - printf("invalid netmask: %s\n", input_line); - goto get_my_netmask; - } - - get_my_gateway: - printf("My gateway? "); - bzero(input_line, sizeof(input_line)); - gets(input_line); - if ((gateip.s_addr = inet_addr(input_line)) == - htonl(INADDR_NONE)) { - printf("invalid IP address: %s\n", input_line); - goto get_my_gateway; - } - - get_server_ip: - printf("Server IP address? "); - bzero(input_line, sizeof(input_line)); - gets(input_line); - if ((rootip.s_addr = inet_addr(input_line)) == - htonl(INADDR_NONE)) { - printf("invalid IP address: %s\n", input_line); - goto get_server_ip; - } - - get_server_path: - printf("Server path? "); - bzero(rootpath, sizeof(rootpath)); - gets(rootpath); - if (rootpath[0] == '\0' || rootpath[0] == '\n') - goto get_server_path; - - if ((d = socktodesc(netdev_sock)) == NULL) - return (EMFILE); - - d->myip = myip; - - goto do_nfs_mount; - } - /* * Get info for NFS boot: our IP address, our hostname, * server IP address, and our root path on the server. @@ -229,8 +166,6 @@ netmountroot(struct open_file *f, char *devname) printf("Using IP address: %s\n", inet_ntoa(myip)); printf("myip: %s (%s)", hostname, inet_ntoa(myip)); - if (gateip) - printf(", gateip: %s", inet_ntoa(gateip)); if (mask) printf(", mask: %s", intoa(netmask)); printf("\n"); @@ -239,9 +174,6 @@ netmountroot(struct open_file *f, char *devname) printf("root addr=%s path=%s\n", inet_ntoa(rootip), rootpath); - do_nfs_mount: /* Get the NFS file handle (mount). */ - error = nfs_mount(netdev_sock, rootip, rootpath); - - return (error); + return nfs_mount(netdev_sock, rootip, rootpath); } diff --git a/sys/arch/hp300/stand/uboot/uboot.c b/sys/arch/hp300/stand/uboot/uboot.c index 6ec4ee78759..66689285d0a 100644 --- a/sys/arch/hp300/stand/uboot/uboot.c +++ b/sys/arch/hp300/stand/uboot/uboot.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uboot.c,v 1.5 2007/05/29 00:03:09 deraadt Exp $ */ +/* $OpenBSD: uboot.c,v 1.6 2011/08/18 20:02:58 miod Exp $ */ /* $NetBSD: uboot.c,v 1.3 1997/04/27 21:17:13 thorpej Exp $ */ /*- @@ -69,7 +69,7 @@ static int bdev, badapt, bctlr, bunit, bpart; void getbootdev(int *); int -main() +main(void) { int currname = 0; |