From nobody Tue Jan 25 07:48:01 2022 X-Original-To: dev-commits-src-all@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 2386D1979E8B; Tue, 25 Jan 2022 07:48:02 +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 4Jjf8x72p3z3RKk; Tue, 25 Jan 2022 07:48:01 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1643096882; 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=PIZoby/0FHKrbhl7G4uzZ4681HWr28P1j3NvNgAWNJQ=; b=cUQ5VJo2iib+llw7okpYkDv0WJrGklSrfW4jMYWGjFkHkiKR7iQvqixBdTHwtYHFDCS/r7 hoDcaM8VPZn3irMMVB5tTmiyn6lTSpFpafkW+/hlnUWn7AOEp6pwlWCivjzupSF9+Ot+6+ Q3hXHsum48LEbySLxbWws7B6lFKryiFTPlb7YDrBcT6jAIw8hKDsTSpM+zGCzTU2KvHjNN j2M4qPBZJWUS03UvIGojCG3Vvtp2EzPRX7B2JhhjnrOpaYxoImq5l07Qm+rrqeDgEoOk4i wK55/wPGtDAkRYlHlqS64fjulhfS+xiyl5u5gbfaNQj09N0duCf67b47xqUPSg== 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 A15F825D36; Tue, 25 Jan 2022 07:48:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 20P7m1KF037665; Tue, 25 Jan 2022 07:48:01 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 20P7m11v037664; Tue, 25 Jan 2022 07:48:01 GMT (envelope-from git) Date: Tue, 25 Jan 2022 07:48:01 GMT Message-Id: <202201250748.20P7m11v037664@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Andriy Gapon Subject: git: 82acfc0d7838 - stable/13 - add and use defintions for ATA power modes List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: avg X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 82acfc0d7838dca0969c4469e8181e34606d15a0 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1643096882; 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=PIZoby/0FHKrbhl7G4uzZ4681HWr28P1j3NvNgAWNJQ=; b=REQAvcENSaBUOcDABDMqwgBGISWReGvWLe3SnUoPsph5h9wDtKOZ49ceqHp+gx6uHrqrT4 RVk0XBLBL1EiEx+tkd0zbyDah3OQ2t395baqLo94Ebk+3yayqfHc/NWViAmXxC8NvJGRVF ywJ2r9oBGkss868VLlyVA3AanjdZbVjkAt8uuiDyDUzAAyTVLr7bEw1yllAZXHcBObKqfQ gCBVQ1O/7y0NNu8ZqyL33VnnxAxb3PMGEFTpCKCcuQNRN1UuOK5xzwD96FRfXV3yiTFSMq +w02wcTcjr5Ns6IGNF1erfu6MsFBl2vcoilvJjHl5ZSDuDqPDsDxpih6TN4HLw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1643096882; a=rsa-sha256; cv=none; b=s9Fy5eVa+89CAwJ4zK/vJbnhvzhk2V+D+l/d0oHlHM/Igbpyel8uG1VJyLakdSJX2RAC1v Dxcyx7by+rWKk6Y3ScQmQHYWuwWIFTqsjZM+USBKJ2buXaYudopzV9V9x+54gU/2Pbuqt8 TtuOM/Tdc75W7jCvj6h4v5jQbKsru8KvcpnNWq2D8GRPnRldrXoFmAy1swFDBCyF9EFnWe 8DiFqbFXnG7239M7mAZBzjtvb9HKidfj73IRaqbsZ+ipsvlTb+fcls4JQlPDRgXvamVmRO R47OmMix1jus8lx3KCdQXIQ2T3a3dZLWn2aRW2mg6KHbj9VqY2vKC0MTv/k3Cg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by avg: URL: https://cgit.FreeBSD.org/src/commit/?id=82acfc0d7838dca0969c4469e8181e34606d15a0 commit 82acfc0d7838dca0969c4469e8181e34606d15a0 Author: Andriy Gapon AuthorDate: 2022-01-11 13:41:38 +0000 Commit: Andriy Gapon CommitDate: 2022-01-25 07:43:11 +0000 add and use defintions for ATA power modes Those can be returned by CHECK POWER MODE command (0xe5). Note that some of the definitions duplicate definitions for Extended Power Conditions. (cherry picked from commit 75bc7150f4b87e14da13e2e96da9cdf59a5723cf) --- sbin/camcontrol/camcontrol.c | 18 +++++++++--------- sbin/camcontrol/epc.c | 8 ++++---- sys/cam/ata/ata_da.c | 4 ++-- sys/sys/ata.h | 7 +++++++ 4 files changed, 22 insertions(+), 15 deletions(-) diff --git a/sbin/camcontrol/camcontrol.c b/sbin/camcontrol/camcontrol.c index 35272bcdc8ed..7e39b67908e1 100644 --- a/sbin/camcontrol/camcontrol.c +++ b/sbin/camcontrol/camcontrol.c @@ -9242,31 +9242,31 @@ atapm_proc_resp(struct cam_device *device, union ccb *ccb) printf("%s%d: ", device->device_name, device->dev_unit_num); switch (count) { - case 0x00: + case ATA_PM_STANDBY: printf("Standby mode\n"); break; - case 0x01: + case ATA_PM_STANDBY_Y: printf("Standby_y mode\n"); break; - case 0x40: + case 0x40: /* obsolete since ACS-3 */ printf("NV Cache Power Mode and the spindle is spun down or spinning down\n"); break; - case 0x41: + case 0x41: /* obsolete since ACS-3 */ printf("NV Cache Power Mode and the spindle is spun up or spinning up\n"); break; - case 0x80: + case ATA_PM_IDLE: printf("Idle mode\n"); break; - case 0x81: + case ATA_PM_IDLE_A: printf("Idle_a mode\n"); break; - case 0x82: + case ATA_PM_IDLE_B: printf("Idle_b mode\n"); break; - case 0x83: + case ATA_PM_IDLE_C: printf("Idle_c mode\n"); break; - case 0xff: + case ATA_PM_ACTIVE_IDLE: printf("Active or Idle mode\n"); break; default: diff --git a/sbin/camcontrol/epc.c b/sbin/camcontrol/epc.c index 8b42f63c7523..5da3bbbc35d3 100644 --- a/sbin/camcontrol/epc.c +++ b/sbin/camcontrol/epc.c @@ -475,18 +475,18 @@ check_power_mode: || (ident->enabled2 & ATA_ENABLED_EPC)) { if (mode_name != NULL) printf("%s", mode_name); - else if (count == 0xff) { + else if (count == ATA_PM_ACTIVE_IDLE) { printf("PM0:Active or PM1:Idle"); } } else { switch (count) { - case 0x00: + case ATA_PM_STANDBY: printf("PM2:Standby"); break; - case 0x80: + case ATA_PM_IDLE: printf("PM1:Idle"); break; - case 0xff: + case ATA_PM_ACTIVE_IDLE: printf("PM0:Active or PM1:Idle"); break; } diff --git a/sys/cam/ata/ata_da.c b/sys/cam/ata/ata_da.c index 5aa29174f71a..2c69c4545f0f 100644 --- a/sys/cam/ata/ata_da.c +++ b/sys/cam/ata/ata_da.c @@ -3624,8 +3624,8 @@ adaspindown(uint8_t cmd, int flags) } #endif switch (mode) { - case 0x00: - case 0x01: + case ATA_PM_STANDBY: + case ATA_PM_STANDBY_Y: if (bootverbose) { xpt_print(periph->path, "already spun down\n"); diff --git a/sys/sys/ata.h b/sys/sys/ata.h index 7f89d96790fe..2cebba0e4864 100644 --- a/sys/sys/ata.h +++ b/sys/sys/ata.h @@ -477,6 +477,13 @@ struct ata_params { #define ATA_READ_BUFFER 0xe4 /* read buffer */ #define ATA_READ_PM 0xe4 /* read portmultiplier */ #define ATA_CHECK_POWER_MODE 0xe5 /* device power mode */ +#define ATA_PM_STANDBY 0x00 /* standby, also ATA_EPC_STANDBY_Z */ +#define ATA_PM_STANDBY_Y 0x01 /* standby, also ATA_EPC_STANDBY_Y */ +#define ATA_PM_IDLE 0x80 /* idle */ +#define ATA_PM_IDLE_A 0x81 /* idle, also ATA_EPC_IDLE_A */ +#define ATA_PM_IDLE_B 0x82 /* idle, also ATA_EPC_IDLE_B */ +#define ATA_PM_IDLE_C 0x83 /* idle, also ATA_EPC_IDLE_C */ +#define ATA_PM_ACTIVE_IDLE 0xff /* active or idle */ #define ATA_SLEEP 0xe6 /* sleep */ #define ATA_FLUSHCACHE 0xe7 /* flush cache to disk */ #define ATA_WRITE_BUFFER 0xe8 /* write buffer */