scsi_scan.c
上传用户:jlfgdled
上传日期:2013-04-10
资源大小:33168k
文件大小:28k
- /*
- * scsi_scan.c Copyright (C) 2000 Eric Youngdale
- *
- * Bus scan logic.
- *
- * This used to live in scsi.c, but that file was just a laundry basket
- * full of misc stuff. This got separated out in order to make things
- * clearer.
- */
- #define __NO_VERSION__
- #include <linux/config.h>
- #include <linux/module.h>
- #include <linux/init.h>
- #include <linux/blk.h>
- #include "scsi.h"
- #include "hosts.h"
- #include "constants.h"
- #ifdef CONFIG_KMOD
- #include <linux/kmod.h>
- #endif
- /*
- * Flags for irregular SCSI devices that need special treatment
- */
- #define BLIST_NOLUN 0x001 /* Don't scan for LUNs */
- #define BLIST_FORCELUN 0x002 /* Known to have LUNs, force sanning */
- #define BLIST_BORKEN 0x004 /* Flag for broken handshaking */
- #define BLIST_KEY 0x008 /* Needs to be unlocked by special command */
- #define BLIST_SINGLELUN 0x010 /* LUNs should better not be used in parallel */
- #define BLIST_NOTQ 0x020 /* Buggy Tagged Command Queuing */
- #define BLIST_SPARSELUN 0x040 /* Non consecutive LUN numbering */
- #define BLIST_MAX5LUN 0x080 /* Avoid LUNS >= 5 */
- #define BLIST_ISDISK 0x100 /* Treat as (removable) disk */
- #define BLIST_ISROM 0x200 /* Treat as (removable) CD-ROM */
- #define BLIST_LARGELUN 0x400 /* LUNs larger than 7 despite reporting as SCSI 2 */
- static void print_inquiry(unsigned char *data);
- static int scan_scsis_single(unsigned int channel, unsigned int dev,
- unsigned int lun, int lun0_scsi_level,
- unsigned int *max_scsi_dev, unsigned int *sparse_lun,
- Scsi_Device ** SDpnt, struct Scsi_Host *shpnt,
- char *scsi_result);
- static int find_lun0_scsi_level(unsigned int channel, unsigned int dev,
- struct Scsi_Host *shpnt);
- struct dev_info {
- const char *vendor;
- const char *model;
- const char *revision; /* Latest revision known to be bad. Not used yet */
- unsigned flags;
- };
- /*
- * This is what was previously known as the blacklist. The concept
- * has been expanded so that we can specify other types of things we
- * need to be aware of.
- */
- static struct dev_info device_list[] =
- {
- /* The following devices are known not to tolerate a lun != 0 scan for
- * one reason or another. Some will respond to all luns, others will
- * lock up.
- */
- {"Aashima", "IMAGERY 2400SP", "1.03", BLIST_NOLUN}, /* Locks up if polled for lun != 0 */
- {"CHINON", "CD-ROM CDS-431", "H42", BLIST_NOLUN}, /* Locks up if polled for lun != 0 */
- {"CHINON", "CD-ROM CDS-535", "Q14", BLIST_NOLUN}, /* Locks up if polled for lun != 0 */
- {"DENON", "DRD-25X", "V", BLIST_NOLUN}, /* Locks up if probed for lun != 0 */
- {"HITACHI", "DK312C", "CM81", BLIST_NOLUN}, /* Responds to all lun - dtg */
- {"HITACHI", "DK314C", "CR21", BLIST_NOLUN}, /* responds to all lun */
- {"IMS", "CDD521/10", "2.06", BLIST_NOLUN}, /* Locks-up when LUN>0 polled. */
- {"MAXTOR", "XT-3280", "PR02", BLIST_NOLUN}, /* Locks-up when LUN>0 polled. */
- {"MAXTOR", "XT-4380S", "B3C", BLIST_NOLUN}, /* Locks-up when LUN>0 polled. */
- {"MAXTOR", "MXT-1240S", "I1.2", BLIST_NOLUN}, /* Locks up when LUN>0 polled */
- {"MAXTOR", "XT-4170S", "B5A", BLIST_NOLUN}, /* Locks-up sometimes when LUN>0 polled. */
- {"MAXTOR", "XT-8760S", "B7B", BLIST_NOLUN}, /* guess what? */
- {"MEDIAVIS", "RENO CD-ROMX2A", "2.03", BLIST_NOLUN}, /*Responds to all lun */
- {"NEC", "CD-ROM DRIVE:841", "1.0", BLIST_NOLUN}, /* Locks-up when LUN>0 polled. */
- {"PHILIPS", "PCA80SC", "V4-2", BLIST_NOLUN}, /* Responds to all lun */
- {"RODIME", "RO3000S", "2.33", BLIST_NOLUN}, /* Locks up if polled for lun != 0 */
- {"SANYO", "CRD-250S", "1.20", BLIST_NOLUN}, /* causes failed REQUEST SENSE on lun 1
- * for aha152x controller, which causes
- * SCSI code to reset bus.*/
- {"SEAGATE", "ST157N", "