当前位置: 首页>>代码示例>>C++>>正文


C++ reserve_bootmem函数代码示例

本文整理汇总了C++中reserve_bootmem函数的典型用法代码示例。如果您正苦于以下问题:C++ reserve_bootmem函数的具体用法?C++ reserve_bootmem怎么用?C++ reserve_bootmem使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了reserve_bootmem函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: bootmem_init

void __init bootmem_init(void)
{
	unsigned long bootmap_size;

	/*
	 * Init memory
	 */
	physical_memory_start = sdram_start;
	physical_memory_end = sdram_start+sdram_size;
	if( ((unsigned long)_end < physical_memory_start) || ((unsigned long)_end > physical_memory_end) )
		printk("BUG: your kernel is not located in the ddr sdram");
	/* start after kernel code */
	memory_start = PAGE_ALIGN((unsigned long)_end);
	memory_end = physical_memory_end;
#ifdef DEBUG
	printk("memory from %lx - %lx\n", memory_start, memory_end);
#endif

	init_mm.start_code = (unsigned long)_stext;
	init_mm.end_code = (unsigned long)_etext;
	init_mm.end_data = (unsigned long)_edata;
	init_mm.brk = (unsigned long)0;

	/*
	 * Give all the memory to the bootmap allocator, tell it to put the
	 * boot mem_map at the start of memory.
	 */
	bootmap_size = init_bootmem_node(
			NODE_DATA(0),
			memory_start >> PAGE_SHIFT, /* map goes here */
			PAGE_OFFSET >> PAGE_SHIFT,
			memory_end >> PAGE_SHIFT);

	/*
	 * Free the usable memory, we have to make sure we do not free
	 * the bootmem bitmap so we then reserve it after freeing it :-)
	 */
	free_bootmem(memory_start, memory_end - memory_start);
	reserve_bootmem(memory_start, bootmap_size);

	/*
	 * reserve initrd boot memory
	 */
#ifdef CONFIG_BLK_DEV_INITRD
	if(_kernel_arg_initrd_start) {
		unsigned long reserve_start = _kernel_arg_initrd_start & PAGE_MASK;
		unsigned long reserve_end = (_kernel_arg_initrd_end + PAGE_SIZE-1) & PAGE_MASK;
		initrd_start = _kernel_arg_initrd_start;
		initrd_end = _kernel_arg_initrd_end;
		printk("reserving initrd memory: %lx size %lx\n", reserve_start, reserve_end-reserve_start);
		reserve_bootmem(reserve_start, reserve_end-reserve_start);
	}
#endif
}
开发者ID:tmatsuya,项目名称:milkymist-linux,代码行数:54,代码来源:init.c

示例2: mach_reserve_bootmem

void __init mach_reserve_bootmem ()
{
#ifdef CONFIG_RTE_CB_MULTI
	/* Prevent the kernel from touching the monitor's scratch RAM.  */
	reserve_bootmem (MON_SCRATCH_ADDR, MON_SCRATCH_SIZE);
#endif

	/* The space between SRAM and SDRAM is filled with duplicate
	   images of SRAM.  Prevent the kernel from using them.  */
	reserve_bootmem (SRAM_ADDR + SRAM_SIZE,
			 SDRAM_ADDR - (SRAM_ADDR + SRAM_SIZE));
}
开发者ID:3sOx,项目名称:asuswrt-merlin,代码行数:12,代码来源:rte_ma1_cb.c

示例3: sec_log_setup

static int __init sec_log_setup(char *str)
{
	unsigned size=memparse(str, &str);
	unsigned long base = 0;
	unsigned alloc_size=0;
	unsigned size_of_struct_sec_log_buffer=0;

	if (!size /*|| size != roundup_pow_of_two(size)*/ || *str != '@'
				    || kstrtoul(str + 1, 0, &base))
		return -1;
	sec_logbuf_base_addr = base;
	sec_logbuf_size = size;
#ifdef CONFIG_SEC_LOG_BUF_NOCACHE
	sec_log_buf_nocache_enable=1;
#else
	size_of_struct_sec_log_buffer = ((sizeof(struct sec_log_buffer)+4)/4)*4;
	// sec_logbuf_size(1M) + sec_log_buffer(16B) + sec_log_ptr(4B) + sec_log_mag(4B)
	alloc_size = sec_logbuf_size + size_of_struct_sec_log_buffer + 4 + 4; 
	if(reserve_bootmem(sec_logbuf_base_addr,alloc_size, BOOTMEM_EXCLUSIVE))
	{
		printk("%s: fail to reserve memory\n",__func__);
		return -1;
	}
	else {
			printk("%s: success to reserve memory, base_phys=%x, size=%x\n",__func__,sec_logbuf_base_addr, alloc_size);
	}	
	sec_log_buf_nocache_enable=0;
#endif	
	return 0;
	
}
开发者ID:TechTex198,项目名称:SM-G318H-Kernel-Source,代码行数:31,代码来源:sec_log.c

