diff options
author | Kristian Høgsberg <krh@redhat.com> | 2006-12-19 19:58:27 -0500 |
---|---|---|
committer | Stefan Richter <stefanr@s5r6.in-berlin.de> | 2007-03-09 16:02:33 -0500 |
commit | 3038e353cfaf548eb94f02b172b9dbe412abd24c (patch) | |
tree | 70e50c20e117e2dacb7cd810d00fe595e60d26ce /drivers/firewire/fw-topology.h | |
parent | 08e15e81a40e3241ce93b4a43886f3abda184aa6 (diff) |
firewire: Add core firewire stack.
Signed-off-by: Kristian Høgsberg <krh@redhat.com>
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
Diffstat (limited to 'drivers/firewire/fw-topology.h')
-rw-r--r-- | drivers/firewire/fw-topology.h | 84 |
1 files changed, 84 insertions, 0 deletions
diff --git a/drivers/firewire/fw-topology.h b/drivers/firewire/fw-topology.h new file mode 100644 index 000000000000..7582d6e16cbd --- /dev/null +++ b/drivers/firewire/fw-topology.h | |||
@@ -0,0 +1,84 @@ | |||
1 | /* -*- c-basic-offset: 8 -*- | ||
2 | * | ||
3 | * fw-topology.h -- Incremental bus scan, based on bus topology | ||
4 | * | ||
5 | * Copyright (C) 2003-2006 Kristian Hoegsberg <krh@bitplanet.net> | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License as published by | ||
9 | * the Free Software Foundation; either version 2 of the License, or | ||
10 | * (at your option) any later version. | ||
11 | * | ||
12 | * This program is distributed in the hope that it will be useful, | ||
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
15 | * GNU General Public License for more details. | ||
16 | * | ||
17 | * You should have received a copy of the GNU General Public License | ||
18 | * along with this program; if not, write to the Free Software Foundation, | ||
19 | * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | ||
20 | */ | ||
21 | |||
22 | #ifndef __fw_topology_h | ||
23 | #define __fw_topology_h | ||
24 | |||
25 | enum { | ||
26 | FW_NODE_CREATED = 0x00, | ||
27 | FW_NODE_UPDATED = 0x01, | ||
28 | FW_NODE_DESTROYED = 0x02, | ||
29 | FW_NODE_LINK_ON = 0x03, | ||
30 | FW_NODE_LINK_OFF = 0x04 | ||
31 | }; | ||
32 | |||
33 | struct fw_port { | ||
34 | struct fw_node *node; | ||
35 | unsigned speed : 3; /* S100, S200, ... S3200 */ | ||
36 | }; | ||
37 | |||
38 | struct fw_node { | ||
39 | u16 node_id; | ||
40 | u8 color; | ||
41 | u8 port_count; | ||
42 | unsigned link_on : 1; | ||
43 | unsigned initiated_reset : 1; | ||
44 | unsigned b_path : 1; | ||
45 | u8 phy_speed; /* As in the self ID packet. */ | ||
46 | u8 max_speed; /* Minimum of all phy-speeds and port speeds on | ||
47 | * the path from the local node to this node. */ | ||
48 | |||
49 | atomic_t ref_count; | ||
50 | |||
51 | /* For serializing node topology into a list. */ | ||
52 | struct list_head link; | ||
53 | |||
54 | /* Upper layer specific data. */ | ||
55 | void *data; | ||
56 | |||
57 | struct fw_port ports[0]; | ||
58 | }; | ||
59 | |||
60 | extern inline struct fw_node * | ||
61 | fw_node(struct list_head *l) | ||
62 | { | ||
63 | return list_entry (l, struct fw_node, link); | ||
64 | } | ||
65 | |||
66 | extern inline struct fw_node * | ||
67 | fw_node_get(struct fw_node *node) | ||
68 | { | ||
69 | atomic_inc(&node->ref_count); | ||
70 | |||
71 | return node; | ||
72 | } | ||
73 | |||
74 | extern inline void | ||
75 | fw_node_put(struct fw_node *node) | ||
76 | { | ||
77 | if (atomic_dec_and_test(&node->ref_count)) | ||
78 | kfree(node); | ||
79 | } | ||
80 | |||
81 | void | ||
82 | fw_destroy_nodes(struct fw_card *card); | ||
83 | |||
84 | #endif | ||