setup.c
来自「h内核」· C语言 代码 · 共 612 行 · 第 1/2 页
C
612 行
/* * This file is subject to the terms and conditions of the GNU General Public * License. See the file "COPYING" in the main directory of this archive * for more details. * * Copyright (C) 1999,2001-2004 Silicon Graphics, Inc. All rights reserved. */#include <linux/config.h>#include <linux/module.h>#include <linux/init.h>#include <linux/delay.h>#include <linux/kernel.h>#include <linux/kdev_t.h>#include <linux/string.h>#include <linux/tty.h>#include <linux/console.h>#include <linux/timex.h>#include <linux/sched.h>#include <linux/ioport.h>#include <linux/mm.h>#include <linux/serial.h>#include <linux/irq.h>#include <linux/bootmem.h>#include <linux/mmzone.h>#include <linux/interrupt.h>#include <linux/acpi.h>#include <linux/compiler.h>#include <linux/sched.h>#include <linux/root_dev.h>#include <linux/nodemask.h>#include <asm/io.h>#include <asm/sal.h>#include <asm/machvec.h>#include <asm/system.h>#include <asm/processor.h>#include <asm/sn/arch.h>#include <asm/sn/addrs.h>#include <asm/sn/pda.h>#include <asm/sn/nodepda.h>#include <asm/sn/sn_cpuid.h>#include <asm/sn/simulator.h>#include <asm/sn/leds.h>#include <asm/sn/bte.h>#include <asm/sn/shub_mmr.h>#include <asm/sn/clksupport.h>#include <asm/sn/sn_sal.h>#include <asm/sn/geo.h>#include "xtalk/xwidgetdev.h"#include "xtalk/hubdev.h"#include <asm/sn/klconfig.h>DEFINE_PER_CPU(struct pda_s, pda_percpu);#define MAX_PHYS_MEMORY (1UL << 49) /* 1 TB */lboard_t *root_lboard[MAX_COMPACT_NODES];extern void bte_init_node(nodepda_t *, cnodeid_t);extern void sn_timer_init(void);extern unsigned long last_time_offset;extern void (*ia64_mark_idle) (int);extern void snidle(int);extern unsigned char acpi_kbd_controller_present;unsigned long sn_rtc_cycles_per_second;EXPORT_SYMBOL(sn_rtc_cycles_per_second);partid_t sn_partid = -1;EXPORT_SYMBOL(sn_partid);char sn_system_serial_number_string[128];EXPORT_SYMBOL(sn_system_serial_number_string);u64 sn_partition_serial_number;EXPORT_SYMBOL(sn_partition_serial_number);short physical_node_map[MAX_PHYSNODE_ID];EXPORT_SYMBOL(physical_node_map);int numionodes;static void sn_init_pdas(char **);static void scan_for_ionodes(void);static nodepda_t *nodepdaindr[MAX_COMPACT_NODES];/* * The format of "screen_info" is strange, and due to early i386-setup * code. This is just enough to make the console code think we're on a * VGA color display. */struct screen_info sn_screen_info = { .orig_x = 0, .orig_y = 0, .orig_video_mode = 3, .orig_video_cols = 80, .orig_video_ega_bx = 3, .orig_video_lines = 25, .orig_video_isVGA = 1, .orig_video_points = 16};/* * This is here so we can use the CMOS detection in ide-probe.c to * determine what drives are present. In theory, we don't need this * as the auto-detection could be done via ide-probe.c:do_probe() but * in practice that would be much slower, which is painful when * running in the simulator. Note that passing zeroes in DRIVE_INFO * is sufficient (the IDE driver will autodetect the drive geometry). */#ifdef CONFIG_IA64_GENERICextern char drive_info[4 * 16];#elsechar drive_info[4 * 16];#endif/* * Get nasid of current cpu early in boot before nodepda is initialized */static intboot_get_nasid(void){ int nasid; if (ia64_sn_get_sapic_info(get_sapicid(), &nasid, NULL, NULL)) BUG(); return nasid;}/* * This routine can only be used during init, since * smp_boot_data is an init data structure. * We have to use smp_boot_data.cpu_phys_id to find * the physical id of the processor because the normal * cpu_physical_id() relies on data structures that * may not be initialized yet. */static int __init pxm_to_nasid(int pxm){ int i; int nid; nid = pxm_to_nid_map[pxm]; for (i = 0; i < num_node_memblks; i++) { if (node_memblk[i].nid == nid) { return NASID_GET(node_memblk[i].start_paddr); } } return -1;}/** * early_sn_setup - early setup routine for SN platforms * * Sets up an initial console to aid debugging. Intended primarily * for bringup. See start_kernel() in init/main.c. */void __init early_sn_setup(void){ efi_system_table_t *efi_systab; efi_config_table_t *config_tables; struct ia64_sal_systab *sal_systab; struct ia64_sal_desc_entry_point *ep; char *p; int i, j; /* * Parse enough of the SAL tables to locate the SAL entry point. Since, console * IO on SN2 is done via SAL calls, early_printk won't work without this. * * This code duplicates some of the ACPI table parsing that is in efi.c & sal.c. * Any changes to those file may have to be made hereas well. */ efi_systab = (efi_system_table_t *) __va(ia64_boot_param->efi_systab); config_tables = __va(efi_systab->tables); for (i = 0; i < efi_systab->nr_tables; i++) { if (efi_guidcmp(config_tables[i].guid, SAL_SYSTEM_TABLE_GUID) == 0) { sal_systab = __va(config_tables[i].table); p = (char *)(sal_systab + 1); for (j = 0; j < sal_systab->entry_count; j++) { if (*p == SAL_DESC_ENTRY_POINT) { ep = (struct ia64_sal_desc_entry_point *)p; ia64_sal_handler_init(__va (ep->sal_proc), __va(ep->gp)); return; } p += SAL_DESC_SIZE(*p); } } } /* Uh-oh, SAL not available?? */ printk(KERN_ERR "failed to find SAL entry point\n");}extern int platform_intr_list[];extern nasid_t master_nasid;static int shub_1_1_found __initdata;/* * sn_check_for_wars * * Set flag for enabling shub specific wars */static inline int __init is_shub_1_1(int nasid){ unsigned long id; int rev; if (is_shub2()) return 0; id = REMOTE_HUB_L(nasid, SH1_SHUB_ID); rev = (id & SH1_SHUB_ID_REVISION_MASK) >> SH1_SHUB_ID_REVISION_SHFT; return rev <= 2;}static void __init sn_check_for_wars(void){ int cnode; if (is_shub2()) { /* none yet */ } else { for_each_online_node(cnode) { if (is_shub_1_1(cnodeid_to_nasid(cnode))) shub_1_1_found = 1; } }}/** * sn_setup - SN platform setup routine * @cmdline_p: kernel command line * * Handles platform setup for SN machines. This includes determining * the RTC frequency (via a SAL call), initializing secondary CPUs, and * setting up per-node data areas. The console is also initialized here. */void __init sn_setup(char **cmdline_p){ long status, ticks_per_sec, drift; int pxm; int major = sn_sal_rev_major(), minor = sn_sal_rev_minor(); extern void sn_cpu_init(void); /* * If the generic code has enabled vga console support - lets * get rid of it again. This is a kludge for the fact that ACPI * currtently has no way of informing us if legacy VGA is available * or not. */#if defined(CONFIG_VT) && defined(CONFIG_VGA_CONSOLE) if (conswitchp == &vga_con) { printk(KERN_DEBUG "SGI: Disabling VGA console\n");#ifdef CONFIG_DUMMY_CONSOLE conswitchp = &dummy_con;#else conswitchp = NULL;#endif /* CONFIG_DUMMY_CONSOLE */ }#endif /* def(CONFIG_VT) && def(CONFIG_VGA_CONSOLE) */ MAX_DMA_ADDRESS = PAGE_OFFSET + MAX_PHYS_MEMORY; memset(physical_node_map, -1, sizeof(physical_node_map)); for (pxm = 0; pxm < MAX_PXM_DOMAINS; pxm++) if (pxm_to_nid_map[pxm] != -1) physical_node_map[pxm_to_nasid(pxm)] = pxm_to_nid_map[pxm]; /* * Old PROMs do not provide an ACPI FADT. Disable legacy keyboard * support here so we don't have to listen to failed keyboard probe * messages. */ if ((major < 2 || (major == 2 && minor <= 9)) && acpi_kbd_controller_present) { printk(KERN_INFO "Disabling legacy keyboard support as prom " "is too old and doesn't provide FADT\n"); acpi_kbd_controller_present = 0; } printk("SGI SAL version %x.%02x\n", major, minor); /* * Confirm the SAL we're running on is recent enough... */ if ((major < SN_SAL_MIN_MAJOR) || (major == SN_SAL_MIN_MAJOR && minor < SN_SAL_MIN_MINOR)) { printk(KERN_ERR "This kernel needs SGI SAL version >= " "%x.%02x\n", SN_SAL_MIN_MAJOR, SN_SAL_MIN_MINOR); panic("PROM version too old\n"); } master_nasid = boot_get_nasid(); status =
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?