Lines Matching refs:tok

711 static void add_token_u8(int *err, struct opal_dev *cmd, u8 tok)
716 cmd->cmd[cmd->pos++] = tok;
894 const struct opal_resp_tok *tok;
907 tok = &resp->toks[n];
908 if (tok->len == 0) {
913 return tok;
916 static ssize_t response_parse_tiny(struct opal_resp_tok *tok,
919 tok->pos = pos;
920 tok->len = 1;
921 tok->width = OPAL_WIDTH_TINY;
924 tok->type = OPAL_DTA_TOKENID_SINT;
926 tok->type = OPAL_DTA_TOKENID_UINT;
927 tok->stored.u = pos[0] & 0x3f;
930 return tok->len;
933 static ssize_t response_parse_short(struct opal_resp_tok *tok,
936 tok->pos = pos;
937 tok->len = (pos[0] & SHORT_ATOM_LEN_MASK) + 1;
938 tok->width = OPAL_WIDTH_SHORT;
941 tok->type = OPAL_DTA_TOKENID_BYTESTRING;
943 tok->type = OPAL_DTA_TOKENID_SINT;
948 tok->type = OPAL_DTA_TOKENID_UINT;
949 if (tok->len > 9) {
953 for (i = tok->len - 1; i > 0; i--) {
957 tok->stored.u = u_integer;
960 return tok->len;
963 static ssize_t response_parse_medium(struct opal_resp_tok *tok,
966 tok->pos = pos;
967 tok->len = (((pos[0] & MEDIUM_ATOM_LEN_MASK) << 8) | pos[1]) + 2;
968 tok->width = OPAL_WIDTH_MEDIUM;
971 tok->type = OPAL_DTA_TOKENID_BYTESTRING;
973 tok->type = OPAL_DTA_TOKENID_SINT;
975 tok->type = OPAL_DTA_TOKENID_UINT;
977 return tok->len;
980 static ssize_t response_parse_long(struct opal_resp_tok *tok,
983 tok->pos = pos;
984 tok->len = ((pos[1] << 16) | (pos[2] << 8) | pos[3]) + 4;
985 tok->width = OPAL_WIDTH_LONG;
988 tok->type = OPAL_DTA_TOKENID_BYTESTRING;
990 tok->type = OPAL_DTA_TOKENID_SINT;
992 tok->type = OPAL_DTA_TOKENID_UINT;
994 return tok->len;
997 static ssize_t response_parse_token(struct opal_resp_tok *tok,
1000 tok->pos = pos;
1001 tok->len = 1;
1002 tok->type = OPAL_DTA_TOKENID_TOKEN;
1003 tok->width = OPAL_WIDTH_TOKEN;
1005 return tok->len;
1083 const struct opal_resp_tok *tok;
1086 tok = response_get_token(resp, n);
1087 if (IS_ERR(tok))
1090 if (tok->type != OPAL_DTA_TOKENID_BYTESTRING) {
1095 switch (tok->width) {
1111 *store = tok->pos + skip;
1113 return tok->len - skip;
1118 const struct opal_resp_tok *tok;
1120 tok = response_get_token(resp, n);
1121 if (IS_ERR(tok))
1124 if (tok->type != OPAL_DTA_TOKENID_UINT) {
1125 pr_debug("Token is not unsigned int: %d\n", tok->type);
1129 if (tok->width != OPAL_WIDTH_TINY && tok->width != OPAL_WIDTH_SHORT) {
1130 pr_debug("Atom is not short or tiny: %d\n", tok->width);
1134 return tok->stored.u;
1148 const struct opal_resp_tok *tok;
1150 tok = response_get_token(resp, 0);
1151 if (response_token_matches(tok, OPAL_ENDOFSESSION))
1157 tok = response_get_token(resp, resp->num - 5);
1158 if (!response_token_matches(tok, OPAL_STARTLIST))
1161 tok = response_get_token(resp, resp->num - 1);
1162 if (!response_token_matches(tok, OPAL_ENDLIST))
1301 * data will be available in dev->resp->tok[4]
1312 * the result is provided in dev->resp->tok[4]
1573 const struct opal_resp_tok *tok;
1577 tok = response_get_token(resp, n);
1578 if (IS_ERR(tok))
1579 return PTR_ERR(tok);
1581 if (!response_token_matches(tok, OPAL_STARTNAME)) {
1597 tok = response_get_token(resp, n);
1598 if (IS_ERR(tok))
1599 return PTR_ERR(tok);
1601 if (!response_token_matches(tok, OPAL_ENDNAME)) {