summaryrefslogtreecommitdiff
path: root/src/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'src/drivers')
-rw-r--r--src/drivers/pc80/rtc/option.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/src/drivers/pc80/rtc/option.c b/src/drivers/pc80/rtc/option.c
index 5cc5ea558e..cc4138bfd7 100644
--- a/src/drivers/pc80/rtc/option.c
+++ b/src/drivers/pc80/rtc/option.c
@@ -84,7 +84,7 @@ static struct cmos_entries *find_cmos_entry(struct cmos_option_table *ct, const
return NULL;
}
-enum cb_err cmos_get_option(void *dest, const char *name)
+enum cb_err cmos_get_uint_option(unsigned int *dest, const char *name)
{
struct cmos_option_table *ct;
struct cmos_entries *ce;
@@ -99,6 +99,11 @@ enum cb_err cmos_get_option(void *dest, const char *name)
return CB_CMOS_OPTION_NOT_FOUND;
}
+ if (ce->config != 'e' && ce->config != 'h') {
+ printk(BIOS_ERR, "ERROR: CMOS option '%s' is not of integer type.\n", name);
+ return CB_ERR_ARG;
+ }
+
if (!cmos_checksum_valid(LB_CKS_RANGE_START, LB_CKS_RANGE_END, LB_CKS_LOC))
return CB_CMOS_CHECKSUM_INVALID;
@@ -149,11 +154,10 @@ static enum cb_err set_cmos_value(unsigned long bit, unsigned long length,
return CB_SUCCESS;
}
-enum cb_err cmos_set_option(const char *name, void *value)
+enum cb_err cmos_set_uint_option(const char *name, unsigned int *value)
{
struct cmos_option_table *ct;
struct cmos_entries *ce;
- unsigned long length;
ct = get_cmos_layout();
if (!ct)
@@ -165,16 +169,12 @@ enum cb_err cmos_set_option(const char *name, void *value)
return CB_CMOS_OPTION_NOT_FOUND;
}
- length = ce->length;
- if (ce->config == 's') {
- length = MAX(strlen((const char *)value) * 8, ce->length - 8);
- /* make sure the string is null terminated */
- if (set_cmos_value(ce->bit + ce->length - 8, 8, &(u8[]){0})
- != CB_SUCCESS)
- return CB_CMOS_ACCESS_ERROR;
+ if (ce->config != 'e' && ce->config != 'h') {
+ printk(BIOS_ERR, "ERROR: CMOS option '%s' is not of integer type.\n", name);
+ return CB_ERR_ARG;
}
- if (set_cmos_value(ce->bit, length, value) != CB_SUCCESS)
+ if (set_cmos_value(ce->bit, ce->length, value) != CB_SUCCESS)
return CB_CMOS_ACCESS_ERROR;
return CB_SUCCESS;