Driver health : Posting message in MessageList


EDK
 

Hi ,

For our products, we have UEFI Driver and HII Driver as two separate images
(this is a requirement for our product because we want to keep UEFI Driver
as thin as possible).

- Main role of UEFI Driver is providing boot services, reporting/solving
health issues, posting messages in message list, EXT SPT etc.

FYI: UEFI Driver will install HII Config access protocol (*CAP*) and driver
health formset on the controller handle if the controller has health issue;
at this time, HII image won't be in picture (HII image come into play ONLY
when controller is healthy); if UEFI Driver detects controller is healthy
then it will not install HII Config access protocol (if it had installed,
it would uninstall before loading HII image from controller flash to host)

Note: We have our own API to load the HII Image from controller flash to
host

- Role of HII is, installing HII config access protocol and Management
formset on the controller handle and allowing the user to view
controller/PD/VD/other hardware properties, perform various
controller/PD/VD level operations etc.



Requirement (need to see whether this is feasible or not): There are cases
where our controller is healthy but we would like to post certain
informational messages in messageList.

How do I achieve this? That is I want UEFI Driver to have the capability to
post the message in messageList and our HII Image also to be
loaded/present.



Can UEFI Driver and HII driver install HII Config access protocol on the
same handle? AFAIK, the answer is “no”.

I experimented just adding the driver health formset to the package via the
HiiAddPackages() on the controller handle (that is from UEFI Driver I was
not installing HII CAP but just installed the formset on controller handle)
and it is not working. In this case HII image is also loaded (this means
HII image would have installed HII CAP and its own formset on the same
controller handle).



Appreciate your input.



Thanks,

Daniel

Backup:

*Excerpt from UEFI Spec: *

*MessageList *A pointer to an array of warning or error messages associ
ated with

the controller specified by *ControllerHandle *and *ChildHandle*.

This is an optional parameter that may be *NULL*. *M**essageList *is

allocated by this function with the EFI Boot Service

*AllocatePool()*, and it is the caller’s responsibility to free

*MessageList *with the EFI Boot Service *F**reePool()*. Each

message is specified by tuple of an *EFI_HII_HANDLE *and an

*EFI_STRING_ID*. The array of messages is terminated by tuple

containing a *EFI_HII_HANDLE *with a value of *NULL*. The

*EFI_HII_STRING_PROTOCOL.GetString() *function can be used

to retrieve the warning or error message as a Null-terminated string

in a specific language. Messages may be returned for any of the

*HealthStatus *values except

*EfiDriverHealthStatusReconnectRequired *and

*EfiDriverHealthStatusRebootRequired*.

*FormHiiHandle *A pointer to the HII handle containing the HII form used
when configuration is required. The HII handle is associated with the
controller specified by *ControllerHandle *and

*C**hildHandle*. If this is *N**ULL*, then no HII form is available. An HII
handle will only be returned with a *HealthStatus *value of

*E**fiDriverHealthStatusConfigurationRequired*.











If *MessageList *is not *NULL*, and *HealthStatu**s *is
*EfiDriverHealthStatusReconnectRequired
*or *EfiDriverHealthStatusRebootRequired *then no messages are
returned and **MessageList
*must be set to *NULL*.

If *MessageList *is not *NULL*, and there are no warning or error messages
associated with the controller specified by *ControllerHandle *and
*ChildHandle*, then **MessageList *must be set to *NULL*.

If *MessageList *is not *NULL*, and there are one or more warning or error
messages associated with the controller specified by *ControllerHandle *and
*ChildHandle*, then **MessageList *must point to a buffer allocated with
the EFI Boot Service *AllocatePool()*. The number of
*EFI_DRIVER_HEALTH_HII_MESSAGE
*structures allocated in the buffer must be one more than the total number
of warning or error messages, and the *HiiHandle *field of the last
*EFI_DRIVER_HEALTH_HII_MESSAGE
*structure must be set to *NULL *to terminate the list of messages. It is
the caller’s responsibility to free the buffer returned in **MessageList *using
the EFI Boot Service *FreePool()*. Each message is specified by an
*EFI_HII_HANDLE
*and an *EFI_STRING_ID*. The caller may use the
*EFI_HII_STRING_PROTOCOL.GetString()
*function to convert each message into a Null-terminated string that can
may be displayed on a console device.

If *FormHiiHandle *is *NULL*, then no forms are returned from this function.

If *FormHiiHandle *is not *NULL*, and *HealthStatus *is not
*EfiDriverHealthStatusConfigurationRequired*, then no forms are returned
and **FormHiiHandle *must be set to *NULL*.

If *FormHiiHandle *is not *NULL*, and *FormSetGuid *is not *NULL*, and
*HealthStatus
*is *EfiDriverHealthStatusConfigurationRequired*, then *FormHiiHandle *is
assigned to the HII handle which contains the HII form required to perform
the configuration operation.





*//********************************************************

*// EFI_DRIVER_HEALTH_HII_MESSAGE*

*//********************************************************

*typedef struct { EFI_HII_HANDLE **H**iiHandle**; **EF**I_STRING_ID **S*
*tringId**; **UI**NT64 **MessageCode;*

*} EFI_DRIVER_HEALTH_HII_MESSAGE;*

*HiiHandle *The *EFI_HII_HANDLE *that was returned by
*EFI_HII_DATABASE_PROTOCOL.NewPackageList()
*when the string pack containing StringId was registered with the HII Databa
se.

*StringId *The identifier for a single string token in the string
pack associated with *HiiHandle.*

*MessageCode *64-bit numeric value of the warning/error specified by
this message.

A value of *0x0000000000000000 *is used to indicate that

*MessageCode *is not specified.

The values *0**x0000000000000001 *to *0x0fffffffffffffff *are reserved for
allocation by the UEFI Specification.

The values *0**x1000000000000000 *to *0x1fffffffffffffff *are reserved for
IHV-developed drivers.

The values *0**x8000000000000000 *to *0x8fffffffffffffff *is reserved for
platform/OEM drivers.

All other values are reserved and should not be used.

Join discuss@edk2.groups.io to automatically receive all group messages.