aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/staging/rts5139/ms_mg.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/staging/rts5139/ms_mg.c')
-rw-r--r--drivers/staging/rts5139/ms_mg.c104
1 files changed, 52 insertions, 52 deletions
diff --git a/drivers/staging/rts5139/ms_mg.c b/drivers/staging/rts5139/ms_mg.c
index 057d96c1a93..54cfd85259a 100644
--- a/drivers/staging/rts5139/ms_mg.c
+++ b/drivers/staging/rts5139/ms_mg.c
@@ -119,7 +119,7 @@ int mg_set_tpc_para_sub(struct rts51x_chip *chip, int type, u8 mg_entry_num)
119 * 2. send SET_ID TPC command to medium with Leaf ID released by host 119 * 2. send SET_ID TPC command to medium with Leaf ID released by host
120 * in this SCSI CMD. 120 * in this SCSI CMD.
121 */ 121 */
122int mg_set_leaf_id(struct scsi_cmnd *srb, struct rts51x_chip *chip) 122int rts51x_mg_set_leaf_id(struct scsi_cmnd *srb, struct rts51x_chip *chip)
123{ 123{
124 int retval; 124 int retval;
125 int i; 125 int i;
@@ -129,10 +129,10 @@ int mg_set_leaf_id(struct scsi_cmnd *srb, struct rts51x_chip *chip)
129 RTS51X_DEBUGP("--%s--\n", __func__); 129 RTS51X_DEBUGP("--%s--\n", __func__);
130 130
131 if (scsi_bufflen(srb) < 12) { 131 if (scsi_bufflen(srb) < 12) {
132 set_sense_type(chip, lun, SENSE_TYPE_MEDIA_INVALID_CMD_FIELD); 132 rts51x_set_sense_type(chip, lun, SENSE_TYPE_MEDIA_INVALID_CMD_FIELD);
133 TRACE_RET(chip, STATUS_FAIL); 133 TRACE_RET(chip, STATUS_FAIL);
134 } 134 }
135 ms_cleanup_work(chip); 135 rts51x_ms_cleanup_work(chip);
136 136
137 retval = ms_switch_clock(chip); 137 retval = ms_switch_clock(chip);
138 if (retval != STATUS_SUCCESS) 138 if (retval != STATUS_SUCCESS)
@@ -140,7 +140,7 @@ int mg_set_leaf_id(struct scsi_cmnd *srb, struct rts51x_chip *chip)
140 140
141 retval = mg_send_ex_cmd(chip, MG_SET_LID, 0); 141 retval = mg_send_ex_cmd(chip, MG_SET_LID, 0);
142 if (retval != STATUS_SUCCESS) { 142 if (retval != STATUS_SUCCESS) {
143 set_sense_type(chip, lun, SENSE_TYPE_MG_KEY_FAIL_NOT_ESTAB); 143 rts51x_set_sense_type(chip, lun, SENSE_TYPE_MG_KEY_FAIL_NOT_ESTAB);
144 TRACE_RET(chip, retval); 144 TRACE_RET(chip, retval);
145 } 145 }
146 146
@@ -151,12 +151,12 @@ int mg_set_leaf_id(struct scsi_cmnd *srb, struct rts51x_chip *chip)
151 retval = 151 retval =
152 ms_write_bytes(chip, PRO_WRITE_SHORT_DATA, 32, WAIT_INT, buf1, 32); 152 ms_write_bytes(chip, PRO_WRITE_SHORT_DATA, 32, WAIT_INT, buf1, 32);
153 if (retval != STATUS_SUCCESS) { 153 if (retval != STATUS_SUCCESS) {
154 set_sense_type(chip, lun, SENSE_TYPE_MG_KEY_FAIL_NOT_ESTAB); 154 rts51x_set_sense_type(chip, lun, SENSE_TYPE_MG_KEY_FAIL_NOT_ESTAB);
155 TRACE_RET(chip, retval); 155 TRACE_RET(chip, retval);
156 } 156 }
157 retval = mg_check_int_error(chip); 157 retval = mg_check_int_error(chip);
158 if (retval != STATUS_SUCCESS) { 158 if (retval != STATUS_SUCCESS) {
159 set_sense_type(chip, lun, SENSE_TYPE_MG_KEY_FAIL_NOT_ESTAB); 159 rts51x_set_sense_type(chip, lun, SENSE_TYPE_MG_KEY_FAIL_NOT_ESTAB);
160 TRACE_RET(chip, retval); 160 TRACE_RET(chip, retval);
161 } 161 }
162 162
@@ -170,7 +170,7 @@ int mg_set_leaf_id(struct scsi_cmnd *srb, struct rts51x_chip *chip)
170 * data(1536 bytes totally) from medium by using READ_LONG_DATA TPC 170 * data(1536 bytes totally) from medium by using READ_LONG_DATA TPC
171 * for 3 times, and report data to host with data-length is 1052 bytes. 171 * for 3 times, and report data to host with data-length is 1052 bytes.
172 */ 172 */
173int mg_get_local_EKB(struct scsi_cmnd *srb, struct rts51x_chip *chip) 173int rts51x_mg_get_local_EKB(struct scsi_cmnd *srb, struct rts51x_chip *chip)
174{ 174{
175 int retval = STATUS_FAIL; 175 int retval = STATUS_FAIL;
176 int bufflen; 176 int bufflen;
@@ -179,7 +179,7 @@ int mg_get_local_EKB(struct scsi_cmnd *srb, struct rts51x_chip *chip)
179 179
180 RTS51X_DEBUGP("--%s--\n", __func__); 180 RTS51X_DEBUGP("--%s--\n", __func__);
181 181
182 ms_cleanup_work(chip); 182 rts51x_ms_cleanup_work(chip);
183 183
184 retval = ms_switch_clock(chip); 184 retval = ms_switch_clock(chip);
185 if (retval != STATUS_SUCCESS) 185 if (retval != STATUS_SUCCESS)
@@ -196,21 +196,21 @@ int mg_get_local_EKB(struct scsi_cmnd *srb, struct rts51x_chip *chip)
196 196
197 retval = mg_send_ex_cmd(chip, MG_GET_LEKB, 0); 197 retval = mg_send_ex_cmd(chip, MG_GET_LEKB, 0);
198 if (retval != STATUS_SUCCESS) { 198 if (retval != STATUS_SUCCESS) {
199 set_sense_type(chip, lun, SENSE_TYPE_MG_KEY_FAIL_NOT_AUTHEN); 199 rts51x_set_sense_type(chip, lun, SENSE_TYPE_MG_KEY_FAIL_NOT_AUTHEN);
200 TRACE_GOTO(chip, GetEKBFinish); 200 TRACE_GOTO(chip, GetEKBFinish);
201 } 201 }
202 202
203 retval = ms_transfer_data(chip, MS_TM_AUTO_READ, PRO_READ_LONG_DATA, 203 retval = ms_transfer_data(chip, MS_TM_AUTO_READ, PRO_READ_LONG_DATA,
204 3, WAIT_INT, 0, 0, buf + 4, 1536); 204 3, WAIT_INT, 0, 0, buf + 4, 1536);
205 if (retval != STATUS_SUCCESS) { 205 if (retval != STATUS_SUCCESS) {
206 set_sense_type(chip, lun, SENSE_TYPE_MG_KEY_FAIL_NOT_AUTHEN); 206 rts51x_set_sense_type(chip, lun, SENSE_TYPE_MG_KEY_FAIL_NOT_AUTHEN);
207 rts51x_write_register(chip, CARD_STOP, MS_STOP | MS_CLR_ERR, 207 rts51x_write_register(chip, CARD_STOP, MS_STOP | MS_CLR_ERR,
208 MS_STOP | MS_CLR_ERR); 208 MS_STOP | MS_CLR_ERR);
209 TRACE_GOTO(chip, GetEKBFinish); 209 TRACE_GOTO(chip, GetEKBFinish);
210 } 210 }
211 retval = mg_check_int_error(chip); 211 retval = mg_check_int_error(chip);
212 if (retval != STATUS_SUCCESS) { 212 if (retval != STATUS_SUCCESS) {
213 set_sense_type(chip, lun, SENSE_TYPE_MG_KEY_FAIL_NOT_AUTHEN); 213 rts51x_set_sense_type(chip, lun, SENSE_TYPE_MG_KEY_FAIL_NOT_AUTHEN);
214 TRACE_GOTO(chip, GetEKBFinish); 214 TRACE_GOTO(chip, GetEKBFinish);
215 } 215 }
216 216
@@ -229,7 +229,7 @@ GetEKBFinish:
229 * TPC commands to the medium for writing 8-bytes data as challenge 229 * TPC commands to the medium for writing 8-bytes data as challenge
230 * by host within a short data packet. 230 * by host within a short data packet.
231 */ 231 */
232int mg_chg(struct scsi_cmnd *srb, struct rts51x_chip *chip) 232int rts51x_mg_chg(struct scsi_cmnd *srb, struct rts51x_chip *chip)
233{ 233{
234 struct ms_info *ms_card = &(chip->ms_card); 234 struct ms_info *ms_card = &(chip->ms_card);
235 int retval; 235 int retval;
@@ -240,7 +240,7 @@ int mg_chg(struct scsi_cmnd *srb, struct rts51x_chip *chip)
240 240
241 RTS51X_DEBUGP("--%s--\n", __func__); 241 RTS51X_DEBUGP("--%s--\n", __func__);
242 242
243 ms_cleanup_work(chip); 243 rts51x_ms_cleanup_work(chip);
244 244
245 retval = ms_switch_clock(chip); 245 retval = ms_switch_clock(chip);
246 if (retval != STATUS_SUCCESS) 246 if (retval != STATUS_SUCCESS)
@@ -248,19 +248,19 @@ int mg_chg(struct scsi_cmnd *srb, struct rts51x_chip *chip)
248 248
249 retval = mg_send_ex_cmd(chip, MG_GET_ID, 0); 249 retval = mg_send_ex_cmd(chip, MG_GET_ID, 0);
250 if (retval != STATUS_SUCCESS) { 250 if (retval != STATUS_SUCCESS) {
251 set_sense_type(chip, lun, SENSE_TYPE_MG_INCOMPATIBLE_MEDIUM); 251 rts51x_set_sense_type(chip, lun, SENSE_TYPE_MG_INCOMPATIBLE_MEDIUM);
252 TRACE_RET(chip, retval); 252 TRACE_RET(chip, retval);
253 } 253 }
254 254
255 retval = 255 retval =
256 ms_read_bytes(chip, PRO_READ_SHORT_DATA, 32, WAIT_INT, buf, 32); 256 ms_read_bytes(chip, PRO_READ_SHORT_DATA, 32, WAIT_INT, buf, 32);
257 if (retval != STATUS_SUCCESS) { 257 if (retval != STATUS_SUCCESS) {
258 set_sense_type(chip, lun, SENSE_TYPE_MG_INCOMPATIBLE_MEDIUM); 258 rts51x_set_sense_type(chip, lun, SENSE_TYPE_MG_INCOMPATIBLE_MEDIUM);
259 TRACE_RET(chip, retval); 259 TRACE_RET(chip, retval);
260 } 260 }
261 retval = mg_check_int_error(chip); 261 retval = mg_check_int_error(chip);
262 if (retval != STATUS_SUCCESS) { 262 if (retval != STATUS_SUCCESS) {
263 set_sense_type(chip, lun, SENSE_TYPE_MG_INCOMPATIBLE_MEDIUM); 263 rts51x_set_sense_type(chip, lun, SENSE_TYPE_MG_INCOMPATIBLE_MEDIUM);
264 TRACE_RET(chip, retval); 264 TRACE_RET(chip, retval);
265 } 265 }
266 266
@@ -276,13 +276,13 @@ int mg_chg(struct scsi_cmnd *srb, struct rts51x_chip *chip)
276 } 276 }
277 277
278 if (i == 2500) { 278 if (i == 2500) {
279 set_sense_type(chip, lun, SENSE_TYPE_MG_INCOMPATIBLE_MEDIUM); 279 rts51x_set_sense_type(chip, lun, SENSE_TYPE_MG_INCOMPATIBLE_MEDIUM);
280 TRACE_RET(chip, STATUS_FAIL); 280 TRACE_RET(chip, STATUS_FAIL);
281 } 281 }
282 282
283 retval = mg_send_ex_cmd(chip, MG_SET_RD, 0); 283 retval = mg_send_ex_cmd(chip, MG_SET_RD, 0);
284 if (retval != STATUS_SUCCESS) { 284 if (retval != STATUS_SUCCESS) {
285 set_sense_type(chip, lun, SENSE_TYPE_MG_INCOMPATIBLE_MEDIUM); 285 rts51x_set_sense_type(chip, lun, SENSE_TYPE_MG_INCOMPATIBLE_MEDIUM);
286 TRACE_RET(chip, retval); 286 TRACE_RET(chip, retval);
287 } 287 }
288 288
@@ -296,12 +296,12 @@ int mg_chg(struct scsi_cmnd *srb, struct rts51x_chip *chip)
296 retval = 296 retval =
297 ms_write_bytes(chip, PRO_WRITE_SHORT_DATA, 32, WAIT_INT, buf, 32); 297 ms_write_bytes(chip, PRO_WRITE_SHORT_DATA, 32, WAIT_INT, buf, 32);
298 if (retval != STATUS_SUCCESS) { 298 if (retval != STATUS_SUCCESS) {
299 set_sense_type(chip, lun, SENSE_TYPE_MG_INCOMPATIBLE_MEDIUM); 299 rts51x_set_sense_type(chip, lun, SENSE_TYPE_MG_INCOMPATIBLE_MEDIUM);
300 TRACE_RET(chip, retval); 300 TRACE_RET(chip, retval);
301 } 301 }
302 retval = mg_check_int_error(chip); 302 retval = mg_check_int_error(chip);
303 if (retval != STATUS_SUCCESS) { 303 if (retval != STATUS_SUCCESS) {
304 set_sense_type(chip, lun, SENSE_TYPE_MG_INCOMPATIBLE_MEDIUM); 304 rts51x_set_sense_type(chip, lun, SENSE_TYPE_MG_INCOMPATIBLE_MEDIUM);
305 TRACE_RET(chip, retval); 305 TRACE_RET(chip, retval);
306 } 306 }
307 307
@@ -320,7 +320,7 @@ int mg_chg(struct scsi_cmnd *srb, struct rts51x_chip *chip)
320 * The paremeter MagicGateID is the one that adapter has obtained from 320 * The paremeter MagicGateID is the one that adapter has obtained from
321 * the medium by TPC commands in Set Leaf ID command phase previously. 321 * the medium by TPC commands in Set Leaf ID command phase previously.
322 */ 322 */
323int mg_get_rsp_chg(struct scsi_cmnd *srb, struct rts51x_chip *chip) 323int rts51x_mg_get_rsp_chg(struct scsi_cmnd *srb, struct rts51x_chip *chip)
324{ 324{
325 struct ms_info *ms_card = &(chip->ms_card); 325 struct ms_info *ms_card = &(chip->ms_card);
326 int retval, i; 326 int retval, i;
@@ -330,7 +330,7 @@ int mg_get_rsp_chg(struct scsi_cmnd *srb, struct rts51x_chip *chip)
330 330
331 RTS51X_DEBUGP("--%s--\n", __func__); 331 RTS51X_DEBUGP("--%s--\n", __func__);
332 332
333 ms_cleanup_work(chip); 333 rts51x_ms_cleanup_work(chip);
334 334
335 retval = ms_switch_clock(chip); 335 retval = ms_switch_clock(chip);
336 if (retval != STATUS_SUCCESS) 336 if (retval != STATUS_SUCCESS)
@@ -338,19 +338,19 @@ int mg_get_rsp_chg(struct scsi_cmnd *srb, struct rts51x_chip *chip)
338 338
339 retval = mg_send_ex_cmd(chip, MG_MAKE_RMS, 0); 339 retval = mg_send_ex_cmd(chip, MG_MAKE_RMS, 0);
340 if (retval != STATUS_SUCCESS) { 340 if (retval != STATUS_SUCCESS) {
341 set_sense_type(chip, lun, SENSE_TYPE_MG_KEY_FAIL_NOT_AUTHEN); 341 rts51x_set_sense_type(chip, lun, SENSE_TYPE_MG_KEY_FAIL_NOT_AUTHEN);
342 TRACE_RET(chip, retval); 342 TRACE_RET(chip, retval);
343 } 343 }
344 344
345 retval = 345 retval =
346 ms_read_bytes(chip, PRO_READ_SHORT_DATA, 32, WAIT_INT, buf1, 32); 346 ms_read_bytes(chip, PRO_READ_SHORT_DATA, 32, WAIT_INT, buf1, 32);
347 if (retval != STATUS_SUCCESS) { 347 if (retval != STATUS_SUCCESS) {
348 set_sense_type(chip, lun, SENSE_TYPE_MG_KEY_FAIL_NOT_AUTHEN); 348 rts51x_set_sense_type(chip, lun, SENSE_TYPE_MG_KEY_FAIL_NOT_AUTHEN);
349 TRACE_RET(chip, retval); 349 TRACE_RET(chip, retval);
350 } 350 }
351 retval = mg_check_int_error(chip); 351 retval = mg_check_int_error(chip);
352 if (retval != STATUS_SUCCESS) { 352 if (retval != STATUS_SUCCESS) {
353 set_sense_type(chip, lun, SENSE_TYPE_MG_KEY_FAIL_NOT_AUTHEN); 353 rts51x_set_sense_type(chip, lun, SENSE_TYPE_MG_KEY_FAIL_NOT_AUTHEN);
354 TRACE_RET(chip, retval); 354 TRACE_RET(chip, retval);
355 } 355 }
356 356
@@ -375,7 +375,7 @@ int mg_get_rsp_chg(struct scsi_cmnd *srb, struct rts51x_chip *chip)
375 } 375 }
376 376
377 if (i == 2500) { 377 if (i == 2500) {
378 set_sense_type(chip, lun, SENSE_TYPE_MG_KEY_FAIL_NOT_AUTHEN); 378 rts51x_set_sense_type(chip, lun, SENSE_TYPE_MG_KEY_FAIL_NOT_AUTHEN);
379 TRACE_RET(chip, STATUS_FAIL); 379 TRACE_RET(chip, STATUS_FAIL);
380 } 380 }
381 381
@@ -389,7 +389,7 @@ int mg_get_rsp_chg(struct scsi_cmnd *srb, struct rts51x_chip *chip)
389 * issues TPC commands to the medium for writing 8-bytes data as 389 * issues TPC commands to the medium for writing 8-bytes data as
390 * challenge by host within a short data packet. 390 * challenge by host within a short data packet.
391 */ 391 */
392int mg_rsp(struct scsi_cmnd *srb, struct rts51x_chip *chip) 392int rts51x_mg_rsp(struct scsi_cmnd *srb, struct rts51x_chip *chip)
393{ 393{
394 struct ms_info *ms_card = &(chip->ms_card); 394 struct ms_info *ms_card = &(chip->ms_card);
395 int retval; 395 int retval;
@@ -400,7 +400,7 @@ int mg_rsp(struct scsi_cmnd *srb, struct rts51x_chip *chip)
400 400
401 RTS51X_DEBUGP("--%s--\n", __func__); 401 RTS51X_DEBUGP("--%s--\n", __func__);
402 402
403 ms_cleanup_work(chip); 403 rts51x_ms_cleanup_work(chip);
404 404
405 retval = ms_switch_clock(chip); 405 retval = ms_switch_clock(chip);
406 if (retval != STATUS_SUCCESS) 406 if (retval != STATUS_SUCCESS)
@@ -408,7 +408,7 @@ int mg_rsp(struct scsi_cmnd *srb, struct rts51x_chip *chip)
408 408
409 retval = mg_send_ex_cmd(chip, MG_MAKE_KSE, 0); 409 retval = mg_send_ex_cmd(chip, MG_MAKE_KSE, 0);
410 if (retval != STATUS_SUCCESS) { 410 if (retval != STATUS_SUCCESS) {
411 set_sense_type(chip, lun, SENSE_TYPE_MG_KEY_FAIL_NOT_AUTHEN); 411 rts51x_set_sense_type(chip, lun, SENSE_TYPE_MG_KEY_FAIL_NOT_AUTHEN);
412 TRACE_RET(chip, retval); 412 TRACE_RET(chip, retval);
413 } 413 }
414 414
@@ -422,12 +422,12 @@ int mg_rsp(struct scsi_cmnd *srb, struct rts51x_chip *chip)
422 retval = 422 retval =
423 ms_write_bytes(chip, PRO_WRITE_SHORT_DATA, 32, WAIT_INT, buf, 32); 423 ms_write_bytes(chip, PRO_WRITE_SHORT_DATA, 32, WAIT_INT, buf, 32);
424 if (retval != STATUS_SUCCESS) { 424 if (retval != STATUS_SUCCESS) {
425 set_sense_type(chip, lun, SENSE_TYPE_MG_KEY_FAIL_NOT_AUTHEN); 425 rts51x_set_sense_type(chip, lun, SENSE_TYPE_MG_KEY_FAIL_NOT_AUTHEN);
426 TRACE_RET(chip, retval); 426 TRACE_RET(chip, retval);
427 } 427 }
428 retval = mg_check_int_error(chip); 428 retval = mg_check_int_error(chip);
429 if (retval != STATUS_SUCCESS) { 429 if (retval != STATUS_SUCCESS) {
430 set_sense_type(chip, lun, SENSE_TYPE_MG_KEY_FAIL_NOT_AUTHEN); 430 rts51x_set_sense_type(chip, lun, SENSE_TYPE_MG_KEY_FAIL_NOT_AUTHEN);
431 TRACE_RET(chip, retval); 431 TRACE_RET(chip, retval);
432 } 432 }
433 433
@@ -447,7 +447,7 @@ int mg_rsp(struct scsi_cmnd *srb, struct rts51x_chip *chip)
447 * precedes data transmission from medium to Ring buffer by DMA mechanism 447 * precedes data transmission from medium to Ring buffer by DMA mechanism
448 * in order to get maximum performance and minimum code size simultaneously. 448 * in order to get maximum performance and minimum code size simultaneously.
449 */ 449 */
450int mg_get_ICV(struct scsi_cmnd *srb, struct rts51x_chip *chip) 450int rts51x_mg_get_ICV(struct scsi_cmnd *srb, struct rts51x_chip *chip)
451{ 451{
452 struct ms_info *ms_card = &(chip->ms_card); 452 struct ms_info *ms_card = &(chip->ms_card);
453 int retval; 453 int retval;
@@ -457,7 +457,7 @@ int mg_get_ICV(struct scsi_cmnd *srb, struct rts51x_chip *chip)
457 457
458 RTS51X_DEBUGP("--%s--\n", __func__); 458 RTS51X_DEBUGP("--%s--\n", __func__);
459 459
460 ms_cleanup_work(chip); 460 rts51x_ms_cleanup_work(chip);
461 461
462 retval = ms_switch_clock(chip); 462 retval = ms_switch_clock(chip);
463 if (retval != STATUS_SUCCESS) 463 if (retval != STATUS_SUCCESS)
@@ -474,21 +474,21 @@ int mg_get_ICV(struct scsi_cmnd *srb, struct rts51x_chip *chip)
474 474
475 retval = mg_send_ex_cmd(chip, MG_GET_IBD, ms_card->mg_entry_num); 475 retval = mg_send_ex_cmd(chip, MG_GET_IBD, ms_card->mg_entry_num);
476 if (retval != STATUS_SUCCESS) { 476 if (retval != STATUS_SUCCESS) {
477 set_sense_type(chip, lun, SENSE_TYPE_MEDIA_UNRECOVER_READ_ERR); 477 rts51x_set_sense_type(chip, lun, SENSE_TYPE_MEDIA_UNRECOVER_READ_ERR);
478 TRACE_GOTO(chip, GetICVFinish); 478 TRACE_GOTO(chip, GetICVFinish);
479 } 479 }
480 480
481 retval = ms_transfer_data(chip, MS_TM_AUTO_READ, PRO_READ_LONG_DATA, 481 retval = ms_transfer_data(chip, MS_TM_AUTO_READ, PRO_READ_LONG_DATA,
482 2, WAIT_INT, 0, 0, buf + 4, 1024); 482 2, WAIT_INT, 0, 0, buf + 4, 1024);
483 if (retval != STATUS_SUCCESS) { 483 if (retval != STATUS_SUCCESS) {
484 set_sense_type(chip, lun, SENSE_TYPE_MEDIA_UNRECOVER_READ_ERR); 484 rts51x_set_sense_type(chip, lun, SENSE_TYPE_MEDIA_UNRECOVER_READ_ERR);
485 rts51x_write_register(chip, CARD_STOP, MS_STOP | MS_CLR_ERR, 485 rts51x_write_register(chip, CARD_STOP, MS_STOP | MS_CLR_ERR,
486 MS_STOP | MS_CLR_ERR); 486 MS_STOP | MS_CLR_ERR);
487 TRACE_GOTO(chip, GetICVFinish); 487 TRACE_GOTO(chip, GetICVFinish);
488 } 488 }
489 retval = mg_check_int_error(chip); 489 retval = mg_check_int_error(chip);
490 if (retval != STATUS_SUCCESS) { 490 if (retval != STATUS_SUCCESS) {
491 set_sense_type(chip, lun, SENSE_TYPE_MEDIA_UNRECOVER_READ_ERR); 491 rts51x_set_sense_type(chip, lun, SENSE_TYPE_MEDIA_UNRECOVER_READ_ERR);
492 TRACE_GOTO(chip, GetICVFinish); 492 TRACE_GOTO(chip, GetICVFinish);
493 } 493 }
494 494
@@ -511,7 +511,7 @@ GetICVFinish:
511 * that sent by host, and it should be skipped by shifting DMA pointer 511 * that sent by host, and it should be skipped by shifting DMA pointer
512 * before writing 1024 bytes to medium. 512 * before writing 1024 bytes to medium.
513 */ 513 */
514int mg_set_ICV(struct scsi_cmnd *srb, struct rts51x_chip *chip) 514int rts51x_mg_set_ICV(struct scsi_cmnd *srb, struct rts51x_chip *chip)
515{ 515{
516 struct ms_info *ms_card = &(chip->ms_card); 516 struct ms_info *ms_card = &(chip->ms_card);
517 int retval; 517 int retval;
@@ -524,7 +524,7 @@ int mg_set_ICV(struct scsi_cmnd *srb, struct rts51x_chip *chip)
524 524
525 RTS51X_DEBUGP("--%s--\n", __func__); 525 RTS51X_DEBUGP("--%s--\n", __func__);
526 526
527 ms_cleanup_work(chip); 527 rts51x_ms_cleanup_work(chip);
528 528
529 retval = ms_switch_clock(chip); 529 retval = ms_switch_clock(chip);
530 if (retval != STATUS_SUCCESS) 530 if (retval != STATUS_SUCCESS)
@@ -541,13 +541,13 @@ int mg_set_ICV(struct scsi_cmnd *srb, struct rts51x_chip *chip)
541 if (retval != STATUS_SUCCESS) { 541 if (retval != STATUS_SUCCESS) {
542 if (ms_card->mg_auth == 0) { 542 if (ms_card->mg_auth == 0) {
543 if ((buf[5] & 0xC0) != 0) 543 if ((buf[5] & 0xC0) != 0)
544 set_sense_type(chip, lun, 544 rts51x_set_sense_type(chip, lun,
545 SENSE_TYPE_MG_KEY_FAIL_NOT_ESTAB); 545 SENSE_TYPE_MG_KEY_FAIL_NOT_ESTAB);
546 else 546 else
547 set_sense_type(chip, lun, 547 rts51x_set_sense_type(chip, lun,
548 SENSE_TYPE_MG_WRITE_ERR); 548 SENSE_TYPE_MG_WRITE_ERR);
549 } else { 549 } else {
550 set_sense_type(chip, lun, SENSE_TYPE_MG_WRITE_ERR); 550 rts51x_set_sense_type(chip, lun, SENSE_TYPE_MG_WRITE_ERR);
551 } 551 }
552 TRACE_GOTO(chip, SetICVFinish); 552 TRACE_GOTO(chip, SetICVFinish);
553 } 553 }
@@ -563,7 +563,7 @@ int mg_set_ICV(struct scsi_cmnd *srb, struct rts51x_chip *chip)
563 rts51x_add_cmd(chip, WRITE_REG_CMD, MS_TRANS_CFG, 0xFF, 563 rts51x_add_cmd(chip, WRITE_REG_CMD, MS_TRANS_CFG, 0xFF,
564 WAIT_INT); 564 WAIT_INT);
565 565
566 trans_dma_enable(DMA_TO_DEVICE, chip, 512, DMA_512); 566 rts51x_trans_dma_enable(DMA_TO_DEVICE, chip, 512, DMA_512);
567 567
568 rts51x_add_cmd(chip, WRITE_REG_CMD, MS_TRANSFER, 0xFF, 568 rts51x_add_cmd(chip, WRITE_REG_CMD, MS_TRANSFER, 0xFF,
569 MS_TRANSFER_START | MS_TM_NORMAL_WRITE); 569 MS_TRANSFER_START | MS_TM_NORMAL_WRITE);
@@ -572,7 +572,7 @@ int mg_set_ICV(struct scsi_cmnd *srb, struct rts51x_chip *chip)
572 572
573 retval = rts51x_send_cmd(chip, MODE_CDOR, 100); 573 retval = rts51x_send_cmd(chip, MODE_CDOR, 100);
574 if (retval != STATUS_SUCCESS) { 574 if (retval != STATUS_SUCCESS) {
575 set_sense_type(chip, lun, SENSE_TYPE_MG_WRITE_ERR); 575 rts51x_set_sense_type(chip, lun, SENSE_TYPE_MG_WRITE_ERR);
576 TRACE_GOTO(chip, SetICVFinish); 576 TRACE_GOTO(chip, SetICVFinish);
577 } 577 }
578 578
@@ -583,13 +583,13 @@ int mg_set_ICV(struct scsi_cmnd *srb, struct rts51x_chip *chip)
583 rts51x_clear_ms_error(chip); 583 rts51x_clear_ms_error(chip);
584 if (ms_card->mg_auth == 0) { 584 if (ms_card->mg_auth == 0) {
585 if ((buf[5] & 0xC0) != 0) 585 if ((buf[5] & 0xC0) != 0)
586 set_sense_type(chip, lun, 586 rts51x_set_sense_type(chip, lun,
587 SENSE_TYPE_MG_KEY_FAIL_NOT_ESTAB); 587 SENSE_TYPE_MG_KEY_FAIL_NOT_ESTAB);
588 else 588 else
589 set_sense_type(chip, lun, 589 rts51x_set_sense_type(chip, lun,
590 SENSE_TYPE_MG_WRITE_ERR); 590 SENSE_TYPE_MG_WRITE_ERR);
591 } else { 591 } else {
592 set_sense_type(chip, lun, 592 rts51x_set_sense_type(chip, lun,
593 SENSE_TYPE_MG_WRITE_ERR); 593 SENSE_TYPE_MG_WRITE_ERR);
594 } 594 }
595 retval = STATUS_FAIL; 595 retval = STATUS_FAIL;
@@ -602,13 +602,13 @@ int mg_set_ICV(struct scsi_cmnd *srb, struct rts51x_chip *chip)
602 rts51x_clear_ms_error(chip); 602 rts51x_clear_ms_error(chip);
603 if (ms_card->mg_auth == 0) { 603 if (ms_card->mg_auth == 0) {
604 if ((buf[5] & 0xC0) != 0) 604 if ((buf[5] & 0xC0) != 0)
605 set_sense_type(chip, lun, 605 rts51x_set_sense_type(chip, lun,
606 SENSE_TYPE_MG_KEY_FAIL_NOT_ESTAB); 606 SENSE_TYPE_MG_KEY_FAIL_NOT_ESTAB);
607 else 607 else
608 set_sense_type(chip, lun, 608 rts51x_set_sense_type(chip, lun,
609 SENSE_TYPE_MG_WRITE_ERR); 609 SENSE_TYPE_MG_WRITE_ERR);
610 } else { 610 } else {
611 set_sense_type(chip, lun, 611 rts51x_set_sense_type(chip, lun,
612 SENSE_TYPE_MG_WRITE_ERR); 612 SENSE_TYPE_MG_WRITE_ERR);
613 } 613 }
614 retval = STATUS_FAIL; 614 retval = STATUS_FAIL;
@@ -622,13 +622,13 @@ int mg_set_ICV(struct scsi_cmnd *srb, struct rts51x_chip *chip)
622 rts51x_clear_ms_error(chip); 622 rts51x_clear_ms_error(chip);
623 if (ms_card->mg_auth == 0) { 623 if (ms_card->mg_auth == 0) {
624 if ((buf[5] & 0xC0) != 0) 624 if ((buf[5] & 0xC0) != 0)
625 set_sense_type(chip, lun, 625 rts51x_set_sense_type(chip, lun,
626 SENSE_TYPE_MG_KEY_FAIL_NOT_ESTAB); 626 SENSE_TYPE_MG_KEY_FAIL_NOT_ESTAB);
627 else 627 else
628 set_sense_type(chip, lun, 628 rts51x_set_sense_type(chip, lun,
629 SENSE_TYPE_MG_WRITE_ERR); 629 SENSE_TYPE_MG_WRITE_ERR);
630 } else { 630 } else {
631 set_sense_type(chip, lun, SENSE_TYPE_MG_WRITE_ERR); 631 rts51x_set_sense_type(chip, lun, SENSE_TYPE_MG_WRITE_ERR);
632 } 632 }
633 TRACE_GOTO(chip, SetICVFinish); 633 TRACE_GOTO(chip, SetICVFinish);
634 } 634 }