summaryrefslogtreecommitdiff
path: root/firmware/lib
diff options
context:
space:
mode:
authorRandall Spangler <rspangler@chromium.org>2013-02-05 12:42:36 -0800
committerChromeBot <chrome-bot@google.com>2013-02-06 17:38:05 -0800
commit7f43669630cb42e40ca6ddc1128eefea8fd339d9 (patch)
tree456e5db55ce4bf057d8e95c8897b9df422e5679e /firmware/lib
parent0714d9de56da3a5c686b26755d15aa6788c727d4 (diff)
downloadvboot-7f43669630cb42e40ca6ddc1128eefea8fd339d9.tar.gz
Add more vboot_api_kernel testsstabilize-bluetooth-smart
BUG=chromium-os:38139 BRANCH=none TEST=make runtests && FEATURES=test emerge-daisy vboot_reference Change-Id: Ib280b80ba707f8a2141d728f78ae296774b1301a Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/42669
Diffstat (limited to 'firmware/lib')
-rw-r--r--firmware/lib/include/vboot_kernel.h45
-rw-r--r--firmware/lib/vboot_api_kernel.c33
2 files changed, 52 insertions, 26 deletions
diff --git a/firmware/lib/include/vboot_kernel.h b/firmware/lib/include/vboot_kernel.h
index 6e6c5dc3..e3a44190 100644
--- a/firmware/lib/include/vboot_kernel.h
+++ b/firmware/lib/include/vboot_kernel.h
@@ -10,7 +10,9 @@
#define VBOOT_REFERENCE_VBOOT_KERNEL_H_
#include "cgptlib.h"
+#include "load_firmware_fw.h"
#include "vboot_api.h"
+#include "vboot_kernel.h"
/**
* Allocate and read GPT data from the drive. The sector_bytes and
@@ -26,4 +28,47 @@ int AllocAndReadGptData(VbExDiskHandle_t disk_handle, GptData *gptdata);
*/
int WriteAndFreeGptData(VbExDiskHandle_t disk_handle, GptData *gptdata);
+/**
+ * Accessors for unit tests only.
+ */
+VbNvContext *VbApiKernelGetVnc(void);
+
+/**
+ * Try to load a kernel.
+ */
+uint32_t VbTryLoadKernel(VbCommonParams *cparams, LoadKernelParams *p,
+ uint32_t get_info_flags);
+
+/**
+ * Ask the user to confirm something.
+ *
+ * We should display whatever the question is first, then call this. ESC is
+ * always "no", ENTER is always "yes", and we'll specify what SPACE means. We
+ * don't return until one of those keys is pressed, or until asked to shut
+ * down.
+ *
+ * Returns: 1=yes, 0=no, -1 = shutdown.
+ */
+int VbUserConfirms(VbCommonParams *cparams, int space_means_no);
+
+/**
+ * Handle a normal boot.
+ */
+VbError_t VbBootNormal(VbCommonParams *cparams, LoadKernelParams *p);
+
+/**
+ * Handle a developer-mode boot.
+ */
+VbError_t VbBootDeveloper(VbCommonParams *cparams, LoadKernelParams *p);
+
+/**
+ * Handle a recovery-mode boot.
+ */
+VbError_t VbBootRecovery(VbCommonParams *cparams, LoadKernelParams *p);
+
+/**
+ * Sync EC firmware to expected version.
+ */
+VbError_t VbEcSoftwareSync(VbCommonParams *cparams);
+
#endif /* VBOOT_REFERENCE_VBOOT_KERNEL_H_ */
diff --git a/firmware/lib/vboot_api_kernel.c b/firmware/lib/vboot_api_kernel.c
index c7213ede..9b596fc2 100644
--- a/firmware/lib/vboot_api_kernel.c
+++ b/firmware/lib/vboot_api_kernel.c
@@ -28,7 +28,7 @@ VbNvContext *VbApiKernelGetVnc(void)
#endif
/**
- * Set recovery request
+ * Set recovery request (called from vboot_api_kernel.c functions only)
*/
static void VbSetRecoveryRequest(uint32_t recovery_request)
{
@@ -125,17 +125,7 @@ uint32_t VbTryLoadKernel(VbCommonParams *cparams, LoadKernelParams *p,
#define CONFIRM_KEY_DELAY 20 /* Check confirm screen keys every 20ms */
-/**
- * Ask the user to confirm something.
- *
- * We should display whatever the question is first, then call this. ESC is
- * always "no", ENTER is always "yes", and we'll specify what SPACE means. We
- * don't return until one of those keys is pressed, or until asked to shut
- * down.
- *
- * Returns: 1=yes, 0=no, -1 = shutdown.
- */
-static int VbUserConfirms(VbCommonParams *cparams, int space_means_no)
+int VbUserConfirms(VbCommonParams *cparams, int space_means_no)
{
uint32_t key;
@@ -171,9 +161,6 @@ static int VbUserConfirms(VbCommonParams *cparams, int space_means_no)
return -1;
}
-/**
- * Handle a normal boot.
- */
VbError_t VbBootNormal(VbCommonParams *cparams, LoadKernelParams *p)
{
/* Boot from fixed disk only */
@@ -181,9 +168,6 @@ VbError_t VbBootNormal(VbCommonParams *cparams, LoadKernelParams *p)
return VbTryLoadKernel(cparams, p, VB_DISK_FLAG_FIXED);
}
-/**
- * Handle a developer-mode boot.
- */
VbError_t VbBootDeveloper(VbCommonParams *cparams, LoadKernelParams *p)
{
GoogleBinaryBlockHeader *gbb =
@@ -320,11 +304,11 @@ VbError_t VbBootDeveloper(VbCommonParams *cparams, LoadKernelParams *p)
VbExBeep(120, 400);
break;
- case VB_KEY_CTRL_ENTER:
- /*
- * The Ctrl-Enter is special for Lumpy test purpose; fall through
- * to Ctrl+U handler.
- */
+ case VB_KEY_CTRL_ENTER:
+ /*
+ * The Ctrl-Enter is special for Lumpy test purpose;
+ * fall through to Ctrl+U handler.
+ */
case 0x15:
/* Ctrl+U = try USB boot, or beep if failure */
VBDEBUG(("VbBootDeveloper() - "
@@ -393,9 +377,6 @@ VbError_t VbBootDeveloper(VbCommonParams *cparams, LoadKernelParams *p)
#define REC_DISK_DELAY 1000 /* Check disks every 1s */
#define REC_KEY_DELAY 20 /* Check keys every 20ms */
-/**
- * Handle a recovery-mode boot.
- */
VbError_t VbBootRecovery(VbCommonParams *cparams, LoadKernelParams *p)
{
VbSharedDataHeader *shared =