diff options
Diffstat (limited to 'ext2load')
-rw-r--r-- | ext2load/ext2io.c | 21 | ||||
-rw-r--r-- | ext2load/loader.c | 19 |
2 files changed, 12 insertions, 28 deletions
diff --git a/ext2load/ext2io.c b/ext2load/ext2io.c index aa4b4c0..9f16473 100644 --- a/ext2load/ext2io.c +++ b/ext2load/ext2io.c @@ -17,6 +17,7 @@ #include <ext2_fs.h> #include <ext2fs.h> #include <arc.h> +#include <debug.h> /* * All About the Cache @@ -596,9 +597,7 @@ arc_read_blk(io_channel channel, unsigned long block, int count, void *buf) priv = (struct arc_private_data *) channel->private_data; EXT2_CHECK_MAGIC(priv, EXT2_ET_BAD_MAGIC); -#ifdef DEBUG - printf("req %lu id %lu count %u\n\r", block, priv->fileID, count); -#endif + debug_printf("req %lu id %lu count %u\n\r", block, priv->fileID, count); /* Odd-sized reads can't be cached. */ if (count < 0) @@ -607,9 +606,7 @@ arc_read_blk(io_channel channel, unsigned long block, int count, void *buf) while (count > 0) { if ((cache = find_cached_block(priv, block)) == NULL) break; -#ifdef DEBUG - printf("Cache hit on block %lu\n\r", block); -#endif + debug_printf("Cache hit on block %lu\n\r", block); memcpy(cbuf, cache->buf, channel->block_size); count--; block++; @@ -626,15 +623,11 @@ arc_read_blk(io_channel channel, unsigned long block, int count, void *buf) * for reads we expect are not part of a sequential set. */ while (count > 0) { -#ifdef DEBUG - printf("Cache miss on block %lu (readahead %u)\n\r", + debug_printf("Cache miss on block %lu (readahead %u)\n\r", block, CACHE_SG_MAX); -#endif if ((cb_alloc = alloc_sg_blocks(channel, priv, block, CACHE_SG_MAX)) == 0) { -#ifdef DEBUG - printf("%s\n\r", "Cache error: can't alloc any blocks"); -#endif + debug_printf("%s\n\r", "Cache error: can't alloc any blocks"); /* Cache is broken, so do the raw read. */ cache_invalidate(channel, priv); status = raw_read_blk(channel, priv, block, count, @@ -643,10 +636,8 @@ arc_read_blk(io_channel channel, unsigned long block, int count, void *buf) } if ((status = fill_sg_blocks(channel, priv, cb_alloc)) != 0) { -#ifdef DEBUG - printf("Cache error (status %lu at block %lu(%u)\n\r", + debug_printf("Cache error (status %lu at block %lu(%u)\n\r", (unsigned long) status, block, count); -#endif /* Cache is broken, so do the raw read. */ cache_invalidate(channel, priv); status = raw_read_blk(channel, priv, block, count, diff --git a/ext2load/loader.c b/ext2load/loader.c index 44203b6..1feb6ba 100644 --- a/ext2load/loader.c +++ b/ext2load/loader.c @@ -20,6 +20,7 @@ #include "arcboot.h" #include <subarch.h> +#include <debug.h> #define KSEG0ADDR(addr) (((addr) & 0x1fffffff) | 0x80000000) @@ -76,9 +77,7 @@ void InitMalloc(void) { MEMORYDESCRIPTOR *current = NULL; ULONG stack = (ULONG) ¤t; -#ifdef DEBUG - printf("stack starts at: 0x%lx\n\r", stack); -#endif + debug_printf("stack starts at: 0x%lx\n\r", stack); current = ArcGetMemoryDescriptor(current); if(! current ) { @@ -96,10 +95,8 @@ void InitMalloc(void) ULONG start = KSEG0ADDR(current->BasePage * PAGE_SIZE); ULONG end = start + (current->PageCount * PAGE_SIZE); -#if DEBUG - printf("Free Memory(%u) segment found at (0x%lx,0x%lx).\n\r", + debug_printf("Free Memory(%u) segment found at (0x%lx,0x%lx).\n\r", current->Type, start, end); -#endif /* Leave some space for our stack */ if ((stack >= start) && (stack < end)) @@ -118,10 +115,8 @@ void InitMalloc(void) + kernel_load[SUBARCH].reserved ))) end = kernel_load[SUBARCH].base; if (end > start) { -#ifdef DEBUG - printf("Adding %lu bytes at 0x%lx to the list of available memory\n\r", + debug_printf("Adding %lu bytes at 0x%lx to the list of available memory\n\r", end-start, start); -#endif arclib_malloc_add(start, end - start); } } @@ -561,10 +556,8 @@ void _start(LONG argc, CHAR *argv[], CHAR *envp[]) if (OSLoadPartition == NULL) Fatal("Invalid load partition\n\r"); -#if DEBUG - printf("OSLoadPartition: %s\n\r", OSLoadPartition); - printf("OSLoadFilename: %s\n\r", OSLoadFilename); -#endif + debug_printf("OSLoadPartition: %s\n\r", OSLoadPartition); + debug_printf("OSLoadFilename: %s\n\r", OSLoadFilename); /* * XXX: let's play stupid for now: assume /etc/arcboot.conf * is on OSLoadPartition |