mirror of https://github.com/wolfSSL/wolfBoot.git
Fixes to get TPM working with T1024 and MMU enabled.
parent
3e8d6fb061
commit
389e12faf1
|
@ -61,7 +61,7 @@ static int test_tpm(void);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef ENABLE_ESPI
|
#ifdef ENABLE_ESPI
|
||||||
#include "spi_drv.h" /* for transfer flags */
|
#include "spi_drv.h" /* for transfer flags and chip select */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* P1021 Platform */
|
/* P1021 Platform */
|
||||||
|
@ -1936,9 +1936,6 @@ static int test_flash(void)
|
||||||
#endif /* ENABLE_ELBC && TEST_FLASH */
|
#endif /* ENABLE_ELBC && TEST_FLASH */
|
||||||
|
|
||||||
#if defined(ENABLE_ESPI) && defined(TEST_TPM)
|
#if defined(ENABLE_ESPI) && defined(TEST_TPM)
|
||||||
#ifndef SPI_CS_TPM
|
|
||||||
#define SPI_CS_TPM 2
|
|
||||||
#endif
|
|
||||||
int test_tpm(void)
|
int test_tpm(void)
|
||||||
{
|
{
|
||||||
/* Read 4 bytes at TIS address D40F00. Assumes 0 wait state on TPM */
|
/* Read 4 bytes at TIS address D40F00. Assumes 0 wait state on TPM */
|
||||||
|
|
|
@ -37,6 +37,13 @@
|
||||||
#define ENABLE_BUS_CLK_CALC
|
#define ENABLE_BUS_CLK_CALC
|
||||||
#define ENABLE_IFC
|
#define ENABLE_IFC
|
||||||
#ifndef BUILD_LOADER_STAGE1
|
#ifndef BUILD_LOADER_STAGE1
|
||||||
|
/* Tests */
|
||||||
|
#if 0
|
||||||
|
#define TEST_DDR
|
||||||
|
#define TEST_FLASH
|
||||||
|
#define TEST_TPM
|
||||||
|
#endif
|
||||||
|
|
||||||
//#define ENABLE_CPLD
|
//#define ENABLE_CPLD
|
||||||
#define ENABLE_QE /* QUICC Engine */
|
#define ENABLE_QE /* QUICC Engine */
|
||||||
//#define ENABLE_FMAN
|
//#define ENABLE_FMAN
|
||||||
|
@ -44,13 +51,6 @@
|
||||||
#if defined(WOLFBOOT_TPM) || defined(TEST_TPM)
|
#if defined(WOLFBOOT_TPM) || defined(TEST_TPM)
|
||||||
#define ENABLE_ESPI /* SPI for TPM */
|
#define ENABLE_ESPI /* SPI for TPM */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Tests */
|
|
||||||
#if 1
|
|
||||||
//#define TEST_DDR
|
|
||||||
//#define TEST_FLASH
|
|
||||||
//#define TEST_TPM
|
|
||||||
#endif
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define USE_ERRATA_DDRA008378
|
#define USE_ERRATA_DDRA008378
|
||||||
|
@ -72,7 +72,7 @@ static int test_tpm(void);
|
||||||
static void hal_flash_unlock_sector(uint32_t sector);
|
static void hal_flash_unlock_sector(uint32_t sector);
|
||||||
|
|
||||||
#ifdef ENABLE_ESPI
|
#ifdef ENABLE_ESPI
|
||||||
#include "spi_drv.h" /* for transfer flags */
|
#include "spi_drv.h" /* for transfer flags and chip select */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* T1024 */
|
/* T1024 */
|
||||||
|
@ -1697,9 +1697,6 @@ static int test_flash(void)
|
||||||
#endif /* ENABLE_IFC && TEST_FLASH */
|
#endif /* ENABLE_IFC && TEST_FLASH */
|
||||||
|
|
||||||
#if defined(ENABLE_ESPI) && defined(TEST_TPM)
|
#if defined(ENABLE_ESPI) && defined(TEST_TPM)
|
||||||
#ifndef SPI_CS_TPM
|
|
||||||
#define SPI_CS_TPM 2
|
|
||||||
#endif
|
|
||||||
int test_tpm(void)
|
int test_tpm(void)
|
||||||
{
|
{
|
||||||
/* Read 4 bytes at TIS address D40F00. Assumes 0 wait state on TPM */
|
/* Read 4 bytes at TIS address D40F00. Assumes 0 wait state on TPM */
|
||||||
|
|
|
@ -29,12 +29,10 @@
|
||||||
|
|
||||||
#ifdef WOLFBOOT_TPM
|
#ifdef WOLFBOOT_TPM
|
||||||
|
|
||||||
#if defined(PLATFORM_nxp_p1021)
|
/* functions from nxp_p1021.c and nxp_t1024.c hal */
|
||||||
/* functions from nxp_p1021.c hal */
|
|
||||||
extern void hal_espi_init(uint32_t cs, uint32_t clock_hz, uint32_t mode);
|
extern void hal_espi_init(uint32_t cs, uint32_t clock_hz, uint32_t mode);
|
||||||
extern int hal_espi_xfer(int cs, const uint8_t* tx, uint8_t* rx, uint32_t sz, int flags);
|
extern int hal_espi_xfer(int cs, const uint8_t* tx, uint8_t* rx, uint32_t sz, int flags);
|
||||||
extern void hal_espi_deinit(void);
|
extern void hal_espi_deinit(void);
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <wolftpm/tpm2_types.h>
|
#include <wolftpm/tpm2_types.h>
|
||||||
|
|
||||||
|
|
|
@ -20,13 +20,13 @@
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
#if defined(PLATFORM_nxp_p1021)
|
/* Chip select for TPM - defaults */
|
||||||
|
|
||||||
/* Chip select for TPM */
|
|
||||||
#ifndef SPI_CS_TPM
|
#ifndef SPI_CS_TPM
|
||||||
#define SPI_CS_TPM 2
|
#if defined(PLATFORM_nxp_p1021)
|
||||||
#endif
|
#define SPI_CS_TPM 2
|
||||||
|
#elif defined(PLATFORM_nxp_t1024)
|
||||||
|
#define SPI_CS_TPM 1
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif /* !SPI_DRV_NXP_H_INCLUDED */
|
#endif /* !SPI_DRV_NXP_H_INCLUDED */
|
||||||
|
|
|
@ -54,7 +54,7 @@
|
||||||
#include "hal/spi/spi_drv_nrf52.h"
|
#include "hal/spi/spi_drv_nrf52.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(PLATFORM_nxp_p1021)
|
#if defined(PLATFORM_nxp_p1021) || defined(PLATFORM_nxp_t1024)
|
||||||
#include "hal/spi/spi_drv_nxp.h"
|
#include "hal/spi/spi_drv_nxp.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -819,9 +819,10 @@ int wolfBoot_open_image_address(struct wolfBoot_image *img, uint8_t *image)
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef MMU
|
#ifdef MMU
|
||||||
/* Inline use of ByteReverseWord32 */
|
#ifndef WOLFBOOT_TPM /* tpm2_types.h has ByteReverseWord32 */
|
||||||
#define WOLFSSL_MISC_INCLUDED
|
#define WOLFSSL_MISC_INCLUDED /* allow misc.c code to be inlined */
|
||||||
#include <wolfcrypt/src/misc.c>
|
#include <wolfcrypt/src/misc.c> /* for ByteReverseWord32 */
|
||||||
|
#endif /* !WOLFBOOT_TPM */
|
||||||
static uint32_t wb_reverse_word32(uint32_t x)
|
static uint32_t wb_reverse_word32(uint32_t x)
|
||||||
{
|
{
|
||||||
return ByteReverseWord32(x);
|
return ByteReverseWord32(x);
|
||||||
|
|
|
@ -119,9 +119,8 @@ static uint32_t ext_cache;
|
||||||
|
|
||||||
|
|
||||||
#if defined(__WOLFBOOT) || defined (UNIT_TEST)
|
#if defined(__WOLFBOOT) || defined (UNIT_TEST)
|
||||||
/* Inline use of ByteReverseWord32 */
|
#define WOLFSSL_MISC_INCLUDED /* allow misc.c code to be inlined */
|
||||||
#define WOLFSSL_MISC_INCLUDED
|
#include <wolfcrypt/src/misc.c> /* for ByteReverseWord32 */
|
||||||
#include <wolfcrypt/src/misc.c>
|
|
||||||
static uint32_t wb_reverse_word32(uint32_t x)
|
static uint32_t wb_reverse_word32(uint32_t x)
|
||||||
{
|
{
|
||||||
return ByteReverseWord32(x);
|
return ByteReverseWord32(x);
|
||||||
|
|
|
@ -125,7 +125,7 @@ int main(void)
|
||||||
#ifdef PRINTF_ENABLED
|
#ifdef PRINTF_ENABLED
|
||||||
wolfBoot_printf("Jumping to full wolfBoot at %p\n", wolfboot_start);
|
wolfBoot_printf("Jumping to full wolfBoot at %p\n", wolfboot_start);
|
||||||
#elif defined(DEBUG_UART)
|
#elif defined(DEBUG_UART)
|
||||||
uart_write("Jumping to full wolfBoot\n", 27);
|
uart_write("Jumping to full wolfBoot\n", 25);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
hal_prepare_boot();
|
hal_prepare_boot();
|
||||||
|
|
Loading…
Reference in New Issue