From 948b65615a4e84baa5862633e13705d1f283f0db Mon Sep 17 00:00:00 2001
From: Paul Kocialkowski <contact@paulk.fr>
Date: Mon, 10 Aug 2015 22:46:43 +0200
Subject: [PATCH 3/7] firmware: NV context pointer handoff to VbExDisplayScreen

VbExDisplayScreen might need to display some information based on the NV context
so it makes sense to pass that pointer along.

Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
---
 firmware/include/vboot_api.h    | 4 +++-
 firmware/lib/vboot_display.c    | 4 ++--
 firmware/stub/vboot_api_stub.c  | 3 ++-
 tests/vboot_api_devmode_tests.c | 3 ++-
 4 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/firmware/include/vboot_api.h b/firmware/include/vboot_api.h
index ddc8cc6..c98fca4 100644
--- a/firmware/include/vboot_api.h
+++ b/firmware/include/vboot_api.h
@@ -24,6 +24,7 @@
 #include <stdint.h>
 #include <stdlib.h>
 
+#include "vboot_nvstorage.h"
 #include "gpt.h"
 
 /*****************************************************************************/
@@ -771,7 +772,8 @@ VbError_t VbExDisplaySetDimension(uint32_t width, uint32_t height);
  * to be simple ASCII text such as "NO GOOD" or "INSERT"; these screens should
  * only be seen during development.
  */
-VbError_t VbExDisplayScreen(uint32_t screen_type, uint32_t locale);
+VbError_t VbExDisplayScreen(uint32_t screen_type, VbNvContext *vnc,
+                            uint32_t locale);
 
 /**
  * Write an image to the display, with the upper left corner at the specified
diff --git a/firmware/lib/vboot_display.c b/firmware/lib/vboot_display.c
index b95a1eb..472ca91 100644
--- a/firmware/lib/vboot_display.c
+++ b/firmware/lib/vboot_display.c
@@ -340,7 +340,7 @@ static VbError_t VbDisplayScreenLegacy(VbCommonParams *cparams, uint32_t screen,
 	disp_current_screen = screen;
 
 	/* Display default first */
-	if (VBERROR_SUCCESS == VbExDisplayScreen(screen, locale))
+	if (VBERROR_SUCCESS == VbExDisplayScreen(screen, vncptr, locale))
 		return VBERROR_SUCCESS;
 
 	/* If default doesn't have anything to show, fall back to GBB bitmaps */
@@ -357,7 +357,7 @@ VbError_t VbDisplayScreen(VbCommonParams *cparams, uint32_t screen,
 	VbNvGet(vncptr, VBNV_LOCALIZATION_INDEX, &locale);
 
 	if (gbb->bmpfv_size == 0) {
-		VbError_t ret = VbExDisplayScreen(screen, locale);
+		VbError_t ret = VbExDisplayScreen(screen, vncptr, locale);
 
 		/* Keep track of the currently displayed screen */
 		if (ret == VBERROR_SUCCESS)
diff --git a/firmware/stub/vboot_api_stub.c b/firmware/stub/vboot_api_stub.c
index 2299a03..9c86fc7 100644
--- a/firmware/stub/vboot_api_stub.c
+++ b/firmware/stub/vboot_api_stub.c
@@ -43,7 +43,8 @@ VbError_t VbExDisplaySetDimension(uint32_t width, uint32_t height)
 	return VBERROR_SUCCESS;
 }
 
-VbError_t VbExDisplayScreen(uint32_t screen_type, uint32_t locale)
+VbError_t VbExDisplayScreen(uint32_t screen_type, VbNvContext *vnc,
+                            uint32_t locale)
 {
 	return VBERROR_SUCCESS;
 }
diff --git a/tests/vboot_api_devmode_tests.c b/tests/vboot_api_devmode_tests.c
index cd927a8..16abc6e 100644
--- a/tests/vboot_api_devmode_tests.c
+++ b/tests/vboot_api_devmode_tests.c
@@ -265,7 +265,8 @@ VbError_t VbExBeep(uint32_t msec, uint32_t frequency) {
   return beep_return;
 }
 
-VbError_t VbExDisplayScreen(uint32_t screen_type, uint32_t locale) {
+VbError_t VbExDisplayScreen(uint32_t screen_type, VbNvContext *vnc,
+                            uint32_t locale) {
   switch(screen_type) {
   case VB_SCREEN_BLANK:
     VBDEBUG(("VbExDisplayScreen(BLANK)\n"));
-- 
2.8.0

