/******************************************************************************
 *
 * Copyright(c) 2016 - 2019 Realtek Corporation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify it
 * under the terms of version 2 of the GNU General Public License as
 * published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
 * more details.
 *
 ******************************************************************************/

#ifndef _HAL_H2CEXTRAINFO_H2C_C2H_NIC_H_
#define _HAL_H2CEXTRAINFO_H2C_C2H_NIC_H_

/* H2C extra info (rsvd page) usage, unit : page (128byte)*/
/* dlfw : not include txdesc size*/
/* update pkt : not include txdesc size*/
/* cfg param : not include txdesc size*/
/* scan info : not include txdesc size*/
/* dl flash : not include txdesc size*/
#define DLFW_RSVDPG_SIZE 2048
#define UPDATE_PKT_RSVDPG_SIZE 2048
#define CFG_PARAM_RSVDPG_SIZE 2048
#define SCAN_INFO_RSVDPG_SIZE 256
#define DL_FLASH_RSVDPG_SIZE 2048
/* su0 snding pkt : include txdesc size */
#define SU0_SNDING_PKT_OFFSET 0
#define SU0_SNDING_PKT_RSVDPG_SIZE 128

#define PARAM_INFO_GET_LEN(extra_info) LE_BITS_TO_4BYTE(extra_info + 0X00, 0, 8)
#define PARAM_INFO_SET_LEN(extra_info, value)                                  \
	SET_BITS_TO_LE_4BYTE(extra_info + 0X00, 0, 8, value)
#define PARAM_INFO_GET_IO_CMD(extra_info)                                      \
	LE_BITS_TO_4BYTE(extra_info + 0X00, 8, 7)
#define PARAM_INFO_SET_IO_CMD(extra_info, value)                               \
	SET_BITS_TO_LE_4BYTE(extra_info + 0X00, 8, 7, value)
#define PARAM_INFO_GET_MSK_EN(extra_info)                                      \
	LE_BITS_TO_4BYTE(extra_info + 0X00, 15, 1)
#define PARAM_INFO_SET_MSK_EN(extra_info, value)                               \
	SET_BITS_TO_LE_4BYTE(extra_info + 0X00, 15, 1, value)
#define PARAM_INFO_GET_LLT_PG_BNDY(extra_info)                                 \
	LE_BITS_TO_4BYTE(extra_info + 0X00, 16, 8)
#define PARAM_INFO_SET_LLT_PG_BNDY(extra_info, value)                          \
	SET_BITS_TO_LE_4BYTE(extra_info + 0X00, 16, 8, value)
#define PARAM_INFO_GET_EFUSE_RSVDPAGE_LOC(extra_info)                          \
	LE_BITS_TO_4BYTE(extra_info + 0X00, 16, 8)
#define PARAM_INFO_SET_EFUSE_RSVDPAGE_LOC(extra_info, value)                   \
	SET_BITS_TO_LE_4BYTE(extra_info + 0X00, 16, 8, value)
#define PARAM_INFO_GET_EFUSE_PATCH_EN(extra_info)                              \
	LE_BITS_TO_4BYTE(extra_info + 0X00, 16, 8)
#define PARAM_INFO_SET_EFUSE_PATCH_EN(extra_info, value)                       \
	SET_BITS_TO_LE_4BYTE(extra_info + 0X00, 16, 8, value)
#define PARAM_INFO_GET_RF_ADDR(extra_info)                                     \
	LE_BITS_TO_4BYTE(extra_info + 0X00, 16, 8)
#define PARAM_INFO_SET_RF_ADDR(extra_info, value)                              \
	SET_BITS_TO_LE_4BYTE(extra_info + 0X00, 16, 8, value)
#define PARAM_INFO_GET_IO_ADDR(extra_info)                                     \
	LE_BITS_TO_4BYTE(extra_info + 0X00, 16, 16)
#define PARAM_INFO_SET_IO_ADDR(extra_info, value)                              \
	SET_BITS_TO_LE_4BYTE(extra_info + 0X00, 16, 16, value)
#define PARAM_INFO_GET_DELAY_VAL(extra_info)                                   \
	LE_BITS_TO_4BYTE(extra_info + 0X00, 16, 16)
#define PARAM_INFO_SET_DELAY_VAL(extra_info, value)                            \
	SET_BITS_TO_LE_4BYTE(extra_info + 0X00, 16, 16, value)
#define PARAM_INFO_GET_RF_PATH(extra_info)                                     \
	LE_BITS_TO_4BYTE(extra_info + 0X00, 24, 8)
