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.

MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D33646
This commit is contained in:
Andriy Gapon 2022-01-11 15:41:38 +02:00
parent 7e8ed296e1
commit 75bc7150f4
4 changed files with 22 additions and 15 deletions

View File

@ -9203,31 +9203,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:

View File

@ -475,18 +475,18 @@ epc_getmode(struct cam_device *device, camcontrol_devtype devtype,
|| (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;
}

View File

@ -3660,8 +3660,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");

View File

@ -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 */