diff options
Diffstat (limited to 'arch/mips/loongson/common/env.c')
-rw-r--r-- | arch/mips/loongson/common/env.c | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/arch/mips/loongson/common/env.c b/arch/mips/loongson/common/env.c index f15228550a22..045ea3d47c87 100644 --- a/arch/mips/loongson/common/env.c +++ b/arch/mips/loongson/common/env.c | |||
@@ -21,6 +21,7 @@ | |||
21 | #include <asm/bootinfo.h> | 21 | #include <asm/bootinfo.h> |
22 | #include <loongson.h> | 22 | #include <loongson.h> |
23 | #include <boot_param.h> | 23 | #include <boot_param.h> |
24 | #include <workarounds.h> | ||
24 | 25 | ||
25 | u32 cpu_clock_freq; | 26 | u32 cpu_clock_freq; |
26 | EXPORT_SYMBOL(cpu_clock_freq); | 27 | EXPORT_SYMBOL(cpu_clock_freq); |
@@ -31,7 +32,6 @@ u64 loongson_chipcfg[MAX_PACKAGES] = {0xffffffffbfc00180}; | |||
31 | u64 loongson_freqctrl[MAX_PACKAGES]; | 32 | u64 loongson_freqctrl[MAX_PACKAGES]; |
32 | 33 | ||
33 | unsigned long long smp_group[4]; | 34 | unsigned long long smp_group[4]; |
34 | int cpuhotplug_workaround = 0; | ||
35 | 35 | ||
36 | #define parse_even_earlier(res, option, p) \ | 36 | #define parse_even_earlier(res, option, p) \ |
37 | do { \ | 37 | do { \ |
@@ -67,6 +67,7 @@ void __init prom_init_env(void) | |||
67 | #else | 67 | #else |
68 | struct boot_params *boot_p; | 68 | struct boot_params *boot_p; |
69 | struct loongson_params *loongson_p; | 69 | struct loongson_params *loongson_p; |
70 | struct system_loongson *esys; | ||
70 | struct efi_cpuinfo_loongson *ecpu; | 71 | struct efi_cpuinfo_loongson *ecpu; |
71 | struct irq_source_routing_table *eirq_source; | 72 | struct irq_source_routing_table *eirq_source; |
72 | 73 | ||
@@ -74,6 +75,8 @@ void __init prom_init_env(void) | |||
74 | boot_p = (struct boot_params *)fw_arg2; | 75 | boot_p = (struct boot_params *)fw_arg2; |
75 | loongson_p = &(boot_p->efi.smbios.lp); | 76 | loongson_p = &(boot_p->efi.smbios.lp); |
76 | 77 | ||
78 | esys = (struct system_loongson *) | ||
79 | ((u64)loongson_p + loongson_p->system_offset); | ||
77 | ecpu = (struct efi_cpuinfo_loongson *) | 80 | ecpu = (struct efi_cpuinfo_loongson *) |
78 | ((u64)loongson_p + loongson_p->cpu_offset); | 81 | ((u64)loongson_p + loongson_p->cpu_offset); |
79 | eirq_source = (struct irq_source_routing_table *) | 82 | eirq_source = (struct irq_source_routing_table *) |
@@ -95,6 +98,7 @@ void __init prom_init_env(void) | |||
95 | loongson_chipcfg[2] = 0x900020001fe00180; | 98 | loongson_chipcfg[2] = 0x900020001fe00180; |
96 | loongson_chipcfg[3] = 0x900030001fe00180; | 99 | loongson_chipcfg[3] = 0x900030001fe00180; |
97 | loongson_sysconf.ht_control_base = 0x90000EFDFB000000; | 100 | loongson_sysconf.ht_control_base = 0x90000EFDFB000000; |
101 | loongson_sysconf.workarounds = WORKAROUND_CPUFREQ; | ||
98 | } else if (ecpu->cputype == Loongson_3B) { | 102 | } else if (ecpu->cputype == Loongson_3B) { |
99 | loongson_sysconf.cores_per_node = 4; /* One chip has 2 nodes */ | 103 | loongson_sysconf.cores_per_node = 4; /* One chip has 2 nodes */ |
100 | loongson_sysconf.cores_per_package = 8; | 104 | loongson_sysconf.cores_per_package = 8; |
@@ -111,7 +115,7 @@ void __init prom_init_env(void) | |||
111 | loongson_freqctrl[2] = 0x900040001fe001d0; | 115 | loongson_freqctrl[2] = 0x900040001fe001d0; |
112 | loongson_freqctrl[3] = 0x900060001fe001d0; | 116 | loongson_freqctrl[3] = 0x900060001fe001d0; |
113 | loongson_sysconf.ht_control_base = 0x90001EFDFB000000; | 117 | loongson_sysconf.ht_control_base = 0x90001EFDFB000000; |
114 | cpuhotplug_workaround = 1; | 118 | loongson_sysconf.workarounds = WORKAROUND_CPUHOTPLUG; |
115 | } else { | 119 | } else { |
116 | loongson_sysconf.cores_per_node = 1; | 120 | loongson_sysconf.cores_per_node = 1; |
117 | loongson_sysconf.cores_per_package = 1; | 121 | loongson_sysconf.cores_per_package = 1; |
@@ -119,6 +123,8 @@ void __init prom_init_env(void) | |||
119 | } | 123 | } |
120 | 124 | ||
121 | loongson_sysconf.nr_cpus = ecpu->nr_cpus; | 125 | loongson_sysconf.nr_cpus = ecpu->nr_cpus; |
126 | loongson_sysconf.boot_cpu_id = ecpu->cpu_startup_core_id; | ||
127 | loongson_sysconf.reserved_cpus_mask = ecpu->reserved_cores_mask; | ||
122 | if (ecpu->nr_cpus > NR_CPUS || ecpu->nr_cpus == 0) | 128 | if (ecpu->nr_cpus > NR_CPUS || ecpu->nr_cpus == 0) |
123 | loongson_sysconf.nr_cpus = NR_CPUS; | 129 | loongson_sysconf.nr_cpus = NR_CPUS; |
124 | loongson_sysconf.nr_nodes = (loongson_sysconf.nr_cpus + | 130 | loongson_sysconf.nr_nodes = (loongson_sysconf.nr_cpus + |
@@ -141,6 +147,24 @@ void __init prom_init_env(void) | |||
141 | pr_debug("Shutdown Addr: %llx, Restart Addr: %llx, VBIOS Addr: %llx\n", | 147 | pr_debug("Shutdown Addr: %llx, Restart Addr: %llx, VBIOS Addr: %llx\n", |
142 | loongson_sysconf.poweroff_addr, loongson_sysconf.restart_addr, | 148 | loongson_sysconf.poweroff_addr, loongson_sysconf.restart_addr, |
143 | loongson_sysconf.vgabios_addr); | 149 | loongson_sysconf.vgabios_addr); |
150 | |||
151 | memset(loongson_sysconf.ecname, 0, 32); | ||
152 | if (esys->has_ec) | ||
153 | memcpy(loongson_sysconf.ecname, esys->ec_name, 32); | ||
154 | loongson_sysconf.workarounds |= esys->workarounds; | ||
155 | |||
156 | loongson_sysconf.nr_uarts = esys->nr_uarts; | ||
157 | if (esys->nr_uarts < 1 || esys->nr_uarts > MAX_UARTS) | ||
158 | loongson_sysconf.nr_uarts = 1; | ||
159 | memcpy(loongson_sysconf.uarts, esys->uarts, | ||
160 | sizeof(struct uart_device) * loongson_sysconf.nr_uarts); | ||
161 | |||
162 | loongson_sysconf.nr_sensors = esys->nr_sensors; | ||
163 | if (loongson_sysconf.nr_sensors > MAX_SENSORS) | ||
164 | loongson_sysconf.nr_sensors = 0; | ||
165 | if (loongson_sysconf.nr_sensors) | ||
166 | memcpy(loongson_sysconf.sensors, esys->sensors, | ||
167 | sizeof(struct sensor_device) * loongson_sysconf.nr_sensors); | ||
144 | #endif | 168 | #endif |
145 | if (cpu_clock_freq == 0) { | 169 | if (cpu_clock_freq == 0) { |
146 | processor_id = (¤t_cpu_data)->processor_id; | 170 | processor_id = (¤t_cpu_data)->processor_id; |