Re: OptionROM driver update failing in UEFI 2.4 but works on UEFI 2.3.1


Andrew Fish <afish@...>
 



On Aug 3, 2020, at 8:58 AM, udai sharma <udai16787@...> wrote:

Hi Andrew, Laszlo, Tomas,
Thanks for your comments. 

I wrote a simple Test optiom Driver [Attached init.c] to verify the unload part, with minimum protocol 
install for a UEFI PCI BUS driver.

From shell I loaded the ROM using 'loadpcirom TestDxeAA.rom' and then 'unload '. I saw it seem 
to work. 
So I created two ROM versions, 0xAA and 0xBB. I updated the 'TestDxeAA.rom' in the option rom of the 
two PCI devices present in my system. At bootup I see DriverStart getting called, just fine. From 
Shell, I see the 'dh ' dumping proper data. 
Then I tried 'loadpcirom TestDxeBB.rom' to update existing driver, I see a hang again. I did capture 
everything [Attached TestROM.log]. 
In 2.3.1 based system I see it works fine but the similar procedure doesn't work in 2.4 system.
It ASSERT's with "Status = UNSUPPORTED" in 2.4.  

So gBS->UnloadImage() is returning EFI_UNSUPPORTED. Per the UEFI Spec that implies that driver did not register an unload function. Unload functions are not required. 

Thanks,

Andrew Fish


Thanks in advance.


On Thu, 30 Jul 2020 21:11:55 +0530 Andrew Fish wrote
>



> On Jul 30, 2020, at 5:23 AM, Laszlo Ersek wrote:

> 

> +Andrew:

> 

> On 07/27/20 11:57, UdayS via groups.io wrote:

>> Hi All,

>> SW Revision updates to my Option Rom/Driver is handled properly during the EntryPoint i.e., using 
component name to get the revision info and if existing version is older than current, then 
UninstallMultipleProtocolInterfaces and unloadImage. 



What protocols are being uninstalled, and what driver is being unloaded? If you return an error from 
your driver it will get unloaded. 



I don’t understand the combination of gBS->UnloadIMage() and UninstallMultipleProtocolInterfaces()? The 
unload function in the driver should do all the work? You would use 
UninstallMultipleProtocolInterfaces() on your protocols prior to error exiting. If you driver returns 
an error it gets unloaded. 



Maybe there is a bug in the Unload function. Is the Unload function disconnecting other drivers off its 
handle properly? 



>> This seem to work in UEFI 2.3.1 but when I test the same SW in UEFI 2.4 based system, it goes for a 
hang.

>> I have been banging my around this for last couple for days and now I am in need of some expert 
advice.

>> All suggestions are welcome..

> 

> Andrew, do you recall changes related to driver dispatch between 2.3.1

> and 2.4? Not necessarily in the spec, but maybe in edk2.

> 



I don’t recall any changes in spec or edk2. 



Thanks,



Andrew Fish



> Thanks

> Laszlo

> 

<TestRom.log><Init.c>

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