From: Andrew Fish <afish@apple.com>
To: galla rao <galla.rao80@gmail.com>
Cc: edk2-devel@lists.01.org
Subject: Re: Query on Variable Services
Date: Thu, 17 Jan 2019 10:48:54 -0800 [thread overview]
Message-ID: <85C3724D-B83A-4441-9193-F568145A94C0@apple.com> (raw)
In-Reply-To: <CAC=A7_D=xk5=WE+vX7df3gMZYVAAwMqaXT_1uDepVq273RhO0w@mail.gmail.com>
> On Jan 17, 2019, at 10:26 AM, galla rao <galla.rao80@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 <afish@apple.com <mailto:afish@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.rao80@gmail.com <mailto:galla.rao80@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>
>
prev parent reply other threads:[~2019-01-17 18:49 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-01-17 17:23 Query on Variable Services galla rao
2019-01-17 17:54 ` Andrew Fish
2019-01-17 18:26 ` galla rao
2019-01-17 18:48 ` Andrew Fish [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=85C3724D-B83A-4441-9193-F568145A94C0@apple.com \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox