aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--MAINTAINERS5
-rw-r--r--drivers/firewire/fw-card.c32
-rw-r--r--drivers/firewire/fw-device.c5
-rw-r--r--drivers/firewire/fw-device.h1
-rw-r--r--drivers/firewire/fw-ohci.c1
-rw-r--r--drivers/firewire/fw-sbp2.c25
-rw-r--r--drivers/firewire/fw-transaction.c32
-rw-r--r--drivers/firewire/fw-transaction.h34
-rw-r--r--drivers/ieee1394/csr1212.c32
-rw-r--r--drivers/ieee1394/dma.c2
-rw-r--r--drivers/ieee1394/highlevel.c4
-rw-r--r--drivers/ieee1394/highlevel.h13
-rw-r--r--drivers/ieee1394/raw1394.c20
-rw-r--r--drivers/ieee1394/sbp2.c22
-rw-r--r--drivers/ieee1394/sbp2.h1
-rw-r--r--drivers/ieee1394/video1394.c2
-rw-r--r--drivers/scsi/sd.c5
-rw-r--r--include/asm-generic/pgtable.h2
-rw-r--r--include/scsi/scsi_device.h1
19 files changed, 181 insertions, 58 deletions
diff --git a/MAINTAINERS b/MAINTAINERS
index 6198fa3deb99..fc6c005c531a 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1777,6 +1777,11 @@ M: hch@infradead.org
1777W: ftp://ftp.openlinux.org/pub/people/hch/vxfs 1777W: ftp://ftp.openlinux.org/pub/people/hch/vxfs
1778S: Maintained 1778S: Maintained
1779 1779
1780FTRACE
1781P: Steven Rostedt
1782M: srostedt@redhat.com
1783S: Maintained
1784
1780FUJITSU FR-V (FRV) PORT 1785FUJITSU FR-V (FRV) PORT
1781P: David Howells 1786P: David Howells
1782M: dhowells@redhat.com 1787M: dhowells@redhat.com
diff --git a/drivers/firewire/fw-card.c b/drivers/firewire/fw-card.c
index 5b4c0d9f5173..da873d795aad 100644
--- a/drivers/firewire/fw-card.c
+++ b/drivers/firewire/fw-card.c
@@ -16,12 +16,15 @@
16 * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 16 * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 */ 17 */
18 18
19#include <linux/module.h> 19#include <linux/completion.h>
20#include <linux/errno.h> 20#include <linux/crc-itu-t.h>
21#include <linux/delay.h> 21#include <linux/delay.h>
22#include <linux/device.h> 22#include <linux/device.h>
23#include <linux/errno.h>
24#include <linux/kref.h>
25#include <linux/module.h>
23#include <linux/mutex.h> 26#include <linux/mutex.h>
24#include <linux/crc-itu-t.h> 27
25#include "fw-transaction.h" 28#include "fw-transaction.h"
26#include "fw-topology.h" 29#include "fw-topology.h"
27#include "fw-device.h" 30#include "fw-device.h"
@@ -396,14 +399,16 @@ fw_card_initialize(struct fw_card *card, const struct fw_card_driver *driver,
396{ 399{
397 static atomic_t index = ATOMIC_INIT(-1); 400 static atomic_t index = ATOMIC_INIT(-1);
398 401
399 atomic_set(&card->device_count, 0);
400 card->index = atomic_inc_return(&index); 402 card->index = atomic_inc_return(&index);
401 card->driver = driver; 403 card->driver = driver;
402 card->device = device; 404 card->device = device;
403 card->current_tlabel = 0; 405 card->current_tlabel = 0;
404 card->tlabel_mask = 0; 406 card->tlabel_mask = 0;
405 card->color = 0; 407 card->color = 0;
408 card->broadcast_channel = BROADCAST_CHANNEL_INITIAL;
406 409
410 kref_init(&card->kref);
411 init_completion(&card->done);
407 INIT_LIST_HEAD(&card->transaction_list); 412 INIT_LIST_HEAD(&card->transaction_list);
408 spin_lock_init(&card->lock); 413 spin_lock_init(&card->lock);
409 setup_timer(&card->flush_timer, 414 setup_timer(&card->flush_timer,
@@ -496,7 +501,6 @@ dummy_enable_phys_dma(struct fw_card *card,
496} 501}
497 502
498static struct fw_card_driver dummy_driver = { 503static struct fw_card_driver dummy_driver = {
499 .name = "dummy",
500 .enable = dummy_enable, 504 .enable = dummy_enable,
501 .update_phy_reg = dummy_update_phy_reg, 505 .update_phy_reg = dummy_update_phy_reg,
502 .set_config_rom = dummy_set_config_rom, 506 .set_config_rom = dummy_set_config_rom,
@@ -507,6 +511,14 @@ static struct fw_card_driver dummy_driver = {
507}; 511};
508 512
509void 513void
514fw_card_release(struct kref *kref)
515{
516 struct fw_card *card = container_of(kref, struct fw_card, kref);
517
518 complete(&card->done);
519}
520
521void
510fw_core_remove_card(struct fw_card *card) 522fw_core_remove_card(struct fw_card *card)
511{ 523{
512 card->driver->update_phy_reg(card, 4, 524 card->driver->update_phy_reg(card, 4,
@@ -521,12 +533,10 @@ fw_core_remove_card(struct fw_card *card)
521 card->driver = &dummy_driver; 533 card->driver = &dummy_driver;
522 534
523 fw_destroy_nodes(card); 535 fw_destroy_nodes(card);
524 /* 536
525 * Wait for all device workqueue jobs to finish. Otherwise the 537 /* Wait for all users, especially device workqueue jobs, to finish. */
526 * firewire-core module could be unloaded before the jobs ran. 538 fw_card_put(card);
527 */ 539 wait_for_completion(&card->done);
528 while (atomic_read(&card->device_count) > 0)
529 msleep(100);
530 540
531 cancel_delayed_work_sync(&card->work); 541 cancel_delayed_work_sync(&card->work);
532 fw_flush_transactions(card); 542 fw_flush_transactions(card);
diff --git a/drivers/firewire/fw-device.c b/drivers/firewire/fw-device.c
index d9c8daf7ae7d..0855fb5568e8 100644
--- a/drivers/firewire/fw-device.c
+++ b/drivers/firewire/fw-device.c
@@ -168,7 +168,7 @@ static void fw_device_release(struct device *dev)
168 fw_node_put(device->node); 168 fw_node_put(device->node);
169 kfree(device->config_rom); 169 kfree(device->config_rom);
170 kfree(device); 170 kfree(device);
171 atomic_dec(&card->device_count); 171 fw_card_put(card);
172} 172}
173 173
174int fw_device_enable_phys_dma(struct fw_device *device) 174int fw_device_enable_phys_dma(struct fw_device *device)
@@ -946,8 +946,7 @@ void fw_node_event(struct fw_card *card, struct fw_node *node, int event)
946 */ 946 */
947 device_initialize(&device->device); 947 device_initialize(&device->device);
948 atomic_set(&device->state, FW_DEVICE_INITIALIZING); 948 atomic_set(&device->state, FW_DEVICE_INITIALIZING);
949 atomic_inc(&card->device_count); 949 device->card = fw_card_get(card);
950 device->card = card;
951 device->node = fw_node_get(node); 950 device->node = fw_node_get(node);
952 device->node_id = node->node_id; 951 device->node_id = node->node_id;
953 device->generation = card->generation; 952 device->generation = card->generation;
diff --git a/drivers/firewire/fw-device.h b/drivers/firewire/fw-device.h
index 5f131f5129da..42305bbac72f 100644
--- a/drivers/firewire/fw-device.h
+++ b/drivers/firewire/fw-device.h
@@ -62,7 +62,6 @@ struct fw_device {
62 bool cmc; 62 bool cmc;
63 struct fw_card *card; 63 struct fw_card *card;
64 struct device device; 64 struct device device;
65 struct list_head link;
66 struct list_head client_list; 65 struct list_head client_list;
67 u32 *config_rom; 66 u32 *config_rom;
68 size_t config_rom_length; 67 size_t config_rom_length;
diff --git a/drivers/firewire/fw-ohci.c b/drivers/firewire/fw-ohci.c
index 0b66306af479..333b12544dd1 100644
--- a/drivers/firewire/fw-ohci.c
+++ b/drivers/firewire/fw-ohci.c
@@ -2292,7 +2292,6 @@ ohci_queue_iso(struct fw_iso_context *base,
2292} 2292}
2293 2293
2294static const struct fw_card_driver ohci_driver = { 2294static const struct fw_card_driver ohci_driver = {
2295 .name = ohci_driver_name,
2296 .enable = ohci_enable, 2295 .enable = ohci_enable,
2297 .update_phy_reg = ohci_update_phy_reg, 2296 .update_phy_reg = ohci_update_phy_reg,
2298 .set_config_rom = ohci_set_config_rom, 2297 .set_config_rom = ohci_set_config_rom,
diff --git a/drivers/firewire/fw-sbp2.c b/drivers/firewire/fw-sbp2.c
index 227d2e036cd8..53fc5a641e6d 100644
--- a/drivers/firewire/fw-sbp2.c
+++ b/drivers/firewire/fw-sbp2.c
@@ -86,6 +86,11 @@ MODULE_PARM_DESC(exclusive_login, "Exclusive login to sbp2 device "
86 * - delay inquiry 86 * - delay inquiry
87 * Wait extra SBP2_INQUIRY_DELAY seconds after login before SCSI inquiry. 87 * Wait extra SBP2_INQUIRY_DELAY seconds after login before SCSI inquiry.
88 * 88 *
89 * - power condition
90 * Set the power condition field in the START STOP UNIT commands sent by
91 * sd_mod on suspend, resume, and shutdown (if manage_start_stop is on).
92 * Some disks need this to spin down or to resume properly.
93 *
89 * - override internal blacklist 94 * - override internal blacklist
90 * Instead of adding to the built-in blacklist, use only the workarounds 95 * Instead of adding to the built-in blacklist, use only the workarounds
91 * specified in the module load parameter. 96 * specified in the module load parameter.
@@ -97,6 +102,7 @@ MODULE_PARM_DESC(exclusive_login, "Exclusive login to sbp2 device "
97#define SBP2_WORKAROUND_FIX_CAPACITY 0x8 102#define SBP2_WORKAROUND_FIX_CAPACITY 0x8
98#define SBP2_WORKAROUND_DELAY_INQUIRY 0x10 103#define SBP2_WORKAROUND_DELAY_INQUIRY 0x10
99#define SBP2_INQUIRY_DELAY 12 104#define SBP2_INQUIRY_DELAY 12
105#define SBP2_WORKAROUND_POWER_CONDITION 0x20
100#define SBP2_WORKAROUND_OVERRIDE 0x100 106#define SBP2_WORKAROUND_OVERRIDE 0x100
101 107
102static int sbp2_param_workarounds; 108static int sbp2_param_workarounds;
@@ -107,6 +113,8 @@ MODULE_PARM_DESC(workarounds, "Work around device bugs (default = 0"
107 ", skip mode page 8 = " __stringify(SBP2_WORKAROUND_MODE_SENSE_8) 113 ", skip mode page 8 = " __stringify(SBP2_WORKAROUND_MODE_SENSE_8)
108 ", fix capacity = " __stringify(SBP2_WORKAROUND_FIX_CAPACITY) 114 ", fix capacity = " __stringify(SBP2_WORKAROUND_FIX_CAPACITY)
109 ", delay inquiry = " __stringify(SBP2_WORKAROUND_DELAY_INQUIRY) 115 ", delay inquiry = " __stringify(SBP2_WORKAROUND_DELAY_INQUIRY)
116 ", set power condition in start stop unit = "
117 __stringify(SBP2_WORKAROUND_POWER_CONDITION)
110 ", override internal blacklist = " __stringify(SBP2_WORKAROUND_OVERRIDE) 118 ", override internal blacklist = " __stringify(SBP2_WORKAROUND_OVERRIDE)
111 ", or a combination)"); 119 ", or a combination)");
112 120
@@ -310,18 +318,25 @@ static const struct {
310 .firmware_revision = 0x002800, 318 .firmware_revision = 0x002800,
311 .model = 0x001010, 319 .model = 0x001010,
312 .workarounds = SBP2_WORKAROUND_INQUIRY_36 | 320 .workarounds = SBP2_WORKAROUND_INQUIRY_36 |
313 SBP2_WORKAROUND_MODE_SENSE_8, 321 SBP2_WORKAROUND_MODE_SENSE_8 |
322 SBP2_WORKAROUND_POWER_CONDITION,
314 }, 323 },
315 /* DViCO Momobay FX-3A with TSB42AA9A bridge */ { 324 /* DViCO Momobay FX-3A with TSB42AA9A bridge */ {
316 .firmware_revision = 0x002800, 325 .firmware_revision = 0x002800,
317 .model = 0x000000, 326 .model = 0x000000,
318 .workarounds = SBP2_WORKAROUND_DELAY_INQUIRY, 327 .workarounds = SBP2_WORKAROUND_DELAY_INQUIRY |
328 SBP2_WORKAROUND_POWER_CONDITION,
319 }, 329 },
320 /* Initio bridges, actually only needed for some older ones */ { 330 /* Initio bridges, actually only needed for some older ones */ {
321 .firmware_revision = 0x000200, 331 .firmware_revision = 0x000200,
322 .model = ~0, 332 .model = ~0,
323 .workarounds = SBP2_WORKAROUND_INQUIRY_36, 333 .workarounds = SBP2_WORKAROUND_INQUIRY_36,
324 }, 334 },
335 /* PL-3507 bridge with Prolific firmware */ {
336 .firmware_revision = 0x012800,
337 .model = ~0,
338 .workarounds = SBP2_WORKAROUND_POWER_CONDITION,
339 },
325 /* Symbios bridge */ { 340 /* Symbios bridge */ {
326 .firmware_revision = 0xa0b800, 341 .firmware_revision = 0xa0b800,
327 .model = ~0, 342 .model = ~0,
@@ -1530,6 +1545,9 @@ static int sbp2_scsi_slave_configure(struct scsi_device *sdev)
1530 1545
1531 sdev->use_10_for_rw = 1; 1546 sdev->use_10_for_rw = 1;
1532 1547
1548 if (sbp2_param_exclusive_login)
1549 sdev->manage_start_stop = 1;
1550
1533 if (sdev->type == TYPE_ROM) 1551 if (sdev->type == TYPE_ROM)
1534 sdev->use_10_for_ms = 1; 1552 sdev->use_10_for_ms = 1;
1535 1553
@@ -1540,6 +1558,9 @@ static int sbp2_scsi_slave_configure(struct scsi_device *sdev)
1540 if (lu->tgt->workarounds & SBP2_WORKAROUND_FIX_CAPACITY) 1558 if (lu->tgt->workarounds & SBP2_WORKAROUND_FIX_CAPACITY)
1541 sdev->fix_capacity = 1; 1559 sdev->fix_capacity = 1;
1542 1560
1561 if (lu->tgt->workarounds & SBP2_WORKAROUND_POWER_CONDITION)
1562 sdev->start_stop_pwr_cond = 1;
1563
1543 if (lu->tgt->workarounds & SBP2_WORKAROUND_128K_MAX_TRANS) 1564 if (lu->tgt->workarounds & SBP2_WORKAROUND_128K_MAX_TRANS)
1544 blk_queue_max_sectors(sdev->request_queue, 128 * 1024 / 512); 1565 blk_queue_max_sectors(sdev->request_queue, 128 * 1024 / 512);
1545 1566
diff --git a/drivers/firewire/fw-transaction.c b/drivers/firewire/fw-transaction.c
index 03ae8a77c479..40db80752272 100644
--- a/drivers/firewire/fw-transaction.c
+++ b/drivers/firewire/fw-transaction.c
@@ -55,6 +55,9 @@
55#define HEADER_GET_DATA_LENGTH(q) (((q) >> 16) & 0xffff) 55#define HEADER_GET_DATA_LENGTH(q) (((q) >> 16) & 0xffff)
56#define HEADER_GET_EXTENDED_TCODE(q) (((q) >> 0) & 0xffff) 56#define HEADER_GET_EXTENDED_TCODE(q) (((q) >> 0) & 0xffff)
57 57
58#define HEADER_DESTINATION_IS_BROADCAST(q) \
59 (((q) & HEADER_DESTINATION(0x3f)) == HEADER_DESTINATION(0x3f))
60
58#define PHY_CONFIG_GAP_COUNT(gap_count) (((gap_count) << 16) | (1 << 22)) 61#define PHY_CONFIG_GAP_COUNT(gap_count) (((gap_count) << 16) | (1 << 22))
59#define PHY_CONFIG_ROOT_ID(node_id) ((((node_id) & 0x3f) << 24) | (1 << 23)) 62#define PHY_CONFIG_ROOT_ID(node_id) ((((node_id) & 0x3f) << 24) | (1 << 23))
60#define PHY_IDENTIFIER(id) ((id) << 30) 63#define PHY_IDENTIFIER(id) ((id) << 30)
@@ -624,12 +627,9 @@ allocate_request(struct fw_packet *p)
624void 627void
625fw_send_response(struct fw_card *card, struct fw_request *request, int rcode) 628fw_send_response(struct fw_card *card, struct fw_request *request, int rcode)
626{ 629{
627 /* 630 /* unified transaction or broadcast transaction: don't respond */
628 * Broadcast packets are reported as ACK_COMPLETE, so this 631 if (request->ack != ACK_PENDING ||
629 * check is sufficient to ensure we don't send response to 632 HEADER_DESTINATION_IS_BROADCAST(request->request_header[0])) {
630 * broadcast packets or posted writes.
631 */
632 if (request->ack != ACK_PENDING) {
633 kfree(request); 633 kfree(request);
634 return; 634 return;
635 } 635 }
@@ -817,12 +817,13 @@ handle_registers(struct fw_card *card, struct fw_request *request,
817 int reg = offset & ~CSR_REGISTER_BASE; 817 int reg = offset & ~CSR_REGISTER_BASE;
818 unsigned long long bus_time; 818 unsigned long long bus_time;
819 __be32 *data = payload; 819 __be32 *data = payload;
820 int rcode = RCODE_COMPLETE;
820 821
821 switch (reg) { 822 switch (reg) {
822 case CSR_CYCLE_TIME: 823 case CSR_CYCLE_TIME:
823 case CSR_BUS_TIME: 824 case CSR_BUS_TIME:
824 if (!TCODE_IS_READ_REQUEST(tcode) || length != 4) { 825 if (!TCODE_IS_READ_REQUEST(tcode) || length != 4) {
825 fw_send_response(card, request, RCODE_TYPE_ERROR); 826 rcode = RCODE_TYPE_ERROR;
826 break; 827 break;
827 } 828 }
828 829
@@ -831,7 +832,17 @@ handle_registers(struct fw_card *card, struct fw_request *request,
831 *data = cpu_to_be32(bus_time); 832 *data = cpu_to_be32(bus_time);
832 else 833 else
833 *data = cpu_to_be32(bus_time >> 25); 834 *data = cpu_to_be32(bus_time >> 25);
834 fw_send_response(card, request, RCODE_COMPLETE); 835 break;
836
837 case CSR_BROADCAST_CHANNEL:
838 if (tcode == TCODE_READ_QUADLET_REQUEST)
839 *data = cpu_to_be32(card->broadcast_channel);
840 else if (tcode == TCODE_WRITE_QUADLET_REQUEST)
841 card->broadcast_channel =
842 (be32_to_cpu(*data) & BROADCAST_CHANNEL_VALID) |
843 BROADCAST_CHANNEL_INITIAL;
844 else
845 rcode = RCODE_TYPE_ERROR;
835 break; 846 break;
836 847
837 case CSR_BUS_MANAGER_ID: 848 case CSR_BUS_MANAGER_ID:
@@ -850,10 +861,13 @@ handle_registers(struct fw_card *card, struct fw_request *request,
850 861
851 case CSR_BUSY_TIMEOUT: 862 case CSR_BUSY_TIMEOUT:
852 /* FIXME: Implement this. */ 863 /* FIXME: Implement this. */
864
853 default: 865 default:
854 fw_send_response(card, request, RCODE_ADDRESS_ERROR); 866 rcode = RCODE_ADDRESS_ERROR;
855 break; 867 break;
856 } 868 }
869
870 fw_send_response(card, request, rcode);
857} 871}
858 872
859static struct fw_address_handler registers = { 873static struct fw_address_handler registers = {
diff --git a/drivers/firewire/fw-transaction.h b/drivers/firewire/fw-transaction.h
index 04d3854f6560..2ae1b0d6cb7b 100644
--- a/drivers/firewire/fw-transaction.h
+++ b/drivers/firewire/fw-transaction.h
@@ -19,14 +19,15 @@
19#ifndef __fw_transaction_h 19#ifndef __fw_transaction_h
20#define __fw_transaction_h 20#define __fw_transaction_h
21 21
22#include <linux/completion.h>
22#include <linux/device.h> 23#include <linux/device.h>
23#include <linux/timer.h>
24#include <linux/interrupt.h>
25#include <linux/list.h>
26#include <linux/fs.h>
27#include <linux/dma-mapping.h> 24#include <linux/dma-mapping.h>
28#include <linux/firewire-constants.h> 25#include <linux/firewire-constants.h>
29#include <asm/atomic.h> 26#include <linux/kref.h>
27#include <linux/list.h>
28#include <linux/spinlock_types.h>
29#include <linux/timer.h>
30#include <linux/workqueue.h>
30 31
31#define TCODE_IS_READ_REQUEST(tcode) (((tcode) & ~1) == 4) 32#define TCODE_IS_READ_REQUEST(tcode) (((tcode) & ~1) == 4)
32#define TCODE_IS_BLOCK_PACKET(tcode) (((tcode) & 1) != 0) 33#define TCODE_IS_BLOCK_PACKET(tcode) (((tcode) & 1) != 0)
@@ -80,6 +81,9 @@
80#define CSR_SPEED_MAP 0x2000 81#define CSR_SPEED_MAP 0x2000
81#define CSR_SPEED_MAP_END 0x3000 82#define CSR_SPEED_MAP_END 0x3000
82 83
84#define BROADCAST_CHANNEL_INITIAL (1 << 31 | 31)
85#define BROADCAST_CHANNEL_VALID (1 << 30)
86
83#define fw_notify(s, args...) printk(KERN_NOTICE KBUILD_MODNAME ": " s, ## args) 87#define fw_notify(s, args...) printk(KERN_NOTICE KBUILD_MODNAME ": " s, ## args)
84#define fw_error(s, args...) printk(KERN_ERR KBUILD_MODNAME ": " s, ## args) 88#define fw_error(s, args...) printk(KERN_ERR KBUILD_MODNAME ": " s, ## args)
85 89
@@ -216,7 +220,8 @@ extern struct bus_type fw_bus_type;
216struct fw_card { 220struct fw_card {
217 const struct fw_card_driver *driver; 221 const struct fw_card_driver *driver;
218 struct device *device; 222 struct device *device;
219 atomic_t device_count; 223 struct kref kref;
224 struct completion done;
220 225
221 int node_id; 226 int node_id;
222 int generation; 227 int generation;
@@ -236,6 +241,7 @@ struct fw_card {
236 */ 241 */
237 int self_id_count; 242 int self_id_count;
238 u32 topology_map[252 + 3]; 243 u32 topology_map[252 + 3];
244 u32 broadcast_channel;
239 245
240 spinlock_t lock; /* Take this lock when handling the lists in 246 spinlock_t lock; /* Take this lock when handling the lists in
241 * this struct. */ 247 * this struct. */
@@ -256,6 +262,20 @@ struct fw_card {
256 int bm_generation; 262 int bm_generation;
257}; 263};
258 264
265static inline struct fw_card *fw_card_get(struct fw_card *card)
266{
267 kref_get(&card->kref);
268
269 return card;
270}
271
272void fw_card_release(struct kref *kref);
273
274static inline void fw_card_put(struct fw_card *card)
275{
276 kref_put(&card->kref, fw_card_release);
277}
278
259/* 279/*
260 * The iso packet format allows for an immediate header/payload part 280 * The iso packet format allows for an immediate header/payload part
261 * stored in 'header' immediately after the packet info plus an 281 * stored in 'header' immediately after the packet info plus an
@@ -348,8 +368,6 @@ int
348fw_iso_context_stop(struct fw_iso_context *ctx); 368fw_iso_context_stop(struct fw_iso_context *ctx);
349 369
350struct fw_card_driver { 370struct fw_card_driver {
351 const char *name;
352
353 /* 371 /*
354 * Enable the given card with the given initial config rom. 372 * Enable the given card with the given initial config rom.
355 * This function is expected to activate the card, and either 373 * This function is expected to activate the card, and either
diff --git a/drivers/ieee1394/csr1212.c b/drivers/ieee1394/csr1212.c
index e8122def164d..9f95337139e3 100644
--- a/drivers/ieee1394/csr1212.c
+++ b/drivers/ieee1394/csr1212.c
@@ -1049,6 +1049,24 @@ int csr1212_read(struct csr1212_csr *csr, u32 offset, void *buffer, u32 len)
1049 return -ENOENT; 1049 return -ENOENT;
1050} 1050}
1051 1051
1052/*
1053 * Apparently there are many different wrong implementations of the CRC
1054 * algorithm. We don't fail, we just warn... approximately once per GUID.
1055 */
1056static void
1057csr1212_check_crc(const u32 *buffer, size_t length, u16 crc, __be32 *guid)
1058{
1059 static u64 last_bad_eui64;
1060 u64 eui64 = ((u64)be32_to_cpu(guid[0]) << 32) | be32_to_cpu(guid[1]);
1061
1062 if (csr1212_crc16(buffer, length) == crc ||
1063 csr1212_msft_crc16(buffer, length) == crc ||
1064 eui64 == last_bad_eui64)
1065 return;
1066
1067 printk(KERN_DEBUG "ieee1394: config ROM CRC error\n");
1068 last_bad_eui64 = eui64;
1069}
1052 1070
1053/* Parse a chunk of data as a Config ROM */ 1071/* Parse a chunk of data as a Config ROM */
1054 1072
@@ -1092,11 +1110,8 @@ static int csr1212_parse_bus_info_block(struct csr1212_csr *csr)
1092 return ret; 1110 return ret;
1093 } 1111 }
1094 1112
1095 /* Apparently there are many different wrong implementations of the CRC 1113 csr1212_check_crc(bi->data, bi->crc_length, bi->crc,
1096 * algorithm. We don't fail, we just warn. */ 1114 &csr->bus_info_data[3]);
1097 if ((csr1212_crc16(bi->data, bi->crc_length) != bi->crc) &&
1098 (csr1212_msft_crc16(bi->data, bi->crc_length) != bi->crc))
1099 printk(KERN_DEBUG "IEEE 1394 device has ROM CRC error\n");
1100 1115
1101 cr = CSR1212_MALLOC(sizeof(*cr)); 1116 cr = CSR1212_MALLOC(sizeof(*cr));
1102 if (!cr) 1117 if (!cr)
@@ -1205,11 +1220,8 @@ int csr1212_parse_keyval(struct csr1212_keyval *kv,
1205 &cache->data[bytes_to_quads(kv->offset - cache->offset)]; 1220 &cache->data[bytes_to_quads(kv->offset - cache->offset)];
1206 kvi_len = be16_to_cpu(kvi->length); 1221 kvi_len = be16_to_cpu(kvi->length);
1207 1222
1208 /* Apparently there are many different wrong implementations of the CRC 1223 /* GUID is wrong in here in case of extended ROM. We don't care. */
1209 * algorithm. We don't fail, we just warn. */ 1224 csr1212_check_crc(kvi->data, kvi_len, kvi->crc, &cache->data[3]);
1210 if ((csr1212_crc16(kvi->data, kvi_len) != kvi->crc) &&
1211 (csr1212_msft_crc16(kvi->data, kvi_len) != kvi->crc))
1212 printk(KERN_DEBUG "IEEE 1394 device has ROM CRC error\n");
1213 1225
1214 switch (kv->key.type) { 1226 switch (kv->key.type) {
1215 case CSR1212_KV_TYPE_DIRECTORY: 1227 case CSR1212_KV_TYPE_DIRECTORY:
diff --git a/drivers/ieee1394/dma.c b/drivers/ieee1394/dma.c
index 73685e7dc7e4..1aba8c13fe8f 100644
--- a/drivers/ieee1394/dma.c
+++ b/drivers/ieee1394/dma.c
@@ -274,7 +274,7 @@ int dma_region_mmap(struct dma_region *dma, struct file *file,
274 vma->vm_ops = &dma_region_vm_ops; 274 vma->vm_ops = &dma_region_vm_ops;
275 vma->vm_private_data = dma; 275 vma->vm_private_data = dma;
276 vma->vm_file = file; 276 vma->vm_file = file;
277 vma->vm_flags |= VM_RESERVED; 277 vma->vm_flags |= VM_RESERVED | VM_ALWAYSDUMP;
278 278
279 return 0; 279 return 0;
280} 280}
diff --git a/drivers/ieee1394/highlevel.c b/drivers/ieee1394/highlevel.c
index fa2bfec0fca2..918ffc4fc8ac 100644
--- a/drivers/ieee1394/highlevel.c
+++ b/drivers/ieee1394/highlevel.c
@@ -228,10 +228,8 @@ void hpsb_register_highlevel(struct hpsb_highlevel *hl)
228{ 228{
229 unsigned long flags; 229 unsigned long flags;
230 230
231 hpsb_init_highlevel(hl);
231 INIT_LIST_HEAD(&hl->addr_list); 232 INIT_LIST_HEAD(&hl->addr_list);
232 INIT_LIST_HEAD(&hl->host_info_list);
233
234 rwlock_init(&hl->host_info_lock);
235 233
236 down_write(&hl_drivers_sem); 234 down_write(&hl_drivers_sem);
237 list_add_tail(&hl->hl_list, &hl_drivers); 235 list_add_tail(&hl->hl_list, &hl_drivers);
diff --git a/drivers/ieee1394/highlevel.h b/drivers/ieee1394/highlevel.h
index eb9fe321e09a..bc5d0854c17e 100644
--- a/drivers/ieee1394/highlevel.h
+++ b/drivers/ieee1394/highlevel.h
@@ -2,7 +2,7 @@
2#define IEEE1394_HIGHLEVEL_H 2#define IEEE1394_HIGHLEVEL_H
3 3
4#include <linux/list.h> 4#include <linux/list.h>
5#include <linux/spinlock_types.h> 5#include <linux/spinlock.h>
6#include <linux/types.h> 6#include <linux/types.h>
7 7
8struct module; 8struct module;
@@ -103,6 +103,17 @@ int highlevel_lock64(struct hpsb_host *host, int nodeid, octlet_t *store,
103void highlevel_fcp_request(struct hpsb_host *host, int nodeid, int direction, 103void highlevel_fcp_request(struct hpsb_host *host, int nodeid, int direction,
104 void *data, size_t length); 104 void *data, size_t length);
105 105
106/**
107 * hpsb_init_highlevel - initialize a struct hpsb_highlevel
108 *
109 * This is only necessary if hpsb_get_hostinfo_bykey can be called
110 * before hpsb_register_highlevel.
111 */
112static inline void hpsb_init_highlevel(struct hpsb_highlevel *hl)
113{
114 rwlock_init(&hl->host_info_lock);
115 INIT_LIST_HEAD(&hl->host_info_list);
116}
106void hpsb_register_highlevel(struct hpsb_highlevel *hl); 117void hpsb_register_highlevel(struct hpsb_highlevel *hl);
107void hpsb_unregister_highlevel(struct hpsb_highlevel *hl); 118void hpsb_unregister_highlevel(struct hpsb_highlevel *hl);
108 119
diff --git a/drivers/ieee1394/raw1394.c b/drivers/ieee1394/raw1394.c
index ec2a0adbedb2..96f2847b0405 100644
--- a/drivers/ieee1394/raw1394.c
+++ b/drivers/ieee1394/raw1394.c
@@ -2549,8 +2549,8 @@ static int raw1394_mmap(struct file *file, struct vm_area_struct *vma)
2549} 2549}
2550 2550
2551/* ioctl is only used for rawiso operations */ 2551/* ioctl is only used for rawiso operations */
2552static int raw1394_ioctl(struct inode *inode, struct file *file, 2552static long do_raw1394_ioctl(struct file *file, unsigned int cmd,
2553 unsigned int cmd, unsigned long arg) 2553 unsigned long arg)
2554{ 2554{
2555 struct file_info *fi = file->private_data; 2555 struct file_info *fi = file->private_data;
2556 void __user *argp = (void __user *)arg; 2556 void __user *argp = (void __user *)arg;
@@ -2656,6 +2656,16 @@ static int raw1394_ioctl(struct inode *inode, struct file *file,
2656 return -EINVAL; 2656 return -EINVAL;
2657} 2657}
2658 2658
2659static long raw1394_ioctl(struct file *file, unsigned int cmd,
2660 unsigned long arg)
2661{
2662 long ret;
2663 lock_kernel();
2664 ret = do_raw1394_ioctl(file, cmd, arg);
2665 unlock_kernel();
2666 return ret;
2667}
2668
2659#ifdef CONFIG_COMPAT 2669#ifdef CONFIG_COMPAT
2660struct raw1394_iso_packets32 { 2670struct raw1394_iso_packets32 {
2661 __u32 n_packets; 2671 __u32 n_packets;
@@ -2690,7 +2700,7 @@ static long raw1394_iso_xmit_recv_packets32(struct file *file, unsigned int cmd,
2690 !copy_from_user(&infos32, &arg->infos, sizeof infos32)) { 2700 !copy_from_user(&infos32, &arg->infos, sizeof infos32)) {
2691 infos = compat_ptr(infos32); 2701 infos = compat_ptr(infos32);
2692 if (!copy_to_user(&dst->infos, &infos, sizeof infos)) 2702 if (!copy_to_user(&dst->infos, &infos, sizeof infos))
2693 err = raw1394_ioctl(NULL, file, cmd, (unsigned long)dst); 2703 err = do_raw1394_ioctl(file, cmd, (unsigned long)dst);
2694 } 2704 }
2695 return err; 2705 return err;
2696} 2706}
@@ -2731,7 +2741,7 @@ static long raw1394_compat_ioctl(struct file *file,
2731 case RAW1394_IOC_ISO_GET_STATUS: 2741 case RAW1394_IOC_ISO_GET_STATUS:
2732 case RAW1394_IOC_ISO_SHUTDOWN: 2742 case RAW1394_IOC_ISO_SHUTDOWN:
2733 case RAW1394_IOC_ISO_QUEUE_ACTIVITY: 2743 case RAW1394_IOC_ISO_QUEUE_ACTIVITY:
2734 err = raw1394_ioctl(NULL, file, cmd, arg); 2744 err = do_raw1394_ioctl(file, cmd, arg);
2735 break; 2745 break;
2736 /* These request have different format. */ 2746 /* These request have different format. */
2737 case RAW1394_IOC_ISO_RECV_PACKETS32: 2747 case RAW1394_IOC_ISO_RECV_PACKETS32:
@@ -2984,7 +2994,7 @@ static const struct file_operations raw1394_fops = {
2984 .read = raw1394_read, 2994 .read = raw1394_read,
2985 .write = raw1394_write, 2995 .write = raw1394_write,
2986 .mmap = raw1394_mmap, 2996 .mmap = raw1394_mmap,
2987 .ioctl = raw1394_ioctl, 2997 .unlocked_ioctl = raw1394_ioctl,
2988#ifdef CONFIG_COMPAT 2998#ifdef CONFIG_COMPAT
2989 .compat_ioctl = raw1394_compat_ioctl, 2999 .compat_ioctl = raw1394_compat_ioctl,
2990#endif 3000#endif
diff --git a/drivers/ieee1394/sbp2.c b/drivers/ieee1394/sbp2.c
index a5ceff287a28..9cbf3154d243 100644
--- a/drivers/ieee1394/sbp2.c
+++ b/drivers/ieee1394/sbp2.c
@@ -186,6 +186,11 @@ MODULE_PARM_DESC(exclusive_login, "Exclusive login to sbp2 device "
186 * - delay inquiry 186 * - delay inquiry
187 * Wait extra SBP2_INQUIRY_DELAY seconds after login before SCSI inquiry. 187 * Wait extra SBP2_INQUIRY_DELAY seconds after login before SCSI inquiry.
188 * 188 *
189 * - power condition
190 * Set the power condition field in the START STOP UNIT commands sent by
191 * sd_mod on suspend, resume, and shutdown (if manage_start_stop is on).
192 * Some disks need this to spin down or to resume properly.
193 *
189 * - override internal blacklist 194 * - override internal blacklist
190 * Instead of adding to the built-in blacklist, use only the workarounds 195 * Instead of adding to the built-in blacklist, use only the workarounds
191 * specified in the module load parameter. 196 * specified in the module load parameter.
@@ -199,6 +204,8 @@ MODULE_PARM_DESC(workarounds, "Work around device bugs (default = 0"
199 ", skip mode page 8 = " __stringify(SBP2_WORKAROUND_MODE_SENSE_8) 204 ", skip mode page 8 = " __stringify(SBP2_WORKAROUND_MODE_SENSE_8)
200 ", fix capacity = " __stringify(SBP2_WORKAROUND_FIX_CAPACITY) 205 ", fix capacity = " __stringify(SBP2_WORKAROUND_FIX_CAPACITY)
201 ", delay inquiry = " __stringify(SBP2_WORKAROUND_DELAY_INQUIRY) 206 ", delay inquiry = " __stringify(SBP2_WORKAROUND_DELAY_INQUIRY)
207 ", set power condition in start stop unit = "
208 __stringify(SBP2_WORKAROUND_POWER_CONDITION)
202 ", override internal blacklist = " __stringify(SBP2_WORKAROUND_OVERRIDE) 209 ", override internal blacklist = " __stringify(SBP2_WORKAROUND_OVERRIDE)
203 ", or a combination)"); 210 ", or a combination)");
204 211
@@ -359,18 +366,25 @@ static const struct {
359 .firmware_revision = 0x002800, 366 .firmware_revision = 0x002800,
360 .model_id = 0x001010, 367 .model_id = 0x001010,
361 .workarounds = SBP2_WORKAROUND_INQUIRY_36 | 368 .workarounds = SBP2_WORKAROUND_INQUIRY_36 |
362 SBP2_WORKAROUND_MODE_SENSE_8, 369 SBP2_WORKAROUND_MODE_SENSE_8 |
370 SBP2_WORKAROUND_POWER_CONDITION,
363 }, 371 },
364 /* DViCO Momobay FX-3A with TSB42AA9A bridge */ { 372 /* DViCO Momobay FX-3A with TSB42AA9A bridge */ {
365 .firmware_revision = 0x002800, 373 .firmware_revision = 0x002800,
366 .model_id = 0x000000, 374 .model_id = 0x000000,
367 .workarounds = SBP2_WORKAROUND_DELAY_INQUIRY, 375 .workarounds = SBP2_WORKAROUND_DELAY_INQUIRY |
376 SBP2_WORKAROUND_POWER_CONDITION,
368 }, 377 },
369 /* Initio bridges, actually only needed for some older ones */ { 378 /* Initio bridges, actually only needed for some older ones */ {
370 .firmware_revision = 0x000200, 379 .firmware_revision = 0x000200,
371 .model_id = SBP2_ROM_VALUE_WILDCARD, 380 .model_id = SBP2_ROM_VALUE_WILDCARD,
372 .workarounds = SBP2_WORKAROUND_INQUIRY_36, 381 .workarounds = SBP2_WORKAROUND_INQUIRY_36,
373 }, 382 },
383 /* PL-3507 bridge with Prolific firmware */ {
384 .firmware_revision = 0x012800,
385 .model_id = SBP2_ROM_VALUE_WILDCARD,
386 .workarounds = SBP2_WORKAROUND_POWER_CONDITION,
387 },
374 /* Symbios bridge */ { 388 /* Symbios bridge */ {
375 .firmware_revision = 0xa0b800, 389 .firmware_revision = 0xa0b800,
376 .model_id = SBP2_ROM_VALUE_WILDCARD, 390 .model_id = SBP2_ROM_VALUE_WILDCARD,
@@ -1995,6 +2009,8 @@ static int sbp2scsi_slave_configure(struct scsi_device *sdev)
1995 2009
1996 sdev->use_10_for_rw = 1; 2010 sdev->use_10_for_rw = 1;
1997 2011
2012 if (sbp2_exclusive_login)
2013 sdev->manage_start_stop = 1;
1998 if (sdev->type == TYPE_ROM) 2014 if (sdev->type == TYPE_ROM)
1999 sdev->use_10_for_ms = 1; 2015 sdev->use_10_for_ms = 1;
2000 if (sdev->type == TYPE_DISK && 2016 if (sdev->type == TYPE_DISK &&
@@ -2002,6 +2018,8 @@ static int sbp2scsi_slave_configure(struct scsi_device *sdev)
2002 sdev->skip_ms_page_8 = 1; 2018 sdev->skip_ms_page_8 = 1;
2003 if (lu->workarounds & SBP2_WORKAROUND_FIX_CAPACITY) 2019 if (lu->workarounds & SBP2_WORKAROUND_FIX_CAPACITY)
2004 sdev->fix_capacity = 1; 2020 sdev->fix_capacity = 1;
2021 if (lu->workarounds & SBP2_WORKAROUND_POWER_CONDITION)
2022 sdev->start_stop_pwr_cond = 1;
2005 if (lu->workarounds & SBP2_WORKAROUND_128K_MAX_TRANS) 2023 if (lu->workarounds & SBP2_WORKAROUND_128K_MAX_TRANS)
2006 blk_queue_max_sectors(sdev->request_queue, 128 * 1024 / 512); 2024 blk_queue_max_sectors(sdev->request_queue, 128 * 1024 / 512);
2007 return 0; 2025 return 0;
diff --git a/drivers/ieee1394/sbp2.h b/drivers/ieee1394/sbp2.h
index 80d8e097b065..875428bc8d29 100644
--- a/drivers/ieee1394/sbp2.h
+++ b/drivers/ieee1394/sbp2.h
@@ -345,6 +345,7 @@ enum sbp2lu_state_types {
345#define SBP2_WORKAROUND_FIX_CAPACITY 0x8 345#define SBP2_WORKAROUND_FIX_CAPACITY 0x8
346#define SBP2_WORKAROUND_DELAY_INQUIRY 0x10 346#define SBP2_WORKAROUND_DELAY_INQUIRY 0x10
347#define SBP2_INQUIRY_DELAY 12 347#define SBP2_INQUIRY_DELAY 12
348#define SBP2_WORKAROUND_POWER_CONDITION 0x20
348#define SBP2_WORKAROUND_OVERRIDE 0x100 349#define SBP2_WORKAROUND_OVERRIDE 0x100
349 350
350#endif /* SBP2_H */ 351#endif /* SBP2_H */
diff --git a/drivers/ieee1394/video1394.c b/drivers/ieee1394/video1394.c
index e24772d336e1..069b9f6bf16d 100644
--- a/drivers/ieee1394/video1394.c
+++ b/drivers/ieee1394/video1394.c
@@ -1503,6 +1503,8 @@ static int __init video1394_init_module (void)
1503{ 1503{
1504 int ret; 1504 int ret;
1505 1505
1506 hpsb_init_highlevel(&video1394_highlevel);
1507
1506 cdev_init(&video1394_cdev, &video1394_fops); 1508 cdev_init(&video1394_cdev, &video1394_fops);
1507 video1394_cdev.owner = THIS_MODULE; 1509 video1394_cdev.owner = THIS_MODULE;
1508 ret = cdev_add(&video1394_cdev, IEEE1394_VIDEO1394_DEV, 16); 1510 ret = cdev_add(&video1394_cdev, IEEE1394_VIDEO1394_DEV, 16);
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index 01cefbb2d539..d53312c42547 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -1124,6 +1124,8 @@ sd_spinup_disk(struct scsi_disk *sdkp)
1124 cmd[1] = 1; /* Return immediately */ 1124 cmd[1] = 1; /* Return immediately */
1125 memset((void *) &cmd[2], 0, 8); 1125 memset((void *) &cmd[2], 0, 8);
1126 cmd[4] = 1; /* Start spin cycle */ 1126 cmd[4] = 1; /* Start spin cycle */
1127 if (sdkp->device->start_stop_pwr_cond)
1128 cmd[4] |= 1 << 4;
1127 scsi_execute_req(sdkp->device, cmd, DMA_NONE, 1129 scsi_execute_req(sdkp->device, cmd, DMA_NONE,
1128 NULL, 0, &sshdr, 1130 NULL, 0, &sshdr,
1129 SD_TIMEOUT, SD_MAX_RETRIES); 1131 SD_TIMEOUT, SD_MAX_RETRIES);
@@ -1790,6 +1792,9 @@ static int sd_start_stop_device(struct scsi_disk *sdkp, int start)
1790 if (start) 1792 if (start)
1791 cmd[4] |= 1; /* START */ 1793 cmd[4] |= 1; /* START */
1792 1794
1795 if (sdp->start_stop_pwr_cond)
1796 cmd[4] |= start ? 1 << 4 : 3 << 4; /* Active or Standby */
1797
1793 if (!scsi_device_online(sdp)) 1798 if (!scsi_device_online(sdp))
1794 return -ENODEV; 1799 return -ENODEV;
1795 1800
diff --git a/include/asm-generic/pgtable.h b/include/asm-generic/pgtable.h
index 4fce3db2cecc..ef87f889ef62 100644
--- a/include/asm-generic/pgtable.h
+++ b/include/asm-generic/pgtable.h
@@ -195,7 +195,6 @@ static inline int pmd_none_or_clear_bad(pmd_t *pmd)
195 } 195 }
196 return 0; 196 return 0;
197} 197}
198#endif /* CONFIG_MMU */
199 198
200static inline pte_t __ptep_modify_prot_start(struct mm_struct *mm, 199static inline pte_t __ptep_modify_prot_start(struct mm_struct *mm,
201 unsigned long addr, 200 unsigned long addr,
@@ -253,6 +252,7 @@ static inline void ptep_modify_prot_commit(struct mm_struct *mm,
253 __ptep_modify_prot_commit(mm, addr, ptep, pte); 252 __ptep_modify_prot_commit(mm, addr, ptep, pte);
254} 253}
255#endif /* __HAVE_ARCH_PTEP_MODIFY_PROT_TRANSACTION */ 254#endif /* __HAVE_ARCH_PTEP_MODIFY_PROT_TRANSACTION */
255#endif /* CONFIG_MMU */
256 256
257/* 257/*
258 * A facility to provide lazy MMU batching. This allows PTE updates and 258 * A facility to provide lazy MMU batching. This allows PTE updates and
diff --git a/include/scsi/scsi_device.h b/include/scsi/scsi_device.h
index f6a9fe0ef09c..00b78763a1bf 100644
--- a/include/scsi/scsi_device.h
+++ b/include/scsi/scsi_device.h
@@ -134,6 +134,7 @@ struct scsi_device {
134 unsigned no_start_on_add:1; /* do not issue start on add */ 134 unsigned no_start_on_add:1; /* do not issue start on add */
135 unsigned allow_restart:1; /* issue START_UNIT in error handler */ 135 unsigned allow_restart:1; /* issue START_UNIT in error handler */
136 unsigned manage_start_stop:1; /* Let HLD (sd) manage start/stop */ 136 unsigned manage_start_stop:1; /* Let HLD (sd) manage start/stop */
137 unsigned start_stop_pwr_cond:1; /* Set power cond. in START_STOP_UNIT */
137 unsigned no_uld_attach:1; /* disable connecting to upper level drivers */ 138 unsigned no_uld_attach:1; /* disable connecting to upper level drivers */
138 unsigned select_no_atn:1; 139 unsigned select_no_atn:1;
139 unsigned fix_capacity:1; /* READ_CAPACITY is too high by 1 */ 140 unsigned fix_capacity:1; /* READ_CAPACITY is too high by 1 */