Subversion Repositories shark

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
424 giacomo 1
/*
2
 *  include/asm-i386/mach-pc9800/mach_resources.h
3
 *
4
 *  Machine specific resource allocation for PC-9800.
5
 *  Written by Osamu Tomita <tomita@cinet.co.jp>
6
 */
7
#ifndef _MACH_RESOURCES_H
8
#define _MACH_RESOURCES_H
9
 
10
static char str_pic1[] = "pic1";
11
static char str_dma[] = "dma";
12
static char str_pic2[] = "pic2";
13
static char str_calender_clock[] = "calender clock";
14
static char str_system[] = "system";
15
static char str_nmi_control[] = "nmi control";
16
static char str_kanji_rom[] = "kanji rom";
17
static char str_keyboard[] = "keyboard";
18
static char str_text_gdc[] = "text gdc";
19
static char str_crtc[] = "crtc";
20
static char str_timer[] = "timer";
21
static char str_graphic_gdc[] = "graphic gdc";
22
static char str_dma_ex_bank[] = "dma ex. bank";
23
static char str_beep_freq[] = "beep freq.";
24
static char str_mouse_pio[] = "mouse pio";
25
struct resource standard_io_resources[] = {
26
        { str_pic1, 0x00, 0x00, IORESOURCE_BUSY },
27
        { str_dma, 0x01, 0x01, IORESOURCE_BUSY },
28
        { str_pic1, 0x02, 0x02, IORESOURCE_BUSY },
29
        { str_dma, 0x03, 0x03, IORESOURCE_BUSY },
30
        { str_dma, 0x05, 0x05, IORESOURCE_BUSY },
31
        { str_dma, 0x07, 0x07, IORESOURCE_BUSY },
32
        { str_pic2, 0x08, 0x08, IORESOURCE_BUSY },
33
        { str_dma, 0x09, 0x09, IORESOURCE_BUSY },
34
        { str_pic2, 0x0a, 0x0a, IORESOURCE_BUSY },
35
        { str_dma, 0x0b, 0x0b, IORESOURCE_BUSY },
36
        { str_dma, 0x0d, 0x0d, IORESOURCE_BUSY },
37
        { str_dma, 0x0f, 0x0f, IORESOURCE_BUSY },
38
        { str_dma, 0x11, 0x11, IORESOURCE_BUSY },
39
        { str_dma, 0x13, 0x13, IORESOURCE_BUSY },
40
        { str_dma, 0x15, 0x15, IORESOURCE_BUSY },
41
        { str_dma, 0x17, 0x17, IORESOURCE_BUSY },
42
        { str_dma, 0x19, 0x19, IORESOURCE_BUSY },
43
        { str_dma, 0x1b, 0x1b, IORESOURCE_BUSY },
44
        { str_dma, 0x1d, 0x1d, IORESOURCE_BUSY },
45
        { str_dma, 0x1f, 0x1f, IORESOURCE_BUSY },
46
        { str_calender_clock, 0x20, 0x20, 0 },
47
        { str_dma, 0x21, 0x21, IORESOURCE_BUSY },
48
        { str_calender_clock, 0x22, 0x22, 0 },
49
        { str_dma, 0x23, 0x23, IORESOURCE_BUSY },
50
        { str_dma, 0x25, 0x25, IORESOURCE_BUSY },
51
        { str_dma, 0x27, 0x27, IORESOURCE_BUSY },
52
        { str_dma, 0x29, 0x29, IORESOURCE_BUSY },
53
        { str_dma, 0x2b, 0x2b, IORESOURCE_BUSY },
54
        { str_dma, 0x2d, 0x2d, IORESOURCE_BUSY },
55
        { str_system, 0x31, 0x31, IORESOURCE_BUSY },
56
        { str_system, 0x33, 0x33, IORESOURCE_BUSY },
57
        { str_system, 0x35, 0x35, IORESOURCE_BUSY },
58
        { str_system, 0x37, 0x37, IORESOURCE_BUSY },
59
        { str_nmi_control, 0x50, 0x50, IORESOURCE_BUSY },
60
        { str_nmi_control, 0x52, 0x52, IORESOURCE_BUSY },
61
        { "time stamp", 0x5c, 0x5f, IORESOURCE_BUSY },
62
        { str_kanji_rom, 0xa1, 0xa1, IORESOURCE_BUSY },
63
        { str_kanji_rom, 0xa3, 0xa3, IORESOURCE_BUSY },
64
        { str_kanji_rom, 0xa5, 0xa5, IORESOURCE_BUSY },
65
        { str_kanji_rom, 0xa7, 0xa7, IORESOURCE_BUSY },
66
        { str_kanji_rom, 0xa9, 0xa9, IORESOURCE_BUSY },
67
        { str_keyboard, 0x41, 0x41, IORESOURCE_BUSY },
68
        { str_keyboard, 0x43, 0x43, IORESOURCE_BUSY },
69
        { str_text_gdc, 0x60, 0x60, IORESOURCE_BUSY },
70
        { str_text_gdc, 0x62, 0x62, IORESOURCE_BUSY },
71
        { str_text_gdc, 0x64, 0x64, IORESOURCE_BUSY },
72
        { str_text_gdc, 0x66, 0x66, IORESOURCE_BUSY },
73
        { str_text_gdc, 0x68, 0x68, IORESOURCE_BUSY },
74
        { str_text_gdc, 0x6a, 0x6a, IORESOURCE_BUSY },
75
        { str_text_gdc, 0x6c, 0x6c, IORESOURCE_BUSY },
76
        { str_text_gdc, 0x6e, 0x6e, IORESOURCE_BUSY },
77
        { str_crtc, 0x70, 0x70, IORESOURCE_BUSY },
78
        { str_crtc, 0x72, 0x72, IORESOURCE_BUSY },
79
        { str_crtc, 0x74, 0x74, IORESOURCE_BUSY },
80
        { str_crtc, 0x74, 0x74, IORESOURCE_BUSY },
81
        { str_crtc, 0x76, 0x76, IORESOURCE_BUSY },
82
        { str_crtc, 0x78, 0x78, IORESOURCE_BUSY },
83
        { str_crtc, 0x7a, 0x7a, IORESOURCE_BUSY },
84
        { str_timer, 0x71, 0x71, IORESOURCE_BUSY },
85
        { str_timer, 0x73, 0x73, IORESOURCE_BUSY },
86
        { str_timer, 0x75, 0x75, IORESOURCE_BUSY },
87
        { str_timer, 0x77, 0x77, IORESOURCE_BUSY },
88
        { str_graphic_gdc, 0xa0, 0xa0, IORESOURCE_BUSY },
89
        { str_graphic_gdc, 0xa2, 0xa2, IORESOURCE_BUSY },
90
        { str_graphic_gdc, 0xa4, 0xa4, IORESOURCE_BUSY },
91
        { str_graphic_gdc, 0xa6, 0xa6, IORESOURCE_BUSY },
92
        { "cpu", 0xf0, 0xf7, IORESOURCE_BUSY },
93
        { "fpu", 0xf8, 0xff, IORESOURCE_BUSY },
94
        { str_dma_ex_bank, 0x0e05, 0x0e05, 0 },
95
        { str_dma_ex_bank, 0x0e07, 0x0e07, 0 },
96
        { str_dma_ex_bank, 0x0e09, 0x0e09, 0 },
97
        { str_dma_ex_bank, 0x0e0b, 0x0e0b, 0 },
98
        { str_beep_freq, 0x3fd9, 0x3fd9, IORESOURCE_BUSY },
99
        { str_beep_freq, 0x3fdb, 0x3fdb, IORESOURCE_BUSY },
100
        { str_beep_freq, 0x3fdd, 0x3fdd, IORESOURCE_BUSY },
101
        { str_beep_freq, 0x3fdf, 0x3fdf, IORESOURCE_BUSY },
102
        /* All PC-9800 have (exactly) one mouse interface.  */
103
        { str_mouse_pio, 0x7fd9, 0x7fd9, 0 },
104
        { str_mouse_pio, 0x7fdb, 0x7fdb, 0 },
105
        { str_mouse_pio, 0x7fdd, 0x7fdd, 0 },
106
        { str_mouse_pio, 0x7fdf, 0x7fdf, 0 },
107
        { "mouse timer", 0xbfdb, 0xbfdb, 0 },
108
        { "mouse irq", 0x98d7, 0x98d7, 0 },
109
};
110
 
