Thanks Andrew..
On Wed, Jan 30, 2013 at 11:25 PM, Andrew Fish <af...@apple.com> wrote:
> Sateesh,
>
> There are two classes of drivers in EFI:
> 1) Device Drivers
> 2) Bus drivers
>
> A device driver, like your example, adds a protocol to an existing handle.
> A Bus driver adds child handles.
>
> In your case I think you will find that there already is a device path on
> the PciIo handle that was created by the bus driver that produced that
> handle. So you don't need to do anything.
>
> If you driver created a child handle then you would take the device path
> from the PciIo handle and append the node that represents your new handle
> and install that device path protocol on the new handle.
>
> Andrew Fish
>
>
> On Jan 29, 2013, at 9:12 PM, satish kondapalli <nitw.sat...@gmail.com>
> wrote:
>
> > 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
>
>
>
> ------------------------------------------------------------------------------
> 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
>
------------------------------------------------------------------------------
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