Patch {1/2]

Signed-off-by: Charles Fisher <Charles.Fisher@gdc4s.com

 

There are a couple of problems that occur with tboot. The first is on some Dell

laptops, it is necessary to disable the legacy usb interrupts. This patch

provides a mechanism to enable a developer to do so.

 

The second problem is that in certain circumstances, data owners consider the

contents of memory to be sensitive. In these cases, they require that the e820

map be scrubbed. The other portion of this patch provides a capability to do

that scrub.

 

Both options are invoked via the command line, and both default to the current

behavior - i.e. don't disable the usb interrupts, and don't scrub the memory.

 

diff -up tboot-1.7.2/tboot/common/acpi.c.orig tboot-1.7.2/tboot/common/acpi.c

--- tboot-1.7.2/tboot/common/acpi.c.orig  2012-10-09 14:26:14.279694000 -0700

+++ tboot-1.7.2/tboot/common/acpi.c 2012-10-09 14:28:59.721553000 -0700

@@ -436,6 +436,15 @@ void set_s3_resume_vector(const tboot_ac

 

     acpi_printk("wakeup_vector_address = %llx\n", acpi_sinfo->wakeup_vector);

     acpi_printk("wakeup_vector_value = %llxx\n", resume_vector);

+}

+

+void disable_smis(void)

+{

+        printk("disabling legacy USB SMIs\n");

+        uint32_t pmbase = pcireg_cfgread(0, 31, 0, 0x40, 4) & ~1;

+        uint32_t smi_en = inl(pmbase + 0x30);

+        smi_en &= ~0x20008;

+        outl(pmbase + 0x30, smi_en);

}

 

 /*

diff -up tboot-1.7.2/tboot/common/cmdline.c.orig tboot-1.7.2/tboot/common/cmdline.c

--- tboot-1.7.2/tboot/common/cmdline.c.orig     2012-10-09 14:26:23.724083000 -0700

+++ tboot-1.7.2/tboot/common/cmdline.c    2012-10-09 14:28:59.723556000 -0700

@@ -74,6 +74,8 @@ static const cmdline_option_t g_tboot_cm

     { "ap_wake_mwait", "false" },    /* true|false */

     { "pcr_map", "legacy" },         /* legacy|da */

     { "min_ram", "0" },              /* size in bytes | 0 for no min */

+    { "scrub_e820", "false" },       /* true|false */

+    { "no_usb", "false" },           /* true|false */

     { NULL, NULL }

};

static char g_tboot_param_values[ARRAY_SIZE(g_tboot_cmdline_options)][MAX_VALUE_LEN];

@@ -423,6 +425,15 @@ bool get_tboot_serial(void)

     return parse_serial_param(serial);

}

 

+bool get_tboot_no_usb(void)

+{

+    const char *no_usb = get_option_val(g_tboot_cmdline_options,

+                                        g_tboot_param_values, "no_usb");

+    if ( no_usb == NULL || (strcmp(no_usb, "true") != 0 ))

+        return false;

+    return true;

+}

+

void get_tboot_vga_delay(void)

{

     const char *vga_delay = get_option_val(g_tboot_cmdline_options,

@@ -433,6 +444,15 @@ void get_tboot_vga_delay(void)

     g_vga_delay = strtoul(vga_delay, NULL, 0);

}