aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ieee1394/highlevel.h
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/ieee1394/highlevel.h')
-rw-r--r--drivers/ieee1394/highlevel.h201
1 files changed, 104 insertions, 97 deletions
diff --git a/drivers/ieee1394/highlevel.h b/drivers/ieee1394/highlevel.h
index e119fb87e5b5..50f2dd2c7e20 100644
--- a/drivers/ieee1394/highlevel.h
+++ b/drivers/ieee1394/highlevel.h
@@ -1,60 +1,61 @@
1
2#ifndef IEEE1394_HIGHLEVEL_H 1#ifndef IEEE1394_HIGHLEVEL_H
3#define IEEE1394_HIGHLEVEL_H 2#define IEEE1394_HIGHLEVEL_H
4 3
4#include <linux/list.h>
5#include <linux/spinlock_types.h>
6#include <linux/types.h>
5 7
6struct hpsb_address_serve { 8struct module;
7 struct list_head host_list; /* per host list */
8 9
9 struct list_head hl_list; /* hpsb_highlevel list */ 10#include "ieee1394_types.h"
10 11
11 struct hpsb_address_ops *op; 12struct hpsb_host;
12 13
14/* internal to ieee1394 core */
15struct hpsb_address_serve {
16 struct list_head host_list; /* per host list */
17 struct list_head hl_list; /* hpsb_highlevel list */
18 struct hpsb_address_ops *op;
13 struct hpsb_host *host; 19 struct hpsb_host *host;
14 20 u64 start; /* first address handled, quadlet aligned */
15 /* first address handled and first address behind, quadlet aligned */ 21 u64 end; /* first address behind, quadlet aligned */
16 u64 start, end;
17}; 22};
18 23
19 24/* Only the following structures are of interest to actual highlevel drivers. */
20/*
21 * The above structs are internal to highlevel driver handling. Only the
22 * following structures are of interest to actual highlevel drivers.
23 */
24 25
25struct hpsb_highlevel { 26struct hpsb_highlevel {
26 struct module *owner; 27 struct module *owner;
27 const char *name; 28 const char *name;
28 29
29 /* Any of the following pointers can legally be NULL, except for 30 /* Any of the following pointers can legally be NULL, except for
30 * iso_receive which can only be NULL when you don't request 31 * iso_receive which can only be NULL when you don't request
31 * channels. */ 32 * channels. */
32 33
33 /* New host initialized. Will also be called during 34 /* New host initialized. Will also be called during
34 * hpsb_register_highlevel for all hosts already installed. */ 35 * hpsb_register_highlevel for all hosts already installed. */
35 void (*add_host) (struct hpsb_host *host); 36 void (*add_host)(struct hpsb_host *host);
36 37
37 /* Host about to be removed. Will also be called during 38 /* Host about to be removed. Will also be called during
38 * hpsb_unregister_highlevel once for each host. */ 39 * hpsb_unregister_highlevel once for each host. */
39 void (*remove_host) (struct hpsb_host *host); 40 void (*remove_host)(struct hpsb_host *host);
40 41
41 /* Host experienced bus reset with possible configuration changes. 42 /* Host experienced bus reset with possible configuration changes.
42 * Note that this one may occur during interrupt/bottom half handling. 43 * Note that this one may occur during interrupt/bottom half handling.
43 * You can not expect to be able to do stock hpsb_reads. */ 44 * You can not expect to be able to do stock hpsb_reads. */
44 void (*host_reset) (struct hpsb_host *host); 45 void (*host_reset)(struct hpsb_host *host);
45 46
46 /* An isochronous packet was received. Channel contains the channel 47 /* An isochronous packet was received. Channel contains the channel
47 * number for your convenience, it is also contained in the included 48 * number for your convenience, it is also contained in the included
48 * packet header (first quadlet, CRCs are missing). You may get called 49 * packet header (first quadlet, CRCs are missing). You may get called
49 * for channel/host combinations you did not request. */ 50 * for channel/host combinations you did not request. */
50 void (*iso_receive) (struct hpsb_host *host, int channel, 51 void (*iso_receive)(struct hpsb_host *host, int channel,
51 quadlet_t *data, size_t length); 52 quadlet_t *data, size_t length);
52 53
53 /* A write request was received on either the FCP_COMMAND (direction = 54 /* A write request was received on either the FCP_COMMAND (direction =
54 * 0) or the FCP_RESPONSE (direction = 1) register. The cts arg 55 * 0) or the FCP_RESPONSE (direction = 1) register. The cts arg
55 * contains the cts field (first byte of data). */ 56 * contains the cts field (first byte of data). */
56 void (*fcp_request) (struct hpsb_host *host, int nodeid, int direction, 57 void (*fcp_request)(struct hpsb_host *host, int nodeid, int direction,
57 int cts, u8 *data, size_t length); 58 int cts, u8 *data, size_t length);
58 59
59 /* These are initialized by the subsystem when the 60 /* These are initialized by the subsystem when the
60 * hpsb_higlevel is registered. */ 61 * hpsb_higlevel is registered. */
@@ -67,61 +68,62 @@ struct hpsb_highlevel {
67}; 68};
68 69
69struct hpsb_address_ops { 70struct hpsb_address_ops {
70 /* 71 /*
71 * Null function pointers will make the respective operation complete 72 * Null function pointers will make the respective operation complete
72 * with RCODE_TYPE_ERROR. Makes for easy to implement read-only 73 * with RCODE_TYPE_ERROR. Makes for easy to implement read-only
73 * registers (just leave everything but read NULL). 74 * registers (just leave everything but read NULL).
74 * 75 *
75 * All functions shall return appropriate IEEE 1394 rcodes. 76 * All functions shall return appropriate IEEE 1394 rcodes.
76 */ 77 */
77 78
78 /* These functions have to implement block reads for themselves. */ 79 /* These functions have to implement block reads for themselves.
79 /* These functions either return a response code 80 *
80 or a negative number. In the first case a response will be generated; in the 81 * These functions either return a response code or a negative number.
81 later case, no response will be sent and the driver, that handled the request 82 * In the first case a response will be generated. In the latter case,
82 will send the response itself 83 * no response will be sent and the driver which handled the request
83 */ 84 * will send the response itself. */
84 int (*read) (struct hpsb_host *host, int nodeid, quadlet_t *buffer, 85 int (*read)(struct hpsb_host *host, int nodeid, quadlet_t *buffer,
85 u64 addr, size_t length, u16 flags); 86 u64 addr, size_t length, u16 flags);
86 int (*write) (struct hpsb_host *host, int nodeid, int destid, 87 int (*write)(struct hpsb_host *host, int nodeid, int destid,
87 quadlet_t *data, u64 addr, size_t length, u16 flags); 88 quadlet_t *data, u64 addr, size_t length, u16 flags);
88 89
89 /* Lock transactions: write results of ext_tcode operation into 90 /* Lock transactions: write results of ext_tcode operation into
90 * *store. */ 91 * *store. */
91 int (*lock) (struct hpsb_host *host, int nodeid, quadlet_t *store, 92 int (*lock)(struct hpsb_host *host, int nodeid, quadlet_t *store,
92 u64 addr, quadlet_t data, quadlet_t arg, int ext_tcode, u16 flags); 93 u64 addr, quadlet_t data, quadlet_t arg, int ext_tcode,
93 int (*lock64) (struct hpsb_host *host, int nodeid, octlet_t *store, 94 u16 flags);
94 u64 addr, octlet_t data, octlet_t arg, int ext_tcode, u16 flags); 95 int (*lock64)(struct hpsb_host *host, int nodeid, octlet_t *store,
96 u64 addr, octlet_t data, octlet_t arg, int ext_tcode,
97 u16 flags);
95}; 98};
96 99
97
98void highlevel_add_host(struct hpsb_host *host); 100void highlevel_add_host(struct hpsb_host *host);
99void highlevel_remove_host(struct hpsb_host *host); 101void highlevel_remove_host(struct hpsb_host *host);
100void highlevel_host_reset(struct hpsb_host *host); 102void highlevel_host_reset(struct hpsb_host *host);
101 103
102 104/*
103/* these functions are called to handle transactions. They are called, when 105 * These functions are called to handle transactions. They are called when a
104 a packet arrives. The flags argument contains the second word of the first header 106 * packet arrives. The flags argument contains the second word of the first
105 quadlet of the incoming packet (containing transaction label, retry code, 107 * header quadlet of the incoming packet (containing transaction label, retry
106 transaction code and priority). These functions either return a response code 108 * code, transaction code and priority). These functions either return a
107 or a negative number. In the first case a response will be generated; in the 109 * response code or a negative number. In the first case a response will be
108 later case, no response will be sent and the driver, that handled the request 110 * generated. In the latter case, no response will be sent and the driver which
109 will send the response itself. 111 * handled the request will send the response itself.
110*/ 112 */
111int highlevel_read(struct hpsb_host *host, int nodeid, void *data, 113int highlevel_read(struct hpsb_host *host, int nodeid, void *data, u64 addr,
112 u64 addr, unsigned int length, u16 flags); 114 unsigned int length, u16 flags);
113int highlevel_write(struct hpsb_host *host, int nodeid, int destid, 115int highlevel_write(struct hpsb_host *host, int nodeid, int destid, void *data,
114 void *data, u64 addr, unsigned int length, u16 flags); 116 u64 addr, unsigned int length, u16 flags);
115int highlevel_lock(struct hpsb_host *host, int nodeid, quadlet_t *store, 117int highlevel_lock(struct hpsb_host *host, int nodeid, quadlet_t *store,
116 u64 addr, quadlet_t data, quadlet_t arg, int ext_tcode, u16 flags); 118 u64 addr, quadlet_t data, quadlet_t arg, int ext_tcode,
119 u16 flags);
117int highlevel_lock64(struct hpsb_host *host, int nodeid, octlet_t *store, 120int highlevel_lock64(struct hpsb_host *host, int nodeid, octlet_t *store,
118 u64 addr, octlet_t data, octlet_t arg, int ext_tcode, u16 flags); 121 u64 addr, octlet_t data, octlet_t arg, int ext_tcode,
122 u16 flags);
119 123
120void highlevel_iso_receive(struct hpsb_host *host, void *data, 124void highlevel_iso_receive(struct hpsb_host *host, void *data, size_t length);
121 size_t length);
122void highlevel_fcp_request(struct hpsb_host *host, int nodeid, int direction, 125void highlevel_fcp_request(struct hpsb_host *host, int nodeid, int direction,
123 void *data, size_t length); 126 void *data, size_t length);
124
125 127
126/* 128/*
127 * Register highlevel driver. The name pointer has to stay valid at all times 129 * Register highlevel driver. The name pointer has to stay valid at all times
@@ -132,13 +134,15 @@ void hpsb_unregister_highlevel(struct hpsb_highlevel *hl);
132 134
133/* 135/*
134 * Register handlers for host address spaces. Start and end are 48 bit pointers 136 * Register handlers for host address spaces. Start and end are 48 bit pointers
135 * and have to be quadlet aligned (end points to the first address behind the 137 * and have to be quadlet aligned. Argument "end" points to the first address
136 * handled addresses. This function can be called multiple times for a single 138 * behind the handled addresses. This function can be called multiple times for
137 * hpsb_highlevel to implement sparse register sets. The requested region must 139 * a single hpsb_highlevel to implement sparse register sets. The requested
138 * not overlap any previously allocated region, otherwise registering will fail. 140 * region must not overlap any previously allocated region, otherwise
141 * registering will fail.
139 * 142 *
140 * It returns true for successful allocation. There is no unregister function, 143 * It returns true for successful allocation. Address spaces can be
141 * all address spaces are deallocated together with the hpsb_highlevel. 144 * unregistered with hpsb_unregister_addrspace. All remaining address spaces
145 * are automatically deallocated together with the hpsb_highlevel.
142 */ 146 */
143u64 hpsb_allocate_and_register_addrspace(struct hpsb_highlevel *hl, 147u64 hpsb_allocate_and_register_addrspace(struct hpsb_highlevel *hl,
144 struct hpsb_host *host, 148 struct hpsb_host *host,
@@ -146,20 +150,18 @@ u64 hpsb_allocate_and_register_addrspace(struct hpsb_highlevel *hl,
146 u64 size, u64 alignment, 150 u64 size, u64 alignment,
147 u64 start, u64 end); 151 u64 start, u64 end);
148int hpsb_register_addrspace(struct hpsb_highlevel *hl, struct hpsb_host *host, 152int hpsb_register_addrspace(struct hpsb_highlevel *hl, struct hpsb_host *host,
149 struct hpsb_address_ops *ops, u64 start, u64 end); 153 struct hpsb_address_ops *ops, u64 start, u64 end);
150
151int hpsb_unregister_addrspace(struct hpsb_highlevel *hl, struct hpsb_host *host, 154int hpsb_unregister_addrspace(struct hpsb_highlevel *hl, struct hpsb_host *host,
152 u64 start); 155 u64 start);
153 156
154/* 157/*
155 * Enable or disable receving a certain isochronous channel through the 158 * Enable or disable receving a certain isochronous channel through the
156 * iso_receive op. 159 * iso_receive op.
157 */ 160 */
158int hpsb_listen_channel(struct hpsb_highlevel *hl, struct hpsb_host *host, 161int hpsb_listen_channel(struct hpsb_highlevel *hl, struct hpsb_host *host,
159 unsigned int channel); 162 unsigned int channel);
160void hpsb_unlisten_channel(struct hpsb_highlevel *hl, struct hpsb_host *host, 163void hpsb_unlisten_channel(struct hpsb_highlevel *hl, struct hpsb_host *host,
161 unsigned int channel); 164 unsigned int channel);
162
163 165
164/* Retrieve a hostinfo pointer bound to this driver/host */ 166/* Retrieve a hostinfo pointer bound to this driver/host */
165void *hpsb_get_hostinfo(struct hpsb_highlevel *hl, struct hpsb_host *host); 167void *hpsb_get_hostinfo(struct hpsb_highlevel *hl, struct hpsb_host *host);
@@ -172,19 +174,24 @@ void *hpsb_create_hostinfo(struct hpsb_highlevel *hl, struct hpsb_host *host,
172void hpsb_destroy_hostinfo(struct hpsb_highlevel *hl, struct hpsb_host *host); 174void hpsb_destroy_hostinfo(struct hpsb_highlevel *hl, struct hpsb_host *host);
173 175
174/* Set an alternate lookup key for the hostinfo bound to this driver/host */ 176/* Set an alternate lookup key for the hostinfo bound to this driver/host */
175void hpsb_set_hostinfo_key(struct hpsb_highlevel *hl, struct hpsb_host *host, unsigned long key); 177void hpsb_set_hostinfo_key(struct hpsb_highlevel *hl, struct hpsb_host *host,
178 unsigned long key);
176 179
177/* Retrieve the alternate lookup key for the hostinfo bound to this driver/host */ 180/* Retrieve the alternate lookup key for the hostinfo bound to this
178unsigned long hpsb_get_hostinfo_key(struct hpsb_highlevel *hl, struct hpsb_host *host); 181 * driver/host */
182unsigned long hpsb_get_hostinfo_key(struct hpsb_highlevel *hl,
183 struct hpsb_host *host);
179 184
180/* Retrieve a hostinfo pointer bound to this driver using its alternate key */ 185/* Retrieve a hostinfo pointer bound to this driver using its alternate key */
181void *hpsb_get_hostinfo_bykey(struct hpsb_highlevel *hl, unsigned long key); 186void *hpsb_get_hostinfo_bykey(struct hpsb_highlevel *hl, unsigned long key);
182 187
183/* Set the hostinfo pointer to something useful. Usually follows a call to 188/* Set the hostinfo pointer to something useful. Usually follows a call to
184 * hpsb_create_hostinfo, where the size is 0. */ 189 * hpsb_create_hostinfo, where the size is 0. */
185int hpsb_set_hostinfo(struct hpsb_highlevel *hl, struct hpsb_host *host, void *data); 190int hpsb_set_hostinfo(struct hpsb_highlevel *hl, struct hpsb_host *host,
191 void *data);
186 192
187/* Retrieve hpsb_host using a highlevel handle and a key */ 193/* Retrieve hpsb_host using a highlevel handle and a key */
188struct hpsb_host *hpsb_get_host_bykey(struct hpsb_highlevel *hl, unsigned long key); 194struct hpsb_host *hpsb_get_host_bykey(struct hpsb_highlevel *hl,
195 unsigned long key);
189 196
190#endif /* IEEE1394_HIGHLEVEL_H */ 197#endif /* IEEE1394_HIGHLEVEL_H */