efuse: add efuse hal api

Closes IDF-7215
This commit is contained in:
Sachin Billore 2023-04-14 20:33:37 +05:30
parent 34850de22b
commit c3e701588e
4 changed files with 15 additions and 3 deletions

View File

@ -19,7 +19,6 @@
#include "soc/efuse_reg.h"
#include "soc/chip_revision.h"
#include "hal/efuse_hal.h"
#include "hal/efuse_ll.h"
#include "hal/gpio_ll.h"
#include "esp_image_format.h"
#include "bootloader_sha.h"
@ -80,7 +79,7 @@ esp_err_t bootloader_common_check_chip_validity(const esp_image_header_t* img_hd
}
if (type == ESP_IMAGE_APPLICATION) {
unsigned max_rev = img_hdr->max_chip_rev_full;
if ((IS_MAX_REV_SET(max_rev) && (revision > max_rev) && !efuse_ll_get_disable_wafer_version_major())) {
if ((IS_MAX_REV_SET(max_rev) && (revision > max_rev) && !efuse_hal_get_disable_wafer_version_major())) {
ESP_LOGE(TAG, "Image requires chip rev <= v%d.%d, but chip is v%d.%d",
max_rev / 100, max_rev % 100,
major_rev, minor_rev);

View File

@ -450,7 +450,7 @@ static void start_cpu0_default(void)
ESP_EARLY_LOGI(TAG, "Min chip rev: v%d.%d", CONFIG_ESP_REV_MIN_FULL / 100, CONFIG_ESP_REV_MIN_FULL % 100);
ESP_EARLY_LOGI(TAG, "Max chip rev: v%d.%d %s",CONFIG_ESP_REV_MAX_FULL / 100, CONFIG_ESP_REV_MAX_FULL % 100,
efuse_ll_get_disable_wafer_version_major() ? "(constraint ignored)" : "");
efuse_hal_get_disable_wafer_version_major() ? "(constraint ignored)" : "");
unsigned revision = efuse_hal_chip_revision();
ESP_EARLY_LOGI(TAG, "Chip rev: v%d.%d", revision / 100, revision % 100);
}

View File

@ -24,6 +24,11 @@ IRAM_ATTR uint32_t efuse_hal_chip_revision(void)
return efuse_hal_get_major_chip_version() * 100 + efuse_hal_get_minor_chip_version();
}
IRAM_ATTR bool efuse_hal_get_disable_wafer_version_major(void)
{
return efuse_ll_get_disable_wafer_version_major();
}
IRAM_ATTR bool efuse_hal_flash_encryption_enabled(void)
{
uint32_t flash_crypt_cnt = efuse_ll_get_flash_crypt_cnt();

View File

@ -36,6 +36,14 @@ uint32_t efuse_hal_chip_revision(void);
*/
bool efuse_hal_flash_encryption_enabled(void);
/**
* @brief Returns the status of whether the bootloader (and OTA)
* will check the maximum chip version or not.
*
* @return true - Skip the maximum chip version check.
*/
bool efuse_hal_get_disable_wafer_version_major(void);
/**
* @brief Returns major chip version
*/