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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [linux/] [linux-2.4/] [include/] [asm-sh/] [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-sh/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
 *  In future, SuperH code.
10
 */
11
 
12
#ifndef __ASM_SH_IDE_H
13
#define __ASM_SH_IDE_H
14
 
15
#ifdef __KERNEL__
16
 
17
#include <linux/config.h>
18
#include <asm-generic/ide_iops.h>
19
#include <asm/machvec.h>
20
 
21
#ifndef MAX_HWIFS
22
/* Should never have fewer than 2, ide-pci.c(ide_match_hwif) requires it */
23
#define MAX_HWIFS       4
24
#endif
25
 
26
static __inline__ int ide_default_irq_hs7729pci(ide_ioreg_t base)
27
{
28
        switch (base) {
29
                case 0x01f0: return 9;
30
                case 0x0170: return 14;
31
                default:
32
                        return 0;
33
        }
34
}
35
 
36
static __inline__ int ide_default_irq_hp600(ide_ioreg_t base)
37
{
38
        switch (base) {
39
                case 0x01f0: return 93;
40
                case 0x0170: return 94;
41
                default:
42
                        return 0;
43
        }
44
}
45
 
46
static __inline__ int ide_default_irq(ide_ioreg_t base)
47
{
48
        if (MACH_HP600) {
49
                return ide_default_irq_hp600(base);
50
        }
51
        if (MACH_HS7729PCI) {
52
                return ide_default_irq_hs7729pci(base);
53
        }
54
        switch (base) {
55
                case 0x01f0: return 14;
56
                case 0x0170: return 15;
57
                default:
58
                        return 0;
59
        }
60
}
61
 
62
static __inline__ ide_ioreg_t ide_default_io_base_hp600(int index)
63
{
64
        switch (index) {
65
                case 0:
66
                        return 0x01f0;
67
                case 1:
68
                        return 0x0170;
69
                default:
70
                        return 0;
71
        }
72
}
73
 
74
static __inline__ ide_ioreg_t ide_default_io_base(int index)
75
{
76
        if (MACH_HP600) {
77
                return ide_default_io_base_hp600(index);
78
        }
79
        switch (index) {
80
                case 0:
81
                        return 0x1f0;
82
                case 1:
83
                        return 0x170;
84
                default:
85
                        return 0;
86
        }
87
}
88
 
89
static __inline__ void ide_init_hwif_ports(hw_regs_t *hw, ide_ioreg_t data_port, ide_ioreg_t ctrl_port, int *irq)
90
{
91
        ide_ioreg_t reg = data_port;
92
        int i;
93
 
94
        for (i = IDE_DATA_OFFSET; i <= IDE_STATUS_OFFSET; i++) {
95
                hw->io_ports[i] = reg;
96
                reg += 1;
97
        }
98
        if (ctrl_port) {
99
                hw->io_ports[IDE_CONTROL_OFFSET] = ctrl_port;
100
        } else {
101
                hw->io_ports[IDE_CONTROL_OFFSET] = hw->io_ports[IDE_DATA_OFFSET] + 0x206;
102
        }
103
        if (irq != NULL)
104
                *irq = 0;
105
        hw->io_ports[IDE_IRQ_OFFSET] = 0;
106
}
107
 
108
static __inline__ void ide_init_default_hwifs(void)
109
{
110
#ifndef CONFIG_BLK_DEV_IDEPCI
111
        hw_regs_t hw;
112
        int index;
113
 
114
        for(index = 0; index < MAX_HWIFS; index++) {
115
                memset(&hw, 0, sizeof hw);
116
                ide_init_hwif_ports(&hw, ide_default_io_base(index), 0, NULL);
117
                hw.irq = ide_default_irq(ide_default_io_base(index));
118
                ide_register_hw(&hw, NULL);
119
        }
120
#endif /* CONFIG_BLK_DEV_IDEPCI */
121
}
122
 
123
#endif /* __KERNEL__ */
124
 
125
#endif /* __ASM_SH_IDE_H */

powered by: WebSVN 2.1.0

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