Stefan Reinauer (stefan.reinauer(a)coreboot.org) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/4225
-gerrit
commit ab22ac4852a408e81654d6f90df354899f78f53a
Author: Aaron Durbin <adurbin(a)chromium.org>
Date: Thu Jun 6 16:14:21 2013 -0500
libpayload: usb mass storage detect empty media
There is currently a hard-coded 30 sec delay in the mass storage
driver while waiting for each device to become ready. However, mass
storage card readers that are empty return an error code on the
TEST UNIT READY command. A REQUEST SENSE command then needs to be
issued and interrogate the data to determine if no media is present.
If no media determination is found to be true the USB device is no
longer considered a candidate to be a disk.
This code does lead to the fact that the media card reader needs to be
populated at enumeration time. I suspect this is not an issue as it
appears the storage stack in libpayload can't handle removable media
coming online later.
Booted recovery and dev modes. Noted that removable mass storage
devices with no media were ignored without any boot delay.
Change-Id: Ida7a45614d97c6e6fbfc9bb099765aad4df550fd
Signed-off-by: Aaron Durbin <adurbin(a)chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/57828
Reviewed-by: Duncan Laurie <dlaurie(a)chromium.org>
---
payloads/libpayload/drivers/usb/usbmsc.c | 35 ++++++++++++++++++++++++++++++++
1 file changed, 35 insertions(+)
diff --git a/payloads/libpayload/drivers/usb/usbmsc.c b/payloads/libpayload/drivers/usb/usbmsc.c
index ad7e82f..ffb1c93 100644
--- a/payloads/libpayload/drivers/usb/usbmsc.c
+++ b/payloads/libpayload/drivers/usb/usbmsc.c
@@ -123,6 +123,8 @@ enum {
static int
request_sense (usbdev_t *dev);
+static int
+request_sense_no_media (usbdev_t *dev);
static int
reset_transport (usbdev_t *dev)
@@ -256,6 +258,11 @@ execute_command (usbdev_t *dev, cbw_direction dir, const u8 *cb, int cblen,
if (cb[0] == 0x03)
/* requesting sense failed, that's bad */
return MSC_COMMAND_FAIL;
+ else if (cb[0] == 0)
+ /* If command was TEST UNIT READY determine if the
+ * device is of removable type indicating no media
+ * found. */
+ return request_sense_no_media (dev);
/* error "check condition" or reserved error */
ret = request_sense (dev);
/* return fail or the status of request_sense if it's worse */
@@ -350,6 +357,34 @@ request_sense (usbdev_t *dev)
sizeof (cb), buf, 19, 1);
}
+static int request_sense_no_media(usbdev_t *dev)
+{
+ u8 buf[19];
+ int ret;
+ cmdblock6_t cb;
+ memset (&cb, 0, sizeof (cb));
+ cb.command = 0x3;
+
+ ret = execute_command (dev, cbw_direction_data_in, (u8 *) &cb,
+ sizeof (cb), buf, 19, 1);
+
+ if (ret)
+ return ret;
+
+ /* Check if sense key is set to NOT READY. */
+ if ((buf[2] & 0xf) != 2)
+ return MSC_COMMAND_FAIL;
+
+ /* Check if additional sense code is 0x3a. */
+ if (buf[12] != 0x3a)
+ return MSC_COMMAND_FAIL;
+
+ /* No media is present. Return MSC_COMMAND_DETACHED so as not to use
+ * this device any longer. */
+ usb_debug("Empty media found.\n");
+ return MSC_COMMAND_DETACHED;
+}
+
static int
test_unit_ready (usbdev_t *dev)
{
Stefan Reinauer (stefan.reinauer(a)coreboot.org) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/4223
-gerrit
commit 5f0f65e1ba5dd90377abb131a938abe39a7cabfe
Author: Duncan Laurie <dlaurie(a)chromium.org>
Date: Tue Jun 4 10:14:42 2013 -0700
vboot: use out_flags to indicate recovery mode
In order to make the proper decision on loading the
option rom or not the recovery mode setting needs to be
known. Normally this is detected by asking the EC,
but if recovery is requested with crossystem then the EC
does not know about it. Instead we need to check the
output flags from VbInit().
Change-Id: I09358e6fd979b4af6b37a13115ac34db3d98b09d
Signed-off-by: Duncan Laurie <dlaurie(a)chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/57474
Reviewed-by: Aaron Durbin <adurbin(a)chromium.org>
---
src/vendorcode/google/chromeos/chromeos.c | 30 ++++++++++++++++++++++++++----
1 file changed, 26 insertions(+), 4 deletions(-)
diff --git a/src/vendorcode/google/chromeos/chromeos.c b/src/vendorcode/google/chromeos/chromeos.c
index c2cc0e1..828cfd2 100644
--- a/src/vendorcode/google/chromeos/chromeos.c
+++ b/src/vendorcode/google/chromeos/chromeos.c
@@ -41,8 +41,21 @@ static int vboot_enable_developer(void)
return !!(vbho->init_params.out_flags & VB_INIT_OUT_ENABLE_DEVELOPER);
}
+
+static int vboot_enable_recovery(void)
+{
+ struct vboot_handoff *vbho;
+
+ vbho = cbmem_find(CBMEM_ID_VBOOT_HANDOFF);
+
+ if (vbho == NULL)
+ return 0;
+
+ return !!(vbho->init_params.out_flags & VB_INIT_OUT_ENABLE_RECOVERY);
+}
#else
static inline int vboot_enable_developer(void) { return 0; }
+static inline int vboot_enable_recovery(void) { return 0; }
#endif
int developer_mode_enabled(void)
@@ -52,11 +65,20 @@ int developer_mode_enabled(void)
int recovery_mode_enabled(void)
{
- /* TODO(reinauer): get information from VbInit.
- * the recovery mode switch is not the only reason to go
- * to recovery mode.
+ /*
+ * This is called in multiple places and has to detect
+ * recovery mode triggered from the EC and via shared
+ * recovery reason set with crossystem.
+ *
+ * If shared recovery reason is set:
+ * - before VbInit then get_recovery_mode_from_vbnv() is true
+ * - after VbInit then vboot_enable_recovery() is true
+ *
+ * Otherwise the mainboard handler for get_recovery_mode_switch()
+ * will detect recovery mode initiated by the EC.
*/
- return get_recovery_mode_switch() || get_recovery_mode_from_vbnv();
+ return get_recovery_mode_switch() || get_recovery_mode_from_vbnv() ||
+ vboot_enable_recovery();
}
#if CONFIG_VBOOT_VERIFY_FIRMWARE
Stefan Reinauer (stefan.reinauer(a)coreboot.org) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/4222
-gerrit
commit 2c0600f18eca4db689da9540924f05af796582f1
Author: Duncan Laurie <dlaurie(a)chromium.org>
Date: Tue Jun 4 10:08:54 2013 -0700
vboot: Do not pass OPROM_MATTERS flag to VbInit
Since we are using VBNV to determine if developer mode is
active we do not need the messy OPROM hook magic any longer.
Change-Id: I1b9effef3ef2aa84e916060d8e61ee42515a2b7c
Signed-off-by: Duncan Laurie <dlaurie(a)chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/57473
Reviewed-by: Aaron Durbin <adurbin(a)chromium.org>
---
src/vendorcode/google/chromeos/gnvs.c | 8 +-------
1 file changed, 1 insertion(+), 7 deletions(-)
diff --git a/src/vendorcode/google/chromeos/gnvs.c b/src/vendorcode/google/chromeos/gnvs.c
index ba1588d..5ee3665 100644
--- a/src/vendorcode/google/chromeos/gnvs.c
+++ b/src/vendorcode/google/chromeos/gnvs.c
@@ -49,15 +49,9 @@ void chromeos_init_vboot(chromeos_acpi_t *chromeos)
vboot_handoff = cbmem_find(CBMEM_ID_VBOOT_HANDOFF);
- if (vboot_handoff != NULL) {
- vboot_handoff->init_params.flags |= VB_INIT_FLAG_OPROM_MATTERS;
- if (oprom_is_loaded)
- vboot_handoff->init_params.flags |=
- VB_INIT_FLAG_OPROM_LOADED;
-
+ if (vboot_handoff != NULL)
memcpy(&chromeos->vdat[0], &vboot_handoff->shared_data[0],
ARRAY_SIZE(chromeos->vdat));
- }
#endif
#if CONFIG_ELOG
Stefan Reinauer (stefan.reinauer(a)coreboot.org) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/4220
-gerrit
commit 109d6e52d063336ada7a64f8756d9c63ff617bb7
Author: Duncan Laurie <dlaurie(a)chromium.org>
Date: Mon Jun 3 10:45:08 2013 -0700
haswell boards: Enable VIRTUAL_DEV_SWITCH
This config option was not enabled which was preventing
the user from enabling developer mode from recovery mode.
With this enabled we can disable the "dev mode by default"
behavior and let people enable it by entering recovery mode.
This will make the firmware behave like a typical chromeos
device.
Peppy is left in "default dev mode" until after bringup.
1) boot slippy in normal mode by default
2) enter recovery mode with servo button
3) Ctrl+D on USB keyboard to enter developer mode
4) boot slippy in developer mode
Change-Id: I414c0d10dd0489e3c89798f75a2872a43297c8d8
Signed-off-by: Duncan Laurie <dlaurie(a)chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/57350
Reviewed-by: Aaron Durbin <adurbin(a)chromium.org>
---
src/mainboard/google/falco/Kconfig | 1 +
src/mainboard/google/falco/chromeos.c | 2 +-
src/mainboard/google/peppy/Kconfig | 1 +
src/mainboard/google/slippy/Kconfig | 1 +
src/mainboard/google/slippy/chromeos.c | 2 +-
5 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/src/mainboard/google/falco/Kconfig b/src/mainboard/google/falco/Kconfig
index 3a08086..3c0c576 100644
--- a/src/mainboard/google/falco/Kconfig
+++ b/src/mainboard/google/falco/Kconfig
@@ -10,6 +10,7 @@ config BOARD_SPECIFIC_OPTIONS # dummy
select BOARD_ROMSIZE_KB_8192
select EC_GOOGLE_CHROMEEC
select EC_SOFTWARE_SYNC
+ select VIRTUAL_DEV_SWITCH
select HAVE_ACPI_TABLES
select HAVE_OPTION_TABLE
select HAVE_ACPI_RESUME
diff --git a/src/mainboard/google/falco/chromeos.c b/src/mainboard/google/falco/chromeos.c
index 1b70fde..51d625b 100644
--- a/src/mainboard/google/falco/chromeos.c
+++ b/src/mainboard/google/falco/chromeos.c
@@ -83,7 +83,7 @@ void fill_lb_gpios(struct lb_gpios *gpios)
/* The dev-switch is virtual */
int get_developer_mode_switch(void)
{
- return 1;
+ return 0;
}
/* There are actually two recovery switches. One is the magic keyboard chord,
diff --git a/src/mainboard/google/peppy/Kconfig b/src/mainboard/google/peppy/Kconfig
index 5eb8b95..74a04fb 100644
--- a/src/mainboard/google/peppy/Kconfig
+++ b/src/mainboard/google/peppy/Kconfig
@@ -10,6 +10,7 @@ config BOARD_SPECIFIC_OPTIONS # dummy
select BOARD_ROMSIZE_KB_8192
select EC_GOOGLE_CHROMEEC
select EC_SOFTWARE_SYNC
+ select VIRTUAL_DEV_SWITCH
select HAVE_ACPI_TABLES
select HAVE_OPTION_TABLE
select HAVE_ACPI_RESUME
diff --git a/src/mainboard/google/slippy/Kconfig b/src/mainboard/google/slippy/Kconfig
index a53ac00..aaea947 100644
--- a/src/mainboard/google/slippy/Kconfig
+++ b/src/mainboard/google/slippy/Kconfig
@@ -10,6 +10,7 @@ config BOARD_SPECIFIC_OPTIONS # dummy
select BOARD_ROMSIZE_KB_8192
select EC_GOOGLE_CHROMEEC
select EC_SOFTWARE_SYNC
+ select VIRTUAL_DEV_SWITCH
select HAVE_ACPI_TABLES
select HAVE_OPTION_TABLE
select HAVE_ACPI_RESUME
diff --git a/src/mainboard/google/slippy/chromeos.c b/src/mainboard/google/slippy/chromeos.c
index 1b70fde..51d625b 100644
--- a/src/mainboard/google/slippy/chromeos.c
+++ b/src/mainboard/google/slippy/chromeos.c
@@ -83,7 +83,7 @@ void fill_lb_gpios(struct lb_gpios *gpios)
/* The dev-switch is virtual */
int get_developer_mode_switch(void)
{
- return 1;
+ return 0;
}
/* There are actually two recovery switches. One is the magic keyboard chord,
Stefan Reinauer (stefan.reinauer(a)coreboot.org) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/4218
-gerrit
commit 760fe4ac5291a9fd0d08ea202c12796971a37cf9
Author: Aaron Durbin <adurbin(a)chromium.org>
Date: Tue Jun 4 08:57:54 2013 -0500
vboot: use out_flags to indicate dev mode
In order to make the proper decision on loading the
option rom or not the developer mode setting needs to be
known. Under early firmware selection it is possible to know
the state of developer mode by a flag in out flags. Use this
flag when early firmware selection is being employed to determine
if developer mode is enabled or not.
Change-Id: I9c226d368e92ddf8f14ce4dcde00da144de2a5f3
Signed-off-by: Aaron Durbin <adurbin(a)chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/57380
Reviewed-by: Duncan Laurie <dlaurie(a)chromium.org>
---
src/vendorcode/google/chromeos/chromeos.c | 21 ++++++++++++++++++++-
1 file changed, 20 insertions(+), 1 deletion(-)
diff --git a/src/vendorcode/google/chromeos/chromeos.c b/src/vendorcode/google/chromeos/chromeos.c
index 6f1fe72..c2cc0e1 100644
--- a/src/vendorcode/google/chromeos/chromeos.c
+++ b/src/vendorcode/google/chromeos/chromeos.c
@@ -26,9 +26,28 @@
#include <cbmem.h>
#include <console/console.h>
+#if CONFIG_VBOOT_VERIFY_FIRMWARE
+static int vboot_enable_developer(void)
+{
+ struct vboot_handoff *vbho;
+
+ vbho = cbmem_find(CBMEM_ID_VBOOT_HANDOFF);
+
+ if (vbho == NULL) {
+ printk(BIOS_ERR, "%s: Couldn't find vboot_handoff structure!\n",
+ __func__);
+ return 0;
+ }
+
+ return !!(vbho->init_params.out_flags & VB_INIT_OUT_ENABLE_DEVELOPER);
+}
+#else
+static inline int vboot_enable_developer(void) { return 0; }
+#endif
+
int developer_mode_enabled(void)
{
- return get_developer_mode_switch();
+ return get_developer_mode_switch() || vboot_enable_developer();
}
int recovery_mode_enabled(void)