xref: /linux/include/linux/rio.h (revision 59f9996555542f901f2d01ccab5c0612c8c5c480)
170a50ebdSMatt Porter /*
270a50ebdSMatt Porter  * RapidIO interconnect services
370a50ebdSMatt Porter  * (RapidIO Interconnect Specification, http://www.rapidio.org)
470a50ebdSMatt Porter  *
570a50ebdSMatt Porter  * Copyright 2005 MontaVista Software, Inc.
670a50ebdSMatt Porter  * Matt Porter <mporter@kernel.crashing.org>
770a50ebdSMatt Porter  *
870a50ebdSMatt Porter  * This program is free software; you can redistribute  it and/or modify it
970a50ebdSMatt Porter  * under  the terms of  the GNU General  Public License as published by the
1070a50ebdSMatt Porter  * Free Software Foundation;  either version 2 of the  License, or (at your
1170a50ebdSMatt Porter  * option) any later version.
1270a50ebdSMatt Porter  */
1370a50ebdSMatt Porter 
1470a50ebdSMatt Porter #ifndef LINUX_RIO_H
1570a50ebdSMatt Porter #define LINUX_RIO_H
1670a50ebdSMatt Porter 
1770a50ebdSMatt Porter #include <linux/types.h>
1870a50ebdSMatt Porter #include <linux/ioport.h>
1970a50ebdSMatt Porter #include <linux/list.h>
2070a50ebdSMatt Porter #include <linux/errno.h>
2170a50ebdSMatt Porter #include <linux/device.h>
2270a50ebdSMatt Porter #include <linux/rio_regs.h>
2370a50ebdSMatt Porter 
2470a50ebdSMatt Porter #define RIO_NO_HOPCOUNT		-1
25c70555b0SAlexandre Bounine #define RIO_INVALID_DESTID	0xffff
2670a50ebdSMatt Porter 
27569fccb6SAlexandre Bounine #define RIO_MAX_MPORTS		8
2870a50ebdSMatt Porter #define RIO_MAX_MPORT_RESOURCES	16
2970a50ebdSMatt Porter #define RIO_MAX_DEV_RESOURCES	16
3070a50ebdSMatt Porter 
3170a50ebdSMatt Porter #define RIO_GLOBAL_TABLE	0xff	/* Indicates access of a switch's
3270a50ebdSMatt Porter 					   global routing table if it
3370a50ebdSMatt Porter 					   has multiple (or per port)
3470a50ebdSMatt Porter 					   tables */
3570a50ebdSMatt Porter 
3670a50ebdSMatt Porter #define RIO_INVALID_ROUTE	0xff	/* Indicates that a route table
3770a50ebdSMatt Porter 					   entry is invalid (no route
3870a50ebdSMatt Porter 					   exists for the device ID) */
3970a50ebdSMatt Porter 
40e0423236SZhang Wei #define RIO_MAX_ROUTE_ENTRIES(size)	(size ? (1 << 16) : (1 << 8))
41e0423236SZhang Wei #define RIO_ANY_DESTID(size)		(size ? 0xffff : 0xff)
4270a50ebdSMatt Porter 
4370a50ebdSMatt Porter #define RIO_MAX_MBOX		4
4470a50ebdSMatt Porter #define RIO_MAX_MSG_SIZE	0x1000
4570a50ebdSMatt Porter 
4670a50ebdSMatt Porter /*
4770a50ebdSMatt Porter  * Error values that may be returned by RIO functions.
4870a50ebdSMatt Porter  */
4970a50ebdSMatt Porter #define RIO_SUCCESSFUL			0x00
5070a50ebdSMatt Porter #define RIO_BAD_SIZE			0x81
5170a50ebdSMatt Porter 
5270a50ebdSMatt Porter /*
5370a50ebdSMatt Porter  * For RIO devices, the region numbers are assigned this way:
5470a50ebdSMatt Porter  *
5570a50ebdSMatt Porter  *	0	RapidIO outbound doorbells
5670a50ebdSMatt Porter  *      1-15	RapidIO memory regions
5770a50ebdSMatt Porter  *
5870a50ebdSMatt Porter  * For RIO master ports, the region number are assigned this way:
5970a50ebdSMatt Porter  *
6070a50ebdSMatt Porter  *	0	RapidIO inbound doorbells
6170a50ebdSMatt Porter  *	1	RapidIO inbound mailboxes
6270a50ebdSMatt Porter  *	1	RapidIO outbound mailboxes
6370a50ebdSMatt Porter  */
6470a50ebdSMatt Porter #define RIO_DOORBELL_RESOURCE	0
6570a50ebdSMatt Porter #define RIO_INB_MBOX_RESOURCE	1
6670a50ebdSMatt Porter #define RIO_OUTB_MBOX_RESOURCE	2
6770a50ebdSMatt Porter 
68e5cabeb3SAlexandre Bounine #define RIO_PW_MSG_SIZE		64
69e5cabeb3SAlexandre Bounine 
70e6536927SAlexandre Bounine /*
71e6536927SAlexandre Bounine  * A component tag value (stored in the component tag CSR) is used as device's
72e6536927SAlexandre Bounine  * unique identifier assigned during enumeration. Besides being used for
73e6536927SAlexandre Bounine  * identifying switches (which do not have device ID register), it also is used
74e6536927SAlexandre Bounine  * by error management notification and therefore has to be assigned
75e6536927SAlexandre Bounine  * to endpoints as well.
76e6536927SAlexandre Bounine  */
77e6536927SAlexandre Bounine #define RIO_CTAG_RESRVD	0xfffe0000 /* Reserved */
78e6536927SAlexandre Bounine #define RIO_CTAG_UDEVID	0x0001ffff /* Unique device identifier */
79e6536927SAlexandre Bounine 
8070a50ebdSMatt Porter extern struct bus_type rio_bus_type;
812c70f022SAlexandre Bounine extern struct device rio_bus;
8270a50ebdSMatt Porter extern struct list_head rio_devices;	/* list of all devices */
8370a50ebdSMatt Porter 
8470a50ebdSMatt Porter struct rio_mport;
85ded05782SAlexandre Bounine struct rio_dev;
86e5cabeb3SAlexandre Bounine union rio_pw_msg;
8770a50ebdSMatt Porter 
8870a50ebdSMatt Porter /**
89ded05782SAlexandre Bounine  * struct rio_switch - RIO switch info
90ded05782SAlexandre Bounine  * @node: Node in global list of switches
91ded05782SAlexandre Bounine  * @switchid: Switch ID that is unique across a network
92ded05782SAlexandre Bounine  * @route_table: Copy of switch routing table
93ded05782SAlexandre Bounine  * @port_ok: Status of each port (one bit per port) - OK=1 or UNINIT=0
94ded05782SAlexandre Bounine  * @add_entry: Callback for switch-specific route add function
95ded05782SAlexandre Bounine  * @get_entry: Callback for switch-specific route get function
96ded05782SAlexandre Bounine  * @clr_table: Callback for switch-specific clear route table function
97ded05782SAlexandre Bounine  * @set_domain: Callback for switch-specific domain setting function
98ded05782SAlexandre Bounine  * @get_domain: Callback for switch-specific domain get function
99ded05782SAlexandre Bounine  * @em_init: Callback for switch-specific error management init function
100ded05782SAlexandre Bounine  * @em_handle: Callback for switch-specific error management handler function
101ded05782SAlexandre Bounine  * @sw_sysfs: Callback that initializes switch-specific sysfs attributes
102ded05782SAlexandre Bounine  * @nextdev: Array of per-port pointers to the next attached device
103ded05782SAlexandre Bounine  */
104ded05782SAlexandre Bounine struct rio_switch {
105ded05782SAlexandre Bounine 	struct list_head node;
106ded05782SAlexandre Bounine 	u16 switchid;
107ded05782SAlexandre Bounine 	u8 *route_table;
108ded05782SAlexandre Bounine 	u32 port_ok;
109ded05782SAlexandre Bounine 	int (*add_entry) (struct rio_mport *mport, u16 destid, u8 hopcount,
110ded05782SAlexandre Bounine 			  u16 table, u16 route_destid, u8 route_port);
111ded05782SAlexandre Bounine 	int (*get_entry) (struct rio_mport *mport, u16 destid, u8 hopcount,
112ded05782SAlexandre Bounine 			  u16 table, u16 route_destid, u8 *route_port);
113ded05782SAlexandre Bounine 	int (*clr_table) (struct rio_mport *mport, u16 destid, u8 hopcount,
114ded05782SAlexandre Bounine 			  u16 table);
115ded05782SAlexandre Bounine 	int (*set_domain) (struct rio_mport *mport, u16 destid, u8 hopcount,
116ded05782SAlexandre Bounine 			   u8 sw_domain);
117ded05782SAlexandre Bounine 	int (*get_domain) (struct rio_mport *mport, u16 destid, u8 hopcount,
118ded05782SAlexandre Bounine 			   u8 *sw_domain);
119ded05782SAlexandre Bounine 	int (*em_init) (struct rio_dev *dev);
120ded05782SAlexandre Bounine 	int (*em_handle) (struct rio_dev *dev, u8 swport);
121ded05782SAlexandre Bounine 	int (*sw_sysfs) (struct rio_dev *dev, int create);
122ded05782SAlexandre Bounine 	struct rio_dev *nextdev[0];
123ded05782SAlexandre Bounine };
124ded05782SAlexandre Bounine 
125ded05782SAlexandre Bounine /**
12670a50ebdSMatt Porter  * struct rio_dev - RIO device info
12770a50ebdSMatt Porter  * @global_list: Node in list of all RIO devices
12870a50ebdSMatt Porter  * @net_list: Node in list of RIO devices in a network
12970a50ebdSMatt Porter  * @net: Network this device is a part of
13070a50ebdSMatt Porter  * @did: Device ID
13170a50ebdSMatt Porter  * @vid: Vendor ID
13270a50ebdSMatt Porter  * @device_rev: Device revision
13370a50ebdSMatt Porter  * @asm_did: Assembly device ID
13470a50ebdSMatt Porter  * @asm_vid: Assembly vendor ID
13570a50ebdSMatt Porter  * @asm_rev: Assembly revision
13670a50ebdSMatt Porter  * @efptr: Extended feature pointer
13770a50ebdSMatt Porter  * @pef: Processing element features
13870a50ebdSMatt Porter  * @swpinfo: Switch port info
13970a50ebdSMatt Porter  * @src_ops: Source operation capabilities
14070a50ebdSMatt Porter  * @dst_ops: Destination operation capabilities
14197ef6f74SRandy Dunlap  * @comp_tag: RIO component tag
14297ef6f74SRandy Dunlap  * @phys_efptr: RIO device extended features pointer
14397ef6f74SRandy Dunlap  * @em_efptr: RIO Error Management features pointer
144fa78cc51SMatt Porter  * @dma_mask: Mask of bits of RIO address this device implements
14570a50ebdSMatt Porter  * @driver: Driver claiming this device
14670a50ebdSMatt Porter  * @dev: Device model device
14770a50ebdSMatt Porter  * @riores: RIO resources this device owns
14897ef6f74SRandy Dunlap  * @pwcback: port-write callback function for this device
149a93192a5SAlexandre Bounine  * @destid: Network destination ID (or associated destid for switch)
150a93192a5SAlexandre Bounine  * @hopcount: Hopcount to this device
15168fe4df5SAlexandre Bounine  * @prev: Previous RIO device connected to the current one
152ded05782SAlexandre Bounine  * @rswitch: struct rio_switch (if valid for this device)
15370a50ebdSMatt Porter  */
15470a50ebdSMatt Porter struct rio_dev {
15570a50ebdSMatt Porter 	struct list_head global_list;	/* node in list of all RIO devices */
15670a50ebdSMatt Porter 	struct list_head net_list;	/* node in per net list */
15770a50ebdSMatt Porter 	struct rio_net *net;	/* RIO net this device resides in */
15870a50ebdSMatt Porter 	u16 did;
15970a50ebdSMatt Porter 	u16 vid;
16070a50ebdSMatt Porter 	u32 device_rev;
16170a50ebdSMatt Porter 	u16 asm_did;
16270a50ebdSMatt Porter 	u16 asm_vid;
16370a50ebdSMatt Porter 	u16 asm_rev;
16470a50ebdSMatt Porter 	u16 efptr;
16570a50ebdSMatt Porter 	u32 pef;
166ae05cbd5SAlexandre Bounine 	u32 swpinfo;
16770a50ebdSMatt Porter 	u32 src_ops;
16870a50ebdSMatt Porter 	u32 dst_ops;
169e5cabeb3SAlexandre Bounine 	u32 comp_tag;
170e5cabeb3SAlexandre Bounine 	u32 phys_efptr;
171e5cabeb3SAlexandre Bounine 	u32 em_efptr;
172fa78cc51SMatt Porter 	u64 dma_mask;
17370a50ebdSMatt Porter 	struct rio_driver *driver;	/* RIO driver claiming this device */
17470a50ebdSMatt Porter 	struct device dev;	/* LDM device structure */
17570a50ebdSMatt Porter 	struct resource riores[RIO_MAX_DEV_RESOURCES];
176e5cabeb3SAlexandre Bounine 	int (*pwcback) (struct rio_dev *rdev, union rio_pw_msg *msg, int step);
17770a50ebdSMatt Porter 	u16 destid;
178a93192a5SAlexandre Bounine 	u8 hopcount;
17968fe4df5SAlexandre Bounine 	struct rio_dev *prev;
180ded05782SAlexandre Bounine 	struct rio_switch rswitch[0];	/* RIO switch info */
18170a50ebdSMatt Porter };
18270a50ebdSMatt Porter 
18370a50ebdSMatt Porter #define rio_dev_g(n) list_entry(n, struct rio_dev, global_list)
18470a50ebdSMatt Porter #define rio_dev_f(n) list_entry(n, struct rio_dev, net_list)
18570a50ebdSMatt Porter #define	to_rio_dev(n) container_of(n, struct rio_dev, dev)
186ded05782SAlexandre Bounine #define sw_to_rio_dev(n) container_of(n, struct rio_dev, rswitch[0])
18770a50ebdSMatt Porter 
18870a50ebdSMatt Porter /**
18970a50ebdSMatt Porter  * struct rio_msg - RIO message event
19070a50ebdSMatt Porter  * @res: Mailbox resource
19170a50ebdSMatt Porter  * @mcback: Message event callback
19270a50ebdSMatt Porter  */
19370a50ebdSMatt Porter struct rio_msg {
19470a50ebdSMatt Porter 	struct resource *res;
1956978bbc0SMatt Porter 	void (*mcback) (struct rio_mport * mport, void *dev_id, int mbox, int slot);
19670a50ebdSMatt Porter };
19770a50ebdSMatt Porter 
19870a50ebdSMatt Porter /**
19970a50ebdSMatt Porter  * struct rio_dbell - RIO doorbell event
20070a50ebdSMatt Porter  * @node: Node in list of doorbell events
20170a50ebdSMatt Porter  * @res: Doorbell resource
20270a50ebdSMatt Porter  * @dinb: Doorbell event callback
2036978bbc0SMatt Porter  * @dev_id: Device specific pointer to pass on event
20470a50ebdSMatt Porter  */
20570a50ebdSMatt Porter struct rio_dbell {
20670a50ebdSMatt Porter 	struct list_head node;
20770a50ebdSMatt Porter 	struct resource *res;
2086978bbc0SMatt Porter 	void (*dinb) (struct rio_mport *mport, void *dev_id, u16 src, u16 dst, u16 info);
2096978bbc0SMatt Porter 	void *dev_id;
21070a50ebdSMatt Porter };
21170a50ebdSMatt Porter 
21261b26917SZhang Wei enum rio_phy_type {
21361b26917SZhang Wei 	RIO_PHY_PARALLEL,
21461b26917SZhang Wei 	RIO_PHY_SERIAL,
21561b26917SZhang Wei };
21661b26917SZhang Wei 
21770a50ebdSMatt Porter /**
21870a50ebdSMatt Porter  * struct rio_mport - RIO master port info
21970a50ebdSMatt Porter  * @dbells: List of doorbell events
22070a50ebdSMatt Porter  * @node: Node in global list of master ports
22170a50ebdSMatt Porter  * @nnode: Node in network list of master ports
22270a50ebdSMatt Porter  * @iores: I/O mem resource that this master port interface owns
22370a50ebdSMatt Porter  * @riores: RIO resources that this master port interfaces owns
22470a50ebdSMatt Porter  * @inb_msg: RIO inbound message event descriptors
22570a50ebdSMatt Porter  * @outb_msg: RIO outbound message event descriptors
22670a50ebdSMatt Porter  * @host_deviceid: Host device ID associated with this master port
22770a50ebdSMatt Porter  * @ops: configuration space functions
22870a50ebdSMatt Porter  * @id: Port ID, unique among all ports
22970a50ebdSMatt Porter  * @index: Port index, unique among all port interfaces of the same type
2309941d945SRandy Dunlap  * @sys_size: RapidIO common transport system size
2319941d945SRandy Dunlap  * @phy_type: RapidIO phy type
232af84ca38SAlexandre Bounine  * @phys_efptr: RIO port extended features pointer
23370a50ebdSMatt Porter  * @name: Port name string
234ad1e9380SZhang Wei  * @priv: Master port private data
23570a50ebdSMatt Porter  */
23670a50ebdSMatt Porter struct rio_mport {
23770a50ebdSMatt Porter 	struct list_head dbells;	/* list of doorbell events */
23870a50ebdSMatt Porter 	struct list_head node;	/* node in global list of ports */
23970a50ebdSMatt Porter 	struct list_head nnode;	/* node in net list of ports */
24070a50ebdSMatt Porter 	struct resource iores;
24170a50ebdSMatt Porter 	struct resource riores[RIO_MAX_MPORT_RESOURCES];
24270a50ebdSMatt Porter 	struct rio_msg inb_msg[RIO_MAX_MBOX];
24370a50ebdSMatt Porter 	struct rio_msg outb_msg[RIO_MAX_MBOX];
24470a50ebdSMatt Porter 	int host_deviceid;	/* Host device ID */
245f8f06269SAlexandre Bounine 	struct rio_ops *ops;	/* low-level architecture-dependent routines */
24670a50ebdSMatt Porter 	unsigned char id;	/* port ID, unique among all ports */
24770a50ebdSMatt Porter 	unsigned char index;	/* port index, unique among all port
24870a50ebdSMatt Porter 				   interfaces of the same type */
249e0423236SZhang Wei 	unsigned int sys_size;	/* RapidIO common transport system size.
250e0423236SZhang Wei 				 * 0 - Small size. 256 devices.
251e0423236SZhang Wei 				 * 1 - Large size, 65536 devices.
252e0423236SZhang Wei 				 */
25361b26917SZhang Wei 	enum rio_phy_type phy_type;	/* RapidIO phy type */
254af84ca38SAlexandre Bounine 	u32 phys_efptr;
25570a50ebdSMatt Porter 	unsigned char name[40];
256ad1e9380SZhang Wei 	void *priv;		/* Master port private data */
25770a50ebdSMatt Porter };
25870a50ebdSMatt Porter 
25970a50ebdSMatt Porter /**
26070a50ebdSMatt Porter  * struct rio_net - RIO network info
26170a50ebdSMatt Porter  * @node: Node in global list of RIO networks
26270a50ebdSMatt Porter  * @devices: List of devices in this network
26370a50ebdSMatt Porter  * @mports: List of master ports accessing this network
26470a50ebdSMatt Porter  * @hport: Default port for accessing this network
26570a50ebdSMatt Porter  * @id: RIO network ID
26670a50ebdSMatt Porter  */
26770a50ebdSMatt Porter struct rio_net {
26870a50ebdSMatt Porter 	struct list_head node;	/* node in list of networks */
26970a50ebdSMatt Porter 	struct list_head devices;	/* list of devices in this net */
27070a50ebdSMatt Porter 	struct list_head mports;	/* list of ports accessing net */
27170a50ebdSMatt Porter 	struct rio_mport *hport;	/* primary port for accessing net */
27270a50ebdSMatt Porter 	unsigned char id;	/* RIO network ID */
27370a50ebdSMatt Porter };
27470a50ebdSMatt Porter 
275ac38d723SAlexandre Bounine /* Definitions used by switch sysfs initialization callback */
276ac38d723SAlexandre Bounine #define RIO_SW_SYSFS_CREATE	1	/* Create switch attributes */
277ac38d723SAlexandre Bounine #define RIO_SW_SYSFS_REMOVE	0	/* Remove switch attributes */
278ac38d723SAlexandre Bounine 
27970a50ebdSMatt Porter /* Low-level architecture-dependent routines */
28070a50ebdSMatt Porter 
28170a50ebdSMatt Porter /**
28270a50ebdSMatt Porter  * struct rio_ops - Low-level RIO configuration space operations
28370a50ebdSMatt Porter  * @lcread: Callback to perform local (master port) read of config space.
28470a50ebdSMatt Porter  * @lcwrite: Callback to perform local (master port) write of config space.
28570a50ebdSMatt Porter  * @cread: Callback to perform network read of config space.
28670a50ebdSMatt Porter  * @cwrite: Callback to perform network write of config space.
28770a50ebdSMatt Porter  * @dsend: Callback to send a doorbell message.
288e5cabeb3SAlexandre Bounine  * @pwenable: Callback to enable/disable port-write message handling.
289f8f06269SAlexandre Bounine  * @open_outb_mbox: Callback to initialize outbound mailbox.
290f8f06269SAlexandre Bounine  * @close_outb_mbox: Callback to shut down outbound mailbox.
291f8f06269SAlexandre Bounine  * @open_inb_mbox: Callback to initialize inbound mailbox.
292f8f06269SAlexandre Bounine  * @close_inb_mbox: Callback to	shut down inbound mailbox.
293f8f06269SAlexandre Bounine  * @add_outb_message: Callback to add a message to an outbound mailbox queue.
294f8f06269SAlexandre Bounine  * @add_inb_buffer: Callback to	add a buffer to an inbound mailbox queue.
295f8f06269SAlexandre Bounine  * @get_inb_message: Callback to get a message from an inbound mailbox queue.
29670a50ebdSMatt Porter  */
29770a50ebdSMatt Porter struct rio_ops {
298ad1e9380SZhang Wei 	int (*lcread) (struct rio_mport *mport, int index, u32 offset, int len,
29970a50ebdSMatt Porter 			u32 *data);
300ad1e9380SZhang Wei 	int (*lcwrite) (struct rio_mport *mport, int index, u32 offset, int len,
30170a50ebdSMatt Porter 			u32 data);
302ad1e9380SZhang Wei 	int (*cread) (struct rio_mport *mport, int index, u16 destid,
303ad1e9380SZhang Wei 			u8 hopcount, u32 offset, int len, u32 *data);
304ad1e9380SZhang Wei 	int (*cwrite) (struct rio_mport *mport, int index, u16 destid,
305ad1e9380SZhang Wei 			u8 hopcount, u32 offset, int len, u32 data);
306ad1e9380SZhang Wei 	int (*dsend) (struct rio_mport *mport, int index, u16 destid, u16 data);
307e5cabeb3SAlexandre Bounine 	int (*pwenable) (struct rio_mport *mport, int enable);
308f8f06269SAlexandre Bounine 	int (*open_outb_mbox)(struct rio_mport *mport, void *dev_id,
309f8f06269SAlexandre Bounine 			      int mbox, int entries);
310f8f06269SAlexandre Bounine 	void (*close_outb_mbox)(struct rio_mport *mport, int mbox);
311f8f06269SAlexandre Bounine 	int  (*open_inb_mbox)(struct rio_mport *mport, void *dev_id,
312f8f06269SAlexandre Bounine 			     int mbox, int entries);
313f8f06269SAlexandre Bounine 	void (*close_inb_mbox)(struct rio_mport *mport, int mbox);
314f8f06269SAlexandre Bounine 	int  (*add_outb_message)(struct rio_mport *mport, struct rio_dev *rdev,
315f8f06269SAlexandre Bounine 				 int mbox, void *buffer, size_t len);
316f8f06269SAlexandre Bounine 	int (*add_inb_buffer)(struct rio_mport *mport, int mbox, void *buf);
317f8f06269SAlexandre Bounine 	void *(*get_inb_message)(struct rio_mport *mport, int mbox);
31870a50ebdSMatt Porter };
31970a50ebdSMatt Porter 
32070a50ebdSMatt Porter #define RIO_RESOURCE_MEM	0x00000100
32170a50ebdSMatt Porter #define RIO_RESOURCE_DOORBELL	0x00000200
32270a50ebdSMatt Porter #define RIO_RESOURCE_MAILBOX	0x00000400
32370a50ebdSMatt Porter 
32470a50ebdSMatt Porter #define RIO_RESOURCE_CACHEABLE	0x00010000
32570a50ebdSMatt Porter #define RIO_RESOURCE_PCI	0x00020000
32670a50ebdSMatt Porter 
32770a50ebdSMatt Porter #define RIO_RESOURCE_BUSY	0x80000000
32870a50ebdSMatt Porter 
32970a50ebdSMatt Porter /**
33070a50ebdSMatt Porter  * struct rio_driver - RIO driver info
33170a50ebdSMatt Porter  * @node: Node in list of drivers
33270a50ebdSMatt Porter  * @name: RIO driver name
33370a50ebdSMatt Porter  * @id_table: RIO device ids to be associated with this driver
33470a50ebdSMatt Porter  * @probe: RIO device inserted
33570a50ebdSMatt Porter  * @remove: RIO device removed
33670a50ebdSMatt Porter  * @suspend: RIO device suspended
33770a50ebdSMatt Porter  * @resume: RIO device awakened
33870a50ebdSMatt Porter  * @enable_wake: RIO device enable wake event
33970a50ebdSMatt Porter  * @driver: LDM driver struct
34070a50ebdSMatt Porter  *
34170a50ebdSMatt Porter  * Provides info on a RIO device driver for insertion/removal and
34270a50ebdSMatt Porter  * power management purposes.
34370a50ebdSMatt Porter  */
34470a50ebdSMatt Porter struct rio_driver {
34570a50ebdSMatt Porter 	struct list_head node;
34670a50ebdSMatt Porter 	char *name;
34770a50ebdSMatt Porter 	const struct rio_device_id *id_table;
34870a50ebdSMatt Porter 	int (*probe) (struct rio_dev * dev, const struct rio_device_id * id);
34970a50ebdSMatt Porter 	void (*remove) (struct rio_dev * dev);
35070a50ebdSMatt Porter 	int (*suspend) (struct rio_dev * dev, u32 state);
35170a50ebdSMatt Porter 	int (*resume) (struct rio_dev * dev);
35270a50ebdSMatt Porter 	int (*enable_wake) (struct rio_dev * dev, u32 state, int enable);
35370a50ebdSMatt Porter 	struct device_driver driver;
35470a50ebdSMatt Porter };
35570a50ebdSMatt Porter 
35670a50ebdSMatt Porter #define	to_rio_driver(drv) container_of(drv,struct rio_driver, driver)
35770a50ebdSMatt Porter 
35870a50ebdSMatt Porter /**
35970a50ebdSMatt Porter  * struct rio_device_id - RIO device identifier
36070a50ebdSMatt Porter  * @did: RIO device ID
36170a50ebdSMatt Porter  * @vid: RIO vendor ID
36270a50ebdSMatt Porter  * @asm_did: RIO assembly device ID
36370a50ebdSMatt Porter  * @asm_vid: RIO assembly vendor ID
36470a50ebdSMatt Porter  *
36570a50ebdSMatt Porter  * Identifies a RIO device based on both the device/vendor IDs and
36670a50ebdSMatt Porter  * the assembly device/vendor IDs.
36770a50ebdSMatt Porter  */
36870a50ebdSMatt Porter struct rio_device_id {
36970a50ebdSMatt Porter 	u16 did, vid;
37070a50ebdSMatt Porter 	u16 asm_did, asm_vid;
37170a50ebdSMatt Porter };
37270a50ebdSMatt Porter 
37370a50ebdSMatt Porter /**
374058f88d6SAlexandre Bounine  * struct rio_switch_ops - Per-switch operations
37570a50ebdSMatt Porter  * @vid: RIO vendor ID
37670a50ebdSMatt Porter  * @did: RIO device ID
377058f88d6SAlexandre Bounine  * @init_hook: Callback that performs switch device initialization
37870a50ebdSMatt Porter  *
379058f88d6SAlexandre Bounine  * Defines the operations that are necessary to initialize/control
380058f88d6SAlexandre Bounine  * a particular RIO switch device.
38170a50ebdSMatt Porter  */
382058f88d6SAlexandre Bounine struct rio_switch_ops {
38370a50ebdSMatt Porter 	u16 vid, did;
384058f88d6SAlexandre Bounine 	int (*init_hook) (struct rio_dev *rdev, int do_enum);
385e5cabeb3SAlexandre Bounine };
386e5cabeb3SAlexandre Bounine 
387e5cabeb3SAlexandre Bounine union rio_pw_msg {
388e5cabeb3SAlexandre Bounine 	struct {
389e5cabeb3SAlexandre Bounine 		u32 comptag;	/* Component Tag CSR */
390e5cabeb3SAlexandre Bounine 		u32 errdetect;	/* Port N Error Detect CSR */
391e5cabeb3SAlexandre Bounine 		u32 is_port;	/* Implementation specific + PortID */
392e5cabeb3SAlexandre Bounine 		u32 ltlerrdet;	/* LTL Error Detect CSR */
393e5cabeb3SAlexandre Bounine 		u32 padding[12];
394e5cabeb3SAlexandre Bounine 	} em;
395e5cabeb3SAlexandre Bounine 	u32 raw[RIO_PW_MSG_SIZE/sizeof(u32)];
396e5cabeb3SAlexandre Bounine };
397e5cabeb3SAlexandre Bounine 
39870a50ebdSMatt Porter /* Architecture and hardware-specific functions */
399*59f99965SAlexandre Bounine extern int rio_register_mport(struct rio_mport *);
4006978bbc0SMatt Porter extern int rio_open_inb_mbox(struct rio_mport *, void *, int, int);
40170a50ebdSMatt Porter extern void rio_close_inb_mbox(struct rio_mport *, int);
4026978bbc0SMatt Porter extern int rio_open_outb_mbox(struct rio_mport *, void *, int, int);
40370a50ebdSMatt Porter extern void rio_close_outb_mbox(struct rio_mport *, int);
40470a50ebdSMatt Porter 
40570a50ebdSMatt Porter #endif				/* LINUX_RIO_H */
406