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