Lines Matching refs:tok
712 static void add_token_u8(int *err, struct opal_dev *cmd, u8 tok) in add_token_u8() argument
717 cmd->cmd[cmd->pos++] = tok; in add_token_u8()
895 const struct opal_resp_tok *tok; in response_get_token() local
908 tok = &resp->toks[n]; in response_get_token()
909 if (tok->len == 0) { in response_get_token()
914 return tok; in response_get_token()
917 static ssize_t response_parse_tiny(struct opal_resp_tok *tok, in response_parse_tiny() argument
920 tok->pos = pos; in response_parse_tiny()
921 tok->len = 1; in response_parse_tiny()
922 tok->width = OPAL_WIDTH_TINY; in response_parse_tiny()
925 tok->type = OPAL_DTA_TOKENID_SINT; in response_parse_tiny()
927 tok->type = OPAL_DTA_TOKENID_UINT; in response_parse_tiny()
928 tok->stored.u = pos[0] & 0x3f; in response_parse_tiny()
931 return tok->len; in response_parse_tiny()
934 static ssize_t response_parse_short(struct opal_resp_tok *tok, in response_parse_short() argument
937 tok->pos = pos; in response_parse_short()
938 tok->len = (pos[0] & SHORT_ATOM_LEN_MASK) + 1; in response_parse_short()
939 tok->width = OPAL_WIDTH_SHORT; in response_parse_short()
942 tok->type = OPAL_DTA_TOKENID_BYTESTRING; in response_parse_short()
944 tok->type = OPAL_DTA_TOKENID_SINT; in response_parse_short()
949 tok->type = OPAL_DTA_TOKENID_UINT; in response_parse_short()
950 if (tok->len > 9) { in response_parse_short()
954 for (i = tok->len - 1; i > 0; i--) { in response_parse_short()
958 tok->stored.u = u_integer; in response_parse_short()
961 return tok->len; in response_parse_short()
964 static ssize_t response_parse_medium(struct opal_resp_tok *tok, in response_parse_medium() argument
967 tok->pos = pos; in response_parse_medium()
968 tok->len = (((pos[0] & MEDIUM_ATOM_LEN_MASK) << 8) | pos[1]) + 2; in response_parse_medium()
969 tok->width = OPAL_WIDTH_MEDIUM; in response_parse_medium()
972 tok->type = OPAL_DTA_TOKENID_BYTESTRING; in response_parse_medium()
974 tok->type = OPAL_DTA_TOKENID_SINT; in response_parse_medium()
976 tok->type = OPAL_DTA_TOKENID_UINT; in response_parse_medium()
978 return tok->len; in response_parse_medium()
981 static ssize_t response_parse_long(struct opal_resp_tok *tok, in response_parse_long() argument
984 tok->pos = pos; in response_parse_long()
985 tok->len = ((pos[1] << 16) | (pos[2] << 8) | pos[3]) + 4; in response_parse_long()
986 tok->width = OPAL_WIDTH_LONG; in response_parse_long()
989 tok->type = OPAL_DTA_TOKENID_BYTESTRING; in response_parse_long()
991 tok->type = OPAL_DTA_TOKENID_SINT; in response_parse_long()
993 tok->type = OPAL_DTA_TOKENID_UINT; in response_parse_long()
995 return tok->len; in response_parse_long()
998 static ssize_t response_parse_token(struct opal_resp_tok *tok, in response_parse_token() argument
1001 tok->pos = pos; in response_parse_token()
1002 tok->len = 1; in response_parse_token()
1003 tok->type = OPAL_DTA_TOKENID_TOKEN; in response_parse_token()
1004 tok->width = OPAL_WIDTH_TOKEN; in response_parse_token()
1006 return tok->len; in response_parse_token()
1084 const struct opal_resp_tok *tok; in response_get_string() local
1087 tok = response_get_token(resp, n); in response_get_string()
1088 if (IS_ERR(tok)) in response_get_string()
1091 if (tok->type != OPAL_DTA_TOKENID_BYTESTRING) { in response_get_string()
1096 switch (tok->width) { in response_get_string()
1112 *store = tok->pos + skip; in response_get_string()
1114 return tok->len - skip; in response_get_string()
1119 const struct opal_resp_tok *tok; in response_get_u64() local
1121 tok = response_get_token(resp, n); in response_get_u64()
1122 if (IS_ERR(tok)) in response_get_u64()
1125 if (tok->type != OPAL_DTA_TOKENID_UINT) { in response_get_u64()
1126 pr_debug("Token is not unsigned int: %d\n", tok->type); in response_get_u64()
1130 if (tok->width != OPAL_WIDTH_TINY && tok->width != OPAL_WIDTH_SHORT) { in response_get_u64()
1131 pr_debug("Atom is not short or tiny: %d\n", tok->width); in response_get_u64()
1135 return tok->stored.u; in response_get_u64()
1149 const struct opal_resp_tok *tok; in response_status() local
1151 tok = response_get_token(resp, 0); in response_status()
1152 if (response_token_matches(tok, OPAL_ENDOFSESSION)) in response_status()
1158 tok = response_get_token(resp, resp->num - 5); in response_status()
1159 if (!response_token_matches(tok, OPAL_STARTLIST)) in response_status()
1162 tok = response_get_token(resp, resp->num - 1); in response_status()
1163 if (!response_token_matches(tok, OPAL_ENDLIST)) in response_status()
1574 const struct opal_resp_tok *tok; in response_get_column() local
1578 tok = response_get_token(resp, n); in response_get_column()
1579 if (IS_ERR(tok)) in response_get_column()
1580 return PTR_ERR(tok); in response_get_column()
1582 if (!response_token_matches(tok, OPAL_STARTNAME)) { in response_get_column()
1598 tok = response_get_token(resp, n); in response_get_column()
1599 if (IS_ERR(tok)) in response_get_column()
1600 return PTR_ERR(tok); in response_get_column()
1602 if (!response_token_matches(tok, OPAL_ENDNAME)) { in response_get_column()