public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Yau, KaiX" <kaix.yau@intel.com>
To: "Ni, Ray" <ray.ni@intel.com>,
	"Zhao, Lijian" <lijian.zhao@intel.com>,
	"devel@edk2.groups.io" <devel@edk2.groups.io>,
	"kaiyau@gmail.com" <kaiyau@gmail.com>
Cc: "Jiang, Guomin" <guomin.jiang@intel.com>,
	"Gao, Liming" <liming.gao@intel.com>,
	"Archield, Ralphal" <ralphal.archield@intel.com>
Subject: Re: [edk2-devel] [PATCH] PcAtChipsetPkg: Wrong System YEAR displayed in SETUP
Date: Thu, 14 May 2020 15:11:00 +0000	[thread overview]
Message-ID: <863273f6f51647388e503bb6533dba17@intel.com> (raw)
In-Reply-To: <734D49CCEBEEF84792F5B80ED585239D5C54E1E6@SHSMSX104.ccr.corp.intel.com>

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.ni@intel.com> 
Sent: Thursday, May 14, 2020 3:09 AM
To: Zhao, Lijian <lijian.zhao@intel.com>; Yau, KaiX <kaix.yau@intel.com>; devel@edk2.groups.io; kaiyau@gmail.com
Cc: Jiang, Guomin <guomin.jiang@intel.com>; Gao, Liming <liming.gao@intel.com>; Archield, Ralphal <ralphal.archield@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.zhao@intel.com>
> Sent: Thursday, May 14, 2020 1:56 PM
> To: Ni, Ray <ray.ni@intel.com>; Yau, KaiX <kaix.yau@intel.com>; 
> devel@edk2.groups.io; kaiyau@gmail.com
> Cc: Jiang, Guomin <guomin.jiang@intel.com>; Gao, Liming 
> <liming.gao@intel.com>; Archield, Ralphal <ralphal.archield@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.ni@intel.com>
> Sent: Thursday, May 14, 2020 1:38 PM
> To: Yau, KaiX <kaix.yau@intel.com>; devel@edk2.groups.io; 
> kaiyau@gmail.com
> Cc: Jiang, Guomin <guomin.jiang@intel.com>; Gao, Liming 
> <liming.gao@intel.com>; Archield, Ralphal 
> <ralphal.archield@intel.com>; Zhao, Lijian <lijian.zhao@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.yau@intel.com>
> > Sent: Thursday, May 14, 2020 11:36 AM
> > To: Ni, Ray <ray.ni@intel.com>; devel@edk2.groups.io; 
> > kaiyau@gmail.com
> > Cc: Jiang, Guomin <guomin.jiang@intel.com>; Gao, Liming 
> > <liming.gao@intel.com>; Archield, Ralphal 
> > <ralphal.archield@intel.com>; Zhao, Lijian <lijian.zhao@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.ni@intel.com>
> > Sent: Wednesday, May 13, 2020 10:55 PM
> > To: Yau, KaiX <kaix.yau@intel.com>; devel@edk2.groups.io; 
> > kaiyau@gmail.com
> > Cc: Jiang, Guomin <guomin.jiang@intel.com>; Gao, Liming 
> > <liming.gao@intel.com>; Archield, Ralphal 
> > <ralphal.archield@intel.com>; Zhao, Lijian <lijian.zhao@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.yau@intel.com>
> > > Sent: Thursday, May 14, 2020 1:14 AM
> > > To: Ni, Ray <ray.ni@intel.com>; devel@edk2.groups.io; 
> > > kaiyau@gmail.com
> > > Cc: Jiang, Guomin <guomin.jiang@intel.com>; Gao, Liming 
> > > <liming.gao@intel.com>; Archield, Ralphal 
> > > <ralphal.archield@intel.com>; Zhao, Lijian <lijian.zhao@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?
> 
> 


      reply	other threads:[~2020-05-14 15:15 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-20  3:42 [PATCH] PcAtChipsetPkg: Wrong System YEAR displayed in SETUP Yau
2020-03-27  5:15 ` [edk2-devel] " Guomin Jiang
2020-04-27  4:53 ` Ni, Ray
2020-04-27  5:47   ` Yau, KaiX
2020-05-12  1:52     ` Ni, Ray
2020-05-12  2:01       ` Yau, KaiX
2020-05-12  5:41         ` Ni, Ray
2020-05-12  5:51           ` Yau, KaiX
2020-05-13  3:27             ` Ni, Ray
2020-05-13  3:36               ` Yau, KaiX
2020-05-13  4:45                 ` Ni, Ray
2020-05-13  5:45                   ` Yau, KaiX
2020-05-13  9:02                     ` Ni, Ray
2020-05-13 17:13                       ` Yau, KaiX
2020-05-14  2:54                         ` Ni, Ray
2020-05-14  3:35                           ` Yau, KaiX
2020-05-14  5:38                             ` Ni, Ray
     [not found]                               ` <DM6PR11MB3817DAEAB31E0676CF6E41F6F4BC0@DM6PR11MB3817.namprd11.prod.outlook.com>
2020-05-14  7:09                                 ` Ni, Ray
2020-05-14 15:11                                   ` Yau, KaiX [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=863273f6f51647388e503bb6533dba17@intel.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox