Commit 3403c090 authored by Kurt Garloff's avatar Kurt Garloff Committed by James Bottomley

[PATCH] scsi: don't attach device if PQ indicates not connected

parent 3dca9ce9
...@@ -543,17 +543,12 @@ static int scsi_add_lun(struct scsi_device *sdev, char *inq_result, int *bflags) ...@@ -543,17 +543,12 @@ static int scsi_add_lun(struct scsi_device *sdev, char *inq_result, int *bflags)
* 011 the same. Stay compatible with previous code, and create a * 011 the same. Stay compatible with previous code, and create a
* Scsi_Device for a PQ of 1 * Scsi_Device for a PQ of 1
* *
* XXX Save the PQ field let the upper layers figure out if they * Don't set the device offline here; rather let the upper
* want to attach or not to this device, do not set online FALSE; * level drivers eval the PQ to decide whether they should
* otherwise, offline devices still get an sd allocated, and they * attach. So remove ((inq_result[0] >> 5) & 7) == 1 check.
* use up an sd slot. */
*/
if (((inq_result[0] >> 5) & 7) == 1) {
SCSI_LOG_SCAN_BUS(3, printk(KERN_INFO "scsi scan: peripheral"
" qualifier of 1, device offlined\n"));
scsi_device_set_state(sdev, SDEV_OFFLINE);
}
sdev->inq_periph_qual = (inq_result[0] >> 5) & 7;
sdev->removable = (0x80 & inq_result[1]) >> 7; sdev->removable = (0x80 & inq_result[1]) >> 7;
sdev->lockable = sdev->removable; sdev->lockable = sdev->removable;
sdev->soft_reset = (inq_result[7] & 1) && ((inq_result[3] & 7) == 2); sdev->soft_reset = (inq_result[7] & 1) && ((inq_result[3] & 7) == 2);
......
...@@ -181,7 +181,8 @@ struct class sdev_class = { ...@@ -181,7 +181,8 @@ struct class sdev_class = {
/* all probing is done in the individual ->probe routines */ /* all probing is done in the individual ->probe routines */
static int scsi_bus_match(struct device *dev, struct device_driver *gendrv) static int scsi_bus_match(struct device *dev, struct device_driver *gendrv)
{ {
return 1; struct scsi_device *sdp = to_scsi_device(dev);
return (sdp->inq_periph_qual == SCSI_INQ_PQ_CON)? 1: 0;
} }
struct bus_type scsi_bus_type = { struct bus_type scsi_bus_type = {
......
...@@ -362,6 +362,13 @@ struct scsi_lun { ...@@ -362,6 +362,13 @@ struct scsi_lun {
#define SCSI_2 3 #define SCSI_2 3
#define SCSI_3 4 #define SCSI_3 4
/*
* INQ PERIPHERAL QUALIFIERS
*/
#define SCSI_INQ_PQ_CON 0x00
#define SCSI_INQ_PQ_NOT_CON 0x01
#define SCSI_INQ_PQ_NOT_CAP 0x03
/* /*
* Here are some scsi specific ioctl commands which are sometimes useful. * Here are some scsi specific ioctl commands which are sometimes useful.
......
...@@ -63,6 +63,7 @@ struct scsi_device { ...@@ -63,6 +63,7 @@ struct scsi_device {
char devfs_name[256]; /* devfs junk */ char devfs_name[256]; /* devfs junk */
char type; char type;
char scsi_level; char scsi_level;
char inq_periph_qual; /* PQ from INQUIRY data */
unsigned char inquiry_len; /* valid bytes in 'inquiry' */ unsigned char inquiry_len; /* valid bytes in 'inquiry' */
unsigned char * inquiry; /* INQUIRY response data */ unsigned char * inquiry; /* INQUIRY response data */
char * vendor; /* [back_compat] point into 'inquiry' ... */ char * vendor; /* [back_compat] point into 'inquiry' ... */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment