Update of /cvsroot/gc-linux/linux/drivers/block
In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv751/drivers/block
Modified Files:
Kconfig Makefile gcn-aram.c gcn-sd.c rvl-mem2.c rvl-stsd.c
Log Message:
Merge gc-linux-v2.6.31.
Index: gcn-aram.c
===================================================================
RCS file: /cvsroot/gc-linux/linux/drivers/block/gcn-aram.c,v
retrieving revision 1.20
retrieving revision 1.21
diff -C2 -d -r1.20 -r1.21
*** gcn-aram.c 2 Mar 2009 18:50:14 -0000 1.20
--- gcn-aram.c 25 Oct 2009 18:59:27 -0000 1.21
***************
*** 89,93 ****
*/
struct aram_drvdata {
! spinlock_t lock;
spinlock_t io_lock;
--- 89,93 ----
*/
struct aram_drvdata {
! spinlock_t queue_lock;
spinlock_t io_lock;
***************
*** 99,103 ****
struct request_queue *queue;
! struct request *req;
dma_addr_t dma_addr;
size_t dma_len;
--- 99,103 ----
struct request_queue *queue;
! struct request *req; /* protected by ->io_lock */
dma_addr_t dma_addr;
size_t dma_len;
***************
*** 169,190 ****
out_be16(csr_reg, csr);
! /* pick up current request being serviced */
req = drvdata->req;
drvdata->req = NULL;
!
! spin_unlock_irqrestore(&drvdata->io_lock, flags);
!
! if (req) {
! __blk_end_request(req, 0, req->current_nr_sectors << 9);
dma_unmap_single(drvdata->dev,
drvdata->dma_addr, drvdata->dma_len,
rq_dir_to_dma_dir(req));
! spin_lock(&drvdata->lock);
! blk_start_queue(drvdata->queue);
! spin_unlock(&drvdata->lock);
! } else {
drv_printk(KERN_ERR, "ignoring interrupt, no request\n");
}
return IRQ_HANDLED;
}
--- 169,195 ----
out_be16(csr_reg, csr);
! /* pick up request in service */
req = drvdata->req;
drvdata->req = NULL;
! if (drvdata->dma_len) {
dma_unmap_single(drvdata->dev,
drvdata->dma_addr, drvdata->dma_len,
rq_dir_to_dma_dir(req));
! drvdata->dma_len = 0;
! }
!
! spin_unlock_irqrestore(&drvdata->io_lock, flags);
!
! if (!req) {
drv_printk(KERN_ERR, "ignoring interrupt, no request\n");
+ goto out;
}
+ spin_lock(&drvdata->queue_lock);
+ __blk_end_request_cur(req, 0);
+ blk_start_queue(drvdata->queue);
+ spin_unlock(&drvdata->queue_lock);
+
+ out:
return IRQ_HANDLED;
}
***************
*** 197,251 ****
size_t len;
unsigned long flags;
! req = elv_next_request(q);
while (req) {
spin_lock_irqsave(&drvdata->io_lock, flags);
-
- /* we schedule a single request each time */
if (drvdata->req) {
- spin_unlock_irqrestore(&drvdata->io_lock, flags);
blk_stop_queue(q);
- break;
- }
-
- blkdev_dequeue_request(req);
-
- /* ignore requests that we can't handle */
- if (!blk_fs_request(req)) {
spin_unlock_irqrestore(&drvdata->io_lock, flags);
! continue;
}
! /* store the request being handled */
! drvdata->req = req;
! blk_stop_queue(q);
! spin_unlock_irqrestore(&drvdata->io_lock, flags);
/* calculate the ARAM address and length */
! aram_addr = req->sector << 9;
! len = req->current_nr_sectors << 9;
/* give up if the request goes out of bounds */
if (aram_addr + len > ARAM_BUFFERSIZE) {
drv_printk(KERN_ERR, "bad access: block=%lu,"
! " size=%u\n", (unsigned long)req->sector,
len);
! /* XXX correct? the request is already dequeued */
! end_request(req, 0);
! continue;
}
! BUG_ON(req->nr_phys_segments != 1);
! /* perform DMA mappings */
drvdata->dma_len = len;
drvdata->dma_addr = dma_map_single(drvdata->dev,
req->buffer, len,
rq_dir_to_dma_dir(req));
-
- /* start the DMA transfer */
aram_start_dma_transfer(drvdata, aram_addr);
break;
}
}
--- 202,250 ----
size_t len;
unsigned long flags;
+ int error;
! req = blk_peek_request(q);
while (req) {
spin_lock_irqsave(&drvdata->io_lock, flags);
if (drvdata->req) {
blk_stop_queue(q);
spin_unlock_irqrestore(&drvdata->io_lock, flags);
! break;
}
! blk_start_request(req);
! error = -EIO;
! if (!blk_fs_request(req))
! goto done;
/* calculate the ARAM address and length */
! aram_addr = blk_rq_pos(req) << 9;
! len = blk_rq_cur_bytes(req);
/* give up if the request goes out of bounds */
if (aram_addr + len > ARAM_BUFFERSIZE) {
drv_printk(KERN_ERR, "bad access: block=%lu,"
! " size=%u\n", (unsigned long)blk_rq_pos(req),
len);
! goto done;
}
! drvdata->req = req;
! spin_unlock_irqrestore(&drvdata->io_lock, flags);
! /* perform DMA mappings and start the transfer */
drvdata->dma_len = len;
drvdata->dma_addr = dma_map_single(drvdata->dev,
req->buffer, len,
rq_dir_to_dma_dir(req));
aram_start_dma_transfer(drvdata, aram_addr);
+
+ /* one request at a time */
break;
+ done:
+ spin_unlock_irqrestore(&drvdata->io_lock, flags);
+ if (!__blk_end_request_cur(req, error))
+ req = blk_peek_request(q);
}
}
***************
*** 262,266 ****
int retval = 0;
! spin_lock_irqsave(&drvdata->lock, flags);
/* only allow a minor of 0 to be opened */
--- 261,265 ----
int retval = 0;
! spin_lock_irqsave(&drvdata->queue_lock, flags);
/* only allow a minor of 0 to be opened */
***************
*** 283,287 ****
out:
! spin_unlock_irqrestore(&drvdata->lock, flags);
return retval;
}
--- 282,286 ----
out:
! spin_unlock_irqrestore(&drvdata->queue_lock, flags);
return retval;
}
***************
*** 292,301 ****
unsigned long flags;
! spin_lock_irqsave(&drvdata->lock, flags);
if (drvdata->ref_count > 0)
drvdata->ref_count--;
else
drvdata->ref_count = 0;
! spin_unlock_irqrestore(&drvdata->lock, flags);
return 0;
--- 291,300 ----
unsigned long flags;
! spin_lock_irqsave(&drvdata->queue_lock, flags);
if (drvdata->ref_count > 0)
drvdata->ref_count--;
else
drvdata->ref_count = 0;
! spin_unlock_irqrestore(&drvdata->queue_lock, flags);
return 0;
***************
*** 336,346 ****
retval = -ENOMEM;
! spin_lock_init(&drvdata->lock);
spin_lock_init(&drvdata->io_lock);
! queue = blk_init_queue(aram_do_request, &drvdata->lock);
if (!queue)
goto err_blk_init_queue;
! blk_queue_hardsect_size(queue, ARAM_SECTOR_SIZE);
blk_queue_dma_alignment(queue, ARAM_DMA_ALIGN);
blk_queue_max_phys_segments(queue, 1);
--- 335,345 ----
retval = -ENOMEM;
! spin_lock_init(&drvdata->queue_lock);
spin_lock_init(&drvdata->io_lock);
! queue = blk_init_queue(aram_do_request, &drvdata->queue_lock);
if (!queue)
goto err_blk_init_queue;
! blk_queue_logical_block_size(queue, ARAM_SECTOR_SIZE);
blk_queue_dma_alignment(queue, ARAM_DMA_ALIGN);
blk_queue_max_phys_segments(queue, 1);
Index: gcn-sd.c
===================================================================
RCS file: /cvsroot/gc-linux/linux/drivers/block/gcn-sd.c,v
retrieving revision 1.17
retrieving revision 1.18
diff -C2 -d -r1.17 -r1.18
*** gcn-sd.c 2 Mar 2009 18:48:17 -0000 1.17
--- gcn-sd.c 25 Oct 2009 18:59:27 -0000 1.18
***************
*** 1091,1095 ****
*/
! start = req->sector << KERNEL_SECTOR_SHIFT;
#if 0
nr_blocks = req->current_nr_sectors >>
--- 1091,1095 ----
*/
! start = blk_rq_pos(req) << KERNEL_SECTOR_SHIFT;
#if 0
nr_blocks = req->current_nr_sectors >>
***************
*** 1097,1101 ****
block_len = 1 << host->card.csd.read_blkbits;
#else
! nr_blocks = req->current_nr_sectors;
block_len = 1 << KERNEL_SECTOR_SHIFT;
#endif
--- 1097,1101 ----
block_len = 1 << host->card.csd.read_blkbits;
#else
! nr_blocks = blk_rq_cur_sectors(req);
block_len = 1 << KERNEL_SECTOR_SHIFT;
#endif
***************
*** 1135,1140 ****
/* kernel sectors and card write blocks are both 512 bytes long */
! start = req->sector << KERNEL_SECTOR_SHIFT;
! nr_blocks = req->current_nr_sectors;
block_len = 1 << KERNEL_SECTOR_SHIFT;
--- 1135,1140 ----
/* kernel sectors and card write blocks are both 512 bytes long */
! start = blk_rq_pos(req) << KERNEL_SECTOR_SHIFT;
! nr_blocks = blk_rq_cur_sectors(req);
block_len = 1 << KERNEL_SECTOR_SHIFT;
***************
*** 1160,1164 ****
* <0 in case of error.
* 0 if request passes the checks
- * >0 if request can be ignored
*/
static int sd_check_request(struct sd_host *host, struct request *req)
--- 1160,1163 ----
***************
*** 1166,1169 ****
--- 1165,1171 ----
unsigned long nr_sectors;
+ if (!blk_fs_request(req))
+ return -EIO;
+
if (test_bit(__SD_MEDIA_CHANGED, &host->flags)) {
sd_printk(KERN_ERR, "media changed, aborting\n");
***************
*** 1177,1188 ****
/* keep our reads within limits */
! if (req->sector + req->current_nr_sectors > nr_sectors) {
sd_printk(KERN_ERR, "reading past end, aborting\n");
return -EINVAL;
}
- if (!blk_fs_request(req))
- return 1;
-
return 0;
}
--- 1179,1187 ----
/* keep our reads within limits */
! if (blk_rq_pos(req) + blk_rq_cur_sectors(req) > nr_sectors) {
sd_printk(KERN_ERR, "reading past end, aborting\n");
return -EINVAL;
}
return 0;
}
***************
*** 1193,1212 ****
static int sd_do_request(struct sd_host *host, struct request *req)
{
! int retval;
! retval = sd_check_request(host, req);
! if (retval)
! return 0;
switch (rq_data_dir(req)) {
case WRITE:
! retval = sd_write_request(host, req);
break;
case READ:
! retval = sd_read_request(host, req);
break;
}
! return retval;
}
--- 1192,1215 ----
static int sd_do_request(struct sd_host *host, struct request *req)
{
! int nr_sectors = 0;
! int error;
! error = sd_check_request(host, req);
! if (error) {
! nr_sectors = error;
! goto out;
! }
switch (rq_data_dir(req)) {
case WRITE:
! nr_sectors = sd_write_request(host, req);
break;
case READ:
! nr_sectors = sd_read_request(host, req);
break;
}
! out:
! return nr_sectors;
}
***************
*** 1240,1244 ****
spin_lock_irqsave(&host->queue_lock, flags);
if (!blk_queue_plugged(host->queue))
! req = elv_next_request(host->queue);
spin_unlock_irqrestore(&host->queue_lock, flags);
--- 1243,1247 ----
spin_lock_irqsave(&host->queue_lock, flags);
if (!blk_queue_plugged(host->queue))
! req = blk_fetch_request(host->queue);
spin_unlock_irqrestore(&host->queue_lock, flags);
***************
*** 1402,1406 ****
/* inform the block layer about various sizes */
! blk_queue_hardsect_size(host->queue, 1 << KERNEL_SECTOR_SHIFT);
set_capacity(host->disk, host->card.csd.capacity <<
(host->card.csd.read_blkbits - KERNEL_SECTOR_SHIFT));
--- 1405,1409 ----
/* inform the block layer about various sizes */
! blk_queue_logical_block_size(host->queue, 1 << KERNEL_SECTOR_SHIFT);
set_capacity(host->disk, host->card.csd.capacity <<
(host->card.csd.read_blkbits - KERNEL_SECTOR_SHIFT));
Index: Kconfig
===================================================================
RCS file: /cvsroot/gc-linux/linux/drivers/block/Kconfig,v
retrieving revision 1.41
retrieving revision 1.42
diff -C2 -d -r1.41 -r1.42
*** Kconfig 25 Oct 2009 18:56:56 -0000 1.41
--- Kconfig 25 Oct 2009 18:59:27 -0000 1.42
***************
*** 64,67 ****
--- 64,132 ----
module will be called z2ram.
+ config GAMECUBE_SD
+ tristate "Nintendo GameCube/Wii MMC/SD card"
+ depends on GAMECUBE_EXI
+ help
+ This enables support for using SD and MMC cards through
+ the Nintendo SD Card Adapter (DOL-019) or compatible hardware.
+
+ You probably want to compile FAT support, and the required
+ codepages, or mount will complain. See Filesystems -> DOS/FAT/NT
+ filesystems and Filesystems -> Native Language Support
+
+ Say Y if you want to include this driver in the kernel.
+
+ To compile this driver as a module, choose M here: the
+ module will be called gcn-sd.
+
+ config GAMECUBE_ARAM
+ tristate "Nintendo GameCube Auxiliary RAM (ARAM)"
+ depends on GAMECUBE
+ help
+ This enables support for using the 16MB of ARAM found in the
+ Nintendo GameCube as a block device.
+ Say Y if you want to include this driver in the kernel.
+
+ To compile this driver as a module, choose M here: the
+ module will be called gcn-aram.
+
+ config GAMECUBE_DI
+ tristate "Nintendo GameCube Disk Interface (DI)"
+ depends on GAMECUBE
+ help
+ This enables support for using the DVD drive unit found
+ in the Nintendo GameCube.
+ Say Y if you want to include this driver in the kernel.
+
+ To compile this driver as a module, choose M here: the
+ module will be called gcn-di.
+
+ config WII_MEM2
+ tristate "Nintendo Wii MEM2"
+ depends on WII
+ help
+ This enables support for using the MEM2 found in the
+ Nintendo Wii as a block device.
+ Say Y if you want to include this driver in the kernel.
+
+ To compile this driver as a module, choose M here: the
+ module will be called rvl-mem2.
+
+ config WII_SD
+ tristate "Nintendo Wii front slot MMC/SD"
+ depends on STARLET_IOS
+ help
+ This enables support for MMC/SD cards using the front SD card
+ slot of the Nintendo Wii.
+
+ You probably want to compile FAT support, and the required
+ codepages, or mount will complain. See Filesystems -> DOS/FAT/NT
+ filesystems and Filesystems -> Native Language Support
+
+ Say Y if you want to include this driver in the kernel.
+
+ To compile this driver as a module, choose M here: the
+ module will be called rvl-stsd.
+
config BLK_DEV_XD
tristate "XT hard disk support"
Index: rvl-mem2.c
===================================================================
RCS file: /cvsroot/gc-linux/linux/drivers/block/rvl-mem2.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** rvl-mem2.c 25 Oct 2009 18:50:27 -0000 1.7
--- rvl-mem2.c 25 Oct 2009 18:59:28 -0000 1.8
***************
*** 73,108 ****
int error;
! req = elv_next_request(q);
while (req) {
! if (blk_fs_request(req)) {
! /* calculate the MEM2 address and length */
! mem2_addr = req->sector << 9;
! len = req->current_nr_sectors << 9;
! /* give up if the request goes out of bounds */
! if (mem2_addr + len > drvdata->size) {
! drv_printk(KERN_ERR, "bad access: block=%lu,"
! " size=%u\n",
! (unsigned long)req->sector, len);
! error = -EIO;
! } else {
! switch (rq_data_dir(req)) {
! case READ:
! memcpy(req->buffer,
! drvdata->io_base + mem2_addr,
! len);
! break;
! case WRITE:
! memcpy(drvdata->io_base + mem2_addr,
! req->buffer, len);
! break;
! }
! error = 0;
! }
! __blk_end_request(req, error, len);
! } else {
! end_request(req, 0);
}
! req = elv_next_request(q);
}
}
--- 73,108 ----
int error;
! req = blk_fetch_request(q);
while (req) {
! error = -EIO;
! if (!blk_fs_request(req))
! goto done;
!
! /* calculate the MEM2 address and length */
! mem2_addr = blk_rq_pos(req) << 9;
! len = blk_rq_cur_bytes(req);
!
! /* give up if the request goes out of bounds */
! if (mem2_addr + len > drvdata->size) {
! drv_printk(KERN_ERR, "bad access: block=%lu,"
! " size=%zu\n",
! (unsigned long)blk_rq_pos(req), len);
! goto done;
}
!
! switch (rq_data_dir(req)) {
! case READ:
! memcpy(req->buffer, drvdata->io_base + mem2_addr, len);
! break;
! case WRITE:
! memcpy(drvdata->io_base + mem2_addr, req->buffer, len);
! break;
! }
! error = 0;
!
! done:
! if (!__blk_end_request_cur(req, error));
! req = blk_fetch_request(q);
}
}
***************
*** 198,202 ****
goto err_blk_init_queue;
! blk_queue_hardsect_size(queue, MEM2_SECTOR_SIZE);
blk_queue_max_phys_segments(queue, 1);
blk_queue_max_hw_segments(queue, 1);
--- 198,202 ----
goto err_blk_init_queue;
! blk_queue_logical_block_size(queue, MEM2_SECTOR_SIZE);
blk_queue_max_phys_segments(queue, 1);
blk_queue_max_hw_segments(queue, 1);
Index: Makefile
===================================================================
RCS file: /cvsroot/gc-linux/linux/drivers/block/Makefile,v
retrieving revision 1.29
retrieving revision 1.30
diff -C2 -d -r1.29 -r1.30
*** Makefile 25 Oct 2009 18:56:56 -0000 1.29
--- Makefile 25 Oct 2009 18:59:27 -0000 1.30
***************
*** 14,17 ****
--- 14,22 ----
obj-$(CONFIG_ATARI_FLOPPY) += ataflop.o
obj-$(CONFIG_AMIGA_Z2RAM) += z2ram.o
+ obj-$(CONFIG_GAMECUBE_SD) += gcn-sd.o
+ obj-$(CONFIG_GAMECUBE_ARAM) += gcn-aram.o
+ obj-$(CONFIG_GAMECUBE_DI) += gcn-di/
+ obj-$(CONFIG_WII_MEM2) += rvl-mem2.o
+ obj-$(CONFIG_WII_SD) += rvl-stsd.o
obj-$(CONFIG_BLK_DEV_RAM) += brd.o
obj-$(CONFIG_BLK_DEV_LOOP) += loop.o
Index: rvl-stsd.c
===================================================================
RCS file: /cvsroot/gc-linux/linux/drivers/block/rvl-stsd.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** rvl-stsd.c 25 Oct 2009 18:50:27 -0000 1.8
--- rvl-stsd.c 25 Oct 2009 18:59:28 -0000 1.9
***************
*** 1724,1734 ****
}
- /*
- * Returns >0 if a request should be dispatched.
- */
static int stsd_check_request(struct stsd_host *host, struct request *req)
{
unsigned long nr_sectors;
if (test_bit(__STSD_MEDIA_CHANGED, &host->flags)) {
drv_printk(KERN_ERR, "media changed, aborting\n");
--- 1724,1734 ----
}
static int stsd_check_request(struct stsd_host *host, struct request *req)
{
unsigned long nr_sectors;
+ if (!blk_fs_request(req))
+ return -EIO;
+
if (test_bit(__STSD_MEDIA_CHANGED, &host->flags)) {
drv_printk(KERN_ERR, "media changed, aborting\n");
***************
*** 1742,1754 ****
/* keep our reads within limits */
! if (req->sector + req->current_nr_sectors > nr_sectors) {
drv_printk(KERN_ERR, "reading past end, aborting\n");
return -EINVAL;
}
! if (!blk_fs_request(req))
! return 0;
!
! return 1;
}
--- 1742,1751 ----
/* keep our reads within limits */
! if (blk_rq_pos(req) + blk_rq_cur_sectors(req) > nr_sectors) {
drv_printk(KERN_ERR, "reading past end, aborting\n");
return -EINVAL;
}
! return 0;
}
***************
*** 1758,1774 ****
unsigned long start;
int write;
- int uptodate;
int error;
! uptodate = stsd_check_request(host, req);
! if (uptodate <= 0)
! return uptodate;
write = (rq_data_dir(req) == READ) ? 0 : 1;
! start = req->sector;
if (!stsd_card_is_sdhc(host))
start <<= KERNEL_SECTOR_SHIFT;
! nr_blocks = req->current_nr_sectors;
error = stsd_do_block_transfer(host, write,
--- 1755,1770 ----
unsigned long start;
int write;
int error;
! error = stsd_check_request(host, req);
! if (error)
! goto out;
write = (rq_data_dir(req) == READ) ? 0 : 1;
! start = blk_rq_pos(req);
if (!stsd_card_is_sdhc(host))
start <<= KERNEL_SECTOR_SHIFT;
! nr_blocks = blk_rq_cur_sectors(req);
error = stsd_do_block_transfer(host, write,
***************
*** 1778,1781 ****
--- 1774,1778 ----
error, error, start);
+ out:
return error;
}
***************
*** 1797,1801 ****
spin_lock_irqsave(&host->queue_lock, flags);
if (!blk_queue_plugged(host->queue))
! req = elv_next_request(host->queue);
spin_unlock_irqrestore(&host->queue_lock, flags);
--- 1794,1798 ----
spin_lock_irqsave(&host->queue_lock, flags);
if (!blk_queue_plugged(host->queue))
! req = blk_fetch_request(host->queue);
spin_unlock_irqrestore(&host->queue_lock, flags);
***************
*** 1814,1818 ****
spin_lock_irqsave(&host->queue_lock, flags);
! __blk_end_request(req, error, blk_rq_bytes(req));
spin_unlock_irqrestore(&host->queue_lock, flags);
}
--- 1811,1815 ----
spin_lock_irqsave(&host->queue_lock, flags);
! __blk_end_request_cur(req, error);
spin_unlock_irqrestore(&host->queue_lock, flags);
}
***************
*** 1825,1829 ****
{
struct stsd_host *host = q->queuedata;
-
wake_up_process(host->io_thread);
}
--- 1822,1825 ----
***************
*** 1959,1963 ****
/* inform the block layer about various sizes */
! blk_queue_hardsect_size(host->queue, KERNEL_SECTOR_SIZE);
set_capacity(host->disk, host->card.csd.capacity <<
(host->card.csd.read_blkbits - KERNEL_SECTOR_SHIFT));
--- 1955,1959 ----
/* inform the block layer about various sizes */
! blk_queue_logical_block_size(host->queue, KERNEL_SECTOR_SIZE);
set_capacity(host->disk, host->card.csd.capacity <<
(host->card.csd.read_blkbits - KERNEL_SECTOR_SHIFT));
|