1 /* $OpenBSD: stivar.h,v 1.29 2024/08/17 08:45:22 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 struct sti_screen; 34 35 /* 36 * STI ROM information - one per device 37 */ 38 struct sti_rom { 39 struct sti_softc *rom_softc; /* backpointer to device */ 40 int rom_devtype; 41 42 bus_space_tag_t iot, memt; /* XXX iot unused */ 43 bus_space_handle_t romh; 44 bus_space_handle_t regh[STI_REGION_MAX]; 45 bus_addr_t *bases; 46 47 struct sti_dd rom_dd; /* in word format */ 48 u_int8_t *rom_code; 49 50 int rom_enable; 51 52 /* 53 * ROM-provided function pointers 54 */ 55 sti_init_t init; 56 sti_unpmv_t unpmv; 57 sti_blkmv_t blkmv; 58 sti_inqconf_t inqconf; 59 sti_scment_t scment; 60 }; 61 62 /* 63 * STI screen information - one per head 64 */ 65 struct sti_screen { 66 struct sti_rom *scr_rom; 67 68 #ifdef notyet 69 u_int scr_flags; 70 #endif 71 72 int scr_bpp; 73 74 struct sti_font scr_curfont; 75 struct sti_cfg scr_cfg; 76 struct sti_ecfg scr_ecfg; 77 u_int8_t name[STI_DEVNAME_LEN]; 78 79 void *scr_romfont; /* ROM font copy in memory... */ 80 u_int scr_fontmaxcol;/* ...or in off-screen area */ 81 u_int scr_fontbase; 82 83 u_int8_t scr_rcmap[STI_NCMAP], 84 scr_gcmap[STI_NCMAP], 85 scr_bcmap[STI_NCMAP]; 86 87 u_int16_t fbheight, fbwidth; 88 u_int16_t oheight, owidth; /* offscreen size */ 89 bus_addr_t fbaddr; 90 bus_size_t fblen; 91 92 /* wsdisplay information */ 93 int scr_nscreens; 94 u_int scr_wsmode; 95 struct wsscreen_descr scr_wsd; 96 struct wsscreen_descr *scr_scrlist[1]; 97 struct wsscreen_list scr_screenlist; 98 99 /* 100 * Board-specific function data and pointers 101 */ 102 void (*setupfb)(struct sti_screen *); 103 int (*putcmap)(struct sti_screen *, u_int, u_int); 104 105 uint32_t reg10_value; 106 uint32_t reg12_value; 107 bus_addr_t cmap_finish_register; 108 }; 109 110 /* 111 * STI device state 112 */ 113 struct sti_softc { 114 struct device sc_dev; 115 #ifdef notyet 116 void *sc_ih; 117 #endif 118 119 u_int sc_flags; 120 #define STI_CONSOLE 0x0001 /* first head is console... */ 121 #define STI_ATTACHED 0x0002 /* ... and wsdisplay_cnattach() has been done */ 122 #define STI_ROM_ENABLED 0x0004 /* PCI ROM is enabled */ 123 124 bus_addr_t bases[STI_REGION_MAX]; 125 struct sti_rom *sc_rom; 126 struct sti_screen *sc_scr; 127 128 /* optional, required for PCI */ 129 void (*sc_enable_rom)(struct sti_softc *); 130 void (*sc_disable_rom)(struct sti_softc *); 131 }; 132 133 int sti_attach_common(struct sti_softc *, bus_space_tag_t, bus_space_tag_t, 134 bus_space_handle_t, u_int); 135 void sti_describe(struct sti_softc *); 136 void sti_end_attach(void *); 137 u_int sti_rom_size(bus_space_tag_t, bus_space_handle_t); 138 139 #endif /* _IC_STIVAR_H_ */ 140