summaryrefslogtreecommitdiff
path: root/drivers/misc/mic/scif/scif_peer_bus.h
blob: 33f0dbb3015279603a412f49f9bc86f20a3196bf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
/*
 * Intel MIC Platform Software Stack (MPSS)
 *
 * Copyright(c) 2014 Intel Corporation.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License, version 2, as
 * published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * General Public License for more details.
 *
 * Intel SCIF driver.
 */
#ifndef _SCIF_PEER_BUS_H_
#define _SCIF_PEER_BUS_H_

#include <linux/device.h>
#include <linux/mic_common.h>

/*
 * Peer devices show up as PCIe devices for the mgmt node but not the cards.
 * The mgmt node discovers all the cards on the PCIe bus and informs the other
 * cards about their peers. Upon notification of a peer a node adds a peer
 * device to the peer bus to maintain symmetry in the way devices are
 * discovered across all nodes in the SCIF network.
 */
/**
 * scif_peer_dev - representation of a peer SCIF device
 * @dev: underlying device
 * @dnode - The destination node which this device will communicate with.
 */
struct scif_peer_dev {
	struct device dev;
	u8 dnode;
};

/**
 * scif_peer_driver - operations for a scif_peer I/O driver
 * @driver: underlying device driver (populate name and owner).
 * @id_table: the ids serviced by this driver.
 * @probe: the function to call when a device is found.  Returns 0 or -errno.
 * @remove: the function to call when a device is removed.
 */
struct scif_peer_driver {
	struct device_driver driver;
	const struct scif_peer_dev_id *id_table;

	int (*probe)(struct scif_peer_dev *dev);
	void (*remove)(struct scif_peer_dev *dev);
};

struct scif_dev;

int scif_peer_register_driver(struct scif_peer_driver *driver);
void scif_peer_unregister_driver(struct scif_peer_driver *driver);

struct scif_peer_dev *scif_peer_register_device(struct scif_dev *sdev);
void scif_peer_unregister_device(struct scif_peer_dev *sdev);

int scif_peer_bus_init(void);
void scif_peer_bus_exit(void);
#endif /* _SCIF_PEER_BUS_H */