#include "nv_push_clcec0.h"

#include <stdio.h>

#include "util/u_math.h"





const char *P_PARSE_NVCDC0_MTHD(uint16_t idx) ATTRIBUTE_COLD;
void P_DUMP_NVCDC0_MTHD_DATA(FILE *fp, uint16_t idx, uint32_t data,
                                   const char *prefix) ATTRIBUTE_COLD;

const char*
P_PARSE_NVCEC0_MTHD(uint16_t idx)
{
    switch (idx) {

  
    default:

    return P_PARSE_NVCDC0_MTHD(idx);

                                                                                                                                                                                        case NVCEC0_UPDATE_ALL_COMPUTE_CONTROL:
        return "NVCEC0_UPDATE_ALL_COMPUTE_CONTROL";
                                                                                                                                                                                                                                                                                                                            case NVCEC0_SET_WFI_FILTER_STATE:
        return "NVCEC0_SET_WFI_FILTER_STATE";
                                case NVCEC0_INVALIDATE_SAMPLER_CACHE_BY_TAG:
        return "NVCEC0_INVALIDATE_SAMPLER_CACHE_BY_TAG";
    case NVCEC0_INVALIDATE_TEXTURE_HEADER_CACHE_BY_TAG:
        return "NVCEC0_INVALIDATE_TEXTURE_HEADER_CACHE_BY_TAG";
    case NVCEC0_INVALIDATE_TEXTURE_DATA_CACHE_BY_TAG:
        return "NVCEC0_INVALIDATE_TEXTURE_DATA_CACHE_BY_TAG";
    case NVCEC0_SET_MME_TASK_EVENT_STATE:
        return "NVCEC0_SET_MME_TASK_EVENT_STATE";
                                                case NVCEC0_INVALIDATE_SAMPLER_CACHE_BY_TAG_NO_WFI:
        return "NVCEC0_INVALIDATE_SAMPLER_CACHE_BY_TAG_NO_WFI";
    case NVCEC0_INVALIDATE_TEXTURE_HEADER_CACHE_BY_TAG_NO_WFI:
        return "NVCEC0_INVALIDATE_TEXTURE_HEADER_CACHE_BY_TAG_NO_WFI";
    case NVCEC0_INVALIDATE_TEXTURE_DATA_CACHE_BY_TAG_NO_WFI:
        return "NVCEC0_INVALIDATE_TEXTURE_DATA_CACHE_BY_TAG_NO_WFI";
                                                                                                                        
    }
}

