Lines Matching refs:shpnt

509 #define HOSTDATA(shpnt)		((struct aha152x_hostdata *) &shpnt->hostdata)  argument
511 #define HOSTNO ((shpnt)->host_no)
513 #define CURRENT_SC (HOSTDATA(shpnt)->current_SC)
514 #define DONE_SC (HOSTDATA(shpnt)->done_SC)
515 #define ISSUE_SC (HOSTDATA(shpnt)->issue_SC)
516 #define DISCONNECTED_SC (HOSTDATA(shpnt)->disconnected_SC)
517 #define QLOCK (HOSTDATA(shpnt)->lock)
518 #define QLOCKER (HOSTDATA(shpnt)->locker)
519 #define QLOCKERL (HOSTDATA(shpnt)->lockerl)
521 #define STATE (HOSTDATA(shpnt)->state)
522 #define PREVSTATE (HOSTDATA(shpnt)->prevstate)
523 #define LASTSTATE (HOSTDATA(shpnt)->laststate)
525 #define RECONN_TARGET (HOSTDATA(shpnt)->target)
527 #define CMD_I (HOSTDATA(shpnt)->cmd_i)
529 #define MSGO(i) (HOSTDATA(shpnt)->msgo[i])
530 #define MSGO_I (HOSTDATA(shpnt)->msgo_i)
531 #define MSGOLEN (HOSTDATA(shpnt)->msgo_len)
532 #define ADDMSGO(x) (MSGOLEN<256 ? (void)(MSGO(MSGOLEN++)=x) : aha152x_error(shpnt,"MSGO overflow"))
534 #define MSGI(i) (HOSTDATA(shpnt)->msgi[i])
535 #define MSGILEN (HOSTDATA(shpnt)->msgi_len)
536 #define ADDMSGI(x) (MSGILEN<256 ? (void)(MSGI(MSGILEN++)=x) : aha152x_error(shpnt,"MSGI overflow"))
538 #define DATA_LEN (HOSTDATA(shpnt)->data_len)
540 #define SYNCRATE (HOSTDATA(shpnt)->syncrate[CURRENT_SC->device->id])
541 #define SYNCNEG (HOSTDATA(shpnt)->syncneg[CURRENT_SC->device->id])
543 #define DELAY (HOSTDATA(shpnt)->delay)
544 #define EXT_TRANS (HOSTDATA(shpnt)->ext_trans)
545 #define TC1550 (HOSTDATA(shpnt)->tc1550)
546 #define RECONNECT (HOSTDATA(shpnt)->reconnect)
547 #define PARITY (HOSTDATA(shpnt)->parity)
548 #define SYNCHRONOUS (HOSTDATA(shpnt)->synchronous)
550 #define HOSTIOPORT0 (HOSTDATA(shpnt)->io_port0)
551 #define HOSTIOPORT1 (HOSTDATA(shpnt)->io_port1)
560 static void seldi_run(struct Scsi_Host *shpnt);
561 static void seldo_run(struct Scsi_Host *shpnt);
562 static void selto_run(struct Scsi_Host *shpnt);
563 static void busfree_run(struct Scsi_Host *shpnt);
565 static void msgo_init(struct Scsi_Host *shpnt);
566 static void msgo_run(struct Scsi_Host *shpnt);
567 static void msgo_end(struct Scsi_Host *shpnt);
569 static void cmd_init(struct Scsi_Host *shpnt);
570 static void cmd_run(struct Scsi_Host *shpnt);
571 static void cmd_end(struct Scsi_Host *shpnt);
573 static void datai_init(struct Scsi_Host *shpnt);
574 static void datai_run(struct Scsi_Host *shpnt);
575 static void datai_end(struct Scsi_Host *shpnt);
577 static void datao_init(struct Scsi_Host *shpnt);
578 static void datao_run(struct Scsi_Host *shpnt);
579 static void datao_end(struct Scsi_Host *shpnt);
581 static void status_run(struct Scsi_Host *shpnt);
583 static void msgi_run(struct Scsi_Host *shpnt);
584 static void msgi_end(struct Scsi_Host *shpnt);
586 static void parerr_run(struct Scsi_Host *shpnt);
587 static void rsti_run(struct Scsi_Host *shpnt);
589 static void is_complete(struct Scsi_Host *shpnt);
620 static void reset_ports(struct Scsi_Host *shpnt);
621 static void aha152x_error(struct Scsi_Host *shpnt, char *msg);
622 static void done(struct Scsi_Host *shpnt, int error);
626 static void show_queues(struct Scsi_Host *shpnt);
627 static void disp_enintr(struct Scsi_Host *shpnt);
706 struct Scsi_Host *shpnt = dev_id; in swintr() local
708 HOSTDATA(shpnt)->swint++; in swintr()
716 struct Scsi_Host *shpnt; in aha152x_probe_one() local
718 shpnt = scsi_host_alloc(&aha152x_driver_template, sizeof(struct aha152x_hostdata)); in aha152x_probe_one()
719 if (!shpnt) { in aha152x_probe_one()
724 memset(HOSTDATA(shpnt), 0, sizeof *HOSTDATA(shpnt)); in aha152x_probe_one()
725 INIT_LIST_HEAD(&HOSTDATA(shpnt)->host_list); in aha152x_probe_one()
728 list_add_tail(&HOSTDATA(shpnt)->host_list, &aha152x_host_list); in aha152x_probe_one()
730 shpnt->io_port = setup->io_port; in aha152x_probe_one()
731 shpnt->n_io_port = IO_RANGE; in aha152x_probe_one()
732 shpnt->irq = setup->irq; in aha152x_probe_one()
750 shpnt->this_id = setup->scsiid; in aha152x_probe_one()
753 shpnt->can_queue = AHA152X_MAXQUEUE; in aha152x_probe_one()
762 reset_ports(shpnt); in aha152x_probe_one()
775 shpnt->host_no, setup->tc1550 ? " (tc1550 mode)" : "", in aha152x_probe_one()
777 shpnt->io_port, HOSTIOPORT0, HOSTIOPORT1, in aha152x_probe_one()
778 shpnt->irq, in aha152x_probe_one()
779 shpnt->this_id, in aha152x_probe_one()
790 if (request_irq(shpnt->irq, swintr, IRQF_SHARED, "aha152x", shpnt)) { in aha152x_probe_one()
791 printk(KERN_ERR "aha152x%d: irq %d busy.\n", shpnt->host_no, shpnt->irq); in aha152x_probe_one()
795 HOSTDATA(shpnt)->swint = 0; in aha152x_probe_one()
797 printk(KERN_INFO "aha152x%d: trying software interrupt, ", shpnt->host_no); in aha152x_probe_one()
802 free_irq(shpnt->irq, shpnt); in aha152x_probe_one()
804 if (!HOSTDATA(shpnt)->swint) { in aha152x_probe_one()
814 "Please verify.\n", shpnt->host_no, shpnt->irq); in aha152x_probe_one()
824 if (request_irq(shpnt->irq, intr, IRQF_SHARED, "aha152x", shpnt)) { in aha152x_probe_one()
825 printk(KERN_ERR "aha152x%d: failed to reassign irq %d.\n", shpnt->host_no, shpnt->irq); in aha152x_probe_one()
829 if( scsi_add_host(shpnt, NULL) ) { in aha152x_probe_one()
830 free_irq(shpnt->irq, shpnt); in aha152x_probe_one()
831 printk(KERN_ERR "aha152x%d: failed to add host.\n", shpnt->host_no); in aha152x_probe_one()
835 scsi_scan_host(shpnt); in aha152x_probe_one()
837 return shpnt; in aha152x_probe_one()
840 list_del(&HOSTDATA(shpnt)->host_list); in aha152x_probe_one()
841 scsi_host_put(shpnt); in aha152x_probe_one()
846 void aha152x_release(struct Scsi_Host *shpnt) in aha152x_release() argument
848 if (!shpnt) in aha152x_release()
851 scsi_remove_host(shpnt); in aha152x_release()
852 if (shpnt->irq) in aha152x_release()
853 free_irq(shpnt->irq, shpnt); in aha152x_release()
856 if (shpnt->io_port) in aha152x_release()
857 release_region(shpnt->io_port, IO_RANGE); in aha152x_release()
861 if (HOSTDATA(shpnt)->pnpdev) in aha152x_release()
862 pnp_device_detach(HOSTDATA(shpnt)->pnpdev); in aha152x_release()
865 list_del(&HOSTDATA(shpnt)->host_list); in aha152x_release()
866 scsi_host_put(shpnt); in aha152x_release()
875 static int setup_expected_interrupts(struct Scsi_Host *shpnt) in setup_expected_interrupts() argument
896 if(!HOSTDATA(shpnt)->in_intr) in setup_expected_interrupts()
910 struct Scsi_Host *shpnt = SCpnt->device->host; in aha152x_internal_queue() local
957 HOSTDATA(shpnt)->total_commands++; in aha152x_internal_queue()
961 HOSTDATA(shpnt)->commands++; in aha152x_internal_queue()
962 if (HOSTDATA(shpnt)->commands==1) in aha152x_internal_queue()
967 if(!HOSTDATA(shpnt)->in_intr) in aha152x_internal_queue()
968 setup_expected_interrupts(shpnt); in aha152x_internal_queue()
1006 struct Scsi_Host *shpnt = SCpnt->device->host; in aha152x_abort() local
1015 HOSTDATA(shpnt)->commands--; in aha152x_abort()
1016 if (!HOSTDATA(shpnt)->commands) in aha152x_abort()
1047 struct Scsi_Host *shpnt = SCpnt->device->host; in aha152x_device_reset() local
1081 HOSTDATA(shpnt)->commands--; in aha152x_device_reset()
1082 if (!HOSTDATA(shpnt)->commands) in aha152x_device_reset()
1103 static void free_hard_reset_SCs(struct Scsi_Host *shpnt, in free_hard_reset_SCs() argument
1122 HOSTDATA(shpnt)->commands--; in free_hard_reset_SCs()
1138 static int aha152x_bus_reset_host(struct Scsi_Host *shpnt) in aha152x_bus_reset_host() argument
1144 free_hard_reset_SCs(shpnt, &ISSUE_SC); in aha152x_bus_reset_host()
1145 free_hard_reset_SCs(shpnt, &DISCONNECTED_SC); in aha152x_bus_reset_host()
1152 setup_expected_interrupts(shpnt); in aha152x_bus_reset_host()
1153 if(HOSTDATA(shpnt)->commands==0) in aha152x_bus_reset_host()
1174 static void reset_ports(struct Scsi_Host *shpnt) in reset_ports() argument
1203 setup_expected_interrupts(shpnt); in reset_ports()
1211 int aha152x_host_reset_host(struct Scsi_Host *shpnt) in aha152x_host_reset_host() argument
1213 aha152x_bus_reset_host(shpnt); in aha152x_host_reset_host()
1214 reset_ports(shpnt); in aha152x_host_reset_host()
1226 struct Scsi_Host *shpnt = sdev->host; in aha152x_biosparam() local
1274 static void done(struct Scsi_Host *shpnt, int error) in done() argument
1312 struct Scsi_Host *shpnt = dev_id; in intr() local
1342 if( HOSTDATA(shpnt)->service==0 ) { in intr()
1343 HOSTDATA(shpnt)->service=1; in intr()
1359 static void busfree_run(struct Scsi_Host *shpnt) in busfree_run() argument
1379 …done(shpnt, (CURRENT_SC->SCp.Status & 0xff) | ((CURRENT_SC->SCp.Message & 0xff) << 8) | (DID_OK <<… in busfree_run()
1382 …done(shpnt, (CURRENT_SC->SCp.Status & 0xff) | ((CURRENT_SC->SCp.Message & 0xff) << 8) | (DID_ABORT… in busfree_run()
1385 …done(shpnt, (CURRENT_SC->SCp.Status & 0xff) | ((CURRENT_SC->SCp.Message & 0xff) << 8) | (DID_RESET… in busfree_run()
1390 HOSTDATA(shpnt)->disconnections++; in busfree_run()
1397 done(shpnt, DID_ERROR << 16); in busfree_run()
1401 HOSTDATA(shpnt)->busfree_without_old_command++; in busfree_run()
1413 struct scsi_cmnd *cmd = HOSTDATA(shpnt)->done_SC; in busfree_run()
1420 HOSTDATA(shpnt)->commands--; in busfree_run()
1421 if (!HOSTDATA(shpnt)->commands) in busfree_run()
1425 HOSTDATA(shpnt)->busfree_with_check_condition++; in busfree_run()
1449 HOSTDATA(shpnt)->commands--; in busfree_run()
1450 if (!HOSTDATA(shpnt)->commands) in busfree_run()
1466 HOSTDATA(shpnt)->busfree_without_done_command++; in busfree_run()
1484 SETPORT(SCSIID, (shpnt->this_id << OID_) | CURRENT_SC->device->id); in busfree_run()
1489 HOSTDATA(shpnt)->busfree_without_new_command++; in busfree_run()
1496 HOSTDATA(shpnt)->busfree_without_any_action++; in busfree_run()
1505 static void seldo_run(struct Scsi_Host *shpnt) in seldo_run() argument
1518 done(shpnt, DID_NO_CONNECT << 16); in seldo_run()
1544 static void selto_run(struct Scsi_Host *shpnt) in selto_run() argument
1555 done(shpnt, DID_ABORT << 16); in selto_run()
1557 done(shpnt, DID_BUS_BUSY << 16); in selto_run()
1560 done(shpnt, DID_NO_CONNECT << 16); in selto_run()
1570 static void seldi_run(struct Scsi_Host *shpnt) in seldi_run() argument
1598 selid = GETPORT(SELID) & ~(1 << shpnt->this_id); in seldi_run()
1601 shost_printk(KERN_INFO, shpnt, in seldi_run()
1610 shost_printk(KERN_INFO, shpnt, in seldi_run()
1615 SETPORT(SCSIID, (shpnt->this_id << OID_) | target); in seldi_run()
1618 SETRATE(HOSTDATA(shpnt)->syncrate[target]); in seldi_run()
1636 static void msgi_run(struct Scsi_Host *shpnt) in msgi_run() argument
1651 shost_printk(KERN_ERR, shpnt, in msgi_run()
1660 shost_printk(KERN_ERR, shpnt, in msgi_run()
1668 show_queues(shpnt); in msgi_run()
1669 shost_printk(KERN_ERR, shpnt, in msgi_run()
1734 if (!HOSTDATA(shpnt)->synchronous) in msgi_run()
1789 HOSTDATA(shpnt)->syncrate[i]=0; in msgi_run()
1790 HOSTDATA(shpnt)->syncneg[i]=0; in msgi_run()
1810 static void msgi_end(struct Scsi_Host *shpnt) in msgi_end() argument
1825 static void msgo_init(struct Scsi_Host *shpnt) in msgo_init() argument
1843 static void msgo_run(struct Scsi_Host *shpnt) in msgo_run() argument
1868 static void msgo_end(struct Scsi_Host *shpnt) in msgo_end() argument
1889 static void cmd_init(struct Scsi_Host *shpnt) in cmd_init() argument
1894 done(shpnt, DID_ERROR << 16); in cmd_init()
1905 static void cmd_run(struct Scsi_Host *shpnt) in cmd_run() argument
1915 static void cmd_end(struct Scsi_Host *shpnt) in cmd_end() argument
1929 static void status_run(struct Scsi_Host *shpnt) in status_run() argument
1942 static void datai_init(struct Scsi_Host *shpnt) in datai_init() argument
1956 static void datai_run(struct Scsi_Host *shpnt) in datai_run() argument
2063 static void datai_end(struct Scsi_Host *shpnt) in datai_end() argument
2075 static void datao_init(struct Scsi_Host *shpnt) in datao_init() argument
2089 static void datao_run(struct Scsi_Host *shpnt) in datao_run() argument
2142 static void datao_end(struct Scsi_Host *shpnt) in datao_end() argument
2177 static int update_state(struct Scsi_Host *shpnt) in update_state() argument
2231 static void parerr_run(struct Scsi_Host *shpnt) in parerr_run() argument
2234 done(shpnt, DID_PARITY << 16); in parerr_run()
2241 static void rsti_run(struct Scsi_Host *shpnt) in rsti_run() argument
2245 shost_printk(KERN_NOTICE, shpnt, "scsi reset in\n"); in rsti_run()
2265 done(shpnt, DID_RESET << 16 ); in rsti_run()
2273 static void is_complete(struct Scsi_Host *shpnt) in is_complete() argument
2279 if(!shpnt) in is_complete()
2284 if( HOSTDATA(shpnt)->service==0 ) { in is_complete()
2289 HOSTDATA(shpnt)->service = 0; in is_complete()
2291 if(HOSTDATA(shpnt)->in_intr) { in is_complete()
2294 aha152x_error(shpnt, "bottom-half already running!?"); in is_complete()
2296 HOSTDATA(shpnt)->in_intr++; in is_complete()
2306 dataphase=update_state(shpnt); in is_complete()
2313 states[PREVSTATE].end(shpnt); in is_complete()
2354 states[STATE].init(shpnt); in is_complete()
2361 states[STATE].run(shpnt); in is_complete()
2373 pending=setup_expected_interrupts(shpnt); in is_complete()
2375 HOSTDATA(shpnt)->count[STATE]++; in is_complete()
2377 HOSTDATA(shpnt)->count_trans[STATE]++; in is_complete()
2378 HOSTDATA(shpnt)->time[STATE] += jiffies-start; in is_complete()
2387 HOSTDATA(shpnt)->in_intr--; in is_complete()
2396 static void aha152x_error(struct Scsi_Host *shpnt, char *msg) in aha152x_error() argument
2398 shost_printk(KERN_EMERG, shpnt, "%s\n", msg); in aha152x_error()
2399 show_queues(shpnt); in aha152x_error()
2406 static void disp_enintr(struct Scsi_Host *shpnt) in disp_enintr() argument
2413 shost_printk(KERN_DEBUG, shpnt, in disp_enintr()
2456 static void show_queues(struct Scsi_Host *shpnt) in show_queues() argument
2477 disp_enintr(shpnt); in show_queues()
2513 static void get_ports(struct seq_file *m, struct Scsi_Host *shpnt) in get_ports() argument
2772 static int aha152x_set_info(struct Scsi_Host *shpnt, char *buffer, int length) in aha152x_set_info() argument
2774 if(!shpnt || !buffer || length<8 || strncmp("aha152x ", buffer, 8)!=0) in aha152x_set_info()
2781 HOSTDATA(shpnt)->total_commands=0; in aha152x_set_info()
2782 HOSTDATA(shpnt)->disconnections=0; in aha152x_set_info()
2783 HOSTDATA(shpnt)->busfree_without_any_action=0; in aha152x_set_info()
2784 HOSTDATA(shpnt)->busfree_without_old_command=0; in aha152x_set_info()
2785 HOSTDATA(shpnt)->busfree_without_new_command=0; in aha152x_set_info()
2786 HOSTDATA(shpnt)->busfree_without_done_command=0; in aha152x_set_info()
2787 HOSTDATA(shpnt)->busfree_with_check_condition=0; in aha152x_set_info()
2789 HOSTDATA(shpnt)->count[i]=0; in aha152x_set_info()
2790 HOSTDATA(shpnt)->count_trans[i]=0; in aha152x_set_info()
2791 HOSTDATA(shpnt)->time[i]=0; in aha152x_set_info()
2794 shost_printk(KERN_INFO, shpnt, "aha152x: stats reset.\n"); in aha152x_set_info()
2806 static int aha152x_show_info(struct seq_file *m, struct Scsi_Host *shpnt) in aha152x_show_info() argument
2815 shpnt->io_port, shpnt->io_port + shpnt->n_io_port - 1); in aha152x_show_info()
2816 seq_printf(m, "interrupt 0x%02x\n", shpnt->irq); in aha152x_show_info()
2823 seq_printf(m, "%d commands currently queued\n", HOSTDATA(shpnt)->commands); in aha152x_show_info()
2828 if (HOSTDATA(shpnt)->syncrate[i] & 0x7f) in aha152x_show_info()
2831 (((HOSTDATA(shpnt)->syncrate[i] & 0x70) >> 4) + 2), in aha152x_show_info()
2832 (((HOSTDATA(shpnt)->syncrate[i] & 0x70) >> 4) + 2) * 50, in aha152x_show_info()
2833 HOSTDATA(shpnt)->syncrate[i] & 0x0f); in aha152x_show_info()
2858 get_ports(m, shpnt); in aha152x_show_info()
2873 HOSTDATA(shpnt)->total_commands, in aha152x_show_info()
2874 HOSTDATA(shpnt)->disconnections, in aha152x_show_info()
2875 HOSTDATA(shpnt)->busfree_with_check_condition, in aha152x_show_info()
2876 HOSTDATA(shpnt)->busfree_without_old_command, in aha152x_show_info()
2877 HOSTDATA(shpnt)->busfree_without_new_command, in aha152x_show_info()
2878 HOSTDATA(shpnt)->busfree_without_done_command, in aha152x_show_info()
2879 HOSTDATA(shpnt)->busfree_without_any_action); in aha152x_show_info()
2883 HOSTDATA(shpnt)->count_trans[i], in aha152x_show_info()
2884 HOSTDATA(shpnt)->count[i], in aha152x_show_info()
2885 HOSTDATA(shpnt)->time[i]); in aha152x_show_info()
3312 struct Scsi_Host *shpnt = aha152x_probe_one(&setup[i]); in aha152x_init() local
3314 if( !shpnt ) { in aha152x_init()
3318 HOSTDATA(shpnt)->pnpdev=pnpdev[i]; in aha152x_init()