diff options
Diffstat (limited to 'usr/src')
-rw-r--r-- | usr/src/uts/common/io/blkdev/blkdev.c | 1 | ||||
-rw-r--r-- | usr/src/uts/common/io/cmlb.c | 11 | ||||
-rw-r--r-- | usr/src/uts/common/io/lofi.c | 1 | ||||
-rw-r--r-- | usr/src/uts/common/io/scsi/targets/sd.c | 44 | ||||
-rw-r--r-- | usr/src/uts/common/sys/cmlb.h | 1 | ||||
-rw-r--r-- | usr/src/uts/common/sys/scsi/targets/sddef.h | 3 | ||||
-rw-r--r-- | usr/src/uts/common/xen/io/xdf.c | 3 | ||||
-rw-r--r-- | usr/src/uts/intel/io/dktp/disk/cmdk.c | 1 |
8 files changed, 47 insertions, 18 deletions
diff --git a/usr/src/uts/common/io/blkdev/blkdev.c b/usr/src/uts/common/io/blkdev/blkdev.c index b8eea2b6a4..0c80d15cfe 100644 --- a/usr/src/uts/common/io/blkdev/blkdev.c +++ b/usr/src/uts/common/io/blkdev/blkdev.c @@ -1510,6 +1510,7 @@ bd_tg_getinfo(dev_info_t *dip, int cmd, void *arg, void *tg_cookie) ((tg_attribute_t *)arg)->media_is_writable = bd->d_rdonly ? B_FALSE : B_TRUE; ((tg_attribute_t *)arg)->media_is_solid_state = bd->d_ssd; + ((tg_attribute_t *)arg)->media_is_rotational = B_FALSE; return (0); default: diff --git a/usr/src/uts/common/io/cmlb.c b/usr/src/uts/common/io/cmlb.c index ea04806be9..17eca53288 100644 --- a/usr/src/uts/common/io/cmlb.c +++ b/usr/src/uts/common/io/cmlb.c @@ -246,6 +246,7 @@ static i_ddi_prop_dyn_t cmlb_prop_dyn[] = { {"device-nblocks", DDI_PROP_TYPE_INT64}, {"device-blksize", DDI_PROP_TYPE_INT}, {"device-solid-state", DDI_PROP_TYPE_INT}, + {"device-rotational", DDI_PROP_TYPE_INT}, {NULL} }; @@ -5711,7 +5712,7 @@ cmlb_prop_op(cmlb_handle_t cmlbhandle, struct cmlb_lun *cl; diskaddr_t capacity; uint32_t lbasize; - enum dp { DP_NBLOCKS, DP_BLKSIZE, DP_SSD } dp; + enum dp { DP_NBLOCKS, DP_BLKSIZE, DP_SSD, DP_ROT } dp; int callers_length; caddr_t buffer; uint64_t nblocks64; @@ -5742,6 +5743,8 @@ fallback: return (ddi_prop_op(dev, dip, prop_op, mod_flags, dp = DP_BLKSIZE; else if (strcmp(name, "device-solid-state") == 0) dp = DP_SSD; + else if (strcmp(name, "device-rotational") == 0) + dp = DP_ROT; else goto fallback; @@ -5790,6 +5793,12 @@ fallback: return (ddi_prop_op(dev, dip, prop_op, mod_flags, *((uint32_t *)buffer) = tgattr.media_is_solid_state ? 1 : 0; break; + case DP_ROT: + if (DK_TG_GETATTRIBUTE(cl, &tgattr, tg_cookie) != 0) + tgattr.media_is_rotational = B_TRUE; + *((uint32_t *)buffer) = + tgattr.media_is_rotational ? 1 : 0; + break; } return (DDI_PROP_SUCCESS); } diff --git a/usr/src/uts/common/io/lofi.c b/usr/src/uts/common/io/lofi.c index 568242e29c..95f4cd7254 100644 --- a/usr/src/uts/common/io/lofi.c +++ b/usr/src/uts/common/io/lofi.c @@ -509,6 +509,7 @@ lofi_tg_getinfo(dev_info_t *dip, int cmd, void *arg, void *tg_cookie) tgattr->media_is_writable = !lsp->ls_readonly; tgattr->media_is_solid_state = B_FALSE; + tgattr->media_is_rotational = B_FALSE; return (0); } diff --git a/usr/src/uts/common/io/scsi/targets/sd.c b/usr/src/uts/common/io/scsi/targets/sd.c index c3f32ceb72..b5b4a8216d 100644 --- a/usr/src/uts/common/io/scsi/targets/sd.c +++ b/usr/src/uts/common/io/scsi/targets/sd.c @@ -895,7 +895,7 @@ static int sd_pm_idletime = 1; #define sd_blank_cmp ssd_blank_cmp #define sd_chk_vers1_data ssd_chk_vers1_data #define sd_set_vers1_properties ssd_set_vers1_properties -#define sd_check_solid_state ssd_check_solid_state +#define sd_check_bdc_vpd ssd_check_bdc_vpd #define sd_check_emulation_mode ssd_check_emulation_mode #define sd_get_physical_geometry ssd_get_physical_geometry @@ -1297,7 +1297,7 @@ static int sd_get_write_cache_enabled(sd_ssc_t *ssc, int *is_enabled); static void sd_get_write_cache_changeable(sd_ssc_t *ssc, int *is_changeable); static void sd_get_nv_sup(sd_ssc_t *ssc); static dev_t sd_make_device(dev_info_t *devi); -static void sd_check_solid_state(sd_ssc_t *ssc); +static void sd_check_bdc_vpd(sd_ssc_t *ssc); static void sd_check_emulation_mode(sd_ssc_t *ssc); static void sd_update_block_info(struct sd_lun *un, uint32_t lbasize, uint64_t capacity); @@ -8217,9 +8217,9 @@ sd_unit_attach(dev_info_t *devi) un->un_mediastate = DKIO_NONE; /* - * Check if this is a SSD(Solid State Drive). + * Check Block Device Characteristics VPD. */ - sd_check_solid_state(ssc); + sd_check_bdc_vpd(ssc); /* * Check whether the drive is in emulation mode. @@ -31188,6 +31188,8 @@ sd_tg_getinfo(dev_info_t *devi, int cmd, void *arg, void *tg_cookie) un->un_f_mmc_writable_media; ((tg_attribute_t *)arg)->media_is_solid_state = un->un_f_is_solid_state; + ((tg_attribute_t *)arg)->media_is_rotational = + un->un_f_is_rotational; mutex_exit(SD_MUTEX(un)); return (0); default: @@ -31676,18 +31678,22 @@ sd_ssc_extract_info(sd_ssc_t *ssc, struct sd_lun *un, struct scsi_pkt *pktp, /* - * Function: sd_check_solid_state + * Function: sd_check_bdc_vpd * * Description: Query the optional INQUIRY VPD page 0xb1. If the device * supports VPD page 0xb1, sd examines the MEDIUM ROTATION - * RATE. If the MEDIUM ROTATION RATE is 1, sd assumes the - * device is a solid state drive. + * RATE. + * + * Set the following based on RPM value: + * = 0 device is not solid state, non-rotational + * = 1 device is solid state, non-rotational + * > 1 device is not solid state, rotational * * Context: Kernel thread or interrupt context. */ static void -sd_check_solid_state(sd_ssc_t *ssc) +sd_check_bdc_vpd(sd_ssc_t *ssc) { int rval = 0; uchar_t *inqb1 = NULL; @@ -31701,6 +31707,7 @@ sd_check_solid_state(sd_ssc_t *ssc) ASSERT(!mutex_owned(SD_MUTEX(un))); mutex_enter(SD_MUTEX(un)); + un->un_f_is_rotational = TRUE; un->un_f_is_solid_state = FALSE; if (ISCD(un)) { @@ -31719,7 +31726,7 @@ sd_check_solid_state(sd_ssc_t *ssc) if (rval == 0 && (inqb1_len - inqb1_resid > 5)) { SD_TRACE(SD_LOG_COMMON, un, - "sd_check_solid_state: \ + "sd_check_bdc_vpd: \ successfully get VPD page: %x \ PAGE LENGTH: %x BYTE 4: %x \ BYTE 5: %x", inqb1[1], inqb1[3], inqb1[4], @@ -31727,13 +31734,20 @@ sd_check_solid_state(sd_ssc_t *ssc) mutex_enter(SD_MUTEX(un)); /* - * Check the MEDIUM ROTATION RATE. If it is set - * to 1, the device is a solid state drive. + * Check the MEDIUM ROTATION RATE. */ - if (inqb1[4] == 0 && inqb1[5] == 1) { - un->un_f_is_solid_state = TRUE; - /* solid state drives don't need disksort */ - un->un_f_disksort_disabled = TRUE; + if (inqb1[4] == 0) { + if (inqb1[5] == 0) { + un->un_f_is_rotational = FALSE; + } else if (inqb1[5] == 1) { + un->un_f_is_rotational = FALSE; + un->un_f_is_solid_state = TRUE; + /* + * Solid state drives don't need + * disksort. + */ + un->un_f_disksort_disabled = TRUE; + } } mutex_exit(SD_MUTEX(un)); } else if (rval != 0) { diff --git a/usr/src/uts/common/sys/cmlb.h b/usr/src/uts/common/sys/cmlb.h index a1013c9fed..23ef49ef15 100644 --- a/usr/src/uts/common/sys/cmlb.h +++ b/usr/src/uts/common/sys/cmlb.h @@ -51,6 +51,7 @@ typedef struct cmlb_geom { typedef struct tg_attribute { int media_is_writable; int media_is_solid_state; + int media_is_rotational; } tg_attribute_t; diff --git a/usr/src/uts/common/sys/scsi/targets/sddef.h b/usr/src/uts/common/sys/scsi/targets/sddef.h index 4f05a5894a..3a696a503e 100644 --- a/usr/src/uts/common/sys/scsi/targets/sddef.h +++ b/usr/src/uts/common/sys/scsi/targets/sddef.h @@ -460,12 +460,13 @@ struct sd_lun { un_f_pm_log_sense_smart :1, /* log sense support SMART */ /* feature attribute */ un_f_is_solid_state :1, /* has solid state media */ + un_f_is_rotational :1, /* spinning rust */ un_f_mmc_gesn_polling :1, /* use GET EVENT STATUS */ /* NOTIFICATION for polling */ un_f_enable_rmw :1, /* Force RMW in sd driver */ un_f_expnevent :1, un_f_cache_mode_changeable :1, /* can change cache mode */ - un_f_reserved :2; + un_f_reserved :1; /* Ptr to table of strings for ASC/ASCQ error message printing */ struct scsi_asq_key_strings *un_additional_codes; diff --git a/usr/src/uts/common/xen/io/xdf.c b/usr/src/uts/common/xen/io/xdf.c index 2e45882e5d..4a71be3341 100644 --- a/usr/src/uts/common/xen/io/xdf.c +++ b/usr/src/uts/common/xen/io/xdf.c @@ -2373,6 +2373,7 @@ xdf_lb_getattribute(dev_info_t *dip, tg_attribute_t *tgattributep) tgattributep->media_is_writable = 0; else tgattributep->media_is_writable = 1; + tgattributep->media_is_rotational = 0; return (0); } @@ -3115,7 +3116,7 @@ xdf_watch_hp_status_cb(dev_info_t *dip, const char *path, void *arg) static int xdf_prop_op(dev_t dev, dev_info_t *dip, ddi_prop_op_t prop_op, int flags, - char *name, caddr_t valuep, int *lengthp) + char *name, caddr_t valuep, int *lengthp) { xdf_t *vdp = ddi_get_soft_state(xdf_ssp, ddi_get_instance(dip)); diff --git a/usr/src/uts/intel/io/dktp/disk/cmdk.c b/usr/src/uts/intel/io/dktp/disk/cmdk.c index 9548464f58..b9223fd7e2 100644 --- a/usr/src/uts/intel/io/dktp/disk/cmdk.c +++ b/usr/src/uts/intel/io/dktp/disk/cmdk.c @@ -1578,6 +1578,7 @@ cmdk_lb_getinfo(dev_info_t *dip, int cmd, void *arg, void *tg_cookie) tgattribute->media_is_writable = FALSE; else tgattribute->media_is_writable = TRUE; + tgattribute->media_is_rotational = TRUE; return (0); } |