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

Subversion Repositories or1k_soc_on_altera_embedded_dev_kit

[/] [or1k_soc_on_altera_embedded_dev_kit/] [trunk/] [linux-2.6/] [linux-2.6.24/] [arch/] [x86/] [mach-voyager/] [setup.c] - Blame information for rev 3

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 3 xianfeng
/*
2
 *      Machine specific setup for generic
3
 */
4
 
5
#include <linux/init.h>
6
#include <linux/interrupt.h>
7
#include <asm/arch_hooks.h>
8
#include <asm/voyager.h>
9
#include <asm/e820.h>
10
#include <asm/io.h>
11
#include <asm/setup.h>
12
 
13
void __init pre_intr_init_hook(void)
14
{
15
        init_ISA_irqs();
16
}
17
 
18
/*
19
 * IRQ2 is cascade interrupt to second interrupt controller
20
 */
21
static struct irqaction irq2 = {
22
        .handler = no_action,
23
        .mask = CPU_MASK_NONE,
24
        .name = "cascade",
25
};
26
 
27
void __init intr_init_hook(void)
28
{
29
#ifdef CONFIG_SMP
30
        smp_intr_init();
31
#endif
32
 
33
        setup_irq(2, &irq2);
34
}
35
 
36
void __init pre_setup_arch_hook(void)
37
{
38
        /* Voyagers run their CPUs from independent clocks, so disable
39
         * the TSC code because we can't sync them */
40
        tsc_disable = 1;
41
}
42
 
43
void __init trap_init_hook(void)
44
{
45
}
46
 
47
static struct irqaction irq0  = {
48
        .handler = timer_interrupt,
49
        .flags = IRQF_DISABLED | IRQF_NOBALANCING | IRQF_IRQPOLL,
50
        .mask = CPU_MASK_NONE,
51
        .name = "timer"
52
};
53
 
54
void __init time_init_hook(void)
55
{
56
        irq0.mask = cpumask_of_cpu(safe_smp_processor_id());
57
        setup_irq(0, &irq0);
58
}
59
 
60
/* Hook for machine specific memory setup. */
61
 
62
char * __init machine_specific_memory_setup(void)
63
{
64
        char *who;
65
 
66
        who = "NOT VOYAGER";
67
 
68
        if(voyager_level == 5) {
69
                __u32 addr, length;
70
                int i;
71
 
72
                who = "Voyager-SUS";
73
 
74
                e820.nr_map = 0;
75
                for(i=0; voyager_memory_detect(i, &addr, &length); i++) {
76
                        add_memory_region(addr, length, E820_RAM);
77
                }
78
                return who;
79
        } else if(voyager_level == 4) {
80
                __u32 tom;
81
                __u16 catbase = inb(VOYAGER_SSPB_RELOCATION_PORT)<<8;
82
                /* select the DINO config space */
83
                outb(VOYAGER_DINO, VOYAGER_CAT_CONFIG_PORT);
84
                /* Read DINO top of memory register */
85
                tom = ((inb(catbase + 0x4) & 0xf0) << 16)
86
                        + ((inb(catbase + 0x5) & 0x7f) << 24);
87
 
88
                if(inb(catbase) != VOYAGER_DINO) {
89
                        printk(KERN_ERR "Voyager: Failed to get DINO for L4, setting tom to EXT_MEM_K\n");
90
                        tom = (boot_params.screen_info.ext_mem_k)<<10;
91
                }
92
                who = "Voyager-TOM";
93
                add_memory_region(0, 0x9f000, E820_RAM);
94
                /* map from 1M to top of memory */
95
                add_memory_region(1*1024*1024, tom - 1*1024*1024, E820_RAM);
96
                /* FIXME: Should check the ASICs to see if I need to
97
                 * take out the 8M window.  Just do it at the moment
98
                 * */
99
                add_memory_region(8*1024*1024, 8*1024*1024, E820_RESERVED);
100
                return who;
101
        }
102
 
103
        who = "BIOS-e820";
104
 
105
        /*
106
         * Try to copy the BIOS-supplied E820-map.
107
         *
108
         * Otherwise fake a memory map; one section from 0k->640k,
109
         * the next section from 1mb->appropriate_mem_k
110
         */
111
        sanitize_e820_map(boot_params.e820_map, &boot_params.e820_entries);
112
        if (copy_e820_map(boot_params.e820_map, boot_params.e820_entries)
113
            < 0) {
114
                unsigned long mem_size;
115
 
116
                /* compare results from other methods and take the greater */
117
                if (boot_params.alt_mem_k
118
                    < boot_params.screen_info.ext_mem_k) {
119
                        mem_size = boot_params.screen_info.ext_mem_k;
120
                        who = "BIOS-88";
121
                } else {
122
                        mem_size = boot_params.alt_mem_k;
123
                        who = "BIOS-e801";
124
                }
125
 
126
                e820.nr_map = 0;
127
                add_memory_region(0, LOWMEMSIZE(), E820_RAM);
128
                add_memory_region(HIGH_MEMORY, mem_size << 10, E820_RAM);
129
        }
130
        return who;
131
}

powered by: WebSVN 2.1.0

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