Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 7 Nov 2014 00:10:08 +0000 (UTC)
From:      Alexander Motin <mav@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r274206 - head/sys/cam/ctl
Message-ID:  <201411070010.sA70A8gF060295@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mav
Date: Fri Nov  7 00:10:07 2014
New Revision: 274206
URL: https://svnweb.freebsd.org/changeset/base/274206

Log:
  Synchronize medium rotation rate in legacy Rigid Disk Drive Geometry mode
  page with modern Block Device Characteristics VPD page.
  
  MFC after:	1 week

Modified:
  head/sys/cam/ctl/ctl.c
  head/sys/cam/ctl/ctl_private.h

Modified: head/sys/cam/ctl/ctl.c
==============================================================================
--- head/sys/cam/ctl/ctl.c	Thu Nov  6 23:45:05 2014	(r274205)
+++ head/sys/cam/ctl/ctl.c	Fri Nov  7 00:10:07 2014	(r274206)
@@ -4197,17 +4197,11 @@ ctl_init_page_index(struct ctl_lun *lun)
 			 * works out a fake geometry based on the capacity.
 			 */
 			memcpy(&lun->mode_pages.rigid_disk_page[
-			       CTL_PAGE_CURRENT], &rigid_disk_page_default,
+			       CTL_PAGE_DEFAULT], &rigid_disk_page_default,
 			       sizeof(rigid_disk_page_default));
 			memcpy(&lun->mode_pages.rigid_disk_page[
 			       CTL_PAGE_CHANGEABLE],&rigid_disk_page_changeable,
 			       sizeof(rigid_disk_page_changeable));
-			memcpy(&lun->mode_pages.rigid_disk_page[
-			       CTL_PAGE_DEFAULT], &rigid_disk_page_default,
-			       sizeof(rigid_disk_page_default));
-			memcpy(&lun->mode_pages.rigid_disk_page[
-			       CTL_PAGE_SAVED], &rigid_disk_page_default,
-			       sizeof(rigid_disk_page_default));
 
 			sectors_per_cylinder = CTL_DEFAULT_SECTORS_PER_TRACK *
 				CTL_DEFAULT_HEADS;
@@ -4244,16 +4238,21 @@ ctl_init_page_index(struct ctl_lun *lun)
 				cylinders = 0xffffff;
 
 			rigid_disk_page = &lun->mode_pages.rigid_disk_page[
-				CTL_PAGE_CURRENT];
-			scsi_ulto3b(cylinders, rigid_disk_page->cylinders);
-
-			rigid_disk_page = &lun->mode_pages.rigid_disk_page[
 				CTL_PAGE_DEFAULT];
 			scsi_ulto3b(cylinders, rigid_disk_page->cylinders);
 
-			rigid_disk_page = &lun->mode_pages.rigid_disk_page[
-				CTL_PAGE_SAVED];
-			scsi_ulto3b(cylinders, rigid_disk_page->cylinders);
+			if ((value = ctl_get_opt(&lun->be_lun->options,
+			    "rpm")) != NULL) {
+				scsi_ulto2b(strtol(value, NULL, 0),
+				     rigid_disk_page->rotation_rate);
+			}
+
+			memcpy(&lun->mode_pages.rigid_disk_page[CTL_PAGE_CURRENT],
+			       &lun->mode_pages.rigid_disk_page[CTL_PAGE_DEFAULT],
+			       sizeof(rigid_disk_page_default));
+			memcpy(&lun->mode_pages.rigid_disk_page[CTL_PAGE_SAVED],
+			       &lun->mode_pages.rigid_disk_page[CTL_PAGE_DEFAULT],
+			       sizeof(rigid_disk_page_default));
 
 			page_index->page_data =
 				(uint8_t *)lun->mode_pages.rigid_disk_page;
@@ -10413,7 +10412,7 @@ ctl_inquiry_evpd_bdc(struct ctl_scsiio *
 	    (value = ctl_get_opt(&lun->be_lun->options, "rpm")) != NULL)
 		i = strtol(value, NULL, 0);
 	else
-		i = SVPD_NON_ROTATING;
+		i = CTL_DEFAULT_ROTATION_RATE;
 	scsi_ulto2b(i, bdc_ptr->medium_rotation_rate);
 	if (lun != NULL &&
 	    (value = ctl_get_opt(&lun->be_lun->options, "formfactor")) != NULL)

Modified: head/sys/cam/ctl/ctl_private.h
==============================================================================
--- head/sys/cam/ctl/ctl_private.h	Thu Nov  6 23:45:05 2014	(r274205)
+++ head/sys/cam/ctl/ctl_private.h	Fri Nov  7 00:10:07 2014	(r274206)
@@ -271,7 +271,7 @@ union ctl_softcs {
 #define	CTL_DEFAULT_SECTORS_PER_TRACK	256
 #define	CTL_DEFAULT_HEADS		128
 
-#define	CTL_DEFAULT_ROTATION_RATE	10000
+#define	CTL_DEFAULT_ROTATION_RATE	SVPD_NON_ROTATING
 
 struct ctl_page_index;
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201411070010.sA70A8gF060295>