printf("mem_add_mapping bpa %x size %x, spa %x epa %x\n", bpa, size, spa, epa);
bus_mem_add_mapping(bpa, size, cacheable, bshp)	bus_addr_t bpa;	bus_size_t size;	int cacheable;	bus_space_handle_t *bshp;{	bus_addr_t vaddr;	bus_addr_t spa, epa;	bus_size_t off;	int len;	spa = trunc_page(bpa);	epa = bpa + size;	off = bpa - spa;	len = size+off;printf("mem_add_mapping bpa %x size %x, spa %x epa %x\n",	bpa, size, spa, epa);#if 0	if (epa <= spa) {		panic("bus_mem_add_mapping: overflow");	}#endif	if (ppc_malloc_ok == 0) { 		bus_size_t alloc_size;		/* need to steal vm space before kernel vm is initialized */		alloc_size = trunc_page(size + NBPG);		ppc_kvm_size -= alloc_size;		vaddr = VM_MIN_KERNEL_ADDRESS + ppc_kvm_size;	} else {#ifdef UVM		vaddr = uvm_km_valloc_wait(phys_map, len);#else		vaddr = kmem_alloc_wait(phys_map, len);#endif	}	*bshp = vaddr + off;#ifdef DEBUG_BUS_MEM_ADD_MAPPING	printf("mapping %x size %x to %x vbase %x\n", 		bpa, size, *bshp, spa);#endif	for (; len > 0; len -= NBPG) {#if 0		pmap_enter(vm_map_pmap(phys_map), vaddr, spa,#else		pmap_enter(pmap_kernel(), vaddr, spa,#endif			VM_PROT_READ | VM_PROT_WRITE, TRUE, 0/* XXX */);		spa += NBPG;		vaddr += NBPG;	}	return 0;}