1 #ifndef _IEEE1394_TRANSACTIONS_H
2 #define _IEEE1394_TRANSACTIONS_H
4 #include "ieee1394_core.h"
8 * Utility functions to fill out packet headers.
10 void fill_async_readquad(struct hpsb_packet *packet, u64 addr);
11 void fill_async_readquad_resp(struct hpsb_packet *packet, int rcode,
13 void fill_async_readblock(struct hpsb_packet *packet, u64 addr, int length);
14 void fill_async_readblock_resp(struct hpsb_packet *packet, int rcode,
16 void fill_async_writequad(struct hpsb_packet *packet, u64 addr, quadlet_t data);
17 void fill_async_writeblock(struct hpsb_packet *packet, u64 addr, int length);
18 void fill_async_write_resp(struct hpsb_packet *packet, int rcode);
19 void fill_async_lock(struct hpsb_packet *packet, u64 addr, int extcode,
21 void fill_async_lock_resp(struct hpsb_packet *packet, int rcode, int extcode,
23 void fill_iso_packet(struct hpsb_packet *packet, int length, int channel,
25 void fill_phy_packet(struct hpsb_packet *packet, quadlet_t data);
28 * Get and free transaction labels.
30 int get_tlabel(struct hpsb_host *host, nodeid_t nodeid, int wait);
31 void free_tlabel(struct hpsb_host *host, nodeid_t nodeid, int tlabel);
33 struct hpsb_packet *hpsb_make_readqpacket(struct hpsb_host *host, nodeid_t node,
35 struct hpsb_packet *hpsb_make_readbpacket(struct hpsb_host *host, nodeid_t node,
36 u64 addr, size_t length);
37 struct hpsb_packet *hpsb_make_writeqpacket(struct hpsb_host *host,
38 nodeid_t node, u64 addr,
40 struct hpsb_packet *hpsb_make_writebpacket(struct hpsb_host *host,
41 nodeid_t node, u64 addr,
43 struct hpsb_packet *hpsb_make_lockpacket(struct hpsb_host *host, nodeid_t node,
44 u64 addr, int extcode);
45 struct hpsb_packet *hpsb_make_lock64packet(struct hpsb_host *host, nodeid_t node,
46 u64 addr, int extcode);
47 struct hpsb_packet *hpsb_make_phypacket(struct hpsb_host *host,
52 * hpsb_packet_success - Make sense of the ack and reply codes and
53 * return more convenient error codes:
55 * -EBUSY node is busy, try again
56 * -EAGAIN error which can probably resolved by retry
57 * -EREMOTEIO node suffers from an internal error
58 * -EACCES this transaction is not allowed on requested address
59 * -EINVAL invalid address at node
61 int hpsb_packet_success(struct hpsb_packet *packet);
65 * The generic read, write and lock functions. All recognize the local node ID
66 * and act accordingly. Read and write automatically use quadlet commands if
67 * length == 4 and and block commands otherwise (however, they do not yet
68 * support lengths that are not a multiple of 4). You must explicitly specifiy
69 * the generation for which the node ID is valid, to avoid sending packets to
70 * the wrong nodes when we race with a bus reset.
72 int hpsb_read(struct hpsb_host *host, nodeid_t node, unsigned int generation,
73 u64 addr, quadlet_t *buffer, size_t length);
74 int hpsb_write(struct hpsb_host *host, nodeid_t node, unsigned int generation,
75 u64 addr, quadlet_t *buffer, size_t length);
76 int hpsb_lock(struct hpsb_host *host, nodeid_t node, unsigned int generation,
77 u64 addr, int extcode, quadlet_t *data, quadlet_t arg);
79 /* Generic packet creation. Used by hpsb_write. Also useful for protocol
80 * drivers that want to implement their own hpsb_write replacement. */
81 struct hpsb_packet *hpsb_make_packet (struct hpsb_host *host, nodeid_t node,
82 u64 addr, quadlet_t *buffer, size_t length);
84 #endif /* _IEEE1394_TRANSACTIONS_H */