@@ -107,70 +107,6 @@ ice_read_flat_nvm(struct ice_hw *hw, u32 offset, u32 *length, u8 *data,
107
107
return status ;
108
108
}
109
109
110
- /**
111
- * ice_check_sr_access_params - verify params for Shadow RAM R/W operations.
112
- * @hw: pointer to the HW structure
113
- * @offset: offset in words from module start
114
- * @words: number of words to access
115
- */
116
- static enum ice_status
117
- ice_check_sr_access_params (struct ice_hw * hw , u32 offset , u16 words )
118
- {
119
- if ((offset + words ) > hw -> nvm .sr_words ) {
120
- ice_debug (hw , ICE_DBG_NVM ,
121
- "NVM error: offset beyond SR lmt.\n" );
122
- return ICE_ERR_PARAM ;
123
- }
124
-
125
- if (words > ICE_SR_SECTOR_SIZE_IN_WORDS ) {
126
- /* We can access only up to 4KB (one sector), in one AQ write */
127
- ice_debug (hw , ICE_DBG_NVM ,
128
- "NVM error: tried to access %d words, limit is %d.\n" ,
129
- words , ICE_SR_SECTOR_SIZE_IN_WORDS );
130
- return ICE_ERR_PARAM ;
131
- }
132
-
133
- if (((offset + (words - 1 )) / ICE_SR_SECTOR_SIZE_IN_WORDS ) !=
134
- (offset / ICE_SR_SECTOR_SIZE_IN_WORDS )) {
135
- /* A single access cannot spread over two sectors */
136
- ice_debug (hw , ICE_DBG_NVM ,
137
- "NVM error: cannot spread over two sectors.\n" );
138
- return ICE_ERR_PARAM ;
139
- }
140
-
141
- return 0 ;
142
- }
143
-
144
- /**
145
- * ice_read_sr_aq - Read Shadow RAM.
146
- * @hw: pointer to the HW structure
147
- * @offset: offset in words from module start
148
- * @words: number of words to read
149
- * @data: storage for the words read from Shadow RAM (Little Endian)
150
- * @last_command: tells the AdminQ that this is the last command
151
- *
152
- * Reads 16-bit Little Endian word buffers from the Shadow RAM using the admin
153
- * command.
154
- */
155
- static enum ice_status
156
- ice_read_sr_aq (struct ice_hw * hw , u32 offset , u16 words , __le16 * data ,
157
- bool last_command )
158
- {
159
- enum ice_status status ;
160
-
161
- status = ice_check_sr_access_params (hw , offset , words );
162
-
163
- /* values in "offset" and "words" parameters are sized as words
164
- * (16 bits) but ice_aq_read_nvm expects these values in bytes.
165
- * So do this conversion while calling ice_aq_read_nvm.
166
- */
167
- if (!status )
168
- status = ice_aq_read_nvm (hw , 0 , 2 * offset , 2 * words , data ,
169
- last_command , true, NULL );
170
-
171
- return status ;
172
- }
173
-
174
110
/**
175
111
* ice_read_sr_word_aq - Reads Shadow RAM via AQ
176
112
* @hw: pointer to the HW structure
@@ -198,71 +134,14 @@ ice_read_sr_word_aq(struct ice_hw *hw, u16 offset, u16 *data)
198
134
return 0 ;
199
135
}
200
136
201
- /**
202
- * ice_read_sr_buf_aq - Reads Shadow RAM buf via AQ
203
- * @hw: pointer to the HW structure
204
- * @offset: offset of the Shadow RAM word to read (0x000000 - 0x001FFF)
205
- * @words: (in) number of words to read; (out) number of words actually read
206
- * @data: words read from the Shadow RAM
207
- *
208
- * Reads 16 bit words (data buf) from the SR using the ice_read_sr_aq
209
- * method. Ownership of the NVM is taken before reading the buffer and later
210
- * released.
211
- */
212
- static enum ice_status
213
- ice_read_sr_buf_aq (struct ice_hw * hw , u16 offset , u16 * words , u16 * data )
214
- {
215
- enum ice_status status ;
216
- bool last_cmd = false;
217
- u16 words_read = 0 ;
218
- u16 i = 0 ;
219
-
220
- do {
221
- u16 read_size , off_w ;
222
-
223
- /* Calculate number of bytes we should read in this step.
224
- * It's not allowed to read more than one page at a time or
225
- * to cross page boundaries.
226
- */
227
- off_w = offset % ICE_SR_SECTOR_SIZE_IN_WORDS ;
228
- read_size = off_w ?
229
- min_t (u16 , * words ,
230
- (ICE_SR_SECTOR_SIZE_IN_WORDS - off_w )) :
231
- min_t (u16 , (* words - words_read ),
232
- ICE_SR_SECTOR_SIZE_IN_WORDS );
233
-
234
- /* Check if this is last command, if so set proper flag */
235
- if ((words_read + read_size ) >= * words )
236
- last_cmd = true;
237
-
238
- status = ice_read_sr_aq (hw , offset , read_size ,
239
- data + words_read , last_cmd );
240
- if (status )
241
- goto read_nvm_buf_aq_exit ;
242
-
243
- /* Increment counter for words already read and move offset to
244
- * new read location
245
- */
246
- words_read += read_size ;
247
- offset += read_size ;
248
- } while (words_read < * words );
249
-
250
- for (i = 0 ; i < * words ; i ++ )
251
- data [i ] = le16_to_cpu (((__force __le16 * )data )[i ]);
252
-
253
- read_nvm_buf_aq_exit :
254
- * words = words_read ;
255
- return status ;
256
- }
257
-
258
137
/**
259
138
* ice_acquire_nvm - Generic request for acquiring the NVM ownership
260
139
* @hw: pointer to the HW structure
261
140
* @access: NVM access type (read or write)
262
141
*
263
142
* This function will request NVM ownership.
264
143
*/
265
- static enum ice_status
144
+ enum ice_status
266
145
ice_acquire_nvm (struct ice_hw * hw , enum ice_aq_res_access_type access )
267
146
{
268
147
if (hw -> nvm .blank_nvm_mode )
@@ -277,7 +156,7 @@ ice_acquire_nvm(struct ice_hw *hw, enum ice_aq_res_access_type access)
277
156
*
278
157
* This function will release NVM ownership.
279
158
*/
280
- static void ice_release_nvm (struct ice_hw * hw )
159
+ void ice_release_nvm (struct ice_hw * hw )
281
160
{
282
161
if (hw -> nvm .blank_nvm_mode )
283
162
return ;
@@ -514,31 +393,6 @@ enum ice_status ice_init_nvm(struct ice_hw *hw)
514
393
return 0 ;
515
394
}
516
395
517
- /**
518
- * ice_read_sr_buf - Reads Shadow RAM buf and acquire lock if necessary
519
- * @hw: pointer to the HW structure
520
- * @offset: offset of the Shadow RAM word to read (0x000000 - 0x001FFF)
521
- * @words: (in) number of words to read; (out) number of words actually read
522
- * @data: words read from the Shadow RAM
523
- *
524
- * Reads 16 bit words (data buf) from the SR using the ice_read_nvm_buf_aq
525
- * method. The buf read is preceded by the NVM ownership take
526
- * and followed by the release.
527
- */
528
- enum ice_status
529
- ice_read_sr_buf (struct ice_hw * hw , u16 offset , u16 * words , u16 * data )
530
- {
531
- enum ice_status status ;
532
-
533
- status = ice_acquire_nvm (hw , ICE_RES_READ );
534
- if (!status ) {
535
- status = ice_read_sr_buf_aq (hw , offset , words , data );
536
- ice_release_nvm (hw );
537
- }
538
-
539
- return status ;
540
- }
541
-
542
396
/**
543
397
* ice_nvm_validate_checksum
544
398
* @hw: pointer to the HW struct
0 commit comments