• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /asuswrt-rt-n18u-9.0.0.4.380.2695/release/src-rt-6.x.4708/linux/linux-2.6.36/drivers/scsi/

Lines Matching refs:ldn

164 	unsigned short cache_stat;	/* ldn cachestat. Bit=1 = not cached */
243 displays. ldn is no longer displayed here, because the ldn mapping is now
244 done dynamically and the ldn <-> pun,lun maps can be looked-up at boottime
322 int cache_flag; /* 1 if this is uncached, 0 if cache is present for ldn */
329 int ldn_access[MAX_LOG_DEV + 1]; /* total accesses on a ldn */
330 int ldn_read_access[MAX_LOG_DEV + 1]; /* total read-access on a ldn */
331 int ldn_write_access[MAX_LOG_DEV + 1]; /* total write-access on a ldn */
332 int ldn_inquiry_access[MAX_LOG_DEV + 1]; /* total inquiries on a ldn */
333 int ldn_modeselect_access[MAX_LOG_DEV + 1]; /* total mode selects on ldn */
345 ldn */
373 /* Counter that points on the next reassignable ldn for dynamical
435 /* ldn which is used to probe the SCSI devices */
504 unsigned int ldn;
536 ldn = intr_reg & 0x0f;
538 lastSCSI = last_scsi_command(shpnt)[ldn];
539 outb(IM_EOI | ldn, IM_ATTN_REG(shpnt));
549 printk(KERN_ERR " Last cmd=0x%x, ena=%x, len=", lastSCSI, ld(shpnt)[ldn].scb.enable);
550 if (ld(shpnt)[ldn].cmd)
551 printk("%ld/%ld,", (long) (scsi_bufflen(ld(shpnt)[ldn].cmd)), (long) (ld(shpnt)[ldn].scb.sys_buf_length));
554 if (ld(shpnt)[ldn].cmd)
555 printk("Blocksize=%d", ld(shpnt)[ldn].scb.u2.blk.length);
558 printk(", host=%p, ldn=0x%x\n", shpnt, ldn);
559 if (ld(shpnt)[ldn].cmd) {
560 printk(KERN_ERR "Blockcount=%d/%d\n", last_scsi_blockcount(shpnt)[ldn], ld(shpnt)[ldn].scb.u2.blk.count);
561 printk(KERN_ERR "Logical block=%lx/%lx\n", last_scsi_logical_block(shpnt)[ldn], ld(shpnt)[ldn].scb.u1.log_blk_adr);
566 printk(KERN_ERR " Command Type................: %x\n", last_scsi_type(shpnt)[ldn]);
571 if ((last_scsi_type(shpnt)[ldn] == IM_SCB) || (last_scsi_type(shpnt)[ldn] == IM_LONG_SCB)) {
572 printk(KERN_ERR " SCB-Command.................: %x\n", ld(shpnt)[ldn].scb.command);
573 printk(KERN_ERR " SCB-Enable..................: %x\n", ld(shpnt)[ldn].scb.enable);
574 printk(KERN_ERR " SCB-logical block address...: %lx\n", ld(shpnt)[ldn].scb.u1.log_blk_adr);
575 printk(KERN_ERR " SCB-system buffer address...: %lx\n", ld(shpnt)[ldn].scb.sys_buf_adr);
576 printk(KERN_ERR " SCB-system buffer length....: %lx\n", ld(shpnt)[ldn].scb.sys_buf_length);
577 printk(KERN_ERR " SCB-tsb address.............: %lx\n", ld(shpnt)[ldn].scb.tsb_adr);
578 printk(KERN_ERR " SCB-Chain address...........: %lx\n", ld(shpnt)[ldn].scb.scb_chain_adr);
579 printk(KERN_ERR " SCB-block count.............: %x\n", ld(shpnt)[ldn].scb.u2.blk.count);
580 printk(KERN_ERR " SCB-block length............: %x\n", ld(shpnt)[ldn].scb.u2.blk.length);
608 last_scsi_command(shpnt)[ldn] = NO_SCSI;
613 if (last_scsi_type(shpnt)[ldn] == IM_IMM_CMD) {
614 /* verify ldn, and may handle rare reset immediate command */
615 if ((reset_status(shpnt) == IM_RESET_IN_PROGRESS) && (last_scsi_command(shpnt)[ldn] == IM_RESET_IMM_CMD)) {
627 last_scsi_command(shpnt)[ldn] = NO_SCSI;
628 last_scsi_type(shpnt)[ldn] = 0;
631 } else if (last_scsi_command(shpnt)[ldn] == IM_ABORT_IMM_CMD) {
638 cmd = ld(shpnt)[ldn].cmd;
639 ld(shpnt)[ldn].cmd = NULL;
645 last_scsi_command(shpnt)[ldn] = NO_SCSI;
646 last_scsi_type(shpnt)[ldn] = 0;
656 last_scsi_command(shpnt)[ldn] = NO_SCSI;
661 last_scsi_command(shpnt)[ldn] = NO_SCSI;
662 last_scsi_type(shpnt)[ldn] = 0;
663 cmd = ld(shpnt)[ldn].cmd;
664 ld(shpnt)[ldn].cmd = NULL;
682 printk("cmd=%02x ireg=%02x ds=%02x cs=%02x de=%02x ce=%02x\n", cmd->cmnd[0], intr_reg, ld(shpnt)[ldn].tsb.dev_status, ld(shpnt)[ldn].tsb.cmd_status, ld(shpnt)[ldn].tsb.dev_error, ld(shpnt)[ldn].tsb.cmd_error);
685 if ((ld(shpnt)[ldn].device_type != TYPE_NO_LUN) && (ld(shpnt)[ldn].device_type != TYPE_NO_DEVICE)) {
696 cmd->result = (unsigned char) (ld(shpnt)[ldn].tsb.dev_status & 0x1e);
736 static int device_inquiry(struct Scsi_Host *shpnt, int ldn)
743 scb = &(ld(shpnt)[ldn].scb);
744 tsb = &(ld(shpnt)[ldn].tsb);
745 buf = (unsigned char *) (&(ld(shpnt)[ldn].buf));
746 ld(shpnt)[ldn].tsb.dev_status = 0; /* prepare statusblock */
751 last_scsi_command(shpnt)[ldn] = IM_DEVICE_INQUIRY_CMD;
752 last_scsi_type(shpnt)[ldn] = IM_SCB;
756 /* issue scb to passed ldn, and busy wait for interrupt */
758 issue_cmd(shpnt, isa_virt_to_bus(scb), IM_SCB | ldn);
766 /*if all three retries failed, return "no device at this ldn" */
773 static int read_capacity(struct Scsi_Host *shpnt, int ldn)
780 scb = &(ld(shpnt)[ldn].scb);
781 tsb = &(ld(shpnt)[ldn].tsb);
782 buf = (unsigned char *) (&(ld(shpnt)[ldn].buf));
783 ld(shpnt)[ldn].tsb.dev_status = 0;
788 last_scsi_command(shpnt)[ldn] = IM_READ_CAPACITY_CMD;
789 last_scsi_type(shpnt)[ldn] = IM_SCB;
793 /*issue scb to passed ldn, and busy wait for interrupt */
795 issue_cmd(shpnt, isa_virt_to_bus(scb), IM_SCB | ldn);
803 /*if all three retries failed, return "no device at this ldn" */
833 /*issue scb to ldn=15, and busy wait for interrupt */
844 /* if all three retries failed, return "no device at this ldn" */
852 ldn-numbers on SCSI (PUN,LUN). It is needed for presetting of the
855 unsigned int lun, unsigned int ldn,
869 imm_cmd |= (unsigned long) ((ldn & 15) << 16);
878 imm_cmd |= (unsigned long) ((ldn & 15) << 16);
934 static int immediate_reset(struct Scsi_Host *shpnt, unsigned int ldn)
944 last_scsi_command(shpnt)[ldn] = IM_RESET_IMM_CMD;
945 last_scsi_type(shpnt)[ldn] = IM_IMM_CMD;
948 issue_cmd(shpnt, (unsigned long) (imm_command), IM_IMM_CMD | ldn);
1000 /* interpreter for logical device numbers (ldn) */
1068 int ldn;
1077 for (ldn = 0; ldn <= MAX_LOG_DEV; ldn++) {
1079 if (!((info->cache_stat >> ldn) & 1))
1080 ld(shpnt)[ldn].cache_flag = 0;
1082 if (!((info->retry_stat >> ldn) & 1))
1083 ld(shpnt)[ldn].retry_flag = 0;
1087 for (ldn = 0; ldn <= MAX_LOG_DEV; ldn++) {
1088 printk("%d", ld(shpnt)[ldn].cache_flag);
1091 for (ldn = 0; ldn <= MAX_LOG_DEV; ldn++) {
1092 printk("%d", ld(shpnt)[ldn].retry_flag);
1103 int id, lun, ldn, ticks;
1112 IBM_DS(shpnt).dyn_flag = 0; /* normally no need for dynamical ldn management */
1114 next_ldn(shpnt) = 7; /* next ldn to be assigned is 7, because 0-6 is 'hardwired' */
1118 for (ldn = 0; ldn <= MAX_LOG_DEV; ldn++) {
1119 last_scsi_command(shpnt)[ldn] = NO_SCSI; /* emptify last SCSI-command storage */
1120 last_scsi_type(shpnt)[ldn] = 0;
1121 ld(shpnt)[ldn].cache_flag = 1;
1122 ld(shpnt)[ldn].retry_flag = 1;
1130 ldn is active for all
1176 for (ldn = 0; ldn < MAX_LOG_DEV; ldn++) {
1181 immediate_assign(shpnt, 0, 0, ldn, REMOVE_LDN); /* remove ldn (wherever) */
1202 /* set ldn=0 to pun,lun */
1210 /* remove ldn */
1221 ldn = 0;
1224 for (lun = 0; lun < 8 && ldn < MAX_LOG_DEV; lun++)
1226 for (id = 0; id < max_pun && ldn < MAX_LOG_DEV; id++) {
1234 lun == 0 to get no gaps into ldn-mapping for ldn<7. */
1235 immediate_assign(shpnt, id, lun, ldn, SET_LDN);
1236 get_ldn(shpnt)[id][lun] = ldn; /* map ldn */
1237 if (device_exists(shpnt, ldn, &ld(shpnt)[ldn].block_length, &ld(shpnt)[ldn].device_type)) {
1239 printk("resetting device at ldn=%x ... ", ldn);
1240 immediate_reset(shpnt, ldn);
1242 ldn++;
1249 immediate_assign(shpnt, 0, 0, ldn, REMOVE_LDN);
1251 ldn++;
1255 immediate_assign(shpnt, id, lun, ldn, SET_LDN);
1256 get_ldn(shpnt)[id][lun] = ldn; /* map ldn */
1257 ldn++;
1264 for (lun = 1; lun < 8 && ldn < MAX_LOG_DEV; lun++)
1265 for (id = 0; id < max_pun && ldn < MAX_LOG_DEV; id++) {
1272 immediate_assign(shpnt, id, lun, ldn, SET_LDN);
1273 get_ldn(shpnt)[id][lun] = ldn;
1274 ldn++;
1315 if (ldn == 0)
1334 static int device_exists(struct Scsi_Host *shpnt, int ldn, int *block_length, int *device_type)
1338 if (!(device_inquiry(shpnt, ldn)))
1340 buf = (unsigned char *) (&(ld(shpnt)[ldn].buf));
1353 if (read_capacity(shpnt, ldn)) {
1361 if (read_capacity(shpnt, ldn)) {
1637 unsigned int ldn;
1669 ldn = get_ldn(shpnt)[target][cmd->device->lun];
1670 if (ldn >= MAX_LOG_DEV) { /* on invalid ldn do special stuff */
1671 if (ldn > MAX_LOG_DEV) { /* dynamical remapping if ldn unassigned */
1674 /* command-processing ldn. */
1679 /* no non-processing ldn found */
1682 " On ldn 7-14 SCSI-commands everywhere in progress.\n"
1691 /* unmap non-processing ldn */
1702 /* map found ldn to pun,lun */
1704 /* change ldn to the right value, that is now next_ldn */
1705 ldn = next_ldn(shpnt);
1706 /* unassign all ldns (pun,lun,ldn does not matter for remove) */
1709 immediate_assign(shpnt, target, cmd->device->lun, ldn, SET_LDN);
1710 /* get device information for ld[ldn] */
1711 if (device_exists(shpnt, ldn, &ld(shpnt)[ldn].block_length, &ld(shpnt)[ldn].device_type)) {
1712 ld(shpnt)[ldn].cmd = NULL; /* To prevent panic set 0, because
1715 get_scsi(shpnt)[target][cmd->device->lun] = ld(shpnt)[ldn].device_type;
1718 IBM_DS(shpnt).ldn_assignments[ldn]++;
1722 panic("IBM MCA SCSI: ldn=0x%x, SCSI-device on (%d,%d) vanished!\n", ldn, target, cmd->device->lun);
1723 /* unassign again all ldns (pun,lun,ldn does not matter for remove) */
1738 printk("IBM MCA SCSI: ldn=0x%x dynamically reassigned to (%d,%d).\n", ldn, target, cmd->device->lun);
1753 if (ld(shpnt)[ldn].cmd)
1754 panic("IBM MCA SCSI: cmd already in progress for this ldn.\n");
1758 ld(shpnt)[ldn].cmd = cmd;
1761 scb = &(ld(shpnt)[ldn].scb);
1762 ld(shpnt)[ldn].tsb.dev_status = 0;
1764 scb->tsb_adr = isa_virt_to_bus(&(ld(shpnt)[ldn].tsb));
1771 ld(shpnt)[ldn].sge[i].address = (void *) (isa_page_to_bus(sg_page(sg)) + sg->offset);
1772 ld(shpnt)[ldn].sge[i].byte_length = sg->length;
1775 scb->sys_buf_adr = isa_virt_to_bus(&(ld(shpnt)[ldn].sge[0]));
1805 printk("issue scsi cmd=%02x to ldn=%d\n", scsi_cmd, ldn);
1810 if (ld(shpnt)[ldn].device_type == IM_DEBUG_CMD_DEVICE)
1811 printk("(SCSI-device-type=0x%x) issue scsi cmd=%02x to ldn=%d\n", ld(shpnt)[ldn].device_type, scsi_cmd, ldn);
1815 last_scsi_command(shpnt)[ldn] = scsi_cmd;
1816 last_scsi_type(shpnt)[ldn] = IM_SCB;
1819 IBM_DS(shpnt).ldn_access[ldn]++;
1831 switch (ld(shpnt)[ldn].device_type) {
1838 IBM_DS(shpnt).ldn_read_access[ldn]++; /* increase READ-access on ldn stat. */
1841 IBM_DS(shpnt).ldn_write_access[ldn]++; /* increase write-count on ldn stat. */
1851 last_scsi_logical_block(shpnt)[ldn] = scb->u1.log_blk_adr;
1852 last_scsi_blockcount(shpnt)[ldn] = scb->u2.blk.count;
1853 scb->u2.blk.length = ld(shpnt)[ldn].block_length;
1874 last_scsi_type(shpnt)[ldn] = IM_LONG_SCB;
1881 IBM_DS(shpnt).ldn_inquiry_access[ldn]++;
1892 last_scsi_type(shpnt)[ldn] = IM_LONG_SCB;
1909 IBM_DS(shpnt).ldn_modeselect_access[ldn]++;
1914 last_scsi_type(shpnt)[ldn] = IM_LONG_SCB;
1923 last_scsi_type(shpnt)[ldn] = IM_LONG_SCB;
1930 if (last_scsi_type(shpnt)[ldn] == IM_LONG_SCB) {
1931 issue_cmd(shpnt, isa_virt_to_bus(scb), IM_LONG_SCB | ldn);
1934 issue_cmd(shpnt, isa_virt_to_bus(scb), IM_SCB | ldn);
1947 unsigned int ldn;
1971 ldn = get_ldn(shpnt)[target][cmd->device->lun];
1973 /*if cmd for this ldn has already finished, no need to abort */
1974 if (!ld(shpnt)[ldn].cmd) {
1985 last_scsi_command(shpnt)[ldn] = IM_ABORT_IMM_CMD;
1986 last_scsi_type(shpnt)[ldn] = IM_IMM_CMD;
1997 outb(IM_IMM_CMD | ldn, IM_ATTN_REG(shpnt));
2016 ld(shpnt)[ldn].cmd = NULL;
2025 ld(shpnt)[ldn].cmd = NULL;
2157 /* calculate percentage of total accesses on a ldn */
2158 static int ldn_access_load(struct Scsi_Host *shpnt, int ldn)
2162 if (IBM_DS(shpnt).ldn_access[ldn] == 0)
2164 return (IBM_DS(shpnt).ldn_access[ldn] * 100) / IBM_DS(shpnt).total_accesses;