On 23 June 2016 at 12:57, Laszlo Ersek <ler...@redhat.com> wrote:
> On 06/23/16 10:14, Ard Biesheuvel wrote:
>> On 23 June 2016 at 03:43, Gao, Liming <liming....@intel.com> wrote:
>>> Ard:
>>>   Could you send the updated FDF file that causes build failure? I would 
>>> like to see what issue here.
>>>
>>
>> As it turns out, the defines should go into the associated .DSC file,
>> in a [Defines] section. The .FDF parser tolerates the DEFINEs, but
>> ignores them.
>>
>> So I tried putting the defines in ArmVirt.dsc.inc, which does work to
>> some extent: these expressions
>>
>>   DEFINE VARS_SIZE   = ($(VARS_BLOCKS) * $(BLOCK_SIZE))
>>   DEFINE SPARE_BASE  = (2 * $(BLOCK_SIZE))
>>
>> are rejected, and need to be open coded.
>>
>> Since the only macro that is actually used more than once is
>> BLOCK_SIZE, and considering that moving these defines elsewhere and
>> open coding some of them defeats the purpose of using macros anyway, I
>> think it is better to go with my v2 (which Laslzo already indicated he
>> is ok with)
>
> Yes, as I've indicated, I'm fine to proceed with v2.
>

OK, will do.

> Just for curiosity's sake: can you try extracting the DEFINEs in
> question to a separate *FDF* include file? That's how we use them in
> OvmfPkg. Maybe the FDF parser in BaseTools will honor those macro defs
> if their definition and their place of use are separated by an !include
> directive in the FDF file.
>

The trick appears to be that the [Defines] .FDF section needs to
precede any [FD] sections.
That still means a separate .FDF include file just for these macro
defs, so I am not going to bother

-- 
Ard.

>>
>>>> -----Original Message-----
>>>> From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of
>>>> Laszlo Ersek
>>>> Sent: Wednesday, June 22, 2016 11:43 PM
>>>> To: Ard Biesheuvel <ard.biesheu...@linaro.org>
>>>> Cc: edk2-devel@lists.01.org <edk2-de...@ml01.01.org>; Leif Lindholm
>>>> <leif.lindh...@linaro.org>
>>>> Subject: Re: [edk2] [PATCH 4/4] ArmVirtPkg: add FDF definition for empty
>>>> varstore
>>>>
>>>> On 06/22/16 17:30, Ard Biesheuvel wrote:
>>>>> On 21 June 2016 at 17:43, Laszlo Ersek <ler...@redhat.com> wrote:
>>>>
>>>>>> (3) Actually, now I suggest to DEFINE the following macros at the top of
>>>> the file:
>>>>>>
>>>>>> DEFINE VARS_BASE   = 0x04000000
>>>>>> DEFINE VARS_BLOCKS = 3
>>>>>> DEFINE BLOCK_SIZE  = 0x00040000
>>>>>> DEFINE VARS_SIZE   = ($(VARS_BLOCKS) * $(BLOCK_SIZE))
>>>>>> DEFINE SPARE_BASE  = (2 * $(BLOCK_SIZE))
>>>>>>
>>>>>> (It is possible that the multiplications above will not work in all of 
>>>>>> the
>>>> contexts below -- in that case, just open-code the products please, and add
>>>> some comments.)
>>>>>>
>>>>>> Then use these macros, for setting the above FD Tokens, like this:
>>>>>>
>>>>>> BaseAddress   = $(VARS_BASE)
>>>>>
>>>>> It chokes at this reference already:
>>>>>
>>>>> /home/ard/build/edk2/ArmVirtPkg/VarStore.fdf.inc(26): error 3000:
>>>>> Invalid syntax/format
>>>>> expected Hex base address near line 26, column 0: BaseAddress
>>>>> = $(VARS_BASE)
>>>>>
>>>>> so this is not going to fly.
>>>>
>>>> It's strange. If you check e.g. "OvmfPkgX64.fdf", we definitely use this
>>>> pattern:
>>>>
>>>> [FD.OVMF]
>>>> BaseAddress   = $(FW_BASE_ADDRESS)
>>>> --
>>>> [FD.OVMF_VARS]
>>>> BaseAddress   = $(FW_BASE_ADDRESS)
>>>> --
>>>> [FD.OVMF_CODE]
>>>> BaseAddress   = $(CODE_BASE_ADDRESS)
>>>> --
>>>> [FD.MEMFD]
>>>> BaseAddress   = $(MEMFD_BASE_ADDRESS)
>>>>
>>>>>> Size          = $(VARS_SIZE)
>>>>>> ErasePolarity = 1
>>>>>> BlockSize     = $(BLOCK_SIZE)
>>>>>> NumBlocks     = $(VARS_BLOCKS)
>>>>>>
>>>>>> Furthermore:
>>>>>>
>>>>>>> +0x00000000|0x00040000
>>>>>>
>>>>>> (4) This should use $(BLOCK_SIZE) after the pipe symbol, *plus* assign
>>>> PcdFlashNvStorageVariableBase and PcdFlashNvStorageVariableSize at once.
>>>>>>
>>>>>> The most compact form for that is:
>>>>>>
>>>>>> 0x00000000|$(BLOCK_SIZE)
>>>>>>
>>>> gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase|gEfiM
>>>> deModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableSize
>>>>>>
>>>>>
>>>>> I have adopted this for v2, but without the BLOCK_SIZE macro, since I
>>>>> could not get that to work reliably either.
>>>>
>>>> That's again strange! The OvmfPkg*.fdf files use this as well; just run:
>>>>
>>>> git grep '|\$' -- OvmfPkg/'*fdf'
>>>>
>>>> Something must be wrong with your macro definitions (perhaps due to the
>>>> way I relayed them to you?) The above methods definitely work. Perhaps
>>>> we should invite BaseTools people to help us debug this.
>>>>
>>>> Thanks
>>>> Laszlo
>>>>
>>>> _______________________________________________
>>>> edk2-devel mailing list
>>>> edk2-devel@lists.01.org
>>>> 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