Lines Matching refs:tok

551 static void add_token_u8(int *err, struct opal_dev *cmd, u8 tok)
556 cmd->cmd[cmd->pos++] = tok;
734 const struct opal_resp_tok *tok;
747 tok = &resp->toks[n];
748 if (tok->len == 0) {
753 return tok;
756 static ssize_t response_parse_tiny(struct opal_resp_tok *tok,
759 tok->pos = pos;
760 tok->len = 1;
761 tok->width = OPAL_WIDTH_TINY;
764 tok->type = OPAL_DTA_TOKENID_SINT;
766 tok->type = OPAL_DTA_TOKENID_UINT;
767 tok->stored.u = pos[0] & 0x3f;
770 return tok->len;
773 static ssize_t response_parse_short(struct opal_resp_tok *tok,
776 tok->pos = pos;
777 tok->len = (pos[0] & SHORT_ATOM_LEN_MASK) + 1;
778 tok->width = OPAL_WIDTH_SHORT;
781 tok->type = OPAL_DTA_TOKENID_BYTESTRING;
783 tok->type = OPAL_DTA_TOKENID_SINT;
788 tok->type = OPAL_DTA_TOKENID_UINT;
789 if (tok->len > 9) {
793 for (i = tok->len - 1; i > 0; i--) {
797 tok->stored.u = u_integer;
800 return tok->len;
803 static ssize_t response_parse_medium(struct opal_resp_tok *tok,
806 tok->pos = pos;
807 tok->len = (((pos[0] & MEDIUM_ATOM_LEN_MASK) << 8) | pos[1]) + 2;
808 tok->width = OPAL_WIDTH_MEDIUM;
811 tok->type = OPAL_DTA_TOKENID_BYTESTRING;
813 tok->type = OPAL_DTA_TOKENID_SINT;
815 tok->type = OPAL_DTA_TOKENID_UINT;
817 return tok->len;
820 static ssize_t response_parse_long(struct opal_resp_tok *tok,
823 tok->pos = pos;
824 tok->len = ((pos[1] << 16) | (pos[2] << 8) | pos[3]) + 4;
825 tok->width = OPAL_WIDTH_LONG;
828 tok->type = OPAL_DTA_TOKENID_BYTESTRING;
830 tok->type = OPAL_DTA_TOKENID_SINT;
832 tok->type = OPAL_DTA_TOKENID_UINT;
834 return tok->len;
837 static ssize_t response_parse_token(struct opal_resp_tok *tok,
840 tok->pos = pos;
841 tok->len = 1;
842 tok->type = OPAL_DTA_TOKENID_TOKEN;
843 tok->width = OPAL_WIDTH_TOKEN;
845 return tok->len;
919 const struct opal_resp_tok *tok;
922 tok = response_get_token(resp, n);
923 if (IS_ERR(tok))
926 if (tok->type != OPAL_DTA_TOKENID_BYTESTRING) {
931 switch (tok->width) {
947 *store = tok->pos + skip;
949 return tok->len - skip;
954 const struct opal_resp_tok *tok;
956 tok = response_get_token(resp, n);
957 if (IS_ERR(tok))
960 if (tok->type != OPAL_DTA_TOKENID_UINT) {
961 pr_debug("Token is not unsigned int: %d\n", tok->type);
965 if (tok->width != OPAL_WIDTH_TINY && tok->width != OPAL_WIDTH_SHORT) {
966 pr_debug("Atom is not short or tiny: %d\n", tok->width);
970 return tok->stored.u;
984 const struct opal_resp_tok *tok;
986 tok = response_get_token(resp, 0);
987 if (response_token_matches(tok, OPAL_ENDOFSESSION))
993 tok = response_get_token(resp, resp->num - 5);
994 if (!response_token_matches(tok, OPAL_STARTLIST))
997 tok = response_get_token(resp, resp->num - 1);
998 if (!response_token_matches(tok, OPAL_ENDLIST))
1110 * data will be available in dev->resp->tok[4]
1142 * the result is provided in dev->resp->tok[4]