Make pmap_mapdev() deal with non-page-aligned requests.

Add a corresponding pmap_unmapdev() to release the KVM back to kernel_map.
This commit is contained in:
peter 1999-09-11 20:31:32 +00:00
parent 68d776c14a
commit 718e870486
4 changed files with 36 additions and 6 deletions

View File

@ -3280,10 +3280,11 @@ pmap_mapdev(pa, size)
vm_offset_t pa;
vm_size_t size;
{
vm_offset_t va, tmpva;
vm_offset_t va, tmpva, offset;
unsigned *pte;
size = roundup(size, PAGE_SIZE);
offset = pa & PAGE_MASK;
size = roundup(offset + size, PAGE_SIZE);
va = kmem_alloc_pageable(kernel_map, size);
#if !defined(MAX_PERF)
@ -3301,7 +3302,20 @@ pmap_mapdev(pa, size)
}
invltlb();
return ((void *) va);
return ((void *)(va + offset));
}
void
pmap_unmapdev(va, size)
vm_offset_t va;
vm_size_t size;
{
vm_offset_t base, offset;
base = va & PG_FRAME;
offset = va & PAGE_MASK;
size = roundup(offset + size, PAGE_SIZE);
kmem_free(kernel_map, base, size);
}
/*

View File

@ -253,6 +253,7 @@ extern vm_offset_t virtual_end;
void pmap_bootstrap __P(( vm_offset_t, vm_offset_t));
pmap_t pmap_kernel __P((void));
void *pmap_mapdev __P((vm_offset_t, vm_size_t));
void pmap_unmapdev __P((vm_offset_t, vm_size_t));
unsigned *pmap_pte __P((pmap_t, vm_offset_t)) __pure2;
vm_page_t pmap_use_pt __P((pmap_t, vm_offset_t));
#ifdef SMP

View File

@ -3280,10 +3280,11 @@ pmap_mapdev(pa, size)
vm_offset_t pa;
vm_size_t size;
{
vm_offset_t va, tmpva;
vm_offset_t va, tmpva, offset;
unsigned *pte;
size = roundup(size, PAGE_SIZE);
offset = pa & PAGE_MASK;
size = roundup(offset + size, PAGE_SIZE);
va = kmem_alloc_pageable(kernel_map, size);
#if !defined(MAX_PERF)
@ -3301,7 +3302,20 @@ pmap_mapdev(pa, size)
}
invltlb();
return ((void *) va);
return ((void *)(va + offset));
}
void
pmap_unmapdev(va, size)
vm_offset_t va;
vm_size_t size;
{
vm_offset_t base, offset;
base = va & PG_FRAME;
offset = va & PAGE_MASK;
size = roundup(offset + size, PAGE_SIZE);
kmem_free(kernel_map, base, size);
}
/*

View File

@ -253,6 +253,7 @@ extern vm_offset_t virtual_end;
void pmap_bootstrap __P(( vm_offset_t, vm_offset_t));
pmap_t pmap_kernel __P((void));
void *pmap_mapdev __P((vm_offset_t, vm_size_t));
void pmap_unmapdev __P((vm_offset_t, vm_size_t));
unsigned *pmap_pte __P((pmap_t, vm_offset_t)) __pure2;
vm_page_t pmap_use_pt __P((pmap_t, vm_offset_t));
#ifdef SMP