1/* 2 * rpmb_driver.h 3 * 4 * rpmb driver function, such as ioctl 5 * 6 * Copyright (C) 2022 Huawei Technologies Co., Ltd. 7 * 8 * This software is licensed under the terms of the GNU General Public 9 * License version 2, as published by the Free Software Foundation, and 10 * may be copied, distributed, and modified under those terms. 11 * 12 * This program is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * GNU General Public License for more details. 16 */ 17 18#ifndef __RPMB_DRIVER_H 19#define __RPMB_DRIVER_H 20 21#include <linux/rpmb/rpmb.h> 22 23#ifdef CONFIG_VENDOR_RPMB 24int vendor_rpmb_ioctl_cmd(enum func_id id, enum rpmb_op_type operation, 25 struct storage_blk_ioc_rpmb_data *storage_data); 26 27static inline void tee_report_rpmb(void) 28{ 29 rpmb_dump_io_latency(); 30} 31#else 32static inline int vendor_rpmb_ioctl_cmd(enum func_id id, enum rpmb_op_type operation, 33 struct storage_blk_ioc_rpmb_data *storage_data) 34{ 35 return 0xFF08; 36} 37 38static inline void tee_report_rpmb(void) 39{ 40} 41#endif 42 43#if defined(CONFIG_VENDOR_RPMB) && !defined(CONFIG_RPMB_REQ_LOCK_DISABLE) 44static inline void rpmb_driver_counter_lock(void) 45{ 46 mutex_lock(&rpmb_counter_lock); 47} 48 49static inline void rpmb_driver_counter_unlock(void) 50{ 51 mutex_unlock(&rpmb_counter_lock); 52} 53#else 54static inline void rpmb_driver_counter_lock(void) 55{ 56} 57 58static inline void rpmb_driver_counter_unlock(void) 59{ 60} 61#endif 62 63int rpmb_ioctl_cmd(enum func_id id, enum rpmb_op_type operation, 64 struct storage_blk_ioc_rpmb_data *storage_data); 65#endif