[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1328989452-20921-13-git-send-email-bootc@bootc.net>
Date: Sat, 11 Feb 2012 19:44:11 +0000
From: Chris Boot <bootc@...tc.net>
To: linux1394-devel@...ts.sourceforge.net, target-devel@...r.kernel.org
Cc: linux-kernel@...r.kernel.org, agrover@...hat.com,
clemens@...isch.de, nab@...ux-iscsi.org, stefanr@...6.in-berlin.de,
Chris Boot <bootc@...tc.net>
Subject: [PATCH 12/13] firewire-sbp-target: Add sbp_util.{c,h}
Common helper functions and global declarations.
Signed-off-by: Chris Boot <bootc@...tc.net>
Cc: Andy Grover <agrover@...hat.com>
Cc: Clemens Ladisch <clemens@...isch.de>
Cc: Nicholas A. Bellinger <nab@...ux-iscsi.org>
Cc: Stefan Richter <stefanr@...6.in-berlin.de>
---
drivers/target/sbp/sbp_util.c | 36 ++++++++++++++++++++++++++++++++++++
drivers/target/sbp/sbp_util.h | 15 +++++++++++++++
2 files changed, 51 insertions(+), 0 deletions(-)
create mode 100644 drivers/target/sbp/sbp_util.c
create mode 100644 drivers/target/sbp/sbp_util.h
diff --git a/drivers/target/sbp/sbp_util.c b/drivers/target/sbp/sbp_util.c
new file mode 100644
index 0000000..33073b1
--- /dev/null
+++ b/drivers/target/sbp/sbp_util.c
@@ -0,0 +1,36 @@
+/*
+ * SBP2 target driver (SCSI over IEEE1394 in target mode)
+ *
+ * Copyright (C) 2011 Chris Boot <bootc@...tc.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.
+ */
+
+#define KMSG_COMPONENT "sbp_target"
+#define pr_fmt(fmt) KMSG_COMPONENT ": " fmt
+
+#include <linux/firewire.h>
+#include <linux/firewire-constants.h>
+
+#include <target/target_core_base.h>
+
+#include "sbp_base.h"
+#include "sbp_util.h"
+
+const struct fw_address_region sbp_register_region = {
+ .start = CSR_REGISTER_BASE + 0x10000,
+ .end = 0x1000000000000ULL,
+};
+
diff --git a/drivers/target/sbp/sbp_util.h b/drivers/target/sbp/sbp_util.h
new file mode 100644
index 0000000..cd3e00d
--- /dev/null
+++ b/drivers/target/sbp/sbp_util.h
@@ -0,0 +1,15 @@
+
+extern const struct fw_address_region sbp_register_region;
+
+static inline u64 sbp2_pointer_to_addr(const struct sbp2_pointer *ptr)
+{
+ return (u64)(be32_to_cpu(ptr->high) & 0x0000ffff) << 32 |
+ (be32_to_cpu(ptr->low) & 0xfffffffc);
+}
+
+static inline void addr_to_sbp2_pointer(u64 addr, struct sbp2_pointer *ptr)
+{
+ ptr->high = cpu_to_be32(addr >> 32);
+ ptr->low = cpu_to_be32(addr);
+}
+
--
1.7.9
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists