Lines Matching refs:shpnt

527 #define HOSTDATA(shpnt)		((struct aha152x_hostdata *) &shpnt->hostdata)  argument
529 #define HOSTNO ((shpnt)->host_no)
531 #define CURRENT_SC (HOSTDATA(shpnt)->current_SC)
532 #define DONE_SC (HOSTDATA(shpnt)->done_SC)
533 #define ISSUE_SC (HOSTDATA(shpnt)->issue_SC)
534 #define DISCONNECTED_SC (HOSTDATA(shpnt)->disconnected_SC)
535 #define QLOCK (HOSTDATA(shpnt)->lock)
536 #define QLOCKER (HOSTDATA(shpnt)->locker)
537 #define QLOCKERL (HOSTDATA(shpnt)->lockerl)
539 #define STATE (HOSTDATA(shpnt)->state)
540 #define PREVSTATE (HOSTDATA(shpnt)->prevstate)
541 #define LASTSTATE (HOSTDATA(shpnt)->laststate)
543 #define RECONN_TARGET (HOSTDATA(shpnt)->target)
545 #define CMD_I (HOSTDATA(shpnt)->cmd_i)
547 #define MSGO(i) (HOSTDATA(shpnt)->msgo[i])
548 #define MSGO_I (HOSTDATA(shpnt)->msgo_i)
549 #define MSGOLEN (HOSTDATA(shpnt)->msgo_len)
550 #define ADDMSGO(x) (MSGOLEN<256 ? (void)(MSGO(MSGOLEN++)=x) : aha152x_error(shpnt,"MSGO overflow"))
552 #define MSGI(i) (HOSTDATA(shpnt)->msgi[i])
553 #define MSGILEN (HOSTDATA(shpnt)->msgi_len)
554 #define ADDMSGI(x) (MSGILEN<256 ? (void)(MSGI(MSGILEN++)=x) : aha152x_error(shpnt,"MSGI overflow"))
556 #define DATA_LEN (HOSTDATA(shpnt)->data_len)
558 #define SYNCRATE (HOSTDATA(shpnt)->syncrate[CURRENT_SC->device->id])
559 #define SYNCNEG (HOSTDATA(shpnt)->syncneg[CURRENT_SC->device->id])
561 #define DELAY (HOSTDATA(shpnt)->delay)
562 #define EXT_TRANS (HOSTDATA(shpnt)->ext_trans)
563 #define TC1550 (HOSTDATA(shpnt)->tc1550)
564 #define RECONNECT (HOSTDATA(shpnt)->reconnect)
565 #define PARITY (HOSTDATA(shpnt)->parity)
566 #define SYNCHRONOUS (HOSTDATA(shpnt)->synchronous)
568 #define HOSTIOPORT0 (HOSTDATA(shpnt)->io_port0)
569 #define HOSTIOPORT1 (HOSTDATA(shpnt)->io_port1)
578 static void seldi_run(struct Scsi_Host *shpnt);
579 static void seldo_run(struct Scsi_Host *shpnt);
580 static void selto_run(struct Scsi_Host *shpnt);
581 static void busfree_run(struct Scsi_Host *shpnt);
583 static void msgo_init(struct Scsi_Host *shpnt);
584 static void msgo_run(struct Scsi_Host *shpnt);
585 static void msgo_end(struct Scsi_Host *shpnt);
587 static void cmd_init(struct Scsi_Host *shpnt);
588 static void cmd_run(struct Scsi_Host *shpnt);
589 static void cmd_end(struct Scsi_Host *shpnt);
591 static void datai_init(struct Scsi_Host *shpnt);
592 static void datai_run(struct Scsi_Host *shpnt);
593 static void datai_end(struct Scsi_Host *shpnt);
595 static void datao_init(struct Scsi_Host *shpnt);
596 static void datao_run(struct Scsi_Host *shpnt);
597 static void datao_end(struct Scsi_Host *shpnt);
599 static void status_run(struct Scsi_Host *shpnt);
601 static void msgi_run(struct Scsi_Host *shpnt);
602 static void msgi_end(struct Scsi_Host *shpnt);
604 static void parerr_run(struct Scsi_Host *shpnt);
605 static void rsti_run(struct Scsi_Host *shpnt);
607 static void is_complete(struct Scsi_Host *shpnt);
638 static void reset_ports(struct Scsi_Host *shpnt);
639 static void aha152x_error(struct Scsi_Host *shpnt, char *msg);
640 static void done(struct Scsi_Host *shpnt, unsigned char status_byte,
645 static void show_queues(struct Scsi_Host *shpnt);
646 static void disp_enintr(struct Scsi_Host *shpnt);
725 struct Scsi_Host *shpnt = dev_id; in swintr() local
727 HOSTDATA(shpnt)->swint++; in swintr()
735 struct Scsi_Host *shpnt; in aha152x_probe_one() local
737 shpnt = scsi_host_alloc(&aha152x_driver_template, sizeof(struct aha152x_hostdata)); in aha152x_probe_one()
738 if (!shpnt) { in aha152x_probe_one()
743 memset(HOSTDATA(shpnt), 0, sizeof *HOSTDATA(shpnt)); in aha152x_probe_one()
744 INIT_LIST_HEAD(&HOSTDATA(shpnt)->host_list); in aha152x_probe_one()
747 list_add_tail(&HOSTDATA(shpnt)->host_list, &aha152x_host_list); in aha152x_probe_one()
749 shpnt->io_port = setup->io_port; in aha152x_probe_one()
750 shpnt->n_io_port = IO_RANGE; in aha152x_probe_one()
751 shpnt->irq = setup->irq; in aha152x_probe_one()
769 shpnt->this_id = setup->scsiid; in aha152x_probe_one()
772 shpnt->can_queue = AHA152X_MAXQUEUE; in aha152x_probe_one()
781 reset_ports(shpnt); in aha152x_probe_one()
794 shpnt->host_no, setup->tc1550 ? " (tc1550 mode)" : "", in aha152x_probe_one()
796 shpnt->io_port, HOSTIOPORT0, HOSTIOPORT1, in aha152x_probe_one()
797 shpnt->irq, in aha152x_probe_one()
798 shpnt->this_id, in aha152x_probe_one()
809 if (request_irq(shpnt->irq, swintr, IRQF_SHARED, "aha152x", shpnt)) { in aha152x_probe_one()
810 printk(KERN_ERR "aha152x%d: irq %d busy.\n", shpnt->host_no, shpnt->irq); in aha152x_probe_one()
814 HOSTDATA(shpnt)->swint = 0; in aha152x_probe_one()
816 printk(KERN_INFO "aha152x%d: trying software interrupt, ", shpnt->host_no); in aha152x_probe_one()
821 free_irq(shpnt->irq, shpnt); in aha152x_probe_one()
823 if (!HOSTDATA(shpnt)->swint) { in aha152x_probe_one()
833 "Please verify.\n", shpnt->host_no, shpnt->irq); in aha152x_probe_one()
843 if (request_irq(shpnt->irq, intr, IRQF_SHARED, "aha152x", shpnt)) { in aha152x_probe_one()
844 printk(KERN_ERR "aha152x%d: failed to reassign irq %d.\n", shpnt->host_no, shpnt->irq); in aha152x_probe_one()
848 if( scsi_add_host(shpnt, NULL) ) { in aha152x_probe_one()
849 free_irq(shpnt->irq, shpnt); in aha152x_probe_one()
850 printk(KERN_ERR "aha152x%d: failed to add host.\n", shpnt->host_no); in aha152x_probe_one()
854 scsi_scan_host(shpnt); in aha152x_probe_one()
856 return shpnt; in aha152x_probe_one()
859 list_del(&HOSTDATA(shpnt)->host_list); in aha152x_probe_one()
860 scsi_host_put(shpnt); in aha152x_probe_one()
865 void aha152x_release(struct Scsi_Host *shpnt) in aha152x_release() argument
867 if (!shpnt) in aha152x_release()
870 scsi_remove_host(shpnt); in aha152x_release()
871 if (shpnt->irq) in aha152x_release()
872 free_irq(shpnt->irq, shpnt); in aha152x_release()
875 if (shpnt->io_port) in aha152x_release()
876 release_region(shpnt->io_port, IO_RANGE); in aha152x_release()
880 if (HOSTDATA(shpnt)->pnpdev) in aha152x_release()
881 pnp_device_detach(HOSTDATA(shpnt)->pnpdev); in aha152x_release()
884 list_del(&HOSTDATA(shpnt)->host_list); in aha152x_release()
885 scsi_host_put(shpnt); in aha152x_release()
894 static int setup_expected_interrupts(struct Scsi_Host *shpnt) in setup_expected_interrupts() argument
917 if(!HOSTDATA(shpnt)->in_intr) in setup_expected_interrupts()
931 struct Scsi_Host *shpnt = SCpnt->device->host; in aha152x_internal_queue() local
976 HOSTDATA(shpnt)->total_commands++; in aha152x_internal_queue()
980 HOSTDATA(shpnt)->commands++; in aha152x_internal_queue()
981 if (HOSTDATA(shpnt)->commands==1) in aha152x_internal_queue()
986 if(!HOSTDATA(shpnt)->in_intr) in aha152x_internal_queue()
987 setup_expected_interrupts(shpnt); in aha152x_internal_queue()
1032 struct Scsi_Host *shpnt = SCpnt->device->host; in aha152x_abort() local
1041 HOSTDATA(shpnt)->commands--; in aha152x_abort()
1042 if (!HOSTDATA(shpnt)->commands) in aha152x_abort()
1073 struct Scsi_Host *shpnt = SCpnt->device->host; in aha152x_device_reset() local
1107 HOSTDATA(shpnt)->commands--; in aha152x_device_reset()
1108 if (!HOSTDATA(shpnt)->commands) in aha152x_device_reset()
1129 static void free_hard_reset_SCs(struct Scsi_Host *shpnt, in free_hard_reset_SCs() argument
1148 HOSTDATA(shpnt)->commands--; in free_hard_reset_SCs()
1164 static int aha152x_bus_reset_host(struct Scsi_Host *shpnt) in aha152x_bus_reset_host() argument
1170 free_hard_reset_SCs(shpnt, &ISSUE_SC); in aha152x_bus_reset_host()
1171 free_hard_reset_SCs(shpnt, &DISCONNECTED_SC); in aha152x_bus_reset_host()
1178 setup_expected_interrupts(shpnt); in aha152x_bus_reset_host()
1179 if(HOSTDATA(shpnt)->commands==0) in aha152x_bus_reset_host()
1200 static void reset_ports(struct Scsi_Host *shpnt) in reset_ports() argument
1229 setup_expected_interrupts(shpnt); in reset_ports()
1237 int aha152x_host_reset_host(struct Scsi_Host *shpnt) in aha152x_host_reset_host() argument
1239 aha152x_bus_reset_host(shpnt); in aha152x_host_reset_host()
1240 reset_ports(shpnt); in aha152x_host_reset_host()
1252 struct Scsi_Host *shpnt = sdev->host; in aha152x_biosparam() local
1300 static void done(struct Scsi_Host *shpnt, unsigned char status_byte, in done() argument
1340 struct Scsi_Host *shpnt = dev_id; in intr() local
1370 if( HOSTDATA(shpnt)->service==0 ) { in intr()
1371 HOSTDATA(shpnt)->service=1; in intr()
1387 static void busfree_run(struct Scsi_Host *shpnt) in busfree_run() argument
1409 done(shpnt, acp->status, DID_OK); in busfree_run()
1412 done(shpnt, acp->status, DID_ABORT); in busfree_run()
1415 done(shpnt, acp->status, DID_RESET); in busfree_run()
1420 HOSTDATA(shpnt)->disconnections++; in busfree_run()
1427 done(shpnt, SAM_STAT_GOOD, DID_ERROR); in busfree_run()
1431 HOSTDATA(shpnt)->busfree_without_old_command++; in busfree_run()
1443 struct scsi_cmnd *cmd = HOSTDATA(shpnt)->done_SC; in busfree_run()
1450 HOSTDATA(shpnt)->commands--; in busfree_run()
1451 if (!HOSTDATA(shpnt)->commands) in busfree_run()
1455 HOSTDATA(shpnt)->busfree_with_check_condition++; in busfree_run()
1479 HOSTDATA(shpnt)->commands--; in busfree_run()
1480 if (!HOSTDATA(shpnt)->commands) in busfree_run()
1496 HOSTDATA(shpnt)->busfree_without_done_command++; in busfree_run()
1516 SETPORT(SCSIID, (shpnt->this_id << OID_) | CURRENT_SC->device->id); in busfree_run()
1521 HOSTDATA(shpnt)->busfree_without_new_command++; in busfree_run()
1528 HOSTDATA(shpnt)->busfree_without_any_action++; in busfree_run()
1537 static void seldo_run(struct Scsi_Host *shpnt) in seldo_run() argument
1552 done(shpnt, SAM_STAT_GOOD, DID_NO_CONNECT); in seldo_run()
1578 static void selto_run(struct Scsi_Host *shpnt) in selto_run() argument
1592 done(shpnt, SAM_STAT_GOOD, DID_ABORT); in selto_run()
1594 done(shpnt, SAM_STAT_GOOD, DID_BUS_BUSY); in selto_run()
1597 done(shpnt, SAM_STAT_GOOD, DID_NO_CONNECT); in selto_run()
1607 static void seldi_run(struct Scsi_Host *shpnt) in seldi_run() argument
1637 selid = GETPORT(SELID) & ~(1 << shpnt->this_id); in seldi_run()
1640 shost_printk(KERN_INFO, shpnt, in seldi_run()
1649 shost_printk(KERN_INFO, shpnt, in seldi_run()
1654 SETPORT(SCSIID, (shpnt->this_id << OID_) | target); in seldi_run()
1657 SETRATE(HOSTDATA(shpnt)->syncrate[target]); in seldi_run()
1675 static void msgi_run(struct Scsi_Host *shpnt) in msgi_run() argument
1691 shost_printk(KERN_ERR, shpnt, in msgi_run()
1700 shost_printk(KERN_ERR, shpnt, in msgi_run()
1708 show_queues(shpnt); in msgi_run()
1709 shost_printk(KERN_ERR, shpnt, in msgi_run()
1776 if (!HOSTDATA(shpnt)->synchronous) in msgi_run()
1831 HOSTDATA(shpnt)->syncrate[i]=0; in msgi_run()
1832 HOSTDATA(shpnt)->syncneg[i]=0; in msgi_run()
1852 static void msgi_end(struct Scsi_Host *shpnt) in msgi_end() argument
1867 static void msgo_init(struct Scsi_Host *shpnt) in msgo_init() argument
1886 static void msgo_run(struct Scsi_Host *shpnt) in msgo_run() argument
1913 static void msgo_end(struct Scsi_Host *shpnt) in msgo_end() argument
1934 static void cmd_init(struct Scsi_Host *shpnt) in cmd_init() argument
1939 done(shpnt, SAM_STAT_GOOD, DID_ERROR); in cmd_init()
1950 static void cmd_run(struct Scsi_Host *shpnt) in cmd_run() argument
1960 static void cmd_end(struct Scsi_Host *shpnt) in cmd_end() argument
1974 static void status_run(struct Scsi_Host *shpnt) in status_run() argument
1987 static void datai_init(struct Scsi_Host *shpnt) in datai_init() argument
2001 static void datai_run(struct Scsi_Host *shpnt) in datai_run() argument
2109 static void datai_end(struct Scsi_Host *shpnt) in datai_end() argument
2121 static void datao_init(struct Scsi_Host *shpnt) in datao_init() argument
2135 static void datao_run(struct Scsi_Host *shpnt) in datao_run() argument
2188 static void datao_end(struct Scsi_Host *shpnt) in datao_end() argument
2224 static int update_state(struct Scsi_Host *shpnt) in update_state() argument
2279 static void parerr_run(struct Scsi_Host *shpnt) in parerr_run() argument
2282 done(shpnt, SAM_STAT_GOOD, DID_PARITY); in parerr_run()
2289 static void rsti_run(struct Scsi_Host *shpnt) in rsti_run() argument
2293 shost_printk(KERN_NOTICE, shpnt, "scsi reset in\n"); in rsti_run()
2313 done(shpnt, SAM_STAT_GOOD, DID_RESET); in rsti_run()
2321 static void is_complete(struct Scsi_Host *shpnt) in is_complete() argument
2327 if(!shpnt) in is_complete()
2332 if( HOSTDATA(shpnt)->service==0 ) { in is_complete()
2337 HOSTDATA(shpnt)->service = 0; in is_complete()
2339 if(HOSTDATA(shpnt)->in_intr) { in is_complete()
2342 aha152x_error(shpnt, "bottom-half already running!?"); in is_complete()
2344 HOSTDATA(shpnt)->in_intr++; in is_complete()
2354 dataphase=update_state(shpnt); in is_complete()
2361 states[PREVSTATE].end(shpnt); in is_complete()
2402 states[STATE].init(shpnt); in is_complete()
2409 states[STATE].run(shpnt); in is_complete()
2421 pending=setup_expected_interrupts(shpnt); in is_complete()
2423 HOSTDATA(shpnt)->count[STATE]++; in is_complete()
2425 HOSTDATA(shpnt)->count_trans[STATE]++; in is_complete()
2426 HOSTDATA(shpnt)->time[STATE] += jiffies-start; in is_complete()
2435 HOSTDATA(shpnt)->in_intr--; in is_complete()
2444 static void aha152x_error(struct Scsi_Host *shpnt, char *msg) in aha152x_error() argument
2446 shost_printk(KERN_EMERG, shpnt, "%s\n", msg); in aha152x_error()
2447 show_queues(shpnt); in aha152x_error()
2454 static void disp_enintr(struct Scsi_Host *shpnt) in disp_enintr() argument
2461 shost_printk(KERN_DEBUG, shpnt, in disp_enintr()
2506 static void show_queues(struct Scsi_Host *shpnt) in show_queues() argument
2527 disp_enintr(shpnt); in show_queues()
2565 static void get_ports(struct seq_file *m, struct Scsi_Host *shpnt) in get_ports() argument
2824 static int aha152x_set_info(struct Scsi_Host *shpnt, char *buffer, int length) in aha152x_set_info() argument
2826 if(!shpnt || !buffer || length<8 || strncmp("aha152x ", buffer, 8)!=0) in aha152x_set_info()
2833 HOSTDATA(shpnt)->total_commands=0; in aha152x_set_info()
2834 HOSTDATA(shpnt)->disconnections=0; in aha152x_set_info()
2835 HOSTDATA(shpnt)->busfree_without_any_action=0; in aha152x_set_info()
2836 HOSTDATA(shpnt)->busfree_without_old_command=0; in aha152x_set_info()
2837 HOSTDATA(shpnt)->busfree_without_new_command=0; in aha152x_set_info()
2838 HOSTDATA(shpnt)->busfree_without_done_command=0; in aha152x_set_info()
2839 HOSTDATA(shpnt)->busfree_with_check_condition=0; in aha152x_set_info()
2841 HOSTDATA(shpnt)->count[i]=0; in aha152x_set_info()
2842 HOSTDATA(shpnt)->count_trans[i]=0; in aha152x_set_info()
2843 HOSTDATA(shpnt)->time[i]=0; in aha152x_set_info()
2846 shost_printk(KERN_INFO, shpnt, "aha152x: stats reset.\n"); in aha152x_set_info()
2858 static int aha152x_show_info(struct seq_file *m, struct Scsi_Host *shpnt) in aha152x_show_info() argument
2867 shpnt->io_port, shpnt->io_port + shpnt->n_io_port - 1); in aha152x_show_info()
2868 seq_printf(m, "interrupt 0x%02x\n", shpnt->irq); in aha152x_show_info()
2875 seq_printf(m, "%d commands currently queued\n", HOSTDATA(shpnt)->commands); in aha152x_show_info()
2880 if (HOSTDATA(shpnt)->syncrate[i] & 0x7f) in aha152x_show_info()
2883 (((HOSTDATA(shpnt)->syncrate[i] & 0x70) >> 4) + 2), in aha152x_show_info()
2884 (((HOSTDATA(shpnt)->syncrate[i] & 0x70) >> 4) + 2) * 50, in aha152x_show_info()
2885 HOSTDATA(shpnt)->syncrate[i] & 0x0f); in aha152x_show_info()
2910 get_ports(m, shpnt); in aha152x_show_info()
2925 HOSTDATA(shpnt)->total_commands, in aha152x_show_info()
2926 HOSTDATA(shpnt)->disconnections, in aha152x_show_info()
2927 HOSTDATA(shpnt)->busfree_with_check_condition, in aha152x_show_info()
2928 HOSTDATA(shpnt)->busfree_without_old_command, in aha152x_show_info()
2929 HOSTDATA(shpnt)->busfree_without_new_command, in aha152x_show_info()
2930 HOSTDATA(shpnt)->busfree_without_done_command, in aha152x_show_info()
2931 HOSTDATA(shpnt)->busfree_without_any_action); in aha152x_show_info()
2935 HOSTDATA(shpnt)->count_trans[i], in aha152x_show_info()
2936 HOSTDATA(shpnt)->count[i], in aha152x_show_info()
2937 HOSTDATA(shpnt)->time[i]); in aha152x_show_info()
3365 struct Scsi_Host *shpnt = aha152x_probe_one(&setup[i]); in aha152x_init() local
3367 if( !shpnt ) { in aha152x_init()
3371 HOSTDATA(shpnt)->pnpdev=pnpdev[i]; in aha152x_init()