Thanks Feng, Will try that out.
Regards
Vijai Kumar K
On Fri, Jun 13, 2014 at 1:32 PM, <edk2-devel-requ...@lists.sourceforge.net>
wrote:
> Send edk2-devel mailing list submissions to
> edk2-devel@lists.sourceforge.net
>
> To subscribe or unsubscribe via the World Wide Web, visit
> https://lists.sourceforge.net/lists/listinfo/edk2-devel
> or, via email, send a message with subject or body 'help' to
> edk2-devel-requ...@lists.sourceforge.net
>
> You can reach the person managing the list at
> edk2-devel-ow...@lists.sourceforge.net
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of edk2-devel digest..."
>
>
> Today's Topics:
>
> 1. Re: NOR Flash Driver (Andrew Fish) (Tian, Feng)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Fri, 13 Jun 2014 08:02:36 +0000
> From: "Tian, Feng" <feng.t...@intel.com>
> Subject: Re: [edk2] NOR Flash Driver (Andrew Fish)
> To: "edk2-devel@lists.sourceforge.net"
> <edk2-devel@lists.sourceforge.net>
> Message-ID:
> <
> 7f1bad85adea444d97065a60d2e97ee501c0a...@shsmsx101.ccr.corp.intel.com>
>
> Content-Type: text/plain; charset="utf-8"
>
> You can use Dblk shell cmd to test read, and you could refer to dblk
> source code to add write test.
>
> From: vijaikumar k [mailto:vijaikuma...@mistralsolutions.com]
> Sent: Friday, June 13, 2014 14:30
> To: edk2-devel@lists.sourceforge.net
> Subject: Re: [edk2] NOR Flash Driver (Andrew Fish)
>
> Thanks Deric and Andrew for helping me out on this.
>
> Yes, I have assigned Instance->Handle to Null in
> mNorFlashInstanceTemplate. After assigning
> Instance->Handle=ControllerHandle and removing &gEfiDevicePathProtocolGuid,
> Instance->DevPath everything went fine and now I am able to see my device
> as BLK7 when I do map -r. Here is the code of mNorFlashInstanceTemplate.
> How can I test my driver implementation NorFlashBlockIoReadBlocks,
> NorFlashBlockIoWriteBlocks etc.. ?? Is there a way to test it from UEFI
> shell??
>
> NOR_FLASH_INSTANCE mNorFlashInstanceTemplate = {
> NOR_FLASH_SIGNATURE, // Signature
> NULL, // Handle
> FALSE, // Initialized
> NULL, // Initialize
> 0, // Size
> 0, // StartLba
> {
> EFI_BLOCK_IO_PROTOCOL_REVISION3, // Revision
> NULL, // Media
> (EFI_BLOCK_RESET)NorFlashBlockIoReset, // Reset
> NorFlashBlockIoReadBlocks, // ReadBlocks
> NorFlashBlockIoWriteBlocks, // WriteBlocks
> NorFlashBlockIoFlushBlocks // FlushBlocks
> },// BlockIoProtocol
> {
> 0, // MediaId
> FALSE, // RemovableMedia
> FALSE, // MediaPresent
> TRUE, // LogicalPartition
> FALSE, // ReadOnly
> FALSE, // WriteCaching
> 512, // BlockSize
> 0, // IoAlign
> 0, // LastBlock
> 0, // LowestAlignedLba
> 0, // LogicalBlocksPerPhysicalBlock
> 0 // OptimalTransferLengthGranularity
> }, //Media;
> NULL, //For PCI Access
> NULL, //Device Path
> };
>
> Regards
> Vijai Kumar K
>
> On Thu, Jun 12, 2014 at 11:39 PM, <
> edk2-devel-requ...@lists.sourceforge.net<mailto:
> edk2-devel-requ...@lists.sourceforge.net>> wrote:
> Send edk2-devel mailing list submissions to
> edk2-devel@lists.sourceforge.net<mailto:
> edk2-devel@lists.sourceforge.net>
>
> To subscribe or unsubscribe via the World Wide Web, visit
> https://lists.sourceforge.net/lists/listinfo/edk2-devel
> or, via email, send a message with subject or body 'help' to
> edk2-devel-requ...@lists.sourceforge.net<mailto:
> edk2-devel-requ...@lists.sourceforge.net>
>
> You can reach the person managing the list at
> edk2-devel-ow...@lists.sourceforge.net<mailto:
> edk2-devel-ow...@lists.sourceforge.net>
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of edk2-devel digest..."
>
>
> Today's Topics:
>
> 1. Re: NOR Flash Driver (Andrew Fish)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Thu, 12 Jun 2014 11:09:30 -0700
> From: Andrew Fish <af...@apple.com<mailto:af...@apple.com>>
> Subject: Re: [edk2] NOR Flash Driver
> To: edk2-devel@lists.sourceforge.net<mailto:
> edk2-devel@lists.sourceforge.net>
> Message-ID: <2cc53dd9-1496-43e8-ae0e-4bc3ce432...@apple.com<mailto:
> 2cc53dd9-1496-43e8-ae0e-4bc3ce432...@apple.com>>
> Content-Type: text/plain; charset="windows-1252"
>
>
> On Jun 12, 2014, at 11:01 AM, Deric Cole <deric_c...@phoenix.com<mailto:
> deric_c...@phoenix.com>> wrote:
>
> > Vijai,
> >
> > You didn?t send the definition of mNorFlashInstanceTemplate, so I can
> only assume you?ve correctly initialized the other fields of your block I/O
> protocol there. You may want to double check.
> >
> > I see this comment:
> >
> > //Removed Device path as already there is a device path associated with
> PCIIO: by Andrew Fish
> > Status = gBS->InstallMultipleProtocolInterfaces (
> > &Instance->Handle,
> > &gEfiBlockIoProtocolGuid,
> &Instance->BlockIoProtocol,
> > &gEfiDevicePathProtocolGuid,
> Instance->DevPath,
> > NULL
> > );
> >
> > But the device path does not appear to be removed.
> >
> > Anyway, you should use ControllerHandle here. It looks like
> Instance->Handle is probably null, which will allocate a new handle, rather
> than installing on the existing handle (the one you found PCI I/O on). Try
> adding this line above:
> >
> > Instance->Handle = ControllerHandle;
> >
>
> You also need to remove:
> > &gEfiDevicePathProtocolGuid, Instance->DevPath,
>
> as this will cause the InstallMultipleProtocolnterface() to fail. You can
> only have a single protocol instance of a protocol on a handle.
>
> If you create a new handle, then your driver is a bus driver and you need
> to do the open by child controller.
>
> Thanks,
>
> Andrew Fish
>
> > Also note that if there is no file system, you will not see fs0/fs1/etc.
> for this device after you do ?map -r?. But if your block I/O protocol is
> installed correctly, you will see blk0/blk1/etc. for it.
> >
> > Deric Cole
> > Sr. Customer Engineer
> > Phoenix Technologies Ltd.
> >
> > From: vijaikumar k [mailto:vijaikuma...@mistralsolutions.com<mailto:
> vijaikuma...@mistralsolutions.com>]
> > Sent: Thursday, June 12, 2014 3:43 AM
> > To: edk2-devel@lists.sourceforge.net<mailto:
> edk2-devel@lists.sourceforge.net>
> > Subject: [edk2] NOR Flash Driver
> >
> > Hi All,
> > I am a newbie to EFI. I have the following problem
> > Problem: We have Atom Processor connected to a PCIe to PCI bridge. On
> the other side of the PCI bridge we have a PCI device which gives Memory
> Mapped access to NOR Flash via BAR0. I have written a driver to boot from
> the NOR flash. The driver is registered successfully but I am not able to
> see my device when I do "Map -r".
> > By the way the NOR has no File System associated with it. It is still
> RAW. Following are the line of code written by me for start routine.
> >
> > Code:
> > EFI_STATUS
> > EFIAPI
> > NorFlashDriverBindingStart (
> > IN EFI_DRIVER_BINDING_PROTOCOL *This,
> > IN EFI_HANDLE ControllerHandle,
> > IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL
> > )
> > {
> > EFI_STATUS Status;
> > EFI_PCI_IO_PROTOCOL *PciIo;
> > EFI_DEVICE_PATH_PROTOCOL *ParentDevicePath;
> > NOR_FLASH_INSTANCE *Instance;
> > UINT8 CmdSts;
> > Instance=NULL;
> > Print(L"\nInside Start of NorFlash");
> > Status = gBS->OpenProtocol(
> > ControllerHandle,
> > &gEfiPciIoProtocolGuid,
> > (VOID **)&PciIo,
> > This->DriverBindingHandle,
> > ControllerHandle,
> > EFI_OPEN_PROTOCOL_BY_DRIVER
> > );
> > if (EFI_ERROR (Status)) {
> > goto Error;
> > }
> > Print(L"\nPCI IO Protocol opened successfully");
> >
> > Status = gBS->OpenProtocol (
> > ControllerHandle,
> > &gEfiDevicePathProtocolGuid,
> > (VOID **) &ParentDevicePath,
> > This->DriverBindingHandle,
> > ControllerHandle,
> > EFI_OPEN_PROTOCOL_BY_DRIVER
> > );
> > if (EFI_ERROR (Status)) {
> > Print(L"\nDevice Path Protocol Failed to register");
> > goto Error;
> > }
> > Print(L"\nDevice Path Protocol Registered Successfully");
> > Instance = AllocateCopyPool
> (sizeof(NOR_FLASH_INSTANCE),&mNorFlashInstanceTemplate);
> > if (Instance == NULL) {
> > return EFI_OUT_OF_RESOURCES;
> > }
> > Print(L"\nResource Pool has been allocated");
> >
> > Instance->Signature=NOR_FLASH_SIGNATURE;
> > Instance->Size = NOR_SIZE;
> > Instance->PciIo=PciIo;
> >
> > Instance->BlockIoProtocol.Media = &Instance->Media;
> > Instance->Media.MediaId = NOR_MEDIA_ID;
> > Instance->Media.BlockSize = NOR_BLOCK_SIZE;
> > Instance->Media.LastBlock = (NOR_SIZE / NOR_BLOCK_SIZE)-1;
> >
> > Instance->Initialized = TRUE;
> > Print(L"\nBefore Installing multiple protocols");
> > //Set Command register to enable Bus Master and MemorySpace
> > PciIo->Pci.Read (
> > PciIo,
> > EfiPciIoWidthUint8,
> > PCI_COMMAND_OFFSET,
> > sizeof (UINT8),
> > &CmdSts
> > );
> >
> > CmdSts |= EFI_PCI_COMMAND_MEMORY_SPACE |
> > EFI_PCI_COMMAND_BUS_MASTER;
> >
> > PciIo->Pci.Write(
> > PciIo,
> > EfiPciIoWidthUint8,
> > PCI_COMMAND_OFFSET,
> > sizeof (UINT8),
> > &CmdSts
> > );
> > //Removed Device path as already there is a device path associated with
> PCIIO: by Andrew Fish
> > Status = gBS->InstallMultipleProtocolInterfaces (
> > &Instance->Handle,
> > &gEfiBlockIoProtocolGuid,
> &Instance->BlockIoProtocol,
> >
> &gEfiDevicePathProtocolGuid, Instance->DevPath,
> > NULL
> > );
> >
> > if (EFI_ERROR(Status)) {
> > Print(L"\nFailedInstalling multiple protocols");
> > FreePool(Instance);
> > return Status;
> > }
> > Print(L"\nAfter Installing multiple protocols");
> > return Status;
> >
> > Error:
> >
> > gBS->CloseProtocol (
> > ControllerHandle,
> > &gEfiDevicePathProtocolGuid,
> > This->DriverBindingHandle,
> > ControllerHandle
> > );
> > gBS->CloseProtocol (
> > ControllerHandle,
> > &gEfiPciIoProtocolGuid,
> > This->DriverBindingHandle,
> > ControllerHandle
> > );
> > if (Instance->DevPath != NULL) {
> > FreePool (Instance->DevPath);
> > }
> > FreePool (Instance);
> > return Status;
> > }
> >
> > Regards
> > Vijai Kumar K
> > +918095863361
> > Ext:699
> >
> ------------------------------------------------------------------------------
> > HPCC Systems Open Source Big Data Platform from LexisNexis Risk Solutions
> > Find What Matters Most in Your Big Data with HPCC Systems
> > Open Source. Fast. Scalable. Simple. Ideal for Dirty Data.
> > Leverages Graph Analysis for Fast Processing & Easy Data Exploration
> >
> http://p.sf.net/sfu/hpccsystems_______________________________________________
> > edk2-devel mailing list
> > edk2-devel@lists.sourceforge.net<mailto:edk2-devel@lists.sourceforge.net
> >
> > https://lists.sourceforge.net/lists/listinfo/edk2-devel
>
> -------------- next part --------------
> An HTML attachment was scrubbed...
>
> ------------------------------
>
>
> ------------------------------------------------------------------------------
> HPCC Systems Open Source Big Data Platform from LexisNexis Risk Solutions
> Find What Matters Most in Your Big Data with HPCC Systems
> Open Source. Fast. Scalable. Simple. Ideal for Dirty Data.
> Leverages Graph Analysis for Fast Processing & Easy Data Exploration
> http://p.sf.net/sfu/hpccsystems
>
> ------------------------------
>
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.sourceforge.net<mailto:edk2-devel@lists.sourceforge.net>
> https://lists.sourceforge.net/lists/listinfo/edk2-devel
>
>
> End of edk2-devel Digest, Vol 54, Issue 33
> ******************************************
>
> -------------- next part --------------
> An HTML attachment was scrubbed...
>
> ------------------------------
>
>
> ------------------------------------------------------------------------------
> HPCC Systems Open Source Big Data Platform from LexisNexis Risk Solutions
> Find What Matters Most in Your Big Data with HPCC Systems
> Open Source. Fast. Scalable. Simple. Ideal for Dirty Data.
> Leverages Graph Analysis for Fast Processing & Easy Data Exploration
> http://p.sf.net/sfu/hpccsystems
>
> ------------------------------
>
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/edk2-devel
>
>
> End of edk2-devel Digest, Vol 54, Issue 35
> ******************************************
>
------------------------------------------------------------------------------
HPCC Systems Open Source Big Data Platform from LexisNexis Risk Solutions
Find What Matters Most in Your Big Data with HPCC Systems
Open Source. Fast. Scalable. Simple. Ideal for Dirty Data.
Leverages Graph Analysis for Fast Processing & Easy Data Exploration
http://p.sf.net/sfu/hpccsystems
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-devel