ARM-software / arm-enterprise-acs

ARM Enterprise ACS
Apache License 2.0
42 stars 48 forks source link

SetWakeupTime_Func problematic time format #90

Closed wojtas-marcin closed 3 years ago

wojtas-marcin commented 3 years ago

Hi, I am facing an issue with SetWakeupTime_Func, which afaik seems to be present like forever (I played with early versions of ACS in 2018).

  1. The test output looks following:

    Remaining test cases: 74
    Runtime services test: SetWakeupTime_Func
    Iterations: 1/1
    ASSERT [RealTimeClock] /home/mw/git/edk2-workspace/edk2/EmbeddedPkg/Library/TimeBaseLib/TimeBaseLib.c(94): JulianDate >= 2440588
  2. The assert is hit in generic EfiTimeToEpoch code:

    EFI_STATUS
    EFIAPI
    LibSetWakeupTime (
    IN BOOLEAN      Enabled,
    OUT EFI_TIME    *Time
    )
    {
    UINTN       WakeupSeconds;
    
    // Convert time to raw seconds
    WakeupSeconds = EfiTimeToEpoch (Time);
    if (WakeupSeconds > MAX_UINT32) {
    return EFI_INVALID_PARAMETER;
    }
  3. All other platforms in Tianocore edk2/edk2-platforms return EFI_UNSUPPORTED in LibSetWakeupTime/LibGetWakeupTime so nothing to compare to.

  4. From assert we can see the time passed is lower than 1.1.1970 -> does it mean the test passes a relative time? If yes, is that correct (UEFI spec 2.8, chapter 8.3 does not clarify it)? In such case the HW that uses counters with Unix Epoch format won't be able to use EfiTime Epoch helpers from generic edk2 code, but do the arithmetic on its own (FYI, when implementing I tested wakeup callbacks from Linux and afair it worked fine...).

Thanks, Marcin

edhay commented 3 years ago

Hi Marcin,

For your question: "From assert we can see the time passed is lower than 1.1.1970 -> does it mean the test passes a relative time? " Analysis: SCT test code is doing a SetWakeupTime for 1 hour later from the currennt time. The time passed indeed may be before of 1.1.1970 and not be relative time.

This may be a case of true failure. Can we get the complete logs of your test for further analysis? Does SetTime() and GetTime() tests pass?

--Enterprise ACS Support

wojtas-marcin commented 3 years ago

Thanks. I managed to reimplement the RTC routines, so that all UEFI SCT tests pass clean.

edhay commented 3 years ago

Thank you for the update.