Commit ea23b8ba0068df281988bfba605f107edb01bf7f

Authored by Bartlomiej Zolnierkiewicz
1 parent db2432c40f

ns87415: add ->tf_read method

Add ->tf_read method so out{b,w}(), in{b,w}() and superio_ide_inb()
can be used directly.

There should be no functional changes caused by this patch.

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

Showing 1 changed file with 44 additions and 0 deletions Side-by-side Diff

drivers/ide/pci/ns87415.c
... ... @@ -63,6 +63,48 @@
63 63 return inb(port);
64 64 }
65 65  
  66 +static void superio_tf_read(ide_drive_t *drive, ide_task_t *task)
  67 +{
  68 + struct ide_io_ports *io_ports = &drive->hwif->io_ports;
  69 + struct ide_taskfile *tf = &task->tf;
  70 +
  71 + if (task->tf_flags & IDE_TFLAG_IN_DATA) {
  72 + u16 data = inw(io_ports->data_addr);
  73 +
  74 + tf->data = data & 0xff;
  75 + tf->hob_data = (data >> 8) & 0xff;
  76 + }
  77 +
  78 + /* be sure we're looking at the low order bits */
  79 + outb(drive->ctl & ~0x80, io_ports->ctl_addr);
  80 +
  81 + if (task->tf_flags & IDE_TFLAG_IN_NSECT)
  82 + tf->nsect = inb(io_ports->nsect_addr);
  83 + if (task->tf_flags & IDE_TFLAG_IN_LBAL)
  84 + tf->lbal = inb(io_ports->lbal_addr);
  85 + if (task->tf_flags & IDE_TFLAG_IN_LBAM)
  86 + tf->lbam = inb(io_ports->lbam_addr);
  87 + if (task->tf_flags & IDE_TFLAG_IN_LBAH)
  88 + tf->lbah = inb(io_ports->lbah_addr);
  89 + if (task->tf_flags & IDE_TFLAG_IN_DEVICE)
  90 + tf->device = superio_ide_inb(io_ports->device_addr);
  91 +
  92 + if (task->tf_flags & IDE_TFLAG_LBA48) {
  93 + outb(drive->ctl | 0x80, io_ports->ctl_addr);
  94 +
  95 + if (task->tf_flags & IDE_TFLAG_IN_HOB_FEATURE)
  96 + tf->hob_feature = inb(io_ports->feature_addr);
  97 + if (task->tf_flags & IDE_TFLAG_IN_HOB_NSECT)
  98 + tf->hob_nsect = inb(io_ports->nsect_addr);
  99 + if (task->tf_flags & IDE_TFLAG_IN_HOB_LBAL)
  100 + tf->hob_lbal = inb(io_ports->lbal_addr);
  101 + if (task->tf_flags & IDE_TFLAG_IN_HOB_LBAM)
  102 + tf->hob_lbam = inb(io_ports->lbam_addr);
  103 + if (task->tf_flags & IDE_TFLAG_IN_HOB_LBAH)
  104 + tf->hob_lbah = inb(io_ports->lbah_addr);
  105 + }
  106 +}
  107 +
66 108 static void __devinit superio_ide_init_iops (struct hwif_s *hwif)
67 109 {
68 110 struct pci_dev *pdev = to_pci_dev(hwif->dev);
... ... @@ -79,6 +121,8 @@
79 121 /* Clear error/interrupt, enable dma */
80 122 tmp = superio_ide_inb(superio_ide_dma_status[port]);
81 123 outb(tmp | 0x66, superio_ide_dma_status[port]);
  124 +
  125 + hwif->tf_read = superio_tf_read;
82 126  
83 127 /* We need to override inb to workaround a SuperIO errata */
84 128 hwif->INB = superio_ide_inb;