-
Notifications
You must be signed in to change notification settings - Fork 108
UEFI SCT: Improve runtime services support detection #316
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
UEFI SCT: Improve runtime services support detection #316
Conversation
| STATIC | ||
| EFI_STATUS | ||
| CallRuntimeService ( | ||
| IN UINT32 RTServiceFlag |
There was a problem hiding this comment.
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".
There was a problem hiding this comment.
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: { |
There was a problem hiding this comment.
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.)
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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().
There was a problem hiding this comment.
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; | |||
| } | |||
|
|
|||
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
e71ac43 to
5fd6ce5
Compare
sathishas89
left a comment
There was a problem hiding this 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 .
|
Thanks @sathishas89. |
sunnywang-arm
left a comment
There was a problem hiding this 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; |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
5fd6ce5 to
04f1f5f
Compare
sathishas89
left a comment
There was a problem hiding this 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); |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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: { |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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]>
04f1f5f to
65187c9
Compare
sathishas89
left a comment
There was a problem hiding this 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.
Update RuntimePropertiesTable test to validate runtime service support based on actual return status, treating EFI_UNSUPPORTED as not supported.