blob: c1369c41469b5464cb66b4a3bad22ee2d996846b [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001#ifndef _IEEE1394_TRANSACTIONS_H
2#define _IEEE1394_TRANSACTIONS_H
3
Stefan Richterde4394f2006-07-03 12:02:29 -04004#include <linux/types.h>
5
6#include "ieee1394_types.h"
7
8struct hpsb_packet;
9struct hpsb_host;
Linus Torvalds1da177e2005-04-16 15:20:36 -070010
Linus Torvalds1da177e2005-04-16 15:20:36 -070011int hpsb_get_tlabel(struct hpsb_packet *packet);
12void hpsb_free_tlabel(struct hpsb_packet *packet);
Linus Torvalds1da177e2005-04-16 15:20:36 -070013struct hpsb_packet *hpsb_make_readpacket(struct hpsb_host *host, nodeid_t node,
14 u64 addr, size_t length);
15struct hpsb_packet *hpsb_make_lockpacket(struct hpsb_host *host, nodeid_t node,
Stefan Richtere1d118f2006-07-03 12:02:28 -040016 u64 addr, int extcode, quadlet_t *data,
Linus Torvalds1da177e2005-04-16 15:20:36 -070017 quadlet_t arg);
Stefan Richtere1d118f2006-07-03 12:02:28 -040018struct hpsb_packet *hpsb_make_lock64packet(struct hpsb_host *host,
19 nodeid_t node, u64 addr, int extcode,
20 octlet_t *data, octlet_t arg);
21struct hpsb_packet *hpsb_make_phypacket(struct hpsb_host *host, quadlet_t data);
22struct hpsb_packet *hpsb_make_isopacket(struct hpsb_host *host, int length,
23 int channel, int tag, int sync);
24struct hpsb_packet *hpsb_make_writepacket(struct hpsb_host *host,
25 nodeid_t node, u64 addr,
26 quadlet_t *buffer, size_t length);
Linus Torvalds1da177e2005-04-16 15:20:36 -070027struct hpsb_packet *hpsb_make_streampacket(struct hpsb_host *host, u8 *buffer,
Stefan Richtere1d118f2006-07-03 12:02:28 -040028 int length, int channel, int tag,
29 int sync);
Linus Torvalds1da177e2005-04-16 15:20:36 -070030
31/*
32 * hpsb_packet_success - Make sense of the ack and reply codes and
33 * return more convenient error codes:
34 * 0 success
35 * -EBUSY node is busy, try again
36 * -EAGAIN error which can probably resolved by retry
37 * -EREMOTEIO node suffers from an internal error
38 * -EACCES this transaction is not allowed on requested address
39 * -EINVAL invalid address at node
40 */
41int hpsb_packet_success(struct hpsb_packet *packet);
42
Linus Torvalds1da177e2005-04-16 15:20:36 -070043/*
Stefan Richtere1d118f2006-07-03 12:02:28 -040044 * The generic read and write functions. All recognize the local node ID
Linus Torvalds1da177e2005-04-16 15:20:36 -070045 * and act accordingly. Read and write automatically use quadlet commands if
46 * length == 4 and and block commands otherwise (however, they do not yet
47 * support lengths that are not a multiple of 4). You must explicitly specifiy
48 * the generation for which the node ID is valid, to avoid sending packets to
49 * the wrong nodes when we race with a bus reset.
50 */
51int hpsb_read(struct hpsb_host *host, nodeid_t node, unsigned int generation,
52 u64 addr, quadlet_t *buffer, size_t length);
53int hpsb_write(struct hpsb_host *host, nodeid_t node, unsigned int generation,
54 u64 addr, quadlet_t *buffer, size_t length);
Linus Torvalds1da177e2005-04-16 15:20:36 -070055
Stefan Richter99519032006-07-02 14:17:00 +020056#ifdef HPSB_DEBUG_TLABELS
57extern spinlock_t hpsb_tlabel_lock;
58#endif
59
Linus Torvalds1da177e2005-04-16 15:20:36 -070060#endif /* _IEEE1394_TRANSACTIONS_H */