All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/4] aic7xxx: fix debugging printks
@ 2017-08-03 23:28 Michał Mirosław
  2017-08-03 23:28 ` [PATCH v2 1/5] aic7xxx: remove empty function Michał Mirosław
                   ` (5 more replies)
  0 siblings, 6 replies; 13+ messages in thread
From: Michał Mirosław @ 2017-08-03 23:28 UTC (permalink / raw)
  To: Hannes Reinecke, James E.J. Bottomley, Martin K. Petersen; +Cc: linux-scsi

This series aims to clean up printing of card state after a problem event.
Currently, the output is pretty much unreadable, as it is spread over a lot
of single-word lines.

This series compiles (on x86), but is not tested, yet.

v2: rebased after 516b7db593 ("scsi: aic7xxx: fix firmware build with O=path")


Michał Mirosław (5):
  aic7xxx: remove empty function
  aic7xxx: fix firmware build deps
  aic7xxx: remove rules for shipped files
  aic7xxx: regenerate firmware files
  aic7[9x]xx: printk() lines unbroken

 drivers/scsi/Kconfig                             |    3 +-
 drivers/scsi/aic7xxx/Kconfig                     |    6 +
 drivers/scsi/aic7xxx/Kconfig.aic79xx             |    1 +
 drivers/scsi/aic7xxx/Kconfig.aic7xxx             |    1 +
 drivers/scsi/aic7xxx/Makefile                    |   11 +-
 drivers/scsi/aic7xxx/aic79xx.h                   |    7 -
 drivers/scsi/aic7xxx/aic79xx_core.c              |  242 ++--
 drivers/scsi/aic7xxx/aic79xx_reg.h_shipped       | 1560 +++++-----------------
 drivers/scsi/aic7xxx/aic79xx_reg_print.c_shipped |  504 +++----
 drivers/scsi/aic7xxx/aic7xxx.h                   |    7 -
 drivers/scsi/aic7xxx/aic7xxx_core.c              |  182 +--
 drivers/scsi/aic7xxx/aic7xxx_osm.c               |    5 -
 drivers/scsi/aic7xxx/aic7xxx_osm.h               |    1 -
 drivers/scsi/aic7xxx/aic7xxx_reg.h_shipped       |  201 ++-
 drivers/scsi/aic7xxx/aic7xxx_reg_print.c_shipped |  242 ++--
 drivers/scsi/aic7xxx/aicasm/aicasm_symbol.c      |   39 +-
 drivers/scsi/aic7xxx/aiclib.c                    |  103 +-
 drivers/scsi/aic7xxx/aiclib.h                    |   32 +
 18 files changed, 1098 insertions(+), 2049 deletions(-)
 create mode 100644 drivers/scsi/aic7xxx/Kconfig

-- 
2.11.0

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

* [PATCH v2 1/5] aic7xxx: remove empty function
  2017-08-03 23:28 [PATCH v2 0/4] aic7xxx: fix debugging printks Michał Mirosław
@ 2017-08-03 23:28 ` Michał Mirosław
  2017-08-04  8:37   ` Hannes Reinecke
  2017-08-03 23:28 ` [PATCH v2 2/5] aic7xxx: fix firmware build deps Michał Mirosław
                   ` (4 subsequent siblings)
  5 siblings, 1 reply; 13+ messages in thread
From: Michał Mirosław @ 2017-08-03 23:28 UTC (permalink / raw)
  To: Hannes Reinecke, James E.J. Bottomley, Martin K. Petersen; +Cc: linux-scsi


ahc_platform_dump_card_state() does nothing. Remove it.

Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
---
 drivers/scsi/aic7xxx/aic7xxx_core.c | 1 -
 drivers/scsi/aic7xxx/aic7xxx_osm.c  | 5 -----
 drivers/scsi/aic7xxx/aic7xxx_osm.h  | 1 -
 3 files changed, 7 deletions(-)

diff --git a/drivers/scsi/aic7xxx/aic7xxx_core.c b/drivers/scsi/aic7xxx/aic7xxx_core.c
index 64ab9eaec428..381846164003 100644
--- a/drivers/scsi/aic7xxx/aic7xxx_core.c
+++ b/drivers/scsi/aic7xxx/aic7xxx_core.c
@@ -7340,7 +7340,6 @@ ahc_dump_card_state(struct ahc_softc *ahc)
 		printk("\n");
 	}
 
-	ahc_platform_dump_card_state(ahc);
 	printk("\n<<<<<<<<<<<<<<<<< Dump Card State Ends >>>>>>>>>>>>>>>>>>\n");
 	ahc_outb(ahc, SCBPTR, saved_scbptr);
 	if (paused == 0)
diff --git a/drivers/scsi/aic7xxx/aic7xxx_osm.c b/drivers/scsi/aic7xxx/aic7xxx_osm.c
index fc6a83188c1e..acd687f4554e 100644
--- a/drivers/scsi/aic7xxx/aic7xxx_osm.c
+++ b/drivers/scsi/aic7xxx/aic7xxx_osm.c
@@ -2329,11 +2329,6 @@ ahc_linux_queue_recovery_cmd(struct scsi_cmnd *cmd, scb_flag flag)
 	return (retval);
 }
 
