]> git.hungrycats.org Git - linux/commitdiff
[MMC] Add host specific block queue parameters
authorRussell King <rmk@flint.arm.linux.org.uk>
Mon, 30 Aug 2004 11:49:37 +0000 (12:49 +0100)
committerRussell King <rmk@flint.arm.linux.org.uk>
Mon, 30 Aug 2004 11:49:37 +0000 (12:49 +0100)
Allow MMC host drivers to specify their data phase capabilities
to the block queue.  This will eventually allow us to perform
SG data phase operations, thereby processing a single request
in one go.

drivers/mmc/mmc.c
drivers/mmc/mmc_block.c
drivers/mmc/mmc_queue.c
include/linux/mmc/host.h

index 761987485ed4672d7e8792f10c4ecbb64cb1071a..962b6ae4d4eec29a029f0703a8b6b3c1ffc7bd85 100644 (file)
@@ -1,7 +1,7 @@
 /*
  *  linux/drivers/mmc/mmc.c
  *
- *  Copyright (C) 2003 Russell King, All Rights Reserved.
+ *  Copyright (C) 2003-2004 Russell King, All Rights Reserved.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 as
@@ -14,6 +14,7 @@
 #include <linux/completion.h>
 #include <linux/device.h>
 #include <linux/delay.h>
+#include <linux/pagemap.h>
 #include <linux/err.h>
 
 #include <linux/mmc/card.h>
@@ -721,6 +722,15 @@ struct mmc_host *mmc_alloc_host(int extra, struct device *dev)
                INIT_WORK(&host->detect, mmc_rescan, host);
 
                host->dev = dev;
+
+               /*
+                * By default, hosts do not support SGIO or large requests.
+                * They have to set these according to their abilities.
+                */
+               host->max_hw_segs = 1;
+               host->max_phys_segs = 1;
+               host->max_sectors = 1 << (PAGE_CACHE_SHIFT - 9);
+               host->max_seg_size = PAGE_CACHE_SIZE;
        }
 
        return host;
index 6454a32802951c515f966e8bc4ffdbc3f84bdc05..423d9cb9055ec3bc1e99dfcb84e4a41295b52a97 100644 (file)
@@ -43,7 +43,6 @@
 #define MMC_SHIFT      3
 
 static int mmc_major;
-static int maxsectors = 8;
 
 /*
  * There is one mmc_blk_data per slot.
@@ -336,7 +335,6 @@ static struct mmc_blk_data *mmc_blk_alloc(struct mmc_card *card)
 
                md->block_bits = card->csd.read_blkbits;
 
-               blk_queue_max_sectors(md->queue.queue, maxsectors);
                blk_queue_hardsect_size(md->queue.queue, 1 << md->block_bits);
                set_capacity(md->disk, card->csd.capacity);
        }
@@ -489,9 +487,6 @@ static void __exit mmc_blk_exit(void)
 
 module_init(mmc_blk_init);
 module_exit(mmc_blk_exit);
-module_param(maxsectors, int, 0444);
-
-MODULE_PARM_DESC(maxsectors, "Maximum number of sectors for a single request");
 
 MODULE_LICENSE("GPL");
 MODULE_DESCRIPTION("Multimedia Card (MMC) block device driver");
index 58180c8fefac16d6547ec816c56216695bd96b02..dffa439db34ea111240a92ebc9e60ed119d4a541 100644 (file)
@@ -124,11 +124,12 @@ static void mmc_request(request_queue_t *q)
  */
 int mmc_init_queue(struct mmc_queue *mq, struct mmc_card *card, spinlock_t *lock)
 {
+       struct mmc_host *host = card->host;
        u64 limit = BLK_BOUNCE_HIGH;
        int ret;
 
-       if (card->host->dev->dma_mask && *card->host->dev->dma_mask)
-               limit = *card->host->dev->dma_mask;
+       if (host->dev->dma_mask && *host->dev->dma_mask)
+               limit = *host->dev->dma_mask;
 
        mq->card = card;
        mq->queue = blk_init_queue(mmc_request, lock);
@@ -137,6 +138,10 @@ int mmc_init_queue(struct mmc_queue *mq, struct mmc_card *card, spinlock_t *lock
 
        blk_queue_prep_rq(mq->queue, mmc_prep_request);
        blk_queue_bounce_limit(mq->queue, limit);
+       blk_queue_max_sectors(mq->queue, host->max_sectors);
+       blk_queue_max_phys_segments(mq->queue, host->max_phys_segs);
+       blk_queue_max_hw_segments(mq->queue, host->max_hw_segs);
+       blk_queue_max_segment_size(mq->queue, host->max_seg_size);
 
        mq->queue->queuedata = mq;
        mq->req = NULL;
index 9cbbc82fd7df717ec3320debe9c9d4714e374c17..f67686cef62aee1c1f5586e6e724d8d66aa22186 100644 (file)
@@ -69,6 +69,13 @@ struct mmc_host {
        u32                     ocr_avail;
        char                    host_name[8];
 
+       /* host specific block data */
+       unsigned int            max_seg_size;   /* see blk_queue_max_segment_size */
+       unsigned short          max_hw_segs;    /* see blk_queue_max_hw_segments */
+       unsigned short          max_phys_segs;  /* see blk_queue_max_phys_segments */
+       unsigned short          max_sectors;    /* see blk_queue_max_sectors */
+       unsigned short          unused;
+
        /* private data */
        struct mmc_ios          ios;            /* current io bus settings */
        u32                     ocr;            /* the current OCR setting */