Fixed more issues with 64 bit physical addresses. Mostly by restricting
allocations to 32 bit. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37217 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -599,7 +599,9 @@ b44_MM_AllocateSharedMemory(PLM_DEVICE_BLOCK pDevice, LM_UINT32 BlockSize,
|
||||
dev = (struct be_b44_dev *)(pDevice);
|
||||
area_desc = dev->lockmem_list[dev->lockmem_list_num++] = create_area("broadcom_shared_mem",
|
||||
&pvirt, B_ANY_KERNEL_ADDRESS, ROUND_UP_TO_PAGE(BlockSize),
|
||||
/*B_CONTIGUOUS*/ B_FULL_LOCK, B_READ_AREA | B_WRITE_AREA);
|
||||
B_32_BIT_MEMORY, B_READ_AREA | B_WRITE_AREA);
|
||||
// TODO: B_32_BIT_MEMORY implies contiguous, although that wouldn't
|
||||
// be necessary here!
|
||||
if (area_desc < B_OK)
|
||||
return LM_STATUS_FAILURE;
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* Intel PRO/1000 Family Driver
|
||||
* Copyright (C) 2004 Marcus Overhagen <[email protected]>. All rights reserved.
|
||||
*
|
||||
* Permission to use, copy, modify and distribute this software and its
|
||||
* Permission to use, copy, modify and distribute this software and its
|
||||
* documentation for any purpose and without fee is hereby granted, provided
|
||||
* that the above copyright notice appear in all copies, and that both the
|
||||
* copyright notice and this permission notice appear in supporting documentation.
|
||||
@@ -29,9 +29,13 @@ area_malloc(size_t size)
|
||||
{
|
||||
void *p;
|
||||
size = ROUNDUP(size, B_PAGE_SIZE);
|
||||
|
||||
if (create_area("area_malloc", &p, B_ANY_KERNEL_ADDRESS, size, B_FULL_LOCK, 0) < 0)
|
||||
|
||||
if (create_area("area_malloc", &p, B_ANY_KERNEL_ADDRESS, size,
|
||||
B_32_BIT_MEMORY, 0) < 0) {
|
||||
// TODO: B_32_BIT_MEMORY implies contiguous, although that wouldn't
|
||||
// be necessary here!
|
||||
return 0;
|
||||
}
|
||||
return p;
|
||||
}
|
||||
|
||||
@@ -47,18 +51,18 @@ mempool_init(int count)
|
||||
int chunk_size = 2048;
|
||||
|
||||
int chunk_alloc_size = chunk_size * (count + 1);
|
||||
|
||||
|
||||
char *chunk_base;
|
||||
|
||||
|
||||
int i;
|
||||
|
||||
|
||||
chunk_pool = area_malloc(chunk_alloc_size);
|
||||
if (!chunk_pool) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
chunk_base = (char *)ROUNDUP((unsigned long)chunk_pool, 2048);
|
||||
|
||||
|
||||
for (i = 0; i < count; i++) {
|
||||
chunk_pool_put(chunk_base + i * chunk_size);
|
||||
}
|
||||
|
||||
@@ -648,7 +648,7 @@ static status_t init_ring_buffers(dp83815_properties_t *data)
|
||||
pages = pages_needed(2*MAX_DESC*sizeof(descriptor_t) + NUM_BUFFS*BUFFER_SIZE);
|
||||
|
||||
data->mem_area = create_area(kDevName " desc buffer", (void**)&RxDescRing,
|
||||
B_ANY_KERNEL_ADDRESS, pages * B_PAGE_SIZE, B_CONTIGUOUS,
|
||||
B_ANY_KERNEL_ADDRESS, pages * B_PAGE_SIZE, B_32_BIT_MEMORY,
|
||||
B_READ_AREA | B_WRITE_AREA);
|
||||
if( data->mem_area < 0 )
|
||||
return -1;
|
||||
|
||||
@@ -73,7 +73,9 @@ alloc_mem(void **log, void **phy, size_t size, const char *name)
|
||||
|
||||
size = round_to_pagesize(size);
|
||||
areaid = create_area(name, &logadr, B_ANY_KERNEL_ADDRESS, size,
|
||||
B_CONTIGUOUS, B_READ_AREA | B_WRITE_AREA);
|
||||
B_32_BIT_MEMORY, B_READ_AREA | B_WRITE_AREA);
|
||||
// TODO: The rest of the code doesn't deal correctly with physical
|
||||
// addresses > 4 GB, so we have to force 32 bit addresses here.
|
||||
if (areaid < B_OK) {
|
||||
dprintf("couldn't allocate area %s\n",name);
|
||||
return B_ERROR;
|
||||
|
||||
@@ -114,7 +114,7 @@ typedef ipro1000_device * device_t;
|
||||
void *contigmalloc(int size, int p1, int p2, int p3, int p4, int p5, int p6);
|
||||
void contigfree(void *p, int p1, int p2);
|
||||
|
||||
static inline unsigned long vtophys(unsigned long virtual_addr)
|
||||
static inline u_int64_t vtophys(unsigned long virtual_addr)
|
||||
{
|
||||
physical_entry pe;
|
||||
status_t err;
|
||||
|
||||
@@ -47,7 +47,9 @@ alloc_contiguous(void **virt, void **phy, size_t size, uint32 protection,
|
||||
|
||||
size = round_to_pagesize(size);
|
||||
areaid = create_area(name, &virtadr, B_ANY_KERNEL_ADDRESS, size,
|
||||
B_CONTIGUOUS, protection);
|
||||
B_32_BIT_MEMORY, protection);
|
||||
// TODO: The rest of the code doesn't deal correctly with physical
|
||||
// addresses > 4 GB, so we have to force 32 bit addresses here.
|
||||
if (areaid < B_OK) {
|
||||
ERROR("couldn't allocate area %s\n", name);
|
||||
return B_ERROR;
|
||||
|
||||
@@ -152,8 +152,10 @@ sis900_txInterrupt(struct sis_info *info)
|
||||
struct buffer_desc *descriptor = (void *)read32(info->registers + SiS900_MAC_Tx_DESCR);
|
||||
int16 that;
|
||||
for (that = 0;
|
||||
that < NUM_Tx_DESCR && (void *)physicalAddress(&info->txDescriptor[that],
|
||||
sizeof(struct buffer_desc)) != descriptor; that++) {
|
||||
that < NUM_Tx_DESCR
|
||||
&& physicalAddress(&info->txDescriptor[that],
|
||||
sizeof(struct buffer_desc)) != (addr_t)descriptor;
|
||||
that++) {
|
||||
}
|
||||
if (that == NUM_Tx_DESCR)
|
||||
that = 0;
|
||||
@@ -732,7 +734,9 @@ sis900_createRings(struct sis_info *info)
|
||||
info->txArea = create_area("sis900 tx buffer", (void **)&info->txBuffer[0],
|
||||
B_ANY_KERNEL_ADDRESS,
|
||||
ROUND_TO_PAGE_SIZE(BUFFER_SIZE * NUM_Tx_DESCR),
|
||||
B_FULL_LOCK, B_READ_AREA | B_WRITE_AREA);
|
||||
B_32_BIT_MEMORY, B_READ_AREA | B_WRITE_AREA);
|
||||
// TODO: B_32_BIT_MEMORY implies contiguous, although that wouldn't
|
||||
// be necessary here!
|
||||
if (info->txArea < B_OK)
|
||||
return info->txArea;
|
||||
|
||||
@@ -755,7 +759,9 @@ sis900_createRings(struct sis_info *info)
|
||||
info->rxArea = create_area("sis900 rx buffer", (void **)&info->rxBuffer[0],
|
||||
B_ANY_KERNEL_ADDRESS,
|
||||
ROUND_TO_PAGE_SIZE(BUFFER_SIZE * NUM_Rx_DESCR),
|
||||
B_FULL_LOCK, B_READ_AREA | B_WRITE_AREA);
|
||||
B_32_BIT_MEMORY, B_READ_AREA | B_WRITE_AREA);
|
||||
// TODO: B_32_BIT_MEMORY implies contiguous, although that wouldn't
|
||||
// be necessary here!
|
||||
if (info->rxArea < B_OK) {
|
||||
delete_area(info->txArea);
|
||||
return info->rxArea;
|
||||
|
||||
@@ -269,8 +269,10 @@ alloc_buffers(dev_info_t *device)
|
||||
/* create tx descriptor area */
|
||||
size = RNDUP(sizeof(trns_desc_t) * TX_BUFFERS, B_PAGE_SIZE);
|
||||
device->tx_desc_area = create_area(DEVICE_NAME " tx descriptors",
|
||||
(void **)device->tx_desc, B_ANY_KERNEL_ADDRESS, size, B_FULL_LOCK,
|
||||
(void **)device->tx_desc, B_ANY_KERNEL_ADDRESS, size, B_32_BIT_MEMORY,
|
||||
B_READ_AREA | B_WRITE_AREA);
|
||||
// TODO: B_32_BIT_MEMORY implies contiguous, although that wouldn't
|
||||
// be necessary here!
|
||||
if (device->tx_desc_area < 0)
|
||||
return device->tx_desc_area;
|
||||
|
||||
@@ -288,7 +290,9 @@ alloc_buffers(dev_info_t *device)
|
||||
size = RNDUP(BUFFER_SIZE * TX_BUFFERS, B_PAGE_SIZE);
|
||||
device->tx_buf_area = create_area(DEVICE_NAME " tx buffers",
|
||||
(void **)device->tx_buf, B_ANY_KERNEL_ADDRESS, size,
|
||||
B_FULL_LOCK, B_READ_AREA | B_WRITE_AREA);
|
||||
B_32_BIT_MEMORY, B_READ_AREA | B_WRITE_AREA);
|
||||
// TODO: B_32_BIT_MEMORY implies contiguous, although that wouldn't
|
||||
// be necessary here!
|
||||
if (device->tx_buf_area < 0) {
|
||||
delete_area(device->tx_desc_area); // sensitive to alloc ordering
|
||||
return device->tx_buf_area;
|
||||
@@ -309,7 +313,9 @@ alloc_buffers(dev_info_t *device)
|
||||
size = RNDUP( sizeof(recv_desc_t) * RX_BUFFERS, B_PAGE_SIZE);
|
||||
device->rx_desc_area = create_area(DEVICE_NAME " rx descriptors",
|
||||
(void **)device->rx_desc, B_ANY_KERNEL_ADDRESS, size,
|
||||
B_FULL_LOCK, B_READ_AREA | B_WRITE_AREA);
|
||||
B_32_BIT_MEMORY, B_READ_AREA | B_WRITE_AREA);
|
||||
// TODO: B_32_BIT_MEMORY implies contiguous, although that wouldn't
|
||||
// be necessary here!
|
||||
if (device->rx_desc_area < 0) {
|
||||
delete_area(device->tx_desc_area);
|
||||
delete_area(device->tx_buf_area); // sensitive to alloc ordering
|
||||
@@ -330,7 +336,9 @@ alloc_buffers(dev_info_t *device)
|
||||
size = RNDUP(BUFFER_SIZE * RX_BUFFERS, B_PAGE_SIZE);
|
||||
device->rx_buf_area = create_area(DEVICE_NAME " rx buffers",
|
||||
(void **)device->rx_buf, B_ANY_KERNEL_ADDRESS, size,
|
||||
B_FULL_LOCK, B_READ_AREA | B_WRITE_AREA);
|
||||
B_32_BIT_MEMORY, B_READ_AREA | B_WRITE_AREA);
|
||||
// TODO: B_32_BIT_MEMORY implies contiguous, although that wouldn't
|
||||
// be necessary here!
|
||||
if (device->rx_buf_area < 0) {
|
||||
delete_area(device->tx_desc_area);
|
||||
delete_area(device->tx_buf_area);
|
||||
|
||||
@@ -525,7 +525,9 @@ wb_create_rings(struct wb_device *device)
|
||||
|
||||
device->rxArea = create_area("wb840 rx buffer", (void **)&device->rxBuffer[0],
|
||||
B_ANY_KERNEL_ADDRESS, ROUND_TO_PAGE_SIZE(WB_BUFBYTES * WB_RX_LIST_CNT),
|
||||
B_FULL_LOCK, B_READ_AREA | B_WRITE_AREA);
|
||||
B_32_BIT_MEMORY, B_READ_AREA | B_WRITE_AREA);
|
||||
// TODO: B_32_BIT_MEMORY implies contiguous, although that wouldn't
|
||||
// be necessary here!
|
||||
if (device->rxArea < B_OK)
|
||||
return device->rxArea;
|
||||
|
||||
@@ -545,7 +547,9 @@ wb_create_rings(struct wb_device *device)
|
||||
|
||||
device->txArea = create_area("wb840 tx buffer", (void **)&device->txBuffer[0],
|
||||
B_ANY_KERNEL_ADDRESS, ROUND_TO_PAGE_SIZE(WB_BUFBYTES * WB_TX_LIST_CNT),
|
||||
B_FULL_LOCK, B_READ_AREA | B_WRITE_AREA);
|
||||
B_32_BIT_MEMORY, B_READ_AREA | B_WRITE_AREA);
|
||||
// TODO: B_32_BIT_MEMORY implies contiguous, although that wouldn't
|
||||
// be necessary here!
|
||||
if (device->txArea < B_OK) {
|
||||
delete_area(device->rxArea);
|
||||
return device->txArea;
|
||||
|
||||
@@ -922,7 +922,7 @@ IPW2100::AllocateContiguous(const char *name, void **logicalAddress,
|
||||
size = (size + B_PAGE_SIZE - 1) & ~(B_PAGE_SIZE - 1);
|
||||
void *virtualAddress = NULL;
|
||||
area_id area = create_area(name, &virtualAddress, B_ANY_KERNEL_ADDRESS,
|
||||
size, B_CONTIGUOUS, B_READ_AREA | B_WRITE_AREA);
|
||||
size, B_32_BIT_MEMORY, B_READ_AREA | B_WRITE_AREA);
|
||||
if (area < B_OK) {
|
||||
TRACE_ALWAYS(("IPW2100: allocating contiguous area failed\n"));
|
||||
return area;
|
||||
|
||||
Reference in New Issue
Block a user