diff options
author | Che-Liang Chiou <clchiou@chromium.org> | 2011-07-20 16:28:15 +0800 |
---|---|---|
committer | Simon Glass <sjg@chromium.org> | 2011-08-29 10:59:02 -0700 |
commit | e63000c289d334c500fd91e0ccfd810ef461e65d (patch) | |
tree | 7d2782c7a10af6dd2ef83a716fabc35d1ae0a6d1 /lib/vbexport | |
parent | 96963ac0127feaac0ded6b97efb4304e2efe76c4 (diff) |
CHROMIUM: remove codes based on deprecated API of vboot_reference
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>
Diffstat (limited to 'lib/vbexport')
-rw-r--r-- | lib/vbexport/Makefile | 1 | ||||
-rw-r--r-- | lib/vbexport/nvstorage.c | 9 | ||||
-rw-r--r-- | lib/vbexport/tlcl_stub.c | 63 | ||||
-rw-r--r-- | lib/vbexport/utility.c | 10 |
4 files changed, 78 insertions, 5 deletions
diff --git a/lib/vbexport/Makefile b/lib/vbexport/Makefile index 4b99667039..c59cd8e87c 100644 --- a/lib/vbexport/Makefile +++ b/lib/vbexport/Makefile @@ -18,6 +18,7 @@ COBJS-$(CONFIG_CHROMEOS_VBEXPORT) += keyboard.o COBJS-$(CONFIG_CHROMEOS_VBEXPORT) += load_firmware.o COBJS-$(CONFIG_CHROMEOS_VBEXPORT) += misc.o COBJS-$(CONFIG_CHROMEOS_VBEXPORT) += nvstorage.o +COBJS-$(CONFIG_CHROMEOS_VBEXPORT) += tlcl_stub.o COBJS-$(CONFIG_CHROMEOS_VBEXPORT) += utility.o COBJS := $(COBJS-y) diff --git a/lib/vbexport/nvstorage.c b/lib/vbexport/nvstorage.c index 3d93b190e8..e9f49c4f85 100644 --- a/lib/vbexport/nvstorage.c +++ b/lib/vbexport/nvstorage.c @@ -23,9 +23,6 @@ * cookies in eMMC device where we are certain that kernel can access. */ -/* Store the cookies in the first LBA of the internal disk. */ -#define NVCXT_LBA 0 - /* * Gets the first internal disk and caches the result in a static variable. * Returns 0 for success, non-zero for failure. @@ -63,7 +60,8 @@ static int get_nvcxt_block_of_disk(const VbDiskInfo *disk, block_buf = VbExMalloc(disk->bytes_per_lba); - if (VbExDiskRead(disk->handle, NVCXT_LBA, 1, block_buf)) { + if (VbExDiskRead(disk->handle, + CHROMEOS_VBNVCONTEXT_LBA, 1, block_buf)) { VBDEBUG(PREFIX "Failed to read internal disk!\n"); VbExFree(block_buf); return 1; @@ -103,7 +101,8 @@ VbError_t VbExNvStorageWrite(const uint8_t* buf) memcpy(block_buf, buf, VBNV_BLOCK_SIZE); - if (VbExDiskWrite(internal_disk->handle, NVCXT_LBA, 1, block_buf)) { + if (VbExDiskWrite(internal_disk->handle, + CHROMEOS_VBNVCONTEXT_LBA, 1, block_buf)) { VBDEBUG(PREFIX "Failed to write internal disk!\n"); VbExFree(block_buf); return 1; diff --git a/lib/vbexport/tlcl_stub.c b/lib/vbexport/tlcl_stub.c new file mode 100644 index 0000000000..3caa22fd76 --- /dev/null +++ b/lib/vbexport/tlcl_stub.c @@ -0,0 +1,63 @@ +/* + * Copyright (c) 2011 The Chromium OS Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + * + * Alternatively, this software may be distributed under the terms of the + * GNU General Public License ("GPL") version 2 as published by the Free + * Software Foundation. + */ + +#include <common.h> +#include <config.h> +#include <tpm.h> + +/* Import the header files from vboot_reference. */ +#include <tss_constants.h> +#include <vboot_api.h> + +VbError_t VbExTpmInit(void) +{ +/* TODO According to FDT, select the real TPM path or just returning success. */ +#ifdef CONFIG_HARDWARE_TPM + if (tis_init()) + return TPM_E_IOERROR; + /* tpm_lite lib doesn't call VbExTpmOpene after VbExTpmInit. */ + return VbExTpmOpen(); +#endif + return TPM_SUCCESS; +} + +VbError_t VbExTpmClose(void) +{ +#ifdef CONFIG_HARDWARE_TPM + if (tis_close()) + return TPM_E_IOERROR; +#endif + return TPM_SUCCESS; +} + +VbError_t VbExTpmOpen(void) +{ +#ifdef CONFIG_HARDWARE_TPM + if (tis_open()) + return TPM_E_IOERROR; +#endif + return TPM_SUCCESS; +} + +VbError_t VbExTpmSendReceive(const uint8_t* request, uint32_t request_length, + uint8_t* response, uint32_t* response_length) +{ +#ifdef CONFIG_HARDWARE_TPM + if (tis_sendrecv(request, request_length, response, response_length)) + return TPM_E_IOERROR; +#else + /* Make a successful response */ + uint8_t successful_response[10] = + {0x0, 0x0, 0x0, 0x0, 0x0, 0xa, 0x0, 0x0, 0x0, 0x0}; + memcpy(response, successful_response, 10); + *response_length = 10; +#endif + return TPM_SUCCESS; +} diff --git a/lib/vbexport/utility.c b/lib/vbexport/utility.c index 8112921a6a..5f3b7057a3 100644 --- a/lib/vbexport/utility.c +++ b/lib/vbexport/utility.c @@ -94,3 +94,13 @@ void VbExBeep(uint32_t msec, uint32_t frequency) VbExSleepMs(msec); VBDEBUG("Beep!\n"); } + +int Memcmp(const void *src1, const void *src2, size_t n) +{ + return memcmp(src1, src2, n); +} + +void *Memcpy(void *dest, const void *src, uint64_t n) +{ + return memcpy(dest, src, (size_t) n); +} |