From nobody Tue Feb 27 18:52:40 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Tkmnh3KGlz5CF23; Tue, 27 Feb 2024 18:52:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Tkmnh2V1Hz51Vs; Tue, 27 Feb 2024 18:52:40 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1709059960; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=FqMVvScY5TE3MSvi9AV3beQqRFC/jYXhTNNZHm8IXik=; b=xkdctNwvUsdwcHtL0RrWkNkFlATwlSyU5Q40xoxOTKJi60teBAUcqml6LCWVqOGscImact ZsHQX8rEV5LgWE2Gvo/L3ux6ls/wZU4Ma9GnrOKNB0Y2WqTzpvNB478eDOXEXD7ZAbCj6U JcKOcHPy0tOEqRwd7/z/xkk9clnAwUDdS5G24asjciOfWri8z/I3Bw52IslZngIKCiEsNm DBzR5YAKvcgAqBvymggk90hAK0HYTdzQECVuP/oL9K9gshbe4LzLCeiO3y5HEZ9J1d7saz DbT/qG3zepX3jWSeXS0Rmruq/ZYSvVBjOPIXq1a+ammQInNTDr/JQkEeEGcHOw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1709059960; a=rsa-sha256; cv=none; b=Zp8gftU3s8wpBFn9Izxm89XUdqCp+6XCVmuCJmuF9RM4ykZVkddiqWxQkPXB9wgQe6dOct oaImycC6Opxfn9PTE6di7ZNZ4f4pjLqP66szc9RQWktRy2beN1skvXCgb69b4rwZUK3IPf 39AuhhEKZybepWz/g3G1AsMFFGqoWNSHm7xuZVcg20Q7MmeXaGNgJMIHB7g/tvCPTVrhts ZMWnWdCEh5jIhdqQPhcKFcpKXUrEuIypADodFwbijCi8N+dLe8U0IKwvKuDzGFq7R8s9Cu batz6RHKXF7atS2KIu99ZQYTM4uevCwzks9/ggupYD0nYPqZnrtXT0w3daeWGQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1709059960; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=FqMVvScY5TE3MSvi9AV3beQqRFC/jYXhTNNZHm8IXik=; b=o0GPaKtMsVqCCrlhxywHmFQXm4m6p+kepowekgX3/H8ipQmw1z9kK4GWRHeEclxHUPJ+zr fjDIn0jkHjhoUayb92poEkXEUxMVp5YeVPl2qH1lMhQiYcluebcPNeLEb3U00WDiKvxzEa L+KKqOXbtHTD+EMThOlWNR3evyeiuBOd2BQ1Xzwjfg7LEPsq5oRhqjlsroGDs04/uoMBBW 7yKD4EVk2GB9nZK/YBmy+SCihEj+d0OnBBBVaz9wLPHmzM+iTXM4JIO2Ro3E5CyFo0bT/2 gfypkWpd8ZIhyfu6HBoY2VVbtZPSbSwTNZwXJHeRmmKjLFviXbhIIQ9k+lMeuQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Tkmnh1WjYzPnQ; Tue, 27 Feb 2024 18:52:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 41RIqeqD007629; Tue, 27 Feb 2024 18:52:40 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 41RIqeLD007626; Tue, 27 Feb 2024 18:52:40 GMT (envelope-from git) Date: Tue, 27 Feb 2024 18:52:40 GMT Message-Id: <202402271852.41RIqeLD007626@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alexander Motin Subject: git: 7c667affb7b0 - main - CTL: Drop Format Device and Rigid Disk Geometry mode pages List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mav X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 7c667affb7b09fcdcb81f6f2635e9dfab7bc1fa8 Auto-Submitted: auto-generated The branch main has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=7c667affb7b09fcdcb81f6f2635e9dfab7bc1fa8 commit 7c667affb7b09fcdcb81f6f2635e9dfab7bc1fa8 Author: Alexander Motin AuthorDate: 2024-02-27 18:28:44 +0000 Commit: Alexander Motin CommitDate: 2024-02-27 18:28:44 +0000 CTL: Drop Format Device and Rigid Disk Geometry mode pages Those mode pages are obsolete since SBC-2 specification almost 20 years ago. First I was trying to understand possible relations between physical block and physical sector terms in different specs. Then was thinking about possible relations to device CHS geometry and compatibility issues. Finally I just decided that none of it worth the efforts and should rest in piece. PR: 276524 --- sys/cam/ctl/ctl.c | 194 ---------------------------------------------- sys/cam/ctl/ctl_private.h | 63 --------------- 2 files changed, 257 deletions(-) diff --git a/sys/cam/ctl/ctl.c b/sys/cam/ctl/ctl.c index 3d6eb0382cc9..5230a2694544 100644 --- a/sys/cam/ctl/ctl.c +++ b/sys/cam/ctl/ctl.c @@ -124,72 +124,6 @@ const static struct scsi_da_rw_recovery_page rw_er_page_changeable = { /*recovery_time_limit*/{0, 0}, }; -const static struct scsi_format_page format_page_default = { - /*page_code*/SMS_FORMAT_DEVICE_PAGE, - /*page_length*/sizeof(struct scsi_format_page) - 2, - /*tracks_per_zone*/ {0, 0}, - /*alt_sectors_per_zone*/ {0, 0}, - /*alt_tracks_per_zone*/ {0, 0}, - /*alt_tracks_per_lun*/ {0, 0}, - /*sectors_per_track*/ {(CTL_DEFAULT_SECTORS_PER_TRACK >> 8) & 0xff, - CTL_DEFAULT_SECTORS_PER_TRACK & 0xff}, - /*bytes_per_sector*/ {0, 0}, - /*interleave*/ {0, 0}, - /*track_skew*/ {0, 0}, - /*cylinder_skew*/ {0, 0}, - /*flags*/ SFP_HSEC, - /*reserved*/ {0, 0, 0} -}; - -const static struct scsi_format_page format_page_changeable = { - /*page_code*/SMS_FORMAT_DEVICE_PAGE, - /*page_length*/sizeof(struct scsi_format_page) - 2, - /*tracks_per_zone*/ {0, 0}, - /*alt_sectors_per_zone*/ {0, 0}, - /*alt_tracks_per_zone*/ {0, 0}, - /*alt_tracks_per_lun*/ {0, 0}, - /*sectors_per_track*/ {0, 0}, - /*bytes_per_sector*/ {0, 0}, - /*interleave*/ {0, 0}, - /*track_skew*/ {0, 0}, - /*cylinder_skew*/ {0, 0}, - /*flags*/ 0, - /*reserved*/ {0, 0, 0} -}; - -const static struct scsi_rigid_disk_page rigid_disk_page_default = { - /*page_code*/SMS_RIGID_DISK_PAGE, - /*page_length*/sizeof(struct scsi_rigid_disk_page) - 2, - /*cylinders*/ {0, 0, 0}, - /*heads*/ CTL_DEFAULT_HEADS, - /*start_write_precomp*/ {0, 0, 0}, - /*start_reduced_current*/ {0, 0, 0}, - /*step_rate*/ {0, 0}, - /*landing_zone_cylinder*/ {0, 0, 0}, - /*rpl*/ SRDP_RPL_DISABLED, - /*rotational_offset*/ 0, - /*reserved1*/ 0, - /*rotation_rate*/ {(CTL_DEFAULT_ROTATION_RATE >> 8) & 0xff, - CTL_DEFAULT_ROTATION_RATE & 0xff}, - /*reserved2*/ {0, 0} -}; - -const static struct scsi_rigid_disk_page rigid_disk_page_changeable = { - /*page_code*/SMS_RIGID_DISK_PAGE, - /*page_length*/sizeof(struct scsi_rigid_disk_page) - 2, - /*cylinders*/ {0, 0, 0}, - /*heads*/ 0, - /*start_write_precomp*/ {0, 0, 0}, - /*start_reduced_current*/ {0, 0, 0}, - /*step_rate*/ {0, 0}, - /*landing_zone_cylinder*/ {0, 0, 0}, - /*rpl*/ 0, - /*rotational_offset*/ 0, - /*reserved1*/ 0, - /*rotation_rate*/ {0, 0}, - /*reserved2*/ {0, 0} -}; - const static struct scsi_da_verify_recovery_page verify_er_page_default = { /*page_code*/SMS_VERIFY_ERROR_RECOVERY_PAGE, /*page_length*/sizeof(struct scsi_da_verify_recovery_page) - 2, @@ -4124,134 +4058,6 @@ ctl_init_page_index(struct ctl_lun *lun) (uint8_t *)lun->mode_pages.rw_er_page; break; } - case SMS_FORMAT_DEVICE_PAGE: { - struct scsi_format_page *format_page; - - KASSERT(page_index->subpage == SMS_SUBPAGE_PAGE_0, - ("subpage %#x for page %#x is incorrect!", - page_index->subpage, page_code)); - - /* - * Sectors per track are set above. Bytes per - * sector need to be set here on a per-LUN basis. - */ - memcpy(&lun->mode_pages.format_page[CTL_PAGE_CURRENT], - &format_page_default, - sizeof(format_page_default)); - memcpy(&lun->mode_pages.format_page[ - CTL_PAGE_CHANGEABLE], &format_page_changeable, - sizeof(format_page_changeable)); - memcpy(&lun->mode_pages.format_page[CTL_PAGE_DEFAULT], - &format_page_default, - sizeof(format_page_default)); - memcpy(&lun->mode_pages.format_page[CTL_PAGE_SAVED], - &format_page_default, - sizeof(format_page_default)); - - format_page = &lun->mode_pages.format_page[ - CTL_PAGE_CURRENT]; - scsi_ulto2b(lun->be_lun->blocksize, - format_page->bytes_per_sector); - - format_page = &lun->mode_pages.format_page[ - CTL_PAGE_DEFAULT]; - scsi_ulto2b(lun->be_lun->blocksize, - format_page->bytes_per_sector); - - format_page = &lun->mode_pages.format_page[ - CTL_PAGE_SAVED]; - scsi_ulto2b(lun->be_lun->blocksize, - format_page->bytes_per_sector); - - page_index->page_data = - (uint8_t *)lun->mode_pages.format_page; - break; - } - case SMS_RIGID_DISK_PAGE: { - struct scsi_rigid_disk_page *rigid_disk_page; - uint32_t sectors_per_cylinder; - uint64_t cylinders; -#ifndef __XSCALE__ - int shift; -#endif /* !__XSCALE__ */ - - KASSERT(page_index->subpage == SMS_SUBPAGE_PAGE_0, - ("subpage %#x for page %#x is incorrect!", - page_index->subpage, page_code)); - - /* - * Rotation rate and sectors per track are set - * above. We calculate the cylinders here based on - * capacity. Due to the number of heads and - * sectors per track we're using, smaller arrays - * may turn out to have 0 cylinders. Linux and - * FreeBSD don't pay attention to these mode pages - * to figure out capacity, but Solaris does. It - * seems to deal with 0 cylinders just fine, and - * works out a fake geometry based on the capacity. - */ - 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_CHANGEABLE],&rigid_disk_page_changeable, - sizeof(rigid_disk_page_changeable)); - - sectors_per_cylinder = CTL_DEFAULT_SECTORS_PER_TRACK * - CTL_DEFAULT_HEADS; - - /* - * The divide method here will be more accurate, - * probably, but results in floating point being - * used in the kernel on i386 (__udivdi3()). On the - * XScale, though, __udivdi3() is implemented in - * software. - * - * The shift method for cylinder calculation is - * accurate if sectors_per_cylinder is a power of - * 2. Otherwise it might be slightly off -- you - * might have a bit of a truncation problem. - */ -#ifdef __XSCALE__ - cylinders = (lun->be_lun->maxlba + 1) / - sectors_per_cylinder; -#else - for (shift = 31; shift > 0; shift--) { - if (sectors_per_cylinder & (1 << shift)) - break; - } - cylinders = (lun->be_lun->maxlba + 1) >> shift; -#endif - - /* - * We've basically got 3 bytes, or 24 bits for the - * cylinder size in the mode page. If we're over, - * just round down to 2^24. - */ - if (cylinders > 0xffffff) - cylinders = 0xffffff; - - rigid_disk_page = &lun->mode_pages.rigid_disk_page[ - CTL_PAGE_DEFAULT]; - scsi_ulto3b(cylinders, rigid_disk_page->cylinders); - - if ((value = dnvlist_get_string(lun->be_lun->options, - "rpm", NULL)) != 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; - break; - } case SMS_VERIFY_ERROR_RECOVERY_PAGE: { KASSERT(page_index->subpage == SMS_SUBPAGE_PAGE_0, ("subpage %#x for page %#x is incorrect!", diff --git a/sys/cam/ctl/ctl_private.h b/sys/cam/ctl/ctl_private.h index 04846f80e913..9dfe979bcb7f 100644 --- a/sys/cam/ctl/ctl_private.h +++ b/sys/cam/ctl/ctl_private.h @@ -168,61 +168,6 @@ union ctl_softcs { /* * Mode page defaults. */ -#if 0 -/* - * These values make Solaris trim off some of the capacity. - */ -#define CTL_DEFAULT_SECTORS_PER_TRACK 63 -#define CTL_DEFAULT_HEADS 255 -/* - * These values seem to work okay. - */ -#define CTL_DEFAULT_SECTORS_PER_TRACK 63 -#define CTL_DEFAULT_HEADS 16 -/* - * These values work reasonably well. - */ -#define CTL_DEFAULT_SECTORS_PER_TRACK 512 -#define CTL_DEFAULT_HEADS 64 -#endif - -/* - * Solaris is somewhat picky about how many heads and sectors per track you - * have defined in mode pages 3 and 4. These values seem to cause Solaris - * to get the capacity more or less right when you run the format tool. - * They still have problems when dealing with devices larger than 1TB, - * but there isn't anything we can do about that. - * - * For smaller LUN sizes, this ends up causing the number of cylinders to - * work out to 0. Solaris actually recognizes that and comes up with its - * own bogus geometry to fit the actual capacity of the drive. They really - * should just give up on geometry and stick to the read capacity - * information alone for modern disk drives. - * - * One thing worth mentioning about Solaris' mkfs command is that it - * doesn't like sectors per track values larger than 256. 512 seems to - * work okay for format, but causes problems when you try to make a - * filesystem. - * - * Another caveat about these values: the product of these two values - * really should be a power of 2. This is because of the simplistic - * shift-based calculation that we have to use on the i386 platform to - * calculate the number of cylinders here. (If you use a divide, you end - * up calling __udivdi3(), which is a hardware FP call on the PC. On the - * XScale, it is done in software, so you can do that from inside the - * kernel.) - * - * So for the current values (256 S/T, 128 H), we get 32768, which works - * very nicely for calculating cylinders. - * - * If you want to change these values so that their product is no longer a - * power of 2, re-visit the calculation in ctl_init_page_index(). You may - * need to make it a bit more complicated to get the number of cylinders - * right. - */ -#define CTL_DEFAULT_SECTORS_PER_TRACK 256 -#define CTL_DEFAULT_HEADS 128 - #define CTL_DEFAULT_ROTATION_RATE SVPD_NON_ROTATING struct ctl_page_index; @@ -271,10 +216,6 @@ struct ctl_logical_block_provisioning_page { static const struct ctl_page_index page_index_template[] = { {SMS_RW_ERROR_RECOVERY_PAGE, 0, sizeof(struct scsi_da_rw_recovery_page), NULL, CTL_PAGE_FLAG_DIRECT | CTL_PAGE_FLAG_CDROM, NULL, ctl_default_page_handler}, - {SMS_FORMAT_DEVICE_PAGE, 0, sizeof(struct scsi_format_page), NULL, - CTL_PAGE_FLAG_DIRECT, NULL, NULL}, - {SMS_RIGID_DISK_PAGE, 0, sizeof(struct scsi_rigid_disk_page), NULL, - CTL_PAGE_FLAG_DIRECT, NULL, NULL}, {SMS_VERIFY_ERROR_RECOVERY_PAGE, 0, sizeof(struct scsi_da_verify_recovery_page), NULL, CTL_PAGE_FLAG_DIRECT | CTL_PAGE_FLAG_CDROM, NULL, ctl_default_page_handler}, {SMS_CACHING_PAGE, 0, sizeof(struct scsi_caching_page), NULL, @@ -300,8 +241,6 @@ static const struct ctl_page_index page_index_template[] = { struct ctl_mode_pages { struct scsi_da_rw_recovery_page rw_er_page[4]; - struct scsi_format_page format_page[4]; - struct scsi_rigid_disk_page rigid_disk_page[4]; struct scsi_da_verify_recovery_page verify_er_page[4]; struct scsi_caching_page caching_page[4]; struct scsi_control_page control_page[4]; @@ -313,8 +252,6 @@ struct ctl_mode_pages { }; #define MODE_RWER mode_pages.rw_er_page[CTL_PAGE_CURRENT] -#define MODE_FMT mode_pages.format_page[CTL_PAGE_CURRENT] -#define MODE_RDISK mode_pages.rigid_disk_page[CTL_PAGE_CURRENT] #define MODE_VER mode_pages.verify_er_page[CTL_PAGE_CURRENT] #define MODE_CACHING mode_pages.caching_page[CTL_PAGE_CURRENT] #define MODE_CTRL mode_pages.control_page[CTL_PAGE_CURRENT]