Re: [edk2] Require help in EFI on BLOCK_IO_PROTOCOL

Subject: Re: [edk2] Require help in EFI on BLOCK_IO_PROTOCOL

From: satish kondapalli <nitw.satish@gmail.com>

To: edk2-devel@lists.sourceforge.net

Date: 2012-02-02 07:02:48

Thanks Andrew,

In case of EFI_LOAD_FILE_PROTOCOL, if we provide linux bzImage will it boot?

Thanks
Sateesh

On Wed, Feb 1, 2012 at 10:00 PM, Andrew Fish <afish@apple.com> wrote:
As for other options on booting, you could use EFI_LOAD_FILE_PROTOCOLhttps://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2/MdePkg/Include/Protocol/LoadFile.h. It is also how network boot works, but if all you want to do is return a boot image it is the simplest way.

You have a few errors in your DriverBingindStart()/DriverBingindStop(). The main issue is you are adding your protocol to the PCI IO handle created by the PCI Bus Driver. This handle already has a device path on it, so that is probably your failure. You only need to add a device path protocol if you create a new child handle. At that point you take the parents device path and append your device path node to it.

EFI_DEVICE_PATH_PROTOCOL *SpDevicePath=NULL;

Status = gBS->InstallMultipleProtocolInterfaces(
&SpHandle,
&gEfiBlockIoProtocolGuid,&SpBlockIo,
&gEfiDevicePathProtocolGuid,SpDevicePath,
NULL);

Also Stop() should undo Start(). And Start() should keep the PCI IO handle open on success and it gets closed on Stop(). See the DiskIo driver for a simple examplehttps://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2/MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIo.c. DiskIo is different in that it layers on top of every BlockIo protocol, but if you replace BlockIo with PciIo it should give you the sequence you need.

Andrew Fish





On Feb 1, 2012, at 6:48 AM, satish kondapalli wrote:

Hi,

I have a problem as stated below and not able to get a solution for the same...

I have a PCI card having NOR flash which is plugged onto Intel Atom baord. This NOR flash would store a Kernel image which needs to be booted by atom board. The only way to access NOR flash is through PCI BAR0 register which when "read" will give contents on NOR flash in few chunks of bytes. As i am newbie to EFI, i thought of the following solution which seems logical but fails to work...

Solution: I have created Linux Kernel image + GRUB boot loader and stored it in NOR flash. I have written a EFI driver which sits on small option ROM in PCI card. This driver registers itself as Block driver to EFI so that i can boot from NOR flash. Few queries which i have are:

1. Am i following the right approach?
2. Is their any other way this can be solved?
3. In general how do we boot a OS stored in flash on EFI aware machine : ( ?

As i currently don't have required HW with option ROM, i am loading the my own driver from a USB pen drive using "Load" command.

My driver fails while adding BLOCK_IO_PROTOCOL.

Status = gBS->InstallMultipleProtocolInterfaces(
&SpHandle,
&gEfiBlockIoProtocolGuid,&SpBlockIo,
&gEfiDevicePathProtocolGuid,SpDevicePath,
NULL);

Not sure what is going wrong here. But with out DEVICE_PATH_PROTOCOL this works fine.

Is DEVICE_PATH_PROTOCOL is mandatory for boot devices..?

Here i am attaching sample driver for your reference..

Thanks
Sateesh

<SpDrv.c>------------------------------------------------------------------------------
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d_______________________________________________
edk2-devel mailing list
edk2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-devel


------------------------------------------------------------------------------
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-devel