16 #include <linux/kernel.h>
17 #include <linux/slab.h>
28 const unsigned char *
buf,
unsigned size)
30 unsigned i, nr_strings;
39 for (i = 0; i <
size; i++) {
50 buffer = kzalloc(
sizeof(
char*) * nr_strings + size,
GFP_KERNEL);
54 string = (
char*)(buffer + nr_strings);
56 for (i = 0; i < nr_strings; i++) {
59 string +=
strlen(
string) + 1;
65 func->
info = (
const char**)buffer;
68 card->
info = (
const char**)buffer;
75 const unsigned char *buf,
unsigned size)
80 vendor = buf[0] | (buf[1] << 8);
83 device = buf[2] | (buf[3] << 8);
96 static const unsigned char speed_val[16] =
97 { 0, 10, 12, 13, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 70, 80 };
98 static const unsigned int speed_unit[8] =
99 { 10000, 100000, 1000000, 10000000, 0, 0, 0, 0 };
103 const unsigned char *, unsigned);
112 const char *tpl_descr,
113 const struct cis_tpl *tpl,
int tpl_count,
115 const unsigned char *buf,
unsigned size)
120 for (i = 0; i < tpl_count; i++, tpl++) {
121 if (tpl->
code == code)
127 ret = tpl->
parse(card, func, buf, size);
135 pr_err(
"%s: bad %s tuple 0x%02x (%u bytes)\n",
147 const unsigned char *buf,
unsigned size)
154 card->
cis.blksize = buf[1] | (buf[2] << 8);
157 card->
cis.max_dtr = speed_val[(buf[3] >> 3) & 15] *
158 speed_unit[buf[3] & 7];
164 const unsigned char *buf,
unsigned size)
177 vsn = func->
card->cccr.sdio_vsn;
202 static const struct cis_tpl cis_tpl_funce_list[] = {
203 { 0x00, 4, cistpl_funce_common },
204 { 0x01, 0, cistpl_funce_func },
209 const unsigned char *buf,
unsigned size)
214 return cis_tpl_parse(card, func,
"CISTPL_FUNCE",
221 static const struct cis_tpl cis_tpl_list[] = {
222 { 0x15, 3, cistpl_vers_1 },
223 { 0x20, 4, cistpl_manfid },
225 { 0x22, 0, cistpl_funce },
239 for (i = 0; i < 3; i++) {
262 unsigned char tpl_code, tpl_link;
269 if (tpl_code == 0xff)
273 if (tpl_code == 0x00)
281 if (tpl_link == 0xff)
288 for (i = 0; i < tpl_link; i++) {
290 ptr + i, 0, &this->
data[i]);
300 ret = cis_tpl_parse(card, func,
"CIS",
302 tpl_code, this->
data, tpl_link);
309 this->code = tpl_code;
310 this->size = tpl_link;
317 " CIS tuple 0x%02x (%u bytes)\n",
348 return sdio_read_cis(card,
NULL);
370 ret = sdio_read_cis(func->
card, func);
398 while (tuple && tuple != func->
card->tuples) {