public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* Capsule update with USBIO in FmpDxe.
@ 2022-07-26 11:32 gordontcp
  0 siblings, 0 replies; 2+ messages in thread
From: gordontcp @ 2022-07-26 11:32 UTC (permalink / raw)
  To: devel

[-- Attachment #1: Type: text/plain, Size: 3155 bytes --]

Hi all,
In \FmpDevicePkg\Library\FmpDeviceLibNull\FmpDeviceLib.c
There are comments for RegisterFmpInstaller:

/**
 Used to pass the FMP install function to this lib.  This allows the library to
 have control of the handle that the FMP instance is installed on.  This allows
 the library to use DriverBinding protocol model to locate its device(s) in the
 system.

 @param[in] Func  Function pointer to FMP install function.

 @retval EFI_SUCCESS       Library has saved function pointer and will call
                           function pointer on each DriverBinding Start.
 @retval EFI_UNSUPPORTED   Library doesn't use driver binding and only supports
                           a single instance.
 @retval other error       Error occurred.  Don't install FMP

**/
EFI_STATUS
EFIAPI
RegisterFmpInstaller (
 IN FMP_DEVICE_LIB_REGISTER_FMP_INSTALLER Func
 )
{
 //
 // This is a system firmware update that does not use Driver Binding Protocol
 //
 return EFI_UNSUPPORTED;
}

However, since the ‘RegisterFmpInstaller’ of the example directly returns EFI_UNSUPPORTED , it does not demonstrate how to handle the DriverBinding protocol.

In addition, I refer to
the example of \MdeModulePkg\Bus\Usb\UsbMouseAbsolutePointerDxe adding the driverbinding protocol to locate the USBMouse device to the 'RegisterFmpInstaller' function. And set the return value of RegisterFmpInstaller to EFI_SUCCESS.
where RegisterFmpInstaller is in the following file:
edk2-platforms\Platform\Intel\Vlv2TbltDevicePkg\Feature\Capsule\Library\FmpDeviceLibSample
Then tested on Minnowboard.
Test command: CapsuleApp.efi Red.cap
The test results are as follows:

* During the Capsule update process, when FmpDeviceSetImageWithStatus is executed, USBMouseAbsolutePointerDriverBindingSupported has not been executed, that is, USB Device IO cannot be operated yet.
* After USBMouseAbsolutePointerDriverBindingSupporte d is executed, USBIO can be operated, but at this time FmpDeviceSetImageWithStatus has been executed, that is, capsule update is too late to process.

My questions are as follows:

* Is there an example of how RegisterFmpInstaller handles the driverbinding protocol?
* When processing the Capsule update (FmpDeviceSetImageWithStatus), the USBMouseAbsolutePointerDriverBindingSupported has not been executed. What should I do?
* The parameter in RegisterFmpInstaller is the function pointer ' FMP_DEVICE_LIB_REGISTER_FMP_INSTALLER Func ', and how should the parameter Handle in Func (ie InstallFmpInstance , see below) be passed from FmpDxe to FmpDeviceLib ?
Any suggestion is highly appreciated!
Thanks!

EFI_STATUS
EFIAPI
FmpDxeEntryPoint (
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
)
{
….
Status = RegisterFmpInstaller(InstallFmpInstance);
…
}
EFI_STATUS
EFIAPI
InstallFmpInstance (
IN EFI_HANDLE Handle
)
{….
}
EFI_STATUS
EFIAPI
RegisterFmpInstaller(
IN FMP_DEVICE_LIB_REGISTER_FMP_INSTALLER Func
)
{
// Because this is a sample lib with very simple fake device we don't use
// the driverbinding protocol to locate our device.
//
return EFI_UNSUPPORTED;
}

[-- Attachment #2: Type: text/html, Size: 11172 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread
* Capsule update with USBIO in FmpDxe
@ 2022-07-29  3:28 gordontcp
  0 siblings, 0 replies; 2+ messages in thread
From: gordontcp @ 2022-07-29  3:28 UTC (permalink / raw)
  To: devel

[-- Attachment #1: Type: text/plain, Size: 3180 bytes --]

In \FmpDevicePkg\Library\FmpDeviceLibNull\FmpDeviceLib.c There are comments for RegisterFmpInstaller:

/**
 Used to pass the FMP install function to this lib.  This allows the library to
 have control of the handle that the FMP instance is installed on.  This allows
 the library to use DriverBinding protocol model to locate its device(s) in the
 system.

 @param[in] Func  Function pointer to FMP install function.

 @retval EFI_SUCCESS       Library has saved function pointer and will call
                           function pointer on each DriverBinding Start.
 @retval EFI_UNSUPPORTED   Library doesn't use driver binding and only supports
                           a single instance.
 @retval other error       Error occurred.  Don't install FMP

**/
EFI_STATUS
EFIAPI
RegisterFmpInstaller (
 IN FMP_DEVICE_LIB_REGISTER_FMP_INSTALLER Func
 )
{
 //
 // This is a system firmware update that does not use Driver Binding Protocol
 //
 return EFI_UNSUPPORTED;
}

However, since the ‘RegisterFmpInstaller’ of the example directly returns EFI_UNSUPPORTED , it does not demonstrate how to handle the DriverBinding protocol. In addition, I refer to the example of \MdeModulePkg\Bus\Usb\UsbMouseAbsolutePointerDxe adding the driverbinding protocol to locate the USBMouse device to the 'RegisterFmpInstaller' function. And set the return value of RegisterFmpInstaller to EFI_SUCCESS. where RegisterFmpInstaller is in the following file:

edk2-platforms\Platform\Intel\Vlv2TbltDevicePkg\Feature\Capsule\Library\FmpDeviceLibSample

Then tested on Minnowboard.

Test command: CapsuleApp.efi Red.cap

The test results are as follows:

* 

During the Capsule update process, when FmpDeviceSetImageWithStatus is executed, ‘USBMouseAbsolutePointerDriverBindingSupported' has not been executed, that is, USB Device IO cannot be operated yet.

* 

After USBMouseAbsolutePointerDriverBindingSupported is executed, USBIO can be operated, but at this time 'FmpDeviceSetImageWithStatus' has been executed, that is, capsule update time has passed and cannot be processed.

* 

I also refer to the method of Locate spiFlash protocol in ‘PlatformFlashAccessLib.c’, instead of using DriverBinding model, I directly Locate USBIo Protocol, which is written as follows:

Status = gBS->LocateProtocol(&gEfiUsbIoProtocolGuid, NULL, (VOID**)&gUsbIOWDT);

But the returned value is Status: EFI_NOT_FOUND. The file full path is as follows:

\edk2-platforms\Platform\Intel\Vlv2TbltDevicePkg\Feature\Capsule\Library\PlatformFlashAccessLib\PlatformFlashAccessLib.c

My questions are as follows:

* To operate USB Io in FMPDxe driver, should I use driverbinding protocol in RegisterFmpInstaller? Or can use LocateProtocol directly? Or is there any other way to handle it?
* Are there example codes of how RegisterFmpInstaller handles the driverbinding protocol or other method such as LocateProtocol?
* When processing the Capsule update (FmpDeviceSetImageWithStatus), the USBMouseAbsolutePointerDriverBindingSupported has not been executed. How should I deal with it?

Any suggestion is highly appreciated.

Thanks!

Best Regards,

[-- Attachment #2: Type: text/html, Size: 15490 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-07-29  3:28 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-07-26 11:32 Capsule update with USBIO in FmpDxe gordontcp
  -- strict thread matches above, loose matches on Subject: below --
2022-07-29  3:28 gordontcp

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox