]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
rsxx: Adding in sync_start module paramenter.
authorPhilip J Kelleher <pjk1939@linux.vnet.ibm.com>
Tue, 18 Jun 2013 19:42:36 +0000 (14:42 -0500)
committerJens Axboe <axboe@kernel.dk>
Wed, 19 Jun 2013 11:52:09 +0000 (13:52 +0200)
Before, the partition table would have to be reread because our
card was attached before it transistioned out of it's 'starting'
state.

This change will cause the driver to wait to attach the device
until the adapter is ready.

Signed-off-by: Philip J Kelleher <pjk1939@linux.vnet.ibm.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
drivers/block/rsxx/core.c

index aca3f198e5cdb55d55d35dcae51f2027dadda989..0f1be41ccfa8f0c5d5f38c1ee5d5ef5352904b43 100644 (file)
@@ -39,6 +39,7 @@
 #include "rsxx_cfg.h"
 
 #define NO_LEGACY 0
+#define SYNC_START_TIMEOUT (10 * 60) /* 10 minutes */
 
 MODULE_DESCRIPTION("IBM FlashSystem 70/80 PCIe SSD Device Driver");
 MODULE_AUTHOR("Joshua Morris/Philip Kelleher, IBM");
@@ -49,6 +50,11 @@ static unsigned int force_legacy = NO_LEGACY;
 module_param(force_legacy, uint, 0444);
 MODULE_PARM_DESC(force_legacy, "Force the use of legacy type PCI interrupts");
 
+static unsigned int sync_start = 1;
+module_param(sync_start, uint, 0444);
+MODULE_PARM_DESC(sync_start, "On by Default: Driver load will not complete "
+                            "until the card startup has completed.");
+
 static DEFINE_IDA(rsxx_disk_ida);
 static DEFINE_SPINLOCK(rsxx_ida_lock);
 
@@ -540,6 +546,7 @@ static int rsxx_pci_probe(struct pci_dev *dev,
 {
        struct rsxx_cardinfo *card;
        int st;
+       unsigned int sync_timeout;
 
        dev_info(&dev->dev, "PCI-Flash SSD discovered\n");
 
@@ -698,6 +705,33 @@ static int rsxx_pci_probe(struct pci_dev *dev,
                if (st)
                        dev_crit(CARD_TO_DEV(card),
                                "Failed issuing card startup\n");
+               if (sync_start) {
+                       sync_timeout = SYNC_START_TIMEOUT;
+
+                       dev_info(CARD_TO_DEV(card),
+                                "Waiting for card to startup\n");
+
+                       do {
+                               ssleep(1);
+                               sync_timeout--;
+
+                               rsxx_get_card_state(card, &card->state);
+                       } while (sync_timeout &&
+                               (card->state == CARD_STATE_STARTING));
+
+                       if (card->state == CARD_STATE_STARTING) {
+                               dev_warn(CARD_TO_DEV(card),
+                                        "Card startup timed out\n");
+                               card->size8 = 0;
+                       } else {
+                               dev_info(CARD_TO_DEV(card),
+                                       "card state: %s\n",
+                                       rsxx_card_state_to_str(card->state));
+                               st = rsxx_get_card_size8(card, &card->size8);
+                               if (st)
+                                       card->size8 = 0;
+                       }
+               }
        } else if (card->state == CARD_STATE_GOOD ||
                   card->state == CARD_STATE_RD_ONLY_FAULT) {
                st = rsxx_get_card_size8(card, &card->size8);