1 1.16 riastrad /* $NetBSD: drm_print.c,v 1.16 2021/12/29 23:59:37 riastradh Exp $ */ 2 1.1 riastrad 3 1.1 riastrad /* 4 1.1 riastrad * Copyright (C) 2016 Red Hat 5 1.1 riastrad * 6 1.1 riastrad * Permission is hereby granted, free of charge, to any person obtaining a 7 1.1 riastrad * copy of this software and associated documentation files (the "Software"), 8 1.1 riastrad * to deal in the Software without restriction, including without limitation 9 1.1 riastrad * the rights to use, copy, modify, merge, publish, distribute, sublicense, 10 1.1 riastrad * and/or sell copies of the Software, and to permit persons to whom the 11 1.1 riastrad * Software is furnished to do so, subject to the following conditions: 12 1.1 riastrad * 13 1.1 riastrad * The above copyright notice and this permission notice shall be included in 14 1.1 riastrad * all copies or substantial portions of the Software. 15 1.1 riastrad * 16 1.1 riastrad * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 1.1 riastrad * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 1.1 riastrad * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 19 1.1 riastrad * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR 20 1.1 riastrad * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 21 1.1 riastrad * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 22 1.1 riastrad * OTHER DEALINGS IN THE SOFTWARE. 23 1.1 riastrad * 24 1.1 riastrad * Authors: 25 1.1 riastrad * Rob Clark <robdclark (at) gmail.com> 26 1.1 riastrad */ 27 1.1 riastrad 28 1.1 riastrad #include <sys/cdefs.h> 29 1.16 riastrad __KERNEL_RCSID(0, "$NetBSD: drm_print.c,v 1.16 2021/12/29 23:59:37 riastradh Exp $"); 30 1.1 riastrad 31 1.4 riastrad #ifndef __NetBSD__ /* XXX ??? */ 32 1.1 riastrad #define DEBUG /* for pr_debug() */ 33 1.4 riastrad #endif 34 1.1 riastrad 35 1.3 riastrad #ifdef __NetBSD__ 36 1.6 riastrad #include <sys/param.h> 37 1.3 riastrad #include <sys/stdarg.h> 38 1.10 riastrad #include <sys/cpu.h> 39 1.6 riastrad #include <sys/device.h> 40 1.9 riastrad #include <sys/ksyms.h> 41 1.13 riastrad #include <sys/pserialize.h> 42 1.3 riastrad #else 43 1.1 riastrad #include <stdarg.h> 44 1.16 riastrad #endif 45 1.1 riastrad 46 1.1 riastrad #include <linux/io.h> 47 1.1 riastrad #include <linux/moduleparam.h> 48 1.1 riastrad #include <linux/seq_file.h> 49 1.1 riastrad #include <linux/slab.h> 50 1.1 riastrad 51 1.1 riastrad #include <drm/drm.h> 52 1.1 riastrad #include <drm/drm_drv.h> 53 1.1 riastrad #include <drm/drm_print.h> 54 1.1 riastrad 55 1.1 riastrad /* 56 1.1 riastrad * __drm_debug: Enable debug output. 57 1.1 riastrad * Bitmask of DRM_UT_x. See include/drm/drm_print.h for details. 58 1.1 riastrad */ 59 1.1 riastrad unsigned int __drm_debug; 60 1.1 riastrad EXPORT_SYMBOL(__drm_debug); 61 1.1 riastrad 62 1.1 riastrad MODULE_PARM_DESC(debug, "Enable debug output, where each bit enables a debug category.\n" 63 1.1 riastrad "\t\tBit 0 (0x01) will enable CORE messages (drm core code)\n" 64 1.1 riastrad "\t\tBit 1 (0x02) will enable DRIVER messages (drm controller code)\n" 65 1.1 riastrad "\t\tBit 2 (0x04) will enable KMS messages (modesetting code)\n" 66 1.1 riastrad "\t\tBit 3 (0x08) will enable PRIME messages (prime code)\n" 67 1.1 riastrad "\t\tBit 4 (0x10) will enable ATOMIC messages (atomic code)\n" 68 1.1 riastrad "\t\tBit 5 (0x20) will enable VBL messages (vblank code)\n" 69 1.1 riastrad "\t\tBit 7 (0x80) will enable LEASE messages (leasing code)\n" 70 1.1 riastrad "\t\tBit 8 (0x100) will enable DP messages (displayport code)"); 71 1.1 riastrad module_param_named(debug, __drm_debug, int, 0600); 72 1.1 riastrad 73 1.9 riastrad #ifdef __NetBSD__ 74 1.9 riastrad static void 75 1.9 riastrad drm_symstr(vaddr_t val, char *out, size_t outsize) 76 1.9 riastrad { 77 1.9 riastrad unsigned long naddr; 78 1.9 riastrad const char *mod; 79 1.9 riastrad const char *sym; 80 1.13 riastrad int s; 81 1.9 riastrad 82 1.13 riastrad s = pserialize_read_enter(); 83 1.13 riastrad if (ksyms_getname(&mod, &sym, val, KSYMS_PROC|KSYMS_CLOSEST) == 0) { 84 1.9 riastrad char offset[32]; 85 1.9 riastrad 86 1.9 riastrad if (ksyms_getval(mod, sym, &naddr, KSYMS_ANY) == 0 && 87 1.9 riastrad (val - naddr) != 0) 88 1.9 riastrad snprintf(offset, sizeof offset, "+%p", 89 1.9 riastrad (void *)(val - naddr)); 90 1.9 riastrad else 91 1.9 riastrad offset[0] = '\0'; 92 1.13 riastrad pserialize_read_exit(s); 93 1.9 riastrad snprintf(out, outsize, "%s:%s%s", mod, sym, offset); 94 1.9 riastrad return; 95 1.9 riastrad } 96 1.13 riastrad pserialize_read_exit(s); 97 1.9 riastrad snprintf(out, outsize, "%p", (void *)val); 98 1.9 riastrad } 99 1.9 riastrad #endif 100 1.9 riastrad 101 1.1 riastrad void __drm_puts_coredump(struct drm_printer *p, const char *str) 102 1.1 riastrad { 103 1.1 riastrad struct drm_print_iterator *iterator = p->arg; 104 1.1 riastrad ssize_t len; 105 1.1 riastrad 106 1.1 riastrad if (!iterator->remain) 107 1.1 riastrad return; 108 1.1 riastrad 109 1.1 riastrad if (iterator->offset < iterator->start) { 110 1.1 riastrad ssize_t copy; 111 1.1 riastrad 112 1.1 riastrad len = strlen(str); 113 1.1 riastrad 114 1.1 riastrad if (iterator->offset + len <= iterator->start) { 115 1.1 riastrad iterator->offset += len; 116 1.1 riastrad return; 117 1.1 riastrad } 118 1.1 riastrad 119 1.1 riastrad copy = len - (iterator->start - iterator->offset); 120 1.1 riastrad 121 1.1 riastrad if (copy > iterator->remain) 122 1.1 riastrad copy = iterator->remain; 123 1.1 riastrad 124 1.1 riastrad /* Copy out the bit of the string that we need */ 125 1.1 riastrad memcpy(iterator->data, 126 1.1 riastrad str + (iterator->start - iterator->offset), copy); 127 1.1 riastrad 128 1.1 riastrad iterator->offset = iterator->start + copy; 129 1.1 riastrad iterator->remain -= copy; 130 1.1 riastrad } else { 131 1.1 riastrad ssize_t pos = iterator->offset - iterator->start; 132 1.1 riastrad 133 1.1 riastrad len = min_t(ssize_t, strlen(str), iterator->remain); 134 1.1 riastrad 135 1.4 riastrad memcpy((char *)iterator->data + pos, str, len); 136 1.1 riastrad 137 1.1 riastrad iterator->offset += len; 138 1.1 riastrad iterator->remain -= len; 139 1.1 riastrad } 140 1.1 riastrad } 141 1.1 riastrad EXPORT_SYMBOL(__drm_puts_coredump); 142 1.1 riastrad 143 1.1 riastrad void __drm_printfn_coredump(struct drm_printer *p, struct va_format *vaf) 144 1.1 riastrad { 145 1.1 riastrad struct drm_print_iterator *iterator = p->arg; 146 1.1 riastrad size_t len; 147 1.1 riastrad char *buf; 148 1.1 riastrad 149 1.1 riastrad if (!iterator->remain) 150 1.1 riastrad return; 151 1.1 riastrad 152 1.1 riastrad /* Figure out how big the string will be */ 153 1.1 riastrad len = snprintf(NULL, 0, "%pV", vaf); 154 1.1 riastrad 155 1.1 riastrad /* This is the easiest path, we've already advanced beyond the offset */ 156 1.1 riastrad if (iterator->offset + len <= iterator->start) { 157 1.1 riastrad iterator->offset += len; 158 1.1 riastrad return; 159 1.1 riastrad } 160 1.1 riastrad 161 1.1 riastrad /* Then check if we can directly copy into the target buffer */ 162 1.1 riastrad if ((iterator->offset >= iterator->start) && (len < iterator->remain)) { 163 1.1 riastrad ssize_t pos = iterator->offset - iterator->start; 164 1.1 riastrad 165 1.1 riastrad snprintf(((char *) iterator->data) + pos, 166 1.1 riastrad iterator->remain, "%pV", vaf); 167 1.1 riastrad 168 1.1 riastrad iterator->offset += len; 169 1.1 riastrad iterator->remain -= len; 170 1.1 riastrad 171 1.1 riastrad return; 172 1.1 riastrad } 173 1.1 riastrad 174 1.1 riastrad /* 175 1.1 riastrad * Finally, hit the slow path and make a temporary string to copy over 176 1.1 riastrad * using _drm_puts_coredump 177 1.1 riastrad */ 178 1.1 riastrad buf = kmalloc(len + 1, GFP_KERNEL | __GFP_NOWARN | __GFP_NORETRY); 179 1.1 riastrad if (!buf) 180 1.1 riastrad return; 181 1.1 riastrad 182 1.1 riastrad snprintf(buf, len + 1, "%pV", vaf); 183 1.1 riastrad __drm_puts_coredump(p, (const char *) buf); 184 1.1 riastrad 185 1.1 riastrad kfree(buf); 186 1.1 riastrad } 187 1.1 riastrad EXPORT_SYMBOL(__drm_printfn_coredump); 188 1.1 riastrad 189 1.4 riastrad #ifndef __NetBSD__ /* XXX seq file */ 190 1.1 riastrad void __drm_puts_seq_file(struct drm_printer *p, const char *str) 191 1.1 riastrad { 192 1.1 riastrad seq_puts(p->arg, str); 193 1.1 riastrad } 194 1.1 riastrad EXPORT_SYMBOL(__drm_puts_seq_file); 195 1.4 riastrad #endif 196 1.1 riastrad 197 1.4 riastrad #ifndef __NetBSD__ /* XXX seq file */ 198 1.1 riastrad void __drm_printfn_seq_file(struct drm_printer *p, struct va_format *vaf) 199 1.1 riastrad { 200 1.1 riastrad seq_printf(p->arg, "%pV", vaf); 201 1.1 riastrad } 202 1.1 riastrad EXPORT_SYMBOL(__drm_printfn_seq_file); 203 1.4 riastrad #endif 204 1.1 riastrad 205 1.1 riastrad void __drm_printfn_info(struct drm_printer *p, struct va_format *vaf) 206 1.1 riastrad { 207 1.9 riastrad #ifdef __NetBSD__ 208 1.15 riastrad dev_info(p->arg, "{" DRM_NAME "} "); 209 1.9 riastrad vprintf(vaf->fmt, *vaf->va); /* XXX */ 210 1.9 riastrad #else 211 1.1 riastrad dev_info(p->arg, "[" DRM_NAME "] %pV", vaf); 212 1.9 riastrad #endif 213 1.1 riastrad } 214 1.1 riastrad EXPORT_SYMBOL(__drm_printfn_info); 215 1.1 riastrad 216 1.1 riastrad void __drm_printfn_debug(struct drm_printer *p, struct va_format *vaf) 217 1.1 riastrad { 218 1.9 riastrad #ifdef __NetBSD__ 219 1.9 riastrad pr_debug("%s ", p->prefix); 220 1.9 riastrad vprintf(vaf->fmt, *vaf->va); /* XXX */ 221 1.9 riastrad #else 222 1.1 riastrad pr_debug("%s %pV", p->prefix, vaf); 223 1.9 riastrad #endif 224 1.1 riastrad } 225 1.1 riastrad EXPORT_SYMBOL(__drm_printfn_debug); 226 1.1 riastrad 227 1.1 riastrad void __drm_printfn_err(struct drm_printer *p, struct va_format *vaf) 228 1.1 riastrad { 229 1.9 riastrad #ifdef __NetBSD__ 230 1.9 riastrad pr_err("*ERROR* %s ", p->prefix); 231 1.9 riastrad vprintf(vaf->fmt, *vaf->va); /* XXX */ 232 1.9 riastrad #else 233 1.1 riastrad pr_err("*ERROR* %s %pV", p->prefix, vaf); 234 1.9 riastrad #endif 235 1.1 riastrad } 236 1.1 riastrad EXPORT_SYMBOL(__drm_printfn_err); 237 1.1 riastrad 238 1.1 riastrad /** 239 1.1 riastrad * drm_puts - print a const string to a &drm_printer stream 240 1.1 riastrad * @p: the &drm printer 241 1.1 riastrad * @str: const string 242 1.1 riastrad * 243 1.1 riastrad * Allow &drm_printer types that have a constant string 244 1.1 riastrad * option to use it. 245 1.1 riastrad */ 246 1.1 riastrad void drm_puts(struct drm_printer *p, const char *str) 247 1.1 riastrad { 248 1.1 riastrad if (p->puts) 249 1.1 riastrad p->puts(p, str); 250 1.1 riastrad else 251 1.1 riastrad drm_printf(p, "%s", str); 252 1.1 riastrad } 253 1.1 riastrad EXPORT_SYMBOL(drm_puts); 254 1.1 riastrad 255 1.1 riastrad /** 256 1.1 riastrad * drm_printf - print to a &drm_printer stream 257 1.1 riastrad * @p: the &drm_printer 258 1.1 riastrad * @f: format string 259 1.1 riastrad */ 260 1.1 riastrad void drm_printf(struct drm_printer *p, const char *f, ...) 261 1.1 riastrad { 262 1.1 riastrad va_list args; 263 1.1 riastrad 264 1.1 riastrad va_start(args, f); 265 1.1 riastrad drm_vprintf(p, f, &args); 266 1.1 riastrad va_end(args); 267 1.1 riastrad } 268 1.1 riastrad EXPORT_SYMBOL(drm_printf); 269 1.1 riastrad 270 1.1 riastrad /** 271 1.1 riastrad * drm_print_bits - print bits to a &drm_printer stream 272 1.1 riastrad * 273 1.1 riastrad * Print bits (in flag fields for example) in human readable form. 274 1.1 riastrad * 275 1.1 riastrad * @p: the &drm_printer 276 1.1 riastrad * @value: field value. 277 1.1 riastrad * @bits: Array with bit names. 278 1.1 riastrad * @nbits: Size of bit names array. 279 1.1 riastrad */ 280 1.1 riastrad void drm_print_bits(struct drm_printer *p, unsigned long value, 281 1.1 riastrad const char * const bits[], unsigned int nbits) 282 1.1 riastrad { 283 1.1 riastrad bool first = true; 284 1.1 riastrad unsigned int i; 285 1.1 riastrad 286 1.1 riastrad if (WARN_ON_ONCE(nbits > BITS_PER_TYPE(value))) 287 1.1 riastrad nbits = BITS_PER_TYPE(value); 288 1.1 riastrad 289 1.1 riastrad for_each_set_bit(i, &value, nbits) { 290 1.1 riastrad if (WARN_ON_ONCE(!bits[i])) 291 1.1 riastrad continue; 292 1.1 riastrad drm_printf(p, "%s%s", first ? "" : ",", 293 1.1 riastrad bits[i]); 294 1.1 riastrad first = false; 295 1.1 riastrad } 296 1.1 riastrad if (first) 297 1.1 riastrad drm_printf(p, "(none)"); 298 1.1 riastrad } 299 1.1 riastrad EXPORT_SYMBOL(drm_print_bits); 300 1.1 riastrad 301 1.1 riastrad void drm_dev_printk(const struct device *dev, const char *level, 302 1.1 riastrad const char *format, ...) 303 1.1 riastrad { 304 1.4 riastrad #ifdef __NetBSD__ 305 1.4 riastrad va_list va; 306 1.9 riastrad char symbuf[128]; 307 1.9 riastrad 308 1.9 riastrad drm_symstr((vaddr_t)__builtin_return_address(0), symbuf, sizeof symbuf); 309 1.15 riastrad if (dev) { 310 1.15 riastrad printf("%s {" DRM_NAME ":%s} ", device_xname(__UNCONST(dev)), 311 1.15 riastrad symbuf); 312 1.15 riastrad } else { 313 1.15 riastrad printf("{" DRM_NAME ":%s} ", symbuf); 314 1.15 riastrad } 315 1.4 riastrad 316 1.4 riastrad va_start(va, format); 317 1.4 riastrad vprintf(format, va); 318 1.4 riastrad va_end(va); 319 1.4 riastrad #else 320 1.1 riastrad struct va_format vaf; 321 1.1 riastrad va_list args; 322 1.1 riastrad 323 1.1 riastrad va_start(args, format); 324 1.1 riastrad vaf.fmt = format; 325 1.1 riastrad vaf.va = &args; 326 1.1 riastrad 327 1.1 riastrad if (dev) 328 1.1 riastrad dev_printk(level, dev, "[" DRM_NAME ":%ps] %pV", 329 1.1 riastrad __builtin_return_address(0), &vaf); 330 1.1 riastrad else 331 1.1 riastrad printk("%s" "[" DRM_NAME ":%ps] %pV", 332 1.1 riastrad level, __builtin_return_address(0), &vaf); 333 1.1 riastrad 334 1.1 riastrad va_end(args); 335 1.4 riastrad #endif 336 1.1 riastrad } 337 1.1 riastrad EXPORT_SYMBOL(drm_dev_printk); 338 1.1 riastrad 339 1.1 riastrad void drm_dev_dbg(const struct device *dev, enum drm_debug_category category, 340 1.1 riastrad const char *format, ...) 341 1.1 riastrad { 342 1.4 riastrad #ifdef __NetBSD__ 343 1.4 riastrad va_list va; 344 1.9 riastrad char symbuf[128]; 345 1.4 riastrad 346 1.8 riastrad if (!(__drm_debug & category)) 347 1.4 riastrad return; 348 1.4 riastrad 349 1.9 riastrad drm_symstr((vaddr_t)__builtin_return_address(0), symbuf, sizeof symbuf); 350 1.15 riastrad if (dev) { 351 1.15 riastrad printf("%s {" DRM_NAME ":%s} ", device_xname(__UNCONST(dev)), 352 1.15 riastrad symbuf); 353 1.15 riastrad } else { 354 1.15 riastrad printf("{" DRM_NAME ":%s} ", symbuf); 355 1.15 riastrad } 356 1.9 riastrad 357 1.4 riastrad va_start(va, format); 358 1.4 riastrad vprintf(format, va); 359 1.4 riastrad va_end(va); 360 1.4 riastrad #else 361 1.1 riastrad struct va_format vaf; 362 1.1 riastrad va_list args; 363 1.1 riastrad 364 1.1 riastrad if (!drm_debug_enabled(category)) 365 1.1 riastrad return; 366 1.1 riastrad 367 1.1 riastrad va_start(args, format); 368 1.1 riastrad vaf.fmt = format; 369 1.1 riastrad vaf.va = &args; 370 1.1 riastrad 371 1.1 riastrad if (dev) 372 1.1 riastrad dev_printk(KERN_DEBUG, dev, "[" DRM_NAME ":%ps] %pV", 373 1.1 riastrad __builtin_return_address(0), &vaf); 374 1.1 riastrad else 375 1.1 riastrad printk(KERN_DEBUG "[" DRM_NAME ":%ps] %pV", 376 1.1 riastrad __builtin_return_address(0), &vaf); 377 1.1 riastrad 378 1.1 riastrad va_end(args); 379 1.4 riastrad #endif 380 1.1 riastrad } 381 1.1 riastrad EXPORT_SYMBOL(drm_dev_dbg); 382 1.1 riastrad 383 1.1 riastrad void __drm_dbg(enum drm_debug_category category, const char *format, ...) 384 1.1 riastrad { 385 1.4 riastrad #ifdef __NetBSD__ 386 1.9 riastrad char symbuf[128]; 387 1.4 riastrad va_list va; 388 1.4 riastrad 389 1.8 riastrad if (!(__drm_debug & category)) 390 1.4 riastrad return; 391 1.4 riastrad 392 1.15 riastrad memset(symbuf, 0, sizeof symbuf); 393 1.9 riastrad drm_symstr((vaddr_t)__builtin_return_address(0), symbuf, sizeof symbuf); 394 1.15 riastrad printf("{" DRM_NAME ":%s} ", symbuf); 395 1.9 riastrad 396 1.4 riastrad va_start(va, format); 397 1.4 riastrad vprintf(format, va); 398 1.4 riastrad va_end(va); 399 1.4 riastrad #else 400 1.1 riastrad struct va_format vaf; 401 1.1 riastrad va_list args; 402 1.1 riastrad 403 1.1 riastrad if (!drm_debug_enabled(category)) 404 1.1 riastrad return; 405 1.1 riastrad 406 1.1 riastrad va_start(args, format); 407 1.1 riastrad vaf.fmt = format; 408 1.1 riastrad vaf.va = &args; 409 1.1 riastrad 410 1.1 riastrad printk(KERN_DEBUG "[" DRM_NAME ":%ps] %pV", 411 1.1 riastrad __builtin_return_address(0), &vaf); 412 1.1 riastrad 413 1.1 riastrad va_end(args); 414 1.4 riastrad #endif 415 1.1 riastrad } 416 1.1 riastrad EXPORT_SYMBOL(__drm_dbg); 417 1.1 riastrad 418 1.1 riastrad void __drm_err(const char *format, ...) 419 1.1 riastrad { 420 1.9 riastrad #ifdef __NetBSD__ 421 1.9 riastrad char symbuf[128]; 422 1.9 riastrad va_list va; 423 1.9 riastrad 424 1.9 riastrad drm_symstr((vaddr_t)__builtin_return_address(0), symbuf, sizeof symbuf); 425 1.15 riastrad printf("{" DRM_NAME ":%s} *ERROR* ", symbuf); 426 1.9 riastrad 427 1.9 riastrad va_start(va, format); 428 1.9 riastrad vprintf(format, va); 429 1.9 riastrad va_end(va); 430 1.9 riastrad #else 431 1.1 riastrad struct va_format vaf; 432 1.1 riastrad va_list args; 433 1.1 riastrad 434 1.1 riastrad va_start(args, format); 435 1.1 riastrad vaf.fmt = format; 436 1.1 riastrad vaf.va = &args; 437 1.1 riastrad 438 1.1 riastrad printk(KERN_ERR "[" DRM_NAME ":%ps] *ERROR* %pV", 439 1.1 riastrad __builtin_return_address(0), &vaf); 440 1.1 riastrad 441 1.1 riastrad va_end(args); 442 1.9 riastrad #endif 443 1.1 riastrad } 444 1.1 riastrad EXPORT_SYMBOL(__drm_err); 445 1.1 riastrad 446 1.5 riastrad #ifndef __NetBSD__ 447 1.1 riastrad /** 448 1.1 riastrad * drm_print_regset32 - print the contents of registers to a 449 1.1 riastrad * &drm_printer stream. 450 1.1 riastrad * 451 1.1 riastrad * @p: the &drm printer 452 1.1 riastrad * @regset: the list of registers to print. 453 1.1 riastrad * 454 1.1 riastrad * Often in driver debug, it's useful to be able to either capture the 455 1.1 riastrad * contents of registers in the steady state using debugfs or at 456 1.1 riastrad * specific points during operation. This lets the driver have a 457 1.1 riastrad * single list of registers for both. 458 1.1 riastrad */ 459 1.1 riastrad void drm_print_regset32(struct drm_printer *p, struct debugfs_regset32 *regset) 460 1.1 riastrad { 461 1.1 riastrad int namelen = 0; 462 1.1 riastrad int i; 463 1.1 riastrad 464 1.1 riastrad for (i = 0; i < regset->nregs; i++) 465 1.1 riastrad namelen = max(namelen, (int)strlen(regset->regs[i].name)); 466 1.1 riastrad 467 1.1 riastrad for (i = 0; i < regset->nregs; i++) { 468 1.1 riastrad drm_printf(p, "%*s = 0x%08x\n", 469 1.1 riastrad namelen, regset->regs[i].name, 470 1.1 riastrad readl(regset->base + regset->regs[i].offset)); 471 1.1 riastrad } 472 1.1 riastrad } 473 1.1 riastrad EXPORT_SYMBOL(drm_print_regset32); 474 1.5 riastrad #endif 475