]> Git Repo - u-boot.git/blame - test/dm/tpm.c
global: Move remaining CONFIG_SYS_SDRAM_* to CFG_SYS_SDRAM_*
[u-boot.git] / test / dm / tpm.c
CommitLineData
3bb4db4c
SG
1// SPDX-License-Identifier: GPL-2.0+
2/*
3 * Copyright 2022 Google LLC
4 * Written by Simon Glass <[email protected]>
5 */
6
7#include <common.h>
8#include <dm.h>
9#include <tpm_api.h>
10#include <dm/test.h>
11#include <test/test.h>
12#include <test/ut.h>
13
14/* Basic test of the TPM uclass */
15static int dm_test_tpm(struct unit_test_state *uts)
16{
17 struct udevice *dev;
18 char buf[50];
19
20 /* check probe success */
21 ut_assertok(uclass_first_device_err(UCLASS_TPM, &dev));
22 ut_assert(tpm_is_v2(dev));
23
24 ut_assert(tpm_report_state(dev, buf, sizeof(buf)));
25 ut_asserteq_str("init_done=0", buf);
26
27 ut_assertok(tpm_init(dev));
28
29 ut_assert(tpm_report_state(dev, buf, sizeof(buf)));
30 ut_asserteq_str("init_done=1", buf);
31
32 return 0;
33}
34DM_TEST(dm_test_tpm, UT_TESTF_SCAN_FDT);
This page took 0.03229 seconds and 4 git commands to generate.