scif_peer_bus.h 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. /*
  2. * Intel MIC Platform Software Stack (MPSS)
  3. *
  4. * Copyright(c) 2014 Intel Corporation.
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License, version 2, as
  8. * published by the Free Software Foundation.
  9. *
  10. * This program is distributed in the hope that it will be useful, but
  11. * WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  13. * General Public License for more details.
  14. *
  15. * Intel SCIF driver.
  16. */
  17. #ifndef _SCIF_PEER_BUS_H_
  18. #define _SCIF_PEER_BUS_H_
  19. #include <linux/device.h>
  20. #include <linux/mic_common.h>
  21. /*
  22. * Peer devices show up as PCIe devices for the mgmt node but not the cards.
  23. * The mgmt node discovers all the cards on the PCIe bus and informs the other
  24. * cards about their peers. Upon notification of a peer a node adds a peer
  25. * device to the peer bus to maintain symmetry in the way devices are
  26. * discovered across all nodes in the SCIF network.
  27. */
  28. /**
  29. * scif_peer_dev - representation of a peer SCIF device
  30. * @dev: underlying device
  31. * @dnode - The destination node which this device will communicate with.
  32. */
  33. struct scif_peer_dev {
  34. struct device dev;
  35. u8 dnode;
  36. };
  37. /**
  38. * scif_peer_driver - operations for a scif_peer I/O driver
  39. * @driver: underlying device driver (populate name and owner).
  40. * @id_table: the ids serviced by this driver.
  41. * @probe: the function to call when a device is found. Returns 0 or -errno.
  42. * @remove: the function to call when a device is removed.
  43. */
  44. struct scif_peer_driver {
  45. struct device_driver driver;
  46. const struct scif_peer_dev_id *id_table;
  47. int (*probe)(struct scif_peer_dev *dev);
  48. void (*remove)(struct scif_peer_dev *dev);
  49. };
  50. struct scif_dev;
  51. int scif_peer_register_driver(struct scif_peer_driver *driver);
  52. void scif_peer_unregister_driver(struct scif_peer_driver *driver);
  53. struct scif_peer_dev *scif_peer_register_device(struct scif_dev *sdev);
  54. void scif_peer_unregister_device(struct scif_peer_dev *sdev);
  55. int scif_peer_bus_init(void);
  56. void scif_peer_bus_exit(void);
  57. #endif /* _SCIF_PEER_BUS_H */