-void
-ahc_platform_dump_card_state(struct ahc_softc *ahc)
-{
-}
-
 static void ahc_linux_set_width(struct scsi_target *starget, int width)
 {
 	struct Scsi_Host *shost = dev_to_shost(starget->dev.parent);
diff --git a/drivers/scsi/aic7xxx/aic7xxx_osm.h b/drivers/scsi/aic7xxx/aic7xxx_osm.h
index 54c702864103..f8489078f003 100644
--- a/drivers/scsi/aic7xxx/aic7xxx_osm.h
+++ b/drivers/scsi/aic7xxx/aic7xxx_osm.h
@@ -688,7 +688,6 @@ void	ahc_done(struct ahc_softc*, struct scb*);
 void	ahc_send_async(struct ahc_softc *, char channel,
 		       u_int target, u_int lun, ac_code);
 void	ahc_print_path(struct ahc_softc *, struct scb *);
-void	ahc_platform_dump_card_state(struct ahc_softc *ahc);
 
 #ifdef CONFIG_PCI
 #define AHC_PCI_CONFIG 1
-- 
2.11.0

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

* [PATCH v2 2/5] aic7xxx: fix firmware build deps
  2017-08-03 23:28 [PATCH v2 0/4] aic7xxx: fix debugging printks Michał Mirosław
  2017-08-03 23:28 ` [PATCH v2 1/5] aic7xxx: remove empty function Michał Mirosław
@ 2017-08-03 23:28 ` Michał Mirosław
  2017-08-04  8:41   ` Hannes Reinecke
  2017-08-03 23:28 ` [PATCH v2 3/5] aic7xxx: remove rules for shipped files Michał Mirosław
                   ` (3 subsequent siblings)
  5 siblings, 1 reply; 13+ messages in thread
From: Michał Mirosław @ 2017-08-03 23:28 UTC (permalink / raw)
  To: Hannes Reinecke, James E.J. Bottomley, Martin K. Petersen; +Cc: linux-scsi

We need to override Kbuild rules for copying shipped files, otherwise
aic7xxx_reg.h and aic7xxx_reg_print.c will be ovewritten by old versions.

Fixes: 516b7db593f3a541e2e98867575c3c697f41a247
Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
---
 drivers/scsi/aic7xxx/Makefile | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/aic7xxx/Makefile b/drivers/scsi/aic7xxx/Makefile
index 07b60a780c06..b03ba0df7a83 100644
--- a/drivers/scsi/aic7xxx/Makefile
+++ b/drivers/scsi/aic7xxx/Makefile
@@ -59,7 +59,8 @@ $(obj)/aic7xxx_seq.h: $(src)/aic7xxx.seq $(src)/aic7xxx.reg $(obj)/aicasm/aicasm
 			      $(aicasm-7xxx-opts-y) -o $(obj)/aic7xxx_seq.h \
 			      $(srctree)/$(src)/aic7xxx.seq
 
-$(aic7xxx-gen-y): $(obj)/aic7xxx_seq.h
+$(aic7xxx-gen-y): $(objtree)/$(obj)/aic7xxx_seq.h
+	@true
 else
 $(obj)/aic7xxx_reg_print.c: $(src)/aic7xxx_reg_print.c_shipped
 endif
@@ -76,7 +77,8 @@ $(obj)/aic79xx_seq.h: $(src)/aic79xx.seq $(src)/aic79xx.reg $(obj)/aicasm/aicasm
 			      $(aicasm-79xx-opts-y) -o $(obj)/aic79xx_seq.h \
 			      $(srctree)/$(src)/aic79xx.seq
 
-$(aic79xx-gen-y): $(obj)/aic79xx_seq.h
+$(aic79xx-gen-y): $(objtree)/$(obj)/aic79xx_seq.h
+	@true
 else
 $(obj)/aic79xx_reg_print.c: $(src)/aic79xx_reg_print.c_shipped
 endif
-- 
2.11.0

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

* [PATCH v2 3/5] aic7xxx: remove rules for shipped files
  2017-08-03 23:28 [PATCH v2 0/4] aic7xxx: fix debugging printks Michał Mirosław
  2017-08-03 23:28 ` [PATCH v2 1/5] aic7xxx: remove empty function Michał Mirosław
  2017-08-03 23:28 ` [PATCH v2 2/5] aic7xxx: fix firmware build deps Michał Mirosław
@ 2017-08-03 23:28 ` Michał Mirosław
  2017-08-04  8:41   ` Hannes Reinecke
  2017-08-09 22:27   ` Michał Mirosław
  2017-08-03 23:28 ` [PATCH v2 4/5] aic7xxx: regenerate firmware files Michał Mirosław
                   ` (2 subsequent siblings)
  5 siblings, 2 replies; 13+ messages in thread
From: Michał Mirosław @ 2017-08-03 23:28 UTC (permalink / raw)
  To: Hannes Reinecke, James E.J. Bottomley, Martin K. Petersen; +Cc: linux-scsi

There are Kbuild rules for that already.

Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
---
 drivers/scsi/aic7xxx/Makefile | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/drivers/scsi/aic7xxx/Makefile b/drivers/scsi/aic7xxx/Makefile
index b03ba0df7a83..1a5509d40f8a 100644
--- a/drivers/scsi/aic7xxx/Makefile
+++ b/drivers/scsi/aic7xxx/Makefile
@@ -61,8 +61,6 @@ $(obj)/aic7xxx_seq.h: $(src)/aic7xxx.seq $(src)/aic7xxx.reg $(obj)/aicasm/aicasm
 
 $(aic7xxx-gen-y): $(objtree)/$(obj)/aic7xxx_seq.h
 	@true
-else
-$(obj)/aic7xxx_reg_print.c: $(src)/aic7xxx_reg_print.c_shipped
 endif
 
 aic79xx-gen-$(CONFIG_AIC79XX_BUILD_FIRMWARE)	:= $(obj)/aic79xx_reg.h
@@ -79,8 +77,6 @@ $(obj)/aic79xx_seq.h: $(src)/aic79xx.seq $(src)/aic79xx.reg $(obj)/aicasm/aicasm
 
 $(aic79xx-gen-y): $(objtree)/$(obj)/aic79xx_seq.h
 	@true
-else
-$(obj)/aic79xx_reg_print.c: $(src)/aic79xx_reg_print.c_shipped
 endif
 
 $(obj)/aicasm/aicasm: $(srctree)/$(src)/aicasm/*.[chyl]
-- 
2.11.0

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

* [PATCH v2 4/5] aic7xxx: regenerate firmware files
  2017-08-03 23:28 [PATCH v2 0/4] aic7xxx: fix debugging printks Michał Mirosław
                   ` (2 preceding siblings ...)
  2017-08-03 23:28 ` [PATCH v2 3/5] aic7xxx: remove rules for shipped files Michał Mirosław
@ 2017-08-03 23:28 ` Michał Mirosław
  2017-08-04  8:44   ` Hannes Reinecke
  2017-08-03 23:28 ` [PATCH v2 5/5] aic7[9x]xx: printk() lines unbroken Michał Mirosław
  2017-08-08  1:43 ` [PATCH v2 0/4] aic7xxx: fix debugging printks Martin K. Petersen
  5 siblings, 1 reply; 13+ messages in thread
From: Michał Mirosław @ 2017-08-03 23:28 UTC (permalink / raw)
  To: Hannes Reinecke, James E.J. Bottomley, Martin K. Petersen; +Cc: linux-scsi

Regenerate firmware files to make cleaner base for following fix.
This removes some unused definitions and reorders some #defines, but
the code remains the same.

Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
---
 drivers/scsi/aic7xxx/aic79xx_reg.h_shipped       | 1267 ++++------------------
 drivers/scsi/aic7xxx/aic79xx_reg_print.c_shipped |   34 +-
 drivers/scsi/aic7xxx/aic7xxx_reg.h_shipped       |   44 +-
 3 files changed, 235 insertions(+), 1110 deletions(-)

diff --git a/drivers/scsi/aic7xxx/aic79xx_reg.h_shipped b/drivers/scsi/aic7xxx/aic79xx_reg.h_shipped
index cdcead071ef6..ddcd5a7701ac 100644
--- a/drivers/scsi/aic7xxx/aic79xx_reg.h_shipped
+++ b/drivers/scsi/aic7xxx/aic79xx_reg.h_shipped
@@ -13,13 +13,6 @@ typedef struct ahd_reg_parse_entry {
 } ahd_reg_parse_entry_t;
 
 #if AIC_DEBUG_REGISTERS
-ahd_reg_print_t ahd_mode_ptr_print;
-#else
-#define ahd_mode_ptr_print(regvalue, cur_col, wrap) \
-    ahd_print_register(NULL, 0, "MODE_PTR", 0x00, regvalue, cur_col, wrap)
-#endif
-
-#if AIC_DEBUG_REGISTERS
 ahd_reg_print_t ahd_intstat_print;
 #else
 #define ahd_intstat_print(regvalue, cur_col, wrap) \
@@ -27,27 +20,6 @@ ahd_reg_print_t ahd_intstat_print;
 #endif
 
 #if AIC_DEBUG_REGISTERS
-ahd_reg_print_t ahd_seqintcode_print;
-#else
-#define ahd_seqintcode_print(regvalue, cur_col, wrap) \
-    ahd_print_register(NULL, 0, "SEQINTCODE", 0x02, regvalue, cur_col, wrap)
-#endif
-
-#if AIC_DEBUG_REGISTERS
-ahd_reg_print_t ahd_error_print;
-#else
-#define ahd_error_print(regvalue, cur_col, wrap) \
-    ahd_print_register(NULL, 0, "ERROR", 0x04, regvalue, cur_col, wrap)
-#endif
-
-#if AIC_DEBUG_REGISTERS
-ahd_reg_print_t ahd_hescb_qoff_print;
-#else
-#define ahd_hescb_qoff_print(regvalue, cur_col, wrap) \
-    ahd_print_register(NULL, 0, "HESCB_QOFF", 0x08, regvalue, cur_col, wrap)
-#endif
-
-#if AIC_DEBUG_REGISTERS
 ahd_reg_print_t ahd_hs_mailbox_print;
 #else
 #define ahd_hs_mailbox_print(regvalue, cur_col, wrap) \
@@ -62,27 +34,6 @@ ahd_reg_print_t ahd_seqintstat_print;
 #endif
 
 #if AIC_DEBUG_REGISTERS
-ahd_reg_print_t ahd_clrseqintstat_print;
-#else
-#define ahd_clrseqintstat_print(regvalue, cur_col, wrap) \
-    ahd_print_register(NULL, 0, "CLRSEQINTSTAT", 0x0c, regvalue, cur_col, wrap)
-#endif
-
-#if AIC_DEBUG_REGISTERS
-ahd_reg_print_t ahd_swtimer_print;
-#else
-#define ahd_swtimer_print(regvalue, cur_col, wrap) \
-    ahd_print_register(NULL, 0, "SWTIMER", 0x0e, regvalue, cur_col, wrap)
-#endif
-
-#if AIC_DEBUG_REGISTERS
-ahd_reg_print_t ahd_sescb_qoff_print;
-#else
-#define ahd_sescb_qoff_print(regvalue, cur_col, wrap) \
-    ahd_print_register(NULL, 0, "SESCB_QOFF", 0x12, regvalue, cur_col, wrap)
-#endif
-
-#if AIC_DEBUG_REGISTERS
 ahd_reg_print_t ahd_intctl_print;
 #else
 #define ahd_intctl_print(regvalue, cur_col, wrap) \
@@ -111,111 +62,6 @@ ahd_reg_print_t ahd_sg_cache_shadow_print;
 #endif
 
 #if AIC_DEBUG_REGISTERS
-ahd_reg_print_t ahd_lqin_print;
-#else
-#define ahd_lqin_print(regvalue, cur_col, wrap) \
-    ahd_print_register(NULL, 0, "LQIN", 0x20, regvalue, cur_col, wrap)
-#endif
-
-#if AIC_DEBUG_REGISTERS
-ahd_reg_print_t ahd_lunptr_print;
-#else
-#define ahd_lunptr_print(regvalue, cur_col, wrap) \
-    ahd_print_register(NULL, 0, "LUNPTR", 0x22, regvalue, cur_col, wrap)
-#endif
-
-#if AIC_DEBUG_REGISTERS
-ahd_reg_print_t ahd_cmdlenptr_print;
-#else
-#define ahd_cmdlenptr_print(regvalue, cur_col, wrap) \
-    ahd_print_register(NULL, 0, "CMDLENPTR", 0x25, regvalue, cur_col, wrap)
-#endif
-
-#if AIC_DEBUG_REGISTERS
-ahd_reg_print_t ahd_attrptr_print;
-#else
-#define ahd_attrptr_print(regvalue, cur_col, wrap) \
-    ahd_print_register(NULL, 0, "ATTRPTR", 0x26, regvalue, cur_col, wrap)
-#endif
-
-#if AIC_DEBUG_REGISTERS
-ahd_reg_print_t ahd_flagptr_print;
-#else
-#define ahd_flagptr_print(regvalue, cur_col, wrap) \
-    ahd_print_register(NULL, 0, "FLAGPTR", 0x27, regvalue, cur_col, wrap)
-#endif
-
-#if AIC_DEBUG_REGISTERS
-ahd_reg_print_t ahd_cmdptr_print;
-#else
-#define ahd_cmdptr_print(regvalue, cur_col, wrap) \
-    ahd_print_register(NULL, 0, "CMDPTR", 0x28, regvalue, cur_col, wrap)
-#endif
-
-#if AIC_DEBUG_REGISTERS
-ahd_reg_print_t ahd_qnextptr_print;
-#else
-#define ahd_qnextptr_print(regvalue, cur_col, wrap) \
-    ahd_print_register(NULL, 0, "QNEXTPTR", 0x29, regvalue, cur_col, wrap)
-#endif
-
-#if AIC_DEBUG_REGISTERS
-ahd_reg_print_t ahd_abrtbyteptr_print;
-#else
-#define ahd_abrtbyteptr_print(regvalue, cur_col, wrap) \
-    ahd_print_register(NULL, 0, "ABRTBYTEPTR", 0x2b, regvalue, cur_col, wrap)
-#endif
-
-#if AIC_DEBUG_REGISTERS
-ahd_reg_print_t ahd_abrtbitptr_print;
-#else
-#define ahd_abrtbitptr_print(regvalue, cur_col, wrap) \
-    ahd_print_register(NULL, 0, "ABRTBITPTR", 0x2c, regvalue, cur_col, wrap)
-#endif
-
-#if AIC_DEBUG_REGISTERS
-ahd_reg_print_t ahd_lunlen_print;
-#else
-#define ahd_lunlen_print(regvalue, cur_col, wrap) \
-    ahd_print_register(NULL, 0, "LUNLEN", 0x30, regvalue, cur_col, wrap)
-#endif
-
-#if AIC_DEBUG_REGISTERS
-ahd_reg_print_t ahd_cdblimit_print;
-#else
-#define ahd_cdblimit_print(regvalue, cur_col, wrap) \
-    ahd_print_register(NULL, 0, "CDBLIMIT", 0x31, regvalue, cur_col, wrap)
-#endif
-
-#if AIC_DEBUG_REGISTERS
-ahd_reg_print_t ahd_maxcmd_print;
-#else
-#define ahd_maxcmd_print(regvalue, cur_col, wrap) \
-    ahd_print_register(NULL, 0, "MAXCMD", 0x32, regvalue, cur_col, wrap)
-#endif
-
-#if AIC_DEBUG_REGISTERS
-ahd_reg_print_t ahd_maxcmdcnt_print;
-#else
-#define ahd_maxcmdcnt_print(regvalue, cur_col, wrap) \
-    ahd_print_register(NULL, 0, "MAXCMDCNT", 0x33, regvalue, cur_col, wrap)
-#endif
-
-#if AIC_DEBUG_REGISTERS
-ahd_reg_print_t ahd_lqctl1_print;
-#else
-#define ahd_lqctl1_print(regvalue, cur_col, wrap) \
-    ahd_print_register(NULL, 0, "LQCTL1", 0x38, regvalue, cur_col, wrap)
-#endif
-
-#if AIC_DEBUG_REGISTERS
-ahd_reg_print_t ahd_lqctl2_print;
-#else
-#define ahd_lqctl2_print(regvalue, cur_col, wrap) \
-    ahd_print_register(NULL, 0, "LQCTL2", 0x39, regvalue, cur_col, wrap)
-#endif
-
-#if AIC_DEBUG_REGISTERS
 ahd_reg_print_t ahd_scsiseq0_print;
 #else
 #define ahd_scsiseq0_print(regvalue, cur_col, wrap) \
@@ -230,13 +76,6 @@ ahd_reg_print_t ahd_scsiseq1_print;
 #endif
 
 #if AIC_DEBUG_REGISTERS
-ahd_reg_print_t ahd_sxfrctl0_print;
-#else
-#define ahd_sxfrctl0_print(regvalue, cur_col, wrap) \
-    ahd_print_register(NULL, 0, "SXFRCTL0", 0x3c, regvalue, cur_col, wrap)
-#endif
-
-#if AIC_DEBUG_REGISTERS
 ahd_reg_print_t ahd_dffstat_print;
 #else
 #define ahd_dffstat_print(regvalue, cur_col, wrap) \
@@ -244,13 +83,6 @@ ahd_reg_print_t ahd_dffstat_print;
 #endif
 
 #if AIC_DEBUG_REGISTERS
-ahd_reg_print_t ahd_multargid_print;
-#else
-#define ahd_multargid_print(regvalue, cur_col, wrap) \
-    ahd_print_register(NULL, 0, "MULTARGID", 0x40, regvalue, cur_col, wrap)
-#endif
-
-#if AIC_DEBUG_REGISTERS
 ahd_reg_print_t ahd_scsisigi_print;
 #else
 #define ahd_scsisigi_print(regvalue, cur_col, wrap) \
@@ -265,13 +97,6 @@ ahd_reg_print_t ahd_scsiphase_print;
 #endif
 
 #if AIC_DEBUG_REGISTERS
-ahd_reg_print_t ahd_scsidat_print;
-#else
-#define ahd_scsidat_print(regvalue, cur_col, wrap) \
-    ahd_print_register(NULL, 0, "SCSIDAT", 0x44, regvalue, cur_col, wrap)
-#endif
-
-#if AIC_DEBUG_REGISTERS
 ahd_reg_print_t ahd_scsibus_print;
 #else
 #define ahd_scsibus_print(regvalue, cur_col, wrap) \
@@ -279,13 +104,6 @@ ahd_reg_print_t ahd_scsibus_print;
 #endif
 
 #if AIC_DEBUG_REGISTERS
-ahd_reg_print_t ahd_targidin_print;
-#else
-#define ahd_targidin_print(regvalue, cur_col, wrap) \
-    ahd_print_register(NULL, 0, "TARGIDIN", 0x48, regvalue, cur_col, wrap)
-#endif
-
-#if AIC_DEBUG_REGISTERS
 ahd_reg_print_t ahd_selid_print;
 #else
 #define ahd_selid_print(regvalue, cur_col, wrap) \
@@ -293,20 +111,6 @@ ahd_reg_print_t ahd_selid_print;
 #endif
 
 #if AIC_DEBUG_REGISTERS
-ahd_reg_print_t ahd_sblkctl_print;
-#else
-#define ahd_sblkctl_print(regvalue, cur_col, wrap) \
-    ahd_print_register(NULL, 0, "SBLKCTL", 0x4a, regvalue, cur_col, wrap)
-#endif
-
-#if AIC_DEBUG_REGISTERS
-ahd_reg_print_t ahd_sstat0_print;
-#else
-#define ahd_sstat0_print(regvalue, cur_col, wrap) \
-    ahd_print_register(NULL, 0, "SSTAT0", 0x4b, regvalue, cur_col, wrap)
-#endif
-
-#if AIC_DEBUG_REGISTERS
 ahd_reg_print_t ahd_simode0_print;
 #else
 #define ahd_simode0_print(regvalue, cur_col, wrap) \
@@ -314,6 +118,13 @@ ahd_reg_print_t ahd_simode0_print;
 #endif
 
 #if AIC_DEBUG_REGISTERS
+ahd_reg_print_t ahd_sstat0_print;
+#else
+#define ahd_sstat0_print(regvalue, cur_col, wrap) \
+    ahd_print_register(NULL, 0, "SSTAT0", 0x4b, regvalue, cur_col, wrap)
+#endif
+
+#if AIC_DEBUG_REGISTERS
 ahd_reg_print_t ahd_sstat1_print;
 #else
 #define ahd_sstat1_print(regvalue, cur_col, wrap) \
@@ -328,13 +139,6 @@ ahd_reg_print_t ahd_sstat2_print;
 #endif
 
 #if AIC_DEBUG_REGISTERS
-ahd_reg_print_t ahd_clrsint2_print;
-#else
-#define ahd_clrsint2_print(regvalue, cur_col, wrap) \
-    ahd_print_register(NULL, 0, "CLRSINT2", 0x4d, regvalue, cur_col, wrap)
-#endif
-
-#if AIC_DEBUG_REGISTERS
 ahd_reg_print_t ahd_perrdiag_print;
 #else
 #define ahd_perrdiag_print(regvalue, cur_col, wrap) \
@@ -342,13 +146,6 @@ ahd_reg_print_t ahd_perrdiag_print;
 #endif
 
 #if AIC_DEBUG_REGISTERS
-ahd_reg_print_t ahd_lqistate_print;
-#else
-#define ahd_lqistate_print(regvalue, cur_col, wrap) \
-    ahd_print_register(NULL, 0, "LQISTATE", 0x4e, regvalue, cur_col, wrap)
-#endif
-
-#if AIC_DEBUG_REGISTERS
 ahd_reg_print_t ahd_soffcnt_print;
 #else
 #define ahd_soffcnt_print(regvalue, cur_col, wrap) \
@@ -356,13 +153,6 @@ ahd_reg_print_t ahd_soffcnt_print;
 #endif
 
 #if AIC_DEBUG_REGISTERS
-ahd_reg_print_t ahd_lqostate_print;
-#else
-#define ahd_lqostate_print(regvalue, cur_col, wrap) \
-    ahd_print_register(NULL, 0, "LQOSTATE", 0x4f, regvalue, cur_col, wrap)
-#endif
-
-#if AIC_DEBUG_REGISTERS
 ahd_reg_print_t ahd_lqistat0_print;
 #else
 #define ahd_lqistat0_print(regvalue, cur_col, wrap) \
@@ -370,27 +160,6 @@ ahd_reg_print_t ahd_lqistat0_print;
 #endif
 
 #if AIC_DEBUG_REGISTERS
-ahd_reg_print_t ahd_clrlqiint0_print;
-#else
-#define ahd_clrlqiint0_print(regvalue, cur_col, wrap) \
-    ahd_print_register(NULL, 0, "CLRLQIINT0", 0x50, regvalue, cur_col, wrap)
-#endif
-
-#if AIC_DEBUG_REGISTERS
-ahd_reg_print_t ahd_lqimode0_print;
-#else
-#define ahd_lqimode0_print(regvalue, cur_col, wrap) \
-    ahd_print_register(NULL, 0, "LQIMODE0", 0x50, regvalue, cur_col, wrap)
-#endif
-
-#if AIC_DEBUG_REGISTERS
-ahd_reg_print_t ahd_lqimode1_print;
-#else
-#define ahd_lqimode1_print(regvalue, cur_col, wrap) \
-    ahd_print_register(NULL, 0, "LQIMODE1", 0x51, regvalue, cur_col, wrap)
-#endif
-
-#if AIC_DEBUG_REGISTERS
 ahd_reg_print_t ahd_lqistat1_print;
 #else
 #define ahd_lqistat1_print(regvalue, cur_col, wrap) \
@@ -398,13 +167,6 @@ ahd_reg_print_t ahd_lqistat1_print;
 #endif
 
 #if AIC_DEBUG_REGISTERS
-ahd_reg_print_t ahd_clrlqiint1_print;
-#else
-#define ahd_clrlqiint1_print(regvalue, cur_col, wrap) \
-    ahd_print_register(NULL, 0, "CLRLQIINT1", 0x51, regvalue, cur_col, wrap)
-#endif
-
-#if AIC_DEBUG_REGISTERS
 ahd_reg_print_t ahd_lqistat2_print;
 #else
 #define ahd_lqistat2_print(regvalue, cur_col, wrap) \
@@ -419,20 +181,6 @@ ahd_reg_print_t ahd_sstat3_print;
 #endif
 
 #if AIC_DEBUG_REGISTERS
-ahd_reg_print_t ahd_simode3_print;
-#else
-#define ahd_simode3_print(regvalue, cur_col, wrap) \
-    ahd_print_register(NULL, 0, "SIMODE3", 0x53, regvalue, cur_col, wrap)
-#endif
-
-#if AIC_DEBUG_REGISTERS
-ahd_reg_print_t ahd_clrsint3_print;
-#else
-#define ahd_clrsint3_print(regvalue, cur_col, wrap) \
-    ahd_print_register(NULL, 0, "CLRSINT3", 0x53, regvalue, cur_col, wrap)
-#endif
-
-#if AIC_DEBUG_REGISTERS
 ahd_reg_print_t ahd_lqostat0_print;
 #else
 #define ahd_lqostat0_print(regvalue, cur_col, wrap) \
@@ -440,27 +188,6 @@ ahd_reg_print_t ahd_lqostat0_print;
 #endif
 
 #if AIC_DEBUG_REGISTERS
-ahd_reg_print_t ahd_clrlqoint0_print;
-#else
-#define ahd_clrlqoint0_print(regvalue, cur_col, wrap) \
-    ahd_print_register(NULL, 0, "CLRLQOINT0", 0x54, regvalue, cur_col, wrap)
-#endif
-
-#if AIC_DEBUG_REGISTERS
-ahd_reg_print_t ahd_lqomode0_print;
-#else
-#define ahd_lqomode0_print(regvalue, cur_col, wrap) \
-    ahd_print_register(NULL, 0, "LQOMODE0", 0x54, regvalue, cur_col, wrap)
-#endif
-
-#if AIC_DEBUG_REGISTERS
-ahd_reg_print_t ahd_lqomode1_print;
-#else
-#define ahd_lqomode1_print(regvalue, cur_col, wrap) \
-    ahd_print_register(NULL, 0, "LQOMODE1", 0x55, regvalue, cur_col, wrap)
-#endif
-
-#if AIC_DEBUG_REGISTERS
 ahd_reg_print_t ahd_lqostat1_print;
 #else
 #define ahd_lqostat1_print(regvalue, cur_col, wrap) \
@@ -468,13 +195,6 @@ ahd_reg_print_t ahd_lqostat1_print;
 #endif
 
 #if AIC_DEBUG_REGISTERS
-ahd_reg_print_t ahd_clrlqoint1_print;
-#else
-#define ahd_clrlqoint1_print(regvalue, cur_col, wrap) \
-    ahd_print_register(NULL, 0, "CLRLQOINT1", 0x55, regvalue, cur_col, wrap)
-#endif
-
-#if AIC_DEBUG_REGISTERS
 ahd_reg_print_t ahd_lqostat2_print;
 #else
 #define ahd_lqostat2_print(regvalue, cur_col, wrap) \
@@ -482,13 +202,6 @@ ahd_reg_print_t ahd_lqostat2_print;
 #endif
 
 #if AIC_DEBUG_REGISTERS
-ahd_reg_print_t ahd_os_space_cnt_print;
-#else
-#define ahd_os_space_cnt_print(regvalue, cur_col, wrap) \
-    ahd_print_register(NULL, 0, "OS_SPACE_CNT", 0x56, regvalue, cur_col, wrap)
-#endif
-
-#if AIC_DEBUG_REGISTERS
 ahd_reg_print_t ahd_simode1_print;
 #else
 #define ahd_simode1_print(regvalue, cur_col, wrap) \
@@ -496,13 +209,6 @@ ahd_reg_print_t ahd_simode1_print;
 #endif
 
 #if AIC_DEBUG_REGISTERS
-ahd_reg_print_t ahd_gsfifo_print;
-#else
-#define ahd_gsfifo_print(regvalue, cur_col, wrap) \
-    ahd_print_register(NULL, 0, "GSFIFO", 0x58, regvalue, cur_col, wrap)
-#endif
-
-#if AIC_DEBUG_REGISTERS
 ahd_reg_print_t ahd_dffsxfrctl_print;
 #else
 #define ahd_dffsxfrctl_print(regvalue, cur_col, wrap) \
@@ -510,27 +216,6 @@ ahd_reg_print_t ahd_dffsxfrctl_print;
 #endif
 
 #if AIC_DEBUG_REGISTERS
-ahd_reg_print_t ahd_lqoscsctl_print;
-#else
-#define ahd_lqoscsctl_print(regvalue, cur_col, wrap) \
-    ahd_print_register(NULL, 0, "LQOSCSCTL", 0x5a, regvalue, cur_col, wrap)
-#endif
-
-#if AIC_DEBUG_REGISTERS
-ahd_reg_print_t ahd_nextscb_print;
-#else
-#define ahd_nextscb_print(regvalue, cur_col, wrap) \
-    ahd_print_register(NULL, 0, "NEXTSCB", 0x5a, regvalue, cur_col, wrap)
-#endif
-
-#if AIC_DEBUG_REGISTERS
-ahd_reg_print_t ahd_clrseqintsrc_print;
-#else
-#define ahd_clrseqintsrc_print(regvalue, cur_col, wrap) \
-    ahd_print_register(NULL, 0, "CLRSEQINTSRC", 0x5b, regvalue, cur_col, wrap)
-#endif
-
-#if AIC_DEBUG_REGISTERS
 ahd_reg_print_t ahd_seqintsrc_print;
 #else
 #define ahd_seqintsrc_print(regvalue, cur_col, wrap) \
@@ -538,13 +223,6 @@ ahd_reg_print_t ahd_seqintsrc_print;
 #endif
 
 #if AIC_DEBUG_REGISTERS
-ahd_reg_print_t ahd_currscb_print;
-#else
-#define ahd_currscb_print(regvalue, cur_col, wrap) \
-    ahd_print_register(NULL, 0, "CURRSCB", 0x5c, regvalue, cur_col, wrap)
-#endif
-
-#if AIC_DEBUG_REGISTERS
 ahd_reg_print_t ahd_seqimode_print;
 #else
 #define ahd_seqimode_print(regvalue, cur_col, wrap) \
@@ -559,90 +237,6 @@ ahd_reg_print_t ahd_mdffstat_print;
 #endif
 
 #if AIC_DEBUG_REGISTERS
-ahd_reg_print_t ahd_lastscb_print;
-#else
-#define ahd_lastscb_print(regvalue, cur_col, wrap) \
-    ahd_print_register(NULL, 0, "LASTSCB", 0x5e, regvalue, cur_col, wrap)
-#endif
-
-#if AIC_DEBUG_REGISTERS
-ahd_reg_print_t ahd_negoaddr_print;
-#else
-#define ahd_negoaddr_print(regvalue, cur_col, wrap) \
-    ahd_print_register(NULL, 0, "NEGOADDR", 0x60, regvalue, cur_col, wrap)
-#endif
-
-#if AIC_DEBUG_REGISTERS
-ahd_reg_print_t ahd_negperiod_print;
-#else
-#define ahd_negperiod_print(regvalue, cur_col, wrap) \
-    ahd_print_register(NULL, 0, "NEGPERIOD", 0x61, regvalue, cur_col, wrap)
-#endif
-
-#if AIC_DEBUG_REGISTERS
-ahd_reg_print_t ahd_negoffset_print;
-#else
-#define ahd_negoffset_print(regvalue, cur_col, wrap) \
-    ahd_print_register(NULL, 0, "NEGOFFSET", 0x62, regvalue, cur_col, wrap)
-#endif
-
-#if AIC_DEBUG_REGISTERS
-ahd_reg_print_t ahd_negppropts_print;
-#else
-#define ahd_negppropts_print(regvalue, cur_col, wrap) \
-    ahd_print_register(NULL, 0, "NEGPPROPTS", 0x63, regvalue, cur_col, wrap)
-#endif
-
-#if AIC_DEBUG_REGISTERS
-ahd_reg_print_t ahd_negconopts_print;
-#else
-#define ahd_negconopts_print(regvalue, cur_col, wrap) \
-    ahd_print_register(NULL, 0, "NEGCONOPTS", 0x64, regvalue, cur_col, wrap)
-#endif
-
-#if AIC_DEBUG_REGISTERS
-ahd_reg_print_t ahd_annexcol_print;
-#else
-#define ahd_annexcol_print(regvalue, cur_col, wrap) \
-    ahd_print_register(NULL, 0, "ANNEXCOL", 0x65, regvalue, cur_col, wrap)
-#endif
-
-#if AIC_DEBUG_REGISTERS
-ahd_reg_print_t ahd_annexdat_print;
-#else
-#define ahd_annexdat_print(regvalue, cur_col, wrap) \
-    ahd_print_register(NULL, 0, "ANNEXDAT", 0x66, regvalue, cur_col, wrap)
-#endif
-
-#if AIC_DEBUG_REGISTERS
-ahd_reg_print_t ahd_scschkn_print;
-#else
-#define ahd_scschkn_print(regvalue, cur_col, wrap) \
-    ahd_print_register(NULL, 0, "SCSCHKN", 0x66, regvalue, cur_col, wrap)
-#endif
-
-#if AIC_DEBUG_REGISTERS
-ahd_reg_print_t ahd_iownid_print;
-#else
-#define ahd_iownid_print(regvalue, cur_col, wrap) \
-    ahd_print_register(NULL, 0, "IOWNID", 0x67, regvalue, cur_col, wrap)
-#endif
-
-#if AIC_DEBUG_REGISTERS
-ahd_reg_print_t ahd_shcnt_print;
-#else
-#define ahd_shcnt_print(regvalue, cur_col, wrap) \
-    ahd_print_register(NULL, 0, "SHCNT", 0x68, regvalue, cur_col, wrap)
-#endif
-
-#if AIC_DEBUG_REGISTERS
-ahd_reg_print_t ahd_townid_print;
-#else
-#define ahd_townid_print(regvalue, cur_col, wrap) \
-    ahd_print_register(NULL, 0, "TOWNID", 0x69, regvalue, cur_col, wrap)
-#endif
-
-#if AIC_DEBUG_REGISTERS
 ahd_reg_print_t ahd_seloid_print;
 #else
 #define ahd_seloid_print(regvalue, cur_col, wrap) \
@@ -650,90 +244,6 @@ ahd_reg_print_t ahd_seloid_print;
 #endif
 
 #if AIC_DEBUG_REGISTERS
-ahd_reg_print_t ahd_scbhaddr_print;
-#else
-#define ahd_scbhaddr_print(regvalue, cur_col, wrap) \
-    ahd_print_register(NULL, 0, "SCBHADDR", 0x7c, regvalue, cur_col, wrap)
-#endif
-
-#if AIC_DEBUG_REGISTERS
-ahd_reg_print_t ahd_sghaddr_print;
-#else
-#define ahd_sghaddr_print(regvalue, cur_col, wrap) \
-    ahd_print_register(NULL, 0, "SGHADDR", 0x7c, regvalue, cur_col, wrap)
-#endif
-
-#if AIC_DEBUG_REGISTERS
-ahd_reg_print_t ahd_scbhcnt_print;
-#else
-#define ahd_scbhcnt_print(regvalue, cur_col, wrap) \
-    ahd_print_register(NULL, 0, "SCBHCNT", 0x84, regvalue, cur_col, wrap)
-#endif
-
-#if AIC_DEBUG_REGISTERS
-ahd_reg_print_t ahd_sghcnt_print;
-#else
-#define ahd_sghcnt_print(regvalue, cur_col, wrap) \
-    ahd_print_register(NULL, 0, "SGHCNT", 0x84, regvalue, cur_col, wrap)
-#endif
-
-#if AIC_DEBUG_REGISTERS
-ahd_reg_print_t ahd_pcixctl_print;
-#else
-#define ahd_pcixctl_print(regvalue, cur_col, wrap) \
-    ahd_print_register(NULL, 0, "PCIXCTL", 0x93, regvalue, cur_col, wrap)
-#endif
-
-#if AIC_DEBUG_REGISTERS
-ahd_reg_print_t ahd_dchspltstat0_print;
-#else
-#define ahd_dchspltstat0_print(regvalue, cur_col, wrap) \
-    ahd_print_register(NULL, 0, "DCHSPLTSTAT0", 0x96, regvalue, cur_col, wrap)
-#endif
-
-#if AIC_DEBUG_REGISTERS
-ahd_reg_print_t ahd_dchspltstat1_print;
-#else
-#define ahd_dchspltstat1_print(regvalue, cur_col, wrap) \
-    ahd_print_register(NULL, 0, "DCHSPLTSTAT1", 0x97, regvalue, cur_col, wrap)
-#endif
-
-#if AIC_DEBUG_REGISTERS
-ahd_reg_print_t ahd_sgspltstat0_print;
-#else
-#define ahd_sgspltstat0_print(regvalue, cur_col, wrap) \
-    ahd_print_register(NULL, 0, "SGSPLTSTAT0", 0x9e, regvalue, cur_col, wrap)
-#endif
-
-#if AIC_DEBUG_REGISTERS
-ahd_reg_print_t ahd_sgspltstat1_print;
-#else
-#define ahd_sgspltstat1_print(regvalue, cur_col, wrap) \
-    ahd_print_register(NULL, 0, "SGSPLTSTAT1", 0x9f, regvalue, cur_col, wrap)
-#endif
-
-#if AIC_DEBUG_REGISTERS
-ahd_reg_print_t ahd_df0pcistat_print;
-#else
-#define ahd_df0pcistat_print(regvalue, cur_col, wrap) \
-    ahd_print_register(NULL, 0, "DF0PCISTAT", 0xa0, regvalue, cur_col, wrap)
-#endif
-
-#if AIC_DEBUG_REGISTERS
-ahd_reg_print_t ahd_reg0_print;
-#else
-#define ahd_reg0_print(regvalue, cur_col, wrap) \
-    ahd_print_register(NULL, 0, "REG0", 0xa0, regvalue, cur_col, wrap)
-#endif
-
-#if AIC_DEBUG_REGISTERS
-ahd_reg_print_t ahd_reg_isr_print;
-#else
-#define ahd_reg_isr_print(regvalue, cur_col, wrap) \
-    ahd_print_register(NULL, 0, "REG_ISR", 0xa4, regvalue, cur_col, wrap)
-#endif
-
-#if AIC_DEBUG_REGISTERS
 ahd_reg_print_t ahd_sg_state_print;
 #else
 #define ahd_sg_state_print(regvalue, cur_col, wrap) \
@@ -741,27 +251,6 @@ ahd_reg_print_t ahd_sg_state_print;
 #endif
 
 #if AIC_DEBUG_REGISTERS
-ahd_reg_print_t ahd_targpcistat_print;
-#else
-#define ahd_targpcistat_print(regvalue, cur_col, wrap) \
-    ahd_print_register(NULL, 0, "TARGPCISTAT", 0xa7, regvalue, cur_col, wrap)
-#endif
-
-#if AIC_DEBUG_REGISTERS
-ahd_reg_print_t ahd_scbautoptr_print;
-#else
-#define ahd_scbautoptr_print(regvalue, cur_col, wrap) \
-    ahd_print_register(NULL, 0, "SCBAUTOPTR", 0xab, regvalue, cur_col, wrap)
-#endif
-
-#if AIC_DEBUG_REGISTERS
-ahd_reg_print_t ahd_ccscbaddr_print;
-#else
-#define ahd_ccscbaddr_print(regvalue, cur_col, wrap) \
-    ahd_print_register(NULL, 0, "CCSCBADDR", 0xac, regvalue, cur_col, wrap)
-#endif
-
-#if AIC_DEBUG_REGISTERS
 ahd_reg_print_t ahd_ccscbctl_print;
 #else
 #define ahd_ccscbctl_print(regvalue, cur_col, wrap) \
@@ -776,69 +265,6 @@ ahd_reg_print_t ahd_ccsgctl_print;
 #endif
 
 #if AIC_DEBUG_REGISTERS
-ahd_reg_print_t ahd_ccscbram_print;
-#else
-#define ahd_ccscbram_print(regvalue, cur_col, wrap) \
-    ahd_print_register(NULL, 0, "CCSCBRAM", 0xb0, regvalue, cur_col, wrap)
-#endif
-
-#if AIC_DEBUG_REGISTERS
-ahd_reg_print_t ahd_brddat_print;
-#else
-#define ahd_brddat_print(regvalue, cur_col, wrap) \
-    ahd_print_register(NULL, 0, "BRDDAT", 0xb8, regvalue, cur_col, wrap)
-#endif
-
-#if AIC_DEBUG_REGISTERS
-ahd_reg_print_t ahd_seeadr_print;
-#else
-#define ahd_seeadr_print(regvalue, cur_col, wrap) \
-    ahd_print_register(NULL, 0, "SEEADR", 0xba, regvalue, cur_col, wrap)
-#endif
-
-#if AIC_DEBUG_REGISTERS
-ahd_reg_print_t ahd_seedat_print;
-#else
-#define ahd_seedat_print(regvalue, cur_col, wrap) \
-    ahd_print_register(NULL, 0, "SEEDAT", 0xbc, regvalue, cur_col, wrap)
-#endif
-
-#if AIC_DEBUG_REGISTERS
-ahd_reg_print_t ahd_seectl_print;
-#else
-#define ahd_seectl_print(regvalue, cur_col, wrap) \
-    ahd_print_register(NULL, 0, "SEECTL", 0xbe, regvalue, cur_col, wrap)
-#endif
-
-#if AIC_DEBUG_REGISTERS
-ahd_reg_print_t ahd_seestat_print;
-#else
-#define ahd_seestat_print(regvalue, cur_col, wrap) \
-    ahd_print_register(NULL, 0, "SEESTAT", 0xbe, regvalue, cur_col, wrap)
-#endif
-
-#if AIC_DEBUG_REGISTERS
-ahd_reg_print_t ahd_dspdatactl_print;
-#else
-#define ahd_dspdatactl_print(regvalue, cur_col, wrap) \
-    ahd_print_register(NULL, 0, "DSPDATACTL", 0xc1, regvalue, cur_col, wrap)
-#endif
-
-#if AIC_DEBUG_REGISTERS
-ahd_reg_print_t ahd_dspselect_print;
-#else
-#define ahd_dspselect_print(regvalue, cur_col, wrap) \
-    ahd_print_register(NULL, 0, "DSPSELECT", 0xc4, regvalue, cur_col, wrap)
-#endif
-
-#if AIC_DEBUG_REGISTERS
-ahd_reg_print_t ahd_wrtbiasctl_print;
-#else
-#define ahd_wrtbiasctl_print(regvalue, cur_col, wrap) \
-    ahd_print_register(NULL, 0, "WRTBIASCTL", 0xc5, regvalue, cur_col, wrap)
-#endif
-
-#if AIC_DEBUG_REGISTERS
 ahd_reg_print_t ahd_seqctl0_print;
 #else
 #define ahd_seqctl0_print(regvalue, cur_col, wrap) \
@@ -853,62 +279,6 @@ ahd_reg_print_t ahd_seqintctl_print;
 #endif
 
 #if AIC_DEBUG_REGISTERS
-ahd_reg_print_t ahd_prgmcnt_print;
-#else
-#define ahd_prgmcnt_print(regvalue, cur_col, wrap) \
-    ahd_print_register(NULL, 0, "PRGMCNT", 0xde, regvalue, cur_col, wrap)
-#endif
-
-#if AIC_DEBUG_REGISTERS
-ahd_reg_print_t ahd_none_print;
-#else
-#define ahd_none_print(regvalue, cur_col, wrap) \
-    ahd_print_register(NULL, 0, "NONE", 0xea, regvalue, cur_col, wrap)
-#endif
-
-#if AIC_DEBUG_REGISTERS
-ahd_reg_print_t ahd_intvec1_addr_print;
-#else
-#define ahd_intvec1_addr_print(regvalue, cur_col, wrap) \
-    ahd_print_register(NULL, 0, "INTVEC1_ADDR", 0xf4, regvalue, cur_col, wrap)
-#endif
-
-#if AIC_DEBUG_REGISTERS
-ahd_reg_print_t ahd_curaddr_print;
-#else
-#define ahd_curaddr_print(regvalue, cur_col, wrap) \
-    ahd_print_register(NULL, 0, "CURADDR", 0xf4, regvalue, cur_col, wrap)
-#endif
-
-#if AIC_DEBUG_REGISTERS
-ahd_reg_print_t ahd_intvec2_addr_print;
-#else
-#define ahd_intvec2_addr_print(regvalue, cur_col, wrap) \
-    ahd_print_register(NULL, 0, "INTVEC2_ADDR", 0xf6, regvalue, cur_col, wrap)
-#endif
-
-#if AIC_DEBUG_REGISTERS
-ahd_reg_print_t ahd_longjmp_addr_print;
-#else
-#define ahd_longjmp_addr_print(regvalue, cur_col, wrap) \
-    ahd_print_register(NULL, 0, "LONGJMP_ADDR", 0xf8, regvalue, cur_col, wrap)
-#endif
-
-#if AIC_DEBUG_REGISTERS
-ahd_reg_print_t ahd_accum_save_print;
-#else
-#define ahd_accum_save_print(regvalue, cur_col, wrap) \
-    ahd_print_register(NULL, 0, "ACCUM_SAVE", 0xfa, regvalue, cur_col, wrap)
-#endif
-
-#if AIC_DEBUG_REGISTERS
-ahd_reg_print_t ahd_waiting_scb_tails_print;
-#else
-#define ahd_waiting_scb_tails_print(regvalue, cur_col, wrap) \
-    ahd_print_register(NULL, 0, "WAITING_SCB_TAILS", 0x100, regvalue, cur_col, wrap)
-#endif
-
-#if AIC_DEBUG_REGISTERS
 ahd_reg_print_t ahd_sram_base_print;
 #else
 #define ahd_sram_base_print(regvalue, cur_col, wrap) \
@@ -916,62 +286,6 @@ ahd_reg_print_t ahd_sram_base_print;
 #endif
 
 #if AIC_DEBUG_REGISTERS
-ahd_reg_print_t ahd_waiting_tid_head_print;
-#else
-#define ahd_waiting_tid_head_print(regvalue, cur_col, wrap) \
-    ahd_print_register(NULL, 0, "WAITING_TID_HEAD", 0x120, regvalue, cur_col, wrap)
-#endif
-
-#if AIC_DEBUG_REGISTERS
-ahd_reg_print_t ahd_waiting_tid_tail_print;
-#else
-#define ahd_waiting_tid_tail_print(regvalue, cur_col, wrap) \
-    ahd_print_register(NULL, 0, "WAITING_TID_TAIL", 0x122, regvalue, cur_col, wrap)
-#endif
-
-#if AIC_DEBUG_REGISTERS
-ahd_reg_print_t ahd_next_queued_scb_addr_print;
-#else
-#define ahd_next_queued_scb_addr_print(regvalue, cur_col, wrap) \
-    ahd_print_register(NULL, 0, "NEXT_QUEUED_SCB_ADDR", 0x124, regvalue, cur_col, wrap)
-#endif
-
-#if AIC_DEBUG_REGISTERS
-ahd_reg_print_t ahd_complete_scb_head_print;
-#else
-#define ahd_complete_scb_head_print(regvalue, cur_col, wrap) \
-    ahd_print_register(NULL, 0, "COMPLETE_SCB_HEAD", 0x128, regvalue, cur_col, wrap)
-#endif
-
-#if AIC_DEBUG_REGISTERS
-ahd_reg_print_t ahd_complete_scb_dmainprog_head_print;
-#else
-#define ahd_complete_scb_dmainprog_head_print(regvalue, cur_col, wrap) \
-    ahd_print_register(NULL, 0, "COMPLETE_SCB_DMAINPROG_HEAD", 0x12a, regvalue, cur_col, wrap)
-#endif
-
-#if AIC_DEBUG_REGISTERS
-ahd_reg_print_t ahd_complete_dma_scb_head_print;
-#else
-#define ahd_complete_dma_scb_head_print(regvalue, cur_col, wrap) \
-    ahd_print_register(NULL, 0, "COMPLETE_DMA_SCB_HEAD", 0x12c, regvalue, cur_col, wrap)
-#endif
-
-#if AIC_DEBUG_REGISTERS
-ahd_reg_print_t ahd_complete_dma_scb_tail_print;
-#else
-#define ahd_complete_dma_scb_tail_print(regvalue, cur_col, wrap) \
-    ahd_print_register(NULL, 0, "COMPLETE_DMA_SCB_TAIL", 0x12e, regvalue, cur_col, wrap)
-#endif
-
-#if AIC_DEBUG_REGISTERS
-ahd_reg_print_t ahd_complete_on_qfreeze_head_print;
-#else
-#define ahd_complete_on_qfreeze_head_print(regvalue, cur_col, wrap) \
-    ahd_print_register(NULL, 0, "COMPLETE_ON_QFREEZE_HEAD", 0x130, regvalue, cur_col, wrap)
-#endif
-
-#if AIC_DEBUG_REGISTERS
 ahd_reg_print_t ahd_qfreeze_count_print;
 #else
 #define ahd_qfreeze_count_print(regvalue, cur_col, wrap) \
@@ -993,13 +307,6 @@ ahd_reg_print_t ahd_saved_mode_print;
 #endif
 
 #if AIC_DEBUG_REGISTERS
-ahd_reg_print_t ahd_msg_out_print;
-#else
-#define ahd_msg_out_print(regvalue, cur_col, wrap) \
-    ahd_print_register(NULL, 0, "MSG_OUT", 0x137, regvalue, cur_col, wrap)
-#endif
-
-#if AIC_DEBUG_REGISTERS
 ahd_reg_print_t ahd_seq_flags_print;
 #else
 #define ahd_seq_flags_print(regvalue, cur_col, wrap) \
@@ -1014,48 +321,6 @@ ahd_reg_print_t ahd_lastphase_print;
 #endif
 
 #if AIC_DEBUG_REGISTERS
-ahd_reg_print_t ahd_qoutfifo_entry_valid_tag_print;
-#else
-#define ahd_qoutfifo_entry_valid_tag_print(regvalue, cur_col, wrap) \
-    ahd_print_register(NULL, 0, "QOUTFIFO_ENTRY_VALID_TAG", 0x13d, regvalue, cur_col, wrap)
-#endif
-
-#if AIC_DEBUG_REGISTERS
-ahd_reg_print_t ahd_kernel_tqinpos_print;
-#else
-#define ahd_kernel_tqinpos_print(regvalue, cur_col, wrap) \
-    ahd_print_register(NULL, 0, "KERNEL_TQINPOS", 0x13e, regvalue, cur_col, wrap)
-#endif
-
-#if AIC_DEBUG_REGISTERS
-ahd_reg_print_t ahd_qoutfifo_next_addr_print;
-#else
-#define ahd_qoutfifo_next_addr_print(regvalue, cur_col, wrap) \
-    ahd_print_register(NULL, 0, "QOUTFIFO_NEXT_ADDR", 0x144, regvalue, cur_col, wrap)
-#endif
-
-#if AIC_DEBUG_REGISTERS
-ahd_reg_print_t ahd_last_msg_print;
-#else
-#define ahd_last_msg_print(regvalue, cur_col, wrap) \
-    ahd_print_register(NULL, 0, "LAST_MSG", 0x14a, regvalue, cur_col, wrap)
-#endif
-
-#if AIC_DEBUG_REGISTERS
-ahd_reg_print_t ahd_scsiseq_template_print;
-#else
-#define ahd_scsiseq_template_print(regvalue, cur_col, wrap) \
-    ahd_print_register(NULL, 0, "SCSISEQ_TEMPLATE", 0x14b, regvalue, cur_col, wrap)
-#endif
-
-#if AIC_DEBUG_REGISTERS
-ahd_reg_print_t ahd_initiator_tag_print;
-#else
-#define ahd_initiator_tag_print(regvalue, cur_col, wrap) \
-    ahd_print_register(NULL, 0, "INITIATOR_TAG", 0x14c, regvalue, cur_col, wrap)
-#endif
-
-#if AIC_DEBUG_REGISTERS
 ahd_reg_print_t ahd_seq_flags2_print;
 #else
 #define ahd_seq_flags2_print(regvalue, cur_col, wrap) \
@@ -1063,62 +328,6 @@ ahd_reg_print_t ahd_seq_flags2_print;
 #endif
 
 #if AIC_DEBUG_REGISTERS
-ahd_reg_print_t ahd_allocfifo_scbptr_print;
-#else
-#define ahd_allocfifo_scbptr_print(regvalue, cur_col, wrap) \
-    ahd_print_register(NULL, 0, "ALLOCFIFO_SCBPTR", 0x14e, regvalue, cur_col, wrap)
-#endif
-
-#if AIC_DEBUG_REGISTERS
-ahd_reg_print_t ahd_int_coalescing_timer_print;
-#else
-#define ahd_int_coalescing_timer_print(regvalue, cur_col, wrap) \
-    ahd_print_register(NULL, 0, "INT_COALESCING_TIMER", 0x150, regvalue, cur_col, wrap)
-#endif
-
-#if AIC_DEBUG_REGISTERS
-ahd_reg_print_t ahd_int_coalescing_maxcmds_print;
-#else
-#define ahd_int_coalescing_maxcmds_print(regvalue, cur_col, wrap) \
-    ahd_print_register(NULL, 0, "INT_COALESCING_MAXCMDS", 0x152, regvalue, cur_col, wrap)
-#endif
-
-#if AIC_DEBUG_REGISTERS
-ahd_reg_print_t ahd_int_coalescing_mincmds_print;
-#else
-#define ahd_int_coalescing_mincmds_print(regvalue, cur_col, wrap) \
-    ahd_print_register(NULL, 0, "INT_COALESCING_MINCMDS", 0x153, regvalue, cur_col, wrap)
-#endif
-
-#if AIC_DEBUG_REGISTERS
-ahd_reg_print_t ahd_cmds_pending_print;
-#else
-#define ahd_cmds_pending_print(regvalue, cur_col, wrap) \
-    ahd_print_register(NULL, 0, "CMDS_PENDING", 0x154, regvalue, cur_col, wrap)
-#endif
-
-#if AIC_DEBUG_REGISTERS
-ahd_reg_print_t ahd_int_coalescing_cmdcount_print;
-#else
-#define ahd_int_coalescing_cmdcount_print(regvalue, cur_col, wrap) \
-    ahd_print_register(NULL, 0, "INT_COALESCING_CMDCOUNT", 0x156, regvalue, cur_col, wrap)
-#endif
-
-#if AIC_DEBUG_REGISTERS
-ahd_reg_print_t ahd_local_hs_mailbox_print;
-#else
-#define ahd_local_hs_mailbox_print(regvalue, cur_col, wrap) \
-    ahd_print_register(NULL, 0, "LOCAL_HS_MAILBOX", 0x157, regvalue, cur_col, wrap)
-#endif
-
-#if AIC_DEBUG_REGISTERS
-ahd_reg_print_t ahd_cmdsize_table_print;
-#else
-#define ahd_cmdsize_table_print(regvalue, cur_col, wrap) \
-    ahd_print_register(NULL, 0, "CMDSIZE_TABLE", 0x158, regvalue, cur_col, wrap)
-#endif
-
-#if AIC_DEBUG_REGISTERS
 ahd_reg_print_t ahd_mk_message_scb_print;
 #else
 #define ahd_mk_message_scb_print(regvalue, cur_col, wrap) \
@@ -1140,27 +349,6 @@ ahd_reg_print_t ahd_scb_base_print;
 #endif
 
 #if AIC_DEBUG_REGISTERS
-ahd_reg_print_t ahd_scb_residual_datacnt_print;
-#else
-#define ahd_scb_residual_datacnt_print(regvalue, cur_col, wrap) \
-    ahd_print_register(NULL, 0, "SCB_RESIDUAL_DATACNT", 0x180, regvalue, cur_col, wrap)
-#endif
-
-#if AIC_DEBUG_REGISTERS
-ahd_reg_print_t ahd_scb_sense_busaddr_print;
-#else
-#define ahd_scb_sense_busaddr_print(regvalue, cur_col, wrap) \
-    ahd_print_register(NULL, 0, "SCB_SENSE_BUSADDR", 0x18c, regvalue, cur_col, wrap)
-#endif
-
-#if AIC_DEBUG_REGISTERS
-ahd_reg_print_t ahd_scb_tag_print;
-#else
-#define ahd_scb_tag_print(regvalue, cur_col, wrap) \
-    ahd_print_register(NULL, 0, "SCB_TAG", 0x190, regvalue, cur_col, wrap)
-#endif
-
-#if AIC_DEBUG_REGISTERS
 ahd_reg_print_t ahd_scb_control_print;
 #else
 #define ahd_scb_control_print(regvalue, cur_col, wrap) \
@@ -1174,69 +362,6 @@ ahd_reg_print_t ahd_scb_scsiid_print;
     ahd_print_register(NULL, 0, "SCB_SCSIID", 0x193, regvalue, cur_col, wrap)
 #endif
 
-#if AIC_DEBUG_REGISTERS
-ahd_reg_print_t ahd_scb_lun_print;
-#else
-#define ahd_scb_lun_print(regvalue, cur_col, wrap) \
-    ahd_print_register(NULL, 0, "SCB_LUN", 0x194, regvalue, cur_col, wrap)
-#endif
-
-#if AIC_DEBUG_REGISTERS
-ahd_reg_print_t ahd_scb_task_attribute_print;
-#else
-#define ahd_scb_task_attribute_print(regvalue, cur_col, wrap) \
-    ahd_print_register(NULL, 0, "SCB_TASK_ATTRIBUTE", 0x195, regvalue, cur_col, wrap)
-#endif
-
-#if AIC_DEBUG_REGISTERS
-ahd_reg_print_t ahd_scb_task_management_print;
-#else
-#define ahd_scb_task_management_print(regvalue, cur_col, wrap) \
-    ahd_print_register(NULL, 0, "SCB_TASK_MANAGEMENT", 0x197, regvalue, cur_col, wrap)
-#endif
-
-#if AIC_DEBUG_REGISTERS
-ahd_reg_print_t ahd_scb_dataptr_print;
-#else
-#define ahd_scb_dataptr_print(regvalue, cur_col, wrap) \
-    ahd_print_register(NULL, 0, "SCB_DATAPTR", 0x198, regvalue, cur_col, wrap)
-#endif
-
-#if AIC_DEBUG_REGISTERS
-ahd_reg_print_t ahd_scb_datacnt_print;
-#else
-#define ahd_scb_datacnt_print(regvalue, cur_col, wrap) \
-    ahd_print_register(NULL, 0, "SCB_DATACNT", 0x1a0, regvalue, cur_col, wrap)
-#endif
-
-#if AIC_DEBUG_REGISTERS
-ahd_reg_print_t ahd_scb_sgptr_print;
-#else
-#define ahd_scb_sgptr_print(regvalue, cur_col, wrap) \
-    ahd_print_register(NULL, 0, "SCB_SGPTR", 0x1a4, regvalue, cur_col, wrap)
-#endif
-
-#if AIC_DEBUG_REGISTERS
-ahd_reg_print_t ahd_scb_busaddr_print;
-#else
-#define ahd_scb_busaddr_print(regvalue, cur_col, wrap) \
-    ahd_print_register(NULL, 0, "SCB_BUSADDR", 0x1a8, regvalue, cur_col, wrap)
-#endif
-
-#if AIC_DEBUG_REGISTERS
-ahd_reg_print_t ahd_scb_next2_print;
-#else
-#define ahd_scb_next2_print(regvalue, cur_col, wrap) \
-    ahd_print_register(NULL, 0, "SCB_NEXT2", 0x1ae, regvalue, cur_col, wrap)
-#endif
-
-#if AIC_DEBUG_REGISTERS
-ahd_reg_print_t ahd_scb_disconnected_lists_print;
-#else
-#define ahd_scb_disconnected_lists_print(regvalue, cur_col, wrap) \
-    ahd_print_register(NULL, 0, "SCB_DISCONNECTED_LISTS", 0x1b8, regvalue, cur_col, wrap)
-#endif
-
 
 #define	MODE_PTR        		0x00
 #define		DST_MODE        	0x70
@@ -1292,15 +417,6 @@ ahd_reg_print_t ahd_scb_disconnected_lists_print;
 #define		CLRCMDINT       	0x02
 #define		CLRSPLTINT      	0x01
 
-#define	ERROR           		0x04
-#define		CIOPARERR       	0x80
-#define		CIOACCESFAIL    	0x40
-#define		MPARERR         	0x20
-#define		DPARERR         	0x10
-#define		SQPARERR        	0x08
-#define		ILLOPCODE       	0x04
-#define		DSCTMOUT        	0x02
-
 #define	CLRERR          		0x04
 #define		CLRCIOPARERR    	0x80
 #define		CLRCIOACCESFAIL 	0x40
@@ -1310,6 +426,15 @@ ahd_reg_print_t ahd_scb_disconnected_lists_print;
 #define		CLRILLOPCODE    	0x04
 #define		CLRDSCTMOUT     	0x02
 
+#define	ERROR           		0x04
+#define		CIOPARERR       	0x80
+#define		CIOACCESFAIL    	0x40
+#define		MPARERR         	0x20
+#define		DPARERR         	0x10
+#define		SQPARERR        	0x08
+#define		ILLOPCODE       	0x04
+#define		DSCTMOUT        	0x02
+
 #define	HCNTRL          		0x05
 #define		SEQ_RESET       	0x80
 #define		POWRDN          	0x40
@@ -1404,22 +529,22 @@ ahd_reg_print_t ahd_scb_disconnected_lists_print;
 #define		FIFOFULL        	0x02
 #define		FIFOEMP         	0x01
 
-#define	SG_CACHE_SHADOW 		0x1b
-#define		ODD_SEG         	0x04
-#define		LAST_SEG        	0x02
-#define		LAST_SEG_DONE   	0x01
-
 #define	ARBCTL          		0x1b
 #define		RESET_HARB      	0x80
 #define		RETRY_SWEN      	0x08
 #define		USE_TIME        	0x07
 
+#define	SG_CACHE_SHADOW 		0x1b
+#define		ODD_SEG         	0x04
+#define		LAST_SEG        	0x02
+#define		LAST_SEG_DONE   	0x01
+
 #define	SG_CACHE_PRE    		0x1b
 
-#define	LQIN            		0x20
-
 #define	TYPEPTR         		0x20
 
+#define	LQIN            		0x20
+
 #define	TAGPTR          		0x21
 
 #define	LUNPTR          		0x22
@@ -1479,14 +604,6 @@ ahd_reg_print_t ahd_scb_disconnected_lists_print;
 #define		SINGLECMD       	0x02
 #define		ABORTPENDING    	0x01
 
-#define	SCSBIST0        		0x39
-#define		GSBISTERR       	0x40
-#define		GSBISTDONE      	0x20
-#define		GSBISTRUN       	0x10
-#define		OSBISTERR       	0x04
-#define		OSBISTDONE      	0x02
-#define		OSBISTRUN       	0x01
-
 #define	LQCTL2          		0x39
 #define		LQIRETRY        	0x80
 #define		LQICONTINUE     	0x40
@@ -1497,10 +614,13 @@ ahd_reg_print_t ahd_scb_disconnected_lists_print;
 #define		LQOTOIDLE       	0x02
 #define		LQOPAUSE        	0x01
 
-#define	SCSBIST1        		0x3a
-#define		NTBISTERR       	0x04
-#define		NTBISTDONE      	0x02
-#define		NTBISTRUN       	0x01
+#define	SCSBIST0        		0x39
+#define		GSBISTERR       	0x40
+#define		GSBISTDONE      	0x20
+#define		GSBISTRUN       	0x10
+#define		OSBISTERR       	0x04
+#define		OSBISTDONE      	0x02
+#define		OSBISTRUN       	0x01
 
 #define	SCSISEQ0        		0x3a
 #define		TEMODEO         	0x80
@@ -1509,8 +629,15 @@ ahd_reg_print_t ahd_scb_disconnected_lists_print;
 #define		FORCEBUSFREE    	0x10
 #define		SCSIRSTO        	0x01
 
+#define	SCSBIST1        		0x3a
+#define		NTBISTERR       	0x04
+#define		NTBISTDONE      	0x02
+#define		NTBISTRUN       	0x01
+
 #define	SCSISEQ1        		0x3b
 
+#define	BUSINITID       		0x3c
+
 #define	SXFRCTL0        		0x3c
 #define		DFON            	0x80
 #define		DFPEXP          	0x40
@@ -1519,8 +646,6 @@ ahd_reg_print_t ahd_scb_disconnected_lists_print;
 
 #define	DLCOUNT         		0x3c
 
-#define	BUSINITID       		0x3c
-
 #define	SXFRCTL1        		0x3d
 #define		BITBUCKET       	0x80
 #define		ENSACHK         	0x40
@@ -1545,6 +670,8 @@ ahd_reg_print_t ahd_scb_disconnected_lists_print;
 #define		CURRFIFO_1      	0x01
 #define		CURRFIFO_0      	0x00
 
+#define	MULTARGID       		0x40
+
 #define	SCSISIGO        		0x40
 #define		CDO             	0x80
 #define		IOO             	0x40
@@ -1555,8 +682,6 @@ ahd_reg_print_t ahd_scb_disconnected_lists_print;
 #define		REQO            	0x02
 #define		ACKO            	0x01
 
-#define	MULTARGID       		0x40
-
 #define	SCSISIGI        		0x41
 #define		ATNI            	0x10
 #define		SELI            	0x08
@@ -1603,14 +728,14 @@ ahd_reg_print_t ahd_scb_disconnected_lists_print;
 #define		ENAB20          	0x04
 #define		SELWIDE         	0x02
 
-#define	CLRSINT0        		0x4b
-#define		CLRSELDO        	0x40
-#define		CLRSELDI        	0x20
-#define		CLRSELINGO      	0x10
-#define		CLRIOERR        	0x08
-#define		CLROVERRUN      	0x04
-#define		CLRSPIORDY      	0x02
-#define		CLRARBDO        	0x01
+#define	SIMODE0         		0x4b
+#define		ENSELDO         	0x40
+#define		ENSELDI         	0x20
+#define		ENSELINGO       	0x10
+#define		ENIOERR         	0x08
+#define		ENOVERRUN       	0x04
+#define		ENSPIORDY       	0x02
+#define		ENARBDO         	0x01
 
 #define	SSTAT0          		0x4b
 #define		TARGET          	0x80
@@ -1622,23 +747,14 @@ ahd_reg_print_t ahd_scb_disconnected_lists_print;
 #define		SPIORDY         	0x02
 #define		ARBDO           	0x01
 
-#define	SIMODE0         		0x4b
-#define		ENSELDO         	0x40
-#define		ENSELDI         	0x20
-#define		ENSELINGO       	0x10
-#define		ENIOERR         	0x08
-#define		ENOVERRUN       	0x04
-#define		ENSPIORDY       	0x02
-#define		ENARBDO         	0x01
-
-#define	CLRSINT1        		0x4c
-#define		CLRSELTIMEO     	0x80
-#define		CLRATNO         	0x40
-#define		CLRSCSIRSTI     	0x20
-#define		CLRBUSFREE      	0x08
-#define		CLRSCSIPERR     	0x04
-#define		CLRSTRB2FAST    	0x02
-#define		CLRREQINIT      	0x01
+#define	CLRSINT0        		0x4b
+#define		CLRSELDO        	0x40
+#define		CLRSELDI        	0x20
+#define		CLRSELINGO      	0x10
+#define		CLRIOERR        	0x08
+#define		CLROVERRUN      	0x04
+#define		CLRSPIORDY      	0x02
+#define		CLRARBDO        	0x01
 
 #define	SSTAT1          		0x4c
 #define		SELTO           	0x80
@@ -1650,6 +766,20 @@ ahd_reg_print_t ahd_scb_disconnected_lists_print;
 #define		STRB2FAST       	0x02
 #define		REQINIT         	0x01
 
+#define	CLRSINT1        		0x4c
+#define		CLRSELTIMEO     	0x80
+#define		CLRATNO         	0x40
+#define		CLRSCSIRSTI     	0x20
+#define		CLRBUSFREE      	0x08
+#define		CLRSCSIPERR     	0x04
+#define		CLRSTRB2FAST    	0x02
+#define		CLRREQINIT      	0x01
+
+#define	SIMODE2         		0x4d
+#define		ENWIDE_RES      	0x04
+#define		ENSDONE         	0x02
+#define		ENDMADONE       	0x01
+
 #define	SSTAT2          		0x4d
 #define		BUSFREETIME     	0xc0
 #define		NONPACKREQ      	0x20
@@ -1662,11 +792,6 @@ ahd_reg_print_t ahd_scb_disconnected_lists_print;
 #define		BUSFREE_DFF0    	0x80
 #define		BUSFREE_LQO     	0x40
 
-#define	SIMODE2         		0x4d
-#define		ENWIDE_RES      	0x04
-#define		ENSDONE         	0x02
-#define		ENDMADONE       	0x01
-
 #define	CLRSINT2        		0x4d
 #define		CLRNONPACKREQ   	0x20
 #define		CLRWIDE_RES     	0x04
@@ -1685,10 +810,10 @@ ahd_reg_print_t ahd_scb_disconnected_lists_print;
 
 #define	LQISTATE        		0x4e
 
-#define	SOFFCNT         		0x4f
-
 #define	LQOSTATE        		0x4f
 
+#define	SOFFCNT         		0x4f
+
 #define	LQISTAT0        		0x50
 #define		LQIATNQAS       	0x20
 #define		LQICRCT1        	0x10
@@ -1697,14 +822,6 @@ ahd_reg_print_t ahd_scb_disconnected_lists_print;
 #define		LQIATNLQ        	0x02
 #define		LQIATNCMD       	0x01
 
-#define	CLRLQIINT0      		0x50
-#define		CLRLQIATNQAS    	0x20
-#define		CLRLQICRCT1     	0x10
-#define		CLRLQICRCT2     	0x08
-#define		CLRLQIBADLQT    	0x04
-#define		CLRLQIATNLQ     	0x02
-#define		CLRLQIATNCMD    	0x01
-
 #define	LQIMODE0        		0x50
 #define		ENLQIATNQASK    	0x20
 #define		ENLQICRCT1      	0x10
@@ -1713,6 +830,14 @@ ahd_reg_print_t ahd_scb_disconnected_lists_print;
 #define		ENLQIATNLQ      	0x02
 #define		ENLQIATNCMD     	0x01
 
+#define	CLRLQIINT0      		0x50
+#define		CLRLQIATNQAS    	0x20
+#define		CLRLQICRCT1     	0x10
+#define		CLRLQICRCT2     	0x08
+#define		CLRLQIBADLQT    	0x04
+#define		CLRLQIATNLQ     	0x02
+#define		CLRLQIATNCMD    	0x01
+
 #define	LQIMODE1        		0x51
 #define		ENLQIPHASE_LQ   	0x80
 #define		ENLQIPHASE_NLQ  	0x40
@@ -1753,25 +878,18 @@ ahd_reg_print_t ahd_scb_disconnected_lists_print;
 #define		LQISTOPCMD      	0x02
 #define		LQIGSAVAIL      	0x01
 
-#define	SSTAT3          		0x53
-#define		NTRAMPERR       	0x02
-#define		OSRAMPERR       	0x01
-
 #define	SIMODE3         		0x53
 #define		ENNTRAMPERR     	0x02
 #define		ENOSRAMPERR     	0x01
 
+#define	SSTAT3          		0x53
+#define		NTRAMPERR       	0x02
+#define		OSRAMPERR       	0x01
+
 #define	CLRSINT3        		0x53
 #define		CLRNTRAMPERR    	0x02
 #define		CLROSRAMPERR    	0x01
 
-#define	LQOSTAT0        		0x54
-#define		LQOTARGSCBPERR  	0x10
-#define		LQOSTOPT2       	0x08
-#define		LQOATNLQ        	0x04
-#define		LQOATNPKT       	0x02
-#define		LQOTCRC         	0x01
-
 #define	CLRLQOINT0      		0x54
 #define		CLRLQOTARGSCBPERR	0x10
 #define		CLRLQOSTOPT2    	0x08
@@ -1779,6 +897,13 @@ ahd_reg_print_t ahd_scb_disconnected_lists_print;
 #define		CLRLQOATNPKT    	0x02
 #define		CLRLQOTCRC      	0x01
 
+#define	LQOSTAT0        		0x54
+#define		LQOTARGSCBPERR  	0x10
+#define		LQOSTOPT2       	0x08
+#define		LQOATNLQ        	0x04
+#define		LQOATNPKT       	0x02
+#define		LQOTCRC         	0x01
+
 #define	LQOMODE0        		0x54
 #define		ENLQOTARGSCBPERR	0x10
 #define		ENLQOSTOPT2     	0x08
@@ -1793,13 +918,6 @@ ahd_reg_print_t ahd_scb_disconnected_lists_print;
 #define		ENLQOBUSFREE    	0x02
 #define		ENLQOPHACHGINPKT	0x01
 
-#define	LQOSTAT1        		0x55
-#define		LQOINITSCBPERR  	0x10
-#define		LQOSTOPI2       	0x08
-#define		LQOBADQAS       	0x04
-#define		LQOBUSFREE      	0x02
-#define		LQOPHACHGINPKT  	0x01
-
 #define	CLRLQOINT1      		0x55
 #define		CLRLQOINITSCBPERR	0x10
 #define		CLRLQOSTOPI2    	0x08
@@ -1807,6 +925,13 @@ ahd_reg_print_t ahd_scb_disconnected_lists_print;
 #define		CLRLQOBUSFREE   	0x02
 #define		CLRLQOPHACHGINPKT	0x01
 
+#define	LQOSTAT1        		0x55
+#define		LQOINITSCBPERR  	0x10
+#define		LQOSTOPI2       	0x08
+#define		LQOBADQAS       	0x04
+#define		LQOBUSFREE      	0x02
+#define		LQOPHACHGINPKT  	0x01
+
 #define	LQOSTAT2        		0x56
 #define		LQOPKT          	0xe0
 #define		LQOWAITFIFO     	0x10
@@ -1859,8 +984,6 @@ ahd_reg_print_t ahd_scb_disconnected_lists_print;
 #define		CFG4ICMD        	0x02
 #define		CFG4TCMD        	0x01
 
-#define	CURRSCB         		0x5c
-
 #define	SEQIMODE        		0x5c
 #define		ENCTXTDONE      	0x40
 #define		ENSAVEPTRS      	0x20
@@ -1870,6 +993,11 @@ ahd_reg_print_t ahd_scb_disconnected_lists_print;
 #define		ENCFG4ICMD      	0x02
 #define		ENCFG4TCMD      	0x01
 
+#define	CURRSCB         		0x5c
+
+#define	CRCCONTROL      		0x5d
+#define		CRCVALCHKEN     	0x40
+
 #define	MDFFSTAT        		0x5d
 #define		SHCNTNEGATIVE   	0x40
 #define		SHCNTMINUS1     	0x20
@@ -1879,34 +1007,31 @@ ahd_reg_print_t ahd_scb_disconnected_lists_print;
 #define		DATAINFIFO      	0x02
 #define		FIFOFREE        	0x01
 
-#define	CRCCONTROL      		0x5d
-#define		CRCVALCHKEN     	0x40
-
 #define	DFFTAG          		0x5e
 
-#define	LASTSCB         		0x5e
-
 #define	SCSITEST        		0x5e
 #define		CNTRTEST        	0x08
 #define		SEL_TXPLL_DEBUG 	0x04
 
+#define	LASTSCB         		0x5e
+
 #define	IOPDNCTL        		0x5f
 #define		DISABLE_OE      	0x80
 #define		PDN_IDIST       	0x04
 #define		PDN_DIFFSENSE   	0x01
 
-#define	SHADDR          		0x60
-
-#define	NEGOADDR        		0x60
-
 #define	DGRPCRCI        		0x60
 
+#define	NEGOADDR        		0x60
+
+#define	SHADDR          		0x60
+
 #define	NEGPERIOD       		0x61
 
-#define	PACKCRCI        		0x62
-
 #define	NEGOFFSET       		0x62
 
+#define	PACKCRCI        		0x62
+
 #define	NEGPPROPTS      		0x63
 #define		PPROPT_PACE     	0x08
 #define		PPROPT_QAS      	0x04
@@ -1942,16 +1067,18 @@ ahd_reg_print_t ahd_scb_disconnected_lists_print;
 
 #define	SHCNT           		0x68
 
-#define	TOWNID          		0x69
-
 #define	PLL960CTL1      		0x69
 
+#define	TOWNID          		0x69
+
 #define	PLL960CNT0      		0x6a
 
 #define	XSIG            		0x6a
 
 #define	SELOID          		0x6b
 
+#define	FAIRNESS        		0x6c
+
 #define	PLL400CTL0      		0x6c
 #define		PLL_VCOSEL      	0x80
 #define		PLL_PWDN        	0x40
@@ -1961,8 +1088,6 @@ ahd_reg_print_t ahd_scb_disconnected_lists_print;
 #define		PLL_DLPF        	0x02
 #define		PLL_ENFBM       	0x01
 
-#define	FAIRNESS        		0x6c
-
 #define	PLL400CTL1      		0x6d
 #define		PLL_CNTEN       	0x80
 #define		PLL_CNTCLR      	0x40
@@ -1974,25 +1099,25 @@ ahd_reg_print_t ahd_scb_disconnected_lists_print;
 
 #define	HADDR           		0x70
 
+#define	HODMAADR        		0x70
+
 #define	PLLDELAY        		0x70
 #define		SPLIT_DROP_REQ  	0x80
 
-#define	HODMAADR        		0x70
-
-#define	HODMACNT        		0x78
-
 #define	HCNT            		0x78
 
+#define	HODMACNT        		0x78
+
 #define	HODMAEN         		0x7a
 
-#define	SCBHADDR        		0x7c
-
 #define	SGHADDR         		0x7c
 
-#define	SCBHCNT         		0x84
+#define	SCBHADDR        		0x7c
 
 #define	SGHCNT          		0x84
 
+#define	SCBHCNT         		0x84
+
 #define	DFF_THRSH       		0x88
 #define		WR_DFTHRSH      	0x70
 #define		RD_DFTHRSH      	0x07
@@ -2025,6 +1150,10 @@ ahd_reg_print_t ahd_scb_disconnected_lists_print;
 
 #define	CMCRXMSG0       		0x90
 
+#define	OVLYRXMSG0      		0x90
+
+#define	DCHRXMSG0       		0x90
+
 #define	ROENABLE        		0x90
 #define		MSIROEN         	0x20
 #define		OVLYROEN        	0x10
@@ -2033,12 +1162,12 @@ ahd_reg_print_t ahd_scb_disconnected_lists_print;
 #define		DCH1ROEN        	0x02
 #define		DCH0ROEN        	0x01
 
-#define	OVLYRXMSG0      		0x90
-
-#define	DCHRXMSG0       		0x90
-
 #define	OVLYRXMSG1      		0x91
 
+#define	CMCRXMSG1       		0x91
+
+#define	DCHRXMSG1       		0x91
+
 #define	NSENABLE        		0x91
 #define		MSINSEN         	0x20
 #define		OVLYNSEN        	0x10
@@ -2047,10 +1176,6 @@ ahd_reg_print_t ahd_scb_disconnected_lists_print;
 #define		DCH1NSEN        	0x02
 #define		DCH0NSEN        	0x01
 
-#define	CMCRXMSG1       		0x91
-
-#define	DCHRXMSG1       		0x91
-
 #define	DCHRXMSG2       		0x92
 
 #define	CMCRXMSG2       		0x92
@@ -2074,24 +1199,24 @@ ahd_reg_print_t ahd_scb_disconnected_lists_print;
 #define		TSCSERREN       	0x02
 #define		CMPABCDIS       	0x01
 
+#define	CMCSEQBCNT      		0x94
+
 #define	OVLYSEQBCNT     		0x94
 
 #define	DCHSEQBCNT      		0x94
 
-#define	CMCSEQBCNT      		0x94
-
-#define	CMCSPLTSTAT0    		0x96
-
 #define	DCHSPLTSTAT0    		0x96
 
 #define	OVLYSPLTSTAT0   		0x96
 
-#define	CMCSPLTSTAT1    		0x97
+#define	CMCSPLTSTAT0    		0x96
 
 #define	OVLYSPLTSTAT1   		0x97
 
 #define	DCHSPLTSTAT1    		0x97
 
+#define	CMCSPLTSTAT1    		0x97
+
 #define	SGRXMSG0        		0x98
 #define		CDNUM           	0xf8
 #define		CFNUM           	0x07
@@ -2119,18 +1244,15 @@ ahd_reg_print_t ahd_scb_disconnected_lists_print;
 #define		TAG_NUM         	0x1f
 #define		RLXORD          	0x10
 
-#define	SGSEQBCNT       		0x9c
-
 #define	SLVSPLTOUTATTR0 		0x9c
 #define		LOWER_BCNT      	0xff
 
+#define	SGSEQBCNT       		0x9c
+
 #define	SLVSPLTOUTATTR1 		0x9d
 #define		CMPLT_DNUM      	0xf8
 #define		CMPLT_FNUM      	0x07
 
-#define	SLVSPLTOUTATTR2 		0x9e
-#define		CMPLT_BNUM      	0xff
-
 #define	SGSPLTSTAT0     		0x9e
 #define		STAETERM        	0x80
 #define		SCBCERR         	0x40
@@ -2141,6 +1263,9 @@ ahd_reg_print_t ahd_scb_disconnected_lists_print;
 #define		RXSCEMSG        	0x02
 #define		RXSPLTRSP       	0x01
 
+#define	SLVSPLTOUTATTR2 		0x9e
+#define		CMPLT_BNUM      	0xff
+
 #define	SGSPLTSTAT1     		0x9f
 #define		RXDATABUCKET    	0x01
 
@@ -2177,14 +1302,14 @@ ahd_reg_print_t ahd_scb_disconnected_lists_print;
 #define		CLRPENDMSI      	0x08
 #define		DPR             	0x01
 
+#define	DATA_COUNT_ODD  		0xa7
+
 #define	TARGPCISTAT     		0xa7
 #define		DPE             	0x80
 #define		SSE             	0x40
 #define		STA             	0x08
 #define		TWATERR         	0x02
 
-#define	DATA_COUNT_ODD  		0xa7
-
 #define	SCBPTR          		0xa8
 
 #define	CCSCBACNT       		0xab
@@ -2196,10 +1321,10 @@ ahd_reg_print_t ahd_scb_disconnected_lists_print;
 
 #define	CCSGADDR        		0xac
 
-#define	CCSCBADR_BK     		0xac
-
 #define	CCSCBADDR       		0xac
 
+#define	CCSCBADR_BK     		0xac
+
 #define	CMC_RAMBIST     		0xad
 #define		SG_ELEMENT_SIZE 	0x80
 #define		SCBRAMBIST_FAIL 	0x40
@@ -2253,9 +1378,9 @@ ahd_reg_print_t ahd_scb_disconnected_lists_print;
 #define	SEEDAT          		0xbc
 
 #define	SEECTL          		0xbe
+#define		SEEOP_EWDS      	0x40
 #define		SEEOP_WALL      	0x40
 #define		SEEOP_EWEN      	0x40
-#define		SEEOP_EWDS      	0x40
 #define		SEEOPCODE       	0x70
 #define		SEERST          	0x02
 #define		SEESTART        	0x01
@@ -2272,25 +1397,25 @@ ahd_reg_print_t ahd_scb_disconnected_lists_print;
 
 #define	SCBCNT          		0xbf
 
-#define	DFWADDR         		0xc0
-
 #define	DSPFLTRCTL      		0xc0
 #define		FLTRDISABLE     	0x20
 #define		EDGESENSE       	0x10
 #define		DSPFCNTSEL      	0x0f
 
+#define	DFWADDR         		0xc0
+
 #define	DSPDATACTL      		0xc1
 #define		BYPASSENAB      	0x80
 #define		DESQDIS         	0x10
 #define		RCVROFFSTDIS    	0x04
 #define		XMITOFFSTDIS    	0x02
 
-#define	DFRADDR         		0xc2
-
 #define	DSPREQCTL       		0xc2
 #define		MANREQCTL       	0xc0
 #define		MANREQDLY       	0x3f
 
+#define	DFRADDR         		0xc2
+
 #define	DSPACKCTL       		0xc3
 #define		MANACKCTL       	0xc0
 #define		MANACKDLY       	0x3f
@@ -2311,14 +1436,14 @@ ahd_reg_print_t ahd_scb_disconnected_lists_print;
 
 #define	WRTBIASCALC     		0xc7
 
-#define	RCVRBIASCALC    		0xc8
-
 #define	DFPTRS          		0xc8
 
-#define	SKEWCALC        		0xc9
+#define	RCVRBIASCALC    		0xc8
 
 #define	DFBKPTR         		0xc9
 
+#define	SKEWCALC        		0xc9
+
 #define	DFDBCTL         		0xcb
 #define		DFF_CIO_WR_RDY  	0x20
 #define		DFF_CIO_RD_RDY  	0x10
@@ -2403,12 +1528,12 @@ ahd_reg_print_t ahd_scb_disconnected_lists_print;
 
 #define	ACCUM_SAVE      		0xfa
 
-#define	WAITING_SCB_TAILS		0x100
-
 #define	AHD_PCI_CONFIG_BASE		0x100
 
 #define	SRAM_BASE       		0x100
 
+#define	WAITING_SCB_TAILS		0x100
+
 #define	WAITING_TID_HEAD		0x120
 
 #define	WAITING_TID_TAIL		0x122
@@ -2437,8 +1562,8 @@ ahd_reg_print_t ahd_scb_disconnected_lists_print;
 #define		PRELOADEN       	0x80
 #define		WIDEODD         	0x40
 #define		SCSIEN          	0x20
-#define		SDMAEN          	0x10
 #define		SDMAENACK       	0x10
+#define		SDMAEN          	0x10
 #define		HDMAEN          	0x08
 #define		HDMAENACK       	0x08
 #define		DIRECTION       	0x04
@@ -2536,12 +1661,12 @@ ahd_reg_print_t ahd_scb_disconnected_lists_print;
 
 #define	MK_MESSAGE_SCSIID		0x162
 
-#define	SCB_BASE        		0x180
-
 #define	SCB_RESIDUAL_DATACNT		0x180
 #define	SCB_CDB_STORE   		0x180
 #define	SCB_HOST_CDB_PTR		0x180
 
+#define	SCB_BASE        		0x180
+
 #define	SCB_RESIDUAL_SGPTR		0x184
 #define		SG_ADDR_MASK    	0xf8
 #define		SG_OVERRUN_RESID	0x02
@@ -2609,77 +1734,77 @@ ahd_reg_print_t ahd_scb_disconnected_lists_print;
 #define	SCB_DISCONNECTED_LISTS		0x1b8
 
 
+#define	STIMESEL_SHIFT	0x03
+#define	STIMESEL_MIN	0x18
+#define	INVALID_ADDR	0x80
+#define	CMD_GROUP_CODE_SHIFT	0x05
+#define	AHD_PRECOMP_MASK	0x07
+#define	TARGET_DATA_IN	0x01
+#define	SEEOP_EWEN_ADDR	0xc0
+#define	NUMDSPS 	0x14
+#define	DST_MODE_SHIFT	0x04
+#define	CCSCBADDR_MAX	0x80
+#define	AHD_ANNEXCOL_PER_DEV0	0x04
+#define	TARGET_CMD_CMPLT	0xfe
+#define	SEEOP_WRAL_ADDR	0x40
+#define	BUS_8_BIT	0x00
 #define	AHD_TIMER_MAX_US	0x18ffe7
 #define	AHD_TIMER_MAX_TICKS	0xffff
 #define	AHD_SENSE_BUFSIZE	0x100
-#define	BUS_8_BIT	0x00
-#define	TARGET_CMD_CMPLT	0xfe
-#define	SEEOP_WRAL_ADDR	0x40
-#define	AHD_AMPLITUDE_DEF	0x07
-#define	AHD_PRECOMP_CUTBACK_37	0x07
 #define	AHD_PRECOMP_SHIFT	0x00
+#define	AHD_PRECOMP_CUTBACK_37	0x07
 #define	AHD_ANNEXCOL_PRECOMP_SLEW	0x04
-#define	AHD_TIMER_US_PER_TICK	0x19
-#define	SCB_TRANSFER_SIZE_FULL_LUN	0x38
+#define	AHD_AMPLITUDE_DEF	0x07
+#define	WRTBIASCTL_HP_DEFAULT	0x00
+#define	TID_SHIFT	0x04
 #define	STATUS_QUEUE_FULL	0x28
 #define	STATUS_BUSY	0x08
-#define	MAX_OFFSET_NON_PACED	0x7f
+#define	SEEOP_EWDS_ADDR	0x00
+#define	SCB_TRANSFER_SIZE_FULL_LUN	0x38
+#define	MK_MESSAGE_BIT_OFFSET	0x04
 #define	MAX_OFFSET_PACED	0xfe
-#define	BUS_32_BIT	0x02
+#define	MAX_OFFSET_NON_PACED	0x7f
+#define	LUNLEN_SINGLE_LEVEL_LUN	0x0f
 #define	CCSGADDR_MAX	0x80
-#define	TID_SHIFT	0x04
-#define	MK_MESSAGE_BIT_OFFSET	0x04
-#define	WRTBIASCTL_HP_DEFAULT	0x00
-#define	SEEOP_EWDS_ADDR	0x00
-#define	AHD_AMPLITUDE_SHIFT	0x00
-#define	AHD_AMPLITUDE_MASK	0x07
-#define	AHD_ANNEXCOL_AMPLITUDE	0x06
-#define	AHD_SLEWRATE_DEF_REVA	0x08
+#define	B_CURRFIFO_0	0x02
+#define	BUS_32_BIT	0x02
+#define	AHD_TIMER_US_PER_TICK	0x19
 #define	AHD_SLEWRATE_SHIFT	0x03
 #define	AHD_SLEWRATE_MASK	0x78
+#define	AHD_SLEWRATE_DEF_REVA	0x08
 #define	AHD_PRECOMP_CUTBACK_29	0x06
 #define	AHD_NUM_PER_DEV_ANNEXCOLS	0x04
-#define	B_CURRFIFO_0	0x02
-#define	LUNLEN_SINGLE_LEVEL_LUN	0x0f
-#define	NVRAM_SCB_OFFSET	0x2c
+#define	AHD_ANNEXCOL_AMPLITUDE	0x06
+#define	AHD_AMPLITUDE_SHIFT	0x00
+#define	AHD_AMPLITUDE_MASK	0x07
+#define	STIMESEL_BUG_ADJ	0x08
 #define	STATUS_PKT_SENSE	0xff
-#define	CMD_GROUP_CODE_SHIFT	0x05
+#define	SRC_MODE_SHIFT	0x00
+#define	SEEOP_ERAL_ADDR	0x80
+#define	NVRAM_SCB_OFFSET	0x2c
 #define	MAX_OFFSET_PACED_BUG	0x7f
-#define	STIMESEL_BUG_ADJ	0x08
-#define	STIMESEL_MIN	0x18
-#define	STIMESEL_SHIFT	0x03
 #define	CCSGRAM_MAXSEGS	0x10
-#define	INVALID_ADDR	0x80
-#define	SEEOP_ERAL_ADDR	0x80
 #define	AHD_SLEWRATE_DEF_REVB	0x08
 #define	AHD_PRECOMP_CUTBACK_17	0x04
-#define	AHD_PRECOMP_MASK	0x07
-#define	SRC_MODE_SHIFT	0x00
-#define	PKT_OVERRUN_BUFSIZE	0x200
 #define	SCB_TRANSFER_SIZE_1BYTE_LUN	0x30
-#define	TARGET_DATA_IN	0x01
-#define	HOST_MSG	0xff
+#define	PKT_OVERRUN_BUFSIZE	0x200
 #define	MAX_OFFSET	0xfe
+#define	HOST_MSG	0xff
 #define	BUS_16_BIT	0x01
-#define	CCSCBADDR_MAX	0x80
-#define	NUMDSPS 	0x14
-#define	SEEOP_EWEN_ADDR	0xc0
-#define	AHD_ANNEXCOL_PER_DEV0	0x04
-#define	DST_MODE_SHIFT	0x04
 
 
 /* Downloaded Constant Definitions */
+#define	SG_SIZEOF	0x04
+#define	SG_PREFETCH_ALIGN_MASK	0x02
+#define	SG_PREFETCH_CNT_LIMIT	0x01
 #define	CACHELINE_MASK	0x07
 #define	SCB_TRANSFER_SIZE	0x06
 #define	PKT_OVERRUN_BUFOFFSET	0x05
-#define	SG_SIZEOF	0x04
 #define	SG_PREFETCH_ADDR_MASK	0x03
-#define	SG_PREFETCH_ALIGN_MASK	0x02
-#define	SG_PREFETCH_CNT_LIMIT	0x01
 #define	SG_PREFETCH_CNT	0x00
 #define	DOWNLOAD_CONST_COUNT	0x08
 
 
 /* Exported Labels */
-#define	LABEL_seq_isr 	0x28f
 #define	LABEL_timer_isr	0x28b
+#define	LABEL_seq_isr 	0x28f
diff --git a/drivers/scsi/aic7xxx/aic79xx_reg_print.c_shipped b/drivers/scsi/aic7xxx/aic79xx_reg_print.c_shipped
index f5ea715d6ac3..2e0c58905b9e 100644
--- a/drivers/scsi/aic7xxx/aic79xx_reg_print.c_shipped
+++ b/drivers/scsi/aic7xxx/aic79xx_reg_print.c_shipped
@@ -234,6 +234,23 @@ ahd_selid_print(u_int regvalue, u_int *cur_col, u_int wrap)
 	    0x49, regvalue, cur_col, wrap));
 }
 