示例4: mach_reserve_bootmem

void __init mach_reserve_bootmem(void)
{
	unsigned *vmem_reg_addr;
	void *vram_mem;

	/* Reserve memory for the framebuffer */
//#ifdef CONFIG_XILINX_TFT_CNTLR_REF_0_INSTANCE
#if 0
	/* Get address of DCR across the OPB->DCR bridge */
	vmem_reg_addr = (unsigned *) 
		(CONFIG_XILINX_TFT_CNTLR_REF_0_DCR_BASEADDR*4 +
		0xD0000000);

	/* Let's take 2MB off the top of RAM */
	vram_mem=CONFIG_XILINX_ERAM_START+CONFIG_XILINX_ERAM_SIZE;
	vram_mem-=0x200000;

	printk("Reserving 2MB for video memory (0x%08x-0x%08x)\n",
			(vram_mem), vram_mem + 0x1fffff);
	reserve_bootmem(__pa(vram_mem),0x200000);
	/* Set the vmem address on the controller */
	*vmem_reg_addr = vram_mem;

	/* Tell the video driver where to find the video mem */
	__vram_start = vram_mem;
#endif
}
开发者ID:ProjectZeroSlackr,项目名称:linux-2.4.32-ipod,代码行数:27,代码来源:machine.c

示例5: mach_reserve_bootmem

void __init mach_reserve_bootmem ()
{
    if (SDRAM_ADDR < RAM_END && SDRAM_ADDR > RAM_START)
        /* We can't use the space between SRAM and SDRAM, so
           prevent the kernel from trying.  */
        reserve_bootmem (SRAM_END, SDRAM_ADDR - SRAM_END);
}
开发者ID:Dronevery,项目名称:JetsonTK1-kernel,代码行数:7,代码来源:as85ep1.c

示例6: sec_tsp_log_setup

static int __init sec_tsp_log_setup(char *str)
{
	unsigned size = memparse(str, &str);
	unsigned long base = 0;
	unsigned *sec_tsp_log_mag;
	/* If we encounter any problem parsing str ... */
	if (!size || size != roundup_pow_of_two(size) || *str != '@'
		|| kstrtoul(str + 1, 0, &base))
			goto out;

	if (reserve_bootmem(base - 8 , size + 8, BOOTMEM_EXCLUSIVE)) {
			pr_err("%s: failed reserving size %d " \
						"at base 0x%lx\n", __func__, size, base);
			goto out;
	}

	sec_tsp_log_mag = phys_to_virt(base) - 8;
	sec_tsp_log_ptr = phys_to_virt(base) - 4;
	sec_tsp_log_buf = phys_to_virt(base);
	sec_tsp_log_size = size;

	pr_info("%s: *sec_tsp_log_ptr:%x " \
		"sec_tsp_log_buf:%p sec_tsp_log_size:0x%x\n",
		__func__, *sec_tsp_log_ptr, sec_tsp_log_buf,
		sec_tsp_log_size);

	if (*sec_tsp_log_mag != LOG_MAGIC) {
		pr_info("%s: no old log found\n", __func__);
		*sec_tsp_log_ptr = 0;
		*sec_tsp_log_mag = LOG_MAGIC;
	}
	return 1;
out:
	return 0;
}
开发者ID:AMohseni76,项目名称:LP_SM_P600_KERNEL,代码行数:35,代码来源:sec_log.c

示例7: mach_reserve_bootmem

