2007-05-08 02:33:32 +02:00
|
|
|
/*
|
2006-12-20 01:58:27 +01:00
|
|
|
* Copyright (C) 2003-2006 Kristian Hoegsberg <krh@bitplanet.net>
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software Foundation,
|
|
|
|
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __fw_topology_h
|
|
|
|
#define __fw_topology_h
|
|
|
|
|
2009-01-04 16:23:29 +01:00
|
|
|
#include <linux/list.h>
|
|
|
|
#include <linux/slab.h>
|
|
|
|
|
|
|
|
#include <asm/atomic.h>
|
|
|
|
|
2006-12-20 01:58:27 +01:00
|
|
|
enum {
|
2008-03-24 20:54:28 +01:00
|
|
|
FW_NODE_CREATED,
|
|
|
|
FW_NODE_UPDATED,
|
|
|
|
FW_NODE_DESTROYED,
|
|
|
|
FW_NODE_LINK_ON,
|
|
|
|
FW_NODE_LINK_OFF,
|
|
|
|
FW_NODE_INITIATED_RESET,
|
2006-12-20 01:58:27 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
struct fw_node {
|
|
|
|
u16 node_id;
|
2007-01-21 20:44:09 +01:00
|
|
|
u8 color;
|
2006-12-20 01:58:27 +01:00
|
|
|
u8 port_count;
|
2007-06-10 21:31:36 +02:00
|
|
|
u8 link_on : 1;
|
|
|
|
u8 initiated_reset : 1;
|
|
|
|
u8 b_path : 1;
|
|
|
|
u8 phy_speed : 2; /* As in the self ID packet. */
|
|
|
|
u8 max_speed : 2; /* Minimum of all phy-speeds on the path from the
|
|
|
|
* local node to this node. */
|
2007-01-26 06:37:50 +01:00
|
|
|
u8 max_depth : 4; /* Maximum depth to any leaf node */
|
|
|
|
u8 max_hops : 4; /* Max hops in this sub tree */
|
2006-12-20 01:58:27 +01:00
|
|
|
atomic_t ref_count;
|
|
|
|
|
2007-01-21 20:44:09 +01:00
|
|
|
/* For serializing node topology into a list. */
|
2006-12-20 01:58:27 +01:00
|
|
|
struct list_head link;
|
|
|
|
|
|
|
|
/* Upper layer specific data. */
|
|
|
|
void *data;
|
|
|
|
|
2007-06-17 23:39:58 +02:00
|
|
|
struct fw_node *ports[0];
|
2006-12-20 01:58:27 +01:00
|
|
|
};
|
|
|
|
|
2008-12-14 21:47:04 +01:00
|
|
|
static inline struct fw_node *fw_node_get(struct fw_node *node)
|
2006-12-20 01:58:27 +01:00
|
|
|
{
|
|
|
|
atomic_inc(&node->ref_count);
|
|
|
|
|
|
|
|
return node;
|
|
|
|
}
|
|
|
|
|
2008-12-14 21:47:04 +01:00
|
|
|
static inline void fw_node_put(struct fw_node *node)
|
2006-12-20 01:58:27 +01:00
|
|
|
{
|
|
|
|
if (atomic_dec_and_test(&node->ref_count))
|
|
|
|
kfree(node);
|
|
|
|
}
|
|
|
|
|
2009-01-04 16:23:29 +01:00
|
|
|
struct fw_card;
|
2008-12-14 21:47:04 +01:00
|
|
|
void fw_destroy_nodes(struct fw_card *card);
|
2007-05-08 02:33:31 +02:00
|
|
|
|
2008-12-14 21:47:04 +01:00
|
|
|
int fw_compute_block_crc(u32 *block);
|
2007-03-07 18:12:55 +01:00
|
|
|
|
2006-12-28 16:20:00 +01:00
|
|
|
#endif /* __fw_topology_h */
|