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

📄 setup.c

📁 linux-2.4.29操作系统的源码
💻 C
📖 第 1 页 / 共 2 页
字号:
		sh_mv.mv_inw_p = generic_inw_p;		sh_mv.mv_inl_p = generic_inl_p;		sh_mv.mv_outb_p = generic_outb_p;		sh_mv.mv_outw_p = generic_outw_p;		sh_mv.mv_outl_p = generic_outl_p;		sh_mv.mv_insb = generic_insb;		sh_mv.mv_insw = generic_insw;		sh_mv.mv_insl = generic_insl;		sh_mv.mv_outsb = generic_outsb;		sh_mv.mv_outsw = generic_outsw;		sh_mv.mv_outsl = generic_outsl;		sh_mv.mv_isa_port2addr = generic_isa_port2addr;		generic_io_base = mv_io_base;	}	if (mv_mmio_enable != 0) {		sh_mv.mv_readb = generic_readb;		sh_mv.mv_readw = generic_readw;		sh_mv.mv_readl = generic_readl;		sh_mv.mv_writeb = generic_writeb;		sh_mv.mv_writew = generic_writew;		sh_mv.mv_writel = generic_writel;	}#endif#define PFN_UP(x)	(((x) + PAGE_SIZE-1) >> PAGE_SHIFT)#define PFN_DOWN(x)	((x) >> PAGE_SHIFT)#define PFN_PHYS(x)	((x) << PAGE_SHIFT)#ifdef CONFIG_DISCONTIGMEM	NODE_DATA(0)->bdata = &discontig_node_bdata[0];	NODE_DATA(1)->bdata = &discontig_node_bdata[1];	bootmap_size = init_bootmem_node(NODE_DATA(1), 					 PFN_UP(__MEMORY_START_2ND),					 PFN_UP(__MEMORY_START_2ND),					 PFN_DOWN(__MEMORY_START_2ND+__MEMORY_SIZE_2ND));	free_bootmem_node(NODE_DATA(1), __MEMORY_START_2ND, __MEMORY_SIZE_2ND);	reserve_bootmem_node(NODE_DATA(1), __MEMORY_START_2ND, bootmap_size);#endif	/*	 * Find the highest page frame number we have available	 */	max_pfn = PFN_DOWN(__pa(memory_end));	/*	 * Determine low and high memory ranges:	 */	max_low_pfn = max_pfn; 	/*	 * Partially used pages are not usable - thus	 * we are rounding upwards: 	 */	start_pfn = PFN_UP(__pa(&_end));	/*	 * Find a proper area for the bootmem bitmap. After this	 * bootstrap step all allocations (until the page allocator	 * is intact) must be done via bootmem_alloc().	 */	bootmap_size = init_bootmem_node(NODE_DATA(0), start_pfn,					 __MEMORY_START>>PAGE_SHIFT,					 max_low_pfn);	/*	 * Register fully available low RAM pages with the bootmem allocator.	 */	{		unsigned long curr_pfn, last_pfn, pages;		/*		 * We are rounding up the start address of usable memory:		 */		curr_pfn = PFN_UP(__MEMORY_START);		/*		 * ... and at the end of the usable range downwards:		 */		last_pfn = PFN_DOWN(__pa(memory_end));		if (last_pfn > max_low_pfn)			last_pfn = max_low_pfn;		pages = last_pfn - curr_pfn;		free_bootmem_node(NODE_DATA(0), PFN_PHYS(curr_pfn),				  PFN_PHYS(pages));	}	/*	 * Reserve the kernel text and	 * Reserve the bootmem bitmap. We do this in two steps (first step	 * was init_bootmem()), because this catches the (definitely buggy)	 * case of us accidentally initializing the bootmem allocator with	 * an invalid RAM area.	 */	reserve_bootmem_node(NODE_DATA(0), __MEMORY_START+PAGE_SIZE,		(PFN_PHYS(start_pfn)+bootmap_size+PAGE_SIZE-1)-__MEMORY_START);	/*	 * reserve physical page 0 - it's a special BIOS page on many boxes,	 * enabling clean reboots, SMP operation, laptop functions.	 */	reserve_bootmem_node(NODE_DATA(0), __MEMORY_START, PAGE_SIZE);#ifdef CONFIG_BLK_DEV_INITRD	if (LOADER_TYPE && INITRD_START) {		if (INITRD_START + INITRD_SIZE <= (max_low_pfn << PAGE_SHIFT)) {			reserve_bootmem_node(NODE_DATA(0), INITRD_START+__MEMORY_START, INITRD_SIZE);			initrd_start =				INITRD_START ? INITRD_START + PAGE_OFFSET + __MEMORY_START : 0;			initrd_end = initrd_start + INITRD_SIZE;		} else {			printk("initrd extends beyond end of memory "			    "(0x%08lx > 0x%08lx)\ndisabling initrd\n",				    INITRD_START + INITRD_SIZE,				    max_low_pfn << PAGE_SHIFT);			initrd_start = 0;		}	}#endif#if 0	/*	 * Request the standard RAM and ROM resources -	 * they eat up PCI memory space	 */	request_resource(&iomem_resource, ram_resources+0);	request_resource(&iomem_resource, ram_resources+1);	request_resource(&iomem_resource, ram_resources+2);	request_resource(ram_resources+1, &code_resource);	request_resource(ram_resources+1, &data_resource);	probe_roms();	/* request I/O space for devices used on all i[345]86 PCs */	for (i = 0; i < STANDARD_IO_RESOURCES; i++)		request_resource(&ioport_resource, standard_io_resources+i);#endif#ifdef CONFIG_VT#if defined(CONFIG_VGA_CONSOLE)	conswitchp = &vga_con;#elif defined(CONFIG_DUMMY_CONSOLE)	conswitchp = &dummy_con;#endif#endif	/* Perform the machine specific initialisation */	if (sh_mv.mv_init_arch != NULL) {		sh_mv.mv_init_arch();	}#if defined(__SH4__)	init_task.used_math = 0;	init_task.flags &= ~PF_USEDFPU;#endif#ifdef CONFIG_UBC_WAKEUP	/*	 * Some brain-damaged loaders decided it would be a good idea to put	 * the UBC to sleep. This causes some issues when it comes to things	 * like PTRACE_SINGLESTEP or doing hardware watchpoints in GDB.  So ..	 * we wake it up and hope that all is well.	 */	ubc_wakeup();#endif	paging_init();}struct sh_machine_vector* __init get_mv_byname(const char* name){	extern int strcasecmp(const char *, const char *);	extern long __machvec_start, __machvec_end;	struct sh_machine_vector *all_vecs =		(struct sh_machine_vector *)&__machvec_start;	int i, n = ((unsigned long)&__machvec_end		    - (unsigned long)&__machvec_start)/		sizeof(struct sh_machine_vector);	for (i = 0; i < n; ++i) {		struct sh_machine_vector *mv = &all_vecs[i];		if (mv == NULL)			continue;		if (strcasecmp(name, mv->mv_name) == 0) {			return mv;		}	}	return NULL;}/* *	Get CPU information for use by the procfs. */#ifdef CONFIG_PROC_FSstatic int show_cpuinfo(struct seq_file *m, void *v){#if defined(__sh3__)	seq_printf(m, "cpu family\t: SH-3\n"		      "cache size\t: 8K-byte\n");#elif defined(__SH4__)	seq_printf(m, "cpu family\t: SH-4\n"		      "cache size\t: 8K-byte/16K-byte\n");#endif	seq_printf(m, "bogomips\t: %lu.%02lu\n\n",		     loops_per_jiffy/(500000/HZ),		     (loops_per_jiffy/(5000/HZ)) % 100);	seq_printf(m, "Machine: %s\n", sh_mv.mv_name);#define PRINT_CLOCK(name, value) \	seq_printf(m, name " clock: %d.%02dMHz\n", \		     ((value) / 1000000), ((value) % 1000000)/10000)		PRINT_CLOCK("CPU", boot_cpu_data.cpu_clock);	PRINT_CLOCK("Bus", boot_cpu_data.bus_clock);#ifdef CONFIG_CPU_SUBTYPE_ST40	PRINT_CLOCK("Memory", boot_cpu_data.memory_clock);#endif	PRINT_CLOCK("Peripheral module", boot_cpu_data.module_clock);	return 0;}static void *c_start(struct seq_file *m, loff_t *pos){	return (void*)(*pos == 0);}static void *c_next(struct seq_file *m, void *v, loff_t *pos){	return NULL;}static void c_stop(struct seq_file *m, void *v){}struct seq_operations cpuinfo_op = {	start:	c_start,	next:	c_next,	stop:	c_stop,	show:	show_cpuinfo,};#endif /* CONFIG_PROC_FS */#ifdef CONFIG_SH_KGDB/* * Parse command-line kgdb options.  By default KGDB is enabled, * entered on error (or other action) using default serial info. * The command-line option can include a serial port specification * and an action to override default or configured behavior. */struct kgdb_sermap kgdb_sci_sermap ={ "ttySC", 5, kgdb_sci_setup, NULL };struct kgdb_sermap *kgdb_serlist = &kgdb_sci_sermap;struct kgdb_sermap *kgdb_porttype = &kgdb_sci_sermap;void kgdb_register_sermap(struct kgdb_sermap *map){	struct kgdb_sermap *last;	for (last = kgdb_serlist; last->next; last = last->next)		;	last->next = map;	if (!map->namelen) {		map->namelen = strlen(map->name);	}}static int __init kgdb_parse_options(char *options){	char c;	int baud;	/* Check for port spec (or use default) */	/* Determine port type and instance */	if (!memcmp(options, "tty", 3)) {		struct kgdb_sermap *map = kgdb_serlist;		while (map && memcmp(options, map->name, map->namelen))			map = map->next;		if (!map) {			KGDB_PRINTK("unknown port spec in %s\n", options);			return -1;		}		kgdb_porttype = map;		kgdb_serial_setup = map->setup_fn;		kgdb_portnum = options[map->namelen] - '0';		options += map->namelen + 1;		options = (*options == ',') ? options+1 : options;				/* Read optional parameters (baud/parity/bits) */		baud = simple_strtoul(options, &options, 10);		if (baud != 0) {			kgdb_baud = baud;			c = toupper(*options);			if (c == 'E' || c == 'O' || c == 'N') {				kgdb_parity = c;				options++;			}			c = *options;			if (c == '7' || c == '8') {				kgdb_bits = c;				options++;			}			options = (*options == ',') ? options+1 : options;		}	}	/* Check for action specification */	if (!memcmp(options, "halt", 4)) {		kgdb_halt = 1;		options += 4;	} else if (!memcmp(options, "disabled", 8)) {		kgdb_enabled = 0;		options += 8;	}	if (*options) {                KGDB_PRINTK("ignored unknown options: %s\n", options);		return 0;	}	return 1;}__setup("kgdb=", kgdb_parse_options);#endif /* CONFIG_SH_KGDB */

⌨️ 快捷键说明

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