18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * Intel(R) Trace Hub data structures
48c2ecf20Sopenharmony_ci *
58c2ecf20Sopenharmony_ci * Copyright (C) 2014-2015 Intel Corporation.
68c2ecf20Sopenharmony_ci */
78c2ecf20Sopenharmony_ci
88c2ecf20Sopenharmony_ci#ifndef __INTEL_TH_H__
98c2ecf20Sopenharmony_ci#define __INTEL_TH_H__
108c2ecf20Sopenharmony_ci
118c2ecf20Sopenharmony_ci#include <linux/irqreturn.h>
128c2ecf20Sopenharmony_ci
138c2ecf20Sopenharmony_ci/* intel_th_device device types */
148c2ecf20Sopenharmony_cienum {
158c2ecf20Sopenharmony_ci	/* Devices that generate trace data */
168c2ecf20Sopenharmony_ci	INTEL_TH_SOURCE = 0,
178c2ecf20Sopenharmony_ci	/* Output ports (MSC, PTI) */
188c2ecf20Sopenharmony_ci	INTEL_TH_OUTPUT,
198c2ecf20Sopenharmony_ci	/* Switch, the Global Trace Hub (GTH) */
208c2ecf20Sopenharmony_ci	INTEL_TH_SWITCH,
218c2ecf20Sopenharmony_ci};
228c2ecf20Sopenharmony_ci
238c2ecf20Sopenharmony_cistruct intel_th_device;
248c2ecf20Sopenharmony_ci
258c2ecf20Sopenharmony_ci/**
268c2ecf20Sopenharmony_ci * struct intel_th_output - descriptor INTEL_TH_OUTPUT type devices
278c2ecf20Sopenharmony_ci * @port:	output port number, assigned by the switch
288c2ecf20Sopenharmony_ci * @type:	GTH_{MSU,CTP,PTI}
298c2ecf20Sopenharmony_ci * @scratchpad:	scratchpad bits to flag when this output is enabled
308c2ecf20Sopenharmony_ci * @multiblock:	true for multiblock output configuration
318c2ecf20Sopenharmony_ci * @active:	true when this output is enabled
328c2ecf20Sopenharmony_ci * @wait_empty:	wait for device pipeline to be empty
338c2ecf20Sopenharmony_ci *
348c2ecf20Sopenharmony_ci * Output port descriptor, used by switch driver to tell which output
358c2ecf20Sopenharmony_ci * port this output device corresponds to. Filled in at output device's
368c2ecf20Sopenharmony_ci * probe time by switch::assign(). Passed from output device driver to
378c2ecf20Sopenharmony_ci * switch related code to enable/disable its port.
388c2ecf20Sopenharmony_ci */
398c2ecf20Sopenharmony_cistruct intel_th_output {
408c2ecf20Sopenharmony_ci	int		port;
418c2ecf20Sopenharmony_ci	unsigned int	type;
428c2ecf20Sopenharmony_ci	unsigned int	scratchpad;
438c2ecf20Sopenharmony_ci	bool		multiblock;
448c2ecf20Sopenharmony_ci	bool		active;
458c2ecf20Sopenharmony_ci};
468c2ecf20Sopenharmony_ci
478c2ecf20Sopenharmony_ci/**
488c2ecf20Sopenharmony_ci * struct intel_th_drvdata - describes hardware capabilities and quirks
498c2ecf20Sopenharmony_ci * @tscu_enable:	device needs SW to enable time stamping unit
508c2ecf20Sopenharmony_ci * @multi_is_broken:	device has multiblock mode is broken
518c2ecf20Sopenharmony_ci * @has_mintctl:	device has interrupt control (MINTCTL) register
528c2ecf20Sopenharmony_ci * @host_mode_only:	device can only operate in 'host debugger' mode
538c2ecf20Sopenharmony_ci */
548c2ecf20Sopenharmony_cistruct intel_th_drvdata {
558c2ecf20Sopenharmony_ci	unsigned int	tscu_enable        : 1,
568c2ecf20Sopenharmony_ci			multi_is_broken    : 1,
578c2ecf20Sopenharmony_ci			has_mintctl        : 1,
588c2ecf20Sopenharmony_ci			host_mode_only     : 1;
598c2ecf20Sopenharmony_ci};
608c2ecf20Sopenharmony_ci
618c2ecf20Sopenharmony_ci#define INTEL_TH_CAP(_th, _cap) ((_th)->drvdata ? (_th)->drvdata->_cap : 0)
628c2ecf20Sopenharmony_ci
638c2ecf20Sopenharmony_ci/**
648c2ecf20Sopenharmony_ci * struct intel_th_device - device on the intel_th bus
658c2ecf20Sopenharmony_ci * @dev:		device
668c2ecf20Sopenharmony_ci * @drvdata:		hardware capabilities/quirks
678c2ecf20Sopenharmony_ci * @resource:		array of resources available to this device
688c2ecf20Sopenharmony_ci * @num_resources:	number of resources in @resource array
698c2ecf20Sopenharmony_ci * @type:		INTEL_TH_{SOURCE,OUTPUT,SWITCH}
708c2ecf20Sopenharmony_ci * @id:			device instance or -1
718c2ecf20Sopenharmony_ci * @host_mode:		Intel TH is controlled by an external debug host
728c2ecf20Sopenharmony_ci * @output:		output descriptor for INTEL_TH_OUTPUT devices
738c2ecf20Sopenharmony_ci * @name:		device name to match the driver
748c2ecf20Sopenharmony_ci */
758c2ecf20Sopenharmony_cistruct intel_th_device {
768c2ecf20Sopenharmony_ci	struct device		dev;
778c2ecf20Sopenharmony_ci	struct intel_th_drvdata *drvdata;
788c2ecf20Sopenharmony_ci	struct resource		*resource;
798c2ecf20Sopenharmony_ci	unsigned int		num_resources;
808c2ecf20Sopenharmony_ci	unsigned int		type;
818c2ecf20Sopenharmony_ci	int			id;
828c2ecf20Sopenharmony_ci
838c2ecf20Sopenharmony_ci	/* INTEL_TH_SWITCH specific */
848c2ecf20Sopenharmony_ci	bool			host_mode;
858c2ecf20Sopenharmony_ci
868c2ecf20Sopenharmony_ci	/* INTEL_TH_OUTPUT specific */
878c2ecf20Sopenharmony_ci	struct intel_th_output	output;
888c2ecf20Sopenharmony_ci
898c2ecf20Sopenharmony_ci	char		name[];
908c2ecf20Sopenharmony_ci};
918c2ecf20Sopenharmony_ci
928c2ecf20Sopenharmony_ci#define to_intel_th_device(_d)				\
938c2ecf20Sopenharmony_ci	container_of((_d), struct intel_th_device, dev)
948c2ecf20Sopenharmony_ci
958c2ecf20Sopenharmony_ci/**
968c2ecf20Sopenharmony_ci * intel_th_device_get_resource() - obtain @num'th resource of type @type
978c2ecf20Sopenharmony_ci * @thdev:	the device to search the resource for
988c2ecf20Sopenharmony_ci * @type:	resource type
998c2ecf20Sopenharmony_ci * @num:	number of the resource
1008c2ecf20Sopenharmony_ci */
1018c2ecf20Sopenharmony_cistatic inline struct resource *
1028c2ecf20Sopenharmony_ciintel_th_device_get_resource(struct intel_th_device *thdev, unsigned int type,
1038c2ecf20Sopenharmony_ci			     unsigned int num)
1048c2ecf20Sopenharmony_ci{
1058c2ecf20Sopenharmony_ci	int i;
1068c2ecf20Sopenharmony_ci
1078c2ecf20Sopenharmony_ci	for (i = 0; i < thdev->num_resources; i++)
1088c2ecf20Sopenharmony_ci		if (resource_type(&thdev->resource[i]) == type && !num--)
1098c2ecf20Sopenharmony_ci			return &thdev->resource[i];
1108c2ecf20Sopenharmony_ci
1118c2ecf20Sopenharmony_ci	return NULL;
1128c2ecf20Sopenharmony_ci}
1138c2ecf20Sopenharmony_ci
1148c2ecf20Sopenharmony_ci/*
1158c2ecf20Sopenharmony_ci * GTH, output ports configuration
1168c2ecf20Sopenharmony_ci */
1178c2ecf20Sopenharmony_cienum {
1188c2ecf20Sopenharmony_ci	GTH_NONE = 0,
1198c2ecf20Sopenharmony_ci	GTH_MSU,	/* memory/usb */
1208c2ecf20Sopenharmony_ci	GTH_CTP,	/* Common Trace Port */
1218c2ecf20Sopenharmony_ci	GTH_LPP,	/* Low Power Path */
1228c2ecf20Sopenharmony_ci	GTH_PTI,	/* MIPI-PTI */
1238c2ecf20Sopenharmony_ci};
1248c2ecf20Sopenharmony_ci
1258c2ecf20Sopenharmony_ci/**
1268c2ecf20Sopenharmony_ci * intel_th_output_assigned() - if an output device is assigned to a switch port
1278c2ecf20Sopenharmony_ci * @thdev:	the output device
1288c2ecf20Sopenharmony_ci *
1298c2ecf20Sopenharmony_ci * Return:	true if the device is INTEL_TH_OUTPUT *and* is assigned a port
1308c2ecf20Sopenharmony_ci */
1318c2ecf20Sopenharmony_cistatic inline bool
1328c2ecf20Sopenharmony_ciintel_th_output_assigned(struct intel_th_device *thdev)
1338c2ecf20Sopenharmony_ci{
1348c2ecf20Sopenharmony_ci	return thdev->type == INTEL_TH_OUTPUT &&
1358c2ecf20Sopenharmony_ci		(thdev->output.port >= 0 ||
1368c2ecf20Sopenharmony_ci		 thdev->output.type == GTH_NONE);
1378c2ecf20Sopenharmony_ci}
1388c2ecf20Sopenharmony_ci
1398c2ecf20Sopenharmony_ci/**
1408c2ecf20Sopenharmony_ci * struct intel_th_driver - driver for an intel_th_device device
1418c2ecf20Sopenharmony_ci * @driver:	generic driver
1428c2ecf20Sopenharmony_ci * @probe:	probe method
1438c2ecf20Sopenharmony_ci * @remove:	remove method
1448c2ecf20Sopenharmony_ci * @assign:	match a given output type device against available outputs
1458c2ecf20Sopenharmony_ci * @unassign:	deassociate an output type device from an output port
1468c2ecf20Sopenharmony_ci * @prepare:	prepare output port for tracing
1478c2ecf20Sopenharmony_ci * @enable:	enable tracing for a given output device
1488c2ecf20Sopenharmony_ci * @disable:	disable tracing for a given output device
1498c2ecf20Sopenharmony_ci * @irq:	interrupt callback
1508c2ecf20Sopenharmony_ci * @activate:	enable tracing on the output's side
1518c2ecf20Sopenharmony_ci * @deactivate:	disable tracing on the output's side
1528c2ecf20Sopenharmony_ci * @fops:	file operations for device nodes
1538c2ecf20Sopenharmony_ci * @attr_group:	attributes provided by the driver
1548c2ecf20Sopenharmony_ci *
1558c2ecf20Sopenharmony_ci * Callbacks @probe and @remove are required for all device types.
1568c2ecf20Sopenharmony_ci * Switch device driver needs to fill in @assign, @enable and @disable
1578c2ecf20Sopenharmony_ci * callbacks.
1588c2ecf20Sopenharmony_ci */
1598c2ecf20Sopenharmony_cistruct intel_th_driver {
1608c2ecf20Sopenharmony_ci	struct device_driver	driver;
1618c2ecf20Sopenharmony_ci	int			(*probe)(struct intel_th_device *thdev);
1628c2ecf20Sopenharmony_ci	void			(*remove)(struct intel_th_device *thdev);
1638c2ecf20Sopenharmony_ci	/* switch (GTH) ops */
1648c2ecf20Sopenharmony_ci	int			(*assign)(struct intel_th_device *thdev,
1658c2ecf20Sopenharmony_ci					  struct intel_th_device *othdev);
1668c2ecf20Sopenharmony_ci	void			(*unassign)(struct intel_th_device *thdev,
1678c2ecf20Sopenharmony_ci					    struct intel_th_device *othdev);
1688c2ecf20Sopenharmony_ci	void			(*prepare)(struct intel_th_device *thdev,
1698c2ecf20Sopenharmony_ci					   struct intel_th_output *output);
1708c2ecf20Sopenharmony_ci	void			(*enable)(struct intel_th_device *thdev,
1718c2ecf20Sopenharmony_ci					  struct intel_th_output *output);
1728c2ecf20Sopenharmony_ci	void			(*trig_switch)(struct intel_th_device *thdev,
1738c2ecf20Sopenharmony_ci					       struct intel_th_output *output);
1748c2ecf20Sopenharmony_ci	void			(*disable)(struct intel_th_device *thdev,
1758c2ecf20Sopenharmony_ci					   struct intel_th_output *output);
1768c2ecf20Sopenharmony_ci	/* output ops */
1778c2ecf20Sopenharmony_ci	irqreturn_t		(*irq)(struct intel_th_device *thdev);
1788c2ecf20Sopenharmony_ci	void			(*wait_empty)(struct intel_th_device *thdev);
1798c2ecf20Sopenharmony_ci	int			(*activate)(struct intel_th_device *thdev);
1808c2ecf20Sopenharmony_ci	void			(*deactivate)(struct intel_th_device *thdev);
1818c2ecf20Sopenharmony_ci	/* file_operations for those who want a device node */
1828c2ecf20Sopenharmony_ci	const struct file_operations *fops;
1838c2ecf20Sopenharmony_ci	/* optional attributes */
1848c2ecf20Sopenharmony_ci	struct attribute_group	*attr_group;
1858c2ecf20Sopenharmony_ci
1868c2ecf20Sopenharmony_ci	/* source ops */
1878c2ecf20Sopenharmony_ci	int			(*set_output)(struct intel_th_device *thdev,
1888c2ecf20Sopenharmony_ci					      unsigned int master);
1898c2ecf20Sopenharmony_ci};
1908c2ecf20Sopenharmony_ci
1918c2ecf20Sopenharmony_ci#define to_intel_th_driver(_d)					\
1928c2ecf20Sopenharmony_ci	container_of((_d), struct intel_th_driver, driver)
1938c2ecf20Sopenharmony_ci
1948c2ecf20Sopenharmony_ci#define to_intel_th_driver_or_null(_d)		\
1958c2ecf20Sopenharmony_ci	((_d) ? to_intel_th_driver(_d) : NULL)
1968c2ecf20Sopenharmony_ci
1978c2ecf20Sopenharmony_ci/*
1988c2ecf20Sopenharmony_ci * Subdevice tree structure is as follows:
1998c2ecf20Sopenharmony_ci * + struct intel_th device (pci; dev_{get,set}_drvdata()
2008c2ecf20Sopenharmony_ci *   + struct intel_th_device INTEL_TH_SWITCH (GTH)
2018c2ecf20Sopenharmony_ci *     + struct intel_th_device INTEL_TH_OUTPUT (MSU, PTI)
2028c2ecf20Sopenharmony_ci *   + struct intel_th_device INTEL_TH_SOURCE (STH)
2038c2ecf20Sopenharmony_ci *
2048c2ecf20Sopenharmony_ci * In other words, INTEL_TH_OUTPUT devices are children of INTEL_TH_SWITCH;
2058c2ecf20Sopenharmony_ci * INTEL_TH_SWITCH and INTEL_TH_SOURCE are children of the intel_th device.
2068c2ecf20Sopenharmony_ci */
2078c2ecf20Sopenharmony_cistatic inline struct intel_th_device *
2088c2ecf20Sopenharmony_cito_intel_th_parent(struct intel_th_device *thdev)
2098c2ecf20Sopenharmony_ci{
2108c2ecf20Sopenharmony_ci	struct device *parent = thdev->dev.parent;
2118c2ecf20Sopenharmony_ci
2128c2ecf20Sopenharmony_ci	if (!parent)
2138c2ecf20Sopenharmony_ci		return NULL;
2148c2ecf20Sopenharmony_ci
2158c2ecf20Sopenharmony_ci	return to_intel_th_device(parent);
2168c2ecf20Sopenharmony_ci}
2178c2ecf20Sopenharmony_ci
2188c2ecf20Sopenharmony_cistatic inline struct intel_th *to_intel_th(struct intel_th_device *thdev)
2198c2ecf20Sopenharmony_ci{
2208c2ecf20Sopenharmony_ci	if (thdev->type == INTEL_TH_OUTPUT)
2218c2ecf20Sopenharmony_ci		thdev = to_intel_th_parent(thdev);
2228c2ecf20Sopenharmony_ci
2238c2ecf20Sopenharmony_ci	if (WARN_ON_ONCE(!thdev || thdev->type == INTEL_TH_OUTPUT))
2248c2ecf20Sopenharmony_ci		return NULL;
2258c2ecf20Sopenharmony_ci
2268c2ecf20Sopenharmony_ci	return dev_get_drvdata(thdev->dev.parent);
2278c2ecf20Sopenharmony_ci}
2288c2ecf20Sopenharmony_ci
2298c2ecf20Sopenharmony_cistruct intel_th *
2308c2ecf20Sopenharmony_ciintel_th_alloc(struct device *dev, struct intel_th_drvdata *drvdata,
2318c2ecf20Sopenharmony_ci	       struct resource *devres, unsigned int ndevres);
2328c2ecf20Sopenharmony_civoid intel_th_free(struct intel_th *th);
2338c2ecf20Sopenharmony_ci
2348c2ecf20Sopenharmony_ciint intel_th_driver_register(struct intel_th_driver *thdrv);
2358c2ecf20Sopenharmony_civoid intel_th_driver_unregister(struct intel_th_driver *thdrv);
2368c2ecf20Sopenharmony_ci
2378c2ecf20Sopenharmony_ciint intel_th_trace_enable(struct intel_th_device *thdev);
2388c2ecf20Sopenharmony_ciint intel_th_trace_switch(struct intel_th_device *thdev);
2398c2ecf20Sopenharmony_ciint intel_th_trace_disable(struct intel_th_device *thdev);
2408c2ecf20Sopenharmony_ciint intel_th_set_output(struct intel_th_device *thdev,
2418c2ecf20Sopenharmony_ci			unsigned int master);
2428c2ecf20Sopenharmony_ciint intel_th_output_enable(struct intel_th *th, unsigned int otype);
2438c2ecf20Sopenharmony_ci
2448c2ecf20Sopenharmony_cienum th_mmio_idx {
2458c2ecf20Sopenharmony_ci	TH_MMIO_CONFIG = 0,
2468c2ecf20Sopenharmony_ci	TH_MMIO_SW = 1,
2478c2ecf20Sopenharmony_ci	TH_MMIO_RTIT = 2,
2488c2ecf20Sopenharmony_ci	TH_MMIO_END,
2498c2ecf20Sopenharmony_ci};
2508c2ecf20Sopenharmony_ci
2518c2ecf20Sopenharmony_ci#define TH_POSSIBLE_OUTPUTS	8
2528c2ecf20Sopenharmony_ci/* Total number of possible subdevices: outputs + GTH + STH */
2538c2ecf20Sopenharmony_ci#define TH_SUBDEVICE_MAX	(TH_POSSIBLE_OUTPUTS + 2)
2548c2ecf20Sopenharmony_ci#define TH_CONFIGURABLE_MASTERS 256
2558c2ecf20Sopenharmony_ci#define TH_MSC_MAX		2
2568c2ecf20Sopenharmony_ci
2578c2ecf20Sopenharmony_ci/* Maximum IRQ vectors */
2588c2ecf20Sopenharmony_ci#define TH_NVEC_MAX		8
2598c2ecf20Sopenharmony_ci
2608c2ecf20Sopenharmony_ci/**
2618c2ecf20Sopenharmony_ci * struct intel_th - Intel TH controller
2628c2ecf20Sopenharmony_ci * @dev:	driver core's device
2638c2ecf20Sopenharmony_ci * @thdev:	subdevices
2648c2ecf20Sopenharmony_ci * @hub:	"switch" subdevice (GTH)
2658c2ecf20Sopenharmony_ci * @resource:	resources of the entire controller
2668c2ecf20Sopenharmony_ci * @num_thdevs:	number of devices in the @thdev array
2678c2ecf20Sopenharmony_ci * @num_resources:	number of resources in the @resource array
2688c2ecf20Sopenharmony_ci * @irq:	irq number
2698c2ecf20Sopenharmony_ci * @num_irqs:	number of IRQs is use
2708c2ecf20Sopenharmony_ci * @id:		this Intel TH controller's device ID in the system
2718c2ecf20Sopenharmony_ci * @major:	device node major for output devices
2728c2ecf20Sopenharmony_ci */
2738c2ecf20Sopenharmony_cistruct intel_th {
2748c2ecf20Sopenharmony_ci	struct device		*dev;
2758c2ecf20Sopenharmony_ci
2768c2ecf20Sopenharmony_ci	struct intel_th_device	*thdev[TH_SUBDEVICE_MAX];
2778c2ecf20Sopenharmony_ci	struct intel_th_device	*hub;
2788c2ecf20Sopenharmony_ci	struct intel_th_drvdata	*drvdata;
2798c2ecf20Sopenharmony_ci
2808c2ecf20Sopenharmony_ci	struct resource		resource[TH_MMIO_END];
2818c2ecf20Sopenharmony_ci	int			(*activate)(struct intel_th *);
2828c2ecf20Sopenharmony_ci	void			(*deactivate)(struct intel_th *);
2838c2ecf20Sopenharmony_ci	unsigned int		num_thdevs;
2848c2ecf20Sopenharmony_ci	unsigned int		num_resources;
2858c2ecf20Sopenharmony_ci	int			irq;
2868c2ecf20Sopenharmony_ci	int			num_irqs;
2878c2ecf20Sopenharmony_ci
2888c2ecf20Sopenharmony_ci	int			id;
2898c2ecf20Sopenharmony_ci	int			major;
2908c2ecf20Sopenharmony_ci#ifdef CONFIG_MODULES
2918c2ecf20Sopenharmony_ci	struct work_struct	request_module_work;
2928c2ecf20Sopenharmony_ci#endif /* CONFIG_MODULES */
2938c2ecf20Sopenharmony_ci#ifdef CONFIG_INTEL_TH_DEBUG
2948c2ecf20Sopenharmony_ci	struct dentry		*dbg;
2958c2ecf20Sopenharmony_ci#endif
2968c2ecf20Sopenharmony_ci};
2978c2ecf20Sopenharmony_ci
2988c2ecf20Sopenharmony_cistatic inline struct intel_th_device *
2998c2ecf20Sopenharmony_cito_intel_th_hub(struct intel_th_device *thdev)
3008c2ecf20Sopenharmony_ci{
3018c2ecf20Sopenharmony_ci	if (thdev->type == INTEL_TH_SWITCH)
3028c2ecf20Sopenharmony_ci		return thdev;
3038c2ecf20Sopenharmony_ci	else if (thdev->type == INTEL_TH_OUTPUT)
3048c2ecf20Sopenharmony_ci		return to_intel_th_parent(thdev);
3058c2ecf20Sopenharmony_ci
3068c2ecf20Sopenharmony_ci	return to_intel_th(thdev)->hub;
3078c2ecf20Sopenharmony_ci}
3088c2ecf20Sopenharmony_ci
3098c2ecf20Sopenharmony_ci/*
3108c2ecf20Sopenharmony_ci * Register windows
3118c2ecf20Sopenharmony_ci */
3128c2ecf20Sopenharmony_cienum {
3138c2ecf20Sopenharmony_ci	/* Global Trace Hub (GTH) */
3148c2ecf20Sopenharmony_ci	REG_GTH_OFFSET		= 0x0000,
3158c2ecf20Sopenharmony_ci	REG_GTH_LENGTH		= 0x2000,
3168c2ecf20Sopenharmony_ci
3178c2ecf20Sopenharmony_ci	/* Timestamp counter unit (TSCU) */
3188c2ecf20Sopenharmony_ci	REG_TSCU_OFFSET		= 0x2000,
3198c2ecf20Sopenharmony_ci	REG_TSCU_LENGTH		= 0x1000,
3208c2ecf20Sopenharmony_ci
3218c2ecf20Sopenharmony_ci	REG_CTS_OFFSET		= 0x3000,
3228c2ecf20Sopenharmony_ci	REG_CTS_LENGTH		= 0x1000,
3238c2ecf20Sopenharmony_ci
3248c2ecf20Sopenharmony_ci	/* Software Trace Hub (STH) [0x4000..0x4fff] */
3258c2ecf20Sopenharmony_ci	REG_STH_OFFSET		= 0x4000,
3268c2ecf20Sopenharmony_ci	REG_STH_LENGTH		= 0x2000,
3278c2ecf20Sopenharmony_ci
3288c2ecf20Sopenharmony_ci	/* Memory Storage Unit (MSU) [0xa0000..0xa1fff] */
3298c2ecf20Sopenharmony_ci	REG_MSU_OFFSET		= 0xa0000,
3308c2ecf20Sopenharmony_ci	REG_MSU_LENGTH		= 0x02000,
3318c2ecf20Sopenharmony_ci
3328c2ecf20Sopenharmony_ci	/* Internal MSU trace buffer [0x80000..0x9ffff] */
3338c2ecf20Sopenharmony_ci	BUF_MSU_OFFSET		= 0x80000,
3348c2ecf20Sopenharmony_ci	BUF_MSU_LENGTH		= 0x20000,
3358c2ecf20Sopenharmony_ci
3368c2ecf20Sopenharmony_ci	/* PTI output == same window as GTH */
3378c2ecf20Sopenharmony_ci	REG_PTI_OFFSET		= REG_GTH_OFFSET,
3388c2ecf20Sopenharmony_ci	REG_PTI_LENGTH		= REG_GTH_LENGTH,
3398c2ecf20Sopenharmony_ci
3408c2ecf20Sopenharmony_ci	/* DCI Handler (DCIH) == some window as MSU */
3418c2ecf20Sopenharmony_ci	REG_DCIH_OFFSET		= REG_MSU_OFFSET,
3428c2ecf20Sopenharmony_ci	REG_DCIH_LENGTH		= REG_MSU_LENGTH,
3438c2ecf20Sopenharmony_ci};
3448c2ecf20Sopenharmony_ci
3458c2ecf20Sopenharmony_ci/*
3468c2ecf20Sopenharmony_ci * Scratchpad bits: tell firmware and external debuggers
3478c2ecf20Sopenharmony_ci * what we are up to.
3488c2ecf20Sopenharmony_ci */
3498c2ecf20Sopenharmony_cienum {
3508c2ecf20Sopenharmony_ci	/* Memory is the primary destination */
3518c2ecf20Sopenharmony_ci	SCRPD_MEM_IS_PRIM_DEST		= BIT(0),
3528c2ecf20Sopenharmony_ci	/* XHCI DbC is the primary destination */
3538c2ecf20Sopenharmony_ci	SCRPD_DBC_IS_PRIM_DEST		= BIT(1),
3548c2ecf20Sopenharmony_ci	/* PTI is the primary destination */
3558c2ecf20Sopenharmony_ci	SCRPD_PTI_IS_PRIM_DEST		= BIT(2),
3568c2ecf20Sopenharmony_ci	/* BSSB is the primary destination */
3578c2ecf20Sopenharmony_ci	SCRPD_BSSB_IS_PRIM_DEST		= BIT(3),
3588c2ecf20Sopenharmony_ci	/* PTI is the alternate destination */
3598c2ecf20Sopenharmony_ci	SCRPD_PTI_IS_ALT_DEST		= BIT(4),
3608c2ecf20Sopenharmony_ci	/* BSSB is the alternate destination */
3618c2ecf20Sopenharmony_ci	SCRPD_BSSB_IS_ALT_DEST		= BIT(5),
3628c2ecf20Sopenharmony_ci	/* DeepSx exit occurred */
3638c2ecf20Sopenharmony_ci	SCRPD_DEEPSX_EXIT		= BIT(6),
3648c2ecf20Sopenharmony_ci	/* S4 exit occurred */
3658c2ecf20Sopenharmony_ci	SCRPD_S4_EXIT			= BIT(7),
3668c2ecf20Sopenharmony_ci	/* S5 exit occurred */
3678c2ecf20Sopenharmony_ci	SCRPD_S5_EXIT			= BIT(8),
3688c2ecf20Sopenharmony_ci	/* MSU controller 0/1 is enabled */
3698c2ecf20Sopenharmony_ci	SCRPD_MSC0_IS_ENABLED		= BIT(9),
3708c2ecf20Sopenharmony_ci	SCRPD_MSC1_IS_ENABLED		= BIT(10),
3718c2ecf20Sopenharmony_ci	/* Sx exit occurred */
3728c2ecf20Sopenharmony_ci	SCRPD_SX_EXIT			= BIT(11),
3738c2ecf20Sopenharmony_ci	/* Trigger Unit is enabled */
3748c2ecf20Sopenharmony_ci	SCRPD_TRIGGER_IS_ENABLED	= BIT(12),
3758c2ecf20Sopenharmony_ci	SCRPD_ODLA_IS_ENABLED		= BIT(13),
3768c2ecf20Sopenharmony_ci	SCRPD_SOCHAP_IS_ENABLED		= BIT(14),
3778c2ecf20Sopenharmony_ci	SCRPD_STH_IS_ENABLED		= BIT(15),
3788c2ecf20Sopenharmony_ci	SCRPD_DCIH_IS_ENABLED		= BIT(16),
3798c2ecf20Sopenharmony_ci	SCRPD_VER_IS_ENABLED		= BIT(17),
3808c2ecf20Sopenharmony_ci	/* External debugger is using Intel TH */
3818c2ecf20Sopenharmony_ci	SCRPD_DEBUGGER_IN_USE		= BIT(24),
3828c2ecf20Sopenharmony_ci};
3838c2ecf20Sopenharmony_ci
3848c2ecf20Sopenharmony_ci#endif
385