blob: d44605af11ee3049abe538065fd93711f719cbf6 [file] [log] [blame]
Kevin O'Connorf13b0082008-08-17 11:26:42 -04001// Code to load disk image and start system boot.
Kevin O'Connorf076a3e2008-02-25 22:25:15 -05002//
Kevin O'Connor0ac5e9e2013-09-14 13:09:27 -04003// Copyright (C) 2008-2013 Kevin O'Connor <kevin@koconnor.net>
Kevin O'Connorf076a3e2008-02-25 22:25:15 -05004// Copyright (C) 2002 MandrakeSoft S.A.
5//
Kevin O'Connorb1b7c2a2009-01-15 20:52:58 -05006// This file may be distributed under the terms of the GNU LGPLv3 license.
Kevin O'Connorf076a3e2008-02-25 22:25:15 -05007
Kevin O'Connor135f3f62013-09-14 23:57:26 -04008#include "block.h" // struct drive_s
Kevin O'Connor2d2fa312013-09-14 21:55:26 -04009#include "bregs.h" // struct bregs
Kevin O'Connor38fcbfe2008-02-25 22:30:47 -050010#include "config.h" // CONFIG_*
Kevin O'Connorccee6e82013-09-02 21:25:21 -040011#include "fw/paravirt.h" // qemu_cfg_show_boot_menu
Kevin O'Connor5d369d82013-09-02 20:48:46 -040012#include "hw/pci.h" // pci_bdf_to_*
Kevin O'Connor8b7861c2013-09-15 02:29:06 -040013#include "hw/rtc.h" // rtc_read
Kevin O'Connor5d369d82013-09-02 20:48:46 -040014#include "hw/usb.h" // struct usbdevice_s
Kevin O'Connor446defb2013-06-08 21:50:53 -040015#include "list.h" // hlist_node
Kevin O'Connor9dea5902013-09-14 20:23:54 -040016#include "malloc.h" // free
Kevin O'Connor2d2fa312013-09-14 21:55:26 -040017#include "output.h" // dprintf
Kevin O'Connor41639f82013-09-14 19:37:36 -040018#include "romfile.h" // romfile_loadint
Kevin O'Connor135f3f62013-09-14 23:57:26 -040019#include "std/disk.h" // struct mbr_s
Kevin O'Connorfa9c66a2013-09-14 19:10:40 -040020#include "string.h" // memset
Kevin O'Connor2d2fa312013-09-14 21:55:26 -040021#include "util.h" // irqtimer_calc
Kevin O'Connorc659fde2008-12-28 23:43:20 -050022
Kevin O'Connor9f4e1d92009-02-08 15:44:08 -050023
24/****************************************************************
Kevin O'Connor031ef552010-12-27 19:26:57 -050025 * Boot priority ordering
Kevin O'Connor9f4e1d92009-02-08 15:44:08 -050026 ****************************************************************/
27
Kevin O'Connor70c94dd2013-03-08 19:39:49 -050028static char **Bootorder VARVERIFY32INIT;
Kevin O'Connor3da2c1c2010-12-29 11:37:41 -050029static int BootorderCount;
30
Kevin O'Connord1a17462010-12-24 11:17:03 -050031static void
32loadBootOrder(void)
33{
Kevin O'Connor49bf57b2011-05-10 22:08:30 -040034 if (!CONFIG_BOOTORDER)
35 return;
36
Kevin O'Connord1a17462010-12-24 11:17:03 -050037 char *f = romfile_loadfile("bootorder", NULL);
38 if (!f)
39 return;
40
Kevin O'Connor8bf55032011-01-01 11:00:42 -050041 int i = 0;
Kevin O'Connor3da2c1c2010-12-29 11:37:41 -050042 BootorderCount = 1;
Kevin O'Connord1a17462010-12-24 11:17:03 -050043 while (f[i]) {
44 if (f[i] == '\n')
Kevin O'Connor3da2c1c2010-12-29 11:37:41 -050045 BootorderCount++;
Kevin O'Connord1a17462010-12-24 11:17:03 -050046 i++;
47 }
Kevin O'Connor3da2c1c2010-12-29 11:37:41 -050048 Bootorder = malloc_tmphigh(BootorderCount*sizeof(char*));
49 if (!Bootorder) {
Kevin O'Connord1a17462010-12-24 11:17:03 -050050 warn_noalloc();
51 free(f);
Kevin O'Connor4d0c5922011-01-26 21:04:01 -050052 BootorderCount = 0;
Kevin O'Connord1a17462010-12-24 11:17:03 -050053 return;
54 }
55
Gerd Hoffmannf5beab42013-12-06 10:29:09 +010056 dprintf(1, "boot order:\n");
Kevin O'Connord1a17462010-12-24 11:17:03 -050057 i = 0;
58 do {
Kevin O'Connor3da2c1c2010-12-29 11:37:41 -050059 Bootorder[i] = f;
Kevin O'Connord1a17462010-12-24 11:17:03 -050060 f = strchr(f, '\n');
Kevin O'Connor8bf55032011-01-01 11:00:42 -050061 if (f)
62 *(f++) = '\0';
Kevin O'Connor9e881a32011-01-08 12:06:54 -050063 nullTrailingSpace(Bootorder[i]);
Gerd Hoffmannf5beab42013-12-06 10:29:09 +010064 dprintf(1, "%d: %s\n", i+1, Bootorder[i]);
Kevin O'Connor8bf55032011-01-01 11:00:42 -050065 i++;
66 } while (f);
67}
68
69// See if 'str' starts with 'glob' - if glob contains an '*' character
70// it will match any number of characters in str that aren't a '/' or
71// the next glob character.
72static char *
73glob_prefix(const char *glob, const char *str)
74{
75 for (;;) {
76 if (!*glob && (!*str || *str == '/'))
77 return (char*)str;
78 if (*glob == '*') {
79 if (!*str || *str == '/' || *str == glob[1])
80 glob++;
81 else
82 str++;
83 continue;
Kevin O'Connord1a17462010-12-24 11:17:03 -050084 }
Kevin O'Connor8bf55032011-01-01 11:00:42 -050085 if (*glob != *str)
86 return NULL;
87 glob++;
88 str++;
89 }
90}
91
92// Search the bootorder list for the given glob pattern.
93static int
94find_prio(const char *glob)
95{
96 dprintf(1, "Searching bootorder for: %s\n", glob);
97 int i;
98 for (i = 0; i < BootorderCount; i++)
99 if (glob_prefix(glob, Bootorder[i]))
100 return i+1;
101 return -1;
102}
103
104#define FW_PCI_DOMAIN "/pci@i0cf8"
105
Kevin O'Connor659c99d2011-06-20 23:29:15 -0400106static char *
107build_pci_path(char *buf, int max, const char *devname, struct pci_device *pci)
108{
Kevin O'Connor8bf55032011-01-01 11:00:42 -0500109 // Build the string path of a bdf - for example: /pci@i0cf8/isa@1,2
110 char *p = buf;
Kevin O'Connor659c99d2011-06-20 23:29:15 -0400111 if (pci->parent) {
112 p = build_pci_path(p, max, "pci-bridge", pci->parent);
Kevin O'Connord08eb9c2011-01-10 00:48:45 -0500113 } else {
Kevin O'Connor659c99d2011-06-20 23:29:15 -0400114 if (pci->rootbus)
115 p += snprintf(p, max, "/pci-root@%x", pci->rootbus);
Kevin O'Connord08eb9c2011-01-10 00:48:45 -0500116 p += snprintf(p, buf+max-p, "%s", FW_PCI_DOMAIN);
117 }
Kevin O'Connor8bf55032011-01-01 11:00:42 -0500118
Kevin O'Connor659c99d2011-06-20 23:29:15 -0400119 int dev = pci_bdf_to_dev(pci->bdf), fn = pci_bdf_to_fn(pci->bdf);
Kevin O'Connord08eb9c2011-01-10 00:48:45 -0500120 p += snprintf(p, buf+max-p, "/%s@%x", devname, dev);
Kevin O'Connor8bf55032011-01-01 11:00:42 -0500121 if (fn)
122 p += snprintf(p, buf+max-p, ",%x", fn);
123 return p;
Kevin O'Connord1a17462010-12-24 11:17:03 -0500124}
125
Kevin O'Connordc3a7d62011-07-09 14:33:56 -0400126int bootprio_find_pci_device(struct pci_device *pci)
Kevin O'Connor031ef552010-12-27 19:26:57 -0500127{
David Woodhouse118469a2013-01-25 19:46:25 -0600128 if (CONFIG_CSM)
129 return csm_bootprio_pci(pci);
Kevin O'Connor49bf57b2011-05-10 22:08:30 -0400130 if (!CONFIG_BOOTORDER)
131 return -1;
Kevin O'Connor8bf55032011-01-01 11:00:42 -0500132 // Find pci device - for example: /pci@i0cf8/ethernet@5
133 char desc[256];
Kevin O'Connordc3a7d62011-07-09 14:33:56 -0400134 build_pci_path(desc, sizeof(desc), "*", pci);
Kevin O'Connor8bf55032011-01-01 11:00:42 -0500135 return find_prio(desc);
Kevin O'Connor031ef552010-12-27 19:26:57 -0500136}
137
Paolo Bonzinic5c488f2012-02-27 17:22:23 +0100138int bootprio_find_scsi_device(struct pci_device *pci, int target, int lun)
139{
140 if (!CONFIG_BOOTORDER)
141 return -1;
142 if (!pci)
143 // support only pci machine for now
144 return -1;
145 // Find scsi drive - for example: /pci@i0cf8/scsi@5/channel@0/disk@1,0
146 char desc[256], *p;
147 p = build_pci_path(desc, sizeof(desc), "*", pci);
148 snprintf(p, desc+sizeof(desc)-p, "/*@0/*@%d,%d", target, lun);
149 return find_prio(desc);
150}
151
Kevin O'Connor95b2e0c2011-07-09 14:42:11 -0400152int bootprio_find_ata_device(struct pci_device *pci, int chanid, int slave)
Kevin O'Connor031ef552010-12-27 19:26:57 -0500153{
David Woodhouse118469a2013-01-25 19:46:25 -0600154 if (CONFIG_CSM)
155 return csm_bootprio_ata(pci, chanid, slave);
Kevin O'Connor49bf57b2011-05-10 22:08:30 -0400156 if (!CONFIG_BOOTORDER)
157 return -1;
Kevin O'Connor95b2e0c2011-07-09 14:42:11 -0400158 if (!pci)
Kevin O'Connor8bf55032011-01-01 11:00:42 -0500159 // support only pci machine for now
160 return -1;
161 // Find ata drive - for example: /pci@i0cf8/ide@1,1/drive@1/disk@0
162 char desc[256], *p;
Kevin O'Connor95b2e0c2011-07-09 14:42:11 -0400163 p = build_pci_path(desc, sizeof(desc), "*", pci);
Kevin O'Connor8bf55032011-01-01 11:00:42 -0500164 snprintf(p, desc+sizeof(desc)-p, "/drive@%x/disk@%x", chanid, slave);
165 return find_prio(desc);
Kevin O'Connor031ef552010-12-27 19:26:57 -0500166}
167
Kevin O'Connor03e589c2011-07-09 14:35:37 -0400168int bootprio_find_fdc_device(struct pci_device *pci, int port, int fdid)
Kevin O'Connor031ef552010-12-27 19:26:57 -0500169{
David Woodhouse118469a2013-01-25 19:46:25 -0600170 if (CONFIG_CSM)
171 return csm_bootprio_fdc(pci, port, fdid);
Kevin O'Connor49bf57b2011-05-10 22:08:30 -0400172 if (!CONFIG_BOOTORDER)
173 return -1;
Kevin O'Connor03e589c2011-07-09 14:35:37 -0400174 if (!pci)
Kevin O'Connor8bf55032011-01-01 11:00:42 -0500175 // support only pci machine for now
176 return -1;
177 // Find floppy - for example: /pci@i0cf8/isa@1/fdc@03f1/floppy@0
178 char desc[256], *p;
Kevin O'Connor03e589c2011-07-09 14:35:37 -0400179 p = build_pci_path(desc, sizeof(desc), "isa", pci);
Kevin O'Connor8bf55032011-01-01 11:00:42 -0500180 snprintf(p, desc+sizeof(desc)-p, "/fdc@%04x/floppy@%x", port, fdid);
181 return find_prio(desc);
Kevin O'Connor031ef552010-12-27 19:26:57 -0500182}
183
Kevin O'Connorfce91892011-07-09 14:47:47 -0400184int bootprio_find_pci_rom(struct pci_device *pci, int instance)
Kevin O'Connor031ef552010-12-27 19:26:57 -0500185{
Kevin O'Connor49bf57b2011-05-10 22:08:30 -0400186 if (!CONFIG_BOOTORDER)
187 return -1;
Kevin O'Connor8bf55032011-01-01 11:00:42 -0500188 // Find pci rom - for example: /pci@i0cf8/scsi@3:rom2
189 char desc[256], *p;
Kevin O'Connorfce91892011-07-09 14:47:47 -0400190 p = build_pci_path(desc, sizeof(desc), "*", pci);
Kevin O'Connor8bf55032011-01-01 11:00:42 -0500191 if (instance)
192 snprintf(p, desc+sizeof(desc)-p, ":rom%d", instance);
193 return find_prio(desc);
Kevin O'Connor031ef552010-12-27 19:26:57 -0500194}
195
196int bootprio_find_named_rom(const char *name, int instance)
197{
Kevin O'Connor49bf57b2011-05-10 22:08:30 -0400198 if (!CONFIG_BOOTORDER)
199 return -1;
Kevin O'Connor8bf55032011-01-01 11:00:42 -0500200 // Find named rom - for example: /rom@genroms/linuxboot.bin
201 char desc[256], *p;
202 p = desc + snprintf(desc, sizeof(desc), "/rom@%s", name);
203 if (instance)
204 snprintf(p, desc+sizeof(desc)-p, ":rom%d", instance);
205 return find_prio(desc);
Kevin O'Connor031ef552010-12-27 19:26:57 -0500206}
207
Kevin O'Connorea274782012-03-08 07:49:09 -0500208static char *
209build_usb_path(char *buf, int max, struct usbhub_s *hub)
210{
211 if (!hub->usbdev)
212 // Root hub - nothing to add.
213 return buf;
214 char *p = build_usb_path(buf, max, hub->usbdev->hub);
215 p += snprintf(p, buf+max-p, "/hub@%x", hub->usbdev->port+1);
216 return p;
217}
218
Kevin O'Connor7fa31b52012-06-13 08:47:03 -0400219int bootprio_find_usb(struct usbdevice_s *usbdev, int lun)
Kevin O'Connorc2002a12010-12-31 14:38:10 -0500220{
Kevin O'Connor49bf57b2011-05-10 22:08:30 -0400221 if (!CONFIG_BOOTORDER)
222 return -1;
Kevin O'Connor7fa31b52012-06-13 08:47:03 -0400223 // Find usb - for example: /pci@i0cf8/usb@1,2/storage@1/channel@0/disk@0,0
Kevin O'Connorc2002a12010-12-31 14:38:10 -0500224 char desc[256], *p;
Kevin O'Connorea274782012-03-08 07:49:09 -0500225 p = build_pci_path(desc, sizeof(desc), "usb", usbdev->hub->cntl->pci);
226 p = build_usb_path(p, desc+sizeof(desc)-p, usbdev->hub);
Kevin O'Connor7fa31b52012-06-13 08:47:03 -0400227 snprintf(p, desc+sizeof(desc)-p, "/storage@%x/*@0/*@0,%d"
228 , usbdev->port+1, lun);
229 int ret = find_prio(desc);
230 if (ret >= 0)
231 return ret;
232 // Try usb-host/redir - for example: /pci@i0cf8/usb@1,2/usb-host@1
233 snprintf(p, desc+sizeof(desc)-p, "/usb-*@%x", usbdev->port+1);
Kevin O'Connorc2002a12010-12-31 14:38:10 -0500234 return find_prio(desc);
235}
236
Kevin O'Connor031ef552010-12-27 19:26:57 -0500237
238/****************************************************************
239 * Boot setup
240 ****************************************************************/
241
Kevin O'Connor11a72342013-03-05 17:52:21 +0800242static int BootRetryTime;
Kevin O'Connorbaaadb62010-12-29 11:18:04 -0500243static int CheckFloppySig = 1;
244
Kevin O'Connor72eee3e2010-12-27 19:07:49 -0500245#define DEFAULT_PRIO 9999
246
247static int DefaultFloppyPrio = 101;
248static int DefaultCDPrio = 102;
249static int DefaultHDPrio = 103;
250static int DefaultBEVPrio = 104;
251
Kevin O'Connor9f4e1d92009-02-08 15:44:08 -0500252void
Kevin O'Connord83c87b2013-01-21 01:14:12 -0500253boot_init(void)
Kevin O'Connor9f4e1d92009-02-08 15:44:08 -0500254{
255 if (! CONFIG_BOOT)
256 return;
Kevin O'Connor9f4e1d92009-02-08 15:44:08 -0500257
Kevin O'Connor897fb112013-02-07 23:32:48 -0500258 if (CONFIG_QEMU) {
Kevin O'Connor9f4e1d92009-02-08 15:44:08 -0500259 // On emulators, get boot order from nvram.
Kevin O'Connor8b7861c2013-09-15 02:29:06 -0400260 if (rtc_read(CMOS_BIOS_BOOTFLAG1) & 1)
Kevin O'Connorbaaadb62010-12-29 11:18:04 -0500261 CheckFloppySig = 0;
Kevin O'Connor8b7861c2013-09-15 02:29:06 -0400262 u32 bootorder = (rtc_read(CMOS_BIOS_BOOTFLAG2)
263 | ((rtc_read(CMOS_BIOS_BOOTFLAG1) & 0xf0) << 4));
Kevin O'Connor72eee3e2010-12-27 19:07:49 -0500264 DefaultFloppyPrio = DefaultCDPrio = DefaultHDPrio
265 = DefaultBEVPrio = DEFAULT_PRIO;
266 int i;
267 for (i=101; i<104; i++) {
268 u32 val = bootorder & 0x0f;
269 bootorder >>= 4;
270 switch (val) {
271 case 1: DefaultFloppyPrio = i; break;
272 case 2: DefaultHDPrio = i; break;
273 case 3: DefaultCDPrio = i; break;
274 case 4: DefaultBEVPrio = i; break;
275 }
276 }
Kevin O'Connor9f4e1d92009-02-08 15:44:08 -0500277 }
Gleb Natapovb9a75912010-12-23 11:29:38 +0200278
Kevin O'Connor11a72342013-03-05 17:52:21 +0800279 BootRetryTime = romfile_loadint("etc/boot-fail-wait", 60*1000);
280
Kevin O'Connord1a17462010-12-24 11:17:03 -0500281 loadBootOrder();
Kevin O'Connor9f4e1d92009-02-08 15:44:08 -0500282}
283
Kevin O'Connord1a17462010-12-24 11:17:03 -0500284
285/****************************************************************
Kevin O'Connor031ef552010-12-27 19:26:57 -0500286 * BootList handling
Kevin O'Connord1a17462010-12-24 11:17:03 -0500287 ****************************************************************/
288
Kevin O'Connor031ef552010-12-27 19:26:57 -0500289struct bootentry_s {
290 int type;
291 union {
292 u32 data;
293 struct segoff_s vector;
294 struct drive_s *drive;
295 };
296 int priority;
297 const char *description;
Kevin O'Connor446defb2013-06-08 21:50:53 -0400298 struct hlist_node node;
Kevin O'Connor031ef552010-12-27 19:26:57 -0500299};
Kevin O'Connor446defb2013-06-08 21:50:53 -0400300static struct hlist_head BootList VARVERIFY32INIT;
Kevin O'Connor031ef552010-12-27 19:26:57 -0500301
Kevin O'Connor7bb15842010-12-29 11:25:14 -0500302#define IPL_TYPE_FLOPPY 0x01
303#define IPL_TYPE_HARDDISK 0x02
304#define IPL_TYPE_CDROM 0x03
305#define IPL_TYPE_CBFS 0x20
306#define IPL_TYPE_BEV 0x80
307#define IPL_TYPE_BCV 0x81
Kevin O'Connor54ae5432013-01-12 16:36:11 -0500308#define IPL_TYPE_HALT 0xf0
Kevin O'Connor7bb15842010-12-29 11:25:14 -0500309
Kevin O'Connor72eee3e2010-12-27 19:07:49 -0500310static void
311bootentry_add(int type, int prio, u32 data, const char *desc)
Kevin O'Connor9f4e1d92009-02-08 15:44:08 -0500312{
Kevin O'Connor9f4e1d92009-02-08 15:44:08 -0500313 if (! CONFIG_BOOT)
314 return;
Kevin O'Connor72eee3e2010-12-27 19:07:49 -0500315 struct bootentry_s *be = malloc_tmp(sizeof(*be));
316 if (!be) {
317 warn_noalloc();
Kevin O'Connor9f4e1d92009-02-08 15:44:08 -0500318 return;
Kevin O'Connor72eee3e2010-12-27 19:07:49 -0500319 }
320 be->type = type;
321 be->priority = prio;
322 be->data = data;
Kevin O'Connorca2bc1c2010-12-29 21:41:19 -0500323 be->description = desc ?: "?";
Kevin O'Connor8bf55032011-01-01 11:00:42 -0500324 dprintf(3, "Registering bootable: %s (type:%d prio:%d data:%x)\n"
325 , be->description, type, prio, data);
Kevin O'Connor9f4e1d92009-02-08 15:44:08 -0500326
Kevin O'Connor72eee3e2010-12-27 19:07:49 -0500327 // Add entry in sorted order.
Kevin O'Connor446defb2013-06-08 21:50:53 -0400328 struct hlist_node **pprev;
329 struct bootentry_s *pos;
Kevin O'Connor030a58a2013-06-13 21:24:14 -0400330 hlist_for_each_entry_pprev(pos, pprev, &BootList, node) {
Kevin O'Connor72eee3e2010-12-27 19:07:49 -0500331 if (be->priority < pos->priority)
332 break;
333 if (be->priority > pos->priority)
334 continue;
335 if (be->type < pos->type)
336 break;
337 if (be->type > pos->type)
338 continue;
339 if (be->type <= IPL_TYPE_CDROM
340 && (be->drive->type < pos->drive->type
341 || (be->drive->type == pos->drive->type
342 && be->drive->cntl_id < pos->drive->cntl_id)))
343 break;
344 }
Kevin O'Connor446defb2013-06-08 21:50:53 -0400345 hlist_add(&be->node, pprev);
Kevin O'Connor0a924122009-02-08 19:43:47 -0500346}
Kevin O'Connor9f4e1d92009-02-08 15:44:08 -0500347
Kevin O'Connor031ef552010-12-27 19:26:57 -0500348// Return the given priority if it's set - defaultprio otherwise.
349static inline int defPrio(int priority, int defaultprio) {
350 return (priority < 0) ? defaultprio : priority;
351}
352
Kevin O'Connor72eee3e2010-12-27 19:07:49 -0500353// Add a BEV vector for a given pnp compatible option rom.
Gleb Natapov4c90a202010-12-07 13:50:54 +0200354void
Kevin O'Connor031ef552010-12-27 19:26:57 -0500355boot_add_bev(u16 seg, u16 bev, u16 desc, int prio)
Gleb Natapov4c90a202010-12-07 13:50:54 +0200356{
Kevin O'Connor031ef552010-12-27 19:26:57 -0500357 bootentry_add(IPL_TYPE_BEV, defPrio(prio, DefaultBEVPrio)
358 , SEGOFF(seg, bev).segoff
Kevin O'Connor72eee3e2010-12-27 19:07:49 -0500359 , desc ? MAKE_FLATPTR(seg, desc) : "Unknown");
360 DefaultBEVPrio = DEFAULT_PRIO;
Gleb Natapov4c90a202010-12-07 13:50:54 +0200361}
362
Kevin O'Connor0a924122009-02-08 19:43:47 -0500363// Add a bcv entry for an expansion card harddrive or legacy option rom
364void
Kevin O'Connor031ef552010-12-27 19:26:57 -0500365boot_add_bcv(u16 seg, u16 ip, u16 desc, int prio)
Kevin O'Connor0a924122009-02-08 19:43:47 -0500366{
Kevin O'Connor88e745e2012-01-14 11:58:14 -0500367 bootentry_add(IPL_TYPE_BCV, defPrio(prio, DefaultHDPrio)
Kevin O'Connor031ef552010-12-27 19:26:57 -0500368 , SEGOFF(seg, ip).segoff
Kevin O'Connor72eee3e2010-12-27 19:07:49 -0500369 , desc ? MAKE_FLATPTR(seg, desc) : "Legacy option rom");
Kevin O'Connor0a924122009-02-08 19:43:47 -0500370}
371
Kevin O'Connor0a924122009-02-08 19:43:47 -0500372void
Kevin O'Connorca2bc1c2010-12-29 21:41:19 -0500373boot_add_floppy(struct drive_s *drive_g, const char *desc, int prio)
Kevin O'Connor0a924122009-02-08 19:43:47 -0500374{
Kevin O'Connor031ef552010-12-27 19:26:57 -0500375 bootentry_add(IPL_TYPE_FLOPPY, defPrio(prio, DefaultFloppyPrio)
Kevin O'Connorca2bc1c2010-12-29 21:41:19 -0500376 , (u32)drive_g, desc);
Kevin O'Connor72eee3e2010-12-27 19:07:49 -0500377}
Kevin O'Connor0a924122009-02-08 19:43:47 -0500378
Kevin O'Connor72eee3e2010-12-27 19:07:49 -0500379void
Kevin O'Connorca2bc1c2010-12-29 21:41:19 -0500380boot_add_hd(struct drive_s *drive_g, const char *desc, int prio)
Kevin O'Connor72eee3e2010-12-27 19:07:49 -0500381{
Kevin O'Connor031ef552010-12-27 19:26:57 -0500382 bootentry_add(IPL_TYPE_HARDDISK, defPrio(prio, DefaultHDPrio)
Kevin O'Connorca2bc1c2010-12-29 21:41:19 -0500383 , (u32)drive_g, desc);
Kevin O'Connor72eee3e2010-12-27 19:07:49 -0500384}
385
386void
Kevin O'Connorca2bc1c2010-12-29 21:41:19 -0500387boot_add_cd(struct drive_s *drive_g, const char *desc, int prio)
Kevin O'Connor72eee3e2010-12-27 19:07:49 -0500388{
Kevin O'Connor031ef552010-12-27 19:26:57 -0500389 bootentry_add(IPL_TYPE_CDROM, defPrio(prio, DefaultCDPrio)
Kevin O'Connorca2bc1c2010-12-29 21:41:19 -0500390 , (u32)drive_g, desc);
Kevin O'Connor72eee3e2010-12-27 19:07:49 -0500391}
392
393// Add a CBFS payload entry
394void
Kevin O'Connor031ef552010-12-27 19:26:57 -0500395boot_add_cbfs(void *data, const char *desc, int prio)
Kevin O'Connor72eee3e2010-12-27 19:07:49 -0500396{
Kevin O'Connor031ef552010-12-27 19:26:57 -0500397 bootentry_add(IPL_TYPE_CBFS, defPrio(prio, DEFAULT_PRIO), (u32)data, desc);
Kevin O'Connor9f4e1d92009-02-08 15:44:08 -0500398}
399
400
401/****************************************************************
Kevin O'Connor0ac5e9e2013-09-14 13:09:27 -0400402 * Keyboard calls
403 ****************************************************************/
404
405// See if a keystroke is pending in the keyboard buffer.
406static int
407check_for_keystroke(void)
408{
409 struct bregs br;
410 memset(&br, 0, sizeof(br));
411 br.flags = F_IF|F_ZF;
412 br.ah = 1;
413 call16_int(0x16, &br);
414 return !(br.flags & F_ZF);
415}
416
417// Return a keystroke - waiting forever if necessary.
418static int
419get_raw_keystroke(void)
420{
421 struct bregs br;
422 memset(&br, 0, sizeof(br));
423 br.flags = F_IF;
424 call16_int(0x16, &br);
425 return br.ah;
426}
427
428// Read a keystroke - waiting up to 'msec' milliseconds.
429static int
430get_keystroke(int msec)
431{
432 u32 end = irqtimer_calc(msec);
433 for (;;) {
434 if (check_for_keystroke())
435 return get_raw_keystroke();
436 if (irqtimer_check(end))
437 return -1;
Marc Jones57508fa2014-09-24 15:14:41 -0600438 if (!CONFIG_KBC_POLL)
Kevin O'Connor0ac5e9e2013-09-14 13:09:27 -0400439 yield_toirq();
Marc Jones57508fa2014-09-24 15:14:41 -0600440 else
441 msleep(5);
Kevin O'Connor0ac5e9e2013-09-14 13:09:27 -0400442 }
443}
444
445
446/****************************************************************
Kevin O'Connor0a924122009-02-08 19:43:47 -0500447 * Boot menu and BCV execution
Kevin O'Connor9f4e1d92009-02-08 15:44:08 -0500448 ****************************************************************/
449
Kevin O'Connor73023002011-07-05 20:34:34 -0400450#define DEFAULT_BOOTMENU_WAIT 2500
451
Kevin O'Connor0a924122009-02-08 19:43:47 -0500452// Show IPL option menu.
Kevin O'Connor8a0a9722013-01-21 01:53:31 -0500453void
Kevin O'Connor1ca05b02010-01-03 17:43:37 -0500454interactive_bootmenu(void)
Kevin O'Connor9f4e1d92009-02-08 15:44:08 -0500455{
Kevin O'Connor8a0a9722013-01-21 01:53:31 -0500456 // XXX - show available drives?
457
Kevin O'Connor56c50892013-02-09 19:25:51 -0500458 if (! CONFIG_BOOTMENU || !romfile_loadint("etc/show-boot-menu", 1))
Kevin O'Connor9f4e1d92009-02-08 15:44:08 -0500459 return;
460
461 while (get_keystroke(0) >= 0)
462 ;
463
Kevin O'Connor129f11e2013-08-02 14:13:50 -0400464 char *bootmsg = romfile_loadfile("etc/boot-menu-message", NULL);
465 int menukey = romfile_loadint("etc/boot-menu-key", 0x86);
466 printf("%s", bootmsg ?: "\nPress F12 for boot menu.\n\n");
467 free(bootmsg);
Kevin O'Connor9f4e1d92009-02-08 15:44:08 -0500468
Kevin O'Connor73023002011-07-05 20:34:34 -0400469 u32 menutime = romfile_loadint("etc/boot-menu-wait", DEFAULT_BOOTMENU_WAIT);
Kevin O'Connor9a01a9c2010-08-25 21:07:48 -0400470 enable_bootsplash();
Kevin O'Connor73023002011-07-05 20:34:34 -0400471 int scan_code = get_keystroke(menutime);
Kevin O'Connor9a01a9c2010-08-25 21:07:48 -0400472 disable_bootsplash();
Kevin O'Connor129f11e2013-08-02 14:13:50 -0400473 if (scan_code != menukey)
Kevin O'Connor9f4e1d92009-02-08 15:44:08 -0500474 return;
475
476 while (get_keystroke(0) >= 0)
477 ;
478
479 printf("Select boot device:\n\n");
Kevin O'Connore438b0c2010-05-01 12:20:33 -0400480 wait_threads();
Kevin O'Connor9f4e1d92009-02-08 15:44:08 -0500481
Kevin O'Connor72eee3e2010-12-27 19:07:49 -0500482 // Show menu items
Kevin O'Connor72eee3e2010-12-27 19:07:49 -0500483 int maxmenu = 0;
Kevin O'Connor446defb2013-06-08 21:50:53 -0400484 struct bootentry_s *pos;
485 hlist_for_each_entry(pos, &BootList, node) {
Kevin O'Connor72eee3e2010-12-27 19:07:49 -0500486 char desc[60];
487 maxmenu++;
488 printf("%d. %s\n", maxmenu
489 , strtcpy(desc, pos->description, ARRAY_SIZE(desc)));
Kevin O'Connor9f4e1d92009-02-08 15:44:08 -0500490 }
491
Kevin O'Connor551caa22010-12-29 13:25:18 -0500492 // Get key press
Kevin O'Connor9f4e1d92009-02-08 15:44:08 -0500493 for (;;) {
494 scan_code = get_keystroke(1000);
Kevin O'Connor551caa22010-12-29 13:25:18 -0500495 if (scan_code >= 1 && scan_code <= maxmenu+1)
Kevin O'Connor9f4e1d92009-02-08 15:44:08 -0500496 break;
Kevin O'Connor9f4e1d92009-02-08 15:44:08 -0500497 }
498 printf("\n");
Kevin O'Connor551caa22010-12-29 13:25:18 -0500499 if (scan_code == 0x01)
500 // ESC
501 return;
502
503 // Find entry and make top priority.
504 int choice = scan_code - 1;
Kevin O'Connor446defb2013-06-08 21:50:53 -0400505 hlist_for_each_entry(pos, &BootList, node) {
506 if (! --choice)
507 break;
508 }
509 hlist_del(&pos->node);
Kevin O'Connor551caa22010-12-29 13:25:18 -0500510 pos->priority = 0;
Kevin O'Connor446defb2013-06-08 21:50:53 -0400511 hlist_add_head(&pos->node, &BootList);
Kevin O'Connor9f4e1d92009-02-08 15:44:08 -0500512}
513
Kevin O'Connorf13a1802010-12-29 11:52:33 -0500514// BEV (Boot Execution Vector) list
Kevin O'Connor7bb15842010-12-29 11:25:14 -0500515struct bev_s {
516 int type;
517 u32 vector;
518};
519static struct bev_s BEV[20];
520static int BEVCount;
Kevin O'Connor72eee3e2010-12-27 19:07:49 -0500521static int HaveHDBoot, HaveFDBoot;
522
Kevin O'Connor0a924122009-02-08 19:43:47 -0500523static void
Kevin O'Connor72eee3e2010-12-27 19:07:49 -0500524add_bev(int type, u32 vector)
Kevin O'Connor0a924122009-02-08 19:43:47 -0500525{
Kevin O'Connor72eee3e2010-12-27 19:07:49 -0500526 if (type == IPL_TYPE_HARDDISK && HaveHDBoot++)
527 return;
528 if (type == IPL_TYPE_FLOPPY && HaveFDBoot++)
529 return;
Kevin O'Connor7bb15842010-12-29 11:25:14 -0500530 if (BEVCount >= ARRAY_SIZE(BEV))
Kevin O'Connor72eee3e2010-12-27 19:07:49 -0500531 return;
Kevin O'Connor7bb15842010-12-29 11:25:14 -0500532 struct bev_s *bev = &BEV[BEVCount++];
Kevin O'Connor72eee3e2010-12-27 19:07:49 -0500533 bev->type = type;
534 bev->vector = vector;
Kevin O'Connor0a924122009-02-08 19:43:47 -0500535}
536
537// Prepare for boot - show menu and run bcvs.
538void
Kevin O'Connor8a0a9722013-01-21 01:53:31 -0500539bcv_prepboot(void)
Kevin O'Connor0a924122009-02-08 19:43:47 -0500540{
Kevin O'Connor8a0a9722013-01-21 01:53:31 -0500541 if (! CONFIG_BOOT)
Kevin O'Connor0a924122009-02-08 19:43:47 -0500542 return;
Kevin O'Connor0a924122009-02-08 19:43:47 -0500543
Kevin O'Connor54ae5432013-01-12 16:36:11 -0500544 int haltprio = find_prio("HALT");
545 if (haltprio >= 0)
546 bootentry_add(IPL_TYPE_HALT, haltprio, 0, "HALT");
547
Kevin O'Connor72eee3e2010-12-27 19:07:49 -0500548 // Map drives and populate BEV list
Kevin O'Connor446defb2013-06-08 21:50:53 -0400549 struct bootentry_s *pos;
550 hlist_for_each_entry(pos, &BootList, node) {
Kevin O'Connor72eee3e2010-12-27 19:07:49 -0500551 switch (pos->type) {
552 case IPL_TYPE_BCV:
553 call_bcv(pos->vector.seg, pos->vector.offset);
554 add_bev(IPL_TYPE_HARDDISK, 0);
555 break;
556 case IPL_TYPE_FLOPPY:
557 map_floppy_drive(pos->drive);
558 add_bev(IPL_TYPE_FLOPPY, 0);
559 break;
560 case IPL_TYPE_HARDDISK:
561 map_hd_drive(pos->drive);
562 add_bev(IPL_TYPE_HARDDISK, 0);
563 break;
564 case IPL_TYPE_CDROM:
565 map_cd_drive(pos->drive);
566 // NO BREAK
567 default:
568 add_bev(pos->type, pos->data);
569 break;
570 }
Kevin O'Connor72eee3e2010-12-27 19:07:49 -0500571 }
Kevin O'Connorafd05202009-08-16 12:21:44 -0400572
Kevin O'Connor72eee3e2010-12-27 19:07:49 -0500573 // If nothing added a floppy/hd boot - add it manually.
574 add_bev(IPL_TYPE_FLOPPY, 0);
575 add_bev(IPL_TYPE_HARDDISK, 0);
Kevin O'Connor0a924122009-02-08 19:43:47 -0500576}
577
Kevin O'Connor9f4e1d92009-02-08 15:44:08 -0500578
579/****************************************************************
580 * Boot code (int 18/19)
581 ****************************************************************/
582
Kevin O'Connor0a924122009-02-08 19:43:47 -0500583// Jump to a bootup entry point.
Kevin O'Connorf076a3e2008-02-25 22:25:15 -0500584static void
Kevin O'Connorf13a1802010-12-29 11:52:33 -0500585call_boot_entry(struct segoff_s bootsegip, u8 bootdrv)
Kevin O'Connor71f036d2009-02-08 16:57:22 -0500586{
Kevin O'Connorf13a1802010-12-29 11:52:33 -0500587 dprintf(1, "Booting from %04x:%04x\n", bootsegip.seg, bootsegip.offset);
Kevin O'Connor71f036d2009-02-08 16:57:22 -0500588 struct bregs br;
589 memset(&br, 0, sizeof(br));
Kevin O'Connorf8e800d2009-09-24 21:01:16 -0400590 br.flags = F_IF;
Kevin O'Connorf13a1802010-12-29 11:52:33 -0500591 br.code = bootsegip;
Kevin O'Connor71f036d2009-02-08 16:57:22 -0500592 // Set the magic number in ax and the boot drive in dl.
593 br.dl = bootdrv;
594 br.ax = 0xaa55;
Kevin O'Connorc7ffbac2012-03-25 11:04:10 -0400595 farcall16(&br);
Kevin O'Connor71f036d2009-02-08 16:57:22 -0500596}
597
598// Boot from a disk (either floppy or harddrive)
599static void
600boot_disk(u8 bootdrv, int checksig)
601{
602 u16 bootseg = 0x07c0;
603
604 // Read sector
605 struct bregs br;
606 memset(&br, 0, sizeof(br));
Kevin O'Connorf8e800d2009-09-24 21:01:16 -0400607 br.flags = F_IF;
Kevin O'Connor71f036d2009-02-08 16:57:22 -0500608 br.dl = bootdrv;
609 br.es = bootseg;
610 br.ah = 2;
611 br.al = 1;
612 br.cl = 1;
613 call16_int(0x13, &br);
614
615 if (br.flags & F_CF) {
616 printf("Boot failed: could not read the boot disk\n\n");
617 return;
618 }
619
620 if (checksig) {
621 struct mbr_s *mbr = (void*)0;
622 if (GET_FARVAR(bootseg, mbr->signature) != MBR_SIGNATURE) {
623 printf("Boot failed: not a bootable disk\n\n");
624 return;
625 }
626 }
627
628 /* Canonicalize bootseg:bootip */
629 u16 bootip = (bootseg & 0x0fff) << 4;
630 bootseg &= 0xf000;
631
Kevin O'Connorf13a1802010-12-29 11:52:33 -0500632 call_boot_entry(SEGOFF(bootseg, bootip), bootdrv);
Kevin O'Connor71f036d2009-02-08 16:57:22 -0500633}
634
635// Boot from a CD-ROM
636static void
Kevin O'Connorf13a1802010-12-29 11:52:33 -0500637boot_cdrom(struct drive_s *drive_g)
Kevin O'Connor71f036d2009-02-08 16:57:22 -0500638{
639 if (! CONFIG_CDROM_BOOT)
640 return;
Kevin O'Connor72eee3e2010-12-27 19:07:49 -0500641 printf("Booting from DVD/CD...\n");
Gleb Natapov4c90a202010-12-07 13:50:54 +0200642
Gleb Natapov4c90a202010-12-07 13:50:54 +0200643 int status = cdrom_boot(drive_g);
Kevin O'Connor71f036d2009-02-08 16:57:22 -0500644 if (status) {
Kevin O'Connorecbcf772010-12-29 13:26:01 -0500645 printf("Boot failed: Could not read from CDROM (code %04x)\n", status);
Kevin O'Connor71f036d2009-02-08 16:57:22 -0500646 return;
647 }
648
Kevin O'Connord3140832012-05-13 22:46:12 -0400649 u8 bootdrv = CDEmu.emulated_extdrive;
650 u16 bootseg = CDEmu.load_segment;
Kevin O'Connor71f036d2009-02-08 16:57:22 -0500651 /* Canonicalize bootseg:bootip */
652 u16 bootip = (bootseg & 0x0fff) << 4;
653 bootseg &= 0xf000;
654
Kevin O'Connorf13a1802010-12-29 11:52:33 -0500655 call_boot_entry(SEGOFF(bootseg, bootip), bootdrv);
Kevin O'Connor71f036d2009-02-08 16:57:22 -0500656}
657
Kevin O'Connore8f00ee2009-07-04 04:04:36 -0400658// Boot from a CBFS payload
Kevin O'Connor67823442009-04-13 14:14:51 -0400659static void
Kevin O'Connorf13a1802010-12-29 11:52:33 -0500660boot_cbfs(struct cbfs_file *file)
Kevin O'Connor67823442009-04-13 14:14:51 -0400661{
Kevin O'Connor897fb112013-02-07 23:32:48 -0500662 if (!CONFIG_COREBOOT_FLASH)
Kevin O'Connor67823442009-04-13 14:14:51 -0400663 return;
Kevin O'Connor72eee3e2010-12-27 19:07:49 -0500664 printf("Booting from CBFS...\n");
Kevin O'Connorf13a1802010-12-29 11:52:33 -0500665 cbfs_run_payload(file);
Kevin O'Connor67823442009-04-13 14:14:51 -0400666}
667
Kevin O'Connorf13a1802010-12-29 11:52:33 -0500668// Boot from a BEV entry on an optionrom.
669static void
670boot_rom(u32 vector)
671{
672 printf("Booting from ROM...\n");
673 struct segoff_s so;
674 so.segoff = vector;
675 call_boot_entry(so, 0);
676}
677
Kevin O'Connorb8fcf462012-05-12 22:12:22 -0400678// Unable to find bootable device - warn user and eventually retry.
679static void
680boot_fail(void)
681{
Kevin O'Connor11a72342013-03-05 17:52:21 +0800682 if (BootRetryTime == (u32)-1)
Kevin O'Connorb8fcf462012-05-12 22:12:22 -0400683 printf("No bootable device.\n");
684 else
Kevin O'Connor11a72342013-03-05 17:52:21 +0800685 printf("No bootable device. Retrying in %d seconds.\n"
686 , BootRetryTime/1000);
687 // Wait for 'BootRetryTime' milliseconds and then reboot.
Kevin O'Connor95ee3822013-07-20 18:07:50 -0400688 u32 end = irqtimer_calc(BootRetryTime);
Kevin O'Connorb8fcf462012-05-12 22:12:22 -0400689 for (;;) {
Kevin O'Connor95ee3822013-07-20 18:07:50 -0400690 if (BootRetryTime != (u32)-1 && irqtimer_check(end))
Kevin O'Connorb8fcf462012-05-12 22:12:22 -0400691 break;
Kevin O'Connor94c749c2012-05-28 11:44:02 -0400692 yield_toirq();
Kevin O'Connorb8fcf462012-05-12 22:12:22 -0400693 }
694 printf("Rebooting.\n");
695 struct bregs br;
696 memset(&br, 0, sizeof(br));
697 br.code = SEGOFF(SEG_BIOS, (u32)reset_vector);
Kevin O'Connorc7ffbac2012-03-25 11:04:10 -0400698 farcall16big(&br);
Kevin O'Connorb8fcf462012-05-12 22:12:22 -0400699}
700
Kevin O'Connorf13a1802010-12-29 11:52:33 -0500701// Determine next boot method and attempt a boot using it.
Kevin O'Connor71f036d2009-02-08 16:57:22 -0500702static void
Kevin O'Connor9d8e0a62012-05-13 12:23:58 -0400703do_boot(int seq_nr)
Kevin O'Connorf076a3e2008-02-25 22:25:15 -0500704{
Kevin O'Connor40967022008-07-21 22:23:05 -0400705 if (! CONFIG_BOOT)
Kevin O'Connore07e18e2009-02-08 17:07:29 -0500706 panic("Boot support not compiled in.\n");
Kevin O'Connor40967022008-07-21 22:23:05 -0400707
Kevin O'Connorb8fcf462012-05-12 22:12:22 -0400708 if (seq_nr >= BEVCount)
709 boot_fail();
Kevin O'Connor38fcbfe2008-02-25 22:30:47 -0500710
Kevin O'Connor72eee3e2010-12-27 19:07:49 -0500711 // Boot the given BEV type.
Kevin O'Connor7bb15842010-12-29 11:25:14 -0500712 struct bev_s *ie = &BEV[seq_nr];
Kevin O'Connorcadaf0e2010-07-26 23:47:26 -0400713 switch (ie->type) {
Kevin O'Connorf13b0082008-08-17 11:26:42 -0400714 case IPL_TYPE_FLOPPY:
Kevin O'Connor72eee3e2010-12-27 19:07:49 -0500715 printf("Booting from Floppy...\n");
Kevin O'Connorbaaadb62010-12-29 11:18:04 -0500716 boot_disk(0x00, CheckFloppySig);
Kevin O'Connor71f036d2009-02-08 16:57:22 -0500717 break;
Kevin O'Connorf13b0082008-08-17 11:26:42 -0400718 case IPL_TYPE_HARDDISK:
Kevin O'Connor72eee3e2010-12-27 19:07:49 -0500719 printf("Booting from Hard Disk...\n");
Kevin O'Connor71f036d2009-02-08 16:57:22 -0500720 boot_disk(0x80, 1);
Kevin O'Connor38fcbfe2008-02-25 22:30:47 -0500721 break;
Kevin O'Connor71f036d2009-02-08 16:57:22 -0500722 case IPL_TYPE_CDROM:
Kevin O'Connorf13a1802010-12-29 11:52:33 -0500723 boot_cdrom((void*)ie->vector);
Kevin O'Connor67823442009-04-13 14:14:51 -0400724 break;
725 case IPL_TYPE_CBFS:
Kevin O'Connorf13a1802010-12-29 11:52:33 -0500726 boot_cbfs((void*)ie->vector);
Kevin O'Connor71f036d2009-02-08 16:57:22 -0500727 break;
728 case IPL_TYPE_BEV:
Kevin O'Connorf13a1802010-12-29 11:52:33 -0500729 boot_rom(ie->vector);
Kevin O'Connor38fcbfe2008-02-25 22:30:47 -0500730 break;
Kevin O'Connor54ae5432013-01-12 16:36:11 -0500731 case IPL_TYPE_HALT:
732 boot_fail();
733 break;
Kevin O'Connor180a9592008-03-04 22:50:53 -0500734 }
Kevin O'Connorf076a3e2008-02-25 22:25:15 -0500735
Kevin O'Connor38fcbfe2008-02-25 22:30:47 -0500736 // Boot failed: invoke the boot recovery function
Kevin O'Connor7af49bf2008-03-09 13:46:13 -0400737 struct bregs br;
738 memset(&br, 0, sizeof(br));
Kevin O'Connorf8e800d2009-09-24 21:01:16 -0400739 br.flags = F_IF;
Kevin O'Connor7af49bf2008-03-09 13:46:13 -0400740 call16_int(0x18, &br);
Kevin O'Connorf076a3e2008-02-25 22:25:15 -0500741}
742
Kevin O'Connor9d8e0a62012-05-13 12:23:58 -0400743int BootSequence VARLOW = -1;
744
Kevin O'Connorf076a3e2008-02-25 22:25:15 -0500745// Boot Failure recovery: try the next device.
Kevin O'Connor52a300f2009-12-26 23:32:57 -0500746void VISIBLE32FLAT
Kevin O'Connor1ca05b02010-01-03 17:43:37 -0500747handle_18(void)
Kevin O'Connorf076a3e2008-02-25 22:25:15 -0500748{
Kevin O'Connor15c1f222008-06-12 22:59:43 -0400749 debug_enter(NULL, DEBUG_HDL_18);
Kevin O'Connor9d8e0a62012-05-13 12:23:58 -0400750 int seq = BootSequence + 1;
751 BootSequence = seq;
Kevin O'Connor7af49bf2008-03-09 13:46:13 -0400752 do_boot(seq);
Kevin O'Connorf076a3e2008-02-25 22:25:15 -0500753}
754
755// INT 19h Boot Load Service Entry Point
Kevin O'Connor52a300f2009-12-26 23:32:57 -0500756void VISIBLE32FLAT
Kevin O'Connor1ca05b02010-01-03 17:43:37 -0500757handle_19(void)
Kevin O'Connorf076a3e2008-02-25 22:25:15 -0500758{
Kevin O'Connor15c1f222008-06-12 22:59:43 -0400759 debug_enter(NULL, DEBUG_HDL_19);
Kevin O'Connor9d8e0a62012-05-13 12:23:58 -0400760 BootSequence = 0;
Kevin O'Connor7af49bf2008-03-09 13:46:13 -0400761 do_boot(0);
Kevin O'Connorf076a3e2008-02-25 22:25:15 -0500762}