From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=17.151.62.67; helo=nwk-aaemail-lapp02.apple.com; envelope-from=afish@apple.com; receiver=edk2-devel@lists.01.org Received: from nwk-aaemail-lapp02.apple.com (nwk-aaemail-lapp02.apple.com [17.151.62.67]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 33525211B6C17 for ; Thu, 17 Jan 2019 10:49:27 -0800 (PST) Received: from pps.filterd (nwk-aaemail-lapp02.apple.com [127.0.0.1]) by nwk-aaemail-lapp02.apple.com (8.16.0.27/8.16.0.27) with SMTP id x0HIkxd8008695; Thu, 17 Jan 2019 10:49:26 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=apple.com; h=mime-version : content-type : sender : from : message-id : subject : date : in-reply-to : cc : to : references; s=20180706; bh=VhCEOwr3mYiYA3WA+7TJ0zwpPE0HtWxXPdCK4CLg8hw=; b=n3SRlBxo+MzKBnojNHjtdzCw0BHL5ST9W/YuNVcEadbPnlqefP14kp2t7775rO+vZy/k 1ZAmE0YMk1+DcmCop4VSqxy+q4h4fiX0KIsnD4/RS/yfN4UavwCo/Kfb2cwiKWucOMCH AgaFBGP+0Zs+JyCkB3ok041U38GVE4zfhfZnLx+rX36u0BMZLZJhdB1JnjiZVv4F5lxZ izCHuRxYCwQd1/YX84iQ6J8Hzr4z7W+RIebZXH8kyJlF4rtipldbvBk7sn5oXlhWxfZt Pu3ctYTf8zwDqIiZcCiJugVfla1OsNVjonTWE0dIykyaD6nWhlYRDgmpYXCD0hdeI3zA Dg== Received: from ma1-mtap-s02.corp.apple.com (ma1-mtap-s02.corp.apple.com [17.40.76.6]) by nwk-aaemail-lapp02.apple.com with ESMTP id 2pydprstfn-31 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NO); Thu, 17 Jan 2019 10:49:26 -0800 MIME-version: 1.0 Received: from nwk-mmpp-sz10.apple.com (nwk-mmpp-sz10.apple.com [17.128.115.122]) by ma1-mtap-s02.corp.apple.com (Oracle Communications Messaging Server 8.0.2.3.20181024 64bit (built Oct 24 2018)) with ESMTPS id <0PLH007JUOA81H90@ma1-mtap-s02.corp.apple.com>; Thu, 17 Jan 2019 10:49:21 -0800 (PST) Received: from process_viserion-daemon.nwk-mmpp-sz10.apple.com by nwk-mmpp-sz10.apple.com (Oracle Communications Messaging Server 8.0.2.3.20181024 64bit (built Oct 24 2018)) id <0PLH00100O4VZO00@nwk-mmpp-sz10.apple.com>; Thu, 17 Jan 2019 10:49:21 -0800 (PST) X-Va-A: X-Va-T-CD: 51261b8211517578446660ad09054340 X-Va-E-CD: 685ac2fd9b1a4125622b70565570ea4f X-Va-R-CD: 6ec8b4e6b1bb3bf63fba0e32ce718723 X-Va-CD: 0 X-Va-ID: 15e81e7e-16ae-45dc-9856-f8754a29e8ad X-V-A: X-V-T-CD: 51261b8211517578446660ad09054340 X-V-E-CD: 685ac2fd9b1a4125622b70565570ea4f X-V-R-CD: 6ec8b4e6b1bb3bf63fba0e32ce718723 X-V-CD: 0 X-V-ID: 0db182e9-8b44-420e-a194-620e6b9e00fd Received: from process_milters-daemon.nwk-mmpp-sz10.apple.com by nwk-mmpp-sz10.apple.com (Oracle Communications Messaging Server 8.0.2.3.20181024 64bit (built Oct 24 2018)) id <0PLH00400O6YB300@nwk-mmpp-sz10.apple.com>; Thu, 17 Jan 2019 10:49:20 -0800 (PST) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2019-01-17_06:,, signatures=0 Received: from [17.226.41.14] (unknown [17.226.41.14]) by nwk-mmpp-sz10.apple.com (Oracle Communications Messaging Server 8.0.2.3.20181024 64bit (built Oct 24 2018)) with ESMTPSA id <0PLH00A8VOA80QA0@nwk-mmpp-sz10.apple.com>; Thu, 17 Jan 2019 10:49:20 -0800 (PST) Sender: afish@apple.com From: Andrew Fish Message-id: <85C3724D-B83A-4441-9193-F568145A94C0@apple.com> Date: Thu, 17 Jan 2019 10:48:54 -0800 In-reply-to: Cc: edk2-devel@lists.01.org To: galla rao References: X-Mailer: Apple Mail (2.3445.6.18) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-01-17_06:, , signatures=0 X-Content-Filtered-By: Mailman/MimeDel 2.1.29 Subject: Re: Query on Variable Services X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Jan 2019 18:49:27 -0000 Content-Type: text/plain; CHARSET=US-ASCII Content-Transfer-Encoding: 7BIT > On Jan 17, 2019, at 10:26 AM, galla rao 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 > 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 > 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 > > https://lists.01.org/mailman/listinfo/edk2-devel >