Skip to contentSkip to conversation

ieee1394 fixes

GIT PULL Stefan Richter 1 participant 2 messages Jun 1, 2007 Firewire

lore
Share & tools
lore
#0 lore raw

Linus, please pull from the for-linus branch at

    git://git.kernel.org/pub/scm/linux/kernel/git/ieee1394/linux1394-2.6.git for-linus

to receive the following updates to the old and the new IEEE 1394 subsystem:

- fix hang in s2ram,
- port a sysfs attribute from sbp2 to firewire-sbp2,
- fix userspace-exported headers,
- list new firewire stack in MAINTAINERS.

I'm sorry that the s2ram fix is rather large for an -rc fix but I think it is acceptable in preparation of the very first release of the new firewire stack. Things will get back to normal from now on.

The diff will follow in a reply. The stat and shortlog:

 MAINTAINERS                   |    8 ++
 drivers/firewire/fw-card.c    |    5 -
 drivers/firewire/fw-cdev.c    |   17 +++-
 drivers/firewire/fw-device.h  |    1 +
 drivers/firewire/fw-ohci.c    |  187 +++++++++++++++++++++-----------
 drivers/firewire/fw-sbp2.c    |   53 +++++++++
 drivers/ieee1394/nodemgr.c    |    7 +-
 drivers/ieee1394/nodemgr.h    |    1 +
 drivers/ieee1394/sbp2.c       |   31 +++++-
 include/linux/Kbuild          |    2 +
 include/linux/firewire-cdev.h |   14 ++-
 11 files changed, 247 insertions(+), 79 deletions(-)

Kristian Høgsberg (3):
firewire: Implement suspend/resume PCI driver hooks.
firewire: Change struct fw_cdev_iso_packet to not use bitfields.
firewire: Install firewire-constants.h and firewire-cdev.h for userspace.

Stefan Richter (4):
ieee1394: fix calculation of sysfs attribute "address"
ieee1394: sbp2: offer SAM-conforming target port ID in sysfs
firewire: fw-sbp2: implement sysfs ieee1394_id
firewire: add to MAINTAINERS

Signature · 3 lines
Stefan Richter
-=====-=-=== -==- ----=
http://arcgraph.de/sr/
author Acked-by Kristian Høgsberg
#1 lore raw
Quoted 8 lines

Linus, please pull from the for-linus branch at

    git://git.kernel.org/pub/scm/linux/kernel/git/ieee1394/linux1394-2.6.git for-linus

to receive the following updates to the old and the new IEEE 1394 subsystem:

From a52938f3e2e7c1dd2f00775016703991b7809c42 Mon Sep 17 00:00:00 2001

From: Stefan Richter <[email protected]>
Date: Sun, 27 May 2007 13:11:47 +0200
Subject: [PATCH] ieee1394: fix calculation of sysfs attribute "address"

struct csr1212_keyval.offset is relative to 0xffff f000 0000 rather than 0xffff f000 0400.

---
 drivers/ieee1394/nodemgr.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/ieee1394/nodemgr.c +1 -1
index 835937e..c291602 100644
@@ -976,7 +976,7 @@ static struct unit_directory *nodemgr_process_unit_directory
 
 	ud->ne = ne;
 	ud->ignore_driver = ignore_drivers;
-	ud->address = ud_kv->offset + CSR1212_CONFIG_ROM_SPACE_BASE;
+	ud->address = ud_kv->offset + CSR1212_REGISTER_SPACE_BASE;
 	ud->ud_kv = ud_kv;
 	ud->id = (*id)++;
 
Signature · 1 line
1.5.1.6
Quoted 1 line

From d7794c86686a05276de42f145e485099426aca68 Mon Sep 17 00:00:00 2001

From: Stefan Richter <[email protected]>
Date: Sun, 27 May 2007 13:17:15 +0200
Subject: [PATCH] ieee1394: sbp2: offer SAM-conforming target port ID in sysfs

With "modprobe sbp2 long_ieee1394_id=y", the format of /sys/bus/scsi/devices/*:*:*:*/ieee1394_id is changed from e.g. 0001041010004beb:0:0 to 0001041010004beb:00042c:0000.

The longer format fully conforms to object identifier sizes as per SAM(-2...4) and reflects what the SAM target port identifier is meant to
contain: A Discovery ID allegedly specified by ISO/IEC 13213:1994 --- however there is no such thing; the authors of SAM probably meant Directory ID). Especially target nodes with multiple dynamically added targets may use Directory IDs to persistently identify target ports.

