1 // Menu presented during final phase of "post".
3 // Copyright (C) 2008 Kevin O'Connor <kevin@koconnor.net>
4 // Copyright (C) 2002 MandrakeSoft S.A.
6 // This file may be distributed under the terms of the GNU GPLv3 license.
8 #include "biosvar.h" // GET_EBDA
9 #include "util.h" // mdelay
10 #include "bregs.h" // struct bregs
16 memset(&br, 0, sizeof(br));
18 call16_int(0x16, &br);
19 return !(br.flags & F_ZF);
26 memset(&br, 0, sizeof(br));
27 call16_int(0x16, &br);
32 mdelay_and_check_for_keystroke(u32 msec, int count)
35 for (i = 1; i <= count; i++) {
37 if (check_for_keystroke())
43 interactive_bootmenu()
45 if (! CONFIG_BOOTMENU)
48 while (check_for_keystroke())
51 printf("Press F12 for boot menu.\n\n");
53 mdelay_and_check_for_keystroke(500, 5);
54 if (! check_for_keystroke())
56 u8 scan_code = get_keystroke();
57 if (scan_code != 0x86)
61 while (check_for_keystroke())
64 printf("Select boot device:\n\n");
66 int count = GET_EBDA(ipl.count);
68 for (i = 0; i < count; i++) {
75 scan_code = get_keystroke();
76 if (scan_code == 0x01 || scan_code == 0x58)
79 if (scan_code <= count + 1) {
80 // Add user choice to the boot order.
81 u16 choice = scan_code - 1;
82 u32 bootorder = GET_EBDA(ipl.bootorder);
83 SET_EBDA(ipl.bootorder, (bootorder << 4) | choice);