Lines Matching refs:tok

591 static void add_token_u8(int *err, struct opal_dev *cmd, u8 tok)  in add_token_u8()  argument
596 cmd->cmd[cmd->pos++] = tok; in add_token_u8()
774 const struct opal_resp_tok *tok; in response_get_token() local
787 tok = &resp->toks[n]; in response_get_token()
788 if (tok->len == 0) { in response_get_token()
793 return tok; in response_get_token()
796 static ssize_t response_parse_tiny(struct opal_resp_tok *tok, in response_parse_tiny() argument
799 tok->pos = pos; in response_parse_tiny()
800 tok->len = 1; in response_parse_tiny()
801 tok->width = OPAL_WIDTH_TINY; in response_parse_tiny()
804 tok->type = OPAL_DTA_TOKENID_SINT; in response_parse_tiny()
806 tok->type = OPAL_DTA_TOKENID_UINT; in response_parse_tiny()
807 tok->stored.u = pos[0] & 0x3f; in response_parse_tiny()
810 return tok->len; in response_parse_tiny()
813 static ssize_t response_parse_short(struct opal_resp_tok *tok, in response_parse_short() argument
816 tok->pos = pos; in response_parse_short()
817 tok->len = (pos[0] & SHORT_ATOM_LEN_MASK) + 1; in response_parse_short()
818 tok->width = OPAL_WIDTH_SHORT; in response_parse_short()
821 tok->type = OPAL_DTA_TOKENID_BYTESTRING; in response_parse_short()
823 tok->type = OPAL_DTA_TOKENID_SINT; in response_parse_short()
828 tok->type = OPAL_DTA_TOKENID_UINT; in response_parse_short()
829 if (tok->len > 9) { in response_parse_short()
833 for (i = tok->len - 1; i > 0; i--) { in response_parse_short()
837 tok->stored.u = u_integer; in response_parse_short()
840 return tok->len; in response_parse_short()
843 static ssize_t response_parse_medium(struct opal_resp_tok *tok, in response_parse_medium() argument
846 tok->pos = pos; in response_parse_medium()
847 tok->len = (((pos[0] & MEDIUM_ATOM_LEN_MASK) << 8) | pos[1]) + 2; in response_parse_medium()
848 tok->width = OPAL_WIDTH_MEDIUM; in response_parse_medium()
851 tok->type = OPAL_DTA_TOKENID_BYTESTRING; in response_parse_medium()
853 tok->type = OPAL_DTA_TOKENID_SINT; in response_parse_medium()
855 tok->type = OPAL_DTA_TOKENID_UINT; in response_parse_medium()
857 return tok->len; in response_parse_medium()
860 static ssize_t response_parse_long(struct opal_resp_tok *tok, in response_parse_long() argument
863 tok->pos = pos; in response_parse_long()
864 tok->len = ((pos[1] << 16) | (pos[2] << 8) | pos[3]) + 4; in response_parse_long()
865 tok->width = OPAL_WIDTH_LONG; in response_parse_long()
868 tok->type = OPAL_DTA_TOKENID_BYTESTRING; in response_parse_long()
870 tok->type = OPAL_DTA_TOKENID_SINT; in response_parse_long()
872 tok->type = OPAL_DTA_TOKENID_UINT; in response_parse_long()
874 return tok->len; in response_parse_long()
877 static ssize_t response_parse_token(struct opal_resp_tok *tok, in response_parse_token() argument
880 tok->pos = pos; in response_parse_token()
881 tok->len = 1; in response_parse_token()
882 tok->type = OPAL_DTA_TOKENID_TOKEN; in response_parse_token()
883 tok->width = OPAL_WIDTH_TOKEN; in response_parse_token()
885 return tok->len; in response_parse_token()
959 const struct opal_resp_tok *tok; in response_get_string() local
962 tok = response_get_token(resp, n); in response_get_string()
963 if (IS_ERR(tok)) in response_get_string()
966 if (tok->type != OPAL_DTA_TOKENID_BYTESTRING) { in response_get_string()
971 switch (tok->width) { in response_get_string()
987 *store = tok->pos + skip; in response_get_string()
989 return tok->len - skip; in response_get_string()
994 const struct opal_resp_tok *tok; in response_get_u64() local
996 tok = response_get_token(resp, n); in response_get_u64()
997 if (IS_ERR(tok)) in response_get_u64()
1000 if (tok->type != OPAL_DTA_TOKENID_UINT) { in response_get_u64()
1001 pr_debug("Token is not unsigned int: %d\n", tok->type); in response_get_u64()
1005 if (tok->width != OPAL_WIDTH_TINY && tok->width != OPAL_WIDTH_SHORT) { in response_get_u64()
1006 pr_debug("Atom is not short or tiny: %d\n", tok->width); in response_get_u64()
1010 return tok->stored.u; in response_get_u64()
1024 const struct opal_resp_tok *tok; in response_status() local
1026 tok = response_get_token(resp, 0); in response_status()
1027 if (response_token_matches(tok, OPAL_ENDOFSESSION)) in response_status()
1033 tok = response_get_token(resp, resp->num - 5); in response_status()
1034 if (!response_token_matches(tok, OPAL_STARTLIST)) in response_status()
1037 tok = response_get_token(resp, resp->num - 1); in response_status()
1038 if (!response_token_matches(tok, OPAL_ENDLIST)) in response_status()