@@ -2974,3 +2974,74 @@ static int hwcomp_log(int argc, char **argv, struct command *acmd, struct plugin
29742974{
29752975 return ocp_hwcomp_log (argc , argv , acmd , plugin );
29762976}
2977+
2978+ ///////////////////////////////////////////////////////////////////////////////
2979+ ///////////////////////////////////////////////////////////////////////////////
2980+ ///////////////////////////////////////////////////////////////////////////////
2981+ ///////////////////////////////////////////////////////////////////////////////
2982+ /// Idle Wake Up Time Configuration (Feature Identifier CAh) Get Feature
2983+ static int ocp_get_idle_wakeup_time_config_feature (int argc , char * * argv ,
2984+ struct command * acmd , struct plugin * plugin )
2985+ {
2986+ const char * desc = "Define Issue Get Feature cmd (FID: 0xCA) Idle Wake Up Time" ;
2987+ const char * sel = "[0-3]: current/default/saved/supported/" ;
2988+ const char * nsid = "Byte[04-07]: Namespace Identifier Valid/Invalid/Inactive" ;
2989+
2990+ _cleanup_nvme_global_ctx_ struct nvme_global_ctx * ctx = NULL ;
2991+ _cleanup_nvme_transport_handle_ struct nvme_transport_handle * hdl = NULL ;
2992+
2993+ __u64 result ;
2994+ int err ;
2995+ bool uuid ;
2996+ __u8 uuid_index = 0 ;
2997+
2998+ struct config {
2999+ __u8 sel ;
3000+ __u32 nsid ;
3001+ };
3002+
3003+ struct config cfg = {
3004+ .sel = 0 ,
3005+ .nsid = 0 ,
3006+ };
3007+
3008+ OPT_ARGS (opts ) = {
3009+ OPT_BYTE ("sel" , 's' , & cfg .sel , sel ),
3010+ OPT_UINT ("namespace-id" , 'n' , & cfg .nsid , nsid ),
3011+ OPT_FLAG ("no-uuid" , 'u' , NULL , no_uuid ),
3012+ OPT_END ()
3013+ };
3014+
3015+ err = parse_and_open (& ctx , & hdl , argc , argv , desc , opts );
3016+ if (err )
3017+ return err ;
3018+
3019+ uuid = !argconfig_parse_seen (opts , "no-uuid" );
3020+
3021+ if (uuid ) {
3022+ /* OCP 2.0 requires UUID index support */
3023+ err = ocp_get_uuid_index (hdl , & uuid_index );
3024+ if (err || !uuid_index ) {
3025+ nvme_show_error ("ERROR: No OCP UUID index found" );
3026+ return err ;
3027+ }
3028+ }
3029+
3030+ err = nvme_get_features (hdl , cfg .nsid , OCP_FID_IWTC , cfg .sel , 0 ,
3031+ uuid_index , NULL , 0 , & result );
3032+ if (!err ) {
3033+ if (result == 0 ){
3034+ printf ("get-feature:0xCA SEL=%s, Idle WakeUp Time is Disabled: %#016" PRIx64 "\n" ,
3035+ nvme_select_to_string (cfg .sel ), (uint64_t )result );
3036+ } else {
3037+ printf ("get-feature:0xCA SEL=%s,Idle WakeUp Time is: %#016" PRIx64 "\n" ,
3038+ nvme_select_to_string (cfg .sel ), (uint64_t )result );
3039+ }
3040+ if (cfg .sel == NVME_GET_FEATURES_SEL_SUPPORTED )
3041+ nvme_show_select_result (0xCA , result );
3042+ } else {
3043+ nvme_show_error ("Could not get feature: 0xCA" );
3044+ }
3045+
3046+ return err ;
3047+ }
0 commit comments