OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [linux/] [linux-2.4/] [include/] [asm-i386/] [ide.h] - Blame information for rev 1774

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1275 phoenix
/*
2
 *  linux/include/asm-i386/ide.h
3
 *
4
 *  Copyright (C) 1994-1996  Linus Torvalds & authors
5
 */
6
 
7
/*
8
 *  This file contains the i386 architecture specific IDE code.
9
 */
10
 
11
#ifndef __ASMi386_IDE_H
12
#define __ASMi386_IDE_H
13
 
14
#ifdef __KERNEL__
15
 
16
#include <linux/config.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
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
}
39
 
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
}
53
 
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;
58
 
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
}
72
 
73
static __inline__ void ide_init_default_hwifs(void)
74
{
75
#ifndef CONFIG_BLK_DEV_IDEPCI
76
        hw_regs_t hw;
77
        int index;
78
 
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
}
87
 
88
#include <asm-generic/ide_iops.h>
89
 
90
#endif /* __KERNEL__ */
91
 
92
#endif /* __ASMi386_IDE_H */

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.