* Added boolean "alreadyWired" parameter to vm_map_physical_memory().

* ioapic_init(): map_physical_memory() was called for already mapped
  addresses. This worked fine, but only because the x86 page mapping code
  didn't mind.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35059 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ingo Weinhold 2010-01-13 22:02:21 +00:00
parent 9435ae9395
commit 946325051b
4 changed files with 17 additions and 12 deletions

View File

@ -69,7 +69,8 @@ area_id vm_create_anonymous_area(team_id team, const char *name, void **address,
uint32 addressSpec, addr_t size, uint32 wiring, uint32 protection, uint32 addressSpec, addr_t size, uint32 wiring, uint32 protection,
addr_t physicalAddress, uint32 flags, bool kernel); addr_t physicalAddress, uint32 flags, bool kernel);
area_id vm_map_physical_memory(team_id team, const char *name, void **address, area_id vm_map_physical_memory(team_id team, const char *name, void **address,
uint32 addressSpec, addr_t size, uint32 protection, addr_t phys_addr); uint32 addressSpec, addr_t size, uint32 protection,
addr_t physicalAddress, bool alreadyWired);
area_id vm_map_physical_memory_vecs(team_id team, const char* name, area_id vm_map_physical_memory_vecs(team_id team, const char* name,
void** _address, uint32 addressSpec, addr_t* _size, uint32 protection, void** _address, uint32 addressSpec, addr_t* _size, uint32 protection,
struct iovec* vecs, uint32 vecCount); struct iovec* vecs, uint32 vecCount);

View File

@ -568,9 +568,10 @@ ioapic_init(kernel_args *args)
// always map the local apic as it can be used for timers even if we // always map the local apic as it can be used for timers even if we
// don't end up using the io apic // don't end up using the io apic
sLocalAPIC = args->arch_args.apic; sLocalAPIC = args->arch_args.apic;
if (map_physical_memory("local apic", (void *)args->arch_args.apic_phys, if (vm_map_physical_memory(B_SYSTEM_TEAM, "local apic", &sLocalAPIC,
B_PAGE_SIZE, B_EXACT_ADDRESS, B_KERNEL_READ_AREA B_EXACT_ADDRESS, B_PAGE_SIZE,
| B_KERNEL_WRITE_AREA, &sLocalAPIC) < B_OK) { B_KERNEL_READ_AREA | B_KERNEL_WRITE_AREA,
args->arch_args.apic_phys, true) < 0) {
panic("mapping the local apic failed"); panic("mapping the local apic failed");
return; return;
} }
@ -597,9 +598,10 @@ ioapic_init(kernel_args *args)
// map in the ioapic // map in the ioapic
sIOAPIC = (ioapic *)args->arch_args.ioapic; sIOAPIC = (ioapic *)args->arch_args.ioapic;
if (map_physical_memory("ioapic", (void *)args->arch_args.ioapic_phys, if (vm_map_physical_memory(B_SYSTEM_TEAM, "ioapic", (void**)&sIOAPIC,
B_PAGE_SIZE, B_EXACT_ADDRESS, B_EXACT_ADDRESS, B_PAGE_SIZE,
B_KERNEL_READ_AREA | B_KERNEL_WRITE_AREA, (void **)&sIOAPIC) < 0) { B_KERNEL_READ_AREA | B_KERNEL_WRITE_AREA,
args->arch_args.ioapic_phys, true) < 0) {
panic("mapping the ioapic failed"); panic("mapping the ioapic failed");
return; return;
} }

View File

@ -573,8 +573,9 @@ vm86_prepare(struct vm86_state *state, unsigned int ramSize)
// map vga/bios area // map vga/bios area
address = (void *)0xa0000; address = (void *)0xa0000;
state->bios_area = vm_map_physical_memory(team->id, "bios", state->bios_area = vm_map_physical_memory(team->id, "bios",
&address, B_EXACT_ADDRESS, 0x60000, B_KERNEL_READ_AREA &address, B_EXACT_ADDRESS, 0x60000,
| B_KERNEL_WRITE_AREA | B_READ_AREA | B_WRITE_AREA, (addr_t)0xa0000); B_KERNEL_READ_AREA | B_KERNEL_WRITE_AREA | B_READ_AREA | B_WRITE_AREA,
(addr_t)0xa0000, false);
if (state->bios_area < B_OK) { if (state->bios_area < B_OK) {
ret = state->bios_area; ret = state->bios_area;
TRACE("Could not map VGA BIOS.\n"); TRACE("Could not map VGA BIOS.\n");

View File

@ -1079,7 +1079,8 @@ err0:
area_id area_id
vm_map_physical_memory(team_id team, const char* name, void** _address, vm_map_physical_memory(team_id team, const char* name, void** _address,
uint32 addressSpec, addr_t size, uint32 protection, addr_t physicalAddress) uint32 addressSpec, addr_t size, uint32 protection, addr_t physicalAddress,
bool alreadyWired)
{ {
VMArea* area; VMArea* area;
VMCache* cache; VMCache* cache;
@ -1132,7 +1133,7 @@ vm_map_physical_memory(team_id team, const char* name, void** _address,
delete_area(locker.AddressSpace(), area); delete_area(locker.AddressSpace(), area);
} }
if (status >= B_OK) { if (status >= B_OK && !alreadyWired) {
// make sure our area is mapped in completely // make sure our area is mapped in completely
vm_translation_map* map = &locker.AddressSpace()->TranslationMap(); vm_translation_map* map = &locker.AddressSpace()->TranslationMap();
@ -4839,7 +4840,7 @@ map_physical_memory(const char* name, void* physicalAddress, size_t numBytes,
return vm_map_physical_memory(VMAddressSpace::KernelID(), name, return vm_map_physical_memory(VMAddressSpace::KernelID(), name,
_virtualAddress, addressSpec, numBytes, protection, _virtualAddress, addressSpec, numBytes, protection,
(addr_t)physicalAddress); (addr_t)physicalAddress, false);
} }