mmcsd.c (184034) | mmcsd.c (184452) |
---|---|
1/*- 2 * Copyright (c) 2006 Bernd Walter. All rights reserved. 3 * Copyright (c) 2006 M. Warner Losh. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 37 unchanged lines hidden (view full) --- 46 * implication, estoppel or otherwise under any patent or other rights of the 47 * SD Group, SD-3C LLC, the SD Card Association or any third party. Nothing 48 * herein shall be construed as an obligation by the SD Group, the SD-3C LLC 49 * or the SD Card Association to disclose or distribute any technical 50 * information, know-how or other confidential information to any third party. 51 */ 52 53#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 2006 Bernd Walter. All rights reserved. 3 * Copyright (c) 2006 M. Warner Losh. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 37 unchanged lines hidden (view full) --- 46 * implication, estoppel or otherwise under any patent or other rights of the 47 * SD Group, SD-3C LLC, the SD Card Association or any third party. Nothing 48 * herein shall be construed as an obligation by the SD Group, the SD-3C LLC 49 * or the SD Card Association to disclose or distribute any technical 50 * information, know-how or other confidential information to any third party. 51 */ 52 53#include <sys/cdefs.h> |
54__FBSDID("$FreeBSD: head/sys/dev/mmc/mmcsd.c 184034 2008-10-18 22:22:25Z mav $"); | 54__FBSDID("$FreeBSD: head/sys/dev/mmc/mmcsd.c 184452 2008-10-29 20:01:26Z mav $"); |
55 56#include <sys/param.h> 57#include <sys/systm.h> 58#include <sys/bio.h> 59#include <sys/bus.h> 60#include <sys/conf.h> 61#include <sys/kernel.h> 62#include <sys/kthread.h> --- 13 unchanged lines hidden (view full) --- 76 struct mtx sc_mtx; 77 struct disk *disk; 78 struct proc *p; 79 struct bio_queue_head bio_queue; 80 daddr_t eblock, eend; /* Range remaining after the last erase. */ 81 int running; 82}; 83 | 55 56#include <sys/param.h> 57#include <sys/systm.h> 58#include <sys/bio.h> 59#include <sys/bus.h> 60#include <sys/conf.h> 61#include <sys/kernel.h> 62#include <sys/kthread.h> --- 13 unchanged lines hidden (view full) --- 76 struct mtx sc_mtx; 77 struct disk *disk; 78 struct proc *p; 79 struct bio_queue_head bio_queue; 80 daddr_t eblock, eend; /* Range remaining after the last erase. */ 81 int running; 82}; 83 |
84#define MULTI_BLOCK_BROKEN 85 | |
86/* bus entry points */ 87static int mmcsd_probe(device_t dev); 88static int mmcsd_attach(device_t dev); 89static int mmcsd_detach(device_t dev); 90 91/* disk routines */ 92static int mmcsd_open(struct disk *dp); 93static int mmcsd_close(struct disk *dp); --- 136 unchanged lines hidden (view full) --- 230 device_t dev = sc->dev; 231 int sz = sc->disk->d_sectorsize; 232 233 block = bp->bio_pblkno; 234 end = bp->bio_pblkno + (bp->bio_bcount / sz); 235 while (block < end) { 236 char *vaddr = bp->bio_data + 237 (block - bp->bio_pblkno) * sz; | 84/* bus entry points */ 85static int mmcsd_probe(device_t dev); 86static int mmcsd_attach(device_t dev); 87static int mmcsd_detach(device_t dev); 88 89/* disk routines */ 90static int mmcsd_open(struct disk *dp); 91static int mmcsd_close(struct disk *dp); --- 136 unchanged lines hidden (view full) --- 228 device_t dev = sc->dev; 229 int sz = sc->disk->d_sectorsize; 230 231 block = bp->bio_pblkno; 232 end = bp->bio_pblkno + (bp->bio_bcount / sz); 233 while (block < end) { 234 char *vaddr = bp->bio_data + 235 (block - bp->bio_pblkno) * sz; |
238 int numblocks; 239#ifdef MULTI_BLOCK 240 numblocks = end - block; 241#else 242 numblocks = 1; 243#endif | 236 int numblocks = min(end - block, mmc_get_max_data(dev)); |
244 memset(&req, 0, sizeof(req)); 245 memset(&cmd, 0, sizeof(cmd)); 246 memset(&stop, 0, sizeof(stop)); 247 req.cmd = &cmd; 248 cmd.data = &data; 249 if (bp->bio_cmd == BIO_READ) { 250 if (numblocks > 1) 251 cmd.opcode = MMC_READ_MULTIPLE_BLOCK; --- 222 unchanged lines hidden --- | 237 memset(&req, 0, sizeof(req)); 238 memset(&cmd, 0, sizeof(cmd)); 239 memset(&stop, 0, sizeof(stop)); 240 req.cmd = &cmd; 241 cmd.data = &data; 242 if (bp->bio_cmd == BIO_READ) { 243 if (numblocks > 1) 244 cmd.opcode = MMC_READ_MULTIPLE_BLOCK; --- 222 unchanged lines hidden --- |