111
#define STANDARD_IO_RESOURCES (sizeof(standard_io_resources)/sizeof(struct resource))
112
 
113
static struct resource tvram_resource = { "Text VRAM/CG window", 0xa0000, 0xa4fff, IORESOURCE_BUSY };
114
static struct resource gvram_brg_resource = { "Graphic VRAM (B/R/G)", 0xa8000, 0xbffff, IORESOURCE_BUSY };
115
static struct resource gvram_e_resource = { "Graphic VRAM (E)", 0xe0000, 0xe7fff, IORESOURCE_BUSY };
116
 
117
/* System ROM resources */
118
#define MAXROMS 6
119
static struct resource rom_resources[MAXROMS] = {
120
        { "System ROM", 0xe8000, 0xfffff, IORESOURCE_BUSY }
121
};
122
 
123
static inline void probe_video_rom(int roms)
124
{
125
        /* PC-9800 has no video ROM */
126
}
127
 
128
static inline void probe_extension_roms(int roms)
129
{
130
        int i;
131
        __u8 *xrom_id;
132
 
133
        xrom_id = (__u8 *) isa_bus_to_virt(PC9800SCA_XROM_ID + 0x10);
134
 
135
        for (i = 0; i < 16; i++) {
136
                if (xrom_id[i] & 0x80) {
137
                        int j;
138
 
139
                        for (j = i + 1; j < 16 && (xrom_id[j] & 0x80); j++)
140
                                ;
141
                        rom_resources[roms].start = 0x0d0000 + i * 0x001000;
142
                        rom_resources[roms].end = 0x0d0000 + j * 0x001000 - 1;
143
                        rom_resources[roms].name = "Extension ROM";
144
                        rom_resources[roms].flags = IORESOURCE_BUSY;
145
 
146
                        request_resource(&iomem_resource,
147
                                          rom_resources + roms);
148
                        if (++roms >= MAXROMS)
149
                                return;
150
                }
151
        }
152
}
153
 
