forked from nvmecompliance/tnvme
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setFeatures.h
192 lines (167 loc) · 6.46 KB
/
setFeatures.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
/*
* Copyright (c) 2011, Intel Corporation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef _SETFEATURES_H_
#define _SETFEATURES_H_
#include "baseFeatures.h"
class SetFeatures; // forward definition
typedef boost::shared_ptr<SetFeatures> SharedSetFeaturesPtr;
typedef boost::shared_ptr<const SetFeatures> ConstSharedSetFeaturesPtr;
#define CAST_TO_SETFEATURES(shared_trackable_ptr) \
boost::dynamic_pointer_cast<SetFeatures>(shared_trackable_ptr);
/**
* This class implements the SetFeatures admin cmd
*
* @note This class may throw exceptions.
*/
class SetFeatures : public BaseFeatures
{
public:
SetFeatures();
virtual ~SetFeatures();
/// Used to compare for NULL pointers being returned by allocations
static SharedSetFeaturesPtr NullSetFeaturesPtr;
static const uint8_t Opcode;
/**
* Set the command arbitration desired.
* @param hpw Pass the high priority weight desired
* @param mpw Pass the medium priority weight desired
* @param lpw Pass the low priority weight desired
* @param ab Pass the arbitration burst desired
*/
void SetArbitration(uint8_t hpw, uint8_t mpw, uint8_t lpw, uint8_t ab);
void SetArbitrationHPW(uint8_t hpw);
void SetArbitrationMPW(uint8_t mpw);
void SetArbitrationLPW(uint8_t lpw);
void SetArbitrationAB(uint8_t ab);
uint32_t GetArbitration() const;
uint8_t GetArbitrationHPW() const;
uint8_t GetArbitrationMPW() const;
uint8_t GetArbitrationLPW() const;
uint8_t GetArbitrationAB() const;
/**
* Set the power management state (PS) desired.
* @note Spec states "shall only" be set to supported values using
* IdentifyCtrlr.NPSS
* @param ps Pass the power state desired
*/
void SetPowerManagementPS(uint8_t ps);
uint8_t GetPowerManagementPS() const;
/**
* Set the number of LBA ranges desired.
* @param num Pass the number of LBA ranges desired
*/
void SetLBARangeTypeNUM(uint8_t num);
uint8_t GetLBARangeTypeNUM() const;
/**
* Set the temperature threshold desired in units of kelvin.
* @param tmpth Pass the temperature threshold desired (kelvin)
*/
void SetTempThresholdTMPTH(uint16_t tmpth);
uint16_t GetTempThresholdTMPTH() const;
/**
* Set the error recovery limited retry timeout desired.
* This value is in 100 millisec units.
* @param tler Pass the time limited error recovery desired (100ms units)
*/
void SetErrRecoveryTLER(uint16_t tler);
uint16_t GetErrRecoveryTLER() const;
/**
* Set the error recovery deallocated or unwritten logical block error
* enable bit.
* @param dulbe The bit value to set; true = 1, false = 0
*/
void SetErrRecoveryDULBE(bool dulbe);
bool GetErrRecoveryDULBE() const;
/**
* Set the volatile write cache to either enabled or disabled.
* @param wce Pass write cache enabled(1) or disabled(0).
*/
void SetVolatileWriteCacheWCE(uint8_t wce);
uint8_t GetVolatileWriteCacheWCE() const;
/**
* Set the number of IO queues desired.
* @note Spec states "shall only" be set after a power cycle, not resets
* @param ncqr Pass the number of IOCQ's desired
* @param nsqr Pass the number of IOSQ's desired
*/
void SetNumberOfQueues(uint16_t ncqr, uint16_t nsqr);
void SetNumberOfQueuesNCQR(uint16_t ncqr);
void SetNumberOfQueuesNSQR(uint16_t nsqr);
uint32_t GetNumberOfQueues() const;
uint16_t GetNumberOfQueuesNCQR() const;
uint16_t GetNumberOfQueuesNSQR() const;
/**
* Set the interrupt coalescing values for aggregation time in 100us
* increments and aggregation threshold (completion entries) desired.
* @param time Pass recommended maximum time in 100 usec units.
* @param thr Pass desired minimum no. of CQ entries to aggregate per IV.
*/
void SetIntCoalescing(uint8_t time, uint8_t thr);
void SetIntCoalescingTIME(uint8_t time);
void SetIntCoalescingTHR(uint8_t thr);
uint32_t GetIntCoalescing() const;
uint8_t GetIntCoalescingTIME() const;
uint8_t GetIntCoalescingTHR() const;
/**
* Set the interrupt vector configuration desired.
* @param cd Set coalescing disable value to 1 or 0 desired.
* @param iv Specify the interrupt vec for which the config settings apply.
*/
void SetIntVecConfig(uint8_t cd, uint16_t iv);
void SetIntVecConfigIV(uint16_t iv);
void SetIntVecConfigCD(uint8_t cd);
uint32_t GetIntVecConfig() const;
uint16_t GetIntVecConfigIV() const;
uint8_t GetIntVecConfigCD() const;
/**
* Set the write atomicity feature control desired
* @param dn Set the write atomicity of enabled(1) or disable(0).
*/
void SetWriteAtomicityDN(uint8_t dn);
uint8_t GetWriteAtomicityDN() const;
/**
* Set the desired controls in bit vector for the events that trigger an
* asynchronous event notification to the host.
* @param critWarn Set the desired bit mask for critical warnings.
*/
void SetAsyncEventConfigSMART(uint16_t critWarn);
uint16_t GetAsyncEventConfigSMART() const;
/**
* Set the pre boot s/w load cnt desired for software progress marker
* and this is persistent across power cycles.
* @param pbslc Pass pre-boot s/w load cnt desired.
*/
void SetSWProgressMarkerPBSLC(uint8_t pbslc);
uint8_t GetSWProgressMarkerPBSLC() const;
/**
* Set the autonomous power state transition enable bit.
* @param enable auto PS enabled or disabled
*/
void SetAutoPSTransAPSTE(bool enable);
bool GetAutoPSTransAPSTE() const;
/**
* Sets Save (SV) field that forces the controller to save the
* attribute through all power states and resets
* @param saveable sets the save (SV) field to either 1 or 0
*/
void SetSave(bool save);
/**
* Set Power State to a potentially unsafe power state.
* @param ps power state to be set to
*/
void SetUnsafePS(uint8_t ps);
};
#endif