summaryrefslogtreecommitdiff
path: root/lib/vbexport
AgeCommit message (Collapse)Author
2011-08-29CHROMIUMOS: Add vbexport_init() to set up librarySimon Glass
We need to register available boot devices. It seems reasonable that this library should be initialized before use. BUG=chromium-os:19518 TEST=build on Seaboard; vbexport_test diskinfo See that all boot devices are found with SD and USB inserted Change-Id: I17a535dc85b5aaee669ea67b439632bafb19c806 Reviewed-on: http://gerrit.chromium.org/gerrit/6501 Reviewed-by: Anton Staaf <robotboy@chromium.org> Tested-by: Simon Glass <sjg@chromium.org>
2011-08-29Only include mmc.h when mmc is enabled.Stefan Reinauer
From http://gerrit.chromium.org/gerrit/#change,6253 BUG=none TEST=none Change-Id: I3145aa84a8426506d8dc44d094da4884f079b3b4 Reviewed-on: http://gerrit.chromium.org/gerrit/6355 Tested-by: Stefan Reinauer <reinauer@chromium.org> Reviewed-by: Simon Glass <sjg@chromium.org>
2011-08-29Look for an IDE boot device on non-MMC systems.Stefan Reinauer
This is a rewrite of http://gerrit.chromium.org/gerrit/#change,5547 which tries to integrate more transparently into vbexport's code and at the same time removes some (false) assumptions about always booting from MMC. BUG=none TEST=none Change-Id: I18f3b91f307b16622de9ced97ab00454c29941fe Reviewed-on: http://gerrit.chromium.org/gerrit/6232 Reviewed-by: Simon Glass <sjg@chromium.org> Tested-by: Stefan Reinauer <reinauer@google.com>
2011-08-29CHROMIUMOS: tidy msleep castSimon Glass
BUG=chromium-os:19353 TEST=build for Seaboard Change-Id: Iba1da73cdd5a8e3972240e939a40ee4a32e83786 Reviewed-on: http://gerrit.chromium.org/gerrit/6252 Reviewed-by: Simon Glass <sjg@chromium.org> Tested-by: Simon Glass <sjg@chromium.org>
2011-08-29New function VbExDecompress(), changed VbExDisplayImage().Bill Richardson
The vboot_api.h interface has changed, so we need to adapt. VbExDecompress() now allows the vboot library access to native decompression routines. The signature of VbExDisplayImage() has changed, so we now only need to support uncompressed native-format bitmaps. BUG=chromium-os:19134 TEST=manual I tested by modifying the U-Boot build so I could get into the U-Boot prompt and run "vbexport_test display". The GBB screens rendered correctly. Change-Id: Iec605dee0af46e7d9eecc89b826e260f8a5930a4 Reviewed-on: http://gerrit.chromium.org/gerrit/6131 Reviewed-by: Randall Spangler <rspangler@chromium.org> Reviewed-by: Bill Richardson <wfrichar@chromium.org> Tested-by: Bill Richardson <wfrichar@chromium.org>
2011-08-29Makes the VbExGetTimer vboot callback function board specificGabe Black
The timer_get_us function which is called by the existing implementation of VbExGetTimer isn't trivial to implement on x86. The vboot source says that the TSC is an appropriate time source to return from this function. This change makes the VbExGetTimer function per board so that it can use rdtsc instead of timer_get_us. BUG=chrome-os-partner:4552 TEST=Built and booted on x86-alex, and built on tegra2_kaen. Signed-off-by: Gabe Black <gabeblack@google.com> Change-Id: I335d5ae98949cd05c42dc3f30c52931bdf63a623 Reviewed-on: http://gerrit.chromium.org/gerrit/5544 Reviewed-by: Gabe Black <gabeblack@chromium.org> Tested-by: Gabe Black <gabeblack@chromium.org>
2011-08-29Implement missing functions for vboot:Stefan Reinauer
* video_clear() Clear the video framebuffer. * cold_reboot() Do a hard reset through the chipset's reset control register. This register is available on all x86 systems (at least those built in the last 10ys) * power_off() Power down the machine by using the power management sleep control of the chipset. This will currently only work on Intel chipsets. However, adapting it to new chipsets is fairly simple. You will have to find the IO address of the power management register block in your southbridge, and look up the appropriate SLP_TYP_S5 value from your southbridge's data sheet. BUG=chrome-os-partner:3912 TEST=Run vboot_twostage and see vboot first clear the screen and later cold boot. Run poweroff and coldboot command in uboot console. Change-Id: I59f49a41e8807b2ec3ebb3d083d2a06ced9553a0 Reviewed-on: http://gerrit.chromium.org/gerrit/5361 Reviewed-by: Stefan Reinauer <reinauer@chromium.org> Tested-by: Stefan Reinauer <reinauer@chromium.org>
2011-08-29Remove the device tree from one of the vboot support APIs.Gabe Black
This change removes the device tree from one of the vboot support APIs so that they fit better with coreboot u-boot. Specifically this is cros_gpio_fetch which is for getting GPIO values. Coreboot will read these and provide the values through its coreboot tables. The device tree pointer is global data so it doesn't need to be passed around as a parameter to be accessible. This change also removes the device tree from other interfaces in cmd_vboot_twostop.c so the structure of the code is more consistent. This way people can expect the device tree to always be the one pointed at by the global data and not sometimes one and sometimes the other, even though as written those will be equivalent. This change also takes the opportunity to mark the local functions in that file static, which is most of them. BUG=chrome-os-partner:4552 TEST=Built for x86-alex and tegra2_kaen. Installed and booted to chromeos login on Kaen. Change-Id: I084e774d97025d9ec71abe09c92fab8a7827892f Signed-off-by: Gabe Black <gabeblack@google.com> Reviewed-on: http://gerrit.chromium.org/gerrit/5232 Reviewed-by: Gabe Black <gabeblack@chromium.org> Tested-by: Gabe Black <gabeblack@chromium.org>
2011-08-29CHROMIUM: move VbExHashFirmwareBody() to lib/vbexport/Che-Liang Chiou
This patch only moves code around. BUG=chromium-os:16542 TEST=build okay Change-Id: Idc908fd2e652c114ae8029c120386fb44e63b4f9 Reviewed-on: http://gerrit.chromium.org/gerrit/5204 Tested-by: Che-Liang Chiou <clchiou@chromium.org> Reviewed-by: Gabe Black <gabeblack@chromium.org>
2011-08-29Implement shared display support.Vadim Bendebury
This change fills up the stubs in lib/vbexport/display.c to provide support on both ARM (where LCD driver is used) and X86 (where the CFB driver is used) platforms. BUG=chrome-os-partner:4552 TEST=manual On X86 (alex with a Dediprog programmer connected to it), run the following commands: . emerge-x86-alex vboot_reference-firmware chromeos-u-boot chromeos-coreboot dd if=/build/x86-alex/coreboot/coreboot.rom of=/tmp/coreboot seek=3584 bs=1K sudo flashrom -p dediprog -w /tmp/coreboot . Reboot the machine, observe it come up to boot> prompt, start ChromeOS (using the `boot' cli command). On ARM (tegra2_kaen) . emerge-tegra2_kaen vboot_reference-firmware chromeos-u-boot chromeos-bootimage . program the resulting image into Kaen, restart it, observe the machine come up. . install the new OS image on the machine, restart it, observe the machine come up. . request recovery reboot using crossystem, restart the machine, observe it come up in recovery request mode. This test case actually failed: the system did show the recovery request screen, but then proceeded to boot from the plugged in USB stick (it was supposed to wait for the stick to be removed/reinserted) Change-Id: I75310de3f93464645cc9e61237f65d7d19b71873 Signed-off-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-on: http://gerrit.chromium.org/gerrit/4886 Reviewed-by: Stefan Reinauer <reinauer@google.com>
2011-08-29Conditionally implement vbexport functionsGabe Black
There are a few functions in display.c in the vbexport library which depend on being able to call functions provided by the LCD driver. If that support isn't turned on then compilation will fail. It can't always be turned on because it's not always the right driver to use. This change conditionally compiles in the existing implementation if the right support is available and compiles in a warning message and a failing return code if it isn't. BUG=chrome-os-partner:4552 TEST=Built on x86. Signed-off-by: Gabe Black <gabeblack@google.com> Change-Id: I70695f06bb1b55063d035307e0420f8fc58b1efa Reviewed-on: http://gerrit.chromium.org/gerrit/4768 Reviewed-by: Vadim Bendebury <vbendeb@chromium.org> Tested-by: Gabe Black <gabeblack@chromium.org>
2011-08-29CHROMIUM: reorganize config headersChe-Liang Chiou
The headers are merged and split into the board-independent header chromeos.h and a board-dependent header, e.g., chromeos_tegra2_twostop.h. The board-independent header defines/enables all features that a verified boot firmware must have, and is included by a board-dependent header. Moreover, the CONFIG_CHROMEOS_* flags are reduced into a single flag CONFIG_CHROMEOS. BUG=none TEST=make chromeos_tegra2_twostop_config && make Change-Id: I2ec9092ed898c640175095e86cfcb100efbefb3a Reviewed-on: http://gerrit.chromium.org/gerrit/4731 Reviewed-by: Che-Liang Chiou <clchiou@chromium.org> Tested-by: Che-Liang Chiou <clchiou@chromium.org>
2011-08-29Make vbexport only use the fdt for LCD info if that's configuredGabe Black
BUG=chrome-os-partner:4552 TEST=Built and booted u-boot on an Alex. Change-Id: I03eb29f70742b4dd3056b0e50c8d54f125bff225 Signed-off-by: Gabe Black <gabeblack@google.com> Reviewed-on: http://gerrit.chromium.org/gerrit/4717 Reviewed-by: Simon Glass <sjg@chromium.org> Tested-by: Gabe Black <gabeblack@chromium.org>
2011-08-29Make a few files assume a reasonable default if CACHE_LINE_SIZE isn't set.Gabe Black
This change modifies a few files to set a reasonable default, __BIGGEST_ALIGNMENT__, if CACHE_LINE_SIZE isn't set. There's precedence for doing this in a few other places in u-boot, and it's helpful if CACHE_LINE_SIZE isn't easy to determine. BUG=chrome-os-partner:4552 TEST=Built and booted on Alex and Seaboard. Change-Id: Id1fc373a35dd93f28c2c2f5c4bdaff707ff700e9 Signed-off-by: Gabe Black <gabeblack@google.com> Reviewed-on: http://gerrit.chromium.org/gerrit/4699 Reviewed-by: Stefan Reinauer <reinauer@google.com> Tested-by: Gabe Black <gabeblack@chromium.org>
2011-08-29CHROMIUM: unroll the outer for-loop of VbExDiskGetInfo()Che-Liang Chiou
VbExDiskGetInfo() was implemented with nested loops, where the outer loop iterates iterators, and the inner loop runs through block devices via the iterator. It was quite complicated and the outer loop only iterates twice. So we believe it will make the code more readable if we unroll the outer for-loop. Besides unrolling the loop, we fix a logic error that disk_flags should be tested 'is subset of' rather than 'has non-empty intersection with' flags. BUG=chromium-os:16542 TEST=vbexport_test diskinfo Change-Id: Ic4a7d516d91ba7214b9b67eebbecf02f80b11786 Signed-off-by: Tammo Spalink <tammo@chromium.org> Reviewed-on: http://gerrit.chromium.org/gerrit/4472 Tested-by: Che-Liang Chiou <clchiou@chromium.org> Reviewed-by: Tom Wai-Hong Tam <waihong@chromium.org>
2011-08-29CHROMIUM: remove CONFIG_HARDWARE_TPMChe-Liang Chiou
The CONFIG_HARDWARE_TPM flag was used to disable software emulation of TPM functionality, for testing purpose or for boards that have a buggy or even do not have a hardware TPM. However, it turns out that it is easier to mock out TPM entirely in vboot_reference than implement a full software-emulated TPM in U-Boot. So we believe remove this flag and implement a mock in vboot_reference. BUG=none TEST=boot on Aebl Change-Id: Id6d2975f04f0f5e4203d45e23f36fce2ad7114f3 Reviewed-on: http://gerrit.chromium.org/gerrit/4647 Tested-by: Che-Liang Chiou <clchiou@chromium.org> Reviewed-by: Rong Chang <rongchang@chromium.org>
2011-08-29CHROMIUM: move VbExNvStorageRead/Write to board-specific directoryChe-Liang Chiou
As ARM accesses non-volatile storage from eMMC and x86 from CMOS, the accessor functions that export to vboot_reference are really not board-independent and so should be put at a board-dependent module. BUG=none TEST=make Change-Id: Idbd4d70372770597aa8897524ee6a1ffe173bfea Reviewed-on: http://gerrit.chromium.org/gerrit/4646 Tested-by: Che-Liang Chiou <clchiou@chromium.org> Reviewed-by: Tom Wai-Hong Tam <waihong@chromium.org>
2011-08-29CHROMIUM: Implement VbExIsShutdownRequested() function and its test.Tom Wai-Hong Tam
The check condition is either: * a user has pressed the power button; * a user has closed the lid. BUG=chromium-os:17180,chrome-os-partner:4738 TEST=build without error, run "vbexport_test isshutdown", or boot recovery mode on Aebl --- When I pressed the power key, see the messages --- misc: Power-key-pressed is detected. VbDisplayScreen(0, 0) VbDisplayScreenFromGBB(): screen 0 not in the GBB VbSelectAndLoadKernel() returning 1 Returned 0x1 main: Failed to select and load kernel! --- When I closed the lid, see the messages --- misc: Lid-closed is detected. VbDisplayScreen(0, 0) VbDisplayScreenFromGBB(): screen 0 not in the GBB VbSelectAndLoadKernel() returning 1 Returned 0x1 main: Failed to select and load kernel! Change-Id: Ia003187215c0327b0246592404d13bab668cd323 Reviewed-on: http://gerrit.chromium.org/gerrit/4486 Tested-by: Tom Wai-Hong Tam <waihong@chromium.org> Reviewed-by: Che-Liang Chiou <clchiou@chromium.org>
2011-08-29CHROMIUIM: fix VbExKeyboardRead() not returning Escape characterChe-Liang Chiou
Another bug that was found when testing this patch: The keyboard driver does not seem to return arrow keys. BUG=chromium-os:17931 TEST=vbexport_test key Tested keys: Escape, Tab, Ctrl-D, Ctrl-U, Enter, Space No responding keys: Up, Down, Left, Right Change-Id: I3aa551bd0edf62e6b9eb7b067136140a7d197b8e Reviewed-on: http://gerrit.chromium.org/gerrit/4483 Tested-by: Che-Liang Chiou <clchiou@chromium.org> Reviewed-by: Tom Wai-Hong Tam <waihong@chromium.org>
2011-08-29CHROMIUM: fix error of showing eMMC as a removable diskChe-Liang Chiou
It is too bad that I did not catch this when I tested the cleanup patch. To avoid that from happening again, more checks are added to "vbexport_test diskinfo" that prints out an error message when the flag of any probed storage device mismatches the given flag. BUG=chromium-os:16542 TEST=manual When no SD card and USB key is inserted, vbexport_test diskinfo prints "No disk found!" under "Detecting all removable disks..." test. Change-Id: I0e20a6337c7cd638b883cf36416fdb3ae5bd3071 Reviewed-on: http://gerrit.chromium.org/gerrit/4392 Tested-by: Che-Liang Chiou <clchiou@chromium.org> Reviewed-by: Tammo Spalink <tammo@chromium.org>
2011-08-29CHROMIUM: A good alternative way to show blank screen is to clear lcd.Tom Wai-Hong Tam
BUG=chromium-os:16542 TEST=build and run "vbexport_test display" on seaboard, see the lcd is cleared. Change-Id: I5bbaed77c14368fd2734a89a5766a04449216d9b Reviewed-on: http://gerrit.chromium.org/gerrit/4380 Tested-by: Tom Wai-Hong Tam <waihong@chromium.org> Reviewed-by: Che-Liang Chiou <clchiou@chromium.org>
2011-08-29CHROMIUM: cleanup duplicated for-loops of VbExDiskGetInfo()Che-Liang Chiou
BUG=chromium-os:16542 TEST=vbexport_test diskinfo && vbexport_test diskrw Change-Id: Ie44c31d26d2380c6f080b962c4290218de7235ec Reviewed-on: http://gerrit.chromium.org/gerrit/4379 Tested-by: Che-Liang Chiou <clchiou@chromium.org> Reviewed-by: Tom Wai-Hong Tam <waihong@chromium.org>
2011-08-29CHROMIUM: remove codes based on deprecated API of vboot_referenceChe-Liang Chiou
vboot_reference is redesigned and deprecates parts of its API. This patch remove those U-Boot integration codes that are based on the deprecated API. BUG=none TEST=clean build okay Change-Id: I45e08b8f5b6cec8f1bd62e760361f169aac4b687 Reviewed-on: http://gerrit.chromium.org/gerrit/4382 Tested-by: Che-Liang Chiou <clchiou@chromium.org> Reviewed-by: Tom Wai-Hong Tam <waihong@chromium.org>
2011-08-29CHROMIUM: fix mismatch of format and argument type to debug printfChe-Liang Chiou
BUG=none TEST=build cleanly Change-Id: Id3ff5d25064d6a33b68a29ca7e30c6cd3c86136a Reviewed-on: http://gerrit.chromium.org/gerrit/4371 Reviewed-by: Che-Liang Chiou <clchiou@chromium.org> Tested-by: Che-Liang Chiou <clchiou@chromium.org>
2011-08-29CHROMIUM: remove direct calling VbExDebugChe-Liang Chiou
Debug output has to be able to be turned off. We do not want users see debugging message from read-only firmware. BUG=none TEST=successfully make chromeos_seaboard_vboot_config Change-Id: Ie243beb1966622be23e42b07784548ba8cdcf16c Reviewed-on: http://gerrit.chromium.org/gerrit/4248 Reviewed-by: Che-Liang Chiou <clchiou@chromium.org> Tested-by: Che-Liang Chiou <clchiou@chromium.org>
2011-08-29CHROMIUM: fix recovery boot hangsChe-Liang Chiou
When the developer switch is turned off, the recovery boot hangs deep inside call stack due to memory corruption caused by freeing a pointer twice. The pointer in question is allocated by VbExDiskGetInfo() and freed by VbExDiskFreeInfo(). When VbExDiskGetInfo() finds no storage device or encounters an error, it frees the VbDiskInfo pointer, but it still returns the pointer value to its caller. And its caller frees the pointer again anyway. So, when an error occurs or no storage device is available, the correct implementation of VbExDiskGetInfo() should either not freeing and returning the pointer, or freeing the pointer and returning NULL, but not anything in between. In additional to fix the free-twice bug, this patch also corrects the return value of VbExDiskGetInfo() when there are too many storage device available. This should be a success with warnings instead of an error. BUG=chromium-os:17462 TEST=manually tested on Kaen * Boot to Chrome OS on internal and external storage device through normal, developer, and recovery boot path. * The recovery boot path is tested with both developer switch on and off. Change-Id: I26026a86523b4b0f6c471c2a30a7394607a9c86b Reviewed-on: http://gerrit.chromium.org/gerrit/4297 Tested-by: Che-Liang Chiou <clchiou@chromium.org> Reviewed-by: Tom Wai-Hong Tam <waihong@chromium.org>
2011-08-29fix disk info for USB mass storage deviceVincent Palatin
We need to read the parameters from the actual USB device structure not from the last MMC device read ... BUG=chromium-os:17650 TEST=Boot with Ctrl+U and check that the sector size and the number of sectors correspond to the USB key Change-Id: I6ff5e0507372f2fdd5c1778d589894adbaef6187 Reviewed-on: http://gerrit.chromium.org/gerrit/4230 Tested-by: Vincent Palatin <vpalatin@chromium.org> Reviewed-by: Olof Johansson <olofj@chromium.org> Reviewed-by: Simon Glass <sjg@chromium.org>
2011-08-29CHROMIUM: Do partial load and hash firmware body to improve speed.Tom Wai-Hong Tam
Do partial load and hash can use the advantage of cache. Here is the benchmark results: Block size of each time read : microsecond of running VbLoadFirmware() 512 : 487998 1K : 484538 2K : 482178 4K : 480991 8K : 480623 <- the best 16K : 481034 32K : 481111 64K : 481480 128K : 481739 256K : 481280 512K : 481377 <- original So we pick the block size as 8K. BUG=none TEST=build u-boot and boot it to kernel on seaboard. Change-Id: I62432c4f7d57d102f834aeb658f2c197d3fba03b Reviewed-on: http://gerrit.chromium.org/gerrit/4162 Tested-by: Tom Wai-Hong Tam <waihong@chromium.org> Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org>
2011-08-29CHROMIUM: twostop: cleanup config flagsChe-Liang Chiou
The variants of Chrome OS verified boot are: * chromeos_seaboard_onestop implements twostop firmware based on prior-redesigned vboot_reference. It is called onestop because it was implementing onestop boot. * chromeos_seaboard_vboot implements ordinary verified boot, which has bootstub, recovery, normal, and developer firmware, based on redesigned vboot_reference. * chromeos_tegra2_twostop implements twostop firmware based on redesigned vboot_reference. This variant is going to replace chromeos_seaboard_onestop. We split config flags into: * CONFIG_CHROMEOS enables codes that are shared among all variants. * CONFIG_CHROMEOS_VBEXPORT enables codes that implements APIs defined in vboot_api.h. * CONFIG_CHROMEOS_{ONESTOP,TWOSTOP,VBOOT} enables codes that are specific to each variant. Note that we would further cleanup or reorganize config flags after we migrate from chromeos_seaboard_onestop to chromeos_tegra2_twostop. BUG=chromium-os:17424 TEST=build cleanly Change-Id: I7574ec9376047693065b4295edb85b65acb4ea37 Reviewed-on: http://gerrit.chromium.org/gerrit/3943 Tested-by: Che-Liang Chiou <clchiou@chromium.org> Reviewed-by: Rong Chang <rongchang@chromium.org>
2011-08-29CHROMIUM: refactor firmware storage device interfaceChe-Liang Chiou
BUG=chromium-os:17424 TEST=boot on Seaboard Change-Id: I8363b6e48fe3c12d04de37ce0bf18d4be657c34e Reviewed-on: http://gerrit.chromium.org/gerrit/3930 Tested-by: Che-Liang Chiou <clchiou@chromium.org> Reviewed-by: Che-Liang Chiou <clchiou@chromium.org>
2011-08-29CHROMIUM: Remove duplicated tlcl_stub library.Tom Wai-Hong Tam
Remove lib/chromeos/tlcl_stub.c (old APIs with renamed function names, patched in http://gerrit.chromium.org/gerrit/3833) Move lib/vbexport/tlcl_stub -> lib/chromeos/tlcl_stub.c BUG=chromium-os:17303 TEST=emerge-tegra2_seaboard chromeos-u-boot without error Change-Id: I62f0eb3baa6d5b737deae19e47b7fffe5c5ba794 Reviewed-on: http://gerrit.chromium.org/gerrit/3848 Reviewed-by: Hung-Te Lin <hungte@chromium.org> Reviewed-by: Che-Liang Chiou <clchiou@chromium.org> Tested-by: Tom Wai-Hong Tam <waihong@chromium.org>
2011-08-29CHROMIUM: Add the VbExIsShutdownRequested function and will implement it later.Tom Wai-Hong Tam
It now always returns no shutdown requested, in order to quickly have a workable firmware. Will implement the real behavior later. BUG=chromium-os:16543 TEST=build chromeos_seaboard_vboot withour error Change-Id: I6da3c0051b6233ef139fa17cab361af7abf7c953 Reviewed-on: http://gerrit.chromium.org/gerrit/3430 Tested-by: Tom Wai-Hong Tam <waihong@chromium.org> Reviewed-by: Che-Liang Chiou <clchiou@chromium.org>
2011-08-29CHROMIUM: Remove duplicated vboot/firmware_storage libraries.Tom Wai-Hong Tam
Directly use chromeos/firmware_storage libraries. BUG=chromium-os:16544 TEST=build without error and put it on seaboard and run: Tegra2 # vboot_test fwrw SF: Detected W25Q16 with page size 256, total 2 MiB firmware_storage: read firmware_storage: write firmware_storage_spi: before adjustment firmware_storage_spi: offset: 0xd0000 firmware_storage_spi: length: 0x20000 firmware_storage_spi: after adjustment firmware_storage_spi: offset: 0xd0000 firmware_storage_spi: length: 0x20000 firmware_storage_spi: cxt->offset: 0x000d0000 firmware_storage_spi: offset: 0x000d0000 firmware_storage: read firmware_storage: write firmware_storage_spi: before adjustment firmware_storage_spi: offset: 0xd0000 firmware_storage_spi: length: 0x20000 firmware_storage_spi: after adjustment firmware_storage_spi: offset: 0xd0000 firmware_storage_spi: length: 0x20000 firmware_storage_spi: cxt->offset: 0x000d0000 firmware_storage_spi: offset: 0x000d0000 Read and write firmware test SUCCESS. Change-Id: I608f8f2c766322d3d564bb4b0aabd0f2a30fdba4 Reviewed-on: http://gerrit.chromium.org/gerrit/3372 Tested-by: Tom Wai-Hong Tam <waihong@chromium.org> Reviewed-by: Che-Liang Chiou <clchiou@chromium.org>
2011-08-29CHROMIUM: VbExDisplayScreen shows text on the center of LCD instead of printf.Tom Wai-Hong Tam
This debug messages are showed for development, as a backup method when GBB does not contain a full set of bitmaps. We don't use printf because it shows nothing when disabled LCD console. BUG=chromium-os:16543 TEST=Build chromeos_seaboard_vboot and put it on seaboard and run: Tegra2 # vbexport_test display Then several text-filled screens showed on LCD, like: ................................................................................ ................................................................................ ................................................................................ ................................................................................ ................................................................................ ................................................................................ ................................................................................ ................................................................................ ................................................................................ .............................developer mode warning............................. ................................................................................ ................................................................................ ................................................................................ ................................................................................ ................................................................................ ................................................................................ ................................................................................ ................................................................................ ................................................................................ ................................................................................ Change-Id: I77408e256625110ac3abf2bf863fd32624467aad Reviewed-on: http://gerrit.chromium.org/gerrit/3370 Reviewed-by: Che-Liang Chiou <clchiou@chromium.org> Tested-by: Tom Wai-Hong Tam <waihong@chromium.org>
2011-08-29CHROMIUM: Implement VbExDisplayDebugInfo to show debug message on LCD.Tom Wai-Hong Tam
Use existing library in u-boot to show string on the upper left corner. BUG=chromium-os:17035 TEST=Edit chromeos_seaboard_vboot config and add the following line to disable LCD console output. #undef CONFIG_STD_DEVICES_SETTINGS #define CONFIG_STD_DEVICES_SETTINGS "stdin=serial,tegra-kbc\0" \ "stdout=serial\0" \ "stderr=serial\0" Build chromeos_seaboard_vboot and put it on seaboard and run: Tegra2 # vbexport_test display It then shows the debug message on LCD. Change-Id: I4997c51780fe6964a5b9ff4065e6d78062c3a506 Reviewed-on: http://gerrit.chromium.org/gerrit/3365 Reviewed-by: Tom Wai-Hong Tam <waihong@chromium.org> Tested-by: Tom Wai-Hong Tam <waihong@chromium.org>
2011-08-29CHROMIUM: Implement VbExDisplayImage function to show an image on LCD.Tom Wai-Hong Tam
An unit test is implemented to show all the screens on GBB. BUG=chromium-os:16543 TEST=Build chromeos_seaboard_vboot and put it on seaboard and run: Tegra2 # vbexport_test display The screen dimensions is 1366x768. Showing screens... ... SF: Detected W25Q16 with page size 256, total 2 MiB firmware_storage: read Showing images... /* Several screens show on LCD */ Change-Id: Ica05ed58a536b376359eef7e63757c1431d04061 Reviewed-on: http://gerrit.chromium.org/gerrit/3363 Reviewed-by: Tom Wai-Hong Tam <waihong@chromium.org> Tested-by: Tom Wai-Hong Tam <waihong@chromium.org>
2011-08-29CHROMIUM: Implement the basic display functions.Tom Wai-Hong Tam
This CL implements 2 basic display functions, VbExDisplayInit and VbExDisplayScreen, and their tests. BUG=chromium-os:16543 TEST=Build chromeos_seaboard_vboot and put it on seaboard and run: Tegra2 # vbexport_test display The screen dimensions is 1366x768. Showing screens... Showing a BLANK screen +------------------------------+ |------------------------------| +------------------------------+ Showing a DEVELOPER_WARNING screen +------------------------------+ |-----------warning------------| +------------------------------+ Showing a DEVELOPER_EGG screen +------------------------------+ |----------easter egg----------| +------------------------------+ Showing a RECOVERY_REMOVE screen +------------------------------+ |---remove inserted devices----| +------------------------------+ Showing a RECOVERY_INSERT screen +------------------------------+ |----insert recovery image-----| +------------------------------+ Showing a RECOVERY_NO_GOOD screen +------------------------------+ |-----insert image invalid-----| +------------------------------+ Change-Id: I6f0a570e1d737007bcea3286d84194d789eee3e4 Reviewed-on: http://gerrit.chromium.org/gerrit/3070 Tested-by: Tom Wai-Hong Tam <waihong@chromium.org> Reviewed-by: Che-Liang Chiou <clchiou@chromium.org>
2011-08-29CHROMIUM: Implement VbExKeyboardRead function.Tom Wai-Hong Tam
Only tested on serial console. The ctrl and arrow keys do not work on a physical keyboard. BUG=chromium-os:16543 TEST=build and run on seaboard: Tegra2 (SeaBoard) # vbexport_test key Press any key for test. Press Ctrl-C to exit... Key pressed: 0x04 // Ctrl-D Key pressed: 0x15 // Ctrl-U Key pressed: 0x09 // Tab Key pressed: 0x20 // Space Key pressed: 0x0d // Enter Key pressed: 0x100 // Up arrow Key pressed: 0x101 // Down arrow Key pressed: 0x102 // Left arrow Key pressed: 0x103 // Right arrow Change-Id: I64fdf967913f6c98f36a41216cdb15ee5af1a469 Reviewed-on: http://gerrit.chromium.org/gerrit/3062 Tested-by: Tom Wai-Hong Tam <waihong@chromium.org> Reviewed-by: Simon Glass <sjg@chromium.org>
2011-08-29CHROMIUM: Implement VbExHashFirmwareBody function.Tom Wai-Hong Tam
The firmware_cache data is passed by cparams->caller_contenxt which is filled before calling VbSelectFirmware(). BUG=chromium-os:16542 TEST=build without error. pending test until VbUpdateFirmwareBodyHash is ready. Change-Id: I24c6b22c1a5dffe138abae02aa2dd252c39d2ba0 Reviewed-on: http://gerrit.chromium.org/gerrit/3033 Reviewed-by: Tom Wai-Hong Tam <waihong@chromium.org> Tested-by: Tom Wai-Hong Tam <waihong@chromium.org>
2011-08-29CHROMIUM: Implement nvstorage related functions for vboot_wrapper APIs.Tom Wai-Hong Tam
Use the same approach as old time. Store the NV data in the first block of the internal disk. BUG=chromium-os:16543 TEST=Build u-boot and put it in seaboard and run: Tegra2 (SeaBoard) # vbexport_test nvrw Requested clock rate 52000000 not honored (got 48000000) MMC Device 2 not found Read and write nvstorage test SUCCESS. Change-Id: I6c08ad01dac8654c55b338f9b0f549dce5ad8c55 Reviewed-on: http://gerrit.chromium.org/gerrit/2853 Reviewed-by: Tom Wai-Hong Tam <waihong@chromium.org> Tested-by: Tom Wai-Hong Tam <waihong@chromium.org>
2011-08-29CHROMIUM: Implement read and write disk for vboot_wrapper APIs.Tom Wai-Hong Tam
An unit test is also added. BUG=chromium-os:16543 TEST=Build u-boot and put it in seaboard and run: Tegra2 (SeaBoard) # vbexport_test diskrw Requested clock rate 52000000 not honored (got 48000000) Read and write disk test SUCCESS. Change-Id: I005ecaa6e981324c57da09bc93c8dd3b218148f3 Reviewed-on: http://gerrit.chromium.org/gerrit/2850 Reviewed-by: Tom Wai-Hong Tam <waihong@chromium.org> Tested-by: Tom Wai-Hong Tam <waihong@chromium.org>
2011-08-29CHROMIUM: Implement get and free disk info for vboot_wrapper APIs.Tom Wai-Hong Tam
Some notes: - Currently there is a bug when initializing the external SD card, returning "mmc_prepare_data: Unaligned data, using slower bounce buffer". We can't test it in a real hardware. Since it shares the same interface as the internal MMC disk. So supposely it should work. - We now fill "MMC"/"USB" as the optional name string in VbDiskInfo for use in debug. - A manual test is also added for debug. BUG=chromium-os:16543 TEST=Build u-boot and put it in seaboard. Insert 3 USB sticks and run: Tegra2 (SeaBoard) # vbexport_test diskinfo Detecting all fixed disks... Requested clock rate 52000000 not honored (got 48000000) handle byte/lba lba_count f name 3fbcb850 512 15638528 2 MMC Detecting all removable disks... Card did not respond to voltage select! boot_device: Unable to init MMC dev 1. USB: Register 10011 NbrPorts 1 USB EHCI 1.00 scanning bus for devices... 5 USB Device(s) found scanning bus for storage devices... 3 Storage Device(s) found handle byte/lba lba_count f name 3fbcad28 512 31512576 1 USB 3fbcad94 512 31375360 1 USB 3fbcae00 512 30883840 1 USB Change-Id: I40822716d7e48efb321b6d33e61a6bf32e5d81cc Reviewed-on: http://gerrit.chromium.org/gerrit/2835 Tested-by: Tom Wai-Hong Tam <waihong@chromium.org> Reviewed-by: Che-Liang Chiou <clchiou@chromium.org>
2011-08-29CHROMIUM: Port tlcl_stub.c to new vboot_wrapper APIs.Tom Wai-Hong Tam
Move /lib/chromeos/tlcl_stub.c to /lib/vbexport/tlcl_stub.c and change the function names. We haven't tested it yet since the APIs in tlcl_stub.c are too elemental. We should use a more functional tpm_lib in vboot_reference to do integration test. But it needs to wait for vboot_reference to change to new proper APIs. Will write the tests later. BUG=chromium-os:16543 TEST=build chromeos_seaboard_vboot_config without error: $ make ARCH=arm CROSS_COMPILE=armv7a-cros-linux-gnueabi- \ USE_PRIVATE_LIBGCC=yes HOSTSTRIP=true \ chromeos_seaboard_vboot_config $ make ARCH=arm CROSS_COMPILE=armv7a-cros-linux-gnueabi- \ USE_PRIVATE_LIBGCC=yes HOSTSTRIP=true \ VBOOT=/build/tegra2_seaboard/usr all Change-Id: Id89b7ef5f6f01d71b32a0a95b4935f5be9c0804c Reviewed-on: http://gerrit.chromium.org/gerrit/2742 Reviewed-by: Tom Wai-Hong Tam <waihong@chromium.org> Tested-by: Tom Wai-Hong Tam <waihong@chromium.org>
2011-08-29CHROMIUM: Implement utility APIs provided by u-boot and exported to ↵Tom Wai-Hong Tam
vboot_reference. We put the new vboot wrapper export API to /lib/vbexport directory to separate the original APIs which in /lib/chromeos directory. A u-boot prompt testing tool, vbexport_test, is added for the API unit tests. This CL is dependent on http://gerrit.chromium.org/gerrit/#change,2195 BUG=chromium-os:16543 TEST=build chromeos_seaboard_vboot_config, flash it to seaboard, and run: Tegra2 # vbexport_test debug Preforming the debug output tests... Expect: K 75 Hello! It's "Chrome OS". Actual: K 75 Hello! It's "Chrome OS". Expect: -22222 0xa932 Actual: -22222 0xa932 Expect: 44444 0xad9c Actual: 44444 0xad9c Expect: -1111111111 0xbdc5ca39 Actual: -1111111111 0xbdc5ca39 Expect: 2222222222 0x84746b8e Actual: 2222222222 0x84746b8e Expect: -8888888888888888888 0x84a452a6a1dc71c8 Actual: -8888888888888888888 0x84a452a6a1dc71c8 Expect: 11111111111111111111 0x9a3298afb5ac71c7 Actual: 11111111111111111111 0x9a3298afb5ac71c7 Tegra2 # vbexport_test malloc Preforming the malloc/free tests... Trying to malloc a memory block for 1 bytes... - SUCCESS Trying to malloc a memory block for 2 bytes... - SUCCESS Trying to malloc a memory block for 4 bytes... - SUCCESS Trying to malloc a memory block for 8 bytes... - SUCCESS Trying to malloc a memory block for 32 bytes... - SUCCESS Trying to malloc a memory block for 1024 bytes... - SUCCESS Trying to malloc a memory block for 4096 bytes... - SUCCESS Trying to malloc a memory block for 32768 bytes... - SUCCESS Trying to malloc a memory block for 1048576 bytes... - SUCCESS Trying to malloc a memory block for 12345 bytes... - SUCCESS Trying to malloc a memory block for 13579 bytes... - SUCCESS Tegra2 # vbexport_test sleep Preforming the sleep tests... System is going to sleep for 10 ms... From tick 20158963 to 20168065 (delta: 9102) - SUCCESS System is going to sleep for 50 ms... From tick 20345437 to 20395038 (delta: 49601) - SUCCESS System is going to sleep for 100 ms... From tick 20572586 to 20672087 (delta: 99501) - SUCCESS System is going to sleep for 500 ms... From tick 20849623 to 21349024 (delta: 499401) - SUCCESS System is going to sleep for 1000 ms... From tick 21526751 to 22526052 (delta: 999301) - SUCCESS Tegra2 # vbexport_test longsleep Preforming the long sleep tests... System is going to sleep for 5000 ms... From tick 71318054 to 76318055 (delta: 5000001) - SUCCESS System is going to sleep for 10000 ms... From tick 76495950 to 86495051 (delta: 9999101) - SUCCESS System is going to sleep for 50000 ms... From tick 86672951 to 136672052 (delta: 49999101) - SUCCESS Tegra2 # vbexport_test beep Preforming the beep tests... System is going to sleep for 500 ms... Beep! From tick 11288504 to 11788451 (delta: 499947) - SUCCESS Change-Id: Ia192c1f152fa75f7d587d8a87eb22a1cf0a505c3 Reviewed-on: http://gerrit.chromium.org/gerrit/2656 Tested-by: Tom Wai-Hong Tam <waihong@chromium.org> Reviewed-by: Che-Liang Chiou <clchiou@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org>