+static const ahd_reg_parse_entry_t SIMODE0_parse_table[] = {
+	{ "ENARBDO",		0x01, 0x01 },
+	{ "ENSPIORDY",		0x02, 0x02 },
+	{ "ENOVERRUN",		0x04, 0x04 },
+	{ "ENIOERR",		0x08, 0x08 },
+	{ "ENSELINGO",		0x10, 0x10 },
+	{ "ENSELDI",		0x20, 0x20 },
+	{ "ENSELDO",		0x40, 0x40 }
+};
+
+int
+ahd_simode0_print(u_int regvalue, u_int *cur_col, u_int wrap)
+{
+	return (ahd_print_register(SIMODE0_parse_table, 7, "SIMODE0",
+	    0x4b, regvalue, cur_col, wrap));
+}
+
 static const ahd_reg_parse_entry_t SSTAT0_parse_table[] = {
 	{ "ARBDO",		0x01, 0x01 },
 	{ "SPIORDY",		0x02, 0x02 },
@@ -252,23 +269,6 @@ ahd_sstat0_print(u_int regvalue, u_int *cur_col, u_int wrap)
 	    0x4b, regvalue, cur_col, wrap));
 }
 
-static const ahd_reg_parse_entry_t SIMODE0_parse_table[] = {
-	{ "ENARBDO",		0x01, 0x01 },
-	{ "ENSPIORDY",		0x02, 0x02 },
-	{ "ENOVERRUN",		0x04, 0x04 },
-	{ "ENIOERR",		0x08, 0x08 },
-	{ "ENSELINGO",		0x10, 0x10 },
-	{ "ENSELDI",		0x20, 0x20 },
-	{ "ENSELDO",		0x40, 0x40 }
-};
-
-int
-ahd_simode0_print(u_int regvalue, u_int *cur_col, u_int wrap)
-{
-	return (ahd_print_register(SIMODE0_parse_table, 7, "SIMODE0",
-	    0x4b, regvalue, cur_col, wrap));
-}
-
 static const ahd_reg_parse_entry_t SSTAT1_parse_table[] = {
 	{ "REQINIT",		0x01, 0x01 },
 	{ "STRB2FAST",		0x02, 0x02 },
diff --git a/drivers/scsi/aic7xxx/aic7xxx_reg.h_shipped b/drivers/scsi/aic7xxx/aic7xxx_reg.h_shipped
index e821082a4f47..473039df0ed5 100644
--- a/drivers/scsi/aic7xxx/aic7xxx_reg.h_shipped
+++ b/drivers/scsi/aic7xxx/aic7xxx_reg.h_shipped
@@ -244,8 +244,6 @@ ahc_reg_print_t ahc_scb_tag_print;
 
 #define	SCSIDATH        		0x07
 
-#define	STCNT           		0x08
-
 #define	OPTIONMODE      		0x08
 #define		OPTIONMODE_DEFAULTS	0x03
 #define		AUTORATEEN      	0x80
@@ -257,6 +255,8 @@ ahc_reg_print_t ahc_scb_tag_print;
 #define		AUTO_MSGOUT_DE  	0x02
 #define		DIS_MSGIN_DUALEDGE	0x01
 
+#define	STCNT           		0x08
+
 #define	TARGCRCCNT      		0x0a
 
 #define	CLRSINT0        		0x0b
@@ -365,8 +365,6 @@ ahc_reg_print_t ahc_scb_tag_print;
 #define		ALTSTIM         	0x20
 #define		DFLTTID         	0x10
 
-#define	TARGID          		0x1b
-
 #define	SPIOCAP         		0x1b
 #define		SOFT1           	0x80
 #define		SOFT0           	0x40
@@ -377,12 +375,14 @@ ahc_reg_print_t ahc_scb_tag_print;
 #define		ROM             	0x02
 #define		SSPIOCPS        	0x01
 
+#define	TARGID          		0x1b
+
 #define	BRDCTL          		0x1d
 #define		BRDDAT7         	0x80
 #define		BRDDAT6         	0x40
 #define		BRDDAT5         	0x20
-#define		BRDDAT4         	0x10
 #define		BRDSTB          	0x10
+#define		BRDDAT4         	0x10
 #define		BRDDAT3         	0x08
 #define		BRDCS           	0x08
 #define		BRDDAT2         	0x04
@@ -406,8 +406,8 @@ ahc_reg_print_t ahc_scb_tag_print;
 #define		DIAGLEDEN       	0x80
 #define		DIAGLEDON       	0x40
 #define		AUTOFLUSHDIS    	0x20
-#define		ENAB40          	0x08
 #define		SELBUSB         	0x08
+#define		ENAB40          	0x08
 #define		ENAB20          	0x04
 #define		SELWIDE         	0x02
 #define		XCVR            	0x01
@@ -730,8 +730,8 @@ ahc_reg_print_t ahc_scb_tag_print;
 #define	SCB_BASE        		0xa0
 
 #define	SCB_CDB_PTR     		0xa0
-#define	SCB_RESIDUAL_DATACNT		0xa0
 #define	SCB_CDB_STORE   		0xa0
+#define	SCB_RESIDUAL_DATACNT		0xa0
 
 #define	SCB_RESIDUAL_SGPTR		0xa4
 
@@ -756,8 +756,8 @@ ahc_reg_print_t ahc_scb_tag_print;
 
 #define	SCB_CONTROL     		0xb8
 #define		SCB_TAG_TYPE    	0x03
-#define		STATUS_RCVD     	0x80
 #define		TARGET_SCB      	0x80
+#define		STATUS_RCVD     	0x80
 #define		DISCENB         	0x40
 #define		TAG_ENB         	0x20
 #define		MK_MESSAGE      	0x10
@@ -872,40 +872,40 @@ ahc_reg_print_t ahc_scb_tag_print;
 #define	SG_CACHE_PRE    		0xfc
 
 
+#define	TARGET_CMD_CMPLT	0xfe
 #define	MAX_OFFSET_ULTRA2	0x7f
 #define	MAX_OFFSET_16BIT	0x08
 #define	BUS_8_BIT	0x00
-#define	TARGET_CMD_CMPLT	0xfe
+#define	TID_SHIFT	0x04
 #define	STATUS_QUEUE_FULL	0x28
 #define	STATUS_BUSY	0x08
-#define	MAX_OFFSET_8BIT	0x0f
-#define	BUS_32_BIT	0x02
-#define	CCSGADDR_MAX	0x80
-#define	TID_SHIFT	0x04
 #define	SCB_DOWNLOAD_SIZE_64	0x30
+#define	MAX_OFFSET_8BIT	0x0f
 #define	HOST_MAILBOX_SHIFT	0x04
-#define	CMD_GROUP_CODE_SHIFT	0x05
-#define	CCSGRAM_MAXSEGS	0x10
-#define	SCB_LIST_NULL	0xff
+#define	CCSGADDR_MAX	0x80
+#define	BUS_32_BIT	0x02
 #define	SG_SIZEOF	0x08
-#define	SCB_DOWNLOAD_SIZE	0x20
 #define	SEQ_MAILBOX_SHIFT	0x00
+#define	SCB_LIST_NULL	0xff
+#define	SCB_DOWNLOAD_SIZE	0x20
+#define	CMD_GROUP_CODE_SHIFT	0x05
+#define	CCSGRAM_MAXSEGS	0x10
 #define	TARGET_DATA_IN	0x01
-#define	HOST_MSG	0xff
+#define	STACK_SIZE	0x04
+#define	SCB_UPLOAD_SIZE	0x20
 #define	MAX_OFFSET	0x7f
+#define	HOST_MSG	0xff
 #define	BUS_16_BIT	0x01
-#define	SCB_UPLOAD_SIZE	0x20
-#define	STACK_SIZE	0x04
 
 
 /* Downloaded Constant Definitions */
 #define	INVERTED_CACHESIZE_MASK	0x03
-#define	SG_PREFETCH_ADDR_MASK	0x06
 #define	SG_PREFETCH_ALIGN_MASK	0x05
+#define	SG_PREFETCH_ADDR_MASK	0x06
 #define	QOUTFIFO_OFFSET	0x00
 #define	SG_PREFETCH_CNT	0x04
-#define	CACHESIZE_MASK	0x02
 #define	QINFIFO_OFFSET	0x01
+#define	CACHESIZE_MASK	0x02
 #define	DOWNLOAD_CONST_COUNT	0x07
 
 
-- 
2.11.0

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

* [PATCH v2 5/5] aic7[9x]xx: printk() lines unbroken
  2017-08-03 23:28 [PATCH v2 0/4] aic7xxx: fix debugging printks Michał Mirosław
                   ` (3 preceding siblings ...)
  2017-08-03 23:28 ` [PATCH v2 4/5] aic7xxx: regenerate firmware files Michał Mirosław
@ 2017-08-03 23:28 ` Michał Mirosław
  2017-08-08  1:43 ` [PATCH v2 0/4] aic7xxx: fix debugging printks Martin K. Petersen
  5 siblings, 0 replies; 13+ messages in thread
From: Michał Mirosław @ 2017-08-03 23:28 UTC (permalink / raw)
  To: Hannes Reinecke, James E.J. Bottomley, Martin K. Petersen; +Cc: linux-scsi

Current code is not SMP-friendly and since now each printk() call
generates a separate line in the log, the output is mostly unreadable.
Make it better formatted.

Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
---
 drivers/scsi/Kconfig                             |   3 +-
 drivers/scsi/aic7xxx/Kconfig                     |   6 +
 drivers/scsi/aic7xxx/Kconfig.aic79xx             |   1 +
 drivers/scsi/aic7xxx/Kconfig.aic7xxx             |   1 +
 drivers/scsi/aic7xxx/Makefile                    |   1 +
 drivers/scsi/aic7xxx/aic79xx.h                   |   7 -
 drivers/scsi/aic7xxx/aic79xx_core.c              | 242 +++++-------
 drivers/scsi/aic7xxx/aic79xx_reg.h_shipped       | 307 +++++++--------
 drivers/scsi/aic7xxx/aic79xx_reg_print.c_shipped | 480 +++++++++++------------
 drivers/scsi/aic7xxx/aic7xxx.h                   |   7 -
 drivers/scsi/aic7xxx/aic7xxx_core.c              | 181 ++++-----
 drivers/scsi/aic7xxx/aic7xxx_reg.h_shipped       | 157 ++++----
 drivers/scsi/aic7xxx/aic7xxx_reg_print.c_shipped | 242 ++++++------
 drivers/scsi/aic7xxx/aicasm/aicasm_symbol.c      |  39 +-
 drivers/scsi/aic7xxx/aiclib.c                    | 103 +++--
 drivers/scsi/aic7xxx/aiclib.h                    |  32 ++
 16 files changed, 871 insertions(+), 938 deletions(-)

diff --git a/drivers/scsi/Kconfig b/drivers/scsi/Kconfig
index f4538d7a3016..b76939b77319 100644
--- a/drivers/scsi/Kconfig
+++ b/drivers/scsi/Kconfig
@@ -452,8 +452,7 @@ config SCSI_AACRAID
 	  will be called aacraid.
 
 
-source "drivers/scsi/aic7xxx/Kconfig.aic7xxx"
-source "drivers/scsi/aic7xxx/Kconfig.aic79xx"
+source "drivers/scsi/aic7xxx/Kconfig"
 source "drivers/scsi/aic94xx/Kconfig"
 source "drivers/scsi/hisi_sas/Kconfig"
 source "drivers/scsi/mvsas/Kconfig"
diff --git a/drivers/scsi/aic7xxx/Kconfig b/drivers/scsi/aic7xxx/Kconfig
new file mode 100644
index 000000000000..aeae1ba88281
--- /dev/null
+++ b/drivers/scsi/aic7xxx/Kconfig
@@ -0,0 +1,6 @@
+config SCSI_AICLIB
+	tristate
+	default n
+
+source "drivers/scsi/aic7xxx/Kconfig.aic7xxx"
+source "drivers/scsi/aic7xxx/Kconfig.aic79xx"
diff --git a/drivers/scsi/aic7xxx/Kconfig.aic79xx b/drivers/scsi/aic7xxx/Kconfig.aic79xx
index 3b3d599103f8..7cf29839bc54 100644
--- a/drivers/scsi/aic7xxx/Kconfig.aic79xx
+++ b/drivers/scsi/aic7xxx/Kconfig.aic79xx
@@ -6,6 +6,7 @@ config SCSI_AIC79XX
 	tristate "Adaptec AIC79xx U320 support"
 	depends on PCI && SCSI
 	select SCSI_SPI_ATTRS
+	select SCSI_AICLIB
 	help
 	This driver supports all of Adaptec's Ultra 320 PCI-X
 	based SCSI controllers.
diff --git a/drivers/scsi/aic7xxx/Kconfig.aic7xxx b/drivers/scsi/aic7xxx/Kconfig.aic7xxx
index 55ac55ee6068..0d6cea939551 100644
--- a/drivers/scsi/aic7xxx/Kconfig.aic7xxx
+++ b/drivers/scsi/aic7xxx/Kconfig.aic7xxx
@@ -6,6 +6,7 @@ config SCSI_AIC7XXX
 	tristate "Adaptec AIC7xxx Fast -> U160 support (New Driver)"
 	depends on (PCI || EISA) && SCSI
 	select SCSI_SPI_ATTRS
+	select SCSI_AICLIB
 	---help---
 	This driver supports all of Adaptec's Fast through Ultra 160 PCI
 	based SCSI controllers as well as the aic7770 based EISA and VLB
diff --git a/drivers/scsi/aic7xxx/Makefile b/drivers/scsi/aic7xxx/Makefile
index 1a5509d40f8a..3e7565a9d37a 100644
--- a/drivers/scsi/aic7xxx/Makefile
+++ b/drivers/scsi/aic7xxx/Makefile
@@ -7,6 +7,7 @@
 # Let kbuild descend into aicasm when cleaning
 subdir-				+= aicasm
 
+obj-$(CONFIG_SCSI_AICLIB)	+= aiclib.o
 obj-$(CONFIG_SCSI_AIC7XXX)	+= aic7xxx.o
 obj-$(CONFIG_SCSI_AIC79XX)	+= aic79xx.o
 
diff --git a/drivers/scsi/aic7xxx/aic79xx.h b/drivers/scsi/aic7xxx/aic79xx.h
index d47b527b25dd..f81287db98bb 100644
--- a/drivers/scsi/aic7xxx/aic79xx.h
+++ b/drivers/scsi/aic7xxx/aic79xx.h
@@ -1468,11 +1468,4 @@ extern uint32_t ahd_debug;
 void			ahd_print_devinfo(struct ahd_softc *ahd,
 					  struct ahd_devinfo *devinfo);
 void			ahd_dump_card_state(struct ahd_softc *ahd);
-int			ahd_print_register(const ahd_reg_parse_entry_t *table,
-					   u_int num_entries,
-					   const char *name,
-					   u_int address,
-					   u_int value,
-					   u_int *cur_column,
-					   u_int wrap_point);
 #endif /* _AIC79XX_H_ */
diff --git a/drivers/scsi/aic7xxx/aic79xx_core.c b/drivers/scsi/aic7xxx/aic79xx_core.c
index 95d8f25cbcca..b895c43e9a5d 100644
--- a/drivers/scsi/aic7xxx/aic79xx_core.c
+++ b/drivers/scsi/aic7xxx/aic79xx_core.c
@@ -2672,6 +2672,7 @@ ahd_handle_scsiint(struct ahd_softc *ahd, u_int intstat)
 static void
 ahd_handle_transmission_error(struct ahd_softc *ahd)
 {
+	struct aic_dump_buffer buf;
 	struct	scb *scb;
 	u_int	scbid;
 	u_int	lqistat1;
@@ -2680,7 +2681,6 @@ ahd_handle_transmission_error(struct ahd_softc *ahd)
 	u_int	curphase;
 	u_int	lastphase;
 	u_int	perrdiag;
-	u_int	cur_col;
 	int	silent;
 
 	scb = NULL;
@@ -2727,14 +2727,14 @@ ahd_handle_transmission_error(struct ahd_softc *ahd)
 			silent = TRUE;
 	}
 
-	cur_col = 0;
+	aic_printbuf_init(&buf, 60);
 	if (silent == FALSE) {
 		printk("%s: Transmission error detected\n", ahd_name(ahd));
-		ahd_lqistat1_print(lqistat1, &cur_col, 50);
-		ahd_lastphase_print(lastphase, &cur_col, 50);
-		ahd_scsisigi_print(curphase, &cur_col, 50);
-		ahd_perrdiag_print(perrdiag, &cur_col, 50);
-		printk("\n");
+		ahd_lqistat1_print(lqistat1, &buf);
+		ahd_lastphase_print(lastphase, &buf);
+		ahd_scsisigi_print(curphase, &buf);
+		ahd_perrdiag_print(perrdiag, &buf);
+		aic_printbuf_finish(&buf);
 		ahd_dump_card_state(ahd);
 	}
 
@@ -9677,64 +9677,16 @@ ahd_probe_stack_size(struct ahd_softc *ahd)
 	return (last_probe);
 }
 
