> On Jan 17, 2019, at 10:26 AM, galla rao <galla.ra...@gmail.com> wrote:
> 
> Thanks Andrew!
> 
> SPI driver has failed the call to, in the log i could see the failure
> 
> Status = gDS->SetMemorySpaceAttributes (
> 
>                     BaseAddress,
> 
>                     Length,
> 
>                     GcdDescriptor.Attributes | EFI_MEMORY_RUNTIME
> 
>                     );
> 
>     if (EFI_ERROR (Status)) {
> 
>       DEBUG ((DEBUG_WARN, "Variable driver failed to add EFI_MEMORY_RUNTIME 
> attribute to Flash. %r \n", Status));

You should dump out the Status value. I guess you could also make sure 
BaseAddress, and Length look correct. 

https://github.com/tianocore/edk2/blob/master/MdePkg/Include/Pi/PiDxeCis.h#L368

/**
  Modifies the attributes for a memory region in the global coherency domain of 
the
  processor.
  @param  BaseAddress      The physical address that is the start address of a 
memory region.
  @param  Length           The size in bytes of the memory region.
  @param  Attributes       The bit mask of attributes to set for the memory 
region.
  @retval EFI_SUCCESS           The attributes were set for the memory region.
  @retval EFI_INVALID_PARAMETER Length is zero.
  @retval EFI_UNSUPPORTED       The processor does not support one or more 
bytes of the memory
                                resource range specified by BaseAddress and 
Length.
  @retval EFI_UNSUPPORTED       The bit mask of attributes is not support for 
the memory resource
                                range specified by BaseAddress and Length.
  @retval EFI_ACCESS_DENIED     The attributes for the memory resource range 
specified by
                                BaseAddress and Length cannot be modified.
  @retval EFI_OUT_OF_RESOURCES  There are not enough system resources to modify 
the attributes of
                                the memory resource range.
  @retval EFI_NOT_AVAILABLE_YET The attributes cannot be set because CPU 
architectural protocol is
                                not available yet.
**/
typedef
EFI_STATUS
(EFIAPI *EFI_SET_MEMORY_SPACE_ATTRIBUTES)(
  IN EFI_PHYSICAL_ADDRESS         BaseAddress,
  IN UINT64                       Length,
  IN UINT64                       Attributes
  );


Thanks,

Andrew Fish

> 
>     }
> 
> if this call has failed SetVirtualAddress would not be useful for Virtual 
> Address conversion for this region I believe
>   
> Best Regards
> Ranga
> 
> On Thu, Jan 17, 2019 at 5:55 PM Andrew Fish <af...@apple.com 
> <mailto:af...@apple.com>> wrote:
> Galla,
> 
> The PCD value usually get set as the result of the build. 
> 
> EFI_MEMORY_RUNTIME attribute is used to request a virtual mapping from the 
> OS. When the variable services are called from the OS the run in a virtual 
> address space provided by the OS. Thus trying to access 0xFFE00000 would page 
> fault. 
> 
> You can run the memmap command from the EFI Shell and see if bit 63 is set. 
> If your SPI controller is a memory mapped hardware device you may also need 
> to map the SPI register via EFI_MEMORY_RUNTIME. The SPI driver also needs to 
> deal with the SetVirtualAddress map event to convert its pointers over to the 
> new OS provided virtual memory space.
> 
> Thanks,
> 
> Andrew Fish
> 
> 
> > On Jan 17, 2019, at 9:23 AM, galla rao <galla.ra...@gmail.com 
> > <mailto:galla.ra...@gmail.com>> wrote:
> > 
> > Hi All,
> > 
> > Have a question for Variable services
> > 
> > Given PCD's are initialized
> > 
> > gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase   | 0xFFE00000
> > 
> >  gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingBase |
> > 0xFFE3E000
> > 
> >  gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareBase   |
> > 0xFFE40000
> > 
> > Do i need to make these regions as *EFI_MEMORY_RUNTIME *through
> > *gDS->SetMemorySpaceAttributes*
> > 
> > SPI Flash writes within BIOS works good!
> > 
> > *when trying to change BootOrder from efibootmgr, the failure is seen*
> > 
> > It would be useful if someone has faced this issue earlier and can respond
> > kindly.
> > 
> > Best Regards
> > Galla
> > _______________________________________________
> > edk2-devel mailing list
> > edk2-devel@lists.01.org <mailto:edk2-devel@lists.01.org>
> > https://lists.01.org/mailman/listinfo/edk2-devel 
> > <https://lists.01.org/mailman/listinfo/edk2-devel>
> 

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to