From mboxrd@z Thu Jan 1 00:00:00 1970 Subject: Capsule update with USBIO in FmpDxe. To: devel@edk2.groups.io From: gordontcp@gmail.com X-Originating-Location: Hsinchu, TW (61.222.87.235) X-Originating-Platform: Windows Chrome 103 User-Agent: GROUPS.IO Web Poster MIME-Version: 1.0 Date: Tue, 26 Jul 2022 04:32:00 -0700 Message-ID: <4CaW.1658835120122756488.3x88@groups.io> Content-Type: multipart/alternative; boundary="jLsbGWuNcugz7AttrEgJ" --jLsbGWuNcugz7AttrEgJ Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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 librar= y to have control of the handle that the FMP instance is installed on. This al= lows 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 supp= orts 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 Proto= col // return EFI_UNSUPPORTED; } However, since the =E2=80=98RegisterFmpInstaller=E2=80=99 of the example di= rectly 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 'RegisterFmpIns= taller' function. And set the return value of RegisterFmpInstaller to EFI_S= UCCESS. where RegisterFmpInstaller is in the following file: edk2-platforms\Platform\Intel\Vlv2TbltDevicePkg\Feature\Capsule\Library\Fmp= DeviceLibSample Then tested on Minnowboard. Test command: CapsuleApp.efi Red.cap The test results are as follows: * During the Capsule update process, when FmpDeviceSetImageWithStatus is ex= ecuted, USBMouseAbsolutePointerDriverBindingSupported has not been executed= , that is, USB Device IO cannot be operated yet. * After USBMouseAbsolutePointerDriverBindingSupporte d is executed, USBIO c= an be operated, but at this time FmpDeviceSetImageWithStatus has been execu= ted, 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 USB= MouseAbsolutePointerDriverBindingSupported has not been executed. What shou= ld I do? * The parameter in RegisterFmpInstaller is the function pointer ' FMP_DEVIC= E_LIB_REGISTER_FMP_INSTALLER Func ', and how should the parameter Handle in= Func (ie InstallFmpInstance , see below) be passed from FmpDxe to FmpDevic= eLib ? Any suggestion is highly appreciated! Thanks! EFI_STATUS EFIAPI FmpDxeEntryPoint ( IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable ) { =E2=80=A6. Status =3D RegisterFmpInstaller(InstallFmpInstance); =E2=80=A6 } EFI_STATUS EFIAPI InstallFmpInstance ( IN EFI_HANDLE Handle ) {=E2=80=A6. } 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; } --jLsbGWuNcugz7AttrEgJ Content-Type: text/html; charset="utf-8" Content-Transfer-Encoding: quoted-printable
Hi all,
In \FmpDevicePkg\Library\FmpDeviceLibNull\FmpDeviceLib.c<=
/code>
There are comments for RegisterFmpInstaller:
<= code style=3D"font-family: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, = Consolas, 'Liberation Mono', monospace; font-size: 12px; margin: 0px; backg= round-image: initial; background-position: initial; background-size: initia= l; background-repeat: initial; background-attachment: initial; background-o= rigin: initial; background-clip: initial; border-radius: 6px; word-break: n= ormal; white-space: pre; border: 0px; display: inline; overflow: visible; l= ine-height: inherit; overflow-wrap: normal;">/** Used to pass the FMP install function to this lib. This allows the libra= ry to have control of the handle that the FMP instance is installed on. This a= llows the library to use DriverBinding protocol model to locate its device(s) i= n the system. @param[in] Func Function pointer to FMP install function. @retval EFI_SUCCESS Library has saved function pointer and will cal= l function pointer on each DriverBinding Start. @retval EFI_UNSUPPORTED Library doesn't use driver binding and only sup= ports 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 Prot= ocol // return EFI_UNSUPPORTED; }
However, since the ‘Registe=
rFmpInstaller’ of the example directly returns EFI_UNSUPPORTED
, it does not demonstrate how to handl=
e the DriverBinding protocol.
In addition, I refer to
the =
example of \MdeModulePkg\Bus\Usb\UsbMo=
useAbsolutePointerDxe
adding the driverbinding protocol to loca=
te the USBMouse device to the 'RegisterFmpInstaller' function. And set the =
return value of RegisterFmpInstaller to EFI_SUCCESS
.
where RegisterFmpInstaller is in the following f=
ile:edk2-platforms\Platform\Intel\Vlv=
2TbltDevicePkg\Feature\Capsule\Library\FmpDeviceLibSample
Then =
tested on Minnowboard.
Test command: CapsuleApp.efi Red.cap
The test results are as follows:
FmpDeviceSetImageWithStatus
i=
s executed, USBMouseAbsolutePointerDri=
verBindingSupported
has not been executed, that is, USB Device =
IO cannot be operated yet.USBMouseAbsolutePointerDriverBindingSupporte
d i=
s executed, USBIO can be operated, but at this time FmpDeviceSetImageWithStatus
has been executed, th=
at is, capsule update is too late to process.My questions are as follows:
F=
MP_DEVICE_LIB_REGISTER_FMP_INSTALLER Func
', and how should the param=
eter Handle
in Func
(ie InstallFmpInstance
, see below) be passed from FmpDxe
to FmpDeviceLib
?<= code style=3D"font-family: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, = Consolas, 'Liberation Mono', monospace; font-size: 12px; margin: 0px; backg= round-image: initial; background-position: initial; background-size: initia= l; background-repeat: initial; background-attachment: initial; background-o= rigin: initial; background-clip: initial; border-radius: 6px; word-break: n= ormal; white-space: pre; border: 0px; display: inline; overflow: visible; l= ine-height: inherit; overflow-wrap: normal;">EFI_STATUS EFIAPI FmpDxeEntryPoint ( IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable ) { …. Status =3D 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; }