-- Copyright (c) 2026 Huawei Technologies Co., Ltd.
-- openUBMC is licensed under Mulan PSL v2.
-- You can use this software according to the terms and conditions of the Mulan PSL v2.
-- You may obtain a copy of Mulan PSL v2 at: http://license.coscl.org.cn/MulanPSL2
-- THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
-- EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
-- MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
-- See the Mulan PSL v2 for more details.

-- Description: 定义升级需要的通用常量和方法
local upgrade_defs = {}

upgrade_defs.RET = {
    OK = 0,
    ERR = (-1),
    OTHERS_UPGRADING = 248,
    IN_UPGRADING = 36
}
upgrade_defs.UPGRADE_NIC_DIR = '/data/backup/nic/up_cfg/'
upgrade_defs.UPGRADE_NIC_FILE_NAME = 'nic.hpm'

upgrade_defs.LOCK_FOREVER = 0xffff

upgrade_defs.SPIKODRV = '/lib/modules/hibmc/sfc0_drv.ko'
upgrade_defs.DEVNAME_MTD = '/dev/mtd0'
upgrade_defs.PERIOD3_MHZ = 25
upgrade_defs.FLASH_START_ADDRESS = 0
upgrade_defs.SET_ROUTE_RETRY = 3
upgrade_defs.O_SYNC_RDWR = 4098
upgrade_defs.PROTOCOL_NIC_SFC = 'SFC'    -- 网卡采用SFC协议升级固件

return upgrade_defs