void __init mach_reserve_bootmem ()
{
	/* The space between SRAM and SDRAM is filled with duplicate
	   images of SRAM.  Prevent the kernel from using them.  */
	reserve_bootmem (SRAM_ADDR + SRAM_SIZE,
			 SDRAM_ADDR - (SRAM_ADDR + SRAM_SIZE));
}
开发者ID:FatSunHYS,项目名称:OSCourseDesign,代码行数:7,代码来源:anna.c

示例8: platform_alloc_bootmem

/*
 * Allocates/reserves the Platform memory resources early in the boot process.
 * This ignores any resources that are designated IORESOURCE_IO
 */
void __init platform_alloc_bootmem(void)
{
	int i;
	int total = 0;

	/* Get persistent memory data from command line before allocating
	 * resources. This need to happen before normal command line parsing
	 * has been done */
	pmem_setup_resource();

	/* Loop through looking for resources that want a particular address */
	for (i = 0; gp_resources[i].flags != 0; i++) {
		int size = resource_size(&gp_resources[i]);
		if ((gp_resources[i].start != 0) &&
			((gp_resources[i].flags & IORESOURCE_MEM) != 0)) {
			reserve_bootmem(dma_to_phys(gp_resources[i].start),
				size, 0);
			total += resource_size(&gp_resources[i]);
			pr_info("reserve resource %s at %08x (%u bytes)\n",
				gp_resources[i].name, gp_resources[i].start,
				resource_size(&gp_resources[i]));
		}
	}

	/* Loop through assigning addresses for those that are left */
	for (i = 0; gp_resources[i].flags != 0; i++) {
		int size = resource_size(&gp_resources[i]);
		if ((gp_resources[i].start == 0) &&
			((gp_resources[i].flags & IORESOURCE_MEM) != 0)) {
			void *mem = alloc_bootmem_pages(size);

			if (mem == NULL)
				pr_err("Unable to allocate bootmem pages "
					"for %s\n", gp_resources[i].name);

			else {
				gp_resources[i].start =
					phys_to_dma(virt_to_phys(mem));
				gp_resources[i].end =
					gp_resources[i].start + size - 1;
				total += size;
				pr_info("allocate resource %s at %08x "
						"(%u bytes)\n",
					gp_resources[i].name,
					gp_resources[i].start, size);
			}
		}
	}

	pr_info("Total Platform driver memory allocation: 0x%08x\n", total);

	/* indicate resources that are platform I/O related */
	for (i = 0; gp_resources[i].flags != 0; i++) {
		if ((gp_resources[i].start != 0) &&
			((gp_resources[i].flags & IORESOURCE_IO) != 0)) {
			pr_info("reserved platform resource %s at %08x\n",
				gp_resources[i].name, gp_resources[i].start);
		}
	}
}
开发者ID:212006949,项目名称:linux,代码行数:64,代码来源:asic_devices.c

示例9: reserve_bootmem_generic

void __init reserve_bootmem_generic(unsigned long phys, unsigned len) 
{ 
#ifdef CONFIG_NUMA
	int nid = phys_to_nid(phys);
#endif
	unsigned long pfn = phys >> PAGE_SHIFT;
	if (pfn >= end_pfn) {
		/* This can happen with kdump kernels when accessing firmware
		   tables. */
		if (pfn < end_pfn_map)
			return;
		printk(KERN_ERR "reserve_bootmem: illegal reserve %lx %u\n",
				phys, len);
		return;
	}

	/* Should check here against the e820 map to avoid double free */
#ifdef CONFIG_NUMA
  	reserve_bootmem_node(NODE_DATA(nid), phys, len);
#else       		
	reserve_bootmem(phys, len);    
#endif
	if (phys+len <= MAX_DMA_PFN*PAGE_SIZE) {
		dma_reserve += len / PAGE_SIZE;
		set_dma_reserve(dma_reserve);
	}
}
开发者ID:PennPanda,项目名称:linux-repo,代码行数:27,代码来源:init_64.c

示例10: device_tree_init

