FreeBSD/Linux Kernel Cross Reference
sys/dev/ic/stivar.h
1 /* $NetBSD: stivar.h,v 1.11 2020/12/23 08:34:35 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_space_handle_t regh[STI_REGION_MAX];
46 bus_addr_t *bases;
47
48 struct sti_dd rom_dd; /* in word format */
49 vaddr_t rom_code;
50
51 /*
52 * ROM-provided function pointers
53 */
54 sti_init_t init;
55 sti_mgmt_t mgmt;
56 sti_unpmv_t unpmv;
57 sti_blkmv_t blkmv;
58 sti_test_t test;
59 sti_exhdl_t exhdl;
60 sti_inqconf_t inqconf;
61 sti_scment_t scment;
62 sti_dmac_t dmac;
63 sti_flowc_t flowc;
64 sti_utiming_t utiming;
65 sti_pmgr_t pmgr;
66 sti_util_t util;
67 };
68
69 /*
70 * STI screen information - one per head
71 */
72 struct sti_screen {
73 struct sti_rom *scr_rom;
74
75 #ifdef notyet
76 u_int scr_flags;
77 #endif
78
79 int scr_bpp;
80
81 struct sti_font scr_curfont;
82 struct sti_cfg scr_cfg;
83 struct sti_ecfg scr_ecfg;
84 char name[STI_DEVNAME_LEN];
85
86 void *scr_romfont; /* ROM font copy in memory... */
87 u_int scr_fontmaxcol;/* ...or in off-screen area */
88 u_int scr_fontbase;
89
90 uint8_t scr_rcmap[STI_NCMAP],
91 scr_gcmap[STI_NCMAP],
92 scr_bcmap[STI_NCMAP];
93
94 uint16_t fbheight, fbwidth;
95 uint16_t oheight, owidth; /* offscreen size */
96 bus_addr_t fbaddr;
97 bus_size_t fblen;
98
99 /* wsdisplay information */
100 int scr_nscreens;
101 u_int scr_wsmode;
102 struct wsscreen_descr scr_wsd;
103 const struct wsscreen_descr *scr_scrlist[1];
104 struct wsscreen_list scr_screenlist;
105
106 /*
107 * Board-specific function data and pointers
108 */
109 void (*setupfb)(struct sti_screen *);
110 int (*putcmap)(struct sti_screen *, u_int, u_int);
111
112 uint32_t reg10_value;
113 uint32_t reg12_value;
114 bus_addr_t cmap_finish_register;
115 };
116
117 /*
118 * STI device state
119 */
120 struct sti_softc {
121 device_t sc_dev;
122 #if notyet
123 void *sc_ih;
124 #endif
125
126 u_int sc_flags;
127 #define STI_CONSOLE 0x0001 /* first head is console... */
128 #define STI_ATTACHED 0x0002 /* ... and wsdisplay_cnattach() has been done */
129 #define STI_ROM_ENABLED 0x0004 /* PCI ROM is enabled */
130
131 bus_addr_t bases[STI_REGION_MAX];
132 struct sti_rom *sc_rom;
133 struct sti_screen *sc_scr;
134
135 /* optional, required for PCI */
136 void (*sc_enable_rom)(struct sti_softc *);
137 void (*sc_disable_rom)(struct sti_softc *);
138 };
139
140 int sti_attach_common(struct sti_softc *, bus_space_tag_t, bus_space_tag_t,
141 bus_space_handle_t, u_int);
142 int sti_cnattach(struct sti_rom *, struct sti_screen *, bus_space_tag_t,
143 bus_addr_t *, u_int);
144 void sti_describe(struct sti_softc *);
145 void sti_end_attach(struct sti_softc *);
146 u_int sti_rom_size(bus_space_tag_t, bus_space_handle_t);
147
148 int sti_init(struct sti_screen *, int);
149 #define STI_TEXTMODE 0x01
150 #define STI_CLEARSCR 0x02
151 #define STI_FBMODE 0x04
152 int sti_ioctl(void *, void *, u_long, void *, int, struct lwp *);
153 paddr_t sti_mmap(void *, void *, off_t, int);
154 int sti_alloc_screen(void *, const struct wsscreen_descr *,
155 void **, int *, int *, long *);
156 void sti_free_screen(void *, void *);
157 int sti_show_screen(void *, void *, int, void (*cb)(void *, int, int),
158 void *);
159 int sti_load_font(void *, void *, struct wsdisplay_font *);
160
161 int sti_cnattach(struct sti_rom *, struct sti_screen *, bus_space_tag_t,
162 bus_addr_t *, u_int);
163
164 #endif /* _IC_STIVAR_H_ */
Cache object: 0d2c3df94f7a6bf3649a35ebe34ab408
|