void
P_DUMP_NVCEC0_MTHD_DATA(FILE *fp, uint16_t idx, uint32_t data,
                         const char *prefix)
{
    UNUSED uint32_t parsed;
    switch (idx) {

  
    default:

    P_DUMP_NVCDC0_MTHD_DATA(fp, idx, data, prefix);
    break;

                                                                                                                                                                                      
    case NVCEC0_UPDATE_ALL_COMPUTE_CONTROL:

    
        parsed = (data >> 0) & ((1u << 1) - 1);
        fprintf(fp, "%s.VALID = ", prefix);
        switch (parsed) {
        case NVCEC0_UPDATE_ALL_COMPUTE_CONTROL_VALID_FALSE:
            fprintf(fp, "FALSE\n");
            break;
        case NVCEC0_UPDATE_ALL_COMPUTE_CONTROL_VALID_TRUE:
            fprintf(fp, "TRUE\n");
            break;
        default:
            fprintf(fp, "0x%x\n", parsed);
            break;
        }
    
        parsed = (data >> 4) & ((1u << 1) - 1);
        fprintf(fp, "%s.STICK_IN_COMPUTE_IN_GRAPHICS_MODE = ", prefix);
        switch (parsed) {
        case NVCEC0_UPDATE_ALL_COMPUTE_CONTROL_STICK_IN_COMPUTE_IN_GRAPHICS_MODE_FALSE:
            fprintf(fp, "FALSE\n");
            break;
        case NVCEC0_UPDATE_ALL_COMPUTE_CONTROL_STICK_IN_COMPUTE_IN_GRAPHICS_MODE_TRUE:
            fprintf(fp, "TRUE\n");
            break;
        default:
            fprintf(fp, "0x%x\n", parsed);
            break;
        }
        break;
                                                                                                                                                                                                                                                                                                                          
    case NVCEC0_SET_WFI_FILTER_STATE:

    
        parsed = (data >> 0) & ((1u << 1) - 1);
        fprintf(fp, "%s.FILTER_HOST_WFI = ", prefix);
        switch (parsed) {
        case NVCEC0_SET_WFI_FILTER_STATE_FILTER_HOST_WFI_FALSE:
            fprintf(fp, "FALSE\n");
            break;
        case NVCEC0_SET_WFI_FILTER_STATE_FILTER_HOST_WFI_TRUE:
            fprintf(fp, "TRUE\n");
            break;
        default:
            fprintf(fp, "0x%x\n", parsed);
            break;
        }
        break;
                              
    case NVCEC0_INVALIDATE_SAMPLER_CACHE_BY_TAG:

    
        parsed = data;
        fprintf(fp, "%s.TAG = ", prefix);
        fprintf(fp, "(0x%x)\n", parsed);
        break;
  
    case NVCEC0_INVALIDATE_TEXTURE_HEADER_CACHE_BY_TAG:

    
        parsed = data;
        fprintf(fp, "%s.TAG = ", prefix);
        fprintf(fp, "(0x%x)\n", parsed);
        break;
  
    case NVCEC0_INVALIDATE_TEXTURE_DATA_CACHE_BY_TAG:

    
        parsed = data;
        fprintf(fp, "%s.TAG = ", prefix);
        fprintf(fp, "(0x%x)\n", parsed);
        break;
  
    case NVCEC0_SET_MME_TASK_EVENT_STATE:

    
        parsed = (data >> 0) & ((1u << 8) - 1);
        fprintf(fp, "%s.FLUSH_MACRO = ", prefix);
        fprintf(fp, "(0x%x)\n", parsed);
    
        parsed = (data >> 8) & ((1u << 1) - 1);
        fprintf(fp, "%s.TSG_EVENT_ENABLE = ", prefix);
        switch (parsed) {
        case NVCEC0_SET_MME_TASK_EVENT_STATE_TSG_EVENT_ENABLE_FALSE:
            fprintf(fp, "FALSE\n");
            break;
        case NVCEC0_SET_MME_TASK_EVENT_STATE_TSG_EVENT_ENABLE_TRUE:
            fprintf(fp, "TRUE\n");
            break;
        default:
            fprintf(fp, "0x%x\n", parsed);
            break;
        }
    
        parsed = (data >> 9) & ((1u << 1) - 1);
        fprintf(fp, "%s.HOST_WFI_ENABLE = ", prefix);
        switch (parsed) {
        case NVCEC0_SET_MME_TASK_EVENT_STATE_HOST_WFI_ENABLE_FALSE:
            fprintf(fp, "FALSE\n");
            break;
        case NVCEC0_SET_MME_TASK_EVENT_STATE_HOST_WFI_ENABLE_TRUE:
            fprintf(fp, "TRUE\n");
            break;
        default:
            fprintf(fp, "0x%x\n", parsed);
            break;
        }
    
        parsed = (data >> 10) & ((1u << 1) - 1);
        fprintf(fp, "%s.FE_COMPUTE_METHOD_WFI_ENABLE = ", prefix);
        switch (parsed) {
        case NVCEC0_SET_MME_TASK_EVENT_STATE_FE_COMPUTE_METHOD_WFI_ENABLE_FALSE:
            fprintf(fp, "FALSE\n");
            break;
        case NVCEC0_SET_MME_TASK_EVENT_STATE_FE_COMPUTE_METHOD_WFI_ENABLE_TRUE:
            fprintf(fp, "TRUE\n");
            break;
        default:
            fprintf(fp, "0x%x\n", parsed);
            break;
        }
    
        parsed = (data >> 11) & ((1u << 1) - 1);
        fprintf(fp, "%s.FE_SUBCH_SWITCH_WFI_ENABLE = ", prefix);
        switch (parsed) {
        case NVCEC0_SET_MME_TASK_EVENT_STATE_FE_SUBCH_SWITCH_WFI_ENABLE_FALSE:
            fprintf(fp, "FALSE\n");
            break;
        case NVCEC0_SET_MME_TASK_EVENT_STATE_FE_SUBCH_SWITCH_WFI_ENABLE_TRUE:
            fprintf(fp, "TRUE\n");
            break;
        default:
            fprintf(fp, "0x%x\n", parsed);
            break;
        }
        break;
                                              
    case NVCEC0_INVALIDATE_SAMPLER_CACHE_BY_TAG_NO_WFI:

    
        parsed = data;
        fprintf(fp, "%s.TAG = ", prefix);
        fprintf(fp, "(0x%x)\n", parsed);
        break;
  
    case NVCEC0_INVALIDATE_TEXTURE_HEADER_CACHE_BY_TAG_NO_WFI:

    
        parsed = data;
        fprintf(fp, "%s.TAG = ", prefix);
        fprintf(fp, "(0x%x)\n", parsed);
        break;
  
    case NVCEC0_INVALIDATE_TEXTURE_DATA_CACHE_BY_TAG_NO_WFI:

    
        parsed = data;
        fprintf(fp, "%s.TAG = ", prefix);
        fprintf(fp, "(0x%x)\n", parsed);
        break;
                                                                                                                            }
}
