18c2ecf20Sopenharmony_ci/*
28c2ecf20Sopenharmony_ci * Copyright (C) 2016 Red Hat
38c2ecf20Sopenharmony_ci *
48c2ecf20Sopenharmony_ci * Permission is hereby granted, free of charge, to any person obtaining a
58c2ecf20Sopenharmony_ci * copy of this software and associated documentation files (the "Software"),
68c2ecf20Sopenharmony_ci * to deal in the Software without restriction, including without limitation
78c2ecf20Sopenharmony_ci * the rights to use, copy, modify, merge, publish, distribute, sublicense,
88c2ecf20Sopenharmony_ci * and/or sell copies of the Software, and to permit persons to whom the
98c2ecf20Sopenharmony_ci * Software is furnished to do so, subject to the following conditions:
108c2ecf20Sopenharmony_ci *
118c2ecf20Sopenharmony_ci * The above copyright notice and this permission notice shall be included in
128c2ecf20Sopenharmony_ci * all copies or substantial portions of the Software.
138c2ecf20Sopenharmony_ci *
148c2ecf20Sopenharmony_ci * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
158c2ecf20Sopenharmony_ci * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
168c2ecf20Sopenharmony_ci * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
178c2ecf20Sopenharmony_ci * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
188c2ecf20Sopenharmony_ci * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
198c2ecf20Sopenharmony_ci * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
208c2ecf20Sopenharmony_ci * OTHER DEALINGS IN THE SOFTWARE.
218c2ecf20Sopenharmony_ci *
228c2ecf20Sopenharmony_ci * Authors:
238c2ecf20Sopenharmony_ci * Rob Clark <robdclark@gmail.com>
248c2ecf20Sopenharmony_ci */
258c2ecf20Sopenharmony_ci
268c2ecf20Sopenharmony_ci#define DEBUG /* for pr_debug() */
278c2ecf20Sopenharmony_ci
288c2ecf20Sopenharmony_ci#include <stdarg.h>
298c2ecf20Sopenharmony_ci
308c2ecf20Sopenharmony_ci#include <linux/io.h>
318c2ecf20Sopenharmony_ci#include <linux/moduleparam.h>
328c2ecf20Sopenharmony_ci#include <linux/seq_file.h>
338c2ecf20Sopenharmony_ci#include <linux/slab.h>
348c2ecf20Sopenharmony_ci
358c2ecf20Sopenharmony_ci#include <drm/drm.h>
368c2ecf20Sopenharmony_ci#include <drm/drm_drv.h>
378c2ecf20Sopenharmony_ci#include <drm/drm_print.h>
388c2ecf20Sopenharmony_ci
398c2ecf20Sopenharmony_ci/*
408c2ecf20Sopenharmony_ci * __drm_debug: Enable debug output.
418c2ecf20Sopenharmony_ci * Bitmask of DRM_UT_x. See include/drm/drm_print.h for details.
428c2ecf20Sopenharmony_ci */
438c2ecf20Sopenharmony_ciunsigned int __drm_debug;
448c2ecf20Sopenharmony_ciEXPORT_SYMBOL(__drm_debug);
458c2ecf20Sopenharmony_ci
468c2ecf20Sopenharmony_ciMODULE_PARM_DESC(debug, "Enable debug output, where each bit enables a debug category.\n"
478c2ecf20Sopenharmony_ci"\t\tBit 0 (0x01)  will enable CORE messages (drm core code)\n"
488c2ecf20Sopenharmony_ci"\t\tBit 1 (0x02)  will enable DRIVER messages (drm controller code)\n"
498c2ecf20Sopenharmony_ci"\t\tBit 2 (0x04)  will enable KMS messages (modesetting code)\n"
508c2ecf20Sopenharmony_ci"\t\tBit 3 (0x08)  will enable PRIME messages (prime code)\n"
518c2ecf20Sopenharmony_ci"\t\tBit 4 (0x10)  will enable ATOMIC messages (atomic code)\n"
528c2ecf20Sopenharmony_ci"\t\tBit 5 (0x20)  will enable VBL messages (vblank code)\n"
538c2ecf20Sopenharmony_ci"\t\tBit 7 (0x80)  will enable LEASE messages (leasing code)\n"
548c2ecf20Sopenharmony_ci"\t\tBit 8 (0x100) will enable DP messages (displayport code)");
558c2ecf20Sopenharmony_cimodule_param_named(debug, __drm_debug, int, 0600);
568c2ecf20Sopenharmony_ci
578c2ecf20Sopenharmony_civoid __drm_puts_coredump(struct drm_printer *p, const char *str)
588c2ecf20Sopenharmony_ci{
598c2ecf20Sopenharmony_ci	struct drm_print_iterator *iterator = p->arg;
608c2ecf20Sopenharmony_ci	ssize_t len;
618c2ecf20Sopenharmony_ci
628c2ecf20Sopenharmony_ci	if (!iterator->remain)
638c2ecf20Sopenharmony_ci		return;
648c2ecf20Sopenharmony_ci
658c2ecf20Sopenharmony_ci	if (iterator->offset < iterator->start) {
668c2ecf20Sopenharmony_ci		ssize_t copy;
678c2ecf20Sopenharmony_ci
688c2ecf20Sopenharmony_ci		len = strlen(str);
698c2ecf20Sopenharmony_ci
708c2ecf20Sopenharmony_ci		if (iterator->offset + len <= iterator->start) {
718c2ecf20Sopenharmony_ci			iterator->offset += len;
728c2ecf20Sopenharmony_ci			return;
738c2ecf20Sopenharmony_ci		}
748c2ecf20Sopenharmony_ci
758c2ecf20Sopenharmony_ci		copy = len - (iterator->start - iterator->offset);
768c2ecf20Sopenharmony_ci
778c2ecf20Sopenharmony_ci		if (copy > iterator->remain)
788c2ecf20Sopenharmony_ci			copy = iterator->remain;
798c2ecf20Sopenharmony_ci
808c2ecf20Sopenharmony_ci		/* Copy out the bit of the string that we need */
818c2ecf20Sopenharmony_ci		memcpy(iterator->data,
828c2ecf20Sopenharmony_ci			str + (iterator->start - iterator->offset), copy);
838c2ecf20Sopenharmony_ci
848c2ecf20Sopenharmony_ci		iterator->offset = iterator->start + copy;
858c2ecf20Sopenharmony_ci		iterator->remain -= copy;
868c2ecf20Sopenharmony_ci	} else {
878c2ecf20Sopenharmony_ci		ssize_t pos = iterator->offset - iterator->start;
888c2ecf20Sopenharmony_ci
898c2ecf20Sopenharmony_ci		len = min_t(ssize_t, strlen(str), iterator->remain);
908c2ecf20Sopenharmony_ci
918c2ecf20Sopenharmony_ci		memcpy(iterator->data + pos, str, len);
928c2ecf20Sopenharmony_ci
938c2ecf20Sopenharmony_ci		iterator->offset += len;
948c2ecf20Sopenharmony_ci		iterator->remain -= len;
958c2ecf20Sopenharmony_ci	}
968c2ecf20Sopenharmony_ci}
978c2ecf20Sopenharmony_ciEXPORT_SYMBOL(__drm_puts_coredump);
988c2ecf20Sopenharmony_ci
998c2ecf20Sopenharmony_civoid __drm_printfn_coredump(struct drm_printer *p, struct va_format *vaf)
1008c2ecf20Sopenharmony_ci{
1018c2ecf20Sopenharmony_ci	struct drm_print_iterator *iterator = p->arg;
1028c2ecf20Sopenharmony_ci	size_t len;
1038c2ecf20Sopenharmony_ci	char *buf;
1048c2ecf20Sopenharmony_ci
1058c2ecf20Sopenharmony_ci	if (!iterator->remain)
1068c2ecf20Sopenharmony_ci		return;
1078c2ecf20Sopenharmony_ci
1088c2ecf20Sopenharmony_ci	/* Figure out how big the string will be */
1098c2ecf20Sopenharmony_ci	len = snprintf(NULL, 0, "%pV", vaf);
1108c2ecf20Sopenharmony_ci
1118c2ecf20Sopenharmony_ci	/* This is the easiest path, we've already advanced beyond the offset */
1128c2ecf20Sopenharmony_ci	if (iterator->offset + len <= iterator->start) {
1138c2ecf20Sopenharmony_ci		iterator->offset += len;
1148c2ecf20Sopenharmony_ci		return;
1158c2ecf20Sopenharmony_ci	}
1168c2ecf20Sopenharmony_ci
1178c2ecf20Sopenharmony_ci	/* Then check if we can directly copy into the target buffer */
1188c2ecf20Sopenharmony_ci	if ((iterator->offset >= iterator->start) && (len < iterator->remain)) {
1198c2ecf20Sopenharmony_ci		ssize_t pos = iterator->offset - iterator->start;
1208c2ecf20Sopenharmony_ci
1218c2ecf20Sopenharmony_ci		snprintf(((char *) iterator->data) + pos,
1228c2ecf20Sopenharmony_ci			iterator->remain, "%pV", vaf);
1238c2ecf20Sopenharmony_ci
1248c2ecf20Sopenharmony_ci		iterator->offset += len;
1258c2ecf20Sopenharmony_ci		iterator->remain -= len;
1268c2ecf20Sopenharmony_ci
1278c2ecf20Sopenharmony_ci		return;
1288c2ecf20Sopenharmony_ci	}
1298c2ecf20Sopenharmony_ci
1308c2ecf20Sopenharmony_ci	/*
1318c2ecf20Sopenharmony_ci	 * Finally, hit the slow path and make a temporary string to copy over
1328c2ecf20Sopenharmony_ci	 * using _drm_puts_coredump
1338c2ecf20Sopenharmony_ci	 */
1348c2ecf20Sopenharmony_ci	buf = kmalloc(len + 1, GFP_KERNEL | __GFP_NOWARN | __GFP_NORETRY);
1358c2ecf20Sopenharmony_ci	if (!buf)
1368c2ecf20Sopenharmony_ci		return;
1378c2ecf20Sopenharmony_ci
1388c2ecf20Sopenharmony_ci	snprintf(buf, len + 1, "%pV", vaf);
1398c2ecf20Sopenharmony_ci	__drm_puts_coredump(p, (const char *) buf);
1408c2ecf20Sopenharmony_ci
1418c2ecf20Sopenharmony_ci	kfree(buf);
1428c2ecf20Sopenharmony_ci}
1438c2ecf20Sopenharmony_ciEXPORT_SYMBOL(__drm_printfn_coredump);
1448c2ecf20Sopenharmony_ci
1458c2ecf20Sopenharmony_civoid __drm_puts_seq_file(struct drm_printer *p, const char *str)
1468c2ecf20Sopenharmony_ci{
1478c2ecf20Sopenharmony_ci	seq_puts(p->arg, str);
1488c2ecf20Sopenharmony_ci}
1498c2ecf20Sopenharmony_ciEXPORT_SYMBOL(__drm_puts_seq_file);
1508c2ecf20Sopenharmony_ci
1518c2ecf20Sopenharmony_civoid __drm_printfn_seq_file(struct drm_printer *p, struct va_format *vaf)
1528c2ecf20Sopenharmony_ci{
1538c2ecf20Sopenharmony_ci	seq_printf(p->arg, "%pV", vaf);
1548c2ecf20Sopenharmony_ci}
1558c2ecf20Sopenharmony_ciEXPORT_SYMBOL(__drm_printfn_seq_file);
1568c2ecf20Sopenharmony_ci
1578c2ecf20Sopenharmony_civoid __drm_printfn_info(struct drm_printer *p, struct va_format *vaf)
1588c2ecf20Sopenharmony_ci{
1598c2ecf20Sopenharmony_ci	dev_info(p->arg, "[" DRM_NAME "] %pV", vaf);
1608c2ecf20Sopenharmony_ci}
1618c2ecf20Sopenharmony_ciEXPORT_SYMBOL(__drm_printfn_info);
1628c2ecf20Sopenharmony_ci
1638c2ecf20Sopenharmony_civoid __drm_printfn_debug(struct drm_printer *p, struct va_format *vaf)
1648c2ecf20Sopenharmony_ci{
1658c2ecf20Sopenharmony_ci	pr_debug("%s %pV", p->prefix, vaf);
1668c2ecf20Sopenharmony_ci}
1678c2ecf20Sopenharmony_ciEXPORT_SYMBOL(__drm_printfn_debug);
1688c2ecf20Sopenharmony_ci
1698c2ecf20Sopenharmony_civoid __drm_printfn_err(struct drm_printer *p, struct va_format *vaf)
1708c2ecf20Sopenharmony_ci{
1718c2ecf20Sopenharmony_ci	pr_err("*ERROR* %s %pV", p->prefix, vaf);
1728c2ecf20Sopenharmony_ci}
1738c2ecf20Sopenharmony_ciEXPORT_SYMBOL(__drm_printfn_err);
1748c2ecf20Sopenharmony_ci
1758c2ecf20Sopenharmony_ci/**
1768c2ecf20Sopenharmony_ci * drm_puts - print a const string to a &drm_printer stream
1778c2ecf20Sopenharmony_ci * @p: the &drm printer
1788c2ecf20Sopenharmony_ci * @str: const string
1798c2ecf20Sopenharmony_ci *
1808c2ecf20Sopenharmony_ci * Allow &drm_printer types that have a constant string
1818c2ecf20Sopenharmony_ci * option to use it.
1828c2ecf20Sopenharmony_ci */
1838c2ecf20Sopenharmony_civoid drm_puts(struct drm_printer *p, const char *str)
1848c2ecf20Sopenharmony_ci{
1858c2ecf20Sopenharmony_ci	if (p->puts)
1868c2ecf20Sopenharmony_ci		p->puts(p, str);
1878c2ecf20Sopenharmony_ci	else
1888c2ecf20Sopenharmony_ci		drm_printf(p, "%s", str);
1898c2ecf20Sopenharmony_ci}
1908c2ecf20Sopenharmony_ciEXPORT_SYMBOL(drm_puts);
1918c2ecf20Sopenharmony_ci
1928c2ecf20Sopenharmony_ci/**
1938c2ecf20Sopenharmony_ci * drm_printf - print to a &drm_printer stream
1948c2ecf20Sopenharmony_ci * @p: the &drm_printer
1958c2ecf20Sopenharmony_ci * @f: format string
1968c2ecf20Sopenharmony_ci */
1978c2ecf20Sopenharmony_civoid drm_printf(struct drm_printer *p, const char *f, ...)
1988c2ecf20Sopenharmony_ci{
1998c2ecf20Sopenharmony_ci	va_list args;
2008c2ecf20Sopenharmony_ci
2018c2ecf20Sopenharmony_ci	va_start(args, f);
2028c2ecf20Sopenharmony_ci	drm_vprintf(p, f, &args);
2038c2ecf20Sopenharmony_ci	va_end(args);
2048c2ecf20Sopenharmony_ci}
2058c2ecf20Sopenharmony_ciEXPORT_SYMBOL(drm_printf);
2068c2ecf20Sopenharmony_ci
2078c2ecf20Sopenharmony_ci/**
2088c2ecf20Sopenharmony_ci * drm_print_bits - print bits to a &drm_printer stream
2098c2ecf20Sopenharmony_ci *
2108c2ecf20Sopenharmony_ci * Print bits (in flag fields for example) in human readable form.
2118c2ecf20Sopenharmony_ci *
2128c2ecf20Sopenharmony_ci * @p: the &drm_printer
2138c2ecf20Sopenharmony_ci * @value: field value.
2148c2ecf20Sopenharmony_ci * @bits: Array with bit names.
2158c2ecf20Sopenharmony_ci * @nbits: Size of bit names array.
2168c2ecf20Sopenharmony_ci */
2178c2ecf20Sopenharmony_civoid drm_print_bits(struct drm_printer *p, unsigned long value,
2188c2ecf20Sopenharmony_ci		    const char * const bits[], unsigned int nbits)
2198c2ecf20Sopenharmony_ci{
2208c2ecf20Sopenharmony_ci	bool first = true;
2218c2ecf20Sopenharmony_ci	unsigned int i;
2228c2ecf20Sopenharmony_ci
2238c2ecf20Sopenharmony_ci	if (WARN_ON_ONCE(nbits > BITS_PER_TYPE(value)))
2248c2ecf20Sopenharmony_ci		nbits = BITS_PER_TYPE(value);
2258c2ecf20Sopenharmony_ci
2268c2ecf20Sopenharmony_ci	for_each_set_bit(i, &value, nbits) {
2278c2ecf20Sopenharmony_ci		if (WARN_ON_ONCE(!bits[i]))
2288c2ecf20Sopenharmony_ci			continue;
2298c2ecf20Sopenharmony_ci		drm_printf(p, "%s%s", first ? "" : ",",
2308c2ecf20Sopenharmony_ci			   bits[i]);
2318c2ecf20Sopenharmony_ci		first = false;
2328c2ecf20Sopenharmony_ci	}
2338c2ecf20Sopenharmony_ci	if (first)
2348c2ecf20Sopenharmony_ci		drm_printf(p, "(none)");
2358c2ecf20Sopenharmony_ci}
2368c2ecf20Sopenharmony_ciEXPORT_SYMBOL(drm_print_bits);
2378c2ecf20Sopenharmony_ci
2388c2ecf20Sopenharmony_civoid drm_dev_printk(const struct device *dev, const char *level,
2398c2ecf20Sopenharmony_ci		    const char *format, ...)
2408c2ecf20Sopenharmony_ci{
2418c2ecf20Sopenharmony_ci	struct va_format vaf;
2428c2ecf20Sopenharmony_ci	va_list args;
2438c2ecf20Sopenharmony_ci
2448c2ecf20Sopenharmony_ci	va_start(args, format);
2458c2ecf20Sopenharmony_ci	vaf.fmt = format;
2468c2ecf20Sopenharmony_ci	vaf.va = &args;
2478c2ecf20Sopenharmony_ci
2488c2ecf20Sopenharmony_ci	if (dev)
2498c2ecf20Sopenharmony_ci		dev_printk(level, dev, "[" DRM_NAME ":%ps] %pV",
2508c2ecf20Sopenharmony_ci			   __builtin_return_address(0), &vaf);
2518c2ecf20Sopenharmony_ci	else
2528c2ecf20Sopenharmony_ci		printk("%s" "[" DRM_NAME ":%ps] %pV",
2538c2ecf20Sopenharmony_ci		       level, __builtin_return_address(0), &vaf);
2548c2ecf20Sopenharmony_ci
2558c2ecf20Sopenharmony_ci	va_end(args);
2568c2ecf20Sopenharmony_ci}
2578c2ecf20Sopenharmony_ciEXPORT_SYMBOL(drm_dev_printk);
2588c2ecf20Sopenharmony_ci
2598c2ecf20Sopenharmony_civoid drm_dev_dbg(const struct device *dev, enum drm_debug_category category,
2608c2ecf20Sopenharmony_ci		 const char *format, ...)
2618c2ecf20Sopenharmony_ci{
2628c2ecf20Sopenharmony_ci	struct va_format vaf;
2638c2ecf20Sopenharmony_ci	va_list args;
2648c2ecf20Sopenharmony_ci
2658c2ecf20Sopenharmony_ci	if (!drm_debug_enabled(category))
2668c2ecf20Sopenharmony_ci		return;
2678c2ecf20Sopenharmony_ci
2688c2ecf20Sopenharmony_ci	va_start(args, format);
2698c2ecf20Sopenharmony_ci	vaf.fmt = format;
2708c2ecf20Sopenharmony_ci	vaf.va = &args;
2718c2ecf20Sopenharmony_ci
2728c2ecf20Sopenharmony_ci	if (dev)
2738c2ecf20Sopenharmony_ci		dev_printk(KERN_DEBUG, dev, "[" DRM_NAME ":%ps] %pV",
2748c2ecf20Sopenharmony_ci			   __builtin_return_address(0), &vaf);
2758c2ecf20Sopenharmony_ci	else
2768c2ecf20Sopenharmony_ci		printk(KERN_DEBUG "[" DRM_NAME ":%ps] %pV",
2778c2ecf20Sopenharmony_ci		       __builtin_return_address(0), &vaf);
2788c2ecf20Sopenharmony_ci
2798c2ecf20Sopenharmony_ci	va_end(args);
2808c2ecf20Sopenharmony_ci}
2818c2ecf20Sopenharmony_ciEXPORT_SYMBOL(drm_dev_dbg);
2828c2ecf20Sopenharmony_ci
2838c2ecf20Sopenharmony_civoid __drm_dbg(enum drm_debug_category category, const char *format, ...)
2848c2ecf20Sopenharmony_ci{
2858c2ecf20Sopenharmony_ci	struct va_format vaf;
2868c2ecf20Sopenharmony_ci	va_list args;
2878c2ecf20Sopenharmony_ci
2888c2ecf20Sopenharmony_ci	if (!drm_debug_enabled(category))
2898c2ecf20Sopenharmony_ci		return;
2908c2ecf20Sopenharmony_ci
2918c2ecf20Sopenharmony_ci	va_start(args, format);
2928c2ecf20Sopenharmony_ci	vaf.fmt = format;
2938c2ecf20Sopenharmony_ci	vaf.va = &args;
2948c2ecf20Sopenharmony_ci
2958c2ecf20Sopenharmony_ci	printk(KERN_DEBUG "[" DRM_NAME ":%ps] %pV",
2968c2ecf20Sopenharmony_ci	       __builtin_return_address(0), &vaf);
2978c2ecf20Sopenharmony_ci
2988c2ecf20Sopenharmony_ci	va_end(args);
2998c2ecf20Sopenharmony_ci}
3008c2ecf20Sopenharmony_ciEXPORT_SYMBOL(__drm_dbg);
3018c2ecf20Sopenharmony_ci
3028c2ecf20Sopenharmony_civoid __drm_err(const char *format, ...)
3038c2ecf20Sopenharmony_ci{
3048c2ecf20Sopenharmony_ci	struct va_format vaf;
3058c2ecf20Sopenharmony_ci	va_list args;
3068c2ecf20Sopenharmony_ci
3078c2ecf20Sopenharmony_ci	va_start(args, format);
3088c2ecf20Sopenharmony_ci	vaf.fmt = format;
3098c2ecf20Sopenharmony_ci	vaf.va = &args;
3108c2ecf20Sopenharmony_ci
3118c2ecf20Sopenharmony_ci	printk(KERN_ERR "[" DRM_NAME ":%ps] *ERROR* %pV",
3128c2ecf20Sopenharmony_ci	       __builtin_return_address(0), &vaf);
3138c2ecf20Sopenharmony_ci
3148c2ecf20Sopenharmony_ci	va_end(args);
3158c2ecf20Sopenharmony_ci}
3168c2ecf20Sopenharmony_ciEXPORT_SYMBOL(__drm_err);
3178c2ecf20Sopenharmony_ci
3188c2ecf20Sopenharmony_ci/**
3198c2ecf20Sopenharmony_ci * drm_print_regset32 - print the contents of registers to a
3208c2ecf20Sopenharmony_ci * &drm_printer stream.
3218c2ecf20Sopenharmony_ci *
3228c2ecf20Sopenharmony_ci * @p: the &drm printer
3238c2ecf20Sopenharmony_ci * @regset: the list of registers to print.
3248c2ecf20Sopenharmony_ci *
3258c2ecf20Sopenharmony_ci * Often in driver debug, it's useful to be able to either capture the
3268c2ecf20Sopenharmony_ci * contents of registers in the steady state using debugfs or at
3278c2ecf20Sopenharmony_ci * specific points during operation.  This lets the driver have a
3288c2ecf20Sopenharmony_ci * single list of registers for both.
3298c2ecf20Sopenharmony_ci */
3308c2ecf20Sopenharmony_civoid drm_print_regset32(struct drm_printer *p, struct debugfs_regset32 *regset)
3318c2ecf20Sopenharmony_ci{
3328c2ecf20Sopenharmony_ci	int namelen = 0;
3338c2ecf20Sopenharmony_ci	int i;
3348c2ecf20Sopenharmony_ci
3358c2ecf20Sopenharmony_ci	for (i = 0; i < regset->nregs; i++)
3368c2ecf20Sopenharmony_ci		namelen = max(namelen, (int)strlen(regset->regs[i].name));
3378c2ecf20Sopenharmony_ci
3388c2ecf20Sopenharmony_ci	for (i = 0; i < regset->nregs; i++) {
3398c2ecf20Sopenharmony_ci		drm_printf(p, "%*s = 0x%08x\n",
3408c2ecf20Sopenharmony_ci			   namelen, regset->regs[i].name,
3418c2ecf20Sopenharmony_ci			   readl(regset->base + regset->regs[i].offset));
3428c2ecf20Sopenharmony_ci	}
3438c2ecf20Sopenharmony_ci}
3448c2ecf20Sopenharmony_ciEXPORT_SYMBOL(drm_print_regset32);
345