The new format is independent of implementation details of nodemgr. Thus the same ieee1394_id attribute format can be implemented in the new firewire stack.

The ieee1394_id is typically used to create persistently named links in /dev/disk/by-id.

---
 drivers/ieee1394/nodemgr.c |    5 +++++
 drivers/ieee1394/nodemgr.h |    1 +
 drivers/ieee1394/sbp2.c    |   31 +++++++++++++++++++++++++++++--
 3 files changed, 35 insertions(+), 2 deletions(-)
drivers/ieee1394/nodemgr.c +5 -0
index c291602..81b3864 100644
@@ -977,6 +977,7 @@ static struct unit_directory *nodemgr_process_unit_directory
 	ud->ne = ne;
 	ud->ignore_driver = ignore_drivers;
 	ud->address = ud_kv->offset + CSR1212_REGISTER_SPACE_BASE;
+	ud->directory_id = ud->address & 0xffffff;
 	ud->ud_kv = ud_kv;
 	ud->id = (*id)++;
 
@@ -1085,6 +1086,10 @@ static struct unit_directory *nodemgr_process_unit_directory
 
 			break;
 
+		case CSR1212_KV_ID_DIRECTORY_ID:
+			ud->directory_id = kv->value.immediate;
+			break;
+
 		default:
 			break;
 		}
drivers/ieee1394/nodemgr.h +1 -0
index e7ac683..4530b29 100644
@@ -75,6 +75,7 @@ struct unit_directory {
 	struct csr1212_keyval *model_name_kv;
 	quadlet_t specifier_id;
 	quadlet_t version;
+	quadlet_t directory_id;
 
 	unsigned int id;
 
drivers/ieee1394/sbp2.c +29 -2
index 875eadd..3f873cc 100644
@@ -194,6 +194,27 @@ MODULE_PARM_DESC(workarounds, "Work around device bugs (default = 0"
 	", override internal blacklist = " __stringify(SBP2_WORKAROUND_OVERRIDE)
 	", or a combination)");
 
+/*
+ * This influences the format of the sysfs attribute
+ * /sys/bus/scsi/devices/.../ieee1394_id.
+ *
+ * The default format is like in older kernels:  %016Lx:%d:%d
+ * It contains the target's EUI-64, a number given to the logical unit by
+ * the ieee1394 driver's nodemgr (starting at 0), and the LUN.
+ *
+ * The long format is:  %016Lx:%06x:%04x
+ * It contains the target's EUI-64, the unit directory's directory_ID as per
+ * IEEE 1212 clause 7.7.19, and the LUN.  This format comes closest to the
+ * format of SBP(-3) target port and logical unit identifier as per SAM (SCSI
+ * Architecture Model) rev.2 to 4 annex A.  Therefore and because it is
+ * independent of the implementation of the ieee1394 nodemgr, the longer format
+ * is recommended for future use.
+ */
+static int sbp2_long_sysfs_ieee1394_id;
+module_param_named(long_ieee1394_id, sbp2_long_sysfs_ieee1394_id, bool, 0644);
+MODULE_PARM_DESC(long_ieee1394_id, "8+3+2 bytes format of ieee1394_id in sysfs "
+		 "(default = backwards-compatible = N, SAM-conforming = Y)");
+
 
 #define SBP2_INFO(fmt, args...)	HPSB_INFO("sbp2: "fmt, ## args)
 #define SBP2_ERR(fmt, args...)	HPSB_ERR("sbp2: "fmt, ## args)
@@ -2100,8 +2121,14 @@ static ssize_t sbp2_sysfs_ieee1394_id_show(struct device *dev,
 	if (!(lu = (struct sbp2_lu *)sdev->host->hostdata[0]))
 		return 0;
 
-	return sprintf(buf, "%016Lx:%d:%d\n", (unsigned long long)lu->ne->guid,
-		       lu->ud->id, ORB_SET_LUN(lu->lun));
+	if (sbp2_long_sysfs_ieee1394_id)
+		return sprintf(buf, "%016Lx:%06x:%04x\n",
+				(unsigned long long)lu->ne->guid,
+				lu->ud->directory_id, ORB_SET_LUN(lu->lun));
+	else
+		return sprintf(buf, "%016Lx:%d:%d\n",
+				(unsigned long long)lu->ne->guid,
+				lu->ud->id, ORB_SET_LUN(lu->lun));
 }
 
 MODULE_AUTHOR("Ben Collins <[email protected]>");
Signature · 1 line
1.5.1.6
Quoted 1 line

From 14e2198646d92ef52a69d20269580a3fbe7c996b Mon Sep 17 00:00:00 2001

From: Stefan Richter <[email protected]>
Date: Sun, 27 May 2007 13:18:27 +0200
Subject: [PATCH] firewire: fw-sbp2: implement sysfs ieee1394_id
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit

The attribute /sys/bus/scsi/devices/*:*:*:*/ieee1394_id, as generated by the old sbp2 driver, is typically used to create persistently named links in /dev/disk/by-id.

---
 drivers/firewire/fw-device.h |    1 +
 drivers/firewire/fw-sbp2.c   |   53 ++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 54 insertions(+), 0 deletions(-)
drivers/firewire/fw-device.h +1 -0
index 0ba9d64..af1723e 100644
@@ -99,6 +99,7 @@ fw_unit(struct device *dev)
 #define CSR_DEPENDENT_INFO	0x14
 #define CSR_MODEL		0x17
 #define CSR_INSTANCE		0x18
+#define CSR_DIRECTORY_ID	0x20
 
 #define SBP2_COMMAND_SET_SPECIFIER	0x38
 #define SBP2_COMMAND_SET		0x39
drivers/firewire/fw-sbp2.c +53 -0

65 lines not on this page · raw message

Signature · 1 line
1.5.1.6
Quoted 1 line

From b32744751e751e0abb184cf3b7359c9387a4bdf8 Mon Sep 17 00:00:00 2001

From: Stefan Richter <[email protected]>
Date: Wed, 30 May 2007 20:44:52 -0400
Subject: [PATCH] firewire: add to MAINTAINERS
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit

---
 MAINTAINERS |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)
