ahd_platform_dump_card_state(ahd); 
ahd_dump_card_state(struct ahd_softc *ahd){	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)) {		paused = 1;	} else {		paused = 0;		ahd_pause(ahd);	}	saved_modes = ahd_save_modes(ahd);	ahd_set_modes(ahd, AHD_MODE_SCSI, AHD_MODE_SCSI);	printf(">>>>>>>>>>>>>>>>>> Dump Card State Begins <<<<<<<<<<<<<<<<<\n"	       "%s: Dumping Card State at program address 0x%x Mode 0x%x\n",	       ahd_name(ahd), 	       ahd_inb(ahd, CURADDR) | (ahd_inb(ahd, CURADDR+1) << 8),	       ahd_build_mode_state(ahd, ahd->saved_src_mode,				    ahd->saved_dst_mode));	if (paused)		printf("Card was paused\n");	if (ahd_check_cmdcmpltqueues(ahd))		printf("Completions are pending\n");	/*	 * Mode independent registers.	 */	cur_col = 0;	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_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);	printf("\n");	printf("\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);	printf("Pending list:");	i = 0;	LIST_FOREACH(scb, &ahd->pending_scbs, pending_links) {		if (i++ > AHD_SCB_MAX)			break;		cur_col = printf("\n%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);	}	printf("\nTotal %d\n", i);	printf("Kernel Free SCB list: ");	i = 0;	TAILQ_FOREACH(scb, &ahd->scb_data.free_scbs, links.tqe) {		struct scb *list_scb;		list_scb = scb;		do {			printf("%d ", SCB_GET_TAG(list_scb));			list_scb = LIST_NEXT(list_scb, collision_links);		} while (list_scb && i++ < AHD_SCB_MAX);	}	LIST_FOREACH(scb, &ahd->scb_data.any_dev_free_scb_list, links.le) {		if (i++ > AHD_SCB_MAX)			break;		printf("%d ", SCB_GET_TAG(scb));	}	printf("\n");	printf("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);		printf("%d ", scb_index);		scb_index = ahd_inw_scbram(ahd, SCB_NEXT_COMPLETE);	}	printf("\n");	printf("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);		printf("%d ", scb_index);		scb_index = ahd_inw_scbram(ahd, SCB_NEXT_COMPLETE);	}	printf("\n");		printf("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);		printf("%d ", scb_index);		scb_index = ahd_inw_scbram(ahd, SCB_NEXT_COMPLETE);	}	printf("\n");	ahd_set_scbptr(ahd, saved_scb_index);	dffstat = ahd_inb(ahd, DFFSTAT);	for (i = 0; i < 2; i++) {#ifdef AHD_DEBUG		struct scb *fifo_scb;#endif		u_int	    fifo_scbptr;		ahd_set_modes(ahd, AHD_MODE_DFF0 + i, AHD_MODE_DFF0 + i);		fifo_scbptr = ahd_get_scbptr(ahd);		printf("\n%s: FIFO%d %s, LONGJMP == 0x%x, SCB 0x%x\n",		       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) {			printf("\n");			cur_col = 0;		}		cur_col += printf("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) {			printf("\n");			cur_col = 0;		}		cur_col += printf("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);#ifdef AHD_DEBUG		if ((ahd_debug & AHD_SHOW_SG) != 0) {			fifo_scb = ahd_lookup_scb(ahd, fifo_scbptr);			if (fifo_scb != NULL)				ahd_dump_sglist(fifo_scb);		}#endif	}	printf("\nLQIN: ");	for (i = 0; i < 20; i++)		printf("0x%x ", ahd_inb(ahd, LQIN + i));	printf("\n");	ahd_set_modes(ahd, AHD_MODE_CFG, AHD_MODE_CFG);	printf("%s: LQISTATE = 0x%x, LQOSTATE = 0x%x, OPTIONMODE = 0x%x\n",	       ahd_name(ahd), ahd_inb(ahd, LQISTATE), ahd_inb(ahd, LQOSTATE),	       ahd_inb(ahd, OPTIONMODE));	printf("%s: OS_SPACE_CNT = 0x%x MAXCMDCNT = 0x%x\n",	       ahd_name(ahd), ahd_inb(ahd, OS_SPACE_CNT),	       ahd_inb(ahd, MAXCMDCNT));	ahd_simode0_print(ahd_inb(ahd, SIMODE0), &cur_col, 50);	printf("\n");	ahd_set_modes(ahd, AHD_MODE_CCHAN, AHD_MODE_CCHAN);	cur_col = 0;	ahd_ccscbctl_print(ahd_inb(ahd, CCSCBCTL), &cur_col, 50);	printf("\n");	ahd_set_modes(ahd, ahd->saved_src_mode, ahd->saved_dst_mode);	printf("%s: REG0 == 0x%x, SINDEX = 0x%x, DINDEX = 0x%x\n",	       ahd_name(ahd), ahd_inw(ahd, REG0), ahd_inw(ahd, SINDEX),	       ahd_inw(ahd, DINDEX));	printf("%s: SCBPTR == 0x%x, SCB_NEXT == 0x%x, SCB_NEXT2 == 0x%x\n",	       ahd_name(ahd), ahd_get_scbptr(ahd),	       ahd_inw_scbram(ahd, SCB_NEXT),	       ahd_inw_scbram(ahd, SCB_NEXT2));	printf("CDB %x %x %x %x %x %x\n",	       ahd_inb_scbram(ahd, SCB_CDB_STORE),	       ahd_inb_scbram(ahd, SCB_CDB_STORE+1),	       ahd_inb_scbram(ahd, SCB_CDB_STORE+2),	       ahd_inb_scbram(ahd, SCB_CDB_STORE+3),	       ahd_inb_scbram(ahd, SCB_CDB_STORE+4),	       ahd_inb_scbram(ahd, SCB_CDB_STORE+5));	printf("STACK:");	for (i = 0; i < ahd->stack_size; i++) {		ahd->saved_stack[i] =		    ahd_inb(ahd, STACK)|(ahd_inb(ahd, STACK) << 8);		printf(" 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);	}	printf("\n<<<<<<<<<<<<<<<<< Dump Card State Ends >>>>>>>>>>>>>>>>>>\n");	ahd_platform_dump_card_state(ahd);	ahd_restore_modes(ahd, saved_modes);	if (paused == 0)		ahd_unpause(ahd);}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/60a13213840296b1e32d6781653a0eaa83d04382/aic79xx_core.c/buggy/drivers/scsi/aic7xxx/aic79xx_core.c