print_status (status); 
scsi_print_status (status); 
NCR53c7xx_run_tests (struct Scsi_Host *host) {    NCR53c7x0_local_declare();    struct NCR53c7x0_hostdata *hostdata = (struct NCR53c7x0_hostdata *)	host->hostdata[0];    unsigned long timeout;    u32 start;    int failed, i;    unsigned long flags;    NCR53c7x0_local_setup(host);    /* The NCR chip _must_ be idle to run the test scripts */    local_irq_save(flags);    if (!hostdata->idle) {	printk ("scsi%d : chip not idle, aborting tests\n", host->host_no);	local_irq_restore(flags);	return -1;    }    /*      * Check for functional interrupts, this could work as an     * autoprobe routine.     */    if ((hostdata->options & OPTION_DEBUG_TEST1) && 	    hostdata->state != STATE_DISABLED) {	hostdata->idle = 0;	hostdata->test_running = 1;	hostdata->test_completed = -1;	hostdata->test_dest = 0;	hostdata->test_source = 0xdeadbeef;	start = virt_to_bus (hostdata->script) + hostdata->E_test_1;    	hostdata->state = STATE_RUNNING;	printk ("scsi%d : test 1", host->host_no);	NCR53c7x0_write32 (DSP_REG, start);	if (hostdata->options & OPTION_DEBUG_TRACE)	    NCR53c7x0_write8 (DCNTL_REG, hostdata->saved_dcntl | DCNTL_SSM |						DCNTL_STD);	printk (" started\n");	local_irq_restore(flags);	/* 	 * This is currently a .5 second timeout, since (in theory) no slow 	 * board will take that long.  In practice, we've seen one 	 * pentium which occassionally fails with this, but works with 	 * 10 times as much?	 */	timeout = jiffies + 5 * HZ / 10;	while ((hostdata->test_completed == -1) && time_before(jiffies, timeout))		barrier();	failed = 1;	if (hostdata->test_completed == -1)	    printk ("scsi%d : driver test 1 timed out%s\n",host->host_no ,		(hostdata->test_dest == 0xdeadbeef) ? 		    " due to lost interrupt.\n"		    "         Please verify that the correct IRQ is being used for your board,\n"		    : "");	else if (hostdata->test_completed != 1) 	    printk ("scsi%d : test 1 bad interrupt value (%d)\n", 		host->host_no, hostdata->test_completed);	else 	    failed = (hostdata->test_dest != 0xdeadbeef);	if (hostdata->test_dest != 0xdeadbeef) {	    printk ("scsi%d : driver test 1 read 0x%x instead of 0xdeadbeef indicating a\n"                    "         probable cache invalidation problem.  Please configure caching\n"		    "         as write-through or disabled\n",		host->host_no, hostdata->test_dest);	}	if (failed) {	    printk ("scsi%d : DSP = 0x%p (script at 0x%p, start at 0x%x)\n",		host->host_no, bus_to_virt(NCR53c7x0_read32(DSP_REG)),		hostdata->script, start);	    printk ("scsi%d : DSPS = 0x%x\n", host->host_no,		NCR53c7x0_read32(DSPS_REG));	    local_irq_restore(flags);	    return -1;	}    	hostdata->test_running = 0;    }    if ((hostdata->options & OPTION_DEBUG_TEST2) && 	hostdata->state != STATE_DISABLED) {	u32 dsa[48];    	unsigned char identify = IDENTIFY(0, 0);	unsigned char cmd[6];	unsigned char data[36];    	unsigned char status = 0xff;    	unsigned char msg = 0xff;    	cmd[0] = INQUIRY;    	cmd[1] = cmd[2] = cmd[3] = cmd[5] = 0;    	cmd[4] = sizeof(data);     	dsa[2] = 1;    	dsa[3] = virt_to_bus(&identify);    	dsa[4] = 6;    	dsa[5] = virt_to_bus(&cmd);    	dsa[6] = sizeof(data);    	dsa[7] = virt_to_bus(&data);    	dsa[8] = 1;    	dsa[9] = virt_to_bus(&status);    	dsa[10] = 1;    	dsa[11] = virt_to_bus(&msg);	for (i = 0; i < 6; ++i) {#ifdef VALID_IDS	    if (!hostdata->valid_ids[i])		continue;#endif	    local_irq_disable();	    if (!hostdata->idle) {		printk ("scsi%d : chip not idle, aborting tests\n", host->host_no);		local_irq_restore(flags);		return -1;	    }	    /* 710: bit mapped scsi ID, async   */            dsa[0] = (1 << i) << 16;	    hostdata->idle = 0;	    hostdata->test_running = 2;	    hostdata->test_completed = -1;	    start = virt_to_bus(hostdata->script) + hostdata->E_test_2;	    hostdata->state = STATE_RUNNING;	    NCR53c7x0_write32 (DSA_REG, virt_to_bus(dsa));	    NCR53c7x0_write32 (DSP_REG, start);	    if (hostdata->options & OPTION_DEBUG_TRACE)	        NCR53c7x0_write8 (DCNTL_REG, hostdata->saved_dcntl |				DCNTL_SSM | DCNTL_STD);	    local_irq_restore(flags);	    timeout = jiffies + 5 * HZ;	/* arbitrary */	    while ((hostdata->test_completed == -1) && time_before(jiffies, timeout))	    	barrier();	    NCR53c7x0_write32 (DSA_REG, 0);	    if (hostdata->test_completed == 2) {		data[35] = 0;		printk ("scsi%d : test 2 INQUIRY to target %d, lun 0 : %s\n",		    host->host_no, i, data + 8);		printk ("scsi%d : status ", host->host_no);		print_status (status);		printk ("\nscsi%d : message ", host->host_no);		print_msg (&msg);		printk ("\n");	    } else if (hostdata->test_completed == 3) {		printk("scsi%d : test 2 no connection with target %d\n",		    host->host_no, i);		if (!hostdata->idle) {		    printk("scsi%d : not idle\n", host->host_no);		    local_irq_restore(flags);		    return -1;		}	    } else if (hostdata->test_completed == -1) {		printk ("scsi%d : test 2 timed out\n", host->host_no);		local_irq_restore(flags);		return -1;	    } 	    hostdata->test_running = 0;	}    }    local_irq_restore(flags);    return 0;}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/db9dff366ba78085d0323364fadbf09bec0e77ee/53c7xx.c/buggy/drivers/scsi/53c7xx.c