aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/scsi_scan.c
diff options
context:
space:
mode:
authorMatthew Wilcox <matthew@wil.cx>2006-07-04 14:15:20 -0400
committerJames Bottomley <jejb@mulgrave.il.steeleye.com>2006-08-06 16:59:26 -0400
commit4ff36718ede26ee2da73f2dae94d71e2b06845fc (patch)
treed9188d88bb3f60427c9976ed0f3da8bf433bb757 /drivers/scsi/scsi_scan.c
parent008cd5bbfb4763322837cd1f7c621f02ebe22fef (diff)
[SCSI] Improve inquiry printing
- Replace scsi_device_types array API with scsi_device_type function API. Gets rid of a lot of common code, as well as being easier to use. - Add the new device types in SPC4 r05a, and rename some of the older ones. - Reformat the printing of inquiry data; now fits on one line and includes PQ. I think I've addressed all the feedback from the previous versions. My current test box prints: scsi 2:0:1:0: Direct access HP 18.2G ATLAS10K3_18_SCA HP05 PQ: 0 ANSI: 2 Signed-off-by: Matthew Wilcox <matthew@wil.cx> Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Diffstat (limited to 'drivers/scsi/scsi_scan.c')
-rw-r--r--drivers/scsi/scsi_scan.c66
1 files changed, 8 insertions, 58 deletions
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 */