Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1696976

Re: [PATCH] ACPI, APEI: Fixup incorrect 16-bit access width firmware bug

From Andy Shevchenko <andy.shevchenko@gmail.com>
Newsgroups linux.kernel
Subject Re: [PATCH] ACPI, APEI: Fixup incorrect 16-bit access width firmware bug
Date 2017-07-26 12:50 +0200
Message-ID <u7s37-7CE-9@gated-at.bofh.it> (permalink)
References <u5CJj-37O-11@gated-at.bofh.it> <u5CT0-3b5-23@gated-at.bofh.it> <u7nPQ-56r-13@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Wed, Jul 26, 2017 at 9:16 AM, Liwei Song <liwei.song@windriver.com> wrote:
> On 07/21/2017 05:56 PM, Andy Shevchenko wrote:
>> On Fri, Jul 21, 2017 at 12:41 PM, Song liwei <liwei.song@windriver.com> wrote:

>>     /* Fixup common BIOS bug */
>>     if (bit_offset == 0) {
>>       if (bit_width == 16 && (*paddr & 0x01) == 0 && *access_bit_width < 16)
>>                *access_bit_width = 16;
>>       else if (bit_width == 32 && (*paddr & 0x03) == 0 &&
>> *access_bit_width < 32)
>>                *access_bit_width = 32;
>>       else if (bit_width == 64 && (*paddr & 0x07) == 0 &&
>> *access_bit_width < 64)
>>                *access_bit_width = 64;
>>     }

> Thanks for your suggestion, what about the condition like the following?
> The main bug in bios is bit_width is not comfortable with access_bit_width
> So check it first.
>
> if (*access_bit_width < bit_width && bit_offset == 0) {
>         if ((bit_width == 16 && (*paddr & 0x01) == 0) ||
>             (bit_width == 32 && (*paddr & 0x03) == 0) ||
>             (bit_width == 64 && (*paddr & 0x07) == 0))
>                 *access_bit_width = bit_width;
> }

Either works to me.

P.S. Less explicit case is to use bit operations to check those, i.e.
is_power_of_2(), fls().

-- 
With Best Regards,
Andy Shevchenko

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

[PATCH] ACPI, APEI: Fixup incorrect 16-bit access width firmware bug Song liwei <liwei.song@windriver.com> - 2017-07-21 11:50 +0200
  Re: [PATCH] ACPI, APEI: Fixup incorrect 16-bit access width firmware bug Andy Shevchenko <andy.shevchenko@gmail.com> - 2017-07-21 12:00 +0200
    Re: [PATCH] ACPI, APEI: Fixup incorrect 16-bit access width firmware  bug Liwei Song <liwei.song@windriver.com> - 2017-07-26 08:20 +0200
      Re: [PATCH] ACPI, APEI: Fixup incorrect 16-bit access width firmware bug Andy Shevchenko <andy.shevchenko@gmail.com> - 2017-07-26 12:50 +0200

csiph-web