1 /* $OpenBSD: stivar.h,v 1.24 2009/02/06 22:51:04 miod Exp $ */ 2 3 /* 4 * Copyright (c) 2000-2003 Michael Shalayeff 5 * All rights reserved. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions 9 * are met: 10 * 1. Redistributions of source code must retain the above copyright 11 * notice, this list of conditions and the following disclaimer. 12 * 2. Redistributions in binary form must reproduce the above copyright 13 * notice, this list of conditions and the following disclaimer in the 14 * documentation and/or other materials provided with the distribution. 15 * 16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 17 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 18 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 19 * IN NO EVENT SHALL THE AUTHOR OR HIS RELATIVES BE LIABLE FOR ANY DIRECT, 20 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 22 * SERVICES; LOSS OF MIND, USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 23 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 24 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 25 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 26 * THE POSSIBILITY OF SUCH DAMAGE. 27 */ 28 29 #ifndef _IC_STIVAR_H_ 30 #define _IC_STIVAR_H_ 31 32 struct sti_softc; 33 34 /* 35 * STI ROM information - one per device 36 */ 37 struct sti_rom { 38 struct sti_softc *rom_softc; /* backpointer to device */ 39 int rom_devtype; 40 41 bus_space_tag_t iot, memt; /* XXX iot unused */ 42 bus_space_handle_t romh; 43 bus_addr_t *bases; 44 45 struct sti_dd rom_dd; /* in word format */ 46 47 vaddr_t rom_code; 48 sti_init_t init; 49 sti_mgmt_t mgmt; 50 sti_unpmv_t unpmv; 51 sti_blkmv_t blkmv; 52 sti_test_t test; 53 sti_exhdl_t exhdl; 54 sti_inqconf_t inqconf; 55 sti_scment_t scment; 56 sti_dmac_t dmac; 57 sti_flowc_t flowc; 58 sti_utiming_t utiming; 59 sti_pmgr_t pmgr; 60 sti_util_t util; 61 }; 62 63 /* 64 * STI screen information - one per head 65 */ 66 struct sti_screen { 67 struct sti_rom *scr_rom; 68 69 #ifdef notyet 70 u_int scr_flags; 71 #endif 72 73 int scr_bpp; 74 75 struct sti_font scr_curfont; 76 struct sti_cfg scr_cfg; 77 struct sti_ecfg scr_ecfg; 78 u_int8_t name[STI_DEVNAME_LEN]; 79 80 void *scr_romfont; /* ROM font copy in memory... */ 81 u_int scr_fontmaxcol;/* ...or in off-screen area */ 82 u_int scr_fontbase; 83 84 u_int8_t scr_rcmap[STI_NCMAP], 85 scr_gcmap[STI_NCMAP], 86 scr_bcmap[STI_NCMAP]; 87 88 u_int16_t fbheight, fbwidth; 89 u_int16_t oheight, owidth; /* offscreen size */ 90 bus_addr_t fbaddr; 91 bus_size_t fblen; 92 93 /* wsdisplay information */ 94 int scr_nscreens; 95 u_int scr_wsmode; 96 struct wsscreen_descr scr_wsd; 97 struct wsscreen_descr *scr_scrlist[1]; 98 struct wsscreen_list scr_screenlist; 99 }; 100 101 /* 102 * STI device state 103 */ 104 struct sti_softc { 105 struct device sc_dev; 106 #ifdef notyet 107 void *sc_ih; 108 #endif 109 110 u_int sc_flags; 111 #define STI_CONSOLE 0x0001 /* first head is console... */ 112 #define STI_ATTACHED 0x0002 /* ... and wsdisplay_cnattach() has been done */ 113 #define STI_ROM_ENABLED 0x0004 /* PCI ROM is enabled */ 114 115 bus_addr_t bases[STI_REGION_MAX]; 116 struct sti_rom *sc_rom; 117 struct sti_screen *sc_scr; 118 119 /* optional, required for PCI */ 120 void (*sc_enable_rom)(struct sti_softc *); 121 void (*sc_disable_rom)(struct sti_softc *); 122 }; 123 124 int sti_attach_common(struct sti_softc *, bus_space_tag_t, bus_space_tag_t, 125 bus_space_handle_t, u_int); 126 int sti_cnattach(struct sti_rom *, struct sti_screen *, bus_space_tag_t, 127 bus_addr_t *, u_int); 128 void sti_describe(struct sti_softc *); 129 void sti_end_attach(void *); 130 u_int sti_rom_size(bus_space_tag_t, bus_space_handle_t); 131 132 #endif /* _IC_STIVAR_H_ */ 133