1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20#ifndef _IEEE1394_NODEMGR_H
21#define _IEEE1394_NODEMGR_H
22
23#include <linux/device.h>
24#include <asm/system.h>
25#include <asm/types.h>
26
27#include "ieee1394_core.h"
28#include "ieee1394_transactions.h"
29#include "ieee1394_types.h"
30
31struct csr1212_csr;
32struct csr1212_keyval;
33struct hpsb_host;
34struct ieee1394_device_id;
35
36
37
38
39struct bus_options {
40 u8 irmc;
41 u8 cmc;
42 u8 isc;
43 u8 bmc;
44 u8 pmc;
45 u8 cyc_clk_acc;
46 u8 max_rom;
47 u8 generation;
48 u8 lnkspd;
49 u16 max_rec;
50};
51
52#define UNIT_DIRECTORY_VENDOR_ID 0x01
53#define UNIT_DIRECTORY_MODEL_ID 0x02
54#define UNIT_DIRECTORY_SPECIFIER_ID 0x04
55#define UNIT_DIRECTORY_VERSION 0x08
56#define UNIT_DIRECTORY_HAS_LUN_DIRECTORY 0x10
57#define UNIT_DIRECTORY_LUN_DIRECTORY 0x20
58#define UNIT_DIRECTORY_HAS_LUN 0x40
59
60
61
62
63
64
65struct unit_directory {
66 struct node_entry *ne;
67 octlet_t address;
68 u8 flags;
69
70 quadlet_t vendor_id;
71 struct csr1212_keyval *vendor_name_kv;
72
73 quadlet_t model_id;
74 struct csr1212_keyval *model_name_kv;
75 quadlet_t specifier_id;
76 quadlet_t version;
77 quadlet_t directory_id;
78
79 unsigned int id;
80
81 int ignore_driver;
82
83 int length;
84
85 struct device device;
86 struct device unit_dev;
87
88 struct csr1212_keyval *ud_kv;
89 u32 lun;
90};
91
92struct node_entry {
93 u64 guid;
94 u32 guid_vendor_id;
95
96 struct hpsb_host *host;
97 nodeid_t nodeid;
98 struct bus_options busopt;
99 bool needs_probe;
100 unsigned int generation;
101
102
103 u32 vendor_id;
104 struct csr1212_keyval *vendor_name_kv;
105
106 u32 capabilities;
107
108 struct device device;
109 struct device node_dev;
110
111
112 bool in_limbo;
113
114 struct csr1212_csr *csr;
115};
116
117struct hpsb_protocol_driver {
118
119 const char *name;
120
121
122
123
124
125
126
127
128 const struct ieee1394_device_id *id_table;
129
130
131
132
133
134
135
136
137
138 int (*update)(struct unit_directory *ud);
139
140
141 struct device_driver driver;
142};
143
144int __hpsb_register_protocol(struct hpsb_protocol_driver *, struct module *);
145static inline int hpsb_register_protocol(struct hpsb_protocol_driver *driver)
146{
147 return __hpsb_register_protocol(driver, THIS_MODULE);
148}
149
150void hpsb_unregister_protocol(struct hpsb_protocol_driver *driver);
151
152static inline int hpsb_node_entry_valid(struct node_entry *ne)
153{
154 return ne->generation == get_hpsb_generation(ne->host);
155}
156void hpsb_node_fill_packet(struct node_entry *ne, struct hpsb_packet *packet);
157int hpsb_node_write(struct node_entry *ne, u64 addr,
158 quadlet_t *buffer, size_t length);
159static inline int hpsb_node_read(struct node_entry *ne, u64 addr,
160 quadlet_t *buffer, size_t length)
161{
162 unsigned int g = ne->generation;
163
164 smp_rmb();
165 return hpsb_read(ne->host, ne->nodeid, g, addr, buffer, length);
166}
167static inline int hpsb_node_lock(struct node_entry *ne, u64 addr, int extcode,
168 quadlet_t *buffer, quadlet_t arg)
169{
170 unsigned int g = ne->generation;
171
172 smp_rmb();
173 return hpsb_lock(ne->host, ne->nodeid, g, addr, extcode, buffer, arg);
174}
175int nodemgr_for_each_host(void *data, int (*cb)(struct hpsb_host *, void *));
176
177int init_ieee1394_nodemgr(void);
178void cleanup_ieee1394_nodemgr(void);
179
180
181extern struct device nodemgr_dev_template_host;
182
183
184extern struct bus_attribute *const fw_bus_attrs[];
185
186#endif
187