Re: [Linux-ia64] [PATCH] various eli patches

From: Andreas Schwab <schwab_at_suse.de>
Date: 2000-09-06 00:32:13
Bill Nottingham <notting@redhat.com> writes:

|> These are against CVS of a couple of weeks ago.
|> 
|> - eli-initrd-fix.patch:  fixes initrd support, and a couple of compilation
|>   tweaks. virt_to_phys() on an already physical address doesn't yeild a
|>   working initrd location.

IMHO it is better to change read_file to expect a physical address for the
buffer, since this is all it uses anyway.  That way there is no need to
convert from physical address to virtual address and back again.

Here is the patch to implement this:

--- eli.c~	Thu Aug 17 11:18:39 2000
+++ eli.c	Thu Aug 17 11:27:08 2000
@@ -370,7 +370,7 @@
 }
 
 static EFI_STATUS read_file(EFI_FILE_HANDLE fs, EFI_FILE_HANDLE file,
-		UINT64 vbuffer, UINT64 total_size)
+		EFI_PHYSICAL_ADDRESS buffer, UINT64 total_size)
 {
 	EFI_STATUS status;
 
@@ -383,10 +383,8 @@
 	 * needed.
 	 */
 	{
-		EFI_PHYSICAL_ADDRESS buffer;
 		UINTN j = 0;
 
-		buffer = virt_to_phys(vbuffer);
 		while (total_size > 0) {
 			CHAR8 helicopter[4] = { '|' , '/' , '-' , '\\' };
 			UINT64 size;
@@ -411,7 +409,7 @@
 	}
 #else	
 	size = total_size;
-	status = fs->Read(file, &size, (VOID *) virt_to_phys(start_addr));
+	status = fs->Read(file, &size, (VOID *) buffer);
 	if (EFI_ERROR(status))
 		return EFI_LOAD_ERROR;
 
@@ -422,7 +420,7 @@
 }
 
 static INTN load_ramdisk(EFI_FILE_HANDLE fs, CHAR16 *filename,
-		UINT64 start_addr, struct allocated_memory *memory)
+		EFI_PHYSICAL_ADDRESS start_addr, struct allocated_memory *memory)
 {
 	EFI_FILE_HANDLE file;
 	EFI_STATUS status;
@@ -613,7 +611,7 @@
 	    		return EFI_LOAD_ERROR;
 		}
 
-		status = read_file(fs, file, phdr.p_vaddr, phdr.p_filesz);
+		status = read_file(fs, file, virt_to_phys(phdr.p_vaddr), phdr.p_filesz);
 		if (EFI_ERROR(status)) {
 			Print(W2U(L"%s: read failed: %r\n"), filename, status);
 			BS->FreePages(min_addr, pages);
@@ -1263,6 +1261,9 @@
 		case EFI_LOAD_ERROR:
 			goto free_kernel_image;
 		}
+	} else {
+		initrd.start_addr = 0;
+		initrd.pages = 0;
 	}
 
 	/* Must free the ACPI before creating the boot params so the */

Andreas.

-- 
Andreas Schwab                                  "And now for something
SuSE Labs                                        completely different."
Andreas.Schwab@suse.de
SuSE GmbH, Schanzäckerstr. 10, D-90443 Nürnberg
Received on Tue Sep 05 06:32:36 2000

This archive was generated by hypermail 2.1.8 : 2005-08-02 09:19:59 EST