Lines Matching refs:tok
711 static void add_token_u8(int *err, struct opal_dev *cmd, u8 tok) in add_token_u8() argument
716 cmd->cmd[cmd->pos++] = tok; in add_token_u8()
894 const struct opal_resp_tok *tok; in response_get_token() local
907 tok = &resp->toks[n]; in response_get_token()
908 if (tok->len == 0) { in response_get_token()
913 return tok; in response_get_token()
916 static ssize_t response_parse_tiny(struct opal_resp_tok *tok, in response_parse_tiny() argument
919 tok->pos = pos; in response_parse_tiny()
920 tok->len = 1; in response_parse_tiny()
921 tok->width = OPAL_WIDTH_TINY; in response_parse_tiny()
924 tok->type = OPAL_DTA_TOKENID_SINT; in response_parse_tiny()
926 tok->type = OPAL_DTA_TOKENID_UINT; in response_parse_tiny()
927 tok->stored.u = pos[0] & 0x3f; in response_parse_tiny()
930 return tok->len; in response_parse_tiny()
933 static ssize_t response_parse_short(struct opal_resp_tok *tok, in response_parse_short() argument
936 tok->pos = pos; in response_parse_short()
937 tok->len = (pos[0] & SHORT_ATOM_LEN_MASK) + 1; in response_parse_short()
938 tok->width = OPAL_WIDTH_SHORT; in response_parse_short()
941 tok->type = OPAL_DTA_TOKENID_BYTESTRING; in response_parse_short()
943 tok->type = OPAL_DTA_TOKENID_SINT; in response_parse_short()
948 tok->type = OPAL_DTA_TOKENID_UINT; in response_parse_short()
949 if (tok->len > 9) { in response_parse_short()
953 for (i = tok->len - 1; i > 0; i--) { in response_parse_short()
957 tok->stored.u = u_integer; in response_parse_short()
960 return tok->len; in response_parse_short()
963 static ssize_t response_parse_medium(struct opal_resp_tok *tok, in response_parse_medium() argument
966 tok->pos = pos; in response_parse_medium()
967 tok->len = (((pos[0] & MEDIUM_ATOM_LEN_MASK) << 8) | pos[1]) + 2; in response_parse_medium()
968 tok->width = OPAL_WIDTH_MEDIUM; in response_parse_medium()
971 tok->type = OPAL_DTA_TOKENID_BYTESTRING; in response_parse_medium()
973 tok->type = OPAL_DTA_TOKENID_SINT; in response_parse_medium()
975 tok->type = OPAL_DTA_TOKENID_UINT; in response_parse_medium()
977 return tok->len; in response_parse_medium()
980 static ssize_t response_parse_long(struct opal_resp_tok *tok, in response_parse_long() argument
983 tok->pos = pos; in response_parse_long()
984 tok->len = ((pos[1] << 16) | (pos[2] << 8) | pos[3]) + 4; in response_parse_long()
985 tok->width = OPAL_WIDTH_LONG; in response_parse_long()
988 tok->type = OPAL_DTA_TOKENID_BYTESTRING; in response_parse_long()
990 tok->type = OPAL_DTA_TOKENID_SINT; in response_parse_long()
992 tok->type = OPAL_DTA_TOKENID_UINT; in response_parse_long()
994 return tok->len; in response_parse_long()
997 static ssize_t response_parse_token(struct opal_resp_tok *tok, in response_parse_token() argument
1000 tok->pos = pos; in response_parse_token()
1001 tok->len = 1; in response_parse_token()
1002 tok->type = OPAL_DTA_TOKENID_TOKEN; in response_parse_token()
1003 tok->width = OPAL_WIDTH_TOKEN; in response_parse_token()
1005 return tok->len; in response_parse_token()
1079 const struct opal_resp_tok *tok; in response_get_string() local
1082 tok = response_get_token(resp, n); in response_get_string()
1083 if (IS_ERR(tok)) in response_get_string()
1086 if (tok->type != OPAL_DTA_TOKENID_BYTESTRING) { in response_get_string()
1091 switch (tok->width) { in response_get_string()
1107 *store = tok->pos + skip; in response_get_string()
1109 return tok->len - skip; in response_get_string()
1114 const struct opal_resp_tok *tok; in response_get_u64() local
1116 tok = response_get_token(resp, n); in response_get_u64()
1117 if (IS_ERR(tok)) in response_get_u64()
1120 if (tok->type != OPAL_DTA_TOKENID_UINT) { in response_get_u64()
1121 pr_debug("Token is not unsigned int: %d\n", tok->type); in response_get_u64()
1125 if (tok->width != OPAL_WIDTH_TINY && tok->width != OPAL_WIDTH_SHORT) { in response_get_u64()
1126 pr_debug("Atom is not short or tiny: %d\n", tok->width); in response_get_u64()
1130 return tok->stored.u; in response_get_u64()
1144 const struct opal_resp_tok *tok; in response_status() local
1146 tok = response_get_token(resp, 0); in response_status()
1147 if (response_token_matches(tok, OPAL_ENDOFSESSION)) in response_status()
1153 tok = response_get_token(resp, resp->num - 5); in response_status()
1154 if (!response_token_matches(tok, OPAL_STARTLIST)) in response_status()
1157 tok = response_get_token(resp, resp->num - 1); in response_status()
1158 if (!response_token_matches(tok, OPAL_ENDLIST)) in response_status()
1569 const struct opal_resp_tok *tok; in response_get_column() local
1573 tok = response_get_token(resp, n); in response_get_column()
1574 if (IS_ERR(tok)) in response_get_column()
1575 return PTR_ERR(tok); in response_get_column()
1577 if (!response_token_matches(tok, OPAL_STARTNAME)) { in response_get_column()
1593 tok = response_get_token(resp, n); in response_get_column()
1594 if (IS_ERR(tok)) in response_get_column()
1595 return PTR_ERR(tok); in response_get_column()
1597 if (!response_token_matches(tok, OPAL_ENDNAME)) { in response_get_column()