Lines Matching refs:p

663 	u_char *p, *q;  in parse_device()  local
665 p = (u_char *)tuple->TupleData; in parse_device()
666 q = p + tuple->TupleDataLen; in parse_device()
671 if (*p == 0xff) in parse_device()
673 device->dev[i].type = (*p >> 4); in parse_device()
674 device->dev[i].wp = (*p & 0x08) ? 1 : 0; in parse_device()
675 switch (*p & 0x07) { in parse_device()
692 if (++p == q) in parse_device()
694 device->dev[i].speed = SPEED_CVT(*p); in parse_device()
695 while (*p & 0x80) in parse_device()
696 if (++p == q) in parse_device()
703 if (++p == q) in parse_device()
705 if (*p == 0xff) in parse_device()
707 scale = *p & 7; in parse_device()
710 device->dev[i].size = ((*p >> 3) + 1) * (512 << (scale*2)); in parse_device()
712 if (++p == q) in parse_device()
722 u_char *p; in parse_checksum() local
725 p = (u_char *) tuple->TupleData; in parse_checksum()
726 csum->addr = tuple->CISOffset + get_unaligned_le16(p) - 2; in parse_checksum()
727 csum->len = get_unaligned_le16(p + 2); in parse_checksum()
728 csum->sum = *(p + 4); in parse_checksum()
744 u_char *p; in parse_longlink_mfc() local
747 p = (u_char *)tuple->TupleData; in parse_longlink_mfc()
749 link->nfn = *p; p++; in parse_longlink_mfc()
753 link->fn[i].space = *p; p++; in parse_longlink_mfc()
754 link->fn[i].addr = get_unaligned_le32(p); in parse_longlink_mfc()
755 p += 4; in parse_longlink_mfc()
761 static int parse_strings(u_char *p, u_char *q, int max, in parse_strings() argument
766 if (p == q) in parse_strings()
770 if (*p == 0xff) in parse_strings()
775 s[j++] = (*p == 0xff) ? '\0' : *p; in parse_strings()
776 if ((*p == '\0') || (*p == 0xff)) in parse_strings()
778 if (++p == q) in parse_strings()
781 if ((*p == 0xff) || (++p == q)) in parse_strings()
795 u_char *p, *q; in parse_vers_1() local
797 p = (u_char *)tuple->TupleData; in parse_vers_1()
798 q = p + tuple->TupleDataLen; in parse_vers_1()
800 vers_1->major = *p; p++; in parse_vers_1()
801 vers_1->minor = *p; p++; in parse_vers_1()
802 if (p >= q) in parse_vers_1()
805 return parse_strings(p, q, CISTPL_VERS_1_MAX_PROD_STRINGS, in parse_vers_1()
812 u_char *p, *q; in parse_altstr() local
814 p = (u_char *)tuple->TupleData; in parse_altstr()
815 q = p + tuple->TupleDataLen; in parse_altstr()
817 return parse_strings(p, q, CISTPL_MAX_ALTSTR_STRINGS, in parse_altstr()
824 u_char *p, *q; in parse_jedec() local
827 p = (u_char *)tuple->TupleData; in parse_jedec()
828 q = p + tuple->TupleDataLen; in parse_jedec()
831 if (p > q-2) in parse_jedec()
833 jedec->id[nid].mfr = p[0]; in parse_jedec()
834 jedec->id[nid].info = p[1]; in parse_jedec()
835 p += 2; in parse_jedec()
854 u_char *p; in parse_funcid() local
857 p = (u_char *)tuple->TupleData; in parse_funcid()
858 f->func = p[0]; in parse_funcid()
859 f->sysinit = p[1]; in parse_funcid()
866 u_char *p; in parse_funce() local
870 p = (u_char *)tuple->TupleData; in parse_funce()
871 f->type = p[0]; in parse_funce()
873 f->data[i-1] = p[i]; in parse_funce()
881 u_char *p; in parse_config() local
883 p = (u_char *)tuple->TupleData; in parse_config()
884 rasz = *p & 0x03; in parse_config()
885 rmsz = (*p & 0x3c) >> 2; in parse_config()
888 config->last_idx = *(++p); in parse_config()
889 p++; in parse_config()
892 config->base += p[i] << (8*i); in parse_config()
893 p += rasz+1; in parse_config()
897 config->rmask[i>>2] += p[i] << (8*(i%4)); in parse_config()
906 static u_char *parse_power(u_char *p, u_char *q, cistpl_power_t *pwr) in parse_power() argument
911 if (p == q) in parse_power()
913 pwr->present = *p; in parse_power()
915 p++; in parse_power()
918 if (p == q) in parse_power()
920 pwr->param[i] = POWER_CVT(*p); in parse_power()
921 scale = POWER_SCALE(*p); in parse_power()
922 while (*p & 0x80) { in parse_power()
923 if (++p == q) in parse_power()
925 if ((*p & 0x7f) < 100) in parse_power()
927 (*p & 0x7f) * scale / 100; in parse_power()
928 else if (*p == 0x7d) in parse_power()
930 else if (*p == 0x7e) in parse_power()
932 else if (*p == 0x7f) in parse_power()
937 p++; in parse_power()
939 return p; in parse_power()
943 static u_char *parse_timing(u_char *p, u_char *q, cistpl_timing_t *timing) in parse_timing() argument
947 if (p == q) in parse_timing()
949 scale = *p; in parse_timing()
951 if (++p == q) in parse_timing()
953 timing->wait = SPEED_CVT(*p); in parse_timing()
959 if (++p == q) in parse_timing()
961 timing->ready = SPEED_CVT(*p); in parse_timing()
967 if (++p == q) in parse_timing()
969 timing->reserved = SPEED_CVT(*p); in parse_timing()
973 p++; in parse_timing()
974 return p; in parse_timing()
978 static u_char *parse_io(u_char *p, u_char *q, cistpl_io_t *io) in parse_io() argument
982 if (p == q) in parse_io()
984 io->flags = *p; in parse_io()
986 if (!(*p & 0x80)) { in parse_io()
990 return p+1; in parse_io()
993 if (++p == q) in parse_io()
995 io->nwin = (*p & 0x0f) + 1; in parse_io()
996 bsz = (*p & 0x30) >> 4; in parse_io()
999 lsz = (*p & 0xc0) >> 6; in parse_io()
1002 p++; in parse_io()
1007 for (j = 0; j < bsz; j++, p++) { in parse_io()
1008 if (p == q) in parse_io()
1010 io->win[i].base += *p << (j*8); in parse_io()
1012 for (j = 0; j < lsz; j++, p++) { in parse_io()
1013 if (p == q) in parse_io()
1015 io->win[i].len += *p << (j*8); in parse_io()
1018 return p; in parse_io()
1022 static u_char *parse_mem(u_char *p, u_char *q, cistpl_mem_t *mem) in parse_mem() argument
1027 if (p == q) in parse_mem()
1030 mem->nwin = (*p & 0x07) + 1; in parse_mem()
1031 lsz = (*p & 0x18) >> 3; in parse_mem()
1032 asz = (*p & 0x60) >> 5; in parse_mem()
1033 has_ha = (*p & 0x80); in parse_mem()
1034 if (++p == q) in parse_mem()
1039 for (j = 0; j < lsz; j++, p++) { in parse_mem()
1040 if (p == q) in parse_mem()
1042 len += *p << (j*8); in parse_mem()
1044 for (j = 0; j < asz; j++, p++) { in parse_mem()
1045 if (p == q) in parse_mem()
1047 ca += *p << (j*8); in parse_mem()
1050 for (j = 0; j < asz; j++, p++) { in parse_mem()
1051 if (p == q) in parse_mem()
1053 ha += *p << (j*8); in parse_mem()
1059 return p; in parse_mem()
1063 static u_char *parse_irq(u_char *p, u_char *q, cistpl_irq_t *irq) in parse_irq() argument
1065 if (p == q) in parse_irq()
1067 irq->IRQInfo1 = *p; p++; in parse_irq()
1069 if (p+2 > q) in parse_irq()
1071 irq->IRQInfo2 = (p[1]<<8) + p[0]; in parse_irq()
1072 p += 2; in parse_irq()
1074 return p; in parse_irq()
1081 u_char *p, *q, features; in parse_cftable_entry() local
1083 p = tuple->TupleData; in parse_cftable_entry()
1084 q = p + tuple->TupleDataLen; in parse_cftable_entry()
1085 entry->index = *p & 0x3f; in parse_cftable_entry()
1087 if (*p & 0x40) in parse_cftable_entry()
1089 if (*p & 0x80) { in parse_cftable_entry()
1090 if (++p == q) in parse_cftable_entry()
1092 if (*p & 0x10) in parse_cftable_entry()
1094 if (*p & 0x20) in parse_cftable_entry()
1096 if (*p & 0x40) in parse_cftable_entry()
1098 if (*p & 0x80) in parse_cftable_entry()
1100 entry->interface = *p & 0x0f; in parse_cftable_entry()
1105 if (++p == q) in parse_cftable_entry()
1107 features = *p; p++; in parse_cftable_entry()
1111 p = parse_power(p, q, &entry->vcc); in parse_cftable_entry()
1112 if (p == NULL) in parse_cftable_entry()
1117 p = parse_power(p, q, &entry->vpp1); in parse_cftable_entry()
1118 if (p == NULL) in parse_cftable_entry()
1123 p = parse_power(p, q, &entry->vpp2); in parse_cftable_entry()
1124 if (p == NULL) in parse_cftable_entry()
1131 p = parse_timing(p, q, &entry->timing); in parse_cftable_entry()
1132 if (p == NULL) in parse_cftable_entry()
1142 p = parse_io(p, q, &entry->io); in parse_cftable_entry()
1143 if (p == NULL) in parse_cftable_entry()
1150 p = parse_irq(p, q, &entry->irq); in parse_cftable_entry()
1151 if (p == NULL) in parse_cftable_entry()
1162 entry->mem.win[0].len = get_unaligned_le16(p) << 8; in parse_cftable_entry()
1165 p += 2; in parse_cftable_entry()
1166 if (p > q) in parse_cftable_entry()
1171 entry->mem.win[0].len = get_unaligned_le16(p) << 8; in parse_cftable_entry()
1172 entry->mem.win[0].card_addr = get_unaligned_le16(p + 2) << 8; in parse_cftable_entry()
1174 p += 4; in parse_cftable_entry()
1175 if (p > q) in parse_cftable_entry()
1179 p = parse_mem(p, q, &entry->mem); in parse_cftable_entry()
1180 if (p == NULL) in parse_cftable_entry()
1187 if (p == q) in parse_cftable_entry()
1189 entry->flags |= (*p << 8); in parse_cftable_entry()
1190 while (*p & 0x80) in parse_cftable_entry()
1191 if (++p == q) in parse_cftable_entry()
1193 p++; in parse_cftable_entry()
1196 entry->subtuples = q-p; in parse_cftable_entry()
1204 u_char *p, *q; in parse_device_geo() local
1207 p = (u_char *)tuple->TupleData; in parse_device_geo()
1208 q = p + tuple->TupleDataLen; in parse_device_geo()
1211 if (p > q-6) in parse_device_geo()
1213 geo->geo[n].buswidth = p[0]; in parse_device_geo()
1214 geo->geo[n].erase_block = 1 << (p[1]-1); in parse_device_geo()
1215 geo->geo[n].read_block = 1 << (p[2]-1); in parse_device_geo()
1216 geo->geo[n].write_block = 1 << (p[3]-1); in parse_device_geo()
1217 geo->geo[n].partition = 1 << (p[4]-1); in parse_device_geo()
1218 geo->geo[n].interleave = 1 << (p[5]-1); in parse_device_geo()
1219 p += 6; in parse_device_geo()
1228 u_char *p, *q; in parse_vers_2() local
1233 p = tuple->TupleData; in parse_vers_2()
1234 q = p + tuple->TupleDataLen; in parse_vers_2()
1236 v2->vers = p[0]; in parse_vers_2()
1237 v2->comply = p[1]; in parse_vers_2()
1238 v2->dindex = get_unaligned_le16(p + 2); in parse_vers_2()
1239 v2->vspec8 = p[6]; in parse_vers_2()
1240 v2->vspec9 = p[7]; in parse_vers_2()
1241 v2->nhdr = p[8]; in parse_vers_2()
1242 p += 9; in parse_vers_2()
1243 return parse_strings(p, q, 2, v2->str, &v2->vendor, NULL); in parse_vers_2()
1249 u_char *p, *q; in parse_org() local
1252 p = tuple->TupleData; in parse_org()
1253 q = p + tuple->TupleDataLen; in parse_org()
1254 if (p == q) in parse_org()
1256 org->data_org = *p; in parse_org()
1257 if (++p == q) in parse_org()
1260 org->desc[i] = *p; in parse_org()
1261 if (*p == '\0') in parse_org()
1263 if (++p == q) in parse_org()
1272 u_char *p; in parse_format() local
1277 p = tuple->TupleData; in parse_format()
1279 fmt->type = p[0]; in parse_format()
1280 fmt->edc = p[1]; in parse_format()
1281 fmt->offset = get_unaligned_le32(p + 2); in parse_format()
1282 fmt->length = get_unaligned_le32(p + 6); in parse_format()
1379 cisparse_t *p; in pccard_validate_cis() local
1401 p = kmalloc(sizeof(*p), GFP_KERNEL); in pccard_validate_cis()
1402 if (p == NULL) { in pccard_validate_cis()
1418 (!pccard_read_tuple(s, BIND_FN_ALL, CISTPL_CFTABLE_ENTRY, p)) || in pccard_validate_cis()
1419 (!pccard_read_tuple(s, BIND_FN_ALL, CISTPL_CFTABLE_ENTRY_CB, p))) in pccard_validate_cis()
1425 if ((pccard_read_tuple(s, BIND_FN_ALL, CISTPL_MANFID, p) == 0) || in pccard_validate_cis()
1426 (pccard_read_tuple(s, BIND_FN_ALL, CISTPL_VERS_1, p) == 0) || in pccard_validate_cis()
1427 (pccard_read_tuple(s, BIND_FN_ALL, CISTPL_VERS_2, p) != -ENOSPC)) in pccard_validate_cis()
1466 kfree(p); in pccard_validate_cis()