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