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

svc.h (3289B)


      1/* SPDX-License-Identifier: GPL-2.0 */
      2/*
      3 * Greybus SVC code
      4 *
      5 * Copyright 2015 Google Inc.
      6 * Copyright 2015 Linaro Ltd.
      7 */
      8
      9#ifndef __SVC_H
     10#define __SVC_H
     11
     12#include <linux/types.h>
     13#include <linux/device.h>
     14
     15struct gb_svc_l2_timer_cfg;
     16
     17#define GB_SVC_CPORT_FLAG_E2EFC		BIT(0)
     18#define GB_SVC_CPORT_FLAG_CSD_N		BIT(1)
     19#define GB_SVC_CPORT_FLAG_CSV_N		BIT(2)
     20
     21enum gb_svc_state {
     22	GB_SVC_STATE_RESET,
     23	GB_SVC_STATE_PROTOCOL_VERSION,
     24	GB_SVC_STATE_SVC_HELLO,
     25};
     26
     27enum gb_svc_watchdog_bite {
     28	GB_SVC_WATCHDOG_BITE_RESET_UNIPRO = 0,
     29	GB_SVC_WATCHDOG_BITE_PANIC_KERNEL,
     30};
     31
     32struct gb_svc_watchdog;
     33
     34struct svc_debugfs_pwrmon_rail {
     35	u8 id;
     36	struct gb_svc *svc;
     37};
     38
     39struct gb_svc {
     40	struct device		dev;
     41
     42	struct gb_host_device	*hd;
     43	struct gb_connection	*connection;
     44	enum gb_svc_state	state;
     45	struct ida		device_id_map;
     46	struct workqueue_struct	*wq;
     47
     48	u16 endo_id;
     49	u8 ap_intf_id;
     50
     51	u8 protocol_major;
     52	u8 protocol_minor;
     53
     54	struct gb_svc_watchdog	*watchdog;
     55	enum gb_svc_watchdog_bite action;
     56
     57	struct dentry *debugfs_dentry;
     58	struct svc_debugfs_pwrmon_rail *pwrmon_rails;
     59};
     60#define to_gb_svc(d) container_of(d, struct gb_svc, dev)
     61
     62struct gb_svc *gb_svc_create(struct gb_host_device *hd);
     63int gb_svc_add(struct gb_svc *svc);
     64void gb_svc_del(struct gb_svc *svc);
     65void gb_svc_put(struct gb_svc *svc);
     66
     67int gb_svc_pwrmon_intf_sample_get(struct gb_svc *svc, u8 intf_id,
     68				  u8 measurement_type, u32 *value);
     69int gb_svc_intf_device_id(struct gb_svc *svc, u8 intf_id, u8 device_id);
     70int gb_svc_route_create(struct gb_svc *svc, u8 intf1_id, u8 dev1_id,
     71			       u8 intf2_id, u8 dev2_id);
     72void gb_svc_route_destroy(struct gb_svc *svc, u8 intf1_id, u8 intf2_id);
     73int gb_svc_connection_create(struct gb_svc *svc, u8 intf1_id, u16 cport1_id,
     74			     u8 intf2_id, u16 cport2_id, u8 cport_flags);
     75void gb_svc_connection_destroy(struct gb_svc *svc, u8 intf1_id, u16 cport1_id,
     76			       u8 intf2_id, u16 cport2_id);
     77int gb_svc_intf_eject(struct gb_svc *svc, u8 intf_id);
     78int gb_svc_intf_vsys_set(struct gb_svc *svc, u8 intf_id, bool enable);
     79int gb_svc_intf_refclk_set(struct gb_svc *svc, u8 intf_id, bool enable);
     80int gb_svc_intf_unipro_set(struct gb_svc *svc, u8 intf_id, bool enable);
     81int gb_svc_intf_activate(struct gb_svc *svc, u8 intf_id, u8 *intf_type);
     82int gb_svc_intf_resume(struct gb_svc *svc, u8 intf_id);
     83
     84int gb_svc_dme_peer_get(struct gb_svc *svc, u8 intf_id, u16 attr, u16 selector,
     85			u32 *value);
     86int gb_svc_dme_peer_set(struct gb_svc *svc, u8 intf_id, u16 attr, u16 selector,
     87			u32 value);
     88int gb_svc_intf_set_power_mode(struct gb_svc *svc, u8 intf_id, u8 hs_series,
     89			       u8 tx_mode, u8 tx_gear, u8 tx_nlanes,
     90			       u8 tx_amplitude, u8 tx_hs_equalizer,
     91			       u8 rx_mode, u8 rx_gear, u8 rx_nlanes,
     92			       u8 flags, u32 quirks,
     93			       struct gb_svc_l2_timer_cfg *local,
     94			       struct gb_svc_l2_timer_cfg *remote);
     95int gb_svc_intf_set_power_mode_hibernate(struct gb_svc *svc, u8 intf_id);
     96int gb_svc_ping(struct gb_svc *svc);
     97int gb_svc_watchdog_create(struct gb_svc *svc);
     98void gb_svc_watchdog_destroy(struct gb_svc *svc);
     99bool gb_svc_watchdog_enabled(struct gb_svc *svc);
    100int gb_svc_watchdog_enable(struct gb_svc *svc);
    101int gb_svc_watchdog_disable(struct gb_svc *svc);
    102
    103int gb_svc_protocol_init(void);
    104void gb_svc_protocol_exit(void);
    105
    106#endif /* __SVC_H */