summaryrefslogtreecommitdiffstats
path: root/drivers/firewire/fw-topology.h
diff options
context:
space:
mode:
authorKristian Høgsberg <krh@redhat.com>2006-12-19 19:58:27 -0500
committerStefan Richter <stefanr@s5r6.in-berlin.de>2007-03-09 22:02:33 +0100
commit3038e353cfaf548eb94f02b172b9dbe412abd24c (patch)
tree70e50c20e117e2dacb7cd810d00fe595e60d26ce /drivers/firewire/fw-topology.h
parent08e15e81a40e3241ce93b4a43886f3abda184aa6 (diff)
downloadlinux-3038e353cfaf548eb94f02b172b9dbe412abd24c.tar.gz
linux-3038e353cfaf548eb94f02b172b9dbe412abd24c.tar.bz2
linux-3038e353cfaf548eb94f02b172b9dbe412abd24c.zip
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.h84
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 @@
+/* -*- c-basic-offset: 8 -*-
+ *
+ * fw-topology.h -- Incremental bus scan, based on bus topology
+ *
+ * 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
+
+enum {
+ FW_NODE_CREATED = 0x00,
+ FW_NODE_UPDATED = 0x01,
+ FW_NODE_DESTROYED = 0x02,
+ FW_NODE_LINK_ON = 0x03,
+ FW_NODE_LINK_OFF = 0x04
+};
+
+struct fw_port {
+ struct fw_node *node;
+ unsigned speed : 3; /* S100, S200, ... S3200 */
+};
+
+struct fw_node {
+ u16 node_id;
+ u8 color;
+ u8 port_count;
+ unsigned link_on : 1;
+ unsigned initiated_reset : 1;
+ unsigned b_path : 1;
+ u8 phy_speed; /* As in the self ID packet. */
+ u8 max_speed; /* Minimum of all phy-speeds and port speeds on
+ * the path from the local node to this node. */
+
+ atomic_t ref_count;
+
+ /* For serializing node topology into a list. */
+ struct list_head link;
+
+ /* Upper layer specific data. */
+ void *data;
+
+ struct fw_port ports[0];
+};
+
+extern inline struct fw_node *
+fw_node(struct list_head *l)
+{
+ return list_entry (l, struct fw_node, link);
+}
+
+extern inline struct fw_node *
+fw_node_get(struct fw_node *node)
+{
+ atomic_inc(&node->ref_count);
+
+ return node;
+}
+
+extern inline void
+fw_node_put(struct fw_node *node)
+{
+ if (atomic_dec_and_test(&node->ref_count))
+ kfree(node);
+}
+
+void
+fw_destroy_nodes(struct fw_card *card);
+
+#endif