1
2 #ifndef IEEE1394_HIGHLEVEL_H
3 #define IEEE1394_HIGHLEVEL_H
4
5
6 struct hpsb_highlevel {
7 struct list_head hl_list;
8
9 /* List of hpsb_address_serve. */
10 struct list_head addr_list;
11
12 const char *name;
13 struct hpsb_highlevel_ops *op;
14 };
15
16
17 struct hpsb_address_serve {
18 struct list_head as_list; /* global list */
19
20 struct list_head addr_list; /* hpsb_highlevel list */
21
22 struct hpsb_address_ops *op;
23
24 /* first address handled and first address behind, quadlet aligned */
25 u64 start, end;
26 };
27
28
29 /*
30 * The above structs are internal to highlevel driver handling. Only the
31 * following structures are of interest to actual highlevel drivers.
32 */
33
34 struct hpsb_highlevel_ops {
35 /* Any of the following pointers can legally be NULL, except for
36 * iso_receive which can only be NULL when you don't request
37 * channels. */
38
39 /* New host initialized. Will also be called during
40 * hpsb_register_highlevel for all hosts already installed. */
41 void (*add_host) (struct hpsb_host *host);
42
43 /* Host about to be removed. Will also be called during
44 * hpsb_unregister_highlevel once for each host. */
45 void (*remove_host) (struct hpsb_host *host);
46
47 /* Host experienced bus reset with possible configuration changes. Note
48 * that this one may occur during interrupt/bottom half handling. You
49 * can not expect to be able to do stock hpsb_reads. */
50 void (*host_reset) (struct hpsb_host *host);
51
52 /* An isochronous packet was received. Channel contains the channel
53 * number for your convenience, it is also contained in the included
54 * packet header (first quadlet, CRCs are missing). You may get called
55 * for channel/host combinations you did not request. */
56 void (*iso_receive) (struct hpsb_host *host, int channel,
57 quadlet_t *data, unsigned int length);
58
59 /* A write request was received on either the FCP_COMMAND (direction =
60 * 0) or the FCP_RESPONSE (direction = 1) register. The cts arg
61 * contains the cts field (first byte of data).
62 */
63 void (*fcp_request) (struct hpsb_host *host, int nodeid, int direction,
64 int cts, u8 *data, unsigned int length);
65 };
66
67 struct hpsb_address_ops {
68 /*
69 * Null function pointers will make the respective operation complete
70 * with RCODE_TYPE_ERROR. Makes for easy to implement read-only
71 * registers (just leave everything but read NULL).
72 *
73 * All functions shall return appropriate IEEE 1394 rcodes.
74 */
75
76 /* These functions have to implement block reads for themselves. */
77 int (*read) (struct hpsb_host *host, int nodeid, quadlet_t *buffer,
78 u64 addr, unsigned int length);
79 int (*write) (struct hpsb_host *host, int nodeid, quadlet_t *data,
80 u64 addr, unsigned int length);
81
82 /* Lock transactions: write results of ext_tcode operation into
83 * *store. */
84 int (*lock) (struct hpsb_host *host, int nodeid, quadlet_t *store,
85 u64 addr, quadlet_t data, quadlet_t arg, int ext_tcode);
86 int (*lock64) (struct hpsb_host *host, int nodeid, octlet_t *store,
87 u64 addr, octlet_t data, octlet_t arg, int ext_tcode);
88 };
89
90
91 void init_hpsb_highlevel(void);
92
93 void highlevel_add_host(struct hpsb_host *host);
94 void highlevel_remove_host(struct hpsb_host *host);
95 void highlevel_host_reset(struct hpsb_host *host);
96
97 int highlevel_read(struct hpsb_host *host, int nodeid, quadlet_t *buffer,
98 u64 addr, unsigned int length);
99 int highlevel_write(struct hpsb_host *host, int nodeid, quadlet_t *data,
100 u64 addr, unsigned int length);
101 int highlevel_lock(struct hpsb_host *host, int nodeid, quadlet_t *store,
102 u64 addr, quadlet_t data, quadlet_t arg, int ext_tcode);
103 int highlevel_lock64(struct hpsb_host *host, int nodeid, octlet_t *store,
104 u64 addr, octlet_t data, octlet_t arg, int ext_tcode);
105
106 void highlevel_iso_receive(struct hpsb_host *host, quadlet_t *data,
107 unsigned int length);
108 void highlevel_fcp_request(struct hpsb_host *host, int nodeid, int direction,
109 u8 *data, unsigned int length);
110
111
112 /*
113 * Register highlevel driver. The name pointer has to stay valid at all times
114 * because the string is not copied.
115 */
116 struct hpsb_highlevel *hpsb_register_highlevel(const char *name,
117 struct hpsb_highlevel_ops *ops);
118 void hpsb_unregister_highlevel(struct hpsb_highlevel *hl);
119
120 /*
121 * Register handlers for host address spaces. Start and end are 48 bit pointers
122 * and have to be quadlet aligned (end points to the first address behind the
123 * handled addresses. This function can be called multiple times for a single
124 * hpsb_highlevel to implement sparse register sets. The requested region must
125 * not overlap any previously allocated region, otherwise registering will fail.
126 *
127 * It returns true for successful allocation. There is no unregister function,
128 * all address spaces are deallocated together with the hpsb_highlevel.
129 */
130 int hpsb_register_addrspace(struct hpsb_highlevel *hl,
131 struct hpsb_address_ops *ops, u64 start, u64 end);
132
133 /*
134 * Enable or disable receving a certain isochronous channel through the
135 * iso_receive op.
136 */
137 void hpsb_listen_channel(struct hpsb_highlevel *hl, struct hpsb_host *host,
138 unsigned int channel);
139 void hpsb_unlisten_channel(struct hpsb_highlevel *hl, struct hpsb_host *host,
140 unsigned int channel);
141
142 #endif /* IEEE1394_HIGHLEVEL_H */
143
This page was automatically generated by the
LXR engine.
Visit the LXR main site for more
information.