[coreboot] Triggering another payload
Tadas Slotkus
devtadas at gmail.com
Wed Jul 13 22:11:01 CEST 2011
This one is not bad for triggering another payload (flashrom) via key
press or console input. Unfortunately it works only with PS/2 keyboard.
Signed-off-by: Tadas Slotkus <devtadas at gmail.com>
diff --git a/src/boot/hardwaremain.c b/src/boot/hardwaremain.c
index 3d15b55..7726afd 100644
--- a/src/boot/hardwaremain.c
+++ b/src/boot/hardwaremain.c
@@ -41,6 +41,14 @@ it with the version available from LANL.
#if CONFIG_WRITE_HIGH_TABLES
#include <cbmem.h>
#endif
+#include <arch/io.h>
+
+int keyboard_havechar(void);
+int keyboard_havechar(void)
+{
+ unsigned char c = inb(0x64);
+ return (c == 0xFF) ? 0 : c & 1;
+}
/**
* @brief Main function of the RAM part of coreboot.
@@ -102,7 +110,20 @@ void hardwaremain(int boot_complete)
* write our configuration tables.
*/
lb_mem = write_tables();
- cbfs_load_payload(lb_mem, CONFIG_CBFS_PREFIX "/payload");
+
+ /* This is for PS/2 keyboard spurious scancodes */
+ int i;
+ for (i = 0; i < 50; i++){
+ while (keyboard_havechar())
+ inb(0x60);
+ mdelay(10);
+ }
+ /* Now wait some time for real key press */
+ mdelay(300);
+ if(console_tst_byte() || keyboard_havechar())
+ cbfs_load_payload(lb_mem, CONFIG_CBFS_PREFIX "/flashrom");
+ else
+ cbfs_load_payload(lb_mem, CONFIG_CBFS_PREFIX "/payload");
printk(BIOS_ERR, "Boot failed.\n");
}
More information about the coreboot
mailing list