From: Borislav Petkov <bbpetkov@yahoo.de>
To: linux-ide@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: bzolnier@gmail.com, Borislav Petkov <bbpetkov@yahoo.de>,
Jens Axboe <axboe@kernel.dk>
Subject: [RESEND PATCH 03/10] ide-floppy: convert to generic packet commands
Date: Thu, 3 Jan 2008 14:20:02 +0100 [thread overview]
Message-ID: <1199366409-26016-4-git-send-email-bbpetkov@yahoo.de> (raw)
In-Reply-To: <1199366409-26016-3-git-send-email-bbpetkov@yahoo.de>
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.
CC: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Borislav Petkov <bbpetkov@yahoo.de>
---
drivers/ide/ide-floppy.c | 26 +++++++++++++-------------
drivers/ide/ide-floppy.h | 21 ---------------------
include/linux/cdrom.h | 1 +
3 files changed, 14 insertions(+), 34 deletions(-)
diff --git a/drivers/ide/ide-floppy.c b/drivers/ide/ide-floppy.c
index 52d09c1..4fb6128 100644
--- a/drivers/ide/ide-floppy.c
+++ b/drivers/ide/ide-floppy.c
@@ -313,7 +313,7 @@ static void idefloppy_init_pc (idefloppy_pc_t *pc)
static void idefloppy_create_request_sense_cmd (idefloppy_pc_t *pc)
{
idefloppy_init_pc(pc);
- pc->c[0] = IDEFLOPPY_REQUEST_SENSE_CMD;
+ pc->c[0] = GPCMD_REQUEST_SENSE;
pc->c[4] = 255;
pc->request_transfer = 18;
pc->callback = &idefloppy_request_sense_callback;
@@ -379,7 +379,7 @@ static ide_startstop_t idefloppy_pc_intr (ide_drive_t *drive)
debug_log(KERN_INFO "ide-floppy: %s: I/O error\n",
drive->name);
rq->errors++;
- if (pc->c[0] == IDEFLOPPY_REQUEST_SENSE_CMD) {
+ if (pc->c[0] == GPCMD_REQUEST_SENSE) {
printk(KERN_ERR "ide-floppy: I/O error in "
"request sense command\n");
return ide_do_reset(drive);
@@ -586,8 +586,8 @@ static ide_startstop_t idefloppy_issue_pc (ide_drive_t *drive, idefloppy_pc_t *p
and have lived on another thread's stack; that stack may have become
unmapped meanwhile (CONFIG_DEBUG_PAGEALLOC). */
#if IDEFLOPPY_DEBUG_BUGS
- if (floppy->pc->c[0] == IDEFLOPPY_REQUEST_SENSE_CMD &&
- pc->c[0] == IDEFLOPPY_REQUEST_SENSE_CMD) {
+ if (floppy->pc->c[0] == GPCMD_REQUEST_SENSE &&
+ pc->c[0] == GPCMD_REQUEST_SENSE) {
printk(KERN_ERR "ide-floppy: possible ide-floppy.c bug - "
"Two request sense in serial were issued\n");
}
@@ -595,7 +595,7 @@ static ide_startstop_t idefloppy_issue_pc (ide_drive_t *drive, idefloppy_pc_t *p
#endif
if (floppy->failed_pc == NULL &&
- pc->c[0] != IDEFLOPPY_REQUEST_SENSE_CMD)
+ pc->c[0] != GPCMD_REQUEST_SENSE)
floppy->failed_pc = pc;
/* Set the current packet command */
floppy->pc = pc;
@@ -690,14 +690,14 @@ static void idefloppy_create_prevent_cmd (idefloppy_pc_t *pc, int prevent)
"prevent = %d\n", prevent);
idefloppy_init_pc(pc);
- pc->c[0] = IDEFLOPPY_PREVENT_REMOVAL_CMD;
+ pc->c[0] = GPCMD_PREVENT_ALLOW_MEDIUM_REMOVAL;
pc->c[4] = prevent;
}
static void idefloppy_create_read_capacity_cmd (idefloppy_pc_t *pc)
{
idefloppy_init_pc(pc);
- pc->c[0] = IDEFLOPPY_READ_CAPACITY_CMD;
+ pc->c[0] = GPCMD_READ_FORMAT_CAPACITIES;
pc->c[7] = 255;
pc->c[8] = 255;
pc->request_transfer = 255;
@@ -707,7 +707,7 @@ static void idefloppy_create_format_unit_cmd (idefloppy_pc_t *pc, int b, int l,
int flags)
{
idefloppy_init_pc(pc);
- pc->c[0] = IDEFLOPPY_FORMAT_UNIT_CMD;
+ pc->c[0] = GPCMD_FORMAT_UNIT;
pc->c[1] = 0x17;
memset(pc->buffer, 0, 12);
@@ -733,7 +733,7 @@ static void idefloppy_create_mode_sense_cmd (idefloppy_pc_t *pc, u8 page_code,
u16 length = sizeof(idefloppy_mode_par_hdr_t);
idefloppy_init_pc(pc);
- pc->c[0] = IDEFLOPPY_MODE_SENSE_CMD;
+ pc->c[0] = GPCMD_MODE_SENSE_10;
pc->c[1] = 0;
pc->c[2] = page_code + (type << 6);
@@ -755,14 +755,14 @@ static void idefloppy_create_mode_sense_cmd (idefloppy_pc_t *pc, u8 page_code,
static void idefloppy_create_start_stop_cmd (idefloppy_pc_t *pc, int start)
{
idefloppy_init_pc(pc);
- pc->c[0] = IDEFLOPPY_START_STOP_CMD;
+ pc->c[0] = GPCMD_START_STOP_UNIT;
pc->c[4] = start;
}
static void idefloppy_create_test_unit_ready_cmd(idefloppy_pc_t *pc)
{
idefloppy_init_pc(pc);
- pc->c[0] = IDEFLOPPY_TEST_UNIT_READY_CMD;
+ pc->c[0] = GPCMD_TEST_UNIT_READY;
}
static void idefloppy_create_rw_cmd (idefloppy_t *floppy, idefloppy_pc_t *pc,
@@ -778,10 +778,10 @@ static void idefloppy_create_rw_cmd (idefloppy_t *floppy, idefloppy_pc_t *pc,
idefloppy_init_pc(pc);
if (test_bit(IDEFLOPPY_USE_READ12, &floppy->flags)) {
- pc->c[0] = cmd == READ ? IDEFLOPPY_READ12_CMD : IDEFLOPPY_WRITE12_CMD;
+ pc->c[0] = cmd == READ ? GPCMD_READ_12 : GPCMD_WRITE_12;
put_unaligned(htonl(blocks), (unsigned int *) &pc->c[6]);
} else {
- pc->c[0] = cmd == READ ? IDEFLOPPY_READ10_CMD : IDEFLOPPY_WRITE10_CMD;
+ pc->c[0] = cmd == READ ? GPCMD_READ_10 : GPCMD_WRITE_10;
put_unaligned(htons(blocks), (unsigned short *) &pc->c[7]);
}
put_unaligned(htonl(block), (unsigned int *) &pc->c[2]);
diff --git a/drivers/ide/ide-floppy.h b/drivers/ide/ide-floppy.h
index ecfafa6..4e12038 100644
--- a/drivers/ide/ide-floppy.h
+++ b/drivers/ide/ide-floppy.h
@@ -248,27 +248,6 @@ typedef struct ide_floppy_obj {
#define IDEFLOPPY_ZIP_DRIVE 5 /* Requires BH algorithm for \
packets */
-
-/*
- * ATAPI floppy drive packet commands
- */
-#define IDEFLOPPY_FORMAT_UNIT_CMD 0x04
-#define IDEFLOPPY_INQUIRY_CMD 0x12
-#define IDEFLOPPY_MODE_SELECT_CMD 0x55
-#define IDEFLOPPY_MODE_SENSE_CMD 0x5a
-#define IDEFLOPPY_READ10_CMD 0x28
-#define IDEFLOPPY_READ12_CMD 0xa8
-#define IDEFLOPPY_READ_CAPACITY_CMD 0x23
-#define IDEFLOPPY_REQUEST_SENSE_CMD 0x03
-#define IDEFLOPPY_PREVENT_REMOVAL_CMD 0x1e
-#define IDEFLOPPY_SEEK_CMD 0x2b
-#define IDEFLOPPY_START_STOP_CMD 0x1b
-#define IDEFLOPPY_TEST_UNIT_READY_CMD 0x00
-#define IDEFLOPPY_VERIFY_CMD 0x2f
-#define IDEFLOPPY_WRITE10_CMD 0x2a
-#define IDEFLOPPY_WRITE12_CMD 0xaa
-#define IDEFLOPPY_WRITE_VERIFY_CMD 0x2e
-
/*
* Defines for the mode sense command
*/
diff --git a/include/linux/cdrom.h b/include/linux/cdrom.h
index ba32479..a729b02 100644
--- a/include/linux/cdrom.h
+++ b/include/linux/cdrom.h
@@ -480,6 +480,7 @@ struct cdrom_generic_command
#define GPCMD_TEST_UNIT_READY 0x00
#define GPCMD_VERIFY_10 0x2f
#define GPCMD_WRITE_10 0x2a
+#define GPCMD_WRITE_12 0xaa /* ide floppy */
#define GPCMD_WRITE_AND_VERIFY_10 0x2e
/* This is listed as optional in ATAPI 2.6, but is (curiously)
* missing from Mt. Fuji, Table 57. It _is_ mentioned in Mt. Fuji
--
1.5.3.7
next prev parent reply other threads:[~2008-01-03 13:23 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-01-03 13:19 [RESEND PATCH 0/10] ide-floppy redux p1 Borislav Petkov
2008-01-03 13:20 ` [RESEND PATCH 01/10] move ide-floppy historical changelog to Documentation/ide/ChangeLog.ide-floppy.1996-2002; Borislav Petkov
2008-01-03 13:20 ` [RESEND PATCH 02/10] ide-floppy: move ide-floppy struct and macro defs into its own header. While at it Borislav Petkov
2008-01-03 13:20 ` Borislav Petkov [this message]
2008-01-03 13:20 ` [RESEND PATCH 04/10] ide-floppy: cleanup debugging macros Borislav Petkov
2008-01-03 13:20 ` [RESEND PATCH 05/10] ide-floppy: factor out ioctl handlers from idefloppy_ioctl() Borislav Petkov
2008-01-03 13:20 ` [RESEND PATCH 06/10] ide-floppy: report DMA handling in idefloppy_pc_intr() properly Borislav Petkov
2008-01-03 13:20 ` [RESEND PATCH 07/10] ide-floppy: remove unnecessary ->handler != NULL check Borislav Petkov
2008-01-03 13:20 ` [RESEND PATCH 08/10] ide-floppy: mv idefloppy_{should_,}report_error Borislav Petkov
2008-01-03 13:20 ` [RESEND PATCH 09/10] ide-floppy: use test_bit wrappers for testing flags Borislav Petkov
2008-01-03 13:20 ` [RESEND PATCH 10/10] ide-floppy: replace ntoh{s,l} and hton{s,l} calls with the generic byteorder macros Borislav Petkov
2008-01-04 1:29 ` Bartlomiej Zolnierkiewicz
2008-01-05 16:10 ` [RESEND PATCH 09/10] ide-floppy: use test_bit wrappers for testing flags Bartlomiej Zolnierkiewicz
2008-01-05 15:54 ` [RESEND PATCH 08/10] ide-floppy: mv idefloppy_{should_,}report_error Bartlomiej Zolnierkiewicz
2008-01-04 1:24 ` [RESEND PATCH 07/10] ide-floppy: remove unnecessary ->handler != NULL check Bartlomiej Zolnierkiewicz
2008-01-05 15:46 ` [RESEND PATCH 06/10] ide-floppy: report DMA handling in idefloppy_pc_intr() properly Bartlomiej Zolnierkiewicz
2008-01-05 21:45 ` Borislav Petkov
2008-01-06 15:21 ` Bartlomiej Zolnierkiewicz
2008-01-05 15:12 ` [RESEND PATCH 05/10] ide-floppy: factor out ioctl handlers from idefloppy_ioctl() Bartlomiej Zolnierkiewicz
2008-01-04 1:19 ` [RESEND PATCH 04/10] ide-floppy: cleanup debugging macros Bartlomiej Zolnierkiewicz
2008-01-04 1:04 ` [RESEND PATCH 03/10] ide-floppy: convert to generic packet commands Bartlomiej Zolnierkiewicz
2008-01-04 22:49 ` [RESEND PATCH 02/10] ide-floppy: move ide-floppy struct and macro defs into its own header. While at it Bartlomiej Zolnierkiewicz
2008-01-05 12:45 ` Borislav Petkov
2008-01-05 13:15 ` Bartlomiej Zolnierkiewicz
2008-01-04 0:36 ` [RESEND PATCH 01/10] move ide-floppy historical changelog to Documentation/ide/ChangeLog.ide-floppy.1996-2002; Bartlomiej Zolnierkiewicz
2008-01-04 0:14 ` [RESEND PATCH 0/10] ide-floppy redux p1 Bartlomiej Zolnierkiewicz
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1199366409-26016-4-git-send-email-bbpetkov@yahoo.de \
--to=bbpetkov@yahoo.de \
--cc=axboe@kernel.dk \
--cc=bzolnier@gmail.com \
--cc=linux-ide@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).