#define PARAM_INFO_SET_RF_PATH(extra_info, value)                              \
	SET_BITS_TO_LE_4BYTE(extra_info + 0X00, 24, 8, value)
#define PARAM_INFO_GET_DATA(extra_info)                                        \
	LE_BITS_TO_4BYTE(extra_info + 0X04, 0, 32)
#define PARAM_INFO_SET_DATA(extra_info, value)                                 \
	SET_BITS_TO_LE_4BYTE(extra_info + 0X04, 0, 32, value)
#define PARAM_INFO_GET_MASK(extra_info)                                        \
	LE_BITS_TO_4BYTE(extra_info + 0X08, 0, 32)
#define PARAM_INFO_SET_MASK(extra_info, value)                                 \
	SET_BITS_TO_LE_4BYTE(extra_info + 0X08, 0, 32, value)
#define CH_INFO_GET_CH(extra_info) LE_BITS_TO_4BYTE(extra_info + 0X00, 0, 8)
#define CH_INFO_SET_CH(extra_info, value)                                      \
	SET_BITS_TO_LE_4BYTE(extra_info + 0X00, 0, 8, value)
#define CH_INFO_GET_PRI_CH_IDX(extra_info)                                     \
	LE_BITS_TO_4BYTE(extra_info + 0X00, 8, 4)
#define CH_INFO_SET_PRI_CH_IDX(extra_info, value)                              \
	SET_BITS_TO_LE_4BYTE(extra_info + 0X00, 8, 4, value)
#define CH_INFO_GET_BW(extra_info) LE_BITS_TO_4BYTE(extra_info + 0X00, 12, 4)
#define CH_INFO_SET_BW(extra_info, value)                                      \
	SET_BITS_TO_LE_4BYTE(extra_info + 0X00, 12, 4, value)
#define CH_INFO_GET_TIMEOUT(extra_info)                                        \
	LE_BITS_TO_4BYTE(extra_info + 0X00, 16, 8)
#define CH_INFO_SET_TIMEOUT(extra_info, value)                                 \
	SET_BITS_TO_LE_4BYTE(extra_info + 0X00, 16, 8, value)
#define CH_INFO_GET_ACTION_ID(extra_info)                                      \
	LE_BITS_TO_4BYTE(extra_info + 0X00, 24, 7)
#define CH_INFO_SET_ACTION_ID(extra_info, value)                               \
	SET_BITS_TO_LE_4BYTE(extra_info + 0X00, 24, 7, value)
#define CH_INFO_GET_EXTRA_INFO(extra_info)                                     \
	LE_BITS_TO_4BYTE(extra_info + 0X00, 31, 1)
#define CH_INFO_SET_EXTRA_INFO(extra_info, value)                              \
	SET_BITS_TO_LE_4BYTE(extra_info + 0X00, 31, 1, value)
#define CH_EXTRA_INFO_GET_ID(extra_info)                                       \
	LE_BITS_TO_4BYTE(extra_info + 0X00, 0, 7)
#define CH_EXTRA_INFO_SET_ID(extra_info, value)                                \
	SET_BITS_TO_LE_4BYTE(extra_info + 0X00, 0, 7, value)
#define CH_EXTRA_INFO_GET_INFO(extra_info)                                     \
	LE_BITS_TO_4BYTE(extra_info + 0X00, 7, 1)
#define CH_EXTRA_INFO_SET_INFO(extra_info, value)                              \
	SET_BITS_TO_LE_4BYTE(extra_info + 0X00, 7, 1, value)
#define CH_EXTRA_INFO_GET_SIZE(extra_info)                                     \
	LE_BITS_TO_4BYTE(extra_info + 0X00, 8, 8)
#define CH_EXTRA_INFO_SET_SIZE(extra_info, value)                              \
	SET_BITS_TO_LE_4BYTE(extra_info + 0X00, 8, 8, value)
#define CH_EXTRA_INFO_GET_DATA(extra_info)                                     \
	LE_BITS_TO_4BYTE(extra_info + 0X00, 16, 1)
#define CH_EXTRA_INFO_SET_DATA(extra_info, value)                              \
	SET_BITS_TO_LE_4BYTE(extra_info + 0X00, 16, 1, value)
#define HIOE_INSTRUCTION_INFO_GET_BYTEDATA_L(extra_info)                       \
	LE_BITS_TO_4BYTE(extra_info + 0X00, 0, 16)
#define HIOE_INSTRUCTION_INFO_SET_BYTEDATA_L(extra_info, value)                \
	SET_BITS_TO_LE_4BYTE(extra_info + 0X00, 0, 16, value)
