gh #212 New API and enum last reboot reason - #213
Conversation
There was a problem hiding this comment.
Pull request overview
Adds a new Host HAL API and data model for reporting the device’s last reboot reason in a platform-agnostic way, enabling middleware to consume a normalized enum plus vendor-specific diagnostic strings.
Changes:
- Introduces
dsRebootReasonType_tnormalized reboot-reason enum anddsRebootReason_tdescriptor struct. - Adds new public API
dsGetLastRebootReason(dsRebootReason_t *rebootReason)to retrieve the last reboot reason.
Suppressed comments (2)
include/dsHost.h:183
- The comment contains a split word ("classifica tion"), which is a spelling/formatting error in this public header and will show up in generated docs.
* Mapped to RebootInfo.source in the middleware classifica tion pipeline. */
include/dsHost.h:312
- The new API doxygen block uses inconsistent leading "*" indentation compared to the rest of this header (which uses " *"), and it also has a spacing typo in one
@retval("-Not"). Aligning this block improves readability and keeps the generated docs consistent.
/**
* @brief Retrieves the last reboot reason from the platform.
*
* This API returns a normalized reboot reason along with
* vendor-specific diagnostic information.
*
* Platform implementations are responsible for translating
* hardware-specific reboot causes into the common
* dsRebootReasonType_t enumeration.
*
* @param[out] rebootReason - Reboot reason information.
*
* @return dsError_t
* @retval dsERR_NONE - Success
* @retval dsERR_NOT_INITIALIZED - Module not initialized
* @retval dsERR_INVALID_PARAM - Invalid parameter
* @retval dsERR_OPERATION_NOT_SUPPORTED -Not supported on platform
* @retval dsERR_GENERAL - Platform-specific failure
*/
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.
Suppressed comments (3)
include/dsHost.h:183
- There’s an unintended word break in this doc comment ("classifica tion"), which reads like a typo in the public API documentation.
/** @brief Camel-case human-readable source, e.g. "KernelPanic", "WatchDog".
* Mapped to RebootInfo.source in the middleware classifica tion pipeline. */
include/dsHost.h:298
- This new Doxygen block doesn’t follow the spacing/indentation used throughout this header (lines should be prefixed with " *"). Also, one
@retvalentry is missing a space after the dash ("-Not").
/**
* @brief Retrieves the last reboot reason from the platform.
*
* This API returns a normalized reboot reason along with
* vendor-specific diagnostic information.
include/dsHost.h:94
- There’s trailing whitespace at the end of this comment separator line; if whitespace checks are enabled, this can cause lint failures and creates noisy diffs in the future.
This issue also appears in the following locations of the same file:
- line 182
- line 294
* ----------------------------------------------------------------------
|
|
||
| /** @brief Camel-case human-readable source, e.g. "KernelPanic", "WatchDog". | ||
| * Mapped to RebootInfo.source in the middleware classifica tion pipeline. */ | ||
| char rebootInitiatedBy[DS_REBOOT_REASON_STR_LEN]; |
There was a problem hiding this comment.
do we need these many reboot reason string? I think one reason string should be enough
There was a problem hiding this comment.
This many variables where read from the structure and logged in MW API, so added all the strings.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.
Suppressed comments (2)
include/dsHost.h:273
- This Doxygen block is formatted inconsistently with the rest of the file (missing leading space before '*', inconsistent
@paramspacing, and@returnline format). Keeping the comment style consistent improves generated docs readability.
/**
* @brief Retrieves the last reboot reason from the platform.
*
* This API returns a normalized reboot reason along with
* vendor-specific diagnostic information.
include/dsHost.h:133
- The enum documentation refers to "logString", but the struct field is named rebootReasonString. This mismatch makes the API contract unclear for implementers/consumers.
DS_REBOOT_REASON_UNKNOWN, /**< Reason could not be determined or
* does not match any defined category.
* Consult logString for vendor detail. */
| * applicable. Must not be used for programmatic decision-making. */ | ||
| char rebootReasonString[DS_REBOOT_REASON_STR_LEN]; | ||
|
|
||
| } dsRebootReason_t; |
There was a problem hiding this comment.
Looking at the behaviour of the repo and interface files, isn't it better to move enum to other header files say dsUtls.h or dsTypes.h ?
Just a thought, we can discuss if needed.
There was a problem hiding this comment.
Since it is only one enum and a struct and that is related only to reboot reason api, added it in the same file
| * @retval dsERR_INVALID_PARAM - Invalid parameter | ||
| * @retval dsERR_OPERATION_NOT_SUPPORTED - Not supported on platform | ||
| * @retval dsERR_GENERAL - Platform-specific failure | ||
| */ |
There was a problem hiding this comment.
Also, as this api is part of dshost, we would need to call init before this api gets called, as done in all other apis here. So good to add below line
* @pre dsHostInit() must be called before this function
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.
Suppressed comments (2)
include/dsHost.h:259
- The Doxygen block for
dsGetLastRebootReasonis formatted inconsistently with the rest of this header (missing leading space before*), and it introduces inconsistent spelling ("initialized" vs the existing "initialised"). This can degrade generated API docs readability/searchability.
/**
* @brief Retrieves the last reboot reason from the platform.
*
* This API returns a normalized reboot reason along with
* vendor-specific diagnostic information.
include/dsHost.h:133
- The enum documentation references
logString, but the struct field is namedrebootReasonString. This looks like a stale/incorrect identifier and will confuse implementers reading the generated docs.
This issue also appears on line 255 of the same file.
DS_REBOOT_REASON_UNKNOWN, /**< Reason could not be determined or
* does not match any defined category.
* Consult logString for vendor detail. */
Normalization mapping (raw hardware token → dsRebootReason_t):
DS_REBOOT_REASON_POWER_ON
POWER_ON, POWER_ON_RESET, POWER_ON_REBOOT, HARDWARE, COLD_BOOT
(BRCM: POWER_ON/HARDWARE RTK: POWER_ON/HARDWARE
AMLOGIC: code 0 MTK: 0x00)
DS_REBOOT_REASON_SOFTWARE_RESET
SOFTWARE_MASTER_RESET, SOFTWARE_RESET, SW_RESET,
SOFTWARE_REBOOT, NORMAL_BOOT
(BRCM: SOFTWARE_MASTER_RESET/SW_RESET/SOFTWARE_RESET/SOFTWARE
RTK: same AMLOGIC: code 1 MTK: 0xD1)
DS_REBOOT_REASON_KERNEL_PANIC
KERNEL_PANIC, KERNEL_PANIC_RESET, CRASH_DUMP, CRASH_REBOOT
(BRCM: KERNEL_PANIC/KERNEL_PANIC_RESET
RTK: same AMLOGIC: code 11 (CRASH_REBOOT), code 12 (KERNEL_PANIC)
MTK: 0xEF)
DS_REBOOT_REASON_WATCHDOG
WATCHDOG, WATCHDOG_RESET, WATCHDOG_TIMER_RESET, WATCH_DOG,
GEN_WATCHDOG_RESET, GEN_WATCHDOG_1_RESET, WATCHDOG_REBOOT
(BRCM: WATCHDOG, GEN_WATCHDOG_1_RESET/GEN_WATCHDOG_RESET
RTK: WATCHDOG, GEN_WATCHDOG_1_RESET/GEN_WATCHDOG_RESET
AMLOGIC: code 13 MTK: 0xE0)
DS_REBOOT_REASON_THERMAL
OVERTEMP, OVERHEAT, THERMAL, THERMAL_REBOOT
(BRCM: OVERTEMP/OVERHEAT RTK: OVERTEMP/OVERHEAT
AMLOGIC: code 10 MTK: 0xE4)
DS_REBOOT_REASON_VOLTAGE
OVERVOLTAGE, UNDERVOLTAGE, OVERVOLTAGE_RESET,
UNDERVOLTAGE_RESET, UNDERVOLTAGE_0_RESET, UNDERVOLTAGE_1_RESET
(BRCM: OVERVOLTAGE, UNDERVOLTAGE/UNDERVOLTAGE_0_RESET/UNDERVOLTAGE_1_RESET
RTK: same)
DS_REBOOT_REASON_FACTORY_RESET
FACTORY_RESET, FACTORY_RESET_REBOOT
(AMLOGIC: code 2)
DS_REBOOT_REASON_STANDBY_WAKEUP
S3_WAKEUP_RESET, SUSPEND_REBOOT, SUSPEND_BOOT,
HIBERNATE_REBOOT, HIBERNATE_BOOT
(BRCM: S3_WAKEUP_RESET RTK: S3_WAKEUP_RESET
AMLOGIC: code 5 (SUSPEND_BOOT), code 6 (HIBERNATE_BOOT))
DS_REBOOT_REASON_SECURITY_RESET
SECURITY_MASTER_RESET, STR_AUTH_FAIL, AMLOGIC_DDR_SHA2_REBOOT
(BRCM: SECURITY_MASTER_RESET RTK: SECURITY_MASTER_RESET
AMLOGIC: code 14)
DS_REBOOT_REASON_UPDATE
UPGRADE_SYSTEM_REBOOT, UPDATE_BOOT
(AMLOGIC: code 3)
DS_REBOOT_REASON_UNKNOWN
Everything else, including:
CPU_EJTAG_RESET, SCPU_EJTAG_RESET, MAIN_CHIP_INPUT_RESET,
MAIN_CHIP_RESET_INPUT, SMARTCARD_INSERT_RESET, PCIE_HOT_BOOT_RESET,
AUX_CHIP_EDGE_RESET, AUX_CHIP_LEVEL_RESET, MPM_RESET,
RPMPB (AMLOGIC code 9), FFV (AMLOGIC code 15),
BOOTLOADER_REBOOT / FASTBOOT_BOOTLOADER (AMLOGIC code 7),
SHUTDOWN_REBOOT (AMLOGIC code 8), FASTBOOT_REBOOT / FAST_BOOT (AMLOGIC code 4),
FRONT_PANEL_4SEC_RESET / FRONT_PANEL_RESET, TAP_IN_SYSTEM_RESET,
HARD_POWER, absent / unmatched raw values