board: add boot operation 96/268296/1
authorYoungjae Cho <y0.cho@samsung.com>
Mon, 20 Dec 2021 05:18:03 +0000 (14:18 +0900)
committerYoungjae Cho <y0.cho@samsung.com>
Mon, 20 Dec 2021 05:18:03 +0000 (14:18 +0900)
Added
 - hal_device_board_set_boot_success(void)
 - hal_device_board_clear_boot_mode(void)
 - hal_device_board_get_boot_mode(int *)
 - hal_device_board_get_boot_reason(int *)

Change-Id: I85fa078ed8f3f57e76561ade258352343a79e4f4
Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
include/backend/hal-board-interface.h
src/board.c

index f9a068ccb37d70c38efdb49f115bdb5ccc30caf8..8e8bee52a9a76f28d49a7a1da1153ad1f42be0cd 100644 (file)
@@ -27,6 +27,10 @@ typedef struct _hal_backend_board_funcs {
        int (*get_device_serial_number)(char *buffer, int len);
        int (*get_device_revision)(int *revision);
        int (*switch_partition)(int argc, char *argv[]);
+       int (*set_boot_success)(void);
+       int (*clear_boot_mode)(void);
+       int (*get_boot_mode)(int *mode);
+       int (*get_boot_reason)(int *reason);
 } hal_backend_board_funcs;
 
 #ifdef __cplusplus
index cac90bca6867bb9dd4f4a913b050ecaedf651919..af88ff53d92a035073716460045bab0d9111e2be 100644 (file)
@@ -105,3 +105,68 @@ int hal_device_board_switch_partition(int argc, char *argv[])
 
        return hal_board_funcs->switch_partition(argc, argv);
 }
+
+int hal_device_board_set_boot_success(void)
+{
+       int ret;
+
+       if (!hal_board_funcs && !hal_initialized) {
+               if ((ret = hal_device_board_get_backend()) < 0)
+                       return ret;
+       }
+
+       if (!hal_board_funcs ||
+           !hal_board_funcs->set_boot_success)
+               return -ENODEV;
+
+       return hal_board_funcs->set_boot_success();
+}
+
+
+int hal_device_board_clear_boot_mode(void)
+{
+       int ret;
+
+       if (!hal_board_funcs && !hal_initialized) {
+               if ((ret = hal_device_board_get_backend()) < 0)
+                       return ret;
+       }
+
+       if (!hal_board_funcs ||
+           !hal_board_funcs->clear_boot_mode)
+               return -ENODEV;
+
+       return hal_board_funcs->clear_boot_mode();
+}
+
+int hal_device_board_get_boot_mode(int *mode)
+{
+       int ret;
+
+       if (!hal_board_funcs && !hal_initialized) {
+               if ((ret = hal_device_board_get_backend()) < 0)
+                       return ret;
+       }
+
+       if (!hal_board_funcs ||
+           !hal_board_funcs->get_boot_mode)
+               return -ENODEV;
+
+       return hal_board_funcs->get_boot_mode(mode);
+}
+
+int hal_device_board_get_boot_reason(int *reason)
+{
+       int ret;
+
+       if (!hal_board_funcs && !hal_initialized) {
+               if ((ret = hal_device_board_get_backend()) < 0)
+                       return ret;
+       }
+
+       if (!hal_board_funcs ||
+           !hal_board_funcs->get_boot_reason)
+               return -ENODEV;
+
+       return hal_board_funcs->get_boot_reason(reason);
+}