Andrew, Thanks for the suggestion. In my boot services driver, I made a restriction of one-to-one association between controller and driver, to accomplish that, if the driver is loaded from non media devicepath, then I check RomSize to determine whether driver is loaded from the card which got dispatched to the driver, if RomSize is 0 then I assume the card doesn’t have a driver flashed in it and return failure for binding.support. If the driver is loaded from media (for the case of no driver flashed in the card but the user loads it from shell for some test purpose) then I always allow the first controller dispatched to it, so that multiple loads from shell can manage multiple controllers.
Recently I see that got broke with certain system BIOS and when I root cause why always the first controller is managed by the driver, I found out about the devicepath change. Thanks Sathya From: Andrew Fish [mailto:[email protected]] Sent: Friday, December 05, 2014 10:10 AM To: [email protected] Subject: Re: [edk2] DevicePath for the Boot Services Driver flashed on the Controller Flash. On Dec 5, 2014, at 7:18 AM, Sathya Prakash <[email protected]> wrote: I have a boot services driver programmed on the flash of our add-on controller, when the BSD gets executed from flash, I am trying to identify form where it is loaded (from flash/shell) and for that I have used the below condition and if it is met, Why do you need to know? I assume it is loaded from Shell, if not I assume it loaded from Flash. Is there anything wrong in that, in certain system BIOS implementation even for drivers loaded from flash, the devicepath is set as FILEPATH. Any help on this? The edk2 PCI Bus driver does this. https://svn.code.sf.net/p/edk2/code/trunk/edk2/MdeModulePkg/Bus/Pci/PciBus Dxe/PciOptionRomSupport.c // // Create Pci Option Rom Image device path header // EfiOpRomImageNode.Header.Type = MEDIA_DEVICE_PATH; EfiOpRomImageNode.Header.SubType = MEDIA_RELATIVE_OFFSET_RANGE_DP; SetDevicePathNodeLength (&EfiOpRomImageNode.Header, sizeof (EfiOpRomImageNode)); EfiOpRomImageNode.StartingOffset = (UINTN) RomBarOffset - (UINTN) RomBar; EfiOpRomImageNode.EndingOffset = (UINTN) RomBarOffset + ImageSize - 1 - (UINTN) RomBar; PciOptionRomImageDevicePath = AppendDevicePathNode (PciDevice->DevicePath, &EfiOpRomImageNode.Header); ASSERT (PciOptionRomImageDevicePath != NULL); // // load image and start image // BufferSize = 0; Buffer = NULL; ImageHandle = NULL; Status = gBS->LoadImage ( FALSE, gPciBusDriverBinding.DriverBindingHandle, PciOptionRomImageDevicePath, Buffer, BufferSize, &ImageHandle ); FreePool (PciOptionRomImageDevicePath); If it is loaded from the ROM there is going to be a node in the device path (likely 2nd to last) that contains PCI_DEVICE_PATH. You could always look for that. In the Example below PciDevice->DevicePath is going to be the same device path that has the PCI IO protocol sitting on it. You should be able to dump it from the shell. Thanks, Andrew Fish DevicePathType(LoadedImage->FilePath) == MEDIA_FILEPATH_DP Thanks Sathya -------------------------------------------------------------------------- ---- Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server from Actuate! Instantly Supercharge Your Business Reports and Dashboards with Interactivity, Sharing, Native Excel Exports, App Integration & more Get technology previously reserved for billion-dollar corporations, FREE http://pubads.g.doubleclick.net/gampad/clk?id=164703151&iu=/4140/ostg.clkt rk _______________________________________________ edk2-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/edk2-devel ------------------------------------------------------------------------------ Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server from Actuate! Instantly Supercharge Your Business Reports and Dashboards with Interactivity, Sharing, Native Excel Exports, App Integration & more Get technology previously reserved for billion-dollar corporations, FREE http://pubads.g.doubleclick.net/gampad/clk?id=164703151&iu=/4140/ostg.clktrk _______________________________________________ edk2-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/edk2-devel
