2 * Copyright (C) 2003-2006 Kristian Hoegsberg <krh@bitplanet.net>
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software Foundation,
16 * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19 #ifndef __fw_topology_h
20 #define __fw_topology_h
22 #include <linux/list.h>
23 #include <linux/slab.h>
25 #include <asm/atomic.h>
33 FW_NODE_INITIATED_RESET,
41 u8 initiated_reset : 1;
43 u8 phy_speed : 2; /* As in the self ID packet. */
44 u8 max_speed : 2; /* Minimum of all phy-speeds on the path from the
45 * local node to this node. */
46 u8 max_depth : 4; /* Maximum depth to any leaf node */
47 u8 max_hops : 4; /* Max hops in this sub tree */
50 /* For serializing node topology into a list. */
51 struct list_head link;
53 /* Upper layer specific data. */
56 struct fw_node *ports[0];
59 static inline struct fw_node *fw_node_get(struct fw_node *node)
61 atomic_inc(&node->ref_count);
66 static inline void fw_node_put(struct fw_node *node)
68 if (atomic_dec_and_test(&node->ref_count))
73 void fw_destroy_nodes(struct fw_card *card);
75 int fw_compute_block_crc(u32 *block);
77 #endif /* __fw_topology_h */