^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) /* SPDX-License-Identifier: GPL-2.0-or-later */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) * RapidIO interconnect services
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) * Copyright 2005 MontaVista Software, Inc.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) * Matt Porter <mporter@kernel.crashing.org>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) #include <linux/device.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) #include <linux/list.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) #include <linux/rio.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) #define RIO_MAX_CHK_RETRY 3
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) #define RIO_MPORT_ANY (-1)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) /* Functions internal to the RIO core code */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) extern u32 rio_mport_get_feature(struct rio_mport *mport, int local, u16 destid,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) u8 hopcount, int ftr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) extern u32 rio_mport_get_physefb(struct rio_mport *port, int local,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) u16 destid, u8 hopcount, u32 *rmap);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) extern u32 rio_mport_get_efb(struct rio_mport *port, int local, u16 destid,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) u8 hopcount, u32 from);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) extern int rio_mport_chk_dev_access(struct rio_mport *mport, u16 destid,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) u8 hopcount);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) extern int rio_lock_device(struct rio_mport *port, u16 destid,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) u8 hopcount, int wait_ms);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) extern int rio_unlock_device(struct rio_mport *port, u16 destid, u8 hopcount);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) extern int rio_route_add_entry(struct rio_dev *rdev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) u16 table, u16 route_destid, u8 route_port, int lock);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) extern int rio_route_get_entry(struct rio_dev *rdev, u16 table,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) u16 route_destid, u8 *route_port, int lock);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) extern int rio_route_clr_table(struct rio_dev *rdev, u16 table, int lock);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) extern int rio_set_port_lockout(struct rio_dev *rdev, u32 pnum, int lock);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) extern struct rio_dev *rio_get_comptag(u32 comp_tag, struct rio_dev *from);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) extern struct rio_net *rio_alloc_net(struct rio_mport *mport);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) extern int rio_add_net(struct rio_net *net);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) extern void rio_free_net(struct rio_net *net);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) extern int rio_add_device(struct rio_dev *rdev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) extern void rio_del_device(struct rio_dev *rdev, enum rio_device_state state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) extern int rio_enable_rx_tx_port(struct rio_mport *port, int local, u16 destid,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) u8 hopcount, u8 port_num);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) extern int rio_register_scan(int mport_id, struct rio_scan *scan_ops);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) extern int rio_unregister_scan(int mport_id, struct rio_scan *scan_ops);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) extern void rio_attach_device(struct rio_dev *rdev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) extern struct rio_mport *rio_find_mport(int mport_id);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) extern int rio_mport_scan(int mport_id);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) /* Structures internal to the RIO core code */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) extern const struct attribute_group *rio_dev_groups[];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) extern const struct attribute_group *rio_bus_groups[];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) extern const struct attribute_group *rio_mport_groups[];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) #define RIO_GET_DID(size, x) (size ? (x & 0xffff) : ((x & 0x00ff0000) >> 16))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) #define RIO_SET_DID(size, x) (size ? (x & 0xffff) : ((x & 0x000000ff) << 16))