if (dp->disksize == 0) return (SDGP_RESULT_OFFLINE);
sd_scsibus_get_parms(sd, dp, flags)	struct sd_softc *sd;	struct disk_parms *dp;	int flags;{	struct sd_scsibus_mode_sense_data scsi_sense;	union scsi_disk_pages *sense_pages;	u_int16_t rpm;	int page, error;	dp->rot_rate = 3600;	/*	 * If offline, the SDEV_MEDIA_LOADED flag will be	 * cleared by the caller if necessary.	 */	if (sd->type == T_OPTICAL)		return (sd_scsibus_get_optparms(sd, dp, flags));	if ((error = sd_scsibus_mode_sense(sd, &scsi_sense, page = 4,	    flags)) == 0) {		sense_pages = (union scsi_disk_pages *)		    ((char *)&scsi_sense.blk_desc +		     (size_t)scsi_sense.header.blk_desc_len);		SC_DEBUG(sd->sc_link, SDEV_DB3,		    ("%d cyls, %d heads, %d precomp, %d red_write,"		     " %d land_zone\n",		    _3btol(sense_pages->rigid_geometry.ncyl),		    sense_pages->rigid_geometry.nheads,		    _2btol(sense_pages->rigid_geometry.st_cyl_wp),		    _2btol(sense_pages->rigid_geometry.st_cyl_rwc),		    _2btol(sense_pages->rigid_geometry.land_zone)));		/*		 * KLUDGE!! (for zone recorded disks)		 * give a number of sectors so that sec * trks * cyls		 * is <= disk_size		 * can lead to wasted space! THINK ABOUT THIS !		 */		dp->heads = sense_pages->rigid_geometry.nheads;		dp->cyls = _3btol(sense_pages->rigid_geometry.ncyl);		rpm = _2btol(scsi_sense.pages.rigid_geometry.rpm);		if (rpm)			dp->rot_rate = rpm;		if (scsi_sense.header.blk_desc_len >= 8)			dp->blksize = _3btol(scsi_sense.blk_desc.blklen);		else			dp->blksize = 0;		if (dp->heads == 0 || dp->cyls == 0)			goto fake_it;		if (dp->blksize == 0)			dp->blksize = 512;		dp->disksize = scsi_size(sd->sc_link, flags);		if (dp->disksize == 0)			return (SDGP_RESULT_OFFLINE);		/* XXX dubious on SCSI */		dp->sectors = dp->disksize / (dp->heads * dp->cyls);		return (SDGP_RESULT_OK);	}	if ((error = sd_scsibus_mode_sense(sd, &scsi_sense, page = 5,	    flags)) == 0) {		sense_pages = (union scsi_disk_pages *)		    ((char *)&scsi_sense.blk_desc +		     (size_t)scsi_sense.header.blk_desc_len);		dp->heads = sense_pages->flex_geometry.nheads;		dp->cyls = _2btol(sense_pages->flex_geometry.ncyl);		rpm = _2btol(scsi_sense.pages.flex_geometry.rpm);		if (rpm)			dp->rot_rate = rpm;		if (scsi_sense.header.blk_desc_len >= 8)			dp->blksize = _3btol(scsi_sense.blk_desc.blklen);		else			dp->blksize =			    _2btol(sense_pages->reduced_geometry.bytes_s);		dp->sectors = sense_pages->flex_geometry.ph_sec_tr;		dp->disksize = dp->heads * dp->cyls * dp->sectors;		if (dp->disksize == 0)			goto fake_it;		if (dp->blksize == 0)			dp->blksize = 512;		return (SDGP_RESULT_OK);	}	/* T_RDIRECT define page 6. */	if ((error = sd_scsibus_mode_sense(sd, &scsi_sense, page = 6,	    flags)) == 0) {		sense_pages = (union scsi_disk_pages *)		    ((char *)&scsi_sense.blk_desc +		     (size_t)scsi_sense.header.blk_desc_len);		dp->heads = 64;		dp->sectors = 32;		dp->disksize =		    _4btol(sense_pages->reduced_geometry.sectors+1);		dp->cyls = dp->disksize / (64 * 32);		if (scsi_sense.header.blk_desc_len >= 8)			dp->blksize = _3btol(scsi_sense.blk_desc.blklen);		else			dp->blksize =			    _2btol(sense_pages->reduced_geometry.bytes_s);		if (dp->disksize == 0 ||		    sense_pages->reduced_geometry.sectors[0] != 0)			goto fake_it;		if (dp->blksize == 0)			dp->blksize = 512;		return (SDGP_RESULT_OK);	}fake_it:	if ((sd->sc_link->quirks & SDEV_NOMODESENSE) == 0) {		if (error == 0)			printf("%s: mode sense (%d) returned nonsense",			    sd->sc_dev.dv_xname, page);		else			printf("%s: could not mode sense (4/5)",			    sd->sc_dev.dv_xname);		printf("; using fictitious geometry\n");	}	/*	 * use adaptec standard fictitious geometry	 * this depends on which controller (e.g. 1542C is	 * different. but we have to put SOMETHING here..)	 */	dp->disksize = scsi_size(sd->sc_link, flags);	dp->heads = 64;	dp->sectors = 32;	dp->cyls = dp->disksize / (64 * 32);	dp->blksize = 512;	if (dp->disksize == 0)		return (SDGP_RESULT_OFFLINE);	return (SDGP_RESULT_OK);}