void __init device_tree_init(void)
{
	unsigned long base, size;
	void *fdt_copy;

	if (!initial_boot_params)
		return;

	base = virt_to_phys((void *)initial_boot_params);
	size = be32_to_cpu(initial_boot_params->totalsize);

	/* Before we do anything, lets reserve the dt blob */
	reserve_bootmem(base, size, BOOTMEM_DEFAULT);

	/* The strings in the flattened tree are referenced directly by the
	 * device tree, so copy the flattened device tree from init memory
	 * to regular memory.
	 */
	fdt_copy = alloc_bootmem(size);
	memcpy(fdt_copy, initial_boot_params, size);
	initial_boot_params = fdt_copy;

	unflatten_device_tree();

	/* free the space reserved for the dt blob */
	free_bootmem(base, size);
}
开发者ID:212006949,项目名称:linux,代码行数:27,代码来源:of.c

示例11: atari_stram_reserve_pages

/*
 * This function is called from setup_arch() to reserve the pages needed for
 * ST-RAM management.
 */
void __init atari_stram_reserve_pages(void *start_mem)
{
	/* always reserve first page of ST-RAM, the first 2 kB are
	 * supervisor-only! */
	if (!kernel_in_stram)
		reserve_bootmem (0, PAGE_SIZE);

}
开发者ID:1x23,项目名称:unifi-gpl,代码行数:12,代码来源:stram.c

示例12: platform_alloc_bootmem

void __init platform_alloc_bootmem(void)
{
	int i;
	int total = 0;

	pmem_setup_resource();

	
	for (i = 0; gp_resources[i].flags != 0; i++) {
		int size = resource_size(&gp_resources[i]);
		if ((gp_resources[i].start != 0) &&
			((gp_resources[i].flags & IORESOURCE_MEM) != 0)) {
			reserve_bootmem(dma_to_phys(gp_resources[i].start),
				size, 0);
			total += resource_size(&gp_resources[i]);
			pr_info("reserve resource %s at %08x (%u bytes)\n",
				gp_resources[i].name, gp_resources[i].start,
				resource_size(&gp_resources[i]));
		}
	}

	
	for (i = 0; gp_resources[i].flags != 0; i++) {
		int size = resource_size(&gp_resources[i]);
		if ((gp_resources[i].start == 0) &&
			((gp_resources[i].flags & IORESOURCE_MEM) != 0)) {
			void *mem = alloc_bootmem_pages(size);

			if (mem == NULL)
				pr_err("Unable to allocate bootmem pages "
					"for %s\n", gp_resources[i].name);

			else {
				gp_resources[i].start =
					phys_to_dma(virt_to_phys(mem));
				gp_resources[i].end =
					gp_resources[i].start + size - 1;
				total += size;
				pr_info("allocate resource %s at %08x "
						"(%u bytes)\n",
					gp_resources[i].name,
					gp_resources[i].start, size);
			}
		}
	}

	pr_info("Total Platform driver memory allocation: 0x%08x\n", total);

	
	for (i = 0; gp_resources[i].flags != 0; i++) {
		if ((gp_resources[i].start != 0) &&
			((gp_resources[i].flags & IORESOURCE_IO) != 0)) {
			pr_info("reserved platform resource %s at %08x\n",
				gp_resources[i].name, gp_resources[i].start);
		}
	}
}
开发者ID:Blackburn29,项目名称:PsycoKernel,代码行数:57,代码来源:asic_devices.c

示例13: omap_boxer_map_io

static void __init omap_boxer_map_io(void)
{
#ifdef CONFIG_ANDROID_RAM_CONSOLE
    reserve_bootmem(BOXER_RAM_CONSOLE_START, BOXER_RAM_CONSOLE_SIZE, 0);
#endif /* CONFIG_ANDROID_RAM_CONSOLE */
	omap2_set_globals_343x();
	iotable_init(boxer_io_desc, ARRAY_SIZE(boxer_io_desc));
	omap2_map_common_io();
}
开发者ID:dalingrin,项目名称:Nook_Color_Kernel_Overclock,代码行数:9,代码来源:board-3621_evt1a.c

示例14: bootmem_init

