Ticket #9074: ticket_9074.patch

File ticket_9074.patch, 1.6 KB (added by jerl1, 9 years ago)
  • src/add-ons/kernel/drivers/audio/ice1712/util.cpp

    diff --git a/src/add-ons/kernel/drivers/audio/ice1712/util.cpp b/src/add-ons/kernel/drivers/audio/ice1712/util.cpp
    index 01a172e..b091e32 100644
    a b  
    1212#include <OS.h>
    1313#include <string.h>
    1414
     15#include <vm/vm.h>
     16#include <vm/VMAddressSpace.h>
     17
    1518#include "debug.h"
    1619#include "util.h"
    1720
    1821static spinlock slock = B_SPINLOCK_INITIALIZER;
    19 static uint32 round_to_pagesize(uint32 size);
    2022
    2123cpu_status
    2224lock(void)
    unlock(cpu_status status)  
    3537}
    3638
    3739
    38 uint32
    39 round_to_pagesize(uint32 size)
    40 {
    41     return (size + B_PAGE_SIZE - 1) & ~(B_PAGE_SIZE - 1);
    42 }
    43 
    44 
    4540area_id
    4641alloc_mem(physical_entry *phy, addr_t *log, size_t size, const char *name)
    4742{
    4843    void * logadr;
    4944    area_id areaid;
    5045    status_t rv;
     46    team_id teamid = VMAddressSpace::KernelID();
     47    virtual_address_restrictions virtual_add = {};
     48    physical_address_restrictions phys_add = {};
     49    phys_add.high_address = 1 << 28;
     50    // ICE1712 chipset can not deal with memory area beyond 256MB
    5151
    5252    ITRACE("Allocating %s: ", name);
    5353
    54     size = round_to_pagesize(size);
    55     areaid = create_area(name, &logadr, B_ANY_KERNEL_ADDRESS, size,
    56         B_32_BIT_CONTIGUOUS, B_READ_AREA | B_WRITE_AREA);
    57         // TODO: The rest of the code doesn't deal correctly with physical
    58         // addresses > 4 GB, so we have to force 32 bit addresses here.
     54    areaid = vm_create_anonymous_area(teamid, name, size, B_CONTIGUOUS,
     55        B_READ_AREA | B_WRITE_AREA, 0, B_PAGE_SIZE,
     56        &virtual_add, &phys_add, true, &logadr);
     57
    5958    if (areaid < B_OK) {
    6059        ITRACE("couldn't allocate\n");
    6160        return B_ERROR;