📄 setup.c
字号:
boot_cpu_data.cpu_name = cpu_name_version[boot_cpu_data.cpu_type][0]; boot_cpu_data.family_name = cpu_name_version[boot_cpu_data.cpu_type][1];}#ifdef __LP64__#define COMMAND_GLOBAL 0xfffffffffffe0030UL#else#define COMMAND_GLOBAL 0xfffe0030#endif#define CMD_RESET 5 /* reset any module *//*** The Wright Brothers and Gecko systems have a H/W problem** (Lasi...'nuf said) may cause a broadcast reset to lockup** the system. An HVERSION dependent PDC call was developed** to perform a "safe", platform specific broadcast reset instead** of kludging up all the code.**** Older machines which do not implement PDC_BROADCAST_RESET will** return (with an error) and the regular broadcast reset can be** issued. Obviously, if the PDC does implement PDC_BROADCAST_RESET** the PDC call will not return (the system will be reset).*/static intreset_parisc(struct notifier_block *self, unsigned long command, void *ptr){ printk("%s: %s(cmd=%lu)\n", __FILE__, __FUNCTION__, command); switch(command) { case MACH_RESTART:#ifdef FASTBOOT_SELFTEST_SUPPORT /* ** If user has modified the Firmware Selftest Bitmap, ** run the tests specified in the bitmap after the ** system is rebooted w/PDC_DO_RESET. ** ** ftc_bitmap = 0x1AUL "Skip destructive memory tests" ** ** Using "directed resets" at each processor with the MEM_TOC ** vector cleared will also avoid running destructive ** memory self tests. (Not implemented yet) */ if (ftc_bitmap) { mem_pdc_call( PDC_BROADCAST_RESET, PDC_DO_FIRM_TEST_RESET, PDC_FIRM_TEST_MAGIC, ftc_bitmap); }#endif /* "Normal" system reset */ (void) mem_pdc_call(PDC_BROADCAST_RESET, PDC_DO_RESET, 0L, 0L, 0L); /* Nope...box should reset with just CMD_RESET now */ gsc_writel(CMD_RESET, COMMAND_GLOBAL); /* Wait for RESET to lay us to rest. */ while (1) ; break; } return NOTIFY_DONE;}static struct notifier_block parisc_block = { reset_parisc, NULL, 0 };/* start_parisc() will be called from head.S to setup our new memory_start and actually start our kernel ! Memory-Layout is: - Kernel-Image (code+data+BSS) - Stack (stack-size see below!, stack-setup-code is in head.S) - memory_start at end of stack..*/unsigned long mem_start, mem_max;unsigned long start_pfn, max_pfn;extern asmlinkage void __init start_kernel(void);#define PFN_UP(x) (((x) + PAGE_SIZE-1) >> PAGE_SHIFT)#define PFN_DOWN(x) ((x) >> PAGE_SHIFT)#define PFN_PHYS(x) ((x) << PAGE_SHIFT)void __init start_parisc(unsigned arg0, unsigned arg1, unsigned arg2, unsigned arg3){ register unsigned long ccr; unsigned long memory_start; /* Clear BSS */ { char *p = &_edata, *q = &_end; while (p < q) { *p++ = 0; } } pdc_console_init();#ifdef __LP64__ printk("The 64-bit Kernel has started...\n");#else printk("The 32-bit Kernel has started...\n");#endif /* ** Enable FP coprocessor ** ** REVISIT: ccr should be set by PDC_COPROC results to support PA1.0. ** Hardcoding works for PA1.1 processors. ** ** REVISIT: this could be done in the "code 22" trap handler. ** (frowands idea - that way we know which processes need FP ** registers saved on the interrupt stack.) ** ** NEWS FLASH: wide kernels need FP coprocessor enabled to handle ** formatted printing of %lx for example (double divides I think) */ ccr = 0xc0; mtctl(ccr, 10); printk("Enabled FP coprocessor\n");#ifdef __LP64__ printk( "If this is the LAST MESSAGE YOU SEE, you're probably using\n" "32-bit millicode by mistake.\n");#endif memory_start = (unsigned long) &_end; memory_start = (memory_start + PAGE_SIZE) & PAGE_MASK; printk("Free memory starts at: 0x%lx\n", memory_start); /* Collect stuff passed in from the boot loader */ printk(KERN_WARNING "%s(0x%x,0x%x,0x%x,0x%x)\n", __FUNCTION__, arg0, arg1, arg2, arg3); /* arg0 is free-mem start, arg1 is ptr to command line */ if (arg0 < 64) { /* called from hpux boot loader */ saved_command_line[0] = '\0'; } else { strcpy(saved_command_line, (char *)__va(arg1)); printk("PALO command line: '%s'\nPALO initrd %x-%x\n", saved_command_line, arg2, arg3);#ifdef CONFIG_BLK_DEV_INITRD if (arg2 != 0) /* did palo pass us a ramdisk? */ { initrd_start = (unsigned long)__va(arg2); initrd_end = (unsigned long)__va(arg3); }#endif } mem_start = __pa(memory_start);#define MAX_MEM (512*1024*1024) mem_max = (PAGE0->imm_max_mem > MAX_MEM ? MAX_MEM : PAGE0->imm_max_mem); collect_boot_cpu_data(); /* initialize the LCD/LED after boot_cpu_data is available ! */ led_init(); /* LCD/LED initialization */ do_inventory(); /* probe for hardware */ register_driver(cpu_drivers_for); /* claim all the CPUs */ if (boot_cpu_data.cpu_count == 0) register_fallback_cpu(); printk("CPU(s): %d x %s at %d.%06d MHz\n", boot_cpu_data.cpu_count, boot_cpu_data.cpu_name, boot_cpu_data.cpu_hz / 1000000, boot_cpu_data.cpu_hz % 1000000 ); switch (boot_cpu_data.cpu_type) { case pcx: case pcxs: case pcxt: hppa_dma_ops = &pcx_dma_ops; break; case pcxl2: pa7300lc_init(); case pcxl: /* falls through */ hppa_dma_ops = &pcxl_dma_ops; break; default: break; }#if 1 /* KLUGE! this really belongs in kernel/resource.c! */ iomem_resource.end = ~0UL;#endif sysram_resource.end = mem_max - 1; notifier_chain_register(&mach_notifier, &parisc_block); start_kernel(); /* now back to arch-generic code... */}void __init setup_arch(char **cmdline_p){ unsigned long bootmap_size; unsigned long start_pfn; unsigned long mem_free; *cmdline_p = saved_command_line; /* initialize bootmem */ start_pfn = PFN_UP(mem_start); max_pfn = PFN_DOWN(mem_max); bootmap_size = init_bootmem(start_pfn, max_pfn); mem_start += bootmap_size; mem_free = mem_max - mem_start; /* free_bootmem handles rounding nicely */ printk("free_bootmem(0x%lx, 0x%lx)\n", (unsigned long)mem_start, (unsigned long)mem_free); free_bootmem(mem_start, mem_free);#ifdef CONFIG_BLK_DEV_INITRD printk("initrd: %08x-%08x\n", (int) initrd_start, (int) initrd_end); if (initrd_end != 0) { initrd_below_start_ok = 1; reserve_bootmem(__pa(initrd_start), initrd_end - initrd_start); }#endif cache_init(); paging_init(); if((unsigned long)&init_task_union&(INIT_TASK_SIZE - 1)) { printk("init_task_union not aligned. Please recompile the kernel after changing the first line in arch/parisc/kernel/init_task.c from \n\"#define PAD 0\" to\n\"#define PAD 1\" or vice versa\n"); for(;;); }#ifdef CONFIG_SERIAL_CONSOLE /* nothing */#elif CONFIG_VT#if defined(CONFIG_STI_CONSOLE) conswitchp = &dummy_con; /* we use take_over_console() later ! */#elif defined(CONFIG_IODC_CONSOLE) conswitchp = &prom_con; /* it's currently really "prom_con" */#elif defined(CONFIG_DUMMY_CONSOLE) conswitchp = &dummy_con;#endif#endif}#ifdef CONFIG_PROC_FS/* * Get CPU information for use by procfs. */int get_cpuinfo(char *buffer){ char *p = buffer; int n; for(n=0; n<boot_cpu_data.cpu_count; n++) {#ifdef CONFIG_SMP if (!(cpu_online_map & (1<<n))) continue;#endif p += sprintf(p, "processor\t: %d\n" "cpu family\t: PA-RISC %s\n", n, boot_cpu_data.family_name); p += sprintf(p, "cpu\t\t: %s\n", boot_cpu_data.cpu_name ); /* cpu MHz */ p += sprintf(p, "cpu MHz\t\t: %d.%06d\n", boot_cpu_data.cpu_hz / 1000000, boot_cpu_data.cpu_hz % 1000000 ); p += sprintf(p, "model\t\t: %s\n" "model name\t: %s\n", boot_cpu_data.pdc.sys_model_name, boot_cpu_data.model_name); p += sprintf(p, "hversion\t: 0x%08x\n" "sversion\t: 0x%08x\n", boot_cpu_data.hversion, boot_cpu_data.sversion ); p += get_cache_info(p); /* print cachesize info ? */ p += sprintf(p, "bogomips\t: %lu.%02lu\n", (loops_per_sec+2500)/500000, ((loops_per_sec+2500)/5000) % 100); } return p - buffer;}#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -