From: Bartlomiej Zolnierkiewicz I've just introduced CONFIG_M68KNOMMU because I couldn't find single define identifying this arch, did I miss something? [PATCH] generic ide_init_hwif_ports() Add generic ide_init_hwif_ports() to and remove arch specific versions except arm26, arm, h8300, i386-pc9800, m68k and m68knommu ones. --- 25-akpm/arch/m68knommu/Kconfig | 4 ++ 25-akpm/include/asm-alpha/ide.h | 20 ------------- 25-akpm/include/asm-i386/ide.h | 11 ++----- 25-akpm/include/asm-ia64/ide.h | 20 ------------- 25-akpm/include/asm-mips/mach-generic/ide.h | 20 ------------- 25-akpm/include/asm-parisc/ide.h | 20 ------------- 25-akpm/include/asm-ppc/ide.h | 27 ------------------ 25-akpm/include/asm-ppc64/ide.h | 20 ------------- 25-akpm/include/asm-sh/ide.h | 20 ------------- 25-akpm/include/asm-sparc/ide.h | 23 --------------- 25-akpm/include/asm-sparc64/ide.h | 19 ------------ 25-akpm/include/asm-x86_64/ide.h | 20 ------------- 25-akpm/include/linux/ide.h | 41 ++++++++++++++++++++++++++++ 13 files changed, 48 insertions(+), 217 deletions(-) diff -puN arch/m68knommu/Kconfig~ide-cleanups-3 arch/m68knommu/Kconfig --- 25/arch/m68knommu/Kconfig~ide-cleanups-3 2004-04-17 22:01:30.761774744 -0700 +++ 25-akpm/arch/m68knommu/Kconfig 2004-04-17 22:01:30.780771856 -0700 @@ -5,6 +5,10 @@ mainmenu "uClinux/68k (w/o MMU) Kernel Configuration" +config M68KNOMMU + bool + default y + config MMU bool default n diff -puN include/asm-alpha/ide.h~ide-cleanups-3 include/asm-alpha/ide.h --- 25/include/asm-alpha/ide.h~ide-cleanups-3 2004-04-17 22:01:30.762774592 -0700 +++ 25-akpm/include/asm-alpha/ide.h 2004-04-17 22:01:30.780771856 -0700 @@ -43,26 +43,6 @@ static inline unsigned long ide_default_ } } -static inline void ide_init_hwif_ports(hw_regs_t *hw, unsigned long data_port, - unsigned long ctrl_port, int *irq) -{ - unsigned long reg = data_port; - int i; - - for (i = IDE_DATA_OFFSET; i <= IDE_STATUS_OFFSET; i++) { - hw->io_ports[i] = reg; - reg += 1; - } - if (ctrl_port) { - hw->io_ports[IDE_CONTROL_OFFSET] = ctrl_port; - } else { - hw->io_ports[IDE_CONTROL_OFFSET] = hw->io_ports[IDE_DATA_OFFSET] + 0x206; - } - if (irq != NULL) - *irq = 0; - hw->io_ports[IDE_IRQ_OFFSET] = 0; -} - #ifdef CONFIG_PCI #define ide_init_default_irq(base) (0) #else diff -puN include/asm-i386/ide.h~ide-cleanups-3 include/asm-i386/ide.h --- 25/include/asm-i386/ide.h~ide-cleanups-3 2004-04-17 22:01:30.763774440 -0700 +++ 25-akpm/include/asm-i386/ide.h 2004-04-17 22:01:30.780771856 -0700 @@ -59,29 +59,23 @@ static __inline__ unsigned long ide_defa } } +#ifdef CONFIG_X86_PC9800 static __inline__ void ide_init_hwif_ports(hw_regs_t *hw, unsigned long data_port, unsigned long ctrl_port, int *irq) { unsigned long reg = data_port; int i; -#ifdef CONFIG_X86_PC9800 + unsigned long increment = data_port == 0x640 ? 2 : 1; -#endif for (i = IDE_DATA_OFFSET; i <= IDE_STATUS_OFFSET; i++) { hw->io_ports[i] = reg; -#ifdef CONFIG_X86_PC9800 reg += increment; -#else - reg += 1; -#endif } if (ctrl_port) { hw->io_ports[IDE_CONTROL_OFFSET] = ctrl_port; -#ifdef CONFIG_X86_PC9800 } else if (data_port == 0x640) { hw->io_ports[IDE_CONTROL_OFFSET] = 0x74c; -#endif } else { hw->io_ports[IDE_CONTROL_OFFSET] = hw->io_ports[IDE_DATA_OFFSET] + 0x206; } @@ -89,6 +83,7 @@ static __inline__ void ide_init_hwif_por *irq = 0; hw->io_ports[IDE_IRQ_OFFSET] = 0; } +#endif #ifdef CONFIG_BLK_DEV_IDEPCI #define ide_init_default_irq(base) (0) diff -puN include/asm-ia64/ide.h~ide-cleanups-3 include/asm-ia64/ide.h --- 25/include/asm-ia64/ide.h~ide-cleanups-3 2004-04-17 22:01:30.765774136 -0700 +++ 25-akpm/include/asm-ia64/ide.h 2004-04-17 22:01:30.781771704 -0700 @@ -53,26 +53,6 @@ static inline unsigned long ide_default_ } } -static inline void ide_init_hwif_ports(hw_regs_t *hw, unsigned long data_port, - unsigned long ctrl_port, int *irq) -{ - unsigned long reg = data_port; - int i; - - for (i = IDE_DATA_OFFSET; i <= IDE_STATUS_OFFSET; i++) { - hw->io_ports[i] = reg; - reg += 1; - } - if (ctrl_port) { - hw->io_ports[IDE_CONTROL_OFFSET] = ctrl_port; - } else { - hw->io_ports[IDE_CONTROL_OFFSET] = hw->io_ports[IDE_DATA_OFFSET] + 0x206; - } - if (irq != NULL) - *irq = 0; - hw->io_ports[IDE_IRQ_OFFSET] = 0; -} - #ifdef CONFIG_PCI #define ide_init_default_irq(base) (0) #else diff -puN include/asm-mips/mach-generic/ide.h~ide-cleanups-3 include/asm-mips/mach-generic/ide.h --- 25/include/asm-mips/mach-generic/ide.h~ide-cleanups-3 2004-04-17 22:01:30.766773984 -0700 +++ 25-akpm/include/asm-mips/mach-generic/ide.h 2004-04-17 22:01:30.781771704 -0700 @@ -48,26 +48,6 @@ static inline unsigned long ide_default_ } } -static inline void ide_init_hwif_ports(hw_regs_t *hw, unsigned long data_port, - unsigned long ctrl_port, int *irq) -{ - unsigned long reg = data_port; - int i; - - for (i = IDE_DATA_OFFSET; i <= IDE_STATUS_OFFSET; i++) { - hw->io_ports[i] = reg; - reg += 1; - } - if (ctrl_port) { - hw->io_ports[IDE_CONTROL_OFFSET] = ctrl_port; - } else { - hw->io_ports[IDE_CONTROL_OFFSET] = hw->io_ports[IDE_DATA_OFFSET] + 0x206; - } - if (irq != NULL) - *irq = 0; - hw->io_ports[IDE_IRQ_OFFSET] = 0; -} - #ifdef CONFIG_BLK_DEV_IDEPCI #define ide_init_default_irq(base) (0) #else diff -puN include/asm-parisc/ide.h~ide-cleanups-3 include/asm-parisc/ide.h --- 25/include/asm-parisc/ide.h~ide-cleanups-3 2004-04-17 22:01:30.767773832 -0700 +++ 25-akpm/include/asm-parisc/ide.h 2004-04-17 22:01:30.782771552 -0700 @@ -22,26 +22,6 @@ #define ide_default_irq(base) (0) #define ide_default_io_base(index) (0) -static inline void ide_init_hwif_ports(hw_regs_t *hw, unsigned long data_port, - unsigned long ctrl_port, int *irq) -{ - unsigned long reg = data_port; - int i; - - for (i = IDE_DATA_OFFSET; i <= IDE_STATUS_OFFSET; i++) { - hw->io_ports[i] = reg; - reg += 1; - } - if (ctrl_port) { - hw->io_ports[IDE_CONTROL_OFFSET] = ctrl_port; - } else { - hw->io_ports[IDE_CONTROL_OFFSET] = hw->io_ports[IDE_DATA_OFFSET] + 0x206; - } - if (irq != NULL) - *irq = 0; - hw->io_ports[IDE_IRQ_OFFSET] = 0; -} - #define ide_init_default_irq(base) (0) #define ide_request_irq(irq,hand,flg,dev,id) request_irq((irq),(hand),(flg),(dev),(id)) diff -puN include/asm-ppc64/ide.h~ide-cleanups-3 include/asm-ppc64/ide.h --- 25/include/asm-ppc64/ide.h~ide-cleanups-3 2004-04-17 22:01:30.769773528 -0700 +++ 25-akpm/include/asm-ppc64/ide.h 2004-04-17 22:01:30.782771552 -0700 @@ -25,26 +25,6 @@ static inline int ide_default_irq(unsigned long base) { return 0; } static inline unsigned long ide_default_io_base(int index) { return 0; } -static inline void ide_init_hwif_ports(hw_regs_t *hw, unsigned long data_port, - unsigned long ctrl_port, int *irq) -{ - unsigned long reg = data_port; - int i; - - for (i = IDE_DATA_OFFSET; i <= IDE_STATUS_OFFSET; i++) { - hw->io_ports[i] = reg; - reg += 1; - } - if (ctrl_port) { - hw->io_ports[IDE_CONTROL_OFFSET] = ctrl_port; - } else { - hw->io_ports[IDE_CONTROL_OFFSET] = hw->io_ports[IDE_DATA_OFFSET] + 0x206; - } - if (irq != NULL) - *irq = 0; - hw->io_ports[IDE_IRQ_OFFSET] = 0; -} - #define ide_init_default_irq(base) (0) #endif /* __KERNEL__ */ diff -puN include/asm-ppc/ide.h~ide-cleanups-3 include/asm-ppc/ide.h --- 25/include/asm-ppc/ide.h~ide-cleanups-3 2004-04-17 22:01:30.770773376 -0700 +++ 25-akpm/include/asm-ppc/ide.h 2004-04-17 22:01:30.782771552 -0700 @@ -57,33 +57,6 @@ static __inline__ unsigned long ide_defa return 0; } -/* - * This is only used for PC-style IDE controllers (e.g. as on PReP) - * or for PCI IDE devices, not for other types of IDE interface such - * as the pmac IDE interfaces. - */ -static __inline__ void ide_init_hwif_ports(hw_regs_t *hw, - unsigned long data_port, - unsigned long ctrl_port, int *irq) -{ - unsigned long reg = data_port; - int i; - - for (i = IDE_DATA_OFFSET; i <= IDE_STATUS_OFFSET; i++) - hw->io_ports[i] = reg++; - if (ctrl_port) { - hw->io_ports[IDE_CONTROL_OFFSET] = ctrl_port; - } else { - hw->io_ports[IDE_CONTROL_OFFSET] = - hw->io_ports[IDE_DATA_OFFSET] + 0x206; - } - if (irq != NULL) - *irq = 0; - hw->io_ports[IDE_IRQ_OFFSET] = 0; - if (ppc_ide_md.ide_init_hwif != NULL) - ppc_ide_md.ide_init_hwif(hw, data_port, ctrl_port, irq); -} - #ifdef CONFIG_PCI #define ide_init_default_irq(base) (0) #else diff -puN include/asm-sh/ide.h~ide-cleanups-3 include/asm-sh/ide.h --- 25/include/asm-sh/ide.h~ide-cleanups-3 2004-04-17 22:01:30.771773224 -0700 +++ 25-akpm/include/asm-sh/ide.h 2004-04-17 22:01:30.783771400 -0700 @@ -72,26 +72,6 @@ static inline unsigned long ide_default_ } } -static inline void ide_init_hwif_ports(hw_regs_t *hw, unsigned long data_port, - unsigned long ctrl_port, int *irq) -{ - unsigned long reg = data_port; - int i; - - for (i = IDE_DATA_OFFSET; i <= IDE_STATUS_OFFSET; i++) { - hw->io_ports[i] = reg; - reg += 1; - } - if (ctrl_port) { - hw->io_ports[IDE_CONTROL_OFFSET] = ctrl_port; - } else { - hw->io_ports[IDE_CONTROL_OFFSET] = hw->io_ports[IDE_DATA_OFFSET] + 0x206; - } - if (irq != NULL) - *irq = 0; - hw->io_ports[IDE_IRQ_OFFSET] = 0; -} - #ifdef CONFIG_PCI #define ide_init_default_irq(base) (0) #else diff -puN include/asm-sparc64/ide.h~ide-cleanups-3 include/asm-sparc64/ide.h --- 25/include/asm-sparc64/ide.h~ide-cleanups-3 2004-04-17 22:01:30.772773072 -0700 +++ 25-akpm/include/asm-sparc64/ide.h 2004-04-17 22:01:30.783771400 -0700 @@ -34,25 +34,6 @@ static __inline__ unsigned long ide_defa return 0; } -static __inline__ void ide_init_hwif_ports(hw_regs_t *hw, unsigned long data_port, unsigned long ctrl_port, int *irq) -{ - unsigned long reg = data_port; - int i; - - for (i = IDE_DATA_OFFSET; i <= IDE_STATUS_OFFSET; i++) { - hw->io_ports[i] = reg; - reg += 1; - } - if (ctrl_port) { - hw->io_ports[IDE_CONTROL_OFFSET] = ctrl_port; - } else { - hw->io_ports[IDE_CONTROL_OFFSET] = hw->io_ports[IDE_DATA_OFFSET] + 0x206; - } - if (irq != NULL) - *irq = 0; - hw->io_ports[IDE_IRQ_OFFSET] = 0; -} - #define ide_init_default_irq(base) (0) #define __ide_insl(data_reg, buffer, wcount) \ diff -puN include/asm-sparc/ide.h~ide-cleanups-3 include/asm-sparc/ide.h --- 25/include/asm-sparc/ide.h~ide-cleanups-3 2004-04-17 22:01:30.773772920 -0700 +++ 25-akpm/include/asm-sparc/ide.h 2004-04-17 22:01:30.783771400 -0700 @@ -29,29 +29,6 @@ static __inline__ unsigned long ide_defa return 0; } -/* - * Doing any sort of ioremap() here does not work - * because this function may be called with null aguments. - */ -static __inline__ void ide_init_hwif_ports(hw_regs_t *hw, unsigned long data_port, unsigned long ctrl_port, int *irq) -{ - unsigned long reg = data_port; - int i; - - for (i = IDE_DATA_OFFSET; i <= IDE_STATUS_OFFSET; i++) { - hw->io_ports[i] = reg; - reg += 1; - } - if (ctrl_port) { - hw->io_ports[IDE_CONTROL_OFFSET] = ctrl_port; - } else { - hw->io_ports[IDE_CONTROL_OFFSET] = hw->io_ports[IDE_DATA_OFFSET] + 0x206; - } - if (irq != NULL) - *irq = 0; - hw->io_ports[IDE_IRQ_OFFSET] = 0; -} - #define ide_init_default_irq(base) (0) #define __ide_insl(data_reg, buffer, wcount) \ diff -puN include/asm-x86_64/ide.h~ide-cleanups-3 include/asm-x86_64/ide.h --- 25/include/asm-x86_64/ide.h~ide-cleanups-3 2004-04-17 22:01:30.775772616 -0700 +++ 25-akpm/include/asm-x86_64/ide.h 2004-04-17 22:01:30.784771248 -0700 @@ -51,26 +51,6 @@ static __inline__ unsigned long ide_defa } } -static __inline__ void ide_init_hwif_ports(hw_regs_t *hw, unsigned long data_port, - unsigned long ctrl_port, int *irq) -{ - unsigned long reg = data_port; - int i; - - for (i = IDE_DATA_OFFSET; i <= IDE_STATUS_OFFSET; i++) { - hw->io_ports[i] = reg; - reg += 1; - } - if (ctrl_port) { - hw->io_ports[IDE_CONTROL_OFFSET] = ctrl_port; - } else { - hw->io_ports[IDE_CONTROL_OFFSET] = hw->io_ports[IDE_DATA_OFFSET] + 0x206; - } - if (irq != NULL) - *irq = 0; - hw->io_ports[IDE_IRQ_OFFSET] = 0; -} - #ifdef CONFIG_BLK_DEV_IDEPCI #define ide_init_default_irq(base) (0) #else diff -puN include/linux/ide.h~ide-cleanups-3 include/linux/ide.h --- 25/include/linux/ide.h~ide-cleanups-3 2004-04-17 22:01:30.776772464 -0700 +++ 25-akpm/include/linux/ide.h 2004-04-17 22:01:30.785771096 -0700 @@ -293,8 +293,49 @@ void ide_setup_ports( hw_regs_t *hw, #endif int irq); +static inline void ide_std_init_ports(hw_regs_t *hw, + unsigned long io_addr, + unsigned long ctl_addr) +{ + unsigned int i; + + for (i = IDE_DATA_OFFSET; i <= IDE_STATUS_OFFSET; i++) + hw->io_ports[i] = io_addr++; + + hw->io_ports[IDE_CONTROL_OFFSET] = ctl_addr; +} + #include +/* + * ide_init_hwif_ports() is OBSOLETE and will be removed in 2.7 series. + * + * arm26, arm, h8300, m68k, m68knommu and i386-pc9800 still have own versions. + */ +#if !defined(CONFIG_ARM) && !defined(CONFIG_H8300) && !defined(CONFIG_M68K) && \ + !defined(CONFIG_M68KNOMMU) && !defined(CONFIG_X86_PC9800) +static inline void ide_init_hwif_ports(hw_regs_t *hw, + unsigned long io_addr, + unsigned long ctl_addr, + int *irq) +{ + if (!ctl_addr) + ide_std_init_ports(hw, io_addr, io_addr + 0x206); + else + ide_std_init_ports(hw, io_addr, ctl_addr); + + if (irq) + *irq = 0; + + hw->io_ports[IDE_IRQ_OFFSET] = 0; + +#ifdef CONFIG_PPC32 + if (ppc_ide_md.ide_init_hwif) + ppc_ide_md.ide_init_hwif(hw, io_addr, ctl_addr, irq); +#endif +} +#endif /* !ARM && !H8300 && !M68K && !M68KNOMMU && !X86_PC9800 */ + /* Currently only m68k, apus and m8xx need it */ #ifndef IDE_ARCH_ACK_INTR # define ide_ack_intr(hwif) (1) _