1 /*
2 * linux/include/asm-alpha/ide.h
3 *
4 * Copyright (C) 1994-1996 Linus Torvalds & authors
5 */
6
7 /*
8 * This file contains the alpha architecture specific IDE code.
9 */
10
11 #ifndef __ASMalpha_IDE_H
12 #define __ASMalpha_IDE_H
13
14 #ifdef __KERNEL__
15
16 #include <linux/config.h>
17
18 #ifndef MAX_HWIFS
19 #define MAX_HWIFS 4
20 #endif
21
ide_default_irq(ide_ioreg_t base)22 static __inline__ int ide_default_irq(ide_ioreg_t base)
23 {
24 switch (base) {
25 case 0x1f0: return 14;
26 case 0x170: return 15;
27 case 0x1e8: return 11;
28 case 0x168: return 10;
29 default:
30 return 0;
31 }
32 }
33
ide_default_io_base(int index)34 static __inline__ ide_ioreg_t ide_default_io_base(int index)
35 {
36 switch (index) {
37 case 0: return 0x1f0;
38 case 1: return 0x170;
39 case 2: return 0x1e8;
40 case 3: return 0x168;
41 default:
42 return 0;
43 }
44 }
45
ide_init_hwif_ports(hw_regs_t * hw,ide_ioreg_t data_port,ide_ioreg_t ctrl_port,int * irq)46 static __inline__ void ide_init_hwif_ports(hw_regs_t *hw, ide_ioreg_t data_port, ide_ioreg_t ctrl_port, int *irq)
47 {
48 ide_ioreg_t reg = data_port;
49 int i;
50
51 for (i = IDE_DATA_OFFSET; i <= IDE_STATUS_OFFSET; i++) {
52 hw->io_ports[i] = reg;
53 reg += 1;
54 }
55 if (ctrl_port) {
56 hw->io_ports[IDE_CONTROL_OFFSET] = ctrl_port;
57 } else {
58 hw->io_ports[IDE_CONTROL_OFFSET] = hw->io_ports[IDE_DATA_OFFSET] + 0x206;
59 }
60 if (irq != NULL)
61 *irq = 0;
62 hw->io_ports[IDE_IRQ_OFFSET] = 0;
63 }
64
65 /*
66 * This registers the standard ports for this architecture with the IDE
67 * driver.
68 */
ide_init_default_hwifs(void)69 static __inline__ void ide_init_default_hwifs(void)
70 {
71 #ifndef CONFIG_BLK_DEV_IDEPCI
72 hw_regs_t hw;
73 int index;
74
75 for (index = 0; index < MAX_HWIFS; index++) {
76 ide_init_hwif_ports(&hw, ide_default_io_base(index), 0, NULL);
77 hw.irq = ide_default_irq(ide_default_io_base(index));
78 ide_register_hw(&hw, NULL);
79 }
80 #endif /* CONFIG_BLK_DEV_IDEPCI */
81 }
82
83 #include <asm-generic/ide_iops.h>
84
85 #endif /* __KERNEL__ */
86
87 #endif /* __ASMalpha_IDE_H */
88