more changes on original files
[linux-2.4.git] / include / asm-mips / ide.h
1 /*
2  * This file is subject to the terms and conditions of the GNU General Public
3  * License.  See the file "COPYING" in the main directory of this archive
4  * for more details.
5  *
6  * This file contains the MIPS architecture specific IDE code.
7  *
8  * Copyright (C) 1994-1996  Linus Torvalds & authors
9  */
10 #ifndef __ASM_IDE_H
11 #define __ASM_IDE_H
12
13 #ifdef __KERNEL__
14
15 #include <linux/config.h>
16 #include <asm/io.h>
17
18 #ifndef MAX_HWIFS
19 # ifdef CONFIG_BLK_DEV_IDEPCI
20 #define MAX_HWIFS       10
21 # else
22 #define MAX_HWIFS       6
23 # endif
24 #endif
25
26 struct ide_ops {
27         int (*ide_default_irq)(ide_ioreg_t base);
28         ide_ioreg_t (*ide_default_io_base)(int index);
29         void (*ide_init_hwif_ports)(hw_regs_t *hw, ide_ioreg_t data_port,
30                                     ide_ioreg_t ctrl_port, int *irq);
31 };
32
33 extern struct ide_ops *ide_ops;
34
35 static __inline__ int ide_default_irq(ide_ioreg_t base)
36 {
37         return ide_ops->ide_default_irq(base);
38 }
39
40 static __inline__ ide_ioreg_t ide_default_io_base(int index)
41 {
42         return ide_ops->ide_default_io_base(index);
43 }
44
45 static inline void ide_init_hwif_ports(hw_regs_t *hw, ide_ioreg_t data_port,
46         ide_ioreg_t ctrl_port, int *irq)
47 {
48         ide_ops->ide_init_hwif_ports(hw, data_port, ctrl_port, irq);
49 }
50
51 static __inline__ void ide_init_default_hwifs(void)
52 {
53 #ifndef CONFIG_BLK_DEV_IDEPCI
54         hw_regs_t hw;
55         int index;
56
57         for(index = 0; index < MAX_HWIFS; index++) {
58                 memset(&hw, 0, sizeof hw);
59                 ide_init_hwif_ports(&hw, ide_default_io_base(index), 0, NULL);
60                 hw.irq = ide_default_irq(ide_default_io_base(index));
61                 ide_register_hw(&hw, NULL);
62         }
63 #endif /* CONFIG_BLK_DEV_IDEPCI */
64 }
65
66 #ifdef CONFIG_PCMCIA_SIBYTE
67 #define IDE_ARCH_ACK_INTR
68 #define ide_ack_intr(hwif)      ((hwif)->hw.ack_intr ? (hwif)->hw.ack_intr(hwif) : 1)
69 #endif
70
71 #include <asm-generic/ide_iops.h>
72
73 #endif /* __KERNEL__ */
74
75 #endif /* __ASM_IDE_H */