summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/drivers/pc80/mc146818rtc.c30
-rw-r--r--src/include/pc80/mc146818rtc.h5
-rw-r--r--src/include/rtc.h4
-rw-r--r--src/southbridge/amd/agesa/hudson/lpc.c2
-rw-r--r--src/southbridge/amd/cimx/sb700/late.c2
-rw-r--r--src/southbridge/amd/cimx/sb800/late.c2
-rw-r--r--src/southbridge/amd/cimx/sb900/late.c2
-rw-r--r--src/southbridge/amd/pi/avalon/lpc.c2
-rw-r--r--src/southbridge/amd/sb600/lpc.c2
-rw-r--r--src/southbridge/amd/sb700/lpc.c2
-rw-r--r--src/southbridge/amd/sb800/lpc.c2
11 files changed, 24 insertions, 31 deletions
diff --git a/src/drivers/pc80/mc146818rtc.c b/src/drivers/pc80/mc146818rtc.c
index 84abd4309c..fc3adf0cb8 100644
--- a/src/drivers/pc80/mc146818rtc.c
+++ b/src/drivers/pc80/mc146818rtc.c
@@ -32,7 +32,7 @@
#endif
-static void cmos_reset_date(u8 has_century)
+static void cmos_reset_date(void)
{
/* Now setup a default date equals to the build date */
struct rtc_time time = {
@@ -45,7 +45,7 @@ static void cmos_reset_date(u8 has_century)
bcd2bin(coreboot_build_date.year),
.wday = bcd2bin(coreboot_build_date.weekday)
};
- rtc_set(&time, has_century);
+ rtc_set(&time);
}
#if CONFIG_USE_OPTION_TABLE
@@ -123,7 +123,7 @@ void cmos_init(int invalid)
cmos_write(0, i);
#endif
if (cmos_invalid)
- cmos_reset_date(RTC_HAS_NO_ALTCENTURY);
+ cmos_reset_date();
printk(BIOS_WARNING, "RTC:%s%s%s%s\n",
invalid?" Clear requested":"",
@@ -325,12 +325,12 @@ enum cb_err set_option(const char *name, void *value)
* hurts some OSes. Even if we don't set USE_OPTION_TABLE, we need
* to make sure the date is valid.
*/
-void cmos_check_update_date(u8 has_century)
+void cmos_check_update_date()
{
u8 year, century;
- /* Note: Need to check if the hardware supports RTC_CLK_ALTCENTURY. */
- century = has_century ? cmos_read(RTC_CLK_ALTCENTURY) : 0;
+ /* Assume hardware always supports RTC_CLK_ALTCENTURY. */
+ century = cmos_read(RTC_CLK_ALTCENTURY);
year = cmos_read(RTC_CLK_YEAR);
/*
@@ -339,25 +339,23 @@ void cmos_check_update_date(u8 has_century)
* if the date is valid.
*/
if (century > 0x99 || year > 0x99) /* Invalid date */
- cmos_reset_date(has_century);
+ cmos_reset_date();
}
-int rtc_set(const struct rtc_time *time, u8 has_century)
-{
+int rtc_set(const struct rtc_time *time){
cmos_write(bin2bcd(time->sec), RTC_CLK_SECOND);
cmos_write(bin2bcd(time->min), RTC_CLK_MINUTE);
cmos_write(bin2bcd(time->hour), RTC_CLK_HOUR);
cmos_write(bin2bcd(time->mday), RTC_CLK_DAYOFMONTH);
cmos_write(bin2bcd(time->mon), RTC_CLK_MONTH);
cmos_write(bin2bcd(time->year % 100), RTC_CLK_YEAR);
- if (has_century)
- cmos_write(bin2bcd(time->year / 100),
- RTC_CLK_ALTCENTURY);
+ /* Same assumption as above: We always have RTC_CLK_ALTCENTURY */
+ cmos_write(bin2bcd(time->year / 100), RTC_CLK_ALTCENTURY);
cmos_write(bin2bcd(time->wday + 1), RTC_CLK_DAYOFWEEK);
return 0;
}
-int rtc_get(struct rtc_time *time, u8 has_century)
+int rtc_get(struct rtc_time *time)
{
time->sec = bcd2bin(cmos_read(RTC_CLK_SECOND));
time->min = bcd2bin(cmos_read(RTC_CLK_MINUTE));
@@ -365,10 +363,8 @@ int rtc_get(struct rtc_time *time, u8 has_century)
time->mday = bcd2bin(cmos_read(RTC_CLK_DAYOFMONTH));
time->mon = bcd2bin(cmos_read(RTC_CLK_MONTH));
time->year = bcd2bin(cmos_read(RTC_CLK_YEAR));
- if (has_century)
- time->year += bcd2bin(cmos_read(RTC_CLK_ALTCENTURY)) * 100;
- else
- time->year += 2000;
+ /* Same assumption as above: We always have RTC_CLK_ALTCENTURY */
+ time->year += bcd2bin(cmos_read(RTC_CLK_ALTCENTURY)) * 100;
time->wday = bcd2bin(cmos_read(RTC_CLK_DAYOFWEEK)) - 1;
return 0;
}
diff --git a/src/include/pc80/mc146818rtc.h b/src/include/pc80/mc146818rtc.h
index 3d65909faf..90ae7ae1d7 100644
--- a/src/include/pc80/mc146818rtc.h
+++ b/src/include/pc80/mc146818rtc.h
@@ -94,9 +94,6 @@
#define RTC_CLK_YEAR 9
#define RTC_CLK_ALTCENTURY 0x32
-#define RTC_HAS_ALTCENTURY 1
-#define RTC_HAS_NO_ALTCENTURY 0
-
/* On PCs, the checksum is built only over bytes 16..45 */
#define PC_CKS_RANGE_START 16
#define PC_CKS_RANGE_END 45
@@ -173,7 +170,7 @@ static inline void cmos_write32(u8 offset, u32 value)
#if !defined(__ROMCC__)
void cmos_init(int invalid);
-void cmos_check_update_date(u8 has_century);
+void cmos_check_update_date(void);
#if CONFIG_USE_OPTION_TABLE
enum cb_err set_option(const char *name, void *val);
enum cb_err get_option(void *dest, const char *name);
diff --git a/src/include/rtc.h b/src/include/rtc.h
index ed32b6993b..ba9a9c351d 100644
--- a/src/include/rtc.h
+++ b/src/include/rtc.h
@@ -31,7 +31,7 @@ struct rtc_time
int wday;
};
-int rtc_set(const struct rtc_time *time, u8 has_century);
-int rtc_get(struct rtc_time *time, u8 has_century);
+int rtc_set(const struct rtc_time *time);
+int rtc_get(struct rtc_time *time);
#endif /* _RTC_H_ */
diff --git a/src/southbridge/amd/agesa/hudson/lpc.c b/src/southbridge/amd/agesa/hudson/lpc.c
index 836966e293..b784fc40dc 100644
--- a/src/southbridge/amd/agesa/hudson/lpc.c
+++ b/src/southbridge/amd/agesa/hudson/lpc.c
@@ -71,7 +71,7 @@ static void lpc_init(device_t dev)
byte |= 1 << 0 | 1 << 3;
pci_write_config8(dev, 0xBB, byte);
- cmos_check_update_date(RTC_HAS_ALTCENTURY);
+ cmos_check_update_date();
/* Initialize the real time clock.
* The 0 argument tells cmos_init not to
diff --git a/src/southbridge/amd/cimx/sb700/late.c b/src/southbridge/amd/cimx/sb700/late.c
index 9c7048271c..3fa6940610 100644
--- a/src/southbridge/amd/cimx/sb700/late.c
+++ b/src/southbridge/amd/cimx/sb700/late.c
@@ -81,7 +81,7 @@ static void lpc_init(device_t dev)
{
printk(BIOS_DEBUG, "SB700 - Late.c - lpc_init - Start.\n");
- cmos_check_update_date(RTC_HAS_ALTCENTURY);
+ cmos_check_update_date();
/* Initialize the real time clock.
* The 0 argument tells cmos_init not to
diff --git a/src/southbridge/amd/cimx/sb800/late.c b/src/southbridge/amd/cimx/sb800/late.c
index 9c4047fd83..d7f22d32b5 100644
--- a/src/southbridge/amd/cimx/sb800/late.c
+++ b/src/southbridge/amd/cimx/sb800/late.c
@@ -132,7 +132,7 @@ static void lpc_init(device_t dev)
{
printk(BIOS_DEBUG, "SB800 - Late.c - lpc_init - Start.\n");
- cmos_check_update_date(RTC_HAS_ALTCENTURY);
+ cmos_check_update_date();
/* Initialize the real time clock.
* The 0 argument tells cmos_init not to
diff --git a/src/southbridge/amd/cimx/sb900/late.c b/src/southbridge/amd/cimx/sb900/late.c
index 6f6a5010bb..e9f5ad6229 100644
--- a/src/southbridge/amd/cimx/sb900/late.c
+++ b/src/southbridge/amd/cimx/sb900/late.c
@@ -103,7 +103,7 @@ static void lpc_init(device_t dev)
printk(BIOS_DEBUG, "SB900 - Late.c - lpc_init - Start.\n");
/* SB Configure HPET base and enable bit */
//- hpetInit(sb_config, &(sb_config->BuildParameters));
- cmos_check_update_date(RTC_HAS_ALTCENTURY);
+ cmos_check_update_date();
/* Initialize the real time clock.
* The 0 argument tells cmos_init not to
diff --git a/src/southbridge/amd/pi/avalon/lpc.c b/src/southbridge/amd/pi/avalon/lpc.c
index 1f60bc4ed9..7b54cc32fa 100644
--- a/src/southbridge/amd/pi/avalon/lpc.c
+++ b/src/southbridge/amd/pi/avalon/lpc.c
@@ -70,7 +70,7 @@ static void lpc_init(device_t dev)
byte |= 1 << 0 | 1 << 3;
pci_write_config8(dev, 0xBB, byte);
- cmos_check_update_date(RTC_HAS_ALTCENTURY);
+ cmos_check_update_date();
/* Initialize the real time clock.
* The 0 argument tells cmos_init not to
diff --git a/src/southbridge/amd/sb600/lpc.c b/src/southbridge/amd/sb600/lpc.c
index acee69dbae..dc2f31beb6 100644
--- a/src/southbridge/amd/sb600/lpc.c
+++ b/src/southbridge/amd/sb600/lpc.c
@@ -63,7 +63,7 @@ static void lpc_init(device_t dev)
byte &= ~(1 << 1);
pci_write_config8(dev, 0x78, byte);
- cmos_check_update_date(RTC_HAS_ALTCENTURY);
+ cmos_check_update_date();
}
static void sb600_lpc_read_resources(device_t dev)
diff --git a/src/southbridge/amd/sb700/lpc.c b/src/southbridge/amd/sb700/lpc.c
index 26478b7e0a..8ebc765c0b 100644
--- a/src/southbridge/amd/sb700/lpc.c
+++ b/src/southbridge/amd/sb700/lpc.c
@@ -90,7 +90,7 @@ static void lpc_init(device_t dev)
}
#endif
- cmos_check_update_date(RTC_HAS_ALTCENTURY);
+ cmos_check_update_date();
}
void backup_top_of_ram(uint64_t ramtop)
diff --git a/src/southbridge/amd/sb800/lpc.c b/src/southbridge/amd/sb800/lpc.c
index f862a97ea4..87c09a237e 100644
--- a/src/southbridge/amd/sb800/lpc.c
+++ b/src/southbridge/amd/sb800/lpc.c
@@ -74,7 +74,7 @@ static void lpc_init(device_t dev)
byte |= 1 << 0 | 1 << 3;
pci_write_config8(dev, 0xBB, byte);
- cmos_check_update_date(RTC_HAS_ALTCENTURY);
+ cmos_check_update_date();
}
static void sb800_lpc_read_resources(device_t dev)