1#ifndef _IEEE1394_HOTPLUG_H
2#define _IEEE1394_HOTPLUG_H
3
4#include "ieee1394_core.h"
5#include "nodemgr.h"
6
7#define IEEE1394_MATCH_VENDOR_ID	0x0001
8#define IEEE1394_MATCH_MODEL_ID		0x0002
9#define IEEE1394_MATCH_SPECIFIER_ID	0x0004
10#define IEEE1394_MATCH_VERSION		0x0008
11
12struct ieee1394_device_id {
13	u32 match_flags;
14	u32 vendor_id;
15	u32 model_id;
16	u32 specifier_id;
17	u32 version;
18	void *driver_data;
19};
20
21struct hpsb_protocol_driver {
22	/* The name of the driver, e.g. SBP2 or IP1394 */
23	const char *name;
24
25	/*
26	 * The device id table describing the protocols and/or devices
27	 * supported by this driver.  This is used by the nodemgr to
28	 * decide if a driver could support a given node, but the
29	 * probe function below can implement further protocol
30	 * dependent or vendor dependent checking.
31	 */
32	struct ieee1394_device_id *id_table;
33
34	/*
35	 * The probe function is called when a device is added to the
36	 * bus and the nodemgr finds a matching entry in the drivers
37	 * device id table or when registering this driver and a
38	 * previously unhandled device can be handled.  The driver may
39	 * decline to handle the device based on further investigation
40	 * of the device (or whatever reason) in which case a negative
41	 * error code should be returned, otherwise 0 should be
42	 * returned. The driver may use the driver_data field in the
43	 * unit directory to store per device driver specific data.
44	 */
45	int (*probe)(struct unit_directory *ud);
46
47	/*
48	 * The disconnect function is called when a device is removed
49	 * from the bus or if it wasn't possible to read the guid
50	 * after the last bus reset.
51	 */
52	void (*disconnect)(struct unit_directory *ud);
53
54	/*
55	 * The update function is called when the node has just
56	 * survived a bus reset, i.e. it is still present on the bus.
57	 * However, it may be necessary to reestablish the connection
58	 * or login into the node again, depending on the protocol.
59	 */
60	void (*update)(struct unit_directory *ud);
61
62	/* Driver in list of all registered drivers */
63	struct list_head list;
64
65	/* The list of unit directories managed by this driver */
66	struct list_head unit_directories;
67};
68
69int hpsb_register_protocol(struct hpsb_protocol_driver *driver);
70void hpsb_unregister_protocol(struct hpsb_protocol_driver *driver);
71
72int hpsb_claim_unit_directory(struct unit_directory *ud,
73			      struct hpsb_protocol_driver *driver);
74void hpsb_release_unit_directory(struct unit_directory *ud);
75
76#endif /* _IEEE1394_HOTPLUG_H */
77