/*
 * Copyright (c) Huawei Technologies Co., Ltd. 2026-2026. All rights reserved.
 *
 * this file licensed under the 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.
 *
 */

#ifndef __HS_DRIVE_UPGRADE_H__
#define __HS_DRIVE_UPGRADE_H__

#include <glib-2.0/glib.h>
#include "histore/lib_api.h"

#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif
#endif /* __cplusplus */

// SCSI Write Buffer command opcodes and modes
#define SCSI_WRITE_BUFFER_OPCODE            0x3B
#define SCSI_WRITE_BUFFER_MODE_DOWNLOAD_MICRO   0x0E

// Drive firmware upgrade by path: chunk size and max file size
#define DRIVE_ADM_MAX_DATA_SIZE     0x1000U   /* 4KB per piece */
#define DRIVE_UPGRADE_MAX_FILE_SIZE 0x10000000L  /* 256MB max */

// Drive firmware upgrade functions
gint32 histore_send_drive_upgrade_file(guint32 ctrl_id, guint16 device_id, const gchar *file_path);
gint32 histore_active_drive_upgrade(guint32 ctrl_id, gpointer active_param);

#ifdef __cplusplus
#if __cplusplus
}
#endif
#endif /* __cplusplus */

#endif /* __HS_DRIVE_UPGRADE_H__ */

