rpms/kernel/devel config-generic, 1.76, 1.77 kernel.spec, 1.464, 1.465 linux-2.6-firewire-git-pending.patch, 1.8, 1.9

Jarod Wilson (jwilson) fedora-extras-commits at redhat.com
Sun Mar 2 05:09:39 UTC 2008


Author: jwilson

Update of /cvs/pkgs/rpms/kernel/devel
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv32317

Modified Files:
	config-generic kernel.spec 
	linux-2.6-firewire-git-pending.patch 
Log Message:
* Sun Mar 01 2008 Jarod Wilson <jwilson at redhat.com>
- firewire: fix suspend/resume on older PowerPC Macs (#312871)
- firewire: support for first-gen Apple UniNorth controller
- firewire: add option for remote debugging



Index: config-generic
===================================================================
RCS file: /cvs/pkgs/rpms/kernel/devel/config-generic,v
retrieving revision 1.76
retrieving revision 1.77
diff -u -r1.76 -r1.77
--- config-generic	25 Feb 2008 05:35:20 -0000	1.76
+++ config-generic	2 Mar 2008 05:08:48 -0000	1.77
@@ -3462,3 +3462,4 @@
 # CONFIG_RT_GROUP_SCHED is not set
 CONFIG_CGROUP_SCHED=y
 
+# CONFIG_FIREWIRE_OHCI_REMOTE_DMA is not set


Index: kernel.spec
===================================================================
RCS file: /cvs/pkgs/rpms/kernel/devel/kernel.spec,v
retrieving revision 1.464
retrieving revision 1.465
diff -u -r1.464 -r1.465
--- kernel.spec	29 Feb 2008 22:52:39 -0000	1.464
+++ kernel.spec	2 Mar 2008 05:08:48 -0000	1.465
@@ -1736,6 +1736,11 @@
 %kernel_variant_files -a /%{image_install_path}/xen*-%{KVERREL} -e /etc/ld.so.conf.d/kernelcap-%{KVERREL}.conf %{with_xen} xen
 
 %changelog
+* Sun Mar 01 2008 Jarod Wilson <jwilson at redhat.com>
+- firewire: fix suspend/resume on older PowerPC Macs (#312871)
+- firewire: support for first-gen Apple UniNorth controller
+- firewire: add option for remote debugging
+
 * Fri Feb 29 2008 Kyle McMartin <kmcmartin at redhat.com>
 - Linux 2.6.25-rc3-git2
 

linux-2.6-firewire-git-pending.patch:

Index: linux-2.6-firewire-git-pending.patch
===================================================================
RCS file: /cvs/pkgs/rpms/kernel/devel/linux-2.6-firewire-git-pending.patch,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- linux-2.6-firewire-git-pending.patch	27 Feb 2008 21:43:12 -0000	1.8
+++ linux-2.6-firewire-git-pending.patch	2 Mar 2008 05:08:48 -0000	1.9
@@ -9,6 +9,7 @@
 Signed-off-by: Stefan Richter <stefanr at s5r6.in-berlin.de>
 Cc: sparclinux at vger.kernel.org
 Cc: linuxppc-dev at ozlabs.org
+Signed-off-by: Jarod Wilson <jwilson at redhat.com>
 ---
 
 This patch is a shot in the dark, based on a warning when building with
@@ -64,6 +65,7 @@
 Signed-off-by: Stefan Richter <stefanr at s5r6.in-berlin.de>
 Cc: sparclinux at vger.kernel.org
 Cc: linuxppc-dev at ozlabs.org
+Signed-off-by: Jarod Wilson <jwilson at redhat.com>
 ---
  drivers/firewire/fw-ohci.c        |    4 ++--
  drivers/firewire/fw-transaction.c |    2 +-
@@ -291,6 +293,7 @@
 card.
 
 Signed-off-by: Stefan Richter <stefanr at s5r6.in-berlin.de>
+Signed-off-by: Jarod Wilson <jwilson at redhat.com>
 ---
  drivers/firewire/fw-card.c     |   51 ++++++++++++++++++++++-----------
  drivers/firewire/fw-topology.c |    1 
@@ -519,6 +522,7 @@
 to be shut down.
 
 Signed-off-by: Stefan Richter <stefanr at s5r6.in-berlin.de>
+Signed-off-by: Jarod Wilson <jwilson at redhat.com>
 ---
 
 Update:  Refreshed to be applicable after patch "firewire: fw-sbp2:
@@ -717,6 +721,7 @@
 automatic module unloading" added another counter of card users.
 
 Signed-off-by: Stefan Richter <stefanr at s5r6.in-berlin.de>
+Signed-off-by: Jarod Wilson <jwilson at redhat.com>
 ---
  drivers/firewire/fw-card.c        |   38 ------------------------------
  drivers/firewire/fw-ohci.c        |    8 +++---
@@ -855,6 +860,7 @@
 sbp2_probe.  Fixed by moving the _get further up.
 
 Signed-off-by: Stefan Richter <stefanr at s5r6.in-berlin.de>
+Signed-off-by: Jarod Wilson <jwilson at redhat.com>
 ---
  drivers/firewire/fw-sbp2.c |    3 +--
  1 file changed, 1 insertion(+), 2 deletions(-)
@@ -891,6 +897,7 @@
 Remove some line breaks.
 
 Signed-off-by: Stefan Richter <stefanr at s5r6.in-berlin.de>
+Signed-off-by: Jarod Wilson <jwilson at redhat.com>
 ---
  drivers/firewire/fw-device.h |   27 +++++++++++++++++----------
  drivers/firewire/fw-sbp2.c   |    4 ++--
@@ -988,3 +995,730 @@
 http://arcgraph.de/sr/
 
 
+Write directly in big endian instead of byte-swapping after the fact.
+This saves a few conversions, lets gcc use constant endianess
+conversions where possible, and enables deeper endianess annotation.
+
+Signed-off-by: Stefan Richter <stefanr at s5r6.in-berlin.de>
+---
+ drivers/firewire/fw-sbp2.c |   96 ++++++++++++++++---------------------
+ 1 file changed, 44 insertions(+), 52 deletions(-)
+
+Index: linux/drivers/firewire/fw-sbp2.c
+===================================================================
+--- linux.orig/drivers/firewire/fw-sbp2.c
++++ linux/drivers/firewire/fw-sbp2.c
+@@ -223,8 +223,8 @@ struct sbp2_status {
+ };
+ 
+ struct sbp2_pointer {
+-	u32 high;
+-	u32 low;
++	__be32 high;
++	__be32 low;
+ };
+ 
+ struct sbp2_orb {
+@@ -252,8 +252,8 @@ struct sbp2_management_orb {
+ 	struct {
+ 		struct sbp2_pointer password;
+ 		struct sbp2_pointer response;
+-		u32 misc;
+-		u32 length;
++		__be32 misc;
++		__be32 length;
+ 		struct sbp2_pointer status_fifo;
+ 	} request;
+ 	__be32 response[4];
+@@ -262,13 +262,10 @@ struct sbp2_management_orb {
+ 	struct sbp2_status status;
+ };
+ 
+-#define LOGIN_RESPONSE_GET_LOGIN_ID(v)	((v).misc & 0xffff)
+-#define LOGIN_RESPONSE_GET_LENGTH(v)	(((v).misc >> 16) & 0xffff)
+-
+ struct sbp2_login_response {
+-	u32 misc;
++	__be32 misc;
+ 	struct sbp2_pointer command_block_agent;
+-	u32 reconnect_hold;
++	__be32 reconnect_hold;
+ };
+ #define COMMAND_ORB_DATA_SIZE(v)	((v))
+ #define COMMAND_ORB_PAGE_SIZE(v)	((v) << 16)
+@@ -284,7 +281,7 @@ struct sbp2_command_orb {
+ 	struct {
+ 		struct sbp2_pointer next;
+ 		struct sbp2_pointer data_descriptor;
+-		u32 misc;
++		__be32 misc;
+ 		u8 command_block[12];
+ 	} request;
+ 	struct scsi_cmnd *cmd;
+@@ -453,8 +450,7 @@ sbp2_send_orb(struct sbp2_orb *orb, stru
+ 	unsigned long flags;
+ 
+ 	orb->pointer.high = 0;
+-	orb->pointer.low = orb->request_bus;
+-	fw_memcpy_to_be32(&orb->pointer, &orb->pointer, sizeof(orb->pointer));
++	orb->pointer.low = cpu_to_be32(orb->request_bus);
+ 
+ 	spin_lock_irqsave(&device->card->lock, flags);
+ 	list_add_tail(&orb->link, &lu->orb_list);
+@@ -530,31 +526,31 @@ sbp2_send_management_orb(struct sbp2_log
+ 	if (dma_mapping_error(orb->response_bus))
+ 		goto fail_mapping_response;
+ 
+-	orb->request.response.high    = 0;
+-	orb->request.response.low     = orb->response_bus;
++	orb->request.response.high = 0;
++	orb->request.response.low  = cpu_to_be32(orb->response_bus);
+ 
+-	orb->request.misc =
++	orb->request.misc = cpu_to_be32(
+ 		MANAGEMENT_ORB_NOTIFY |
+ 		MANAGEMENT_ORB_FUNCTION(function) |
+-		MANAGEMENT_ORB_LUN(lun_or_login_id);
+-	orb->request.length =
+-		MANAGEMENT_ORB_RESPONSE_LENGTH(sizeof(orb->response));
+-
+-	orb->request.status_fifo.high = lu->address_handler.offset >> 32;
+-	orb->request.status_fifo.low  = lu->address_handler.offset;
++		MANAGEMENT_ORB_LUN(lun_or_login_id));
++	orb->request.length = cpu_to_be32(
++		MANAGEMENT_ORB_RESPONSE_LENGTH(sizeof(orb->response)));
++
++	orb->request.status_fifo.high =
++		cpu_to_be32(lu->address_handler.offset >> 32);
++	orb->request.status_fifo.low  =
++		cpu_to_be32(lu->address_handler.offset);
+ 
+ 	if (function == SBP2_LOGIN_REQUEST) {
+ 		/* Ask for 2^2 == 4 seconds reconnect grace period */
+-		orb->request.misc |=
++		orb->request.misc |= cpu_to_be32(
+ 			MANAGEMENT_ORB_RECONNECT(2) |
+-			MANAGEMENT_ORB_EXCLUSIVE(sbp2_param_exclusive_login);
++			MANAGEMENT_ORB_EXCLUSIVE(sbp2_param_exclusive_login));
+ 		timeout = lu->tgt->mgt_orb_timeout;
+ 	} else {
+ 		timeout = SBP2_ORB_TIMEOUT;
+ 	}
+ 
+-	fw_memcpy_to_be32(&orb->request, &orb->request, sizeof(orb->request));
+-
+ 	init_completion(&orb->done);
+ 	orb->base.callback = complete_management_orb;
+ 
+@@ -599,8 +595,7 @@ sbp2_send_management_orb(struct sbp2_log
+ 			 sizeof(orb->response), DMA_FROM_DEVICE);
+  fail_mapping_response:
+ 	if (response)
+-		fw_memcpy_from_be32(response,
+-				    orb->response, sizeof(orb->response));
++		memcpy(response, orb->response, sizeof(orb->response));
+ 	kref_put(&orb->base.kref, free_orb);
+ 
+ 	return retval;
+@@ -855,11 +850,10 @@ static void sbp2_login(struct work_struc
+ 	tgt->address_high = local_node_id << 16;
+ 	sbp2_set_generation(lu, generation);
+ 
+-	/* Get command block agent offset and login id. */
+ 	lu->command_block_agent_address =
+-		((u64) (response.command_block_agent.high & 0xffff) << 32) |
+-		response.command_block_agent.low;
+-	lu->login_id = LOGIN_RESPONSE_GET_LOGIN_ID(response);
++		((u64)(be32_to_cpu(response.command_block_agent.high) & 0xffff)
++		      << 32) | be32_to_cpu(response.command_block_agent.low);
++	lu->login_id = be32_to_cpu(response.misc) & 0xffff;
+ 
+ 	fw_notify("%s: logged in to LUN %04x (%d retries)\n",
+ 		  tgt->bus_id, lu->lun, lu->retries);
+@@ -1338,9 +1332,12 @@ sbp2_map_scatterlist(struct sbp2_command
+ 	 * tables.
+ 	 */
+ 	if (count == 1 && sg_dma_len(sg) < SBP2_MAX_SG_ELEMENT_LENGTH) {
+-		orb->request.data_descriptor.high = lu->tgt->address_high;
+-		orb->request.data_descriptor.low  = sg_dma_address(sg);
+-		orb->request.misc |= COMMAND_ORB_DATA_SIZE(sg_dma_len(sg));
++		orb->request.data_descriptor.high =
++			cpu_to_be32(lu->tgt->address_high);
++		orb->request.data_descriptor.low  =
++			cpu_to_be32(sg_dma_address(sg));
++		orb->request.misc |=
++			cpu_to_be32(COMMAND_ORB_DATA_SIZE(sg_dma_len(sg)));
+ 		return 0;
+ 	}
+ 
+@@ -1361,16 +1358,14 @@ sbp2_map_scatterlist(struct sbp2_command
+ 				goto fail_page_table;
+ 			}
+ 			l = min(sg_len, SBP2_MAX_SG_ELEMENT_LENGTH);
+-			orb->page_table[j].low = sg_addr;
+-			orb->page_table[j].high = (l << 16);
++			orb->page_table[j].low = cpu_to_be32(sg_addr);
++			orb->page_table[j].high = cpu_to_be32(l << 16);
+ 			sg_addr += l;
+ 			sg_len -= l;
+ 			j++;
+ 		}
+ 	}
+ 
+-	fw_memcpy_to_be32(orb->page_table, orb->page_table,
+-			  sizeof(orb->page_table[0]) * j);
+ 	orb->page_table_bus =
+ 		dma_map_single(device->card->device, orb->page_table,
+ 			       sizeof(orb->page_table), DMA_TO_DEVICE);
+@@ -1384,11 +1379,10 @@ sbp2_map_scatterlist(struct sbp2_command
+ 	 * initiator (i.e. us), but data_descriptor can refer to data
+ 	 * on other nodes so we need to put our ID in descriptor.high.
+ 	 */
+-	orb->request.data_descriptor.high = lu->tgt->address_high;
+-	orb->request.data_descriptor.low  = orb->page_table_bus;
+-	orb->request.misc |=
+-		COMMAND_ORB_PAGE_TABLE_PRESENT |
+-		COMMAND_ORB_DATA_SIZE(j);
++	orb->request.data_descriptor.high = cpu_to_be32(lu->tgt->address_high);
++	orb->request.data_descriptor.low  = cpu_to_be32(orb->page_table_bus);
++	orb->request.misc |= cpu_to_be32(COMMAND_ORB_PAGE_TABLE_PRESENT |
++					 COMMAND_ORB_DATA_SIZE(j));
+ 
+ 	return 0;
+ 
+@@ -1434,7 +1428,7 @@ static int sbp2_scsi_queuecommand(struct
+ 	orb->done = done;
+ 	orb->cmd  = cmd;
+ 
+-	orb->request.next.high   = SBP2_ORB_NULL;
++	orb->request.next.high   = cpu_to_be32(SBP2_ORB_NULL);
+ 	orb->request.next.low    = 0x0;
+ 	/*
+ 	 * At speed 100 we can do 512 bytes per packet, at speed 200,
+@@ -1444,23 +1438,21 @@ static int sbp2_scsi_queuecommand(struct
+ 	 */
+ 	max_payload = min(device->max_speed + 7,
+ 			  device->card->max_receive - 1);
+-	orb->request.misc =
++	orb->request.misc = cpu_to_be32(
+ 		COMMAND_ORB_MAX_PAYLOAD(max_payload) |
+ 		COMMAND_ORB_SPEED(device->max_speed) |
+-		COMMAND_ORB_NOTIFY;
++		COMMAND_ORB_NOTIFY);
+ 
+ 	if (cmd->sc_data_direction == DMA_FROM_DEVICE)
+-		orb->request.misc |=
+-			COMMAND_ORB_DIRECTION(SBP2_DIRECTION_FROM_MEDIA);
++		orb->request.misc |= cpu_to_be32(
++			COMMAND_ORB_DIRECTION(SBP2_DIRECTION_FROM_MEDIA));
+ 	else if (cmd->sc_data_direction == DMA_TO_DEVICE)
+-		orb->request.misc |=
+-			COMMAND_ORB_DIRECTION(SBP2_DIRECTION_TO_MEDIA);
++		orb->request.misc |= cpu_to_be32(
++			COMMAND_ORB_DIRECTION(SBP2_DIRECTION_TO_MEDIA));
+ 
+ 	if (scsi_sg_count(cmd) && sbp2_map_scatterlist(orb, device, lu) < 0)
+ 		goto out;
+ 
+-	fw_memcpy_to_be32(&orb->request, &orb->request, sizeof(orb->request));
+-
+ 	memset(orb->request.command_block,
+ 	       0, sizeof(orb->request.command_block));
+ 	memcpy(orb->request.command_block, cmd->cmnd, COMMAND_SIZE(*cmd->cmnd));
+
+-- 
+Stefan Richter
+-=====-==--- --=- ===--
+http://arcgraph.de/sr/
+
+
+How hard can it be to switch on one bit? :-)
+
+Signed-off-by: Stefan Richter <stefanr at s5r6.in-berlin.de>
+---
+ drivers/firewire/fw-sbp2.c |   11 ++---------
+ 1 file changed, 2 insertions(+), 9 deletions(-)
+
+Index: linux/drivers/firewire/fw-sbp2.c
+===================================================================
+--- linux.orig/drivers/firewire/fw-sbp2.c
++++ linux/drivers/firewire/fw-sbp2.c
+@@ -174,9 +174,6 @@ struct sbp2_target {
+ #define SBP2_ORB_NULL			0x80000000
+ #define SBP2_MAX_SG_ELEMENT_LENGTH	0xf000
+ 
+-#define SBP2_DIRECTION_TO_MEDIA		0x0
+-#define SBP2_DIRECTION_FROM_MEDIA	0x1
+-
+ /* Unit directory keys */
+ #define SBP2_CSR_UNIT_CHARACTERISTICS	0x3a
+ #define SBP2_CSR_FIRMWARE_REVISION	0x3c
+@@ -272,7 +269,7 @@ struct sbp2_login_response {
+ #define COMMAND_ORB_PAGE_TABLE_PRESENT	((1) << 19)
+ #define COMMAND_ORB_MAX_PAYLOAD(v)	((v) << 20)
+ #define COMMAND_ORB_SPEED(v)		((v) << 24)
+-#define COMMAND_ORB_DIRECTION(v)	((v) << 27)
++#define COMMAND_ORB_DIRECTION		((1) << 27)
+ #define COMMAND_ORB_REQUEST_FORMAT(v)	((v) << 29)
+ #define COMMAND_ORB_NOTIFY		((1) << 31)
+ 
+@@ -1444,11 +1441,7 @@ static int sbp2_scsi_queuecommand(struct
+ 		COMMAND_ORB_NOTIFY);
+ 
+ 	if (cmd->sc_data_direction == DMA_FROM_DEVICE)
+-		orb->request.misc |= cpu_to_be32(
+-			COMMAND_ORB_DIRECTION(SBP2_DIRECTION_FROM_MEDIA));
+-	else if (cmd->sc_data_direction == DMA_TO_DEVICE)
+-		orb->request.misc |= cpu_to_be32(
+-			COMMAND_ORB_DIRECTION(SBP2_DIRECTION_TO_MEDIA));
++		orb->request.misc |= cpu_to_be32(COMMAND_ORB_DIRECTION);
+ 
+ 	if (scsi_sg_count(cmd) && sbp2_map_scatterlist(orb, device, lu) < 0)
+ 		goto out;
+
+-- 
+Stefan Richter
+-=====-==--- --=- ===--
+http://arcgraph.de/sr/
+
+
+orb came from kzalloc.
+
+Signed-off-by: Stefan Richter <stefanr at s5r6.in-berlin.de>
+---
+ drivers/firewire/fw-sbp2.c |    3 ---
+ 1 file changed, 3 deletions(-)
+
+Index: linux/drivers/firewire/fw-sbp2.c
+===================================================================
+--- linux.orig/drivers/firewire/fw-sbp2.c
++++ linux/drivers/firewire/fw-sbp2.c
+@@ -1426,7 +1426,6 @@ static int sbp2_scsi_queuecommand(struct
+ 	orb->cmd  = cmd;
+ 
+ 	orb->request.next.high   = cpu_to_be32(SBP2_ORB_NULL);
+-	orb->request.next.low    = 0x0;
+ 	/*
+ 	 * At speed 100 we can do 512 bytes per packet, at speed 200,
+ 	 * 1024 bytes per packet etc.  The SBP-2 max_payload field
+@@ -1446,8 +1445,6 @@ static int sbp2_scsi_queuecommand(struct
+ 	if (scsi_sg_count(cmd) && sbp2_map_scatterlist(orb, device, lu) < 0)
+ 		goto out;
+ 
+-	memset(orb->request.command_block,
+-	       0, sizeof(orb->request.command_block));
+ 	memcpy(orb->request.command_block, cmd->cmnd, COMMAND_SIZE(*cmd->cmnd));
+ 
+ 	orb->base.callback = complete_command_orb;
+
+-- 
+Stefan Richter
+-=====-==--- --=- ===--
+http://arcgraph.de/sr/
+
+
+The block/unblock logic is now sufficiently tested.
+
+Signed-off-by: Stefan Richter <stefanr at s5r6.in-berlin.de>
+---
+
+To be postponed after 2.6.25.
+
+ drivers/firewire/fw-sbp2.c |    8 ++------
+ 1 file changed, 2 insertions(+), 6 deletions(-)
+
+Index: linux/drivers/firewire/fw-sbp2.c
+===================================================================
+--- linux.orig/drivers/firewire/fw-sbp2.c
++++ linux/drivers/firewire/fw-sbp2.c
+@@ -687,10 +687,8 @@ static void sbp2_conditionally_block(str
+ 	if (!tgt->dont_block && !lu->blocked &&
+ 	    lu->generation != card->generation) {
+ 		lu->blocked = true;
+-		if (++tgt->blocked == 1) {
++		if (++tgt->blocked == 1)
+ 			scsi_block_requests(shost);
+-			fw_notify("blocked %s\n", lu->tgt->bus_id);
+-		}
+ 	}
+ 	spin_unlock_irqrestore(&card->lock, flags);
+ }
+@@ -717,10 +715,8 @@ static void sbp2_conditionally_unblock(s
+ 	}
+ 	spin_unlock_irqrestore(&card->lock, flags);
+ 
+-	if (unblock) {
++	if (unblock)
+ 		scsi_unblock_requests(shost);
+-		fw_notify("unblocked %s\n", lu->tgt->bus_id);
+-	}
+ }
+ 
+ /*
+
+-- 
+Stefan Richter
+-=====-==--- --=- ===--
+http://arcgraph.de/sr/
+
+
+Copied from ohci1394.c.  This code is necessary to prevent machine check
+exceptions when reloading or resuming the driver.
+
+Signed-off-by: Stefan Richter <stefanr at s5r6.in-berlin.de>
+Signed-off-by: Jarod Wilson <jwilson at redhat.com>
+---
+ drivers/firewire/fw-ohci.c |   50 +++++++++++++++++++++++++++++++++++++++++++++
+ 1 file changed, 50 insertions(+)
+
+Index: linux-2.6.25-rc3/drivers/firewire/fw-ohci.c
+===================================================================
+--- linux-2.6.25-rc3.orig/drivers/firewire/fw-ohci.c
++++ linux-2.6.25-rc3/drivers/firewire/fw-ohci.c
+@@ -33,6 +33,10 @@
+ #include <asm/page.h>
+ #include <asm/system.h>
+ 
++#ifdef CONFIG_PPC_PMAC
++#include <asm/pmac_feature.h>
++#endif
++
+ #include "fw-ohci.h"
+ #include "fw-transaction.h"
+ 
+@@ -2057,6 +2061,18 @@ pci_probe(struct pci_dev *dev, const str
+ 	int err;
+ 	size_t size;
+ 
++#ifdef CONFIG_PPC_PMAC
++	/* Necessary on some machines if fw-ohci was loaded/ unloaded before */
++	if (machine_is(powermac)) {
++		struct device_node *ofn = pci_device_to_OF_node(dev);
++
++		if (ofn) {
++			pmac_call_feature(PMAC_FTR_1394_CABLE_POWER, ofn, 0, 1);
++			pmac_call_feature(PMAC_FTR_1394_ENABLE, ofn, 0, 1);
++		}
++	}
++#endif /* CONFIG_PPC_PMAC */
++
+ 	ohci = kzalloc(sizeof(*ohci), GFP_KERNEL);
+ 	if (ohci == NULL) {
+ 		fw_error("Could not malloc fw_ohci data.\n");
+@@ -2189,6 +2205,20 @@ static void pci_remove(struct pci_dev *d
+ 	pci_iounmap(dev, ohci->registers);
+ 	pci_release_region(dev, 0);
+ 	pci_disable_device(dev);
++
++#ifdef CONFIG_PPC_PMAC
++	/* On UniNorth, power down the cable and turn off the chip clock
++	 * to save power on laptops */
++	if (machine_is(powermac)) {
++		struct device_node* ofn = pci_device_to_OF_node(dev);
++
++		if (ofn) {
++			pmac_call_feature(PMAC_FTR_1394_ENABLE, ofn, 0, 0);
++			pmac_call_feature(PMAC_FTR_1394_CABLE_POWER, ofn, 0, 0);
++		}
++	}
++#endif /* CONFIG_PPC_PMAC */
++
+ 	kfree(&ohci->card);
+ 
+ 	fw_notify("Removed fw-ohci device.\n");
+@@ -2211,6 +2241,16 @@ static int pci_suspend(struct pci_dev *p
+ 	if (err)
+ 		fw_error("pci_set_power_state failed with %d\n", err);
+ 
++/* PowerMac suspend code comes last */
++#ifdef CONFIG_PPC_PMAC
++	if (machine_is(powermac)) {
++		struct device_node *ofn = pci_device_to_OF_node(pdev);
++
++		if (ofn)
++			pmac_call_feature(PMAC_FTR_1394_ENABLE, ofn, 0, 0);
++	}
++#endif /* CONFIG_PPC_PMAC */
++
+ 	return 0;
+ }
+ 
+@@ -2219,6 +2259,16 @@ static int pci_resume(struct pci_dev *pd
+ 	struct fw_ohci *ohci = pci_get_drvdata(pdev);
+ 	int err;
+ 
++/* PowerMac resume code comes first */
++#ifdef CONFIG_PPC_PMAC
++	if (machine_is(powermac)) {
++		struct device_node *ofn = pci_device_to_OF_node(pdev);
++
++		if (ofn)
++			pmac_call_feature(PMAC_FTR_1394_ENABLE, ofn, 0, 1);
++	}
++#endif /* CONFIG_PPC_PMAC */
++
+ 	pci_set_power_state(pdev, PCI_D0);
+ 	pci_restore_state(pdev);
+ 	err = pci_enable_device(pdev);
+
+-- 
+Stefan Richter
+-=====-==--- --== ----=
+http://arcgraph.de/sr/
+
+
+Mostly copied from ohci1394.c.  Necessary for some older Macs, e.g.
+PowerBook G3 Pismo and early PowerBook G4 Titanium.
+
+Signed-off-by: Stefan Richter <stefanr at s5r6.in-berlin.de>
+---
+
+Since my TiBook has a broken FireWire PHY I was only able to test
+the byte order of self ID packets but not of the headers of any
+other packets.  The code in handle_ar_packet() is only guesswork
+from ohci1394.c's respective code.  Also, I wonder what's up with
+isochronous packets...
+
+ drivers/firewire/fw-ohci.c |   29 +++++++++++++++++++++--------
+ 1 file changed, 21 insertions(+), 8 deletions(-)
+
+Index: linux-2.6.25-rc3/drivers/firewire/fw-ohci.c
+===================================================================
+--- linux-2.6.25-rc3.orig/drivers/firewire/fw-ohci.c
++++ linux-2.6.25-rc3/drivers/firewire/fw-ohci.c
+@@ -179,6 +179,7 @@ struct fw_ohci {
+ 	int generation;
+ 	int request_generation;
+ 	u32 bus_seconds;
++	bool old_uninorth;
+ 
+ 	/*
+ 	 * Spinlock for accessing fw_ohci data.  Never call out of
+@@ -315,15 +316,22 @@ static int ar_context_add_page(struct ar
+ 	return 0;
+ }
+ 
++#if defined(CONFIG_PPC_PMAC) && defined(CONFIG_PPC32)
++#define cond_le32_to_cpu(v) \
++	(ohci->old_uninorth ? (__force __u32)(v) : le32_to_cpu(v))
++#else
++#define cond_le32_to_cpu(v) le32_to_cpu(v)
++#endif
++
+ static __le32 *handle_ar_packet(struct ar_context *ctx, __le32 *buffer)
+ {
+ 	struct fw_ohci *ohci = ctx->ohci;
+ 	struct fw_packet p;
+ 	u32 status, length, tcode;
+ 
+-	p.header[0] = le32_to_cpu(buffer[0]);
+-	p.header[1] = le32_to_cpu(buffer[1]);
+-	p.header[2] = le32_to_cpu(buffer[2]);
++	p.header[0] = cond_le32_to_cpu(buffer[0]);
++	p.header[1] = cond_le32_to_cpu(buffer[1]);
++	p.header[2] = cond_le32_to_cpu(buffer[2]);
+ 
+ 	tcode = (p.header[0] >> 4) & 0x0f;
+ 	switch (tcode) {
+@@ -335,7 +343,7 @@ static __le32 *handle_ar_packet(struct a
+ 		break;
+ 
+ 	case TCODE_READ_BLOCK_REQUEST :
+-		p.header[3] = le32_to_cpu(buffer[3]);
++		p.header[3] = cond_le32_to_cpu(buffer[3]);
+ 		p.header_length = 16;
+ 		p.payload_length = 0;
+ 		break;
+@@ -344,7 +352,7 @@ static __le32 *handle_ar_packet(struct a
+ 	case TCODE_READ_BLOCK_RESPONSE:
+ 	case TCODE_LOCK_REQUEST:
+ 	case TCODE_LOCK_RESPONSE:
+-		p.header[3] = le32_to_cpu(buffer[3]);
++		p.header[3] = cond_le32_to_cpu(buffer[3]);
+ 		p.header_length = 16;
+ 		p.payload_length = p.header[3] >> 16;
+ 		break;
+@@ -361,7 +369,7 @@ static __le32 *handle_ar_packet(struct a
+ 
+ 	/* FIXME: What to do about evt_* errors? */
+ 	length = (p.header_length + p.payload_length + 3) / 4;
+-	status = le32_to_cpu(buffer[length]);
++	status = cond_le32_to_cpu(buffer[length]);
+ 
+ 	p.ack        = ((status >> 16) & 0x1f) - 16;
+ 	p.speed      = (status >> 21) & 0x7;
+@@ -1026,13 +1034,14 @@ static void bus_reset_tasklet(unsigned l
+ 	 */
+ 
+ 	self_id_count = (reg_read(ohci, OHCI1394_SelfIDCount) >> 3) & 0x3ff;
+-	generation = (le32_to_cpu(ohci->self_id_cpu[0]) >> 16) & 0xff;
++	generation = (cond_le32_to_cpu(ohci->self_id_cpu[0]) >> 16) & 0xff;
+ 	rmb();
+ 
+ 	for (i = 1, j = 0; j < self_id_count; i += 2, j++) {
+ 		if (ohci->self_id_cpu[i] != ~ohci->self_id_cpu[i + 1])
+ 			fw_error("inconsistent self IDs\n");
+-		ohci->self_id_buffer[j] = le32_to_cpu(ohci->self_id_cpu[i]);
++		ohci->self_id_buffer[j] =
++				cond_le32_to_cpu(ohci->self_id_cpu[i]);
+ 	}
+ 	rmb();
+ 
+@@ -2091,6 +2100,10 @@ pci_probe(struct pci_dev *dev, const str
+ 	pci_write_config_dword(dev, OHCI1394_PCI_HCI_Control, 0);
+ 	pci_set_drvdata(dev, ohci);
+ 
++#if defined(CONFIG_PPC_PMAC) && defined(CONFIG_PPC32)
++	ohci->old_uninorth = dev->vendor == PCI_VENDOR_ID_APPLE &&
++			     dev->device == PCI_DEVICE_ID_APPLE_UNI_N_FW;
++#endif
+ 	spin_lock_init(&ohci->lock);
+ 
+ 	tasklet_init(&ohci->bus_reset_tasklet,
+
+-- 
+Stefan Richter
+-=====-==--- --== ----=
+http://arcgraph.de/sr/
+
+
+
+Shut up two "may be used uninitialised in this function" warnings due to
+PPC32's implementation of dma_alloc_coherent().
+
+Signed-off-by: Stefan Richter <stefanr at s5r6.in-berlin.de>
+---
+
+Wasn't there a macro somewhere for this?
+
+Also, could this be better done in PPC32's dma_alloc_coherent()?
+At least this kind of workaround here doesn't add anything to the
+compiled result.
+
+ drivers/firewire/fw-ohci.c |    4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+Index: linux-2.6.25-rc3/drivers/firewire/fw-ohci.c
+===================================================================
+--- linux-2.6.25-rc3.orig/drivers/firewire/fw-ohci.c
++++ linux-2.6.25-rc3/drivers/firewire/fw-ohci.c
+@@ -544,7 +544,7 @@ static int
+ context_add_buffer(struct context *ctx)
+ {
+ 	struct descriptor_buffer *desc;
+-	dma_addr_t bus_addr;
++	dma_addr_t bus_addr uninitialized_var(bus_addr);
+ 	int offset;
+ 
+ 	/*
+@@ -1334,7 +1334,7 @@ ohci_set_config_rom(struct fw_card *card
+ 	unsigned long flags;
+ 	int retval = -EBUSY;
+ 	__be32 *next_config_rom;
+-	dma_addr_t next_config_rom_bus;
++	dma_addr_t next_config_rom_bus = uninitialized_var(next_config_rom_bus);
+ 
+ 	ohci = fw_ohci(card);
+ 
+
+-- 
+Stefan Richter
+-=====-==--- --== ----=
+http://arcgraph.de/sr/
+
+
+This way firewire-ohci can be used for remote debugging like ohci1394.
+
+Signed-off-by: Stefan Richter <stefanr at s5r6.in-berlin.de>
+---
+ Documentation/debugging-via-ohci1394.txt |   13 ++++++++-----
+ drivers/firewire/fw-ohci.c               |    9 +++++++++
+ lib/Kconfig.debug                        |   10 ++++++++++
+ 3 files changed, 27 insertions(+), 5 deletions(-)
+
+Index: linux/Documentation/debugging-via-ohci1394.txt
+===================================================================
+--- linux.orig/Documentation/debugging-via-ohci1394.txt
++++ linux/Documentation/debugging-via-ohci1394.txt
+@@ -41,11 +41,14 @@ to a working state and enables physical 
+ This can be turned off by ohci1394's module parameter phys_dma=0.
+ 
+ The alternative firewire-ohci driver in drivers/firewire uses filtered physical
+-DMA, hence is not yet suitable for remote debugging.
+-
+-Because ohci1394 depends on the PCI enumeration to be completed, an
+-initialization routine which runs pretty early (long before console_init()
+-which makes the printk buffer appear on the console can be called) was written.
++DMA by default, which is more secure but not suitable for remote debugging.
++Compile the driver with CONFIG_FIREWIRE_OHCI_REMOTE_DMA to get unfiltered
++physical DMA.
++
++Because ohci1394 and firewire-ohci depend on the PCI enumeration to be
++completed, an initialization routine which runs pretty early has been
++implemented for x86.  This routine runs long before console_init() can be
++called, i.e. before the printk buffer appears on the console.
+ 
+ To activate it, enable CONFIG_PROVIDE_OHCI1394_DMA_INIT (Kernel hacking menu:
+ Provide code for enabling DMA over FireWire early on boot) and pass the
+Index: linux/drivers/firewire/fw-ohci.c
+===================================================================
+--- linux.orig/drivers/firewire/fw-ohci.c
++++ linux/drivers/firewire/fw-ohci.c
+@@ -1091,6 +1091,11 @@ static void bus_reset_tasklet(unsigned l
+ 		reg_write(ohci, OHCI1394_ConfigROMhdr, ohci->next_header);
+ 	}
+ 
++#ifdef CONFIG_FIREWIRE_OHCI_REMOTE_DMA
++	reg_write(ohci, OHCI1394_PhyReqFilterHiSet, ~0);
++	reg_write(ohci, OHCI1394_PhyReqFilterLoSet, ~0);
++#endif
++
+ 	spin_unlock_irqrestore(&ohci->lock, flags);
+ 
+ 	if (free_rom)
+@@ -1429,6 +1434,9 @@ static int ohci_cancel_packet(struct fw_
+ static int
+ ohci_enable_phys_dma(struct fw_card *card, int node_id, int generation)
+ {
++#ifdef CONFIG_FIREWIRE_OHCI_REMOTE_DMA
++	return 0;
++#else
+ 	struct fw_ohci *ohci = fw_ohci(card);
+ 	unsigned long flags;
+ 	int n, retval = 0;
+@@ -1460,6 +1468,7 @@ ohci_enable_phys_dma(struct fw_card *car
+  out:
+ 	spin_unlock_irqrestore(&ohci->lock, flags);
+ 	return retval;
++#endif /* CONFIG_FIREWIRE_OHCI_REMOTE_DMA */
+ }
+ 
+ static u64
+Index: linux/lib/Kconfig.debug
+===================================================================
+--- linux.orig/lib/Kconfig.debug
++++ linux/lib/Kconfig.debug
+@@ -592,6 +592,16 @@ config LATENCYTOP
+ 	  Enable this option if you want to use the LatencyTOP tool
+ 	  to find out which userspace is blocking on what kernel operations.
+ 
++config FIREWIRE_OHCI_REMOTE_DMA
++	bool "Remote debugging via firewire-ohci"
++	depends on FIREWIRE_OHCI
++	help
++	  This option lets you use the FireWire bus for remote debugging.
++	  It enables unfiltered remote DMA in the firewire-ohci driver.
++	  See Documentation/debugging-via-ohci1394.txt for more information.
++
++	  If unsure, say N.
++
+ config PROVIDE_OHCI1394_DMA_INIT
+ 	bool "Provide code for enabling DMA over FireWire early on boot"
+ 	depends on PCI && X86
+
+-- 
+Stefan Richter
+-=====-==--- --=- ===--
+http://arcgraph.de/sr/
+
+




More information about the fedora-extras-commits mailing list