25 #include <linux/module.h>
32 #include <linux/kernel.h>
33 #include <linux/reboot.h>
34 #include <linux/sched.h>
36 #include <linux/string.h>
38 #include <linux/screen_info.h>
40 #include <linux/serial.h>
41 #include <linux/serial_core.h>
46 #include <linux/kexec.h>
49 #include <asm/machvec.h>
53 #include <asm/paravirt.h>
56 #include <asm/pgtable.h>
57 #include <asm/processor.h>
59 #include <asm/sections.h>
60 #include <asm/setup.h>
62 #include <asm/tlbflush.h>
63 #include <asm/unistd.h>
66 #if defined(CONFIG_SMP) && (IA64_CPU_SIZE > PAGE_SIZE)
67 # error "struct cpuinfo_ia64 too big!"
71 unsigned long __per_cpu_offset[
NR_CPUS];
83 static struct resource data_resource = {
84 .name =
"Kernel data",
88 static struct resource code_resource = {
89 .name =
"Kernel code",
93 static struct resource bss_resource = {
110 #define I_CACHE_STRIDE_SHIFT 5
117 #define CACHE_STRIDE_SHIFT 5
156 if (start >= end)
return 0;
166 range_start =
max(start, prev_start);
169 if (range_start < range_end)
173 if (range_end == end)
return 0;
211 for (j = 0; j <
max; ++
j) {
212 if (rsvd_region[j].
start > rsvd_region[j+1].
start) {
213 struct rsvd_region
tmp;
214 tmp = rsvd_region[
j];
215 rsvd_region[
j] = rsvd_region[j + 1];
216 rsvd_region[j + 1] =
tmp;
224 merge_regions (
struct rsvd_region *rsvd_region,
int max)
227 for (i = 1; i <
max; ++
i) {
228 if (rsvd_region[i].
start >= rsvd_region[i-1].
end)
230 if (rsvd_region[i].
end > rsvd_region[i-1].
end)
231 rsvd_region[i-1].
end = rsvd_region[
i].
end;
233 memmove(&rsvd_region[i], &rsvd_region[i+1],
234 (max - i) *
sizeof(
struct rsvd_region));
242 static int __init register_memory(
void)
271 static int __init check_crashkernel_memory(
unsigned long pbase,
size_t size)
276 return pbase < (1
UL << 32);
279 static void __init setup_crashkernel(
unsigned long total,
int *
n)
281 unsigned long long base = 0, size = 0;
286 if (ret == 0 && size > 0) {
288 sort_regions(rsvd_region, *n);
289 *n = merge_regions(rsvd_region, *n);
294 if (!check_crashkernel_memory(base, size)) {
295 pr_warning(
"crashkernel: There would be kdump memory "
296 "at %ld GB but this is unusable because it "
297 "must\nbe below 4 GB. Change the memory "
298 "configuration of the machine.\n",
299 (
unsigned long)(base >> 30));
305 "for crashkernel (System RAM: %ldMB)\n",
306 (
unsigned long)(size >> 20),
307 (
unsigned long)(base >> 20),
308 (
unsigned long)(total >> 20));
311 rsvd_region[*
n].
end =
323 sizeof(*ia64_boot_param);
326 static inline void __init setup_crashkernel(
unsigned long total,
int *n)
346 rsvd_region[
n].
start = (
unsigned long) ia64_boot_param;
347 rsvd_region[
n].
end = rsvd_region[
n].
start +
sizeof(*ia64_boot_param);
365 #ifdef CONFIG_BLK_DEV_INITRD
373 #ifdef CONFIG_CRASH_DUMP
375 &rsvd_region[n].
end) == 0)
379 total_memory =
efi_memmap_init(&rsvd_region[n].start, &rsvd_region[n].end);
382 setup_crashkernel(total_memory, &n);
386 rsvd_region[
n].
end = ~0
UL;
406 #ifdef CONFIG_BLK_DEV_INITRD
420 unsigned long phys_iobase;
441 "falling back to AR.KR0 (0x%lx)\n", phys_iobase);
462 early_console_setup (
char *
cmdline)
466 #ifdef CONFIG_SERIAL_SGI_L1_CONSOLE
473 #ifdef CONFIG_EFI_PCDP
480 return (earlycons) ? 0 : -1;
484 mark_bsp_online (
void)
493 static __init int setup_nomca(
char *
s)
500 #ifdef CONFIG_CRASH_DUMP
511 if (!is_vmcore_usable())
542 #ifdef CONFIG_IA64_GENERIC
548 machvec_init_from_cmdline(*cmdline_p);
553 if (early_console_setup(*cmdline_p) == 0)
560 # ifdef CONFIG_ACPI_NUMA
562 # ifdef CONFIG_ACPI_HOTPLUG_CPU
565 per_cpu_scan_finalize((
cpus_weight(early_cpu_possible_map) == 0 ?
567 additional_cpus > 0 ? additional_cpus : 0);
579 #ifdef CONFIG_ITANIUM
583 unsigned long num_phys_stacked;
585 if (ia64_pal_rse_info(&num_phys_stacked, 0) == 0 && num_phys_stacked > 96)
602 # if defined(CONFIG_DUMMY_CONSOLE)
605 # if defined(CONFIG_VGA_CONSOLE)
625 #ifndef CONFIG_IA64_HP_SIM
638 # define lpj c->loops_per_jiffy
639 # define cpunum c->cpu
641 # define lpj loops_per_jiffy
646 const char *feature_name;
648 { 1
UL << 0,
"branchlong" },
649 { 1
UL << 1,
"spontaneous deferral"},
650 { 1
UL << 2,
"16-byte atomic ops" }
661 memcpy(features,
"standard", 9);
665 for (i = 0; i < ARRAY_SIZE(feature_bits) && size > 1; ++
i) {
666 if (mask & feature_bits[i].mask) {
667 cp +=
snprintf(cp, size,
"%s%s", sep,
668 feature_bits[i].feature_name),
670 mask &= ~feature_bits[
i].mask;
671 size =
sizeof(
features) - (cp - features);
674 if (mask && size > 1) {
676 snprintf(cp, size,
"%s0x%lx", sep, mask);
695 "cpu MHz : %lu.%03lu\n"
696 "itc MHz : %lu.%06lu\n"
697 "BogoMIPS : %lu.%02lu\n",
701 proc_freq / 1000, proc_freq % 1000,
703 lpj*
HZ/500000, (lpj*
HZ/5000) % 100);
706 if (c->socket_id != -1)
707 seq_printf(m,
"physical id: %u\n", c->socket_id);
708 if (c->threads_per_core > 1 || c->cores_per_socket > 1)
712 c->core_id, c->thread_id);
723 while (*pos < nr_cpu_ids && !
cpu_online(*pos))
730 c_next (
struct seq_file *m,
void *v, loff_t *pos)
737 c_stop (
struct seq_file *m,
void *v)
758 memcpy(brand,
"Unknown", 8);
759 if (ia64_pal_get_brand_info(brand)) {
761 memcpy(brand,
"Merced", 7);
762 else if (family == 0x1f)
switch (model) {
763 case 0:
memcpy(brand,
"McKinley", 9);
break;
764 case 1:
memcpy(brand,
"Madison", 8);
break;
765 case 2:
memcpy(brand,
"Madison up to 9M cache", 23);
break;
769 if (
strcmp(brandname[i], brand) == 0)
772 if (brandname[i][0] ==
'\0')
773 return strcpy(brandname[i], brand);
776 "%s: Table overflow. Some processor model information will be missing\n",
785 unsigned long bits[5];
798 unsigned archrev : 8;
808 unsigned long impl_va_msb = 50, phys_addr_size = 44;
810 for (i = 0; i < 5; ++
i)
820 c->threads_per_core = c->cores_per_socket = c->num_log = 1;
837 status = ia64_pal_vm_summary(&vm1, &vm2);
856 unsigned long line_size, max = 1;
857 unsigned long l, levels, unique_caches;
861 status = ia64_pal_cache_summary(&levels, &unique_caches);
863 printk(
KERN_ERR "%s: ia64_pal_cache_summary() failed (status=%ld)\n",
873 for (l = 0; l < levels; ++
l) {
875 status = ia64_pal_cache_config_info(l, 2, &cci);
878 "(l=%lu, 2) failed (status=%ld)\n",
879 __func__, l, status);
885 cci.pcci_unified = 1;
890 line_size = 1 << cci.pcci_line_size;
895 if (!cci.pcci_unified) {
897 status = ia64_pal_cache_config_info(l, 1, &cci);
900 "(l=%lu, 1) failed (status=%ld)\n",
901 __func__, l, status);
923 unsigned long num_phys_stacked;
925 unsigned int max_ctx;
960 identify_cpu(cpu_info);
962 #ifdef CONFIG_MCKINLEY
964 # define FEATURE_SET 16
967 if (cpu_info->
family == 0x1f) {
969 if ((iprv.
status == 0) && (iprv.
v0 & 0x80) && (iprv.
v2 & 0x80))
971 (iprv.
v1 | 0x80), FEATURE_SET, 0);
1012 ia64_set_itv(1 << 16);
1013 ia64_set_lrr0(1 << 16);
1014 ia64_set_lrr1(1 << 16);
1030 if (ia64_pal_vm_summary(
NULL, &vmi) == 0) {
1035 max_ctx = (1
U << 15) - 1;
1043 if (ia64_pal_rse_info(&num_phys_stacked,
NULL) != 0) {
1046 num_phys_stacked = 96;
1049 if (num_phys_stacked > max_num_phys_stacked) {
1051 max_num_phys_stacked = num_phys_stacked;
1064 static int __init run_dmi_scan(
void)