grfvar.h revision 1.29.66.1 1 /* $NetBSD: grfvar.h,v 1.29.66.1 2011/03/05 20:50:56 rmind Exp $ */
2
3 /*
4 * Copyright (c) 1988 University of Utah.
5 * Copyright (c) 1990 The Regents of the University of California.
6 * All rights reserved.
7 *
8 * This code is derived from software contributed to Berkeley by
9 * the Systems Programming Group of the University of Utah Computer
10 * Science Department.
11 *
12 * Redistribution and use in source and binary forms, with or without
13 * modification, are permitted provided that the following conditions
14 * are met:
15 * 1. Redistributions of source code must retain the above copyright
16 * notice, this list of conditions and the following disclaimer.
17 * 2. Redistributions in binary form must reproduce the above copyright
18 * notice, this list of conditions and the following disclaimer in the
19 * documentation and/or other materials provided with the distribution.
20 * 3. Neither the name of the University nor the names of its contributors
21 * may be used to endorse or promote products derived from this software
22 * without specific prior written permission.
23 *
24 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
25 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
30 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
31 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
33 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34 * SUCH DAMAGE.
35 *
36 * from: Utah $Hdr: grfvar.h 1.9 91/01/21$
37 *
38 * @(#)grfvar.h 7.3 (Berkeley) 5/7/91
39 */
40
41 #define CARD_NAME_LEN 64
42
43 /*
44 * State info, per hardware instance.
45 */
46 struct grfbus_softc {
47 struct device sc_dev;
48 nubus_slot sc_slot;
49
50 bus_addr_t sc_basepa; /* base of video space */
51 bus_addr_t sc_fbofs; /* offset to framebuffer */
52
53 bus_space_tag_t sc_tag;
54 bus_space_handle_t sc_handle;
55 bus_space_handle_t sc_regh;
56
57 struct grfmode curr_mode; /* hardware desc(for ioctl) */
58 u_int32_t card_id; /* DrHW value for nubus cards */
59 bus_size_t cli_offset; /* Offset to clear interrupt */
60 /* for cards where that's suff. */
61 u_int32_t cli_value; /* Value to write at cli_offset */
62 nubus_dir board_dir; /* Nubus dir for curr board */
63 };
64
65 /*
66 * State info, per grf instance.
67 */
68 struct grf_softc {
69 char sc_xname[15]; /* name of the device */
70 struct macfb_softc *mfb_sc;
71 };
72
73 /*
74 * Attach grf and ite semantics to Mac video hardware.
75 */
76 struct grfbus_attach_args {
77 const char *ga_name; /* name of semantics to attach */
78 bus_space_tag_t ga_tag; /* forwarded ... */
79 bus_space_handle_t ga_handle;
80 struct grfmode *ga_grfmode;
81 nubus_slot *ga_slot;
82 bus_addr_t ga_phys;
83 bus_addr_t ga_fboff;
84 int (*ga_mode)(struct grf_softc *, int, void *);
85 };
86
87 typedef void *(*grf_phys_t)(struct grf_softc *, vaddr_t);
88
89 /* flags */
90 #define GF_ALIVE 0x01
91 #define GF_OPEN 0x02
92 #define GF_EXCLUDE 0x04
93 #define GF_WANTED 0x08
94 #define GF_BSDOPEN 0x10
95 #define GF_HPUXOPEN 0x20
96
97 /* requests to mode routine */
98 #define GM_GRFON 1
99 #define GM_GRFOFF 2
100 #define GM_CURRMODE 3
101 #define GM_LISTMODES 4
102 #define GM_NEWMODE 5
103
104 /* minor device interpretation */
105 #define GRFUNIT(d) (minor(d))
106
107 /*
108 * Nubus image data structure. This is the equivalent of a PixMap in
109 * MacOS programming parlance. One of these structures exists for each
110 * video mode that a quickdraw compatible card can fit in.
111 */
112 struct image_data {
113 u_int32_t size;
114 u_int32_t offset;
115 u_int16_t rowbytes;
116 u_int16_t top;
117 u_int16_t left;
118 u_int16_t bottom;
119 u_int16_t right;
120 u_int16_t version;
121 u_int16_t packType;
122 u_int32_t packSize;
123 u_int32_t hRes;
124 u_int32_t vRes;
125 u_int16_t pixelType;
126 u_int16_t pixelSize;
127 u_int16_t cmpCount;
128 u_int16_t cmpSize;
129 u_int32_t planeBytes;
130 };
131
132 #define VID_PARAMS 1
133 #define VID_TABLE_OFFSET 2
134 #define VID_PAGE_CNT 3
135 #define VID_DEV_TYPE 4
136
137 void grf_attach(struct macfb_softc *, int);
138
139 void grf_establish(struct grfbus_softc *, nubus_slot *,
140 int (*)(struct grf_softc *, int, void *));
141 int grfbusprint(void *, const char *);
142