drivers/pc80/rtc: Remove CMOS spinlock
This was only used with amdfam10h-15h, and only in romstage while commentary elsewhere says concurrent CMOS and CBFS access caused issues. We would want a cleaner approach on this, if re-implemented. Change-Id: I8512196cb55ff2b4542b1421a1bbae540450115a Signed-off-by: Kyösti Mälkki <kyosti.malkki@gmail.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/37074 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Arthur Heymans <arthur@aheymans.xyz> Reviewed-by: Aaron Durbin <adurbin@chromium.org>
This commit is contained in:
parent
3382e53c64
commit
9bb16cd9c5
|
@ -37,17 +37,6 @@
|
||||||
/* Don't warn for checking >= LB_CKS_RANGE_START even though it may be 0. */
|
/* Don't warn for checking >= LB_CKS_RANGE_START even though it may be 0. */
|
||||||
#pragma GCC diagnostic ignored "-Wtype-limits"
|
#pragma GCC diagnostic ignored "-Wtype-limits"
|
||||||
|
|
||||||
#include <smp/spinlock.h>
|
|
||||||
|
|
||||||
#if (defined(__PRE_RAM__) && \
|
|
||||||
CONFIG(HAVE_ROMSTAGE_NVRAM_CBFS_SPINLOCK))
|
|
||||||
#define LOCK_NVRAM_CBFS_SPINLOCK() spin_lock(romstage_nvram_cbfs_lock())
|
|
||||||
#define UNLOCK_NVRAM_CBFS_SPINLOCK() spin_unlock(romstage_nvram_cbfs_lock())
|
|
||||||
#else
|
|
||||||
#define LOCK_NVRAM_CBFS_SPINLOCK() { }
|
|
||||||
#define UNLOCK_NVRAM_CBFS_SPINLOCK() { }
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static void cmos_reset_date(void)
|
static void cmos_reset_date(void)
|
||||||
{
|
{
|
||||||
/* Now setup a default date equals to the build date */
|
/* Now setup a default date equals to the build date */
|
||||||
|
@ -274,13 +263,10 @@ enum cb_err get_option(void *dest, const char *name)
|
||||||
if (!CONFIG(USE_OPTION_TABLE))
|
if (!CONFIG(USE_OPTION_TABLE))
|
||||||
return CB_CMOS_OTABLE_DISABLED;
|
return CB_CMOS_OTABLE_DISABLED;
|
||||||
|
|
||||||
LOCK_NVRAM_CBFS_SPINLOCK();
|
|
||||||
|
|
||||||
/* Figure out how long name is */
|
/* Figure out how long name is */
|
||||||
namelen = strnlen(name, CMOS_MAX_NAME_LENGTH);
|
namelen = strnlen(name, CMOS_MAX_NAME_LENGTH);
|
||||||
|
|
||||||
if (locate_cmos_layout(&rdev) != CB_SUCCESS) {
|
if (locate_cmos_layout(&rdev) != CB_SUCCESS) {
|
||||||
UNLOCK_NVRAM_CBFS_SPINLOCK();
|
|
||||||
return CB_CMOS_LAYOUT_NOT_FOUND;
|
return CB_CMOS_LAYOUT_NOT_FOUND;
|
||||||
}
|
}
|
||||||
ct = rdev_mmap_full(&rdev);
|
ct = rdev_mmap_full(&rdev);
|
||||||
|
@ -288,7 +274,6 @@ enum cb_err get_option(void *dest, const char *name)
|
||||||
printk(BIOS_ERR, "RTC: cmos_layout.bin could not be mapped. "
|
printk(BIOS_ERR, "RTC: cmos_layout.bin could not be mapped. "
|
||||||
"Options are disabled\n");
|
"Options are disabled\n");
|
||||||
|
|
||||||
UNLOCK_NVRAM_CBFS_SPINLOCK();
|
|
||||||
return CB_CMOS_LAYOUT_NOT_FOUND;
|
return CB_CMOS_LAYOUT_NOT_FOUND;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -304,22 +289,18 @@ enum cb_err get_option(void *dest, const char *name)
|
||||||
if (!found) {
|
if (!found) {
|
||||||
printk(BIOS_DEBUG, "No CMOS option '%s'.\n", name);
|
printk(BIOS_DEBUG, "No CMOS option '%s'.\n", name);
|
||||||
rdev_munmap(&rdev, ct);
|
rdev_munmap(&rdev, ct);
|
||||||
UNLOCK_NVRAM_CBFS_SPINLOCK();
|
|
||||||
return CB_CMOS_OPTION_NOT_FOUND;
|
return CB_CMOS_OPTION_NOT_FOUND;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!cmos_checksum_valid(LB_CKS_RANGE_START, LB_CKS_RANGE_END, LB_CKS_LOC)) {
|
if (!cmos_checksum_valid(LB_CKS_RANGE_START, LB_CKS_RANGE_END, LB_CKS_LOC)) {
|
||||||
rdev_munmap(&rdev, ct);
|
rdev_munmap(&rdev, ct);
|
||||||
UNLOCK_NVRAM_CBFS_SPINLOCK();
|
|
||||||
return CB_CMOS_CHECKSUM_INVALID;
|
return CB_CMOS_CHECKSUM_INVALID;
|
||||||
}
|
}
|
||||||
if (get_cmos_value(ce->bit, ce->length, dest) != CB_SUCCESS) {
|
if (get_cmos_value(ce->bit, ce->length, dest) != CB_SUCCESS) {
|
||||||
rdev_munmap(&rdev, ct);
|
rdev_munmap(&rdev, ct);
|
||||||
UNLOCK_NVRAM_CBFS_SPINLOCK();
|
|
||||||
return CB_CMOS_ACCESS_ERROR;
|
return CB_CMOS_ACCESS_ERROR;
|
||||||
}
|
}
|
||||||
rdev_munmap(&rdev, ct);
|
rdev_munmap(&rdev, ct);
|
||||||
UNLOCK_NVRAM_CBFS_SPINLOCK();
|
|
||||||
return CB_SUCCESS;
|
return CB_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -392,7 +373,6 @@ enum cb_err set_option(const char *name, void *value)
|
||||||
namelen = strnlen(name, CMOS_MAX_NAME_LENGTH);
|
namelen = strnlen(name, CMOS_MAX_NAME_LENGTH);
|
||||||
|
|
||||||
if (locate_cmos_layout(&rdev) != CB_SUCCESS) {
|
if (locate_cmos_layout(&rdev) != CB_SUCCESS) {
|
||||||
UNLOCK_NVRAM_CBFS_SPINLOCK();
|
|
||||||
return CB_CMOS_LAYOUT_NOT_FOUND;
|
return CB_CMOS_LAYOUT_NOT_FOUND;
|
||||||
}
|
}
|
||||||
ct = rdev_mmap_full(&rdev);
|
ct = rdev_mmap_full(&rdev);
|
||||||
|
@ -400,7 +380,6 @@ enum cb_err set_option(const char *name, void *value)
|
||||||
printk(BIOS_ERR, "RTC: cmos_layout.bin could not be mapped. "
|
printk(BIOS_ERR, "RTC: cmos_layout.bin could not be mapped. "
|
||||||
"Options are disabled\n");
|
"Options are disabled\n");
|
||||||
|
|
||||||
UNLOCK_NVRAM_CBFS_SPINLOCK();
|
|
||||||
return CB_CMOS_LAYOUT_NOT_FOUND;
|
return CB_CMOS_LAYOUT_NOT_FOUND;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue