public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Laszlo Ersek <lersek@redhat.com>
To: Jordan Justen <jordan.l.justen@intel.com>,
	edk2-devel-01 <edk2-devel@lists.01.org>
Subject: Re: [PATCH v2 2/5] OvmfPkg/EmuVariableFvbRuntimeDxe: change block size to 4KB
Date: Fri, 19 May 2017 00:13:01 +0200	[thread overview]
Message-ID: <8bb9e39a-f8ac-0416-0ea9-6c1ef7df3e98@redhat.com> (raw)
In-Reply-To: <71240da1-43bc-3741-dfbc-7f0b13c9b6e7@redhat.com>

On 05/18/17 23:09, Laszlo Ersek wrote:
> On 05/18/17 22:56, Jordan Justen wrote:
>> On 2017-05-18 12:40:30, Laszlo Ersek wrote:
>>> On 05/18/17 20:49, Jordan Justen wrote:
>>>> On 2017-05-18 08:14:33, Laszlo Ersek wrote:
>>>>> diff --git a/OvmfPkg/EmuVariableFvbRuntimeDxe/Fvb.h b/OvmfPkg/EmuVariableFvbRuntimeDxe/Fvb.h
>>>>> index 4247d21d72f8..beb11e3f9a90 100644
>>>>> --- a/OvmfPkg/EmuVariableFvbRuntimeDxe/Fvb.h
>>>>> +++ b/OvmfPkg/EmuVariableFvbRuntimeDxe/Fvb.h
>>>>> @@ -58,8 +58,14 @@ typedef struct {
>>>>>  //
>>>>>  // Constants
>>>>>  //
>>>>> -#define EMU_FVB_BLOCK_SIZE (FixedPcdGet32 (PcdFlashNvStorageFtwSpareSize))
>>>>> -#define EMU_FVB_SIZE (2 * FixedPcdGet32 (PcdFlashNvStorageFtwSpareSize))
>>>>> +#define EMU_FVB_BLOCK_SIZE \
>>>>> +  EFI_PAGE_SIZE
>>>>> +#define EMU_FVB_NUM_SPARE_BLOCKS \
>>>>> +  EFI_SIZE_TO_PAGES ((UINTN)FixedPcdGet32 (PcdFlashNvStorageFtwSpareSize))
>>>>> +#define EMU_FVB_NUM_TOTAL_BLOCKS \
>>>>> +  (2 * EMU_FVB_NUM_SPARE_BLOCKS)
>>>>> +#define EMU_FVB_SIZE \
>>>>> +  (EMU_FVB_NUM_TOTAL_BLOCKS * EMU_FVB_BLOCK_SIZE)
>>>>>  #define FTW_WRITE_QUEUE_SIZE \
>>>>>    (FixedPcdGet32 (PcdFlashNvStorageFtwWorkingSize) - \
>>>>>     sizeof (EFI_FAULT_TOLERANT_WORKING_BLOCK_HEADER))
>>>>
>>>> In the cases where we don't exceed 80 columns, I don't see the excess
>>>> newlines as helping here, style-wise.
>>>
>>> My first preference would have been
>>>
>>> #define SHORT_MACRO_NAME           replacement text 1
>>> #define ANNOYINGLY_LONG_MACRO_NAME replacement text 2
>>>
>>> That is, to keep both the macro names and the replacement texts aligned.
>>> However, that way I wouldn't fit into 80 chars on some lines, and then
>>> breaking only *some* macro definitions to multiple lines looked
>>> horrible. Which is why I opted for the current layout: it is uniform,
>>> and it does preserve the alignment for both macro names and replacement
>>> texts separately.
>>
>> I don't think you would make a block of function calls all multiline
>> if one call required it. I see your point and I agree that aligning
>> things can be nice if it works out. It seems like it doesn't in this
>> case.
>>
>> Could FTW_SPARE_SIZE and FTW_WORKING_SIZE macros help?
> 
> Assuming you mean those as shorthands for the FixedPcdGet32() macro
> invocations, they wouldn't (fully); FTW_WRITE_QUEUE_SIZE would remain
> overlong even after such a replacement.
> 
>>
>> If you feel strongly about this current format, then keep it, as I
>> don't feel too strongly about it.
> 
> I don't feel strongly about this layout, so if (when) you have an
> incremental patch, I'll be glad to review it. What I do feel strongly
> about :) is not wanting to retest the -bios scenarios, which is sort of
> required once these macros are touched. (The ASSERT() below is a lot
> easier / quicker to test.) Due to the testing impact, I prefer to keep
> the current layout.
> 
>>
>>>>
>>>> Could you add to the entry-point an assert:
>>>>
>>>>   ASSERT(FixedPcdGet32 (PcdFlashNvStorageFtwSpareSize) %
>>>>          EMU_FVB_BLOCK_SIZE == 0);
>>>
>>> Should I squash that into this patch?
>>
>> Yeah. No need for resend.
> 
> Thanks, I'll squash it then.

Commit 7e8329267ecb.


  reply	other threads:[~2017-05-18 22:13 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-18 15:14 [PATCH v2 0/5] OvmfPkg: complete the 4MB flash image support ("-bios" / emulated variables) Laszlo Ersek
2017-05-18 15:14 ` [PATCH v2 1/5] OvmfPkg/EmuVariableFvbRuntimeDxe: strip trailing whitespace Laszlo Ersek
2017-05-18 22:12   ` Laszlo Ersek
2017-05-18 15:14 ` [PATCH v2 2/5] OvmfPkg/EmuVariableFvbRuntimeDxe: change block size to 4KB Laszlo Ersek
2017-05-18 18:49   ` Jordan Justen
2017-05-18 19:40     ` Laszlo Ersek
2017-05-18 20:56       ` Jordan Justen
2017-05-18 21:09         ` Laszlo Ersek
2017-05-18 22:13           ` Laszlo Ersek [this message]
2017-05-18 15:14 ` [PATCH v2 3/5] OvmfPkg/PlatformPei: align EmuVariableNvStore at any page boundary Laszlo Ersek
2017-05-18 22:13   ` Laszlo Ersek
2017-05-18 15:14 ` [PATCH v2 4/5] OvmfPkg/README: document 4MB flash layout Laszlo Ersek
2017-05-18 22:13   ` Laszlo Ersek
2017-05-18 15:14 ` [PATCH v2 5/5] OvmfPkg: make the 4MB flash size the default (again) Laszlo Ersek
2017-05-23 16:05   ` Laszlo Ersek

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=8bb9e39a-f8ac-0416-0ea9-6c1ef7df3e98@redhat.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