diff options
Diffstat (limited to 'drivers/ide/ide-floppy.c')
-rw-r--r-- | drivers/ide/ide-floppy.c | 31 |
1 files changed, 9 insertions, 22 deletions
diff --git a/drivers/ide/ide-floppy.c b/drivers/ide/ide-floppy.c index 4bab0932c94a..e04eaa49a8bf 100644 --- a/drivers/ide/ide-floppy.c +++ b/drivers/ide/ide-floppy.c | |||
@@ -69,12 +69,6 @@ | |||
69 | */ | 69 | */ |
70 | #define IDEFLOPPY_MAX_PC_RETRIES 3 | 70 | #define IDEFLOPPY_MAX_PC_RETRIES 3 |
71 | 71 | ||
72 | /* | ||
73 | * With each packet command, we allocate a buffer of IDEFLOPPY_PC_BUFFER_SIZE | ||
74 | * bytes. | ||
75 | */ | ||
76 | #define IDEFLOPPY_PC_BUFFER_SIZE 256 | ||
77 | |||
78 | /* format capacities descriptor codes */ | 72 | /* format capacities descriptor codes */ |
79 | #define CAPACITY_INVALID 0x00 | 73 | #define CAPACITY_INVALID 0x00 |
80 | #define CAPACITY_UNFORMATTED 0x01 | 74 | #define CAPACITY_UNFORMATTED 0x01 |
@@ -274,16 +268,9 @@ static void ide_floppy_callback(ide_drive_t *drive) | |||
274 | idefloppy_end_request(drive, uptodate, 0); | 268 | idefloppy_end_request(drive, uptodate, 0); |
275 | } | 269 | } |
276 | 270 | ||
277 | static void idefloppy_init_pc(struct ide_atapi_pc *pc) | ||
278 | { | ||
279 | memset(pc, 0, sizeof(*pc)); | ||
280 | pc->buf = pc->pc_buf; | ||
281 | pc->buf_size = IDEFLOPPY_PC_BUFFER_SIZE; | ||
282 | } | ||
283 | |||
284 | static void idefloppy_create_request_sense_cmd(struct ide_atapi_pc *pc) | 271 | static void idefloppy_create_request_sense_cmd(struct ide_atapi_pc *pc) |
285 | { | 272 | { |
286 | idefloppy_init_pc(pc); | 273 | ide_init_pc(pc); |
287 | pc->c[0] = GPCMD_REQUEST_SENSE; | 274 | pc->c[0] = GPCMD_REQUEST_SENSE; |
288 | pc->c[4] = 255; | 275 | pc->c[4] = 255; |
289 | pc->req_xfer = 18; | 276 | pc->req_xfer = 18; |
@@ -413,14 +400,14 @@ static void idefloppy_create_prevent_cmd(struct ide_atapi_pc *pc, int prevent) | |||
413 | { | 400 | { |
414 | debug_log("creating prevent removal command, prevent = %d\n", prevent); | 401 | debug_log("creating prevent removal command, prevent = %d\n", prevent); |
415 | 402 | ||
416 | idefloppy_init_pc(pc); | 403 | ide_init_pc(pc); |
417 | pc->c[0] = GPCMD_PREVENT_ALLOW_MEDIUM_REMOVAL; | 404 | pc->c[0] = GPCMD_PREVENT_ALLOW_MEDIUM_REMOVAL; |
418 | pc->c[4] = prevent; | 405 | pc->c[4] = prevent; |
419 | } | 406 | } |
420 | 407 | ||
421 | static void idefloppy_create_read_capacity_cmd(struct ide_atapi_pc *pc) | 408 | static void idefloppy_create_read_capacity_cmd(struct ide_atapi_pc *pc) |
422 | { | 409 | { |
423 | idefloppy_init_pc(pc); | 410 | ide_init_pc(pc); |
424 | pc->c[0] = GPCMD_READ_FORMAT_CAPACITIES; | 411 | pc->c[0] = GPCMD_READ_FORMAT_CAPACITIES; |
425 | pc->c[7] = 255; | 412 | pc->c[7] = 255; |
426 | pc->c[8] = 255; | 413 | pc->c[8] = 255; |
@@ -430,7 +417,7 @@ static void idefloppy_create_read_capacity_cmd(struct ide_atapi_pc *pc) | |||
430 | static void idefloppy_create_format_unit_cmd(struct ide_atapi_pc *pc, int b, | 417 | static void idefloppy_create_format_unit_cmd(struct ide_atapi_pc *pc, int b, |
431 | int l, int flags) | 418 | int l, int flags) |
432 | { | 419 | { |
433 | idefloppy_init_pc(pc); | 420 | ide_init_pc(pc); |
434 | pc->c[0] = GPCMD_FORMAT_UNIT; | 421 | pc->c[0] = GPCMD_FORMAT_UNIT; |
435 | pc->c[1] = 0x17; | 422 | pc->c[1] = 0x17; |
436 | 423 | ||
@@ -454,7 +441,7 @@ static void idefloppy_create_mode_sense_cmd(struct ide_atapi_pc *pc, | |||
454 | { | 441 | { |
455 | u16 length = 8; /* sizeof(Mode Parameter Header) = 8 Bytes */ | 442 | u16 length = 8; /* sizeof(Mode Parameter Header) = 8 Bytes */ |
456 | 443 | ||
457 | idefloppy_init_pc(pc); | 444 | ide_init_pc(pc); |
458 | pc->c[0] = GPCMD_MODE_SENSE_10; | 445 | pc->c[0] = GPCMD_MODE_SENSE_10; |
459 | pc->c[1] = 0; | 446 | pc->c[1] = 0; |
460 | pc->c[2] = page_code; | 447 | pc->c[2] = page_code; |
@@ -476,7 +463,7 @@ static void idefloppy_create_mode_sense_cmd(struct ide_atapi_pc *pc, | |||
476 | 463 | ||
477 | static void idefloppy_create_start_stop_cmd(struct ide_atapi_pc *pc, int start) | 464 | static void idefloppy_create_start_stop_cmd(struct ide_atapi_pc *pc, int start) |
478 | { | 465 | { |
479 | idefloppy_init_pc(pc); | 466 | ide_init_pc(pc); |
480 | pc->c[0] = GPCMD_START_STOP_UNIT; | 467 | pc->c[0] = GPCMD_START_STOP_UNIT; |
481 | pc->c[4] = start; | 468 | pc->c[4] = start; |
482 | } | 469 | } |
@@ -492,7 +479,7 @@ static void idefloppy_create_rw_cmd(idefloppy_floppy_t *floppy, | |||
492 | debug_log("create_rw10_cmd: block == %d, blocks == %d\n", | 479 | debug_log("create_rw10_cmd: block == %d, blocks == %d\n", |
493 | block, blocks); | 480 | block, blocks); |
494 | 481 | ||
495 | idefloppy_init_pc(pc); | 482 | ide_init_pc(pc); |
496 | pc->c[0] = cmd == READ ? GPCMD_READ_10 : GPCMD_WRITE_10; | 483 | pc->c[0] = cmd == READ ? GPCMD_READ_10 : GPCMD_WRITE_10; |
497 | put_unaligned(cpu_to_be16(blocks), (unsigned short *)&pc->c[7]); | 484 | put_unaligned(cpu_to_be16(blocks), (unsigned short *)&pc->c[7]); |
498 | put_unaligned(cpu_to_be32(block), (unsigned int *) &pc->c[2]); | 485 | put_unaligned(cpu_to_be32(block), (unsigned int *) &pc->c[2]); |
@@ -511,7 +498,7 @@ static void idefloppy_create_rw_cmd(idefloppy_floppy_t *floppy, | |||
511 | static void idefloppy_blockpc_cmd(idefloppy_floppy_t *floppy, | 498 | static void idefloppy_blockpc_cmd(idefloppy_floppy_t *floppy, |
512 | struct ide_atapi_pc *pc, struct request *rq) | 499 | struct ide_atapi_pc *pc, struct request *rq) |
513 | { | 500 | { |
514 | idefloppy_init_pc(pc); | 501 | ide_init_pc(pc); |
515 | memcpy(pc->c, rq->cmd, sizeof(pc->c)); | 502 | memcpy(pc->c, rq->cmd, sizeof(pc->c)); |
516 | pc->rq = rq; | 503 | pc->rq = rq; |
517 | pc->b_count = 0; | 504 | pc->b_count = 0; |
@@ -1071,7 +1058,7 @@ static int idefloppy_open(struct inode *inode, struct file *filp) | |||
1071 | drive->atapi_flags &= ~IDE_AFLAG_FORMAT_IN_PROGRESS; | 1058 | drive->atapi_flags &= ~IDE_AFLAG_FORMAT_IN_PROGRESS; |
1072 | /* Just in case */ | 1059 | /* Just in case */ |
1073 | 1060 | ||
1074 | idefloppy_init_pc(&pc); | 1061 | ide_init_pc(&pc); |
1075 | pc.c[0] = GPCMD_TEST_UNIT_READY; | 1062 | pc.c[0] = GPCMD_TEST_UNIT_READY; |
1076 | 1063 | ||
1077 | if (idefloppy_queue_pc_tail(drive, &pc)) { | 1064 | if (idefloppy_queue_pc_tail(drive, &pc)) { |