154
static inline void request_graphics_resource(void)
155
{
156
        int i;
157
 
158
        if (PC9800_HIGHRESO_P()) {
159
                tvram_resource.start = 0xe0000;
160
                tvram_resource.end   = 0xe4fff;
161
                gvram_brg_resource.name  = "Graphic VRAM";
162
                gvram_brg_resource.start = 0xc0000;
163
                gvram_brg_resource.end   = 0xdffff;
164
        }
165
 
166
        request_resource(&iomem_resource, &tvram_resource);
167
        request_resource(&iomem_resource, &gvram_brg_resource);
168
        if (!PC9800_HIGHRESO_P())
169
                request_resource(&iomem_resource, &gvram_e_resource);
170
 
171
        if (PC9800_HIGHRESO_P() || PC9800_9821_P()) {
172
                static char graphics[] = "graphics";
173
                static struct resource graphics_resources[] = {
174
                        { graphics, 0x9a0, 0x9a0, 0 },
175
                        { graphics, 0x9a2, 0x9a2, 0 },
176
                        { graphics, 0x9a4, 0x9a4, 0 },
177
                        { graphics, 0x9a6, 0x9a6, 0 },
178
                        { graphics, 0x9a8, 0x9a8, 0 },
179
                        { graphics, 0x9aa, 0x9aa, 0 },
180
                        { graphics, 0x9ac, 0x9ac, 0 },
181
                        { graphics, 0x9ae, 0x9ae, 0 },
182
                };
183
 
184
#define GRAPHICS_RESOURCES (sizeof(graphics_resources)/sizeof(struct resource))
185
 
186
                for (i = 0; i < GRAPHICS_RESOURCES; i++)
187
                        request_resource(&ioport_resource, graphics_resources + i);
188
        }
189
}
190
 
191
#endif /* !_MACH_RESOURCES_H */