HI Ray, RtcTimeFieldsValid() cannot catch this error because ConvertRtcTimeToEfiTime() made the wrong year, but it is still in the range. ConvertRtcTimeToEfiTime() made 2099 become 1999. 1999 is still valid in RtcTimeFieldsValid().
I understand the risk of using CMOS century value. And there is also a Y2K patch. The limitation is very minor. I am going to close the HSD. Regards Kai Yau -----Original Message----- From: Ni, Ray <ray...@intel.com> Sent: Thursday, May 14, 2020 3:09 AM To: Zhao, Lijian <lijian.z...@intel.com>; Yau, KaiX <kaix....@intel.com>; devel@edk2.groups.io; kai...@gmail.com Cc: Jiang, Guomin <guomin.ji...@intel.com>; Gao, Liming <liming....@intel.com>; Archield, Ralphal <ralphal.archi...@intel.com> Subject: RE: [edk2-devel] [PATCH] PcAtChipsetPkg: Wrong System YEAR displayed in SETUP Lijian, Yeah. I might learn the CMOS/RTC from the same page you shared when I create the two PCDs and the accordingly logic. Just guess as what the page says. I double checked the existing code. RtcTimeFieldsValid() contains logic to check all date/time value read from RTC HW and PcRtcInit() re-inits the RTC HW if date/time in HW is invalid. Thanks, Ray > -----Original Message----- > From: Zhao, Lijian <lijian.z...@intel.com> > Sent: Thursday, May 14, 2020 1:56 PM > To: Ni, Ray <ray...@intel.com>; Yau, KaiX <kaix....@intel.com>; > devel@edk2.groups.io; kai...@gmail.com > Cc: Jiang, Guomin <guomin.ji...@intel.com>; Gao, Liming > <liming....@intel.com>; Archield, Ralphal <ralphal.archi...@intel.com> > Subject: RE: [edk2-devel] [PATCH] PcAtChipsetPkg: Wrong System YEAR > displayed in SETUP > > https://wiki.osdev.org/CMOS#Century_Register > > Yes that's not fixed or defined in original IBM standard > > -----Original Message----- > From: Ni, Ray <ray...@intel.com> > Sent: Thursday, May 14, 2020 1:38 PM > To: Yau, KaiX <kaix....@intel.com>; devel@edk2.groups.io; > kai...@gmail.com > Cc: Jiang, Guomin <guomin.ji...@intel.com>; Gao, Liming > <liming....@intel.com>; Archield, Ralphal > <ralphal.archi...@intel.com>; Zhao, Lijian <lijian.z...@intel.com> > Subject: RE: [edk2-devel] [PATCH] PcAtChipsetPkg: Wrong System YEAR > displayed in SETUP > > Kai, > Thanks for telling me the commit message can help understand. > > RTC HW updates the year/month/day/hour/minute/second every second. > But the year stored in RTC is only the last two digits of the 4-digit year. > > Storing the century (high 2 digits) in CMOS is a choice of platform > implementation and cannot work for all the cases. > > Supposing now we are in the last second of 2099, RTC HW updates the > value in RTC to 00(year)/1(month)/1(day)/0(hour)/0(minute)/0(second). > But it doesn't update the century value in CMOS leaving that value 20. > Then the time will be interpreted as 2000/1/1/0/0/0. > > That's why RTC driver only updates the century in CMOS when platform > reports the century location through the FADT table. Please understand RTC > driver updates it because platform requires it (through reporting CMOS > location in FADT.). > > Please also try to understand that the location of century in CMOS is > platform dependent. > There is no standard to define location for all x86 systems. > > Thanks, > Ray > > > -----Original Message----- > > From: Yau, KaiX <kaix....@intel.com> > > Sent: Thursday, May 14, 2020 11:36 AM > > To: Ni, Ray <ray...@intel.com>; devel@edk2.groups.io; > > kai...@gmail.com > > Cc: Jiang, Guomin <guomin.ji...@intel.com>; Gao, Liming > > <liming....@intel.com>; Archield, Ralphal > > <ralphal.archi...@intel.com>; Zhao, Lijian <lijian.z...@intel.com> > > Subject: RE: [edk2-devel] [PATCH] PcAtChipsetPkg: Wrong System YEAR > > displayed in SETUP > > > > Hi Ray, > > > > I read your comment from gitk. > > I understand why you changed them to 1998 and 2097. > > > > May I know why we don't read the Century value from CMOS in the beginning? > > Some boards does not support? Or the RTC address may be different for > > different boards? > > > > Regards > > Kai Yau > > > > -----Original Message----- > > From: Ni, Ray <ray...@intel.com> > > Sent: Wednesday, May 13, 2020 10:55 PM > > To: Yau, KaiX <kaix....@intel.com>; devel@edk2.groups.io; > > kai...@gmail.com > > Cc: Jiang, Guomin <guomin.ji...@intel.com>; Gao, Liming > > <liming....@intel.com>; Archield, Ralphal > > <ralphal.archi...@intel.com>; Zhao, Lijian <lijian.z...@intel.com> > > Subject: RE: [edk2-devel] [PATCH] PcAtChipsetPkg: Wrong System YEAR > > displayed in SETUP > > > > Kai, > > I created the initial design and made the initial change: using the two PCD > > to help code decide the correct century value. > > More comments below. > > > > > -----Original Message----- > > > From: Yau, KaiX <kaix....@intel.com> > > > Sent: Thursday, May 14, 2020 1:14 AM > > > To: Ni, Ray <ray...@intel.com>; devel@edk2.groups.io; > > > kai...@gmail.com > > > Cc: Jiang, Guomin <guomin.ji...@intel.com>; Gao, Liming > > > <liming....@intel.com>; Archield, Ralphal > > > <ralphal.archi...@intel.com>; Zhao, Lijian <lijian.z...@intel.com> > > > Subject: RE: [edk2-devel] [PATCH] PcAtChipsetPkg: Wrong System > > > YEAR displayed in SETUP > > > > > > Hi, > > > > > > The current logic has two limitations: > > > 1. it has to be 100 years apart (already mentioned in DEC file) > > I agree it's a limitation. I don't want to solve this limitation with > > current RTC HW. > > > > > 2. the century numbers have to be same in order to work. (19XX, > > > 20XX will not work) (20xx, 21xx will not work) Since now is 2020, > > > the value has to be 2000, 2099. But BIOS developers does not > > know this limitation. > > I don't agree. Let's forget other argue points and just focus on this point. > > Can you please explain why with the PCD value (1998,2097) cannot support > > this year 2020? > > -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#59676): https://edk2.groups.io/g/devel/message/59676 Mute This Topic: https://groups.io/mt/72484290/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-