/*
 * Copyright (c) 2021 Advanced Micro Devices, Inc.
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *
 * 1. Redistributions of source code must retain the above copyright notice,
 * this list of conditions and the following disclaimer.
 *
 * 2. Redistributions in binary form must reproduce the above copyright notice,
 * this list of conditions and the following disclaimer in the documentation
 * and/or other materials provided with the distribution.
 *
 * 3. Neither the name of the copyright holder nor the names of its
 * contributors may be used to endorse or promote products derived from this
 * software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 * POSSIBILITY OF SUCH DAMAGE.
 *
 */

#ifndef __DEV_AMDGPU_SDMA_PACKETS_HH__
#define __DEV_AMDGPU_SDMA_PACKETS_HH__

namespace gem5
{

/**
 * SDMA packets
 */
typedef struct GEM5_PACKED
{
    uint32_t count : 30;
    uint32_t res0 : 2;
    uint32_t res1 : 16;
    uint32_t sdw: 2;
    uint32_t res2 : 6;
    uint32_t ddw: 2;
    uint32_t res3 : 6;
    uint64_t source;
    uint64_t dest;
}  sdmaCopy;
static_assert(sizeof(sdmaCopy) == 24);

typedef struct GEM5_PACKED
{
    uint64_t dest;
    uint32_t count : 20;
    uint32_t reserved0 : 4;
    uint32_t sw : 2;
    uint32_t reserved1 : 6;
}  sdmaWrite;
static_assert(sizeof(sdmaWrite) == 12);

typedef struct GEM5_PACKED
{
    union
    {
        struct
        {
            uint32_t addrLo;
            uint32_t addrHi;
        };
        Addr addr;
    };
    uint32_t srcData;
    uint32_t unused : 10;
    uint32_t count : 22;
}  sdmaConstFill;
static_assert(sizeof(sdmaConstFill) == 16);

typedef struct GEM5_PACKED
{
    uint32_t key0;
    uint32_t key1;
    uint32_t key2;
    uint32_t key3;
    uint32_t count0;
    uint32_t count1;
    uint32_t count2;
    uint32_t count3;
}  sdmaAESKey;
static_assert(sizeof(sdmaAESKey) == 32);

typedef struct GEM5_PACKED
{
    uint32_t countData0;
    uint32_t countData1;
    uint32_t countData2;
    uint32_t countData3;
}  sdmaAESCounter;
static_assert(sizeof(sdmaAESCounter) == 16);

typedef struct GEM5_PACKED
{
    uint32_t countKey0;
    uint32_t countKey1;
    uint32_t countKey2;
    uint32_t countKey3;
}  sdmaAESLoad;
static_assert(sizeof(sdmaAESLoad) == 16);

typedef struct GEM5_PACKED
{
    uint32_t reserved : 6;
    uint32_t offset : 26;
}  sdmaAESOffset;
static_assert(sizeof(sdmaAESOffset) == 4);

typedef struct GEM5_PACKED
{
    uint64_t base;
    uint32_t size : 20;
    uint32_t reserved : 12;
    uint64_t csaAddr;
}  sdmaIndirectBuffer;
static_assert(sizeof(sdmaIndirectBuffer) == 20);

typedef struct GEM5_PACKED
{
    uint32_t priv : 1;
    uint32_t reserved1 : 11;
    uint32_t vmid : 4;
    uint32_t reserved2 : 16;
}  sdmaIndirectBufferHeader;
static_assert(sizeof(sdmaIndirectBufferHeader) == 4);

typedef struct GEM5_PACKED
{
    uint64_t dest;
    uint32_t data;
}  sdmaFence;
static_assert(sizeof(sdmaFence) == 12);

typedef struct GEM5_PACKED
{
    union
    {
        struct
        {
            uint32_t contextId : 3;
            uint32_t rbRptr: 13;
            uint32_t ibOffset : 12;
            uint32_t reserved : 4;
        };
        uint32_t intrContext;
    };
}  sdmaTrap;
static_assert(sizeof(sdmaTrap) == 4);

typedef struct GEM5_PACKED
{
    union
    {
        struct
        {
            uint32_t reserved : 3;
            uint32_t addrLo : 29;
            uint32_t addrHi;
        };
        Addr addr;
    };
}  sdmaSemaphore;
static_assert(sizeof(sdmaSemaphore) == 8);

typedef struct GEM5_PACKED
{
    union
    {
        struct
        {
            uint32_t reserved : 3;
            uint32_t addrLo : 29;
            uint32_t addrHi;
        };
        Addr addr;
    };
}  sdmaMemInc;
static_assert(sizeof(sdmaMemInc) == 8);

typedef struct GEM5_PACKED
{
    uint32_t regAddr : 18;
    uint32_t reserved : 2;
    uint32_t apertureId : 12;
    uint32_t data;
}  sdmaSRBMWrite;
static_assert(sizeof(sdmaSRBMWrite) == 8);

typedef struct GEM5_PACKED
{
    uint32_t reserved : 28;
    uint32_t byteEnable : 4;
}  sdmaSRBMWriteHeader;
static_assert(sizeof(sdmaSRBMWriteHeader) == 4);

typedef struct GEM5_PACKED
{
    uint64_t address;
    uint32_t ref;
    uint32_t mask;
    uint32_t pollInt : 16;
    uint32_t retryCount : 12;
    uint32_t reserved1 : 4;
}  sdmaPollRegMem;
static_assert(sizeof(sdmaPollRegMem) == 20);

typedef struct GEM5_PACKED
{
    uint32_t reserved : 26;
    uint32_t op : 2;            // Operation
    uint32_t func : 3;          // Comparison function
    uint32_t mode : 1;          // Mode: register or memory polling
}  sdmaPollRegMemHeader;
static_assert(sizeof(sdmaPollRegMemHeader) == 4);

typedef struct GEM5_PACKED
{
    union
    {
        struct
        {
            uint32_t addrLo;
            uint32_t addrHi;
        };
        Addr addr;
    };
    uint32_t reference;
    union
    {
        struct
        {
            uint32_t execCount : 14;
            uint32_t unused : 18;
        };
        uint32_t ordinal;
    };
}  sdmaCondExec;
static_assert(sizeof(sdmaCondExec) == 16);

typedef struct GEM5_PACKED
{
    union
    {
        struct
        {
            uint32_t addrLo;
            uint32_t addrHi;
        };
        Addr addr;
    };
    union
    {
        struct
        {
            uint32_t srcDataLo;
            uint32_t srdDataHi;
        };
        uint64_t srcData;
    };
    union
    {
        struct
        {
            uint32_t cmpDataLo;
            uint32_t cmpDataHi;
        };
        uint64_t cmpData;
    };
    uint32_t loopInt : 13;
    uint32_t reserved : 19;
}  sdmaAtomic;
static_assert(sizeof(sdmaAtomic) == 28);

typedef struct GEM5_PACKED
{
    uint64_t dest;
    uint64_t mask;
    uint64_t initValue;
    uint64_t increment;
    uint32_t count: 19;
    uint32_t reserved : 13;
}  sdmaPtePde;
static_assert(sizeof(sdmaPtePde) == 36);

typedef struct GEM5_PACKED
{
    union
    {
        struct
        {
            uint32_t initDataLo;
            uint32_t initDataHi;
        };
        uint64_t initData;
    };
}  sdmaTimestamp;
static_assert(sizeof(sdmaTimestamp) == 8);

typedef struct GEM5_PACKED
{
    uint32_t execCount : 14;
    uint32_t reserved : 18;
}  sdmaPredExec;
static_assert(sizeof(sdmaPredExec) == 4);

typedef struct GEM5_PACKED
{
    uint32_t opcode : 8;
    uint32_t subOpcode : 8;
    uint32_t device : 8;
    uint32_t unused : 8;
}  sdmaPredExecHeader;
static_assert(sizeof(sdmaPredExecHeader) == 4);

typedef struct GEM5_PACKED
{
    uint32_t contextId : 3;
    uint32_t rbRptr: 13;
    uint32_t ibOffset : 12;
    uint32_t reserved : 4;
}  sdmaDummyTrap;
static_assert(sizeof(sdmaDummyTrap) == 4);

typedef struct GEM5_PACKED
{
    uint32_t byteStride;
    uint32_t dmaCount;
    union
    {
        struct
        {
            uint32_t destLo;
            uint32_t destHi;
        };
        uint64_t dest;
    };
    uint32_t byteCount : 26;
}  sdmaDataFillMulti;
static_assert(sizeof(sdmaDataFillMulti) == 20);

typedef struct GEM5_PACKED
{
    uint16_t format : 8;
    uint16_t barrier : 1;
    uint16_t acqFenceScope : 2;
    uint16_t relFenceScope : 2;
    uint16_t reserved : 3;
}  sdmaHeaderAgentDisp;
static_assert(sizeof(sdmaHeaderAgentDisp) == 2);

typedef struct GEM5_PACKED
{
    sdmaHeaderAgentDisp header;
    uint16_t res0;
    uint32_t res1;
    union
    {
        struct
        {
            uint32_t retLo;
            uint32_t retHi;
        };
        Addr ret;
    };
    uint32_t count : 22;
    uint32_t res2 : 10;
    uint32_t res3 : 16;
    uint32_t swDest : 2;
    uint32_t res4 : 6;
    uint32_t swSrc : 2;
    uint32_t unused : 6;
    union
    {
        struct
        {
            uint32_t srcLo;
            uint32_t srcHi;
        };
        Addr src;
    };
    union
    {
        struct
        {
            uint32_t destLo;
            uint32_t destHi;
        };
        Addr dest;
    };
    uint64_t res5;
    uint64_t res6;
    union
    {
        struct
        {
            uint32_t compSignalLo;
            uint32_t compSignalHi;
        };
        Addr compSignal;
    };
}  sdmaAQLCopy;
static_assert(sizeof(sdmaAQLCopy) == 64);

typedef struct GEM5_PACKED
{
    sdmaHeaderAgentDisp header;
    uint16_t res0;
    uint32_t res1;
    Addr depSignal0;
    Addr depSignal1;
    Addr depSignal2;
    Addr depSignal3;
    Addr depSignal4;
    uint64_t res2;
    union
    {
        struct
        {
            uint32_t compSignalLo;
            uint32_t compSignalHi;
        };
        Addr compSignal;
    };
}  sdmaAQLBarrierOr;
static_assert(sizeof(sdmaAQLBarrierOr) == 64);

} // namespace gem5

#endif // __DEV_AMDGPU_SDMA_PACKETS_HH__
