1 /* $OpenBSD: stivar.h,v 1.23 2007/01/12 22:02:33 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 struct sti_screen {
35 struct sti_softc *scr_main; /* may be NULL if early console */
36 int scr_devtype;
37
38 bus_space_tag_t iot, memt;
39 bus_space_handle_t romh;
40 bus_addr_t *bases;
41 bus_addr_t fbaddr;
42 bus_size_t fblen;
43
44 int scr_bpp;
45
46 struct sti_dd scr_dd; /* in word format */
47 struct sti_font scr_curfont;
48 struct sti_cfg scr_cfg;
49 struct sti_ecfg scr_ecfg;
50
51 void *scr_romfont; /* ROM font copy, either in memory... */
52 u_int scr_fontmaxcol; /* ...or in off-screen frame buffer */
53 u_int scr_fontbase;
54
55 u_int8_t scr_rcmap[STI_NCMAP],
56 scr_gcmap[STI_NCMAP],
57 scr_bcmap[STI_NCMAP];
58
59 vaddr_t scr_code;
60 sti_init_t init;
61 sti_mgmt_t mgmt;
62 sti_unpmv_t unpmv;
63 sti_blkmv_t blkmv;
64 sti_test_t test;
65 sti_exhdl_t exhdl;
66 sti_inqconf_t inqconf;
67 sti_scment_t scment;
68 sti_dmac_t dmac;
69 sti_flowc_t flowc;
70 sti_utiming_t utiming;
71 sti_pmgr_t pmgr;
72 sti_util_t util;
73
74 u_int16_t fbheight, fbwidth, oheight, owidth;
75 u_int8_t name[STI_DEVNAME_LEN];
76
77 /* wsdisplay information */
78 struct wsscreen_descr scr_wsd;
79 struct wsscreen_descr *scr_scrlist[1];
80 struct wsscreen_list scr_screenlist;
81 };
82
83 struct sti_softc {
84 struct device sc_dev;
85 void *sc_ih;
86
87 u_int sc_flags;
88 #define STI_TEXTMODE 0x0001
89 #define STI_CLEARSCR 0x0002
90 #define STI_CONSOLE 0x0004
91 #define STI_ATTACHED 0x0008
92 #define STI_ROM_ENABLED 0x0010
93 int sc_nscreens;
94
95 bus_space_tag_t iot, memt;
96 bus_space_handle_t romh;
97 bus_addr_t bases[STI_REGION_MAX];
98
99 struct sti_screen *sc_scr;
100 u_int sc_wsmode;
101
102 /* optional, required for PCI */
103 void (*sc_enable_rom)(struct sti_softc *);
104 void (*sc_disable_rom)(struct sti_softc *);
105 };
106
107 int sti_attach_common(struct sti_softc *sc, u_int codebase);
108 void sti_clear(struct sti_screen *);
109 int sti_cnattach(struct sti_screen *, bus_space_tag_t, bus_addr_t *, u_int);
110 void sti_describe(struct sti_softc *);
111 void sti_end_attach(void *);
112 u_int sti_rom_size(bus_space_tag_t, bus_space_handle_t);
113
114 #endif /* _IC_STIVAR_H_ */