#define HIOE_INSTRUCTION_INFO_GET_BITDATA(extra_info)                          \
	LE_BITS_TO_4BYTE(extra_info + 0X00, 0, 16)
#define HIOE_INSTRUCTION_INFO_SET_BITDATA(extra_info, value)                   \
	SET_BITS_TO_LE_4BYTE(extra_info + 0X00, 0, 16, value)
#define HIOE_INSTRUCTION_INFO_GET_BYTEDATA_H(extra_info)                       \
	LE_BITS_TO_4BYTE(extra_info + 0X00, 16, 16)
#define HIOE_INSTRUCTION_INFO_SET_BYTEDATA_H(extra_info, value)                \
	SET_BITS_TO_LE_4BYTE(extra_info + 0X00, 16, 16, value)
#define HIOE_INSTRUCTION_INFO_GET_BITMASK(extra_info)                          \
	LE_BITS_TO_4BYTE(extra_info + 0X00, 16, 16)
#define HIOE_INSTRUCTION_INFO_SET_BITMASK(extra_info, value)                   \
	SET_BITS_TO_LE_4BYTE(extra_info + 0X00, 16, 16, value)
#define HIOE_INSTRUCTION_INFO_GET_REG_ADDR(extra_info)                         \
	LE_BITS_TO_4BYTE(extra_info + 0X04, 0, 22)
#define HIOE_INSTRUCTION_INFO_SET_REG_ADDR(extra_info, value)                  \
	SET_BITS_TO_LE_4BYTE(extra_info + 0X04, 0, 22, value)
#define HIOE_INSTRUCTION_INFO_GET_DELAY_VALUE(extra_info)                      \
	LE_BITS_TO_4BYTE(extra_info + 0X04, 0, 22)
#define HIOE_INSTRUCTION_INFO_SET_DELAY_VALUE(extra_info, value)               \
	SET_BITS_TO_LE_4BYTE(extra_info + 0X04, 0, 22, value)
#define HIOE_INSTRUCTION_INFO_GET_MODE_SELECT(extra_info)                      \
	LE_BITS_TO_4BYTE(extra_info + 0X04, 22, 1)
#define HIOE_INSTRUCTION_INFO_SET_MODE_SELECT(extra_info, value)               \
	SET_BITS_TO_LE_4BYTE(extra_info + 0X04, 22, 1, value)
#define HIOE_INSTRUCTION_INFO_GET_IO_DELAY(extra_info)                         \
	LE_BITS_TO_4BYTE(extra_info + 0X04, 23, 1)
#define HIOE_INSTRUCTION_INFO_SET_IO_DELAY(extra_info, value)                  \
	SET_BITS_TO_LE_4BYTE(extra_info + 0X04, 23, 1, value)
#define HIOE_INSTRUCTION_INFO_GET_BYTEMASK(extra_info)                         \
	LE_BITS_TO_4BYTE(extra_info + 0X04, 24, 4)
#define HIOE_INSTRUCTION_INFO_SET_BYTEMASK(extra_info, value)                  \
	SET_BITS_TO_LE_4BYTE(extra_info + 0X04, 24, 4, value)
#define HIOE_INSTRUCTION_INFO_GET_RD_EN(extra_info)                            \
	LE_BITS_TO_4BYTE(extra_info + 0X04, 28, 1)
#define HIOE_INSTRUCTION_INFO_SET_RD_EN(extra_info, value)                     \
	SET_BITS_TO_LE_4BYTE(extra_info + 0X04, 28, 1, value)
#define HIOE_INSTRUCTION_INFO_GET_WR_EN(extra_info)                            \
	LE_BITS_TO_4BYTE(extra_info + 0X04, 29, 1)
#define HIOE_INSTRUCTION_INFO_SET_WR_EN(extra_info, value)                     \
	SET_BITS_TO_LE_4BYTE(extra_info + 0X04, 29, 1, value)
#define HIOE_INSTRUCTION_INFO_GET_RAW_R(extra_info)                            \
	LE_BITS_TO_4BYTE(extra_info + 0X04, 30, 1)
#define HIOE_INSTRUCTION_INFO_SET_RAW_R(extra_info, value)                     \
	SET_BITS_TO_LE_4BYTE(extra_info + 0X04, 30, 1, value)
#define HIOE_INSTRUCTION_INFO_GET_RAW(extra_info)                              \
	LE_BITS_TO_4BYTE(extra_info + 0X04, 31, 1)
#define HIOE_INSTRUCTION_INFO_SET_RAW(extra_info, value)                       \
	SET_BITS_TO_LE_4BYTE(extra_info + 0X04, 31, 1, value)
#endif
