コード例 #1
0
ファイル: memory.c プロジェクト: ForayJones/iods
void __init prom_meminit(void)
{
	struct prom_pmemblock *p;

#ifdef DEBUG
	pr_debug("YAMON MEMORY DESCRIPTOR dump:\n");
	p = prom_getmdesc();
	while (p->size) {
		int i = 0;
		pr_debug("[%d,%p]: base<%08lx> size<%08lx> type<%s>\n",
			 i, p, p->base, p->size, mtypes[p->type]);
		p++;
		i++;
	}
#endif
	p = prom_getmdesc();

	while (p->size) {
		long type;
		unsigned long base, size;

		type = prom_memtype_classify(p->type);
		base = p->base;
		size = p->size;

		add_memory_region(base, size, type);
                p++;
	}
}
コード例 #2
0
ファイル: memory.c プロジェクト: gonzopancho/asuswrt
void __init prom_meminit(void)
{
	phys_t base = 0, size = RAM_SIZE;
	struct prom_pmemblock *p;

	//printk("ram start= %x, ram end= %x\n",rt2880_res_ram.start, rt2880_res_ram.end); 
	//printk("size = %x\n",rt2880_res_ram.end - rt2880_res_ram.start); 
 	//add_memory_region(0x0a000000, rt2880_res_ram.end - rt2880_res_ram.start, BOOT_MEM_RAM);
#if defined(CONFIG_RT2880_ASIC) || defined(CONFIG_RT2880_FPGA)
	base = 0x08000000;
#endif

	p = prom_getmdesc();
#ifdef DEBUG
	printk("MEMORY DESCRIPTOR dump:\n");
	printk("[0,%p]: base<%08lx> size<%08x> type<%d>\n",
		p, p->base, p->size, p->type);
#endif
	if (!p->base || p->base == 0x08000000)
		base = p->base;

	if (p->size >= (32 * 1024 * 1024) && p->size <= (256 * 1024 * 1024))
		size = p->size;

	add_memory_region(base, size, BOOT_MEM_RAM);
}
コード例 #3
0
__initfunc(void prom_meminit(void))
{
	struct linux_mdesc *p;
	int totram;
	int i = 0;

	p = prom_getmdesc(PROM_NULL_MDESC);
#ifdef DEBUG
	prom_printf("ARCS MEMORY DESCRIPTOR dump:\n");
	while(p) {
		prom_printf("[%d,%p]: base<%08lx> pages<%08lx> type<%s>\n",
			    i, p, p->base, p->pages, mtypes[p->type]);
		p = prom_getmdesc(p);
		i++;
	}
#endif
	p = prom_getmdesc(PROM_NULL_MDESC);
	totram = 0;
	i = 0;
	while(p) {
		if(p->type == free || p->type == fcontig) {
			prom_pblocks[i].base =
				((p->base<<PAGE_SHIFT) + 0x80000000);
			prom_pblocks[i].size = p->pages << PAGE_SHIFT;
			totram += prom_pblocks[i].size;
#ifdef DEBUG
			prom_printf("free_chunk[%d]: base=%08lx size=%d\n",
				    i, prom_pblocks[i].base,
				    prom_pblocks[i].size);
#endif
			i++;
		}
		p = prom_getmdesc(p);
	}
	prom_pblocks[i].base = 0xdeadbeef;
	prom_pblocks[i].size = 0; /* indicates last elem. of array */
	printk("PROMLIB: Total free ram %d bytes (%dK,%dMB)\n",
		    totram, (totram/1024), (totram/1024/1024));

	/* Setup upper physical memory bound. */
	prom_setup_memupper();
}
コード例 #4
0
ファイル: sim_mem.c プロジェクト: Blackburn29/PsycoKernel
void __init prom_meminit(void)
{
	struct prom_pmemblock *p;

	p = prom_getmdesc();

	while (p->size) {
		long type;
		unsigned long base, size;

		type = prom_memtype_classify(p->type);
		base = p->base;
		size = p->size;

		add_memory_region(base, size, type);
		p++;
	}
}
コード例 #5
0
ファイル: memory.c プロジェクト: TitaniumBoy/lin
void __init prom_meminit(void)
{
	struct prom_pmemblock *largest, *p;
	unsigned long bootmap_size;
	int totram;
	int i = 0;

#ifdef DEBUG
	prom_printf("YAMON MEMORY DESCRIPTOR dump:\n");
	p = prom_getmdesc();
	while (p->size) {
		prom_printf("[%d,%p]: base<%08lx> size<%08lx> type<%s>\n",
			    i, p, p->base, p->size, mtypes[p->type]);
		p++;
		i++;
	}
#endif
	totram = 0;
	i = 0;
	p = prom_getmdesc();

	while (p->size) {
		pblocks[i].type = prom_memtype_classify (p->type);
		pblocks[i].base = p->base;
		pblocks[i].size = p->size;
		switch (pblocks[i].type) {
		case MEMTYPE_FREE:
			totram += pblocks[i].size;
#ifdef DEBUG
			prom_printf("free_chunk[%d]: base=%08lx size=%d\n",
				    i, pblocks[i].base, pblocks[i].size);
#endif
			i++;
			break;
		case MEMTYPE_PROM:
#ifdef DEBUG
		        prom_printf("prom_chunk[%d]: base=%08lx size=%d\n",
				    i, pblocks[i].base, pblocks[i].size);
#endif
			i++;
			break;
		default:
			break;
		}
		p++;
	}
	pblocks[i].base = 0xdeadbeef;
	pblocks[i].size = 0; /* indicates last elem. of array */

	max_low_pfn = find_max_low_pfn();
	largest = find_largest_memblock();
	bootmap_size = init_bootmem(largest->base >> PAGE_SHIFT, max_low_pfn);

	for (i = 0; pblocks[i].size; i++)
		if (pblocks[i].type == MEMTYPE_FREE)
			free_bootmem(pblocks[i].base, pblocks[i].size);

	/* This test is simpleminded.  It will fail if the bootmem bitmap
	   falls into multiple adjacent PROM memory areas.  */
	if (bootmap_size > largest->size) {
		prom_printf("CRITIAL: overwriting PROM data.\n");
		BUG();
	}

	/* Reserve the memory bootmap itself */
	reserve_bootmem(largest->base, bootmap_size);
	printk("PROMLIB: Total free ram %d bytes (%dK,%dMB)\n",
	       totram, (totram/1024), (totram/1024/1024));
}