···11-/*22- * This file is subject to the terms and conditions of the GNU General Public33- * License. See the file "COPYING" in the main directory of this archive44- * for more details.55- *66- * This file contains the MIPS architecture specific IDE code.77- */88-#ifndef __ASM_IDE_H99-#define __ASM_IDE_H1010-1111-#include <ide.h>1212-1313-#endif /* __ASM_IDE_H */
-138
arch/mips/include/asm/mach-generic/ide.h
···11-/*22- * This file is subject to the terms and conditions of the GNU General Public33- * License. See the file "COPYING" in the main directory of this archive44- * for more details.55- *66- * Copyright (C) 1994-1996 Linus Torvalds & authors77- *88- * Copied from i386; many of the especially older MIPS or ISA-based platforms99- * are basically identical. Using this file probably implies i8259 PIC1010- * support in a system but the very least interrupt numbers 0 - 15 need to1111- * be put aside for legacy devices.1212- */1313-#ifndef __ASM_MACH_GENERIC_IDE_H1414-#define __ASM_MACH_GENERIC_IDE_H1515-1616-#ifdef __KERNEL__1717-1818-#include <linux/pci.h>1919-#include <linux/stddef.h>2020-#include <asm/processor.h>2121-2222-/* MIPS port and memory-mapped I/O string operations. */2323-static inline void __ide_flush_prologue(void)2424-{2525-#ifdef CONFIG_SMP2626- if (cpu_has_dc_aliases || !cpu_has_ic_fills_f_dc)2727- preempt_disable();2828-#endif2929-}3030-3131-static inline void __ide_flush_epilogue(void)3232-{3333-#ifdef CONFIG_SMP3434- if (cpu_has_dc_aliases || !cpu_has_ic_fills_f_dc)3535- preempt_enable();3636-#endif3737-}3838-3939-static inline void __ide_flush_dcache_range(unsigned long addr, unsigned long size)4040-{4141- if (cpu_has_dc_aliases || !cpu_has_ic_fills_f_dc) {4242- unsigned long end = addr + size;4343-4444- while (addr < end) {4545- local_flush_data_cache_page((void *)addr);4646- addr += PAGE_SIZE;4747- }4848- }4949-}5050-5151-/*5252- * insw() and gang might be called with interrupts disabled, so we can't5353- * send IPIs for flushing due to the potencial of deadlocks, see the comment5454- * above smp_call_function() in arch/mips/kernel/smp.c. We work around the5555- * problem by disabling preemption so we know we actually perform the flush5656- * on the processor that actually has the lines to be flushed which hopefully5757- * is even better for performance anyway.5858- */5959-static inline void __ide_insw(unsigned long port, void *addr,6060- unsigned int count)6161-{6262- __ide_flush_prologue();6363- insw(port, addr, count);6464- __ide_flush_dcache_range((unsigned long)addr, count * 2);6565- __ide_flush_epilogue();6666-}6767-6868-static inline void __ide_insl(unsigned long port, void *addr, unsigned int count)6969-{7070- __ide_flush_prologue();7171- insl(port, addr, count);7272- __ide_flush_dcache_range((unsigned long)addr, count * 4);7373- __ide_flush_epilogue();7474-}7575-7676-static inline void __ide_outsw(unsigned long port, const void *addr,7777- unsigned long count)7878-{7979- __ide_flush_prologue();8080- outsw(port, addr, count);8181- __ide_flush_dcache_range((unsigned long)addr, count * 2);8282- __ide_flush_epilogue();8383-}8484-8585-static inline void __ide_outsl(unsigned long port, const void *addr,8686- unsigned long count)8787-{8888- __ide_flush_prologue();8989- outsl(port, addr, count);9090- __ide_flush_dcache_range((unsigned long)addr, count * 4);9191- __ide_flush_epilogue();9292-}9393-9494-static inline void __ide_mm_insw(void __iomem *port, void *addr, u32 count)9595-{9696- __ide_flush_prologue();9797- readsw(port, addr, count);9898- __ide_flush_dcache_range((unsigned long)addr, count * 2);9999- __ide_flush_epilogue();100100-}101101-102102-static inline void __ide_mm_insl(void __iomem *port, void *addr, u32 count)103103-{104104- __ide_flush_prologue();105105- readsl(port, addr, count);106106- __ide_flush_dcache_range((unsigned long)addr, count * 4);107107- __ide_flush_epilogue();108108-}109109-110110-static inline void __ide_mm_outsw(void __iomem *port, void *addr, u32 count)111111-{112112- __ide_flush_prologue();113113- writesw(port, addr, count);114114- __ide_flush_dcache_range((unsigned long)addr, count * 2);115115- __ide_flush_epilogue();116116-}117117-118118-static inline void __ide_mm_outsl(void __iomem * port, void *addr, u32 count)119119-{120120- __ide_flush_prologue();121121- writesl(port, addr, count);122122- __ide_flush_dcache_range((unsigned long)addr, count * 4);123123- __ide_flush_epilogue();124124-}125125-126126-/* ide_insw calls insw, not __ide_insw. Why? */127127-#undef insw128128-#undef insl129129-#undef outsw130130-#undef outsl131131-#define insw(port, addr, count) __ide_insw(port, addr, count)132132-#define insl(port, addr, count) __ide_insl(port, addr, count)133133-#define outsw(port, addr, count) __ide_outsw(port, addr, count)134134-#define outsl(port, addr, count) __ide_outsl(port, addr, count)135135-136136-#endif /* __KERNEL__ */137137-138138-#endif /* __ASM_MACH_GENERIC_IDE_H */