This is pre8 ...
[linux-2.6/linux-mips.git] / drivers / ieee1394 / highlevel.h
blobf4f615a7b2c066d4972ae773c4a28c9a3ce7b57c
2 #ifndef IEEE1394_HIGHLEVEL_H
3 #define IEEE1394_HIGHLEVEL_H
6 struct hpsb_highlevel {
7 struct list_head hl_list;
9 /* List of hpsb_address_serve. */
10 struct list_head addr_list;
12 const char *name;
13 struct hpsb_highlevel_ops *op;
17 struct hpsb_address_serve {
18 struct list_head as_list; /* global list */
20 struct list_head addr_list; /* hpsb_highlevel list */
22 struct hpsb_address_ops *op;
24 /* first address handled and first address behind, quadlet aligned */
25 u64 start, end;
30 * The above structs are internal to highlevel driver handling. Only the
31 * following structures are of interest to actual highlevel drivers.
34 struct hpsb_highlevel_ops {
35 /* Any of the following pointers can legally be NULL, except for
36 * iso_receive which can only be NULL when you don't request
37 * channels. */
39 /* New host initialized. Will also be called during
40 * hpsb_register_highlevel for all hosts already installed. */
41 void (*add_host) (struct hpsb_host *host);
43 /* Host about to be removed. Will also be called during
44 * hpsb_unregister_highlevel once for each host. */
45 void (*remove_host) (struct hpsb_host *host);
47 /* Host experienced bus reset with possible configuration changes. Note
48 * that this one may occur during interrupt/bottom half handling. You
49 * can not expect to be able to do stock hpsb_reads. */
50 void (*host_reset) (struct hpsb_host *host);
52 /* An isochronous packet was received. Channel contains the channel
53 * number for your convenience, it is also contained in the included
54 * packet header (first quadlet, CRCs are missing). You may get called
55 * for channel/host combinations you did not request. */
56 void (*iso_receive) (struct hpsb_host *host, int channel,
57 quadlet_t *data, unsigned int length);
59 /* A write request was received on either the FCP_COMMAND (direction =
60 * 0) or the FCP_RESPONSE (direction = 1) register. The cts arg
61 * contains the cts field (first byte of data).
63 void (*fcp_request) (struct hpsb_host *host, int nodeid, int direction,
64 int cts, u8 *data, unsigned int length);
67 struct hpsb_address_ops {
69 * Null function pointers will make the respective operation complete
70 * with RCODE_TYPE_ERROR. Makes for easy to implement read-only
71 * registers (just leave everything but read NULL).
73 * All functions shall return appropriate IEEE 1394 rcodes.
76 /* These functions have to implement block reads for themselves. */
77 int (*read) (struct hpsb_host *host, int nodeid, quadlet_t *buffer,
78 u64 addr, unsigned int length);
79 int (*write) (struct hpsb_host *host, int nodeid, quadlet_t *data,
80 u64 addr, unsigned int length);
82 /* Lock transactions: write results of ext_tcode operation into
83 * *store. */
84 int (*lock) (struct hpsb_host *host, int nodeid, quadlet_t *store,
85 u64 addr, quadlet_t data, quadlet_t arg, int ext_tcode);
86 int (*lock64) (struct hpsb_host *host, int nodeid, octlet_t *store,
87 u64 addr, octlet_t data, octlet_t arg, int ext_tcode);
91 void init_hpsb_highlevel(void);
93 void highlevel_add_host(struct hpsb_host *host);
94 void highlevel_remove_host(struct hpsb_host *host);
95 void highlevel_host_reset(struct hpsb_host *host);
97 int highlevel_read(struct hpsb_host *host, int nodeid, quadlet_t *buffer,
98 u64 addr, unsigned int length);
99 int highlevel_write(struct hpsb_host *host, int nodeid, quadlet_t *data,
100 u64 addr, unsigned int length);
101 int highlevel_lock(struct hpsb_host *host, int nodeid, quadlet_t *store,
102 u64 addr, quadlet_t data, quadlet_t arg, int ext_tcode);
103 int highlevel_lock64(struct hpsb_host *host, int nodeid, octlet_t *store,
104 u64 addr, octlet_t data, octlet_t arg, int ext_tcode);
106 void highlevel_iso_receive(struct hpsb_host *host, quadlet_t *data,
107 unsigned int length);
108 void highlevel_fcp_request(struct hpsb_host *host, int nodeid, int direction,
109 u8 *data, unsigned int length);
113 * Register highlevel driver. The name pointer has to stay valid at all times
114 * because the string is not copied.
116 struct hpsb_highlevel *hpsb_register_highlevel(const char *name,
117 struct hpsb_highlevel_ops *ops);
118 void hpsb_unregister_highlevel(struct hpsb_highlevel *hl);
121 * Register handlers for host address spaces. Start and end are 48 bit pointers
122 * and have to be quadlet aligned (end points to the first address behind the
123 * handled addresses. This function can be called multiple times for a single
124 * hpsb_highlevel to implement sparse register sets. The requested region must
125 * not overlap any previously allocated region, otherwise registering will fail.
127 * It returns true for successful allocation. There is no unregister function,
128 * all address spaces are deallocated together with the hpsb_highlevel.
130 int hpsb_register_addrspace(struct hpsb_highlevel *hl,
131 struct hpsb_address_ops *ops, u64 start, u64 end);
134 * Enable or disable receving a certain isochronous channel through the
135 * iso_receive op.
137 void hpsb_listen_channel(struct hpsb_highlevel *hl, struct hpsb_host *host,
138 unsigned int channel);
139 void hpsb_unlisten_channel(struct hpsb_highlevel *hl, struct hpsb_host *host,
140 unsigned int channel);
142 #endif /* IEEE1394_HIGHLEVEL_H */