]>
Commit | Line | Data |
---|---|---|
1 | typedef unsigned int u32; | |
2 | typedef struct { | |
3 | } | |
4 | spinlock_t; | |
5 | extern struct page *mem_map; | |
6 | typedef struct pm_message { | |
7 | } | |
8 | pm_message_t; | |
9 | struct device_driver { | |
10 | const char * name; | |
11 | }; | |
12 | struct page { | |
13 | unsigned long flags; | |
14 | }; | |
15 | struct scatterlist { | |
16 | struct page * page; | |
17 | unsigned int offset; | |
18 | }; | |
19 | struct request { | |
20 | unsigned int cmd_flags; | |
21 | }; | |
22 | static inline __attribute__((always_inline)) void sg_set_buf(struct scatterlist *sg, const void *buf, unsigned int buflen) { | |
23 | sg->page = (mem_map + ((((unsigned long)(buf)-0x80000000) >> 12) - ((0x0C000000 >> 12)))); | |
24 | sg->offset = ((unsigned long)(buf) & ~(~((1UL << 12)-1))); | |
25 | } | |
26 | static inline __attribute__((always_inline)) void sg_init_one(struct scatterlist *sg, const void *buf, unsigned int buflen) { | |
27 | memset(sg, 0, sizeof(*sg)); | |
28 | sg_set_buf(sg, buf, buflen); | |
29 | }; | |
30 | struct mmc_card { | |
31 | unsigned int state; | |
32 | }; | |
33 | struct mmc_driver { | |
34 | struct device_driver drv; | |
35 | int (*probe)(struct mmc_card *); | |
36 | void (*remove)(struct mmc_card *); | |
37 | int (*suspend)(struct mmc_card *, pm_message_t); | |
38 | int (*resume)(struct mmc_card *); | |
39 | }; | |
40 | struct mmc_queue { | |
41 | struct mmc_card *card; | |
42 | int (*issue_fn)(struct mmc_queue *, struct request *); | |
43 | void *data; | |
44 | }; | |
45 | struct mmc_blk_data { | |
46 | struct mmc_queue queue; | |
47 | }; | |
48 | static u32 mmc_sd_num_wr_blocks(struct mmc_card *card) { | |
49 | u32 blocks; | |
50 | struct scatterlist sg; | |
51 | sg_init_one(&sg, &blocks, 4); | |
52 | } | |
53 | static int mmc_blk_issue_rq(struct mmc_queue *mq, struct request *req) { | |
54 | struct mmc_blk_data *md = mq->data; | |
55 | struct mmc_card *card = md->queue.card; | |
56 | if (((req)->cmd_flags & 1) != 0 && ((card)->state & (1<<3))) { | |
57 | u32 blocks; | |
58 | blocks = mmc_sd_num_wr_blocks(card); | |
59 | if (blocks != (u32)-1) { | |
60 | do { | |
61 | local_irq_disable(); | |
62 | } | |
63 | while (0); | |
64 | } | |
65 | } | |
66 | } | |
67 | static struct mmc_blk_data *mmc_blk_alloc(struct mmc_card *card) { | |
68 | struct mmc_blk_data *md; | |
69 | md->queue.issue_fn = mmc_blk_issue_rq; | |
70 | } | |
71 | static int mmc_blk_probe(struct mmc_card *card) { | |
72 | struct mmc_blk_data *md; | |
73 | md = mmc_blk_alloc(card); | |
74 | } | |
75 | static void mmc_blk_remove(struct mmc_card *card) { | |
76 | } | |
77 | static struct mmc_driver mmc_driver = { | |
78 | .drv = { | |
79 | .name = "mmcblk", } | |
80 | , .probe = mmc_blk_probe, .remove = mmc_blk_remove, .suspend = ((void *)0), .resume = ((void *)0), }; | |
81 | static void __attribute__((__used__)) __attribute__ ((__section__(".exit.text"))) mmc_blk_exit(void) { | |
82 | mmc_unregister_driver(&mmc_driver); | |
83 | } |