[ide] add ide_dump_opcode()

* add it to ide-lib.c and cleanup ide{disk}_dump_status()
* as a bonus it fixes unknown opcode reporting in ide_dump_status()
* use ide_dump_opcode() in ide_dump_atapi_status()
Signed-off-by: default avatarBartlomiej Zolnierkiewicz <bzolnier@gmail.com>
parent ea46e05a
......@@ -355,37 +355,7 @@ static u8 idedisk_dump_status (ide_drive_t *drive, const char *msg, u8 stat)
}
}
printk("\n");
{
struct request *rq;
unsigned char opcode = 0;
int found = 0;
spin_lock(&ide_lock);
rq = HWGROUP(drive)->rq;
spin_unlock(&ide_lock);
if (!rq)
goto out;
if (rq->flags & (REQ_DRIVE_CMD | REQ_DRIVE_TASK)) {
char *args = rq->buffer;
if (args) {
opcode = args[0];
found = 1;
}
} else if (rq->flags & REQ_DRIVE_TASKFILE) {
ide_task_t *args = rq->special;
if (args) {
task_struct_t *tf = (task_struct_t *) args->tfRegister;
opcode = tf->command;
found = 1;
}
}
printk("ide: failed opcode was: ");
if (!found)
printk("unknown\n");
else
printk("0x%02x\n", opcode);
}
out:
ide_dump_opcode(drive);
local_irq_restore(flags);
return err;
}
......
......@@ -445,6 +445,43 @@ int ide_set_xfer_rate(ide_drive_t *drive, u8 rate)
EXPORT_SYMBOL_GPL(ide_set_xfer_rate);
void ide_dump_opcode(ide_drive_t *drive)
{
struct request *rq;
u8 opcode = 0;
int found = 0;
spin_lock(&ide_lock);
rq = NULL;
if (HWGROUP(drive))
rq = HWGROUP(drive)->rq;
spin_unlock(&ide_lock);
if (!rq)
return;
if (rq->flags & (REQ_DRIVE_CMD | REQ_DRIVE_TASK)) {
char *args = rq->buffer;
if (args) {
opcode = args[0];
found = 1;
}
} else if (rq->flags & REQ_DRIVE_TASKFILE) {
ide_task_t *args = rq->special;
if (args) {
task_struct_t *tf = (task_struct_t *) args->tfRegister;
opcode = tf->command;
found = 1;
}
}
printk("ide: failed opcode was: ");
if (!found)
printk("unknown\n");
else
printk("0x%02x\n", opcode);
}
EXPORT_SYMBOL_GPL(ide_dump_opcode);
/**
* ide_dump_atapi_status - print human readable atapi status
* @drive: drive that status applies to
......@@ -488,6 +525,7 @@ byte ide_dump_atapi_status (ide_drive_t *drive, const char *msg, byte stat)
error.b.sense_key);
printk("\n");
}
ide_dump_opcode(drive);
local_irq_restore(flags);
return error.all;
}
......
......@@ -457,32 +457,7 @@ u8 ide_dump_status (ide_drive_t *drive, const char *msg, u8 stat)
}
printk("\n");
}
{
struct request *rq;
int opcode = 0x100;
spin_lock(&ide_lock);
rq = NULL;
if (HWGROUP(drive))
rq = HWGROUP(drive)->rq;
spin_unlock(&ide_lock);
if (!rq)
goto out;
if (rq->flags & (REQ_DRIVE_CMD | REQ_DRIVE_TASK)) {
char *args = rq->buffer;
if (args)
opcode = args[0];
} else if (rq->flags & REQ_DRIVE_TASKFILE) {
ide_task_t *args = rq->special;
if (args) {
task_struct_t *tf = (task_struct_t *) args->tfRegister;
opcode = tf->command;
}
}
printk("ide: failed opcode was %x\n", opcode);
}
out:
ide_dump_opcode(drive);
local_irq_restore(flags);
return err;
}
......
......@@ -1510,6 +1510,8 @@ extern int ide_dma_enable(ide_drive_t *drive);
extern char *ide_xfer_verbose(u8 xfer_rate);
extern void ide_toggle_bounce(ide_drive_t *drive, int on);
extern int ide_set_xfer_rate(ide_drive_t *drive, u8 rate);
void ide_dump_opcode(ide_drive_t *);
extern byte ide_dump_atapi_status(ide_drive_t *drive, const char *msg, byte stat);
typedef struct ide_pio_timings_s {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment