linux/drivers/soc/qcom/ice.c

// SPDX-License-Identifier: GPL-2.0
/*
 * Qualcomm ICE (Inline Crypto Engine) support.
 *
 * Copyright (c) 2013-2019, The Linux Foundation. All rights reserved.
 * Copyright (c) 2019, Google LLC
 * Copyright (c) 2023, Linaro Limited
 */

#include <linux/bitfield.h>
#include <linux/clk.h>
#include <linux/delay.h>
#include <linux/iopoll.h>
#include <linux/of.h>
#include <linux/of_platform.h>
#include <linux/platform_device.h>

#include <linux/firmware/qcom/qcom_scm.h>

#include <soc/qcom/ice.h>

#define AES_256_XTS_KEY_SIZE

/* QCOM ICE registers */
#define QCOM_ICE_REG_VERSION
#define QCOM_ICE_REG_FUSE_SETTING
#define QCOM_ICE_REG_BIST_STATUS
#define QCOM_ICE_REG_ADVANCED_CONTROL

/* BIST ("built-in self-test") status flags */
#define QCOM_ICE_BIST_STATUS_MASK

#define QCOM_ICE_FUSE_SETTING_MASK
#define QCOM_ICE_FORCE_HW_KEY0_SETTING_MASK
#define QCOM_ICE_FORCE_HW_KEY1_SETTING_MASK

#define qcom_ice_writel(engine, val, reg)

#define qcom_ice_readl(engine, reg)

struct qcom_ice {};

static bool qcom_ice_check_supported(struct qcom_ice *ice)
{}

static void qcom_ice_low_power_mode_enable(struct qcom_ice *ice)
{}

static void qcom_ice_optimization_enable(struct qcom_ice *ice)
{}

/*
 * Wait until the ICE BIST (built-in self-test) has completed.
 *
 * This may be necessary before ICE can be used.
 * Note that we don't really care whether the BIST passed or failed;
 * we really just want to make sure that it isn't still running. This is
 * because (a) the BIST is a FIPS compliance thing that never fails in
 * practice, (b) ICE is documented to reject crypto requests if the BIST
 * fails, so we needn't do it in software too, and (c) properly testing
 * storage encryption requires testing the full storage stack anyway,
 * and not relying on hardware-level self-tests.
 */
static int qcom_ice_wait_bist_status(struct qcom_ice *ice)
{}

int qcom_ice_enable(struct qcom_ice *ice)
{}
EXPORT_SYMBOL_GPL();

int qcom_ice_resume(struct qcom_ice *ice)
{}
EXPORT_SYMBOL_GPL();

int qcom_ice_suspend(struct qcom_ice *ice)
{}
EXPORT_SYMBOL_GPL();

int qcom_ice_program_key(struct qcom_ice *ice,
			 u8 algorithm_id, u8 key_size,
			 const u8 crypto_key[], u8 data_unit_size,
			 int slot)
{}
EXPORT_SYMBOL_GPL();

int qcom_ice_evict_key(struct qcom_ice *ice, int slot)
{}
EXPORT_SYMBOL_GPL();

static struct qcom_ice *qcom_ice_create(struct device *dev,
					void __iomem *base)
{}

/**
 * of_qcom_ice_get() - get an ICE instance from a DT node
 * @dev: device pointer for the consumer device
 *
 * This function will provide an ICE instance either by creating one for the
 * consumer device if its DT node provides the 'ice' reg range and the 'ice'
 * clock (for legacy DT style). On the other hand, if consumer provides a
 * phandle via 'qcom,ice' property to an ICE DT, the ICE instance will already
 * be created and so this function will return that instead.
 *
 * Return: ICE pointer on success, NULL if there is no ICE data provided by the
 * consumer or ERR_PTR() on error.
 */
struct qcom_ice *of_qcom_ice_get(struct device *dev)
{}
EXPORT_SYMBOL_GPL();

static int qcom_ice_probe(struct platform_device *pdev)
{}

static const struct of_device_id qcom_ice_of_match_table[] =;
MODULE_DEVICE_TABLE(of, qcom_ice_of_match_table);

static struct platform_driver qcom_ice_driver =;

module_platform_driver();

MODULE_DESCRIPTION();
MODULE_LICENSE();