1 /* $NetBSD: veritefbio.h,v 1.1 2026/07/11 15:18:21 rkujawa Exp $ */ 2 3 /* 4 * Copyright (c) 2026 The NetBSD Foundation, Inc. 5 * All rights reserved. 6 * 7 * This code is derived from software contributed to The NetBSD Foundation 8 * by Radoslaw Kujawa. 9 * 10 * Redistribution and use in source and binary forms, with or without 11 * modification, are permitted provided that the following conditions 12 * are met: 13 * 1. Redistributions of source code must retain the above copyright 14 * notice, this list of conditions and the following disclaimer. 15 * 2. Redistributions in binary form must reproduce the above copyright 16 * notice, this list of conditions and the following disclaimer in the 17 * documentation and/or other materials provided with the distribution. 18 * 19 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 20 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 21 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 22 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 23 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 24 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 28 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 */ 30 31 /* 32 * veritefb RISC debug ioctl interface. 33 * 34 * Only available in kernels built with the VERITEFB_DEBUG. 35 */ 36 37 #ifndef VERITEFBIO_H 38 #define VERITEFBIO_H 39 40 #include <sys/ioccom.h> 41 42 #define VERITEFB_DIAG_RING 16 43 44 struct veritefb_dbg_diag { 45 uint32_t vd_accel; /* 0 off, 1 sw-degraded, 2 on */ 46 uint32_t vd_pc; /* sampled RISC program counter */ 47 uint32_t vd_fifoinfree; 48 uint32_t vd_fifooutvalid; 49 uint32_t vd_debugreg; 50 uint32_t vd_heartbeat; /* 0 ok, 1 skipped, 2 failed */ 51 uint32_t vd_ringcount; /* total FIFO words ever written */ 52 uint32_t vd_ring[VERITEFB_DIAG_RING]; /* newest last */ 53 }; 54 55 struct veritefb_dbg_rw { 56 uint32_t vr_addr; /* register index or address */ 57 uint32_t vr_val; 58 }; 59 60 #define VERITEFB_DBG_DIAG _IOR('V', 100, struct veritefb_dbg_diag) 61 #define VERITEFB_DBG_HOLD _IO('V', 101) 62 #define VERITEFB_DBG_CONT _IO('V', 102) 63 #define VERITEFB_DBG_RDREG _IOWR('V', 103, struct veritefb_dbg_rw) 64 #define VERITEFB_DBG_RDMEM _IOWR('V', 104, struct veritefb_dbg_rw) 65 #define VERITEFB_DBG_FAULT _IO('V', 105) /* wedge on purpose */ 66 #define VERITEFB_DBG_RESET _IOR('V', 106, int) /* reload + restart */ 67 68 /* accumulated per-op statistics */ 69 struct veritefb_dbg_stats { 70 uint64_t vs_count[8]; 71 uint64_t vs_us[8]; 72 }; 73 #define VFB_STAT_FILL 0 /* eraserows/erasecols */ 74 #define VFB_STAT_BLT 1 /* copyrows/copycols */ 75 #define VFB_STAT_CHAR_SPACE 2 /* putchar: space rectfill */ 76 #define VFB_STAT_CHAR_HIT 3 /* putchar: glyphcache hit */ 77 #define VFB_STAT_CHAR_ADD 4 /* putchar: SW render + cache add */ 78 #define VFB_STAT_CHAR_SW 5 /* putchar: SW fallback */ 79 80 #define VERITEFB_DBG_STATS _IOR('V', 108, struct veritefb_dbg_stats) 81 #define VERITEFB_DBG_STATCLR _IO('V', 109) 82 83 /* raw byte access to the chip register window (offset < 0x100) */ 84 #define VERITEFB_DBG_IO_IOSPACE 0x1000 /* vr_addr flag: force the I/O BAR */ 85 #define VERITEFB_DBG_RDIO _IOWR('V', 110, struct veritefb_dbg_rw) 86 #define VERITEFB_DBG_WRIO _IOW('V', 111, struct veritefb_dbg_rw) 87 88 #endif /* VERITEFBIO_H */ 89