Commit 089c5c7e0089c3461545be936bcd236cbf16b79a

Authored by Bartlomiej Zolnierkiewicz
1 parent 1fc142589e

ide: factor out debugging code from ide_tf_load()

Factor out debugging code from ide_tf_load() to ide_tf_dump() helper
and update ide_tf_load() users accordingly.

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>

Showing 3 changed files with 20 additions and 12 deletions Side-by-side Diff

drivers/ide/ide-io.c
... ... @@ -1680,6 +1680,7 @@
1680 1680 task.tf.lbam = bcount & 0xff;
1681 1681 task.tf.lbah = (bcount >> 8) & 0xff;
1682 1682  
  1683 + ide_tf_dump(drive->name, &task.tf);
1683 1684 ide_tf_load(drive, &task);
1684 1685 }
1685 1686  
drivers/ide/ide-taskfile.c
... ... @@ -33,27 +33,30 @@
33 33 #include <asm/uaccess.h>
34 34 #include <asm/io.h>
35 35  
36   -void ide_tf_load(ide_drive_t *drive, ide_task_t *task)
  36 +void ide_tf_dump(const char *s, struct ide_taskfile *tf)
37 37 {
38   - ide_hwif_t *hwif = drive->hwif;
39   - struct ide_io_ports *io_ports = &hwif->io_ports;
40   - struct ide_taskfile *tf = &task->tf;
41   - u8 HIHI = (task->tf_flags & IDE_TFLAG_LBA48) ? 0xE0 : 0xEF;
42   -
43   - if (task->tf_flags & IDE_TFLAG_FLAGGED)
44   - HIHI = 0xFF;
45   -
46 38 #ifdef DEBUG
47 39 printk("%s: tf: feat 0x%02x nsect 0x%02x lbal 0x%02x "
48 40 "lbam 0x%02x lbah 0x%02x dev 0x%02x cmd 0x%02x\n",
49   - drive->name, tf->feature, tf->nsect, tf->lbal,
  41 + s, tf->feature, tf->nsect, tf->lbal,
50 42 tf->lbam, tf->lbah, tf->device, tf->command);
51 43 printk("%s: hob: nsect 0x%02x lbal 0x%02x "
52 44 "lbam 0x%02x lbah 0x%02x\n",
53   - drive->name, tf->hob_nsect, tf->hob_lbal,
  45 + s, tf->hob_nsect, tf->hob_lbal,
54 46 tf->hob_lbam, tf->hob_lbah);
55 47 #endif
  48 +}
56 49  
  50 +void ide_tf_load(ide_drive_t *drive, ide_task_t *task)
  51 +{
  52 + ide_hwif_t *hwif = drive->hwif;
  53 + struct ide_io_ports *io_ports = &hwif->io_ports;
  54 + struct ide_taskfile *tf = &task->tf;
  55 + u8 HIHI = (task->tf_flags & IDE_TFLAG_LBA48) ? 0xE0 : 0xEF;
  56 +
  57 + if (task->tf_flags & IDE_TFLAG_FLAGGED)
  58 + HIHI = 0xFF;
  59 +
57 60 ide_set_irq(drive, 1);
58 61  
59 62 if ((task->tf_flags & IDE_TFLAG_NO_SELECT_MASK) == 0)
60 63  
... ... @@ -149,8 +152,10 @@
149 152 if (task->tf_flags & IDE_TFLAG_FLAGGED)
150 153 task->tf_flags |= IDE_TFLAG_FLAGGED_SET_IN_FLAGS;
151 154  
152   - if ((task->tf_flags & IDE_TFLAG_DMA_PIO_FALLBACK) == 0)
  155 + if ((task->tf_flags & IDE_TFLAG_DMA_PIO_FALLBACK) == 0) {
  156 + ide_tf_dump(drive->name, tf);
153 157 ide_tf_load(drive, task);
  158 + }
154 159  
155 160 switch (task->data_phase) {
156 161 case TASKFILE_MULTI_OUT:
... ... @@ -960,6 +960,8 @@
960 960 void *special; /* valid_t generally */
961 961 } ide_task_t;
962 962  
  963 +void ide_tf_dump(const char *, struct ide_taskfile *);
  964 +
963 965 void ide_tf_load(ide_drive_t *, ide_task_t *);
964 966 void ide_tf_read(ide_drive_t *, ide_task_t *);
965 967