MAINTAINERS +8 -0
index 4cc17b9..f63d03a 100644
@@ -1486,6 +1486,14 @@ P:	Alexander Viro
 M:	[email protected]
 S:	Maintained
 
+FIREWIRE SUBSYSTEM
+P:	Kristian Hoegsberg, Stefan Richter
+M:	[email protected], [email protected]
+L:	[email protected]
+W:	http://www.linux1394.org/
+T:	git kernel.org:/pub/scm/linux/kernel/git/ieee1394/linux1394-2.6.git
+S:	Maintained
+
 FIRMWARE LOADER (request_firmware)
 L:	[email protected]
 S:	Orphan
Signature · 1 line
1.5.1.6
Quoted 1 line

From 2aef469a35a273609beaa7094d5a07c1f6d75285 Mon Sep 17 00:00:00 2001

From: =?utf-8?q?Kristian_H=C3=B8gsberg?= <[email protected]>
Date: Wed, 30 May 2007 19:06:35 -0400
Subject: [PATCH] firewire: Implement suspend/resume PCI driver hooks.
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit

It's a low-impact design, that just makes suspend/resume look like a bus reset to the upper level drivers, but it should be sufficient.

---
 drivers/firewire/fw-card.c |    5 -
 drivers/firewire/fw-ohci.c |  187 +++++++++++++++++++++++++++++---------------
 2 files changed, 123 insertions(+), 69 deletions(-)
