All of lore.kernel.org
 help / color / mirror / Atom feed
* [igt-dev] [PATCH i-g-t v2 1/2] tools/intel_dump_audion: Rename BIT macros to REG_BIT
@ 2019-07-03 13:43 Lukasz Kalamarz
  2019-07-03 13:43 ` [igt-dev] [PATCH i-g-t v2 2/2] lib/intel_chipset: Move BIT macro to common place Lukasz Kalamarz
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Lukasz Kalamarz @ 2019-07-03 13:43 UTC (permalink / raw)
  To: igt-dev; +Cc: Wu Fengguang, Zhenyu Wang

In kernel macro BIT is used to set value 1 on a given BIT, while in
this tool it was checking value of given bit in register.
So it was renamed.

Signed-off-by: Lukasz Kalamarz <lukasz.kalamarz@intel.com>
Cc: Zhenyu Wang <zhenyu.z.wang@intel.com>
Cc: Wu Fengguang <fengguang.wu@intel.com>
Cc: Katarzyna Dec <katarzyna.dec@intel.com>
Cc: Michal Winiarski <michal.winiarski@intel.com>
---
 tools/intel_audio_dump.c | 1136 +++++++++++++++++++-------------------
 1 file changed, 568 insertions(+), 568 deletions(-)

diff --git a/tools/intel_audio_dump.c b/tools/intel_audio_dump.c
index 90260a2f..726bb4b6 100644
--- a/tools/intel_audio_dump.c
+++ b/tools/intel_audio_dump.c
@@ -46,8 +46,8 @@ static int disp_reg_base = 0;	/* base address of display registers */
 
 #define BITSTO(n)		(n >= sizeof(long) * 8 ? ~0 : (1UL << (n)) - 1)
 #define BITMASK(high, low)	(BITSTO(high+1) & ~BITSTO(low))
-#define BITS(reg, high, low)	(((reg) & (BITMASK(high, low))) >> (low))
-#define BIT(reg, n)		BITS(reg, n, n)
+#define REG_BITS(reg, high, low)	(((reg) & (BITMASK(high, low))) >> (low))
+#define REG_BIT(reg, n)		REG_BITS(reg, n, n)
 
 #define min_t(type, x, y) ({                    \
 		type __min1 = (x);                      \
@@ -430,11 +430,11 @@ enum {
 
 static void do_self_tests(void)
 {
-	if (BIT(1, 0) != 1)
+	if (REG_BIT(1, 0) != 1)
 		exit(1);
-	if (BIT(0x80000000, 31) != 1)
+	if (REG_BIT(0x80000000, 31) != 1)
 		exit(2);
-	if (BITS(0xc0000000, 31, 30) != 3)
+	if (REG_BITS(0xc0000000, 31, 30) != 3)
 		exit(3);
 }
 
@@ -537,10 +537,10 @@ static void dump_eaglelake(void)
 	printf("AUD_VID_DID device id\t\t\t0x%x\n", dword & 0xffff);
 
 	dword = INREG(AUD_RID);
-	printf("AUD_RID major revision\t\t\t0x%lx\n", BITS(dword, 23, 20));
-	printf("AUD_RID minor revision\t\t\t0x%lx\n", BITS(dword, 19, 16));
-	printf("AUD_RID revision id\t\t\t0x%lx\n",    BITS(dword, 15, 8));
-	printf("AUD_RID stepping id\t\t\t0x%lx\n",    BITS(dword, 7, 0));
+	printf("AUD_RID major revision\t\t\t0x%lx\n", REG_BITS(dword, 23, 20));
+	printf("AUD_RID minor revision\t\t\t0x%lx\n", REG_BITS(dword, 19, 16));
+	printf("AUD_RID revision id\t\t\t0x%lx\n",    REG_BITS(dword, 15, 8));
+	printf("AUD_RID stepping id\t\t\t0x%lx\n",    REG_BITS(dword, 7, 0));
 
 	dword = INREG(SDVOB);
 	printf("SDVOB enable\t\t\t\t%u\n",      !!(dword & SDVO_ENABLE));
@@ -557,180 +557,180 @@ static void dump_eaglelake(void)
 	printf("SDVOC audio enabled\t\t\t%u\n", !!(dword & SDVO_AUDIO_ENABLE));
 
 	dword = INREG(PORT_HOTPLUG_EN);
-	printf("PORT_HOTPLUG_EN DisplayPort/HDMI port B\t%ld\n", BIT(dword, 29)),
-	printf("PORT_HOTPLUG_EN DisplayPort/HDMI port C\t%ld\n", BIT(dword, 28)),
-	printf("PORT_HOTPLUG_EN DisplayPort port D\t%ld\n",      BIT(dword, 27)),
-	printf("PORT_HOTPLUG_EN SDVOB\t\t\t%ld\n", BIT(dword, 26)),
-	printf("PORT_HOTPLUG_EN SDVOC\t\t\t%ld\n", BIT(dword, 25)),
-	printf("PORT_HOTPLUG_EN audio\t\t\t%ld\n", BIT(dword, 24)),
-	printf("PORT_HOTPLUG_EN TV\t\t\t%ld\n",    BIT(dword, 23)),
-	printf("PORT_HOTPLUG_EN CRT\t\t\t%ld\n",   BIT(dword, 9)),
+	printf("PORT_HOTPLUG_EN DisplayPort/HDMI port B\t%ld\n", REG_BIT(dword, 29)),
+	printf("PORT_HOTPLUG_EN DisplayPort/HDMI port C\t%ld\n", REG_BIT(dword, 28)),
+	printf("PORT_HOTPLUG_EN DisplayPort port D\t%ld\n",      REG_BIT(dword, 27)),
+	printf("PORT_HOTPLUG_EN SDVOB\t\t\t%ld\n", REG_BIT(dword, 26)),
+	printf("PORT_HOTPLUG_EN SDVOC\t\t\t%ld\n", REG_BIT(dword, 25)),
+	printf("PORT_HOTPLUG_EN audio\t\t\t%ld\n", REG_BIT(dword, 24)),
+	printf("PORT_HOTPLUG_EN TV\t\t\t%ld\n",    REG_BIT(dword, 23)),
+	printf("PORT_HOTPLUG_EN CRT\t\t\t%ld\n",   REG_BIT(dword, 9)),
 
 	dword = INREG(VIDEO_DIP_CTL);
-	printf("VIDEO_DIP_CTL enable graphics DIP\t%ld\n",     BIT(dword, 31)),
+	printf("VIDEO_DIP_CTL enable graphics DIP\t%ld\n",     REG_BIT(dword, 31)),
 	printf("VIDEO_DIP_CTL port select\t\t[0x%lx] %s\n",
-				BITS(dword, 30, 29), dip_port[BITS(dword, 30, 29)]);
-	printf("VIDEO_DIP_CTL DIP buffer trans active\t%lu\n", BIT(dword, 28));
-	printf("VIDEO_DIP_CTL AVI DIP enabled\t\t%lu\n",       BIT(dword, 21));
-	printf("VIDEO_DIP_CTL vendor DIP enabled\t%lu\n",      BIT(dword, 22));
-	printf("VIDEO_DIP_CTL SPD DIP enabled\t\t%lu\n",       BIT(dword, 24));
+				REG_BITS(dword, 30, 29), dip_port[REG_BITS(dword, 30, 29)]);
+	printf("VIDEO_DIP_CTL DIP buffer trans active\t%lu\n", REG_BIT(dword, 28));
+	printf("VIDEO_DIP_CTL AVI DIP enabled\t\t%lu\n",       REG_BIT(dword, 21));
+	printf("VIDEO_DIP_CTL vendor DIP enabled\t%lu\n",      REG_BIT(dword, 22));
+	printf("VIDEO_DIP_CTL SPD DIP enabled\t\t%lu\n",       REG_BIT(dword, 24));
 	printf("VIDEO_DIP_CTL DIP buffer index\t\t[0x%lx] %s\n",
-			BITS(dword, 20, 19), video_dip_index[BITS(dword, 20, 19)]);
+			REG_BITS(dword, 20, 19), video_dip_index[REG_BITS(dword, 20, 19)]);
 	printf("VIDEO_DIP_CTL DIP trans freq\t\t[0x%lx] %s\n",
-			BITS(dword, 17, 16), video_dip_trans[BITS(dword, 17, 16)]);
-	printf("VIDEO_DIP_CTL DIP buffer size\t\t%lu\n", BITS(dword, 11, 8));
-	printf("VIDEO_DIP_CTL DIP address\t\t%lu\n", BITS(dword, 3, 0));
+			REG_BITS(dword, 17, 16), video_dip_trans[REG_BITS(dword, 17, 16)]);
+	printf("VIDEO_DIP_CTL DIP buffer size\t\t%lu\n", REG_BITS(dword, 11, 8));
+	printf("VIDEO_DIP_CTL DIP address\t\t%lu\n", REG_BITS(dword, 3, 0));
 
 	dword = INREG(AUD_CONFIG);
-	printf("AUD_CONFIG pixel clock\t\t\t[0x%lx] %s\n", BITS(dword, 19, 16),
-			OPNAME(pixel_clock, BITS(dword, 19, 16)));
-	printf("AUD_CONFIG fabrication enabled\t\t%lu\n", BITS(dword, 2, 2));
-	printf("AUD_CONFIG professional use allowed\t%lu\n", BIT(dword, 1));
-	printf("AUD_CONFIG fuse enabled\t\t\t%lu\n", BIT(dword, 0));
+	printf("AUD_CONFIG pixel clock\t\t\t[0x%lx] %s\n", REG_BITS(dword, 19, 16),
+			OPNAME(pixel_clock, REG_BITS(dword, 19, 16)));
+	printf("AUD_CONFIG fabrication enabled\t\t%lu\n", REG_BITS(dword, 2, 2));
+	printf("AUD_CONFIG professional use allowed\t%lu\n", REG_BIT(dword, 1));
+	printf("AUD_CONFIG fuse enabled\t\t\t%lu\n", REG_BIT(dword, 0));
 
 	dword = INREG(AUD_DEBUG);
-	printf("AUD_DEBUG function reset\t\t%lu\n", BIT(dword, 0));
+	printf("AUD_DEBUG function reset\t\t%lu\n", REG_BIT(dword, 0));
 
 	dword = INREG(AUD_SUBN_CNT);
-	printf("AUD_SUBN_CNT starting node number\t0x%lx\n",  BITS(dword, 23, 16));
-	printf("AUD_SUBN_CNT total number of nodes\t0x%lx\n", BITS(dword, 7, 0));
+	printf("AUD_SUBN_CNT starting node number\t0x%lx\n",  REG_BITS(dword, 23, 16));
+	printf("AUD_SUBN_CNT total number of nodes\t0x%lx\n", REG_BITS(dword, 7, 0));
 
 	dword = INREG(AUD_SUBN_CNT2);
-	printf("AUD_SUBN_CNT2 starting node number\t0x%lx\n",  BITS(dword, 24, 16));
-	printf("AUD_SUBN_CNT2 total number of nodes\t0x%lx\n", BITS(dword, 7, 0));
+	printf("AUD_SUBN_CNT2 starting node number\t0x%lx\n",  REG_BITS(dword, 24, 16));
+	printf("AUD_SUBN_CNT2 total number of nodes\t0x%lx\n", REG_BITS(dword, 7, 0));
 
 	dword = INREG(AUD_FUNC_GRP);
-	printf("AUD_FUNC_GRP unsol capable\t\t%lu\n", BIT(dword, 8));
-	printf("AUD_FUNC_GRP node type\t\t\t0x%lx\n", BITS(dword, 7, 0));
+	printf("AUD_FUNC_GRP unsol capable\t\t%lu\n", REG_BIT(dword, 8));
+	printf("AUD_FUNC_GRP node type\t\t\t0x%lx\n", REG_BITS(dword, 7, 0));
 
 	dword = INREG(AUD_GRP_CAP);
-	printf("AUD_GRP_CAP beep 0\t\t\t%lu\n",       BIT(dword, 16));
-	printf("AUD_GRP_CAP input delay\t\t\t%lu\n",  BITS(dword, 11, 8));
-	printf("AUD_GRP_CAP output delay\t\t%lu\n",   BITS(dword, 3, 0));
+	printf("AUD_GRP_CAP beep 0\t\t\t%lu\n",       REG_BIT(dword, 16));
+	printf("AUD_GRP_CAP input delay\t\t\t%lu\n",  REG_BITS(dword, 11, 8));
+	printf("AUD_GRP_CAP output delay\t\t%lu\n",   REG_BITS(dword, 3, 0));
 
 	dword = INREG(AUD_PWRST);
 	printf("AUD_PWRST device power state\t\t%s\n",
-			power_state[BITS(dword, 5, 4)]);
+			power_state[REG_BITS(dword, 5, 4)]);
 	printf("AUD_PWRST device power state setting\t%s\n",
-			power_state[BITS(dword, 1, 0)]);
+			power_state[REG_BITS(dword, 1, 0)]);
 
 	dword = INREG(AUD_SUPPWR);
-	printf("AUD_SUPPWR support D0\t\t\t%lu\n", BIT(dword, 0));
-	printf("AUD_SUPPWR support D1\t\t\t%lu\n", BIT(dword, 1));
-	printf("AUD_SUPPWR support D2\t\t\t%lu\n", BIT(dword, 2));
-	printf("AUD_SUPPWR support D3\t\t\t%lu\n", BIT(dword, 3));
+	printf("AUD_SUPPWR support D0\t\t\t%lu\n", REG_BIT(dword, 0));
+	printf("AUD_SUPPWR support D1\t\t\t%lu\n", REG_BIT(dword, 1));
+	printf("AUD_SUPPWR support D2\t\t\t%lu\n", REG_BIT(dword, 2));
+	printf("AUD_SUPPWR support D3\t\t\t%lu\n", REG_BIT(dword, 3));
 
 	dword = INREG(AUD_OUT_CWCAP);
-	printf("AUD_OUT_CWCAP widget type\t\t0x%lx\n",  BITS(dword, 23, 20));
-	printf("AUD_OUT_CWCAP sample delay\t\t0x%lx\n", BITS(dword, 19, 16));
+	printf("AUD_OUT_CWCAP widget type\t\t0x%lx\n",  REG_BITS(dword, 23, 20));
+	printf("AUD_OUT_CWCAP sample delay\t\t0x%lx\n", REG_BITS(dword, 19, 16));
 	printf("AUD_OUT_CWCAP channel count\t\t%lu\n",
-			BITS(dword, 15, 13) * 2 + BIT(dword, 0) + 1);
-	printf("AUD_OUT_CWCAP L-R swap\t\t\t%lu\n",       BIT(dword, 11));
-	printf("AUD_OUT_CWCAP power control\t\t%lu\n",    BIT(dword, 10));
-	printf("AUD_OUT_CWCAP digital\t\t\t%lu\n",        BIT(dword, 9));
-	printf("AUD_OUT_CWCAP conn list\t\t\t%lu\n",      BIT(dword, 8));
-	printf("AUD_OUT_CWCAP unsol\t\t\t%lu\n",          BIT(dword, 7));
-	printf("AUD_OUT_CWCAP mute\t\t\t%lu\n",           BIT(dword, 5));
-	printf("AUD_OUT_CWCAP format override\t\t%lu\n",  BIT(dword, 4));
-	printf("AUD_OUT_CWCAP amp param override\t%lu\n", BIT(dword, 3));
-	printf("AUD_OUT_CWCAP out amp present\t\t%lu\n",  BIT(dword, 2));
-	printf("AUD_OUT_CWCAP in amp present\t\t%lu\n",   BIT(dword, 1));
+			REG_BITS(dword, 15, 13) * 2 + REG_BIT(dword, 0) + 1);
+	printf("AUD_OUT_CWCAP L-R swap\t\t\t%lu\n",       REG_BIT(dword, 11));
+	printf("AUD_OUT_CWCAP power control\t\t%lu\n",    REG_BIT(dword, 10));
+	printf("AUD_OUT_CWCAP digital\t\t\t%lu\n",        REG_BIT(dword, 9));
+	printf("AUD_OUT_CWCAP conn list\t\t\t%lu\n",      REG_BIT(dword, 8));
+	printf("AUD_OUT_CWCAP unsol\t\t\t%lu\n",          REG_BIT(dword, 7));
+	printf("AUD_OUT_CWCAP mute\t\t\t%lu\n",           REG_BIT(dword, 5));
+	printf("AUD_OUT_CWCAP format override\t\t%lu\n",  REG_BIT(dword, 4));
+	printf("AUD_OUT_CWCAP amp param override\t%lu\n", REG_BIT(dword, 3));
+	printf("AUD_OUT_CWCAP out amp present\t\t%lu\n",  REG_BIT(dword, 2));
+	printf("AUD_OUT_CWCAP in amp present\t\t%lu\n",   REG_BIT(dword, 1));
 
 	dword = INREG(AUD_OUT_DIG_CNVT);
-	printf("AUD_OUT_DIG_CNVT SPDIF category\t\t0x%lx\n", BITS(dword, 14, 8));
-	printf("AUD_OUT_DIG_CNVT SPDIF level\t\t%lu\n",      BIT(dword, 7));
-	printf("AUD_OUT_DIG_CNVT professional\t\t%lu\n",     BIT(dword, 6));
-	printf("AUD_OUT_DIG_CNVT non PCM\t\t%lu\n",          BIT(dword, 5));
-	printf("AUD_OUT_DIG_CNVT copyright asserted\t%lu\n", BIT(dword, 4));
-	printf("AUD_OUT_DIG_CNVT filter preemphasis\t%lu\n", BIT(dword, 3));
-	printf("AUD_OUT_DIG_CNVT validity config\t%lu\n",    BIT(dword, 2));
-	printf("AUD_OUT_DIG_CNVT validity flag\t\t%lu\n",    BIT(dword, 1));
-	printf("AUD_OUT_DIG_CNVT digital enable\t\t%lu\n",   BIT(dword, 0));
+	printf("AUD_OUT_DIG_CNVT SPDIF category\t\t0x%lx\n", REG_BITS(dword, 14, 8));
+	printf("AUD_OUT_DIG_CNVT SPDIF level\t\t%lu\n",      REG_BIT(dword, 7));
+	printf("AUD_OUT_DIG_CNVT professional\t\t%lu\n",     REG_BIT(dword, 6));
+	printf("AUD_OUT_DIG_CNVT non PCM\t\t%lu\n",          REG_BIT(dword, 5));
+	printf("AUD_OUT_DIG_CNVT copyright asserted\t%lu\n", REG_BIT(dword, 4));
+	printf("AUD_OUT_DIG_CNVT filter preemphasis\t%lu\n", REG_BIT(dword, 3));
+	printf("AUD_OUT_DIG_CNVT validity config\t%lu\n",    REG_BIT(dword, 2));
+	printf("AUD_OUT_DIG_CNVT validity flag\t\t%lu\n",    REG_BIT(dword, 1));
+	printf("AUD_OUT_DIG_CNVT digital enable\t\t%lu\n",   REG_BIT(dword, 0));
 
 	dword = INREG(AUD_OUT_CH_STR);
-	printf("AUD_OUT_CH_STR stream id\t\t0x%lx\n",        BITS(dword, 7, 4));
-	printf("AUD_OUT_CH_STR lowest channel\t\t%lu\n",     BITS(dword, 3, 0));
+	printf("AUD_OUT_CH_STR stream id\t\t0x%lx\n",        REG_BITS(dword, 7, 4));
+	printf("AUD_OUT_CH_STR lowest channel\t\t%lu\n",     REG_BITS(dword, 3, 0));
 
 	dword = INREG(AUD_OUT_STR_DESC);
-	printf("AUD_OUT_STR_DESC stream channels\t%lu\n",    BITS(dword, 3, 0) + 1);
+	printf("AUD_OUT_STR_DESC stream channels\t%lu\n",    REG_BITS(dword, 3, 0) + 1);
 	printf("AUD_OUT_STR_DESC Bits per Sample\t[%#lx] %s\n",
-			BITS(dword, 6, 4), OPNAME(bits_per_sample, BITS(dword, 6, 4)));
+			REG_BITS(dword, 6, 4), OPNAME(bits_per_sample, REG_BITS(dword, 6, 4)));
 
 	dword = INREG(AUD_PINW_CAP);
-	printf("AUD_PINW_CAP widget type\t\t0x%lx\n",        BITS(dword, 23, 20));
-	printf("AUD_PINW_CAP sample delay\t\t0x%lx\n",       BITS(dword, 19, 16));
+	printf("AUD_PINW_CAP widget type\t\t0x%lx\n",        REG_BITS(dword, 23, 20));
+	printf("AUD_PINW_CAP sample delay\t\t0x%lx\n",       REG_BITS(dword, 19, 16));
 	printf("AUD_PINW_CAP channel count\t\t%lu\n",
-			BITS(dword, 15, 13) * 2 + BIT(dword, 0) + 1);
-	printf("AUD_PINW_CAP HDCP\t\t\t%lu\n",               BIT(dword, 12));
-	printf("AUD_PINW_CAP L-R swap\t\t\t%lu\n",           BIT(dword, 11));
-	printf("AUD_PINW_CAP power control\t\t%lu\n",        BIT(dword, 10));
-	printf("AUD_PINW_CAP digital\t\t\t%lu\n",            BIT(dword, 9));
-	printf("AUD_PINW_CAP conn list\t\t\t%lu\n",          BIT(dword, 8));
-	printf("AUD_PINW_CAP unsol\t\t\t%lu\n",              BIT(dword, 7));
-	printf("AUD_PINW_CAP mute\t\t\t%lu\n",               BIT(dword, 5));
-	printf("AUD_PINW_CAP format override\t\t%lu\n",      BIT(dword, 4));
-	printf("AUD_PINW_CAP amp param override\t\t%lu\n",   BIT(dword, 3));
-	printf("AUD_PINW_CAP out amp present\t\t%lu\n",      BIT(dword, 2));
-	printf("AUD_PINW_CAP in amp present\t\t%lu\n",       BIT(dword, 1));
+			REG_BITS(dword, 15, 13) * 2 + REG_BIT(dword, 0) + 1);
+	printf("AUD_PINW_CAP HDCP\t\t\t%lu\n",               REG_BIT(dword, 12));
+	printf("AUD_PINW_CAP L-R swap\t\t\t%lu\n",           REG_BIT(dword, 11));
+	printf("AUD_PINW_CAP power control\t\t%lu\n",        REG_BIT(dword, 10));
+	printf("AUD_PINW_CAP digital\t\t\t%lu\n",            REG_BIT(dword, 9));
+	printf("AUD_PINW_CAP conn list\t\t\t%lu\n",          REG_BIT(dword, 8));
+	printf("AUD_PINW_CAP unsol\t\t\t%lu\n",              REG_BIT(dword, 7));
+	printf("AUD_PINW_CAP mute\t\t\t%lu\n",               REG_BIT(dword, 5));
+	printf("AUD_PINW_CAP format override\t\t%lu\n",      REG_BIT(dword, 4));
+	printf("AUD_PINW_CAP amp param override\t\t%lu\n",   REG_BIT(dword, 3));
+	printf("AUD_PINW_CAP out amp present\t\t%lu\n",      REG_BIT(dword, 2));
+	printf("AUD_PINW_CAP in amp present\t\t%lu\n",       REG_BIT(dword, 1));
 
 
 	dword = INREG(AUD_PIN_CAP);
-	printf("AUD_PIN_CAP EAPD\t\t\t%lu\n",          BIT(dword, 16));
-	printf("AUD_PIN_CAP HDMI\t\t\t%lu\n",          BIT(dword, 7));
-	printf("AUD_PIN_CAP output\t\t\t%lu\n",        BIT(dword, 4));
-	printf("AUD_PIN_CAP presence detect\t\t%lu\n", BIT(dword, 2));
+	printf("AUD_PIN_CAP EAPD\t\t\t%lu\n",          REG_BIT(dword, 16));
+	printf("AUD_PIN_CAP HDMI\t\t\t%lu\n",          REG_BIT(dword, 7));
+	printf("AUD_PIN_CAP output\t\t\t%lu\n",        REG_BIT(dword, 4));
+	printf("AUD_PIN_CAP presence detect\t\t%lu\n", REG_BIT(dword, 2));
 
 	dword = INREG(AUD_PINW_CNTR);
-	printf("AUD_PINW_CNTR mute status\t\t%lu\n",     BIT(dword, 8));
-	printf("AUD_PINW_CNTR out enable\t\t%lu\n",      BIT(dword, 6));
-	printf("AUD_PINW_CNTR amp mute status\t\t%lu\n", BIT(dword, 8));
-	printf("AUD_PINW_CNTR amp mute status\t\t%lu\n", BIT(dword, 8));
+	printf("AUD_PINW_CNTR mute status\t\t%lu\n",     REG_BIT(dword, 8));
+	printf("AUD_PINW_CNTR out enable\t\t%lu\n",      REG_BIT(dword, 6));
+	printf("AUD_PINW_CNTR amp mute status\t\t%lu\n", REG_BIT(dword, 8));
+	printf("AUD_PINW_CNTR amp mute status\t\t%lu\n", REG_BIT(dword, 8));
 	printf("AUD_PINW_CNTR stream type\t\t[0x%lx] %s\n",
-			BITS(dword, 2, 0),
-			OPNAME(stream_type, BITS(dword, 2, 0)));
+			REG_BITS(dword, 2, 0),
+			OPNAME(stream_type, REG_BITS(dword, 2, 0)));
 
 	dword = INREG(AUD_PINW_UNSOLRESP);
-	printf("AUD_PINW_UNSOLRESP enable unsol resp\t%lu\n", BIT(dword, 31));
+	printf("AUD_PINW_UNSOLRESP enable unsol resp\t%lu\n", REG_BIT(dword, 31));
 
 	dword = INREG(AUD_CNTL_ST);
-	printf("AUD_CNTL_ST DIP audio enabled\t\t%lu\n", BIT(dword, 21));
-	printf("AUD_CNTL_ST DIP ACP enabled\t\t%lu\n",   BIT(dword, 22));
-	printf("AUD_CNTL_ST DIP ISRCx enabled\t\t%lu\n", BIT(dword, 23));
+	printf("AUD_CNTL_ST DIP audio enabled\t\t%lu\n", REG_BIT(dword, 21));
+	printf("AUD_CNTL_ST DIP ACP enabled\t\t%lu\n",   REG_BIT(dword, 22));
+	printf("AUD_CNTL_ST DIP ISRCx enabled\t\t%lu\n", REG_BIT(dword, 23));
 	printf("AUD_CNTL_ST DIP port select\t\t[0x%lx] %s\n",
-			BITS(dword, 30, 29), dip_port[BITS(dword, 30, 29)]);
+			REG_BITS(dword, 30, 29), dip_port[REG_BITS(dword, 30, 29)]);
 	printf("AUD_CNTL_ST DIP buffer index\t\t[0x%lx] %s\n",
-			BITS(dword, 20, 18), OPNAME(dip_index, BITS(dword, 20, 18)));
+			REG_BITS(dword, 20, 18), OPNAME(dip_index, REG_BITS(dword, 20, 18)));
 	printf("AUD_CNTL_ST DIP trans freq\t\t[0x%lx] %s\n",
-			BITS(dword, 17, 16), dip_trans[BITS(dword, 17, 16)]);
-	printf("AUD_CNTL_ST DIP address\t\t\t%lu\n", BITS(dword, 3, 0));
-	printf("AUD_CNTL_ST CP ready\t\t\t%lu\n",    BIT(dword, 15));
-	printf("AUD_CNTL_ST ELD valid\t\t\t%lu\n",   BIT(dword, 14));
-	printf("AUD_CNTL_ST ELD ack\t\t\t%lu\n",     BIT(dword, 4));
-	printf("AUD_CNTL_ST ELD bufsize\t\t\t%lu\n", BITS(dword, 13, 9));
-	printf("AUD_CNTL_ST ELD address\t\t\t%lu\n", BITS(dword, 8, 5));
+			REG_BITS(dword, 17, 16), dip_trans[REG_BITS(dword, 17, 16)]);
+	printf("AUD_CNTL_ST DIP address\t\t\t%lu\n", REG_BITS(dword, 3, 0));
+	printf("AUD_CNTL_ST CP ready\t\t\t%lu\n",    REG_BIT(dword, 15));
+	printf("AUD_CNTL_ST ELD valid\t\t\t%lu\n",   REG_BIT(dword, 14));
+	printf("AUD_CNTL_ST ELD ack\t\t\t%lu\n",     REG_BIT(dword, 4));
+	printf("AUD_CNTL_ST ELD bufsize\t\t\t%lu\n", REG_BITS(dword, 13, 9));
+	printf("AUD_CNTL_ST ELD address\t\t\t%lu\n", REG_BITS(dword, 8, 5));
 
 	dword = INREG(AUD_HDMIW_STATUS);
-	printf("AUD_HDMIW_STATUS CDCLK/DOTCLK underrun\t%lu\n", BIT(dword, 31));
-	printf("AUD_HDMIW_STATUS CDCLK/DOTCLK overrun\t%lu\n",  BIT(dword, 30));
-	printf("AUD_HDMIW_STATUS BCLK/CDCLK underrun\t%lu\n",   BIT(dword, 29));
-	printf("AUD_HDMIW_STATUS BCLK/CDCLK overrun\t%lu\n",    BIT(dword, 28));
+	printf("AUD_HDMIW_STATUS CDCLK/DOTCLK underrun\t%lu\n", REG_BIT(dword, 31));
+	printf("AUD_HDMIW_STATUS CDCLK/DOTCLK overrun\t%lu\n",  REG_BIT(dword, 30));
+	printf("AUD_HDMIW_STATUS BCLK/CDCLK underrun\t%lu\n",   REG_BIT(dword, 29));
+	printf("AUD_HDMIW_STATUS BCLK/CDCLK overrun\t%lu\n",    REG_BIT(dword, 28));
 
 	dword = INREG(AUD_CONV_CHCNT);
-	printf("AUD_CONV_CHCNT HDMI HBR enabled\t\t%lu\n", BITS(dword, 15, 14));
-	printf("AUD_CONV_CHCNT HDMI channel count\t%lu\n", BITS(dword, 11, 8) + 1);
+	printf("AUD_CONV_CHCNT HDMI HBR enabled\t\t%lu\n", REG_BITS(dword, 15, 14));
+	printf("AUD_CONV_CHCNT HDMI channel count\t%lu\n", REG_BITS(dword, 11, 8) + 1);
 
 	printf("AUD_CONV_CHCNT HDMI channel mapping:\n");
 	for (i = 0; i < 8; i++) {
 		OUTREG(AUD_CONV_CHCNT, i);
 		dword = INREG(AUD_CONV_CHCNT);
-		printf("\t\t\t\t\t[0x%x] %u => %lu\n", dword, i, BITS(dword, 7, 4));
+		printf("\t\t\t\t\t[0x%x] %u => %lu\n", dword, i, REG_BITS(dword, 7, 4));
 	}
 
 	printf("AUD_HDMIW_HDMIEDID HDMI ELD:\n\t");
 	dword = INREG(AUD_CNTL_ST);
 	dword &= ~BITMASK(8, 5);
 	OUTREG(AUD_CNTL_ST, dword);
-	for (i = 0; i < BITS(dword, 14, 10) / 4; i++)
+	for (i = 0; i < REG_BITS(dword, 14, 10) / 4; i++)
 		printf("%08x ", htonl(INREG(AUD_HDMIW_HDMIEDID)));
 	printf("\n");
 
@@ -864,347 +864,347 @@ static void dump_cpt(void)
 	printf("\nDetails:\n\n");
 
 	dword = INREG(VIDEO_DIP_CTL_A);
-	printf("VIDEO_DIP_CTL_A Enable_Graphics_DIP\t\t\t%ld\n",     BIT(dword, 31)),
-	printf("VIDEO_DIP_CTL_A GCP_DIP_enable\t\t\t\t%ld\n",     BIT(dword, 25)),
-	printf("VIDEO_DIP_CTL_A Video_DIP_type_enable AVI\t\t%lu\n",       BIT(dword, 21));
-	printf("VIDEO_DIP_CTL_A Video_DIP_type_enable Vendor\t\t%lu\n",      BIT(dword, 22));
-	printf("VIDEO_DIP_CTL_A Video_DIP_type_enable Gamut\t\t%lu\n",       BIT(dword, 23));
-	printf("VIDEO_DIP_CTL_A Video_DIP_type_enable Source \t\t%lu\n",       BIT(dword, 24));
+	printf("VIDEO_DIP_CTL_A Enable_Graphics_DIP\t\t\t%ld\n",     REG_BIT(dword, 31)),
+	printf("VIDEO_DIP_CTL_A GCP_DIP_enable\t\t\t\t%ld\n",     REG_BIT(dword, 25)),
+	printf("VIDEO_DIP_CTL_A Video_DIP_type_enable AVI\t\t%lu\n",       REG_BIT(dword, 21));
+	printf("VIDEO_DIP_CTL_A Video_DIP_type_enable Vendor\t\t%lu\n",      REG_BIT(dword, 22));
+	printf("VIDEO_DIP_CTL_A Video_DIP_type_enable Gamut\t\t%lu\n",       REG_BIT(dword, 23));
+	printf("VIDEO_DIP_CTL_A Video_DIP_type_enable Source \t\t%lu\n",       REG_BIT(dword, 24));
 	printf("VIDEO_DIP_CTL_A Video_DIP_buffer_index\t\t\t[0x%lx] %s\n",
-			BITS(dword, 20, 19), video_dip_index[BITS(dword, 20, 19)]);
+			REG_BITS(dword, 20, 19), video_dip_index[REG_BITS(dword, 20, 19)]);
 	printf("VIDEO_DIP_CTL_A Video_DIP_frequency\t\t\t[0x%lx] %s\n",
-			BITS(dword, 17, 16), video_dip_trans[BITS(dword, 17, 16)]);
-	printf("VIDEO_DIP_CTL_A Video_DIP_buffer_size\t\t\t%lu\n", BITS(dword, 11, 8));
-	printf("VIDEO_DIP_CTL_A Video_DIP_access_address\t\t%lu\n", BITS(dword, 3, 0));
+			REG_BITS(dword, 17, 16), video_dip_trans[REG_BITS(dword, 17, 16)]);
+	printf("VIDEO_DIP_CTL_A Video_DIP_buffer_size\t\t\t%lu\n", REG_BITS(dword, 11, 8));
+	printf("VIDEO_DIP_CTL_A Video_DIP_access_address\t\t%lu\n", REG_BITS(dword, 3, 0));
 
 	dword = INREG(VIDEO_DIP_CTL_B);
-	printf("VIDEO_DIP_CTL_B Enable_Graphics_DIP\t\t\t%ld\n",     BIT(dword, 31)),
-	printf("VIDEO_DIP_CTL_B GCP_DIP_enable\t\t\t\t%ld\n",     BIT(dword, 25)),
-	printf("VIDEO_DIP_CTL_B Video_DIP_type_enable AVI\t\t%lu\n",       BIT(dword, 21));
-	printf("VIDEO_DIP_CTL_B Video_DIP_type_enable Vendor\t\t%lu\n",      BIT(dword, 22));
-	printf("VIDEO_DIP_CTL_B Video_DIP_type_enable Gamut\t\t%lu\n",       BIT(dword, 23));
-	printf("VIDEO_DIP_CTL_B Video_DIP_type_enable Source \t\t%lu\n",       BIT(dword, 24));
+	printf("VIDEO_DIP_CTL_B Enable_Graphics_DIP\t\t\t%ld\n",     REG_BIT(dword, 31)),
+	printf("VIDEO_DIP_CTL_B GCP_DIP_enable\t\t\t\t%ld\n",     REG_BIT(dword, 25)),
+	printf("VIDEO_DIP_CTL_B Video_DIP_type_enable AVI\t\t%lu\n",       REG_BIT(dword, 21));
+	printf("VIDEO_DIP_CTL_B Video_DIP_type_enable Vendor\t\t%lu\n",      REG_BIT(dword, 22));
+	printf("VIDEO_DIP_CTL_B Video_DIP_type_enable Gamut\t\t%lu\n",       REG_BIT(dword, 23));
+	printf("VIDEO_DIP_CTL_B Video_DIP_type_enable Source \t\t%lu\n",       REG_BIT(dword, 24));
 	printf("VIDEO_DIP_CTL_B Video_DIP_buffer_index\t\t\t[0x%lx] %s\n",
-			BITS(dword, 20, 19), video_dip_index[BITS(dword, 20, 19)]);
+			REG_BITS(dword, 20, 19), video_dip_index[REG_BITS(dword, 20, 19)]);
 	printf("VIDEO_DIP_CTL_B Video_DIP_frequency\t\t\t[0x%lx] %s\n",
-			BITS(dword, 17, 16), video_dip_trans[BITS(dword, 17, 16)]);
-	printf("VIDEO_DIP_CTL_B Video_DIP_buffer_size\t\t\t%lu\n", BITS(dword, 11, 8));
-	printf("VIDEO_DIP_CTL_B Video_DIP_access_address\t\t%lu\n", BITS(dword, 3, 0));
+			REG_BITS(dword, 17, 16), video_dip_trans[REG_BITS(dword, 17, 16)]);
+	printf("VIDEO_DIP_CTL_B Video_DIP_buffer_size\t\t\t%lu\n", REG_BITS(dword, 11, 8));
+	printf("VIDEO_DIP_CTL_B Video_DIP_access_address\t\t%lu\n", REG_BITS(dword, 3, 0));
 
 	dword = INREG(VIDEO_DIP_CTL_C);
-	printf("VIDEO_DIP_CTL_C Enable_Graphics_DIP\t\t\t%ld\n",     BIT(dword, 31)),
-	printf("VIDEO_DIP_CTL_C GCP_DIP_enable\t\t\t\t%ld\n",     BIT(dword, 25)),
-	printf("VIDEO_DIP_CTL_C Video_DIP_type_enable AVI\t\t%lu\n",       BIT(dword, 21));
-	printf("VIDEO_DIP_CTL_C Video_DIP_type_enable Vendor\t\t%lu\n",      BIT(dword, 22));
-	printf("VIDEO_DIP_CTL_C Video_DIP_type_enable Gamut\t\t%lu\n",       BIT(dword, 23));
-	printf("VIDEO_DIP_CTL_C Video_DIP_type_enable Source \t\t%lu\n",       BIT(dword, 24));
+	printf("VIDEO_DIP_CTL_C Enable_Graphics_DIP\t\t\t%ld\n",     REG_BIT(dword, 31)),
+	printf("VIDEO_DIP_CTL_C GCP_DIP_enable\t\t\t\t%ld\n",     REG_BIT(dword, 25)),
+	printf("VIDEO_DIP_CTL_C Video_DIP_type_enable AVI\t\t%lu\n",       REG_BIT(dword, 21));
+	printf("VIDEO_DIP_CTL_C Video_DIP_type_enable Vendor\t\t%lu\n",      REG_BIT(dword, 22));
+	printf("VIDEO_DIP_CTL_C Video_DIP_type_enable Gamut\t\t%lu\n",       REG_BIT(dword, 23));
+	printf("VIDEO_DIP_CTL_C Video_DIP_type_enable Source \t\t%lu\n",       REG_BIT(dword, 24));
 	printf("VIDEO_DIP_CTL_C Video_DIP_buffer_index\t\t\t[0x%lx] %s\n",
-			BITS(dword, 20, 19), video_dip_index[BITS(dword, 20, 19)]);
+			REG_BITS(dword, 20, 19), video_dip_index[REG_BITS(dword, 20, 19)]);
 	printf("VIDEO_DIP_CTL_C Video_DIP_frequency\t\t\t[0x%lx] %s\n",
-			BITS(dword, 17, 16), video_dip_trans[BITS(dword, 17, 16)]);
-	printf("VIDEO_DIP_CTL_C Video_DIP_buffer_size\t\t\t%lu\n", BITS(dword, 11, 8));
-	printf("VIDEO_DIP_CTL_C Video_DIP_access_address\t\t%lu\n", BITS(dword, 3, 0));
+			REG_BITS(dword, 17, 16), video_dip_trans[REG_BITS(dword, 17, 16)]);
+	printf("VIDEO_DIP_CTL_C Video_DIP_buffer_size\t\t\t%lu\n", REG_BITS(dword, 11, 8));
+	printf("VIDEO_DIP_CTL_C Video_DIP_access_address\t\t%lu\n", REG_BITS(dword, 3, 0));
 
 	dword = INREG(AUD_VID_DID);
 	printf("AUD_VID_DID vendor id\t\t\t\t\t0x%x\n", dword >> 16);
 	printf("AUD_VID_DID device id\t\t\t\t\t0x%x\n", dword & 0xffff);
 
 	dword = INREG(AUD_RID);
-	printf("AUD_RID Major_Revision\t\t\t\t\t0x%lx\n", BITS(dword, 23, 20));
-	printf("AUD_RID Minor_Revision\t\t\t\t\t0x%lx\n", BITS(dword, 19, 16));
-	printf("AUD_RID Revision_Id\t\t\t\t\t0x%lx\n",    BITS(dword, 15, 8));
-	printf("AUD_RID Stepping_Id\t\t\t\t\t0x%lx\n",    BITS(dword, 7, 0));
+	printf("AUD_RID Major_Revision\t\t\t\t\t0x%lx\n", REG_BITS(dword, 23, 20));
+	printf("AUD_RID Minor_Revision\t\t\t\t\t0x%lx\n", REG_BITS(dword, 19, 16));
+	printf("AUD_RID Revision_Id\t\t\t\t\t0x%lx\n",    REG_BITS(dword, 15, 8));
+	printf("AUD_RID Stepping_Id\t\t\t\t\t0x%lx\n",    REG_BITS(dword, 7, 0));
 
 	dword = INREG(HDMIB);
 	printf("HDMIB Port_Enable\t\t\t\t\t%u\n",      !!(dword & SDVO_ENABLE));
 	printf("HDMIB Transcoder_Select\t\t\t\t\t[0x%lx] %s\n",
-			BITS(dword, 30, 29), transcoder_select[BITS(dword, 30, 29)]);
-	printf("HDMIB sDVO_Border_Enable\t\t\t\t%lu\n", BIT(dword, 7));
-	printf("HDMIB HDCP_Port_Select\t\t\t\t\t%lu\n", BIT(dword, 5));
-	printf("HDMIB SDVO_HPD_Interrupt_Enable\t\t\t\t%lu\n", BIT(dword, 23));
-	printf("HDMIB Port_Detected\t\t\t\t\t%lu\n", BIT(dword, 2));
+			REG_BITS(dword, 30, 29), transcoder_select[REG_BITS(dword, 30, 29)]);
+	printf("HDMIB sDVO_Border_Enable\t\t\t\t%lu\n", REG_BIT(dword, 7));
+	printf("HDMIB HDCP_Port_Select\t\t\t\t\t%lu\n", REG_BIT(dword, 5));
+	printf("HDMIB SDVO_HPD_Interrupt_Enable\t\t\t\t%lu\n", REG_BIT(dword, 23));
+	printf("HDMIB Port_Detected\t\t\t\t\t%lu\n", REG_BIT(dword, 2));
 	printf("HDMIB Encoding\t\t\t\t\t\t[0x%lx] %s\n",
-			BITS(dword, 11, 10), sdvo_hdmi_encoding[BITS(dword, 11, 10)]);
-	printf("HDMIB HDMI_or_DVI_Select\t\t\t\t%s\n", BIT(dword, 9) ? "HDMI" : "DVI");
+			REG_BITS(dword, 11, 10), sdvo_hdmi_encoding[REG_BITS(dword, 11, 10)]);
+	printf("HDMIB HDMI_or_DVI_Select\t\t\t\t%s\n", REG_BIT(dword, 9) ? "HDMI" : "DVI");
 	printf("HDMIB Audio_Output_Enable\t\t\t\t%u\n", !!(dword & SDVO_AUDIO_ENABLE));
 
 	dword = INREG(HDMIC);
 	printf("HDMIC Port_Enable\t\t\t\t\t%u\n",      !!(dword & SDVO_ENABLE));
 	printf("HDMIC Transcoder_Select\t\t\t\t\t[0x%lx] %s\n",
-			BITS(dword, 30, 29), transcoder_select[BITS(dword, 30, 29)]);
-	printf("HDMIC sDVO_Border_Enable\t\t\t\t%lu\n", BIT(dword, 7));
-	printf("HDMIC HDCP_Port_Select\t\t\t\t\t%lu\n", BIT(dword, 5));
-	printf("HDMIC SDVO_HPD_Interrupt_Enable\t\t\t\t%lu\n", BIT(dword, 23));
-	printf("HDMIC Port_Detected\t\t\t\t\t%lu\n", BIT(dword, 2));
+			REG_BITS(dword, 30, 29), transcoder_select[REG_BITS(dword, 30, 29)]);
+	printf("HDMIC sDVO_Border_Enable\t\t\t\t%lu\n", REG_BIT(dword, 7));
+	printf("HDMIC HDCP_Port_Select\t\t\t\t\t%lu\n", REG_BIT(dword, 5));
+	printf("HDMIC SDVO_HPD_Interrupt_Enable\t\t\t\t%lu\n", REG_BIT(dword, 23));
+	printf("HDMIC Port_Detected\t\t\t\t\t%lu\n", REG_BIT(dword, 2));
 	printf("HDMIC Encoding\t\t\t\t\t\t[0x%lx] %s\n",
-			BITS(dword, 11, 10), sdvo_hdmi_encoding[BITS(dword, 11, 10)]);
-	printf("HDMIC HDMI_or_DVI_Select\t\t\t\t%s\n", BIT(dword, 9) ? "HDMI" : "DVI");
+			REG_BITS(dword, 11, 10), sdvo_hdmi_encoding[REG_BITS(dword, 11, 10)]);
+	printf("HDMIC HDMI_or_DVI_Select\t\t\t\t%s\n", REG_BIT(dword, 9) ? "HDMI" : "DVI");
 	printf("HDMIC Audio_Output_Enable\t\t\t\t%u\n", !!(dword & SDVO_AUDIO_ENABLE));
 
 	dword = INREG(HDMID);
 	printf("HDMID Port_Enable\t\t\t\t\t%u\n",      !!(dword & SDVO_ENABLE));
 	printf("HDMID Transcoder_Select\t\t\t\t\t[0x%lx] %s\n",
-			BITS(dword, 30, 29), transcoder_select[BITS(dword, 30, 29)]);
-	printf("HDMID sDVO_Border_Enable\t\t\t\t%lu\n", BIT(dword, 7));
-	printf("HDMID HDCP_Port_Select\t\t\t\t\t%lu\n", BIT(dword, 5));
-	printf("HDMID SDVO_HPD_Interrupt_Enable\t\t\t\t%lu\n", BIT(dword, 23));
-	printf("HDMID Port_Detected\t\t\t\t\t%lu\n", BIT(dword, 2));
+			REG_BITS(dword, 30, 29), transcoder_select[REG_BITS(dword, 30, 29)]);
+	printf("HDMID sDVO_Border_Enable\t\t\t\t%lu\n", REG_BIT(dword, 7));
+	printf("HDMID HDCP_Port_Select\t\t\t\t\t%lu\n", REG_BIT(dword, 5));
+	printf("HDMID SDVO_HPD_Interrupt_Enable\t\t\t\t%lu\n", REG_BIT(dword, 23));
+	printf("HDMID Port_Detected\t\t\t\t\t%lu\n", REG_BIT(dword, 2));
 	printf("HDMID Encoding\t\t\t\t\t\t[0x%lx] %s\n",
-			BITS(dword, 11, 10), sdvo_hdmi_encoding[BITS(dword, 11, 10)]);
-	printf("HDMID HDMI_or_DVI_Select\t\t\t\t%s\n", BIT(dword, 9) ? "HDMI" : "DVI");
+			REG_BITS(dword, 11, 10), sdvo_hdmi_encoding[REG_BITS(dword, 11, 10)]);
+	printf("HDMID HDMI_or_DVI_Select\t\t\t\t%s\n", REG_BIT(dword, 9) ? "HDMI" : "DVI");
 	printf("HDMID Audio_Output_Enable\t\t\t\t%u\n", !!(dword & SDVO_AUDIO_ENABLE));
 
 	dword = INREG(DP_CTL_B);
-	printf("DP_CTL_B DisplayPort_Enable\t\t\t\t%lu\n", BIT(dword, 31));
+	printf("DP_CTL_B DisplayPort_Enable\t\t\t\t%lu\n", REG_BIT(dword, 31));
 	printf("DP_CTL_B Port_Width_Selection\t\t\t\t[0x%lx] %s\n",
-			BITS(dword, 21, 19), dp_port_width[BITS(dword, 21, 19)]);
-	printf("DP_CTL_B Port_Detected\t\t\t\t\t%lu\n", BIT(dword, 2));
-	printf("DP_CTL_B HDCP_Port_Select\t\t\t\t%lu\n", BIT(dword, 5));
-	printf("DP_CTL_B Audio_Output_Enable\t\t\t\t%lu\n", BIT(dword, 6));
+			REG_BITS(dword, 21, 19), dp_port_width[REG_BITS(dword, 21, 19)]);
+	printf("DP_CTL_B Port_Detected\t\t\t\t\t%lu\n", REG_BIT(dword, 2));
+	printf("DP_CTL_B HDCP_Port_Select\t\t\t\t%lu\n", REG_BIT(dword, 5));
+	printf("DP_CTL_B Audio_Output_Enable\t\t\t\t%lu\n", REG_BIT(dword, 6));
 
 	dword = INREG(DP_CTL_C);
-	printf("DP_CTL_C DisplayPort_Enable\t\t\t\t%lu\n", BIT(dword, 31));
+	printf("DP_CTL_C DisplayPort_Enable\t\t\t\t%lu\n", REG_BIT(dword, 31));
 	printf("DP_CTL_C Port_Width_Selection\t\t\t\t[0x%lx] %s\n",
-			BITS(dword, 21, 19), dp_port_width[BITS(dword, 21, 19)]);
-	printf("DP_CTL_C Port_Detected\t\t\t\t\t%lu\n", BIT(dword, 2));
-	printf("DP_CTL_C HDCP_Port_Select\t\t\t\t%lu\n", BIT(dword, 5));
-	printf("DP_CTL_C Audio_Output_Enable\t\t\t\t%lu\n", BIT(dword, 6));
+			REG_BITS(dword, 21, 19), dp_port_width[REG_BITS(dword, 21, 19)]);
+	printf("DP_CTL_C Port_Detected\t\t\t\t\t%lu\n", REG_BIT(dword, 2));
+	printf("DP_CTL_C HDCP_Port_Select\t\t\t\t%lu\n", REG_BIT(dword, 5));
+	printf("DP_CTL_C Audio_Output_Enable\t\t\t\t%lu\n", REG_BIT(dword, 6));
 
 	dword = INREG(DP_CTL_D);
-	printf("DP_CTL_D DisplayPort_Enable\t\t\t\t%lu\n", BIT(dword, 31));
+	printf("DP_CTL_D DisplayPort_Enable\t\t\t\t%lu\n", REG_BIT(dword, 31));
 	printf("DP_CTL_D Port_Width_Selection\t\t\t\t[0x%lx] %s\n",
-			BITS(dword, 21, 19), dp_port_width[BITS(dword, 21, 19)]);
-	printf("DP_CTL_D Port_Detected\t\t\t\t\t%lu\n", BIT(dword, 2));
-	printf("DP_CTL_D HDCP_Port_Select\t\t\t\t%lu\n", BIT(dword, 5));
-	printf("DP_CTL_D Audio_Output_Enable\t\t\t\t%lu\n", BIT(dword, 6));
+			REG_BITS(dword, 21, 19), dp_port_width[REG_BITS(dword, 21, 19)]);
+	printf("DP_CTL_D Port_Detected\t\t\t\t\t%lu\n", REG_BIT(dword, 2));
+	printf("DP_CTL_D HDCP_Port_Select\t\t\t\t%lu\n", REG_BIT(dword, 5));
+	printf("DP_CTL_D Audio_Output_Enable\t\t\t\t%lu\n", REG_BIT(dword, 6));
 
 	dword = INREG(AUD_CONFIG_A);
-	printf("AUD_CONFIG_A  N_index_value\t\t\t\t[0x%lx] %s\n", BIT(dword, 29),
-			n_index_value[BIT(dword, 29)]);
-	printf("AUD_CONFIG_A  N_programming_enable\t\t\t%lu\n", BIT(dword, 28));
-	printf("AUD_CONFIG_A  Upper_N_value\t\t\t\t0x%02lx\n", BITS(dword, 27, 20));
-	printf("AUD_CONFIG_A  Lower_N_value\t\t\t\t0x%03lx\n", BITS(dword, 15, 4));
-	printf("AUD_CONFIG_A  Pixel_Clock_HDMI\t\t\t\t[0x%lx] %s\n", BITS(dword, 19, 16),
-			OPNAME(pixel_clock, BITS(dword, 19, 16)));
-	printf("AUD_CONFIG_A  Disable_NCTS\t\t\t\t%lu\n", BIT(dword, 3));
+	printf("AUD_CONFIG_A  N_index_value\t\t\t\t[0x%lx] %s\n", REG_BIT(dword, 29),
+			n_index_value[REG_BIT(dword, 29)]);
+	printf("AUD_CONFIG_A  N_programming_enable\t\t\t%lu\n", REG_BIT(dword, 28));
+	printf("AUD_CONFIG_A  Upper_N_value\t\t\t\t0x%02lx\n", REG_BITS(dword, 27, 20));
+	printf("AUD_CONFIG_A  Lower_N_value\t\t\t\t0x%03lx\n", REG_BITS(dword, 15, 4));
+	printf("AUD_CONFIG_A  Pixel_Clock_HDMI\t\t\t\t[0x%lx] %s\n", REG_BITS(dword, 19, 16),
+			OPNAME(pixel_clock, REG_BITS(dword, 19, 16)));
+	printf("AUD_CONFIG_A  Disable_NCTS\t\t\t\t%lu\n", REG_BIT(dword, 3));
 	dword = INREG(AUD_CONFIG_B);
-	printf("AUD_CONFIG_B  N_index_value\t\t\t\t[0x%lx] %s\n", BIT(dword, 29),
-			n_index_value[BIT(dword, 29)]);
-	printf("AUD_CONFIG_B  N_programming_enable\t\t\t%lu\n", BIT(dword, 28));
-	printf("AUD_CONFIG_B  Upper_N_value\t\t\t\t0x%02lx\n", BITS(dword, 27, 20));
-	printf("AUD_CONFIG_B  Lower_N_value\t\t\t\t0x%03lx\n", BITS(dword, 15, 4));
-	printf("AUD_CONFIG_B  Pixel_Clock_HDMI\t\t\t\t[0x%lx] %s\n", BITS(dword, 19, 16),
-			OPNAME(pixel_clock, BITS(dword, 19, 16)));
-	printf("AUD_CONFIG_B  Disable_NCTS\t\t\t\t%lu\n", BIT(dword, 3));
+	printf("AUD_CONFIG_B  N_index_value\t\t\t\t[0x%lx] %s\n", REG_BIT(dword, 29),
+			n_index_value[REG_BIT(dword, 29)]);
+	printf("AUD_CONFIG_B  N_programming_enable\t\t\t%lu\n", REG_BIT(dword, 28));
+	printf("AUD_CONFIG_B  Upper_N_value\t\t\t\t0x%02lx\n", REG_BITS(dword, 27, 20));
+	printf("AUD_CONFIG_B  Lower_N_value\t\t\t\t0x%03lx\n", REG_BITS(dword, 15, 4));
+	printf("AUD_CONFIG_B  Pixel_Clock_HDMI\t\t\t\t[0x%lx] %s\n", REG_BITS(dword, 19, 16),
+			OPNAME(pixel_clock, REG_BITS(dword, 19, 16)));
+	printf("AUD_CONFIG_B  Disable_NCTS\t\t\t\t%lu\n", REG_BIT(dword, 3));
 	dword = INREG(AUD_CONFIG_C);
-	printf("AUD_CONFIG_C  N_index_value\t\t\t\t[0x%lx] %s\n", BIT(dword, 29),
-			n_index_value[BIT(dword, 29)]);
-	printf("AUD_CONFIG_C  N_programming_enable\t\t\t%lu\n", BIT(dword, 28));
-	printf("AUD_CONFIG_C  Upper_N_value\t\t\t\t0x%02lx\n", BITS(dword, 27, 20));
-	printf("AUD_CONFIG_C  Lower_N_value\t\t\t\t0x%03lx\n", BITS(dword, 15, 4));
-	printf("AUD_CONFIG_C  Pixel_Clock_HDMI\t\t\t\t[0x%lx] %s\n", BITS(dword, 19, 16),
-			OPNAME(pixel_clock, BITS(dword, 19, 16)));
-	printf("AUD_CONFIG_C  Disable_NCTS\t\t\t\t%lu\n", BIT(dword, 3));
+	printf("AUD_CONFIG_C  N_index_value\t\t\t\t[0x%lx] %s\n", REG_BIT(dword, 29),
+			n_index_value[REG_BIT(dword, 29)]);
+	printf("AUD_CONFIG_C  N_programming_enable\t\t\t%lu\n", REG_BIT(dword, 28));
+	printf("AUD_CONFIG_C  Upper_N_value\t\t\t\t0x%02lx\n", REG_BITS(dword, 27, 20));
+	printf("AUD_CONFIG_C  Lower_N_value\t\t\t\t0x%03lx\n", REG_BITS(dword, 15, 4));
+	printf("AUD_CONFIG_C  Pixel_Clock_HDMI\t\t\t\t[0x%lx] %s\n", REG_BITS(dword, 19, 16),
+			OPNAME(pixel_clock, REG_BITS(dword, 19, 16)));
+	printf("AUD_CONFIG_C  Disable_NCTS\t\t\t\t%lu\n", REG_BIT(dword, 3));
 
 	dword = INREG(AUD_CTS_ENABLE_A);
-	printf("AUD_CTS_ENABLE_A  Enable_CTS_or_M_programming\t\t%lu\n", BIT(dword, 20));
-	printf("AUD_CTS_ENABLE_A  CTS_M value Index\t\t\t%s\n", BIT(dword, 21) ? "CTS" : "M");
-	printf("AUD_CTS_ENABLE_A  CTS_programming\t\t\t%#lx\n", BITS(dword, 19, 0));
+	printf("AUD_CTS_ENABLE_A  Enable_CTS_or_M_programming\t\t%lu\n", REG_BIT(dword, 20));
+	printf("AUD_CTS_ENABLE_A  CTS_M value Index\t\t\t%s\n", REG_BIT(dword, 21) ? "CTS" : "M");
+	printf("AUD_CTS_ENABLE_A  CTS_programming\t\t\t%#lx\n", REG_BITS(dword, 19, 0));
 	dword = INREG(AUD_CTS_ENABLE_B);
-	printf("AUD_CTS_ENABLE_B  Enable_CTS_or_M_programming\t\t%lu\n", BIT(dword, 20));
-	printf("AUD_CTS_ENABLE_B  CTS_M value Index\t\t\t%s\n", BIT(dword, 21) ? "CTS" : "M");
-	printf("AUD_CTS_ENABLE_B  CTS_programming\t\t\t%#lx\n", BITS(dword, 19, 0));
+	printf("AUD_CTS_ENABLE_B  Enable_CTS_or_M_programming\t\t%lu\n", REG_BIT(dword, 20));
+	printf("AUD_CTS_ENABLE_B  CTS_M value Index\t\t\t%s\n", REG_BIT(dword, 21) ? "CTS" : "M");
+	printf("AUD_CTS_ENABLE_B  CTS_programming\t\t\t%#lx\n", REG_BITS(dword, 19, 0));
 	dword = INREG(AUD_CTS_ENABLE_C);
-	printf("AUD_CTS_ENABLE_C  Enable_CTS_or_M_programming\t\t%lu\n", BIT(dword, 20));
-	printf("AUD_CTS_ENABLE_C  CTS_M value Index\t\t\t%s\n", BIT(dword, 21) ? "CTS" : "M");
-	printf("AUD_CTS_ENABLE_C  CTS_programming\t\t\t%#lx\n", BITS(dword, 19, 0));
+	printf("AUD_CTS_ENABLE_C  Enable_CTS_or_M_programming\t\t%lu\n", REG_BIT(dword, 20));
+	printf("AUD_CTS_ENABLE_C  CTS_M value Index\t\t\t%s\n", REG_BIT(dword, 21) ? "CTS" : "M");
+	printf("AUD_CTS_ENABLE_C  CTS_programming\t\t\t%#lx\n", REG_BITS(dword, 19, 0));
 
 	dword = INREG(AUD_MISC_CTRL_A);
-	printf("AUD_MISC_CTRL_A  Sample_Fabrication_EN_bit\t\t%lu\n",	BIT(dword, 2));
-	printf("AUD_MISC_CTRL_A  Sample_present_Disable\t\t\t%lu\n",	BIT(dword, 8));
-	printf("AUD_MISC_CTRL_A  Output_Delay\t\t\t\t%lu\n",		BITS(dword, 7, 4));
-	printf("AUD_MISC_CTRL_A  Pro_Allowed\t\t\t\t%lu\n",			BIT(dword, 1));
+	printf("AUD_MISC_CTRL_A  Sample_Fabrication_EN_bit\t\t%lu\n",	REG_BIT(dword, 2));
+	printf("AUD_MISC_CTRL_A  Sample_present_Disable\t\t\t%lu\n",	REG_BIT(dword, 8));
+	printf("AUD_MISC_CTRL_A  Output_Delay\t\t\t\t%lu\n",		REG_BITS(dword, 7, 4));
+	printf("AUD_MISC_CTRL_A  Pro_Allowed\t\t\t\t%lu\n",			REG_BIT(dword, 1));
 	dword = INREG(AUD_MISC_CTRL_B);
-	printf("AUD_MISC_CTRL_B  Sample_Fabrication_EN_bit\t\t%lu\n",	BIT(dword, 2));
-	printf("AUD_MISC_CTRL_B  Sample_present_Disable\t\t\t%lu\n",	BIT(dword, 8));
-	printf("AUD_MISC_CTRL_B  Output_Delay\t\t\t\t%lu\n",		BITS(dword, 7, 4));
-	printf("AUD_MISC_CTRL_B  Pro_Allowed\t\t\t\t%lu\n",			BIT(dword, 1));
+	printf("AUD_MISC_CTRL_B  Sample_Fabrication_EN_bit\t\t%lu\n",	REG_BIT(dword, 2));
+	printf("AUD_MISC_CTRL_B  Sample_present_Disable\t\t\t%lu\n",	REG_BIT(dword, 8));
+	printf("AUD_MISC_CTRL_B  Output_Delay\t\t\t\t%lu\n",		REG_BITS(dword, 7, 4));
+	printf("AUD_MISC_CTRL_B  Pro_Allowed\t\t\t\t%lu\n",			REG_BIT(dword, 1));
 	dword = INREG(AUD_MISC_CTRL_C);
-	printf("AUD_MISC_CTRL_C  Sample_Fabrication_EN_bit\t\t%lu\n",	BIT(dword, 2));
-	printf("AUD_MISC_CTRL_C  Sample_present_Disable\t\t\t%lu\n",	BIT(dword, 8));
-	printf("AUD_MISC_CTRL_C  Output_Delay\t\t\t\t%lu\n",		BITS(dword, 7, 4));
-	printf("AUD_MISC_CTRL_C  Pro_Allowed\t\t\t\t%lu\n",			BIT(dword, 1));
+	printf("AUD_MISC_CTRL_C  Sample_Fabrication_EN_bit\t\t%lu\n",	REG_BIT(dword, 2));
+	printf("AUD_MISC_CTRL_C  Sample_present_Disable\t\t\t%lu\n",	REG_BIT(dword, 8));
+	printf("AUD_MISC_CTRL_C  Output_Delay\t\t\t\t%lu\n",		REG_BITS(dword, 7, 4));
+	printf("AUD_MISC_CTRL_C  Pro_Allowed\t\t\t\t%lu\n",			REG_BIT(dword, 1));
 
 	dword = INREG(AUD_PWRST);
-	printf("AUD_PWRST  Func_Grp_Dev_PwrSt_Curr                  \t%s\n", power_state[BITS(dword, 27, 26)]);
-	printf("AUD_PWRST  Func_Grp_Dev_PwrSt_Set                   \t%s\n", power_state[BITS(dword, 25, 24)]);
-	printf("AUD_PWRST  ConvertorA_Widget_Power_State_Current    \t%s\n", power_state[BITS(dword, 15, 14)]);
-	printf("AUD_PWRST  ConvertorA_Widget_Power_State_Requsted   \t%s\n", power_state[BITS(dword, 13, 12)]);
-	printf("AUD_PWRST  ConvertorB_Widget_Power_State_Current    \t%s\n", power_state[BITS(dword, 19, 18)]);
-	printf("AUD_PWRST  ConvertorB_Widget_Power_State_Requested  \t%s\n", power_state[BITS(dword, 17, 16)]);
-	printf("AUD_PWRST  ConvC_Widget_PwrSt_Curr                  \t%s\n", power_state[BITS(dword, 23, 22)]);
-	printf("AUD_PWRST  ConvC_Widget_PwrSt_Req                   \t%s\n", power_state[BITS(dword, 21, 20)]);
-	printf("AUD_PWRST  PinB_Widget_Power_State_Current          \t%s\n", power_state[BITS(dword,  3,  2)]);
-	printf("AUD_PWRST  PinB_Widget_Power_State_Set              \t%s\n", power_state[BITS(dword,  1,  0)]);
-	printf("AUD_PWRST  PinC_Widget_Power_State_Current          \t%s\n", power_state[BITS(dword,  7,  6)]);
-	printf("AUD_PWRST  PinC_Widget_Power_State_Set              \t%s\n", power_state[BITS(dword,  5,  4)]);
-	printf("AUD_PWRST  PinD_Widget_Power_State_Current          \t%s\n", power_state[BITS(dword, 11, 10)]);
-	printf("AUD_PWRST  PinD_Widget_Power_State_Set              \t%s\n", power_state[BITS(dword,  9,  8)]);
+	printf("AUD_PWRST  Func_Grp_Dev_PwrSt_Curr                  \t%s\n", power_state[REG_BITS(dword, 27, 26)]);
+	printf("AUD_PWRST  Func_Grp_Dev_PwrSt_Set                   \t%s\n", power_state[REG_BITS(dword, 25, 24)]);
+	printf("AUD_PWRST  ConvertorA_Widget_Power_State_Current    \t%s\n", power_state[REG_BITS(dword, 15, 14)]);
+	printf("AUD_PWRST  ConvertorA_Widget_Power_State_Requsted   \t%s\n", power_state[REG_BITS(dword, 13, 12)]);
+	printf("AUD_PWRST  ConvertorB_Widget_Power_State_Current    \t%s\n", power_state[REG_BITS(dword, 19, 18)]);
+	printf("AUD_PWRST  ConvertorB_Widget_Power_State_Requested  \t%s\n", power_state[REG_BITS(dword, 17, 16)]);
+	printf("AUD_PWRST  ConvC_Widget_PwrSt_Curr                  \t%s\n", power_state[REG_BITS(dword, 23, 22)]);
+	printf("AUD_PWRST  ConvC_Widget_PwrSt_Req                   \t%s\n", power_state[REG_BITS(dword, 21, 20)]);
+	printf("AUD_PWRST  PinB_Widget_Power_State_Current          \t%s\n", power_state[REG_BITS(dword,  3,  2)]);
+	printf("AUD_PWRST  PinB_Widget_Power_State_Set              \t%s\n", power_state[REG_BITS(dword,  1,  0)]);
+	printf("AUD_PWRST  PinC_Widget_Power_State_Current          \t%s\n", power_state[REG_BITS(dword,  7,  6)]);
+	printf("AUD_PWRST  PinC_Widget_Power_State_Set              \t%s\n", power_state[REG_BITS(dword,  5,  4)]);
+	printf("AUD_PWRST  PinD_Widget_Power_State_Current          \t%s\n", power_state[REG_BITS(dword, 11, 10)]);
+	printf("AUD_PWRST  PinD_Widget_Power_State_Set              \t%s\n", power_state[REG_BITS(dword,  9,  8)]);
 
 	dword = INREG(AUD_PORT_EN_HD_CFG);
-	printf("AUD_PORT_EN_HD_CFG  Convertor_A_Digen\t\t\t%lu\n",	BIT(dword, 0));
-	printf("AUD_PORT_EN_HD_CFG  Convertor_B_Digen\t\t\t%lu\n",	BIT(dword, 1));
-	printf("AUD_PORT_EN_HD_CFG  Convertor_C_Digen\t\t\t%lu\n",	BIT(dword, 2));
-	printf("AUD_PORT_EN_HD_CFG  ConvertorA_Stream_ID\t\t%lu\n",	BITS(dword,  7, 4));
-	printf("AUD_PORT_EN_HD_CFG  ConvertorB_Stream_ID\t\t%lu\n",	BITS(dword, 11, 8));
-	printf("AUD_PORT_EN_HD_CFG  ConvertorC_Stream_ID\t\t%lu\n",	BITS(dword, 15, 12));
-	printf("AUD_PORT_EN_HD_CFG  Port_B_Out_Enable\t\t\t%lu\n",	BIT(dword, 16));
-	printf("AUD_PORT_EN_HD_CFG  Port_C_Out_Enable\t\t\t%lu\n",	BIT(dword, 17));
-	printf("AUD_PORT_EN_HD_CFG  Port_D_Out_Enable\t\t\t%lu\n",	BIT(dword, 18));
-	printf("AUD_PORT_EN_HD_CFG  Port_B_Amp_Mute_Status\t\t%lu\n", BIT(dword, 20));
-	printf("AUD_PORT_EN_HD_CFG  Port_C_Amp_Mute_Status\t\t%lu\n", BIT(dword, 21));
-	printf("AUD_PORT_EN_HD_CFG  Port_D_Amp_Mute_Status\t\t%lu\n", BIT(dword, 22));
+	printf("AUD_PORT_EN_HD_CFG  Convertor_A_Digen\t\t\t%lu\n",	REG_BIT(dword, 0));
+	printf("AUD_PORT_EN_HD_CFG  Convertor_B_Digen\t\t\t%lu\n",	REG_BIT(dword, 1));
+	printf("AUD_PORT_EN_HD_CFG  Convertor_C_Digen\t\t\t%lu\n",	REG_BIT(dword, 2));
+	printf("AUD_PORT_EN_HD_CFG  ConvertorA_Stream_ID\t\t%lu\n",	REG_BITS(dword,  7, 4));
+	printf("AUD_PORT_EN_HD_CFG  ConvertorB_Stream_ID\t\t%lu\n",	REG_BITS(dword, 11, 8));
+	printf("AUD_PORT_EN_HD_CFG  ConvertorC_Stream_ID\t\t%lu\n",	REG_BITS(dword, 15, 12));
+	printf("AUD_PORT_EN_HD_CFG  Port_B_Out_Enable\t\t\t%lu\n",	REG_BIT(dword, 16));
+	printf("AUD_PORT_EN_HD_CFG  Port_C_Out_Enable\t\t\t%lu\n",	REG_BIT(dword, 17));
+	printf("AUD_PORT_EN_HD_CFG  Port_D_Out_Enable\t\t\t%lu\n",	REG_BIT(dword, 18));
+	printf("AUD_PORT_EN_HD_CFG  Port_B_Amp_Mute_Status\t\t%lu\n", REG_BIT(dword, 20));
+	printf("AUD_PORT_EN_HD_CFG  Port_C_Amp_Mute_Status\t\t%lu\n", REG_BIT(dword, 21));
+	printf("AUD_PORT_EN_HD_CFG  Port_D_Amp_Mute_Status\t\t%lu\n", REG_BIT(dword, 22));
 
 	dword = INREG(AUD_OUT_DIG_CNVT_A);
-	printf("AUD_OUT_DIG_CNVT_A  V\t\t\t\t\t%lu\n",		BIT(dword, 1));
-	printf("AUD_OUT_DIG_CNVT_A  VCFG\t\t\t\t%lu\n",		BIT(dword, 2));
-	printf("AUD_OUT_DIG_CNVT_A  PRE\t\t\t\t\t%lu\n",		BIT(dword, 3));
-	printf("AUD_OUT_DIG_CNVT_A  Copy\t\t\t\t%lu\n",		BIT(dword, 4));
-	printf("AUD_OUT_DIG_CNVT_A  NonAudio\t\t\t\t%lu\n",		BIT(dword, 5));
-	printf("AUD_OUT_DIG_CNVT_A  PRO\t\t\t\t\t%lu\n",		BIT(dword, 6));
-	printf("AUD_OUT_DIG_CNVT_A  Level\t\t\t\t%lu\n",		BIT(dword, 7));
-	printf("AUD_OUT_DIG_CNVT_A  Category_Code\t\t\t%lu\n",	BITS(dword, 14, 8));
-	printf("AUD_OUT_DIG_CNVT_A  Lowest_Channel_Number\t\t%lu\n", BITS(dword, 19, 16));
-	printf("AUD_OUT_DIG_CNVT_A  Stream_ID\t\t\t\t%lu\n",	BITS(dword, 23, 20));
+	printf("AUD_OUT_DIG_CNVT_A  V\t\t\t\t\t%lu\n",		REG_BIT(dword, 1));
+	printf("AUD_OUT_DIG_CNVT_A  VCFG\t\t\t\t%lu\n",		REG_BIT(dword, 2));
+	printf("AUD_OUT_DIG_CNVT_A  PRE\t\t\t\t\t%lu\n",		REG_BIT(dword, 3));
+	printf("AUD_OUT_DIG_CNVT_A  Copy\t\t\t\t%lu\n",		REG_BIT(dword, 4));
+	printf("AUD_OUT_DIG_CNVT_A  NonAudio\t\t\t\t%lu\n",		REG_BIT(dword, 5));
+	printf("AUD_OUT_DIG_CNVT_A  PRO\t\t\t\t\t%lu\n",		REG_BIT(dword, 6));
+	printf("AUD_OUT_DIG_CNVT_A  Level\t\t\t\t%lu\n",		REG_BIT(dword, 7));
+	printf("AUD_OUT_DIG_CNVT_A  Category_Code\t\t\t%lu\n",	REG_BITS(dword, 14, 8));
+	printf("AUD_OUT_DIG_CNVT_A  Lowest_Channel_Number\t\t%lu\n", REG_BITS(dword, 19, 16));
+	printf("AUD_OUT_DIG_CNVT_A  Stream_ID\t\t\t\t%lu\n",	REG_BITS(dword, 23, 20));
 
 	dword = INREG(AUD_OUT_DIG_CNVT_B);
-	printf("AUD_OUT_DIG_CNVT_B  V\t\t\t\t\t%lu\n",		BIT(dword, 1));
-	printf("AUD_OUT_DIG_CNVT_B  VCFG\t\t\t\t%lu\n",		BIT(dword, 2));
-	printf("AUD_OUT_DIG_CNVT_B  PRE\t\t\t\t\t%lu\n",		BIT(dword, 3));
-	printf("AUD_OUT_DIG_CNVT_B  Copy\t\t\t\t%lu\n",		BIT(dword, 4));
-	printf("AUD_OUT_DIG_CNVT_B  NonAudio\t\t\t\t%lu\n",		BIT(dword, 5));
-	printf("AUD_OUT_DIG_CNVT_B  PRO\t\t\t\t\t%lu\n",		BIT(dword, 6));
-	printf("AUD_OUT_DIG_CNVT_B  Level\t\t\t\t%lu\n",		BIT(dword, 7));
-	printf("AUD_OUT_DIG_CNVT_B  Category_Code\t\t\t%lu\n",	BITS(dword, 14, 8));
-	printf("AUD_OUT_DIG_CNVT_B  Lowest_Channel_Number\t\t%lu\n", BITS(dword, 19, 16));
-	printf("AUD_OUT_DIG_CNVT_B  Stream_ID\t\t\t\t%lu\n",	BITS(dword, 23, 20));
+	printf("AUD_OUT_DIG_CNVT_B  V\t\t\t\t\t%lu\n",		REG_BIT(dword, 1));
+	printf("AUD_OUT_DIG_CNVT_B  VCFG\t\t\t\t%lu\n",		REG_BIT(dword, 2));
+	printf("AUD_OUT_DIG_CNVT_B  PRE\t\t\t\t\t%lu\n",		REG_BIT(dword, 3));
+	printf("AUD_OUT_DIG_CNVT_B  Copy\t\t\t\t%lu\n",		REG_BIT(dword, 4));
+	printf("AUD_OUT_DIG_CNVT_B  NonAudio\t\t\t\t%lu\n",		REG_BIT(dword, 5));
+	printf("AUD_OUT_DIG_CNVT_B  PRO\t\t\t\t\t%lu\n",		REG_BIT(dword, 6));
+	printf("AUD_OUT_DIG_CNVT_B  Level\t\t\t\t%lu\n",		REG_BIT(dword, 7));
+	printf("AUD_OUT_DIG_CNVT_B  Category_Code\t\t\t%lu\n",	REG_BITS(dword, 14, 8));
+	printf("AUD_OUT_DIG_CNVT_B  Lowest_Channel_Number\t\t%lu\n", REG_BITS(dword, 19, 16));
+	printf("AUD_OUT_DIG_CNVT_B  Stream_ID\t\t\t\t%lu\n",	REG_BITS(dword, 23, 20));
 
 	dword = INREG(AUD_OUT_DIG_CNVT_C);
-	printf("AUD_OUT_DIG_CNVT_C  V\t\t\t\t\t%lu\n",		BIT(dword, 1));
-	printf("AUD_OUT_DIG_CNVT_C  VCFG\t\t\t\t%lu\n",		BIT(dword, 2));
-	printf("AUD_OUT_DIG_CNVT_C  PRE\t\t\t\t\t%lu\n",		BIT(dword, 3));
-	printf("AUD_OUT_DIG_CNVT_C  Copy\t\t\t\t%lu\n",		BIT(dword, 4));
-	printf("AUD_OUT_DIG_CNVT_C  NonAudio\t\t\t\t%lu\n",		BIT(dword, 5));
-	printf("AUD_OUT_DIG_CNVT_C  PRO\t\t\t\t\t%lu\n",		BIT(dword, 6));
-	printf("AUD_OUT_DIG_CNVT_C  Level\t\t\t\t%lu\n",		BIT(dword, 7));
-	printf("AUD_OUT_DIG_CNVT_C  Category_Code\t\t\t%lu\n",	BITS(dword, 14, 8));
-	printf("AUD_OUT_DIG_CNVT_C  Lowest_Channel_Number\t\t%lu\n", BITS(dword, 19, 16));
-	printf("AUD_OUT_DIG_CNVT_C  Stream_ID\t\t\t\t%lu\n",	BITS(dword, 23, 20));
+	printf("AUD_OUT_DIG_CNVT_C  V\t\t\t\t\t%lu\n",		REG_BIT(dword, 1));
+	printf("AUD_OUT_DIG_CNVT_C  VCFG\t\t\t\t%lu\n",		REG_BIT(dword, 2));
+	printf("AUD_OUT_DIG_CNVT_C  PRE\t\t\t\t\t%lu\n",		REG_BIT(dword, 3));
+	printf("AUD_OUT_DIG_CNVT_C  Copy\t\t\t\t%lu\n",		REG_BIT(dword, 4));
+	printf("AUD_OUT_DIG_CNVT_C  NonAudio\t\t\t\t%lu\n",		REG_BIT(dword, 5));
+	printf("AUD_OUT_DIG_CNVT_C  PRO\t\t\t\t\t%lu\n",		REG_BIT(dword, 6));
+	printf("AUD_OUT_DIG_CNVT_C  Level\t\t\t\t%lu\n",		REG_BIT(dword, 7));
+	printf("AUD_OUT_DIG_CNVT_C  Category_Code\t\t\t%lu\n",	REG_BITS(dword, 14, 8));
+	printf("AUD_OUT_DIG_CNVT_C  Lowest_Channel_Number\t\t%lu\n", REG_BITS(dword, 19, 16));
+	printf("AUD_OUT_DIG_CNVT_C  Stream_ID\t\t\t\t%lu\n",	REG_BITS(dword, 23, 20));
 
 	printf("AUD_OUT_CH_STR  Converter_Channel_MAP	PORTB	PORTC	PORTD\n");
 	for (i = 0; i < 8; i++) {
 		OUTREG(AUD_OUT_CH_STR, i | (i << 8) | (i << 16));
 		dword = INREG(AUD_OUT_CH_STR);
 		printf("\t\t\t\t%lu\t%lu\t%lu\t%lu\n",
-				1 + BITS(dword,  3,  0),
-				1 + BITS(dword,  7,  4),
-				1 + BITS(dword, 15, 12),
-				1 + BITS(dword, 23, 20));
+				1 + REG_BITS(dword,  3,  0),
+				1 + REG_BITS(dword,  7,  4),
+				1 + REG_BITS(dword, 15, 12),
+				1 + REG_BITS(dword, 23, 20));
 	}
 
 	dword = INREG(AUD_OUT_STR_DESC_A);
-	printf("AUD_OUT_STR_DESC_A  HBR_enable\t\t\t\t%lu\n",	 BITS(dword, 28, 27));
-	printf("AUD_OUT_STR_DESC_A  Convertor_Channel_Count\t\t%lu\n", BITS(dword, 20, 16) + 1);
+	printf("AUD_OUT_STR_DESC_A  HBR_enable\t\t\t\t%lu\n",	 REG_BITS(dword, 28, 27));
+	printf("AUD_OUT_STR_DESC_A  Convertor_Channel_Count\t\t%lu\n", REG_BITS(dword, 20, 16) + 1);
 	printf("AUD_OUT_STR_DESC_A  Bits_per_Sample\t\t\t[%#lx] %s\n",
-			BITS(dword, 6, 4), OPNAME(bits_per_sample, BITS(dword, 6, 4)));
-	printf("AUD_OUT_STR_DESC_A  Number_of_Channels_in_a_Stream\t%lu\n", 1 + BITS(dword, 3, 0));
+			REG_BITS(dword, 6, 4), OPNAME(bits_per_sample, REG_BITS(dword, 6, 4)));
+	printf("AUD_OUT_STR_DESC_A  Number_of_Channels_in_a_Stream\t%lu\n", 1 + REG_BITS(dword, 3, 0));
 
 	dword = INREG(AUD_OUT_STR_DESC_B);
-	printf("AUD_OUT_STR_DESC_B  HBR_enable\t\t\t\t%lu\n",	 BITS(dword, 28, 27));
-	printf("AUD_OUT_STR_DESC_B  Convertor_Channel_Count\t\t%lu\n", BITS(dword, 20, 16) + 1);
+	printf("AUD_OUT_STR_DESC_B  HBR_enable\t\t\t\t%lu\n",	 REG_BITS(dword, 28, 27));
+	printf("AUD_OUT_STR_DESC_B  Convertor_Channel_Count\t\t%lu\n", REG_BITS(dword, 20, 16) + 1);
 	printf("AUD_OUT_STR_DESC_B  Bits_per_Sample\t\t\t[%#lx] %s\n",
-			BITS(dword, 6, 4), OPNAME(bits_per_sample, BITS(dword, 6, 4)));
-	printf("AUD_OUT_STR_DESC_B  Number_of_Channels_in_a_Stream\t%lu\n", 1 + BITS(dword, 3, 0));
+			REG_BITS(dword, 6, 4), OPNAME(bits_per_sample, REG_BITS(dword, 6, 4)));
+	printf("AUD_OUT_STR_DESC_B  Number_of_Channels_in_a_Stream\t%lu\n", 1 + REG_BITS(dword, 3, 0));
 
 	dword = INREG(AUD_OUT_STR_DESC_C);
-	printf("AUD_OUT_STR_DESC_C  HBR_enable\t\t\t\t%lu\n",	 BITS(dword, 28, 27));
-	printf("AUD_OUT_STR_DESC_C  Convertor_Channel_Count\t\t%lu\n", BITS(dword, 20, 16) + 1);
+	printf("AUD_OUT_STR_DESC_C  HBR_enable\t\t\t\t%lu\n",	 REG_BITS(dword, 28, 27));
+	printf("AUD_OUT_STR_DESC_C  Convertor_Channel_Count\t\t%lu\n", REG_BITS(dword, 20, 16) + 1);
 	printf("AUD_OUT_STR_DESC_C  Bits_per_Sample\t\t\t[%#lx] %s\n",
-			BITS(dword, 6, 4), OPNAME(bits_per_sample, BITS(dword, 6, 4)));
-	printf("AUD_OUT_STR_DESC_C  Number_of_Channels_in_a_Stream\t%lu\n", 1 + BITS(dword, 3, 0));
+			REG_BITS(dword, 6, 4), OPNAME(bits_per_sample, REG_BITS(dword, 6, 4)));
+	printf("AUD_OUT_STR_DESC_C  Number_of_Channels_in_a_Stream\t%lu\n", 1 + REG_BITS(dword, 3, 0));
 
 	dword = INREG(AUD_PINW_CONNLNG_SEL);
-	printf("AUD_PINW_CONNLNG_SEL  Connection_select_Control_B\t%#lx\n", BITS(dword,  7,  0));
-	printf("AUD_PINW_CONNLNG_SEL  Connection_select_Control_C\t%#lx\n", BITS(dword, 15,  8));
-	printf("AUD_PINW_CONNLNG_SEL  Connection_select_Control_D\t%#lx\n", BITS(dword, 23, 16));
+	printf("AUD_PINW_CONNLNG_SEL  Connection_select_Control_B\t%#lx\n", REG_BITS(dword,  7,  0));
+	printf("AUD_PINW_CONNLNG_SEL  Connection_select_Control_C\t%#lx\n", REG_BITS(dword, 15,  8));
+	printf("AUD_PINW_CONNLNG_SEL  Connection_select_Control_D\t%#lx\n", REG_BITS(dword, 23, 16));
 
 	dword = INREG(AUD_CNTL_ST_A);
 	printf("AUD_CNTL_ST_A  DIP_Port_Select\t\t\t\t[%#lx] %s\n",
-			BITS(dword, 30, 29), dip_port[BITS(dword, 30, 29)]);
-	printf("AUD_CNTL_ST_A  DIP_type_enable_status Audio DIP\t\t%lu\n", BIT(dword, 21));
-	printf("AUD_CNTL_ST_A  DIP_type_enable_status ACP DIP\t\t%lu\n", BIT(dword, 22));
-	printf("AUD_CNTL_ST_A  DIP_type_enable_status Generic 2 DIP\t%lu\n", BIT(dword, 23));
+			REG_BITS(dword, 30, 29), dip_port[REG_BITS(dword, 30, 29)]);
+	printf("AUD_CNTL_ST_A  DIP_type_enable_status Audio DIP\t\t%lu\n", REG_BIT(dword, 21));
+	printf("AUD_CNTL_ST_A  DIP_type_enable_status ACP DIP\t\t%lu\n", REG_BIT(dword, 22));
+	printf("AUD_CNTL_ST_A  DIP_type_enable_status Generic 2 DIP\t%lu\n", REG_BIT(dword, 23));
 	printf("AUD_CNTL_ST_A  DIP_transmission_frequency\t\t[0x%lx] %s\n",
-			BITS(dword, 17, 16), dip_trans[BITS(dword, 17, 16)]);
-	printf("AUD_CNTL_ST_A  ELD_ACK\t\t\t\t\t%lu\n", BIT(dword, 4));
-	printf("AUD_CNTL_ST_A  ELD_buffer_size\t\t\t\t%lu\n", BITS(dword, 14, 10));
+			REG_BITS(dword, 17, 16), dip_trans[REG_BITS(dword, 17, 16)]);
+	printf("AUD_CNTL_ST_A  ELD_ACK\t\t\t\t\t%lu\n", REG_BIT(dword, 4));
+	printf("AUD_CNTL_ST_A  ELD_buffer_size\t\t\t\t%lu\n", REG_BITS(dword, 14, 10));
 
 	dword = INREG(AUD_CNTL_ST_B);
 	printf("AUD_CNTL_ST_B  DIP_Port_Select\t\t\t\t[%#lx] %s\n",
-			BITS(dword, 30, 29), dip_port[BITS(dword, 30, 29)]);
-	printf("AUD_CNTL_ST_B  DIP_type_enable_status Audio DIP\t\t%lu\n", BIT(dword, 21));
-	printf("AUD_CNTL_ST_B  DIP_type_enable_status ACP DIP\t\t%lu\n", BIT(dword, 22));
-	printf("AUD_CNTL_ST_B  DIP_type_enable_status Generic 2 DIP\t%lu\n", BIT(dword, 23));
+			REG_BITS(dword, 30, 29), dip_port[REG_BITS(dword, 30, 29)]);
+	printf("AUD_CNTL_ST_B  DIP_type_enable_status Audio DIP\t\t%lu\n", REG_BIT(dword, 21));
+	printf("AUD_CNTL_ST_B  DIP_type_enable_status ACP DIP\t\t%lu\n", REG_BIT(dword, 22));
+	printf("AUD_CNTL_ST_B  DIP_type_enable_status Generic 2 DIP\t%lu\n", REG_BIT(dword, 23));
 	printf("AUD_CNTL_ST_B  DIP_transmission_frequency\t\t[0x%lx] %s\n",
-			BITS(dword, 17, 16), dip_trans[BITS(dword, 17, 16)]);
-	printf("AUD_CNTL_ST_B  ELD_ACK\t\t\t\t\t%lu\n", BIT(dword, 4));
-	printf("AUD_CNTL_ST_B  ELD_buffer_size\t\t\t\t%lu\n", BITS(dword, 14, 10));
+			REG_BITS(dword, 17, 16), dip_trans[REG_BITS(dword, 17, 16)]);
+	printf("AUD_CNTL_ST_B  ELD_ACK\t\t\t\t\t%lu\n", REG_BIT(dword, 4));
+	printf("AUD_CNTL_ST_B  ELD_buffer_size\t\t\t\t%lu\n", REG_BITS(dword, 14, 10));
 
 	dword = INREG(AUD_CNTL_ST_C);
 	printf("AUD_CNTL_ST_C  DIP_Port_Select\t\t\t\t[%#lx] %s\n",
-			BITS(dword, 30, 29), dip_port[BITS(dword, 30, 29)]);
-	printf("AUD_CNTL_ST_C  DIP_type_enable_status Audio DIP\t\t%lu\n", BIT(dword, 21));
-	printf("AUD_CNTL_ST_C  DIP_type_enable_status ACP DIP\t\t%lu\n", BIT(dword, 22));
-	printf("AUD_CNTL_ST_C  DIP_type_enable_status Generic 2 DIP\t%lu\n", BIT(dword, 23));
+			REG_BITS(dword, 30, 29), dip_port[REG_BITS(dword, 30, 29)]);
+	printf("AUD_CNTL_ST_C  DIP_type_enable_status Audio DIP\t\t%lu\n", REG_BIT(dword, 21));
+	printf("AUD_CNTL_ST_C  DIP_type_enable_status ACP DIP\t\t%lu\n", REG_BIT(dword, 22));
+	printf("AUD_CNTL_ST_C  DIP_type_enable_status Generic 2 DIP\t%lu\n", REG_BIT(dword, 23));
 	printf("AUD_CNTL_ST_C  DIP_transmission_frequency\t\t[0x%lx] %s\n",
-			BITS(dword, 17, 16), dip_trans[BITS(dword, 17, 16)]);
-	printf("AUD_CNTL_ST_C  ELD_ACK\t\t\t\t\t%lu\n", BIT(dword, 4));
-	printf("AUD_CNTL_ST_C  ELD_buffer_size\t\t\t\t%lu\n", BITS(dword, 14, 10));
+			REG_BITS(dword, 17, 16), dip_trans[REG_BITS(dword, 17, 16)]);
+	printf("AUD_CNTL_ST_C  ELD_ACK\t\t\t\t\t%lu\n", REG_BIT(dword, 4));
+	printf("AUD_CNTL_ST_C  ELD_buffer_size\t\t\t\t%lu\n", REG_BITS(dword, 14, 10));
 
 	dword = INREG(AUD_CNTRL_ST2);
-	printf("AUD_CNTRL_ST2  CP_ReadyB\t\t\t\t%lu\n",	BIT(dword, 1));
-	printf("AUD_CNTRL_ST2  ELD_validB\t\t\t\t%lu\n",	BIT(dword, 0));
-	printf("AUD_CNTRL_ST2  CP_ReadyC\t\t\t\t%lu\n",	BIT(dword, 5));
-	printf("AUD_CNTRL_ST2  ELD_validC\t\t\t\t%lu\n",	BIT(dword, 4));
-	printf("AUD_CNTRL_ST2  CP_ReadyD\t\t\t\t%lu\n",	BIT(dword, 9));
-	printf("AUD_CNTRL_ST2  ELD_validD\t\t\t\t%lu\n",	BIT(dword, 8));
+	printf("AUD_CNTRL_ST2  CP_ReadyB\t\t\t\t%lu\n",	REG_BIT(dword, 1));
+	printf("AUD_CNTRL_ST2  ELD_validB\t\t\t\t%lu\n",	REG_BIT(dword, 0));
+	printf("AUD_CNTRL_ST2  CP_ReadyC\t\t\t\t%lu\n",	REG_BIT(dword, 5));
+	printf("AUD_CNTRL_ST2  ELD_validC\t\t\t\t%lu\n",	REG_BIT(dword, 4));
+	printf("AUD_CNTRL_ST2  CP_ReadyD\t\t\t\t%lu\n",	REG_BIT(dword, 9));
+	printf("AUD_CNTRL_ST2  ELD_validD\t\t\t\t%lu\n",	REG_BIT(dword, 8));
 
 	dword = INREG(AUD_CNTRL_ST3);
-	printf("AUD_CNTRL_ST3  TransA_DPT_Audio_Output_En\t\t%lu\n",	BIT(dword, 3));
+	printf("AUD_CNTRL_ST3  TransA_DPT_Audio_Output_En\t\t%lu\n",	REG_BIT(dword, 3));
 	printf("AUD_CNTRL_ST3  TransA_to_Port_Sel\t\t\t[%#lx] %s\n",
-			BITS(dword, 2, 0), trans_to_port_sel[BITS(dword, 2, 0)]);
-	printf("AUD_CNTRL_ST3  TransB_DPT_Audio_Output_En\t\t%lu\n",	BIT(dword, 7));
+			REG_BITS(dword, 2, 0), trans_to_port_sel[REG_BITS(dword, 2, 0)]);
+	printf("AUD_CNTRL_ST3  TransB_DPT_Audio_Output_En\t\t%lu\n",	REG_BIT(dword, 7));
 	printf("AUD_CNTRL_ST3  TransB_to_Port_Sel\t\t\t[%#lx] %s\n",
-			BITS(dword, 6, 4), trans_to_port_sel[BITS(dword, 6, 4)]);
-	printf("AUD_CNTRL_ST3  TransC_DPT_Audio_Output_En\t\t%lu\n",	BIT(dword, 11));
+			REG_BITS(dword, 6, 4), trans_to_port_sel[REG_BITS(dword, 6, 4)]);
+	printf("AUD_CNTRL_ST3  TransC_DPT_Audio_Output_En\t\t%lu\n",	REG_BIT(dword, 11));
 	printf("AUD_CNTRL_ST3  TransC_to_Port_Sel\t\t\t[%#lx] %s\n",
-			BITS(dword, 10, 8), trans_to_port_sel[BITS(dword, 10, 8)]);
+			REG_BITS(dword, 10, 8), trans_to_port_sel[REG_BITS(dword, 10, 8)]);
 
 	dword = INREG(AUD_HDMIW_STATUS);
-	printf("AUD_HDMIW_STATUS  Conv_A_CDCLK/DOTCLK_FIFO_Underrun\t%lu\n", BIT(dword, 27));
-	printf("AUD_HDMIW_STATUS  Conv_A_CDCLK/DOTCLK_FIFO_Overrun\t%lu\n",  BIT(dword, 26));
-	printf("AUD_HDMIW_STATUS  Conv_B_CDCLK/DOTCLK_FIFO_Underrun\t%lu\n", BIT(dword, 29));
-	printf("AUD_HDMIW_STATUS  Conv_B_CDCLK/DOTCLK_FIFO_Overrun\t%lu\n",  BIT(dword, 28));
-	printf("AUD_HDMIW_STATUS  Conv_C_CDCLK/DOTCLK_FIFO_Underrun\t%lu\n", BIT(dword, 31));
-	printf("AUD_HDMIW_STATUS  Conv_C_CDCLK/DOTCLK_FIFO_Overrun\t%lu\n",  BIT(dword, 30));
-	printf("AUD_HDMIW_STATUS  BCLK/CDCLK_FIFO_Overrun\t\t%lu\n",	 BIT(dword, 25));
-	printf("AUD_HDMIW_STATUS  Function_Reset\t\t\t%lu\n",		 BIT(dword, 24));
+	printf("AUD_HDMIW_STATUS  Conv_A_CDCLK/DOTCLK_FIFO_Underrun\t%lu\n", REG_BIT(dword, 27));
+	printf("AUD_HDMIW_STATUS  Conv_A_CDCLK/DOTCLK_FIFO_Overrun\t%lu\n",  REG_BIT(dword, 26));
+	printf("AUD_HDMIW_STATUS  Conv_B_CDCLK/DOTCLK_FIFO_Underrun\t%lu\n", REG_BIT(dword, 29));
+	printf("AUD_HDMIW_STATUS  Conv_B_CDCLK/DOTCLK_FIFO_Overrun\t%lu\n",  REG_BIT(dword, 28));
+	printf("AUD_HDMIW_STATUS  Conv_C_CDCLK/DOTCLK_FIFO_Underrun\t%lu\n", REG_BIT(dword, 31));
+	printf("AUD_HDMIW_STATUS  Conv_C_CDCLK/DOTCLK_FIFO_Overrun\t%lu\n",  REG_BIT(dword, 30));
+	printf("AUD_HDMIW_STATUS  BCLK/CDCLK_FIFO_Overrun\t\t%lu\n",	 REG_BIT(dword, 25));
+	printf("AUD_HDMIW_STATUS  Function_Reset\t\t\t%lu\n",		 REG_BIT(dword, 24));
 
 	printf("AUD_HDMIW_HDMIEDID_A HDMI ELD:\n\t");
 	dword = INREG(AUD_CNTL_ST_A);
 	dword &= ~BITMASK(9, 5);
 	OUTREG(AUD_CNTL_ST_A, dword);
-	for (i = 0; i < BITS(dword, 14, 10) / 4; i++)
+	for (i = 0; i < REG_BITS(dword, 14, 10) / 4; i++)
 		printf("%08x ", htonl(INREG(AUD_HDMIW_HDMIEDID_A)));
 	printf("\n");
 
@@ -1212,7 +1212,7 @@ static void dump_cpt(void)
 	dword = INREG(AUD_CNTL_ST_B);
 	dword &= ~BITMASK(9, 5);
 	OUTREG(AUD_CNTL_ST_B, dword);
-	for (i = 0; i < BITS(dword, 14, 10) / 4; i++)
+	for (i = 0; i < REG_BITS(dword, 14, 10) / 4; i++)
 		printf("%08x ", htonl(INREG(AUD_HDMIW_HDMIEDID_B)));
 	printf("\n");
 
@@ -1220,7 +1220,7 @@ static void dump_cpt(void)
 	dword = INREG(AUD_CNTL_ST_C);
 	dword &= ~BITMASK(9, 5);
 	OUTREG(AUD_CNTL_ST_C, dword);
-	for (i = 0; i < BITS(dword, 14, 10) / 4; i++)
+	for (i = 0; i < REG_BITS(dword, 14, 10) / 4; i++)
 		printf("%08x ", htonl(INREG(AUD_HDMIW_HDMIEDID_C)));
 	printf("\n");
 
@@ -1381,14 +1381,14 @@ static void dump_aud_config(int index)
 		sprintf(prefix, "AUD_TC%c_CONFIG", 'A' + index - TRANSCODER_A);
 	}
 
-	printf("%s  Disable_NCTS\t\t\t\t%lu\n",          prefix, BIT(dword, 3));
-	printf("%s  Lower_N_value\t\t\t\t0x%03lx\n",     prefix, BITS(dword, 15, 4));
-	printf("%s  Pixel_Clock_HDMI\t\t\t[0x%lx] %s\n", prefix, BITS(dword, 19, 16),
-		OPNAME(pixel_clock, BITS(dword, 19, 16)));
-	printf("%s  Upper_N_value\t\t\t\t0x%02lx\n",     prefix, BITS(dword, 27, 20));
-	printf("%s  N_programming_enable\t\t\t%lu\n",    prefix, BIT(dword, 28));
-	printf("%s  N_index_value\t\t\t\t[0x%lx] %s\n",  prefix, BIT(dword, 29),
-		OPNAME(n_index_value, BIT(dword, 29)));
+	printf("%s  Disable_NCTS\t\t\t\t%lu\n",          prefix, REG_BIT(dword, 3));
+	printf("%s  Lower_N_value\t\t\t\t0x%03lx\n",     prefix, REG_BITS(dword, 15, 4));
+	printf("%s  Pixel_Clock_HDMI\t\t\t[0x%lx] %s\n", prefix, REG_BITS(dword, 19, 16),
+		OPNAME(pixel_clock, REG_BITS(dword, 19, 16)));
+	printf("%s  Upper_N_value\t\t\t\t0x%02lx\n",     prefix, REG_BITS(dword, 27, 20));
+	printf("%s  N_programming_enable\t\t\t%lu\n",    prefix, REG_BIT(dword, 28));
+	printf("%s  N_index_value\t\t\t\t[0x%lx] %s\n",  prefix, REG_BIT(dword, 29),
+		OPNAME(n_index_value, REG_BIT(dword, 29)));
 }
 
 static void dump_aud_misc_control(int index)
@@ -1404,10 +1404,10 @@ static void dump_aud_misc_control(int index)
 		sprintf(prefix, "AUD_C%c_MISC_CTRL", '1' + index - CONVERTER_1);
 	}
 
-	printf("%s   Pro_Allowed\t\t\t\t%lu\n",           prefix, BIT(dword, 1));
-	printf("%s   Sample_Fabrication_EN_bit\t\t%lu\n", prefix, BIT(dword, 2));
-	printf("%s   Output_Delay\t\t\t\t%lu\n",          prefix, BITS(dword, 7, 4));
-	printf("%s   Sample_present_Disable\t\t%lu\n",    prefix, BIT(dword, 8));
+	printf("%s   Pro_Allowed\t\t\t\t%lu\n",           prefix, REG_BIT(dword, 1));
+	printf("%s   Sample_Fabrication_EN_bit\t\t%lu\n", prefix, REG_BIT(dword, 2));
+	printf("%s   Output_Delay\t\t\t\t%lu\n",          prefix, REG_BITS(dword, 7, 4));
+	printf("%s   Sample_present_Disable\t\t%lu\n",    prefix, REG_BIT(dword, 8));
 }
 
 static void dump_aud_vendor_device_id(void)
@@ -1415,8 +1415,8 @@ static void dump_aud_vendor_device_id(void)
 	uint32_t dword;
 
 	dword = INREG(aud_reg_base + AUD_VID_DID);
-	printf("AUD_VID_DID device id\t\t\t\t\t0x%lx\n", BITS(dword, 15, 0));
-	printf("AUD_VID_DID vendor id\t\t\t\t\t0x%lx\n", BITS(dword, 31, 16));
+	printf("AUD_VID_DID device id\t\t\t\t\t0x%lx\n", REG_BITS(dword, 15, 0));
+	printf("AUD_VID_DID vendor id\t\t\t\t\t0x%lx\n", REG_BITS(dword, 31, 16));
 }
 
 static void dump_aud_revision_id(void)
@@ -1424,10 +1424,10 @@ static void dump_aud_revision_id(void)
 	uint32_t dword;
 
 	dword = INREG(aud_reg_base + AUD_RID);
-	printf("AUD_RID Stepping_Id\t\t\t\t\t0x%lx\n",    BITS(dword, 7, 0));
-	printf("AUD_RID Revision_Id\t\t\t\t\t0x%lx\n",    BITS(dword, 15, 8));
-	printf("AUD_RID Minor_Revision\t\t\t\t\t0x%lx\n", BITS(dword, 19, 16));
-	printf("AUD_RID Major_Revision\t\t\t\t\t0x%lx\n", BITS(dword, 23, 20));
+	printf("AUD_RID Stepping_Id\t\t\t\t\t0x%lx\n",    REG_BITS(dword, 7, 0));
+	printf("AUD_RID Revision_Id\t\t\t\t\t0x%lx\n",    REG_BITS(dword, 15, 8));
+	printf("AUD_RID Minor_Revision\t\t\t\t\t0x%lx\n", REG_BITS(dword, 19, 16));
+	printf("AUD_RID Major_Revision\t\t\t\t\t0x%lx\n", REG_BITS(dword, 23, 20));
 }
 
 static void dump_aud_m_cts_enable(int index)
@@ -1443,10 +1443,10 @@ static void dump_aud_m_cts_enable(int index)
 		sprintf(prefix, "AUD_TC%c_M_CTS_ENABLE", 'A' + index - TRANSCODER_A);
 	}
 
-	printf("%s  CTS_programming\t\t\t%#lx\n",        prefix, BITS(dword, 19, 0));
-	printf("%s  Enable_CTS_or_M_programming\t%lu\n", prefix, BIT(dword, 20));
-	printf("%s  CTS_M value Index\t\t\t[0x%lx] %s\n",prefix, BIT(dword, 21),
-		OPNAME(cts_m_value_index, BIT(dword, 21)));
+	printf("%s  CTS_programming\t\t\t%#lx\n",        prefix, REG_BITS(dword, 19, 0));
+	printf("%s  Enable_CTS_or_M_programming\t%lu\n", prefix, REG_BIT(dword, 20));
+	printf("%s  CTS_M value Index\t\t\t[0x%lx] %s\n",prefix, REG_BIT(dword, 21),
+		OPNAME(cts_m_value_index, REG_BIT(dword, 21)));
 }
 
 static void dump_aud_power_state(void)
@@ -1455,39 +1455,39 @@ static void dump_aud_power_state(void)
 	int num_pipes;
 
 	dword = INREG(aud_reg_base + AUD_PWRST);
-	printf("AUD_PWRST  PinB_Widget_Power_State_Set              \t%s\n",         power_state[BITS(dword,  1,  0)]);
-	printf("AUD_PWRST  PinB_Widget_Power_State_Current          \t%s\n",         power_state[BITS(dword,  3,  2)]);
-	printf("AUD_PWRST  PinC_Widget_Power_State_Set              \t%s\n",         power_state[BITS(dword,  5,  4)]);
-	printf("AUD_PWRST  PinC_Widget_Power_State_Current          \t%s\n",         power_state[BITS(dword,  7,  6)]);
-	printf("AUD_PWRST  PinD_Widget_Power_State_Set              \t%s\n",         power_state[BITS(dword,  9,  8)]);
-	printf("AUD_PWRST  PinD_Widget_Power_State_Current          \t%s\n",         power_state[BITS(dword, 11, 10)]);
+	printf("AUD_PWRST  PinB_Widget_Power_State_Set              \t%s\n",         power_state[REG_BITS(dword,  1,  0)]);
+	printf("AUD_PWRST  PinB_Widget_Power_State_Current          \t%s\n",         power_state[REG_BITS(dword,  3,  2)]);
+	printf("AUD_PWRST  PinC_Widget_Power_State_Set              \t%s\n",         power_state[REG_BITS(dword,  5,  4)]);
+	printf("AUD_PWRST  PinC_Widget_Power_State_Current          \t%s\n",         power_state[REG_BITS(dword,  7,  6)]);
+	printf("AUD_PWRST  PinD_Widget_Power_State_Set              \t%s\n",         power_state[REG_BITS(dword,  9,  8)]);
+	printf("AUD_PWRST  PinD_Widget_Power_State_Current          \t%s\n",         power_state[REG_BITS(dword, 11, 10)]);
 
 	if (!IS_HASWELL_PLUS(devid)) {
-		printf("AUD_PWRST  ConvertorA_Widget_Power_State_Requsted   \t%s\n", power_state[BITS(dword, 13, 12)]);
-		printf("AUD_PWRST  ConvertorA_Widget_Power_State_Current    \t%s\n", power_state[BITS(dword, 15, 14)]);
-		printf("AUD_PWRST  ConvertorB_Widget_Power_State_Requested  \t%s\n", power_state[BITS(dword, 17, 16)]);
-		printf("AUD_PWRST  ConvertorB_Widget_Power_State_Current    \t%s\n", power_state[BITS(dword, 19, 18)]);
+		printf("AUD_PWRST  ConvertorA_Widget_Power_State_Requsted   \t%s\n", power_state[REG_BITS(dword, 13, 12)]);
+		printf("AUD_PWRST  ConvertorA_Widget_Power_State_Current    \t%s\n", power_state[REG_BITS(dword, 15, 14)]);
+		printf("AUD_PWRST  ConvertorB_Widget_Power_State_Requested  \t%s\n", power_state[REG_BITS(dword, 17, 16)]);
+		printf("AUD_PWRST  ConvertorB_Widget_Power_State_Current    \t%s\n", power_state[REG_BITS(dword, 19, 18)]);
 	} else {
-		printf("AUD_PWRST  Convertor1_Widget_Power_State_Requsted   \t%s\n", power_state[BITS(dword, 13, 12)]);
-		printf("AUD_PWRST  Convertor1_Widget_Power_State_Current    \t%s\n", power_state[BITS(dword, 15, 14)]);
-		printf("AUD_PWRST  Convertor2_Widget_Power_State_Requested  \t%s\n", power_state[BITS(dword, 17, 16)]);
-		printf("AUD_PWRST  Convertor2_Widget_Power_State_Current    \t%s\n", power_state[BITS(dword, 19, 18)]);
+		printf("AUD_PWRST  Convertor1_Widget_Power_State_Requsted   \t%s\n", power_state[REG_BITS(dword, 13, 12)]);
+		printf("AUD_PWRST  Convertor1_Widget_Power_State_Current    \t%s\n", power_state[REG_BITS(dword, 15, 14)]);
+		printf("AUD_PWRST  Convertor2_Widget_Power_State_Requested  \t%s\n", power_state[REG_BITS(dword, 17, 16)]);
+		printf("AUD_PWRST  Convertor2_Widget_Power_State_Current    \t%s\n", power_state[REG_BITS(dword, 19, 18)]);
 	}
 
 	num_pipes = get_num_pipes();
 	if (num_pipes == 2) {
-		printf("AUD_PWRST  Func_Grp_Dev_PwrSt_Set                   \t%s\n", power_state[BITS(dword, 21, 20)]);
-		printf("AUD_PWRST  Func_Grp_Dev_PwrSt_Curr                  \t%s\n", power_state[BITS(dword, 23, 22)]);
+		printf("AUD_PWRST  Func_Grp_Dev_PwrSt_Set                   \t%s\n", power_state[REG_BITS(dword, 21, 20)]);
+		printf("AUD_PWRST  Func_Grp_Dev_PwrSt_Curr                  \t%s\n", power_state[REG_BITS(dword, 23, 22)]);
 	} else {	/* 3 pipes */
 		if (!IS_HASWELL_PLUS(devid)) {
-			printf("AUD_PWRST  ConvertorC_Widget_Power_State_Requested  \t%s\n", power_state[BITS(dword, 21, 20)]);
-			printf("AUD_PWRST  ConvertorC_Widget_Power_State_Current    \t%s\n", power_state[BITS(dword, 23, 22)]);
+			printf("AUD_PWRST  ConvertorC_Widget_Power_State_Requested  \t%s\n", power_state[REG_BITS(dword, 21, 20)]);
+			printf("AUD_PWRST  ConvertorC_Widget_Power_State_Current    \t%s\n", power_state[REG_BITS(dword, 23, 22)]);
 		} else {
-			printf("AUD_PWRST  Convertor3_Widget_Power_State_Requested  \t%s\n", power_state[BITS(dword, 21, 20)]);
-			printf("AUD_PWRST  Convertor3_Widget_Power_State_Current    \t%s\n", power_state[BITS(dword, 23, 22)]);
+			printf("AUD_PWRST  Convertor3_Widget_Power_State_Requested  \t%s\n", power_state[REG_BITS(dword, 21, 20)]);
+			printf("AUD_PWRST  Convertor3_Widget_Power_State_Current    \t%s\n", power_state[REG_BITS(dword, 23, 22)]);
 		}
-		printf("AUD_PWRST  Func_Grp_Dev_PwrSt_Set                   \t%s\n", power_state[BITS(dword, 25, 24)]);
-		printf("AUD_PWRST  Func_Grp_Dev_PwrSt_Curr                  \t%s\n", power_state[BITS(dword, 27, 26)]);
+		printf("AUD_PWRST  Func_Grp_Dev_PwrSt_Set                   \t%s\n", power_state[REG_BITS(dword, 25, 24)]);
+		printf("AUD_PWRST  Func_Grp_Dev_PwrSt_Curr                  \t%s\n", power_state[REG_BITS(dword, 27, 26)]);
 	}
 }
 
@@ -1513,7 +1513,7 @@ static void dump_aud_edid_data(int index)
 	dword = INREG(aud_ctrl_st);
 	dword &= ~BITMASK(9, 5);
 	OUTREG(aud_ctrl_st, dword);
-	for (i = 0; i < BITS(dword, 14, 10) / 4; i++)
+	for (i = 0; i < REG_BITS(dword, 14, 10) / 4; i++)
 		printf("%08x ", htonl(INREG(edid_data)));
 	printf("\n");
 }
@@ -1553,31 +1553,31 @@ static void dump_aud_port_en_hd_cfg(void)
 
 	dword = INREG(aud_reg_base + AUD_PORT_EN_HD_CFG);
 	if (num_pipes == 2) {
-		printf("AUD_PORT_EN_HD_CFG  Convertor_A_Digen\t\t\t%lu\n",    BIT(dword, 0));
-		printf("AUD_PORT_EN_HD_CFG  Convertor_B_Digen\t\t\t%lu\n",    BIT(dword, 1));
-		printf("AUD_PORT_EN_HD_CFG  Convertor_A_Stream_ID\t\t%lu\n",  BITS(dword,  7, 4));
-		printf("AUD_PORT_EN_HD_CFG  Convertor_B_Stream_ID\t\t%lu\n",  BITS(dword, 11, 8));
+		printf("AUD_PORT_EN_HD_CFG  Convertor_A_Digen\t\t\t%lu\n",    REG_BIT(dword, 0));
+		printf("AUD_PORT_EN_HD_CFG  Convertor_B_Digen\t\t\t%lu\n",    REG_BIT(dword, 1));
+		printf("AUD_PORT_EN_HD_CFG  Convertor_A_Stream_ID\t\t%lu\n",  REG_BITS(dword,  7, 4));
+		printf("AUD_PORT_EN_HD_CFG  Convertor_B_Stream_ID\t\t%lu\n",  REG_BITS(dword, 11, 8));
 
-		printf("AUD_PORT_EN_HD_CFG  Port_B_Out_Enable\t\t\t%lu\n",    BIT(dword, 12));
-		printf("AUD_PORT_EN_HD_CFG  Port_C_Out_Enable\t\t\t%lu\n",    BIT(dword, 13));
-		printf("AUD_PORT_EN_HD_CFG  Port_D_Out_Enable\t\t\t%lu\n",    BIT(dword, 14));
-		printf("AUD_PORT_EN_HD_CFG  Port_B_Amp_Mute_Status\t\t%lu\n", BIT(dword, 16));
-		printf("AUD_PORT_EN_HD_CFG  Port_C_Amp_Mute_Status\t\t%lu\n", BIT(dword, 17));
-		printf("AUD_PORT_EN_HD_CFG  Port_D_Amp_Mute_Status\t\t%lu\n", BIT(dword, 18));
+		printf("AUD_PORT_EN_HD_CFG  Port_B_Out_Enable\t\t\t%lu\n",    REG_BIT(dword, 12));
+		printf("AUD_PORT_EN_HD_CFG  Port_C_Out_Enable\t\t\t%lu\n",    REG_BIT(dword, 13));
+		printf("AUD_PORT_EN_HD_CFG  Port_D_Out_Enable\t\t\t%lu\n",    REG_BIT(dword, 14));
+		printf("AUD_PORT_EN_HD_CFG  Port_B_Amp_Mute_Status\t\t%lu\n", REG_BIT(dword, 16));
+		printf("AUD_PORT_EN_HD_CFG  Port_C_Amp_Mute_Status\t\t%lu\n", REG_BIT(dword, 17));
+		printf("AUD_PORT_EN_HD_CFG  Port_D_Amp_Mute_Status\t\t%lu\n", REG_BIT(dword, 18));
 	} else { /* three pipes */
-		printf("AUD_PORT_EN_HD_CFG  Convertor_A_Digen\t\t\t%lu\n",    BIT(dword, 0));
-		printf("AUD_PORT_EN_HD_CFG  Convertor_B_Digen\t\t\t%lu\n",    BIT(dword, 1));
-		printf("AUD_PORT_EN_HD_CFG  Convertor_C_Digen\t\t\t%lu\n",    BIT(dword, 2));
-		printf("AUD_PORT_EN_HD_CFG  Convertor_A_Stream_ID\t\t%lu\n",  BITS(dword,  7, 4));
-		printf("AUD_PORT_EN_HD_CFG  Convertor_B_Stream_ID\t\t%lu\n",  BITS(dword, 11, 8));
-		printf("AUD_PORT_EN_HD_CFG  Convertor_C_Stream_ID\t\t%lu\n",  BITS(dword, 15, 12));
+		printf("AUD_PORT_EN_HD_CFG  Convertor_A_Digen\t\t\t%lu\n",    REG_BIT(dword, 0));
+		printf("AUD_PORT_EN_HD_CFG  Convertor_B_Digen\t\t\t%lu\n",    REG_BIT(dword, 1));
+		printf("AUD_PORT_EN_HD_CFG  Convertor_C_Digen\t\t\t%lu\n",    REG_BIT(dword, 2));
+		printf("AUD_PORT_EN_HD_CFG  Convertor_A_Stream_ID\t\t%lu\n",  REG_BITS(dword,  7, 4));
+		printf("AUD_PORT_EN_HD_CFG  Convertor_B_Stream_ID\t\t%lu\n",  REG_BITS(dword, 11, 8));
+		printf("AUD_PORT_EN_HD_CFG  Convertor_C_Stream_ID\t\t%lu\n",  REG_BITS(dword, 15, 12));
 
-		printf("AUD_PORT_EN_HD_CFG  Port_B_Out_Enable\t\t\t%lu\n",    BIT(dword, 16));
-		printf("AUD_PORT_EN_HD_CFG  Port_C_Out_Enable\t\t\t%lu\n",    BIT(dword, 17));
-		printf("AUD_PORT_EN_HD_CFG  Port_D_Out_Enable\t\t\t%lu\n",    BIT(dword, 18));
-		printf("AUD_PORT_EN_HD_CFG  Port_B_Amp_Mute_Status\t\t%lu\n", BIT(dword, 20));
-		printf("AUD_PORT_EN_HD_CFG  Port_C_Amp_Mute_Status\t\t%lu\n", BIT(dword, 21));
-		printf("AUD_PORT_EN_HD_CFG  Port_D_Amp_Mute_Status\t\t%lu\n", BIT(dword, 22));
+		printf("AUD_PORT_EN_HD_CFG  Port_B_Out_Enable\t\t\t%lu\n",    REG_BIT(dword, 16));
+		printf("AUD_PORT_EN_HD_CFG  Port_C_Out_Enable\t\t\t%lu\n",    REG_BIT(dword, 17));
+		printf("AUD_PORT_EN_HD_CFG  Port_D_Out_Enable\t\t\t%lu\n",    REG_BIT(dword, 18));
+		printf("AUD_PORT_EN_HD_CFG  Port_B_Amp_Mute_Status\t\t%lu\n", REG_BIT(dword, 20));
+		printf("AUD_PORT_EN_HD_CFG  Port_C_Amp_Mute_Status\t\t%lu\n", REG_BIT(dword, 21));
+		printf("AUD_PORT_EN_HD_CFG  Port_D_Amp_Mute_Status\t\t%lu\n", REG_BIT(dword, 22));
 	}
 }
 
@@ -1586,19 +1586,19 @@ static void dump_aud_pipe_conv_cfg(void)
 	uint32_t dword;
 
 	dword = INREG(aud_reg_base + AUD_PIPE_CONV_CFG);
-	printf("AUD_PIPE_CONV_CFG  Convertor_1_Digen\t\t\t%lu\n",    BIT(dword, 0));
-	printf("AUD_PIPE_CONV_CFG  Convertor_2_Digen\t\t\t%lu\n",    BIT(dword, 1));
-	printf("AUD_PIPE_CONV_CFG  Convertor_3_Digen\t\t\t%lu\n",    BIT(dword, 2));
-	printf("AUD_PIPE_CONV_CFG  Convertor_1_Stream_ID\t\t%lu\n",  BITS(dword,  7, 4));
-	printf("AUD_PIPE_CONV_CFG  Convertor_2_Stream_ID\t\t%lu\n",  BITS(dword, 11, 8));
-	printf("AUD_PIPE_CONV_CFG  Convertor_3_Stream_ID\t\t%lu\n",  BITS(dword, 15, 12));
+	printf("AUD_PIPE_CONV_CFG  Convertor_1_Digen\t\t\t%lu\n",    REG_BIT(dword, 0));
+	printf("AUD_PIPE_CONV_CFG  Convertor_2_Digen\t\t\t%lu\n",    REG_BIT(dword, 1));
+	printf("AUD_PIPE_CONV_CFG  Convertor_3_Digen\t\t\t%lu\n",    REG_BIT(dword, 2));
+	printf("AUD_PIPE_CONV_CFG  Convertor_1_Stream_ID\t\t%lu\n",  REG_BITS(dword,  7, 4));
+	printf("AUD_PIPE_CONV_CFG  Convertor_2_Stream_ID\t\t%lu\n",  REG_BITS(dword, 11, 8));
+	printf("AUD_PIPE_CONV_CFG  Convertor_3_Stream_ID\t\t%lu\n",  REG_BITS(dword, 15, 12));
 
-	printf("AUD_PIPE_CONV_CFG  Port_B_Out_Enable\t\t\t%lu\n",    BIT(dword, 16));
-	printf("AUD_PIPE_CONV_CFG  Port_C_Out_Enable\t\t\t%lu\n",    BIT(dword, 17));
-	printf("AUD_PIPE_CONV_CFG  Port_D_Out_Enable\t\t\t%lu\n",    BIT(dword, 18));
-	printf("AUD_PIPE_CONV_CFG  Port_B_Amp_Mute_Status\t\t%lu\n", BIT(dword, 20));
-	printf("AUD_PIPE_CONV_CFG  Port_C_Amp_Mute_Status\t\t%lu\n", BIT(dword, 21));
-	printf("AUD_PIPE_CONV_CFG  Port_D_Amp_Mute_Status\t\t%lu\n", BIT(dword, 22));
+	printf("AUD_PIPE_CONV_CFG  Port_B_Out_Enable\t\t\t%lu\n",    REG_BIT(dword, 16));
+	printf("AUD_PIPE_CONV_CFG  Port_C_Out_Enable\t\t\t%lu\n",    REG_BIT(dword, 17));
+	printf("AUD_PIPE_CONV_CFG  Port_D_Out_Enable\t\t\t%lu\n",    REG_BIT(dword, 18));
+	printf("AUD_PIPE_CONV_CFG  Port_B_Amp_Mute_Status\t\t%lu\n", REG_BIT(dword, 20));
+	printf("AUD_PIPE_CONV_CFG  Port_C_Amp_Mute_Status\t\t%lu\n", REG_BIT(dword, 21));
+	printf("AUD_PIPE_CONV_CFG  Port_D_Amp_Mute_Status\t\t%lu\n", REG_BIT(dword, 22));
 }
 
 static void dump_aud_dig_cnvt(int index)
@@ -1614,16 +1614,16 @@ static void dump_aud_dig_cnvt(int index)
 		sprintf(prefix, "AUD_C%c_DIG_CNVT   ", '1' + index - CONVERTER_1);
 	}
 
-	printf("%s  V\t\t\t\t\t%lu\n",               prefix, BIT(dword, 1));
-	printf("%s  VCFG\t\t\t\t%lu\n",              prefix, BIT(dword, 2));
-	printf("%s  PRE\t\t\t\t\t%lu\n",             prefix, BIT(dword, 3));
-	printf("%s  Copy\t\t\t\t%lu\n",              prefix, BIT(dword, 4));
-	printf("%s  NonAudio\t\t\t\t%lu\n",          prefix, BIT(dword, 5));
-	printf("%s  PRO\t\t\t\t\t%lu\n",             prefix, BIT(dword, 6));
-	printf("%s  Level\t\t\t\t%lu\n",             prefix, BIT(dword, 7));
-	printf("%s  Category_Code\t\t\t%lu\n",       prefix, BITS(dword, 14, 8));
-	printf("%s  Lowest_Channel_Number\t\t%lu\n", prefix, BITS(dword, 19, 16));
-	printf("%s  Stream_ID\t\t\t\t%lu\n",         prefix, BITS(dword, 23, 20));
+	printf("%s  V\t\t\t\t\t%lu\n",               prefix, REG_BIT(dword, 1));
+	printf("%s  VCFG\t\t\t\t%lu\n",              prefix, REG_BIT(dword, 2));
+	printf("%s  PRE\t\t\t\t\t%lu\n",             prefix, REG_BIT(dword, 3));
+	printf("%s  Copy\t\t\t\t%lu\n",              prefix, REG_BIT(dword, 4));
+	printf("%s  NonAudio\t\t\t\t%lu\n",          prefix, REG_BIT(dword, 5));
+	printf("%s  PRO\t\t\t\t\t%lu\n",             prefix, REG_BIT(dword, 6));
+	printf("%s  Level\t\t\t\t%lu\n",             prefix, REG_BIT(dword, 7));
+	printf("%s  Category_Code\t\t\t%lu\n",       prefix, REG_BITS(dword, 14, 8));
+	printf("%s  Lowest_Channel_Number\t\t%lu\n", prefix, REG_BITS(dword, 19, 16));
+	printf("%s  Stream_ID\t\t\t\t%lu\n",         prefix, REG_BITS(dword, 23, 20));
 }
 
 static void dump_aud_str_desc(int index)
@@ -1640,24 +1640,24 @@ static void dump_aud_str_desc(int index)
 		sprintf(prefix, "AUD_C%c_STR_DESC  ", '1' + index - CONVERTER_1);
 	}
 
-	printf("%s  Number_of_Channels_in_a_Stream\t%lu\n",   prefix, BITS(dword, 3, 0) + 1);
-	printf("%s  Bits_per_Sample\t\t\t[%#lx] %s\n",        prefix, BITS(dword, 6, 4),
-		OPNAME(bits_per_sample, BITS(dword, 6, 4)));
+	printf("%s  Number_of_Channels_in_a_Stream\t%lu\n",   prefix, REG_BITS(dword, 3, 0) + 1);
+	printf("%s  Bits_per_Sample\t\t\t[%#lx] %s\n",        prefix, REG_BITS(dword, 6, 4),
+		OPNAME(bits_per_sample, REG_BITS(dword, 6, 4)));
 
-	printf("%s  Sample_Base_Rate_Divisor\t\t[%#lx] %s\n", prefix, BITS(dword, 10, 8),
-		OPNAME(sample_base_rate_divisor, BITS(dword, 10, 8)));
-	printf("%s  Sample_Base_Rate_Mult\t\t[%#lx] %s\n",    prefix, BITS(dword, 13, 11),
-		OPNAME(sample_base_rate_mult, BITS(dword, 13, 11)));
-	printf("%s  Sample_Base_Rate\t\t\t[%#lx] %s\t",       prefix, BIT(dword, 14),
-		OPNAME(sample_base_rate, BIT(dword, 14)));
-	rate = (BIT(dword, 14) ? 44100 : 48000) * (BITS(dword, 13, 11) + 1)
-		/(BITS(dword, 10, 8) + 1);
+	printf("%s  Sample_Base_Rate_Divisor\t\t[%#lx] %s\n", prefix, REG_BITS(dword, 10, 8),
+		OPNAME(sample_base_rate_divisor, REG_BITS(dword, 10, 8)));
+	printf("%s  Sample_Base_Rate_Mult\t\t[%#lx] %s\n",    prefix, REG_BITS(dword, 13, 11),
+		OPNAME(sample_base_rate_mult, REG_BITS(dword, 13, 11)));
+	printf("%s  Sample_Base_Rate\t\t\t[%#lx] %s\t",       prefix, REG_BIT(dword, 14),
+		OPNAME(sample_base_rate, REG_BIT(dword, 14)));
+	rate = (REG_BIT(dword, 14) ? 44100 : 48000) * (REG_BITS(dword, 13, 11) + 1)
+		/(REG_BITS(dword, 10, 8) + 1);
 	printf("=> Sample Rate %d Hz\n", rate);
 
-	printf("%s  Convertor_Channel_Count\t\t%lu\n",        prefix, BITS(dword, 20, 16) + 1);
+	printf("%s  Convertor_Channel_Count\t\t%lu\n",        prefix, REG_BITS(dword, 20, 16) + 1);
 
 	if (!IS_HASWELL_PLUS(devid))
-		printf("%s  HBR_enable\t\t\t\t%lu\n",         prefix, BITS(dword, 28, 27));
+		printf("%s  HBR_enable\t\t\t\t%lu\n",         prefix, REG_BITS(dword, 28, 27));
 }
 
 #define dump_aud_out_ch_str		dump_aud_out_chan_map
@@ -1671,10 +1671,10 @@ static void dump_aud_out_chan_map(void)
 		OUTREG(aud_reg_base + AUD_OUT_CHAN_MAP, i | (i << 8) | (i << 16));
 		dword = INREG(aud_reg_base + AUD_OUT_CHAN_MAP);
 		printf("\t\t\t\t%lu\t%lu\t%lu\t%lu\n",
-				1 + BITS(dword,  3,  0),
-				1 + BITS(dword,  7,  4),
-				1 + BITS(dword, 15, 12),
-				1 + BITS(dword, 23, 20));
+				1 + REG_BITS(dword,  3,  0),
+				1 + REG_BITS(dword,  7,  4),
+				1 + REG_BITS(dword, 15, 12),
+				1 + REG_BITS(dword, 23, 20));
 	}
 }
 
@@ -1686,10 +1686,10 @@ static void dump_aud_connect_list(void)
 	dword = INREG(aud_reg_base + AUD_PINW_CONNLNG_LIST);
 	sprintf(prefix, "AUD_PINW_CONNLNG_LIST");
 
-	printf("%s  Connect_List_Length\t\t%lu\n",     prefix, BITS(dword, 6, 0));
-	printf("%s  Form \t\t\t\t[%#lx] %s\n",         prefix, BIT(dword, 7),
-		OPNAME(connect_list_form, BIT(dword, 7)));
-	printf("%s  Connect_List_Entry\t\t%lu, %lu\n", prefix, BITS(dword, 15, 8), BITS(dword, 23, 16));
+	printf("%s  Connect_List_Length\t\t%lu\n",     prefix, REG_BITS(dword, 6, 0));
+	printf("%s  Form \t\t\t\t[%#lx] %s\n",         prefix, REG_BIT(dword, 7),
+		OPNAME(connect_list_form, REG_BIT(dword, 7)));
+	printf("%s  Connect_List_Entry\t\t%lu, %lu\n", prefix, REG_BITS(dword, 15, 8), REG_BITS(dword, 23, 16));
 }
 
 static void dump_aud_connect_select(void)
@@ -1706,9 +1706,9 @@ static void dump_aud_connect_select(void)
 		sprintf(prefix, "AUD_PINW_CONNLNG_SEL  ");
 	}
 
-	printf("%s  Connection_select_Port_B\t%#lx\n", prefix, BITS(dword,  7,  0));
-	printf("%s  Connection_select_Port_C\t%#lx\n", prefix, BITS(dword, 15,  8));
-	printf("%s  Connection_select_Port_D\t%#lx\n", prefix, BITS(dword, 23, 16));
+	printf("%s  Connection_select_Port_B\t%#lx\n", prefix, REG_BITS(dword,  7,  0));
+	printf("%s  Connection_select_Port_C\t%#lx\n", prefix, REG_BITS(dword, 15,  8));
+	printf("%s  Connection_select_Port_D\t%#lx\n", prefix, REG_BITS(dword, 23, 16));
 }
 
 static void dump_aud_ctrl_state(int index)
@@ -1726,16 +1726,16 @@ static void dump_aud_ctrl_state(int index)
 		printf("Audio control state - Pipe %c\n",  'A' + index - PIPE_A);
 	}
 
-	printf("\tELD_ACK\t\t\t\t\t\t%lu\n",                                 BIT(dword, 4));
-	printf("\tELD_buffer_size\t\t\t\t\t%lu\n",                           BITS(dword, 14, 10));
-	printf("\tDIP_transmission_frequency\t\t\t[0x%lx] %s\n",             BITS(dword, 17, 16),
-		dip_trans[BITS(dword, 17, 16)]);
-	printf("\tDIP Buffer Index \t\t\t\t[0x%lx] %s\n",                    BITS(dword, 20, 18),
-		dip_index[BITS(dword, 20, 18)]);
-	printf("\tAudio DIP type enable status\t\t\t[0x%04lx] %s, %s, %s\n", BITS(dword, 24, 21),
-		dip_type[BIT(dword, 21)], dip_gen1_state[BIT(dword, 22)],  dip_gen2_state[BIT(dword, 23)]);
-	printf("\tAudio DIP port select\t\t\t\t[0x%lx] %s\n",                BITS(dword, 30, 29),
-		dip_port[BITS(dword, 30, 29)]);
+	printf("\tELD_ACK\t\t\t\t\t\t%lu\n",                                 REG_BIT(dword, 4));
+	printf("\tELD_buffer_size\t\t\t\t\t%lu\n",                           REG_BITS(dword, 14, 10));
+	printf("\tDIP_transmission_frequency\t\t\t[0x%lx] %s\n",             REG_BITS(dword, 17, 16),
+		dip_trans[REG_BITS(dword, 17, 16)]);
+	printf("\tDIP Buffer Index \t\t\t\t[0x%lx] %s\n",                    REG_BITS(dword, 20, 18),
+		dip_index[REG_BITS(dword, 20, 18)]);
+	printf("\tAudio DIP type enable status\t\t\t[0x%04lx] %s, %s, %s\n", REG_BITS(dword, 24, 21),
+		dip_type[REG_BIT(dword, 21)], dip_gen1_state[REG_BIT(dword, 22)],  dip_gen2_state[REG_BIT(dword, 23)]);
+	printf("\tAudio DIP port select\t\t\t\t[0x%lx] %s\n",                REG_BITS(dword, 30, 29),
+		dip_port[REG_BITS(dword, 30, 29)]);
 	printf("\n");
 }
 
@@ -1744,12 +1744,12 @@ static void dump_aud_ctrl_state2(void)
 	uint32_t dword;
 
 	dword = INREG(aud_reg_base + AUD_CNTL_ST2);
-	printf("AUD_CNTL_ST2  ELD_validB\t\t\t\t%lu\n",  BIT(dword, 0));
-	printf("AUD_CNTL_ST2  CP_ReadyB\t\t\t\t\t%lu\n", BIT(dword, 1));
-	printf("AUD_CNTL_ST2  ELD_validC\t\t\t\t%lu\n",  BIT(dword, 4));
-	printf("AUD_CNTL_ST2  CP_ReadyC\t\t\t\t\t%lu\n", BIT(dword, 5));
-	printf("AUD_CNTL_ST2  ELD_validD\t\t\t\t%lu\n",  BIT(dword, 8));
-	printf("AUD_CNTL_ST2  CP_ReadyD\t\t\t\t\t%lu\n", BIT(dword, 9));
+	printf("AUD_CNTL_ST2  ELD_validB\t\t\t\t%lu\n",  REG_BIT(dword, 0));
+	printf("AUD_CNTL_ST2  CP_ReadyB\t\t\t\t\t%lu\n", REG_BIT(dword, 1));
+	printf("AUD_CNTL_ST2  ELD_validC\t\t\t\t%lu\n",  REG_BIT(dword, 4));
+	printf("AUD_CNTL_ST2  CP_ReadyC\t\t\t\t\t%lu\n", REG_BIT(dword, 5));
+	printf("AUD_CNTL_ST2  ELD_validD\t\t\t\t%lu\n",  REG_BIT(dword, 8));
+	printf("AUD_CNTL_ST2  CP_ReadyD\t\t\t\t\t%lu\n", REG_BIT(dword, 9));
 }
 
 /* for hsw+ */
@@ -1758,18 +1758,18 @@ static void dump_aud_eld_cp_vld(void)
 	uint32_t dword;
 
 	dword = INREG(aud_reg_base + AUD_PIN_ELD_CP_VLD);
-	printf("AUD_PIN_ELD_CP_VLD  Transcoder_A ELD_valid\t\t%lu\n",	BIT(dword, 0));
-	printf("AUD_PIN_ELD_CP_VLD  Transcoder_A CP_Ready \t\t%lu\n",	BIT(dword, 1));
-	printf("AUD_PIN_ELD_CP_VLD  Transcoder_A Out_enable\t\t%lu\n",	BIT(dword, 2));
-	printf("AUD_PIN_ELD_CP_VLD  Transcoder_A Inactive\t\t%lu\n",	BIT(dword, 3));
-	printf("AUD_PIN_ELD_CP_VLD  Transcoder_B ELD_valid\t\t%lu\n",	BIT(dword, 4));
-	printf("AUD_PIN_ELD_CP_VLD  Transcoder_B CP_Ready\t\t%lu\n",	BIT(dword, 5));
-	printf("AUD_PIN_ELD_CP_VLD  Transcoder_B OUT_enable\t\t%lu\n",	BIT(dword, 6));
-	printf("AUD_PIN_ELD_CP_VLD  Transcoder_B Inactive\t\t%lu\n",    BIT(dword, 7));
-	printf("AUD_PIN_ELD_CP_VLD  Transcoder_C ELD_valid\t\t%lu\n",	BIT(dword, 8));
-	printf("AUD_PIN_ELD_CP_VLD  Transcoder_C CP_Ready\t\t%lu\n",	BIT(dword, 9));
-	printf("AUD_PIN_ELD_CP_VLD  Transcoder_C OUT_enable\t\t%lu\n",	BIT(dword, 10));
-	printf("AUD_PIN_ELD_CP_VLD  Transcoder_C Inactive\t\t%lu\n",    BIT(dword, 11));
+	printf("AUD_PIN_ELD_CP_VLD  Transcoder_A ELD_valid\t\t%lu\n",	REG_BIT(dword, 0));
+	printf("AUD_PIN_ELD_CP_VLD  Transcoder_A CP_Ready \t\t%lu\n",	REG_BIT(dword, 1));
+	printf("AUD_PIN_ELD_CP_VLD  Transcoder_A Out_enable\t\t%lu\n",	REG_BIT(dword, 2));
+	printf("AUD_PIN_ELD_CP_VLD  Transcoder_A Inactive\t\t%lu\n",	REG_BIT(dword, 3));
+	printf("AUD_PIN_ELD_CP_VLD  Transcoder_B ELD_valid\t\t%lu\n",	REG_BIT(dword, 4));
+	printf("AUD_PIN_ELD_CP_VLD  Transcoder_B CP_Ready\t\t%lu\n",	REG_BIT(dword, 5));
+	printf("AUD_PIN_ELD_CP_VLD  Transcoder_B OUT_enable\t\t%lu\n",	REG_BIT(dword, 6));
+	printf("AUD_PIN_ELD_CP_VLD  Transcoder_B Inactive\t\t%lu\n",    REG_BIT(dword, 7));
+	printf("AUD_PIN_ELD_CP_VLD  Transcoder_C ELD_valid\t\t%lu\n",	REG_BIT(dword, 8));
+	printf("AUD_PIN_ELD_CP_VLD  Transcoder_C CP_Ready\t\t%lu\n",	REG_BIT(dword, 9));
+	printf("AUD_PIN_ELD_CP_VLD  Transcoder_C OUT_enable\t\t%lu\n",	REG_BIT(dword, 10));
+	printf("AUD_PIN_ELD_CP_VLD  Transcoder_C Inactive\t\t%lu\n",    REG_BIT(dword, 11));
 }
 
 static void dump_aud_hdmi_status(void)
@@ -1777,12 +1777,12 @@ static void dump_aud_hdmi_status(void)
 	uint32_t dword;
 
 	dword = INREG(aud_reg_base + AUD_HDMIW_STATUS);
-	printf("AUD_HDMIW_STATUS  Function_Reset\t\t\t%lu\n",                BIT(dword, 24));
-	printf("AUD_HDMIW_STATUS  BCLK/CDCLK_FIFO_Overrun\t\t%lu\n",	     BIT(dword, 25));
-	printf("AUD_HDMIW_STATUS  Conv_A_CDCLK/DOTCLK_FIFO_Overrun\t%lu\n",  BIT(dword, 28));
-	printf("AUD_HDMIW_STATUS  Conv_A_CDCLK/DOTCLK_FIFO_Underrun\t%lu\n", BIT(dword, 29));
-	printf("AUD_HDMIW_STATUS  Conv_B_CDCLK/DOTCLK_FIFO_Overrun\t%lu\n",  BIT(dword, 30));
-	printf("AUD_HDMIW_STATUS  Conv_B_CDCLK/DOTCLK_FIFO_Underrun\t%lu\n", BIT(dword, 31));
+	printf("AUD_HDMIW_STATUS  Function_Reset\t\t\t%lu\n",                REG_BIT(dword, 24));
+	printf("AUD_HDMIW_STATUS  BCLK/CDCLK_FIFO_Overrun\t\t%lu\n",	     REG_BIT(dword, 25));
+	printf("AUD_HDMIW_STATUS  Conv_A_CDCLK/DOTCLK_FIFO_Overrun\t%lu\n",  REG_BIT(dword, 28));
+	printf("AUD_HDMIW_STATUS  Conv_A_CDCLK/DOTCLK_FIFO_Underrun\t%lu\n", REG_BIT(dword, 29));
+	printf("AUD_HDMIW_STATUS  Conv_B_CDCLK/DOTCLK_FIFO_Overrun\t%lu\n",  REG_BIT(dword, 30));
+	printf("AUD_HDMIW_STATUS  Conv_B_CDCLK/DOTCLK_FIFO_Underrun\t%lu\n", REG_BIT(dword, 31));
 }
 
 /*
@@ -1818,13 +1818,13 @@ static void dump_dp_port_ctrl(int port)
 
 	port_ctrl = disp_reg_base + DP_CTL_B + (port - PORT_B) * 0x100;
 	dword = INREG(port_ctrl);
-	printf("%s DisplayPort_Enable\t\t\t\t\t%lu\n",        prefix, BIT(dword, 31));
-	printf("%s Transcoder_Select\t\t\t\t\t%s\n",          prefix, BIT(dword, 30) ? "Transcoder B" : "Transcoder A");
-	printf("%s Port_Width_Selection\t\t\t\t[0x%lx] %s\n", prefix, BITS(dword, 21, 19),
-		dp_port_width[BITS(dword, 21, 19)]);
-	printf("%s Port_Detected\t\t\t\t\t%lu\n",             prefix, BIT(dword, 2));
-	printf("%s HDCP_Port_Select\t\t\t\t\t%lu\n",          prefix, BIT(dword, 5));
-	printf("%s Audio_Output_Enable\t\t\t\t%lu\n",         prefix, BIT(dword, 6));
+	printf("%s DisplayPort_Enable\t\t\t\t\t%lu\n",        prefix, REG_BIT(dword, 31));
+	printf("%s Transcoder_Select\t\t\t\t\t%s\n",          prefix, REG_BIT(dword, 30) ? "Transcoder B" : "Transcoder A");
+	printf("%s Port_Width_Selection\t\t\t\t[0x%lx] %s\n", prefix, REG_BITS(dword, 21, 19),
+		dp_port_width[REG_BITS(dword, 21, 19)]);
+	printf("%s Port_Detected\t\t\t\t\t%lu\n",             prefix, REG_BIT(dword, 2));
+	printf("%s HDCP_Port_Select\t\t\t\t\t%lu\n",          prefix, REG_BIT(dword, 5));
+	printf("%s Audio_Output_Enable\t\t\t\t%lu\n",         prefix, REG_BIT(dword, 6));
 }
 
 static void dump_hdmi_port_ctrl(int port)
@@ -1843,13 +1843,13 @@ static void dump_hdmi_port_ctrl(int port)
 
 	dword = INREG(port_ctrl);
 	printf("%s HDMI_Enable\t\t\t\t\t%u\n",                 prefix, !!(dword & SDVO_ENABLE));
-	printf("%s Transcoder_Select\t\t\t\t%s\n",             prefix, BIT(dword, 30) ? "Transcoder B" : "Transcoder A");
-	printf("%s HDCP_Port_Select\t\t\t\t%lu\n",             prefix, BIT(dword, 5));
+	printf("%s Transcoder_Select\t\t\t\t%s\n",             prefix, REG_BIT(dword, 30) ? "Transcoder B" : "Transcoder A");
+	printf("%s HDCP_Port_Select\t\t\t\t%lu\n",             prefix, REG_BIT(dword, 5));
 	if (port == PORT_B) /* TODO: check spec, not found in Ibx b-spec, and only for port B? */
-		printf("%s SDVO Hot Plug Interrupt Detect Enable\t%lu\n", prefix, BIT(dword, 23));
-	printf("%s Digital_Port_Detected\t\t\t%lu\n",          prefix, BIT(dword, 2));
-	printf("%s Encoding\t\t\t\t\t[0x%lx] %s\n",            prefix, BITS(dword, 11, 10),
-		sdvo_hdmi_encoding[BITS(dword, 11, 10)]);
+		printf("%s SDVO Hot Plug Interrupt Detect Enable\t%lu\n", prefix, REG_BIT(dword, 23));
+	printf("%s Digital_Port_Detected\t\t\t%lu\n",          prefix, REG_BIT(dword, 2));
+	printf("%s Encoding\t\t\t\t\t[0x%lx] %s\n",            prefix, REG_BITS(dword, 11, 10),
+		sdvo_hdmi_encoding[REG_BITS(dword, 11, 10)]);
 	printf("%s Null_packets_enabled_during_Vsync\t\t%u\n", prefix, !!(dword & SDVO_NULL_PACKETS_DURING_VSYNC));
 	printf("%s Audio_Output_Enable\t\t\t\t%u\n",           prefix, !!(dword & SDVO_AUDIO_ENABLE));
 }
@@ -2032,9 +2032,9 @@ static void dump_ddi_buf_ctl(int port)
 	dword = INREG(DDI_BUF_CTL_A + (port - PORT_A) * 0x100);
 	printf("DDI %c Buffer control\n", 'A' + port - PORT_A);
 
-	printf("\tDP port width\t\t\t\t\t[0x%lx] %s\n", BITS(dword, 3, 1),
-		OPNAME(dp_port_width, BITS(dword, 3, 1)));
-	printf("\tDDI Buffer Enable\t\t\t\t%ld\n",      BIT(dword, 31));
+	printf("\tDP port width\t\t\t\t\t[0x%lx] %s\n", REG_BITS(dword, 3, 1),
+		OPNAME(dp_port_width, REG_BITS(dword, 3, 1)));
+	printf("\tDDI Buffer Enable\t\t\t\t%ld\n",      REG_BIT(dword, 31));
 }
 
 static void dump_ddi_func_ctl(int pipe)
@@ -2044,13 +2044,13 @@ static void dump_ddi_func_ctl(int pipe)
 	dword = INREG(PIPE_DDI_FUNC_CTL_A + (pipe - PIPE_A) * 0x1000);
 	printf("Pipe %c DDI Function Control\n", 'A' + pipe - PIPE_A);
 
-	printf("\tBITS per color\t\t\t\t\t[0x%lx] %s\n",    BITS(dword, 22, 20),
-		OPNAME(bits_per_color, BITS(dword, 22, 20)));
-	printf("\tPIPE DDI Mode\t\t\t\t\t[0x%lx] %s\n",     BITS(dword, 26, 24),
-		OPNAME(ddi_mode, BITS(dword, 26, 24)));
-	printf("\tPIPE DDI selection\t\t\t\t[0x%lx] %s\n",  BITS(dword, 30, 28),
-		OPNAME(trans_to_port_sel, BITS(dword, 30, 28)));
-	printf("\tPIPE DDI Function Enable\t\t\t[0x%lx]\n", BIT(dword, 31));
+	printf("\tREG_BITS per color\t\t\t\t\t[0x%lx] %s\n", REG_BITS(dword, 22, 20),
+		OPNAME(bits_per_color, REG_BITS(dword, 22, 20)));
+	printf("\tPIPE DDI Mode\t\t\t\t\t[0x%lx] %s\n",     REG_BITS(dword, 26, 24),
+		OPNAME(ddi_mode, REG_BITS(dword, 26, 24)));
+	printf("\tPIPE DDI selection\t\t\t\t[0x%lx] %s\n",  REG_BITS(dword, 30, 28),
+		OPNAME(trans_to_port_sel, REG_BITS(dword, 30, 28)));
+	printf("\tPIPE DDI Function Enable\t\t\t[0x%lx]\n", REG_BIT(dword, 31));
 }
 
 static void dump_aud_connect_list_entry_length(int transcoder)
@@ -2061,10 +2061,10 @@ static void dump_aud_connect_list_entry_length(int transcoder)
 	dword = INREG(aud_reg_base + AUD_TCA_PIN_PIPE_CONN_ENTRY_LNGTH + (transcoder - TRANSCODER_A) * 0x100);
 	sprintf(prefix, "AUD_TC%c_PIN_PIPE_CONN_ENTRY_LNGTH", 'A' + transcoder - TRANSCODER_A);
 
-	printf("%s  Connect_List_Length\t%lu\n", prefix, BITS(dword, 6, 0));
-	printf("%s  Form \t\t[%#lx] %s\n",       prefix, BIT(dword, 7),
-		OPNAME(connect_list_form, BIT(dword, 7)));
-	printf("%s  Connect_List_Entry\t%lu\n",  prefix, BITS(dword, 15, 8));
+	printf("%s  Connect_List_Length\t%lu\n", prefix, REG_BITS(dword, 6, 0));
+	printf("%s  Form \t\t[%#lx] %s\n",       prefix, REG_BIT(dword, 7),
+		OPNAME(connect_list_form, REG_BIT(dword, 7)));
+	printf("%s  Connect_List_Entry\t%lu\n",  prefix, REG_BITS(dword, 15, 8));
 }
 
 static void dump_aud_connect_select_ctrl(void)
@@ -2072,9 +2072,9 @@ static void dump_aud_connect_select_ctrl(void)
 	uint32_t dword;
 
 	dword = INREG(aud_reg_base + AUD_PIPE_CONN_SEL_CTRL);
-	printf("AUD_PIPE_CONN_SEL_CTRL  Connection_select_Port_B\t%#lx\n", BITS(dword,  7,  0));
-	printf("AUD_PIPE_CONN_SEL_CTRL  Connection_select_Port_C\t%#lx\n", BITS(dword, 15,  8));
-	printf("AUD_PIPE_CONN_SEL_CTRL  Connection_select_Port_D\t%#lx\n", BITS(dword, 23, 16));
+	printf("AUD_PIPE_CONN_SEL_CTRL  Connection_select_Port_B\t%#lx\n", REG_BITS(dword,  7,  0));
+	printf("AUD_PIPE_CONN_SEL_CTRL  Connection_select_Port_C\t%#lx\n", REG_BITS(dword, 15,  8));
+	printf("AUD_PIPE_CONN_SEL_CTRL  Connection_select_Port_D\t%#lx\n", REG_BITS(dword, 23, 16));
 }
 
 static void dump_aud_dip_eld_ctrl_st(int transcoder)
@@ -2085,16 +2085,16 @@ static void dump_aud_dip_eld_ctrl_st(int transcoder)
 	dword = INREG(aud_reg_base + AUD_TCA_DIP_ELD_CTRL_ST + offset);
 	printf("Audio DIP and ELD control state for Transcoder %c\n",  'A' + transcoder - TRANSCODER_A);
 
-	printf("\tELD_ACK\t\t\t\t\t\t%lu\n",                                 BIT(dword, 4));
-	printf("\tELD_buffer_size\t\t\t\t\t%lu\n",                           BITS(dword, 14, 10));
-	printf("\tDIP_transmission_frequency\t\t\t[0x%lx] %s\n",             BITS(dword, 17, 16),
-		dip_trans[BITS(dword, 17, 16)]);
-	printf("\tDIP Buffer Index \t\t\t\t[0x%lx] %s\n",                    BITS(dword, 20, 18),
-		dip_index[BITS(dword, 20, 18)]);
-	printf("\tAudio DIP type enable status\t\t\t[0x%04lx] %s, %s, %s\n", BITS(dword, 24, 21),
-		dip_type[BIT(dword, 21)], dip_gen1_state[BIT(dword, 22)],  dip_gen2_state[BIT(dword, 23)]);
-	printf("\tAudio DIP port select\t\t\t\t[0x%lx] %s\n",                BITS(dword, 30, 29),
-		dip_port[BITS(dword, 30, 29)]);
+	printf("\tELD_ACK\t\t\t\t\t\t%lu\n",                                 REG_BIT(dword, 4));
+	printf("\tELD_buffer_size\t\t\t\t\t%lu\n",                           REG_BITS(dword, 14, 10));
+	printf("\tDIP_transmission_frequency\t\t\t[0x%lx] %s\n",             REG_BITS(dword, 17, 16),
+		dip_trans[REG_BITS(dword, 17, 16)]);
+	printf("\tDIP Buffer Index \t\t\t\t[0x%lx] %s\n",                    REG_BITS(dword, 20, 18),
+		dip_index[REG_BITS(dword, 20, 18)]);
+	printf("\tAudio DIP type enable status\t\t\t[0x%04lx] %s, %s, %s\n", REG_BITS(dword, 24, 21),
+		dip_type[REG_BIT(dword, 21)], dip_gen1_state[REG_BIT(dword, 22)],  dip_gen2_state[REG_BIT(dword, 23)]);
+	printf("\tAudio DIP port select\t\t\t\t[0x%lx] %s\n",                REG_BITS(dword, 30, 29),
+		dip_port[REG_BITS(dword, 30, 29)]);
 	printf("\n");
 }
 
@@ -2103,39 +2103,39 @@ static void dump_aud_hdmi_fifo_status(void)
 	uint32_t dword;
 
 	dword = INREG(aud_reg_base + AUD_HDMI_FIFO_STATUS);
-	printf("AUD_HDMI_FIFO_STATUS  Function_Reset\t\t\t%lu\n",                BIT(dword, 24));
-	printf("AUD_HDMI_FIFO_STATUS  Conv_1_CDCLK/DOTCLK_FIFO_Overrun\t%lu\n",  BIT(dword, 26));
-	printf("AUD_HDMI_FIFO_STATUS  Conv_1_CDCLK/DOTCLK_FIFO_Underrun\t%lu\n", BIT(dword, 27));
-	printf("AUD_HDMI_FIFO_STATUS  Conv_2_CDCLK/DOTCLK_FIFO_Overrun\t%lu\n",  BIT(dword, 28));
-	printf("AUD_HDMI_FIFO_STATUS  Conv_2_CDCLK/DOTCLK_FIFO_Underrun\t%lu\n", BIT(dword, 29));
-	printf("AUD_HDMI_FIFO_STATUS  Conv_3_CDCLK/DOTCLK_FIFO_Overrun\t%lu\n",  BIT(dword, 30));
-	printf("AUD_HDMI_FIFO_STATUS  Conv_3_CDCLK/DOTCLK_FIFO_Underrun\t%lu\n", BIT(dword, 31));
+	printf("AUD_HDMI_FIFO_STATUS  Function_Reset\t\t\t%lu\n",                REG_BIT(dword, 24));
+	printf("AUD_HDMI_FIFO_STATUS  Conv_1_CDCLK/DOTCLK_FIFO_Overrun\t%lu\n",  REG_BIT(dword, 26));
+	printf("AUD_HDMI_FIFO_STATUS  Conv_1_CDCLK/DOTCLK_FIFO_Underrun\t%lu\n", REG_BIT(dword, 27));
+	printf("AUD_HDMI_FIFO_STATUS  Conv_2_CDCLK/DOTCLK_FIFO_Overrun\t%lu\n",  REG_BIT(dword, 28));
+	printf("AUD_HDMI_FIFO_STATUS  Conv_2_CDCLK/DOTCLK_FIFO_Underrun\t%lu\n", REG_BIT(dword, 29));
+	printf("AUD_HDMI_FIFO_STATUS  Conv_3_CDCLK/DOTCLK_FIFO_Overrun\t%lu\n",  REG_BIT(dword, 30));
+	printf("AUD_HDMI_FIFO_STATUS  Conv_3_CDCLK/DOTCLK_FIFO_Underrun\t%lu\n", REG_BIT(dword, 31));
 }
 
 static void parse_bdw_audio_chicken_bit_reg(uint32_t dword)
 {
 	printf("\t");
-	printf("%s\n\t", OPNAME(vanilla_dp12_en,           BIT(dword, 31)));
-	printf("%s\n\t", OPNAME(vanilla_3_widgets_en,      BIT(dword, 30)));
-	printf("%s\n\t", OPNAME(block_audio,               BIT(dword, 10)));
-	printf("%s\n\t", OPNAME(dis_eld_valid_pulse_trans, BIT(dword, 9)));
-	printf("%s\n\t", OPNAME(dis_pd_pulse_trans,        BIT(dword, 8)));
-	printf("%s\n\t", OPNAME(dis_ts_delta_err,          BIT(dword, 7)));
-	printf("%s\n\t", OPNAME(dis_ts_fix_dp_hbr,         BIT(dword, 6)));
-	printf("%s\n\t", OPNAME(pattern_gen_8_ch_en,       BIT(dword, 5)));
-	printf("%s\n\t", OPNAME(pattern_gen_2_ch_en,       BIT(dword, 4)));
-	printf("%s\n\t", OPNAME(fabric_32_44_dis,          BIT(dword, 3)));
-	printf("%s\n\t", OPNAME(epss_dis,                  BIT(dword, 2)));
-	printf("%s\n\t", OPNAME(ts_test_mode,              BIT(dword, 1)));
-	printf("%s\n",   OPNAME(en_mmio_program,           BIT(dword, 0)));
+	printf("%s\n\t", OPNAME(vanilla_dp12_en,           REG_BIT(dword, 31)));
+	printf("%s\n\t", OPNAME(vanilla_3_widgets_en,      REG_BIT(dword, 30)));
+	printf("%s\n\t", OPNAME(block_audio,               REG_BIT(dword, 10)));
+	printf("%s\n\t", OPNAME(dis_eld_valid_pulse_trans, REG_BIT(dword, 9)));
+	printf("%s\n\t", OPNAME(dis_pd_pulse_trans,        REG_BIT(dword, 8)));
+	printf("%s\n\t", OPNAME(dis_ts_delta_err,          REG_BIT(dword, 7)));
+	printf("%s\n\t", OPNAME(dis_ts_fix_dp_hbr,         REG_BIT(dword, 6)));
+	printf("%s\n\t", OPNAME(pattern_gen_8_ch_en,       REG_BIT(dword, 5)));
+	printf("%s\n\t", OPNAME(pattern_gen_2_ch_en,       REG_BIT(dword, 4)));
+	printf("%s\n\t", OPNAME(fabric_32_44_dis,          REG_BIT(dword, 3)));
+	printf("%s\n\t", OPNAME(epss_dis,                  REG_BIT(dword, 2)));
+	printf("%s\n\t", OPNAME(ts_test_mode,              REG_BIT(dword, 1)));
+	printf("%s\n",   OPNAME(en_mmio_program,           REG_BIT(dword, 0)));
 }
 
 static void parse_skl_audio_freq_cntrl_reg(uint32_t dword)
 {
 	printf("\t");
-	printf("%s\n\t", OPNAME(sdi_operate_mode,          BIT(dword, 15)));
-	printf("%s\n\t", OPNAME(bclk_96mhz,                BIT(dword, 4)));
-	printf("%s\n",   OPNAME(bclk_48mhz,                BIT(dword, 3)));
+	printf("%s\n\t", OPNAME(sdi_operate_mode,          REG_BIT(dword, 15)));
+	printf("%s\n\t", OPNAME(bclk_96mhz,                REG_BIT(dword, 4)));
+	printf("%s\n",   OPNAME(bclk_48mhz,                REG_BIT(dword, 3)));
 }
 
 /* Dump audio registers for Haswell and its successors (eg. Broadwell).
@@ -2311,10 +2311,10 @@ static void dump_hsw_plus(void)
 	dump_aud_hdmi_fifo_status();
 
 	dword = read_aud_reg(AUD_ICS);
-	printf("IRV [%1lx] %s\t", BIT(dword, 1),
-		OPNAME(immed_result_valid, BIT(dword, 1)));
-	printf("ICB [%1lx] %s\n", BIT(dword, 1),
-		OPNAME(immed_cmd_busy, BIT(dword, 0)));
+	printf("IRV [%1lx] %s\t", REG_BIT(dword, 1),
+		OPNAME(immed_result_valid, REG_BIT(dword, 1)));
+	printf("ICB [%1lx] %s\n", REG_BIT(dword, 1),
+		OPNAME(immed_cmd_busy, REG_BIT(dword, 0)));
 
 	dword = read_aud_reg(AUD_CHICKENBIT_REG);
 	printf("AUD_CHICKENBIT_REG Audio Chicken Bits: %08x\n", dword);
@@ -2324,7 +2324,7 @@ static void dump_hsw_plus(void)
 	dword = read_aud_reg(AUD_DP_DIP_STATUS);
 	printf("AUD_DP_DIP_STATUS Audio DP & DIP FIFO Status: %08x\n\t", dword);
 	for (i = 31; i >= 0; i--)
-		if (BIT(dword, i))
+		if (REG_BIT(dword, i))
 			printf("%s\n\t", audio_dp_dip_status[i]);
 	printf("\n");
 
-- 
2.20.1

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [igt-dev] [PATCH i-g-t v2 2/2] lib/intel_chipset: Move BIT macro to common place
  2019-07-03 13:43 [igt-dev] [PATCH i-g-t v2 1/2] tools/intel_dump_audion: Rename BIT macros to REG_BIT Lukasz Kalamarz
@ 2019-07-03 13:43 ` Lukasz Kalamarz
  2019-07-04  6:07   ` Katarzyna Dec
  2019-07-04 15:17   ` Michal Wajdeczko
  2019-07-03 14:20 ` [igt-dev] ✓ Fi.CI.BAT: success for series starting with [i-g-t,v2,1/2] tools/intel_dump_audion: Rename BIT macros to REG_BIT Patchwork
                   ` (2 subsequent siblings)
  3 siblings, 2 replies; 7+ messages in thread
From: Lukasz Kalamarz @ 2019-07-03 13:43 UTC (permalink / raw)
  To: igt-dev

This macro is defined in two tests. We can move it to common place
in ioctl_wrappers, which is included by all tests.
v2: Missed intel_device_info lib. Moved BIT definition to
intel_chipset, which is part of igt.h

Signed-off-by: Lukasz Kalamarz <lukasz.kalamarz@intel.com>
Cc: Katarzyna Dec <katarzyna.dec@intel.com>
Cc: Michal Winiarski <michal.winiarski@intel.com>
---
 lib/intel_chipset.h            | 2 ++
 lib/intel_device_info.c        | 2 --
 tests/i915/gem_ctx_isolation.c | 1 -
 tests/i915/gem_ctx_param.c     | 2 --
 4 files changed, 2 insertions(+), 5 deletions(-)

diff --git a/lib/intel_chipset.h b/lib/intel_chipset.h
index 7fc9bd77..74a40a46 100644
--- a/lib/intel_chipset.h
+++ b/lib/intel_chipset.h
@@ -31,6 +31,8 @@
 #include <pciaccess.h>
 #include <stdbool.h>
 
+#define BIT(x) (1ul <<(x))
+
 struct pci_device *intel_get_pci_device(void);
 uint32_t intel_get_drm_devid(int fd);
 
diff --git a/lib/intel_device_info.c b/lib/intel_device_info.c
index 88be2917..be192b61 100644
--- a/lib/intel_device_info.c
+++ b/lib/intel_device_info.c
@@ -3,8 +3,6 @@
 
 #include <strings.h> /* ffs() */
 
-#define BIT(x) (1<<(x))
-
 static const struct intel_device_info intel_generic_info = {
 	.gen = 0,
 };
diff --git a/tests/i915/gem_ctx_isolation.c b/tests/i915/gem_ctx_isolation.c
index 5b054c81..c4302394 100644
--- a/tests/i915/gem_ctx_isolation.c
+++ b/tests/i915/gem_ctx_isolation.c
@@ -33,7 +33,6 @@
 #define DIRTY2 0x2
 #define RESET 0x4
 
-#define BIT(x) (1ul << (x))
 #define ENGINE(x, y) BIT(4*(x) + (y))
 
 enum {
diff --git a/tests/i915/gem_ctx_param.c b/tests/i915/gem_ctx_param.c
index fa0ab520..bd1ee399 100644
--- a/tests/i915/gem_ctx_param.c
+++ b/tests/i915/gem_ctx_param.c
@@ -32,8 +32,6 @@
 
 IGT_TEST_DESCRIPTION("Basic test for context set/get param input validation.");
 
-#define BIT(x) (1ul << (x))
-
 #define NEW_CTX	BIT(0)
 #define USER BIT(1)
 
-- 
2.20.1

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [igt-dev] ✓ Fi.CI.BAT: success for series starting with [i-g-t,v2,1/2] tools/intel_dump_audion: Rename BIT macros to REG_BIT
  2019-07-03 13:43 [igt-dev] [PATCH i-g-t v2 1/2] tools/intel_dump_audion: Rename BIT macros to REG_BIT Lukasz Kalamarz
  2019-07-03 13:43 ` [igt-dev] [PATCH i-g-t v2 2/2] lib/intel_chipset: Move BIT macro to common place Lukasz Kalamarz
@ 2019-07-03 14:20 ` Patchwork
  2019-07-04  6:07 ` [igt-dev] [PATCH i-g-t v2 1/2] " Katarzyna Dec
  2019-07-04 12:59 ` [igt-dev] ✗ Fi.CI.IGT: failure for series starting with [i-g-t,v2,1/2] " Patchwork
  3 siblings, 0 replies; 7+ messages in thread
From: Patchwork @ 2019-07-03 14:20 UTC (permalink / raw)
  To: Lukasz Kalamarz; +Cc: igt-dev

== Series Details ==

Series: series starting with [i-g-t,v2,1/2] tools/intel_dump_audion: Rename BIT macros to REG_BIT
URL   : https://patchwork.freedesktop.org/series/63136/
State : success

== Summary ==

CI Bug Log - changes from IGT_5081 -> IGTPW_3233
====================================================

Summary
-------

  **SUCCESS**

  No regressions found.

  External URL: https://patchwork.freedesktop.org/api/1.0/series/63136/revisions/1/mbox/

Known issues
------------

  Here are the changes found in IGTPW_3233 that come from known issues:

### IGT changes ###

#### Issues hit ####

  * igt@gem_exec_suspend@basic-s3:
    - fi-blb-e6850:       [PASS][1] -> [INCOMPLETE][2] ([fdo#107718])
   [1]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_5081/fi-blb-e6850/igt@gem_exec_suspend@basic-s3.html
   [2]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3233/fi-blb-e6850/igt@gem_exec_suspend@basic-s3.html

  * igt@kms_frontbuffer_tracking@basic:
    - fi-icl-u3:          [PASS][3] -> [FAIL][4] ([fdo#103167])
   [3]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_5081/fi-icl-u3/igt@kms_frontbuffer_tracking@basic.html
   [4]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3233/fi-icl-u3/igt@kms_frontbuffer_tracking@basic.html

  * igt@prime_vgem@basic-busy-default:
    - fi-icl-u3:          [PASS][5] -> [DMESG-WARN][6] ([fdo#107724]) +1 similar issue
   [5]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_5081/fi-icl-u3/igt@prime_vgem@basic-busy-default.html
   [6]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3233/fi-icl-u3/igt@prime_vgem@basic-busy-default.html

  
#### Possible fixes ####

  * igt@i915_selftest@live_contexts:
    - fi-skl-iommu:       [INCOMPLETE][7] -> [PASS][8]
   [7]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_5081/fi-skl-iommu/igt@i915_selftest@live_contexts.html
   [8]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3233/fi-skl-iommu/igt@i915_selftest@live_contexts.html

  * igt@kms_chamelium@hdmi-hpd-fast:
    - fi-kbl-7500u:       [FAIL][9] ([fdo#109485]) -> [PASS][10]
   [9]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_5081/fi-kbl-7500u/igt@kms_chamelium@hdmi-hpd-fast.html
   [10]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3233/fi-kbl-7500u/igt@kms_chamelium@hdmi-hpd-fast.html

  * igt@kms_frontbuffer_tracking@basic:
    - fi-hsw-peppy:       [DMESG-WARN][11] ([fdo#102614]) -> [PASS][12]
   [11]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_5081/fi-hsw-peppy/igt@kms_frontbuffer_tracking@basic.html
   [12]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3233/fi-hsw-peppy/igt@kms_frontbuffer_tracking@basic.html

  
  [fdo#102614]: https://bugs.freedesktop.org/show_bug.cgi?id=102614
  [fdo#103167]: https://bugs.freedesktop.org/show_bug.cgi?id=103167
  [fdo#107718]: https://bugs.freedesktop.org/show_bug.cgi?id=107718
  [fdo#107724]: https://bugs.freedesktop.org/show_bug.cgi?id=107724
  [fdo#109485]: https://bugs.freedesktop.org/show_bug.cgi?id=109485


Participating hosts (55 -> 46)
------------------------------

  Missing    (9): fi-kbl-soraka fi-ilk-m540 fi-hsw-4200u fi-byt-squawks fi-bsw-cyan fi-icl-y fi-icl-guc fi-byt-clapper fi-bdw-samus 


Build changes
-------------

  * IGT: IGT_5081 -> IGTPW_3233

  CI_DRM_6404: 1b853e6e181c6015faca908b57956ea836e1f440 @ git://anongit.freedesktop.org/gfx-ci/linux
  IGTPW_3233: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3233/
  IGT_5081: 6ccba39a4395a5bf92add495ab77d3973e05dd2b @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3233/
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [igt-dev] [PATCH i-g-t v2 1/2] tools/intel_dump_audion: Rename BIT macros to REG_BIT
  2019-07-03 13:43 [igt-dev] [PATCH i-g-t v2 1/2] tools/intel_dump_audion: Rename BIT macros to REG_BIT Lukasz Kalamarz
  2019-07-03 13:43 ` [igt-dev] [PATCH i-g-t v2 2/2] lib/intel_chipset: Move BIT macro to common place Lukasz Kalamarz
  2019-07-03 14:20 ` [igt-dev] ✓ Fi.CI.BAT: success for series starting with [i-g-t,v2,1/2] tools/intel_dump_audion: Rename BIT macros to REG_BIT Patchwork
@ 2019-07-04  6:07 ` Katarzyna Dec
  2019-07-04 12:59 ` [igt-dev] ✗ Fi.CI.IGT: failure for series starting with [i-g-t,v2,1/2] " Patchwork
  3 siblings, 0 replies; 7+ messages in thread
From: Katarzyna Dec @ 2019-07-04  6:07 UTC (permalink / raw)
  To: Lukasz Kalamarz, igt-dev; +Cc: Wu Fengguang, Zhenyu Wang

On Wed, Jul 03, 2019 at 03:43:02PM +0200, Lukasz Kalamarz wrote:
> In kernel macro BIT is used to set value 1 on a given BIT, while in
> this tool it was checking value of given bit in register.
> So it was renamed.
> 
> Signed-off-by: Lukasz Kalamarz <lukasz.kalamarz@intel.com>
> Cc: Zhenyu Wang <zhenyu.z.wang@intel.com>
> Cc: Wu Fengguang <fengguang.wu@intel.com>
> Cc: Katarzyna Dec <katarzyna.dec@intel.com>
> Cc: Michal Winiarski <michal.winiarski@intel.com>
> ---
>  tools/intel_audio_dump.c | 1136 +++++++++++++++++++-------------------
>  1 file changed, 568 insertions(+), 568 deletions(-)
> 
> diff --git a/tools/intel_audio_dump.c b/tools/intel_audio_dump.c
> index 90260a2f..726bb4b6 100644
> --- a/tools/intel_audio_dump.c
> +++ b/tools/intel_audio_dump.c
> @@ -46,8 +46,8 @@ static int disp_reg_base = 0;	/* base address of display registers */
>  
>  #define BITSTO(n)		(n >= sizeof(long) * 8 ? ~0 : (1UL << (n)) - 1)
>  #define BITMASK(high, low)	(BITSTO(high+1) & ~BITSTO(low))
> -#define BITS(reg, high, low)	(((reg) & (BITMASK(high, low))) >> (low))
> -#define BIT(reg, n)		BITS(reg, n, n)
> +#define REG_BITS(reg, high, low)	(((reg) & (BITMASK(high, low))) >> (low))
> +#define REG_BIT(reg, n)		REG_BITS(reg, n, n)
>  
>  #define min_t(type, x, y) ({                    \
>  		type __min1 = (x);                      \
> @@ -430,11 +430,11 @@ enum {
>  
>  static void do_self_tests(void)
>  {
> -	if (BIT(1, 0) != 1)
> +	if (REG_BIT(1, 0) != 1)
>  		exit(1);
> -	if (BIT(0x80000000, 31) != 1)
> +	if (REG_BIT(0x80000000, 31) != 1)
>  		exit(2);
> -	if (BITS(0xc0000000, 31, 30) != 3)
> +	if (REG_BITS(0xc0000000, 31, 30) != 3)
>  		exit(3);
>  }
>  
> @@ -537,10 +537,10 @@ static void dump_eaglelake(void)
>  	printf("AUD_VID_DID device id\t\t\t0x%x\n", dword & 0xffff);
>  
>  	dword = INREG(AUD_RID);
> -	printf("AUD_RID major revision\t\t\t0x%lx\n", BITS(dword, 23, 20));
> -	printf("AUD_RID minor revision\t\t\t0x%lx\n", BITS(dword, 19, 16));
> -	printf("AUD_RID revision id\t\t\t0x%lx\n",    BITS(dword, 15, 8));
> -	printf("AUD_RID stepping id\t\t\t0x%lx\n",    BITS(dword, 7, 0));
> +	printf("AUD_RID major revision\t\t\t0x%lx\n", REG_BITS(dword, 23, 20));
> +	printf("AUD_RID minor revision\t\t\t0x%lx\n", REG_BITS(dword, 19, 16));
> +	printf("AUD_RID revision id\t\t\t0x%lx\n",    REG_BITS(dword, 15, 8));
> +	printf("AUD_RID stepping id\t\t\t0x%lx\n",    REG_BITS(dword, 7, 0));
>  
>  	dword = INREG(SDVOB);
>  	printf("SDVOB enable\t\t\t\t%u\n",      !!(dword & SDVO_ENABLE));
> @@ -557,180 +557,180 @@ static void dump_eaglelake(void)
>  	printf("SDVOC audio enabled\t\t\t%u\n", !!(dword & SDVO_AUDIO_ENABLE));
>  
>  	dword = INREG(PORT_HOTPLUG_EN);
> -	printf("PORT_HOTPLUG_EN DisplayPort/HDMI port B\t%ld\n", BIT(dword, 29)),
> -	printf("PORT_HOTPLUG_EN DisplayPort/HDMI port C\t%ld\n", BIT(dword, 28)),
> -	printf("PORT_HOTPLUG_EN DisplayPort port D\t%ld\n",      BIT(dword, 27)),
> -	printf("PORT_HOTPLUG_EN SDVOB\t\t\t%ld\n", BIT(dword, 26)),
> -	printf("PORT_HOTPLUG_EN SDVOC\t\t\t%ld\n", BIT(dword, 25)),
> -	printf("PORT_HOTPLUG_EN audio\t\t\t%ld\n", BIT(dword, 24)),
> -	printf("PORT_HOTPLUG_EN TV\t\t\t%ld\n",    BIT(dword, 23)),
> -	printf("PORT_HOTPLUG_EN CRT\t\t\t%ld\n",   BIT(dword, 9)),
> +	printf("PORT_HOTPLUG_EN DisplayPort/HDMI port B\t%ld\n", REG_BIT(dword, 29)),
> +	printf("PORT_HOTPLUG_EN DisplayPort/HDMI port C\t%ld\n", REG_BIT(dword, 28)),
> +	printf("PORT_HOTPLUG_EN DisplayPort port D\t%ld\n",      REG_BIT(dword, 27)),
> +	printf("PORT_HOTPLUG_EN SDVOB\t\t\t%ld\n", REG_BIT(dword, 26)),
> +	printf("PORT_HOTPLUG_EN SDVOC\t\t\t%ld\n", REG_BIT(dword, 25)),
> +	printf("PORT_HOTPLUG_EN audio\t\t\t%ld\n", REG_BIT(dword, 24)),
> +	printf("PORT_HOTPLUG_EN TV\t\t\t%ld\n",    REG_BIT(dword, 23)),
> +	printf("PORT_HOTPLUG_EN CRT\t\t\t%ld\n",   REG_BIT(dword, 9)),
>  
>  	dword = INREG(VIDEO_DIP_CTL);
> -	printf("VIDEO_DIP_CTL enable graphics DIP\t%ld\n",     BIT(dword, 31)),
> +	printf("VIDEO_DIP_CTL enable graphics DIP\t%ld\n",     REG_BIT(dword, 31)),
>  	printf("VIDEO_DIP_CTL port select\t\t[0x%lx] %s\n",
> -				BITS(dword, 30, 29), dip_port[BITS(dword, 30, 29)]);
> -	printf("VIDEO_DIP_CTL DIP buffer trans active\t%lu\n", BIT(dword, 28));
> -	printf("VIDEO_DIP_CTL AVI DIP enabled\t\t%lu\n",       BIT(dword, 21));
> -	printf("VIDEO_DIP_CTL vendor DIP enabled\t%lu\n",      BIT(dword, 22));
> -	printf("VIDEO_DIP_CTL SPD DIP enabled\t\t%lu\n",       BIT(dword, 24));
> +				REG_BITS(dword, 30, 29), dip_port[REG_BITS(dword, 30, 29)]);
> +	printf("VIDEO_DIP_CTL DIP buffer trans active\t%lu\n", REG_BIT(dword, 28));
> +	printf("VIDEO_DIP_CTL AVI DIP enabled\t\t%lu\n",       REG_BIT(dword, 21));
> +	printf("VIDEO_DIP_CTL vendor DIP enabled\t%lu\n",      REG_BIT(dword, 22));
> +	printf("VIDEO_DIP_CTL SPD DIP enabled\t\t%lu\n",       REG_BIT(dword, 24));
>  	printf("VIDEO_DIP_CTL DIP buffer index\t\t[0x%lx] %s\n",
> -			BITS(dword, 20, 19), video_dip_index[BITS(dword, 20, 19)]);
> +			REG_BITS(dword, 20, 19), video_dip_index[REG_BITS(dword, 20, 19)]);
>  	printf("VIDEO_DIP_CTL DIP trans freq\t\t[0x%lx] %s\n",
> -			BITS(dword, 17, 16), video_dip_trans[BITS(dword, 17, 16)]);
> -	printf("VIDEO_DIP_CTL DIP buffer size\t\t%lu\n", BITS(dword, 11, 8));
> -	printf("VIDEO_DIP_CTL DIP address\t\t%lu\n", BITS(dword, 3, 0));
> +			REG_BITS(dword, 17, 16), video_dip_trans[REG_BITS(dword, 17, 16)]);
> +	printf("VIDEO_DIP_CTL DIP buffer size\t\t%lu\n", REG_BITS(dword, 11, 8));
> +	printf("VIDEO_DIP_CTL DIP address\t\t%lu\n", REG_BITS(dword, 3, 0));
>  
>  	dword = INREG(AUD_CONFIG);
> -	printf("AUD_CONFIG pixel clock\t\t\t[0x%lx] %s\n", BITS(dword, 19, 16),
> -			OPNAME(pixel_clock, BITS(dword, 19, 16)));
> -	printf("AUD_CONFIG fabrication enabled\t\t%lu\n", BITS(dword, 2, 2));
> -	printf("AUD_CONFIG professional use allowed\t%lu\n", BIT(dword, 1));
> -	printf("AUD_CONFIG fuse enabled\t\t\t%lu\n", BIT(dword, 0));
> +	printf("AUD_CONFIG pixel clock\t\t\t[0x%lx] %s\n", REG_BITS(dword, 19, 16),
> +			OPNAME(pixel_clock, REG_BITS(dword, 19, 16)));
> +	printf("AUD_CONFIG fabrication enabled\t\t%lu\n", REG_BITS(dword, 2, 2));
> +	printf("AUD_CONFIG professional use allowed\t%lu\n", REG_BIT(dword, 1));
> +	printf("AUD_CONFIG fuse enabled\t\t\t%lu\n", REG_BIT(dword, 0));
>  
>  	dword = INREG(AUD_DEBUG);
> -	printf("AUD_DEBUG function reset\t\t%lu\n", BIT(dword, 0));
> +	printf("AUD_DEBUG function reset\t\t%lu\n", REG_BIT(dword, 0));
>  
>  	dword = INREG(AUD_SUBN_CNT);
> -	printf("AUD_SUBN_CNT starting node number\t0x%lx\n",  BITS(dword, 23, 16));
> -	printf("AUD_SUBN_CNT total number of nodes\t0x%lx\n", BITS(dword, 7, 0));
> +	printf("AUD_SUBN_CNT starting node number\t0x%lx\n",  REG_BITS(dword, 23, 16));
> +	printf("AUD_SUBN_CNT total number of nodes\t0x%lx\n", REG_BITS(dword, 7, 0));
>  
>  	dword = INREG(AUD_SUBN_CNT2);
> -	printf("AUD_SUBN_CNT2 starting node number\t0x%lx\n",  BITS(dword, 24, 16));
> -	printf("AUD_SUBN_CNT2 total number of nodes\t0x%lx\n", BITS(dword, 7, 0));
> +	printf("AUD_SUBN_CNT2 starting node number\t0x%lx\n",  REG_BITS(dword, 24, 16));
> +	printf("AUD_SUBN_CNT2 total number of nodes\t0x%lx\n", REG_BITS(dword, 7, 0));
>  
>  	dword = INREG(AUD_FUNC_GRP);
> -	printf("AUD_FUNC_GRP unsol capable\t\t%lu\n", BIT(dword, 8));
> -	printf("AUD_FUNC_GRP node type\t\t\t0x%lx\n", BITS(dword, 7, 0));
> +	printf("AUD_FUNC_GRP unsol capable\t\t%lu\n", REG_BIT(dword, 8));
> +	printf("AUD_FUNC_GRP node type\t\t\t0x%lx\n", REG_BITS(dword, 7, 0));
>  
>  	dword = INREG(AUD_GRP_CAP);
> -	printf("AUD_GRP_CAP beep 0\t\t\t%lu\n",       BIT(dword, 16));
> -	printf("AUD_GRP_CAP input delay\t\t\t%lu\n",  BITS(dword, 11, 8));
> -	printf("AUD_GRP_CAP output delay\t\t%lu\n",   BITS(dword, 3, 0));
> +	printf("AUD_GRP_CAP beep 0\t\t\t%lu\n",       REG_BIT(dword, 16));
> +	printf("AUD_GRP_CAP input delay\t\t\t%lu\n",  REG_BITS(dword, 11, 8));
> +	printf("AUD_GRP_CAP output delay\t\t%lu\n",   REG_BITS(dword, 3, 0));
>  
>  	dword = INREG(AUD_PWRST);
>  	printf("AUD_PWRST device power state\t\t%s\n",
> -			power_state[BITS(dword, 5, 4)]);
> +			power_state[REG_BITS(dword, 5, 4)]);
>  	printf("AUD_PWRST device power state setting\t%s\n",
> -			power_state[BITS(dword, 1, 0)]);
> +			power_state[REG_BITS(dword, 1, 0)]);
>  
>  	dword = INREG(AUD_SUPPWR);
> -	printf("AUD_SUPPWR support D0\t\t\t%lu\n", BIT(dword, 0));
> -	printf("AUD_SUPPWR support D1\t\t\t%lu\n", BIT(dword, 1));
> -	printf("AUD_SUPPWR support D2\t\t\t%lu\n", BIT(dword, 2));
> -	printf("AUD_SUPPWR support D3\t\t\t%lu\n", BIT(dword, 3));
> +	printf("AUD_SUPPWR support D0\t\t\t%lu\n", REG_BIT(dword, 0));
> +	printf("AUD_SUPPWR support D1\t\t\t%lu\n", REG_BIT(dword, 1));
> +	printf("AUD_SUPPWR support D2\t\t\t%lu\n", REG_BIT(dword, 2));
> +	printf("AUD_SUPPWR support D3\t\t\t%lu\n", REG_BIT(dword, 3));
>  
>  	dword = INREG(AUD_OUT_CWCAP);
> -	printf("AUD_OUT_CWCAP widget type\t\t0x%lx\n",  BITS(dword, 23, 20));
> -	printf("AUD_OUT_CWCAP sample delay\t\t0x%lx\n", BITS(dword, 19, 16));
> +	printf("AUD_OUT_CWCAP widget type\t\t0x%lx\n",  REG_BITS(dword, 23, 20));
> +	printf("AUD_OUT_CWCAP sample delay\t\t0x%lx\n", REG_BITS(dword, 19, 16));
>  	printf("AUD_OUT_CWCAP channel count\t\t%lu\n",
> -			BITS(dword, 15, 13) * 2 + BIT(dword, 0) + 1);
> -	printf("AUD_OUT_CWCAP L-R swap\t\t\t%lu\n",       BIT(dword, 11));
> -	printf("AUD_OUT_CWCAP power control\t\t%lu\n",    BIT(dword, 10));
> -	printf("AUD_OUT_CWCAP digital\t\t\t%lu\n",        BIT(dword, 9));
> -	printf("AUD_OUT_CWCAP conn list\t\t\t%lu\n",      BIT(dword, 8));
> -	printf("AUD_OUT_CWCAP unsol\t\t\t%lu\n",          BIT(dword, 7));
> -	printf("AUD_OUT_CWCAP mute\t\t\t%lu\n",           BIT(dword, 5));
> -	printf("AUD_OUT_CWCAP format override\t\t%lu\n",  BIT(dword, 4));
> -	printf("AUD_OUT_CWCAP amp param override\t%lu\n", BIT(dword, 3));
> -	printf("AUD_OUT_CWCAP out amp present\t\t%lu\n",  BIT(dword, 2));
> -	printf("AUD_OUT_CWCAP in amp present\t\t%lu\n",   BIT(dword, 1));
> +			REG_BITS(dword, 15, 13) * 2 + REG_BIT(dword, 0) + 1);
> +	printf("AUD_OUT_CWCAP L-R swap\t\t\t%lu\n",       REG_BIT(dword, 11));
> +	printf("AUD_OUT_CWCAP power control\t\t%lu\n",    REG_BIT(dword, 10));
> +	printf("AUD_OUT_CWCAP digital\t\t\t%lu\n",        REG_BIT(dword, 9));
> +	printf("AUD_OUT_CWCAP conn list\t\t\t%lu\n",      REG_BIT(dword, 8));
> +	printf("AUD_OUT_CWCAP unsol\t\t\t%lu\n",          REG_BIT(dword, 7));
> +	printf("AUD_OUT_CWCAP mute\t\t\t%lu\n",           REG_BIT(dword, 5));
> +	printf("AUD_OUT_CWCAP format override\t\t%lu\n",  REG_BIT(dword, 4));
> +	printf("AUD_OUT_CWCAP amp param override\t%lu\n", REG_BIT(dword, 3));
> +	printf("AUD_OUT_CWCAP out amp present\t\t%lu\n",  REG_BIT(dword, 2));
> +	printf("AUD_OUT_CWCAP in amp present\t\t%lu\n",   REG_BIT(dword, 1));
>  
>  	dword = INREG(AUD_OUT_DIG_CNVT);
> -	printf("AUD_OUT_DIG_CNVT SPDIF category\t\t0x%lx\n", BITS(dword, 14, 8));
> -	printf("AUD_OUT_DIG_CNVT SPDIF level\t\t%lu\n",      BIT(dword, 7));
> -	printf("AUD_OUT_DIG_CNVT professional\t\t%lu\n",     BIT(dword, 6));
> -	printf("AUD_OUT_DIG_CNVT non PCM\t\t%lu\n",          BIT(dword, 5));
> -	printf("AUD_OUT_DIG_CNVT copyright asserted\t%lu\n", BIT(dword, 4));
> -	printf("AUD_OUT_DIG_CNVT filter preemphasis\t%lu\n", BIT(dword, 3));
> -	printf("AUD_OUT_DIG_CNVT validity config\t%lu\n",    BIT(dword, 2));
> -	printf("AUD_OUT_DIG_CNVT validity flag\t\t%lu\n",    BIT(dword, 1));
> -	printf("AUD_OUT_DIG_CNVT digital enable\t\t%lu\n",   BIT(dword, 0));
> +	printf("AUD_OUT_DIG_CNVT SPDIF category\t\t0x%lx\n", REG_BITS(dword, 14, 8));
> +	printf("AUD_OUT_DIG_CNVT SPDIF level\t\t%lu\n",      REG_BIT(dword, 7));
> +	printf("AUD_OUT_DIG_CNVT professional\t\t%lu\n",     REG_BIT(dword, 6));
> +	printf("AUD_OUT_DIG_CNVT non PCM\t\t%lu\n",          REG_BIT(dword, 5));
> +	printf("AUD_OUT_DIG_CNVT copyright asserted\t%lu\n", REG_BIT(dword, 4));
> +	printf("AUD_OUT_DIG_CNVT filter preemphasis\t%lu\n", REG_BIT(dword, 3));
> +	printf("AUD_OUT_DIG_CNVT validity config\t%lu\n",    REG_BIT(dword, 2));
> +	printf("AUD_OUT_DIG_CNVT validity flag\t\t%lu\n",    REG_BIT(dword, 1));
> +	printf("AUD_OUT_DIG_CNVT digital enable\t\t%lu\n",   REG_BIT(dword, 0));
>  
>  	dword = INREG(AUD_OUT_CH_STR);
> -	printf("AUD_OUT_CH_STR stream id\t\t0x%lx\n",        BITS(dword, 7, 4));
> -	printf("AUD_OUT_CH_STR lowest channel\t\t%lu\n",     BITS(dword, 3, 0));
> +	printf("AUD_OUT_CH_STR stream id\t\t0x%lx\n",        REG_BITS(dword, 7, 4));
> +	printf("AUD_OUT_CH_STR lowest channel\t\t%lu\n",     REG_BITS(dword, 3, 0));
>  
>  	dword = INREG(AUD_OUT_STR_DESC);
> -	printf("AUD_OUT_STR_DESC stream channels\t%lu\n",    BITS(dword, 3, 0) + 1);
> +	printf("AUD_OUT_STR_DESC stream channels\t%lu\n",    REG_BITS(dword, 3, 0) + 1);
>  	printf("AUD_OUT_STR_DESC Bits per Sample\t[%#lx] %s\n",
> -			BITS(dword, 6, 4), OPNAME(bits_per_sample, BITS(dword, 6, 4)));
> +			REG_BITS(dword, 6, 4), OPNAME(bits_per_sample, REG_BITS(dword, 6, 4)));
>  
>  	dword = INREG(AUD_PINW_CAP);
> -	printf("AUD_PINW_CAP widget type\t\t0x%lx\n",        BITS(dword, 23, 20));
> -	printf("AUD_PINW_CAP sample delay\t\t0x%lx\n",       BITS(dword, 19, 16));
> +	printf("AUD_PINW_CAP widget type\t\t0x%lx\n",        REG_BITS(dword, 23, 20));
> +	printf("AUD_PINW_CAP sample delay\t\t0x%lx\n",       REG_BITS(dword, 19, 16));
>  	printf("AUD_PINW_CAP channel count\t\t%lu\n",
> -			BITS(dword, 15, 13) * 2 + BIT(dword, 0) + 1);
> -	printf("AUD_PINW_CAP HDCP\t\t\t%lu\n",               BIT(dword, 12));
> -	printf("AUD_PINW_CAP L-R swap\t\t\t%lu\n",           BIT(dword, 11));
> -	printf("AUD_PINW_CAP power control\t\t%lu\n",        BIT(dword, 10));
> -	printf("AUD_PINW_CAP digital\t\t\t%lu\n",            BIT(dword, 9));
> -	printf("AUD_PINW_CAP conn list\t\t\t%lu\n",          BIT(dword, 8));
> -	printf("AUD_PINW_CAP unsol\t\t\t%lu\n",              BIT(dword, 7));
> -	printf("AUD_PINW_CAP mute\t\t\t%lu\n",               BIT(dword, 5));
> -	printf("AUD_PINW_CAP format override\t\t%lu\n",      BIT(dword, 4));
> -	printf("AUD_PINW_CAP amp param override\t\t%lu\n",   BIT(dword, 3));
> -	printf("AUD_PINW_CAP out amp present\t\t%lu\n",      BIT(dword, 2));
> -	printf("AUD_PINW_CAP in amp present\t\t%lu\n",       BIT(dword, 1));
> +			REG_BITS(dword, 15, 13) * 2 + REG_BIT(dword, 0) + 1);
> +	printf("AUD_PINW_CAP HDCP\t\t\t%lu\n",               REG_BIT(dword, 12));
> +	printf("AUD_PINW_CAP L-R swap\t\t\t%lu\n",           REG_BIT(dword, 11));
> +	printf("AUD_PINW_CAP power control\t\t%lu\n",        REG_BIT(dword, 10));
> +	printf("AUD_PINW_CAP digital\t\t\t%lu\n",            REG_BIT(dword, 9));
> +	printf("AUD_PINW_CAP conn list\t\t\t%lu\n",          REG_BIT(dword, 8));
> +	printf("AUD_PINW_CAP unsol\t\t\t%lu\n",              REG_BIT(dword, 7));
> +	printf("AUD_PINW_CAP mute\t\t\t%lu\n",               REG_BIT(dword, 5));
> +	printf("AUD_PINW_CAP format override\t\t%lu\n",      REG_BIT(dword, 4));
> +	printf("AUD_PINW_CAP amp param override\t\t%lu\n",   REG_BIT(dword, 3));
> +	printf("AUD_PINW_CAP out amp present\t\t%lu\n",      REG_BIT(dword, 2));
> +	printf("AUD_PINW_CAP in amp present\t\t%lu\n",       REG_BIT(dword, 1));
>  
>  
>  	dword = INREG(AUD_PIN_CAP);
> -	printf("AUD_PIN_CAP EAPD\t\t\t%lu\n",          BIT(dword, 16));
> -	printf("AUD_PIN_CAP HDMI\t\t\t%lu\n",          BIT(dword, 7));
> -	printf("AUD_PIN_CAP output\t\t\t%lu\n",        BIT(dword, 4));
> -	printf("AUD_PIN_CAP presence detect\t\t%lu\n", BIT(dword, 2));
> +	printf("AUD_PIN_CAP EAPD\t\t\t%lu\n",          REG_BIT(dword, 16));
> +	printf("AUD_PIN_CAP HDMI\t\t\t%lu\n",          REG_BIT(dword, 7));
> +	printf("AUD_PIN_CAP output\t\t\t%lu\n",        REG_BIT(dword, 4));
> +	printf("AUD_PIN_CAP presence detect\t\t%lu\n", REG_BIT(dword, 2));
>  
>  	dword = INREG(AUD_PINW_CNTR);
> -	printf("AUD_PINW_CNTR mute status\t\t%lu\n",     BIT(dword, 8));
> -	printf("AUD_PINW_CNTR out enable\t\t%lu\n",      BIT(dword, 6));
> -	printf("AUD_PINW_CNTR amp mute status\t\t%lu\n", BIT(dword, 8));
> -	printf("AUD_PINW_CNTR amp mute status\t\t%lu\n", BIT(dword, 8));
> +	printf("AUD_PINW_CNTR mute status\t\t%lu\n",     REG_BIT(dword, 8));
> +	printf("AUD_PINW_CNTR out enable\t\t%lu\n",      REG_BIT(dword, 6));
> +	printf("AUD_PINW_CNTR amp mute status\t\t%lu\n", REG_BIT(dword, 8));
> +	printf("AUD_PINW_CNTR amp mute status\t\t%lu\n", REG_BIT(dword, 8));
>  	printf("AUD_PINW_CNTR stream type\t\t[0x%lx] %s\n",
> -			BITS(dword, 2, 0),
> -			OPNAME(stream_type, BITS(dword, 2, 0)));
> +			REG_BITS(dword, 2, 0),
> +			OPNAME(stream_type, REG_BITS(dword, 2, 0)));
>  
>  	dword = INREG(AUD_PINW_UNSOLRESP);
> -	printf("AUD_PINW_UNSOLRESP enable unsol resp\t%lu\n", BIT(dword, 31));
> +	printf("AUD_PINW_UNSOLRESP enable unsol resp\t%lu\n", REG_BIT(dword, 31));
>  
>  	dword = INREG(AUD_CNTL_ST);
> -	printf("AUD_CNTL_ST DIP audio enabled\t\t%lu\n", BIT(dword, 21));
> -	printf("AUD_CNTL_ST DIP ACP enabled\t\t%lu\n",   BIT(dword, 22));
> -	printf("AUD_CNTL_ST DIP ISRCx enabled\t\t%lu\n", BIT(dword, 23));
> +	printf("AUD_CNTL_ST DIP audio enabled\t\t%lu\n", REG_BIT(dword, 21));
> +	printf("AUD_CNTL_ST DIP ACP enabled\t\t%lu\n",   REG_BIT(dword, 22));
> +	printf("AUD_CNTL_ST DIP ISRCx enabled\t\t%lu\n", REG_BIT(dword, 23));
>  	printf("AUD_CNTL_ST DIP port select\t\t[0x%lx] %s\n",
> -			BITS(dword, 30, 29), dip_port[BITS(dword, 30, 29)]);
> +			REG_BITS(dword, 30, 29), dip_port[REG_BITS(dword, 30, 29)]);
>  	printf("AUD_CNTL_ST DIP buffer index\t\t[0x%lx] %s\n",
> -			BITS(dword, 20, 18), OPNAME(dip_index, BITS(dword, 20, 18)));
> +			REG_BITS(dword, 20, 18), OPNAME(dip_index, REG_BITS(dword, 20, 18)));
>  	printf("AUD_CNTL_ST DIP trans freq\t\t[0x%lx] %s\n",
> -			BITS(dword, 17, 16), dip_trans[BITS(dword, 17, 16)]);
> -	printf("AUD_CNTL_ST DIP address\t\t\t%lu\n", BITS(dword, 3, 0));
> -	printf("AUD_CNTL_ST CP ready\t\t\t%lu\n",    BIT(dword, 15));
> -	printf("AUD_CNTL_ST ELD valid\t\t\t%lu\n",   BIT(dword, 14));
> -	printf("AUD_CNTL_ST ELD ack\t\t\t%lu\n",     BIT(dword, 4));
> -	printf("AUD_CNTL_ST ELD bufsize\t\t\t%lu\n", BITS(dword, 13, 9));
> -	printf("AUD_CNTL_ST ELD address\t\t\t%lu\n", BITS(dword, 8, 5));
> +			REG_BITS(dword, 17, 16), dip_trans[REG_BITS(dword, 17, 16)]);
> +	printf("AUD_CNTL_ST DIP address\t\t\t%lu\n", REG_BITS(dword, 3, 0));
> +	printf("AUD_CNTL_ST CP ready\t\t\t%lu\n",    REG_BIT(dword, 15));
> +	printf("AUD_CNTL_ST ELD valid\t\t\t%lu\n",   REG_BIT(dword, 14));
> +	printf("AUD_CNTL_ST ELD ack\t\t\t%lu\n",     REG_BIT(dword, 4));
> +	printf("AUD_CNTL_ST ELD bufsize\t\t\t%lu\n", REG_BITS(dword, 13, 9));
> +	printf("AUD_CNTL_ST ELD address\t\t\t%lu\n", REG_BITS(dword, 8, 5));
>  
>  	dword = INREG(AUD_HDMIW_STATUS);
> -	printf("AUD_HDMIW_STATUS CDCLK/DOTCLK underrun\t%lu\n", BIT(dword, 31));
> -	printf("AUD_HDMIW_STATUS CDCLK/DOTCLK overrun\t%lu\n",  BIT(dword, 30));
> -	printf("AUD_HDMIW_STATUS BCLK/CDCLK underrun\t%lu\n",   BIT(dword, 29));
> -	printf("AUD_HDMIW_STATUS BCLK/CDCLK overrun\t%lu\n",    BIT(dword, 28));
> +	printf("AUD_HDMIW_STATUS CDCLK/DOTCLK underrun\t%lu\n", REG_BIT(dword, 31));
> +	printf("AUD_HDMIW_STATUS CDCLK/DOTCLK overrun\t%lu\n",  REG_BIT(dword, 30));
> +	printf("AUD_HDMIW_STATUS BCLK/CDCLK underrun\t%lu\n",   REG_BIT(dword, 29));
> +	printf("AUD_HDMIW_STATUS BCLK/CDCLK overrun\t%lu\n",    REG_BIT(dword, 28));
>  
>  	dword = INREG(AUD_CONV_CHCNT);
> -	printf("AUD_CONV_CHCNT HDMI HBR enabled\t\t%lu\n", BITS(dword, 15, 14));
> -	printf("AUD_CONV_CHCNT HDMI channel count\t%lu\n", BITS(dword, 11, 8) + 1);
> +	printf("AUD_CONV_CHCNT HDMI HBR enabled\t\t%lu\n", REG_BITS(dword, 15, 14));
> +	printf("AUD_CONV_CHCNT HDMI channel count\t%lu\n", REG_BITS(dword, 11, 8) + 1);
>  
>  	printf("AUD_CONV_CHCNT HDMI channel mapping:\n");
>  	for (i = 0; i < 8; i++) {
>  		OUTREG(AUD_CONV_CHCNT, i);
>  		dword = INREG(AUD_CONV_CHCNT);
> -		printf("\t\t\t\t\t[0x%x] %u => %lu\n", dword, i, BITS(dword, 7, 4));
> +		printf("\t\t\t\t\t[0x%x] %u => %lu\n", dword, i, REG_BITS(dword, 7, 4));
>  	}
>  
>  	printf("AUD_HDMIW_HDMIEDID HDMI ELD:\n\t");
>  	dword = INREG(AUD_CNTL_ST);
>  	dword &= ~BITMASK(8, 5);
>  	OUTREG(AUD_CNTL_ST, dword);
> -	for (i = 0; i < BITS(dword, 14, 10) / 4; i++)
> +	for (i = 0; i < REG_BITS(dword, 14, 10) / 4; i++)
>  		printf("%08x ", htonl(INREG(AUD_HDMIW_HDMIEDID)));
>  	printf("\n");
>  
> @@ -864,347 +864,347 @@ static void dump_cpt(void)
>  	printf("\nDetails:\n\n");
>  
>  	dword = INREG(VIDEO_DIP_CTL_A);
> -	printf("VIDEO_DIP_CTL_A Enable_Graphics_DIP\t\t\t%ld\n",     BIT(dword, 31)),
> -	printf("VIDEO_DIP_CTL_A GCP_DIP_enable\t\t\t\t%ld\n",     BIT(dword, 25)),
> -	printf("VIDEO_DIP_CTL_A Video_DIP_type_enable AVI\t\t%lu\n",       BIT(dword, 21));
> -	printf("VIDEO_DIP_CTL_A Video_DIP_type_enable Vendor\t\t%lu\n",      BIT(dword, 22));
> -	printf("VIDEO_DIP_CTL_A Video_DIP_type_enable Gamut\t\t%lu\n",       BIT(dword, 23));
> -	printf("VIDEO_DIP_CTL_A Video_DIP_type_enable Source \t\t%lu\n",       BIT(dword, 24));
> +	printf("VIDEO_DIP_CTL_A Enable_Graphics_DIP\t\t\t%ld\n",     REG_BIT(dword, 31)),
> +	printf("VIDEO_DIP_CTL_A GCP_DIP_enable\t\t\t\t%ld\n",     REG_BIT(dword, 25)),
> +	printf("VIDEO_DIP_CTL_A Video_DIP_type_enable AVI\t\t%lu\n",       REG_BIT(dword, 21));
> +	printf("VIDEO_DIP_CTL_A Video_DIP_type_enable Vendor\t\t%lu\n",      REG_BIT(dword, 22));
> +	printf("VIDEO_DIP_CTL_A Video_DIP_type_enable Gamut\t\t%lu\n",       REG_BIT(dword, 23));
> +	printf("VIDEO_DIP_CTL_A Video_DIP_type_enable Source \t\t%lu\n",       REG_BIT(dword, 24));
>  	printf("VIDEO_DIP_CTL_A Video_DIP_buffer_index\t\t\t[0x%lx] %s\n",
> -			BITS(dword, 20, 19), video_dip_index[BITS(dword, 20, 19)]);
> +			REG_BITS(dword, 20, 19), video_dip_index[REG_BITS(dword, 20, 19)]);
>  	printf("VIDEO_DIP_CTL_A Video_DIP_frequency\t\t\t[0x%lx] %s\n",
> -			BITS(dword, 17, 16), video_dip_trans[BITS(dword, 17, 16)]);
> -	printf("VIDEO_DIP_CTL_A Video_DIP_buffer_size\t\t\t%lu\n", BITS(dword, 11, 8));
> -	printf("VIDEO_DIP_CTL_A Video_DIP_access_address\t\t%lu\n", BITS(dword, 3, 0));
> +			REG_BITS(dword, 17, 16), video_dip_trans[REG_BITS(dword, 17, 16)]);
> +	printf("VIDEO_DIP_CTL_A Video_DIP_buffer_size\t\t\t%lu\n", REG_BITS(dword, 11, 8));
> +	printf("VIDEO_DIP_CTL_A Video_DIP_access_address\t\t%lu\n", REG_BITS(dword, 3, 0));
>  
>  	dword = INREG(VIDEO_DIP_CTL_B);
> -	printf("VIDEO_DIP_CTL_B Enable_Graphics_DIP\t\t\t%ld\n",     BIT(dword, 31)),
> -	printf("VIDEO_DIP_CTL_B GCP_DIP_enable\t\t\t\t%ld\n",     BIT(dword, 25)),
> -	printf("VIDEO_DIP_CTL_B Video_DIP_type_enable AVI\t\t%lu\n",       BIT(dword, 21));
> -	printf("VIDEO_DIP_CTL_B Video_DIP_type_enable Vendor\t\t%lu\n",      BIT(dword, 22));
> -	printf("VIDEO_DIP_CTL_B Video_DIP_type_enable Gamut\t\t%lu\n",       BIT(dword, 23));
> -	printf("VIDEO_DIP_CTL_B Video_DIP_type_enable Source \t\t%lu\n",       BIT(dword, 24));
> +	printf("VIDEO_DIP_CTL_B Enable_Graphics_DIP\t\t\t%ld\n",     REG_BIT(dword, 31)),
> +	printf("VIDEO_DIP_CTL_B GCP_DIP_enable\t\t\t\t%ld\n",     REG_BIT(dword, 25)),
> +	printf("VIDEO_DIP_CTL_B Video_DIP_type_enable AVI\t\t%lu\n",       REG_BIT(dword, 21));
> +	printf("VIDEO_DIP_CTL_B Video_DIP_type_enable Vendor\t\t%lu\n",      REG_BIT(dword, 22));
> +	printf("VIDEO_DIP_CTL_B Video_DIP_type_enable Gamut\t\t%lu\n",       REG_BIT(dword, 23));
> +	printf("VIDEO_DIP_CTL_B Video_DIP_type_enable Source \t\t%lu\n",       REG_BIT(dword, 24));
>  	printf("VIDEO_DIP_CTL_B Video_DIP_buffer_index\t\t\t[0x%lx] %s\n",
> -			BITS(dword, 20, 19), video_dip_index[BITS(dword, 20, 19)]);
> +			REG_BITS(dword, 20, 19), video_dip_index[REG_BITS(dword, 20, 19)]);
>  	printf("VIDEO_DIP_CTL_B Video_DIP_frequency\t\t\t[0x%lx] %s\n",
> -			BITS(dword, 17, 16), video_dip_trans[BITS(dword, 17, 16)]);
> -	printf("VIDEO_DIP_CTL_B Video_DIP_buffer_size\t\t\t%lu\n", BITS(dword, 11, 8));
> -	printf("VIDEO_DIP_CTL_B Video_DIP_access_address\t\t%lu\n", BITS(dword, 3, 0));
> +			REG_BITS(dword, 17, 16), video_dip_trans[REG_BITS(dword, 17, 16)]);
> +	printf("VIDEO_DIP_CTL_B Video_DIP_buffer_size\t\t\t%lu\n", REG_BITS(dword, 11, 8));
> +	printf("VIDEO_DIP_CTL_B Video_DIP_access_address\t\t%lu\n", REG_BITS(dword, 3, 0));
>  
>  	dword = INREG(VIDEO_DIP_CTL_C);
> -	printf("VIDEO_DIP_CTL_C Enable_Graphics_DIP\t\t\t%ld\n",     BIT(dword, 31)),
> -	printf("VIDEO_DIP_CTL_C GCP_DIP_enable\t\t\t\t%ld\n",     BIT(dword, 25)),
> -	printf("VIDEO_DIP_CTL_C Video_DIP_type_enable AVI\t\t%lu\n",       BIT(dword, 21));
> -	printf("VIDEO_DIP_CTL_C Video_DIP_type_enable Vendor\t\t%lu\n",      BIT(dword, 22));
> -	printf("VIDEO_DIP_CTL_C Video_DIP_type_enable Gamut\t\t%lu\n",       BIT(dword, 23));
> -	printf("VIDEO_DIP_CTL_C Video_DIP_type_enable Source \t\t%lu\n",       BIT(dword, 24));
> +	printf("VIDEO_DIP_CTL_C Enable_Graphics_DIP\t\t\t%ld\n",     REG_BIT(dword, 31)),
> +	printf("VIDEO_DIP_CTL_C GCP_DIP_enable\t\t\t\t%ld\n",     REG_BIT(dword, 25)),
> +	printf("VIDEO_DIP_CTL_C Video_DIP_type_enable AVI\t\t%lu\n",       REG_BIT(dword, 21));
> +	printf("VIDEO_DIP_CTL_C Video_DIP_type_enable Vendor\t\t%lu\n",      REG_BIT(dword, 22));
> +	printf("VIDEO_DIP_CTL_C Video_DIP_type_enable Gamut\t\t%lu\n",       REG_BIT(dword, 23));
> +	printf("VIDEO_DIP_CTL_C Video_DIP_type_enable Source \t\t%lu\n",       REG_BIT(dword, 24));
>  	printf("VIDEO_DIP_CTL_C Video_DIP_buffer_index\t\t\t[0x%lx] %s\n",
> -			BITS(dword, 20, 19), video_dip_index[BITS(dword, 20, 19)]);
> +			REG_BITS(dword, 20, 19), video_dip_index[REG_BITS(dword, 20, 19)]);
>  	printf("VIDEO_DIP_CTL_C Video_DIP_frequency\t\t\t[0x%lx] %s\n",
> -			BITS(dword, 17, 16), video_dip_trans[BITS(dword, 17, 16)]);
> -	printf("VIDEO_DIP_CTL_C Video_DIP_buffer_size\t\t\t%lu\n", BITS(dword, 11, 8));
> -	printf("VIDEO_DIP_CTL_C Video_DIP_access_address\t\t%lu\n", BITS(dword, 3, 0));
> +			REG_BITS(dword, 17, 16), video_dip_trans[REG_BITS(dword, 17, 16)]);
> +	printf("VIDEO_DIP_CTL_C Video_DIP_buffer_size\t\t\t%lu\n", REG_BITS(dword, 11, 8));
> +	printf("VIDEO_DIP_CTL_C Video_DIP_access_address\t\t%lu\n", REG_BITS(dword, 3, 0));
>  
>  	dword = INREG(AUD_VID_DID);
>  	printf("AUD_VID_DID vendor id\t\t\t\t\t0x%x\n", dword >> 16);
>  	printf("AUD_VID_DID device id\t\t\t\t\t0x%x\n", dword & 0xffff);
>  
>  	dword = INREG(AUD_RID);
> -	printf("AUD_RID Major_Revision\t\t\t\t\t0x%lx\n", BITS(dword, 23, 20));
> -	printf("AUD_RID Minor_Revision\t\t\t\t\t0x%lx\n", BITS(dword, 19, 16));
> -	printf("AUD_RID Revision_Id\t\t\t\t\t0x%lx\n",    BITS(dword, 15, 8));
> -	printf("AUD_RID Stepping_Id\t\t\t\t\t0x%lx\n",    BITS(dword, 7, 0));
> +	printf("AUD_RID Major_Revision\t\t\t\t\t0x%lx\n", REG_BITS(dword, 23, 20));
> +	printf("AUD_RID Minor_Revision\t\t\t\t\t0x%lx\n", REG_BITS(dword, 19, 16));
> +	printf("AUD_RID Revision_Id\t\t\t\t\t0x%lx\n",    REG_BITS(dword, 15, 8));
> +	printf("AUD_RID Stepping_Id\t\t\t\t\t0x%lx\n",    REG_BITS(dword, 7, 0));
>  
>  	dword = INREG(HDMIB);
>  	printf("HDMIB Port_Enable\t\t\t\t\t%u\n",      !!(dword & SDVO_ENABLE));
>  	printf("HDMIB Transcoder_Select\t\t\t\t\t[0x%lx] %s\n",
> -			BITS(dword, 30, 29), transcoder_select[BITS(dword, 30, 29)]);
> -	printf("HDMIB sDVO_Border_Enable\t\t\t\t%lu\n", BIT(dword, 7));
> -	printf("HDMIB HDCP_Port_Select\t\t\t\t\t%lu\n", BIT(dword, 5));
> -	printf("HDMIB SDVO_HPD_Interrupt_Enable\t\t\t\t%lu\n", BIT(dword, 23));
> -	printf("HDMIB Port_Detected\t\t\t\t\t%lu\n", BIT(dword, 2));
> +			REG_BITS(dword, 30, 29), transcoder_select[REG_BITS(dword, 30, 29)]);
> +	printf("HDMIB sDVO_Border_Enable\t\t\t\t%lu\n", REG_BIT(dword, 7));
> +	printf("HDMIB HDCP_Port_Select\t\t\t\t\t%lu\n", REG_BIT(dword, 5));
> +	printf("HDMIB SDVO_HPD_Interrupt_Enable\t\t\t\t%lu\n", REG_BIT(dword, 23));
> +	printf("HDMIB Port_Detected\t\t\t\t\t%lu\n", REG_BIT(dword, 2));
>  	printf("HDMIB Encoding\t\t\t\t\t\t[0x%lx] %s\n",
> -			BITS(dword, 11, 10), sdvo_hdmi_encoding[BITS(dword, 11, 10)]);
> -	printf("HDMIB HDMI_or_DVI_Select\t\t\t\t%s\n", BIT(dword, 9) ? "HDMI" : "DVI");
> +			REG_BITS(dword, 11, 10), sdvo_hdmi_encoding[REG_BITS(dword, 11, 10)]);
> +	printf("HDMIB HDMI_or_DVI_Select\t\t\t\t%s\n", REG_BIT(dword, 9) ? "HDMI" : "DVI");
>  	printf("HDMIB Audio_Output_Enable\t\t\t\t%u\n", !!(dword & SDVO_AUDIO_ENABLE));
>  
>  	dword = INREG(HDMIC);
>  	printf("HDMIC Port_Enable\t\t\t\t\t%u\n",      !!(dword & SDVO_ENABLE));
>  	printf("HDMIC Transcoder_Select\t\t\t\t\t[0x%lx] %s\n",
> -			BITS(dword, 30, 29), transcoder_select[BITS(dword, 30, 29)]);
> -	printf("HDMIC sDVO_Border_Enable\t\t\t\t%lu\n", BIT(dword, 7));
> -	printf("HDMIC HDCP_Port_Select\t\t\t\t\t%lu\n", BIT(dword, 5));
> -	printf("HDMIC SDVO_HPD_Interrupt_Enable\t\t\t\t%lu\n", BIT(dword, 23));
> -	printf("HDMIC Port_Detected\t\t\t\t\t%lu\n", BIT(dword, 2));
> +			REG_BITS(dword, 30, 29), transcoder_select[REG_BITS(dword, 30, 29)]);
> +	printf("HDMIC sDVO_Border_Enable\t\t\t\t%lu\n", REG_BIT(dword, 7));
> +	printf("HDMIC HDCP_Port_Select\t\t\t\t\t%lu\n", REG_BIT(dword, 5));
> +	printf("HDMIC SDVO_HPD_Interrupt_Enable\t\t\t\t%lu\n", REG_BIT(dword, 23));
> +	printf("HDMIC Port_Detected\t\t\t\t\t%lu\n", REG_BIT(dword, 2));
>  	printf("HDMIC Encoding\t\t\t\t\t\t[0x%lx] %s\n",
> -			BITS(dword, 11, 10), sdvo_hdmi_encoding[BITS(dword, 11, 10)]);
> -	printf("HDMIC HDMI_or_DVI_Select\t\t\t\t%s\n", BIT(dword, 9) ? "HDMI" : "DVI");
> +			REG_BITS(dword, 11, 10), sdvo_hdmi_encoding[REG_BITS(dword, 11, 10)]);
> +	printf("HDMIC HDMI_or_DVI_Select\t\t\t\t%s\n", REG_BIT(dword, 9) ? "HDMI" : "DVI");
>  	printf("HDMIC Audio_Output_Enable\t\t\t\t%u\n", !!(dword & SDVO_AUDIO_ENABLE));
>  
>  	dword = INREG(HDMID);
>  	printf("HDMID Port_Enable\t\t\t\t\t%u\n",      !!(dword & SDVO_ENABLE));
>  	printf("HDMID Transcoder_Select\t\t\t\t\t[0x%lx] %s\n",
> -			BITS(dword, 30, 29), transcoder_select[BITS(dword, 30, 29)]);
> -	printf("HDMID sDVO_Border_Enable\t\t\t\t%lu\n", BIT(dword, 7));
> -	printf("HDMID HDCP_Port_Select\t\t\t\t\t%lu\n", BIT(dword, 5));
> -	printf("HDMID SDVO_HPD_Interrupt_Enable\t\t\t\t%lu\n", BIT(dword, 23));
> -	printf("HDMID Port_Detected\t\t\t\t\t%lu\n", BIT(dword, 2));
> +			REG_BITS(dword, 30, 29), transcoder_select[REG_BITS(dword, 30, 29)]);
> +	printf("HDMID sDVO_Border_Enable\t\t\t\t%lu\n", REG_BIT(dword, 7));
> +	printf("HDMID HDCP_Port_Select\t\t\t\t\t%lu\n", REG_BIT(dword, 5));
> +	printf("HDMID SDVO_HPD_Interrupt_Enable\t\t\t\t%lu\n", REG_BIT(dword, 23));
> +	printf("HDMID Port_Detected\t\t\t\t\t%lu\n", REG_BIT(dword, 2));
>  	printf("HDMID Encoding\t\t\t\t\t\t[0x%lx] %s\n",
> -			BITS(dword, 11, 10), sdvo_hdmi_encoding[BITS(dword, 11, 10)]);
> -	printf("HDMID HDMI_or_DVI_Select\t\t\t\t%s\n", BIT(dword, 9) ? "HDMI" : "DVI");
> +			REG_BITS(dword, 11, 10), sdvo_hdmi_encoding[REG_BITS(dword, 11, 10)]);
> +	printf("HDMID HDMI_or_DVI_Select\t\t\t\t%s\n", REG_BIT(dword, 9) ? "HDMI" : "DVI");
>  	printf("HDMID Audio_Output_Enable\t\t\t\t%u\n", !!(dword & SDVO_AUDIO_ENABLE));
>  
>  	dword = INREG(DP_CTL_B);
> -	printf("DP_CTL_B DisplayPort_Enable\t\t\t\t%lu\n", BIT(dword, 31));
> +	printf("DP_CTL_B DisplayPort_Enable\t\t\t\t%lu\n", REG_BIT(dword, 31));
>  	printf("DP_CTL_B Port_Width_Selection\t\t\t\t[0x%lx] %s\n",
> -			BITS(dword, 21, 19), dp_port_width[BITS(dword, 21, 19)]);
> -	printf("DP_CTL_B Port_Detected\t\t\t\t\t%lu\n", BIT(dword, 2));
> -	printf("DP_CTL_B HDCP_Port_Select\t\t\t\t%lu\n", BIT(dword, 5));
> -	printf("DP_CTL_B Audio_Output_Enable\t\t\t\t%lu\n", BIT(dword, 6));
> +			REG_BITS(dword, 21, 19), dp_port_width[REG_BITS(dword, 21, 19)]);
> +	printf("DP_CTL_B Port_Detected\t\t\t\t\t%lu\n", REG_BIT(dword, 2));
> +	printf("DP_CTL_B HDCP_Port_Select\t\t\t\t%lu\n", REG_BIT(dword, 5));
> +	printf("DP_CTL_B Audio_Output_Enable\t\t\t\t%lu\n", REG_BIT(dword, 6));
>  
>  	dword = INREG(DP_CTL_C);
> -	printf("DP_CTL_C DisplayPort_Enable\t\t\t\t%lu\n", BIT(dword, 31));
> +	printf("DP_CTL_C DisplayPort_Enable\t\t\t\t%lu\n", REG_BIT(dword, 31));
>  	printf("DP_CTL_C Port_Width_Selection\t\t\t\t[0x%lx] %s\n",
> -			BITS(dword, 21, 19), dp_port_width[BITS(dword, 21, 19)]);
> -	printf("DP_CTL_C Port_Detected\t\t\t\t\t%lu\n", BIT(dword, 2));
> -	printf("DP_CTL_C HDCP_Port_Select\t\t\t\t%lu\n", BIT(dword, 5));
> -	printf("DP_CTL_C Audio_Output_Enable\t\t\t\t%lu\n", BIT(dword, 6));
> +			REG_BITS(dword, 21, 19), dp_port_width[REG_BITS(dword, 21, 19)]);
> +	printf("DP_CTL_C Port_Detected\t\t\t\t\t%lu\n", REG_BIT(dword, 2));
> +	printf("DP_CTL_C HDCP_Port_Select\t\t\t\t%lu\n", REG_BIT(dword, 5));
> +	printf("DP_CTL_C Audio_Output_Enable\t\t\t\t%lu\n", REG_BIT(dword, 6));
>  
>  	dword = INREG(DP_CTL_D);
> -	printf("DP_CTL_D DisplayPort_Enable\t\t\t\t%lu\n", BIT(dword, 31));
> +	printf("DP_CTL_D DisplayPort_Enable\t\t\t\t%lu\n", REG_BIT(dword, 31));
>  	printf("DP_CTL_D Port_Width_Selection\t\t\t\t[0x%lx] %s\n",
> -			BITS(dword, 21, 19), dp_port_width[BITS(dword, 21, 19)]);
> -	printf("DP_CTL_D Port_Detected\t\t\t\t\t%lu\n", BIT(dword, 2));
> -	printf("DP_CTL_D HDCP_Port_Select\t\t\t\t%lu\n", BIT(dword, 5));
> -	printf("DP_CTL_D Audio_Output_Enable\t\t\t\t%lu\n", BIT(dword, 6));
> +			REG_BITS(dword, 21, 19), dp_port_width[REG_BITS(dword, 21, 19)]);
> +	printf("DP_CTL_D Port_Detected\t\t\t\t\t%lu\n", REG_BIT(dword, 2));
> +	printf("DP_CTL_D HDCP_Port_Select\t\t\t\t%lu\n", REG_BIT(dword, 5));
> +	printf("DP_CTL_D Audio_Output_Enable\t\t\t\t%lu\n", REG_BIT(dword, 6));
>  
>  	dword = INREG(AUD_CONFIG_A);
> -	printf("AUD_CONFIG_A  N_index_value\t\t\t\t[0x%lx] %s\n", BIT(dword, 29),
> -			n_index_value[BIT(dword, 29)]);
> -	printf("AUD_CONFIG_A  N_programming_enable\t\t\t%lu\n", BIT(dword, 28));
> -	printf("AUD_CONFIG_A  Upper_N_value\t\t\t\t0x%02lx\n", BITS(dword, 27, 20));
> -	printf("AUD_CONFIG_A  Lower_N_value\t\t\t\t0x%03lx\n", BITS(dword, 15, 4));
> -	printf("AUD_CONFIG_A  Pixel_Clock_HDMI\t\t\t\t[0x%lx] %s\n", BITS(dword, 19, 16),
> -			OPNAME(pixel_clock, BITS(dword, 19, 16)));
> -	printf("AUD_CONFIG_A  Disable_NCTS\t\t\t\t%lu\n", BIT(dword, 3));
> +	printf("AUD_CONFIG_A  N_index_value\t\t\t\t[0x%lx] %s\n", REG_BIT(dword, 29),
> +			n_index_value[REG_BIT(dword, 29)]);
> +	printf("AUD_CONFIG_A  N_programming_enable\t\t\t%lu\n", REG_BIT(dword, 28));
> +	printf("AUD_CONFIG_A  Upper_N_value\t\t\t\t0x%02lx\n", REG_BITS(dword, 27, 20));
> +	printf("AUD_CONFIG_A  Lower_N_value\t\t\t\t0x%03lx\n", REG_BITS(dword, 15, 4));
> +	printf("AUD_CONFIG_A  Pixel_Clock_HDMI\t\t\t\t[0x%lx] %s\n", REG_BITS(dword, 19, 16),
> +			OPNAME(pixel_clock, REG_BITS(dword, 19, 16)));
> +	printf("AUD_CONFIG_A  Disable_NCTS\t\t\t\t%lu\n", REG_BIT(dword, 3));
>  	dword = INREG(AUD_CONFIG_B);
> -	printf("AUD_CONFIG_B  N_index_value\t\t\t\t[0x%lx] %s\n", BIT(dword, 29),
> -			n_index_value[BIT(dword, 29)]);
> -	printf("AUD_CONFIG_B  N_programming_enable\t\t\t%lu\n", BIT(dword, 28));
> -	printf("AUD_CONFIG_B  Upper_N_value\t\t\t\t0x%02lx\n", BITS(dword, 27, 20));
> -	printf("AUD_CONFIG_B  Lower_N_value\t\t\t\t0x%03lx\n", BITS(dword, 15, 4));
> -	printf("AUD_CONFIG_B  Pixel_Clock_HDMI\t\t\t\t[0x%lx] %s\n", BITS(dword, 19, 16),
> -			OPNAME(pixel_clock, BITS(dword, 19, 16)));
> -	printf("AUD_CONFIG_B  Disable_NCTS\t\t\t\t%lu\n", BIT(dword, 3));
> +	printf("AUD_CONFIG_B  N_index_value\t\t\t\t[0x%lx] %s\n", REG_BIT(dword, 29),
> +			n_index_value[REG_BIT(dword, 29)]);
> +	printf("AUD_CONFIG_B  N_programming_enable\t\t\t%lu\n", REG_BIT(dword, 28));
> +	printf("AUD_CONFIG_B  Upper_N_value\t\t\t\t0x%02lx\n", REG_BITS(dword, 27, 20));
> +	printf("AUD_CONFIG_B  Lower_N_value\t\t\t\t0x%03lx\n", REG_BITS(dword, 15, 4));
> +	printf("AUD_CONFIG_B  Pixel_Clock_HDMI\t\t\t\t[0x%lx] %s\n", REG_BITS(dword, 19, 16),
> +			OPNAME(pixel_clock, REG_BITS(dword, 19, 16)));
> +	printf("AUD_CONFIG_B  Disable_NCTS\t\t\t\t%lu\n", REG_BIT(dword, 3));
>  	dword = INREG(AUD_CONFIG_C);
> -	printf("AUD_CONFIG_C  N_index_value\t\t\t\t[0x%lx] %s\n", BIT(dword, 29),
> -			n_index_value[BIT(dword, 29)]);
> -	printf("AUD_CONFIG_C  N_programming_enable\t\t\t%lu\n", BIT(dword, 28));
> -	printf("AUD_CONFIG_C  Upper_N_value\t\t\t\t0x%02lx\n", BITS(dword, 27, 20));
> -	printf("AUD_CONFIG_C  Lower_N_value\t\t\t\t0x%03lx\n", BITS(dword, 15, 4));
> -	printf("AUD_CONFIG_C  Pixel_Clock_HDMI\t\t\t\t[0x%lx] %s\n", BITS(dword, 19, 16),
> -			OPNAME(pixel_clock, BITS(dword, 19, 16)));
> -	printf("AUD_CONFIG_C  Disable_NCTS\t\t\t\t%lu\n", BIT(dword, 3));
> +	printf("AUD_CONFIG_C  N_index_value\t\t\t\t[0x%lx] %s\n", REG_BIT(dword, 29),
> +			n_index_value[REG_BIT(dword, 29)]);
> +	printf("AUD_CONFIG_C  N_programming_enable\t\t\t%lu\n", REG_BIT(dword, 28));
> +	printf("AUD_CONFIG_C  Upper_N_value\t\t\t\t0x%02lx\n", REG_BITS(dword, 27, 20));
> +	printf("AUD_CONFIG_C  Lower_N_value\t\t\t\t0x%03lx\n", REG_BITS(dword, 15, 4));
> +	printf("AUD_CONFIG_C  Pixel_Clock_HDMI\t\t\t\t[0x%lx] %s\n", REG_BITS(dword, 19, 16),
> +			OPNAME(pixel_clock, REG_BITS(dword, 19, 16)));
> +	printf("AUD_CONFIG_C  Disable_NCTS\t\t\t\t%lu\n", REG_BIT(dword, 3));
>  
>  	dword = INREG(AUD_CTS_ENABLE_A);
> -	printf("AUD_CTS_ENABLE_A  Enable_CTS_or_M_programming\t\t%lu\n", BIT(dword, 20));
> -	printf("AUD_CTS_ENABLE_A  CTS_M value Index\t\t\t%s\n", BIT(dword, 21) ? "CTS" : "M");
> -	printf("AUD_CTS_ENABLE_A  CTS_programming\t\t\t%#lx\n", BITS(dword, 19, 0));
> +	printf("AUD_CTS_ENABLE_A  Enable_CTS_or_M_programming\t\t%lu\n", REG_BIT(dword, 20));
> +	printf("AUD_CTS_ENABLE_A  CTS_M value Index\t\t\t%s\n", REG_BIT(dword, 21) ? "CTS" : "M");
> +	printf("AUD_CTS_ENABLE_A  CTS_programming\t\t\t%#lx\n", REG_BITS(dword, 19, 0));
>  	dword = INREG(AUD_CTS_ENABLE_B);
> -	printf("AUD_CTS_ENABLE_B  Enable_CTS_or_M_programming\t\t%lu\n", BIT(dword, 20));
> -	printf("AUD_CTS_ENABLE_B  CTS_M value Index\t\t\t%s\n", BIT(dword, 21) ? "CTS" : "M");
> -	printf("AUD_CTS_ENABLE_B  CTS_programming\t\t\t%#lx\n", BITS(dword, 19, 0));
> +	printf("AUD_CTS_ENABLE_B  Enable_CTS_or_M_programming\t\t%lu\n", REG_BIT(dword, 20));
> +	printf("AUD_CTS_ENABLE_B  CTS_M value Index\t\t\t%s\n", REG_BIT(dword, 21) ? "CTS" : "M");
> +	printf("AUD_CTS_ENABLE_B  CTS_programming\t\t\t%#lx\n", REG_BITS(dword, 19, 0));
>  	dword = INREG(AUD_CTS_ENABLE_C);
> -	printf("AUD_CTS_ENABLE_C  Enable_CTS_or_M_programming\t\t%lu\n", BIT(dword, 20));
> -	printf("AUD_CTS_ENABLE_C  CTS_M value Index\t\t\t%s\n", BIT(dword, 21) ? "CTS" : "M");
> -	printf("AUD_CTS_ENABLE_C  CTS_programming\t\t\t%#lx\n", BITS(dword, 19, 0));
> +	printf("AUD_CTS_ENABLE_C  Enable_CTS_or_M_programming\t\t%lu\n", REG_BIT(dword, 20));
> +	printf("AUD_CTS_ENABLE_C  CTS_M value Index\t\t\t%s\n", REG_BIT(dword, 21) ? "CTS" : "M");
> +	printf("AUD_CTS_ENABLE_C  CTS_programming\t\t\t%#lx\n", REG_BITS(dword, 19, 0));
>  
>  	dword = INREG(AUD_MISC_CTRL_A);
> -	printf("AUD_MISC_CTRL_A  Sample_Fabrication_EN_bit\t\t%lu\n",	BIT(dword, 2));
> -	printf("AUD_MISC_CTRL_A  Sample_present_Disable\t\t\t%lu\n",	BIT(dword, 8));
> -	printf("AUD_MISC_CTRL_A  Output_Delay\t\t\t\t%lu\n",		BITS(dword, 7, 4));
> -	printf("AUD_MISC_CTRL_A  Pro_Allowed\t\t\t\t%lu\n",			BIT(dword, 1));
> +	printf("AUD_MISC_CTRL_A  Sample_Fabrication_EN_bit\t\t%lu\n",	REG_BIT(dword, 2));
> +	printf("AUD_MISC_CTRL_A  Sample_present_Disable\t\t\t%lu\n",	REG_BIT(dword, 8));
> +	printf("AUD_MISC_CTRL_A  Output_Delay\t\t\t\t%lu\n",		REG_BITS(dword, 7, 4));
> +	printf("AUD_MISC_CTRL_A  Pro_Allowed\t\t\t\t%lu\n",			REG_BIT(dword, 1));
>  	dword = INREG(AUD_MISC_CTRL_B);
> -	printf("AUD_MISC_CTRL_B  Sample_Fabrication_EN_bit\t\t%lu\n",	BIT(dword, 2));
> -	printf("AUD_MISC_CTRL_B  Sample_present_Disable\t\t\t%lu\n",	BIT(dword, 8));
> -	printf("AUD_MISC_CTRL_B  Output_Delay\t\t\t\t%lu\n",		BITS(dword, 7, 4));
> -	printf("AUD_MISC_CTRL_B  Pro_Allowed\t\t\t\t%lu\n",			BIT(dword, 1));
> +	printf("AUD_MISC_CTRL_B  Sample_Fabrication_EN_bit\t\t%lu\n",	REG_BIT(dword, 2));
> +	printf("AUD_MISC_CTRL_B  Sample_present_Disable\t\t\t%lu\n",	REG_BIT(dword, 8));
> +	printf("AUD_MISC_CTRL_B  Output_Delay\t\t\t\t%lu\n",		REG_BITS(dword, 7, 4));
> +	printf("AUD_MISC_CTRL_B  Pro_Allowed\t\t\t\t%lu\n",			REG_BIT(dword, 1));
>  	dword = INREG(AUD_MISC_CTRL_C);
> -	printf("AUD_MISC_CTRL_C  Sample_Fabrication_EN_bit\t\t%lu\n",	BIT(dword, 2));
> -	printf("AUD_MISC_CTRL_C  Sample_present_Disable\t\t\t%lu\n",	BIT(dword, 8));
> -	printf("AUD_MISC_CTRL_C  Output_Delay\t\t\t\t%lu\n",		BITS(dword, 7, 4));
> -	printf("AUD_MISC_CTRL_C  Pro_Allowed\t\t\t\t%lu\n",			BIT(dword, 1));
> +	printf("AUD_MISC_CTRL_C  Sample_Fabrication_EN_bit\t\t%lu\n",	REG_BIT(dword, 2));
> +	printf("AUD_MISC_CTRL_C  Sample_present_Disable\t\t\t%lu\n",	REG_BIT(dword, 8));
> +	printf("AUD_MISC_CTRL_C  Output_Delay\t\t\t\t%lu\n",		REG_BITS(dword, 7, 4));
> +	printf("AUD_MISC_CTRL_C  Pro_Allowed\t\t\t\t%lu\n",			REG_BIT(dword, 1));
>  
>  	dword = INREG(AUD_PWRST);
> -	printf("AUD_PWRST  Func_Grp_Dev_PwrSt_Curr                  \t%s\n", power_state[BITS(dword, 27, 26)]);
> -	printf("AUD_PWRST  Func_Grp_Dev_PwrSt_Set                   \t%s\n", power_state[BITS(dword, 25, 24)]);
> -	printf("AUD_PWRST  ConvertorA_Widget_Power_State_Current    \t%s\n", power_state[BITS(dword, 15, 14)]);
> -	printf("AUD_PWRST  ConvertorA_Widget_Power_State_Requsted   \t%s\n", power_state[BITS(dword, 13, 12)]);
> -	printf("AUD_PWRST  ConvertorB_Widget_Power_State_Current    \t%s\n", power_state[BITS(dword, 19, 18)]);
> -	printf("AUD_PWRST  ConvertorB_Widget_Power_State_Requested  \t%s\n", power_state[BITS(dword, 17, 16)]);
> -	printf("AUD_PWRST  ConvC_Widget_PwrSt_Curr                  \t%s\n", power_state[BITS(dword, 23, 22)]);
> -	printf("AUD_PWRST  ConvC_Widget_PwrSt_Req                   \t%s\n", power_state[BITS(dword, 21, 20)]);
> -	printf("AUD_PWRST  PinB_Widget_Power_State_Current          \t%s\n", power_state[BITS(dword,  3,  2)]);
> -	printf("AUD_PWRST  PinB_Widget_Power_State_Set              \t%s\n", power_state[BITS(dword,  1,  0)]);
> -	printf("AUD_PWRST  PinC_Widget_Power_State_Current          \t%s\n", power_state[BITS(dword,  7,  6)]);
> -	printf("AUD_PWRST  PinC_Widget_Power_State_Set              \t%s\n", power_state[BITS(dword,  5,  4)]);
> -	printf("AUD_PWRST  PinD_Widget_Power_State_Current          \t%s\n", power_state[BITS(dword, 11, 10)]);
> -	printf("AUD_PWRST  PinD_Widget_Power_State_Set              \t%s\n", power_state[BITS(dword,  9,  8)]);
> +	printf("AUD_PWRST  Func_Grp_Dev_PwrSt_Curr                  \t%s\n", power_state[REG_BITS(dword, 27, 26)]);
> +	printf("AUD_PWRST  Func_Grp_Dev_PwrSt_Set                   \t%s\n", power_state[REG_BITS(dword, 25, 24)]);
> +	printf("AUD_PWRST  ConvertorA_Widget_Power_State_Current    \t%s\n", power_state[REG_BITS(dword, 15, 14)]);
> +	printf("AUD_PWRST  ConvertorA_Widget_Power_State_Requsted   \t%s\n", power_state[REG_BITS(dword, 13, 12)]);
> +	printf("AUD_PWRST  ConvertorB_Widget_Power_State_Current    \t%s\n", power_state[REG_BITS(dword, 19, 18)]);
> +	printf("AUD_PWRST  ConvertorB_Widget_Power_State_Requested  \t%s\n", power_state[REG_BITS(dword, 17, 16)]);
> +	printf("AUD_PWRST  ConvC_Widget_PwrSt_Curr                  \t%s\n", power_state[REG_BITS(dword, 23, 22)]);
> +	printf("AUD_PWRST  ConvC_Widget_PwrSt_Req                   \t%s\n", power_state[REG_BITS(dword, 21, 20)]);
> +	printf("AUD_PWRST  PinB_Widget_Power_State_Current          \t%s\n", power_state[REG_BITS(dword,  3,  2)]);
> +	printf("AUD_PWRST  PinB_Widget_Power_State_Set              \t%s\n", power_state[REG_BITS(dword,  1,  0)]);
> +	printf("AUD_PWRST  PinC_Widget_Power_State_Current          \t%s\n", power_state[REG_BITS(dword,  7,  6)]);
> +	printf("AUD_PWRST  PinC_Widget_Power_State_Set              \t%s\n", power_state[REG_BITS(dword,  5,  4)]);
> +	printf("AUD_PWRST  PinD_Widget_Power_State_Current          \t%s\n", power_state[REG_BITS(dword, 11, 10)]);
> +	printf("AUD_PWRST  PinD_Widget_Power_State_Set              \t%s\n", power_state[REG_BITS(dword,  9,  8)]);
>  
>  	dword = INREG(AUD_PORT_EN_HD_CFG);
> -	printf("AUD_PORT_EN_HD_CFG  Convertor_A_Digen\t\t\t%lu\n",	BIT(dword, 0));
> -	printf("AUD_PORT_EN_HD_CFG  Convertor_B_Digen\t\t\t%lu\n",	BIT(dword, 1));
> -	printf("AUD_PORT_EN_HD_CFG  Convertor_C_Digen\t\t\t%lu\n",	BIT(dword, 2));
> -	printf("AUD_PORT_EN_HD_CFG  ConvertorA_Stream_ID\t\t%lu\n",	BITS(dword,  7, 4));
> -	printf("AUD_PORT_EN_HD_CFG  ConvertorB_Stream_ID\t\t%lu\n",	BITS(dword, 11, 8));
> -	printf("AUD_PORT_EN_HD_CFG  ConvertorC_Stream_ID\t\t%lu\n",	BITS(dword, 15, 12));
> -	printf("AUD_PORT_EN_HD_CFG  Port_B_Out_Enable\t\t\t%lu\n",	BIT(dword, 16));
> -	printf("AUD_PORT_EN_HD_CFG  Port_C_Out_Enable\t\t\t%lu\n",	BIT(dword, 17));
> -	printf("AUD_PORT_EN_HD_CFG  Port_D_Out_Enable\t\t\t%lu\n",	BIT(dword, 18));
> -	printf("AUD_PORT_EN_HD_CFG  Port_B_Amp_Mute_Status\t\t%lu\n", BIT(dword, 20));
> -	printf("AUD_PORT_EN_HD_CFG  Port_C_Amp_Mute_Status\t\t%lu\n", BIT(dword, 21));
> -	printf("AUD_PORT_EN_HD_CFG  Port_D_Amp_Mute_Status\t\t%lu\n", BIT(dword, 22));
> +	printf("AUD_PORT_EN_HD_CFG  Convertor_A_Digen\t\t\t%lu\n",	REG_BIT(dword, 0));
> +	printf("AUD_PORT_EN_HD_CFG  Convertor_B_Digen\t\t\t%lu\n",	REG_BIT(dword, 1));
> +	printf("AUD_PORT_EN_HD_CFG  Convertor_C_Digen\t\t\t%lu\n",	REG_BIT(dword, 2));
> +	printf("AUD_PORT_EN_HD_CFG  ConvertorA_Stream_ID\t\t%lu\n",	REG_BITS(dword,  7, 4));
> +	printf("AUD_PORT_EN_HD_CFG  ConvertorB_Stream_ID\t\t%lu\n",	REG_BITS(dword, 11, 8));
> +	printf("AUD_PORT_EN_HD_CFG  ConvertorC_Stream_ID\t\t%lu\n",	REG_BITS(dword, 15, 12));
> +	printf("AUD_PORT_EN_HD_CFG  Port_B_Out_Enable\t\t\t%lu\n",	REG_BIT(dword, 16));
> +	printf("AUD_PORT_EN_HD_CFG  Port_C_Out_Enable\t\t\t%lu\n",	REG_BIT(dword, 17));
> +	printf("AUD_PORT_EN_HD_CFG  Port_D_Out_Enable\t\t\t%lu\n",	REG_BIT(dword, 18));
> +	printf("AUD_PORT_EN_HD_CFG  Port_B_Amp_Mute_Status\t\t%lu\n", REG_BIT(dword, 20));
> +	printf("AUD_PORT_EN_HD_CFG  Port_C_Amp_Mute_Status\t\t%lu\n", REG_BIT(dword, 21));
> +	printf("AUD_PORT_EN_HD_CFG  Port_D_Amp_Mute_Status\t\t%lu\n", REG_BIT(dword, 22));
>  
>  	dword = INREG(AUD_OUT_DIG_CNVT_A);
> -	printf("AUD_OUT_DIG_CNVT_A  V\t\t\t\t\t%lu\n",		BIT(dword, 1));
> -	printf("AUD_OUT_DIG_CNVT_A  VCFG\t\t\t\t%lu\n",		BIT(dword, 2));
> -	printf("AUD_OUT_DIG_CNVT_A  PRE\t\t\t\t\t%lu\n",		BIT(dword, 3));
> -	printf("AUD_OUT_DIG_CNVT_A  Copy\t\t\t\t%lu\n",		BIT(dword, 4));
> -	printf("AUD_OUT_DIG_CNVT_A  NonAudio\t\t\t\t%lu\n",		BIT(dword, 5));
> -	printf("AUD_OUT_DIG_CNVT_A  PRO\t\t\t\t\t%lu\n",		BIT(dword, 6));
> -	printf("AUD_OUT_DIG_CNVT_A  Level\t\t\t\t%lu\n",		BIT(dword, 7));
> -	printf("AUD_OUT_DIG_CNVT_A  Category_Code\t\t\t%lu\n",	BITS(dword, 14, 8));
> -	printf("AUD_OUT_DIG_CNVT_A  Lowest_Channel_Number\t\t%lu\n", BITS(dword, 19, 16));
> -	printf("AUD_OUT_DIG_CNVT_A  Stream_ID\t\t\t\t%lu\n",	BITS(dword, 23, 20));
> +	printf("AUD_OUT_DIG_CNVT_A  V\t\t\t\t\t%lu\n",		REG_BIT(dword, 1));
> +	printf("AUD_OUT_DIG_CNVT_A  VCFG\t\t\t\t%lu\n",		REG_BIT(dword, 2));
> +	printf("AUD_OUT_DIG_CNVT_A  PRE\t\t\t\t\t%lu\n",		REG_BIT(dword, 3));
> +	printf("AUD_OUT_DIG_CNVT_A  Copy\t\t\t\t%lu\n",		REG_BIT(dword, 4));
> +	printf("AUD_OUT_DIG_CNVT_A  NonAudio\t\t\t\t%lu\n",		REG_BIT(dword, 5));
> +	printf("AUD_OUT_DIG_CNVT_A  PRO\t\t\t\t\t%lu\n",		REG_BIT(dword, 6));
> +	printf("AUD_OUT_DIG_CNVT_A  Level\t\t\t\t%lu\n",		REG_BIT(dword, 7));
> +	printf("AUD_OUT_DIG_CNVT_A  Category_Code\t\t\t%lu\n",	REG_BITS(dword, 14, 8));
> +	printf("AUD_OUT_DIG_CNVT_A  Lowest_Channel_Number\t\t%lu\n", REG_BITS(dword, 19, 16));
> +	printf("AUD_OUT_DIG_CNVT_A  Stream_ID\t\t\t\t%lu\n",	REG_BITS(dword, 23, 20));
>  
>  	dword = INREG(AUD_OUT_DIG_CNVT_B);
> -	printf("AUD_OUT_DIG_CNVT_B  V\t\t\t\t\t%lu\n",		BIT(dword, 1));
> -	printf("AUD_OUT_DIG_CNVT_B  VCFG\t\t\t\t%lu\n",		BIT(dword, 2));
> -	printf("AUD_OUT_DIG_CNVT_B  PRE\t\t\t\t\t%lu\n",		BIT(dword, 3));
> -	printf("AUD_OUT_DIG_CNVT_B  Copy\t\t\t\t%lu\n",		BIT(dword, 4));
> -	printf("AUD_OUT_DIG_CNVT_B  NonAudio\t\t\t\t%lu\n",		BIT(dword, 5));
> -	printf("AUD_OUT_DIG_CNVT_B  PRO\t\t\t\t\t%lu\n",		BIT(dword, 6));
> -	printf("AUD_OUT_DIG_CNVT_B  Level\t\t\t\t%lu\n",		BIT(dword, 7));
> -	printf("AUD_OUT_DIG_CNVT_B  Category_Code\t\t\t%lu\n",	BITS(dword, 14, 8));
> -	printf("AUD_OUT_DIG_CNVT_B  Lowest_Channel_Number\t\t%lu\n", BITS(dword, 19, 16));
> -	printf("AUD_OUT_DIG_CNVT_B  Stream_ID\t\t\t\t%lu\n",	BITS(dword, 23, 20));
> +	printf("AUD_OUT_DIG_CNVT_B  V\t\t\t\t\t%lu\n",		REG_BIT(dword, 1));
> +	printf("AUD_OUT_DIG_CNVT_B  VCFG\t\t\t\t%lu\n",		REG_BIT(dword, 2));
> +	printf("AUD_OUT_DIG_CNVT_B  PRE\t\t\t\t\t%lu\n",		REG_BIT(dword, 3));
> +	printf("AUD_OUT_DIG_CNVT_B  Copy\t\t\t\t%lu\n",		REG_BIT(dword, 4));
> +	printf("AUD_OUT_DIG_CNVT_B  NonAudio\t\t\t\t%lu\n",		REG_BIT(dword, 5));
> +	printf("AUD_OUT_DIG_CNVT_B  PRO\t\t\t\t\t%lu\n",		REG_BIT(dword, 6));
> +	printf("AUD_OUT_DIG_CNVT_B  Level\t\t\t\t%lu\n",		REG_BIT(dword, 7));
> +	printf("AUD_OUT_DIG_CNVT_B  Category_Code\t\t\t%lu\n",	REG_BITS(dword, 14, 8));
> +	printf("AUD_OUT_DIG_CNVT_B  Lowest_Channel_Number\t\t%lu\n", REG_BITS(dword, 19, 16));
> +	printf("AUD_OUT_DIG_CNVT_B  Stream_ID\t\t\t\t%lu\n",	REG_BITS(dword, 23, 20));
>  
>  	dword = INREG(AUD_OUT_DIG_CNVT_C);
> -	printf("AUD_OUT_DIG_CNVT_C  V\t\t\t\t\t%lu\n",		BIT(dword, 1));
> -	printf("AUD_OUT_DIG_CNVT_C  VCFG\t\t\t\t%lu\n",		BIT(dword, 2));
> -	printf("AUD_OUT_DIG_CNVT_C  PRE\t\t\t\t\t%lu\n",		BIT(dword, 3));
> -	printf("AUD_OUT_DIG_CNVT_C  Copy\t\t\t\t%lu\n",		BIT(dword, 4));
> -	printf("AUD_OUT_DIG_CNVT_C  NonAudio\t\t\t\t%lu\n",		BIT(dword, 5));
> -	printf("AUD_OUT_DIG_CNVT_C  PRO\t\t\t\t\t%lu\n",		BIT(dword, 6));
> -	printf("AUD_OUT_DIG_CNVT_C  Level\t\t\t\t%lu\n",		BIT(dword, 7));
> -	printf("AUD_OUT_DIG_CNVT_C  Category_Code\t\t\t%lu\n",	BITS(dword, 14, 8));
> -	printf("AUD_OUT_DIG_CNVT_C  Lowest_Channel_Number\t\t%lu\n", BITS(dword, 19, 16));
> -	printf("AUD_OUT_DIG_CNVT_C  Stream_ID\t\t\t\t%lu\n",	BITS(dword, 23, 20));
> +	printf("AUD_OUT_DIG_CNVT_C  V\t\t\t\t\t%lu\n",		REG_BIT(dword, 1));
> +	printf("AUD_OUT_DIG_CNVT_C  VCFG\t\t\t\t%lu\n",		REG_BIT(dword, 2));
> +	printf("AUD_OUT_DIG_CNVT_C  PRE\t\t\t\t\t%lu\n",		REG_BIT(dword, 3));
> +	printf("AUD_OUT_DIG_CNVT_C  Copy\t\t\t\t%lu\n",		REG_BIT(dword, 4));
> +	printf("AUD_OUT_DIG_CNVT_C  NonAudio\t\t\t\t%lu\n",		REG_BIT(dword, 5));
> +	printf("AUD_OUT_DIG_CNVT_C  PRO\t\t\t\t\t%lu\n",		REG_BIT(dword, 6));
> +	printf("AUD_OUT_DIG_CNVT_C  Level\t\t\t\t%lu\n",		REG_BIT(dword, 7));
> +	printf("AUD_OUT_DIG_CNVT_C  Category_Code\t\t\t%lu\n",	REG_BITS(dword, 14, 8));
> +	printf("AUD_OUT_DIG_CNVT_C  Lowest_Channel_Number\t\t%lu\n", REG_BITS(dword, 19, 16));
> +	printf("AUD_OUT_DIG_CNVT_C  Stream_ID\t\t\t\t%lu\n",	REG_BITS(dword, 23, 20));
>  
>  	printf("AUD_OUT_CH_STR  Converter_Channel_MAP	PORTB	PORTC	PORTD\n");
>  	for (i = 0; i < 8; i++) {
>  		OUTREG(AUD_OUT_CH_STR, i | (i << 8) | (i << 16));
>  		dword = INREG(AUD_OUT_CH_STR);
>  		printf("\t\t\t\t%lu\t%lu\t%lu\t%lu\n",
> -				1 + BITS(dword,  3,  0),
> -				1 + BITS(dword,  7,  4),
> -				1 + BITS(dword, 15, 12),
> -				1 + BITS(dword, 23, 20));
> +				1 + REG_BITS(dword,  3,  0),
> +				1 + REG_BITS(dword,  7,  4),
> +				1 + REG_BITS(dword, 15, 12),
> +				1 + REG_BITS(dword, 23, 20));
>  	}
>  
>  	dword = INREG(AUD_OUT_STR_DESC_A);
> -	printf("AUD_OUT_STR_DESC_A  HBR_enable\t\t\t\t%lu\n",	 BITS(dword, 28, 27));
> -	printf("AUD_OUT_STR_DESC_A  Convertor_Channel_Count\t\t%lu\n", BITS(dword, 20, 16) + 1);
> +	printf("AUD_OUT_STR_DESC_A  HBR_enable\t\t\t\t%lu\n",	 REG_BITS(dword, 28, 27));
> +	printf("AUD_OUT_STR_DESC_A  Convertor_Channel_Count\t\t%lu\n", REG_BITS(dword, 20, 16) + 1);
>  	printf("AUD_OUT_STR_DESC_A  Bits_per_Sample\t\t\t[%#lx] %s\n",
> -			BITS(dword, 6, 4), OPNAME(bits_per_sample, BITS(dword, 6, 4)));
> -	printf("AUD_OUT_STR_DESC_A  Number_of_Channels_in_a_Stream\t%lu\n", 1 + BITS(dword, 3, 0));
> +			REG_BITS(dword, 6, 4), OPNAME(bits_per_sample, REG_BITS(dword, 6, 4)));
> +	printf("AUD_OUT_STR_DESC_A  Number_of_Channels_in_a_Stream\t%lu\n", 1 + REG_BITS(dword, 3, 0));
>  
>  	dword = INREG(AUD_OUT_STR_DESC_B);
> -	printf("AUD_OUT_STR_DESC_B  HBR_enable\t\t\t\t%lu\n",	 BITS(dword, 28, 27));
> -	printf("AUD_OUT_STR_DESC_B  Convertor_Channel_Count\t\t%lu\n", BITS(dword, 20, 16) + 1);
> +	printf("AUD_OUT_STR_DESC_B  HBR_enable\t\t\t\t%lu\n",	 REG_BITS(dword, 28, 27));
> +	printf("AUD_OUT_STR_DESC_B  Convertor_Channel_Count\t\t%lu\n", REG_BITS(dword, 20, 16) + 1);
>  	printf("AUD_OUT_STR_DESC_B  Bits_per_Sample\t\t\t[%#lx] %s\n",
> -			BITS(dword, 6, 4), OPNAME(bits_per_sample, BITS(dword, 6, 4)));
> -	printf("AUD_OUT_STR_DESC_B  Number_of_Channels_in_a_Stream\t%lu\n", 1 + BITS(dword, 3, 0));
> +			REG_BITS(dword, 6, 4), OPNAME(bits_per_sample, REG_BITS(dword, 6, 4)));
> +	printf("AUD_OUT_STR_DESC_B  Number_of_Channels_in_a_Stream\t%lu\n", 1 + REG_BITS(dword, 3, 0));
>  
>  	dword = INREG(AUD_OUT_STR_DESC_C);
> -	printf("AUD_OUT_STR_DESC_C  HBR_enable\t\t\t\t%lu\n",	 BITS(dword, 28, 27));
> -	printf("AUD_OUT_STR_DESC_C  Convertor_Channel_Count\t\t%lu\n", BITS(dword, 20, 16) + 1);
> +	printf("AUD_OUT_STR_DESC_C  HBR_enable\t\t\t\t%lu\n",	 REG_BITS(dword, 28, 27));
> +	printf("AUD_OUT_STR_DESC_C  Convertor_Channel_Count\t\t%lu\n", REG_BITS(dword, 20, 16) + 1);
>  	printf("AUD_OUT_STR_DESC_C  Bits_per_Sample\t\t\t[%#lx] %s\n",
> -			BITS(dword, 6, 4), OPNAME(bits_per_sample, BITS(dword, 6, 4)));
> -	printf("AUD_OUT_STR_DESC_C  Number_of_Channels_in_a_Stream\t%lu\n", 1 + BITS(dword, 3, 0));
> +			REG_BITS(dword, 6, 4), OPNAME(bits_per_sample, REG_BITS(dword, 6, 4)));
> +	printf("AUD_OUT_STR_DESC_C  Number_of_Channels_in_a_Stream\t%lu\n", 1 + REG_BITS(dword, 3, 0));
>  
>  	dword = INREG(AUD_PINW_CONNLNG_SEL);
> -	printf("AUD_PINW_CONNLNG_SEL  Connection_select_Control_B\t%#lx\n", BITS(dword,  7,  0));
> -	printf("AUD_PINW_CONNLNG_SEL  Connection_select_Control_C\t%#lx\n", BITS(dword, 15,  8));
> -	printf("AUD_PINW_CONNLNG_SEL  Connection_select_Control_D\t%#lx\n", BITS(dword, 23, 16));
> +	printf("AUD_PINW_CONNLNG_SEL  Connection_select_Control_B\t%#lx\n", REG_BITS(dword,  7,  0));
> +	printf("AUD_PINW_CONNLNG_SEL  Connection_select_Control_C\t%#lx\n", REG_BITS(dword, 15,  8));
> +	printf("AUD_PINW_CONNLNG_SEL  Connection_select_Control_D\t%#lx\n", REG_BITS(dword, 23, 16));
>  
>  	dword = INREG(AUD_CNTL_ST_A);
>  	printf("AUD_CNTL_ST_A  DIP_Port_Select\t\t\t\t[%#lx] %s\n",
> -			BITS(dword, 30, 29), dip_port[BITS(dword, 30, 29)]);
> -	printf("AUD_CNTL_ST_A  DIP_type_enable_status Audio DIP\t\t%lu\n", BIT(dword, 21));
> -	printf("AUD_CNTL_ST_A  DIP_type_enable_status ACP DIP\t\t%lu\n", BIT(dword, 22));
> -	printf("AUD_CNTL_ST_A  DIP_type_enable_status Generic 2 DIP\t%lu\n", BIT(dword, 23));
> +			REG_BITS(dword, 30, 29), dip_port[REG_BITS(dword, 30, 29)]);
> +	printf("AUD_CNTL_ST_A  DIP_type_enable_status Audio DIP\t\t%lu\n", REG_BIT(dword, 21));
> +	printf("AUD_CNTL_ST_A  DIP_type_enable_status ACP DIP\t\t%lu\n", REG_BIT(dword, 22));
> +	printf("AUD_CNTL_ST_A  DIP_type_enable_status Generic 2 DIP\t%lu\n", REG_BIT(dword, 23));
>  	printf("AUD_CNTL_ST_A  DIP_transmission_frequency\t\t[0x%lx] %s\n",
> -			BITS(dword, 17, 16), dip_trans[BITS(dword, 17, 16)]);
> -	printf("AUD_CNTL_ST_A  ELD_ACK\t\t\t\t\t%lu\n", BIT(dword, 4));
> -	printf("AUD_CNTL_ST_A  ELD_buffer_size\t\t\t\t%lu\n", BITS(dword, 14, 10));
> +			REG_BITS(dword, 17, 16), dip_trans[REG_BITS(dword, 17, 16)]);
> +	printf("AUD_CNTL_ST_A  ELD_ACK\t\t\t\t\t%lu\n", REG_BIT(dword, 4));
> +	printf("AUD_CNTL_ST_A  ELD_buffer_size\t\t\t\t%lu\n", REG_BITS(dword, 14, 10));
>  
>  	dword = INREG(AUD_CNTL_ST_B);
>  	printf("AUD_CNTL_ST_B  DIP_Port_Select\t\t\t\t[%#lx] %s\n",
> -			BITS(dword, 30, 29), dip_port[BITS(dword, 30, 29)]);
> -	printf("AUD_CNTL_ST_B  DIP_type_enable_status Audio DIP\t\t%lu\n", BIT(dword, 21));
> -	printf("AUD_CNTL_ST_B  DIP_type_enable_status ACP DIP\t\t%lu\n", BIT(dword, 22));
> -	printf("AUD_CNTL_ST_B  DIP_type_enable_status Generic 2 DIP\t%lu\n", BIT(dword, 23));
> +			REG_BITS(dword, 30, 29), dip_port[REG_BITS(dword, 30, 29)]);
> +	printf("AUD_CNTL_ST_B  DIP_type_enable_status Audio DIP\t\t%lu\n", REG_BIT(dword, 21));
> +	printf("AUD_CNTL_ST_B  DIP_type_enable_status ACP DIP\t\t%lu\n", REG_BIT(dword, 22));
> +	printf("AUD_CNTL_ST_B  DIP_type_enable_status Generic 2 DIP\t%lu\n", REG_BIT(dword, 23));
>  	printf("AUD_CNTL_ST_B  DIP_transmission_frequency\t\t[0x%lx] %s\n",
> -			BITS(dword, 17, 16), dip_trans[BITS(dword, 17, 16)]);
> -	printf("AUD_CNTL_ST_B  ELD_ACK\t\t\t\t\t%lu\n", BIT(dword, 4));
> -	printf("AUD_CNTL_ST_B  ELD_buffer_size\t\t\t\t%lu\n", BITS(dword, 14, 10));
> +			REG_BITS(dword, 17, 16), dip_trans[REG_BITS(dword, 17, 16)]);
> +	printf("AUD_CNTL_ST_B  ELD_ACK\t\t\t\t\t%lu\n", REG_BIT(dword, 4));
> +	printf("AUD_CNTL_ST_B  ELD_buffer_size\t\t\t\t%lu\n", REG_BITS(dword, 14, 10));
>  
>  	dword = INREG(AUD_CNTL_ST_C);
>  	printf("AUD_CNTL_ST_C  DIP_Port_Select\t\t\t\t[%#lx] %s\n",
> -			BITS(dword, 30, 29), dip_port[BITS(dword, 30, 29)]);
> -	printf("AUD_CNTL_ST_C  DIP_type_enable_status Audio DIP\t\t%lu\n", BIT(dword, 21));
> -	printf("AUD_CNTL_ST_C  DIP_type_enable_status ACP DIP\t\t%lu\n", BIT(dword, 22));
> -	printf("AUD_CNTL_ST_C  DIP_type_enable_status Generic 2 DIP\t%lu\n", BIT(dword, 23));
> +			REG_BITS(dword, 30, 29), dip_port[REG_BITS(dword, 30, 29)]);
> +	printf("AUD_CNTL_ST_C  DIP_type_enable_status Audio DIP\t\t%lu\n", REG_BIT(dword, 21));
> +	printf("AUD_CNTL_ST_C  DIP_type_enable_status ACP DIP\t\t%lu\n", REG_BIT(dword, 22));
> +	printf("AUD_CNTL_ST_C  DIP_type_enable_status Generic 2 DIP\t%lu\n", REG_BIT(dword, 23));
>  	printf("AUD_CNTL_ST_C  DIP_transmission_frequency\t\t[0x%lx] %s\n",
> -			BITS(dword, 17, 16), dip_trans[BITS(dword, 17, 16)]);
> -	printf("AUD_CNTL_ST_C  ELD_ACK\t\t\t\t\t%lu\n", BIT(dword, 4));
> -	printf("AUD_CNTL_ST_C  ELD_buffer_size\t\t\t\t%lu\n", BITS(dword, 14, 10));
> +			REG_BITS(dword, 17, 16), dip_trans[REG_BITS(dword, 17, 16)]);
> +	printf("AUD_CNTL_ST_C  ELD_ACK\t\t\t\t\t%lu\n", REG_BIT(dword, 4));
> +	printf("AUD_CNTL_ST_C  ELD_buffer_size\t\t\t\t%lu\n", REG_BITS(dword, 14, 10));
>  
>  	dword = INREG(AUD_CNTRL_ST2);
> -	printf("AUD_CNTRL_ST2  CP_ReadyB\t\t\t\t%lu\n",	BIT(dword, 1));
> -	printf("AUD_CNTRL_ST2  ELD_validB\t\t\t\t%lu\n",	BIT(dword, 0));
> -	printf("AUD_CNTRL_ST2  CP_ReadyC\t\t\t\t%lu\n",	BIT(dword, 5));
> -	printf("AUD_CNTRL_ST2  ELD_validC\t\t\t\t%lu\n",	BIT(dword, 4));
> -	printf("AUD_CNTRL_ST2  CP_ReadyD\t\t\t\t%lu\n",	BIT(dword, 9));
> -	printf("AUD_CNTRL_ST2  ELD_validD\t\t\t\t%lu\n",	BIT(dword, 8));
> +	printf("AUD_CNTRL_ST2  CP_ReadyB\t\t\t\t%lu\n",	REG_BIT(dword, 1));
> +	printf("AUD_CNTRL_ST2  ELD_validB\t\t\t\t%lu\n",	REG_BIT(dword, 0));
> +	printf("AUD_CNTRL_ST2  CP_ReadyC\t\t\t\t%lu\n",	REG_BIT(dword, 5));
> +	printf("AUD_CNTRL_ST2  ELD_validC\t\t\t\t%lu\n",	REG_BIT(dword, 4));
> +	printf("AUD_CNTRL_ST2  CP_ReadyD\t\t\t\t%lu\n",	REG_BIT(dword, 9));
> +	printf("AUD_CNTRL_ST2  ELD_validD\t\t\t\t%lu\n",	REG_BIT(dword, 8));
>  
>  	dword = INREG(AUD_CNTRL_ST3);
> -	printf("AUD_CNTRL_ST3  TransA_DPT_Audio_Output_En\t\t%lu\n",	BIT(dword, 3));
> +	printf("AUD_CNTRL_ST3  TransA_DPT_Audio_Output_En\t\t%lu\n",	REG_BIT(dword, 3));
>  	printf("AUD_CNTRL_ST3  TransA_to_Port_Sel\t\t\t[%#lx] %s\n",
> -			BITS(dword, 2, 0), trans_to_port_sel[BITS(dword, 2, 0)]);
> -	printf("AUD_CNTRL_ST3  TransB_DPT_Audio_Output_En\t\t%lu\n",	BIT(dword, 7));
> +			REG_BITS(dword, 2, 0), trans_to_port_sel[REG_BITS(dword, 2, 0)]);
> +	printf("AUD_CNTRL_ST3  TransB_DPT_Audio_Output_En\t\t%lu\n",	REG_BIT(dword, 7));
>  	printf("AUD_CNTRL_ST3  TransB_to_Port_Sel\t\t\t[%#lx] %s\n",
> -			BITS(dword, 6, 4), trans_to_port_sel[BITS(dword, 6, 4)]);
> -	printf("AUD_CNTRL_ST3  TransC_DPT_Audio_Output_En\t\t%lu\n",	BIT(dword, 11));
> +			REG_BITS(dword, 6, 4), trans_to_port_sel[REG_BITS(dword, 6, 4)]);
> +	printf("AUD_CNTRL_ST3  TransC_DPT_Audio_Output_En\t\t%lu\n",	REG_BIT(dword, 11));
>  	printf("AUD_CNTRL_ST3  TransC_to_Port_Sel\t\t\t[%#lx] %s\n",
> -			BITS(dword, 10, 8), trans_to_port_sel[BITS(dword, 10, 8)]);
> +			REG_BITS(dword, 10, 8), trans_to_port_sel[REG_BITS(dword, 10, 8)]);
>  
>  	dword = INREG(AUD_HDMIW_STATUS);
> -	printf("AUD_HDMIW_STATUS  Conv_A_CDCLK/DOTCLK_FIFO_Underrun\t%lu\n", BIT(dword, 27));
> -	printf("AUD_HDMIW_STATUS  Conv_A_CDCLK/DOTCLK_FIFO_Overrun\t%lu\n",  BIT(dword, 26));
> -	printf("AUD_HDMIW_STATUS  Conv_B_CDCLK/DOTCLK_FIFO_Underrun\t%lu\n", BIT(dword, 29));
> -	printf("AUD_HDMIW_STATUS  Conv_B_CDCLK/DOTCLK_FIFO_Overrun\t%lu\n",  BIT(dword, 28));
> -	printf("AUD_HDMIW_STATUS  Conv_C_CDCLK/DOTCLK_FIFO_Underrun\t%lu\n", BIT(dword, 31));
> -	printf("AUD_HDMIW_STATUS  Conv_C_CDCLK/DOTCLK_FIFO_Overrun\t%lu\n",  BIT(dword, 30));
> -	printf("AUD_HDMIW_STATUS  BCLK/CDCLK_FIFO_Overrun\t\t%lu\n",	 BIT(dword, 25));
> -	printf("AUD_HDMIW_STATUS  Function_Reset\t\t\t%lu\n",		 BIT(dword, 24));
> +	printf("AUD_HDMIW_STATUS  Conv_A_CDCLK/DOTCLK_FIFO_Underrun\t%lu\n", REG_BIT(dword, 27));
> +	printf("AUD_HDMIW_STATUS  Conv_A_CDCLK/DOTCLK_FIFO_Overrun\t%lu\n",  REG_BIT(dword, 26));
> +	printf("AUD_HDMIW_STATUS  Conv_B_CDCLK/DOTCLK_FIFO_Underrun\t%lu\n", REG_BIT(dword, 29));
> +	printf("AUD_HDMIW_STATUS  Conv_B_CDCLK/DOTCLK_FIFO_Overrun\t%lu\n",  REG_BIT(dword, 28));
> +	printf("AUD_HDMIW_STATUS  Conv_C_CDCLK/DOTCLK_FIFO_Underrun\t%lu\n", REG_BIT(dword, 31));
> +	printf("AUD_HDMIW_STATUS  Conv_C_CDCLK/DOTCLK_FIFO_Overrun\t%lu\n",  REG_BIT(dword, 30));
> +	printf("AUD_HDMIW_STATUS  BCLK/CDCLK_FIFO_Overrun\t\t%lu\n",	 REG_BIT(dword, 25));
> +	printf("AUD_HDMIW_STATUS  Function_Reset\t\t\t%lu\n",		 REG_BIT(dword, 24));
>  
>  	printf("AUD_HDMIW_HDMIEDID_A HDMI ELD:\n\t");
>  	dword = INREG(AUD_CNTL_ST_A);
>  	dword &= ~BITMASK(9, 5);
>  	OUTREG(AUD_CNTL_ST_A, dword);
> -	for (i = 0; i < BITS(dword, 14, 10) / 4; i++)
> +	for (i = 0; i < REG_BITS(dword, 14, 10) / 4; i++)
>  		printf("%08x ", htonl(INREG(AUD_HDMIW_HDMIEDID_A)));
>  	printf("\n");
>  
> @@ -1212,7 +1212,7 @@ static void dump_cpt(void)
>  	dword = INREG(AUD_CNTL_ST_B);
>  	dword &= ~BITMASK(9, 5);
>  	OUTREG(AUD_CNTL_ST_B, dword);
> -	for (i = 0; i < BITS(dword, 14, 10) / 4; i++)
> +	for (i = 0; i < REG_BITS(dword, 14, 10) / 4; i++)
>  		printf("%08x ", htonl(INREG(AUD_HDMIW_HDMIEDID_B)));
>  	printf("\n");
>  
> @@ -1220,7 +1220,7 @@ static void dump_cpt(void)
>  	dword = INREG(AUD_CNTL_ST_C);
>  	dword &= ~BITMASK(9, 5);
>  	OUTREG(AUD_CNTL_ST_C, dword);
> -	for (i = 0; i < BITS(dword, 14, 10) / 4; i++)
> +	for (i = 0; i < REG_BITS(dword, 14, 10) / 4; i++)
>  		printf("%08x ", htonl(INREG(AUD_HDMIW_HDMIEDID_C)));
>  	printf("\n");
>  
> @@ -1381,14 +1381,14 @@ static void dump_aud_config(int index)
>  		sprintf(prefix, "AUD_TC%c_CONFIG", 'A' + index - TRANSCODER_A);
>  	}
>  
> -	printf("%s  Disable_NCTS\t\t\t\t%lu\n",          prefix, BIT(dword, 3));
> -	printf("%s  Lower_N_value\t\t\t\t0x%03lx\n",     prefix, BITS(dword, 15, 4));
> -	printf("%s  Pixel_Clock_HDMI\t\t\t[0x%lx] %s\n", prefix, BITS(dword, 19, 16),
> -		OPNAME(pixel_clock, BITS(dword, 19, 16)));
> -	printf("%s  Upper_N_value\t\t\t\t0x%02lx\n",     prefix, BITS(dword, 27, 20));
> -	printf("%s  N_programming_enable\t\t\t%lu\n",    prefix, BIT(dword, 28));
> -	printf("%s  N_index_value\t\t\t\t[0x%lx] %s\n",  prefix, BIT(dword, 29),
> -		OPNAME(n_index_value, BIT(dword, 29)));
> +	printf("%s  Disable_NCTS\t\t\t\t%lu\n",          prefix, REG_BIT(dword, 3));
> +	printf("%s  Lower_N_value\t\t\t\t0x%03lx\n",     prefix, REG_BITS(dword, 15, 4));
> +	printf("%s  Pixel_Clock_HDMI\t\t\t[0x%lx] %s\n", prefix, REG_BITS(dword, 19, 16),
> +		OPNAME(pixel_clock, REG_BITS(dword, 19, 16)));
> +	printf("%s  Upper_N_value\t\t\t\t0x%02lx\n",     prefix, REG_BITS(dword, 27, 20));
> +	printf("%s  N_programming_enable\t\t\t%lu\n",    prefix, REG_BIT(dword, 28));
> +	printf("%s  N_index_value\t\t\t\t[0x%lx] %s\n",  prefix, REG_BIT(dword, 29),
> +		OPNAME(n_index_value, REG_BIT(dword, 29)));
>  }
>  
>  static void dump_aud_misc_control(int index)
> @@ -1404,10 +1404,10 @@ static void dump_aud_misc_control(int index)
>  		sprintf(prefix, "AUD_C%c_MISC_CTRL", '1' + index - CONVERTER_1);
>  	}
>  
> -	printf("%s   Pro_Allowed\t\t\t\t%lu\n",           prefix, BIT(dword, 1));
> -	printf("%s   Sample_Fabrication_EN_bit\t\t%lu\n", prefix, BIT(dword, 2));
> -	printf("%s   Output_Delay\t\t\t\t%lu\n",          prefix, BITS(dword, 7, 4));
> -	printf("%s   Sample_present_Disable\t\t%lu\n",    prefix, BIT(dword, 8));
> +	printf("%s   Pro_Allowed\t\t\t\t%lu\n",           prefix, REG_BIT(dword, 1));
> +	printf("%s   Sample_Fabrication_EN_bit\t\t%lu\n", prefix, REG_BIT(dword, 2));
> +	printf("%s   Output_Delay\t\t\t\t%lu\n",          prefix, REG_BITS(dword, 7, 4));
> +	printf("%s   Sample_present_Disable\t\t%lu\n",    prefix, REG_BIT(dword, 8));
>  }
>  
>  static void dump_aud_vendor_device_id(void)
> @@ -1415,8 +1415,8 @@ static void dump_aud_vendor_device_id(void)
>  	uint32_t dword;
>  
>  	dword = INREG(aud_reg_base + AUD_VID_DID);
> -	printf("AUD_VID_DID device id\t\t\t\t\t0x%lx\n", BITS(dword, 15, 0));
> -	printf("AUD_VID_DID vendor id\t\t\t\t\t0x%lx\n", BITS(dword, 31, 16));
> +	printf("AUD_VID_DID device id\t\t\t\t\t0x%lx\n", REG_BITS(dword, 15, 0));
> +	printf("AUD_VID_DID vendor id\t\t\t\t\t0x%lx\n", REG_BITS(dword, 31, 16));
>  }
>  
>  static void dump_aud_revision_id(void)
> @@ -1424,10 +1424,10 @@ static void dump_aud_revision_id(void)
>  	uint32_t dword;
>  
>  	dword = INREG(aud_reg_base + AUD_RID);
> -	printf("AUD_RID Stepping_Id\t\t\t\t\t0x%lx\n",    BITS(dword, 7, 0));
> -	printf("AUD_RID Revision_Id\t\t\t\t\t0x%lx\n",    BITS(dword, 15, 8));
> -	printf("AUD_RID Minor_Revision\t\t\t\t\t0x%lx\n", BITS(dword, 19, 16));
> -	printf("AUD_RID Major_Revision\t\t\t\t\t0x%lx\n", BITS(dword, 23, 20));
> +	printf("AUD_RID Stepping_Id\t\t\t\t\t0x%lx\n",    REG_BITS(dword, 7, 0));
> +	printf("AUD_RID Revision_Id\t\t\t\t\t0x%lx\n",    REG_BITS(dword, 15, 8));
> +	printf("AUD_RID Minor_Revision\t\t\t\t\t0x%lx\n", REG_BITS(dword, 19, 16));
> +	printf("AUD_RID Major_Revision\t\t\t\t\t0x%lx\n", REG_BITS(dword, 23, 20));
>  }
>  
>  static void dump_aud_m_cts_enable(int index)
> @@ -1443,10 +1443,10 @@ static void dump_aud_m_cts_enable(int index)
>  		sprintf(prefix, "AUD_TC%c_M_CTS_ENABLE", 'A' + index - TRANSCODER_A);
>  	}
>  
> -	printf("%s  CTS_programming\t\t\t%#lx\n",        prefix, BITS(dword, 19, 0));
> -	printf("%s  Enable_CTS_or_M_programming\t%lu\n", prefix, BIT(dword, 20));
> -	printf("%s  CTS_M value Index\t\t\t[0x%lx] %s\n",prefix, BIT(dword, 21),
> -		OPNAME(cts_m_value_index, BIT(dword, 21)));
> +	printf("%s  CTS_programming\t\t\t%#lx\n",        prefix, REG_BITS(dword, 19, 0));
> +	printf("%s  Enable_CTS_or_M_programming\t%lu\n", prefix, REG_BIT(dword, 20));
> +	printf("%s  CTS_M value Index\t\t\t[0x%lx] %s\n",prefix, REG_BIT(dword, 21),
> +		OPNAME(cts_m_value_index, REG_BIT(dword, 21)));
>  }
>  
>  static void dump_aud_power_state(void)
> @@ -1455,39 +1455,39 @@ static void dump_aud_power_state(void)
>  	int num_pipes;
>  
>  	dword = INREG(aud_reg_base + AUD_PWRST);
> -	printf("AUD_PWRST  PinB_Widget_Power_State_Set              \t%s\n",         power_state[BITS(dword,  1,  0)]);
> -	printf("AUD_PWRST  PinB_Widget_Power_State_Current          \t%s\n",         power_state[BITS(dword,  3,  2)]);
> -	printf("AUD_PWRST  PinC_Widget_Power_State_Set              \t%s\n",         power_state[BITS(dword,  5,  4)]);
> -	printf("AUD_PWRST  PinC_Widget_Power_State_Current          \t%s\n",         power_state[BITS(dword,  7,  6)]);
> -	printf("AUD_PWRST  PinD_Widget_Power_State_Set              \t%s\n",         power_state[BITS(dword,  9,  8)]);
> -	printf("AUD_PWRST  PinD_Widget_Power_State_Current          \t%s\n",         power_state[BITS(dword, 11, 10)]);
> +	printf("AUD_PWRST  PinB_Widget_Power_State_Set              \t%s\n",         power_state[REG_BITS(dword,  1,  0)]);
> +	printf("AUD_PWRST  PinB_Widget_Power_State_Current          \t%s\n",         power_state[REG_BITS(dword,  3,  2)]);
> +	printf("AUD_PWRST  PinC_Widget_Power_State_Set              \t%s\n",         power_state[REG_BITS(dword,  5,  4)]);
> +	printf("AUD_PWRST  PinC_Widget_Power_State_Current          \t%s\n",         power_state[REG_BITS(dword,  7,  6)]);
> +	printf("AUD_PWRST  PinD_Widget_Power_State_Set              \t%s\n",         power_state[REG_BITS(dword,  9,  8)]);
> +	printf("AUD_PWRST  PinD_Widget_Power_State_Current          \t%s\n",         power_state[REG_BITS(dword, 11, 10)]);
>  
>  	if (!IS_HASWELL_PLUS(devid)) {
> -		printf("AUD_PWRST  ConvertorA_Widget_Power_State_Requsted   \t%s\n", power_state[BITS(dword, 13, 12)]);
> -		printf("AUD_PWRST  ConvertorA_Widget_Power_State_Current    \t%s\n", power_state[BITS(dword, 15, 14)]);
> -		printf("AUD_PWRST  ConvertorB_Widget_Power_State_Requested  \t%s\n", power_state[BITS(dword, 17, 16)]);
> -		printf("AUD_PWRST  ConvertorB_Widget_Power_State_Current    \t%s\n", power_state[BITS(dword, 19, 18)]);
> +		printf("AUD_PWRST  ConvertorA_Widget_Power_State_Requsted   \t%s\n", power_state[REG_BITS(dword, 13, 12)]);
> +		printf("AUD_PWRST  ConvertorA_Widget_Power_State_Current    \t%s\n", power_state[REG_BITS(dword, 15, 14)]);
> +		printf("AUD_PWRST  ConvertorB_Widget_Power_State_Requested  \t%s\n", power_state[REG_BITS(dword, 17, 16)]);
> +		printf("AUD_PWRST  ConvertorB_Widget_Power_State_Current    \t%s\n", power_state[REG_BITS(dword, 19, 18)]);
>  	} else {
> -		printf("AUD_PWRST  Convertor1_Widget_Power_State_Requsted   \t%s\n", power_state[BITS(dword, 13, 12)]);
> -		printf("AUD_PWRST  Convertor1_Widget_Power_State_Current    \t%s\n", power_state[BITS(dword, 15, 14)]);
> -		printf("AUD_PWRST  Convertor2_Widget_Power_State_Requested  \t%s\n", power_state[BITS(dword, 17, 16)]);
> -		printf("AUD_PWRST  Convertor2_Widget_Power_State_Current    \t%s\n", power_state[BITS(dword, 19, 18)]);
> +		printf("AUD_PWRST  Convertor1_Widget_Power_State_Requsted   \t%s\n", power_state[REG_BITS(dword, 13, 12)]);
> +		printf("AUD_PWRST  Convertor1_Widget_Power_State_Current    \t%s\n", power_state[REG_BITS(dword, 15, 14)]);
> +		printf("AUD_PWRST  Convertor2_Widget_Power_State_Requested  \t%s\n", power_state[REG_BITS(dword, 17, 16)]);
> +		printf("AUD_PWRST  Convertor2_Widget_Power_State_Current    \t%s\n", power_state[REG_BITS(dword, 19, 18)]);
>  	}
>  
>  	num_pipes = get_num_pipes();
>  	if (num_pipes == 2) {
> -		printf("AUD_PWRST  Func_Grp_Dev_PwrSt_Set                   \t%s\n", power_state[BITS(dword, 21, 20)]);
> -		printf("AUD_PWRST  Func_Grp_Dev_PwrSt_Curr                  \t%s\n", power_state[BITS(dword, 23, 22)]);
> +		printf("AUD_PWRST  Func_Grp_Dev_PwrSt_Set                   \t%s\n", power_state[REG_BITS(dword, 21, 20)]);
> +		printf("AUD_PWRST  Func_Grp_Dev_PwrSt_Curr                  \t%s\n", power_state[REG_BITS(dword, 23, 22)]);
>  	} else {	/* 3 pipes */
>  		if (!IS_HASWELL_PLUS(devid)) {
> -			printf("AUD_PWRST  ConvertorC_Widget_Power_State_Requested  \t%s\n", power_state[BITS(dword, 21, 20)]);
> -			printf("AUD_PWRST  ConvertorC_Widget_Power_State_Current    \t%s\n", power_state[BITS(dword, 23, 22)]);
> +			printf("AUD_PWRST  ConvertorC_Widget_Power_State_Requested  \t%s\n", power_state[REG_BITS(dword, 21, 20)]);
> +			printf("AUD_PWRST  ConvertorC_Widget_Power_State_Current    \t%s\n", power_state[REG_BITS(dword, 23, 22)]);
>  		} else {
> -			printf("AUD_PWRST  Convertor3_Widget_Power_State_Requested  \t%s\n", power_state[BITS(dword, 21, 20)]);
> -			printf("AUD_PWRST  Convertor3_Widget_Power_State_Current    \t%s\n", power_state[BITS(dword, 23, 22)]);
> +			printf("AUD_PWRST  Convertor3_Widget_Power_State_Requested  \t%s\n", power_state[REG_BITS(dword, 21, 20)]);
> +			printf("AUD_PWRST  Convertor3_Widget_Power_State_Current    \t%s\n", power_state[REG_BITS(dword, 23, 22)]);
>  		}
> -		printf("AUD_PWRST  Func_Grp_Dev_PwrSt_Set                   \t%s\n", power_state[BITS(dword, 25, 24)]);
> -		printf("AUD_PWRST  Func_Grp_Dev_PwrSt_Curr                  \t%s\n", power_state[BITS(dword, 27, 26)]);
> +		printf("AUD_PWRST  Func_Grp_Dev_PwrSt_Set                   \t%s\n", power_state[REG_BITS(dword, 25, 24)]);
> +		printf("AUD_PWRST  Func_Grp_Dev_PwrSt_Curr                  \t%s\n", power_state[REG_BITS(dword, 27, 26)]);
>  	}
>  }
>  
> @@ -1513,7 +1513,7 @@ static void dump_aud_edid_data(int index)
>  	dword = INREG(aud_ctrl_st);
>  	dword &= ~BITMASK(9, 5);
>  	OUTREG(aud_ctrl_st, dword);
> -	for (i = 0; i < BITS(dword, 14, 10) / 4; i++)
> +	for (i = 0; i < REG_BITS(dword, 14, 10) / 4; i++)
>  		printf("%08x ", htonl(INREG(edid_data)));
>  	printf("\n");
>  }
> @@ -1553,31 +1553,31 @@ static void dump_aud_port_en_hd_cfg(void)
>  
>  	dword = INREG(aud_reg_base + AUD_PORT_EN_HD_CFG);
>  	if (num_pipes == 2) {
> -		printf("AUD_PORT_EN_HD_CFG  Convertor_A_Digen\t\t\t%lu\n",    BIT(dword, 0));
> -		printf("AUD_PORT_EN_HD_CFG  Convertor_B_Digen\t\t\t%lu\n",    BIT(dword, 1));
> -		printf("AUD_PORT_EN_HD_CFG  Convertor_A_Stream_ID\t\t%lu\n",  BITS(dword,  7, 4));
> -		printf("AUD_PORT_EN_HD_CFG  Convertor_B_Stream_ID\t\t%lu\n",  BITS(dword, 11, 8));
> +		printf("AUD_PORT_EN_HD_CFG  Convertor_A_Digen\t\t\t%lu\n",    REG_BIT(dword, 0));
> +		printf("AUD_PORT_EN_HD_CFG  Convertor_B_Digen\t\t\t%lu\n",    REG_BIT(dword, 1));
> +		printf("AUD_PORT_EN_HD_CFG  Convertor_A_Stream_ID\t\t%lu\n",  REG_BITS(dword,  7, 4));
> +		printf("AUD_PORT_EN_HD_CFG  Convertor_B_Stream_ID\t\t%lu\n",  REG_BITS(dword, 11, 8));
>  
> -		printf("AUD_PORT_EN_HD_CFG  Port_B_Out_Enable\t\t\t%lu\n",    BIT(dword, 12));
> -		printf("AUD_PORT_EN_HD_CFG  Port_C_Out_Enable\t\t\t%lu\n",    BIT(dword, 13));
> -		printf("AUD_PORT_EN_HD_CFG  Port_D_Out_Enable\t\t\t%lu\n",    BIT(dword, 14));
> -		printf("AUD_PORT_EN_HD_CFG  Port_B_Amp_Mute_Status\t\t%lu\n", BIT(dword, 16));
> -		printf("AUD_PORT_EN_HD_CFG  Port_C_Amp_Mute_Status\t\t%lu\n", BIT(dword, 17));
> -		printf("AUD_PORT_EN_HD_CFG  Port_D_Amp_Mute_Status\t\t%lu\n", BIT(dword, 18));
> +		printf("AUD_PORT_EN_HD_CFG  Port_B_Out_Enable\t\t\t%lu\n",    REG_BIT(dword, 12));
> +		printf("AUD_PORT_EN_HD_CFG  Port_C_Out_Enable\t\t\t%lu\n",    REG_BIT(dword, 13));
> +		printf("AUD_PORT_EN_HD_CFG  Port_D_Out_Enable\t\t\t%lu\n",    REG_BIT(dword, 14));
> +		printf("AUD_PORT_EN_HD_CFG  Port_B_Amp_Mute_Status\t\t%lu\n", REG_BIT(dword, 16));
> +		printf("AUD_PORT_EN_HD_CFG  Port_C_Amp_Mute_Status\t\t%lu\n", REG_BIT(dword, 17));
> +		printf("AUD_PORT_EN_HD_CFG  Port_D_Amp_Mute_Status\t\t%lu\n", REG_BIT(dword, 18));
>  	} else { /* three pipes */
> -		printf("AUD_PORT_EN_HD_CFG  Convertor_A_Digen\t\t\t%lu\n",    BIT(dword, 0));
> -		printf("AUD_PORT_EN_HD_CFG  Convertor_B_Digen\t\t\t%lu\n",    BIT(dword, 1));
> -		printf("AUD_PORT_EN_HD_CFG  Convertor_C_Digen\t\t\t%lu\n",    BIT(dword, 2));
> -		printf("AUD_PORT_EN_HD_CFG  Convertor_A_Stream_ID\t\t%lu\n",  BITS(dword,  7, 4));
> -		printf("AUD_PORT_EN_HD_CFG  Convertor_B_Stream_ID\t\t%lu\n",  BITS(dword, 11, 8));
> -		printf("AUD_PORT_EN_HD_CFG  Convertor_C_Stream_ID\t\t%lu\n",  BITS(dword, 15, 12));
> +		printf("AUD_PORT_EN_HD_CFG  Convertor_A_Digen\t\t\t%lu\n",    REG_BIT(dword, 0));
> +		printf("AUD_PORT_EN_HD_CFG  Convertor_B_Digen\t\t\t%lu\n",    REG_BIT(dword, 1));
> +		printf("AUD_PORT_EN_HD_CFG  Convertor_C_Digen\t\t\t%lu\n",    REG_BIT(dword, 2));
> +		printf("AUD_PORT_EN_HD_CFG  Convertor_A_Stream_ID\t\t%lu\n",  REG_BITS(dword,  7, 4));
> +		printf("AUD_PORT_EN_HD_CFG  Convertor_B_Stream_ID\t\t%lu\n",  REG_BITS(dword, 11, 8));
> +		printf("AUD_PORT_EN_HD_CFG  Convertor_C_Stream_ID\t\t%lu\n",  REG_BITS(dword, 15, 12));
>  
> -		printf("AUD_PORT_EN_HD_CFG  Port_B_Out_Enable\t\t\t%lu\n",    BIT(dword, 16));
> -		printf("AUD_PORT_EN_HD_CFG  Port_C_Out_Enable\t\t\t%lu\n",    BIT(dword, 17));
> -		printf("AUD_PORT_EN_HD_CFG  Port_D_Out_Enable\t\t\t%lu\n",    BIT(dword, 18));
> -		printf("AUD_PORT_EN_HD_CFG  Port_B_Amp_Mute_Status\t\t%lu\n", BIT(dword, 20));
> -		printf("AUD_PORT_EN_HD_CFG  Port_C_Amp_Mute_Status\t\t%lu\n", BIT(dword, 21));
> -		printf("AUD_PORT_EN_HD_CFG  Port_D_Amp_Mute_Status\t\t%lu\n", BIT(dword, 22));
> +		printf("AUD_PORT_EN_HD_CFG  Port_B_Out_Enable\t\t\t%lu\n",    REG_BIT(dword, 16));
> +		printf("AUD_PORT_EN_HD_CFG  Port_C_Out_Enable\t\t\t%lu\n",    REG_BIT(dword, 17));
> +		printf("AUD_PORT_EN_HD_CFG  Port_D_Out_Enable\t\t\t%lu\n",    REG_BIT(dword, 18));
> +		printf("AUD_PORT_EN_HD_CFG  Port_B_Amp_Mute_Status\t\t%lu\n", REG_BIT(dword, 20));
> +		printf("AUD_PORT_EN_HD_CFG  Port_C_Amp_Mute_Status\t\t%lu\n", REG_BIT(dword, 21));
> +		printf("AUD_PORT_EN_HD_CFG  Port_D_Amp_Mute_Status\t\t%lu\n", REG_BIT(dword, 22));
>  	}
>  }
>  
> @@ -1586,19 +1586,19 @@ static void dump_aud_pipe_conv_cfg(void)
>  	uint32_t dword;
>  
>  	dword = INREG(aud_reg_base + AUD_PIPE_CONV_CFG);
> -	printf("AUD_PIPE_CONV_CFG  Convertor_1_Digen\t\t\t%lu\n",    BIT(dword, 0));
> -	printf("AUD_PIPE_CONV_CFG  Convertor_2_Digen\t\t\t%lu\n",    BIT(dword, 1));
> -	printf("AUD_PIPE_CONV_CFG  Convertor_3_Digen\t\t\t%lu\n",    BIT(dword, 2));
> -	printf("AUD_PIPE_CONV_CFG  Convertor_1_Stream_ID\t\t%lu\n",  BITS(dword,  7, 4));
> -	printf("AUD_PIPE_CONV_CFG  Convertor_2_Stream_ID\t\t%lu\n",  BITS(dword, 11, 8));
> -	printf("AUD_PIPE_CONV_CFG  Convertor_3_Stream_ID\t\t%lu\n",  BITS(dword, 15, 12));
> +	printf("AUD_PIPE_CONV_CFG  Convertor_1_Digen\t\t\t%lu\n",    REG_BIT(dword, 0));
> +	printf("AUD_PIPE_CONV_CFG  Convertor_2_Digen\t\t\t%lu\n",    REG_BIT(dword, 1));
> +	printf("AUD_PIPE_CONV_CFG  Convertor_3_Digen\t\t\t%lu\n",    REG_BIT(dword, 2));
> +	printf("AUD_PIPE_CONV_CFG  Convertor_1_Stream_ID\t\t%lu\n",  REG_BITS(dword,  7, 4));
> +	printf("AUD_PIPE_CONV_CFG  Convertor_2_Stream_ID\t\t%lu\n",  REG_BITS(dword, 11, 8));
> +	printf("AUD_PIPE_CONV_CFG  Convertor_3_Stream_ID\t\t%lu\n",  REG_BITS(dword, 15, 12));
>  
> -	printf("AUD_PIPE_CONV_CFG  Port_B_Out_Enable\t\t\t%lu\n",    BIT(dword, 16));
> -	printf("AUD_PIPE_CONV_CFG  Port_C_Out_Enable\t\t\t%lu\n",    BIT(dword, 17));
> -	printf("AUD_PIPE_CONV_CFG  Port_D_Out_Enable\t\t\t%lu\n",    BIT(dword, 18));
> -	printf("AUD_PIPE_CONV_CFG  Port_B_Amp_Mute_Status\t\t%lu\n", BIT(dword, 20));
> -	printf("AUD_PIPE_CONV_CFG  Port_C_Amp_Mute_Status\t\t%lu\n", BIT(dword, 21));
> -	printf("AUD_PIPE_CONV_CFG  Port_D_Amp_Mute_Status\t\t%lu\n", BIT(dword, 22));
> +	printf("AUD_PIPE_CONV_CFG  Port_B_Out_Enable\t\t\t%lu\n",    REG_BIT(dword, 16));
> +	printf("AUD_PIPE_CONV_CFG  Port_C_Out_Enable\t\t\t%lu\n",    REG_BIT(dword, 17));
> +	printf("AUD_PIPE_CONV_CFG  Port_D_Out_Enable\t\t\t%lu\n",    REG_BIT(dword, 18));
> +	printf("AUD_PIPE_CONV_CFG  Port_B_Amp_Mute_Status\t\t%lu\n", REG_BIT(dword, 20));
> +	printf("AUD_PIPE_CONV_CFG  Port_C_Amp_Mute_Status\t\t%lu\n", REG_BIT(dword, 21));
> +	printf("AUD_PIPE_CONV_CFG  Port_D_Amp_Mute_Status\t\t%lu\n", REG_BIT(dword, 22));
>  }
>  
>  static void dump_aud_dig_cnvt(int index)
> @@ -1614,16 +1614,16 @@ static void dump_aud_dig_cnvt(int index)
>  		sprintf(prefix, "AUD_C%c_DIG_CNVT   ", '1' + index - CONVERTER_1);
>  	}
>  
> -	printf("%s  V\t\t\t\t\t%lu\n",               prefix, BIT(dword, 1));
> -	printf("%s  VCFG\t\t\t\t%lu\n",              prefix, BIT(dword, 2));
> -	printf("%s  PRE\t\t\t\t\t%lu\n",             prefix, BIT(dword, 3));
> -	printf("%s  Copy\t\t\t\t%lu\n",              prefix, BIT(dword, 4));
> -	printf("%s  NonAudio\t\t\t\t%lu\n",          prefix, BIT(dword, 5));
> -	printf("%s  PRO\t\t\t\t\t%lu\n",             prefix, BIT(dword, 6));
> -	printf("%s  Level\t\t\t\t%lu\n",             prefix, BIT(dword, 7));
> -	printf("%s  Category_Code\t\t\t%lu\n",       prefix, BITS(dword, 14, 8));
> -	printf("%s  Lowest_Channel_Number\t\t%lu\n", prefix, BITS(dword, 19, 16));
> -	printf("%s  Stream_ID\t\t\t\t%lu\n",         prefix, BITS(dword, 23, 20));
> +	printf("%s  V\t\t\t\t\t%lu\n",               prefix, REG_BIT(dword, 1));
> +	printf("%s  VCFG\t\t\t\t%lu\n",              prefix, REG_BIT(dword, 2));
> +	printf("%s  PRE\t\t\t\t\t%lu\n",             prefix, REG_BIT(dword, 3));
> +	printf("%s  Copy\t\t\t\t%lu\n",              prefix, REG_BIT(dword, 4));
> +	printf("%s  NonAudio\t\t\t\t%lu\n",          prefix, REG_BIT(dword, 5));
> +	printf("%s  PRO\t\t\t\t\t%lu\n",             prefix, REG_BIT(dword, 6));
> +	printf("%s  Level\t\t\t\t%lu\n",             prefix, REG_BIT(dword, 7));
> +	printf("%s  Category_Code\t\t\t%lu\n",       prefix, REG_BITS(dword, 14, 8));
> +	printf("%s  Lowest_Channel_Number\t\t%lu\n", prefix, REG_BITS(dword, 19, 16));
> +	printf("%s  Stream_ID\t\t\t\t%lu\n",         prefix, REG_BITS(dword, 23, 20));
>  }
>  
>  static void dump_aud_str_desc(int index)
> @@ -1640,24 +1640,24 @@ static void dump_aud_str_desc(int index)
>  		sprintf(prefix, "AUD_C%c_STR_DESC  ", '1' + index - CONVERTER_1);
>  	}
>  
> -	printf("%s  Number_of_Channels_in_a_Stream\t%lu\n",   prefix, BITS(dword, 3, 0) + 1);
> -	printf("%s  Bits_per_Sample\t\t\t[%#lx] %s\n",        prefix, BITS(dword, 6, 4),
> -		OPNAME(bits_per_sample, BITS(dword, 6, 4)));
> +	printf("%s  Number_of_Channels_in_a_Stream\t%lu\n",   prefix, REG_BITS(dword, 3, 0) + 1);
> +	printf("%s  Bits_per_Sample\t\t\t[%#lx] %s\n",        prefix, REG_BITS(dword, 6, 4),
> +		OPNAME(bits_per_sample, REG_BITS(dword, 6, 4)));
>  
> -	printf("%s  Sample_Base_Rate_Divisor\t\t[%#lx] %s\n", prefix, BITS(dword, 10, 8),
> -		OPNAME(sample_base_rate_divisor, BITS(dword, 10, 8)));
> -	printf("%s  Sample_Base_Rate_Mult\t\t[%#lx] %s\n",    prefix, BITS(dword, 13, 11),
> -		OPNAME(sample_base_rate_mult, BITS(dword, 13, 11)));
> -	printf("%s  Sample_Base_Rate\t\t\t[%#lx] %s\t",       prefix, BIT(dword, 14),
> -		OPNAME(sample_base_rate, BIT(dword, 14)));
> -	rate = (BIT(dword, 14) ? 44100 : 48000) * (BITS(dword, 13, 11) + 1)
> -		/(BITS(dword, 10, 8) + 1);
> +	printf("%s  Sample_Base_Rate_Divisor\t\t[%#lx] %s\n", prefix, REG_BITS(dword, 10, 8),
> +		OPNAME(sample_base_rate_divisor, REG_BITS(dword, 10, 8)));
> +	printf("%s  Sample_Base_Rate_Mult\t\t[%#lx] %s\n",    prefix, REG_BITS(dword, 13, 11),
> +		OPNAME(sample_base_rate_mult, REG_BITS(dword, 13, 11)));
> +	printf("%s  Sample_Base_Rate\t\t\t[%#lx] %s\t",       prefix, REG_BIT(dword, 14),
> +		OPNAME(sample_base_rate, REG_BIT(dword, 14)));
> +	rate = (REG_BIT(dword, 14) ? 44100 : 48000) * (REG_BITS(dword, 13, 11) + 1)
> +		/(REG_BITS(dword, 10, 8) + 1);
>  	printf("=> Sample Rate %d Hz\n", rate);
>  
> -	printf("%s  Convertor_Channel_Count\t\t%lu\n",        prefix, BITS(dword, 20, 16) + 1);
> +	printf("%s  Convertor_Channel_Count\t\t%lu\n",        prefix, REG_BITS(dword, 20, 16) + 1);
>  
>  	if (!IS_HASWELL_PLUS(devid))
> -		printf("%s  HBR_enable\t\t\t\t%lu\n",         prefix, BITS(dword, 28, 27));
> +		printf("%s  HBR_enable\t\t\t\t%lu\n",         prefix, REG_BITS(dword, 28, 27));
>  }
>  
>  #define dump_aud_out_ch_str		dump_aud_out_chan_map
> @@ -1671,10 +1671,10 @@ static void dump_aud_out_chan_map(void)
>  		OUTREG(aud_reg_base + AUD_OUT_CHAN_MAP, i | (i << 8) | (i << 16));
>  		dword = INREG(aud_reg_base + AUD_OUT_CHAN_MAP);
>  		printf("\t\t\t\t%lu\t%lu\t%lu\t%lu\n",
> -				1 + BITS(dword,  3,  0),
> -				1 + BITS(dword,  7,  4),
> -				1 + BITS(dword, 15, 12),
> -				1 + BITS(dword, 23, 20));
> +				1 + REG_BITS(dword,  3,  0),
> +				1 + REG_BITS(dword,  7,  4),
> +				1 + REG_BITS(dword, 15, 12),
> +				1 + REG_BITS(dword, 23, 20));
>  	}
>  }
>  
> @@ -1686,10 +1686,10 @@ static void dump_aud_connect_list(void)
>  	dword = INREG(aud_reg_base + AUD_PINW_CONNLNG_LIST);
>  	sprintf(prefix, "AUD_PINW_CONNLNG_LIST");
>  
> -	printf("%s  Connect_List_Length\t\t%lu\n",     prefix, BITS(dword, 6, 0));
> -	printf("%s  Form \t\t\t\t[%#lx] %s\n",         prefix, BIT(dword, 7),
> -		OPNAME(connect_list_form, BIT(dword, 7)));
> -	printf("%s  Connect_List_Entry\t\t%lu, %lu\n", prefix, BITS(dword, 15, 8), BITS(dword, 23, 16));
> +	printf("%s  Connect_List_Length\t\t%lu\n",     prefix, REG_BITS(dword, 6, 0));
> +	printf("%s  Form \t\t\t\t[%#lx] %s\n",         prefix, REG_BIT(dword, 7),
> +		OPNAME(connect_list_form, REG_BIT(dword, 7)));
> +	printf("%s  Connect_List_Entry\t\t%lu, %lu\n", prefix, REG_BITS(dword, 15, 8), REG_BITS(dword, 23, 16));
>  }
>  
>  static void dump_aud_connect_select(void)
> @@ -1706,9 +1706,9 @@ static void dump_aud_connect_select(void)
>  		sprintf(prefix, "AUD_PINW_CONNLNG_SEL  ");
>  	}
>  
> -	printf("%s  Connection_select_Port_B\t%#lx\n", prefix, BITS(dword,  7,  0));
> -	printf("%s  Connection_select_Port_C\t%#lx\n", prefix, BITS(dword, 15,  8));
> -	printf("%s  Connection_select_Port_D\t%#lx\n", prefix, BITS(dword, 23, 16));
> +	printf("%s  Connection_select_Port_B\t%#lx\n", prefix, REG_BITS(dword,  7,  0));
> +	printf("%s  Connection_select_Port_C\t%#lx\n", prefix, REG_BITS(dword, 15,  8));
> +	printf("%s  Connection_select_Port_D\t%#lx\n", prefix, REG_BITS(dword, 23, 16));
>  }
>  
>  static void dump_aud_ctrl_state(int index)
> @@ -1726,16 +1726,16 @@ static void dump_aud_ctrl_state(int index)
>  		printf("Audio control state - Pipe %c\n",  'A' + index - PIPE_A);
>  	}
>  
> -	printf("\tELD_ACK\t\t\t\t\t\t%lu\n",                                 BIT(dword, 4));
> -	printf("\tELD_buffer_size\t\t\t\t\t%lu\n",                           BITS(dword, 14, 10));
> -	printf("\tDIP_transmission_frequency\t\t\t[0x%lx] %s\n",             BITS(dword, 17, 16),
> -		dip_trans[BITS(dword, 17, 16)]);
> -	printf("\tDIP Buffer Index \t\t\t\t[0x%lx] %s\n",                    BITS(dword, 20, 18),
> -		dip_index[BITS(dword, 20, 18)]);
> -	printf("\tAudio DIP type enable status\t\t\t[0x%04lx] %s, %s, %s\n", BITS(dword, 24, 21),
> -		dip_type[BIT(dword, 21)], dip_gen1_state[BIT(dword, 22)],  dip_gen2_state[BIT(dword, 23)]);
> -	printf("\tAudio DIP port select\t\t\t\t[0x%lx] %s\n",                BITS(dword, 30, 29),
> -		dip_port[BITS(dword, 30, 29)]);
> +	printf("\tELD_ACK\t\t\t\t\t\t%lu\n",                                 REG_BIT(dword, 4));
> +	printf("\tELD_buffer_size\t\t\t\t\t%lu\n",                           REG_BITS(dword, 14, 10));
> +	printf("\tDIP_transmission_frequency\t\t\t[0x%lx] %s\n",             REG_BITS(dword, 17, 16),
> +		dip_trans[REG_BITS(dword, 17, 16)]);
> +	printf("\tDIP Buffer Index \t\t\t\t[0x%lx] %s\n",                    REG_BITS(dword, 20, 18),
> +		dip_index[REG_BITS(dword, 20, 18)]);
> +	printf("\tAudio DIP type enable status\t\t\t[0x%04lx] %s, %s, %s\n", REG_BITS(dword, 24, 21),
> +		dip_type[REG_BIT(dword, 21)], dip_gen1_state[REG_BIT(dword, 22)],  dip_gen2_state[REG_BIT(dword, 23)]);
> +	printf("\tAudio DIP port select\t\t\t\t[0x%lx] %s\n",                REG_BITS(dword, 30, 29),
> +		dip_port[REG_BITS(dword, 30, 29)]);
>  	printf("\n");
>  }
>  
> @@ -1744,12 +1744,12 @@ static void dump_aud_ctrl_state2(void)
>  	uint32_t dword;
>  
>  	dword = INREG(aud_reg_base + AUD_CNTL_ST2);
> -	printf("AUD_CNTL_ST2  ELD_validB\t\t\t\t%lu\n",  BIT(dword, 0));
> -	printf("AUD_CNTL_ST2  CP_ReadyB\t\t\t\t\t%lu\n", BIT(dword, 1));
> -	printf("AUD_CNTL_ST2  ELD_validC\t\t\t\t%lu\n",  BIT(dword, 4));
> -	printf("AUD_CNTL_ST2  CP_ReadyC\t\t\t\t\t%lu\n", BIT(dword, 5));
> -	printf("AUD_CNTL_ST2  ELD_validD\t\t\t\t%lu\n",  BIT(dword, 8));
> -	printf("AUD_CNTL_ST2  CP_ReadyD\t\t\t\t\t%lu\n", BIT(dword, 9));
> +	printf("AUD_CNTL_ST2  ELD_validB\t\t\t\t%lu\n",  REG_BIT(dword, 0));
> +	printf("AUD_CNTL_ST2  CP_ReadyB\t\t\t\t\t%lu\n", REG_BIT(dword, 1));
> +	printf("AUD_CNTL_ST2  ELD_validC\t\t\t\t%lu\n",  REG_BIT(dword, 4));
> +	printf("AUD_CNTL_ST2  CP_ReadyC\t\t\t\t\t%lu\n", REG_BIT(dword, 5));
> +	printf("AUD_CNTL_ST2  ELD_validD\t\t\t\t%lu\n",  REG_BIT(dword, 8));
> +	printf("AUD_CNTL_ST2  CP_ReadyD\t\t\t\t\t%lu\n", REG_BIT(dword, 9));
>  }
>  
>  /* for hsw+ */
> @@ -1758,18 +1758,18 @@ static void dump_aud_eld_cp_vld(void)
>  	uint32_t dword;
>  
>  	dword = INREG(aud_reg_base + AUD_PIN_ELD_CP_VLD);
> -	printf("AUD_PIN_ELD_CP_VLD  Transcoder_A ELD_valid\t\t%lu\n",	BIT(dword, 0));
> -	printf("AUD_PIN_ELD_CP_VLD  Transcoder_A CP_Ready \t\t%lu\n",	BIT(dword, 1));
> -	printf("AUD_PIN_ELD_CP_VLD  Transcoder_A Out_enable\t\t%lu\n",	BIT(dword, 2));
> -	printf("AUD_PIN_ELD_CP_VLD  Transcoder_A Inactive\t\t%lu\n",	BIT(dword, 3));
> -	printf("AUD_PIN_ELD_CP_VLD  Transcoder_B ELD_valid\t\t%lu\n",	BIT(dword, 4));
> -	printf("AUD_PIN_ELD_CP_VLD  Transcoder_B CP_Ready\t\t%lu\n",	BIT(dword, 5));
> -	printf("AUD_PIN_ELD_CP_VLD  Transcoder_B OUT_enable\t\t%lu\n",	BIT(dword, 6));
> -	printf("AUD_PIN_ELD_CP_VLD  Transcoder_B Inactive\t\t%lu\n",    BIT(dword, 7));
> -	printf("AUD_PIN_ELD_CP_VLD  Transcoder_C ELD_valid\t\t%lu\n",	BIT(dword, 8));
> -	printf("AUD_PIN_ELD_CP_VLD  Transcoder_C CP_Ready\t\t%lu\n",	BIT(dword, 9));
> -	printf("AUD_PIN_ELD_CP_VLD  Transcoder_C OUT_enable\t\t%lu\n",	BIT(dword, 10));
> -	printf("AUD_PIN_ELD_CP_VLD  Transcoder_C Inactive\t\t%lu\n",    BIT(dword, 11));
> +	printf("AUD_PIN_ELD_CP_VLD  Transcoder_A ELD_valid\t\t%lu\n",	REG_BIT(dword, 0));
> +	printf("AUD_PIN_ELD_CP_VLD  Transcoder_A CP_Ready \t\t%lu\n",	REG_BIT(dword, 1));
> +	printf("AUD_PIN_ELD_CP_VLD  Transcoder_A Out_enable\t\t%lu\n",	REG_BIT(dword, 2));
> +	printf("AUD_PIN_ELD_CP_VLD  Transcoder_A Inactive\t\t%lu\n",	REG_BIT(dword, 3));
> +	printf("AUD_PIN_ELD_CP_VLD  Transcoder_B ELD_valid\t\t%lu\n",	REG_BIT(dword, 4));
> +	printf("AUD_PIN_ELD_CP_VLD  Transcoder_B CP_Ready\t\t%lu\n",	REG_BIT(dword, 5));
> +	printf("AUD_PIN_ELD_CP_VLD  Transcoder_B OUT_enable\t\t%lu\n",	REG_BIT(dword, 6));
> +	printf("AUD_PIN_ELD_CP_VLD  Transcoder_B Inactive\t\t%lu\n",    REG_BIT(dword, 7));
> +	printf("AUD_PIN_ELD_CP_VLD  Transcoder_C ELD_valid\t\t%lu\n",	REG_BIT(dword, 8));
> +	printf("AUD_PIN_ELD_CP_VLD  Transcoder_C CP_Ready\t\t%lu\n",	REG_BIT(dword, 9));
> +	printf("AUD_PIN_ELD_CP_VLD  Transcoder_C OUT_enable\t\t%lu\n",	REG_BIT(dword, 10));
> +	printf("AUD_PIN_ELD_CP_VLD  Transcoder_C Inactive\t\t%lu\n",    REG_BIT(dword, 11));
>  }
>  
>  static void dump_aud_hdmi_status(void)
> @@ -1777,12 +1777,12 @@ static void dump_aud_hdmi_status(void)
>  	uint32_t dword;
>  
>  	dword = INREG(aud_reg_base + AUD_HDMIW_STATUS);
> -	printf("AUD_HDMIW_STATUS  Function_Reset\t\t\t%lu\n",                BIT(dword, 24));
> -	printf("AUD_HDMIW_STATUS  BCLK/CDCLK_FIFO_Overrun\t\t%lu\n",	     BIT(dword, 25));
> -	printf("AUD_HDMIW_STATUS  Conv_A_CDCLK/DOTCLK_FIFO_Overrun\t%lu\n",  BIT(dword, 28));
> -	printf("AUD_HDMIW_STATUS  Conv_A_CDCLK/DOTCLK_FIFO_Underrun\t%lu\n", BIT(dword, 29));
> -	printf("AUD_HDMIW_STATUS  Conv_B_CDCLK/DOTCLK_FIFO_Overrun\t%lu\n",  BIT(dword, 30));
> -	printf("AUD_HDMIW_STATUS  Conv_B_CDCLK/DOTCLK_FIFO_Underrun\t%lu\n", BIT(dword, 31));
> +	printf("AUD_HDMIW_STATUS  Function_Reset\t\t\t%lu\n",                REG_BIT(dword, 24));
> +	printf("AUD_HDMIW_STATUS  BCLK/CDCLK_FIFO_Overrun\t\t%lu\n",	     REG_BIT(dword, 25));
> +	printf("AUD_HDMIW_STATUS  Conv_A_CDCLK/DOTCLK_FIFO_Overrun\t%lu\n",  REG_BIT(dword, 28));
> +	printf("AUD_HDMIW_STATUS  Conv_A_CDCLK/DOTCLK_FIFO_Underrun\t%lu\n", REG_BIT(dword, 29));
> +	printf("AUD_HDMIW_STATUS  Conv_B_CDCLK/DOTCLK_FIFO_Overrun\t%lu\n",  REG_BIT(dword, 30));
> +	printf("AUD_HDMIW_STATUS  Conv_B_CDCLK/DOTCLK_FIFO_Underrun\t%lu\n", REG_BIT(dword, 31));
>  }
>  
>  /*
> @@ -1818,13 +1818,13 @@ static void dump_dp_port_ctrl(int port)
>  
>  	port_ctrl = disp_reg_base + DP_CTL_B + (port - PORT_B) * 0x100;
>  	dword = INREG(port_ctrl);
> -	printf("%s DisplayPort_Enable\t\t\t\t\t%lu\n",        prefix, BIT(dword, 31));
> -	printf("%s Transcoder_Select\t\t\t\t\t%s\n",          prefix, BIT(dword, 30) ? "Transcoder B" : "Transcoder A");
> -	printf("%s Port_Width_Selection\t\t\t\t[0x%lx] %s\n", prefix, BITS(dword, 21, 19),
> -		dp_port_width[BITS(dword, 21, 19)]);
> -	printf("%s Port_Detected\t\t\t\t\t%lu\n",             prefix, BIT(dword, 2));
> -	printf("%s HDCP_Port_Select\t\t\t\t\t%lu\n",          prefix, BIT(dword, 5));
> -	printf("%s Audio_Output_Enable\t\t\t\t%lu\n",         prefix, BIT(dword, 6));
> +	printf("%s DisplayPort_Enable\t\t\t\t\t%lu\n",        prefix, REG_BIT(dword, 31));
> +	printf("%s Transcoder_Select\t\t\t\t\t%s\n",          prefix, REG_BIT(dword, 30) ? "Transcoder B" : "Transcoder A");
> +	printf("%s Port_Width_Selection\t\t\t\t[0x%lx] %s\n", prefix, REG_BITS(dword, 21, 19),
> +		dp_port_width[REG_BITS(dword, 21, 19)]);
> +	printf("%s Port_Detected\t\t\t\t\t%lu\n",             prefix, REG_BIT(dword, 2));
> +	printf("%s HDCP_Port_Select\t\t\t\t\t%lu\n",          prefix, REG_BIT(dword, 5));
> +	printf("%s Audio_Output_Enable\t\t\t\t%lu\n",         prefix, REG_BIT(dword, 6));
>  }
>  
>  static void dump_hdmi_port_ctrl(int port)
> @@ -1843,13 +1843,13 @@ static void dump_hdmi_port_ctrl(int port)
>  
>  	dword = INREG(port_ctrl);
>  	printf("%s HDMI_Enable\t\t\t\t\t%u\n",                 prefix, !!(dword & SDVO_ENABLE));
> -	printf("%s Transcoder_Select\t\t\t\t%s\n",             prefix, BIT(dword, 30) ? "Transcoder B" : "Transcoder A");
> -	printf("%s HDCP_Port_Select\t\t\t\t%lu\n",             prefix, BIT(dword, 5));
> +	printf("%s Transcoder_Select\t\t\t\t%s\n",             prefix, REG_BIT(dword, 30) ? "Transcoder B" : "Transcoder A");
> +	printf("%s HDCP_Port_Select\t\t\t\t%lu\n",             prefix, REG_BIT(dword, 5));
>  	if (port == PORT_B) /* TODO: check spec, not found in Ibx b-spec, and only for port B? */
> -		printf("%s SDVO Hot Plug Interrupt Detect Enable\t%lu\n", prefix, BIT(dword, 23));
> -	printf("%s Digital_Port_Detected\t\t\t%lu\n",          prefix, BIT(dword, 2));
> -	printf("%s Encoding\t\t\t\t\t[0x%lx] %s\n",            prefix, BITS(dword, 11, 10),
> -		sdvo_hdmi_encoding[BITS(dword, 11, 10)]);
> +		printf("%s SDVO Hot Plug Interrupt Detect Enable\t%lu\n", prefix, REG_BIT(dword, 23));
> +	printf("%s Digital_Port_Detected\t\t\t%lu\n",          prefix, REG_BIT(dword, 2));
> +	printf("%s Encoding\t\t\t\t\t[0x%lx] %s\n",            prefix, REG_BITS(dword, 11, 10),
> +		sdvo_hdmi_encoding[REG_BITS(dword, 11, 10)]);
>  	printf("%s Null_packets_enabled_during_Vsync\t\t%u\n", prefix, !!(dword & SDVO_NULL_PACKETS_DURING_VSYNC));
>  	printf("%s Audio_Output_Enable\t\t\t\t%u\n",           prefix, !!(dword & SDVO_AUDIO_ENABLE));
>  }
> @@ -2032,9 +2032,9 @@ static void dump_ddi_buf_ctl(int port)
>  	dword = INREG(DDI_BUF_CTL_A + (port - PORT_A) * 0x100);
>  	printf("DDI %c Buffer control\n", 'A' + port - PORT_A);
>  
> -	printf("\tDP port width\t\t\t\t\t[0x%lx] %s\n", BITS(dword, 3, 1),
> -		OPNAME(dp_port_width, BITS(dword, 3, 1)));
> -	printf("\tDDI Buffer Enable\t\t\t\t%ld\n",      BIT(dword, 31));
> +	printf("\tDP port width\t\t\t\t\t[0x%lx] %s\n", REG_BITS(dword, 3, 1),
> +		OPNAME(dp_port_width, REG_BITS(dword, 3, 1)));
> +	printf("\tDDI Buffer Enable\t\t\t\t%ld\n",      REG_BIT(dword, 31));
>  }
>  
>  static void dump_ddi_func_ctl(int pipe)
> @@ -2044,13 +2044,13 @@ static void dump_ddi_func_ctl(int pipe)
>  	dword = INREG(PIPE_DDI_FUNC_CTL_A + (pipe - PIPE_A) * 0x1000);
>  	printf("Pipe %c DDI Function Control\n", 'A' + pipe - PIPE_A);
>  
> -	printf("\tBITS per color\t\t\t\t\t[0x%lx] %s\n",    BITS(dword, 22, 20),
> -		OPNAME(bits_per_color, BITS(dword, 22, 20)));
> -	printf("\tPIPE DDI Mode\t\t\t\t\t[0x%lx] %s\n",     BITS(dword, 26, 24),
> -		OPNAME(ddi_mode, BITS(dword, 26, 24)));
> -	printf("\tPIPE DDI selection\t\t\t\t[0x%lx] %s\n",  BITS(dword, 30, 28),
> -		OPNAME(trans_to_port_sel, BITS(dword, 30, 28)));
> -	printf("\tPIPE DDI Function Enable\t\t\t[0x%lx]\n", BIT(dword, 31));
> +	printf("\tREG_BITS per color\t\t\t\t\t[0x%lx] %s\n", REG_BITS(dword, 22, 20),
> +		OPNAME(bits_per_color, REG_BITS(dword, 22, 20)));
> +	printf("\tPIPE DDI Mode\t\t\t\t\t[0x%lx] %s\n",     REG_BITS(dword, 26, 24),
> +		OPNAME(ddi_mode, REG_BITS(dword, 26, 24)));
> +	printf("\tPIPE DDI selection\t\t\t\t[0x%lx] %s\n",  REG_BITS(dword, 30, 28),
> +		OPNAME(trans_to_port_sel, REG_BITS(dword, 30, 28)));
> +	printf("\tPIPE DDI Function Enable\t\t\t[0x%lx]\n", REG_BIT(dword, 31));
>  }
>  
>  static void dump_aud_connect_list_entry_length(int transcoder)
> @@ -2061,10 +2061,10 @@ static void dump_aud_connect_list_entry_length(int transcoder)
>  	dword = INREG(aud_reg_base + AUD_TCA_PIN_PIPE_CONN_ENTRY_LNGTH + (transcoder - TRANSCODER_A) * 0x100);
>  	sprintf(prefix, "AUD_TC%c_PIN_PIPE_CONN_ENTRY_LNGTH", 'A' + transcoder - TRANSCODER_A);
>  
> -	printf("%s  Connect_List_Length\t%lu\n", prefix, BITS(dword, 6, 0));
> -	printf("%s  Form \t\t[%#lx] %s\n",       prefix, BIT(dword, 7),
> -		OPNAME(connect_list_form, BIT(dword, 7)));
> -	printf("%s  Connect_List_Entry\t%lu\n",  prefix, BITS(dword, 15, 8));
> +	printf("%s  Connect_List_Length\t%lu\n", prefix, REG_BITS(dword, 6, 0));
> +	printf("%s  Form \t\t[%#lx] %s\n",       prefix, REG_BIT(dword, 7),
> +		OPNAME(connect_list_form, REG_BIT(dword, 7)));
> +	printf("%s  Connect_List_Entry\t%lu\n",  prefix, REG_BITS(dword, 15, 8));
>  }
>  
>  static void dump_aud_connect_select_ctrl(void)
> @@ -2072,9 +2072,9 @@ static void dump_aud_connect_select_ctrl(void)
>  	uint32_t dword;
>  
>  	dword = INREG(aud_reg_base + AUD_PIPE_CONN_SEL_CTRL);
> -	printf("AUD_PIPE_CONN_SEL_CTRL  Connection_select_Port_B\t%#lx\n", BITS(dword,  7,  0));
> -	printf("AUD_PIPE_CONN_SEL_CTRL  Connection_select_Port_C\t%#lx\n", BITS(dword, 15,  8));
> -	printf("AUD_PIPE_CONN_SEL_CTRL  Connection_select_Port_D\t%#lx\n", BITS(dword, 23, 16));
> +	printf("AUD_PIPE_CONN_SEL_CTRL  Connection_select_Port_B\t%#lx\n", REG_BITS(dword,  7,  0));
> +	printf("AUD_PIPE_CONN_SEL_CTRL  Connection_select_Port_C\t%#lx\n", REG_BITS(dword, 15,  8));
> +	printf("AUD_PIPE_CONN_SEL_CTRL  Connection_select_Port_D\t%#lx\n", REG_BITS(dword, 23, 16));
>  }
>  
>  static void dump_aud_dip_eld_ctrl_st(int transcoder)
> @@ -2085,16 +2085,16 @@ static void dump_aud_dip_eld_ctrl_st(int transcoder)
>  	dword = INREG(aud_reg_base + AUD_TCA_DIP_ELD_CTRL_ST + offset);
>  	printf("Audio DIP and ELD control state for Transcoder %c\n",  'A' + transcoder - TRANSCODER_A);
>  
> -	printf("\tELD_ACK\t\t\t\t\t\t%lu\n",                                 BIT(dword, 4));
> -	printf("\tELD_buffer_size\t\t\t\t\t%lu\n",                           BITS(dword, 14, 10));
> -	printf("\tDIP_transmission_frequency\t\t\t[0x%lx] %s\n",             BITS(dword, 17, 16),
> -		dip_trans[BITS(dword, 17, 16)]);
> -	printf("\tDIP Buffer Index \t\t\t\t[0x%lx] %s\n",                    BITS(dword, 20, 18),
> -		dip_index[BITS(dword, 20, 18)]);
> -	printf("\tAudio DIP type enable status\t\t\t[0x%04lx] %s, %s, %s\n", BITS(dword, 24, 21),
> -		dip_type[BIT(dword, 21)], dip_gen1_state[BIT(dword, 22)],  dip_gen2_state[BIT(dword, 23)]);
> -	printf("\tAudio DIP port select\t\t\t\t[0x%lx] %s\n",                BITS(dword, 30, 29),
> -		dip_port[BITS(dword, 30, 29)]);
> +	printf("\tELD_ACK\t\t\t\t\t\t%lu\n",                                 REG_BIT(dword, 4));
> +	printf("\tELD_buffer_size\t\t\t\t\t%lu\n",                           REG_BITS(dword, 14, 10));
> +	printf("\tDIP_transmission_frequency\t\t\t[0x%lx] %s\n",             REG_BITS(dword, 17, 16),
> +		dip_trans[REG_BITS(dword, 17, 16)]);
> +	printf("\tDIP Buffer Index \t\t\t\t[0x%lx] %s\n",                    REG_BITS(dword, 20, 18),
> +		dip_index[REG_BITS(dword, 20, 18)]);
> +	printf("\tAudio DIP type enable status\t\t\t[0x%04lx] %s, %s, %s\n", REG_BITS(dword, 24, 21),
> +		dip_type[REG_BIT(dword, 21)], dip_gen1_state[REG_BIT(dword, 22)],  dip_gen2_state[REG_BIT(dword, 23)]);
> +	printf("\tAudio DIP port select\t\t\t\t[0x%lx] %s\n",                REG_BITS(dword, 30, 29),
> +		dip_port[REG_BITS(dword, 30, 29)]);
>  	printf("\n");
>  }
>  
> @@ -2103,39 +2103,39 @@ static void dump_aud_hdmi_fifo_status(void)
>  	uint32_t dword;
>  
>  	dword = INREG(aud_reg_base + AUD_HDMI_FIFO_STATUS);
> -	printf("AUD_HDMI_FIFO_STATUS  Function_Reset\t\t\t%lu\n",                BIT(dword, 24));
> -	printf("AUD_HDMI_FIFO_STATUS  Conv_1_CDCLK/DOTCLK_FIFO_Overrun\t%lu\n",  BIT(dword, 26));
> -	printf("AUD_HDMI_FIFO_STATUS  Conv_1_CDCLK/DOTCLK_FIFO_Underrun\t%lu\n", BIT(dword, 27));
> -	printf("AUD_HDMI_FIFO_STATUS  Conv_2_CDCLK/DOTCLK_FIFO_Overrun\t%lu\n",  BIT(dword, 28));
> -	printf("AUD_HDMI_FIFO_STATUS  Conv_2_CDCLK/DOTCLK_FIFO_Underrun\t%lu\n", BIT(dword, 29));
> -	printf("AUD_HDMI_FIFO_STATUS  Conv_3_CDCLK/DOTCLK_FIFO_Overrun\t%lu\n",  BIT(dword, 30));
> -	printf("AUD_HDMI_FIFO_STATUS  Conv_3_CDCLK/DOTCLK_FIFO_Underrun\t%lu\n", BIT(dword, 31));
> +	printf("AUD_HDMI_FIFO_STATUS  Function_Reset\t\t\t%lu\n",                REG_BIT(dword, 24));
> +	printf("AUD_HDMI_FIFO_STATUS  Conv_1_CDCLK/DOTCLK_FIFO_Overrun\t%lu\n",  REG_BIT(dword, 26));
> +	printf("AUD_HDMI_FIFO_STATUS  Conv_1_CDCLK/DOTCLK_FIFO_Underrun\t%lu\n", REG_BIT(dword, 27));
> +	printf("AUD_HDMI_FIFO_STATUS  Conv_2_CDCLK/DOTCLK_FIFO_Overrun\t%lu\n",  REG_BIT(dword, 28));
> +	printf("AUD_HDMI_FIFO_STATUS  Conv_2_CDCLK/DOTCLK_FIFO_Underrun\t%lu\n", REG_BIT(dword, 29));
> +	printf("AUD_HDMI_FIFO_STATUS  Conv_3_CDCLK/DOTCLK_FIFO_Overrun\t%lu\n",  REG_BIT(dword, 30));
> +	printf("AUD_HDMI_FIFO_STATUS  Conv_3_CDCLK/DOTCLK_FIFO_Underrun\t%lu\n", REG_BIT(dword, 31));
>  }
>  
>  static void parse_bdw_audio_chicken_bit_reg(uint32_t dword)
>  {
>  	printf("\t");
> -	printf("%s\n\t", OPNAME(vanilla_dp12_en,           BIT(dword, 31)));
> -	printf("%s\n\t", OPNAME(vanilla_3_widgets_en,      BIT(dword, 30)));
> -	printf("%s\n\t", OPNAME(block_audio,               BIT(dword, 10)));
> -	printf("%s\n\t", OPNAME(dis_eld_valid_pulse_trans, BIT(dword, 9)));
> -	printf("%s\n\t", OPNAME(dis_pd_pulse_trans,        BIT(dword, 8)));
> -	printf("%s\n\t", OPNAME(dis_ts_delta_err,          BIT(dword, 7)));
> -	printf("%s\n\t", OPNAME(dis_ts_fix_dp_hbr,         BIT(dword, 6)));
> -	printf("%s\n\t", OPNAME(pattern_gen_8_ch_en,       BIT(dword, 5)));
> -	printf("%s\n\t", OPNAME(pattern_gen_2_ch_en,       BIT(dword, 4)));
> -	printf("%s\n\t", OPNAME(fabric_32_44_dis,          BIT(dword, 3)));
> -	printf("%s\n\t", OPNAME(epss_dis,                  BIT(dword, 2)));
> -	printf("%s\n\t", OPNAME(ts_test_mode,              BIT(dword, 1)));
> -	printf("%s\n",   OPNAME(en_mmio_program,           BIT(dword, 0)));
> +	printf("%s\n\t", OPNAME(vanilla_dp12_en,           REG_BIT(dword, 31)));
> +	printf("%s\n\t", OPNAME(vanilla_3_widgets_en,      REG_BIT(dword, 30)));
> +	printf("%s\n\t", OPNAME(block_audio,               REG_BIT(dword, 10)));
> +	printf("%s\n\t", OPNAME(dis_eld_valid_pulse_trans, REG_BIT(dword, 9)));
> +	printf("%s\n\t", OPNAME(dis_pd_pulse_trans,        REG_BIT(dword, 8)));
> +	printf("%s\n\t", OPNAME(dis_ts_delta_err,          REG_BIT(dword, 7)));
> +	printf("%s\n\t", OPNAME(dis_ts_fix_dp_hbr,         REG_BIT(dword, 6)));
> +	printf("%s\n\t", OPNAME(pattern_gen_8_ch_en,       REG_BIT(dword, 5)));
> +	printf("%s\n\t", OPNAME(pattern_gen_2_ch_en,       REG_BIT(dword, 4)));
> +	printf("%s\n\t", OPNAME(fabric_32_44_dis,          REG_BIT(dword, 3)));
> +	printf("%s\n\t", OPNAME(epss_dis,                  REG_BIT(dword, 2)));
> +	printf("%s\n\t", OPNAME(ts_test_mode,              REG_BIT(dword, 1)));
> +	printf("%s\n",   OPNAME(en_mmio_program,           REG_BIT(dword, 0)));
>  }
>  
>  static void parse_skl_audio_freq_cntrl_reg(uint32_t dword)
>  {
>  	printf("\t");
> -	printf("%s\n\t", OPNAME(sdi_operate_mode,          BIT(dword, 15)));
> -	printf("%s\n\t", OPNAME(bclk_96mhz,                BIT(dword, 4)));
> -	printf("%s\n",   OPNAME(bclk_48mhz,                BIT(dword, 3)));
> +	printf("%s\n\t", OPNAME(sdi_operate_mode,          REG_BIT(dword, 15)));
> +	printf("%s\n\t", OPNAME(bclk_96mhz,                REG_BIT(dword, 4)));
> +	printf("%s\n",   OPNAME(bclk_48mhz,                REG_BIT(dword, 3)));
>  }
>  
>  /* Dump audio registers for Haswell and its successors (eg. Broadwell).
> @@ -2311,10 +2311,10 @@ static void dump_hsw_plus(void)
>  	dump_aud_hdmi_fifo_status();
>  
>  	dword = read_aud_reg(AUD_ICS);
> -	printf("IRV [%1lx] %s\t", BIT(dword, 1),
> -		OPNAME(immed_result_valid, BIT(dword, 1)));
> -	printf("ICB [%1lx] %s\n", BIT(dword, 1),
> -		OPNAME(immed_cmd_busy, BIT(dword, 0)));
> +	printf("IRV [%1lx] %s\t", REG_BIT(dword, 1),
> +		OPNAME(immed_result_valid, REG_BIT(dword, 1)));
> +	printf("ICB [%1lx] %s\n", REG_BIT(dword, 1),
> +		OPNAME(immed_cmd_busy, REG_BIT(dword, 0)));
>  
>  	dword = read_aud_reg(AUD_CHICKENBIT_REG);
>  	printf("AUD_CHICKENBIT_REG Audio Chicken Bits: %08x\n", dword);
> @@ -2324,7 +2324,7 @@ static void dump_hsw_plus(void)
>  	dword = read_aud_reg(AUD_DP_DIP_STATUS);
>  	printf("AUD_DP_DIP_STATUS Audio DP & DIP FIFO Status: %08x\n\t", dword);
>  	for (i = 31; i >= 0; i--)
> -		if (BIT(dword, i))
> +		if (REG_BIT(dword, i))
>  			printf("%s\n\t", audio_dp_dip_status[i]);
>  	printf("\n");
>  
> -- 
> 2.20.1
>
Quite a long way to come here :)
LGTM
Reviewed-by: Katarzyna Dec <katarzyna.dec@intel.com>
Kasia :)
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [igt-dev] [PATCH i-g-t v2 2/2] lib/intel_chipset: Move BIT macro to common place
  2019-07-03 13:43 ` [igt-dev] [PATCH i-g-t v2 2/2] lib/intel_chipset: Move BIT macro to common place Lukasz Kalamarz
@ 2019-07-04  6:07   ` Katarzyna Dec
  2019-07-04 15:17   ` Michal Wajdeczko
  1 sibling, 0 replies; 7+ messages in thread
From: Katarzyna Dec @ 2019-07-04  6:07 UTC (permalink / raw)
  To: Lukasz Kalamarz, igt-dev

On Wed, Jul 03, 2019 at 03:43:03PM +0200, Lukasz Kalamarz wrote:
> This macro is defined in two tests. We can move it to common place
> in ioctl_wrappers, which is included by all tests.
> v2: Missed intel_device_info lib. Moved BIT definition to
> intel_chipset, which is part of igt.h
> 
> Signed-off-by: Lukasz Kalamarz <lukasz.kalamarz@intel.com>
> Cc: Katarzyna Dec <katarzyna.dec@intel.com>
> Cc: Michal Winiarski <michal.winiarski@intel.com>
> ---
>  lib/intel_chipset.h            | 2 ++
>  lib/intel_device_info.c        | 2 --
>  tests/i915/gem_ctx_isolation.c | 1 -
>  tests/i915/gem_ctx_param.c     | 2 --
>  4 files changed, 2 insertions(+), 5 deletions(-)
> 
> diff --git a/lib/intel_chipset.h b/lib/intel_chipset.h
> index 7fc9bd77..74a40a46 100644
> --- a/lib/intel_chipset.h
> +++ b/lib/intel_chipset.h
> @@ -31,6 +31,8 @@
>  #include <pciaccess.h>
>  #include <stdbool.h>
>  
> +#define BIT(x) (1ul <<(x))
> +
>  struct pci_device *intel_get_pci_device(void);
>  uint32_t intel_get_drm_devid(int fd);
>  
> diff --git a/lib/intel_device_info.c b/lib/intel_device_info.c
> index 88be2917..be192b61 100644
> --- a/lib/intel_device_info.c
> +++ b/lib/intel_device_info.c
> @@ -3,8 +3,6 @@
>  
>  #include <strings.h> /* ffs() */
>  
> -#define BIT(x) (1<<(x))
> -
>  static const struct intel_device_info intel_generic_info = {
>  	.gen = 0,
>  };
> diff --git a/tests/i915/gem_ctx_isolation.c b/tests/i915/gem_ctx_isolation.c
> index 5b054c81..c4302394 100644
> --- a/tests/i915/gem_ctx_isolation.c
> +++ b/tests/i915/gem_ctx_isolation.c
> @@ -33,7 +33,6 @@
>  #define DIRTY2 0x2
>  #define RESET 0x4
>  
> -#define BIT(x) (1ul << (x))
>  #define ENGINE(x, y) BIT(4*(x) + (y))
>  
>  enum {
> diff --git a/tests/i915/gem_ctx_param.c b/tests/i915/gem_ctx_param.c
> index fa0ab520..bd1ee399 100644
> --- a/tests/i915/gem_ctx_param.c
> +++ b/tests/i915/gem_ctx_param.c
> @@ -32,8 +32,6 @@
>  
>  IGT_TEST_DESCRIPTION("Basic test for context set/get param input validation.");
>  
> -#define BIT(x) (1ul << (x))
> -
>  #define NEW_CTX	BIT(0)
>  #define USER BIT(1)
>  
> -- 
> 2.20.1
> 
LGTM
Reviewed-by: Katarzyna Dec <katarzyna.dec@intel.com>
Kasia :)
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [igt-dev] ✗ Fi.CI.IGT: failure for series starting with [i-g-t,v2,1/2] tools/intel_dump_audion: Rename BIT macros to REG_BIT
  2019-07-03 13:43 [igt-dev] [PATCH i-g-t v2 1/2] tools/intel_dump_audion: Rename BIT macros to REG_BIT Lukasz Kalamarz
                   ` (2 preceding siblings ...)
  2019-07-04  6:07 ` [igt-dev] [PATCH i-g-t v2 1/2] " Katarzyna Dec
@ 2019-07-04 12:59 ` Patchwork
  3 siblings, 0 replies; 7+ messages in thread
From: Patchwork @ 2019-07-04 12:59 UTC (permalink / raw)
  To: Lukasz Kalamarz; +Cc: igt-dev

== Series Details ==

Series: series starting with [i-g-t,v2,1/2] tools/intel_dump_audion: Rename BIT macros to REG_BIT
URL   : https://patchwork.freedesktop.org/series/63136/
State : failure

== Summary ==

CI Bug Log - changes from IGT_5081_full -> IGTPW_3233_full
====================================================

Summary
-------

  **FAILURE**

  Serious unknown changes coming with IGTPW_3233_full absolutely need to be
  verified manually.
  
  If you think the reported changes have nothing to do with the changes
  introduced in IGTPW_3233_full, please notify your bug team to allow them
  to document this new failure mode, which will reduce false positives in CI.

  External URL: https://patchwork.freedesktop.org/api/1.0/series/63136/revisions/1/mbox/

Possible new issues
-------------------

  Here are the unknown changes that may have been introduced in IGTPW_3233_full:

### IGT changes ###

#### Possible regressions ####

  * igt@gem_busy@close-race:
    - shard-snb:          [PASS][1] -> [DMESG-FAIL][2]
   [1]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_5081/shard-snb5/igt@gem_busy@close-race.html
   [2]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3233/shard-snb2/igt@gem_busy@close-race.html

  * igt@runner@aborted:
    - shard-snb:          NOTRUN -> [FAIL][3]
   [3]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3233/shard-snb2/igt@runner@aborted.html

  
Known issues
------------

  Here are the changes found in IGTPW_3233_full that come from known issues:

### IGT changes ###

#### Issues hit ####

  * igt@gem_busy@close-race:
    - shard-iclb:         [PASS][4] -> [DMESG-FAIL][5] ([fdo#111063])
   [4]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_5081/shard-iclb5/igt@gem_busy@close-race.html
   [5]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3233/shard-iclb5/igt@gem_busy@close-race.html

  * igt@gem_eio@reset-stress:
    - shard-kbl:          [PASS][6] -> [FAIL][7] ([fdo#109661])
   [6]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_5081/shard-kbl1/igt@gem_eio@reset-stress.html
   [7]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3233/shard-kbl7/igt@gem_eio@reset-stress.html

  * igt@kms_frontbuffer_tracking@fbc-rgb565-draw-pwrite:
    - shard-iclb:         [PASS][8] -> [FAIL][9] ([fdo#103167]) +6 similar issues
   [8]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_5081/shard-iclb4/igt@kms_frontbuffer_tracking@fbc-rgb565-draw-pwrite.html
   [9]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3233/shard-iclb7/igt@kms_frontbuffer_tracking@fbc-rgb565-draw-pwrite.html

  * igt@kms_plane@plane-panning-bottom-right-suspend-pipe-b-planes:
    - shard-apl:          [PASS][10] -> [DMESG-WARN][11] ([fdo#108566]) +4 similar issues
   [10]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_5081/shard-apl4/igt@kms_plane@plane-panning-bottom-right-suspend-pipe-b-planes.html
   [11]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3233/shard-apl3/igt@kms_plane@plane-panning-bottom-right-suspend-pipe-b-planes.html

  * igt@kms_psr@psr2_cursor_mmap_cpu:
    - shard-iclb:         [PASS][12] -> [SKIP][13] ([fdo#109441]) +1 similar issue
   [12]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_5081/shard-iclb2/igt@kms_psr@psr2_cursor_mmap_cpu.html
   [13]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3233/shard-iclb4/igt@kms_psr@psr2_cursor_mmap_cpu.html

  
#### Possible fixes ####

  * igt@gem_busy@close-race:
    - shard-hsw:          [DMESG-FAIL][14] ([fdo#111063]) -> [PASS][15]
   [14]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_5081/shard-hsw5/igt@gem_busy@close-race.html
   [15]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3233/shard-hsw8/igt@gem_busy@close-race.html

  * igt@gem_softpin@noreloc-s3:
    - shard-kbl:          [INCOMPLETE][16] ([fdo#103665]) -> [PASS][17]
   [16]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_5081/shard-kbl4/igt@gem_softpin@noreloc-s3.html
   [17]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3233/shard-kbl7/igt@gem_softpin@noreloc-s3.html

  * igt@gem_tiled_swapping@non-threaded:
    - shard-glk:          [DMESG-WARN][18] ([fdo#108686]) -> [PASS][19]
   [18]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_5081/shard-glk2/igt@gem_tiled_swapping@non-threaded.html
   [19]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3233/shard-glk4/igt@gem_tiled_swapping@non-threaded.html

  * igt@gem_workarounds@suspend-resume-context:
    - shard-apl:          [DMESG-WARN][20] ([fdo#108566]) -> [PASS][21] +3 similar issues
   [20]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_5081/shard-apl8/igt@gem_workarounds@suspend-resume-context.html
   [21]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3233/shard-apl3/igt@gem_workarounds@suspend-resume-context.html

  * igt@i915_pm_lpsp@screens-disabled:
    - shard-hsw:          [FAIL][22] ([fdo#110383]) -> [PASS][23]
   [22]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_5081/shard-hsw7/igt@i915_pm_lpsp@screens-disabled.html
   [23]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3233/shard-hsw7/igt@i915_pm_lpsp@screens-disabled.html

  * igt@i915_pm_rpm@fences-dpms:
    - shard-iclb:         [INCOMPLETE][24] ([fdo#107713] / [fdo#108840]) -> [PASS][25]
   [24]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_5081/shard-iclb2/igt@i915_pm_rpm@fences-dpms.html
   [25]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3233/shard-iclb3/igt@i915_pm_rpm@fences-dpms.html

  * igt@i915_pm_rpm@i2c:
    - shard-hsw:          [FAIL][26] ([fdo#104097]) -> [PASS][27]
   [26]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_5081/shard-hsw4/igt@i915_pm_rpm@i2c.html
   [27]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3233/shard-hsw6/igt@i915_pm_rpm@i2c.html

  * igt@kms_flip@modeset-vs-vblank-race:
    - shard-apl:          [FAIL][28] ([fdo#103060]) -> [PASS][29]
   [28]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_5081/shard-apl6/igt@kms_flip@modeset-vs-vblank-race.html
   [29]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3233/shard-apl6/igt@kms_flip@modeset-vs-vblank-race.html

  * igt@kms_frontbuffer_tracking@fbc-stridechange:
    - shard-iclb:         [FAIL][30] ([fdo#103167]) -> [PASS][31] +6 similar issues
   [30]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_5081/shard-iclb2/igt@kms_frontbuffer_tracking@fbc-stridechange.html
   [31]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3233/shard-iclb7/igt@kms_frontbuffer_tracking@fbc-stridechange.html

  * igt@kms_psr@psr2_basic:
    - shard-iclb:         [SKIP][32] ([fdo#109441]) -> [PASS][33] +2 similar issues
   [32]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_5081/shard-iclb1/igt@kms_psr@psr2_basic.html
   [33]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3233/shard-iclb2/igt@kms_psr@psr2_basic.html

  * igt@kms_setmode@basic:
    - shard-apl:          [FAIL][34] ([fdo#99912]) -> [PASS][35]
   [34]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_5081/shard-apl7/igt@kms_setmode@basic.html
   [35]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3233/shard-apl4/igt@kms_setmode@basic.html

  * igt@perf_pmu@rc6:
    - shard-kbl:          [SKIP][36] ([fdo#109271]) -> [PASS][37]
   [36]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_5081/shard-kbl1/igt@perf_pmu@rc6.html
   [37]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3233/shard-kbl2/igt@perf_pmu@rc6.html

  
#### Warnings ####

  * igt@kms_content_protection@legacy:
    - shard-iclb:         [SKIP][38] ([fdo#109300]) -> [SKIP][39] ([fdo#109300] / [fdo#111066]) +1 similar issue
   [38]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_5081/shard-iclb7/igt@kms_content_protection@legacy.html
   [39]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3233/shard-iclb1/igt@kms_content_protection@legacy.html

  
  [fdo#103060]: https://bugs.freedesktop.org/show_bug.cgi?id=103060
  [fdo#103167]: https://bugs.freedesktop.org/show_bug.cgi?id=103167
  [fdo#103665]: https://bugs.freedesktop.org/show_bug.cgi?id=103665
  [fdo#104097]: https://bugs.freedesktop.org/show_bug.cgi?id=104097
  [fdo#107713]: https://bugs.freedesktop.org/show_bug.cgi?id=107713
  [fdo#108566]: https://bugs.freedesktop.org/show_bug.cgi?id=108566
  [fdo#108686]: https://bugs.freedesktop.org/show_bug.cgi?id=108686
  [fdo#108840]: https://bugs.freedesktop.org/show_bug.cgi?id=108840
  [fdo#109271]: https://bugs.freedesktop.org/show_bug.cgi?id=109271
  [fdo#109300]: https://bugs.freedesktop.org/show_bug.cgi?id=109300
  [fdo#109441]: https://bugs.freedesktop.org/show_bug.cgi?id=109441
  [fdo#109661]: https://bugs.freedesktop.org/show_bug.cgi?id=109661
  [fdo#110383]: https://bugs.freedesktop.org/show_bug.cgi?id=110383
  [fdo#111063]: https://bugs.freedesktop.org/show_bug.cgi?id=111063
  [fdo#111066]: https://bugs.freedesktop.org/show_bug.cgi?id=111066
  [fdo#99912]: https://bugs.freedesktop.org/show_bug.cgi?id=99912


Participating hosts (7 -> 6)
------------------------------

  Missing    (1): shard-skl 


Build changes
-------------

  * IGT: IGT_5081 -> IGTPW_3233

  CI_DRM_6404: 1b853e6e181c6015faca908b57956ea836e1f440 @ git://anongit.freedesktop.org/gfx-ci/linux
  IGTPW_3233: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3233/
  IGT_5081: 6ccba39a4395a5bf92add495ab77d3973e05dd2b @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3233/
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [igt-dev] [PATCH i-g-t v2 2/2] lib/intel_chipset: Move BIT macro to common place
  2019-07-03 13:43 ` [igt-dev] [PATCH i-g-t v2 2/2] lib/intel_chipset: Move BIT macro to common place Lukasz Kalamarz
  2019-07-04  6:07   ` Katarzyna Dec
@ 2019-07-04 15:17   ` Michal Wajdeczko
  1 sibling, 0 replies; 7+ messages in thread
From: Michal Wajdeczko @ 2019-07-04 15:17 UTC (permalink / raw)
  To: igt-dev, Lukasz Kalamarz

On Wed, 03 Jul 2019 15:43:03 +0200, Lukasz Kalamarz  
<lukasz.kalamarz@intel.com> wrote:

> This macro is defined in two tests. We can move it to common place
> in ioctl_wrappers, which is included by all tests.
> v2: Missed intel_device_info lib. Moved BIT definition to
> intel_chipset, which is part of igt.h
>
> Signed-off-by: Lukasz Kalamarz <lukasz.kalamarz@intel.com>
> Cc: Katarzyna Dec <katarzyna.dec@intel.com>
> Cc: Michal Winiarski <michal.winiarski@intel.com>
> ---
>  lib/intel_chipset.h            | 2 ++
>  lib/intel_device_info.c        | 2 --
>  tests/i915/gem_ctx_isolation.c | 1 -
>  tests/i915/gem_ctx_param.c     | 2 --
>  4 files changed, 2 insertions(+), 5 deletions(-)
>
> diff --git a/lib/intel_chipset.h b/lib/intel_chipset.h
> index 7fc9bd77..74a40a46 100644
> --- a/lib/intel_chipset.h
> +++ b/lib/intel_chipset.h
> @@ -31,6 +31,8 @@
>  #include <pciaccess.h>
>  #include <stdbool.h>
> +#define BIT(x) (1ul <<(x))
> +

instead of polluting innocent header file and introduce new
dependency on "intel_chipset.h" to use BIT macro, maybe better
option would be to create new header for such utilities and then:

	#include "igt_utils.h"
or
	#include "igt_bitops.h"

in intel_device_info.c and igt.h.

Michal
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2019-07-04 15:17 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-03 13:43 [igt-dev] [PATCH i-g-t v2 1/2] tools/intel_dump_audion: Rename BIT macros to REG_BIT Lukasz Kalamarz
2019-07-03 13:43 ` [igt-dev] [PATCH i-g-t v2 2/2] lib/intel_chipset: Move BIT macro to common place Lukasz Kalamarz
2019-07-04  6:07   ` Katarzyna Dec
2019-07-04 15:17   ` Michal Wajdeczko
2019-07-03 14:20 ` [igt-dev] ✓ Fi.CI.BAT: success for series starting with [i-g-t,v2,1/2] tools/intel_dump_audion: Rename BIT macros to REG_BIT Patchwork
2019-07-04  6:07 ` [igt-dev] [PATCH i-g-t v2 1/2] " Katarzyna Dec
2019-07-04 12:59 ` [igt-dev] ✗ Fi.CI.IGT: failure for series starting with [i-g-t,v2,1/2] " Patchwork

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.