[igt-dev] [PATCH i-g-t v2 1/2] tools/intel_dump_audion: Rename BIT macros to REG_BIT

Katarzyna Dec katarzyna.dec at intel.com
Thu Jul 4 06:07:09 UTC 2019


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 at intel.com>
> Cc: Zhenyu Wang <zhenyu.z.wang at intel.com>
> Cc: Wu Fengguang <fengguang.wu at intel.com>
> Cc: Katarzyna Dec <katarzyna.dec at intel.com>
> Cc: Michal Winiarski <michal.winiarski at 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 at intel.com>
Kasia :)


More information about the igt-dev mailing list