drivers/firewire/fw-card.c +0 -5
index 636151a..9eb1eda 100644
@@ -407,11 +407,6 @@ fw_card_add(struct fw_card *card,
 	card->link_speed = link_speed;
 	card->guid = guid;
 
-	/* Activate link_on bit and contender bit in our self ID packets.*/
-	if (card->driver->update_phy_reg(card, 4, 0,
-					 PHY_LINK_ACTIVE | PHY_CONTENDER) < 0)
-		return -EIO;
-
 	/*
 	 * The subsystem grabs a reference when the card is added and
 	 * drops it when the driver calls fw_core_remove_card.
drivers/firewire/fw-ohci.c +123 -64

242 lines not on this page · raw message

Signature · 1 line
1.5.1.6
Quoted 1 line

From 1ca31ae7cfed3e2a8e48fbf6ed6cac06495b6158 Mon Sep 17 00:00:00 2001

From: =?utf-8?q?Kristian_H=C3=B8gsberg?= <[email protected]>
Date: Thu, 31 May 2007 11:16:43 -0400
Subject: [PATCH] firewire: Change struct fw_cdev_iso_packet to not use bitfields.
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit

The struct is part of the userspace interface and can not use bitfields. This patch replaces the bitfields with a __u32 'control' word and provides access macros to set the bits.

---
 drivers/firewire/fw-cdev.c    |   17 ++++++++++++++++-
 include/linux/firewire-cdev.h |   14 ++++++++------
 2 files changed, 24 insertions(+), 7 deletions(-)
drivers/firewire/fw-cdev.c +16 -1
index 3ab3585..5d402d6 100644
@@ -677,12 +677,21 @@ static int ioctl_create_iso_context(struct client *client, void *buffer)
 	return 0;
 }
 
+/* Macros for decoding the iso packet control header. */
+#define GET_PAYLOAD_LENGTH(v)	((v) & 0xffff)
+#define GET_INTERRUPT(v)	(((v) >> 16) & 0x01)
+#define GET_SKIP(v)		(((v) >> 17) & 0x01)
+#define GET_TAG(v)		(((v) >> 18) & 0x02)
+#define GET_SY(v)		(((v) >> 20) & 0x04)
+#define GET_HEADER_LENGTH(v)	(((v) >> 24) & 0xff)
+
 static int ioctl_queue_iso(struct client *client, void *buffer)
 {
 	struct fw_cdev_queue_iso *request = buffer;
 	struct fw_cdev_iso_packet __user *p, *end, *next;
 	struct fw_iso_context *ctx = client->iso_context;
 	unsigned long payload, buffer_end, header_length;
+	u32 control;
 	int count;
 	struct {
 		struct fw_iso_packet packet;
@@ -717,8 +726,14 @@ static int ioctl_queue_iso(struct client *client, void *buffer)
 	end = (void __user *)p + request->size;
 	count = 0;
 	while (p < end) {
-		if (__copy_from_user(&u.packet, p, sizeof(*p)))
+		if (get_user(control, &p->control))
 			return -EFAULT;
+		u.packet.payload_length = GET_PAYLOAD_LENGTH(control);
+		u.packet.interrupt = GET_INTERRUPT(control);
+		u.packet.skip = GET_SKIP(control);
+		u.packet.tag = GET_TAG(control);
+		u.packet.sy = GET_SY(control);
+		u.packet.header_length = GET_HEADER_LENGTH(control);
 
 		if (ctx->type == FW_ISO_CONTEXT_TRANSMIT) {
 			header_length = u.packet.header_length;
include/linux/firewire-cdev.h +8 -6
index d4455eb..efbe1fd 100644
@@ -198,13 +198,15 @@ struct fw_cdev_create_iso_context {
 	__u32 handle;
 };
 
+#define FW_CDEV_ISO_PAYLOAD_LENGTH(v)	(v)
+#define FW_CDEV_ISO_INTERRUPT		(1 << 16)
+#define FW_CDEV_ISO_SKIP		(1 << 17)
+#define FW_CDEV_ISO_TAG(v)		((v) << 18)
+#define FW_CDEV_ISO_SY(v)		((v) << 20)
+#define FW_CDEV_ISO_HEADER_LENGTH(v)	((v) << 24)
+
 struct fw_cdev_iso_packet {
-	__u16 payload_length;	/* Length of indirect payload. */
-	__u32 interrupt : 1;	/* Generate interrupt on this packet */
-	__u32 skip : 1;		/* Set to not send packet at all. */
-	__u32 tag : 2;
-	__u32 sy : 4;
-	__u32 header_length : 8;	/* Length of immediate header. */
+	__u32 control;
 	__u32 header[0];
 };
 
Signature · 1 line
1.5.1.6
Quoted 1 line

From ca9a7af35f1ce4a990c6c3aace65ed36f89d50bf Mon Sep 17 00:00:00 2001

From: =?utf-8?q?Kristian_H=C3=B8gsberg?= <[email protected]>
Date: Thu, 31 May 2007 11:36:23 -0400
Subject: [PATCH] firewire: Install firewire-constants.h and firewire-cdev.h for userspace.
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit

This just adds them to include/linux/Kbuild using header-y.

---
 include/linux/Kbuild |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
include/linux/Kbuild +2 -0
index e101315..f317c27 100644
@@ -62,6 +62,8 @@ header-y += fadvise.h
 header-y += fd.h
 header-y += fdreg.h
 header-y += fib_rules.h
+header-y += firewire-cdev.h
+header-y += firewire-constants.h
 header-y += fuse.h
 header-y += genetlink.h
 header-y += gen_stats.h
Signature · 6 lines
1.5.1.6

-- 
Stefan Richter
-=====-=-=== -==- ----=
http://arcgraph.de/sr/