5cbcec56b82d5a1edb165da5a42d7bf9990d591b
[linux-flexiantxendom0-3.2.10.git] / drivers / ieee1394 / ieee1394_transactions.h
1 #ifndef _IEEE1394_TRANSACTIONS_H
2 #define _IEEE1394_TRANSACTIONS_H
3
4 #include "ieee1394_core.h"
5
6
7 /*
8  * Get and free transaction labels.
9  */
10 int hpsb_get_tlabel(struct hpsb_packet *packet, int wait);
11 void hpsb_free_tlabel(struct hpsb_packet *packet);
12
13 struct hpsb_packet *hpsb_make_readpacket(struct hpsb_host *host, nodeid_t node,
14                                          u64 addr, size_t length);
15 struct hpsb_packet *hpsb_make_lockpacket(struct hpsb_host *host, nodeid_t node,
16                                          u64 addr, int extcode, quadlet_t *data,
17                                          quadlet_t arg);
18 struct hpsb_packet *hpsb_make_lock64packet(struct hpsb_host *host, nodeid_t node,
19                                           u64 addr, int extcode, octlet_t *data,
20                                           octlet_t arg);
21 struct hpsb_packet *hpsb_make_phypacket(struct hpsb_host *host,
22                                         quadlet_t data) ;
23 struct hpsb_packet *hpsb_make_isopacket(struct hpsb_host *host,
24                                         int length, int channel,
25                                         int tag, int sync);
26 struct hpsb_packet *hpsb_make_writepacket (struct hpsb_host *host, nodeid_t node,
27                                            u64 addr, quadlet_t *buffer, size_t length);
28
29 /*
30  * hpsb_packet_success - Make sense of the ack and reply codes and
31  * return more convenient error codes:
32  * 0           success
33  * -EBUSY      node is busy, try again
34  * -EAGAIN     error which can probably resolved by retry
35  * -EREMOTEIO  node suffers from an internal error
36  * -EACCES     this transaction is not allowed on requested address
37  * -EINVAL     invalid address at node
38  */
39 int hpsb_packet_success(struct hpsb_packet *packet);
40
41
42 /*
43  * The generic read, write and lock functions.  All recognize the local node ID
44  * and act accordingly.  Read and write automatically use quadlet commands if
45  * length == 4 and and block commands otherwise (however, they do not yet
46  * support lengths that are not a multiple of 4).  You must explicitly specifiy
47  * the generation for which the node ID is valid, to avoid sending packets to
48  * the wrong nodes when we race with a bus reset.
49  */
50 int hpsb_read(struct hpsb_host *host, nodeid_t node, unsigned int generation,
51               u64 addr, quadlet_t *buffer, size_t length);
52 int hpsb_write(struct hpsb_host *host, nodeid_t node, unsigned int generation,
53                u64 addr, quadlet_t *buffer, size_t length);
54 int hpsb_lock(struct hpsb_host *host, nodeid_t node, unsigned int generation,
55               u64 addr, int extcode, quadlet_t *data, quadlet_t arg);
56 int hpsb_lock64(struct hpsb_host *host, nodeid_t node, unsigned int generation,
57                 u64 addr, int extcode, octlet_t *data, octlet_t arg);
58 int hpsb_send_gasp(struct hpsb_host *host, int channel, unsigned int generation,
59                    quadlet_t *buffer, size_t length, u32 specifier_id,
60                    unsigned int version);
61
62 #endif /* _IEEE1394_TRANSACTIONS_H */