File: /usr/src/linux/include/asm-alpha/ide.h

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     
22     #define ide__sti()	__sti()
23     
24     static __inline__ int ide_default_irq(ide_ioreg_t base)
25     {
26     	switch (base) {
27     		case 0x1f0: return 14;
28     		case 0x170: return 15;
29     		case 0x1e8: return 11;
30     		case 0x168: return 10;
31     		default:
32     			return 0;
33     	}
34     }
35     
36     static __inline__ ide_ioreg_t ide_default_io_base(int index)
37     {
38     	switch (index) {
39     		case 0:	return 0x1f0;
40     		case 1:	return 0x170;
41     		case 2: return 0x1e8;
42     		case 3: return 0x168;
43     		default:
44     			return 0;
45     	}
46     }
47     
48     static __inline__ void ide_init_hwif_ports(hw_regs_t *hw, ide_ioreg_t data_port, ide_ioreg_t ctrl_port, int *irq)
49     {
50     	ide_ioreg_t reg = data_port;
51     	int i;
52     
53     	for (i = IDE_DATA_OFFSET; i <= IDE_STATUS_OFFSET; i++) {
54     		hw->io_ports[i] = reg;
55     		reg += 1;
56     	}
57     	if (ctrl_port) {
58     		hw->io_ports[IDE_CONTROL_OFFSET] = ctrl_port;
59     	} else {
60     		hw->io_ports[IDE_CONTROL_OFFSET] = hw->io_ports[IDE_DATA_OFFSET] + 0x206;
61     	}
62     	if (irq != NULL)
63     		*irq = 0;
64     	hw->io_ports[IDE_IRQ_OFFSET] = 0;
65     }
66     
67     /*
68      * This registers the standard ports for this architecture with the IDE
69      * driver.
70      */
71     static __inline__ void ide_init_default_hwifs(void)
72     {
73     #ifndef CONFIG_BLK_DEV_IDEPCI
74     	hw_regs_t hw;
75     	int index;
76     
77     	for (index = 0; index < MAX_HWIFS; index++) {
78     		ide_init_hwif_ports(&hw, ide_default_io_base(index), 0, NULL);
79     		hw.irq = ide_default_irq(ide_default_io_base(index));
80     		ide_register_hw(&hw, NULL);
81     	}
82     #endif /* CONFIG_BLK_DEV_IDEPCI */
83     }
84     
85     typedef union {
86     	unsigned all			: 8;	/* all of the bits together */
87     	struct {
88     		unsigned head		: 4;	/* always zeros here */
89     		unsigned unit		: 1;	/* drive select number, 0 or 1 */
90     		unsigned bit5		: 1;	/* always 1 */
91     		unsigned lba		: 1;	/* using LBA instead of CHS */
92     		unsigned bit7		: 1;	/* always 1 */
93     	} b;
94     	} select_t;
95     
96     #define ide_request_irq(irq,hand,flg,dev,id)	request_irq((irq),(hand),(flg),(dev),(id))
97     #define ide_free_irq(irq,dev_id)		free_irq((irq), (dev_id))
98     #define ide_check_region(from,extent)		check_region((from), (extent))
99     #define ide_request_region(from,extent,name)	request_region((from), (extent), (name))
100     #define ide_release_region(from,extent)		release_region((from), (extent))
101     
102     /*
103      * The following are not needed for the non-m68k ports
104      */
105     #define ide_ack_intr(hwif)		(1)
106     #define ide_fix_driveid(id)		do {} while (0)
107     #define ide_release_lock(lock)		do {} while (0)
108     #define ide_get_lock(lock, hdlr, data)	do {} while (0)
109     
110     #endif /* __KERNEL__ */
111     
112     #endif /* __ASMalpha_IDE_H */
113