From 4eb95d96978c6a4b1768c2324ff87a88af91d255 Mon Sep 17 00:00:00 2001 From: Dobrica Pavlinusic Date: Thu, 26 Jul 2007 23:31:32 -0500 Subject: [PATCH] more cleanups, seems to work now --- Makefile | 2 +- uloader_mod.c | 18 ++++++++---------- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/Makefile b/Makefile index 29e5fd7..2955e69 100644 --- a/Makefile +++ b/Makefile @@ -26,7 +26,7 @@ # Change INCLUDE to match your environment -KERNEL=/rest/ppc/linux-2.4.21-per4 +KERNEL=/rest/ppc/linux-2.4.21-pre4 INCLUDE = -nostdinc -I$(KERNEL)/include -I$(KERNEL)/arch/ppc diff --git a/uloader_mod.c b/uloader_mod.c index ecd5b8c..20a1f92 100644 --- a/uloader_mod.c +++ b/uloader_mod.c @@ -45,7 +45,9 @@ static char* uboot = "u-boot.bin"; // 0x07f00000 static unsigned long laddr = 0x07f00000; -#define LOW_MEM 0x00800000 /* no smaller than kernel + 1M (bss) + initrd */ +#define LOW_MEM ( 8 * 1024 * 1024 ) /* no smaller than kernel + 1M (bss) + initrd */ +#define MAX_INDIRECT_BUFFER_SIZE ((PAGE_SIZE/4-1)*PAGE_SIZE) +#define VMALLOC_SIZE ((LOW_MEM+PAGE_SIZE-1)/PAGE_SIZE)*4 void load_uboot(unsigned long pa_load_uboot, unsigned long pa_uboot_buf, @@ -82,10 +84,10 @@ static void *alloc_high_page(void) { save = vmalloc( VMALLOC_SIZE ); if(!save) { - printk(KERN_INFO "can't vmalloc(%x)\n", VMALLOC_SIZE ); + printk(KERN_INFO "can't vmalloc(%lu)\n", VMALLOC_SIZE ); return 0; } else { - printk(KERN_INFO "vmalloc(%x) = %08x\n", VMALLOC_SIZE, save ); + printk(KERN_INFO "vmalloc(%lu) = %08x\n", VMALLOC_SIZE, save ); } } @@ -93,14 +95,14 @@ static void *alloc_high_page(void) { ptr = kmalloc(PAGE_SIZE, GFP_KERNEL); if(!ptr) { - printk(KERN_INFO "can't kmalloc(%0x)\n", PAGE_SIZE); + printk(KERN_INFO "can't kmalloc(%lu)\n", PAGE_SIZE); return 0; } if( __pa(ptr) >= LOW_MEM ) { - printk(KERN_INFO "kmalloc(%x) = %08x __pa: %08x >= %08x skipped\n", PAGE_SIZE, ptr, __pa(ptr), LOW_MEM ); + printk(KERN_INFO "kmalloc(%lu) = %08x __pa: %08x >= %08x got %d pages before this\n", PAGE_SIZE, ptr, __pa(ptr), LOW_MEM, saved_pages ); break; } - printk(KERN_INFO "%d: kmalloc(%x) = %08x __pa: %08x\n", saved_pages, PAGE_SIZE, ptr, __pa(ptr) ); + //printk(KERN_INFO "%d: kmalloc(%lu) = %08x __pa: %08x\n", saved_pages, PAGE_SIZE, ptr, __pa(ptr) ); save[saved_pages++] = ptr; } printk(KERN_INFO "alloc_high_page %08x __pa: %08x\n", ptr, __pa(ptr) ); @@ -137,8 +139,6 @@ static int read_file(char *filename, struct indirect_buffer **indirect_buf) printk(KERN_INFO "can't open filename %s\n", filename); return PTR_ERR(file); } - printk(KERN_INFO "opened file %s at position %x", filename, file->pos); - file->pos = 0; err = -EIO; if(!file->f_op || !file->f_op->read) { @@ -186,10 +186,8 @@ static int read_file(char *filename, struct indirect_buffer **indirect_buf) file->f_pos = i; fs = get_fs(); set_fs(KERNEL_DS); - printk(KERN_DEBUG "KERNEL_DS\n"); got = file->f_op->read(file, buf, todo, &file->f_pos); set_fs(fs); - printk(KERN_DEBUG "fs\n"); if(got != todo) { printk(KERN_INFO "for block %d got %d expected %8x\n", i, got, todo); goto out2; -- 2.20.1