cachepc-linux

Fork of AMDESE/linux with modifications for CachePC side-channel attack
git clone https://git.sinitax.com/sinitax/cachepc-linux
Log | Files | Refs | README | LICENSE | sfeed.txt

intel-ish-client-if.h (4091B)


      1/* SPDX-License-Identifier: GPL-2.0 */
      2/*
      3 * Intel ISH client Interface definitions
      4 *
      5 * Copyright (c) 2019, Intel Corporation.
      6 */
      7
      8#ifndef _INTEL_ISH_CLIENT_IF_H_
      9#define _INTEL_ISH_CLIENT_IF_H_
     10
     11#include <linux/device.h>
     12#include <linux/mod_devicetable.h>
     13
     14struct ishtp_cl_device;
     15struct ishtp_device;
     16struct ishtp_cl;
     17struct ishtp_fw_client;
     18
     19typedef __printf(2, 3) void (*ishtp_print_log)(struct ishtp_device *dev,
     20					       const char *format, ...);
     21
     22/* Client state */
     23enum cl_state {
     24	ISHTP_CL_INITIALIZING = 0,
     25	ISHTP_CL_CONNECTING,
     26	ISHTP_CL_CONNECTED,
     27	ISHTP_CL_DISCONNECTING,
     28	ISHTP_CL_DISCONNECTED
     29};
     30
     31/**
     32 * struct ishtp_cl_device - ISHTP device handle
     33 * @driver:	driver instance on a bus
     34 * @name:	Name of the device for probe
     35 * @probe:	driver callback for device probe
     36 * @remove:	driver callback on device removal
     37 *
     38 * Client drivers defines to get probed/removed for ISHTP client device.
     39 */
     40struct ishtp_cl_driver {
     41	struct device_driver driver;
     42	const char *name;
     43	const struct ishtp_device_id *id;
     44	int (*probe)(struct ishtp_cl_device *dev);
     45	void (*remove)(struct ishtp_cl_device *dev);
     46	int (*reset)(struct ishtp_cl_device *dev);
     47	const struct dev_pm_ops *pm;
     48};
     49
     50/**
     51 * struct ishtp_msg_data - ISHTP message data struct
     52 * @size:	Size of data in the *data
     53 * @data:	Pointer to data
     54 */
     55struct ishtp_msg_data {
     56	uint32_t size;
     57	unsigned char *data;
     58};
     59
     60/*
     61 * struct ishtp_cl_rb - request block structure
     62 * @list:	Link to list members
     63 * @cl:		ISHTP client instance
     64 * @buffer:	message header
     65 * @buf_idx:	Index into buffer
     66 * @read_time:	 unused at this time
     67 */
     68struct ishtp_cl_rb {
     69	struct list_head list;
     70	struct ishtp_cl *cl;
     71	struct ishtp_msg_data buffer;
     72	unsigned long buf_idx;
     73	unsigned long read_time;
     74};
     75
     76int ishtp_cl_driver_register(struct ishtp_cl_driver *driver,
     77			     struct module *owner);
     78void ishtp_cl_driver_unregister(struct ishtp_cl_driver *driver);
     79int ishtp_register_event_cb(struct ishtp_cl_device *device,
     80			    void (*read_cb)(struct ishtp_cl_device *));
     81
     82/* Get the device * from ishtp device instance */
     83struct device *ishtp_device(struct ishtp_cl_device *cl_device);
     84/* wait for IPC resume */
     85bool ishtp_wait_resume(struct ishtp_device *dev);
     86/* Trace interface for clients */
     87ishtp_print_log ishtp_trace_callback(struct ishtp_cl_device *cl_device);
     88/* Get device pointer of PCI device for DMA acces */
     89struct device *ishtp_get_pci_device(struct ishtp_cl_device *cl_device);
     90
     91struct ishtp_cl *ishtp_cl_allocate(struct ishtp_cl_device *cl_device);
     92void ishtp_cl_free(struct ishtp_cl *cl);
     93int ishtp_cl_link(struct ishtp_cl *cl);
     94void ishtp_cl_unlink(struct ishtp_cl *cl);
     95int ishtp_cl_disconnect(struct ishtp_cl *cl);
     96int ishtp_cl_connect(struct ishtp_cl *cl);
     97int ishtp_cl_send(struct ishtp_cl *cl, uint8_t *buf, size_t length);
     98int ishtp_cl_flush_queues(struct ishtp_cl *cl);
     99int ishtp_cl_io_rb_recycle(struct ishtp_cl_rb *rb);
    100bool ishtp_cl_tx_empty(struct ishtp_cl *cl);
    101struct ishtp_cl_rb *ishtp_cl_rx_get_rb(struct ishtp_cl *cl);
    102void *ishtp_get_client_data(struct ishtp_cl *cl);
    103void ishtp_set_client_data(struct ishtp_cl *cl, void *data);
    104struct ishtp_device *ishtp_get_ishtp_device(struct ishtp_cl *cl);
    105void ishtp_set_tx_ring_size(struct ishtp_cl *cl, int size);
    106void ishtp_set_rx_ring_size(struct ishtp_cl *cl, int size);
    107void ishtp_set_connection_state(struct ishtp_cl *cl, int state);
    108void ishtp_cl_set_fw_client_id(struct ishtp_cl *cl, int fw_client_id);
    109
    110void ishtp_put_device(struct ishtp_cl_device *cl_dev);
    111void ishtp_get_device(struct ishtp_cl_device *cl_dev);
    112void ishtp_set_drvdata(struct ishtp_cl_device *cl_device, void *data);
    113void *ishtp_get_drvdata(struct ishtp_cl_device *cl_device);
    114struct ishtp_cl_device *ishtp_dev_to_cl_device(struct device *dev);
    115int ishtp_register_event_cb(struct ishtp_cl_device *device,
    116				void (*read_cb)(struct ishtp_cl_device *));
    117struct	ishtp_fw_client *ishtp_fw_cl_get_client(struct ishtp_device *dev,
    118						const guid_t *uuid);
    119int ishtp_get_fw_client_id(struct ishtp_fw_client *fw_client);
    120int ish_hw_reset(struct ishtp_device *dev);
    121#endif /* _INTEL_ISH_CLIENT_IF_H_ */