On Thu, Apr 19, 2018 at 12:33:50PM +0000, Meenakshi Aggarwal wrote:
> > > +EFI_STATUS
> > > +EFIAPI
> > > +LibSetTime (
> > > +  IN EFI_TIME                *Time
> > > +  )
> > > +{
> > > +  UINT8           Buffer[8];
> > > +  UINT8           Index;
> > > +  EFI_STATUS      Status;
> > > +  RTC_I2C_REQUEST Req;
> > > +  UINT8           RtcRegAddr;
> > > +
> > > +  Index = 0;
> > > +  Status = EFI_SUCCESS;
> > > +  RtcRegAddr = PCF2129_CTRL1_REG_ADDR;
> > > +
> > > +  if (mI2cMaster == NULL) {
> > > +    return EFI_DEVICE_ERROR;
> > > +  }
> > > +
> > > +  // start register address
> > > +  Buffer[Index++] = PCF2129_SEC_REG_ADDR;
> > > +
> > > +  // hours, minutes and seconds
> > > +  Buffer[Index++] = DecimalToBcd8 (Time->Second);
> > > +  Buffer[Index++] = DecimalToBcd8 (Time->Minute);
> > > +  Buffer[Index++] = DecimalToBcd8 (Time->Hour);
> > > +  Buffer[Index++] = DecimalToBcd8 (Time->Day);
> > > +  Buffer[Index++] = EfiTimeToWday (Time) & 0x07;
> > 
> > Why mask at the call site?
> > 
> In GetTime function, data is been read from RTC device so we need to
> mask the unnecessary bits
> [as described in RTC registers] while
> In SetTime, we are receiving the appropriate buffer so no need to
> mask the data.

But EfiTimeToWday returns an integer in the range 0-6:
  return (EpochDays + 4) % 7;

Anding the result of that with 0x7 has no effect.

/
    Leif
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to