Subject: Still can't alloc physical memory in cpu_setup().
To: None <tech-kern@netbsd.org>
From: Alexander Funcke <funcke@daemon.se>
List: tech-kern
Date: 05/04/2002 02:51:35
Hi,

I'm now running NetBSD-current and want to add support for National's
Geode SCx200 family. One of the features on the chip is an scratchpad
RAM area.

It is this one I want to alloc space for.

The physical address is at gx_base and the area is GX_BASE_SIZE bytes.
This code is executed from cpu_setup() in arch/i386/i386/machdep.c
for the particular CPU.

Running this code tell me kernel_map equals NULL, so I guess uvm_init()
hasn't taken place? even though I believed it had...

anyways, I don't have a kernel_map, but I still want to alloc this area,
should I just wait until later in the startup or is there away to do this
before uvm_init?


if(gx_base) {
		pgpa = i386_trunc_page(gx_base);
		endpa = i386_round_page(gx_base + GX_BASE_SIZE);
		
		if(kernel_map == NULL) {
			printf("aborting GX mapping\n");
			return;
		}

		if((va = uvm_km_valloc(kernel_map, endpa - pgpa)) == 0) {
			printf("cpu0: Couldn't allocate a virtual adress for gx_base\n");
			return;
		}

		for(; pgpa > endpa; pgpa += NBPG, va += NBPG)
			pmap_kenter_pa(va, pgpa, VM_PROT_READ | VM_PROT_WRITE);
				
		pmap_update(kernel_map);
	} else 
		printf("cpu0: This doesn't seem like an GX1 Geode.\n");
}

TIA,
/Alexander Funcke