summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/ec/google/chromeec/ec.c11
-rw-r--r--src/ec/google/chromeec/ec.h2
-rw-r--r--src/include/fw_config.h6
-rw-r--r--src/lib/fw_config.c24
-rw-r--r--src/mainboard/google/dedede/board_info.c2
-rw-r--r--src/mainboard/google/dedede/variants/baseboard/include/baseboard/variants.h2
-rw-r--r--src/mainboard/google/zork/variants/baseboard/helpers.c8
7 files changed, 32 insertions, 23 deletions
diff --git a/src/ec/google/chromeec/ec.c b/src/ec/google/chromeec/ec.c
index 39cf89512f..2ffccbc77c 100644
--- a/src/ec/google/chromeec/ec.c
+++ b/src/ec/google/chromeec/ec.c
@@ -841,9 +841,16 @@ int google_chromeec_cbi_get_sku_id(uint32_t *id)
return cbi_get_uint32(id, CBI_TAG_SKU_ID);
}
-int google_chromeec_cbi_get_fw_config(uint32_t *fw_config)
+int google_chromeec_cbi_get_fw_config(uint64_t *fw_config)
{
- return cbi_get_uint32(fw_config, CBI_TAG_FW_CONFIG);
+ uint32_t config;
+
+ if (cbi_get_uint32(&config, CBI_TAG_FW_CONFIG))
+ return -1;
+
+ /* FIXME: Yet to determine source of other 32 bits... */
+ *fw_config = (uint64_t)config;
+ return 0;
}
int google_chromeec_cbi_get_oem_id(uint32_t *id)
diff --git a/src/ec/google/chromeec/ec.h b/src/ec/google/chromeec/ec.h
index c2ceff831f..bed8594a8b 100644
--- a/src/ec/google/chromeec/ec.h
+++ b/src/ec/google/chromeec/ec.h
@@ -83,7 +83,7 @@ int google_chromeec_reboot(int dev_idx, enum ec_reboot_cmd type, uint8_t flags);
*/
int google_chromeec_cbi_get_oem_id(uint32_t *id);
int google_chromeec_cbi_get_sku_id(uint32_t *id);
-int google_chromeec_cbi_get_fw_config(uint32_t *fw_config);
+int google_chromeec_cbi_get_fw_config(uint64_t *fw_config);
int google_chromeec_cbi_get_dram_part_num(char *buf, size_t bufsize);
int google_chromeec_cbi_get_oem_name(char *buf, size_t bufsize);
/* version may be stored in CBI as a smaller integer width, but the EC code
diff --git a/src/include/fw_config.h b/src/include/fw_config.h
index 81980b93ae..494ce7f389 100644
--- a/src/include/fw_config.h
+++ b/src/include/fw_config.h
@@ -18,8 +18,8 @@
struct fw_config {
const char *field_name;
const char *option_name;
- uint32_t mask;
- uint32_t value;
+ uint64_t mask;
+ uint64_t value;
};
/* Generate a pointer to a compound literal of the fw_config structure. */
@@ -53,7 +53,7 @@ void fw_config_for_each_found(void (*cb)(const struct fw_config *config, void *a
*
* Return pointer to cached `struct fw_config` if successfully probed, otherwise NULL.
*/
-const struct fw_config *fw_config_get_found(uint32_t field_mask);
+const struct fw_config *fw_config_get_found(uint64_t field_mask);
#else
diff --git a/src/lib/fw_config.c b/src/lib/fw_config.c
index ec3205958d..0973cbeeff 100644
--- a/src/lib/fw_config.c
+++ b/src/lib/fw_config.c
@@ -7,6 +7,7 @@
#include <device/device.h>
#include <ec/google/chromeec/ec.h>
#include <fw_config.h>
+#include <inttypes.h>
#include <lib.h>
#include <stdbool.h>
#include <stdint.h>
@@ -14,11 +15,11 @@
/**
* fw_config_get() - Provide firmware configuration value.
*
- * Return 32bit firmware configuration value determined for the system.
+ * Return 64bit firmware configuration value determined for the system.
*/
-static uint32_t fw_config_get(void)
+static uint64_t fw_config_get(void)
{
- static uint32_t fw_config_value;
+ static uint64_t fw_config_value;
static bool fw_config_value_initialized;
/* Nothing to prepare if setup is already done. */
@@ -35,7 +36,7 @@ static uint32_t fw_config_get(void)
__func__);
fw_config_value = 0;
} else {
- printk(BIOS_INFO, "FW_CONFIG value from CBFS is 0x%08x\n",
+ printk(BIOS_INFO, "FW_CONFIG value from CBFS is 0x%" PRIx64 "\n",
fw_config_value);
return fw_config_value;
}
@@ -47,7 +48,7 @@ static uint32_t fw_config_get(void)
printk(BIOS_WARNING, "%s: Could not get fw_config from EC\n", __func__);
}
- printk(BIOS_INFO, "FW_CONFIG value is 0x%08x\n", fw_config_value);
+ printk(BIOS_INFO, "FW_CONFIG value is 0x%" PRIx64 "\n", fw_config_value);
return fw_config_value;
}
@@ -59,7 +60,8 @@ bool fw_config_probe(const struct fw_config *match)
printk(BIOS_INFO, "fw_config match found: %s=%s\n", match->field_name,
match->option_name);
else
- printk(BIOS_INFO, "fw_config match found: mask=0x%08x value=0x%08x\n",
+ printk(BIOS_INFO, "fw_config match found: mask=0x%" PRIx64 " value=0x%"
+ PRIx64 "\n",
match->mask, match->value);
return true;
}
@@ -70,20 +72,20 @@ bool fw_config_probe(const struct fw_config *match)
#if ENV_RAMSTAGE
/*
- * The maximum number of fw_config fields is limited by the 32-bit mask that is used to
+ * The maximum number of fw_config fields is limited by the 64-bit mask that is used to
* represent them.
*/
-#define MAX_CACHE_ELEMENTS (8 * sizeof(uint32_t))
+#define MAX_CACHE_ELEMENTS (8 * sizeof(uint64_t))
static const struct fw_config *cached_configs[MAX_CACHE_ELEMENTS];
-static size_t probe_index(uint32_t mask)
+static size_t probe_index(uint64_t mask)
{
assert(mask);
- return __ffs(mask);
+ return __ffs64(mask);
}
-const struct fw_config *fw_config_get_found(uint32_t field_mask)
+const struct fw_config *fw_config_get_found(uint64_t field_mask)
{
const struct fw_config *config;
config = cached_configs[probe_index(field_mask)];
diff --git a/src/mainboard/google/dedede/board_info.c b/src/mainboard/google/dedede/board_info.c
index fdb4b5ff64..22d35d7475 100644
--- a/src/mainboard/google/dedede/board_info.c
+++ b/src/mainboard/google/dedede/board_info.c
@@ -3,7 +3,7 @@
#include <baseboard/variants.h>
#include <ec/google/chromeec/ec.h>
-int board_info_get_fw_config(uint32_t *fw_config)
+int board_info_get_fw_config(uint64_t *fw_config)
{
return google_chromeec_cbi_get_fw_config(fw_config);
}
diff --git a/src/mainboard/google/dedede/variants/baseboard/include/baseboard/variants.h b/src/mainboard/google/dedede/variants/baseboard/include/baseboard/variants.h
index dc855c63cd..bb41e45931 100644
--- a/src/mainboard/google/dedede/variants/baseboard/include/baseboard/variants.h
+++ b/src/mainboard/google/dedede/variants/baseboard/include/baseboard/variants.h
@@ -21,7 +21,7 @@ const struct pad_config *variant_override_gpio_table(size_t *num);
* @param fw_config Address where the fw_config is stored.
* @return 0 on success or negative integer for errors.
*/
-int board_info_get_fw_config(uint32_t *fw_config);
+int board_info_get_fw_config(uint64_t *fw_config);
/* Return memory configuration structure. */
const struct mb_cfg *variant_memcfg_config(void);
diff --git a/src/mainboard/google/zork/variants/baseboard/helpers.c b/src/mainboard/google/zork/variants/baseboard/helpers.c
index cc07fe18d6..70710351d2 100644
--- a/src/mainboard/google/zork/variants/baseboard/helpers.c
+++ b/src/mainboard/google/zork/variants/baseboard/helpers.c
@@ -48,9 +48,9 @@ enum {
FW_CONFIG_SHIFT_FAN = 27,
};
-static int get_fw_config(uint32_t *val)
+static int get_fw_config(uint64_t *val)
{
- static uint32_t known_value;
+ static uint64_t known_value;
if (known_value) {
*val = known_value;
@@ -67,9 +67,9 @@ static int get_fw_config(uint32_t *val)
return 0;
}
-static unsigned int extract_field(uint32_t mask, int shift)
+static unsigned int extract_field(uint64_t mask, int shift)
{
- uint32_t fw_config;
+ uint64_t fw_config;
/* On errors nothing is assumed to be set. */
if (get_fw_config(&fw_config))