master
h 34 lines 1004 Bytes
Raw
1 /*
2 * SPDX-License-Identifier: GPL-2.0-or-later
3 *
4 * QTest TPM TIS I2C: Common test functions used for TPM I2C on Aspeed bus
5 *
6 * Copyright (c) 2026 IBM Corporation
7 *
8 * Authors:
9 * Stefan Berger <stefanb@linux.ibm.com>
10 *
11 */
12
13 #ifndef TESTS_TPM_TIS_I2C_UTIL_H
14 #define TESTS_TPM_TIS_I2C_UTIL_H
15
16 #include "qemu/osdep.h"
17
18 extern uint32_t aspeed_bus_addr;
19
20 #define I2C_SLAVE_ADDR 0x2e
21 #define I2C_DEV_BUS_NUM 10
22
23 uint8_t tpm_tis_i2c_readb(QTestState *s, uint8_t locty, uint8_t reg);
24 uint16_t tpm_tis_i2c_readw(QTestState *s, uint8_t locty, uint8_t reg);
25 uint32_t tpm_tis_i2c_readl(QTestState *s, uint8_t locty, uint8_t reg);
26
27 void tpm_tis_i2c_writeb(QTestState *s, uint8_t locty, uint8_t reg, uint8_t v);
28 void tpm_tis_i2c_writel(QTestState *s, uint8_t locty, uint8_t reg, uint32_t v);
29
30 void tpm_tis_i2c_transfer(QTestState *s,
31 const unsigned char *req, size_t req_size,
32 unsigned char *rsp, size_t rsp_size);
33
34 #endif /* TESTS_TPM_TIS_I2C_UTIL_H */