Index: sys/cam/scsi/scsi_da.c =================================================================== --- sys/cam/scsi/scsi_da.c +++ sys/cam/scsi/scsi_da.c @@ -106,6 +106,7 @@ DA_FLAG_NEW_PACK = 0x000002, DA_FLAG_PACK_LOCKED = 0x000004, DA_FLAG_PACK_REMOVABLE = 0x000008, + DA_FLAG_ROTATING = 0x000010, DA_FLAG_NEED_OTAG = 0x000020, DA_FLAG_WAS_OTAG = 0x000040, DA_FLAG_RETRY_UA = 0x000080, @@ -120,8 +121,32 @@ DA_FLAG_CAN_ATA_IDLOG = 0x010000, DA_FLAG_CAN_ATA_SUPCAP = 0x020000, DA_FLAG_CAN_ATA_ZONE = 0x040000, - DA_FLAG_TUR_PENDING = 0x080000 + DA_FLAG_TUR_PENDING = 0x080000, + DA_FLAG_UNMAPPEDIO = 0x100000 } da_flags; +#define DA_FLAG_STRING \ + "\020" \ + "\001PACK_INVALID" \ + "\002NEW_PACK" \ + "\003PACK_LOCKED" \ + "\004PACK_REMOVABLE" \ + "\005ROTATING" \ + "\006NEED_OTAG" \ + "\007WAS_OTAG" \ + "\010RETRY_UA" \ + "\011OPEN" \ + "\012SCTX_INIT" \ + "\013CAN_RC16" \ + "\014PROBED" \ + "\015DIRTY" \ + "\016ANNOUCNED" \ + "\017CAN_ATA_DMA" \ + "\020CAN_ATA_LOG" \ + "\021CAN_ATA_IDLOG" \ + "\022CAN_ATA_SUPACP" \ + "\023CAN_ATA_ZONE" \ + "\024TUR_PENDING" \ + "\025UNMAPPEDIO" typedef enum { DA_Q_NONE = 0x00, @@ -345,8 +370,8 @@ da_delete_methods delete_method_pref; da_delete_methods delete_method; da_delete_func_t *delete_func; - int unmappedio; - int rotating; + int unmappedio; /* compat only */ + int rotating; /* compat only */ int p_type; struct disk_params params; struct disk *disk; @@ -1442,6 +1467,7 @@ static int dasysctlsofttimeout(SYSCTL_HANDLER_ARGS); static int dacmdsizesysctl(SYSCTL_HANDLER_ARGS); static int dadeletemethodsysctl(SYSCTL_HANDLER_ARGS); +static int daflagssysctl(SYSCTL_HANDLER_ARGS); static int dazonemodesysctl(SYSCTL_HANDLER_ARGS); static int dazonesupsysctl(SYSCTL_HANDLER_ARGS); static int dadeletemaxsysctl(SYSCTL_HANDLER_ARGS); @@ -2296,7 +2322,7 @@ CTLFLAG_RD, &softc->unmappedio, 0, - "Unmapped I/O support"); + "Unmapped I/O support *DEPRECATED* gone in FreeBSD 14"); SYSCTL_ADD_INT(&softc->sysctl_ctx, SYSCTL_CHILDREN(softc->sysctl_tree), @@ -2305,7 +2331,7 @@ CTLFLAG_RD, &softc->rotating, 0, - "Rotating media"); + "Rotating media *DEPRECATED* gone in FreeBSD 14"); SYSCTL_ADD_INT(&softc->sysctl_ctx, SYSCTL_CHILDREN(softc->sysctl_tree), @@ -2316,6 +2342,11 @@ 0, "DIF protection type"); + SYSCTL_ADD_PROC(&softc->sysctl_ctx, SYSCTL_CHILDREN(softc->sysctl_tree), + OID_AUTO, "flags", CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_MPSAFE, + softc, 0, daflagssysctl, "A", + "Flags for drive"); + #ifdef CAM_TEST_FAILURE SYSCTL_ADD_PROC(&softc->sysctl_ctx, SYSCTL_CHILDREN(softc->sysctl_tree), OID_AUTO, "invalidate", CTLTYPE_U64 | CTLFLAG_RW | CTLFLAG_MPSAFE, @@ -2590,6 +2621,24 @@ dadeletemethodset(softc, default_method); } +static int +daflagssysctl(SYSCTL_HANDLER_ARGS) +{ + struct sbuf sbuf; + struct da_softc *softc = arg1; + int error; + + sbuf_new_for_sysctl(&sbuf, NULL, 0, req); + if (softc->flags != 0) + sbuf_printf(&sbuf, "0x%b", softc->flags, DA_FLAG_STRING); + else + sbuf_printf(&sbuf, "0"); + error = sbuf_finish(&sbuf); + sbuf_delete(&sbuf); + + return (error); +} + static int dadeletemethodsysctl(SYSCTL_HANDLER_ARGS) { @@ -2730,6 +2779,7 @@ softc->ws_max_blks = WS16_MAX_BLKS; softc->trim_max_ranges = ATA_TRIM_MAX_RANGES; softc->rotating = 1; + softc->flags |= DA_FLAG_ROTATING; periph->softc = softc; @@ -2863,6 +2913,7 @@ softc->disk->d_flags |= DISKFLAG_CANFLUSHCACHE; if ((cpi.hba_misc & PIM_UNMAPPED) != 0) { softc->unmappedio = 1; + softc->flags |= DA_FLAG_UNMAPPEDIO; softc->disk->d_flags |= DISKFLAG_UNMAPPED_BIO; } cam_strvis(softc->disk->d_descr, cgd->inq_data.vendor, @@ -5139,6 +5190,7 @@ cam_iosched_set_sort_queue( softc->cam_iosched, 0); softc->rotating = 0; + softc->flags &= ~DA_FLAG_ROTATING; } if (softc->disk->d_rotation_rate != old_rate) { disk_attr_changed(softc->disk, @@ -5249,6 +5301,7 @@ if (softc->disk->d_rotation_rate == ATA_RATE_NON_ROTATING) { cam_iosched_set_sort_queue(softc->cam_iosched, 0); softc->rotating = 0; + softc->flags &= ~DA_FLAG_ROTATING; } if (softc->disk->d_rotation_rate != old_rate) { disk_attr_changed(softc->disk,