/* SPDX-License-Identifier: GPL-2.0-only */
/*
 * GXP firmware data manager.
 * A sub-module responsible for managing the resources/data regions shared
 * between the GXP driver and FW.
 *
 * Copyright (C) 2021 Google LLC
 */
#ifndef __GXP_FIRMWARE_DATA_H__
#define __GXP_FIRMWARE_DATA_H__

#include <linux/sizes.h>

#include "gxp-dma.h"
#include "gxp-internal.h"
#include "gxp-vd.h"

#define GXP_FW_DATA_SYSCFG_SIZE SZ_8K

enum gxp_fw_data_protocol {
	/* Use the per-VD configuration region. */
	FW_DATA_PROTOCOL_PER_VD_CONFIG = 2,
};

/**
 * gxp_fw_data_init() - Initializes the FW data manager submodule.
 * @gxp: The parent GXP device
 *
 * Return:
 * 0       - Successfully initialized submodule
 * -ENOMEM - Insufficient memory to create the submodule
 * -ENODEV - Failed to locate the shared driver-device region
 * -Other  - Error codes propagated from internal functions.
 */
int gxp_fw_data_init(struct gxp_dev *gxp);

/**
 * gxp_fw_data_destroy() - Destroys the FW data manager submodule and free all
 *                         its resources.
 * @gxp: The parent GXP device
 */
void gxp_fw_data_destroy(struct gxp_dev *gxp);

/**
 * gxp_fw_data_populate_vd_cfg() - Sets up the resources to VD's per-core config
 *                                 regions and per-VD config regions.
 * @gxp: The parent GXP device
 * @vd: The virtual device to be populated for
 */
void gxp_fw_data_populate_vd_cfg(struct gxp_dev *gxp,
				 struct gxp_virtual_device *vd);

/**
 * gxp_fw_data_set_core_telemetry_descriptors() - Set new logging or tracing
 *                                                buffers for firmware to write
 *                                                to.
 * @gxp: The GXP device to set buffer descriptors for
 * @host_status:  Bitfield describing the host's core telemetry status. See the
 *                bit definitions in gxp-host-device-structs.h.
 * @buffers: An array of coherent buffers for logging and tracing
 * @per_buffer_size: The size of each core's logging or tracing buffer in bytes
 *
 * `gxp_fw_data_init()` must have been called before this function.
 *
 * Caller must hold gxp->core_telemetry_mgr's lock.
 *
 * Return:
 * 0       - Success
 * -EINVAL - @buffer_addrs are not addressable by @gxp
 */
int gxp_fw_data_set_core_telemetry_descriptors(struct gxp_dev *gxp, u32 host_status,
					       struct gxp_coherent_buf *buffers,
					       u32 per_buffer_size);

/**
 * gxp_fw_data_get_core_telemetry_device_status() - Returns a bitfield
 *                                                  describing a core's
 *                                                  telemetry status.
 * @gxp: The GXP device to get core telemetry status for
 * @core: The core in @gxp to get the core telemetry status for
 *
 * Caller must hold gxp->core_telemetry_mgr's lock.
 *
 * Return: The bitfield describing @core's telemetry status. If @core is invalid, returns 0.
 */
u32 gxp_fw_data_get_core_telemetry_device_status(struct gxp_dev *gxp, uint core);

/**
 * gxp_fw_data_resource() - Returns the resource of data region for host<->core
 *		            communication.
 * @gxp: The GXP device
 *
 * This function requires either @gxp->fwdatabuf or @gxp->shared_buf be
 * initialized, so it couldn't be called during device probe time.
 *
 * Return: The resource.
 */
struct gxp_mapped_resource gxp_fw_data_resource(struct gxp_dev *gxp);

/**
 * gxp_fw_data_system_cfg() - Returns the pointer to the system config region.
 * @gxp: The GXP device
 *
 * This function requires either @gxp->fwdatabuf or @gxp->shared_buf be
 * initialized, so it couldn't be called during device probe time.
 *
 * Return: The pointer. This function never fails.
 */
void *gxp_fw_data_system_cfg(struct gxp_dev *gxp);

/**
 * gxp_fw_data_populate_system_config() - Populate settings onto firmware system
 *                                        config region.
 * @gxp: The GXP device
 *
 * This function is expected to be called after "after_probe" in the probe
 * procedure since it uses gxp_fw_data_system_cfg().
 */
void gxp_fw_data_populate_system_config(struct gxp_dev *gxp);

#endif /* __GXP_FIRMWARE_DATA_H__ */
