aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/ide-floppy.c
diff options
context:
space:
mode:
authorBorislav Petkov <bbpetkov@yahoo.de>2008-02-02 13:56:33 -0500
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-02-02 13:56:33 -0500
commit30d67099385dd837b252a604f1593735c5559e13 (patch)
tree24912cb34886ac9e28613625f9ffe89f0ef71810 /drivers/ide/ide-floppy.c
parent78829dd9224b62e2092a681afaee1bda4d0cb93b (diff)
ide-floppy: convert to generic packet commands
Replace the ide-floppy packet commands opcode defines with the generic ones. Add a missing GPCMD_WRITE_12 (opcode 0xaa) to the generic ones in cdrom.h. The last one can be found in the current version of INF-8090, p.905. [ Bart: Tejun's libata patch also adding GPCMD_WRITE_12 got merged first ] Signed-off-by: Borislav Petkov <bbpetkov@yahoo.de> Cc: Jens Axboe <axboe@kernel.dk> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide/ide-floppy.c')
-rw-r--r--drivers/ide/ide-floppy.c44
1 files changed, 12 insertions, 32 deletions
diff --git a/drivers/ide/ide-floppy.c b/drivers/ide/ide-floppy.c
index 3512637ae8d4..e4ebb2166547 100644
--- a/drivers/ide/ide-floppy.c
+++ b/drivers/ide/ide-floppy.c
@@ -273,26 +273,6 @@ typedef struct ide_floppy_obj {
273#define IDEFLOPPY_ZIP_DRIVE 5 /* Requires BH algorithm for packets */ 273#define IDEFLOPPY_ZIP_DRIVE 5 /* Requires BH algorithm for packets */
274 274
275/* 275/*
276 * ATAPI floppy drive packet commands
277 */
278#define IDEFLOPPY_FORMAT_UNIT_CMD 0x04
279#define IDEFLOPPY_INQUIRY_CMD 0x12
280#define IDEFLOPPY_MODE_SELECT_CMD 0x55
281#define IDEFLOPPY_MODE_SENSE_CMD 0x5a
282#define IDEFLOPPY_READ10_CMD 0x28
283#define IDEFLOPPY_READ12_CMD 0xa8
284#define IDEFLOPPY_READ_CAPACITY_CMD 0x23
285#define IDEFLOPPY_REQUEST_SENSE_CMD 0x03
286#define IDEFLOPPY_PREVENT_REMOVAL_CMD 0x1e
287#define IDEFLOPPY_SEEK_CMD 0x2b
288#define IDEFLOPPY_START_STOP_CMD 0x1b
289#define IDEFLOPPY_TEST_UNIT_READY_CMD 0x00
290#define IDEFLOPPY_VERIFY_CMD 0x2f
291#define IDEFLOPPY_WRITE10_CMD 0x2a
292#define IDEFLOPPY_WRITE12_CMD 0xaa
293#define IDEFLOPPY_WRITE_VERIFY_CMD 0x2e
294
295/*
296 * Defines for the mode sense command 276 * Defines for the mode sense command
297 */ 277 */
298#define MODE_SENSE_CURRENT 0x00 278#define MODE_SENSE_CURRENT 0x00
@@ -696,8 +676,8 @@ static void idefloppy_init_pc (idefloppy_pc_t *pc)
696 676
697static void idefloppy_create_request_sense_cmd (idefloppy_pc_t *pc) 677static void idefloppy_create_request_sense_cmd (idefloppy_pc_t *pc)
698{ 678{
699 idefloppy_init_pc(pc); 679 idefloppy_init_pc(pc);
700 pc->c[0] = IDEFLOPPY_REQUEST_SENSE_CMD; 680 pc->c[0] = GPCMD_REQUEST_SENSE;
701 pc->c[4] = 255; 681 pc->c[4] = 255;
702 pc->request_transfer = 18; 682 pc->request_transfer = 18;
703 pc->callback = &idefloppy_request_sense_callback; 683 pc->callback = &idefloppy_request_sense_callback;
@@ -762,7 +742,7 @@ static ide_startstop_t idefloppy_pc_intr (ide_drive_t *drive)
762 debug_log(KERN_INFO "ide-floppy: %s: I/O error\n", 742 debug_log(KERN_INFO "ide-floppy: %s: I/O error\n",
763 drive->name); 743 drive->name);
764 rq->errors++; 744 rq->errors++;
765 if (pc->c[0] == IDEFLOPPY_REQUEST_SENSE_CMD) { 745 if (pc->c[0] == GPCMD_REQUEST_SENSE) {
766 printk(KERN_ERR "ide-floppy: I/O error in " 746 printk(KERN_ERR "ide-floppy: I/O error in "
767 "request sense command\n"); 747 "request sense command\n");
768 return ide_do_reset(drive); 748 return ide_do_reset(drive);
@@ -962,7 +942,7 @@ static ide_startstop_t idefloppy_issue_pc (ide_drive_t *drive, idefloppy_pc_t *p
962 u8 dma; 942 u8 dma;
963 943
964 if (floppy->failed_pc == NULL && 944 if (floppy->failed_pc == NULL &&
965 pc->c[0] != IDEFLOPPY_REQUEST_SENSE_CMD) 945 pc->c[0] != GPCMD_REQUEST_SENSE)
966 floppy->failed_pc = pc; 946 floppy->failed_pc = pc;
967 /* Set the current packet command */ 947 /* Set the current packet command */
968 floppy->pc = pc; 948 floppy->pc = pc;
@@ -1052,14 +1032,14 @@ static void idefloppy_create_prevent_cmd (idefloppy_pc_t *pc, int prevent)
1052 "prevent = %d\n", prevent); 1032 "prevent = %d\n", prevent);
1053 1033
1054 idefloppy_init_pc(pc); 1034 idefloppy_init_pc(pc);
1055 pc->c[0] = IDEFLOPPY_PREVENT_REMOVAL_CMD; 1035 pc->c[0] = GPCMD_PREVENT_ALLOW_MEDIUM_REMOVAL;
1056 pc->c[4] = prevent; 1036 pc->c[4] = prevent;
1057} 1037}
1058 1038
1059static void idefloppy_create_read_capacity_cmd (idefloppy_pc_t *pc) 1039static void idefloppy_create_read_capacity_cmd (idefloppy_pc_t *pc)
1060{ 1040{
1061 idefloppy_init_pc(pc); 1041 idefloppy_init_pc(pc);
1062 pc->c[0] = IDEFLOPPY_READ_CAPACITY_CMD; 1042 pc->c[0] = GPCMD_READ_FORMAT_CAPACITIES;
1063 pc->c[7] = 255; 1043 pc->c[7] = 255;
1064 pc->c[8] = 255; 1044 pc->c[8] = 255;
1065 pc->request_transfer = 255; 1045 pc->request_transfer = 255;
@@ -1069,7 +1049,7 @@ static void idefloppy_create_format_unit_cmd (idefloppy_pc_t *pc, int b, int l,
1069 int flags) 1049 int flags)
1070{ 1050{
1071 idefloppy_init_pc(pc); 1051 idefloppy_init_pc(pc);
1072 pc->c[0] = IDEFLOPPY_FORMAT_UNIT_CMD; 1052 pc->c[0] = GPCMD_FORMAT_UNIT;
1073 pc->c[1] = 0x17; 1053 pc->c[1] = 0x17;
1074 1054
1075 memset(pc->buffer, 0, 12); 1055 memset(pc->buffer, 0, 12);
@@ -1094,7 +1074,7 @@ static void idefloppy_create_mode_sense_cmd (idefloppy_pc_t *pc, u8 page_code, u
1094 u16 length = sizeof(idefloppy_mode_parameter_header_t); 1074 u16 length = sizeof(idefloppy_mode_parameter_header_t);
1095 1075
1096 idefloppy_init_pc(pc); 1076 idefloppy_init_pc(pc);
1097 pc->c[0] = IDEFLOPPY_MODE_SENSE_CMD; 1077 pc->c[0] = GPCMD_MODE_SENSE_10;
1098 pc->c[1] = 0; 1078 pc->c[1] = 0;
1099 pc->c[2] = page_code + (type << 6); 1079 pc->c[2] = page_code + (type << 6);
1100 1080
@@ -1116,14 +1096,14 @@ static void idefloppy_create_mode_sense_cmd (idefloppy_pc_t *pc, u8 page_code, u
1116static void idefloppy_create_start_stop_cmd (idefloppy_pc_t *pc, int start) 1096static void idefloppy_create_start_stop_cmd (idefloppy_pc_t *pc, int start)
1117{ 1097{
1118 idefloppy_init_pc(pc); 1098 idefloppy_init_pc(pc);
1119 pc->c[0] = IDEFLOPPY_START_STOP_CMD; 1099 pc->c[0] = GPCMD_START_STOP_UNIT;
1120 pc->c[4] = start; 1100 pc->c[4] = start;
1121} 1101}
1122 1102
1123static void idefloppy_create_test_unit_ready_cmd(idefloppy_pc_t *pc) 1103static void idefloppy_create_test_unit_ready_cmd(idefloppy_pc_t *pc)
1124{ 1104{
1125 idefloppy_init_pc(pc); 1105 idefloppy_init_pc(pc);
1126 pc->c[0] = IDEFLOPPY_TEST_UNIT_READY_CMD; 1106 pc->c[0] = GPCMD_TEST_UNIT_READY;
1127} 1107}
1128 1108
1129static void idefloppy_create_rw_cmd (idefloppy_floppy_t *floppy, idefloppy_pc_t *pc, struct request *rq, unsigned long sector) 1109static void idefloppy_create_rw_cmd (idefloppy_floppy_t *floppy, idefloppy_pc_t *pc, struct request *rq, unsigned long sector)
@@ -1138,10 +1118,10 @@ static void idefloppy_create_rw_cmd (idefloppy_floppy_t *floppy, idefloppy_pc_t
1138 1118
1139 idefloppy_init_pc(pc); 1119 idefloppy_init_pc(pc);
1140 if (test_bit(IDEFLOPPY_USE_READ12, &floppy->flags)) { 1120 if (test_bit(IDEFLOPPY_USE_READ12, &floppy->flags)) {
1141 pc->c[0] = cmd == READ ? IDEFLOPPY_READ12_CMD : IDEFLOPPY_WRITE12_CMD; 1121 pc->c[0] = cmd == READ ? GPCMD_READ_12 : GPCMD_WRITE_12;
1142 put_unaligned(htonl(blocks), (unsigned int *) &pc->c[6]); 1122 put_unaligned(htonl(blocks), (unsigned int *) &pc->c[6]);
1143 } else { 1123 } else {
1144 pc->c[0] = cmd == READ ? IDEFLOPPY_READ10_CMD : IDEFLOPPY_WRITE10_CMD; 1124 pc->c[0] = cmd == READ ? GPCMD_READ_10 : GPCMD_WRITE_10;
1145 put_unaligned(htons(blocks), (unsigned short *) &pc->c[7]); 1125 put_unaligned(htons(blocks), (unsigned short *) &pc->c[7]);
1146 } 1126 }
1147 put_unaligned(htonl(block), (unsigned int *) &pc->c[2]); 1127 put_unaligned(htonl(block), (unsigned int *) &pc->c[2]);