Subversion Repositories shark

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
424 giacomo 1
/*
2
 *  include/asm-i386/mach-default/mach_resources.h
3
 *
4
 *  Machine specific resource allocation for generic.
5
 *  Split out from setup.c by Osamu Tomita <tomita@cinet.co.jp>
6
 */
7
#ifndef _MACH_RESOURCES_H
8
#define _MACH_RESOURCES_H
9
 
10
struct resource standard_io_resources[] = {
11
        { "dma1", 0x00, 0x1f, IORESOURCE_BUSY },
12
        { "pic1", 0x20, 0x21, IORESOURCE_BUSY },
13
        { "timer", 0x40, 0x5f, IORESOURCE_BUSY },
14
        { "keyboard", 0x60, 0x6f, IORESOURCE_BUSY },
15
        { "dma page reg", 0x80, 0x8f, IORESOURCE_BUSY },
16
        { "pic2", 0xa0, 0xa1, IORESOURCE_BUSY },
17
        { "dma2", 0xc0, 0xdf, IORESOURCE_BUSY },
18
        { "fpu", 0xf0, 0xff, IORESOURCE_BUSY }
19
};
20
 
21
#define STANDARD_IO_RESOURCES (sizeof(standard_io_resources)/sizeof(struct resource))
22
 
23
static struct resource vram_resource = { "Video RAM area", 0xa0000, 0xbffff, IORESOURCE_BUSY };
24
 
25
/* System ROM resources */
26
#define MAXROMS 6
27
static struct resource rom_resources[MAXROMS] = {
28
        { "System ROM", 0xF0000, 0xFFFFF, IORESOURCE_BUSY },
29
        { "Video ROM", 0xc0000, 0xc7fff, IORESOURCE_BUSY }
30
};
31
 
32
#define romsignature(x) (*(unsigned short *)(x) == 0xaa55)
33
 
34
static inline void probe_video_rom(int roms)
35
{
36
        unsigned long base;
37
        unsigned char *romstart;
38
 
39
 
40
        /* Video ROM is standard at C000:0000 - C7FF:0000, check signature */
41
        for (base = 0xC0000; base < 0xE0000; base += 2048) {
42
                romstart = isa_bus_to_virt(base);
43
                if (!romsignature(romstart))
44
                        continue;
45
                request_resource(&iomem_resource, rom_resources + roms);
46
                roms++;
47
                break;
48
        }
49
}
50
 
51
static inline void probe_extension_roms(int roms)
52
{
53
        unsigned long base;
54
        unsigned char *romstart;
55
 
56
        /* Extension roms at C800:0000 - DFFF:0000 */
57
        for (base = 0xC8000; base < 0xE0000; base += 2048) {
58
                unsigned long length;
59
 
60
                romstart = isa_bus_to_virt(base);
61
                if (!romsignature(romstart))
62
                        continue;
63
                length = romstart[2] * 512;
64
                if (length) {
65
                        unsigned int i;
66
                        unsigned char chksum;
67
 
68
                        chksum = 0;
69
                        for (i = 0; i < length; i++)
70
                                chksum += romstart[i];
71
 
72
                        /* Good checksum? */
73
                        if (!chksum) {
74
                                rom_resources[roms].start = base;
75
                                rom_resources[roms].end = base + length - 1;
76
                                rom_resources[roms].name = "Extension ROM";
77
                                rom_resources[roms].flags = IORESOURCE_BUSY;
78
 
79
                                request_resource(&iomem_resource, rom_resources + roms);
80
                                roms++;
81
                                if (roms >= MAXROMS)
82
                                        return;
83
                        }
84
                }
85
        }
86
 
87
        /* Final check for motherboard extension rom at E000:0000 */
88
        base = 0xE0000;
89
        romstart = isa_bus_to_virt(base);
90
 
91
        if (romsignature(romstart)) {
92
                rom_resources[roms].start = base;
93
                rom_resources[roms].end = base + 65535;
94
                rom_resources[roms].name = "Extension ROM";
95
                rom_resources[roms].flags = IORESOURCE_BUSY;
96
 
97
                request_resource(&iomem_resource, rom_resources + roms);
98
        }
99
}
100
 
101
static inline void request_graphics_resource(void)
102
{
103
        request_resource(&iomem_resource, &vram_resource);
104
}
105
 
106
#endif /* !_MACH_RESOURCES_H */