Files
android/drivers/misc/mediatek/teei/400/tz_driver/tz_log.h
T
threeeye bc1d038eac REVVL 6 Pro kernel bring-up: full working tree snapshot (2026-09-12)
Squashed backup commit (no shallow-clone history issues) of
xiaomi-mt6833-dev/kernel_xiaomi_mt6833 (lineage-23.2 branch, upstream
commit 9eece662e) plus all fixes applied to get everpal_defconfig building
clean against a modern (GCC 15.2.0) toolchain -- see the previous commit
message on the lineage-23.2 branch (also in this repo history is not
available here since this is a squashed snapshot; full incremental history
lives in the local DL380 checkout and the upstream GitHub remote).

Upstream: https://github.com/xiaomi-mt6833-dev/kernel_xiaomi_mt6833 (lineage-23.2)
2026-09-12 13:36:46 +00:00

77 lines
1.9 KiB
C

/*
* Copyright (c) 2015-2019, MICROTRUST Incorporated
* Copyright (C) 2015 Google, Inc.
*
* This software is licensed under the terms of the GNU General Public
* License version 2, as published by the Free Software Foundation, and
* may be copied, distributed, and modified under those terms.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*/
#ifndef _TRUSTY_LOG_H_
#define _TRUSTY_LOG_H_
#include <imsg_log.h>
#define TZ_LOG_SIZE (PAGE_SIZE * 64)
#define TZ_LINE_BUFFER_SIZE 256
#define TZ_LOG_RATELIMIT_INTERVAL (1 * HZ)
#define TZ_LOG_RATELIMIT_BURST 200
/*
* Ring buffer that supports one secure producer thread and one
* linux side consumer thread.
*/
struct log_rb {
TZ_VOLATILE(uint32_t alloc);
TZ_VOLATILE(uint32_t put);
TZ_NON_VOLATILE(uint32_t sz);
TZ_VOLATILE(char data[0]);
} __packed;
struct boot_log_rb {
uint32_t get;
uint32_t put;
uint32_t sz;
char data[0];
} __packed;
struct tz_log_state {
struct device *dev;
/*
* This lock is here to ensure only one consumer will read
* from the log ring buffer at a time.
*/
spinlock_t lock;
struct log_rb *log;
struct boot_log_rb *boot_log;
uint32_t get;
uint32_t read_get;
struct page *log_pages;
struct page *boot_log_pages;
struct notifier_block call_notifier;
struct notifier_block panic_notifier;
char line_buffer[TZ_LINE_BUFFER_SIZE];
};
int tz_log_probe(struct platform_device *pdev);
int tz_log_remove(struct platform_device *pdev);
int tz_driver_read_logs(char *buffer, unsigned long count);
#ifdef CONFIG_MICROTRUST_TZ_LOG
int teei_log_fn(void *work);
int init_tlog_comp_fn(void);
void teei_notify_log_fn(void);
#endif
int teei_change_log_status(unsigned long new_status);
#endif