From a7d15860f78fcc8f91e467b5fe238e40db1008ba Mon Sep 17 00:00:00 2001 From: Russell King Date: Mon, 30 Aug 2004 12:49:37 +0100 Subject: [PATCH] [MMC] Add host specific block queue parameters 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 | 12 +++++++++++- drivers/mmc/mmc_block.c | 5 ----- drivers/mmc/mmc_queue.c | 9 +++++++-- include/linux/mmc/host.h | 7 +++++++ 4 files changed, 25 insertions(+), 8 deletions(-) diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c index 761987485ed46..962b6ae4d4eec 100644 --- a/drivers/mmc/mmc.c +++ b/drivers/mmc/mmc.c @@ -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 #include #include +#include #include #include @@ -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; diff --git a/drivers/mmc/mmc_block.c b/drivers/mmc/mmc_block.c index 6454a32802951..423d9cb9055ec 100644 --- a/drivers/mmc/mmc_block.c +++ b/drivers/mmc/mmc_block.c @@ -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"); diff --git a/drivers/mmc/mmc_queue.c b/drivers/mmc/mmc_queue.c index 58180c8fefac1..dffa439db34ea 100644 --- a/drivers/mmc/mmc_queue.c +++ b/drivers/mmc/mmc_queue.c @@ -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; diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h index 9cbbc82fd7df7..f67686cef62ae 100644 --- a/include/linux/mmc/host.h +++ b/include/linux/mmc/host.h @@ -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 */ -- 2.53.0