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