GUI: Fix Tomato RAF theme for all builds. Compilation typo.
[tomato.git] / release / src-rt-6.x.4708 / linux / linux-2.6.36 / drivers / ieee1394 / hosts.h
blobda88eae1e7e4b837c904e1a7195e15c3c665bec2
1 #ifndef _IEEE1394_HOSTS_H
2 #define _IEEE1394_HOSTS_H
4 #include <linux/device.h>
5 #include <linux/list.h>
6 #include <linux/timer.h>
7 #include <linux/types.h>
8 #include <linux/workqueue.h>
9 #include <asm/atomic.h>
11 struct pci_dev;
12 struct module;
14 #include "ieee1394_types.h"
15 #include "csr.h"
16 #include "highlevel.h"
18 struct hpsb_packet;
19 struct hpsb_iso;
21 struct hpsb_host {
22 struct list_head host_list;
24 void *hostdata;
26 atomic_t generation;
28 struct list_head pending_packets;
29 struct timer_list timeout;
30 unsigned long timeout_interval;
32 int node_count; /* number of identified nodes on this bus */
33 int selfid_count; /* total number of SelfIDs received */
34 int nodes_active; /* number of nodes with active link layer */
36 nodeid_t node_id; /* node ID of this host */
37 nodeid_t irm_id; /* ID of this bus' isochronous resource manager */
38 nodeid_t busmgr_id; /* ID of this bus' bus manager */
40 /* this nodes state */
41 unsigned in_bus_reset:1;
42 unsigned is_shutdown:1;
43 unsigned resume_packet_sent:1;
45 /* this nodes' duties on the bus */
46 unsigned is_root:1;
47 unsigned is_cycmst:1;
48 unsigned is_irm:1;
49 unsigned is_busmgr:1;
51 int reset_retries;
52 quadlet_t *topology_map;
53 u8 *speed_map;
55 int id;
56 struct hpsb_host_driver *driver;
57 struct pci_dev *pdev;
58 struct device device;
59 struct device host_dev;
61 struct delayed_work delayed_reset;
62 unsigned config_roms:31;
63 unsigned update_config_rom:1;
65 struct list_head addr_space;
66 u64 low_addr_space; /* upper bound of physical DMA area */
67 u64 middle_addr_space; /* upper bound of posted write area */
69 u8 speed[ALL_NODES]; /* speed between each node and local node */
71 /* per node tlabel allocation */
72 u8 next_tl[ALL_NODES];
73 struct { DECLARE_BITMAP(map, 64); } tl_pool[ALL_NODES];
75 struct csr_control csr;
77 struct hpsb_address_serve dummy_zero_addr;
78 struct hpsb_address_serve dummy_max_addr;
81 enum devctl_cmd {
82 /* Host is requested to reset its bus and cancel all outstanding async
83 * requests. If arg == 1, it shall also attempt to become root on the
84 * bus. Return void. */
85 RESET_BUS,
87 /* Arg is void, return value is the hardware cycle counter value. */
88 GET_CYCLE_COUNTER,
90 SET_CYCLE_COUNTER,
92 /* Configure hardware for new bus ID in arg, return void. */
93 SET_BUS_ID,
95 /* If arg true, start sending cycle start packets, stop if arg == 0.
96 * Return void. */
97 ACT_CYCLE_MASTER,
99 /* Cancel all outstanding async requests without resetting the bus.
100 * Return void. */
101 CANCEL_REQUESTS,
104 enum isoctl_cmd {
105 /* rawiso API - see iso.h for the meanings of these commands
106 * (they correspond exactly to the hpsb_iso_* API functions)
107 * INIT = allocate resources
108 * START = begin transmission/reception
109 * STOP = halt transmission/reception
110 * QUEUE/RELEASE = produce/consume packets
111 * SHUTDOWN = deallocate resources
114 XMIT_INIT,
115 XMIT_START,
116 XMIT_STOP,
117 XMIT_QUEUE,
118 XMIT_SHUTDOWN,
120 RECV_INIT,
121 RECV_LISTEN_CHANNEL, /* multi-channel only */
122 RECV_UNLISTEN_CHANNEL, /* multi-channel only */
123 RECV_SET_CHANNEL_MASK, /* multi-channel only; arg is a *u64 */
124 RECV_START,
125 RECV_STOP,
126 RECV_RELEASE,
127 RECV_SHUTDOWN,
128 RECV_FLUSH
131 enum reset_types {
132 /* 166 microsecond reset -- only type of reset available on
133 non-1394a capable controllers */
134 LONG_RESET,
136 /* Short (arbitrated) reset -- only available on 1394a capable
137 controllers */
138 SHORT_RESET,
140 /* Variants that set force_root before issueing the bus reset */
141 LONG_RESET_FORCE_ROOT, SHORT_RESET_FORCE_ROOT,
143 /* Variants that clear force_root before issueing the bus reset */
144 LONG_RESET_NO_FORCE_ROOT, SHORT_RESET_NO_FORCE_ROOT
147 struct hpsb_host_driver {
148 struct module *owner;
149 const char *name;
151 /* The hardware driver may optionally support a function that is used
152 * to set the hardware ConfigROM if the hardware supports handling
153 * reads to the ConfigROM on its own. */
154 void (*set_hw_config_rom)(struct hpsb_host *host,
155 __be32 *config_rom);
157 /* This function shall implement packet transmission based on
158 * packet->type. It shall CRC both parts of the packet (unless
159 * packet->type == raw) and do byte-swapping as necessary or instruct
160 * the hardware to do so. It can return immediately after the packet
161 * was queued for sending. After sending, hpsb_sent_packet() has to be
162 * called. Return 0 on success, negative errno on failure.
163 * NOTE: The function must be callable in interrupt context.
165 int (*transmit_packet)(struct hpsb_host *host,
166 struct hpsb_packet *packet);
168 /* This function requests miscellanous services from the driver, see
169 * above for command codes and expected actions. Return -1 for unknown
170 * command, though that should never happen.
172 int (*devctl)(struct hpsb_host *host, enum devctl_cmd command, int arg);
174 /* ISO transmission/reception functions. Return 0 on success, -1
175 * (or -EXXX errno code) on failure. If the low-level driver does not
176 * support the new ISO API, set isoctl to NULL.
178 int (*isoctl)(struct hpsb_iso *iso, enum isoctl_cmd command,
179 unsigned long arg);
181 /* This function is mainly to redirect local CSR reads/locks to the iso
182 * management registers (bus manager id, bandwidth available, channels
183 * available) to the hardware registers in OHCI. reg is 0,1,2,3 for bus
184 * mgr, bwdth avail, ch avail hi, ch avail lo respectively (the same ids
185 * as OHCI uses). data and compare are the new data and expected data
186 * respectively, return value is the old value.
188 quadlet_t (*hw_csr_reg) (struct hpsb_host *host, int reg,
189 quadlet_t data, quadlet_t compare);
192 struct hpsb_host *hpsb_alloc_host(struct hpsb_host_driver *drv, size_t extra,
193 struct device *dev);
194 int hpsb_add_host(struct hpsb_host *host);
195 void hpsb_resume_host(struct hpsb_host *host);
196 void hpsb_remove_host(struct hpsb_host *host);
197 int hpsb_update_config_rom_image(struct hpsb_host *host);
199 #endif /* _IEEE1394_HOSTS_H */