aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/block/cciss_scsi.c14
-rw-r--r--drivers/scsi/fcal.c3
-rw-r--r--drivers/scsi/g_NCR5380.c3
-rw-r--r--drivers/scsi/megaraid.c4
-rw-r--r--drivers/scsi/scsi.c36
-rw-r--r--drivers/scsi/scsi_proc.c4
-rw-r--r--drivers/scsi/scsi_scan.c66
-rw-r--r--include/scsi/scsi.h10
8 files changed, 46 insertions, 94 deletions
diff --git a/drivers/block/cciss_scsi.c b/drivers/block/cciss_scsi.c
index afdff32f6724..05f79d7393f7 100644
--- a/drivers/block/cciss_scsi.c
+++ b/drivers/block/cciss_scsi.c
@@ -251,10 +251,6 @@ scsi_cmd_stack_free(int ctlr)
251 stk->pool = NULL; 251 stk->pool = NULL;
252} 252}
253 253
254/* scsi_device_types comes from scsi.h */
255#define DEVICETYPE(n) (n<0 || n>MAX_SCSI_DEVICE_CODE) ? \
256 "Unknown" : scsi_device_types[n]
257
258#if 0 254#if 0
259static int xmargin=8; 255static int xmargin=8;
260static int amargin=60; 256static int amargin=60;
@@ -389,7 +385,7 @@ cciss_scsi_add_entry(int ctlr, int hostno,
389 time anyway (the scsi layer's inquiries will show that info) */ 385 time anyway (the scsi layer's inquiries will show that info) */
390 if (hostno != -1) 386 if (hostno != -1)
391 printk("cciss%d: %s device c%db%dt%dl%d added.\n", 387 printk("cciss%d: %s device c%db%dt%dl%d added.\n",
392 ctlr, DEVICETYPE(sd->devtype), hostno, 388 ctlr, scsi_device_type(sd->devtype), hostno,
393 sd->bus, sd->target, sd->lun); 389 sd->bus, sd->target, sd->lun);
394 return 0; 390 return 0;
395} 391}
@@ -407,7 +403,7 @@ cciss_scsi_remove_entry(int ctlr, int hostno, int entry)
407 ccissscsi[ctlr].dev[i] = ccissscsi[ctlr].dev[i+1]; 403 ccissscsi[ctlr].dev[i] = ccissscsi[ctlr].dev[i+1];
408 ccissscsi[ctlr].ndevices--; 404 ccissscsi[ctlr].ndevices--;
409 printk("cciss%d: %s device c%db%dt%dl%d removed.\n", 405 printk("cciss%d: %s device c%db%dt%dl%d removed.\n",
410 ctlr, DEVICETYPE(sd.devtype), hostno, 406 ctlr, scsi_device_type(sd.devtype), hostno,
411 sd.bus, sd.target, sd.lun); 407 sd.bus, sd.target, sd.lun);
412} 408}
413 409
@@ -458,7 +454,7 @@ adjust_cciss_scsi_table(int ctlr, int hostno,
458 if (found == 0) { /* device no longer present. */ 454 if (found == 0) { /* device no longer present. */
459 changes++; 455 changes++;
460 /* printk("cciss%d: %s device c%db%dt%dl%d removed.\n", 456 /* printk("cciss%d: %s device c%db%dt%dl%d removed.\n",
461 ctlr, DEVICETYPE(csd->devtype), hostno, 457 ctlr, scsi_device_type(csd->devtype), hostno,
462 csd->bus, csd->target, csd->lun); */ 458 csd->bus, csd->target, csd->lun); */
463 cciss_scsi_remove_entry(ctlr, hostno, i); 459 cciss_scsi_remove_entry(ctlr, hostno, i);
464 /* note, i not incremented */ 460 /* note, i not incremented */
@@ -468,7 +464,7 @@ adjust_cciss_scsi_table(int ctlr, int hostno,
468 printk("cciss%d: device c%db%dt%dl%d type changed " 464 printk("cciss%d: device c%db%dt%dl%d type changed "
469 "(device type now %s).\n", 465 "(device type now %s).\n",
470 ctlr, hostno, csd->bus, csd->target, csd->lun, 466 ctlr, hostno, csd->bus, csd->target, csd->lun,
471 DEVICETYPE(csd->devtype)); 467 scsi_device_type(csd->devtype));
472 csd->devtype = sd[j].devtype; 468 csd->devtype = sd[j].devtype;
473 i++; /* so just move along. */ 469 i++; /* so just move along. */
474 } else /* device is same as it ever was, */ 470 } else /* device is same as it ever was, */
@@ -1098,7 +1094,7 @@ cciss_update_non_disk_devices(int cntl_num, int hostno)
1098 if (ncurrent >= CCISS_MAX_SCSI_DEVS_PER_HBA) { 1094 if (ncurrent >= CCISS_MAX_SCSI_DEVS_PER_HBA) {
1099 printk(KERN_INFO "cciss%d: %s ignored, " 1095 printk(KERN_INFO "cciss%d: %s ignored, "
1100 "too many devices.\n", cntl_num, 1096 "too many devices.\n", cntl_num,
1101 DEVICETYPE(devtype)); 1097 scsi_device_type(devtype));
1102 break; 1098 break;
1103 } 1099 }
1104 memcpy(&currentsd[ncurrent].scsi3addr[0], 1100 memcpy(&currentsd[ncurrent].scsi3addr[0],
diff --git a/drivers/scsi/fcal.c b/drivers/scsi/fcal.c
index 7f891023aa15..c4e16c0775de 100644
--- a/drivers/scsi/fcal.c
+++ b/drivers/scsi/fcal.c
@@ -248,8 +248,7 @@ int fcal_proc_info (struct Scsi_Host *host, char *buffer, char **start, off_t of
248 if (scd->id == target) { 248 if (scd->id == target) {
249 SPRINTF (" [AL-PA: %02x, Id: %02d, Port WWN: %08x%08x, Node WWN: %08x%08x] ", 249 SPRINTF (" [AL-PA: %02x, Id: %02d, Port WWN: %08x%08x, Node WWN: %08x%08x] ",
250 alpa, target, u1[0], u1[1], u2[0], u2[1]); 250 alpa, target, u1[0], u1[1], u2[0], u2[1]);
251 SPRINTF ("%s ", (scd->type < MAX_SCSI_DEVICE_CODE) ? 251 SPRINTF ("%s ", scsi_device_type(scd->type));
252 scsi_device_types[(short) scd->type] : "Unknown device");
253 252
254 for (j = 0; (j < 8) && (scd->vendor[j] >= 0x20); j++) 253 for (j = 0; (j < 8) && (scd->vendor[j] >= 0x20); j++)
255 SPRINTF ("%c", scd->vendor[j]); 254 SPRINTF ("%c", scd->vendor[j]);
diff --git a/drivers/scsi/g_NCR5380.c b/drivers/scsi/g_NCR5380.c
index 67f1100f3103..cdd893bb4e28 100644
--- a/drivers/scsi/g_NCR5380.c
+++ b/drivers/scsi/g_NCR5380.c
@@ -811,7 +811,6 @@ static int generic_NCR5380_proc_info(struct Scsi_Host *scsi_ptr, char *buffer, c
811 struct NCR5380_hostdata *hostdata; 811 struct NCR5380_hostdata *hostdata;
812#ifdef NCR5380_STATS 812#ifdef NCR5380_STATS
813 struct scsi_device *dev; 813 struct scsi_device *dev;
814 extern const char *const scsi_device_types[MAX_SCSI_DEVICE_CODE];
815#endif 814#endif
816 815
817 NCR5380_setup(scsi_ptr); 816 NCR5380_setup(scsi_ptr);
@@ -851,7 +850,7 @@ static int generic_NCR5380_proc_info(struct Scsi_Host *scsi_ptr, char *buffer, c
851 long tr = hostdata->time_read[dev->id] / HZ; 850 long tr = hostdata->time_read[dev->id] / HZ;
852 long tw = hostdata->time_write[dev->id] / HZ; 851 long tw = hostdata->time_write[dev->id] / HZ;
853 852
854 PRINTP(" T:%d %s " ANDP dev->id ANDP(dev->type < MAX_SCSI_DEVICE_CODE) ? scsi_device_types[(int) dev->type] : "Unknown"); 853 PRINTP(" T:%d %s " ANDP dev->id ANDP scsi_device_type(dev->type));
855 for (i = 0; i < 8; i++) 854 for (i = 0; i < 8; i++)
856 if (dev->vendor[i] >= 0x20) 855 if (dev->vendor[i] >= 0x20)
857 *(buffer + (len++)) = dev->vendor[i]; 856 *(buffer + (len++)) = dev->vendor[i];
diff --git a/drivers/scsi/megaraid.c b/drivers/scsi/megaraid.c
index 76edbb639d37..ccb0055ac73a 100644
--- a/drivers/scsi/megaraid.c
+++ b/drivers/scsi/megaraid.c
@@ -2822,9 +2822,7 @@ mega_print_inquiry(char *page, char *scsi_inq)
2822 2822
2823 i = scsi_inq[0] & 0x1f; 2823 i = scsi_inq[0] & 0x1f;
2824 2824
2825 len += sprintf(page+len, " Type: %s ", 2825 len += sprintf(page+len, " Type: %s ", scsi_device_type(i));
2826 i < MAX_SCSI_DEVICE_CODE ? scsi_device_types[i] :
2827 "Unknown ");
2828 2826
2829 len += sprintf(page+len, 2827 len += sprintf(page+len,
2830 " ANSI SCSI revision: %02x", scsi_inq[2] & 0x07); 2828 " ANSI SCSI revision: %02x", scsi_inq[2] & 0x07);
diff --git a/drivers/scsi/scsi.c b/drivers/scsi/scsi.c
index b332caddd5b3..94df671d776a 100644
--- a/drivers/scsi/scsi.c
+++ b/drivers/scsi/scsi.c
@@ -96,24 +96,40 @@ unsigned int scsi_logging_level;
96EXPORT_SYMBOL(scsi_logging_level); 96EXPORT_SYMBOL(scsi_logging_level);
97#endif 97#endif
98 98
99const char *const scsi_device_types[MAX_SCSI_DEVICE_CODE] = { 99static const char *const scsi_device_types[] = {
100 "Direct-Access ", 100 "Direct access ",
101 "Sequential-Access", 101 "Sequential access",
102 "Printer ", 102 "Printer ",
103 "Processor ", 103 "Processor ",
104 "WORM ", 104 "WORM ",
105 "CD-ROM ", 105 "CD/DVD ",
106 "Scanner ", 106 "Scanner ",
107 "Optical Device ", 107 "Optical memory ",
108 "Medium Changer ", 108 "Media changer ",
109 "Communications ", 109 "Communications ",
110 "Unknown ", 110 "ASC IT8 ",
111 "Unknown ", 111 "ASC IT8 ",
112 "RAID ", 112 "RAID ",
113 "Enclosure ", 113 "Enclosure ",
114 "Direct-Access-RBC", 114 "Direct access RBC",
115 "Optical card ",
116 "Bridge controller",
117 "Object storage ",
118 "Automation/Drive ",
115}; 119};
116EXPORT_SYMBOL(scsi_device_types); 120
121const char * scsi_device_type(unsigned type)
122{
123 if (type == 0x1e)
124 return "Well-known LUN ";
125 if (type == 0x1f)
126 return "No Device ";
127 if (type > ARRAY_SIZE(scsi_device_types))
128 return "Unknown ";
129 return scsi_device_types[type];
130}
131
132EXPORT_SYMBOL(scsi_device_type);
117 133
118struct scsi_host_cmd_pool { 134struct scsi_host_cmd_pool {
119 kmem_cache_t *slab; 135 kmem_cache_t *slab;
diff --git a/drivers/scsi/scsi_proc.c b/drivers/scsi/scsi_proc.c
index 55200e4fdf11..524a5f7a5193 100644
--- a/drivers/scsi/scsi_proc.c
+++ b/drivers/scsi/scsi_proc.c
@@ -178,9 +178,7 @@ static int proc_print_scsidevice(struct device *dev, void *data)
178 178
179 seq_printf(s, "\n"); 179 seq_printf(s, "\n");
180 180
181 seq_printf(s, " Type: %s ", 181 seq_printf(s, " Type: %s ", scsi_device_type(sdev->type));
182 sdev->type < MAX_SCSI_DEVICE_CODE ?
183 scsi_device_types[(int) sdev->type] : "Unknown ");
184 seq_printf(s, " ANSI" 182 seq_printf(s, " ANSI"
185 " SCSI revision: %02x", (sdev->scsi_level - 1) ? 183 " SCSI revision: %02x", (sdev->scsi_level - 1) ?
186 sdev->scsi_level - 1 : 1); 184 sdev->scsi_level - 1 : 1);
diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c
index 1bd92b9b46d9..180399406510 100644
--- a/drivers/scsi/scsi_scan.c
+++ b/drivers/scsi/scsi_scan.c
@@ -134,59 +134,6 @@ static void scsi_unlock_floptical(struct scsi_device *sdev,
134} 134}
135 135
136/** 136/**
137 * print_inquiry - printk the inquiry information
138 * @inq_result: printk this SCSI INQUIRY
139 *
140 * Description:
141 * printk the vendor, model, and other information found in the
142 * INQUIRY data in @inq_result.
143 *
144 * Notes:
145 * Remove this, and replace with a hotplug event that logs any
146 * relevant information.
147 **/
148static void print_inquiry(unsigned char *inq_result)
149{
150 int i;
151
152 printk(KERN_NOTICE " Vendor: ");
153 for (i = 8; i < 16; i++)
154 if (inq_result[i] >= 0x20 && i < inq_result[4] + 5)
155 printk("%c", inq_result[i]);
156 else
157 printk(" ");
158
159 printk(" Model: ");
160 for (i = 16; i < 32; i++)
161 if (inq_result[i] >= 0x20 && i < inq_result[4] + 5)
162 printk("%c", inq_result[i]);
163 else
164 printk(" ");
165
166 printk(" Rev: ");
167 for (i = 32; i < 36; i++)
168 if (inq_result[i] >= 0x20 && i < inq_result[4] + 5)
169 printk("%c", inq_result[i]);
170 else
171 printk(" ");
172
173 printk("\n");
174
175 i = inq_result[0] & 0x1f;
176
177 printk(KERN_NOTICE " Type: %s ",
178 i <
179 MAX_SCSI_DEVICE_CODE ? scsi_device_types[i] :
180 "Unknown ");
181 printk(" ANSI SCSI revision: %02x",
182 inq_result[2] & 0x07);
183 if ((inq_result[2] & 0x07) == 1 && (inq_result[3] & 0x0f) == 1)
184 printk(" CCS\n");
185 else
186 printk("\n");
187}
188
189/**
190 * scsi_alloc_sdev - allocate and setup a scsi_Device 137 * scsi_alloc_sdev - allocate and setup a scsi_Device
191 * 138 *
192 * Description: 139 * Description:
@@ -653,9 +600,8 @@ static int scsi_add_lun(struct scsi_device *sdev, char *inq_result, int *bflags)
653 if (*bflags & BLIST_ISROM) { 600 if (*bflags & BLIST_ISROM) {
654 /* 601 /*
655 * It would be better to modify sdev->type, and set 602 * It would be better to modify sdev->type, and set
656 * sdev->removable, but then the print_inquiry() output 603 * sdev->removable; this can now be done since
657 * would not show TYPE_ROM; if print_inquiry() is removed 604 * print_inquiry has gone away.
658 * the issue goes away.
659 */ 605 */
660 inq_result[0] = TYPE_ROM; 606 inq_result[0] = TYPE_ROM;
661 inq_result[1] |= 0x80; /* removable */ 607 inq_result[1] |= 0x80; /* removable */
@@ -684,8 +630,6 @@ static int scsi_add_lun(struct scsi_device *sdev, char *inq_result, int *bflags)
684 printk(KERN_INFO "scsi: unknown device type %d\n", sdev->type); 630 printk(KERN_INFO "scsi: unknown device type %d\n", sdev->type);
685 } 631 }
686 632
687 print_inquiry(inq_result);
688
689 /* 633 /*
690 * For a peripheral qualifier (PQ) value of 1 (001b), the SCSI 634 * For a peripheral qualifier (PQ) value of 1 (001b), the SCSI
691 * spec says: The device server is capable of supporting the 635 * spec says: The device server is capable of supporting the
@@ -715,6 +659,12 @@ static int scsi_add_lun(struct scsi_device *sdev, char *inq_result, int *bflags)
715 if (inq_result[7] & 0x10) 659 if (inq_result[7] & 0x10)
716 sdev->sdtr = 1; 660 sdev->sdtr = 1;
717 661
662 sdev_printk(KERN_NOTICE "scsi", sdev, "%s %.8s %.16s %.4s PQ: %d "
663 "ANSI: %d%s\n", scsi_device_type(sdev->type),
664 sdev->vendor, sdev->model, sdev->rev,
665 sdev->inq_periph_qual, inq_result[2] & 0x07,
666 (inq_result[3] & 0x0f) == 1 ? " CCS" : "");
667
718 /* 668 /*
719 * End sysfs code. 669 * End sysfs code.
720 */ 670 */
diff --git a/include/scsi/scsi.h b/include/scsi/scsi.h
index c60b8ff2f5e4..1bc675201413 100644
--- a/include/scsi/scsi.h
+++ b/include/scsi/scsi.h
@@ -25,13 +25,6 @@ extern const unsigned char scsi_command_size[8];
25#define COMMAND_SIZE(opcode) scsi_command_size[((opcode) >> 5) & 7] 25#define COMMAND_SIZE(opcode) scsi_command_size[((opcode) >> 5) & 7]
26 26
27/* 27/*
28 * SCSI device types
29 */
30
31#define MAX_SCSI_DEVICE_CODE 15
32extern const char *const scsi_device_types[MAX_SCSI_DEVICE_CODE];
33
34/*
35 * Special value for scanning to specify scanning or rescanning of all 28 * Special value for scanning to specify scanning or rescanning of all
36 * possible channels, (target) ids, or luns on a given shost. 29 * possible channels, (target) ids, or luns on a given shost.
37 */ 30 */
@@ -225,6 +218,9 @@ static inline int scsi_status_is_good(int status)
225#define TYPE_RBC 0x0e 218#define TYPE_RBC 0x0e
226#define TYPE_NO_LUN 0x7f 219#define TYPE_NO_LUN 0x7f
227 220
221/* Returns a human-readable name for the device */
222extern const char * scsi_device_type(unsigned type);
223
228/* 224/*
229 * standard mode-select header prepended to all mode-select commands 225 * standard mode-select header prepended to all mode-select commands
230 */ 226 */