Lines Matching refs:ldn

503    unsigned int ldn;  in interrupt_handler()  local
538 ldn = intr_reg & 0x0f; in interrupt_handler()
540 lastSCSI = last_scsi_command(ihost_index)[ldn]; in interrupt_handler()
541 outb (IM_EOI | ldn, IM_ATTN_REG(ihost_index)); in interrupt_handler()
552 ld(ihost_index)[ldn].scb.enable); in interrupt_handler()
553 if (ld(ihost_index)[ldn].cmd) in interrupt_handler()
554 printk("%ld/%ld,",(long)(ld(ihost_index)[ldn].cmd->request_bufflen), in interrupt_handler()
555 (long)(ld(ihost_index)[ldn].scb.sys_buf_length)); in interrupt_handler()
558 if (ld(ihost_index)[ldn].cmd) in interrupt_handler()
559 printk("Blocksize=%d",ld(ihost_index)[ldn].scb.u2.blk.length); in interrupt_handler()
562 printk(", host=0x%x, ldn=0x%x\n",ihost_index, ldn); in interrupt_handler()
563 if (ld(ihost_index)[ldn].cmd) { in interrupt_handler()
564 printk("Blockcount=%d/%d\n",last_scsi_blockcount(ihost_index)[ldn], in interrupt_handler()
565 ld(ihost_index)[ldn].scb.u2.blk.count); in interrupt_handler()
566 printk("Logical block=%lx/%lx\n",last_scsi_logical_block(ihost_index)[ldn], in interrupt_handler()
567 ld(ihost_index)[ldn].scb.u1.log_blk_adr); in interrupt_handler()
576 last_scsi_type(ihost_index)[ldn]); in interrupt_handler()
585 if ((last_scsi_type(ihost_index)[ldn]==IM_SCB)|| in interrupt_handler()
586 (last_scsi_type(ihost_index)[ldn]==IM_LONG_SCB)) { in interrupt_handler()
588 ld(ihost_index)[ldn].scb.command); in interrupt_handler()
590 ld(ihost_index)[ldn].scb.enable); in interrupt_handler()
592 ld(ihost_index)[ldn].scb.u1.log_blk_adr); in interrupt_handler()
594 ld(ihost_index)[ldn].scb.sys_buf_adr); in interrupt_handler()
596 ld(ihost_index)[ldn].scb.sys_buf_length); in interrupt_handler()
598 ld(ihost_index)[ldn].scb.tsb_adr); in interrupt_handler()
600 ld(ihost_index)[ldn].scb.scb_chain_adr); in interrupt_handler()
602 ld(ihost_index)[ldn].scb.u2.blk.count); in interrupt_handler()
604 ld(ihost_index)[ldn].scb.u2.blk.length); in interrupt_handler()
628 last_scsi_command(ihost_index)[ldn] = NO_SCSI; in interrupt_handler()
632 if (last_scsi_type(ihost_index)[ldn] == IM_IMM_CMD) { in interrupt_handler()
635 (last_scsi_command(ihost_index)[ldn] == IM_RESET_IMM_CMD)) { in interrupt_handler()
647 last_scsi_command(ihost_index)[ldn] = NO_SCSI; in interrupt_handler()
648 last_scsi_type(ihost_index)[ldn] = 0; in interrupt_handler()
650 } else if (last_scsi_command(ihost_index)[ldn] == IM_ABORT_IMM_CMD) { in interrupt_handler()
657 cmd = ld(ihost_index)[ldn].cmd; in interrupt_handler()
658 ld(ihost_index)[ldn].cmd = NULL; in interrupt_handler()
664 last_scsi_command(ihost_index)[ldn] = NO_SCSI; in interrupt_handler()
665 last_scsi_type(ihost_index)[ldn] = 0; in interrupt_handler()
674 last_scsi_command(ihost_index)[ldn] = NO_SCSI; in interrupt_handler()
678 last_scsi_command(ihost_index)[ldn] = NO_SCSI; in interrupt_handler()
679 last_scsi_type(ihost_index)[ldn] = 0; in interrupt_handler()
680 cmd = ld(ihost_index)[ldn].cmd; in interrupt_handler()
681 ld(ihost_index)[ldn].cmd = NULL; in interrupt_handler()
697 ld(ihost_index)[ldn].tsb.dev_status, in interrupt_handler()
698 ld(ihost_index)[ldn].tsb.cmd_status, in interrupt_handler()
699 ld(ihost_index)[ldn].tsb.dev_error, in interrupt_handler()
700 ld(ihost_index)[ldn].tsb.cmd_error); in interrupt_handler()
703 if ((ld(ihost_index)[ldn].device_type!=TYPE_NO_LUN)&& in interrupt_handler()
704 (ld(ihost_index)[ldn].device_type!=TYPE_NO_DEVICE)) { in interrupt_handler()
714 cmd->result = (unsigned char)(ld(ihost_index)[ldn].tsb.dev_status & 0x1e); in interrupt_handler()
752 static int device_inquiry(int host_index, int ldn) in device_inquiry() argument
759 scb = &(ld(host_index)[ldn].scb); in device_inquiry()
760 tsb = &(ld(host_index)[ldn].tsb); in device_inquiry()
761 buf = (unsigned char *)(&(ld(host_index)[ldn].buf)); in device_inquiry()
762 ld(host_index)[ldn].tsb.dev_status = 0; /* prepare statusblock */ in device_inquiry()
767 last_scsi_command(host_index)[ldn] = IM_DEVICE_INQUIRY_CMD; in device_inquiry()
768 last_scsi_type(host_index)[ldn] = IM_SCB; in device_inquiry()
774 issue_cmd (host_index, virt_to_bus(scb), IM_SCB | ldn); in device_inquiry()
790 static int read_capacity(int host_index, int ldn) in read_capacity() argument
797 scb = &(ld(host_index)[ldn].scb); in read_capacity()
798 tsb = &(ld(host_index)[ldn].tsb); in read_capacity()
799 buf = (unsigned char *)(&(ld(host_index)[ldn].buf)); in read_capacity()
800 ld(host_index)[ldn].tsb.dev_status = 0; in read_capacity()
805 last_scsi_command(host_index)[ldn] = IM_READ_CAPACITY_CMD; in read_capacity()
806 last_scsi_type(host_index)[ldn] = IM_SCB; in read_capacity()
812 issue_cmd (host_index, virt_to_bus(scb), IM_SCB | ldn); in read_capacity()
873 unsigned int lun, unsigned int ldn, in immediate_assign() argument
887 imm_cmd |= (unsigned long)((ldn & 15) << 16); in immediate_assign()
896 imm_cmd |= (unsigned long)((ldn & 15) << 16); in immediate_assign()
952 static int immediate_reset(int host_index, unsigned int ldn) in immediate_reset() argument
962 last_scsi_command(host_index)[ldn] = IM_RESET_IMM_CMD; in immediate_reset()
963 last_scsi_type(host_index)[ldn] = IM_IMM_CMD; in immediate_reset()
966 issue_cmd (host_index, (unsigned long)(imm_command), IM_IMM_CMD | ldn); in immediate_reset()
1061 int ldn; in probe_bus_mode() local
1070 for (ldn=0; ldn<=MAX_LOG_DEV; ldn++) { in probe_bus_mode()
1073 if (!((info->cache_stat >> ldn) & 1)) in probe_bus_mode()
1074 ld(host_index)[ldn].cache_flag = 0; in probe_bus_mode()
1076 if (!((info->retry_stat >> ldn) & 1)) in probe_bus_mode()
1077 ld(host_index)[ldn].retry_flag = 0; in probe_bus_mode()
1081 for (ldn=0; ldn<=MAX_LOG_DEV; ldn++) { in probe_bus_mode()
1082 printk("%d",ld(host_index)[ldn].cache_flag); in probe_bus_mode()
1085 for (ldn=0; ldn<=MAX_LOG_DEV; ldn++) { in probe_bus_mode()
1086 printk("%d",ld(host_index)[ldn].retry_flag); in probe_bus_mode()
1097 int id, lun, ldn, ticks; in check_devices() local
1112 for (ldn=0; ldn<=MAX_LOG_DEV; ldn++) { in check_devices()
1113 last_scsi_command(host_index)[ldn] = NO_SCSI; /* emptify last SCSI-command storage */ in check_devices()
1114 last_scsi_type(host_index)[ldn] = 0; in check_devices()
1115 ld(host_index)[ldn].cache_flag = 1; in check_devices()
1116 ld(host_index)[ldn].retry_flag = 1; in check_devices()
1173 for (ldn=0; ldn<MAX_LOG_DEV; ldn++) { in check_devices()
1178 immediate_assign(host_index,0,0,ldn,REMOVE_LDN); /* remove ldn (wherever)*/ in check_devices()
1219 ldn = 0; in check_devices()
1222 for (lun=0; lun<8 && ldn<MAX_LOG_DEV; lun++) in check_devices()
1224 for (id=0; id<max_pun && ldn<MAX_LOG_DEV; id++) { in check_devices()
1234 immediate_assign(host_index,id,lun,ldn,SET_LDN); in check_devices()
1235 get_ldn(host_index)[id][lun]=ldn; /* map ldn */ in check_devices()
1236 if (device_exists (host_index, ldn, in check_devices()
1237 &ld(host_index)[ldn].block_length, in check_devices()
1238 &ld(host_index)[ldn].device_type)) { in check_devices()
1240 printk("resetting device at ldn=%x ... ",ldn); in check_devices()
1241 immediate_reset(host_index,ldn); in check_devices()
1243 ldn++; in check_devices()
1250 immediate_assign(host_index,0,0,ldn,REMOVE_LDN); in check_devices()
1251 } else ldn++; in check_devices()
1255 immediate_assign(host_index,id,lun,ldn,SET_LDN); in check_devices()
1256 get_ldn(host_index)[id][lun]=ldn; /* map ldn */ in check_devices()
1257 ldn++; in check_devices()
1264 for (lun=1; lun<8 && ldn<MAX_LOG_DEV; lun++) in check_devices()
1265 for (id=0; id<max_pun && ldn<MAX_LOG_DEV; id++) { in check_devices()
1273 immediate_assign(host_index,id,lun,ldn,SET_LDN); in check_devices()
1274 get_ldn(host_index)[id][lun]=ldn; in check_devices()
1275 ldn++; in check_devices()
1316 if (ldn == 0) in check_devices()
1341 static int device_exists (int host_index, int ldn, int *block_length, in device_exists() argument
1346 if (!(device_inquiry(host_index, ldn))) in device_exists()
1348 buf = (unsigned char *)(&(ld(host_index)[ldn].buf)); in device_exists()
1361 if (read_capacity( host_index, ldn)) { in device_exists()
1370 if (read_capacity( host_index, ldn)) { in device_exists()
1857 unsigned int ldn; in ibmmca_queuecommand() local
1897 ldn = get_ldn(host_index)[target][cmd->lun]; in ibmmca_queuecommand()
1898 if (ldn >= MAX_LOG_DEV) { /* on invalid ldn do special stuff */ in ibmmca_queuecommand()
1899 if (ldn > MAX_LOG_DEV) { /* dynamical remapping if ldn unassigned */ in ibmmca_queuecommand()
1932 ldn = next_ldn(host_index); in ibmmca_queuecommand()
1936 immediate_assign(host_index,target,cmd->lun,ldn,SET_LDN); in ibmmca_queuecommand()
1938 if (device_exists (host_index, ldn, in ibmmca_queuecommand()
1939 &ld(host_index)[ldn].block_length, in ibmmca_queuecommand()
1940 &ld(host_index)[ldn].device_type)) { in ibmmca_queuecommand()
1941 ld(host_index)[ldn].cmd = NULL; /* To prevent panic set 0, because in ibmmca_queuecommand()
1944 get_scsi(host_index)[target][cmd->lun] = ld(host_index)[ldn].device_type; in ibmmca_queuecommand()
1947 IBM_DS(host_index).ldn_assignments[ldn]++; in ibmmca_queuecommand()
1952 ldn, target, cmd->lun); in ibmmca_queuecommand()
1970 ldn, target, cmd->lun); in ibmmca_queuecommand()
1984 if (ld(host_index)[ldn].cmd) in ibmmca_queuecommand()
1989 ld(host_index)[ldn].cmd = cmd; in ibmmca_queuecommand()
1992 scb = &(ld(host_index)[ldn].scb); in ibmmca_queuecommand()
1993 ld(host_index)[ldn].tsb.dev_status = 0; in ibmmca_queuecommand()
1995 scb->tsb_adr = virt_to_bus(&(ld(host_index)[ldn].tsb)); in ibmmca_queuecommand()
2004 ld(host_index)[ldn].sge[i].address = (void *)(virt_to_bus(sl[i].address)); in ibmmca_queuecommand()
2005 ld(host_index)[ldn].sge[i].byte_length = sl[i].length; in ibmmca_queuecommand()
2008 scb->sys_buf_adr = virt_to_bus(&(ld(host_index)[ldn].sge[0])); in ibmmca_queuecommand()
2036 printk("issue scsi cmd=%02x to ldn=%d\n", scsi_cmd, ldn); in ibmmca_queuecommand()
2041 if (ld(host_index)[ldn].device_type==IM_DEBUG_CMD_DEVICE) in ibmmca_queuecommand()
2043 ld(host_index)[ldn].device_type, scsi_cmd, ldn); in ibmmca_queuecommand()
2047 last_scsi_command(host_index)[ldn] = scsi_cmd; in ibmmca_queuecommand()
2048 last_scsi_type(host_index)[ldn] = IM_SCB; in ibmmca_queuecommand()
2051 IBM_DS(host_index).ldn_access[ldn]++; in ibmmca_queuecommand()
2063 switch (ld(host_index)[ldn].device_type) { in ibmmca_queuecommand()
2070 IBM_DS(host_index).ldn_read_access[ldn]++; /* increase READ-access on ldn stat. */ in ibmmca_queuecommand()
2073 IBM_DS(host_index).ldn_write_access[ldn]++; /* increase write-count on ldn stat.*/ in ibmmca_queuecommand()
2089 last_scsi_logical_block(host_index)[ldn] = scb->u1.log_blk_adr; in ibmmca_queuecommand()
2090 last_scsi_blockcount(host_index)[ldn] = scb->u2.blk.count; in ibmmca_queuecommand()
2091 scb->u2.blk.length = ld(host_index)[ldn].block_length; in ibmmca_queuecommand()
2112 last_scsi_type(host_index)[ldn] = IM_LONG_SCB; in ibmmca_queuecommand()
2119 IBM_DS(host_index).ldn_inquiry_access[ldn]++; in ibmmca_queuecommand()
2130 last_scsi_type(host_index)[ldn] = IM_LONG_SCB; in ibmmca_queuecommand()
2146 IBM_DS(host_index).ldn_modeselect_access[ldn]++; in ibmmca_queuecommand()
2151 last_scsi_type(host_index)[ldn] = IM_LONG_SCB; in ibmmca_queuecommand()
2160 last_scsi_type(host_index)[ldn] = IM_LONG_SCB; in ibmmca_queuecommand()
2167 if (last_scsi_type(host_index)[ldn] == IM_LONG_SCB) { in ibmmca_queuecommand()
2168 issue_cmd (host_index, virt_to_bus(scb), IM_LONG_SCB | ldn); in ibmmca_queuecommand()
2171 issue_cmd (host_index, virt_to_bus(scb), IM_SCB | ldn); in ibmmca_queuecommand()
2184 unsigned int ldn; in ibmmca_abort() local
2223 ldn = get_ldn(host_index)[target][cmd->lun]; in ibmmca_abort()
2226 if (!ld(host_index)[ldn].cmd) { in ibmmca_abort()
2238 last_scsi_command(host_index)[ldn] = IM_ABORT_IMM_CMD; in ibmmca_abort()
2239 last_scsi_type(host_index)[ldn] = IM_IMM_CMD; in ibmmca_abort()
2252 outb (IM_IMM_CMD | ldn, IM_ATTN_REG(host_index)); in ibmmca_abort()
2268 ld(host_index)[ldn].cmd = NULL; in ibmmca_abort()
2278 ld(host_index)[ldn].cmd = NULL; in ibmmca_abort()
2406 static int ldn_access_load(int host_index, int ldn) in ldn_access_load() argument
2409 if (IBM_DS(host_index).ldn_access[ldn] == 0) return (0); in ldn_access_load()
2410 return (IBM_DS(host_index).ldn_access[ldn] * 100) / IBM_DS(host_index).total_accesses; in ldn_access_load()