summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2010-12-24 11:17:03 -0500
committerKevin O'Connor <kevin@koconnor.net>2010-12-24 11:17:03 -0500
commitd1a1746c5c8610041a706aa8f4819cea794dd5af (patch)
tree272e8815a3718d30a8284a41d11040699faa5589
parentf9b0930ab9efe5f340edbb61f3a5269dbff8c663 (diff)
Breakup boot_setup() bootorder code into its own function.
-rw-r--r--src/boot.c71
1 files changed, 41 insertions, 30 deletions
diff --git a/src/boot.c b/src/boot.c
index 4fb73ac..5137345 100644
--- a/src/boot.c
+++ b/src/boot.c
@@ -18,9 +18,44 @@ struct ipl_s IPL;
/****************************************************************
- * IPL and BCV handlers
+ * Boot setup
****************************************************************/
+static void
+loadBootOrder(void)
+{
+ char *f = romfile_loadfile("bootorder", NULL);
+ if (!f)
+ return;
+
+ int i;
+ IPL.fw_bootorder_count = 1;
+ while (f[i]) {
+ if (f[i] == '\n')
+ IPL.fw_bootorder_count++;
+ i++;
+ }
+ IPL.fw_bootorder = malloc_tmphigh(IPL.fw_bootorder_count*sizeof(char*));
+ if (!IPL.fw_bootorder) {
+ warn_noalloc();
+ free(f);
+ return;
+ }
+
+ dprintf(3, "boot order:\n");
+ i = 0;
+ do {
+ IPL.fw_bootorder[i] = f;
+ f = strchr(f, '\n');
+ if (f) {
+ *f = '\0';
+ f++;
+ dprintf(3, "%d: %s\n", i, IPL.fw_bootorder[i]);
+ i++;
+ }
+ } while(f);
+}
+
void
boot_setup(void)
{
@@ -68,37 +103,13 @@ boot_setup(void)
IPL.checkfloppysig = 1;
}
- char *f = romfile_loadfile("bootorder", NULL);
- if (!f)
- return;
+ loadBootOrder();
+}
- int i;
- IPL.fw_bootorder_count = 1;
- while(f[i]) {
- if (f[i] == '\n')
- IPL.fw_bootorder_count++;
- i++;
- }
- IPL.fw_bootorder = malloc_tmphigh(IPL.fw_bootorder_count*sizeof(char*));
- if (!IPL.fw_bootorder) {
- warn_noalloc();
- free(f);
- return;
- }
- dprintf(3, "boot order:\n");
- i = 0;
- do {
- IPL.fw_bootorder[i] = f;
- f = strchr(f, '\n');
- if (f) {
- *f = '\0';
- f++;
- dprintf(3, "%d: %s\n", i, IPL.fw_bootorder[i]);
- i++;
- }
- } while(f);
-}
+/****************************************************************
+ * IPL and BCV handlers
+ ****************************************************************/
// Add a BEV vector for a given pnp compatible option rom.
void