replaced LOG with TRACE

git-svn-id: file:///srv/svn/repos/haiku/trunk/current@7385 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
beveloper
2004-05-03 22:04:31 +00:00
parent 4ade280af9
commit eeb57e873c
2 changed files with 17 additions and 15 deletions
@@ -1,13 +1,17 @@
/* Realtek RTL8169 Family Driver
* Copyright (C) 2004 Marcus Overhagen <[email protected]>. All rights reserved.
*/
#include <Errors.h>
#include <OS.h>
#include <string.h>
//#define DEBUG
#include "debug.h"
#include "util.h"
uint32 round_to_pagesize(uint32 size);
uint32 round_to_pagesize(uint32 size)
static inline uint32
round_to_pagesize(uint32 size)
{
return (size + B_PAGE_SIZE - 1) & ~(B_PAGE_SIZE - 1);
}
@@ -20,18 +24,18 @@ alloc_mem(void **virt, void **phy, size_t size, uint32 protection, const char *n
area_id areaid;
status_t rv;
LOG("allocating %ld bytes for %s\n", size, name);
TRACE("allocating %ld bytes for %s\n", size, name);
size = round_to_pagesize(size);
areaid = create_area(name, &virtadr, B_ANY_KERNEL_ADDRESS, size, B_FULL_LOCK | B_CONTIGUOUS, protection);
if (areaid < B_OK) {
LOG("couldn't allocate area %s\n", name);
ERROR("couldn't allocate area %s\n", name);
return B_ERROR;
}
rv = get_memory_map(virtadr, size, &pe, 1);
if (rv < B_OK) {
delete_area(areaid);
LOG("couldn't map %s\n", name);
ERROR("couldn't get mapping for %s\n", name);
return B_ERROR;
}
memset(virtadr, 0, size);
@@ -39,15 +43,10 @@ alloc_mem(void **virt, void **phy, size_t size, uint32 protection, const char *n
*virt = virtadr;
if (phy)
*phy = pe.address;
LOG("area = %ld, size = %ld, virt = %p, phy = %p\n", areaid, size, virtadr, pe.address);
TRACE("area = %ld, size = %ld, virt = %p, phy = %p\n", areaid, size, virtadr, pe.address);
return areaid;
}
/* This is not the most advanced method to map physical memory for io access.
* Perhaps using B_ANY_KERNEL_ADDRESS instead of B_ANY_KERNEL_BLOCK_ADDRESS
* makes the whole offset calculation and relocation obsolete. But the code
* below does work, and I can't test if using B_ANY_KERNEL_ADDRESS also works.
*/
area_id
map_mem(void **virt, void *phy, size_t size, uint32 protection, const char *name)
{
@@ -56,20 +55,20 @@ map_mem(void **virt, void *phy, size_t size, uint32 protection, const char *name
void *mapadr;
area_id area;
LOG("mapping physical address %p with %ld bytes for %s\n", phy, size, name);
TRACE("mapping physical address %p with %ld bytes for %s\n", phy, size, name);
offset = (uint32)phy & (B_PAGE_SIZE - 1);
phyadr = (char *)phy - offset;
size = round_to_pagesize(size + offset);
area = map_physical_memory(name, phyadr, size, B_ANY_KERNEL_BLOCK_ADDRESS, protection, &mapadr);
if (area < B_OK) {
LOG("mapping failed, error 0x%x (%s)\n", area, strerror(area));
ERROR("mapping '%s' failed, error 0x%lx (%s)\n", name, area, strerror(area));
return area;
}
*virt = (char *)mapadr + offset;
LOG("physical = %p, virtual = %p, offset = %ld, phyadr = %p, mapadr = %p, size = %ld, area = 0x%08lx\n",
TRACE("physical = %p, virtual = %p, offset = %ld, phyadr = %p, mapadr = %p, size = %ld, area = 0x%08lx\n",
phy, *virt, offset, phyadr, mapadr, size, area);
return area;
@@ -1,3 +1,6 @@
/* Realtek RTL8169 Family Driver
* Copyright (C) 2004 Marcus Overhagen <[email protected]>. All rights reserved.
*/
#ifndef __UTIL_H
#define __UTIL_H