Home | History | Annotate | Line # | Download | only in dev
sti_machdep.c revision 1.1
      1  1.1  tsutsui /*	$NetBSD $	*/
      2  1.1  tsutsui /*	$OpenBSD: sti_sgc.c,v 1.14 2007/05/26 00:36:03 krw Exp $	*/
      3  1.1  tsutsui 
      4  1.1  tsutsui /*
      5  1.1  tsutsui  * Copyright (c) 2005, Miodrag Vallat
      6  1.1  tsutsui  *
      7  1.1  tsutsui  * Redistribution and use in source and binary forms, with or without
      8  1.1  tsutsui  * modification, are permitted provided that the following conditions
      9  1.1  tsutsui  * are met:
     10  1.1  tsutsui  * 1. Redistributions of source code must retain the above copyright
     11  1.1  tsutsui  *    notice, this list of conditions and the following disclaimer.
     12  1.1  tsutsui  * 2. Redistributions in binary form must reproduce the above copyright
     13  1.1  tsutsui  *    notice, this list of conditions and the following disclaimer in the
     14  1.1  tsutsui  *    documentation and/or other materials provided with the distribution.
     15  1.1  tsutsui  *
     16  1.1  tsutsui  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
     17  1.1  tsutsui  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
     18  1.1  tsutsui  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
     19  1.1  tsutsui  * DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
     20  1.1  tsutsui  * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
     21  1.1  tsutsui  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
     22  1.1  tsutsui  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     23  1.1  tsutsui  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
     24  1.1  tsutsui  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
     25  1.1  tsutsui  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     26  1.1  tsutsui  * POSSIBILITY OF SUCH DAMAGE.
     27  1.1  tsutsui  *
     28  1.1  tsutsui  */
     29  1.1  tsutsui /*-
     30  1.1  tsutsui  * Copyright (c) 2020, 2025 Izumi Tsutsui.  All rights reserved.
     31  1.1  tsutsui  *
     32  1.1  tsutsui  * Redistribution and use in source and binary forms, with or without
     33  1.1  tsutsui  * modification, are permitted provided that the following conditions
     34  1.1  tsutsui  * are met:
     35  1.1  tsutsui  * 1. Redistributions of source code must retain the above copyright
     36  1.1  tsutsui  *    notice, this list of conditions and the following disclaimer.
     37  1.1  tsutsui  * 2. Redistributions in binary form must reproduce the above copyright
     38  1.1  tsutsui  *    notice, this list of conditions and the following disclaimer in the
     39  1.1  tsutsui  *    documentation and/or other materials provided with the distribution.
     40  1.1  tsutsui  *
     41  1.1  tsutsui  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
     42  1.1  tsutsui  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
     43  1.1  tsutsui  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
     44  1.1  tsutsui  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
     45  1.1  tsutsui  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
     46  1.1  tsutsui  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
     47  1.1  tsutsui  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
     48  1.1  tsutsui  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     49  1.1  tsutsui  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
     50  1.1  tsutsui  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     51  1.1  tsutsui  */
     52  1.1  tsutsui 
     53  1.1  tsutsui #include <sys/cdefs.h>
     54  1.1  tsutsui __KERNEL_RCSID(0, "$NetBSD: sti_machdep.c,v 1.1 2025/05/01 06:11:21 tsutsui Exp $");
     55  1.1  tsutsui 
     56  1.1  tsutsui #include <sys/param.h>
     57  1.1  tsutsui #include <sys/device.h>
     58  1.1  tsutsui #include <sys/bus.h>
     59  1.1  tsutsui 
     60  1.1  tsutsui #include <dev/wscons/wsconsio.h>
     61  1.1  tsutsui 
     62  1.1  tsutsui #include <hp300/dev/sgcvar.h>
     63  1.1  tsutsui #include <hp300/dev/sti_machdep.h>
     64  1.1  tsutsui 
     65  1.1  tsutsui /*
     66  1.1  tsutsui  * 425e EVRX specific hardware
     67  1.1  tsutsui  */
     68  1.1  tsutsui /*
     69  1.1  tsutsui  * EVRX RAMDAC (Bt458) is found at offset 0x060000 from SGC bus PA and
     70  1.1  tsutsui  * offset 0x040000 length 0x1c0000 is mapped in MI sti via ROM region 2
     71  1.1  tsutsui  */
     72  1.1  tsutsui #define STI_EVRX_REGNO2OFFSET	0x020000
     73  1.1  tsutsui #define STI_EVRX_FBOFFSET	0x200000
     74  1.1  tsutsui 
     75  1.1  tsutsui #define EVRX_BT458_ADDR		(STI_EVRX_REGNO2OFFSET + 0x200 + 2)
     76  1.1  tsutsui #define EVRX_BT458_CMAP		(STI_EVRX_REGNO2OFFSET + 0x204 + 2)
     77  1.1  tsutsui #define EVRX_BT458_CTRL		(STI_EVRX_REGNO2OFFSET + 0x208 + 2)
     78  1.1  tsutsui #define EVRX_BT458_OMAP		(STI_EVRX_REGNO2OFFSET + 0x20C + 2)
     79  1.1  tsutsui 
     80  1.1  tsutsui /* from HP-UX /usr/lib/libddevrx.a */
     81  1.1  tsutsui #define EVRX_MAGIC00		(STI_EVRX_REGNO2OFFSET + 0x600)
     82  1.1  tsutsui #define EVRX_MAGIC04		(STI_EVRX_REGNO2OFFSET + 0x604)
     83  1.1  tsutsui #define EVRX_MAGIC08		(STI_EVRX_REGNO2OFFSET + 0x608)
     84  1.1  tsutsui #define EVRX_MAGIC0C		(STI_EVRX_REGNO2OFFSET + 0x60c)
     85  1.1  tsutsui #define EVRX_MAGIC10		(STI_EVRX_REGNO2OFFSET + 0x610)
     86  1.1  tsutsui #define EVRX_MAGIC10_BSY	0x00010000
     87  1.1  tsutsui #define EVRX_MAGIC18		(STI_EVRX_REGNO2OFFSET + 0x618)
     88  1.1  tsutsui #define EVRX_MAGIC1C		(STI_EVRX_REGNO2OFFSET + 0x61c)
     89  1.1  tsutsui 
     90  1.1  tsutsui /*
     91  1.1  tsutsui  * HP A1659A CRX specific hardware
     92  1.1  tsutsui  */
     93  1.1  tsutsui #define STI_CRX_FBOFFSET	0x01000000
     94  1.1  tsutsui 
     95  1.1  tsutsui /* 425e EVRX/CRX specific access functions */
     96  1.1  tsutsui static int sti_evrx_putcmap(struct sti_screen *, u_int, u_int);
     97  1.1  tsutsui static void sti_evrx_resetramdac(struct sti_screen *);
     98  1.1  tsutsui static void sti_evrx_resetcmap(struct sti_screen *);
     99  1.1  tsutsui static void sti_evrx_setupfb(struct sti_screen *);
    100  1.1  tsutsui static paddr_t sti_m68k_mmap(void *, void *, off_t, int);
    101  1.1  tsutsui 
    102  1.1  tsutsui static struct bus_space_tag sticn_tag;
    103  1.1  tsutsui static struct sti_rom sticn_rom;
    104  1.1  tsutsui static struct sti_screen sticn_scr;
    105  1.1  tsutsui static bus_addr_t sticn_bases[STI_REGION_MAX];
    106  1.1  tsutsui 
    107  1.1  tsutsui static const struct wsdisplay_accessops sti_m68k_accessops = {
    108  1.1  tsutsui 	sti_ioctl,
    109  1.1  tsutsui 	sti_m68k_mmap,
    110  1.1  tsutsui 	sti_alloc_screen,
    111  1.1  tsutsui 	sti_free_screen,
    112  1.1  tsutsui 	sti_show_screen,
    113  1.1  tsutsui 	sti_load_font
    114  1.1  tsutsui };
    115  1.1  tsutsui 
    116  1.1  tsutsui void
    117  1.1  tsutsui sti_machdep_attach_console(struct sti_machdep_softc *sc)
    118  1.1  tsutsui {
    119  1.1  tsutsui 	struct sti_softc *ssc = &sc->sc_sti;
    120  1.1  tsutsui 
    121  1.1  tsutsui 	ssc->sc_flags |= STI_CONSOLE | STI_ATTACHED;
    122  1.1  tsutsui 	ssc->sc_rom = &sticn_rom;
    123  1.1  tsutsui 	ssc->sc_rom->rom_softc = ssc;
    124  1.1  tsutsui 	ssc->sc_scr = &sticn_scr;
    125  1.1  tsutsui 	ssc->sc_scr->scr_rom = ssc->sc_rom;
    126  1.1  tsutsui 	memcpy(ssc->bases, sticn_bases, sizeof(ssc->bases));
    127  1.1  tsutsui 
    128  1.1  tsutsui 	sti_describe(ssc);
    129  1.1  tsutsui }
    130  1.1  tsutsui 
    131  1.1  tsutsui void
    132  1.1  tsutsui sti_machdep_attach(struct sti_machdep_softc *sc)
    133  1.1  tsutsui {
    134  1.1  tsutsui 	struct sti_softc *ssc = &sc->sc_sti;
    135  1.1  tsutsui 	struct sti_screen *scr;
    136  1.1  tsutsui 	paddr_t base = sc->sc_base;
    137  1.1  tsutsui 	struct wsemuldisplaydev_attach_args waa;
    138  1.1  tsutsui 	struct sti_dd *rom_dd;
    139  1.1  tsutsui 	uint32_t grid0;
    140  1.1  tsutsui 
    141  1.1  tsutsui 	/* Identify the board model by dd_grid */
    142  1.1  tsutsui 	rom_dd = &ssc->sc_rom->rom_dd;
    143  1.1  tsutsui 	grid0 = rom_dd->dd_grid[0];
    144  1.1  tsutsui 	scr = ssc->sc_scr;
    145  1.1  tsutsui 
    146  1.1  tsutsui 	switch (grid0) {
    147  1.1  tsutsui 	case STI_DD_EVRX:
    148  1.1  tsutsui 		/*
    149  1.1  tsutsui 		 * 425e on-board EVRX framebuffer.
    150  1.1  tsutsui 		 * bitmap memory can be accessed at offset +0x200000.
    151  1.1  tsutsui 		 */
    152  1.1  tsutsui 		sc->sc_bitmap = base + STI_EVRX_FBOFFSET;
    153  1.1  tsutsui 
    154  1.1  tsutsui 		aprint_normal_dev(ssc->sc_dev, "Enable mmap support\n");
    155  1.1  tsutsui 
    156  1.1  tsutsui 		/*
    157  1.1  tsutsui 		 * initialize Bt458 RAMDAC and preserve initial color map
    158  1.1  tsutsui 		 */
    159  1.1  tsutsui 		sti_evrx_resetramdac(scr);
    160  1.1  tsutsui 		sti_evrx_resetcmap(scr);
    161  1.1  tsutsui 
    162  1.1  tsutsui 		scr->setupfb = sti_evrx_setupfb;
    163  1.1  tsutsui 		scr->putcmap = sti_evrx_putcmap;
    164  1.1  tsutsui 
    165  1.1  tsutsui 		scr->scr_wsmode = WSDISPLAYIO_MODE_EMUL;
    166  1.1  tsutsui 		waa.console = ssc->sc_flags & STI_CONSOLE ? 1 : 0;
    167  1.1  tsutsui 		waa.scrdata = &scr->scr_screenlist;
    168  1.1  tsutsui 		waa.accessops = &sti_m68k_accessops;
    169  1.1  tsutsui 		waa.accesscookie = scr;
    170  1.1  tsutsui 
    171  1.1  tsutsui 		config_found(ssc->sc_dev, &waa, wsemuldisplaydevprint,
    172  1.1  tsutsui 		    CFARGS_NONE);
    173  1.1  tsutsui 		break;
    174  1.1  tsutsui 
    175  1.1  tsutsui 	case STI_DD_CRX:
    176  1.1  tsutsui 		/*
    177  1.1  tsutsui 		 * HP A1659A CRX on some 425t variants.
    178  1.1  tsutsui 		 * bitmap memory can be accessed at offset +0x1000000.
    179  1.1  tsutsui 		 */
    180  1.1  tsutsui 		sc->sc_bitmap = base + STI_CRX_FBOFFSET;
    181  1.1  tsutsui 
    182  1.1  tsutsui 		aprint_normal_dev(ssc->sc_dev, "Enable mmap support\n");
    183  1.1  tsutsui 
    184  1.1  tsutsui 		scr->scr_wsmode = WSDISPLAYIO_MODE_EMUL;
    185  1.1  tsutsui 		waa.console = ssc->sc_flags & STI_CONSOLE ? 1 : 0;
    186  1.1  tsutsui 		waa.scrdata = &scr->scr_screenlist;
    187  1.1  tsutsui 		waa.accessops = &sti_m68k_accessops;
    188  1.1  tsutsui 		waa.accesscookie = scr;
    189  1.1  tsutsui 
    190  1.1  tsutsui 		config_found(ssc->sc_dev, &waa, wsemuldisplaydevprint,
    191  1.1  tsutsui 		    CFARGS_NONE);
    192  1.1  tsutsui 		break;
    193  1.1  tsutsui 	default:
    194  1.1  tsutsui 		/*
    195  1.1  tsutsui 		 * Unsupported variants.
    196  1.1  tsutsui 		 * Use default common sti(4) attachment (no bitmap support).
    197  1.1  tsutsui 		 */
    198  1.1  tsutsui 		sti_end_attach(ssc);
    199  1.1  tsutsui 		break;
    200  1.1  tsutsui 	}
    201  1.1  tsutsui }
    202  1.1  tsutsui 
    203  1.1  tsutsui static int
    204  1.1  tsutsui sti_evrx_putcmap(struct sti_screen *scr, u_int index, u_int count)
    205  1.1  tsutsui {
    206  1.1  tsutsui 	struct sti_rom *rom = scr->scr_rom;
    207  1.1  tsutsui 	bus_space_tag_t bst = rom->memt;
    208  1.1  tsutsui 	bus_space_handle_t bsh = rom->regh[2];
    209  1.1  tsutsui 	int i;
    210  1.1  tsutsui 
    211  1.1  tsutsui 	/* magic setup from HP-UX */
    212  1.1  tsutsui 	bus_space_write_4(bst, bsh, EVRX_MAGIC08, 0x00000001);
    213  1.1  tsutsui 	bus_space_write_4(bst, bsh, EVRX_MAGIC00, 0x00000001);
    214  1.1  tsutsui 	for (i = index; i < index + count; i++) {
    215  1.1  tsutsui 		/* this is what HP-UX woodDownloadCmap() does */
    216  1.1  tsutsui 		while ((bus_space_read_4(bst, bsh, EVRX_MAGIC10) &
    217  1.1  tsutsui 		    EVRX_MAGIC10_BSY) != 0)
    218  1.1  tsutsui 			continue;
    219  1.1  tsutsui 		bus_space_write_1(bst, bsh, EVRX_BT458_ADDR, i);
    220  1.1  tsutsui 		bus_space_write_1(bst, bsh, EVRX_BT458_CMAP, scr->scr_rcmap[i]);
    221  1.1  tsutsui 		bus_space_write_1(bst, bsh, EVRX_BT458_CMAP, scr->scr_gcmap[i]);
    222  1.1  tsutsui 		bus_space_write_4(bst, bsh, EVRX_MAGIC10,   scr->scr_bcmap[i]);
    223  1.1  tsutsui 	}
    224  1.1  tsutsui 	return 0;
    225  1.1  tsutsui }
    226  1.1  tsutsui 
    227  1.1  tsutsui static void
    228  1.1  tsutsui sti_evrx_resetramdac(struct sti_screen *scr)
    229  1.1  tsutsui {
    230  1.1  tsutsui 	struct sti_rom *rom = scr->scr_rom;
    231  1.1  tsutsui 	bus_space_tag_t bst = rom->memt;
    232  1.1  tsutsui 	bus_space_handle_t bsh = rom->regh[2];
    233  1.1  tsutsui #if 0
    234  1.1  tsutsui 	int i;
    235  1.1  tsutsui #endif
    236  1.1  tsutsui 
    237  1.1  tsutsui 	/*
    238  1.1  tsutsui 	 * Initialize the Bt458.  When we write to control registers,
    239  1.1  tsutsui 	 * the address is not incremented automatically. So we specify
    240  1.1  tsutsui 	 * it ourselves for each control register.
    241  1.1  tsutsui 	 */
    242  1.1  tsutsui 
    243  1.1  tsutsui 	/* all planes will be read */
    244  1.1  tsutsui 	bus_space_write_1(bst, bsh, EVRX_BT458_ADDR, 0x04);
    245  1.1  tsutsui 	bus_space_write_1(bst, bsh, EVRX_BT458_CTRL, 0xff);
    246  1.1  tsutsui 
    247  1.1  tsutsui 	/* all planes have non-blink */
    248  1.1  tsutsui 	bus_space_write_1(bst, bsh, EVRX_BT458_ADDR, 0x05);
    249  1.1  tsutsui 	bus_space_write_1(bst, bsh, EVRX_BT458_CTRL, 0x00);
    250  1.1  tsutsui 
    251  1.1  tsutsui 	/* palette enabled, ovly plane disabled */
    252  1.1  tsutsui 	bus_space_write_1(bst, bsh, EVRX_BT458_ADDR, 0x06);
    253  1.1  tsutsui 	bus_space_write_1(bst, bsh, EVRX_BT458_CTRL, 0x40);
    254  1.1  tsutsui 
    255  1.1  tsutsui 	/* no test mode */
    256  1.1  tsutsui 	bus_space_write_1(bst, bsh, EVRX_BT458_ADDR, 0x07);
    257  1.1  tsutsui 	bus_space_write_1(bst, bsh, EVRX_BT458_CTRL, 0x00);
    258  1.1  tsutsui 
    259  1.1  tsutsui 	/* magic initialization from HP-UX woodInitializeHardware() */
    260  1.1  tsutsui 	bus_space_write_4(bst, bsh, EVRX_MAGIC00, 0x00000001);
    261  1.1  tsutsui 	bus_space_write_4(bst, bsh, EVRX_MAGIC04, 0x00000001);
    262  1.1  tsutsui 	bus_space_write_4(bst, bsh, EVRX_MAGIC08, 0x00000001);
    263  1.1  tsutsui 	bus_space_write_4(bst, bsh, EVRX_MAGIC0C, 0x00000001);
    264  1.1  tsutsui 	bus_space_write_4(bst, bsh, EVRX_MAGIC18, 0xFFFFFFFF);
    265  1.1  tsutsui 	bus_space_write_4(bst, bsh, EVRX_MAGIC1C, 0x00000000);
    266  1.1  tsutsui 
    267  1.1  tsutsui #if 0
    268  1.1  tsutsui 	bus_space_write_1(bst, bsh, EVRX_BT458_ADDR, 0x00);
    269  1.1  tsutsui 	for (i = 0; i < 4; i++) {
    270  1.1  tsutsui 		bus_space_write_1(bst, bsh, EVRX_BT458_OMAP, 0x00);
    271  1.1  tsutsui 		bus_space_write_1(bst, bsh, EVRX_BT458_OMAP, 0x00);
    272  1.1  tsutsui 		bus_space_write_1(bst, bsh, EVRX_BT458_OMAP, 0x00);
    273  1.1  tsutsui 	}
    274  1.1  tsutsui #endif
    275  1.1  tsutsui }
    276  1.1  tsutsui 
    277  1.1  tsutsui static void
    278  1.1  tsutsui sti_evrx_resetcmap(struct sti_screen *scr)
    279  1.1  tsutsui {
    280  1.1  tsutsui 	struct sti_rom *rom = scr->scr_rom;
    281  1.1  tsutsui 	bus_space_tag_t bst = rom->memt;
    282  1.1  tsutsui 	bus_space_handle_t bsh = rom->regh[2];
    283  1.1  tsutsui 	int i;
    284  1.1  tsutsui 
    285  1.1  tsutsui 	/* magic setup from HP-UX */
    286  1.1  tsutsui 	bus_space_write_4(bst, bsh, EVRX_MAGIC08, 0x00000001);
    287  1.1  tsutsui 	bus_space_write_4(bst, bsh, EVRX_MAGIC00, 0x00000001);
    288  1.1  tsutsui 
    289  1.1  tsutsui 	/* preserve palette values initialized by STI firmware */
    290  1.1  tsutsui 	for (i = 0; i < STI_NCMAP; i++) {
    291  1.1  tsutsui 		/* this is what HP-UX woodUploadCmap() does */
    292  1.1  tsutsui 		while ((bus_space_read_4(bst, bsh, EVRX_MAGIC10) &
    293  1.1  tsutsui 		    EVRX_MAGIC10_BSY) != 0)
    294  1.1  tsutsui 			continue;
    295  1.1  tsutsui 		bus_space_write_1(bst, bsh, EVRX_BT458_ADDR, i);
    296  1.1  tsutsui 		scr->scr_rcmap[i] = bus_space_read_1(bst, bsh, EVRX_BT458_CMAP);
    297  1.1  tsutsui 		scr->scr_gcmap[i] = bus_space_read_1(bst, bsh, EVRX_BT458_CMAP);
    298  1.1  tsutsui 		scr->scr_bcmap[i] = bus_space_read_1(bst, bsh, EVRX_BT458_CMAP);
    299  1.1  tsutsui 	}
    300  1.1  tsutsui }
    301  1.1  tsutsui 
    302  1.1  tsutsui static void
    303  1.1  tsutsui sti_evrx_setupfb(struct sti_screen *scr)
    304  1.1  tsutsui {
    305  1.1  tsutsui 
    306  1.1  tsutsui 	sti_init(scr, 0);
    307  1.1  tsutsui 	sti_evrx_resetramdac(scr);
    308  1.1  tsutsui }
    309  1.1  tsutsui 
    310  1.1  tsutsui static paddr_t
    311  1.1  tsutsui sti_m68k_mmap(void *v, void *vs, off_t offset, int prot)
    312  1.1  tsutsui {
    313  1.1  tsutsui 	struct sti_screen *scr = (struct sti_screen *)v;
    314  1.1  tsutsui 	struct sti_rom *rom = scr->scr_rom;
    315  1.1  tsutsui 	struct sti_softc *ssc = rom->rom_softc;
    316  1.1  tsutsui 	struct sti_machdep_softc *sc = device_private(ssc->sc_dev);
    317  1.1  tsutsui 	paddr_t cookie = -1;
    318  1.1  tsutsui 
    319  1.1  tsutsui 	if ((offset & PAGE_MASK) != 0)
    320  1.1  tsutsui 		return -1;
    321  1.1  tsutsui 
    322  1.1  tsutsui 	switch (scr->scr_wsmode) {
    323  1.1  tsutsui 	case WSDISPLAYIO_MODE_MAPPED:
    324  1.1  tsutsui 		/* not implemented yet; what should be shown? */
    325  1.1  tsutsui 		break;
    326  1.1  tsutsui 	case WSDISPLAYIO_MODE_DUMBFB:
    327  1.1  tsutsui 		if (offset >= 0 && offset < (scr->fbwidth * scr->fbheight))
    328  1.1  tsutsui 			cookie = m68k_btop(sc->sc_bitmap + offset);
    329  1.1  tsutsui 		break;
    330  1.1  tsutsui 	default:
    331  1.1  tsutsui 		break;
    332  1.1  tsutsui 	}
    333  1.1  tsutsui 
    334  1.1  tsutsui 	return cookie;
    335  1.1  tsutsui }
    336  1.1  tsutsui 
    337  1.1  tsutsui void
    338  1.1  tsutsui sti_machdep_cnattach(bus_space_tag_t bst, paddr_t base)
    339  1.1  tsutsui {
    340  1.1  tsutsui 	int i;
    341  1.1  tsutsui 
    342  1.1  tsutsui 	sticn_tag = *bst;
    343  1.1  tsutsui 
    344  1.1  tsutsui 	/* sticn_bases[0] will be fixed in sti_cnattach() */
    345  1.1  tsutsui 	for (i = 0; i < STI_REGION_MAX; i++)
    346  1.1  tsutsui 		sticn_bases[i] = (bus_addr_t)base;
    347  1.1  tsutsui 
    348  1.1  tsutsui 	sti_cnattach(&sticn_rom, &sticn_scr, &sticn_tag, sticn_bases,
    349  1.1  tsutsui 	    STI_CODEBASE_ALT);
    350  1.1  tsutsui }
    351