Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

rsxx: Adding in sync_start module paramenter.

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>

authored by

Philip J Kelleher and committed by
Jens Axboe
fb065cd9 7b379cc3

+34
+34
drivers/block/rsxx/core.c
··· 39 39 #include "rsxx_cfg.h" 40 40 41 41 #define NO_LEGACY 0 42 + #define SYNC_START_TIMEOUT (10 * 60) /* 10 minutes */ 42 43 43 44 MODULE_DESCRIPTION("IBM FlashSystem 70/80 PCIe SSD Device Driver"); 44 45 MODULE_AUTHOR("Joshua Morris/Philip Kelleher, IBM"); ··· 49 48 static unsigned int force_legacy = NO_LEGACY; 50 49 module_param(force_legacy, uint, 0444); 51 50 MODULE_PARM_DESC(force_legacy, "Force the use of legacy type PCI interrupts"); 51 + 52 + static unsigned int sync_start = 1; 53 + module_param(sync_start, uint, 0444); 54 + MODULE_PARM_DESC(sync_start, "On by Default: Driver load will not complete " 55 + "until the card startup has completed."); 52 56 53 57 static DEFINE_IDA(rsxx_disk_ida); 54 58 static DEFINE_SPINLOCK(rsxx_ida_lock); ··· 546 540 { 547 541 struct rsxx_cardinfo *card; 548 542 int st; 543 + unsigned int sync_timeout; 549 544 550 545 dev_info(&dev->dev, "PCI-Flash SSD discovered\n"); 551 546 ··· 705 698 if (st) 706 699 dev_crit(CARD_TO_DEV(card), 707 700 "Failed issuing card startup\n"); 701 + if (sync_start) { 702 + sync_timeout = SYNC_START_TIMEOUT; 703 + 704 + dev_info(CARD_TO_DEV(card), 705 + "Waiting for card to startup\n"); 706 + 707 + do { 708 + ssleep(1); 709 + sync_timeout--; 710 + 711 + rsxx_get_card_state(card, &card->state); 712 + } while (sync_timeout && 713 + (card->state == CARD_STATE_STARTING)); 714 + 715 + if (card->state == CARD_STATE_STARTING) { 716 + dev_warn(CARD_TO_DEV(card), 717 + "Card startup timed out\n"); 718 + card->size8 = 0; 719 + } else { 720 + dev_info(CARD_TO_DEV(card), 721 + "card state: %s\n", 722 + rsxx_card_state_to_str(card->state)); 723 + st = rsxx_get_card_size8(card, &card->size8); 724 + if (st) 725 + card->size8 = 0; 726 + } 727 + } 708 728 } else if (card->state == CARD_STATE_GOOD || 709 729 card->state == CARD_STATE_RD_ONLY_FAULT) { 710 730 st = rsxx_get_card_size8(card, &card->size8);