rio.h 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565
  1. /*
  2. * RapidIO interconnect services
  3. * (RapidIO Interconnect Specification, http://www.rapidio.org)
  4. *
  5. * Copyright 2005 MontaVista Software, Inc.
  6. * Matt Porter <mporter@kernel.crashing.org>
  7. *
  8. * This program is free software; you can redistribute it and/or modify it
  9. * under the terms of the GNU General Public License as published by the
  10. * Free Software Foundation; either version 2 of the License, or (at your
  11. * option) any later version.
  12. */
  13. #ifndef LINUX_RIO_H
  14. #define LINUX_RIO_H
  15. #include <linux/types.h>
  16. #include <linux/ioport.h>
  17. #include <linux/list.h>
  18. #include <linux/errno.h>
  19. #include <linux/device.h>
  20. #include <linux/rio_regs.h>
  21. #include <linux/mod_devicetable.h>
  22. #ifdef CONFIG_RAPIDIO_DMA_ENGINE
  23. #include <linux/dmaengine.h>
  24. #endif
  25. #define RIO_NO_HOPCOUNT -1
  26. #define RIO_INVALID_DESTID 0xffff
  27. #define RIO_MAX_MPORTS 8
  28. #define RIO_MAX_MPORT_RESOURCES 16
  29. #define RIO_MAX_DEV_RESOURCES 16
  30. #define RIO_MAX_MPORT_NAME 40
  31. #define RIO_GLOBAL_TABLE 0xff /* Indicates access of a switch's
  32. global routing table if it
  33. has multiple (or per port)
  34. tables */
  35. #define RIO_INVALID_ROUTE 0xff /* Indicates that a route table
  36. entry is invalid (no route
  37. exists for the device ID) */
  38. #define RIO_MAX_ROUTE_ENTRIES(size) (size ? (1 << 16) : (1 << 8))
  39. #define RIO_ANY_DESTID(size) (size ? 0xffff : 0xff)
  40. #define RIO_MAX_MBOX 4
  41. #define RIO_MAX_MSG_SIZE 0x1000
  42. /*
  43. * Error values that may be returned by RIO functions.
  44. */
  45. #define RIO_SUCCESSFUL 0x00
  46. #define RIO_BAD_SIZE 0x81
  47. /*
  48. * For RIO devices, the region numbers are assigned this way:
  49. *
  50. * 0 RapidIO outbound doorbells
  51. * 1-15 RapidIO memory regions
  52. *
  53. * For RIO master ports, the region number are assigned this way:
  54. *
  55. * 0 RapidIO inbound doorbells
  56. * 1 RapidIO inbound mailboxes
  57. * 2 RapidIO outbound mailboxes
  58. */
  59. #define RIO_DOORBELL_RESOURCE 0
  60. #define RIO_INB_MBOX_RESOURCE 1
  61. #define RIO_OUTB_MBOX_RESOURCE 2
  62. #define RIO_PW_MSG_SIZE 64
  63. /*
  64. * A component tag value (stored in the component tag CSR) is used as device's
  65. * unique identifier assigned during enumeration. Besides being used for
  66. * identifying switches (which do not have device ID register), it also is used
  67. * by error management notification and therefore has to be assigned
  68. * to endpoints as well.
  69. */
  70. #define RIO_CTAG_RESRVD 0xfffe0000 /* Reserved */
  71. #define RIO_CTAG_UDEVID 0x0001ffff /* Unique device identifier */
  72. extern struct bus_type rio_bus_type;
  73. extern struct class rio_mport_class;
  74. struct rio_mport;
  75. struct rio_dev;
  76. union rio_pw_msg;
  77. /**
  78. * struct rio_switch - RIO switch info
  79. * @node: Node in global list of switches
  80. * @route_table: Copy of switch routing table
  81. * @port_ok: Status of each port (one bit per port) - OK=1 or UNINIT=0
  82. * @ops: pointer to switch-specific operations
  83. * @lock: lock to serialize operations updates
  84. * @nextdev: Array of per-port pointers to the next attached device
  85. */
  86. struct rio_switch {
  87. struct list_head node;
  88. u8 *route_table;
  89. u32 port_ok;
  90. struct rio_switch_ops *ops;
  91. spinlock_t lock;
  92. struct rio_dev *nextdev[0];
  93. };
  94. /**
  95. * struct rio_switch_ops - Per-switch operations
  96. * @owner: The module owner of this structure
  97. * @add_entry: Callback for switch-specific route add function
  98. * @get_entry: Callback for switch-specific route get function
  99. * @clr_table: Callback for switch-specific clear route table function
  100. * @set_domain: Callback for switch-specific domain setting function
  101. * @get_domain: Callback for switch-specific domain get function
  102. * @em_init: Callback for switch-specific error management init function
  103. * @em_handle: Callback for switch-specific error management handler function
  104. *
  105. * Defines the operations that are necessary to initialize/control
  106. * a particular RIO switch device.
  107. */
  108. struct rio_switch_ops {
  109. struct module *owner;
  110. int (*add_entry) (struct rio_mport *mport, u16 destid, u8 hopcount,
  111. u16 table, u16 route_destid, u8 route_port);
  112. int (*get_entry) (struct rio_mport *mport, u16 destid, u8 hopcount,
  113. u16 table, u16 route_destid, u8 *route_port);
  114. int (*clr_table) (struct rio_mport *mport, u16 destid, u8 hopcount,
  115. u16 table);
  116. int (*set_domain) (struct rio_mport *mport, u16 destid, u8 hopcount,
  117. u8 sw_domain);
  118. int (*get_domain) (struct rio_mport *mport, u16 destid, u8 hopcount,
  119. u8 *sw_domain);
  120. int (*em_init) (struct rio_dev *dev);
  121. int (*em_handle) (struct rio_dev *dev, u8 swport);
  122. };
  123. enum rio_device_state {
  124. RIO_DEVICE_INITIALIZING,
  125. RIO_DEVICE_RUNNING,
  126. RIO_DEVICE_GONE,
  127. RIO_DEVICE_SHUTDOWN,
  128. };
  129. /**
  130. * struct rio_dev - RIO device info
  131. * @global_list: Node in list of all RIO devices
  132. * @net_list: Node in list of RIO devices in a network
  133. * @net: Network this device is a part of
  134. * @do_enum: Enumeration flag
  135. * @did: Device ID
  136. * @vid: Vendor ID
  137. * @device_rev: Device revision
  138. * @asm_did: Assembly device ID
  139. * @asm_vid: Assembly vendor ID
  140. * @asm_rev: Assembly revision
  141. * @efptr: Extended feature pointer
  142. * @pef: Processing element features
  143. * @swpinfo: Switch port info
  144. * @src_ops: Source operation capabilities
  145. * @dst_ops: Destination operation capabilities
  146. * @comp_tag: RIO component tag
  147. * @phys_efptr: RIO device extended features pointer
  148. * @em_efptr: RIO Error Management features pointer
  149. * @dma_mask: Mask of bits of RIO address this device implements
  150. * @driver: Driver claiming this device
  151. * @dev: Device model device
  152. * @riores: RIO resources this device owns
  153. * @pwcback: port-write callback function for this device
  154. * @destid: Network destination ID (or associated destid for switch)
  155. * @hopcount: Hopcount to this device
  156. * @prev: Previous RIO device connected to the current one
  157. * @state: device state
  158. * @rswitch: struct rio_switch (if valid for this device)
  159. */
  160. struct rio_dev {
  161. struct list_head global_list; /* node in list of all RIO devices */
  162. struct list_head net_list; /* node in per net list */
  163. struct rio_net *net; /* RIO net this device resides in */
  164. bool do_enum;
  165. u16 did;
  166. u16 vid;
  167. u32 device_rev;
  168. u16 asm_did;
  169. u16 asm_vid;
  170. u16 asm_rev;
  171. u16 efptr;
  172. u32 pef;
  173. u32 swpinfo;
  174. u32 src_ops;
  175. u32 dst_ops;
  176. u32 comp_tag;
  177. u32 phys_efptr;
  178. u32 em_efptr;
  179. u64 dma_mask;
  180. struct rio_driver *driver; /* RIO driver claiming this device */
  181. struct device dev; /* LDM device structure */
  182. struct resource riores[RIO_MAX_DEV_RESOURCES];
  183. int (*pwcback) (struct rio_dev *rdev, union rio_pw_msg *msg, int step);
  184. u16 destid;
  185. u8 hopcount;
  186. struct rio_dev *prev;
  187. atomic_t state;
  188. struct rio_switch rswitch[0]; /* RIO switch info */
  189. };
  190. #define rio_dev_g(n) list_entry(n, struct rio_dev, global_list)
  191. #define rio_dev_f(n) list_entry(n, struct rio_dev, net_list)
  192. #define to_rio_dev(n) container_of(n, struct rio_dev, dev)
  193. #define sw_to_rio_dev(n) container_of(n, struct rio_dev, rswitch[0])
  194. #define to_rio_mport(n) container_of(n, struct rio_mport, dev)
  195. #define to_rio_net(n) container_of(n, struct rio_net, dev)
  196. /**
  197. * struct rio_msg - RIO message event
  198. * @res: Mailbox resource
  199. * @mcback: Message event callback
  200. */
  201. struct rio_msg {
  202. struct resource *res;
  203. void (*mcback) (struct rio_mport * mport, void *dev_id, int mbox, int slot);
  204. };
  205. /**
  206. * struct rio_dbell - RIO doorbell event
  207. * @node: Node in list of doorbell events
  208. * @res: Doorbell resource
  209. * @dinb: Doorbell event callback
  210. * @dev_id: Device specific pointer to pass on event
  211. */
  212. struct rio_dbell {
  213. struct list_head node;
  214. struct resource *res;
  215. void (*dinb) (struct rio_mport *mport, void *dev_id, u16 src, u16 dst, u16 info);
  216. void *dev_id;
  217. };
  218. enum rio_phy_type {
  219. RIO_PHY_PARALLEL,
  220. RIO_PHY_SERIAL,
  221. };
  222. /**
  223. * struct rio_mport - RIO master port info
  224. * @dbells: List of doorbell events
  225. * @pwrites: List of portwrite events
  226. * @node: Node in global list of master ports
  227. * @nnode: Node in network list of master ports
  228. * @net: RIO net this mport is attached to
  229. * @lock: lock to synchronize lists manipulations
  230. * @iores: I/O mem resource that this master port interface owns
  231. * @riores: RIO resources that this master port interfaces owns
  232. * @inb_msg: RIO inbound message event descriptors
  233. * @outb_msg: RIO outbound message event descriptors
  234. * @host_deviceid: Host device ID associated with this master port
  235. * @ops: configuration space functions
  236. * @id: Port ID, unique among all ports
  237. * @index: Port index, unique among all port interfaces of the same type
  238. * @sys_size: RapidIO common transport system size
  239. * @phy_type: RapidIO phy type
  240. * @phys_efptr: RIO port extended features pointer
  241. * @name: Port name string
  242. * @dev: device structure associated with an mport
  243. * @priv: Master port private data
  244. * @dma: DMA device associated with mport
  245. * @nscan: RapidIO network enumeration/discovery operations
  246. * @state: mport device state
  247. * @pwe_refcnt: port-write enable ref counter to track enable/disable requests
  248. */
  249. struct rio_mport {
  250. struct list_head dbells; /* list of doorbell events */
  251. struct list_head pwrites; /* list of portwrite events */
  252. struct list_head node; /* node in global list of ports */
  253. struct list_head nnode; /* node in net list of ports */
  254. struct rio_net *net; /* RIO net this mport is attached to */
  255. struct mutex lock;
  256. struct resource iores;
  257. struct resource riores[RIO_MAX_MPORT_RESOURCES];
  258. struct rio_msg inb_msg[RIO_MAX_MBOX];
  259. struct rio_msg outb_msg[RIO_MAX_MBOX];
  260. int host_deviceid; /* Host device ID */
  261. struct rio_ops *ops; /* low-level architecture-dependent routines */
  262. unsigned char id; /* port ID, unique among all ports */
  263. unsigned char index; /* port index, unique among all port
  264. interfaces of the same type */
  265. unsigned int sys_size; /* RapidIO common transport system size.
  266. * 0 - Small size. 256 devices.
  267. * 1 - Large size, 65536 devices.
  268. */
  269. enum rio_phy_type phy_type; /* RapidIO phy type */
  270. u32 phys_efptr;
  271. unsigned char name[RIO_MAX_MPORT_NAME];
  272. struct device dev;
  273. void *priv; /* Master port private data */
  274. #ifdef CONFIG_RAPIDIO_DMA_ENGINE
  275. struct dma_device dma;
  276. #endif
  277. struct rio_scan *nscan;
  278. atomic_t state;
  279. unsigned int pwe_refcnt;
  280. };
  281. static inline int rio_mport_is_running(struct rio_mport *mport)
  282. {
  283. return atomic_read(&mport->state) == RIO_DEVICE_RUNNING;
  284. }
  285. /*
  286. * Enumeration/discovery control flags
  287. */
  288. #define RIO_SCAN_ENUM_NO_WAIT 0x00000001 /* Do not wait for enum completed */
  289. /**
  290. * struct rio_net - RIO network info
  291. * @node: Node in global list of RIO networks
  292. * @devices: List of devices in this network
  293. * @switches: List of switches in this network
  294. * @mports: List of master ports accessing this network
  295. * @hport: Default port for accessing this network
  296. * @id: RIO network ID
  297. * @dev: Device object
  298. * @enum_data: private data specific to a network enumerator
  299. * @release: enumerator-specific release callback
  300. */
  301. struct rio_net {
  302. struct list_head node; /* node in list of networks */
  303. struct list_head devices; /* list of devices in this net */
  304. struct list_head switches; /* list of switches in this net */
  305. struct list_head mports; /* list of ports accessing net */
  306. struct rio_mport *hport; /* primary port for accessing net */
  307. unsigned char id; /* RIO network ID */
  308. struct device dev;
  309. void *enum_data; /* private data for enumerator of the network */
  310. void (*release)(struct rio_net *net);
  311. };
  312. enum rio_link_speed {
  313. RIO_LINK_DOWN = 0, /* SRIO Link not initialized */
  314. RIO_LINK_125 = 1, /* 1.25 GBaud */
  315. RIO_LINK_250 = 2, /* 2.5 GBaud */
  316. RIO_LINK_312 = 3, /* 3.125 GBaud */
  317. RIO_LINK_500 = 4, /* 5.0 GBaud */
  318. RIO_LINK_625 = 5 /* 6.25 GBaud */
  319. };
  320. enum rio_link_width {
  321. RIO_LINK_1X = 0,
  322. RIO_LINK_1XR = 1,
  323. RIO_LINK_2X = 3,
  324. RIO_LINK_4X = 2,
  325. RIO_LINK_8X = 4,
  326. RIO_LINK_16X = 5
  327. };
  328. enum rio_mport_flags {
  329. RIO_MPORT_DMA = (1 << 0), /* supports DMA data transfers */
  330. RIO_MPORT_DMA_SG = (1 << 1), /* DMA supports HW SG mode */
  331. RIO_MPORT_IBSG = (1 << 2), /* inbound mapping supports SG */
  332. };
  333. /**
  334. * struct rio_mport_attr - RIO mport device attributes
  335. * @flags: mport device capability flags
  336. * @link_speed: SRIO link speed value (as defined by RapidIO specification)
  337. * @link_width: SRIO link width value (as defined by RapidIO specification)
  338. * @dma_max_sge: number of SG list entries that can be handled by DMA channel(s)
  339. * @dma_max_size: max number of bytes in single DMA transfer (SG entry)
  340. * @dma_align: alignment shift for DMA operations (as for other DMA operations)
  341. */
  342. struct rio_mport_attr {
  343. int flags;
  344. int link_speed;
  345. int link_width;
  346. /* DMA capability info: valid only if RIO_MPORT_DMA flag is set */
  347. int dma_max_sge;
  348. int dma_max_size;
  349. int dma_align;
  350. };
  351. /* Low-level architecture-dependent routines */
  352. /**
  353. * struct rio_ops - Low-level RIO configuration space operations
  354. * @lcread: Callback to perform local (master port) read of config space.
  355. * @lcwrite: Callback to perform local (master port) write of config space.
  356. * @cread: Callback to perform network read of config space.
  357. * @cwrite: Callback to perform network write of config space.
  358. * @dsend: Callback to send a doorbell message.
  359. * @pwenable: Callback to enable/disable port-write message handling.
  360. * @open_outb_mbox: Callback to initialize outbound mailbox.
  361. * @close_outb_mbox: Callback to shut down outbound mailbox.
  362. * @open_inb_mbox: Callback to initialize inbound mailbox.
  363. * @close_inb_mbox: Callback to shut down inbound mailbox.
  364. * @add_outb_message: Callback to add a message to an outbound mailbox queue.
  365. * @add_inb_buffer: Callback to add a buffer to an inbound mailbox queue.
  366. * @get_inb_message: Callback to get a message from an inbound mailbox queue.
  367. * @map_inb: Callback to map RapidIO address region into local memory space.
  368. * @unmap_inb: Callback to unmap RapidIO address region mapped with map_inb().
  369. * @query_mport: Callback to query mport device attributes.
  370. * @map_outb: Callback to map outbound address region into local memory space.
  371. * @unmap_outb: Callback to unmap outbound RapidIO address region.
  372. */
  373. struct rio_ops {
  374. int (*lcread) (struct rio_mport *mport, int index, u32 offset, int len,
  375. u32 *data);
  376. int (*lcwrite) (struct rio_mport *mport, int index, u32 offset, int len,
  377. u32 data);
  378. int (*cread) (struct rio_mport *mport, int index, u16 destid,
  379. u8 hopcount, u32 offset, int len, u32 *data);
  380. int (*cwrite) (struct rio_mport *mport, int index, u16 destid,
  381. u8 hopcount, u32 offset, int len, u32 data);
  382. int (*dsend) (struct rio_mport *mport, int index, u16 destid, u16 data);
  383. int (*pwenable) (struct rio_mport *mport, int enable);
  384. int (*open_outb_mbox)(struct rio_mport *mport, void *dev_id,
  385. int mbox, int entries);
  386. void (*close_outb_mbox)(struct rio_mport *mport, int mbox);
  387. int (*open_inb_mbox)(struct rio_mport *mport, void *dev_id,
  388. int mbox, int entries);
  389. void (*close_inb_mbox)(struct rio_mport *mport, int mbox);
  390. int (*add_outb_message)(struct rio_mport *mport, struct rio_dev *rdev,
  391. int mbox, void *buffer, size_t len);
  392. int (*add_inb_buffer)(struct rio_mport *mport, int mbox, void *buf);
  393. void *(*get_inb_message)(struct rio_mport *mport, int mbox);
  394. int (*map_inb)(struct rio_mport *mport, dma_addr_t lstart,
  395. u64 rstart, u64 size, u32 flags);
  396. void (*unmap_inb)(struct rio_mport *mport, dma_addr_t lstart);
  397. int (*query_mport)(struct rio_mport *mport,
  398. struct rio_mport_attr *attr);
  399. int (*map_outb)(struct rio_mport *mport, u16 destid, u64 rstart,
  400. u32 size, u32 flags, dma_addr_t *laddr);
  401. void (*unmap_outb)(struct rio_mport *mport, u16 destid, u64 rstart);
  402. };
  403. #define RIO_RESOURCE_MEM 0x00000100
  404. #define RIO_RESOURCE_DOORBELL 0x00000200
  405. #define RIO_RESOURCE_MAILBOX 0x00000400
  406. #define RIO_RESOURCE_CACHEABLE 0x00010000
  407. #define RIO_RESOURCE_PCI 0x00020000
  408. #define RIO_RESOURCE_BUSY 0x80000000
  409. /**
  410. * struct rio_driver - RIO driver info
  411. * @node: Node in list of drivers
  412. * @name: RIO driver name
  413. * @id_table: RIO device ids to be associated with this driver
  414. * @probe: RIO device inserted
  415. * @remove: RIO device removed
  416. * @shutdown: shutdown notification callback
  417. * @suspend: RIO device suspended
  418. * @resume: RIO device awakened
  419. * @enable_wake: RIO device enable wake event
  420. * @driver: LDM driver struct
  421. *
  422. * Provides info on a RIO device driver for insertion/removal and
  423. * power management purposes.
  424. */
  425. struct rio_driver {
  426. struct list_head node;
  427. char *name;
  428. const struct rio_device_id *id_table;
  429. int (*probe) (struct rio_dev * dev, const struct rio_device_id * id);
  430. void (*remove) (struct rio_dev * dev);
  431. void (*shutdown)(struct rio_dev *dev);
  432. int (*suspend) (struct rio_dev * dev, u32 state);
  433. int (*resume) (struct rio_dev * dev);
  434. int (*enable_wake) (struct rio_dev * dev, u32 state, int enable);
  435. struct device_driver driver;
  436. };
  437. #define to_rio_driver(drv) container_of(drv,struct rio_driver, driver)
  438. union rio_pw_msg {
  439. struct {
  440. u32 comptag; /* Component Tag CSR */
  441. u32 errdetect; /* Port N Error Detect CSR */
  442. u32 is_port; /* Implementation specific + PortID */
  443. u32 ltlerrdet; /* LTL Error Detect CSR */
  444. u32 padding[12];
  445. } em;
  446. u32 raw[RIO_PW_MSG_SIZE/sizeof(u32)];
  447. };
  448. #ifdef CONFIG_RAPIDIO_DMA_ENGINE
  449. /*
  450. * enum rio_write_type - RIO write transaction types used in DMA transfers
  451. *
  452. * Note: RapidIO specification defines write (NWRITE) and
  453. * write-with-response (NWRITE_R) data transfer operations.
  454. * Existing DMA controllers that service RapidIO may use one of these operations
  455. * for entire data transfer or their combination with only the last data packet
  456. * requires response.
  457. */
  458. enum rio_write_type {
  459. RDW_DEFAULT, /* default method used by DMA driver */
  460. RDW_ALL_NWRITE, /* all packets use NWRITE */
  461. RDW_ALL_NWRITE_R, /* all packets use NWRITE_R */
  462. RDW_LAST_NWRITE_R, /* last packet uses NWRITE_R, others - NWRITE */
  463. };
  464. struct rio_dma_ext {
  465. u16 destid;
  466. u64 rio_addr; /* low 64-bits of 66-bit RapidIO address */
  467. u8 rio_addr_u; /* upper 2-bits of 66-bit RapidIO address */
  468. enum rio_write_type wr_type; /* preferred RIO write operation type */
  469. };
  470. struct rio_dma_data {
  471. /* Local data (as scatterlist) */
  472. struct scatterlist *sg; /* I/O scatter list */
  473. unsigned int sg_len; /* size of scatter list */
  474. /* Remote device address (flat buffer) */
  475. u64 rio_addr; /* low 64-bits of 66-bit RapidIO address */
  476. u8 rio_addr_u; /* upper 2-bits of 66-bit RapidIO address */
  477. enum rio_write_type wr_type; /* preferred RIO write operation type */
  478. };
  479. static inline struct rio_mport *dma_to_mport(struct dma_device *ddev)
  480. {
  481. return container_of(ddev, struct rio_mport, dma);
  482. }
  483. #endif /* CONFIG_RAPIDIO_DMA_ENGINE */
  484. /**
  485. * struct rio_scan - RIO enumeration and discovery operations
  486. * @owner: The module owner of this structure
  487. * @enumerate: Callback to perform RapidIO fabric enumeration.
  488. * @discover: Callback to perform RapidIO fabric discovery.
  489. */
  490. struct rio_scan {
  491. struct module *owner;
  492. int (*enumerate)(struct rio_mport *mport, u32 flags);
  493. int (*discover)(struct rio_mport *mport, u32 flags);
  494. };
  495. /**
  496. * struct rio_scan_node - list node to register RapidIO enumeration and
  497. * discovery methods with RapidIO core.
  498. * @mport_id: ID of an mport (net) serviced by this enumerator
  499. * @node: node in global list of registered enumerators
  500. * @ops: RIO enumeration and discovery operations
  501. */
  502. struct rio_scan_node {
  503. int mport_id;
  504. struct list_head node;
  505. struct rio_scan *ops;
  506. };
  507. /* Architecture and hardware-specific functions */
  508. extern int rio_mport_initialize(struct rio_mport *);
  509. extern int rio_register_mport(struct rio_mport *);
  510. extern int rio_unregister_mport(struct rio_mport *);
  511. extern int rio_open_inb_mbox(struct rio_mport *, void *, int, int);
  512. extern void rio_close_inb_mbox(struct rio_mport *, int);
  513. extern int rio_open_outb_mbox(struct rio_mport *, void *, int, int);
  514. extern void rio_close_outb_mbox(struct rio_mport *, int);
  515. extern int rio_query_mport(struct rio_mport *port,
  516. struct rio_mport_attr *mport_attr);
  517. #endif /* LINUX_RIO_H */