1*f4485e64Stsutsui /* $NetBSD: diofbvar.h,v 1.5 2024/05/01 19:28:33 tsutsui Exp $ */ 2b04b7da8Stsutsui /* $OpenBSD: diofbvar.h,v 1.10 2006/08/11 18:33:13 miod Exp $ */ 3b04b7da8Stsutsui 4b04b7da8Stsutsui /* 5b04b7da8Stsutsui * Copyright (c) 2005, Miodrag Vallat 6b04b7da8Stsutsui * 7b04b7da8Stsutsui * Redistribution and use in source and binary forms, with or without 8b04b7da8Stsutsui * modification, are permitted provided that the following conditions 9b04b7da8Stsutsui * are met: 10b04b7da8Stsutsui * 1. Redistributions of source code must retain the above copyright 11b04b7da8Stsutsui * notice, this list of conditions and the following disclaimer. 12b04b7da8Stsutsui * 2. Redistributions in binary form must reproduce the above copyright 13b04b7da8Stsutsui * notice, this list of conditions and the following disclaimer in the 14b04b7da8Stsutsui * documentation and/or other materials provided with the distribution. 15b04b7da8Stsutsui * 16b04b7da8Stsutsui * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 17b04b7da8Stsutsui * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18b04b7da8Stsutsui * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19b04b7da8Stsutsui * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, 20b04b7da8Stsutsui * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21b04b7da8Stsutsui * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 22b04b7da8Stsutsui * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 23b04b7da8Stsutsui * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 24b04b7da8Stsutsui * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 25b04b7da8Stsutsui * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26b04b7da8Stsutsui * POSSIBILITY OF SUCH DAMAGE. 27b04b7da8Stsutsui */ 28b04b7da8Stsutsui /* 29b04b7da8Stsutsui * Copyright (c) 1988 University of Utah. 30b04b7da8Stsutsui * Copyright (c) 1990, 1993 31b04b7da8Stsutsui * The Regents of the University of California. All rights reserved. 32b04b7da8Stsutsui * 33b04b7da8Stsutsui * This code is derived from software contributed to Berkeley by 34b04b7da8Stsutsui * the Systems Programming Group of the University of Utah Computer 35b04b7da8Stsutsui * Science Department. 36b04b7da8Stsutsui * 37b04b7da8Stsutsui * Redistribution and use in source and binary forms, with or without 38b04b7da8Stsutsui * modification, are permitted provided that the following conditions 39b04b7da8Stsutsui * are met: 40b04b7da8Stsutsui * 1. Redistributions of source code must retain the above copyright 41b04b7da8Stsutsui * notice, this list of conditions and the following disclaimer. 42b04b7da8Stsutsui * 2. Redistributions in binary form must reproduce the above copyright 43b04b7da8Stsutsui * notice, this list of conditions and the following disclaimer in the 44b04b7da8Stsutsui * documentation and/or other materials provided with the distribution. 45b04b7da8Stsutsui * 3. Neither the name of the University nor the names of its contributors 46b04b7da8Stsutsui * may be used to endorse or promote products derived from this software 47b04b7da8Stsutsui * without specific prior written permission. 48b04b7da8Stsutsui * 49b04b7da8Stsutsui * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 50b04b7da8Stsutsui * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 51b04b7da8Stsutsui * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 52b04b7da8Stsutsui * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 53b04b7da8Stsutsui * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 54b04b7da8Stsutsui * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 55b04b7da8Stsutsui * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 56b04b7da8Stsutsui * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 57b04b7da8Stsutsui * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 58b04b7da8Stsutsui * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 59b04b7da8Stsutsui * SUCH DAMAGE. 60b04b7da8Stsutsui * 61b04b7da8Stsutsui * from: Utah $Hdr: grfvar.h 1.11 93/08/13$ 62b04b7da8Stsutsui * 63b04b7da8Stsutsui * @(#)grfvar.h 8.2 (Berkeley) 9/9/93 64b04b7da8Stsutsui */ 65b04b7da8Stsutsui 66b04b7da8Stsutsui #ifdef _KERNEL 67b04b7da8Stsutsui 68b04b7da8Stsutsui struct diocmap { 695d7f465dStsutsui uint8_t r[256], g[256], b[256]; 70b04b7da8Stsutsui }; 71b04b7da8Stsutsui 72b04b7da8Stsutsui /* 73b04b7da8Stsutsui * Minimal frame buffer state structure. 74b04b7da8Stsutsui */ 75b04b7da8Stsutsui struct diofb { 76b04b7da8Stsutsui uint8_t *regkva; /* KVA of registers */ 77b04b7da8Stsutsui uint8_t *fbkva; /* KVA of framebuffer */ 78b04b7da8Stsutsui 79b04b7da8Stsutsui uint8_t *regaddr; /* control registers physaddr */ 80b04b7da8Stsutsui uint8_t *fbaddr; /* frame buffer physaddr */ 81b04b7da8Stsutsui 82b04b7da8Stsutsui u_int fbsize; /* frame buffer size */ 83b04b7da8Stsutsui u_int fbwidth; /* frame buffer width */ 84b04b7da8Stsutsui u_int fbheight; /* frame buffer height */ 85b04b7da8Stsutsui u_int dwidth; /* displayed part width */ 86b04b7da8Stsutsui u_int dheight; /* displayed part height */ 87b04b7da8Stsutsui 88b04b7da8Stsutsui u_int planes; /* number of planes */ 89b04b7da8Stsutsui u_int planemask; /* and related mask */ 90b04b7da8Stsutsui 91b04b7da8Stsutsui /* rasops information */ 92b04b7da8Stsutsui struct rasops_info ri; 93b04b7da8Stsutsui 94b04b7da8Stsutsui /* color information */ 95b04b7da8Stsutsui struct diocmap cmap; 96b04b7da8Stsutsui 97b04b7da8Stsutsui /* wsdisplay information */ 98b04b7da8Stsutsui char wsdname[32]; 99b04b7da8Stsutsui struct wsscreen_descr wsd; 100b04b7da8Stsutsui struct wsscreen_list wsl; 101b04b7da8Stsutsui struct wsscreen_descr *scrlist[1]; 102b04b7da8Stsutsui int nscreens; 103b04b7da8Stsutsui u_int mapmode; 104b04b7da8Stsutsui 105b04b7da8Stsutsui /* blockmove routine */ 1065d7f465dStsutsui int (*bmv)(struct diofb *, uint16_t, uint16_t, uint16_t, 1075d7f465dStsutsui uint16_t, uint16_t, uint16_t, int16_t, int16_t); 108*f4485e64Stsutsui 109*f4485e64Stsutsui /* putchar routine to handle rasops; MD busywait might be required */ 110*f4485e64Stsutsui void (*wsputchar)(void *, int, int, u_int, long); 111b04b7da8Stsutsui }; 112b04b7da8Stsutsui 113b04b7da8Stsutsui /* Replacement Rules (rops) */ 114b04b7da8Stsutsui #define RR_CLEAR 0x0 115b04b7da8Stsutsui #define RR_COPY 0x3 116b04b7da8Stsutsui #define RR_XOR 0x6 117b04b7da8Stsutsui #define RR_INVERT 0xa 118b04b7da8Stsutsui #define RR_COPYINVERTED 0xc 119b04b7da8Stsutsui 120b04b7da8Stsutsui void diofb_cnattach(struct diofb *); 121b04b7da8Stsutsui void diofb_end_attach(device_t, struct wsdisplay_accessops *, struct diofb *, 122b04b7da8Stsutsui int, const char *); 123b04b7da8Stsutsui int diofb_fbinquire(struct diofb *, int, struct diofbreg *); 124b04b7da8Stsutsui void diofb_fbsetup(struct diofb *); 125b04b7da8Stsutsui int diofb_getcmap(struct diofb *, struct wsdisplay_cmap *); 126b04b7da8Stsutsui void diofb_resetcmap(struct diofb *); 127b04b7da8Stsutsui 128b04b7da8Stsutsui int diofb_alloc_attr(void *, int, int, int, long *); 129b04b7da8Stsutsui int diofb_alloc_screen(void *, const struct wsscreen_descr *, void **, 130b04b7da8Stsutsui int *, int *, long *); 131b04b7da8Stsutsui void diofb_free_screen(void *, void *); 132b04b7da8Stsutsui paddr_t diofb_mmap(void *, void *, off_t, int); 133b04b7da8Stsutsui int diofb_show_screen(void *, void *, int, void (*)(void *, int, int), 134b04b7da8Stsutsui void *); 135b04b7da8Stsutsui 1365d7f465dStsutsui int diofb_mono_windowmove(struct diofb *, uint16_t, uint16_t, uint16_t, 1375d7f465dStsutsui uint16_t, uint16_t, uint16_t, int16_t, int16_t); 138b04b7da8Stsutsui 139b04b7da8Stsutsui /* Console support */ 140b04b7da8Stsutsui int dvboxcnattach(bus_space_tag_t, bus_addr_t, int); 141b04b7da8Stsutsui int gboxcnattach(bus_space_tag_t, bus_addr_t, int); 142b04b7da8Stsutsui int hypercnattach(bus_space_tag_t, bus_addr_t, int); 143b04b7da8Stsutsui int rboxcnattach(bus_space_tag_t, bus_addr_t, int); 144b04b7da8Stsutsui int topcatcnattach(bus_space_tag_t, bus_addr_t, int); 145b04b7da8Stsutsui int tvrxcnattach(bus_space_tag_t, bus_addr_t, int); 14694f17fd8Stsutsui int gendiofbcnattach(bus_space_tag_t, bus_addr_t, int); 147b04b7da8Stsutsui extern struct diofb diofb_cn; /* struct diofb for console device */ 148b04b7da8Stsutsui 149b04b7da8Stsutsui #endif 150b04b7da8Stsutsui 151b04b7da8Stsutsui /* 152b04b7da8Stsutsui * In mapped mode, mmap() will provide the following layout: 153b04b7da8Stsutsui * 0 - (DIOFB_REGSPACE - 1) frame buffer registers 154b04b7da8Stsutsui * DIOFB_REGSPACE onwards frame buffer memory 155b04b7da8Stsutsui */ 156b04b7da8Stsutsui #define DIOFB_REGSPACE 0x020000 157