⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 scsiconf.c

📁 MIPS处理器的bootloader,龙芯就是用的修改过的PMON2
💻 C
📖 第 1 页 / 共 2 页
字号:
	{{T_DIRECT, T_FIXED,	 "MAXTOR  ", "LXT-213S SUN0207", ""},     SDEV_NOLUNS},	{{T_DIRECT, T_FIXED,	 "MAXTOR  ", "LXT-200S        ", ""},     SDEV_NOLUNS},	{{T_DIRECT, T_FIXED,	 "MST     ", "SnapLink        ", ""},     SDEV_NOLUNS},	{{T_DIRECT, T_FIXED,	 "NEC     ", "D3847           ", "0307"}, SDEV_NOLUNS},	{{T_DIRECT, T_FIXED,	 "QUANTUM ", "ELS85S          ", ""},	  SDEV_AUTOSAVE},	{{T_DIRECT, T_FIXED,	 "QUANTUM ", "LPS525S         ", ""},     SDEV_NOLUNS},	{{T_DIRECT, T_FIXED,	 "QUANTUM ", "P105S 910-10-94x", ""},     SDEV_NOLUNS},	{{T_DIRECT, T_FIXED,	 "QUANTUM ", "PD1225S         ", ""},     SDEV_NOLUNS},	{{T_DIRECT, T_FIXED,	 "QUANTUM ", "PD210S   SUN0207", ""},     SDEV_NOLUNS},	{{T_DIRECT, T_FIXED,	 "RODIME  ", "RO3000S         ", ""},     SDEV_NOLUNS},	{{T_DIRECT, T_FIXED,	 "SEAGATE ", "ST125N          ", ""},     SDEV_NOLUNS},	{{T_DIRECT, T_FIXED,	 "SEAGATE ", "ST157N          ", ""},     SDEV_NOLUNS},	{{T_DIRECT, T_FIXED,	 "SEAGATE ", "ST296           ", ""},     SDEV_NOLUNS},	{{T_DIRECT, T_FIXED,	 "SEAGATE ", "ST296N          ", ""},     SDEV_NOLUNS},	{{T_DIRECT, T_FIXED,	 "SEAGATE ", "ST19171FC",	 ""},	  SDEV_NOMODESENSE},	{{T_DIRECT, T_FIXED,	 "SEAGATE ", "ST34501FC       ", ""},     SDEV_NOMODESENSE},        {{T_DIRECT, T_FIXED,	 "TOSHIBA ", "MK538FB         ", "6027"}, SDEV_NOLUNS},	{{T_DIRECT, T_REMOV,	 "iomega", "jaz 1GB",		 ""},	  SDEV_NOMODESENSE|SDEV_NOTAGS},	{{T_DIRECT, T_REMOV,	 "IOMEGA", "ZIP 100",		 ""},	  SDEV_NOMODESENSE},	{{T_DIRECT, T_REMOV,	 "IOMEGA", "ZIP 250",		 ""},	  SDEV_NOMODESENSE},	{{T_DIRECT, T_FIXED,	 "IBM", "0661467",               "G"},    SDEV_NOMODESENSE},	/* Letting the motor run kills floppy drives and disks quit fast. */	{{T_DIRECT, T_REMOV,	 "TEAC", "FC-1",                 ""},     SDEV_NOSTARTUNIT},	{{T_DIRECT, T_FIXED,	 "NEC ", "SD120S-200      ",	 "0001"}, SDEV_NOLUNS},	/* XXX: QIC-36 tape behind Emulex adapter.  Very broken. */	{{T_SEQUENTIAL, T_REMOV,	 "        ", "                ", "    "}, SDEV_NOLUNS},	{{T_SEQUENTIAL, T_REMOV,	 "CALIPER ", "CP150           ", ""},     SDEV_NOLUNS},	{{T_SEQUENTIAL, T_REMOV,	 "DEC     ", "TZ30            ", ""},     SDEV_NOLUNS},	{{T_SEQUENTIAL, T_REMOV,	 "DEC     ", "TK50            ", ""},     SDEV_NOLUNS},	{{T_SEQUENTIAL, T_REMOV,	 "EXABYTE ", "EXB-8200        ", ""},     SDEV_NOLUNS},	{{T_SEQUENTIAL, T_REMOV,	 "SONY    ", "SDT-2000        ", "2.09"}, SDEV_NOLUNS},	{{T_SEQUENTIAL, T_REMOV,	 "SONY    ", "SDT-5000        ", "3."},   SDEV_NOSYNC|SDEV_NOWIDE},	{{T_SEQUENTIAL, T_REMOV,	 "SONY    ", "SDT-5200        ", "3."},   SDEV_NOLUNS},	{{T_SEQUENTIAL, T_REMOV,	 "TANDBERG", " TDC 3600       ", ""},     SDEV_NOLUNS},	/* Following entry reported as a Tandberg 3600; ref. PR1933 */	{{T_SEQUENTIAL, T_REMOV,	 "ARCHIVE ", "VIPER 150  21247", ""},     SDEV_NOLUNS},	/* Following entry for a Cipher ST150S */	{{T_SEQUENTIAL, T_REMOV,	 "ARCHIVE ", "VIPER 1500 21247", "2.2G"}, SDEV_NOLUNS},	{{T_SEQUENTIAL, T_REMOV,	 "ARCHIVE ", "Python 28454-XXX", ""},     SDEV_NOLUNS},	{{T_SEQUENTIAL, T_REMOV,	 "WANGTEK ", "5099ES SCSI",      ""},     SDEV_NOLUNS},	{{T_SEQUENTIAL, T_REMOV,	 "WANGTEK ", "5150ES SCSI",      ""},     SDEV_NOLUNS},	{{T_SEQUENTIAL, T_REMOV,	 "WangDAT ", "Model 1300      ", "02.4"}, SDEV_NOSYNC|SDEV_NOWIDE},	{{T_SEQUENTIAL, T_REMOV,	 "WangDAT ", "Model 2600      ", "01.7"}, SDEV_NOSYNC|SDEV_NOWIDE},	{{T_SEQUENTIAL, T_REMOV,	 "WangDAT ", "Model 3200      ", "02.2"}, SDEV_NOSYNC|SDEV_NOWIDE},	{{T_SCANNER, T_FIXED,	 "RICOH   ", "IS60            ", "1R08"}, SDEV_NOLUNS},	{{T_SCANNER, T_FIXED,	 "UMAX    ", "Astra 1200S     ", "V2.9"}, SDEV_NOLUNS},	{{T_SCANNER, T_FIXED,	 "ULTIMA  ", "AT3     1.60    ", ""},     SDEV_NOLUNS},	{{T_SCANNER, T_FIXED,	 "UMAX    ", "SuperVista S-12 ", "V1.9"}, SDEV_NOLUNS},	{{T_ENCLOSURE, T_FIXED,	 "SUN     ", "SENA", ""},                 SDEV_NOLUNS},	/* ATAPI device quirks */        {{T_CDROM, T_REMOV,         "ALPS ELECTRIC CO.,LTD. DC544C", "", "SW03D"}, ADEV_NOTUR},        {{T_CDROM, T_REMOV,         "BCD-16X", "", ""},                    SDEV_NOSTARTUNIT},        {{T_CDROM, T_REMOV,         "BCD-24X", "", ""},                    SDEV_NOSTARTUNIT},        {{T_CDROM, T_REMOV,         "CR-2801TE", "", "1.07"},              ADEV_NOSENSE},        {{T_CDROM, T_REMOV,         "CREATIVECD3630E", "", "AC101"},       ADEV_NOSENSE},        {{T_CDROM, T_REMOV,         "FX320S", "", "q01"},                  ADEV_NOSENSE},        {{T_CDROM, T_REMOV,         "GCD-R580B", "", "1.00"},              ADEV_LITTLETOC},        {{T_CDROM, T_REMOV,         "MATSHITA CR-574", "", "1.02"},        ADEV_NOCAPACITY},        {{T_CDROM, T_REMOV,         "MATSHITA CR-574", "", "1.06"},        ADEV_NOCAPACITY},        {{T_CDROM, T_REMOV,         "Memorex CRW-2642", "", "1.0g"},       ADEV_NOSENSE},        {{T_CDROM, T_REMOV,         "NEC                 CD-ROM DRIVE:273", "", "4.21"}, ADEV_NOTUR},        {{T_CDROM, T_REMOV,         "SANYO CRD-256P", "", "1.02"},         ADEV_NOCAPACITY},        {{T_CDROM, T_REMOV,         "SANYO CRD-254P", "", "1.02"},         ADEV_NOCAPACITY},        {{T_CDROM, T_REMOV,         "SANYO CRD-S54P", "", "1.08"},         ADEV_NOCAPACITY},        {{T_CDROM, T_REMOV,         "CD-ROM  CDR-S1", "", "1.70"},         ADEV_NOCAPACITY}, /* Sanyo */        {{T_CDROM, T_REMOV,         "CD-ROM  CDR-N16", "", "1.25"},        ADEV_NOCAPACITY}, /* Sanyo */        {{T_CDROM, T_REMOV,         "UJDCD8730", "", "1.14"},              ADEV_NODOORLOCK}, /* Acer */#endif};/* * Print out autoconfiguration information for a subdevice. * * This is a slight abuse of 'standard' autoconfiguration semantics, * because 'print' functions don't normally print the colon and * device information.  However, in this case that's better than * either printing redundant information before the attach message, * or having the device driver call a special function to print out * the standard device information. */intscsibusprint(aux, pnp)	void       *aux;	const char *pnp;{	struct scsibus_attach_args *sa = aux;	struct scsi_inquiry_data *inqbuf;	u_int8_t type;	boolean removable;	char *dtype, *qtype;	char vendor[33], product[65], revision[17];	int target, lun;	if (pnp != NULL)		printf("%s", pnp);	inqbuf = sa->sa_inqbuf;        target = sa->sa_sc_link->target;        lun = sa->sa_sc_link->lun;        type = inqbuf->device & SID_TYPE;        removable = inqbuf->dev_qual2 & SID_REMOVABLE ? 1 : 0;	/*	 * Figure out basic device type and qualifier.	 */	dtype = 0;	switch (inqbuf->device & SID_QUAL) {	case SID_QUAL_LU_OK:		qtype = "";		break;	case SID_QUAL_LU_OFFLINE:		qtype = " offline";		break;	case SID_QUAL_RSVD:	case SID_QUAL_BAD_LU:		panic("scsibusprint: impossible qualifier");	default:		qtype = "";		dtype = "vendor-unique";		break;	}	if (dtype == 0) {		switch (type) {		case T_DIRECT:			dtype = "direct";			break;		case T_SEQUENTIAL:			dtype = "sequential";			break;#ifndef PMON		case T_PRINTER:			dtype = "printer";			break;		case T_PROCESSOR:			dtype = "processor";			break;#endif		case T_CDROM:			dtype = "cdrom";			break;#ifndef PMON		case T_WORM:			dtype = "worm";			break;		case T_SCANNER:			dtype = "scanner";			break;		case T_OPTICAL:			dtype = "optical";			break;		case T_CHANGER:			dtype = "changer";			break;		case T_COMM:			dtype = "communication";			break;		case T_ENCLOSURE:			dtype = "enclosure services";			break;#endif		case T_NODEVICE:			panic("scsibusprint: impossible device type");		default:			dtype = "unknown";			break;		}	}        scsi_strvis(vendor, inqbuf->vendor, 8);        scsi_strvis(product, inqbuf->product, 16);        scsi_strvis(revision, inqbuf->revision, 4);        printf(" targ %d lun %d: <%s, %s, %s> SCSI%d %d/%s %s%s",            target, lun, vendor, product, revision,            inqbuf->version & SID_ANSII, type, dtype,            removable ? "removable" : "fixed", qtype);	return (UNCONF);}/* * given a target and lu, ask the device what * it is, and find the correct driver table * entry. */voidscsi_probedev(scsi, target, lun)	struct scsibus_softc *scsi;	int target, lun;{	struct scsi_link *sc_link;	static struct scsi_inquiry_data inqbuf;	struct scsi_quirk_inquiry_pattern *finger;	int checkdtype, priority;	struct scsibus_attach_args sa;	struct cfdata *cf;	/* Skip this slot if it is already attached. */	if (scsi->sc_link[target][lun])		return;	sc_link = malloc(sizeof(*sc_link), M_DEVBUF, M_NOWAIT);	if (sc_link == NULL)		return;	*sc_link = *scsi->adapter_link;	sc_link->target = target;	sc_link->lun = lun;	sc_link->device = &probe_switch;	sc_link->inquiry_flags = 0;	/*	 * Ask the device what it is	 */#ifdef SCSIDEBUG	if (((1 << target) & scsidebug_targets) &&	    ((1 << lun) & scsidebug_luns))		sc_link->flags |= scsidebug_level;#endif /* SCSIDEBUG */	(void) scsi_test_unit_ready(sc_link,	    scsi_autoconf | SCSI_IGNORE_ILLEGAL_REQUEST | SCSI_IGNORE_NOT_READY | SCSI_IGNORE_MEDIA_CHANGE);#ifdef SCSI_2_DEF	/* some devices need to be told to go to SCSI2 */	/* However some just explode if you tell them this.. leave it out */	scsi_change_def(sc_link, scsi_autoconf | SCSI_SILENT);#endif /* SCSI_2_DEF */	/* Now go ask the device all about itself. */	bzero(&inqbuf, sizeof(inqbuf));	if (scsi_inquire(sc_link, &inqbuf, scsi_autoconf) != 0)		goto bad;	{		int len = inqbuf.additional_length;		while (len < 3)			inqbuf.unused[len++] = '\0';		while (len < 3 + 28)			inqbuf.unused[len++] = ' ';		if (inqbuf.additional_length == 0) {			if (inqbuf.dev_qual2 == 0xb0) {				strncpy(inqbuf.unused+3, "DEC", 3);				strncpy(inqbuf.unused+11, "TZ30", 4);			} else if (inqbuf.dev_qual2 == 0xd0) {				strncpy(inqbuf.unused+3, "DEC", 3);				strncpy(inqbuf.unused+11, "TK50", 4);			}		}	}	finger = (struct scsi_quirk_inquiry_pattern *)scsi_inqmatch(&inqbuf,	    (caddr_t)scsi_quirk_patterns, 	    sizeof(scsi_quirk_patterns)/sizeof(scsi_quirk_patterns[0]),	    sizeof(scsi_quirk_patterns[0]), &priority);	/*	 * Based upon the inquiry flags we got back, and if we're	 * at SCSI-2 or better, set some limiting quirks.	 */	if ((inqbuf.version & SID_ANSII) >= 2) {		if ((inqbuf.flags & SID_CmdQue) == 0)			sc_link->quirks |= SDEV_NOTAGS;		if ((inqbuf.flags & SID_Sync) == 0) 			sc_link->quirks |= SDEV_NOSYNC;		if ((inqbuf.flags & SID_WBus16) == 0)			sc_link->quirks |= SDEV_NOWIDE;	}	/*	 * Now apply any quirks from the table.	 */	if (priority != 0)		sc_link->quirks |= finger->quirks;	if ((inqbuf.version & SID_ANSII) == 0 &&	    (sc_link->quirks & SDEV_FORCELUNS) == 0)		sc_link->quirks |= SDEV_NOLUNS;	sc_link->scsi_version = inqbuf.version;	if ((sc_link->quirks & SDEV_NOLUNS) == 0)		scsi->moreluns |= (1 << target);	/*	 * Save INQUIRY "flags" (SID_Linked, etc.) for low-level drivers.	 */	sc_link->inquiry_flags = inqbuf.flags;	/*	 * note what BASIC type of device it is	 */	if ((inqbuf.dev_qual2 & SID_REMOVABLE) != 0)		sc_link->flags |= SDEV_REMOVABLE;	/*	 * Any device qualifier that has the top bit set (qualifier&4 != 0)	 * is vendor specific and won't match in this switch.	 * All we do here is throw out bad/negative responses.	 */	checkdtype = 0;	switch (inqbuf.device & SID_QUAL) {	case SID_QUAL_LU_OK:	case SID_QUAL_LU_OFFLINE:		checkdtype = 1;		break;	case SID_QUAL_RSVD:	case SID_QUAL_BAD_LU:		goto bad;	default:		break;	}	if (checkdtype) {		switch (inqbuf.device & SID_TYPE) {#ifndef PMON		case T_DIRECT:		case T_SEQUENTIAL:		case T_PRINTER:		case T_PROCESSOR:		case T_CDROM:		case T_WORM:		case T_SCANNER:		case T_OPTICAL:		case T_CHANGER:		case T_COMM:#endif		default:			break;		case T_NODEVICE:			goto bad;		}	}	sa.sa_sc_link = sc_link;	sa.sa_inqbuf = &inqbuf;	if ((cf = config_search(scsibussubmatch, (struct device *)scsi, &sa)) != 0) {		scsi->sc_link[target][lun] = sc_link;		config_attach((struct device *)scsi, cf, &sa, scsibusprint);	} else {		scsibusprint(&sa, scsi->sc_dev.dv_xname);		printf(" not configured\n");		goto bad;	}	return;bad:	free(sc_link, M_DEVBUF);	return;}/* * Return a priority based on how much of the inquiry data matches * the patterns for the particular driver. */caddr_tscsi_inqmatch(inqbuf, base, nmatches, matchsize, bestpriority)	struct scsi_inquiry_data *inqbuf;	caddr_t base;	int nmatches, matchsize;	int *bestpriority;{	u_int8_t type;	boolean removable;	caddr_t bestmatch;	/* Include the qualifier to catch vendor-unique types. */	type = inqbuf->device;	removable = inqbuf->dev_qual2 & SID_REMOVABLE ? T_REMOV : T_FIXED;	for (*bestpriority = 0, bestmatch = 0; nmatches--; base += matchsize) {		struct scsi_inquiry_pattern *match = (void *)base;		int priority, len;		if (type != match->type)			continue;		if (removable != match->removable)			continue;		priority = 2;		len = strlen(match->vendor);		if (bcmp(inqbuf->vendor, match->vendor, len))			continue;		priority += len;		len = strlen(match->product);		if (bcmp(inqbuf->product, match->product, len))			continue;		priority += len;		len = strlen(match->revision);		if (bcmp(inqbuf->revision, match->revision, len))			continue;		priority += len;#if SCSIDEBUG		printf("scsi_inqmatch: %d/%d/%d <%s, %s, %s>\n",		    priority, match->type, match->removable,		    match->vendor, match->product, match->revision);#endif		if (priority > *bestpriority) {			*bestpriority = priority;			bestmatch = base;		}	}	return (bestmatch);}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -