1394b701ce4fbfde919a9bcbf84cb4820a7c6d47cMatt Porter/* 2394b701ce4fbfde919a9bcbf84cb4820a7c6d47cMatt Porter * RapidIO interconnect services 3394b701ce4fbfde919a9bcbf84cb4820a7c6d47cMatt Porter * 4394b701ce4fbfde919a9bcbf84cb4820a7c6d47cMatt Porter * Copyright 2005 MontaVista Software, Inc. 5394b701ce4fbfde919a9bcbf84cb4820a7c6d47cMatt Porter * Matt Porter <mporter@kernel.crashing.org> 6394b701ce4fbfde919a9bcbf84cb4820a7c6d47cMatt Porter * 7394b701ce4fbfde919a9bcbf84cb4820a7c6d47cMatt Porter * This program is free software; you can redistribute it and/or modify it 8394b701ce4fbfde919a9bcbf84cb4820a7c6d47cMatt Porter * under the terms of the GNU General Public License as published by the 9394b701ce4fbfde919a9bcbf84cb4820a7c6d47cMatt Porter * Free Software Foundation; either version 2 of the License, or (at your 10394b701ce4fbfde919a9bcbf84cb4820a7c6d47cMatt Porter * option) any later version. 11394b701ce4fbfde919a9bcbf84cb4820a7c6d47cMatt Porter */ 12394b701ce4fbfde919a9bcbf84cb4820a7c6d47cMatt Porter 13394b701ce4fbfde919a9bcbf84cb4820a7c6d47cMatt Porter#include <linux/device.h> 14394b701ce4fbfde919a9bcbf84cb4820a7c6d47cMatt Porter#include <linux/list.h> 15394b701ce4fbfde919a9bcbf84cb4820a7c6d47cMatt Porter#include <linux/rio.h> 16394b701ce4fbfde919a9bcbf84cb4820a7c6d47cMatt Porter 176429cd49f45450cd77a57b70b0dfa98fe2794da0Alexandre Bounine#define RIO_MAX_CHK_RETRY 3 18a11650e11093ed57dca78bf16e7836517c599098Alexandre Bounine#define RIO_MPORT_ANY (-1) 196429cd49f45450cd77a57b70b0dfa98fe2794da0Alexandre Bounine 20394b701ce4fbfde919a9bcbf84cb4820a7c6d47cMatt Porter/* Functions internal to the RIO core code */ 21394b701ce4fbfde919a9bcbf84cb4820a7c6d47cMatt Porter 22394b701ce4fbfde919a9bcbf84cb4820a7c6d47cMatt Porterextern u32 rio_mport_get_feature(struct rio_mport *mport, int local, u16 destid, 23394b701ce4fbfde919a9bcbf84cb4820a7c6d47cMatt Porter u8 hopcount, int ftr); 24e5cabeb3d60f9cd3e3950aff071319ae0e2d08d8Alexandre Bounineextern u32 rio_mport_get_physefb(struct rio_mport *port, int local, 25e5cabeb3d60f9cd3e3950aff071319ae0e2d08d8Alexandre Bounine u16 destid, u8 hopcount); 26e5cabeb3d60f9cd3e3950aff071319ae0e2d08d8Alexandre Bounineextern u32 rio_mport_get_efb(struct rio_mport *port, int local, u16 destid, 27e5cabeb3d60f9cd3e3950aff071319ae0e2d08d8Alexandre Bounine u8 hopcount, u32 from); 28e274e0ed0a2ac31d5eaf7c891e4e1d99197517b2Alexandre Bounineextern int rio_mport_chk_dev_access(struct rio_mport *mport, u16 destid, 29e274e0ed0a2ac31d5eaf7c891e4e1d99197517b2Alexandre Bounine u8 hopcount); 30394b701ce4fbfde919a9bcbf84cb4820a7c6d47cMatt Porterextern int rio_create_sysfs_dev_files(struct rio_dev *rdev); 312ec3ba69faf301fb599e3651515e808e8efa533eAlexandre Bounineextern int rio_lock_device(struct rio_mport *port, u16 destid, 322ec3ba69faf301fb599e3651515e808e8efa533eAlexandre Bounine u8 hopcount, int wait_ms); 332ec3ba69faf301fb599e3651515e808e8efa533eAlexandre Bounineextern int rio_unlock_device(struct rio_mport *port, u16 destid, u8 hopcount); 342ec3ba69faf301fb599e3651515e808e8efa533eAlexandre Bounineextern int rio_route_add_entry(struct rio_dev *rdev, 352ec3ba69faf301fb599e3651515e808e8efa533eAlexandre Bounine u16 table, u16 route_destid, u8 route_port, int lock); 362ec3ba69faf301fb599e3651515e808e8efa533eAlexandre Bounineextern int rio_route_get_entry(struct rio_dev *rdev, u16 table, 372ec3ba69faf301fb599e3651515e808e8efa533eAlexandre Bounine u16 route_destid, u8 *route_port, int lock); 382ec3ba69faf301fb599e3651515e808e8efa533eAlexandre Bounineextern int rio_route_clr_table(struct rio_dev *rdev, u16 table, int lock); 39e5cabeb3d60f9cd3e3950aff071319ae0e2d08d8Alexandre Bounineextern int rio_set_port_lockout(struct rio_dev *rdev, u32 pnum, int lock); 40af84ca38aff94061dd0711edbb99b0900a9c28fdAlexandre Bounineextern struct rio_dev *rio_get_comptag(u32 comp_tag, struct rio_dev *from); 41a11650e11093ed57dca78bf16e7836517c599098Alexandre Bounineextern int rio_add_device(struct rio_dev *rdev); 42a11650e11093ed57dca78bf16e7836517c599098Alexandre Bounineextern int rio_enable_rx_tx_port(struct rio_mport *port, int local, u16 destid, 43a11650e11093ed57dca78bf16e7836517c599098Alexandre Bounine u8 hopcount, u8 port_num); 44a11650e11093ed57dca78bf16e7836517c599098Alexandre Bounineextern int rio_register_scan(int mport_id, struct rio_scan *scan_ops); 459edbc30b434f56258d03faac5daf37a555384db3Alexandre Bounineextern int rio_unregister_scan(int mport_id, struct rio_scan *scan_ops); 46a11650e11093ed57dca78bf16e7836517c599098Alexandre Bounineextern void rio_attach_device(struct rio_dev *rdev); 47bc8fcfea18249640f2728c46d70999dcb7e4dc49Alexandre Bounineextern struct rio_mport *rio_find_mport(int mport_id); 489edbc30b434f56258d03faac5daf37a555384db3Alexandre Bounineextern int rio_mport_scan(int mport_id); 49394b701ce4fbfde919a9bcbf84cb4820a7c6d47cMatt Porter 50394b701ce4fbfde919a9bcbf84cb4820a7c6d47cMatt Porter/* Structures internal to the RIO core code */ 516d39c80b19073e2889dabab939fe1a09584138edGreg Kroah-Hartmanextern const struct attribute_group *rio_dev_groups[]; 52ed1d2da28ea17e6f5e06111aac957d9847faff17Greg Kroah-Hartmanextern const struct attribute_group *rio_bus_groups[]; 532aaf308b95b24649a6dcfed89cd956e972089b2aAlexandre Bounineextern const struct attribute_group *rio_mport_groups[]; 54394b701ce4fbfde919a9bcbf84cb4820a7c6d47cMatt Porter 55e042323607f5c14844b1c59aebbca8d1251c7d89Zhang Wei#define RIO_GET_DID(size, x) (size ? (x & 0xffff) : ((x & 0x00ff0000) >> 16)) 56e042323607f5c14844b1c59aebbca8d1251c7d89Zhang Wei#define RIO_SET_DID(size, x) (size ? (x & 0xffff) : ((x & 0x000000ff) << 16)) 57