⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 setup.c

📁 linux-2.4.29操作系统的源码
💻 C
📖 第 1 页 / 共 2 页
字号:
 * @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 __initsn_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");	}	/* Patch the ivt */	sn2_replace_ivt();	master_nasid = get_nasid();	(void)snia_get_console_nasid();	(void)snia_get_master_baseio_nasid();	status = ia64_sal_freq_base(SAL_FREQ_BASE_REALTIME_CLOCK, &ticks_per_sec, &drift);	if (status != 0 || ticks_per_sec < 100000) {		printk(KERN_WARNING "unable to determine platform RTC clock frequency, guessing.\n");		/* PROM gives wrong value for clock freq. so guess */		sn_rtc_cycles_per_second = 1000000000000UL/30000UL;	}	else		sn_rtc_cycles_per_second = ticks_per_sec;	platform_intr_list[ACPI_INTERRUPT_CPEI] = IA64_CPE_VECTOR;	if ( IS_RUNNING_ON_SIMULATOR() )	{		master_node_bedrock_address = (u64)REMOTE_HUB(get_nasid(), SH_JUNK_BUS_UART0);		printk(KERN_DEBUG "sn_setup: setting master_node_bedrock_address to 0x%lx\n",		       master_node_bedrock_address);	}	/*	 * we set the default root device to /dev/hda	 * to make simulation easy	 */	ROOT_DEV = to_kdev_t(0x0301);	/*	 * Create the PDAs and NODEPDAs for all the cpus.	 */	sn_init_pdas(cmdline_p);	ia64_mark_idle = &snidle;	/* 	 * For the bootcpu, we do this here. All other cpus will make the	 * call as part of cpu_init in slave cpu initialization.	 */	sn_cpu_init();	/*	 * Setup hubinfo stuff. Has to happen AFTER sn_cpu_init(),	 * because it uses the cnode to nasid tables.	 */	init_platform_hubinfo(nodepdaindr);#ifdef CONFIG_SMP	init_smp_config();#endif	screen_info = sn_screen_info;	ia64_platform_timer_extras = &sn_timer_interrupt_extras;	sn_timer_init();}/** * sn_init_pdas - setup node data areas * * One time setup for Node Data Area.  Called by sn_setup(). */voidsn_init_pdas(char **cmdline_p){	cnodeid_t	cnode;	void scan_for_ionodes(void);	/*	 * Make sure that the PDA fits entirely in the same page as the 	 * cpu_data area.	 */	if ((PDAADDR&~PAGE_MASK)+sizeof(pda_t) > PAGE_SIZE)		panic("overflow of cpu_data page");	memset(pda.cnodeid_to_nasid_table, -1, sizeof(pda.cnodeid_to_nasid_table));	for (cnode=0; cnode<numnodes; cnode++)		pda.cnodeid_to_nasid_table[cnode] = pxm_to_nasid(nid_to_pxm_map[cnode]);	numionodes = numnodes;	scan_for_ionodes();        /*         * Allocate & initalize the nodepda for each node.         */        for (cnode=0; cnode < numnodes; cnode++) {		nodepdaindr[cnode] = alloc_bootmem_node(NODE_DATA(cnode), sizeof(nodepda_t));		memset(nodepdaindr[cnode], 0, sizeof(nodepda_t));        }	/* 	 * Allocate & initialize nodepda for TIOs.  For now, put them on node 0.	 */	for (cnode = numnodes; cnode < numionodes; cnode ++) {		nodepdaindr[cnode] = alloc_bootmem_node(NODE_DATA(0), sizeof(nodepda_t));		memset(nodepdaindr[cnode], 0, sizeof(nodepda_t));	}	/*	 * Now copy the array of nodepda pointers to each nodepda.	 */        for (cnode=0; cnode < numionodes; cnode++)		memcpy(nodepdaindr[cnode]->pernode_pdaindr, nodepdaindr, sizeof(nodepdaindr));	/*	 * Set up IO related platform-dependent nodepda fields.	 * The following routine actually sets up the hubinfo struct	 * in nodepda.	 */	for (cnode = 0; cnode < numnodes; cnode++) {		init_platform_nodepda(nodepdaindr[cnode], cnode);		spin_lock_init(&nodepdaindr[cnode]->bist_lock);		bte_init_node (nodepdaindr[cnode], cnode);	}	/*	 * Handle TIO differently .. we do not do BTE init ..	 */	for (cnode = numnodes; cnode < numionodes; cnode++) {		init_platform_nodepda(nodepdaindr[cnode], cnode);	}}/** * sn_cpu_init - initialize per-cpu data areas * @cpuid: cpuid of the caller * * Called during cpu initialization on each cpu as it starts. * Currently, initializes the per-cpu data area for SNIA. * Also sets up a few fields in the nodepda.  Also known as * platform_cpu_init() by the ia64 machvec code. */void __initsn_cpu_init(void){	int	cpuid;	int	cpuphyid;	int	nasid;	int	slice;	int	cnode, i;	static int	wars_have_been_checked = 0;	/*	 * The boot cpu makes this call again after platform initialization is	 * complete.	 */	if (nodepdaindr[0] == NULL)		return;	cpuid = smp_processor_id();	cpuphyid = ((ia64_get_lid() >> 16) & 0xffff);	nasid = cpu_physical_id_to_nasid(cpuphyid);	cnode = nasid_to_cnodeid(nasid);	slice = cpu_physical_id_to_slice(cpuphyid);	printk("CPU %d: nasid %d, slice %d, cnode %d\n",			smp_processor_id(), nasid, slice, cnode);	memset(&pda, 0, sizeof(pda));	pda.p_nodepda = nodepdaindr[cnode];	pda.led_address = (typeof(pda.led_address)) (LED0 + (slice<<LED_CPU_SHIFT));	pda.led_state = LED_ALWAYS_SET;	pda.hb_count = HZ/2;	pda.hb_state = 0;	pda.idle_flag = 0;		memset(pda.cnodeid_to_nasid_table, -1, sizeof(pda.cnodeid_to_nasid_table));	for (i=0; i<numnodes; i++)		pda.cnodeid_to_nasid_table[i] = pxm_to_nasid(nid_to_pxm_map[i]);	/*	 * Check for WARs.	 * Only needs to be done once, on BSP.	 * Has to be done after loop above, because it uses pda.cnodeid_to_nasid_table[i].	 * Has to be done before assignment below.	 */	if (!wars_have_been_checked) {		sn_check_for_wars();		wars_have_been_checked = 1;	}	pda.shub_1_1_found = shub_1_1_found;	if (local_node_data->active_cpu_count == 1)		nodepda->node_first_cpu = cpuid;	/*	 * We must use different memory allocators for first cpu (bootmem 	 * allocator) than for the other cpus (regular allocator).	 */	if (cpuid == 0)		irqpdaindr = alloc_bootmem_node(NODE_DATA(cpuid_to_cnodeid(cpuid)),sizeof(irqpda_t));	memset(irqpdaindr, 0, sizeof(irqpda_t));	irqpdaindr->irq_flags[SGI_PCIBR_ERROR] = SN2_IRQ_SHARED;	irqpdaindr->irq_flags[SGI_PCIBR_ERROR] |= SN2_IRQ_RESERVED;	irqpdaindr->irq_flags[SGI_II_ERROR] = SN2_IRQ_SHARED;	irqpdaindr->irq_flags[SGI_II_ERROR] |= SN2_IRQ_RESERVED;	pda.pio_write_status_addr = (volatile unsigned long *)			LOCAL_MMR_ADDR((slice < 2 ? SH_PIO_WRITE_STATUS_0 : SH_PIO_WRITE_STATUS_1 ) );	pda.mem_write_status_addr = (volatile u64 *)			LOCAL_MMR_ADDR((slice < 2 ? SH_MEMORY_WRITE_STATUS_0 : SH_MEMORY_WRITE_STATUS_1 ) );	if (nodepda->node_first_cpu == cpuid) {		int	buddy_nasid;		buddy_nasid = cnodeid_to_nasid(numa_node_id() == numnodes-1 ? 0 : numa_node_id()+ 1);		pda.pio_shub_war_cam_addr = (volatile unsigned long*)GLOBAL_MMR_ADDR(nasid, SH_PI_CAM_CONTROL);	}	bte_init_cpu();}/* * Scan klconfig for TIO's.  Add the TIO nasids to the * physical_node_map and the pda and increment numionodes. */voidscan_for_ionodes() {	int nasid = 0;	lboard_t *brd;	/* Scan all compute nodes. */	for (nasid = 0; nasid < MAX_PHYSNODE_ID; nasid +=2) {		/* if there's no nasid, don't try to read the klconfig on the node */		if (physical_node_map[nasid] == -1) continue;		brd = find_lboard((lboard_t *)KL_CONFIG_INFO(nasid), KLTYPE_TIO);		while (brd) {			pda.cnodeid_to_nasid_table[numionodes] = brd->brd_nasid;			physical_node_map[brd->brd_nasid] = numionodes++;			brd = KLCF_NEXT(brd);			brd = find_lboard(brd, KLTYPE_TIO);		}	}}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -