]> git.kernelconcepts.de Git - karo-tx-linux.git/blobdiff - drivers/firewire/fw-sbp2.c
firewire: sbp2: add support for disks >2 TB (and 16 bytes long CDBs)
[karo-tx-linux.git] / drivers / firewire / fw-sbp2.c
index 133842664af0829e8ef0995186b5f5c349104725..e56f805dade0134e0ffbb905aa822f506f74b144 100644 (file)
@@ -188,6 +188,12 @@ struct sbp2_target {
 #define SBP2_RETRY_LIMIT               0xf             /* 15 retries */
 #define SBP2_CYCLE_LIMIT               (0xc8 << 12)    /* 200 125us cycles */
 
+/*
+ * There is no transport protocol limit to the CDB length,  but we implement
+ * a fixed length only.  16 bytes is enough for disks larger than 2 TB.
+ */
+#define SBP2_MAX_CDB_SIZE              16
+
 /* Unit directory keys */
 #define SBP2_CSR_UNIT_CHARACTERISTICS  0x3a
 #define SBP2_CSR_FIRMWARE_REVISION     0x3c
@@ -293,7 +299,7 @@ struct sbp2_command_orb {
                struct sbp2_pointer next;
                struct sbp2_pointer data_descriptor;
                __be32 misc;
-               u8 command_block[12];
+               u8 command_block[SBP2_MAX_CDB_SIZE];
        } request;
        struct scsi_cmnd *cmd;
        scsi_done_fn_t done;
@@ -350,15 +356,17 @@ static const struct {
                .model                  = ~0,
                .workarounds            = SBP2_WORKAROUND_128K_MAX_TRANS,
        },
-
        /*
-        * There are iPods (2nd gen, 3rd gen) with model_id == 0, but
-        * these iPods do not feature the read_capacity bug according
-        * to one report.  Read_capacity behaviour as well as model_id
-        * could change due to Apple-supplied firmware updates though.
+        * iPod 2nd generation: needs 128k max transfer size workaround
+        * iPod 3rd generation: needs fix capacity workaround
         */
-
-       /* iPod 4th generation. */ {
+       {
+               .firmware_revision      = 0x0a2700,
+               .model                  = 0x000000,
+               .workarounds            = SBP2_WORKAROUND_128K_MAX_TRANS |
+                                         SBP2_WORKAROUND_FIX_CAPACITY,
+       },
+       /* iPod 4th generation */ {
                .firmware_revision      = 0x0a2700,
                .model                  = 0x000021,
                .workarounds            = SBP2_WORKAROUND_FIX_CAPACITY,
@@ -1157,6 +1165,8 @@ static int sbp2_probe(struct device *dev)
        if (fw_device_enable_phys_dma(device) < 0)
                goto fail_shost_put;
 
+       shost->max_cmd_len = SBP2_MAX_CDB_SIZE;
+
        if (scsi_add_host(shost, &unit->device) < 0)
                goto fail_shost_put;