Merge tag 'firewire-updates' of git://git.kernel.org/pub/scm/linux/kernel/git/ieee139...
authorLinus Torvalds <torvalds@linux-foundation.org>
Mon, 30 Jul 2012 16:32:39 +0000 (09:32 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Mon, 30 Jul 2012 16:32:39 +0000 (09:32 -0700)
Pull firewire updates from Stefan Richter:

 - Small fixes and optimizations.

 - A new sysfs attribute to tell local and remote nodes apart.
   Useful to set special permissions/ ownership of local nodes'
   /dev/fw*, to start daemons on them (for diagnostics, management,
   AV targets, VersaPHY initiator or targets...), to pick up their
   GUID to use it as GUID of an SBP2 target instance, and of course
   for informational purposes.

* tag 'firewire-updates' of git://git.kernel.org/pub/scm/linux/kernel/git/ieee1394/linux1394:
  firewire: core: document is_local sysfs attribute
  firewire: core: add is_local sysfs device attribute
  firewire: ohci: initialize multiChanMode bits after reset
  firewire: core: fix multichannel IR with buffers larger than 2 GB
  firewire: ohci: sanity-check MMIO resource
  firewire: ohci: lazy bus time initialization
  firewire: core: allocate the low memory region
  firewire: core: make address handler length 64 bits

1  2 
drivers/firewire/core-transaction.c
include/linux/firewire.h

index 780708dc6e25f39a9cd181e3a1c0f075ad8f96ee,fc2ad654e1ad19a86bb3af6c49c3aae44ef1c3ee..87d6f2d2f02d015a030cad4001fd59bebeeea9a4
@@@ -525,9 -525,10 +525,10 @@@ const struct fw_address_region fw_high_
        { .start = 0x000100000000ULL, .end = 0xffffe0000000ULL,  };
  EXPORT_SYMBOL(fw_high_memory_region);
  
- #if 0
- const struct fw_address_region fw_low_memory_region =
+ static const struct fw_address_region low_memory_region =
        { .start = 0x000000000000ULL, .end = 0x000100000000ULL,  };
+ #if 0
  const struct fw_address_region fw_private_region =
        { .start = 0xffffe0000000ULL, .end = 0xfffff0000000ULL,  };
  const struct fw_address_region fw_csr_region =
@@@ -820,15 -821,6 +821,15 @@@ void fw_send_response(struct fw_card *c
  }
  EXPORT_SYMBOL(fw_send_response);
  
 +/**
 + * fw_get_request_speed() - returns speed at which the @request was received
 + */
 +int fw_get_request_speed(struct fw_request *request)
 +{
 +      return request->response.speed;
 +}
 +EXPORT_SYMBOL(fw_get_request_speed);
 +
  static void handle_exclusive_region_request(struct fw_card *card,
                                            struct fw_packet *p,
                                            struct fw_request *request,
@@@ -1198,6 -1190,23 +1199,23 @@@ static struct fw_address_handler regist
        .address_callback       = handle_registers,
  };
  
+ static void handle_low_memory(struct fw_card *card, struct fw_request *request,
+               int tcode, int destination, int source, int generation,
+               unsigned long long offset, void *payload, size_t length,
+               void *callback_data)
+ {
+       /*
+        * This catches requests not handled by the physical DMA unit,
+        * i.e., wrong transaction types or unauthorized source nodes.
+        */
+       fw_send_response(card, request, RCODE_TYPE_ERROR);
+ }
+ static struct fw_address_handler low_memory = {
+       .length                 = 0x000100000000ULL,
+       .address_callback       = handle_low_memory,
+ };
  MODULE_AUTHOR("Kristian Hoegsberg <krh@bitplanet.net>");
  MODULE_DESCRIPTION("Core IEEE1394 transaction logic");
  MODULE_LICENSE("GPL");
@@@ -1259,6 -1268,7 +1277,7 @@@ static int __init fw_core_init(void
  
        fw_core_add_address_handler(&topology_map, &topology_map_region);
        fw_core_add_address_handler(&registers, &registers_region);
+       fw_core_add_address_handler(&low_memory, &low_memory_region);
        fw_core_add_descriptor(&vendor_id_descriptor);
        fw_core_add_descriptor(&model_id_descriptor);
  
diff --combined include/linux/firewire.h
index 7edcf10317182a32c4ffeef84b5c6dd1d7ed091c,cb2445e2e10e06d6e505cd2cedd368839f95e309..db04ec5121cb770d6c571a59234997c60527e539
@@@ -135,24 -135,10 +135,24 @@@ struct fw_card 
        __be32 maint_utility_register;
  };
  
 +static inline struct fw_card *fw_card_get(struct fw_card *card)
 +{
 +      kref_get(&card->kref);
 +
 +      return card;
 +}
 +
 +void fw_card_release(struct kref *kref);
 +
 +static inline void fw_card_put(struct fw_card *card)
 +{
 +      kref_put(&card->kref, fw_card_release);
 +}
 +
  struct fw_attribute_group {
        struct attribute_group *groups[2];
        struct attribute_group group;
-       struct attribute *attrs[12];
+       struct attribute *attrs[13];
  };
  
  enum fw_device_state {
@@@ -321,7 -307,7 +321,7 @@@ struct fw_transaction 
  
  struct fw_address_handler {
        u64 offset;
-       size_t length;
+       u64 length;
        fw_address_callback_t address_callback;
        void *callback_data;
        struct list_head link;
@@@ -339,7 -325,6 +339,7 @@@ int fw_core_add_address_handler(struct 
  void fw_core_remove_address_handler(struct fw_address_handler *handler);
  void fw_send_response(struct fw_card *card,
                      struct fw_request *request, int rcode);
 +int fw_get_request_speed(struct fw_request *request);
  void fw_send_request(struct fw_card *card, struct fw_transaction *t,
                     int tcode, int destination_id, int generation, int speed,
                     unsigned long long offset, void *payload, size_t length,