ia64/xen-unstable

view xenolinux-2.4.21-pre4-sparse/include/asm-xeno/ide.h @ 235:d7d0a23b2e07

bitkeeper revision 1.93 (3e5a4e6bkPheUp3x1uufN2MS3LAB7A)

Latest and Greatest version of XenoLinux based on the Linux-2.4.21-pre4
kernel.
author iap10@labyrinth.cl.cam.ac.uk
date Mon Feb 24 16:55:07 2003 +0000 (2003-02-24)
parents
children
line source
1 /*
2 * linux/include/asm-i386/ide.h
3 *
4 * Copyright (C) 1994-1996 Linus Torvalds & authors
5 */
7 /*
8 * This file contains the i386 architecture specific IDE code.
9 */
11 #ifndef __ASMi386_IDE_H
12 #define __ASMi386_IDE_H
14 #ifdef __KERNEL__
16 #include <linux/config.h>
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
26 static __inline__ int ide_default_irq(ide_ioreg_t base)
27 {
28 switch (base) {
29 case 0x1f0: return 14;
30 case 0x170: return 15;
31 case 0x1e8: return 11;
32 case 0x168: return 10;
33 case 0x1e0: return 8;
34 case 0x160: return 12;
35 default:
36 return 0;
37 }
38 }
40 static __inline__ ide_ioreg_t ide_default_io_base(int index)
41 {
42 switch (index) {
43 case 0: return 0x1f0;
44 case 1: return 0x170;
45 case 2: return 0x1e8;
46 case 3: return 0x168;
47 case 4: return 0x1e0;
48 case 5: return 0x160;
49 default:
50 return 0;
51 }
52 }
54 static __inline__ void ide_init_hwif_ports(hw_regs_t *hw, ide_ioreg_t data_port, ide_ioreg_t ctrl_port, int *irq)
55 {
56 ide_ioreg_t reg = data_port;
57 int i;
59 for (i = IDE_DATA_OFFSET; i <= IDE_STATUS_OFFSET; i++) {
60 hw->io_ports[i] = reg;
61 reg += 1;
62 }
63 if (ctrl_port) {
64 hw->io_ports[IDE_CONTROL_OFFSET] = ctrl_port;
65 } else {
66 hw->io_ports[IDE_CONTROL_OFFSET] = hw->io_ports[IDE_DATA_OFFSET] + 0x206;
67 }
68 if (irq != NULL)
69 *irq = 0;
70 hw->io_ports[IDE_IRQ_OFFSET] = 0;
71 }
73 static __inline__ void ide_init_default_hwifs(void)
74 {
75 #ifndef CONFIG_BLK_DEV_IDEPCI
76 hw_regs_t hw;
77 int index;
79 for(index = 0; index < MAX_HWIFS; index++) {
80 memset(&hw, 0, sizeof hw);
81 ide_init_hwif_ports(&hw, ide_default_io_base(index), 0, NULL);
82 hw.irq = ide_default_irq(ide_default_io_base(index));
83 ide_register_hw(&hw, NULL);
84 }
85 #endif /* CONFIG_BLK_DEV_IDEPCI */
86 }
88 #include <asm-generic/ide_iops.h>
90 #endif /* __KERNEL__ */
92 #endif /* __ASMi386_IDE_H */