aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ieee1394/highlevel.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/ieee1394/highlevel.c')
-rw-r--r--drivers/ieee1394/highlevel.c89
1 files changed, 86 insertions, 3 deletions
diff --git a/drivers/ieee1394/highlevel.c b/drivers/ieee1394/highlevel.c
index 694da82d820b..83a493312751 100644
--- a/drivers/ieee1394/highlevel.c
+++ b/drivers/ieee1394/highlevel.c
@@ -70,8 +70,12 @@ static struct hl_host_info *hl_get_hostinfo(struct hpsb_highlevel *hl,
70 return NULL; 70 return NULL;
71} 71}
72 72
73/* Returns a per host/driver data structure that was previously stored by 73/**
74 * hpsb_create_hostinfo. */ 74 * hpsb_get_hostinfo - retrieve a hostinfo pointer bound to this driver/host
75 *
76 * Returns a per @host and @hl driver data structure that was previously stored
77 * by hpsb_create_hostinfo.
78 */
75void *hpsb_get_hostinfo(struct hpsb_highlevel *hl, struct hpsb_host *host) 79void *hpsb_get_hostinfo(struct hpsb_highlevel *hl, struct hpsb_host *host)
76{ 80{
77 struct hl_host_info *hi = hl_get_hostinfo(hl, host); 81 struct hl_host_info *hi = hl_get_hostinfo(hl, host);
@@ -79,7 +83,13 @@ void *hpsb_get_hostinfo(struct hpsb_highlevel *hl, struct hpsb_host *host)
79 return hi ? hi->data : NULL; 83 return hi ? hi->data : NULL;
80} 84}
81 85
82/* If size is zero, then the return here is only valid for error checking */ 86/**
87 * hpsb_create_hostinfo - allocate a hostinfo pointer bound to this driver/host
88 *
89 * Allocate a hostinfo pointer backed by memory with @data_size and bind it to
90 * to this @hl driver and @host. If @data_size is zero, then the return here is
91 * only valid for error checking.
92 */
83void *hpsb_create_hostinfo(struct hpsb_highlevel *hl, struct hpsb_host *host, 93void *hpsb_create_hostinfo(struct hpsb_highlevel *hl, struct hpsb_host *host,
84 size_t data_size) 94 size_t data_size)
85{ 95{
@@ -113,6 +123,11 @@ void *hpsb_create_hostinfo(struct hpsb_highlevel *hl, struct hpsb_host *host,
113 return data; 123 return data;
114} 124}
115 125
126/**
127 * hpsb_set_hostinfo - set the hostinfo pointer to something useful
128 *
129 * Usually follows a call to hpsb_create_hostinfo, where the size is 0.
130 */
116int hpsb_set_hostinfo(struct hpsb_highlevel *hl, struct hpsb_host *host, 131int hpsb_set_hostinfo(struct hpsb_highlevel *hl, struct hpsb_host *host,
117 void *data) 132 void *data)
118{ 133{
@@ -132,6 +147,11 @@ int hpsb_set_hostinfo(struct hpsb_highlevel *hl, struct hpsb_host *host,
132 return -EINVAL; 147 return -EINVAL;
133} 148}
134 149
150/**
151 * hpsb_destroy_hostinfo - free and remove a hostinfo pointer
152 *
153 * Free and remove the hostinfo pointer bound to this @hl driver and @host.
154 */
135void hpsb_destroy_hostinfo(struct hpsb_highlevel *hl, struct hpsb_host *host) 155void hpsb_destroy_hostinfo(struct hpsb_highlevel *hl, struct hpsb_host *host)
136{ 156{
137 struct hl_host_info *hi; 157 struct hl_host_info *hi;
@@ -147,6 +167,12 @@ void hpsb_destroy_hostinfo(struct hpsb_highlevel *hl, struct hpsb_host *host)
147 return; 167 return;
148} 168}
149 169
170/**
171 * hpsb_set_hostinfo_key - set an alternate lookup key for an hostinfo
172 *
173 * Sets an alternate lookup key for the hostinfo bound to this @hl driver and
174 * @host.
175 */
150void hpsb_set_hostinfo_key(struct hpsb_highlevel *hl, struct hpsb_host *host, 176void hpsb_set_hostinfo_key(struct hpsb_highlevel *hl, struct hpsb_host *host,
151 unsigned long key) 177 unsigned long key)
152{ 178{
@@ -158,6 +184,9 @@ void hpsb_set_hostinfo_key(struct hpsb_highlevel *hl, struct hpsb_host *host,
158 return; 184 return;
159} 185}
160 186
187/**
188 * hpsb_get_hostinfo_bykey - retrieve a hostinfo pointer by its alternate key
189 */
161void *hpsb_get_hostinfo_bykey(struct hpsb_highlevel *hl, unsigned long key) 190void *hpsb_get_hostinfo_bykey(struct hpsb_highlevel *hl, unsigned long key)
162{ 191{
163 struct hl_host_info *hi; 192 struct hl_host_info *hi;
@@ -189,6 +218,12 @@ static int highlevel_for_each_host_reg(struct hpsb_host *host, void *__data)
189 return 0; 218 return 0;
190} 219}
191 220
221/**
222 * hpsb_register_highlevel - register highlevel driver
223 *
224 * The name pointer in @hl has to stay valid at all times because the string is
225 * not copied.
226 */
192void hpsb_register_highlevel(struct hpsb_highlevel *hl) 227void hpsb_register_highlevel(struct hpsb_highlevel *hl)
193{ 228{
194 unsigned long flags; 229 unsigned long flags;
@@ -258,6 +293,9 @@ static int highlevel_for_each_host_unreg(struct hpsb_host *host, void *__data)
258 return 0; 293 return 0;
259} 294}
260 295
296/**
297 * hpsb_unregister_highlevel - unregister highlevel driver
298 */
261void hpsb_unregister_highlevel(struct hpsb_highlevel *hl) 299void hpsb_unregister_highlevel(struct hpsb_highlevel *hl)
262{ 300{
263 unsigned long flags; 301 unsigned long flags;
@@ -273,6 +311,19 @@ void hpsb_unregister_highlevel(struct hpsb_highlevel *hl)
273 nodemgr_for_each_host(hl, highlevel_for_each_host_unreg); 311 nodemgr_for_each_host(hl, highlevel_for_each_host_unreg);
274} 312}
275 313
314/**
315 * hpsb_allocate_and_register_addrspace - alloc' and reg' a host address space
316 *
317 * @start and @end are 48 bit pointers and have to be quadlet aligned.
318 * @end points to the first address behind the handled addresses. This
319 * function can be called multiple times for a single hpsb_highlevel @hl to
320 * implement sparse register sets. The requested region must not overlap any
321 * previously allocated region, otherwise registering will fail.
322 *
323 * It returns true for successful allocation. Address spaces can be
324 * unregistered with hpsb_unregister_addrspace. All remaining address spaces
325 * are automatically deallocated together with the hpsb_highlevel @hl.
326 */
276u64 hpsb_allocate_and_register_addrspace(struct hpsb_highlevel *hl, 327u64 hpsb_allocate_and_register_addrspace(struct hpsb_highlevel *hl,
277 struct hpsb_host *host, 328 struct hpsb_host *host,
278 struct hpsb_address_ops *ops, 329 struct hpsb_address_ops *ops,
@@ -348,6 +399,19 @@ u64 hpsb_allocate_and_register_addrspace(struct hpsb_highlevel *hl,
348 return retval; 399 return retval;
349} 400}
350 401
402/**
403 * hpsb_register_addrspace - register a host address space
404 *
405 * @start and @end are 48 bit pointers and have to be quadlet aligned.
406 * @end points to the first address behind the handled addresses. This
407 * function can be called multiple times for a single hpsb_highlevel @hl to
408 * implement sparse register sets. The requested region must not overlap any
409 * previously allocated region, otherwise registering will fail.
410 *
411 * It returns true for successful allocation. Address spaces can be
412 * unregistered with hpsb_unregister_addrspace. All remaining address spaces
413 * are automatically deallocated together with the hpsb_highlevel @hl.
414 */
351int hpsb_register_addrspace(struct hpsb_highlevel *hl, struct hpsb_host *host, 415int hpsb_register_addrspace(struct hpsb_highlevel *hl, struct hpsb_host *host,
352 struct hpsb_address_ops *ops, u64 start, u64 end) 416 struct hpsb_address_ops *ops, u64 start, u64 end)
353{ 417{
@@ -419,6 +483,11 @@ int hpsb_unregister_addrspace(struct hpsb_highlevel *hl, struct hpsb_host *host,
419 return retval; 483 return retval;
420} 484}
421 485
486/**
487 * hpsb_listen_channel - enable receving a certain isochronous channel
488 *
489 * Reception is handled through the @hl's iso_receive op.
490 */
422int hpsb_listen_channel(struct hpsb_highlevel *hl, struct hpsb_host *host, 491int hpsb_listen_channel(struct hpsb_highlevel *hl, struct hpsb_host *host,
423 unsigned int channel) 492 unsigned int channel)
424{ 493{
@@ -431,6 +500,9 @@ int hpsb_listen_channel(struct hpsb_highlevel *hl, struct hpsb_host *host,
431 return 0; 500 return 0;
432} 501}
433 502
503/**
504 * hpsb_unlisten_channel - disable receving a certain isochronous channel
505 */
434void hpsb_unlisten_channel(struct hpsb_highlevel *hl, struct hpsb_host *host, 506void hpsb_unlisten_channel(struct hpsb_highlevel *hl, struct hpsb_host *host,
435 unsigned int channel) 507 unsigned int channel)
436{ 508{
@@ -528,6 +600,17 @@ void highlevel_fcp_request(struct hpsb_host *host, int nodeid, int direction,
528 read_unlock_irqrestore(&hl_irqs_lock, flags); 600 read_unlock_irqrestore(&hl_irqs_lock, flags);
529} 601}
530 602
603/*
604 * highlevel_read, highlevel_write, highlevel_lock, highlevel_lock64:
605 *
606 * These functions are called to handle transactions. They are called when a
607 * packet arrives. The flags argument contains the second word of the first
608 * header quadlet of the incoming packet (containing transaction label, retry
609 * code, transaction code and priority). These functions either return a
610 * response code or a negative number. In the first case a response will be
611 * generated. In the latter case, no response will be sent and the driver which
612 * handled the request will send the response itself.
613 */
531int highlevel_read(struct hpsb_host *host, int nodeid, void *data, u64 addr, 614int highlevel_read(struct hpsb_host *host, int nodeid, void *data, u64 addr,
532 unsigned int length, u16 flags) 615 unsigned int length, u16 flags)
533{ 616{