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