Deleted Added
full compact
mmcsd.c (234524) mmcsd.c (236491)
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 234524 2012-04-21 01:51:16Z marius $");
54__FBSDID("$FreeBSD: head/sys/dev/mmc/mmcsd.c 236491 2012-06-02 20:47:00Z marius $");
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>

--- 21 unchanged lines hidden (view full) ---

84 struct proc *p;
85 struct bio_queue_head bio_queue;
86 daddr_t eblock, eend; /* Range remaining after the last erase. */
87 int running;
88 int suspend;
89};
90
91/* bus entry points */
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>

--- 21 unchanged lines hidden (view full) ---

84 struct proc *p;
85 struct bio_queue_head bio_queue;
86 daddr_t eblock, eend; /* Range remaining after the last erase. */
87 int running;
88 int suspend;
89};
90
91/* bus entry points */
92static int mmcsd_probe(device_t dev);
93static int mmcsd_attach(device_t dev);
94static int mmcsd_detach(device_t dev);
92static int mmcsd_attach(device_t dev);
93static int mmcsd_detach(device_t dev);
94static int mmcsd_probe(device_t dev);
95
96/* disk routines */
95
96/* disk routines */
97static int mmcsd_open(struct disk *dp);
98static int mmcsd_close(struct disk *dp);
97static int mmcsd_close(struct disk *dp);
99static void mmcsd_strategy(struct bio *bp);
100static int mmcsd_dump(void *arg, void *virtual, vm_offset_t physical,
101 off_t offset, size_t length);
98static int mmcsd_dump(void *arg, void *virtual, vm_offset_t physical,
99 off_t offset, size_t length);
100static int mmcsd_open(struct disk *dp);
101static void mmcsd_strategy(struct bio *bp);
102static void mmcsd_task(void *arg);
103
104static int mmcsd_bus_bit_width(device_t dev);
102static void mmcsd_task(void *arg);
103
104static int mmcsd_bus_bit_width(device_t dev);
105static daddr_t mmcsd_delete(struct mmcsd_softc *sc, struct bio *bp);
106static daddr_t mmcsd_rw(struct mmcsd_softc *sc, struct bio *bp);
105
106#define MMCSD_LOCK(_sc) mtx_lock(&(_sc)->sc_mtx)
107#define MMCSD_UNLOCK(_sc) mtx_unlock(&(_sc)->sc_mtx)
108#define MMCSD_LOCK_INIT(_sc) \
109 mtx_init(&_sc->sc_mtx, device_get_nameunit(_sc->dev), \
110 "mmcsd", MTX_DEF)
111#define MMCSD_LOCK_DESTROY(_sc) mtx_destroy(&_sc->sc_mtx);
112#define MMCSD_ASSERT_LOCKED(_sc) mtx_assert(&_sc->sc_mtx, MA_OWNED);

--- 138 unchanged lines hidden (view full) ---

251 } else
252 MMCSD_UNLOCK(sc);
253 return (0);
254}
255
256static int
257mmcsd_open(struct disk *dp)
258{
107
108#define MMCSD_LOCK(_sc) mtx_lock(&(_sc)->sc_mtx)
109#define MMCSD_UNLOCK(_sc) mtx_unlock(&(_sc)->sc_mtx)
110#define MMCSD_LOCK_INIT(_sc) \
111 mtx_init(&_sc->sc_mtx, device_get_nameunit(_sc->dev), \
112 "mmcsd", MTX_DEF)
113#define MMCSD_LOCK_DESTROY(_sc) mtx_destroy(&_sc->sc_mtx);
114#define MMCSD_ASSERT_LOCKED(_sc) mtx_assert(&_sc->sc_mtx, MA_OWNED);

--- 138 unchanged lines hidden (view full) ---

253 } else
254 MMCSD_UNLOCK(sc);
255 return (0);
256}
257
258static int
259mmcsd_open(struct disk *dp)
260{
261
259 return (0);
260}
261
262static int
263mmcsd_close(struct disk *dp)
264{
262 return (0);
263}
264
265static int
266mmcsd_close(struct disk *dp)
267{
268
265 return (0);
266}
267
268static void
269mmcsd_strategy(struct bio *bp)
270{
271 struct mmcsd_softc *sc;
272

--- 243 unchanged lines hidden (view full) ---

516 wakeup(sc);
517
518 kproc_exit(0);
519}
520
521static int
522mmcsd_bus_bit_width(device_t dev)
523{
269 return (0);
270}
271
272static void
273mmcsd_strategy(struct bio *bp)
274{
275 struct mmcsd_softc *sc;
276

--- 243 unchanged lines hidden (view full) ---

520 wakeup(sc);
521
522 kproc_exit(0);
523}
524
525static int
526mmcsd_bus_bit_width(device_t dev)
527{
528
524 if (mmc_get_bus_width(dev) == bus_width_1)
525 return (1);
526 if (mmc_get_bus_width(dev) == bus_width_4)
527 return (4);
528 return (8);
529}
530
531static device_method_t mmcsd_methods[] = {

--- 16 unchanged lines hidden ---
529 if (mmc_get_bus_width(dev) == bus_width_1)
530 return (1);
531 if (mmc_get_bus_width(dev) == bus_width_4)
532 return (4);
533 return (8);
534}
535
536static device_method_t mmcsd_methods[] = {

--- 16 unchanged lines hidden ---