28 #include <linux/sched.h>
29 #include <linux/slab.h>
39 #ifdef SUPPORT_MAGIC_GATE
72 if (i == MS_MAX_RETRY_COUNT)
74 retval = mg_check_int_error(chip);
127 u8 buf1[32], buf2[12];
131 if (scsi_bufflen(srb) < 12) {
149 for (i = 0; i < 8; i++)
150 buf1[8 + i] = buf2[4 + i];
157 retval = mg_check_int_error(chip);
211 retval = mg_check_int_error(chip);
217 bufflen =
min(1052, (
int)scsi_bufflen(srb));
249 retval = mg_send_ex_cmd(chip,
MG_GET_ID, 0);
261 retval = mg_check_int_error(chip);
269 for (i = 0; i < 2500; i++) {
283 retval = mg_send_ex_cmd(chip,
MG_SET_RD, 0);
289 bufflen =
min(12, (
int)scsi_bufflen(srb));
292 for (i = 0; i < 8; i++)
294 for (i = 0; i < 24; i++)
302 retval = mg_check_int_error(chip);
329 u8 buf1[32], buf2[36],
tmp;
351 retval = mg_check_int_error(chip);
363 memcpy(buf2 + 20, buf1, 16);
365 bufflen =
min(36, (
int)scsi_bufflen(srb));
368 for (i = 0; i < 2500; i++) {
415 bufflen =
min(12, (
int)scsi_bufflen(srb));
418 for (i = 0; i < 8; i++)
420 for (i = 0; i < 24; i++)
428 retval = mg_check_int_error(chip);
489 retval = mg_check_int_error(chip);
495 bufflen =
min(1028, (
int)scsi_bufflen(srb));
519 #ifdef MG_SET_ICV_SLOW
537 bufflen =
min(1028, (
int)scsi_bufflen(srb));
543 if ((buf[5] & 0xC0) != 0)
555 #ifdef MG_SET_ICV_SLOW
556 for (i = 0; i < 2; i++) {
559 rts51x_init_cmd(chip);
580 buf + 4 + i * 512, 512, 0,
583 rts51x_clear_ms_error(chip);
585 if ((buf[5] & 0xC0) != 0)
601 || mg_check_int_error(chip)) {
602 rts51x_clear_ms_error(chip);
604 if ((buf[5] & 0xC0) != 0)
622 rts51x_clear_ms_error(chip);
624 if ((buf[5] & 0xC0) != 0)