static void __init bootmem_init(void)
{
	unsigned long start_pfn, bootmap_size;
	unsigned long size = initrd_end - initrd_start;

	start_pfn = PFN_UP(__pa(&_end));

	min_low_pfn = PFN_UP(MEMORY_START);
	max_low_pfn = PFN_UP(MEMORY_START + MEMORY_SIZE);

	/* Initialize the boot-time allocator with low memory only. */
	bootmap_size = init_bootmem_node(NODE_DATA(0), start_pfn,
					 min_low_pfn, max_low_pfn);
	add_active_range(0, min_low_pfn, max_low_pfn);

	free_bootmem(PFN_PHYS(start_pfn),
		     (max_low_pfn - start_pfn) << PAGE_SHIFT);
	memory_present(0, start_pfn, max_low_pfn);

	/* Reserve space for the bootmem bitmap. */
	reserve_bootmem(PFN_PHYS(start_pfn), bootmap_size, BOOTMEM_DEFAULT);

	if (size == 0) {
		printk(KERN_INFO "Initrd not found or empty");
		goto disable;
	}

	if (__pa(initrd_end) > PFN_PHYS(max_low_pfn)) {
		printk(KERN_ERR "Initrd extends beyond end of memory");
		goto disable;
	}

	/* Reserve space for the initrd bitmap. */
	reserve_bootmem(__pa(initrd_start), size, BOOTMEM_DEFAULT);
	initrd_below_start_ok = 1;

	pr_info("Initial ramdisk at: 0x%lx (%lu bytes)\n",
		 initrd_start, size);
	return;
disable:
	printk(KERN_CONT " - disabling initrd\n");
	initrd_start = 0;
	initrd_end = 0;
}
开发者ID:325116067,项目名称:semc-qsd8x50,代码行数:44,代码来源:setup.c

示例15: tima_setup_rkp_mem

static int  tima_setup_rkp_mem(void){
	if(reserve_bootmem(TIMA_DEBUG_LOG_START, TIMA_DEBUG_LOG_SIZE, BOOTMEM_EXCLUSIVE)){
		pr_err("%s: RKP failed reserving size %d " \
			   "at base 0x%x\n", __func__, TIMA_DEBUG_LOG_SIZE, TIMA_DEBUG_LOG_START);
		goto out;
	}
	pr_info("RKP :%s, base:%x, size:%x \n", __func__,TIMA_DEBUG_LOG_START, TIMA_DEBUG_LOG_SIZE);

 		   
	if(reserve_bootmem(TIMA_SEC_TO_PGT, TIMA_SEC_TO_PGT_SIZE, BOOTMEM_EXCLUSIVE)){
		pr_err("%s: RKP failed reserving size %d " \
			   "at base 0x%x\n", __func__, TIMA_SEC_TO_PGT_SIZE, TIMA_SEC_TO_PGT);
		goto out;
	}
	pr_info("RKP :%s, base:%x, size:%x \n", __func__,TIMA_SEC_TO_PGT, TIMA_SEC_TO_PGT_SIZE);
 

	if(reserve_bootmem(TIMA_SEC_LOG, TIMA_SEC_LOG_SIZE, BOOTMEM_EXCLUSIVE)){
		pr_err("%s: RKP failed reserving size %d " \
			   "at base 0x%x\n", __func__, TIMA_SEC_LOG_SIZE, TIMA_SEC_LOG);
		goto out;
	}
	pr_info("RKP :%s, base:%x, size:%x \n", __func__,TIMA_SEC_LOG, TIMA_SEC_LOG_SIZE);

	if(reserve_bootmem(TIMA_PHYS_MAP,  TIMA_PHYS_MAP_SIZE, BOOTMEM_EXCLUSIVE)){
		pr_err("%s: RKP failed reserving size %d "					\
			   "at base 0x%x\n", __func__, TIMA_PHYS_MAP_SIZE, TIMA_PHYS_MAP);
		goto out;
	}
	pr_info("RKP :%s, base:%x, size:%x \n", __func__,TIMA_PHYS_MAP, TIMA_PHYS_MAP_SIZE);

	if(reserve_bootmem(TIMA_DASHBOARD_START,  TIMA_DASHBOARD_SIZE, BOOTMEM_EXCLUSIVE)){
		pr_err("%s: RKP failed reserving size %d "					\
			   "at base 0x%x\n", __func__, TIMA_DASHBOARD_SIZE, TIMA_DASHBOARD_START);
		goto out;
	}
	pr_info("RKP :%s, base:%x, size:%x \n", __func__,TIMA_DASHBOARD_START, TIMA_DASHBOARD_SIZE);

	
	return 1; 
 out: 
	return 0; 

}
开发者ID:Biktorgj,项目名称:kminilte_kernel,代码行数:44,代码来源:sec_log.c


注:本文中的reserve_bootmem函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。