^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) // SPDX-License-Identifier: GPL-2.0-only
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) #include <linux/kernel.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) #include <linux/export.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) #include <linux/ide.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) #if defined(CONFIG_ARM) || defined(CONFIG_M68K) || defined(CONFIG_MIPS) || \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) defined(CONFIG_PARISC) || defined(CONFIG_PPC) || defined(CONFIG_SPARC)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) #include <asm/ide.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) #include <asm-generic/ide_iops.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) * Conventional PIO operations for ATA devices
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) static u8 ide_inb(unsigned long port)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) return (u8) inb(port);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) static void ide_outb(u8 val, unsigned long port)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) outb(val, port);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) * MMIO operations, typically used for SATA controllers
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) static u8 ide_mm_inb(unsigned long port)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) return (u8) readb((void __iomem *) port);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) static void ide_mm_outb(u8 value, unsigned long port)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) writeb(value, (void __iomem *) port);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) void ide_exec_command(ide_hwif_t *hwif, u8 cmd)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) if (hwif->host_flags & IDE_HFLAG_MMIO)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) writeb(cmd, (void __iomem *)hwif->io_ports.command_addr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) outb(cmd, hwif->io_ports.command_addr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) EXPORT_SYMBOL_GPL(ide_exec_command);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) u8 ide_read_status(ide_hwif_t *hwif)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) if (hwif->host_flags & IDE_HFLAG_MMIO)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) return readb((void __iomem *)hwif->io_ports.status_addr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) return inb(hwif->io_ports.status_addr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) EXPORT_SYMBOL_GPL(ide_read_status);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) u8 ide_read_altstatus(ide_hwif_t *hwif)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) if (hwif->host_flags & IDE_HFLAG_MMIO)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) return readb((void __iomem *)hwif->io_ports.ctl_addr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) return inb(hwif->io_ports.ctl_addr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) EXPORT_SYMBOL_GPL(ide_read_altstatus);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) void ide_write_devctl(ide_hwif_t *hwif, u8 ctl)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) if (hwif->host_flags & IDE_HFLAG_MMIO)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) writeb(ctl, (void __iomem *)hwif->io_ports.ctl_addr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) outb(ctl, hwif->io_ports.ctl_addr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) EXPORT_SYMBOL_GPL(ide_write_devctl);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) void ide_dev_select(ide_drive_t *drive)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) ide_hwif_t *hwif = drive->hwif;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81) u8 select = drive->select | ATA_DEVICE_OBS;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83) if (hwif->host_flags & IDE_HFLAG_MMIO)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84) writeb(select, (void __iomem *)hwif->io_ports.device_addr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85) else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86) outb(select, hwif->io_ports.device_addr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88) EXPORT_SYMBOL_GPL(ide_dev_select);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90) void ide_tf_load(ide_drive_t *drive, struct ide_taskfile *tf, u8 valid)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92) ide_hwif_t *hwif = drive->hwif;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93) struct ide_io_ports *io_ports = &hwif->io_ports;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94) void (*tf_outb)(u8 addr, unsigned long port);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95) u8 mmio = (hwif->host_flags & IDE_HFLAG_MMIO) ? 1 : 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 96)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 97) if (mmio)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 98) tf_outb = ide_mm_outb;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 99) else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) tf_outb = ide_outb;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) if (valid & IDE_VALID_FEATURE)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) tf_outb(tf->feature, io_ports->feature_addr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) if (valid & IDE_VALID_NSECT)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) tf_outb(tf->nsect, io_ports->nsect_addr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) if (valid & IDE_VALID_LBAL)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) tf_outb(tf->lbal, io_ports->lbal_addr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) if (valid & IDE_VALID_LBAM)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) tf_outb(tf->lbam, io_ports->lbam_addr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) if (valid & IDE_VALID_LBAH)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) tf_outb(tf->lbah, io_ports->lbah_addr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) if (valid & IDE_VALID_DEVICE)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) tf_outb(tf->device, io_ports->device_addr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) EXPORT_SYMBOL_GPL(ide_tf_load);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) void ide_tf_read(ide_drive_t *drive, struct ide_taskfile *tf, u8 valid)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) ide_hwif_t *hwif = drive->hwif;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) struct ide_io_ports *io_ports = &hwif->io_ports;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) u8 (*tf_inb)(unsigned long port);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) u8 mmio = (hwif->host_flags & IDE_HFLAG_MMIO) ? 1 : 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) if (mmio)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) tf_inb = ide_mm_inb;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) tf_inb = ide_inb;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) if (valid & IDE_VALID_ERROR)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) tf->error = tf_inb(io_ports->feature_addr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) if (valid & IDE_VALID_NSECT)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) tf->nsect = tf_inb(io_ports->nsect_addr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) if (valid & IDE_VALID_LBAL)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) tf->lbal = tf_inb(io_ports->lbal_addr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) if (valid & IDE_VALID_LBAM)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) tf->lbam = tf_inb(io_ports->lbam_addr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) if (valid & IDE_VALID_LBAH)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) tf->lbah = tf_inb(io_ports->lbah_addr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) if (valid & IDE_VALID_DEVICE)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) tf->device = tf_inb(io_ports->device_addr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) EXPORT_SYMBOL_GPL(ide_tf_read);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) * Some localbus EIDE interfaces require a special access sequence
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) * when using 32-bit I/O instructions to transfer data. We call this
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) * the "vlb_sync" sequence, which consists of three successive reads
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) * of the sector count register location, with interrupts disabled
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) * to ensure that the reads all happen together.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) static void ata_vlb_sync(unsigned long port)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) (void)inb(port);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) (void)inb(port);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) (void)inb(port);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) * This is used for most PIO data transfers *from* the IDE interface
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) * These routines will round up any request for an odd number of bytes,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) * so if an odd len is specified, be sure that there's at least one
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) * extra byte allocated for the buffer.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) void ide_input_data(ide_drive_t *drive, struct ide_cmd *cmd, void *buf,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) unsigned int len)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) ide_hwif_t *hwif = drive->hwif;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) struct ide_io_ports *io_ports = &hwif->io_ports;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) unsigned long data_addr = io_ports->data_addr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) unsigned int words = (len + 1) >> 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) u8 io_32bit = drive->io_32bit;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) u8 mmio = (hwif->host_flags & IDE_HFLAG_MMIO) ? 1 : 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) if (io_32bit) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) unsigned long flags;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) if ((io_32bit & 2) && !mmio) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) local_irq_save(flags);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) ata_vlb_sync(io_ports->nsect_addr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) words >>= 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) if (mmio)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) __ide_mm_insl((void __iomem *)data_addr, buf, words);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) insl(data_addr, buf, words);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) if ((io_32bit & 2) && !mmio)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) local_irq_restore(flags);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) if (((len + 1) & 3) < 2)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) return;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) buf += len & ~3;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) words = 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) if (mmio)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) __ide_mm_insw((void __iomem *)data_addr, buf, words);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) insw(data_addr, buf, words);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) EXPORT_SYMBOL_GPL(ide_input_data);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) * This is used for most PIO data transfers *to* the IDE interface
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) void ide_output_data(ide_drive_t *drive, struct ide_cmd *cmd, void *buf,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) unsigned int len)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) ide_hwif_t *hwif = drive->hwif;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) struct ide_io_ports *io_ports = &hwif->io_ports;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) unsigned long data_addr = io_ports->data_addr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) unsigned int words = (len + 1) >> 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) u8 io_32bit = drive->io_32bit;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) u8 mmio = (hwif->host_flags & IDE_HFLAG_MMIO) ? 1 : 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) if (io_32bit) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) unsigned long flags;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) if ((io_32bit & 2) && !mmio) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) local_irq_save(flags);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) ata_vlb_sync(io_ports->nsect_addr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) words >>= 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) if (mmio)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) __ide_mm_outsl((void __iomem *)data_addr, buf, words);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) outsl(data_addr, buf, words);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233) if ((io_32bit & 2) && !mmio)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) local_irq_restore(flags);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236) if (((len + 1) & 3) < 2)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) return;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239) buf += len & ~3;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240) words = 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243) if (mmio)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244) __ide_mm_outsw((void __iomem *)data_addr, buf, words);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245) else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246) outsw(data_addr, buf, words);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248) EXPORT_SYMBOL_GPL(ide_output_data);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 250) const struct ide_tp_ops default_tp_ops = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 251) .exec_command = ide_exec_command,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 252) .read_status = ide_read_status,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 253) .read_altstatus = ide_read_altstatus,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 254) .write_devctl = ide_write_devctl,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 255)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 256) .dev_select = ide_dev_select,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 257) .tf_load = ide_tf_load,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 258) .tf_read = ide_tf_read,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 259)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 260) .input_data = ide_input_data,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 261) .output_data = ide_output_data,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 262) };