-int
-ahd_print_register(const ahd_reg_parse_entry_t *table, u_int num_entries,
-		   const char *name, u_int address, u_int value,
-		   u_int *cur_column, u_int wrap_point)
-{
-	int	printed;
-	u_int	printed_mask;
-
-	if (cur_column != NULL && *cur_column >= wrap_point) {
-		printk("\n");
-		*cur_column = 0;
-	}
-	printed = printk("%s[0x%x]", name, value);
-	if (table == NULL) {
-		printed += printk(" ");
-		*cur_column += printed;
-		return (printed);
-	}
-	printed_mask = 0;
-	while (printed_mask != 0xFF) {
-		int entry;
-
-		for (entry = 0; entry < num_entries; entry++) {
-			if (((value & table[entry].mask)
-			  != table[entry].value)
-			 || ((printed_mask & table[entry].mask)
-			  == table[entry].mask))
-				continue;
-
-			printed += printk("%s%s",
-					  printed_mask == 0 ? ":(" : "|",
-					  table[entry].name);
-			printed_mask |= table[entry].mask;
-			
-			break;
-		}
-		if (entry >= num_entries)
-			break;
-	}
-	if (printed_mask != 0)
-		printed += printk(") ");
-	else
-		printed += printk(" ");
-	if (cur_column != NULL)
-		*cur_column += printed;
-	return (printed);
-}
-
 void
 ahd_dump_card_state(struct ahd_softc *ahd)
 {
+	struct aic_dump_buffer buf;
 	struct scb	*scb;
 	ahd_mode_state	 saved_modes;
 	u_int		 dffstat;
 	int		 paused;
 	u_int		 scb_index;
 	u_int		 saved_scb_index;
-	u_int		 cur_col;
 	int		 i;
 
 	if (ahd_is_paused(ahd)) {
@@ -9760,78 +9712,75 @@ ahd_dump_card_state(struct ahd_softc *ahd)
 	/*
 	 * Mode independent registers.
 	 */
-	cur_col = 0;
-	ahd_intstat_print(ahd_inb(ahd, INTSTAT), &cur_col, 50);
-	ahd_seloid_print(ahd_inb(ahd, SELOID), &cur_col, 50);
-	ahd_selid_print(ahd_inb(ahd, SELID), &cur_col, 50);
-	ahd_hs_mailbox_print(ahd_inb(ahd, LOCAL_HS_MAILBOX), &cur_col, 50);
-	ahd_intctl_print(ahd_inb(ahd, INTCTL), &cur_col, 50);
-	ahd_seqintstat_print(ahd_inb(ahd, SEQINTSTAT), &cur_col, 50);
-	ahd_saved_mode_print(ahd_inb(ahd, SAVED_MODE), &cur_col, 50);
-	ahd_dffstat_print(ahd_inb(ahd, DFFSTAT), &cur_col, 50);
-	ahd_scsisigi_print(ahd_inb(ahd, SCSISIGI), &cur_col, 50);
-	ahd_scsiphase_print(ahd_inb(ahd, SCSIPHASE), &cur_col, 50);
-	ahd_scsibus_print(ahd_inb(ahd, SCSIBUS), &cur_col, 50);
-	ahd_lastphase_print(ahd_inb(ahd, LASTPHASE), &cur_col, 50);
-	ahd_scsiseq0_print(ahd_inb(ahd, SCSISEQ0), &cur_col, 50);
-	ahd_scsiseq1_print(ahd_inb(ahd, SCSISEQ1), &cur_col, 50);
-	ahd_seqctl0_print(ahd_inb(ahd, SEQCTL0), &cur_col, 50);
-	ahd_seqintctl_print(ahd_inb(ahd, SEQINTCTL), &cur_col, 50);
-	ahd_seq_flags_print(ahd_inb(ahd, SEQ_FLAGS), &cur_col, 50);
-	ahd_seq_flags2_print(ahd_inb(ahd, SEQ_FLAGS2), &cur_col, 50);
-	ahd_qfreeze_count_print(ahd_inw(ahd, QFREEZE_COUNT), &cur_col, 50);
+	aic_printbuf_init(&buf, 60);
+	ahd_intstat_print(ahd_inb(ahd, INTSTAT), &buf);
+	ahd_seloid_print(ahd_inb(ahd, SELOID), &buf);
+	ahd_selid_print(ahd_inb(ahd, SELID), &buf);
+	ahd_hs_mailbox_print(ahd_inb(ahd, LOCAL_HS_MAILBOX), &buf);
+	ahd_intctl_print(ahd_inb(ahd, INTCTL), &buf);
+	ahd_seqintstat_print(ahd_inb(ahd, SEQINTSTAT), &buf);
+	ahd_saved_mode_print(ahd_inb(ahd, SAVED_MODE), &buf);
+	ahd_dffstat_print(ahd_inb(ahd, DFFSTAT), &buf);
+	ahd_scsisigi_print(ahd_inb(ahd, SCSISIGI), &buf);
+	ahd_scsiphase_print(ahd_inb(ahd, SCSIPHASE), &buf);
+	ahd_scsibus_print(ahd_inb(ahd, SCSIBUS), &buf);
+	ahd_lastphase_print(ahd_inb(ahd, LASTPHASE), &buf);
+	ahd_scsiseq0_print(ahd_inb(ahd, SCSISEQ0), &buf);
+	ahd_scsiseq1_print(ahd_inb(ahd, SCSISEQ1), &buf);
+	ahd_seqctl0_print(ahd_inb(ahd, SEQCTL0), &buf);
+	ahd_seqintctl_print(ahd_inb(ahd, SEQINTCTL), &buf);
+	ahd_seq_flags_print(ahd_inb(ahd, SEQ_FLAGS), &buf);
+	ahd_seq_flags2_print(ahd_inb(ahd, SEQ_FLAGS2), &buf);
+	ahd_qfreeze_count_print(ahd_inw(ahd, QFREEZE_COUNT), &buf);
 	ahd_kernel_qfreeze_count_print(ahd_inw(ahd, KERNEL_QFREEZE_COUNT),
-				       &cur_col, 50);
-	ahd_mk_message_scb_print(ahd_inw(ahd, MK_MESSAGE_SCB), &cur_col, 50);
-	ahd_mk_message_scsiid_print(ahd_inb(ahd, MK_MESSAGE_SCSIID),
-				    &cur_col, 50);
-	ahd_sstat0_print(ahd_inb(ahd, SSTAT0), &cur_col, 50);
-	ahd_sstat1_print(ahd_inb(ahd, SSTAT1), &cur_col, 50);
-	ahd_sstat2_print(ahd_inb(ahd, SSTAT2), &cur_col, 50);
-	ahd_sstat3_print(ahd_inb(ahd, SSTAT3), &cur_col, 50);
-	ahd_perrdiag_print(ahd_inb(ahd, PERRDIAG), &cur_col, 50);
-	ahd_simode1_print(ahd_inb(ahd, SIMODE1), &cur_col, 50);
-	ahd_lqistat0_print(ahd_inb(ahd, LQISTAT0), &cur_col, 50);
-	ahd_lqistat1_print(ahd_inb(ahd, LQISTAT1), &cur_col, 50);
-	ahd_lqistat2_print(ahd_inb(ahd, LQISTAT2), &cur_col, 50);
-	ahd_lqostat0_print(ahd_inb(ahd, LQOSTAT0), &cur_col, 50);
-	ahd_lqostat1_print(ahd_inb(ahd, LQOSTAT1), &cur_col, 50);
-	ahd_lqostat2_print(ahd_inb(ahd, LQOSTAT2), &cur_col, 50);
-	printk("\n");
+				       &buf);
+	ahd_mk_message_scb_print(ahd_inw(ahd, MK_MESSAGE_SCB), &buf);
+	ahd_mk_message_scsiid_print(ahd_inb(ahd, MK_MESSAGE_SCSIID), &buf);
+	ahd_sstat0_print(ahd_inb(ahd, SSTAT0), &buf);
+	ahd_sstat1_print(ahd_inb(ahd, SSTAT1), &buf);
+	ahd_sstat2_print(ahd_inb(ahd, SSTAT2), &buf);
+	ahd_sstat3_print(ahd_inb(ahd, SSTAT3), &buf);
+	ahd_perrdiag_print(ahd_inb(ahd, PERRDIAG), &buf);
+	ahd_simode1_print(ahd_inb(ahd, SIMODE1), &buf);
+	ahd_lqistat0_print(ahd_inb(ahd, LQISTAT0), &buf);
+	ahd_lqistat1_print(ahd_inb(ahd, LQISTAT1), &buf);
+	ahd_lqistat2_print(ahd_inb(ahd, LQISTAT2), &buf);
+	ahd_lqostat0_print(ahd_inb(ahd, LQOSTAT0), &buf);
+	ahd_lqostat1_print(ahd_inb(ahd, LQOSTAT1), &buf);
+	ahd_lqostat2_print(ahd_inb(ahd, LQOSTAT2), &buf);
+	aic_printbuf_finish(&buf);
 	printk("\nSCB Count = %d CMDS_PENDING = %d LASTSCB 0x%x "
 	       "CURRSCB 0x%x NEXTSCB 0x%x\n",
 	       ahd->scb_data.numscbs, ahd_inw(ahd, CMDS_PENDING),
 	       ahd_inw(ahd, LASTSCB), ahd_inw(ahd, CURRSCB),
 	       ahd_inw(ahd, NEXTSCB));
-	cur_col = 0;
 	/* QINFIFO */
 	ahd_search_qinfifo(ahd, CAM_TARGET_WILDCARD, ALL_CHANNELS,
 			   CAM_LUN_WILDCARD, SCB_LIST_NULL,
 			   ROLE_UNKNOWN, /*status*/0, SEARCH_PRINT);
 	saved_scb_index = ahd_get_scbptr(ahd);
-	printk("Pending list:");
+	printk("Pending list:\n");
 	i = 0;
 	LIST_FOREACH(scb, &ahd->pending_scbs, pending_links) {
 		if (i++ > AHD_SCB_MAX)
 			break;
-		cur_col = printk("\n%3d FIFO_USE[0x%x] ", SCB_GET_TAG(scb),
-				 ahd_inb_scbram(ahd, SCB_FIFO_USE_COUNT));
+		aic_printbuf_push(&buf, "%3d FIFO_USE[0x%x] ", SCB_GET_TAG(scb),
+				  ahd_inb_scbram(ahd, SCB_FIFO_USE_COUNT));
 		ahd_set_scbptr(ahd, SCB_GET_TAG(scb));
-		ahd_scb_control_print(ahd_inb_scbram(ahd, SCB_CONTROL),
-				      &cur_col, 60);
-		ahd_scb_scsiid_print(ahd_inb_scbram(ahd, SCB_SCSIID),
-				     &cur_col, 60);
+		ahd_scb_control_print(ahd_inb_scbram(ahd, SCB_CONTROL), &buf);
+		ahd_scb_scsiid_print(ahd_inb_scbram(ahd, SCB_SCSIID), &buf);
+		aic_printbuf_finish(&buf);
 	}
-	printk("\nTotal %d\n", i);
+	printk("Total %d\n", i);
 
-	printk("Kernel Free SCB list: ");
+	aic_printbuf_push(&buf, "Kernel Free SCB list: ");
 	i = 0;
 	TAILQ_FOREACH(scb, &ahd->scb_data.free_scbs, links.tqe) {
 		struct scb *list_scb;
 
 		list_scb = scb;
 		do {
-			printk("%d ", SCB_GET_TAG(list_scb));
+			aic_printbuf_push(&buf, "%d ", SCB_GET_TAG(list_scb));
 			list_scb = LIST_NEXT(list_scb, collision_links);
 		} while (list_scb && i++ < AHD_SCB_MAX);
 	}
@@ -9839,49 +9788,49 @@ ahd_dump_card_state(struct ahd_softc *ahd)
 	LIST_FOREACH(scb, &ahd->scb_data.any_dev_free_scb_list, links.le) {
 		if (i++ > AHD_SCB_MAX)
 			break;
-		printk("%d ", SCB_GET_TAG(scb));
+		aic_printbuf_push(&buf, "%d ", SCB_GET_TAG(scb));
 	}
-	printk("\n");
+	aic_printbuf_finish(&buf);
 
-	printk("Sequencer Complete DMA-inprog list: ");
+	aic_printbuf_push(&buf, "Sequencer Complete DMA-inprog list: ");
 	scb_index = ahd_inw(ahd, COMPLETE_SCB_DMAINPROG_HEAD);
 	i = 0;
 	while (!SCBID_IS_NULL(scb_index) && i++ < AHD_SCB_MAX) {
 		ahd_set_scbptr(ahd, scb_index);
-		printk("%d ", scb_index);
+		aic_printbuf_push(&buf, "%d ", scb_index);
 		scb_index = ahd_inw_scbram(ahd, SCB_NEXT_COMPLETE);
 	}
-	printk("\n");
+	aic_printbuf_finish(&buf);
 
-	printk("Sequencer Complete list: ");
+	aic_printbuf_push(&buf, "Sequencer Complete list: ");
 	scb_index = ahd_inw(ahd, COMPLETE_SCB_HEAD);
 	i = 0;
 	while (!SCBID_IS_NULL(scb_index) && i++ < AHD_SCB_MAX) {
 		ahd_set_scbptr(ahd, scb_index);
-		printk("%d ", scb_index);
+		aic_printbuf_push(&buf, "%d ", scb_index);
 		scb_index = ahd_inw_scbram(ahd, SCB_NEXT_COMPLETE);
 	}
-	printk("\n");
+	aic_printbuf_finish(&buf);
 
 	
-	printk("Sequencer DMA-Up and Complete list: ");
+	aic_printbuf_push(&buf, "Sequencer DMA-Up and Complete list: ");
 	scb_index = ahd_inw(ahd, COMPLETE_DMA_SCB_HEAD);
 	i = 0;
 	while (!SCBID_IS_NULL(scb_index) && i++ < AHD_SCB_MAX) {
 		ahd_set_scbptr(ahd, scb_index);
-		printk("%d ", scb_index);
+		aic_printbuf_push(&buf, "%d ", scb_index);
 		scb_index = ahd_inw_scbram(ahd, SCB_NEXT_COMPLETE);
 	}
-	printk("\n");
-	printk("Sequencer On QFreeze and Complete list: ");
+	aic_printbuf_finish(&buf);
+	aic_printbuf_push(&buf, "Sequencer On QFreeze and Complete list: ");
 	scb_index = ahd_inw(ahd, COMPLETE_ON_QFREEZE_HEAD);
 	i = 0;
 	while (!SCBID_IS_NULL(scb_index) && i++ < AHD_SCB_MAX) {
 		ahd_set_scbptr(ahd, scb_index);
-		printk("%d ", scb_index);
+		aic_printbuf_push(&buf, "%d ", scb_index);
 		scb_index = ahd_inw_scbram(ahd, SCB_NEXT_COMPLETE);
 	}
-	printk("\n");
+	aic_printbuf_finish(&buf);
 	ahd_set_scbptr(ahd, saved_scb_index);
 	dffstat = ahd_inb(ahd, DFFSTAT);
 	for (i = 0; i < 2; i++) {
@@ -9896,38 +9845,29 @@ ahd_dump_card_state(struct ahd_softc *ahd)
 		       ahd_name(ahd), i,
 		       (dffstat & (FIFO0FREE << i)) ? "Free" : "Active",
 		       ahd_inw(ahd, LONGJMP_ADDR), fifo_scbptr);
-		cur_col = 0;
-		ahd_seqimode_print(ahd_inb(ahd, SEQIMODE), &cur_col, 50);
-		ahd_seqintsrc_print(ahd_inb(ahd, SEQINTSRC), &cur_col, 50);
-		ahd_dfcntrl_print(ahd_inb(ahd, DFCNTRL), &cur_col, 50);
-		ahd_dfstatus_print(ahd_inb(ahd, DFSTATUS), &cur_col, 50);
-		ahd_sg_cache_shadow_print(ahd_inb(ahd, SG_CACHE_SHADOW),
-					  &cur_col, 50);
-		ahd_sg_state_print(ahd_inb(ahd, SG_STATE), &cur_col, 50);
-		ahd_dffsxfrctl_print(ahd_inb(ahd, DFFSXFRCTL), &cur_col, 50);
-		ahd_soffcnt_print(ahd_inb(ahd, SOFFCNT), &cur_col, 50);
-		ahd_mdffstat_print(ahd_inb(ahd, MDFFSTAT), &cur_col, 50);
-		if (cur_col > 50) {
-			printk("\n");
-			cur_col = 0;
-		}
-		cur_col += printk("SHADDR = 0x%x%x, SHCNT = 0x%x ",
+		ahd_seqimode_print(ahd_inb(ahd, SEQIMODE), &buf);
+		ahd_seqintsrc_print(ahd_inb(ahd, SEQINTSRC), &buf);
+		ahd_dfcntrl_print(ahd_inb(ahd, DFCNTRL), &buf);
+		ahd_dfstatus_print(ahd_inb(ahd, DFSTATUS), &buf);
+		ahd_sg_cache_shadow_print(ahd_inb(ahd, SG_CACHE_SHADOW), &buf);
+		ahd_sg_state_print(ahd_inb(ahd, SG_STATE), &buf);
+		ahd_dffsxfrctl_print(ahd_inb(ahd, DFFSXFRCTL), &buf);
+		ahd_soffcnt_print(ahd_inb(ahd, SOFFCNT), &buf);
+		ahd_mdffstat_print(ahd_inb(ahd, MDFFSTAT), &buf);
+		aic_printbuf_push(&buf, "SHADDR = 0x%x%x, SHCNT = 0x%x ",
 				  ahd_inl(ahd, SHADDR+4),
 				  ahd_inl(ahd, SHADDR),
 				  (ahd_inb(ahd, SHCNT)
 				| (ahd_inb(ahd, SHCNT + 1) << 8)
 				| (ahd_inb(ahd, SHCNT + 2) << 16)));
-		if (cur_col > 50) {
-			printk("\n");
-			cur_col = 0;
-		}
-		cur_col += printk("HADDR = 0x%x%x, HCNT = 0x%x ",
+		aic_printbuf_push(&buf, "HADDR = 0x%x%x, HCNT = 0x%x ",
 				  ahd_inl(ahd, HADDR+4),
 				  ahd_inl(ahd, HADDR),
 				  (ahd_inb(ahd, HCNT)
 				| (ahd_inb(ahd, HCNT + 1) << 8)
 				| (ahd_inb(ahd, HCNT + 2) << 16)));
-		ahd_ccsgctl_print(ahd_inb(ahd, CCSGCTL), &cur_col, 50);
+		ahd_ccsgctl_print(ahd_inb(ahd, CCSGCTL), &buf);
+		aic_printbuf_finish(&buf);
 #ifdef AHD_DEBUG
 		if ((ahd_debug & AHD_SHOW_SG) != 0) {
 			fifo_scb = ahd_lookup_scb(ahd, fifo_scbptr);
@@ -9936,10 +9876,10 @@ ahd_dump_card_state(struct ahd_softc *ahd)
 		}
 #endif
 	}
-	printk("\nLQIN: ");
+	aic_printbuf_push(&buf, "\nLQIN: ");
 	for (i = 0; i < 20; i++)
-		printk("0x%x ", ahd_inb(ahd, LQIN + i));
-	printk("\n");
+		aic_printbuf_push(&buf, "0x%x ", ahd_inb(ahd, LQIN + i));
+	aic_printbuf_finish(&buf);
 	ahd_set_modes(ahd, AHD_MODE_CFG, AHD_MODE_CFG);
 	printk("%s: LQISTATE = 0x%x, LQOSTATE = 0x%x, OPTIONMODE = 0x%x\n",
 	       ahd_name(ahd), ahd_inb(ahd, LQISTATE), ahd_inb(ahd, LQOSTATE),
@@ -9950,12 +9890,11 @@ ahd_dump_card_state(struct ahd_softc *ahd)
 	printk("%s: SAVED_SCSIID = 0x%x SAVED_LUN = 0x%x\n",
 	       ahd_name(ahd), ahd_inb(ahd, SAVED_SCSIID),
 	       ahd_inb(ahd, SAVED_LUN));
-	ahd_simode0_print(ahd_inb(ahd, SIMODE0), &cur_col, 50);
-	printk("\n");
+	ahd_simode0_print(ahd_inb(ahd, SIMODE0), &buf);
+	aic_printbuf_finish(&buf);
 	ahd_set_modes(ahd, AHD_MODE_CCHAN, AHD_MODE_CCHAN);
-	cur_col = 0;
-	ahd_ccscbctl_print(ahd_inb(ahd, CCSCBCTL), &cur_col, 50);
-	printk("\n");
+	ahd_ccscbctl_print(ahd_inb(ahd, CCSCBCTL), &buf);
+	aic_printbuf_finish(&buf);
 	ahd_set_modes(ahd, ahd->saved_src_mode, ahd->saved_dst_mode);
 	printk("%s: REG0 == 0x%x, SINDEX = 0x%x, DINDEX = 0x%x\n",
 	       ahd_name(ahd), ahd_inw(ahd, REG0), ahd_inw(ahd, SINDEX),
@@ -9971,17 +9910,18 @@ ahd_dump_card_state(struct ahd_softc *ahd)
 	       ahd_inb_scbram(ahd, SCB_CDB_STORE+3),
 	       ahd_inb_scbram(ahd, SCB_CDB_STORE+4),
 	       ahd_inb_scbram(ahd, SCB_CDB_STORE+5));
-	printk("STACK:");
+	aic_printbuf_push(&buf, "STACK:");
 	for (i = 0; i < ahd->stack_size; i++) {
 		ahd->saved_stack[i] =
 		    ahd_inb(ahd, STACK)|(ahd_inb(ahd, STACK) << 8);
-		printk(" 0x%x", ahd->saved_stack[i]);
+		aic_printbuf_push(&buf, " 0x%x", ahd->saved_stack[i]);
 	}
 	for (i = ahd->stack_size-1; i >= 0; i--) {
 		ahd_outb(ahd, STACK, ahd->saved_stack[i] & 0xFF);
 		ahd_outb(ahd, STACK, (ahd->saved_stack[i] >> 8) & 0xFF);
 	}
-	printk("\n<<<<<<<<<<<<<<<<< Dump Card State Ends >>>>>>>>>>>>>>>>>>\n");
+	aic_printbuf_finish(&buf);
+	printk("<<<<<<<<<<<<<<<<< Dump Card State Ends >>>>>>>>>>>>>>>>>>\n");
 	ahd_restore_modes(ahd, saved_modes);
 	if (paused == 0)
 		ahd_unpause(ahd);
diff --git a/drivers/scsi/aic7xxx/aic79xx_reg.h_shipped b/drivers/scsi/aic7xxx/aic79xx_reg.h_shipped
index ddcd5a7701ac..fef0196f0986 100644
--- a/drivers/scsi/aic7xxx/aic79xx_reg.h_shipped
+++ b/drivers/scsi/aic7xxx/aic79xx_reg.h_shipped
@@ -5,361 +5,354 @@
  * $Id: //depot/aic7xxx/aic7xxx/aic79xx.seq#120 $
  * $Id: //depot/aic7xxx/aic7xxx/aic79xx.reg#77 $
  */
-typedef int (ahd_reg_print_t)(u_int, u_int *, u_int);
-typedef struct ahd_reg_parse_entry {
-	char	*name;
-	uint8_t	 value;
-	uint8_t	 mask;
-} ahd_reg_parse_entry_t;
-
 #if AIC_DEBUG_REGISTERS
-ahd_reg_print_t ahd_intstat_print;
+aic_reg_print_t ahd_intstat_print;
 #else
-#define ahd_intstat_print(regvalue, cur_col, wrap) \
-    ahd_print_register(NULL, 0, "INTSTAT", 0x01, regvalue, cur_col, wrap)
+#define ahd_intstat_print(regvalue, buf) \
+    aic_print_register(NULL, 0, "INTSTAT", 0x01, regvalue, buf)
 #endif
 
 #if AIC_DEBUG_REGISTERS
-ahd_reg_print_t ahd_hs_mailbox_print;
+aic_reg_print_t ahd_hs_mailbox_print;
 #else
-#define ahd_hs_mailbox_print(regvalue, cur_col, wrap) \
-    ahd_print_register(NULL, 0, "HS_MAILBOX", 0x0b, regvalue, cur_col, wrap)
+#define ahd_hs_mailbox_print(regvalue, buf) \
+    aic_print_register(NULL, 0, "HS_MAILBOX", 0x0b, regvalue, buf)
 #endif
 
 #if AIC_DEBUG_REGISTERS
-ahd_reg_print_t ahd_seqintstat_print;
+aic_reg_print_t ahd_seqintstat_print;
 #else
-#define ahd_seqintstat_print(regvalue, cur_col, wrap) \
-    ahd_print_register(NULL, 0, "SEQINTSTAT", 0x0c, regvalue, cur_col, wrap)
+#define ahd_seqintstat_print(regvalue, buf) \
+    aic_print_register(NULL, 0, "SEQINTSTAT", 0x0c, regvalue, buf)
 #endif
 
 #if AIC_DEBUG_REGISTERS
-ahd_reg_print_t ahd_intctl_print;
+aic_reg_print_t ahd_intctl_print;
 #else
-#define ahd_intctl_print(regvalue, cur_col, wrap) \
-    ahd_print_register(NULL, 0, "INTCTL", 0x18, regvalue, cur_col, wrap)
+#define ahd_intctl_print(regvalue, buf) \
+    aic_print_register(NULL, 0, "INTCTL", 0x18, regvalue, buf)
 #endif
 
 #if AIC_DEBUG_REGISTERS
-ahd_reg_print_t ahd_dfcntrl_print;
+aic_reg_print_t ahd_dfcntrl_print;
 #else
-#define ahd_dfcntrl_print(regvalue, cur_col, wrap) \
-    ahd_print_register(NULL, 0, "DFCNTRL", 0x19, regvalue, cur_col, wrap)
+#define ahd_dfcntrl_print(regvalue, buf) \
+    aic_print_register(NULL, 0, "DFCNTRL", 0x19, regvalue, buf)
 #endif
 
 #if AIC_DEBUG_REGISTERS
-ahd_reg_print_t ahd_dfstatus_print;
+aic_reg_print_t ahd_dfstatus_print;
 #else
-#define ahd_dfstatus_print(regvalue, cur_col, wrap) \
-    ahd_print_register(NULL, 0, "DFSTATUS", 0x1a, regvalue, cur_col, wrap)
+#define ahd_dfstatus_print(regvalue, buf) \
+    aic_print_register(NULL, 0, "DFSTATUS", 0x1a, regvalue, buf)
 #endif
 
 #if AIC_DEBUG_REGISTERS
-ahd_reg_print_t ahd_sg_cache_shadow_print;
+aic_reg_print_t ahd_sg_cache_shadow_print;
 #else
-#define ahd_sg_cache_shadow_print(regvalue, cur_col, wrap) \
-    ahd_print_register(NULL, 0, "SG_CACHE_SHADOW", 0x1b, regvalue, cur_col, wrap)
+#define ahd_sg_cache_shadow_print(regvalue, buf) \
+    aic_print_register(NULL, 0, "SG_CACHE_SHADOW", 0x1b, regvalue, buf)
 #endif
 
 #if AIC_DEBUG_REGISTERS
-ahd_reg_print_t ahd_scsiseq0_print;
+aic_reg_print_t ahd_scsiseq0_print;
 #else
-#define ahd_scsiseq0_print(regvalue, cur_col, wrap) \
-    ahd_print_register(NULL, 0, "SCSISEQ0", 0x3a, regvalue, cur_col, wrap)
+#define ahd_scsiseq0_print(regvalue, buf) \
+    aic_print_register(NULL, 0, "SCSISEQ0", 0x3a, regvalue, buf)
 #endif
 
 #if AIC_DEBUG_REGISTERS
-ahd_reg_print_t ahd_scsiseq1_print;
+aic_reg_print_t ahd_scsiseq1_print;
 #else
-#define ahd_scsiseq1_print(regvalue, cur_col, wrap) \
-    ahd_print_register(NULL, 0, "SCSISEQ1", 0x3b, regvalue, cur_col, wrap)
+#define ahd_scsiseq1_print(regvalue, buf) \
+    aic_print_register(NULL, 0, "SCSISEQ1", 0x3b, regvalue, buf)
 #endif
 
 #if AIC_DEBUG_REGISTERS
-ahd_reg_print_t ahd_dffstat_print;
+aic_reg_print_t ahd_dffstat_print;
 #else
-#define ahd_dffstat_print(regvalue, cur_col, wrap) \
-    ahd_print_register(NULL, 0, "DFFSTAT", 0x3f, regvalue, cur_col, wrap)
+#define ahd_dffstat_print(regvalue, buf) \
+    aic_print_register(NULL, 0, "DFFSTAT", 0x3f, regvalue, buf)
 #endif
 
 #if AIC_DEBUG_REGISTERS
-ahd_reg_print_t ahd_scsisigi_print;
+aic_reg_print_t ahd_scsisigi_print;
 #else
-#define ahd_scsisigi_print(regvalue, cur_col, wrap) \
-    ahd_print_register(NULL, 0, "SCSISIGI", 0x41, regvalue, cur_col, wrap)
+#define ahd_scsisigi_print(regvalue, buf) \
+    aic_print_register(NULL, 0, "SCSISIGI", 0x41, regvalue, buf)
 #endif
 
 #if AIC_DEBUG_REGISTERS
-ahd_reg_print_t ahd_scsiphase_print;
+aic_reg_print_t ahd_scsiphase_print;
 #else
-#define ahd_scsiphase_print(regvalue, cur_col, wrap) \
-    ahd_print_register(NULL, 0, "SCSIPHASE", 0x42, regvalue, cur_col, wrap)
+#define ahd_scsiphase_print(regvalue, buf) \
+    aic_print_register(NULL, 0, "SCSIPHASE", 0x42, regvalue, buf)
 #endif
 
 #if AIC_DEBUG_REGISTERS
-ahd_reg_print_t ahd_scsibus_print;
+aic_reg_print_t ahd_scsibus_print;
 #else
-#define ahd_scsibus_print(regvalue, cur_col, wrap) \
-    ahd_print_register(NULL, 0, "SCSIBUS", 0x46, regvalue, cur_col, wrap)
+#define ahd_scsibus_print(regvalue, buf) \
+    aic_print_register(NULL, 0, "SCSIBUS", 0x46, regvalue, buf)
 #endif
 
 #if AIC_DEBUG_REGISTERS
-ahd_reg_print_t ahd_selid_print;
+aic_reg_print_t ahd_selid_print;
 #else
-#define ahd_selid_print(regvalue, cur_col, wrap) \
-    ahd_print_register(NULL, 0, "SELID", 0x49, regvalue, cur_col, wrap)
+#define ahd_selid_print(regvalue, buf) \
+    aic_print_register(NULL, 0, "SELID", 0x49, regvalue, buf)
 #endif
 
 #if AIC_DEBUG_REGISTERS
-ahd_reg_print_t ahd_simode0_print;
+aic_reg_print_t ahd_simode0_print;
 #else
-#define ahd_simode0_print(regvalue, cur_col, wrap) \
-    ahd_print_register(NULL, 0, "SIMODE0", 0x4b, regvalue, cur_col, wrap)
+#define ahd_simode0_print(regvalue, buf) \
+    aic_print_register(NULL, 0, "SIMODE0", 0x4b, regvalue, buf)
 #endif
 
 #if AIC_DEBUG_REGISTERS
-ahd_reg_print_t ahd_sstat0_print;
+aic_reg_print_t ahd_sstat0_print;
 #else
-#define ahd_sstat0_print(regvalue, cur_col, wrap) \
-    ahd_print_register(NULL, 0, "SSTAT0", 0x4b, regvalue, cur_col, wrap)
+#define ahd_sstat0_print(regvalue, buf) \
+    aic_print_register(NULL, 0, "SSTAT0", 0x4b, regvalue, buf)
 #endif
 
 #if AIC_DEBUG_REGISTERS
-ahd_reg_print_t ahd_sstat1_print;
+aic_reg_print_t ahd_sstat1_print;
 #else
-#define ahd_sstat1_print(regvalue, cur_col, wrap) \
-    ahd_print_register(NULL, 0, "SSTAT1", 0x4c, regvalue, cur_col, wrap)
+#define ahd_sstat1_print(regvalue, buf) \
+    aic_print_register(NULL, 0, "SSTAT1", 0x4c, regvalue, buf)
 #endif
 
 #if AIC_DEBUG_REGISTERS
-ahd_reg_print_t ahd_sstat2_print;
+aic_reg_print_t ahd_sstat2_print;
 #else
-#define ahd_sstat2_print(regvalue, cur_col, wrap) \
-    ahd_print_register(NULL, 0, "SSTAT2", 0x4d, regvalue, cur_col, wrap)
+#define ahd_sstat2_print(regvalue, buf) \
+    aic_print_register(NULL, 0, "SSTAT2", 0x4d, regvalue, buf)
 #endif
 
 #if AIC_DEBUG_REGISTERS
-ahd_reg_print_t ahd_perrdiag_print;
+aic_reg_print_t ahd_perrdiag_print;
 #else
-#define ahd_perrdiag_print(regvalue, cur_col, wrap) \
-    ahd_print_register(NULL, 0, "PERRDIAG", 0x4e, regvalue, cur_col, wrap)
+#define ahd_perrdiag_print(regvalue, buf) \
+    aic_print_register(NULL, 0, "PERRDIAG", 0x4e, regvalue, buf)
 #endif
 
 #if AIC_DEBUG_REGISTERS
-ahd_reg_print_t ahd_soffcnt_print;
+aic_reg_print_t ahd_soffcnt_print;
 #else
-#define ahd_soffcnt_print(regvalue, cur_col, wrap) \
-    ahd_print_register(NULL, 0, "SOFFCNT", 0x4f, regvalue, cur_col, wrap)
+#define ahd_soffcnt_print(regvalue, buf) \
+    aic_print_register(NULL, 0, "SOFFCNT", 0x4f, regvalue, buf)
 #endif
 
 #if AIC_DEBUG_REGISTERS
-ahd_reg_print_t ahd_lqistat0_print;
+aic_reg_print_t ahd_lqistat0_print;
 #else
-#define ahd_lqistat0_print(regvalue, cur_col, wrap) \
-    ahd_print_register(NULL, 0, "LQISTAT0", 0x50, regvalue, cur_col, wrap)
+#define ahd_lqistat0_print(regvalue, buf) \
+    aic_print_register(NULL, 0, "LQISTAT0", 0x50, regvalue, buf)
 #endif
 
 #if AIC_DEBUG_REGISTERS
-ahd_reg_print_t ahd_lqistat1_print;
+aic_reg_print_t ahd_lqistat1_print;
 #else
-#define ahd_lqistat1_print(regvalue, cur_col, wrap) \
-    ahd_print_register(NULL, 0, "LQISTAT1", 0x51, regvalue, cur_col, wrap)
+#define ahd_lqistat1_print(regvalue, buf) \
+    aic_print_register(NULL, 0, "LQISTAT1", 0x51, regvalue, buf)
 #endif
 
 #if AIC_DEBUG_REGISTERS
-ahd_reg_print_t ahd_lqistat2_print;
+aic_reg_print_t ahd_lqistat2_print;
 #else
-#define ahd_lqistat2_print(regvalue, cur_col, wrap) \
-    ahd_print_register(NULL, 0, "LQISTAT2", 0x52, regvalue, cur_col, wrap)
+#define ahd_lqistat2_print(regvalue, buf) \
+    aic_print_register(NULL, 0, "LQISTAT2", 0x52, regvalue, buf)
 #endif
 
 #if AIC_DEBUG_REGISTERS
-ahd_reg_print_t ahd_sstat3_print;
+aic_reg_print_t ahd_sstat3_print;
 #else
-#define ahd_sstat3_print(regvalue, cur_col, wrap) \
-    ahd_print_register(NULL, 0, "SSTAT3", 0x53, regvalue, cur_col, wrap)
+#define ahd_sstat3_print(regvalue, buf) \
+    aic_print_register(NULL, 0, "SSTAT3", 0x53, regvalue, buf)
 #endif
 
 #if AIC_DEBUG_REGISTERS
-ahd_reg_print_t ahd_lqostat0_print;
+aic_reg_print_t ahd_lqostat0_print;
 #else
-#define ahd_lqostat0_print(regvalue, cur_col, wrap) \
-    ahd_print_register(NULL, 0, "LQOSTAT0", 0x54, regvalue, cur_col, wrap)
+#define ahd_lqostat0_print(regvalue, buf) \
+    aic_print_register(NULL, 0, "LQOSTAT0", 0x54, regvalue, buf)
 #endif
 
 #if AIC_DEBUG_REGISTERS
-ahd_reg_print_t ahd_lqostat1_print;
+aic_reg_print_t ahd_lqostat1_print;
 #else
-#define ahd_lqostat1_print(regvalue, cur_col, wrap) \
-    ahd_print_register(NULL, 0, "LQOSTAT1", 0x55, regvalue, cur_col, wrap)
+#define ahd_lqostat1_print(regvalue, buf) \
+    aic_print_register(NULL, 0, "LQOSTAT1", 0x55, regvalue, buf)
 #endif
 
 #if AIC_DEBUG_REGISTERS
-ahd_reg_print_t ahd_lqostat2_print;
+aic_reg_print_t ahd_lqostat2_print;
 #else
-#define ahd_lqostat2_print(regvalue, cur_col, wrap) \
-    ahd_print_register(NULL, 0, "LQOSTAT2", 0x56, regvalue, cur_col, wrap)
+#define ahd_lqostat2_print(regvalue, buf) \
+    aic_print_register(NULL, 0, "LQOSTAT2", 0x56, regvalue, buf)
 #endif
 
 #if AIC_DEBUG_REGISTERS
-ahd_reg_print_t ahd_simode1_print;
+aic_reg_print_t ahd_simode1_print;
 #else
-#define ahd_simode1_print(regvalue, cur_col, wrap) \
-    ahd_print_register(NULL, 0, "SIMODE1", 0x57, regvalue, cur_col, wrap)
+#define ahd_simode1_print(regvalue, buf) \
+    aic_print_register(NULL, 0, "SIMODE1", 0x57, regvalue, buf)
 #endif
 
 #if AIC_DEBUG_REGISTERS
-ahd_reg_print_t ahd_dffsxfrctl_print;
+aic_reg_print_t ahd_dffsxfrctl_print;
 #else
-#define ahd_dffsxfrctl_print(regvalue, cur_col, wrap) \
-    ahd_print_register(NULL, 0, "DFFSXFRCTL", 0x5a, regvalue, cur_col, wrap)
+#define ahd_dffsxfrctl_print(regvalue, buf) \
+    aic_print_register(NULL, 0, "DFFSXFRCTL", 0x5a, regvalue, buf)
 #endif
 
 #if AIC_DEBUG_REGISTERS
-ahd_reg_print_t ahd_seqintsrc_print;
+aic_reg_print_t ahd_seqintsrc_print;
 #else
-#define ahd_seqintsrc_print(regvalue, cur_col, wrap) \
-    ahd_print_register(NULL, 0, "SEQINTSRC", 0x5b, regvalue, cur_col, wrap)
+#define ahd_seqintsrc_print(regvalue, buf) \
+    aic_print_register(NULL, 0, "SEQINTSRC", 0x5b, regvalue, buf)
 #endif
 
 #if AIC_DEBUG_REGISTERS
-ahd_reg_print_t ahd_seqimode_print;
+aic_reg_print_t ahd_seqimode_print;
 #else
-#define ahd_seqimode_print(regvalue, cur_col, wrap) \
-    ahd_print_register(NULL, 0, "SEQIMODE", 0x5c, regvalue, cur_col, wrap)
+#define ahd_seqimode_print(regvalue, buf) \
+    aic_print_register(NULL, 0, "SEQIMODE", 0x5c, regvalue, buf)
 #endif
 
 #if AIC_DEBUG_REGISTERS
-ahd_reg_print_t ahd_mdffstat_print;
+aic_reg_print_t ahd_mdffstat_print;
 #else
-#define ahd_mdffstat_print(regvalue, cur_col, wrap) \
-    ahd_print_register(NULL, 0, "MDFFSTAT", 0x5d, regvalue, cur_col, wrap)
+#define ahd_mdffstat_print(regvalue, buf) \
+    aic_print_register(NULL, 0, "MDFFSTAT", 0x5d, regvalue, buf)
 #endif
 
 #if AIC_DEBUG_REGISTERS
-ahd_reg_print_t ahd_seloid_print;
+aic_reg_print_t ahd_seloid_print;
 #else
-#define ahd_seloid_print(regvalue, cur_col, wrap) \
-    ahd_print_register(NULL, 0, "SELOID", 0x6b, regvalue, cur_col, wrap)
+#define ahd_seloid_print(regvalue, buf) \
+    aic_print_register(NULL, 0, "SELOID", 0x6b, regvalue, buf)
 #endif
 
 #if AIC_DEBUG_REGISTERS
-ahd_reg_print_t ahd_sg_state_print;
+aic_reg_print_t ahd_sg_state_print;
 #else
-#define ahd_sg_state_print(regvalue, cur_col, wrap) \
-    ahd_print_register(NULL, 0, "SG_STATE", 0xa6, regvalue, cur_col, wrap)
+#define ahd_sg_state_print(regvalue, buf) \
+    aic_print_register(NULL, 0, "SG_STATE", 0xa6, regvalue, buf)
 #endif
 
 #if AIC_DEBUG_REGISTERS
-ahd_reg_print_t ahd_ccscbctl_print;
+aic_reg_print_t ahd_ccscbctl_print;
 #else
-#define ahd_ccscbctl_print(regvalue, cur_col, wrap) \
-    ahd_print_register(NULL, 0, "CCSCBCTL", 0xad, regvalue, cur_col, wrap)
+#define ahd_ccscbctl_print(regvalue, buf) \
+    aic_print_register(NULL, 0, "CCSCBCTL", 0xad, regvalue, buf)
 #endif
 
 #if AIC_DEBUG_REGISTERS
-ahd_reg_print_t ahd_ccsgctl_print;
+aic_reg_print_t ahd_ccsgctl_print;
 #else
-#define ahd_ccsgctl_print(regvalue, cur_col, wrap) \
-    ahd_print_register(NULL, 0, "CCSGCTL", 0xad, regvalue, cur_col, wrap)
+#define ahd_ccsgctl_print(regvalue, buf) \
+    aic_print_register(NULL, 0, "CCSGCTL", 0xad, regvalue, buf)
 #endif
 
 #if AIC_DEBUG_REGISTERS
-ahd_reg_print_t ahd_seqctl0_print;
+aic_reg_print_t ahd_seqctl0_print;
 #else
-#define ahd_seqctl0_print(regvalue, cur_col, wrap) \
-    ahd_print_register(NULL, 0, "SEQCTL0", 0xd6, regvalue, cur_col, wrap)
+#define ahd_seqctl0_print(regvalue, buf) \
+    aic_print_register(NULL, 0, "SEQCTL0", 0xd6, regvalue, buf)
 #endif
 
 #if AIC_DEBUG_REGISTERS
-ahd_reg_print_t ahd_seqintctl_print;
+aic_reg_print_t ahd_seqintctl_print;
 #else
-#define ahd_seqintctl_print(regvalue, cur_col, wrap) \
-    ahd_print_register(NULL, 0, "SEQINTCTL", 0xd9, regvalue, cur_col, wrap)
+#define ahd_seqintctl_print(regvalue, buf) \
+    aic_print_register(NULL, 0, "SEQINTCTL", 0xd9, regvalue, buf)
 #endif
 
 #if AIC_DEBUG_REGISTERS
-ahd_reg_print_t ahd_sram_base_print;
+aic_reg_print_t ahd_sram_base_print;
 #else
-#define ahd_sram_base_print(regvalue, cur_col, wrap) \
-    ahd_print_register(NULL, 0, "SRAM_BASE", 0x100, regvalue, cur_col, wrap)
+#define ahd_sram_base_print(regvalue, buf) \
+    aic_print_register(NULL, 0, "SRAM_BASE", 0x100, regvalue, buf)
 #endif
 
 #if AIC_DEBUG_REGISTERS
-ahd_reg_print_t ahd_qfreeze_count_print;
+aic_reg_print_t ahd_qfreeze_count_print;
 #else
-#define ahd_qfreeze_count_print(regvalue, cur_col, wrap) \
-    ahd_print_register(NULL, 0, "QFREEZE_COUNT", 0x132, regvalue, cur_col, wrap)
+#define ahd_qfreeze_count_print(regvalue, buf) \
+    aic_print_register(NULL, 0, "QFREEZE_COUNT", 0x132, regvalue, buf)
 #endif
 
 #if AIC_DEBUG_REGISTERS
-ahd_reg_print_t ahd_kernel_qfreeze_count_print;
+aic_reg_print_t ahd_kernel_qfreeze_count_print;
 #else
-#define ahd_kernel_qfreeze_count_print(regvalue, cur_col, wrap) \
-    ahd_print_register(NULL, 0, "KERNEL_QFREEZE_COUNT", 0x134, regvalue, cur_col, wrap)
+#define ahd_kernel_qfreeze_count_print(regvalue, buf) \
+    aic_print_register(NULL, 0, "KERNEL_QFREEZE_COUNT", 0x134, regvalue, buf)
 #endif
 
 #if AIC_DEBUG_REGISTERS
-ahd_reg_print_t ahd_saved_mode_print;
+aic_reg_print_t ahd_saved_mode_print;
 #else
-#define ahd_saved_mode_print(regvalue, cur_col, wrap) \
-    ahd_print_register(NULL, 0, "SAVED_MODE", 0x136, regvalue, cur_col, wrap)
+#define ahd_saved_mode_print(regvalue, buf) \
+    aic_print_register(NULL, 0, "SAVED_MODE", 0x136, regvalue, buf)
 #endif
 
 #if AIC_DEBUG_REGISTERS
-ahd_reg_print_t ahd_seq_flags_print;
+aic_reg_print_t ahd_seq_flags_print;
 #else
-#define ahd_seq_flags_print(regvalue, cur_col, wrap) \
-    ahd_print_register(NULL, 0, "SEQ_FLAGS", 0x139, regvalue, cur_col, wrap)
+#define ahd_seq_flags_print(regvalue, buf) \
+    aic_print_register(NULL, 0, "SEQ_FLAGS", 0x139, regvalue, buf)
 #endif
 
 #if AIC_DEBUG_REGISTERS
-ahd_reg_print_t ahd_lastphase_print;
+aic_reg_print_t ahd_lastphase_print;
 #else
-#define ahd_lastphase_print(regvalue, cur_col, wrap) \
-    ahd_print_register(NULL, 0, "LASTPHASE", 0x13c, regvalue, cur_col, wrap)
+#define ahd_lastphase_print(regvalue, buf) \
+    aic_print_register(NULL, 0, "LASTPHASE", 0x13c, regvalue, buf)
 #endif
 
 #if AIC_DEBUG_REGISTERS
-ahd_reg_print_t ahd_seq_flags2_print;
+aic_reg_print_t ahd_seq_flags2_print;
 #else
-#define ahd_seq_flags2_print(regvalue, cur_col, wrap) \
-    ahd_print_register(NULL, 0, "SEQ_FLAGS2", 0x14d, regvalue, cur_col, wrap)
+#define ahd_seq_flags2_print(regvalue, buf) \
+    aic_print_register(NULL, 0, "SEQ_FLAGS2", 0x14d, regvalue, buf)
 #endif
 
 #if AIC_DEBUG_REGISTERS
-ahd_reg_print_t ahd_mk_message_scb_print;
+aic_reg_print_t ahd_mk_message_scb_print;
 #else
-#define ahd_mk_message_scb_print(regvalue, cur_col, wrap) \
-    ahd_print_register(NULL, 0, "MK_MESSAGE_SCB", 0x160, regvalue, cur_col, wrap)
+#define ahd_mk_message_scb_print(regvalue, buf) \
+    aic_print_register(NULL, 0, "MK_MESSAGE_SCB", 0x160, regvalue, buf)
 #endif
 
 #if AIC_DEBUG_REGISTERS
-ahd_reg_print_t ahd_mk_message_scsiid_print;
+aic_reg_print_t ahd_mk_message_scsiid_print;
 #else
-#define ahd_mk_message_scsiid_print(regvalue, cur_col, wrap) \
-    ahd_print_register(NULL, 0, "MK_MESSAGE_SCSIID", 0x162, regvalue, cur_col, wrap)
+#define ahd_mk_message_scsiid_print(regvalue, buf) \
+    aic_print_register(NULL, 0, "MK_MESSAGE_SCSIID", 0x162, regvalue, buf)
 #endif
 
 #if AIC_DEBUG_REGISTERS
-ahd_reg_print_t ahd_scb_base_print;
+aic_reg_print_t ahd_scb_base_print;
 #else
-#define ahd_scb_base_print(regvalue, cur_col, wrap) \
-    ahd_print_register(NULL, 0, "SCB_BASE", 0x180, regvalue, cur_col, wrap)
+#define ahd_scb_base_print(regvalue, buf) \
+    aic_print_register(NULL, 0, "SCB_BASE", 0x180, regvalue, buf)
 #endif
 
 #if AIC_DEBUG_REGISTERS
-ahd_reg_print_t ahd_scb_control_print;
+aic_reg_print_t ahd_scb_control_print;
 #else
-#define ahd_scb_control_print(regvalue, cur_col, wrap) \
-    ahd_print_register(NULL, 0, "SCB_CONTROL", 0x192, regvalue, cur_col, wrap)
+#define ahd_scb_control_print(regvalue, buf) \
+    aic_print_register(NULL, 0, "SCB_CONTROL", 0x192, regvalue, buf)
 #endif
 
 #if AIC_DEBUG_REGISTERS
-ahd_reg_print_t ahd_scb_scsiid_print;
+aic_reg_print_t ahd_scb_scsiid_print;
 #else
-#define ahd_scb_scsiid_print(regvalue, cur_col, wrap) \
-    ahd_print_register(NULL, 0, "SCB_SCSIID", 0x193, regvalue, cur_col, wrap)
+#define ahd_scb_scsiid_print(regvalue, buf) \
+    aic_print_register(NULL, 0, "SCB_SCSIID", 0x193, regvalue, buf)
 #endif
 
 
diff --git a/drivers/scsi/aic7xxx/aic79xx_reg_print.c_shipped b/drivers/scsi/aic7xxx/aic79xx_reg_print.c_shipped
index 2e0c58905b9e..0f8e47a5169d 100644
--- a/drivers/scsi/aic7xxx/aic79xx_reg_print.c_shipped
+++ b/drivers/scsi/aic7xxx/aic79xx_reg_print.c_shipped
@@ -8,7 +8,7 @@
 
 #include "aic79xx_osm.h"
 
-static const ahd_reg_parse_entry_t INTSTAT_parse_table[] = {
+static const aic_reg_parse_entry_t INTSTAT_parse_table[] = {
 	{ "SPLTINT",		0x01, 0x01 },
 	{ "CMDCMPLT",		0x02, 0x02 },
 	{ "SEQINT",		0x04, 0x04 },
@@ -20,26 +20,26 @@ static const ahd_reg_parse_entry_t INTSTAT_parse_table[] = {
 	{ "INT_PEND",		0xff, 0xff }
 };
 
-int
-ahd_intstat_print(u_int regvalue, u_int *cur_col, u_int wrap)
+void
+ahd_intstat_print(u_int regvalue, struct aic_dump_buffer *buf)
 {
-	return (ahd_print_register(INTSTAT_parse_table, 9, "INTSTAT",
-	    0x01, regvalue, cur_col, wrap));
+	aic_print_register(INTSTAT_parse_table, 9, "INTSTAT",
+			   0x01, regvalue, buf);
 }
 
-static const ahd_reg_parse_entry_t HS_MAILBOX_parse_table[] = {
+static const aic_reg_parse_entry_t HS_MAILBOX_parse_table[] = {
 	{ "ENINT_COALESCE",	0x40, 0x40 },
 	{ "HOST_TQINPOS",	0x80, 0x80 }
 };
 
-int
-ahd_hs_mailbox_print(u_int regvalue, u_int *cur_col, u_int wrap)
+void
+ahd_hs_mailbox_print(u_int regvalue, struct aic_dump_buffer *buf)
 {
-	return (ahd_print_register(HS_MAILBOX_parse_table, 2, "HS_MAILBOX",
-	    0x0b, regvalue, cur_col, wrap));
+	aic_print_register(HS_MAILBOX_parse_table, 2, "HS_MAILBOX",
+			   0x0b, regvalue, buf);
 }
 
-static const ahd_reg_parse_entry_t SEQINTSTAT_parse_table[] = {
+static const aic_reg_parse_entry_t SEQINTSTAT_parse_table[] = {
 	{ "SEQ_SPLTINT",	0x01, 0x01 },
 	{ "SEQ_PCIINT",		0x02, 0x02 },
 	{ "SEQ_SCSIINT",	0x04, 0x04 },
@@ -47,14 +47,14 @@ static const ahd_reg_parse_entry_t SEQINTSTAT_parse_table[] = {
 	{ "SEQ_SWTMRTO",	0x10, 0x10 }
 };
 
-int
-ahd_seqintstat_print(u_int regvalue, u_int *cur_col, u_int wrap)
+void
+ahd_seqintstat_print(u_int regvalue, struct aic_dump_buffer *buf)
 {
-	return (ahd_print_register(SEQINTSTAT_parse_table, 5, "SEQINTSTAT",
-	    0x0c, regvalue, cur_col, wrap));
+	aic_print_register(SEQINTSTAT_parse_table, 5, "SEQINTSTAT",
+			   0x0c, regvalue, buf);
 }
 
-static const ahd_reg_parse_entry_t INTCTL_parse_table[] = {
+static const aic_reg_parse_entry_t INTCTL_parse_table[] = {
 	{ "SPLTINTEN",		0x01, 0x01 },
 	{ "SEQINTEN",		0x02, 0x02 },
 	{ "SCSIINTEN",		0x04, 0x04 },
@@ -65,14 +65,14 @@ static const ahd_reg_parse_entry_t INTCTL_parse_table[] = {
 	{ "SWTMINTMASK",	0x80, 0x80 }
 };
 
-int
-ahd_intctl_print(u_int regvalue, u_int *cur_col, u_int wrap)
+void
+ahd_intctl_print(u_int regvalue, struct aic_dump_buffer *buf)
 {
-	return (ahd_print_register(INTCTL_parse_table, 8, "INTCTL",
-	    0x18, regvalue, cur_col, wrap));
+	aic_print_register(INTCTL_parse_table, 8, "INTCTL",
+			   0x18, regvalue, buf);
 }
 
-static const ahd_reg_parse_entry_t DFCNTRL_parse_table[] = {
+static const aic_reg_parse_entry_t DFCNTRL_parse_table[] = {
 	{ "DIRECTIONEN",	0x01, 0x01 },
 	{ "FIFOFLUSH",		0x02, 0x02 },
 	{ "FIFOFLUSHACK",	0x02, 0x02 },
@@ -86,14 +86,14 @@ static const ahd_reg_parse_entry_t DFCNTRL_parse_table[] = {
 	{ "PRELOADEN",		0x80, 0x80 }
 };
 
-int
-ahd_dfcntrl_print(u_int regvalue, u_int *cur_col, u_int wrap)
+void
+ahd_dfcntrl_print(u_int regvalue, struct aic_dump_buffer *buf)
 {
-	return (ahd_print_register(DFCNTRL_parse_table, 11, "DFCNTRL",
-	    0x19, regvalue, cur_col, wrap));
+	aic_print_register(DFCNTRL_parse_table, 11, "DFCNTRL",
+			   0x19, regvalue, buf);
 }
 
-static const ahd_reg_parse_entry_t DFSTATUS_parse_table[] = {
+static const aic_reg_parse_entry_t DFSTATUS_parse_table[] = {
 	{ "FIFOEMP",		0x01, 0x01 },
 	{ "FIFOFULL",		0x02, 0x02 },
 	{ "DFTHRESH",		0x04, 0x04 },
@@ -103,28 +103,28 @@ static const ahd_reg_parse_entry_t DFSTATUS_parse_table[] = {
 	{ "PRELOAD_AVAIL",	0x80, 0x80 }
 };
 
-int
-ahd_dfstatus_print(u_int regvalue, u_int *cur_col, u_int wrap)
+void
+ahd_dfstatus_print(u_int regvalue, struct aic_dump_buffer *buf)
 {
-	return (ahd_print_register(DFSTATUS_parse_table, 7, "DFSTATUS",
-	    0x1a, regvalue, cur_col, wrap));
+	aic_print_register(DFSTATUS_parse_table, 7, "DFSTATUS",
+			   0x1a, regvalue, buf);
 }
 
-static const ahd_reg_parse_entry_t SG_CACHE_SHADOW_parse_table[] = {
+static const aic_reg_parse_entry_t SG_CACHE_SHADOW_parse_table[] = {
 	{ "LAST_SEG_DONE",	0x01, 0x01 },
 	{ "LAST_SEG",		0x02, 0x02 },
 	{ "ODD_SEG",		0x04, 0x04 },
 	{ "SG_ADDR_MASK",	0xf8, 0xf8 }
 };
 
-int
-ahd_sg_cache_shadow_print(u_int regvalue, u_int *cur_col, u_int wrap)
+void
+ahd_sg_cache_shadow_print(u_int regvalue, struct aic_dump_buffer *buf)
 {
-	return (ahd_print_register(SG_CACHE_SHADOW_parse_table, 4, "SG_CACHE_SHADOW",
-	    0x1b, regvalue, cur_col, wrap));
+	aic_print_register(SG_CACHE_SHADOW_parse_table, 4, "SG_CACHE_SHADOW",
+			   0x1b, regvalue, buf);
 }
 
-static const ahd_reg_parse_entry_t SCSISEQ0_parse_table[] = {
+static const aic_reg_parse_entry_t SCSISEQ0_parse_table[] = {
 	{ "SCSIRSTO",		0x01, 0x01 },
 	{ "FORCEBUSFREE",	0x10, 0x10 },
 	{ "ENARBO",		0x20, 0x20 },
@@ -132,14 +132,14 @@ static const ahd_reg_parse_entry_t SCSISEQ0_parse_table[] = {
 	{ "TEMODEO",		0x80, 0x80 }
 };
 
-int
-ahd_scsiseq0_print(u_int regvalue, u_int *cur_col, u_int wrap)
+void
+ahd_scsiseq0_print(u_int regvalue, struct aic_dump_buffer *buf)
 {
-	return (ahd_print_register(SCSISEQ0_parse_table, 5, "SCSISEQ0",
-	    0x3a, regvalue, cur_col, wrap));
+	aic_print_register(SCSISEQ0_parse_table, 5, "SCSISEQ0",
+			   0x3a, regvalue, buf);
 }
 
-static const ahd_reg_parse_entry_t SCSISEQ1_parse_table[] = {
+static const aic_reg_parse_entry_t SCSISEQ1_parse_table[] = {
 	{ "ALTSTIM",		0x01, 0x01 },
 	{ "ENAUTOATNP",		0x02, 0x02 },
 	{ "MANUALP",		0x0c, 0x0c },
@@ -148,14 +148,14 @@ static const ahd_reg_parse_entry_t SCSISEQ1_parse_table[] = {
 	{ "MANUALCTL",		0x40, 0x40 }
 };
 
-int
-ahd_scsiseq1_print(u_int regvalue, u_int *cur_col, u_int wrap)
+void
+ahd_scsiseq1_print(u_int regvalue, struct aic_dump_buffer *buf)
 {
-	return (ahd_print_register(SCSISEQ1_parse_table, 6, "SCSISEQ1",
-	    0x3b, regvalue, cur_col, wrap));
+	aic_print_register(SCSISEQ1_parse_table, 6, "SCSISEQ1",
+			   0x3b, regvalue, buf);
 }
 
-static const ahd_reg_parse_entry_t DFFSTAT_parse_table[] = {
+static const aic_reg_parse_entry_t DFFSTAT_parse_table[] = {
 	{ "CURRFIFO_0",		0x00, 0x03 },
 	{ "CURRFIFO_1",		0x01, 0x03 },
 	{ "CURRFIFO_NONE",	0x03, 0x03 },
@@ -164,14 +164,14 @@ static const ahd_reg_parse_entry_t DFFSTAT_parse_table[] = {
 	{ "CURRFIFO",		0x03, 0x03 }
 };
 
-int
-ahd_dffstat_print(u_int regvalue, u_int *cur_col, u_int wrap)
+void
+ahd_dffstat_print(u_int regvalue, struct aic_dump_buffer *buf)
 {
-	return (ahd_print_register(DFFSTAT_parse_table, 6, "DFFSTAT",
-	    0x3f, regvalue, cur_col, wrap));
+	aic_print_register(DFFSTAT_parse_table, 6, "DFFSTAT",
+			   0x3f, regvalue, buf);
 }
 
-static const ahd_reg_parse_entry_t SCSISIGI_parse_table[] = {
+static const aic_reg_parse_entry_t SCSISIGI_parse_table[] = {
 	{ "P_DATAOUT",		0x00, 0xe0 },
 	{ "P_DATAOUT_DT",	0x20, 0xe0 },
 	{ "P_DATAIN",		0x40, 0xe0 },
@@ -191,14 +191,14 @@ static const ahd_reg_parse_entry_t SCSISIGI_parse_table[] = {
 	{ "PHASE_MASK",		0xe0, 0xe0 }
 };
 
-int
-ahd_scsisigi_print(u_int regvalue, u_int *cur_col, u_int wrap)
+void
+ahd_scsisigi_print(u_int regvalue, struct aic_dump_buffer *buf)
 {
-	return (ahd_print_register(SCSISIGI_parse_table, 17, "SCSISIGI",
-	    0x41, regvalue, cur_col, wrap));
+	aic_print_register(SCSISIGI_parse_table, 17, "SCSISIGI",
+			   0x41, regvalue, buf);
 }
 
-static const ahd_reg_parse_entry_t SCSIPHASE_parse_table[] = {
+static const aic_reg_parse_entry_t SCSIPHASE_parse_table[] = {
 	{ "DATA_OUT_PHASE",	0x01, 0x03 },
 	{ "DATA_IN_PHASE",	0x02, 0x03 },
 	{ "DATA_PHASE_MASK",	0x03, 0x03 },
@@ -208,33 +208,33 @@ static const ahd_reg_parse_entry_t SCSIPHASE_parse_table[] = {
 	{ "STATUS_PHASE",	0x20, 0x20 }
 };
 
-int
-ahd_scsiphase_print(u_int regvalue, u_int *cur_col, u_int wrap)
+void
+ahd_scsiphase_print(u_int regvalue, struct aic_dump_buffer *buf)
 {
-	return (ahd_print_register(SCSIPHASE_parse_table, 7, "SCSIPHASE",
-	    0x42, regvalue, cur_col, wrap));
+	aic_print_register(SCSIPHASE_parse_table, 7, "SCSIPHASE",
+			   0x42, regvalue, buf);
 }
 
-int
-ahd_scsibus_print(u_int regvalue, u_int *cur_col, u_int wrap)
+void
+ahd_scsibus_print(u_int regvalue, struct aic_dump_buffer *buf)
 {
-	return (ahd_print_register(NULL, 0, "SCSIBUS",
-	    0x46, regvalue, cur_col, wrap));
+	aic_print_register(NULL, 0, "SCSIBUS",
+			   0x46, regvalue, buf);
 }
 
-static const ahd_reg_parse_entry_t SELID_parse_table[] = {
+static const aic_reg_parse_entry_t SELID_parse_table[] = {
 	{ "ONEBIT",		0x08, 0x08 },
 	{ "SELID_MASK",		0xf0, 0xf0 }
 };
 
-int
-ahd_selid_print(u_int regvalue, u_int *cur_col, u_int wrap)
+void
+ahd_selid_print(u_int regvalue, struct aic_dump_buffer *buf)
 {
-	return (ahd_print_register(SELID_parse_table, 2, "SELID",
-	    0x49, regvalue, cur_col, wrap));
+	aic_print_register(SELID_parse_table, 2, "SELID",
+			   0x49, regvalue, buf);
 }
 
-static const ahd_reg_parse_entry_t SIMODE0_parse_table[] = {
+static const aic_reg_parse_entry_t SIMODE0_parse_table[] = {
 	{ "ENARBDO",		0x01, 0x01 },
 	{ "ENSPIORDY",		0x02, 0x02 },
 	{ "ENOVERRUN",		0x04, 0x04 },
@@ -244,14 +244,14 @@ static const ahd_reg_parse_entry_t SIMODE0_parse_table[] = {
 	{ "ENSELDO",		0x40, 0x40 }
 };
 
-int
-ahd_simode0_print(u_int regvalue, u_int *cur_col, u_int wrap)
+void
+ahd_simode0_print(u_int regvalue, struct aic_dump_buffer *buf)
 {
-	return (ahd_print_register(SIMODE0_parse_table, 7, "SIMODE0",
-	    0x4b, regvalue, cur_col, wrap));
+	aic_print_register(SIMODE0_parse_table, 7, "SIMODE0",
+			   0x4b, regvalue, buf);
 }
 
-static const ahd_reg_parse_entry_t SSTAT0_parse_table[] = {
+static const aic_reg_parse_entry_t SSTAT0_parse_table[] = {
 	{ "ARBDO",		0x01, 0x01 },
 	{ "SPIORDY",		0x02, 0x02 },
 	{ "OVERRUN",		0x04, 0x04 },
@@ -262,14 +262,14 @@ static const ahd_reg_parse_entry_t SSTAT0_parse_table[] = {
 	{ "TARGET",		0x80, 0x80 }
 };
 
-int
-ahd_sstat0_print(u_int regvalue, u_int *cur_col, u_int wrap)
+void
+ahd_sstat0_print(u_int regvalue, struct aic_dump_buffer *buf)
 {
-	return (ahd_print_register(SSTAT0_parse_table, 8, "SSTAT0",
-	    0x4b, regvalue, cur_col, wrap));
+	aic_print_register(SSTAT0_parse_table, 8, "SSTAT0",
+			   0x4b, regvalue, buf);
 }
 
-static const ahd_reg_parse_entry_t SSTAT1_parse_table[] = {
+static const aic_reg_parse_entry_t SSTAT1_parse_table[] = {
 	{ "REQINIT",		0x01, 0x01 },
 	{ "STRB2FAST",		0x02, 0x02 },
 	{ "SCSIPERR",		0x04, 0x04 },
@@ -280,14 +280,14 @@ static const ahd_reg_parse_entry_t SSTAT1_parse_table[] = {
 	{ "SELTO",		0x80, 0x80 }
 };
 
-int
-ahd_sstat1_print(u_int regvalue, u_int *cur_col, u_int wrap)
+void
+ahd_sstat1_print(u_int regvalue, struct aic_dump_buffer *buf)
 {
-	return (ahd_print_register(SSTAT1_parse_table, 8, "SSTAT1",
-	    0x4c, regvalue, cur_col, wrap));
+	aic_print_register(SSTAT1_parse_table, 8, "SSTAT1",
+			   0x4c, regvalue, buf);
 }
 
-static const ahd_reg_parse_entry_t SSTAT2_parse_table[] = {
+static const aic_reg_parse_entry_t SSTAT2_parse_table[] = {
 	{ "BUSFREE_LQO",	0x40, 0xc0 },
 	{ "BUSFREE_DFF0",	0x80, 0xc0 },
 	{ "BUSFREE_DFF1",	0xc0, 0xc0 },
@@ -300,14 +300,14 @@ static const ahd_reg_parse_entry_t SSTAT2_parse_table[] = {
 	{ "BUSFREETIME",	0xc0, 0xc0 }
 };
 
-int
-ahd_sstat2_print(u_int regvalue, u_int *cur_col, u_int wrap)
+void
+ahd_sstat2_print(u_int regvalue, struct aic_dump_buffer *buf)
 {
-	return (ahd_print_register(SSTAT2_parse_table, 10, "SSTAT2",
-	    0x4d, regvalue, cur_col, wrap));
+	aic_print_register(SSTAT2_parse_table, 10, "SSTAT2",
+			   0x4d, regvalue, buf);
 }
 
-static const ahd_reg_parse_entry_t PERRDIAG_parse_table[] = {
+static const aic_reg_parse_entry_t PERRDIAG_parse_table[] = {
 	{ "DTERR",		0x01, 0x01 },
 	{ "DGFORMERR",		0x02, 0x02 },
 	{ "CRCERR",		0x04, 0x04 },
@@ -318,21 +318,21 @@ static const ahd_reg_parse_entry_t PERRDIAG_parse_table[] = {
 	{ "HIZERO",		0x80, 0x80 }
 };
 
-int
-ahd_perrdiag_print(u_int regvalue, u_int *cur_col, u_int wrap)
+void
+ahd_perrdiag_print(u_int regvalue, struct aic_dump_buffer *buf)
 {
-	return (ahd_print_register(PERRDIAG_parse_table, 8, "PERRDIAG",
-	    0x4e, regvalue, cur_col, wrap));
+	aic_print_register(PERRDIAG_parse_table, 8, "PERRDIAG",
+			   0x4e, regvalue, buf);
 }
 
-int
-ahd_soffcnt_print(u_int regvalue, u_int *cur_col, u_int wrap)
+void
+ahd_soffcnt_print(u_int regvalue, struct aic_dump_buffer *buf)
 {
-	return (ahd_print_register(NULL, 0, "SOFFCNT",
-	    0x4f, regvalue, cur_col, wrap));
+	aic_print_register(NULL, 0, "SOFFCNT",
+			   0x4f, regvalue, buf);
 }
 
-static const ahd_reg_parse_entry_t LQISTAT0_parse_table[] = {
+static const aic_reg_parse_entry_t LQISTAT0_parse_table[] = {
 	{ "LQIATNCMD",		0x01, 0x01 },
 	{ "LQIATNLQ",		0x02, 0x02 },
 	{ "LQIBADLQT",		0x04, 0x04 },
@@ -341,14 +341,14 @@ static const ahd_reg_parse_entry_t LQISTAT0_parse_table[] = {
 	{ "LQIATNQAS",		0x20, 0x20 }
 };
 
-int
-ahd_lqistat0_print(u_int regvalue, u_int *cur_col, u_int wrap)
+void
+ahd_lqistat0_print(u_int regvalue, struct aic_dump_buffer *buf)
 {
-	return (ahd_print_register(LQISTAT0_parse_table, 6, "LQISTAT0",
-	    0x50, regvalue, cur_col, wrap));
+	aic_print_register(LQISTAT0_parse_table, 6, "LQISTAT0",
+			   0x50, regvalue, buf);
 }
 
-static const ahd_reg_parse_entry_t LQISTAT1_parse_table[] = {
+static const aic_reg_parse_entry_t LQISTAT1_parse_table[] = {
 	{ "LQIOVERI_NLQ",	0x01, 0x01 },
 	{ "LQIOVERI_LQ",	0x02, 0x02 },
 	{ "LQIBADLQI",		0x04, 0x04 },
@@ -359,14 +359,14 @@ static const ahd_reg_parse_entry_t LQISTAT1_parse_table[] = {
 	{ "LQIPHASE_LQ",	0x80, 0x80 }
 };
 
-int
-ahd_lqistat1_print(u_int regvalue, u_int *cur_col, u_int wrap)
+void
+ahd_lqistat1_print(u_int regvalue, struct aic_dump_buffer *buf)
 {
-	return (ahd_print_register(LQISTAT1_parse_table, 8, "LQISTAT1",
-	    0x51, regvalue, cur_col, wrap));
+	aic_print_register(LQISTAT1_parse_table, 8, "LQISTAT1",
+			   0x51, regvalue, buf);
 }
 
-static const ahd_reg_parse_entry_t LQISTAT2_parse_table[] = {
+static const aic_reg_parse_entry_t LQISTAT2_parse_table[] = {
 	{ "LQIGSAVAIL",		0x01, 0x01 },
 	{ "LQISTOPCMD",		0x02, 0x02 },
 	{ "LQISTOPLQ",		0x04, 0x04 },
@@ -377,26 +377,26 @@ static const ahd_reg_parse_entry_t LQISTAT2_parse_table[] = {
 	{ "PACKETIZED",		0x80, 0x80 }
 };
 
-int
-ahd_lqistat2_print(u_int regvalue, u_int *cur_col, u_int wrap)
+void
+ahd_lqistat2_print(u_int regvalue, struct aic_dump_buffer *buf)
 {
-	return (ahd_print_register(LQISTAT2_parse_table, 8, "LQISTAT2",
-	    0x52, regvalue, cur_col, wrap));
+	aic_print_register(LQISTAT2_parse_table, 8, "LQISTAT2",
+			   0x52, regvalue, buf);
 }
 
-static const ahd_reg_parse_entry_t SSTAT3_parse_table[] = {
+static const aic_reg_parse_entry_t SSTAT3_parse_table[] = {
 	{ "OSRAMPERR",		0x01, 0x01 },
 	{ "NTRAMPERR",		0x02, 0x02 }
 };
 
-int
-ahd_sstat3_print(u_int regvalue, u_int *cur_col, u_int wrap)
+void
+ahd_sstat3_print(u_int regvalue, struct aic_dump_buffer *buf)
 {
-	return (ahd_print_register(SSTAT3_parse_table, 2, "SSTAT3",
-	    0x53, regvalue, cur_col, wrap));
+	aic_print_register(SSTAT3_parse_table, 2, "SSTAT3",
+			   0x53, regvalue, buf);
 }
 
-static const ahd_reg_parse_entry_t LQOSTAT0_parse_table[] = {
+static const aic_reg_parse_entry_t LQOSTAT0_parse_table[] = {
 	{ "LQOTCRC",		0x01, 0x01 },
 	{ "LQOATNPKT",		0x02, 0x02 },
 	{ "LQOATNLQ",		0x04, 0x04 },
@@ -404,14 +404,14 @@ static const ahd_reg_parse_entry_t LQOSTAT0_parse_table[] = {
 	{ "LQOTARGSCBPERR",	0x10, 0x10 }
 };
 
-int
-ahd_lqostat0_print(u_int regvalue, u_int *cur_col, u_int wrap)
+void
+ahd_lqostat0_print(u_int regvalue, struct aic_dump_buffer *buf)
 {
-	return (ahd_print_register(LQOSTAT0_parse_table, 5, "LQOSTAT0",
-	    0x54, regvalue, cur_col, wrap));
+	aic_print_register(LQOSTAT0_parse_table, 5, "LQOSTAT0",
+			   0x54, regvalue, buf);
 }
 
-static const ahd_reg_parse_entry_t LQOSTAT1_parse_table[] = {
+static const aic_reg_parse_entry_t LQOSTAT1_parse_table[] = {
 	{ "LQOPHACHGINPKT",	0x01, 0x01 },
 	{ "LQOBUSFREE",		0x02, 0x02 },
 	{ "LQOBADQAS",		0x04, 0x04 },
@@ -419,28 +419,28 @@ static const ahd_reg_parse_entry_t LQOSTAT1_parse_table[] = {
 	{ "LQOINITSCBPERR",	0x10, 0x10 }
 };
 
-int
-ahd_lqostat1_print(u_int regvalue, u_int *cur_col, u_int wrap)
+void
+ahd_lqostat1_print(u_int regvalue, struct aic_dump_buffer *buf)
 {
-	return (ahd_print_register(LQOSTAT1_parse_table, 5, "LQOSTAT1",
-	    0x55, regvalue, cur_col, wrap));
+	aic_print_register(LQOSTAT1_parse_table, 5, "LQOSTAT1",
+			   0x55, regvalue, buf);
 }
 
-static const ahd_reg_parse_entry_t LQOSTAT2_parse_table[] = {
+static const aic_reg_parse_entry_t LQOSTAT2_parse_table[] = {
 	{ "LQOSTOP0",		0x01, 0x01 },
 	{ "LQOPHACHGOUTPKT",	0x02, 0x02 },
 	{ "LQOWAITFIFO",	0x10, 0x10 },
 	{ "LQOPKT",		0xe0, 0xe0 }
 };
 
-int
-ahd_lqostat2_print(u_int regvalue, u_int *cur_col, u_int wrap)
+void
+ahd_lqostat2_print(u_int regvalue, struct aic_dump_buffer *buf)
 {
-	return (ahd_print_register(LQOSTAT2_parse_table, 4, "LQOSTAT2",
-	    0x56, regvalue, cur_col, wrap));
+	aic_print_register(LQOSTAT2_parse_table, 4, "LQOSTAT2",
+			   0x56, regvalue, buf);
 }
 
-static const ahd_reg_parse_entry_t SIMODE1_parse_table[] = {
+static const aic_reg_parse_entry_t SIMODE1_parse_table[] = {
 	{ "ENREQINIT",		0x01, 0x01 },
 	{ "ENSTRB2FAST",	0x02, 0x02 },
 	{ "ENSCSIPERR",		0x04, 0x04 },
@@ -451,28 +451,28 @@ static const ahd_reg_parse_entry_t SIMODE1_parse_table[] = {
 	{ "ENSELTIMO",		0x80, 0x80 }
 };
 
-int
-ahd_simode1_print(u_int regvalue, u_int *cur_col, u_int wrap)
+void
+ahd_simode1_print(u_int regvalue, struct aic_dump_buffer *buf)
 {
-	return (ahd_print_register(SIMODE1_parse_table, 8, "SIMODE1",
-	    0x57, regvalue, cur_col, wrap));
+	aic_print_register(SIMODE1_parse_table, 8, "SIMODE1",
+			   0x57, regvalue, buf);
 }
 
-static const ahd_reg_parse_entry_t DFFSXFRCTL_parse_table[] = {
+static const aic_reg_parse_entry_t DFFSXFRCTL_parse_table[] = {
 	{ "RSTCHN",		0x01, 0x01 },
 	{ "CLRCHN",		0x02, 0x02 },
 	{ "CLRSHCNT",		0x04, 0x04 },
 	{ "DFFBITBUCKET",	0x08, 0x08 }
 };
 
-int
-ahd_dffsxfrctl_print(u_int regvalue, u_int *cur_col, u_int wrap)
+void
+ahd_dffsxfrctl_print(u_int regvalue, struct aic_dump_buffer *buf)
 {
-	return (ahd_print_register(DFFSXFRCTL_parse_table, 4, "DFFSXFRCTL",
-	    0x5a, regvalue, cur_col, wrap));
+	aic_print_register(DFFSXFRCTL_parse_table, 4, "DFFSXFRCTL",
+			   0x5a, regvalue, buf);
 }
 
-static const ahd_reg_parse_entry_t SEQINTSRC_parse_table[] = {
+static const aic_reg_parse_entry_t SEQINTSRC_parse_table[] = {
 	{ "CFG4TCMD",		0x01, 0x01 },
 	{ "CFG4ICMD",		0x02, 0x02 },
 	{ "CFG4TSTAT",		0x04, 0x04 },
@@ -482,14 +482,14 @@ static const ahd_reg_parse_entry_t SEQINTSRC_parse_table[] = {
 	{ "CTXTDONE",		0x40, 0x40 }
 };
 
-int
-ahd_seqintsrc_print(u_int regvalue, u_int *cur_col, u_int wrap)
+void
+ahd_seqintsrc_print(u_int regvalue, struct aic_dump_buffer *buf)
 {
-	return (ahd_print_register(SEQINTSRC_parse_table, 7, "SEQINTSRC",
-	    0x5b, regvalue, cur_col, wrap));
+	aic_print_register(SEQINTSRC_parse_table, 7, "SEQINTSRC",
+			   0x5b, regvalue, buf);
 }
 
-static const ahd_reg_parse_entry_t SEQIMODE_parse_table[] = {
+static const aic_reg_parse_entry_t SEQIMODE_parse_table[] = {
 	{ "ENCFG4TCMD",		0x01, 0x01 },
 	{ "ENCFG4ICMD",		0x02, 0x02 },
 	{ "ENCFG4TSTAT",	0x04, 0x04 },
@@ -499,14 +499,14 @@ static const ahd_reg_parse_entry_t SEQIMODE_parse_table[] = {
 	{ "ENCTXTDONE",		0x40, 0x40 }
 };
 
-int
-ahd_seqimode_print(u_int regvalue, u_int *cur_col, u_int wrap)
+void
+ahd_seqimode_print(u_int regvalue, struct aic_dump_buffer *buf)
 {
-	return (ahd_print_register(SEQIMODE_parse_table, 7, "SEQIMODE",
-	    0x5c, regvalue, cur_col, wrap));
+	aic_print_register(SEQIMODE_parse_table, 7, "SEQIMODE",
+			   0x5c, regvalue, buf);
 }
 
-static const ahd_reg_parse_entry_t MDFFSTAT_parse_table[] = {
+static const aic_reg_parse_entry_t MDFFSTAT_parse_table[] = {
 	{ "FIFOFREE",		0x01, 0x01 },
 	{ "DATAINFIFO",		0x02, 0x02 },
 	{ "DLZERO",		0x04, 0x04 },
@@ -516,34 +516,34 @@ static const ahd_reg_parse_entry_t MDFFSTAT_parse_table[] = {
 	{ "SHCNTNEGATIVE",	0x40, 0x40 }
 };
 
-int
-ahd_mdffstat_print(u_int regvalue, u_int *cur_col, u_int wrap)
+void
+ahd_mdffstat_print(u_int regvalue, struct aic_dump_buffer *buf)
 {
-	return (ahd_print_register(MDFFSTAT_parse_table, 7, "MDFFSTAT",
-	    0x5d, regvalue, cur_col, wrap));
+	aic_print_register(MDFFSTAT_parse_table, 7, "MDFFSTAT",
+			   0x5d, regvalue, buf);
 }
 
-int
-ahd_seloid_print(u_int regvalue, u_int *cur_col, u_int wrap)
+void
+ahd_seloid_print(u_int regvalue, struct aic_dump_buffer *buf)
 {
-	return (ahd_print_register(NULL, 0, "SELOID",
-	    0x6b, regvalue, cur_col, wrap));
+	aic_print_register(NULL, 0, "SELOID",
+			   0x6b, regvalue, buf);
 }
 
-static const ahd_reg_parse_entry_t SG_STATE_parse_table[] = {
+static const aic_reg_parse_entry_t SG_STATE_parse_table[] = {
 	{ "SEGS_AVAIL",		0x01, 0x01 },
 	{ "LOADING_NEEDED",	0x02, 0x02 },
 	{ "FETCH_INPROG",	0x04, 0x04 }
 };
 
-int
-ahd_sg_state_print(u_int regvalue, u_int *cur_col, u_int wrap)
+void
+ahd_sg_state_print(u_int regvalue, struct aic_dump_buffer *buf)
 {
-	return (ahd_print_register(SG_STATE_parse_table, 3, "SG_STATE",
-	    0xa6, regvalue, cur_col, wrap));
+	aic_print_register(SG_STATE_parse_table, 3, "SG_STATE",
+			   0xa6, regvalue, buf);
 }
 
-static const ahd_reg_parse_entry_t CCSCBCTL_parse_table[] = {
+static const aic_reg_parse_entry_t CCSCBCTL_parse_table[] = {
 	{ "CCSCBRESET",		0x01, 0x01 },
 	{ "CCSCBDIR",		0x04, 0x04 },
 	{ "CCSCBEN",		0x08, 0x08 },
@@ -552,14 +552,14 @@ static const ahd_reg_parse_entry_t CCSCBCTL_parse_table[] = {
 	{ "CCSCBDONE",		0x80, 0x80 }
 };
 
-int
-ahd_ccscbctl_print(u_int regvalue, u_int *cur_col, u_int wrap)
+void
+ahd_ccscbctl_print(u_int regvalue, struct aic_dump_buffer *buf)
 {
-	return (ahd_print_register(CCSCBCTL_parse_table, 6, "CCSCBCTL",
-	    0xad, regvalue, cur_col, wrap));
+	aic_print_register(CCSCBCTL_parse_table, 6, "CCSCBCTL",
+			   0xad, regvalue, buf);
 }
 
-static const ahd_reg_parse_entry_t CCSGCTL_parse_table[] = {
+static const aic_reg_parse_entry_t CCSGCTL_parse_table[] = {
 	{ "CCSGRESET",		0x01, 0x01 },
 	{ "SG_FETCH_REQ",	0x02, 0x02 },
 	{ "CCSGENACK",		0x08, 0x08 },
@@ -568,14 +568,14 @@ static const ahd_reg_parse_entry_t CCSGCTL_parse_table[] = {
 	{ "CCSGEN",		0x0c, 0x0c }
 };
 
-int
-ahd_ccsgctl_print(u_int regvalue, u_int *cur_col, u_int wrap)
+void
+ahd_ccsgctl_print(u_int regvalue, struct aic_dump_buffer *buf)
 {
-	return (ahd_print_register(CCSGCTL_parse_table, 6, "CCSGCTL",
-	    0xad, regvalue, cur_col, wrap));
+	aic_print_register(CCSGCTL_parse_table, 6, "CCSGCTL",
+			   0xad, regvalue, buf);
 }
 
-static const ahd_reg_parse_entry_t SEQCTL0_parse_table[] = {
+static const aic_reg_parse_entry_t SEQCTL0_parse_table[] = {
 	{ "LOADRAM",		0x01, 0x01 },
 	{ "SEQRESET",		0x02, 0x02 },
 	{ "STEP",		0x04, 0x04 },
@@ -586,14 +586,14 @@ static const ahd_reg_parse_entry_t SEQCTL0_parse_table[] = {
 	{ "PERRORDIS",		0x80, 0x80 }
 };
 
-int
-ahd_seqctl0_print(u_int regvalue, u_int *cur_col, u_int wrap)
+void
+ahd_seqctl0_print(u_int regvalue, struct aic_dump_buffer *buf)
 {
-	return (ahd_print_register(SEQCTL0_parse_table, 8, "SEQCTL0",
-	    0xd6, regvalue, cur_col, wrap));
+	aic_print_register(SEQCTL0_parse_table, 8, "SEQCTL0",
+			   0xd6, regvalue, buf);
 }
 
-static const ahd_reg_parse_entry_t SEQINTCTL_parse_table[] = {
+static const aic_reg_parse_entry_t SEQINTCTL_parse_table[] = {
 	{ "IRET",		0x01, 0x01 },
 	{ "INTMASK1",		0x02, 0x02 },
 	{ "INTMASK2",		0x04, 0x04 },
@@ -603,42 +603,42 @@ static const ahd_reg_parse_entry_t SEQINTCTL_parse_table[] = {
 	{ "INTVEC1DSL",		0x80, 0x80 }
 };
 
-int
-ahd_seqintctl_print(u_int regvalue, u_int *cur_col, u_int wrap)
+void
+ahd_seqintctl_print(u_int regvalue, struct aic_dump_buffer *buf)
 {
-	return (ahd_print_register(SEQINTCTL_parse_table, 7, "SEQINTCTL",
-	    0xd9, regvalue, cur_col, wrap));
+	aic_print_register(SEQINTCTL_parse_table, 7, "SEQINTCTL",
+			   0xd9, regvalue, buf);
 }
 
-int
-ahd_sram_base_print(u_int regvalue, u_int *cur_col, u_int wrap)
+void
+ahd_sram_base_print(u_int regvalue, struct aic_dump_buffer *buf)
 {
-	return (ahd_print_register(NULL, 0, "SRAM_BASE",
-	    0x100, regvalue, cur_col, wrap));
+	aic_print_register(NULL, 0, "SRAM_BASE",
+			   0x100, regvalue, buf);
 }
 
-int
-ahd_qfreeze_count_print(u_int regvalue, u_int *cur_col, u_int wrap)
+void
+ahd_qfreeze_count_print(u_int regvalue, struct aic_dump_buffer *buf)
 {
-	return (ahd_print_register(NULL, 0, "QFREEZE_COUNT",
-	    0x132, regvalue, cur_col, wrap));
+	aic_print_register(NULL, 0, "QFREEZE_COUNT",
+			   0x132, regvalue, buf);
 }
 
-int
-ahd_kernel_qfreeze_count_print(u_int regvalue, u_int *cur_col, u_int wrap)
+void
+ahd_kernel_qfreeze_count_print(u_int regvalue, struct aic_dump_buffer *buf)
 {
-	return (ahd_print_register(NULL, 0, "KERNEL_QFREEZE_COUNT",
-	    0x134, regvalue, cur_col, wrap));
+	aic_print_register(NULL, 0, "KERNEL_QFREEZE_COUNT",
+			   0x134, regvalue, buf);
 }
 
-int
-ahd_saved_mode_print(u_int regvalue, u_int *cur_col, u_int wrap)
+void
+ahd_saved_mode_print(u_int regvalue, struct aic_dump_buffer *buf)
 {
-	return (ahd_print_register(NULL, 0, "SAVED_MODE",
-	    0x136, regvalue, cur_col, wrap));
+	aic_print_register(NULL, 0, "SAVED_MODE",
+			   0x136, regvalue, buf);
 }
 
-static const ahd_reg_parse_entry_t SEQ_FLAGS_parse_table[] = {
+static const aic_reg_parse_entry_t SEQ_FLAGS_parse_table[] = {
 	{ "NO_DISCONNECT",	0x01, 0x01 },
 	{ "SPHASE_PENDING",	0x02, 0x02 },
 	{ "DPHASE_PENDING",	0x04, 0x04 },
@@ -650,14 +650,14 @@ static const ahd_reg_parse_entry_t SEQ_FLAGS_parse_table[] = {
 	{ "NOT_IDENTIFIED",	0x80, 0x80 }
 };
 
-int
-ahd_seq_flags_print(u_int regvalue, u_int *cur_col, u_int wrap)
+void
+ahd_seq_flags_print(u_int regvalue, struct aic_dump_buffer *buf)
 {
-	return (ahd_print_register(SEQ_FLAGS_parse_table, 9, "SEQ_FLAGS",
-	    0x139, regvalue, cur_col, wrap));
+	aic_print_register(SEQ_FLAGS_parse_table, 9, "SEQ_FLAGS",
+			   0x139, regvalue, buf);
 }
 
-static const ahd_reg_parse_entry_t LASTPHASE_parse_table[] = {
+static const aic_reg_parse_entry_t LASTPHASE_parse_table[] = {
 	{ "P_DATAOUT",		0x00, 0xe0 },
 	{ "P_DATAOUT_DT",	0x20, 0xe0 },
 	{ "P_DATAIN",		0x40, 0xe0 },
@@ -673,48 +673,48 @@ static const ahd_reg_parse_entry_t LASTPHASE_parse_table[] = {
 	{ "PHASE_MASK",		0xe0, 0xe0 }
 };
 
-int
-ahd_lastphase_print(u_int regvalue, u_int *cur_col, u_int wrap)
+void
+ahd_lastphase_print(u_int regvalue, struct aic_dump_buffer *buf)
 {
-	return (ahd_print_register(LASTPHASE_parse_table, 13, "LASTPHASE",
-	    0x13c, regvalue, cur_col, wrap));
+	aic_print_register(LASTPHASE_parse_table, 13, "LASTPHASE",
+			   0x13c, regvalue, buf);
 }
 
-static const ahd_reg_parse_entry_t SEQ_FLAGS2_parse_table[] = {
+static const aic_reg_parse_entry_t SEQ_FLAGS2_parse_table[] = {
 	{ "PENDING_MK_MESSAGE",	0x01, 0x01 },
 	{ "TARGET_MSG_PENDING",	0x02, 0x02 },
 	{ "SELECTOUT_QFROZEN",	0x04, 0x04 }
 };
 
-int
-ahd_seq_flags2_print(u_int regvalue, u_int *cur_col, u_int wrap)
+void
+ahd_seq_flags2_print(u_int regvalue, struct aic_dump_buffer *buf)
 {
-	return (ahd_print_register(SEQ_FLAGS2_parse_table, 3, "SEQ_FLAGS2",
-	    0x14d, regvalue, cur_col, wrap));
+	aic_print_register(SEQ_FLAGS2_parse_table, 3, "SEQ_FLAGS2",
+			   0x14d, regvalue, buf);
 }
 
-int
-ahd_mk_message_scb_print(u_int regvalue, u_int *cur_col, u_int wrap)
+void
+ahd_mk_message_scb_print(u_int regvalue, struct aic_dump_buffer *buf)
 {
-	return (ahd_print_register(NULL, 0, "MK_MESSAGE_SCB",
-	    0x160, regvalue, cur_col, wrap));
+	aic_print_register(NULL, 0, "MK_MESSAGE_SCB",
+			   0x160, regvalue, buf);
 }
 
-int
-ahd_mk_message_scsiid_print(u_int regvalue, u_int *cur_col, u_int wrap)
+void
+ahd_mk_message_scsiid_print(u_int regvalue, struct aic_dump_buffer *buf)
 {
-	return (ahd_print_register(NULL, 0, "MK_MESSAGE_SCSIID",
-	    0x162, regvalue, cur_col, wrap));
+	aic_print_register(NULL, 0, "MK_MESSAGE_SCSIID",
+			   0x162, regvalue, buf);
 }
 
-int
-ahd_scb_base_print(u_int regvalue, u_int *cur_col, u_int wrap)
+void
+ahd_scb_base_print(u_int regvalue, struct aic_dump_buffer *buf)
 {
-	return (ahd_print_register(NULL, 0, "SCB_BASE",
-	    0x180, regvalue, cur_col, wrap));
+	aic_print_register(NULL, 0, "SCB_BASE",
+			   0x180, regvalue, buf);
 }
 
-static const ahd_reg_parse_entry_t SCB_CONTROL_parse_table[] = {
+static const aic_reg_parse_entry_t SCB_CONTROL_parse_table[] = {
 	{ "SCB_TAG_TYPE",	0x03, 0x03 },
 	{ "DISCONNECTED",	0x04, 0x04 },
 	{ "STATUS_RCVD",	0x08, 0x08 },
@@ -724,22 +724,22 @@ static const ahd_reg_parse_entry_t SCB_CONTROL_parse_table[] = {
 	{ "TARGET_SCB",		0x80, 0x80 }
 };
 
-int
-ahd_scb_control_print(u_int regvalue, u_int *cur_col, u_int wrap)
+void
+ahd_scb_control_print(u_int regvalue, struct aic_dump_buffer *buf)
 {
-	return (ahd_print_register(SCB_CONTROL_parse_table, 7, "SCB_CONTROL",
-	    0x192, regvalue, cur_col, wrap));
+	aic_print_register(SCB_CONTROL_parse_table, 7, "SCB_CONTROL",
+			   0x192, regvalue, buf);
 }
 
-static const ahd_reg_parse_entry_t SCB_SCSIID_parse_table[] = {
+static const aic_reg_parse_entry_t SCB_SCSIID_parse_table[] = {
 	{ "OID",		0x0f, 0x0f },
 	{ "TID",		0xf0, 0xf0 }
 };
 
-int
-ahd_scb_scsiid_print(u_int regvalue, u_int *cur_col, u_int wrap)
+void
+ahd_scb_scsiid_print(u_int regvalue, struct aic_dump_buffer *buf)
 {
-	return (ahd_print_register(SCB_SCSIID_parse_table, 2, "SCB_SCSIID",
-	    0x193, regvalue, cur_col, wrap));
+	aic_print_register(SCB_SCSIID_parse_table, 2, "SCB_SCSIID",
+			   0x193, regvalue, buf);
 }
 
diff --git a/drivers/scsi/aic7xxx/aic7xxx.h b/drivers/scsi/aic7xxx/aic7xxx.h
index 4ce4e903a759..bdf902a3b7be 100644
--- a/drivers/scsi/aic7xxx/aic7xxx.h
+++ b/drivers/scsi/aic7xxx/aic7xxx.h
@@ -1270,13 +1270,6 @@ extern uint32_t ahc_debug;
 void			ahc_print_devinfo(struct ahc_softc *ahc,
 					  struct ahc_devinfo *dev);
 void			ahc_dump_card_state(struct ahc_softc *ahc);
-int			ahc_print_register(const ahc_reg_parse_entry_t *table,
-					   u_int num_entries,
-					   const char *name,
-					   u_int address,
-					   u_int value,
-					   u_int *cur_column,
-					   u_int wrap_point);
 /******************************* SEEPROM *************************************/
 int		ahc_acquire_seeprom(struct ahc_softc *ahc,
 				    struct seeprom_descriptor *sd);
diff --git a/drivers/scsi/aic7xxx/aic7xxx_core.c b/drivers/scsi/aic7xxx/aic7xxx_core.c
index 381846164003..b0e66707fef7 100644
--- a/drivers/scsi/aic7xxx/aic7xxx_core.c
+++ b/drivers/scsi/aic7xxx/aic7xxx_core.c
@@ -7116,60 +7116,12 @@ ahc_download_instr(struct ahc_softc *ahc, u_int instrptr, uint8_t *dconsts)
 	}
 }
 
-int
-ahc_print_register(const ahc_reg_parse_entry_t *table, u_int num_entries,
-		   const char *name, u_int address, u_int value,
-		   u_int *cur_column, u_int wrap_point)
-{
-	int	printed;
-	u_int	printed_mask;
-
-	if (cur_column != NULL && *cur_column >= wrap_point) {
-		printk("\n");
-		*cur_column = 0;
-	}
-	printed  = printk("%s[0x%x]", name, value);
-	if (table == NULL) {
-		printed += printk(" ");
-		*cur_column += printed;
-		return (printed);
-	}
-	printed_mask = 0;
-	while (printed_mask != 0xFF) {
-		int entry;
-
-		for (entry = 0; entry < num_entries; entry++) {
-			if (((value & table[entry].mask)
-			  != table[entry].value)
-			 || ((printed_mask & table[entry].mask)
-			  == table[entry].mask))
-				continue;
-
-			printed += printk("%s%s",
-					  printed_mask == 0 ? ":(" : "|",
-					  table[entry].name);
-			printed_mask |= table[entry].mask;
-			
-			break;
-		}
-		if (entry >= num_entries)
-			break;
-	}
-	if (printed_mask != 0)
-		printed += printk(") ");
-	else
-		printed += printk(" ");
-	if (cur_column != NULL)
-		*cur_column += printed;
-	return (printed);
-}
-
 void
 ahc_dump_card_state(struct ahc_softc *ahc)
 {
+	struct aic_dump_buffer buf;
 	struct	scb *scb;
 	struct	scb_tailq *untagged_q;
-	u_int	cur_col;
 	int	paused;
 	int	target;
 	int	maxtarget;
@@ -7201,37 +7153,39 @@ ahc_dump_card_state(struct ahc_softc *ahc)
 	       ahc_inb(ahc, ARG_2));
 	printk("HCNT = 0x%x SCBPTR = 0x%x\n", ahc_inb(ahc, HCNT),
 	       ahc_inb(ahc, SCBPTR));
-	cur_col = 0;
+
+	aic_printbuf_init(&buf, 60);
 	if ((ahc->features & AHC_DT) != 0)
-		ahc_scsiphase_print(ahc_inb(ahc, SCSIPHASE), &cur_col, 50);
-	ahc_scsisigi_print(ahc_inb(ahc, SCSISIGI), &cur_col, 50);
-	ahc_error_print(ahc_inb(ahc, ERROR), &cur_col, 50);
-	ahc_scsibusl_print(ahc_inb(ahc, SCSIBUSL), &cur_col, 50);
-	ahc_lastphase_print(ahc_inb(ahc, LASTPHASE), &cur_col, 50);
-	ahc_scsiseq_print(ahc_inb(ahc, SCSISEQ), &cur_col, 50);
-	ahc_sblkctl_print(ahc_inb(ahc, SBLKCTL), &cur_col, 50);
-	ahc_scsirate_print(ahc_inb(ahc, SCSIRATE), &cur_col, 50);
-	ahc_seqctl_print(ahc_inb(ahc, SEQCTL), &cur_col, 50);
-	ahc_seq_flags_print(ahc_inb(ahc, SEQ_FLAGS), &cur_col, 50);
-	ahc_sstat0_print(ahc_inb(ahc, SSTAT0), &cur_col, 50);
-	ahc_sstat1_print(ahc_inb(ahc, SSTAT1), &cur_col, 50);
-	ahc_sstat2_print(ahc_inb(ahc, SSTAT2), &cur_col, 50);
-	ahc_sstat3_print(ahc_inb(ahc, SSTAT3), &cur_col, 50);
-	ahc_simode0_print(ahc_inb(ahc, SIMODE0), &cur_col, 50);
-	ahc_simode1_print(ahc_inb(ahc, SIMODE1), &cur_col, 50);
-	ahc_sxfrctl0_print(ahc_inb(ahc, SXFRCTL0), &cur_col, 50);
-	ahc_dfcntrl_print(ahc_inb(ahc, DFCNTRL), &cur_col, 50);
-	ahc_dfstatus_print(ahc_inb(ahc, DFSTATUS), &cur_col, 50);
-	if (cur_col != 0)
-		printk("\n");
-	printk("STACK:");
+		ahc_scsiphase_print(ahc_inb(ahc, SCSIPHASE), &buf);
+	ahc_scsisigi_print(ahc_inb(ahc, SCSISIGI), &buf);
+	ahc_error_print(ahc_inb(ahc, ERROR), &buf);
+	ahc_scsibusl_print(ahc_inb(ahc, SCSIBUSL), &buf);
+	ahc_lastphase_print(ahc_inb(ahc, LASTPHASE), &buf);
+	ahc_scsiseq_print(ahc_inb(ahc, SCSISEQ), &buf);
+	ahc_sblkctl_print(ahc_inb(ahc, SBLKCTL), &buf);
+	ahc_scsirate_print(ahc_inb(ahc, SCSIRATE), &buf);
+	ahc_seqctl_print(ahc_inb(ahc, SEQCTL), &buf);
+	ahc_seq_flags_print(ahc_inb(ahc, SEQ_FLAGS), &buf);
+	ahc_sstat0_print(ahc_inb(ahc, SSTAT0), &buf);
+	ahc_sstat1_print(ahc_inb(ahc, SSTAT1), &buf);
+	ahc_sstat2_print(ahc_inb(ahc, SSTAT2), &buf);
+	ahc_sstat3_print(ahc_inb(ahc, SSTAT3), &buf);
+	ahc_simode0_print(ahc_inb(ahc, SIMODE0), &buf);
+	ahc_simode1_print(ahc_inb(ahc, SIMODE1), &buf);
+	ahc_sxfrctl0_print(ahc_inb(ahc, SXFRCTL0), &buf);
+	ahc_dfcntrl_print(ahc_inb(ahc, DFCNTRL), &buf);
+	ahc_dfstatus_print(ahc_inb(ahc, DFSTATUS), &buf);
+	aic_printbuf_finish(&buf);
+	aic_printbuf_push(&buf, "STACK:");
 	for (i = 0; i < STACK_SIZE; i++)
-		printk(" 0x%x", ahc_inb(ahc, STACK)|(ahc_inb(ahc, STACK) << 8));
+		aic_printbuf_push(&buf, " 0x%x",
+				  ahc_inb(ahc, STACK)|(ahc_inb(ahc, STACK) << 8));
+	aic_printbuf_finish(&buf);
 	printk("\nSCB count = %d\n", ahc->scb_data->numscbs);
 	printk("Kernel NEXTQSCB = %d\n", ahc->next_queued_scb->hscb->tag);
 	printk("Card NEXTQSCB = %d\n", ahc_inb(ahc, NEXT_QUEUED_SCB));
 	/* QINFIFO */
-	printk("QINFIFO entries: ");
+	aic_printbuf_push(&buf, "QINFIFO entries: ");
 	if ((ahc->features & AHC_QUEUE_REGS) != 0) {
 		qinpos = ahc_inb(ahc, SNSCB_QOFF);
 		ahc_outb(ahc, SNSCB_QOFF, qinpos);
@@ -7239,105 +7193,104 @@ ahc_dump_card_state(struct ahc_softc *ahc)
 		qinpos = ahc_inb(ahc, QINPOS);
 	qintail = ahc->qinfifonext;
 	while (qinpos != qintail) {
-		printk("%d ", ahc->qinfifo[qinpos]);
+		aic_printbuf_push(&buf, "%d ", ahc->qinfifo[qinpos]);
 		qinpos++;
 	}
-	printk("\n");
+	aic_printbuf_finish(&buf);
 
-	printk("Waiting Queue entries: ");
+	aic_printbuf_push(&buf, "Waiting Queue entries: ");
 	scb_index = ahc_inb(ahc, WAITING_SCBH);
 	i = 0;
 	while (scb_index != SCB_LIST_NULL && i++ < 256) {
 		ahc_outb(ahc, SCBPTR, scb_index);
-		printk("%d:%d ", scb_index, ahc_inb(ahc, SCB_TAG));
+		aic_printbuf_push(&buf, "%d:%d ", scb_index,
+				  ahc_inb(ahc, SCB_TAG));
 		scb_index = ahc_inb(ahc, SCB_NEXT);
 	}
-	printk("\n");
+	aic_printbuf_finish(&buf);
 
-	printk("Disconnected Queue entries: ");
+	aic_printbuf_push(&buf, "Disconnected Queue entries: ");
 	scb_index = ahc_inb(ahc, DISCONNECTED_SCBH);
 	i = 0;
 	while (scb_index != SCB_LIST_NULL && i++ < 256) {
 		ahc_outb(ahc, SCBPTR, scb_index);
-		printk("%d:%d ", scb_index, ahc_inb(ahc, SCB_TAG));
+		aic_printbuf_push(&buf, "%d:%d ", scb_index, ahc_inb(ahc, SCB_TAG));
 		scb_index = ahc_inb(ahc, SCB_NEXT);
 	}
-	printk("\n");
-		
+	aic_printbuf_finish(&buf);
+
 	ahc_sync_qoutfifo(ahc, BUS_DMASYNC_POSTREAD);
-	printk("QOUTFIFO entries: ");
+	aic_printbuf_push(&buf, "QOUTFIFO entries: ");
 	qoutpos = ahc->qoutfifonext;
 	i = 0;
 	while (ahc->qoutfifo[qoutpos] != SCB_LIST_NULL && i++ < 256) {
-		printk("%d ", ahc->qoutfifo[qoutpos]);
+		aic_printbuf_push(&buf, "%d ", ahc->qoutfifo[qoutpos]);
 		qoutpos++;
 	}
-	printk("\n");
+	aic_printbuf_finish(&buf);
 
-	printk("Sequencer Free SCB List: ");
+	aic_printbuf_push(&buf, "Sequencer Free SCB List: ");
 	scb_index = ahc_inb(ahc, FREE_SCBH);
 	i = 0;
 	while (scb_index != SCB_LIST_NULL && i++ < 256) {
 		ahc_outb(ahc, SCBPTR, scb_index);
-		printk("%d ", scb_index);
+		aic_printbuf_push(&buf, "%d ", scb_index);
 		scb_index = ahc_inb(ahc, SCB_NEXT);
 	}
-	printk("\n");
+	aic_printbuf_finish(&buf);
 
-	printk("Sequencer SCB Info: ");
+	printk("Sequencer SCB Info:\n");
 	for (i = 0; i < ahc->scb_data->maxhscbs; i++) {
 		ahc_outb(ahc, SCBPTR, i);
-		cur_col  = printk("\n%3d ", i);
-
-		ahc_scb_control_print(ahc_inb(ahc, SCB_CONTROL), &cur_col, 60);
-		ahc_scb_scsiid_print(ahc_inb(ahc, SCB_SCSIID), &cur_col, 60);
-		ahc_scb_lun_print(ahc_inb(ahc, SCB_LUN), &cur_col, 60);
-		ahc_scb_tag_print(ahc_inb(ahc, SCB_TAG), &cur_col, 60);
+		aic_printbuf_push(&buf, "%3d ", i);
+		ahc_scb_control_print(ahc_inb(ahc, SCB_CONTROL), &buf);
+		ahc_scb_scsiid_print(ahc_inb(ahc, SCB_SCSIID), &buf);
+		ahc_scb_lun_print(ahc_inb(ahc, SCB_LUN), &buf);
+		ahc_scb_tag_print(ahc_inb(ahc, SCB_TAG), &buf);
+		aic_printbuf_finish(&buf);
 	}
-	printk("\n");
 
-	printk("Pending list: ");
+	printk("Pending list:\n");
 	i = 0;
 	LIST_FOREACH(scb, &ahc->pending_scbs, pending_links) {
 		if (i++ > 256)
 			break;
-		cur_col  = printk("\n%3d ", scb->hscb->tag);
-		ahc_scb_control_print(scb->hscb->control, &cur_col, 60);
-		ahc_scb_scsiid_print(scb->hscb->scsiid, &cur_col, 60);
-		ahc_scb_lun_print(scb->hscb->lun, &cur_col, 60);
+		aic_printbuf_push(&buf, "%3d ", scb->hscb->tag);
+		ahc_scb_control_print(scb->hscb->control, &buf);
+		ahc_scb_scsiid_print(scb->hscb->scsiid, &buf);
+		ahc_scb_lun_print(scb->hscb->lun, &buf);
 		if ((ahc->flags & AHC_PAGESCBS) == 0) {
 			ahc_outb(ahc, SCBPTR, scb->hscb->tag);
-			printk("(");
-			ahc_scb_control_print(ahc_inb(ahc, SCB_CONTROL),
-					      &cur_col, 60);
-			ahc_scb_tag_print(ahc_inb(ahc, SCB_TAG), &cur_col, 60);
-			printk(")");
+			aic_printbuf_push(&buf, "(");
+			ahc_scb_control_print(ahc_inb(ahc, SCB_CONTROL), &buf);
+			ahc_scb_tag_print(ahc_inb(ahc, SCB_TAG), &buf);
+			aic_printbuf_push(&buf, ")");
 		}
+		aic_printbuf_finish(&buf);
 	}
-	printk("\n");
 
-	printk("Kernel Free SCB list: ");
+	aic_printbuf_push(&buf, "Kernel Free SCB list: ");
 	i = 0;
 	SLIST_FOREACH(scb, &ahc->scb_data->free_scbs, links.sle) {
 		if (i++ > 256)
 			break;
-		printk("%d ", scb->hscb->tag);
+		aic_printbuf_push(&buf, "%d ", scb->hscb->tag);
 	}
-	printk("\n");
+	aic_printbuf_finish(&buf);
 
 	maxtarget = (ahc->features & (AHC_WIDE|AHC_TWIN)) ? 15 : 7;
 	for (target = 0; target <= maxtarget; target++) {
 		untagged_q = &ahc->untagged_queues[target];
 		if (TAILQ_FIRST(untagged_q) == NULL)
 			continue;
-		printk("Untagged Q(%d): ", target);
+		aic_printbuf_push(&buf, "Untagged Q(%d): ", target);
 		i = 0;
 		TAILQ_FOREACH(scb, untagged_q, links.tqe) {
 			if (i++ > 256)
 				break;
-			printk("%d ", scb->hscb->tag);
+			aic_printbuf_push(&buf, "%d ", scb->hscb->tag);
 		}
-		printk("\n");
+		aic_printbuf_finish(&buf);
 	}
 
 	printk("\n<<<<<<<<<<<<<<<<< Dump Card State Ends >>>>>>>>>>>>>>>>>>\n");
diff --git a/drivers/scsi/aic7xxx/aic7xxx_reg.h_shipped b/drivers/scsi/aic7xxx/aic7xxx_reg.h_shipped
index 473039df0ed5..44902ac70ac5 100644
--- a/drivers/scsi/aic7xxx/aic7xxx_reg.h_shipped
+++ b/drivers/scsi/aic7xxx/aic7xxx_reg.h_shipped
@@ -5,186 +5,179 @@
  * $Id: //depot/aic7xxx/aic7xxx/aic7xxx.seq#58 $
  * $Id: //depot/aic7xxx/aic7xxx/aic7xxx.reg#40 $
  */
-typedef int (ahc_reg_print_t)(u_int, u_int *, u_int);
-typedef struct ahc_reg_parse_entry {
-	char	*name;
-	uint8_t	 value;
-	uint8_t	 mask;
-} ahc_reg_parse_entry_t;
-
 #if AIC_DEBUG_REGISTERS
-ahc_reg_print_t ahc_scsiseq_print;
+aic_reg_print_t ahc_scsiseq_print;
 #else
-#define ahc_scsiseq_print(regvalue, cur_col, wrap) \
-    ahc_print_register(NULL, 0, "SCSISEQ", 0x00, regvalue, cur_col, wrap)
+#define ahc_scsiseq_print(regvalue, buf) \
+    aic_print_register(NULL, 0, "SCSISEQ", 0x00, regvalue, buf)
 #endif
 
 #if AIC_DEBUG_REGISTERS
-ahc_reg_print_t ahc_sxfrctl0_print;
+aic_reg_print_t ahc_sxfrctl0_print;
 #else
-#define ahc_sxfrctl0_print(regvalue, cur_col, wrap) \
-    ahc_print_register(NULL, 0, "SXFRCTL0", 0x01, regvalue, cur_col, wrap)
+#define ahc_sxfrctl0_print(regvalue, buf) \
+    aic_print_register(NULL, 0, "SXFRCTL0", 0x01, regvalue, buf)
 #endif
 
 #if AIC_DEBUG_REGISTERS
-ahc_reg_print_t ahc_scsisigi_print;
+aic_reg_print_t ahc_scsisigi_print;
 #else
-#define ahc_scsisigi_print(regvalue, cur_col, wrap) \
-    ahc_print_register(NULL, 0, "SCSISIGI", 0x03, regvalue, cur_col, wrap)
+#define ahc_scsisigi_print(regvalue, buf) \
+    aic_print_register(NULL, 0, "SCSISIGI", 0x03, regvalue, buf)
 #endif
 
 #if AIC_DEBUG_REGISTERS
-ahc_reg_print_t ahc_scsirate_print;
+aic_reg_print_t ahc_scsirate_print;
 #else
-#define ahc_scsirate_print(regvalue, cur_col, wrap) \
-    ahc_print_register(NULL, 0, "SCSIRATE", 0x04, regvalue, cur_col, wrap)
+#define ahc_scsirate_print(regvalue, buf) \
+    aic_print_register(NULL, 0, "SCSIRATE", 0x04, regvalue, buf)
 #endif
 
 #if AIC_DEBUG_REGISTERS
-ahc_reg_print_t ahc_sstat0_print;
+aic_reg_print_t ahc_sstat0_print;
 #else
-#define ahc_sstat0_print(regvalue, cur_col, wrap) \
-    ahc_print_register(NULL, 0, "SSTAT0", 0x0b, regvalue, cur_col, wrap)
+#define ahc_sstat0_print(regvalue, buf) \
+    aic_print_register(NULL, 0, "SSTAT0", 0x0b, regvalue, buf)
 #endif
 
 #if AIC_DEBUG_REGISTERS
-ahc_reg_print_t ahc_sstat1_print;
+aic_reg_print_t ahc_sstat1_print;
 #else
-#define ahc_sstat1_print(regvalue, cur_col, wrap) \
-    ahc_print_register(NULL, 0, "SSTAT1", 0x0c, regvalue, cur_col, wrap)
+#define ahc_sstat1_print(regvalue, buf) \
+    aic_print_register(NULL, 0, "SSTAT1", 0x0c, regvalue, buf)
 #endif
 
 #if AIC_DEBUG_REGISTERS
-ahc_reg_print_t ahc_sstat2_print;
+aic_reg_print_t ahc_sstat2_print;
 #else
-#define ahc_sstat2_print(regvalue, cur_col, wrap) \
-    ahc_print_register(NULL, 0, "SSTAT2", 0x0d, regvalue, cur_col, wrap)
+#define ahc_sstat2_print(regvalue, buf) \
+    aic_print_register(NULL, 0, "SSTAT2", 0x0d, regvalue, buf)
 #endif
 
 #if AIC_DEBUG_REGISTERS
-ahc_reg_print_t ahc_sstat3_print;
+aic_reg_print_t ahc_sstat3_print;
 #else
-#define ahc_sstat3_print(regvalue, cur_col, wrap) \
-    ahc_print_register(NULL, 0, "SSTAT3", 0x0e, regvalue, cur_col, wrap)
+#define ahc_sstat3_print(regvalue, buf) \
+    aic_print_register(NULL, 0, "SSTAT3", 0x0e, regvalue, buf)
 #endif
 
 #if AIC_DEBUG_REGISTERS
-ahc_reg_print_t ahc_simode0_print;
+aic_reg_print_t ahc_simode0_print;
 #else
-#define ahc_simode0_print(regvalue, cur_col, wrap) \
-    ahc_print_register(NULL, 0, "SIMODE0", 0x10, regvalue, cur_col, wrap)
+#define ahc_simode0_print(regvalue, buf) \
+    aic_print_register(NULL, 0, "SIMODE0", 0x10, regvalue, buf)
 #endif
 
 #if AIC_DEBUG_REGISTERS
-ahc_reg_print_t ahc_simode1_print;
+aic_reg_print_t ahc_simode1_print;
 #else
-#define ahc_simode1_print(regvalue, cur_col, wrap) \
-    ahc_print_register(NULL, 0, "SIMODE1", 0x11, regvalue, cur_col, wrap)
+#define ahc_simode1_print(regvalue, buf) \
+    aic_print_register(NULL, 0, "SIMODE1", 0x11, regvalue, buf)
 #endif
 
 #if AIC_DEBUG_REGISTERS
-ahc_reg_print_t ahc_scsibusl_print;
+aic_reg_print_t ahc_scsibusl_print;
 #else
-#define ahc_scsibusl_print(regvalue, cur_col, wrap) \
-    ahc_print_register(NULL, 0, "SCSIBUSL", 0x12, regvalue, cur_col, wrap)
+#define ahc_scsibusl_print(regvalue, buf) \
+    aic_print_register(NULL, 0, "SCSIBUSL", 0x12, regvalue, buf)
 #endif
 
 #if AIC_DEBUG_REGISTERS
-ahc_reg_print_t ahc_sblkctl_print;
+aic_reg_print_t ahc_sblkctl_print;
 #else
-#define ahc_sblkctl_print(regvalue, cur_col, wrap) \
-    ahc_print_register(NULL, 0, "SBLKCTL", 0x1f, regvalue, cur_col, wrap)
+#define ahc_sblkctl_print(regvalue, buf) \
+    aic_print_register(NULL, 0, "SBLKCTL", 0x1f, regvalue, buf)
 #endif
 
 #if AIC_DEBUG_REGISTERS
-ahc_reg_print_t ahc_seq_flags_print;
+aic_reg_print_t ahc_seq_flags_print;
 #else
-#define ahc_seq_flags_print(regvalue, cur_col, wrap) \
-    ahc_print_register(NULL, 0, "SEQ_FLAGS", 0x3c, regvalue, cur_col, wrap)
+#define ahc_seq_flags_print(regvalue, buf) \
+    aic_print_register(NULL, 0, "SEQ_FLAGS", 0x3c, regvalue, buf)
 #endif
 
 #if AIC_DEBUG_REGISTERS
-ahc_reg_print_t ahc_lastphase_print;
+aic_reg_print_t ahc_lastphase_print;
 #else
-#define ahc_lastphase_print(regvalue, cur_col, wrap) \
-    ahc_print_register(NULL, 0, "LASTPHASE", 0x3f, regvalue, cur_col, wrap)
+#define ahc_lastphase_print(regvalue, buf) \
+    aic_print_register(NULL, 0, "LASTPHASE", 0x3f, regvalue, buf)
 #endif
 
 #if AIC_DEBUG_REGISTERS
-ahc_reg_print_t ahc_seqctl_print;
+aic_reg_print_t ahc_seqctl_print;
 #else
-#define ahc_seqctl_print(regvalue, cur_col, wrap) \
-    ahc_print_register(NULL, 0, "SEQCTL", 0x60, regvalue, cur_col, wrap)
+#define ahc_seqctl_print(regvalue, buf) \
+    aic_print_register(NULL, 0, "SEQCTL", 0x60, regvalue, buf)
 #endif
 
 #if AIC_DEBUG_REGISTERS
-ahc_reg_print_t ahc_sram_base_print;
+aic_reg_print_t ahc_sram_base_print;
 #else
-#define ahc_sram_base_print(regvalue, cur_col, wrap) \
-    ahc_print_register(NULL, 0, "SRAM_BASE", 0x70, regvalue, cur_col, wrap)
+#define ahc_sram_base_print(regvalue, buf) \
+    aic_print_register(NULL, 0, "SRAM_BASE", 0x70, regvalue, buf)
 #endif
 
 #if AIC_DEBUG_REGISTERS
-ahc_reg_print_t ahc_error_print;
+aic_reg_print_t ahc_error_print;
 #else
-#define ahc_error_print(regvalue, cur_col, wrap) \
-    ahc_print_register(NULL, 0, "ERROR", 0x92, regvalue, cur_col, wrap)
+#define ahc_error_print(regvalue, buf) \
+    aic_print_register(NULL, 0, "ERROR", 0x92, regvalue, buf)
 #endif
 
 #if AIC_DEBUG_REGISTERS
-ahc_reg_print_t ahc_dfcntrl_print;
+aic_reg_print_t ahc_dfcntrl_print;
 #else
-#define ahc_dfcntrl_print(regvalue, cur_col, wrap) \
-    ahc_print_register(NULL, 0, "DFCNTRL", 0x93, regvalue, cur_col, wrap)
+#define ahc_dfcntrl_print(regvalue, buf) \
+    aic_print_register(NULL, 0, "DFCNTRL", 0x93, regvalue, buf)
 #endif
 
 #if AIC_DEBUG_REGISTERS
-ahc_reg_print_t ahc_dfstatus_print;
+aic_reg_print_t ahc_dfstatus_print;
 #else
-#define ahc_dfstatus_print(regvalue, cur_col, wrap) \
-    ahc_print_register(NULL, 0, "DFSTATUS", 0x94, regvalue, cur_col, wrap)
+#define ahc_dfstatus_print(regvalue, buf) \
+    aic_print_register(NULL, 0, "DFSTATUS", 0x94, regvalue, buf)
 #endif
 
 #if AIC_DEBUG_REGISTERS
-ahc_reg_print_t ahc_scsiphase_print;
+aic_reg_print_t ahc_scsiphase_print;
 #else
-#define ahc_scsiphase_print(regvalue, cur_col, wrap) \
-    ahc_print_register(NULL, 0, "SCSIPHASE", 0x9e, regvalue, cur_col, wrap)
+#define ahc_scsiphase_print(regvalue, buf) \
+    aic_print_register(NULL, 0, "SCSIPHASE", 0x9e, regvalue, buf)
 #endif
 
 #if AIC_DEBUG_REGISTERS
-ahc_reg_print_t ahc_scb_base_print;
+aic_reg_print_t ahc_scb_base_print;
 #else
-#define ahc_scb_base_print(regvalue, cur_col, wrap) \
-    ahc_print_register(NULL, 0, "SCB_BASE", 0xa0, regvalue, cur_col, wrap)
+#define ahc_scb_base_print(regvalue, buf) \
+    aic_print_register(NULL, 0, "SCB_BASE", 0xa0, regvalue, buf)
 #endif
 
 #if AIC_DEBUG_REGISTERS
-ahc_reg_print_t ahc_scb_control_print;
+aic_reg_print_t ahc_scb_control_print;
 #else
-#define ahc_scb_control_print(regvalue, cur_col, wrap) \
-    ahc_print_register(NULL, 0, "SCB_CONTROL", 0xb8, regvalue, cur_col, wrap)
+#define ahc_scb_control_print(regvalue, buf) \
+    aic_print_register(NULL, 0, "SCB_CONTROL", 0xb8, regvalue, buf)
 #endif
 
 #if AIC_DEBUG_REGISTERS
-ahc_reg_print_t ahc_scb_scsiid_print;
+aic_reg_print_t ahc_scb_scsiid_print;
 #else
-#define ahc_scb_scsiid_print(regvalue, cur_col, wrap) \
-    ahc_print_register(NULL, 0, "SCB_SCSIID", 0xb9, regvalue, cur_col, wrap)
+#define ahc_scb_scsiid_print(regvalue, buf) \
+    aic_print_register(NULL, 0, "SCB_SCSIID", 0xb9, regvalue, buf)
 #endif
 
 #if AIC_DEBUG_REGISTERS
-ahc_reg_print_t ahc_scb_lun_print;
+aic_reg_print_t ahc_scb_lun_print;
 #else
-#define ahc_scb_lun_print(regvalue, cur_col, wrap) \
-    ahc_print_register(NULL, 0, "SCB_LUN", 0xba, regvalue, cur_col, wrap)
+#define ahc_scb_lun_print(regvalue, buf) \
+    aic_print_register(NULL, 0, "SCB_LUN", 0xba, regvalue, buf)
 #endif
 
 #if AIC_DEBUG_REGISTERS
-ahc_reg_print_t ahc_scb_tag_print;
+aic_reg_print_t ahc_scb_tag_print;
 #else
-#define ahc_scb_tag_print(regvalue, cur_col, wrap) \
-    ahc_print_register(NULL, 0, "SCB_TAG", 0xbb, regvalue, cur_col, wrap)
+#define ahc_scb_tag_print(regvalue, buf) \
+    aic_print_register(NULL, 0, "SCB_TAG", 0xbb, regvalue, buf)
 #endif
 
 
diff --git a/drivers/scsi/aic7xxx/aic7xxx_reg_print.c_shipped b/drivers/scsi/aic7xxx/aic7xxx_reg_print.c_shipped
index 9f9b88047d0c..7e35960857c5 100644
--- a/drivers/scsi/aic7xxx/aic7xxx_reg_print.c_shipped
+++ b/drivers/scsi/aic7xxx/aic7xxx_reg_print.c_shipped
@@ -8,7 +8,7 @@
 
 #include "aic7xxx_osm.h"
 
-static const ahc_reg_parse_entry_t SCSISEQ_parse_table[] = {
+static const aic_reg_parse_entry_t SCSISEQ_parse_table[] = {
 	{ "SCSIRSTO",		0x01, 0x01 },
 	{ "ENAUTOATNP",		0x02, 0x02 },
 	{ "ENAUTOATNI",		0x04, 0x04 },
@@ -19,14 +19,14 @@ static const ahc_reg_parse_entry_t SCSISEQ_parse_table[] = {
 	{ "TEMODE",		0x80, 0x80 }
 };
 
-int
-ahc_scsiseq_print(u_int regvalue, u_int *cur_col, u_int wrap)
+void
+ahc_scsiseq_print(u_int regvalue, struct aic_dump_buffer *buf)
 {
-	return (ahc_print_register(SCSISEQ_parse_table, 8, "SCSISEQ",
-	    0x00, regvalue, cur_col, wrap));
+	aic_print_register(SCSISEQ_parse_table, 8, "SCSISEQ",
+			   0x00, regvalue, buf);
 }
 
-static const ahc_reg_parse_entry_t SXFRCTL0_parse_table[] = {
+static const aic_reg_parse_entry_t SXFRCTL0_parse_table[] = {
 	{ "CLRCHN",		0x02, 0x02 },
 	{ "SCAMEN",		0x04, 0x04 },
 	{ "SPIOEN",		0x08, 0x08 },
@@ -36,14 +36,14 @@ static const ahc_reg_parse_entry_t SXFRCTL0_parse_table[] = {
 	{ "DFON",		0x80, 0x80 }
 };
 
-int
-ahc_sxfrctl0_print(u_int regvalue, u_int *cur_col, u_int wrap)
+void
+ahc_sxfrctl0_print(u_int regvalue, struct aic_dump_buffer *buf)
 {
-	return (ahc_print_register(SXFRCTL0_parse_table, 7, "SXFRCTL0",
-	    0x01, regvalue, cur_col, wrap));
+	aic_print_register(SXFRCTL0_parse_table, 7, "SXFRCTL0",
+			   0x01, regvalue, buf);
 }
 
-static const ahc_reg_parse_entry_t SCSISIGI_parse_table[] = {
+static const aic_reg_parse_entry_t SCSISIGI_parse_table[] = {
 	{ "ACKI",		0x01, 0x01 },
 	{ "REQI",		0x02, 0x02 },
 	{ "BSYI",		0x04, 0x04 },
@@ -63,14 +63,14 @@ static const ahc_reg_parse_entry_t SCSISIGI_parse_table[] = {
 	{ "P_MESGIN",		0xe0, 0xe0 }
 };
 
-int
-ahc_scsisigi_print(u_int regvalue, u_int *cur_col, u_int wrap)
+void
+ahc_scsisigi_print(u_int regvalue, struct aic_dump_buffer *buf)
 {
-	return (ahc_print_register(SCSISIGI_parse_table, 17, "SCSISIGI",
-	    0x03, regvalue, cur_col, wrap));
+	aic_print_register(SCSISIGI_parse_table, 17, "SCSISIGI",
+			   0x03, regvalue, buf);
 }
 
-static const ahc_reg_parse_entry_t SCSIRATE_parse_table[] = {
+static const aic_reg_parse_entry_t SCSIRATE_parse_table[] = {
 	{ "SINGLE_EDGE",	0x10, 0x10 },
 	{ "ENABLE_CRC",		0x40, 0x40 },
 	{ "WIDEXFER",		0x80, 0x80 },
@@ -79,14 +79,14 @@ static const ahc_reg_parse_entry_t SCSIRATE_parse_table[] = {
 	{ "SXFR",		0x70, 0x70 }
 };
 
-int
-ahc_scsirate_print(u_int regvalue, u_int *cur_col, u_int wrap)
+void
+ahc_scsirate_print(u_int regvalue, struct aic_dump_buffer *buf)
 {
-	return (ahc_print_register(SCSIRATE_parse_table, 6, "SCSIRATE",
-	    0x04, regvalue, cur_col, wrap));
+	aic_print_register(SCSIRATE_parse_table, 6, "SCSIRATE",
+			   0x04, regvalue, buf);
 }
 
-static const ahc_reg_parse_entry_t SSTAT0_parse_table[] = {
+static const aic_reg_parse_entry_t SSTAT0_parse_table[] = {
 	{ "DMADONE",		0x01, 0x01 },
 	{ "SPIORDY",		0x02, 0x02 },
 	{ "SDONE",		0x04, 0x04 },
@@ -98,14 +98,14 @@ static const ahc_reg_parse_entry_t SSTAT0_parse_table[] = {
 	{ "TARGET",		0x80, 0x80 }
 };
 
-int
-ahc_sstat0_print(u_int regvalue, u_int *cur_col, u_int wrap)
+void
+ahc_sstat0_print(u_int regvalue, struct aic_dump_buffer *buf)
 {
-	return (ahc_print_register(SSTAT0_parse_table, 9, "SSTAT0",
-	    0x0b, regvalue, cur_col, wrap));
+	aic_print_register(SSTAT0_parse_table, 9, "SSTAT0",
+			   0x0b, regvalue, buf);
 }
 
-static const ahc_reg_parse_entry_t SSTAT1_parse_table[] = {
+static const aic_reg_parse_entry_t SSTAT1_parse_table[] = {
 	{ "REQINIT",		0x01, 0x01 },
 	{ "PHASECHG",		0x02, 0x02 },
 	{ "SCSIPERR",		0x04, 0x04 },
@@ -116,14 +116,14 @@ static const ahc_reg_parse_entry_t SSTAT1_parse_table[] = {
 	{ "SELTO",		0x80, 0x80 }
 };
 
-int
-ahc_sstat1_print(u_int regvalue, u_int *cur_col, u_int wrap)
+void
+ahc_sstat1_print(u_int regvalue, struct aic_dump_buffer *buf)
 {
-	return (ahc_print_register(SSTAT1_parse_table, 8, "SSTAT1",
-	    0x0c, regvalue, cur_col, wrap));
+	aic_print_register(SSTAT1_parse_table, 8, "SSTAT1",
+			   0x0c, regvalue, buf);
 }
 
-static const ahc_reg_parse_entry_t SSTAT2_parse_table[] = {
+static const aic_reg_parse_entry_t SSTAT2_parse_table[] = {
 	{ "DUAL_EDGE_ERR",	0x01, 0x01 },
 	{ "CRCREQERR",		0x02, 0x02 },
 	{ "CRCENDERR",		0x04, 0x04 },
@@ -134,27 +134,27 @@ static const ahc_reg_parse_entry_t SSTAT2_parse_table[] = {
 	{ "SFCNT",		0x1f, 0x1f }
 };
 
-int
-ahc_sstat2_print(u_int regvalue, u_int *cur_col, u_int wrap)
+void
+ahc_sstat2_print(u_int regvalue, struct aic_dump_buffer *buf)
 {
-	return (ahc_print_register(SSTAT2_parse_table, 8, "SSTAT2",
-	    0x0d, regvalue, cur_col, wrap));
+	aic_print_register(SSTAT2_parse_table, 8, "SSTAT2",
+			   0x0d, regvalue, buf);
 }
 
-static const ahc_reg_parse_entry_t SSTAT3_parse_table[] = {
+static const aic_reg_parse_entry_t SSTAT3_parse_table[] = {
 	{ "OFFCNT",		0x0f, 0x0f },
 	{ "U2OFFCNT",		0x7f, 0x7f },
 	{ "SCSICNT",		0xf0, 0xf0 }
 };
 
-int
-ahc_sstat3_print(u_int regvalue, u_int *cur_col, u_int wrap)
+void
+ahc_sstat3_print(u_int regvalue, struct aic_dump_buffer *buf)
 {
-	return (ahc_print_register(SSTAT3_parse_table, 3, "SSTAT3",
-	    0x0e, regvalue, cur_col, wrap));
+	aic_print_register(SSTAT3_parse_table, 3, "SSTAT3",
+			   0x0e, regvalue, buf);
 }
 
-static const ahc_reg_parse_entry_t SIMODE0_parse_table[] = {
+static const aic_reg_parse_entry_t SIMODE0_parse_table[] = {
 	{ "ENDMADONE",		0x01, 0x01 },
 	{ "ENSPIORDY",		0x02, 0x02 },
 	{ "ENSDONE",		0x04, 0x04 },
@@ -165,14 +165,14 @@ static const ahc_reg_parse_entry_t SIMODE0_parse_table[] = {
 	{ "ENSELDO",		0x40, 0x40 }
 };
 
-int
-ahc_simode0_print(u_int regvalue, u_int *cur_col, u_int wrap)
+void
+ahc_simode0_print(u_int regvalue, struct aic_dump_buffer *buf)
 {
-	return (ahc_print_register(SIMODE0_parse_table, 8, "SIMODE0",
-	    0x10, regvalue, cur_col, wrap));
+	aic_print_register(SIMODE0_parse_table, 8, "SIMODE0",
+			   0x10, regvalue, buf);
 }
 
-static const ahc_reg_parse_entry_t SIMODE1_parse_table[] = {
+static const aic_reg_parse_entry_t SIMODE1_parse_table[] = {
 	{ "ENREQINIT",		0x01, 0x01 },
 	{ "ENPHASECHG",		0x02, 0x02 },
 	{ "ENSCSIPERR",		0x04, 0x04 },
@@ -183,21 +183,21 @@ static const ahc_reg_parse_entry_t SIMODE1_parse_table[] = {
 	{ "ENSELTIMO",		0x80, 0x80 }
 };
 
-int
-ahc_simode1_print(u_int regvalue, u_int *cur_col, u_int wrap)
+void
+ahc_simode1_print(u_int regvalue, struct aic_dump_buffer *buf)
 {
-	return (ahc_print_register(SIMODE1_parse_table, 8, "SIMODE1",
-	    0x11, regvalue, cur_col, wrap));
+	aic_print_register(SIMODE1_parse_table, 8, "SIMODE1",
+			   0x11, regvalue, buf);
 }
 
-int
-ahc_scsibusl_print(u_int regvalue, u_int *cur_col, u_int wrap)
+void
+ahc_scsibusl_print(u_int regvalue, struct aic_dump_buffer *buf)
 {
-	return (ahc_print_register(NULL, 0, "SCSIBUSL",
-	    0x12, regvalue, cur_col, wrap));
+	aic_print_register(NULL, 0, "SCSIBUSL",
+			   0x12, regvalue, buf);
 }
 
-static const ahc_reg_parse_entry_t SBLKCTL_parse_table[] = {
+static const aic_reg_parse_entry_t SBLKCTL_parse_table[] = {
 	{ "XCVR",		0x01, 0x01 },
 	{ "SELWIDE",		0x02, 0x02 },
 	{ "ENAB20",		0x04, 0x04 },
@@ -208,14 +208,14 @@ static const ahc_reg_parse_entry_t SBLKCTL_parse_table[] = {
 	{ "DIAGLEDEN",		0x80, 0x80 }
 };
 
-int
-ahc_sblkctl_print(u_int regvalue, u_int *cur_col, u_int wrap)
+void
+ahc_sblkctl_print(u_int regvalue, struct aic_dump_buffer *buf)
 {
-	return (ahc_print_register(SBLKCTL_parse_table, 8, "SBLKCTL",
-	    0x1f, regvalue, cur_col, wrap));
+	aic_print_register(SBLKCTL_parse_table, 8, "SBLKCTL",
+			   0x1f, regvalue, buf);
 }
 
-static const ahc_reg_parse_entry_t SEQ_FLAGS_parse_table[] = {
+static const aic_reg_parse_entry_t SEQ_FLAGS_parse_table[] = {
 	{ "NO_DISCONNECT",	0x01, 0x01 },
 	{ "SPHASE_PENDING",	0x02, 0x02 },
 	{ "DPHASE_PENDING",	0x04, 0x04 },
@@ -227,14 +227,14 @@ static const ahc_reg_parse_entry_t SEQ_FLAGS_parse_table[] = {
 	{ "NOT_IDENTIFIED",	0x80, 0x80 }
 };
 
-int
-ahc_seq_flags_print(u_int regvalue, u_int *cur_col, u_int wrap)
+void
+ahc_seq_flags_print(u_int regvalue, struct aic_dump_buffer *buf)
 {
-	return (ahc_print_register(SEQ_FLAGS_parse_table, 9, "SEQ_FLAGS",
-	    0x3c, regvalue, cur_col, wrap));
+	aic_print_register(SEQ_FLAGS_parse_table, 9, "SEQ_FLAGS",
+			   0x3c, regvalue, buf);
 }
 
-static const ahc_reg_parse_entry_t LASTPHASE_parse_table[] = {
+static const aic_reg_parse_entry_t LASTPHASE_parse_table[] = {
 	{ "MSGI",		0x20, 0x20 },
 	{ "IOI",		0x40, 0x40 },
 	{ "CDI",		0x80, 0x80 },
@@ -248,14 +248,14 @@ static const ahc_reg_parse_entry_t LASTPHASE_parse_table[] = {
 	{ "P_MESGIN",		0xe0, 0xe0 }
 };
 
-int
-ahc_lastphase_print(u_int regvalue, u_int *cur_col, u_int wrap)
+void
+ahc_lastphase_print(u_int regvalue, struct aic_dump_buffer *buf)
 {
-	return (ahc_print_register(LASTPHASE_parse_table, 11, "LASTPHASE",
-	    0x3f, regvalue, cur_col, wrap));
+	aic_print_register(LASTPHASE_parse_table, 11, "LASTPHASE",
+			   0x3f, regvalue, buf);
 }
 
-static const ahc_reg_parse_entry_t SEQCTL_parse_table[] = {
+static const aic_reg_parse_entry_t SEQCTL_parse_table[] = {
 	{ "LOADRAM",		0x01, 0x01 },
 	{ "SEQRESET",		0x02, 0x02 },
 	{ "STEP",		0x04, 0x04 },
@@ -266,21 +266,21 @@ static const ahc_reg_parse_entry_t SEQCTL_parse_table[] = {
 	{ "PERRORDIS",		0x80, 0x80 }
 };
 
-int
-ahc_seqctl_print(u_int regvalue, u_int *cur_col, u_int wrap)
+void
+ahc_seqctl_print(u_int regvalue, struct aic_dump_buffer *buf)
 {
-	return (ahc_print_register(SEQCTL_parse_table, 8, "SEQCTL",
-	    0x60, regvalue, cur_col, wrap));
+	aic_print_register(SEQCTL_parse_table, 8, "SEQCTL",
+			   0x60, regvalue, buf);
 }
 
-int
-ahc_sram_base_print(u_int regvalue, u_int *cur_col, u_int wrap)
+void
+ahc_sram_base_print(u_int regvalue, struct aic_dump_buffer *buf)
 {
-	return (ahc_print_register(NULL, 0, "SRAM_BASE",
-	    0x70, regvalue, cur_col, wrap));
+	aic_print_register(NULL, 0, "SRAM_BASE",
+			   0x70, regvalue, buf);
 }
 
-static const ahc_reg_parse_entry_t ERROR_parse_table[] = {
+static const aic_reg_parse_entry_t ERROR_parse_table[] = {
 	{ "ILLHADDR",		0x01, 0x01 },
 	{ "ILLSADDR",		0x02, 0x02 },
 	{ "ILLOPCODE",		0x04, 0x04 },
@@ -291,14 +291,14 @@ static const ahc_reg_parse_entry_t ERROR_parse_table[] = {
 	{ "CIOPARERR",		0x80, 0x80 }
 };
 
-int
-ahc_error_print(u_int regvalue, u_int *cur_col, u_int wrap)
+void
+ahc_error_print(u_int regvalue, struct aic_dump_buffer *buf)
 {
-	return (ahc_print_register(ERROR_parse_table, 8, "ERROR",
-	    0x92, regvalue, cur_col, wrap));
+	aic_print_register(ERROR_parse_table, 8, "ERROR",
+			   0x92, regvalue, buf);
 }
 
-static const ahc_reg_parse_entry_t DFCNTRL_parse_table[] = {
+static const aic_reg_parse_entry_t DFCNTRL_parse_table[] = {
 	{ "FIFORESET",		0x01, 0x01 },
 	{ "FIFOFLUSH",		0x02, 0x02 },
 	{ "DIRECTION",		0x04, 0x04 },
@@ -311,14 +311,14 @@ static const ahc_reg_parse_entry_t DFCNTRL_parse_table[] = {
 	{ "PRELOADEN",		0x80, 0x80 }
 };
 
-int
-ahc_dfcntrl_print(u_int regvalue, u_int *cur_col, u_int wrap)
+void
+ahc_dfcntrl_print(u_int regvalue, struct aic_dump_buffer *buf)
 {
-	return (ahc_print_register(DFCNTRL_parse_table, 10, "DFCNTRL",
-	    0x93, regvalue, cur_col, wrap));
+	aic_print_register(DFCNTRL_parse_table, 10, "DFCNTRL",
+			   0x93, regvalue, buf);
 }
 
-static const ahc_reg_parse_entry_t DFSTATUS_parse_table[] = {
+static const aic_reg_parse_entry_t DFSTATUS_parse_table[] = {
 	{ "FIFOEMP",		0x01, 0x01 },
 	{ "FIFOFULL",		0x02, 0x02 },
 	{ "DFTHRESH",		0x04, 0x04 },
@@ -329,14 +329,14 @@ static const ahc_reg_parse_entry_t DFSTATUS_parse_table[] = {
 	{ "PRELOAD_AVAIL",	0x80, 0x80 }
 };
 
-int
-ahc_dfstatus_print(u_int regvalue, u_int *cur_col, u_int wrap)
+void
+ahc_dfstatus_print(u_int regvalue, struct aic_dump_buffer *buf)
 {
-	return (ahc_print_register(DFSTATUS_parse_table, 8, "DFSTATUS",
-	    0x94, regvalue, cur_col, wrap));
+	aic_print_register(DFSTATUS_parse_table, 8, "DFSTATUS",
+			   0x94, regvalue, buf);
 }
 
-static const ahc_reg_parse_entry_t SCSIPHASE_parse_table[] = {
+static const aic_reg_parse_entry_t SCSIPHASE_parse_table[] = {
 	{ "DATA_OUT_PHASE",	0x01, 0x01 },
 	{ "DATA_IN_PHASE",	0x02, 0x02 },
 	{ "MSG_OUT_PHASE",	0x04, 0x04 },
@@ -346,21 +346,21 @@ static const ahc_reg_parse_entry_t SCSIPHASE_parse_table[] = {
 	{ "DATA_PHASE_MASK",	0x03, 0x03 }
 };
 
-int
-ahc_scsiphase_print(u_int regvalue, u_int *cur_col, u_int wrap)
+void
+ahc_scsiphase_print(u_int regvalue, struct aic_dump_buffer *buf)
 {
-	return (ahc_print_register(SCSIPHASE_parse_table, 7, "SCSIPHASE",
-	    0x9e, regvalue, cur_col, wrap));
+	aic_print_register(SCSIPHASE_parse_table, 7, "SCSIPHASE",
+			   0x9e, regvalue, buf);
 }
 
-int
-ahc_scb_base_print(u_int regvalue, u_int *cur_col, u_int wrap)
+void
+ahc_scb_base_print(u_int regvalue, struct aic_dump_buffer *buf)
 {
-	return (ahc_print_register(NULL, 0, "SCB_BASE",
-	    0xa0, regvalue, cur_col, wrap));
+	aic_print_register(NULL, 0, "SCB_BASE",
+			   0xa0, regvalue, buf);
 }
 
-static const ahc_reg_parse_entry_t SCB_CONTROL_parse_table[] = {
+static const aic_reg_parse_entry_t SCB_CONTROL_parse_table[] = {
 	{ "DISCONNECTED",	0x04, 0x04 },
 	{ "ULTRAENB",		0x08, 0x08 },
 	{ "MK_MESSAGE",		0x10, 0x10 },
@@ -371,43 +371,43 @@ static const ahc_reg_parse_entry_t SCB_CONTROL_parse_table[] = {
 	{ "SCB_TAG_TYPE",	0x03, 0x03 }
 };
 
-int
-ahc_scb_control_print(u_int regvalue, u_int *cur_col, u_int wrap)
+void
+ahc_scb_control_print(u_int regvalue, struct aic_dump_buffer *buf)
 {
-	return (ahc_print_register(SCB_CONTROL_parse_table, 8, "SCB_CONTROL",
-	    0xb8, regvalue, cur_col, wrap));
+	aic_print_register(SCB_CONTROL_parse_table, 8, "SCB_CONTROL",
+			   0xb8, regvalue, buf);
 }
 
-static const ahc_reg_parse_entry_t SCB_SCSIID_parse_table[] = {
+static const aic_reg_parse_entry_t SCB_SCSIID_parse_table[] = {
 	{ "TWIN_CHNLB",		0x80, 0x80 },
 	{ "OID",		0x0f, 0x0f },
 	{ "TWIN_TID",		0x70, 0x70 },
 	{ "TID",		0xf0, 0xf0 }
 };
 
-int
-ahc_scb_scsiid_print(u_int regvalue, u_int *cur_col, u_int wrap)
+void
+ahc_scb_scsiid_print(u_int regvalue, struct aic_dump_buffer *buf)
 {
-	return (ahc_print_register(SCB_SCSIID_parse_table, 4, "SCB_SCSIID",
-	    0xb9, regvalue, cur_col, wrap));
+	aic_print_register(SCB_SCSIID_parse_table, 4, "SCB_SCSIID",
+			   0xb9, regvalue, buf);
 }
 
-static const ahc_reg_parse_entry_t SCB_LUN_parse_table[] = {
+static const aic_reg_parse_entry_t SCB_LUN_parse_table[] = {
 	{ "SCB_XFERLEN_ODD",	0x80, 0x80 },
 	{ "LID",		0x3f, 0x3f }
 };
 
-int
-ahc_scb_lun_print(u_int regvalue, u_int *cur_col, u_int wrap)
+void
+ahc_scb_lun_print(u_int regvalue, struct aic_dump_buffer *buf)
 {
-	return (ahc_print_register(SCB_LUN_parse_table, 2, "SCB_LUN",
-	    0xba, regvalue, cur_col, wrap));
+	aic_print_register(SCB_LUN_parse_table, 2, "SCB_LUN",
+			   0xba, regvalue, buf);
 }
 
-int
-ahc_scb_tag_print(u_int regvalue, u_int *cur_col, u_int wrap)
+void
+ahc_scb_tag_print(u_int regvalue, struct aic_dump_buffer *buf)
 {
-	return (ahc_print_register(NULL, 0, "SCB_TAG",
-	    0xbb, regvalue, cur_col, wrap));
+	aic_print_register(NULL, 0, "SCB_TAG",
+			   0xbb, regvalue, buf);
 }
 
diff --git a/drivers/scsi/aic7xxx/aicasm/aicasm_symbol.c b/drivers/scsi/aic7xxx/aicasm/aicasm_symbol.c
index 232aff1fe784..207aa6ca6d2e 100644
--- a/drivers/scsi/aic7xxx/aicasm/aicasm_symbol.c
+++ b/drivers/scsi/aic7xxx/aicasm/aicasm_symbol.c
@@ -52,6 +52,7 @@
 #include <fcntl.h>
 #include <inttypes.h>
 #include <regex.h>
+#include <ctype.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
@@ -353,23 +354,6 @@ aic_print_include(FILE *dfile, char *include_file)
 	fprintf(dfile, "\n#include \"%s\"\n\n", include_file);
 }
 
-void
-aic_print_reg_dump_types(FILE *ofile)
-{
-	if (ofile == NULL)
-		return;
-
-	fprintf(ofile,
-"typedef int (%sreg_print_t)(u_int, u_int *, u_int);\n"
-"typedef struct %sreg_parse_entry {\n"
-"	char	*name;\n"
-"	uint8_t	 value;\n"
-"	uint8_t	 mask;\n"
-"} %sreg_parse_entry_t;\n"
-"\n",
-		prefix, prefix, prefix);
-}
-
 static void
 aic_print_reg_dump_start(FILE *dfile, symbol_node_t *regnode)
 {
@@ -377,8 +361,7 @@ aic_print_reg_dump_start(FILE *dfile, symbol_node_t *regnode)
 		return;
 
 	fprintf(dfile,
-"static const %sreg_parse_entry_t %s_parse_table[] = {\n",
-		prefix,
+"static const aic_reg_parse_entry_t %s_parse_table[] = {\n",
 		regnode->symbol->name);
 }
 
@@ -404,16 +387,15 @@ aic_print_reg_dump_end(FILE *ofile, FILE *dfile,
 "\n");
 
 		fprintf(dfile,
-"int\n"
-"%s%s_print(u_int regvalue, u_int *cur_col, u_int wrap)\n"
+"void\n"
+"%s%s_print(u_int regvalue, struct aic_dump_buffer *buf)\n"
 "{\n"
-"	return (%sprint_register(%s%s, %d, \"%s\",\n"
-"	    0x%02x, regvalue, cur_col, wrap));\n"
+"	aic_print_register(%s%s, %d, \"%s\",\n"
+"			   0x%02x, regvalue, buf);\n"
 "}\n"
 "\n",
 			prefix,
 			lower_name,
-			prefix,
 			num_entries != 0 ? regnode->symbol->name : "NULL",
 			num_entries != 0 ? "_parse_table" : "",
 			num_entries,
@@ -423,18 +405,16 @@ aic_print_reg_dump_end(FILE *ofile, FILE *dfile,
 
 	fprintf(ofile,
 "#if AIC_DEBUG_REGISTERS\n"
-"%sreg_print_t %s%s_print;\n"
+"aic_reg_print_t %s%s_print;\n"
 "#else\n"
-"#define %s%s_print(regvalue, cur_col, wrap) \\\n"
-"    %sprint_register(NULL, 0, \"%s\", 0x%02x, regvalue, cur_col, wrap)\n"
+"#define %s%s_print(regvalue, buf) \\\n"
+"    aic_print_register(NULL, 0, \"%s\", 0x%02x, regvalue, buf)\n"
 "#endif\n"
 "\n",
 		prefix,
-		prefix,
 		lower_name,
 		prefix,
 		lower_name,
-		prefix,
 		regnode->symbol->name,
 		regnode->symbol->info.rinfo->address);
 }
@@ -534,7 +514,6 @@ symtable_dump(FILE *ofile, FILE *dfile)
 
 	/* Register dianostic functions/declarations first. */
 	aic_print_file_prologue(ofile);
-	aic_print_reg_dump_types(ofile);
 	aic_print_file_prologue(dfile);
 	aic_print_include(dfile, stock_include_file);
 	SLIST_FOREACH(curnode, &registers, links) {
diff --git a/drivers/scsi/aic7xxx/aiclib.c b/drivers/scsi/aic7xxx/aiclib.c
index 828ae3d9a510..5869de7a1673 100644
--- a/drivers/scsi/aic7xxx/aiclib.c
+++ b/drivers/scsi/aic7xxx/aiclib.c
@@ -1,34 +1,83 @@
 /*
- * Implementation of Utility functions for all SCSI device types.
+ * Utility functions for AIC driver
  *
- * Copyright (c) 1997, 1998, 1999 Justin T. Gibbs.
- * Copyright (c) 1997, 1998 Kenneth D. Merry.
- * All rights reserved.
+ * Copyright (c) 2017 Michał Mirosław
  *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions, and the following disclaimer,
- *    without modification, immediately at the beginning of the file.
- * 2. The name of the author may not be used to endorse or promote products
- *    derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
- * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * $FreeBSD: src/sys/cam/scsi/scsi_all.c,v 1.38 2002/09/23 04:56:35 mjacob Exp $
- * $Id$
+ * License: GPLv2
  */
 
 #include "aiclib.h"
 
+void aic_printbuf_push(struct aic_dump_buffer *buf, const char *fmt, ...)
+{
+	va_list args;
+	char *ptr;
+	int len;
+
+	ptr = buf->buf + buf->cur_col;
+
+	va_start(args, fmt);
+	len = vscnprintf(ptr, sizeof(buf->buf) - buf->cur_col, fmt, args);
+	buf->cur_col += len;
+	va_end(args);
+}
+EXPORT_SYMBOL_GPL(aic_printbuf_push);
+
+void aic_printbuf_finish(struct aic_dump_buffer *buf)
+{
+	if (!buf->cur_col)
+		return;
+
+	printk("%s\n", buf->buf);
+	buf->cur_col = 0;
+}
+EXPORT_SYMBOL_GPL(aic_printbuf_finish);
+
+static void aic_printbuf_maybe_break(struct aic_dump_buffer *buf)
+{
+	if (buf->cur_col >= buf->wrap)
+		aic_printbuf_finish(buf);
+}
+
+void aic_print_register(const aic_reg_parse_entry_t *table, u_int num_entries,
+			const char *name, u_int address, u_int value,
+			struct aic_dump_buffer *buf)
+{
+	u_int	printed_mask;
+
+	aic_printbuf_push(buf, "%s[0x%x]", name, value);
+	if (table == NULL) {
+		aic_printbuf_push(buf, " ");
+		aic_printbuf_maybe_break(buf);
+		return;
+	}
+
+	printed_mask = 0;
+	while (printed_mask != 0xFF) {
+		int entry;
+
+		for (entry = 0; entry < num_entries; entry++) {
+			const aic_reg_parse_entry_t *e = &table[entry];
+			if (((value & e->mask) != e->value) ||
+			    ((printed_mask & e->mask) == e->mask))
+				continue;
+
+			aic_printbuf_push(buf, "%s%s",
+					  printed_mask == 0 ? ":(" : "|",
+					  e->name);
+			printed_mask |= e->mask;
+
+			break;
+		}
+
+		if (entry >= num_entries)
+			break;
+	}
+	if (printed_mask != 0)
+		aic_printbuf_push(buf, ") ");
+	else
+		aic_printbuf_push(buf, " ");
+
+	aic_printbuf_maybe_break(buf);
+}
+EXPORT_SYMBOL_GPL(aic_print_register);
diff --git a/drivers/scsi/aic7xxx/aiclib.h b/drivers/scsi/aic7xxx/aiclib.h
index f8fd198aafbc..f94981f9878a 100644
--- a/drivers/scsi/aic7xxx/aiclib.h
+++ b/drivers/scsi/aic7xxx/aiclib.h
@@ -57,6 +57,38 @@
 #ifndef	_AICLIB_H
 #define _AICLIB_H
 
+#include <linux/blkdev.h>
+#include <linux/types.h>
+
+struct aic_dump_buffer
+{
+	unsigned int cur_col;
+	unsigned int wrap;
+	char buf[256];
+};
+
+typedef void (aic_reg_print_t)(uint32_t, struct aic_dump_buffer *);
+
+typedef struct aic_reg_parse_entry {
+	char    *name;
+	uint8_t  value;
+	uint8_t  mask;
+} aic_reg_parse_entry_t;
+
+static inline void
+aic_printbuf_init(struct aic_dump_buffer *buf, unsigned int wrap)
+{
+	buf->cur_col = 0;
+	buf->wrap = wrap;
+}
+
+void __printf(2, 3) aic_printbuf_push(struct aic_dump_buffer *buf,
+				      const char *fmt, ...);
+void aic_printbuf_finish(struct aic_dump_buffer *buf);
+void aic_print_register(const aic_reg_parse_entry_t *table, u_int num_entries,
+			const char *name, u_int address, u_int value,
+			struct aic_dump_buffer *buf);
+
 struct scsi_sense
 {
 	uint8_t opcode;
-- 
2.11.0

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

* Re: [PATCH v2 1/5] aic7xxx: remove empty function
  2017-08-03 23:28 ` [PATCH v2 1/5] aic7xxx: remove empty function Michał Mirosław
@ 2017-08-04  8:37   ` Hannes Reinecke
  0 siblings, 0 replies; 13+ messages in thread
From: Hannes Reinecke @ 2017-08-04  8:37 UTC (permalink / raw)
  To: Michał Mirosław, James E.J. Bottomley, Martin K. Petersen
  Cc: linux-scsi

On 08/04/2017 01:28 AM, Michał Mirosław wrote:
> 
> ahc_platform_dump_card_state() does nothing. Remove it.
> 
> Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
> ---
>  drivers/scsi/aic7xxx/aic7xxx_core.c | 1 -
>  drivers/scsi/aic7xxx/aic7xxx_osm.c  | 5 -----
>  drivers/scsi/aic7xxx/aic7xxx_osm.h  | 1 -
>  3 files changed, 7 deletions(-)
> 
Reviewed-by: Hannes Reinecke <hare@suse.com>

Cheers,

Hannes
-- 
Dr. Hannes Reinecke		               zSeries & Storage
hare@suse.com			               +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: F. Imendörffer, J. Smithard, D. Upmanyu, G. Norton
HRB 21284 (AG Nürnberg)

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

* Re: [PATCH v2 2/5] aic7xxx: fix firmware build deps
  2017-08-03 23:28 ` [PATCH v2 2/5] aic7xxx: fix firmware build deps Michał Mirosław
@ 2017-08-04  8:41   ` Hannes Reinecke
  0 siblings, 0 replies; 13+ messages in thread
From: Hannes Reinecke @ 2017-08-04  8:41 UTC (permalink / raw)
  To: Michał Mirosław, Hannes Reinecke, James E.J. Bottomley,
	Martin K. Petersen
  Cc: linux-scsi

On 08/04/2017 01:28 AM, Michał Mirosław wrote:
> We need to override Kbuild rules for copying shipped files, otherwise
> aic7xxx_reg.h and aic7xxx_reg_print.c will be ovewritten by old versions.
> 
> Fixes: 516b7db593f3a541e2e98867575c3c697f41a247
> Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
> ---
>  drivers/scsi/aic7xxx/Makefile | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
Reviewed-by: Hannes Reinecke <hare@suse.com>

Cheers,

Hannes
-- 
Dr. Hannes Reinecke		   Teamlead Storage & Networking
hare@suse.de			               +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton
HRB 21284 (AG Nürnberg)

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

* Re: [PATCH v2 3/5] aic7xxx: remove rules for shipped files
  2017-08-03 23:28 ` [PATCH v2 3/5] aic7xxx: remove rules for shipped files Michał Mirosław
@ 2017-08-04  8:41   ` Hannes Reinecke
  2017-08-09 22:27   ` Michał Mirosław
  1 sibling, 0 replies; 13+ messages in thread
From: Hannes Reinecke @ 2017-08-04  8:41 UTC (permalink / raw)
  To: Michał Mirosław, Hannes Reinecke, James E.J. Bottomley,
	Martin K. Petersen
  Cc: linux-scsi

On 08/04/2017 01:28 AM, Michał Mirosław wrote:
> There are Kbuild rules for that already.
> 
> Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
> ---
>  drivers/scsi/aic7xxx/Makefile | 4 ----
>  1 file changed, 4 deletions(-)
> 
Reviewed-by: Hannes Reinecke <hare@suse.com>

Cheers,

Hannes
-- 
Dr. Hannes Reinecke		   Teamlead Storage & Networking
hare@suse.de			               +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton
HRB 21284 (AG Nürnberg)

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

* Re: [PATCH v2 4/5] aic7xxx: regenerate firmware files
  2017-08-03 23:28 ` [PATCH v2 4/5] aic7xxx: regenerate firmware files Michał Mirosław
@ 2017-08-04  8:44   ` Hannes Reinecke
  0 siblings, 0 replies; 13+ messages in thread
From: Hannes Reinecke @ 2017-08-04  8:44 UTC (permalink / raw)
  To: Michał Mirosław, Hannes Reinecke, James E.J. Bottomley,
	Martin K. Petersen
  Cc: linux-scsi

On 08/04/2017 01:28 AM, Michał Mirosław wrote:
> Regenerate firmware files to make cleaner base for following fix.
> This removes some unused definitions and reorders some #defines, but
> the code remains the same.
> 
> Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
> ---
>  drivers/scsi/aic7xxx/aic79xx_reg.h_shipped       | 1267 ++++------------------
>  drivers/scsi/aic7xxx/aic79xx_reg_print.c_shipped |   34 +-
>  drivers/scsi/aic7xxx/aic7xxx_reg.h_shipped       |   44 +-
>  3 files changed, 235 insertions(+), 1110 deletions(-)
> 
Reviewed-by: Hannes Reinecke <hare@suse.com>

Cheers,

Hannes
-- 
Dr. Hannes Reinecke		   Teamlead Storage & Networking
hare@suse.de			               +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton
HRB 21284 (AG Nürnberg)

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

* Re: [PATCH v2 0/4] aic7xxx: fix debugging printks
  2017-08-03 23:28 [PATCH v2 0/4] aic7xxx: fix debugging printks Michał Mirosław
                   ` (4 preceding siblings ...)
  2017-08-03 23:28 ` [PATCH v2 5/5] aic7[9x]xx: printk() lines unbroken Michał Mirosław
@ 2017-08-08  1:43 ` Martin K. Petersen
  5 siblings, 0 replies; 13+ messages in thread
From: Martin K. Petersen @ 2017-08-08  1:43 UTC (permalink / raw)
  To: Michał Mirosław
  Cc: Hannes Reinecke, James E.J. Bottomley, Martin K. Petersen, linux-scsi


Michał,

> This series aims to clean up printing of card state after a problem
> event.

Applied patches 1 through 4 to 4.14/scsi-queue. Thanks!

-- 
Martin K. Petersen	Oracle Linux Engineering

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

* Re: [PATCH v2 3/5] aic7xxx: remove rules for shipped files
  2017-08-03 23:28 ` [PATCH v2 3/5] aic7xxx: remove rules for shipped files Michał Mirosław
  2017-08-04  8:41   ` Hannes Reinecke
@ 2017-08-09 22:27   ` Michał Mirosław
  2017-08-10 23:37     ` Martin K. Petersen
  1 sibling, 1 reply; 13+ messages in thread
From: Michał Mirosław @ 2017-08-09 22:27 UTC (permalink / raw)
  To: James E.J. Bottomley; +Cc: Hannes Reinecke, Martin K. Petersen, linux-scsi

On Fri, Aug 04, 2017 at 01:28:09AM +0200, Michał Mirosław wrote:
[...]
> --- a/drivers/scsi/aic7xxx/Makefile
> +++ b/drivers/scsi/aic7xxx/Makefile
> @@ -61,8 +61,6 @@ $(obj)/aic7xxx_seq.h: $(src)/aic7xxx.seq $(src)/aic7xxx.reg $(obj)/aicasm/aicasm
[...]
> -else
> -$(obj)/aic7xxx_reg_print.c: $(src)/aic7xxx_reg_print.c_shipped
[...]

Hi,

Please drop this patch (only this one). I didn't notice, that the file is
needed by modpost:

      Building modules, stage 2.
      MODPOST 785 modules
    WARNING: could not open drivers/scsi/aic7xxx/aic79xx_reg_print.c: No
such file or directory
      LD [M]  drivers/scsi/aic7xxx/aic79xx.ko

Best Regards,
Michał Mirosław

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

* Re: [PATCH v2 3/5] aic7xxx: remove rules for shipped files
  2017-08-09 22:27   ` Michał Mirosław
@ 2017-08-10 23:37     ` Martin K. Petersen
  0 siblings, 0 replies; 13+ messages in thread
From: Martin K. Petersen @ 2017-08-10 23:37 UTC (permalink / raw)
  To: Michał Mirosław
  Cc: James E.J. Bottomley, Hannes Reinecke, Martin K. Petersen, linux-scsi


Michał,

> Please drop this patch (only this one). I didn't notice, that the file
> is needed by modpost:

OK, done.

-- 
Martin K. Petersen	Oracle Linux Engineering

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

end of thread, other threads:[~2017-08-10 23:38 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-03 23:28 [PATCH v2 0/4] aic7xxx: fix debugging printks Michał Mirosław
2017-08-03 23:28 ` [PATCH v2 1/5] aic7xxx: remove empty function Michał Mirosław
2017-08-04  8:37   ` Hannes Reinecke
2017-08-03 23:28 ` [PATCH v2 2/5] aic7xxx: fix firmware build deps Michał Mirosław
2017-08-04  8:41   ` Hannes Reinecke
2017-08-03 23:28 ` [PATCH v2 3/5] aic7xxx: remove rules for shipped files Michał Mirosław
2017-08-04  8:41   ` Hannes Reinecke
2017-08-09 22:27   ` Michał Mirosław
2017-08-10 23:37     ` Martin K. Petersen
2017-08-03 23:28 ` [PATCH v2 4/5] aic7xxx: regenerate firmware files Michał Mirosław
2017-08-04  8:44   ` Hannes Reinecke
2017-08-03 23:28 ` [PATCH v2 5/5] aic7[9x]xx: printk() lines unbroken Michał Mirosław
2017-08-08  1:43 ` [PATCH v2 0/4] aic7xxx: fix debugging printks Martin K. Petersen

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