Skip to content

Conversation

@sathishas89
Copy link
Contributor

Update RuntimePropertiesTable test to validate runtime service support based on actual return status, treating EFI_UNSUPPORTED as not supported.

STATIC
EFI_STATUS
CallRuntimeService (
IN UINT32 RTServiceFlag
Copy link

@vstehle vstehle Feb 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I find the "Flag" in the name misleading as this looks more like a "choice" or a "type" or a "selection".

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

return gtRT->QueryCapsuleCapabilities (NULL, 0, &MaxCapsuleSize, &ResetType);
}

case EFI_RT_SUPPORTED_UPDATE_CAPSULE: {
Copy link

@vstehle vstehle Feb 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit-picking: you do not need the braces "{ ... }" here.
(And below.)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

// ResetSystem is platform-handled and would reset the system, so we don't
// actually call it here. Treat this test as UNSUPPORTED.
//
return EFI_UNSUPPORTED;
Copy link

@vstehle vstehle Feb 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we not rather return another error code instead, different from EFI_UNSUPPORTED?
EFI_INVALID_PARAMETER maybe?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

VOID *Function = RuntimeServices[Index].Function;
if (Function != NULL) {
if ((RtPropertiesTable->RuntimeServicesSupported & Flag) == 0) { // marked as unsupported
Status = CallRuntimeService (Flag);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is where we should avoid calling ResetSystem().

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

@@ -733,17 +732,186 @@ CheckRuntimeServices (
return EFI_SUCCESS;
}

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should document that CallRuntimeService() will refuse to call ResetSystem() for now.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

@sathishas89 sathishas89 force-pushed the EFI_Runtime_Properties_Table_Issue branch from e71ac43 to 5fd6ce5 Compare February 9, 2026 04:16
Copy link
Contributor Author

@sathishas89 sathishas89 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed the given comments by @vstehle .

@vstehle
Copy link

vstehle commented Feb 9, 2026

Thanks @sathishas89.

Copy link
Contributor

@sunnywang-arm sunnywang-arm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for addressing Ehdaya and my offline comments, @sathishas89.
Just few more minor comments. Otherwise, it looks good to me.

if (!EFI_ERROR(Status)) {
// supported
} else {
bUnsupportedRuntimeServiceFound = TRUE;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we print message to indicate which runtime service unexpectly return unsupported?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see the fix in this commit. Could you check?

bUnsupportedRuntimeServiceFound = TRUE;
}
} else {
bUnsupportedRuntimeServiceFound = TRUE;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we print message to indicate which runtime service pointer is unexpectly NULL?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see the fix in this commit. Could you check?

{
switch (RTServiceType) {
case EFI_RT_SUPPORTED_GET_TIME: {
EFI_TIME Time;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Per edk2 coding formatting and its based C coding standard C95, could you move all variable declarations after code statements to the top of function (before code statements)?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

@sathishas89 sathishas89 force-pushed the EFI_Runtime_Properties_Table_Issue branch from 5fd6ce5 to 04f1f5f Compare February 10, 2026 10:34
Copy link
Contributor Author

@sathishas89 sathishas89 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed the given comments @sunnywang-arm .

// SetVirtualAddressMap should not be called during boot services.
// Return the status as-is to detect if the service is present.
//
return gtRT->SetVirtualAddressMap (0, 0, 0, NULL);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment is confusing. We should not call SetVirtualAddressMap here, right? Move this to the block of line 1002?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

// Return the status as-is to detect if the service is present.
//
Pointer = NULL;
return gtRT->ConvertPointer (0, &Pointer);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment is confusing. We should not call ConvertPointer here, right? Move this check to the block of line 1002?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

if (!EFI_ERROR(Status)) {
// supported
} else {
bUnsupportedRuntimeServiceFound = TRUE;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see the fix in this commit. Could you check?

bUnsupportedRuntimeServiceFound = TRUE;
}
} else {
bUnsupportedRuntimeServiceFound = TRUE;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see the fix in this commit. Could you check?

case EFI_RT_SUPPORTED_GET_TIME:
return gtRT->GetTime (&Time, &Cap);

case EFI_RT_SUPPORTED_SET_TIME: {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've never seen the use of braces like this in a case statement and I don't see an EDKII Coding Standard rule about using it in this kind of context.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed braces as per EDKII guidelines.

Update RuntimePropertiesTable test to validate runtime service support
based on actual return status, treating EFI_UNSUPPORTED as not supported.

Signed-off-by: Sathisha S <[email protected]>
@sathishas89 sathishas89 force-pushed the EFI_Runtime_Properties_Table_Issue branch from 04f1f5f to 65187c9 Compare February 12, 2026 10:48
Copy link
Contributor Author

@sathishas89 sathishas89 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed the comments, Please check.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants