[OpenBIOS] [commit] r1279 - trunk/openbios-devel/packages

repository service svn at openbios.org
Sun Mar 9 21:50:56 CET 2014


Author: mcayland
Date: Sun Mar  9 21:50:51 2014
New Revision: 1279
URL: http://tracker.coreboot.org/trac/openbios/changeset/1279

Log:
mac-parts.c: introduce new get-bootcode-info word

This is an intermediate step in preparation for allowing %BOOT to read its
load/entry addresses from the partition header, based upon an original patch
by Andrei E. Warkentin <andrey.warkentin at gmail.com>.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland at ilande.co.uk>

Modified:
   trunk/openbios-devel/packages/mac-parts.c

Modified: trunk/openbios-devel/packages/mac-parts.c
==============================================================================
--- trunk/openbios-devel/packages/mac-parts.c	Sun Mar  9 21:50:36 2014	(r1278)
+++ trunk/openbios-devel/packages/mac-parts.c	Sun Mar  9 21:50:51 2014	(r1279)
@@ -35,6 +35,7 @@
 	xt_t		seek_xt, read_xt;
 	ucell	        offs_hi, offs_lo;
         ucell	        size_hi, size_lo;
+	ucell		bootcode_addr, bootcode_entry;
 	unsigned int	blocksize;
 	phandle_t	filesystem_ph;
 } macparts_info_t;
@@ -237,8 +238,19 @@
 	    size = (long long)__be32_to_cpu(par.pmPartBlkCnt) * bs;	
 	    
 	    if (want_bootcode) {
-		offs += (long long)__be32_to_cpu(par.pmLgBootStart) * bs;
+		    
+		/* If size == 0 then fail because we requested bootcode but it doesn't exist */
 		size = (long long)__be32_to_cpu(par.pmBootSize);
+		if (!size) {
+		    ret = 0;
+		    goto out;
+		}
+
+		/* Adjust seek position so 0 = start of bootcode */
+		offs += (long long)__be32_to_cpu(par.pmLgBootStart) * bs;
+
+		di->bootcode_addr = __be32_to_cpu(par.pmBootLoad);
+		di->bootcode_entry = __be32_to_cpu(par.pmBootEntry);
 	    }
 	    
 	    di->blocksize = (unsigned int)bs;	
@@ -326,6 +338,17 @@
 	PUSH( di->size_hi );
 }
 
+/* ( -- size entry addr ) */
+static void
+macparts_get_bootcode_info( macparts_info_t *di )
+{
+	DPRINTF("macparts_get_bootcode_info");
+
+	PUSH( di->size_lo );
+	PUSH( di->bootcode_entry );
+	PUSH( di->bootcode_addr );
+}
+
 static void
 macparts_block_size( macparts_info_t *di )
 {
@@ -403,15 +426,16 @@
 }
 
 NODE_METHODS( macparts ) = {
-	{ "probe",	macparts_probe 		},
-	{ "open",	macparts_open 		},
-	{ "seek",	macparts_seek 		},
-	{ "read",	macparts_read 		},
-	{ "load",	macparts_load 		},
-	{ "dir",	macparts_dir 		},
-	{ "get-info",	macparts_get_info 	},
-	{ "block-size",	macparts_block_size 	},
-	{ NULL,		macparts_initialize	},
+	{ "probe",		macparts_probe	 		},
+	{ "open",		macparts_open 			},
+	{ "seek",		macparts_seek 			},
+	{ "read",		macparts_read 			},
+	{ "load",		macparts_load 			},
+	{ "dir",		macparts_dir 			},
+	{ "get-info",		macparts_get_info 		},
+	{ "get-bootcode-info",	macparts_get_bootcode_info	},
+	{ "block-size",		macparts_block_size 		},
+	{ NULL,			macparts_initialize		},
 };
 
 void



More information about the OpenBIOS mailing list