Hi,
I am writing option ROM driver for my PCIe device. How to add Device path
protocol to my device.
1) Here is the my driver binding protocol:
EFI_DRIVER_BINDING_PROTOCOL gSpDriverBinding = {
SpDriverBindingSupported,
SpDriverBindingStart,
SpDriverBindingStop,
0xa,
NULL,
NULL
};
2) In my "SpDriverBindingSupported" function i am checking my vendor ID
and device ID and based on that i am returning EFI_SUCCESS.
3) In my start function, I am registering block io protocol. This block
disk reads from my PCie Device NOR. I want add device path to my device.
How to add that one?
My SpDriverBindingStart function::
---------------------------------------------------------------------------------------------
EFI_STATUS Status;
EFI_PCI_IO_PROTOCOL *PciIo;
EFI_TPL OldTpl;
Status = gBS->OpenProtocol (
Controller,
&gEfiPciIoProtocolGuid,
(VOID **) &PciIo,
This->DriverBindingHandle,
Controller,
EFI_OPEN_PROTOCOL_BY_DRIVER
);
if (EFI_ERROR (Status)) {
return Status;
}
Status = PciIo->Attributes(
PciIo,
EfiPciIoAttributeOperationEnable,
EFI_PCI_DEVICE_ENABLE,
NULL
);
if (EFI_ERROR (Status)) {
return Status;
}
SpBlockIo.Media = &SpMedia;
SpMedia.LogicalPartition = FALSE;
SpMedia.ReadOnly = FALSE;
SpMedia.WriteCaching = FALSE;
SpMedia.IoAlign = 0;
SpMedia.MediaId = 1;
SpMedia.BlockSize = 0x0200;
SpMedia.RemovableMedia = TRUE;
SpMedia.LastBlock = 0xc000; // 32MB.
SpMedia.MediaPresent = TRUE;
SpBlockIo.Revision = EFI_BLOCK_IO_INTERFACE_REVISION;
SpBlockIo.Reset = SpReset;
SpBlockIo.ReadBlocks = SpReadBlocks;
SpBlockIo.WriteBlocks = SpWriteBlocks;
SpBlockIo.FlushBlocks = SpFlushBlocks;
Status = gBS->InstallMultipleProtocolInterfaces(
&Controller,
&gEfiBlockIoProtocolGuid,&SpBlockIo,
NULL);
ASSERT_EFI_ERROR (Status);
---------------------------------------------------------------------------------------------------------------------
Thanks
Sateesh
------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_jan
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-devel