diff mbox series

[v4,13/15] mips_malta: Clean up definition of flash memory size somewhat

Message ID 20190308094610.21210-14-armbru@redhat.com
State New
Headers show
Series pflash: Fixes and cleanups | expand

Commit Message

Markus Armbruster March 8, 2019, 9:46 a.m. UTC
pflash_cfi01_register() takes a size in bytes, a block size in bytes
and a number of blocks.  mips_malta_init() passes BIOS_SIZE, 65536,
FLASH_SIZE >> 16.  Actually consistent only because BIOS_SIZE (defined
in include/hw/mips/bios.h as (4 * MiB)) matches FLASH_SIZE (defined
locally as 0x400000).  Confusing all the same.

Pass FLASH_SIZE instead of BIOS_SIZE.

Cc: Aurelien Jarno <aurelien@aurel32.net>
Cc: Aleksandar Rikalo <arikalo@wavecomp.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
---
 hw/mips/mips_malta.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Philippe Mathieu-Daudé March 8, 2019, 12:32 p.m. UTC | #1
On 3/8/19 10:46 AM, Markus Armbruster wrote:
> pflash_cfi01_register() takes a size in bytes, a block size in bytes
> and a number of blocks.  mips_malta_init() passes BIOS_SIZE, 65536,
> FLASH_SIZE >> 16.  Actually consistent only because BIOS_SIZE (defined
> in include/hw/mips/bios.h as (4 * MiB)) matches FLASH_SIZE (defined
> locally as 0x400000).  Confusing all the same.
> 
> Pass FLASH_SIZE instead of BIOS_SIZE.
> 
> Cc: Aurelien Jarno <aurelien@aurel32.net>
> Cc: Aleksandar Rikalo <arikalo@wavecomp.com>
> Signed-off-by: Markus Armbruster <armbru@redhat.com>
> Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
> Reviewed-by: Richard Henderson <richard.henderson@linaro.org>

Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>

> ---
>  hw/mips/mips_malta.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/hw/mips/mips_malta.c b/hw/mips/mips_malta.c
> index 4dfe06a1a0..2f20f56458 100644
> --- a/hw/mips/mips_malta.c
> +++ b/hw/mips/mips_malta.c
> @@ -1262,7 +1262,7 @@ void mips_malta_init(MachineState *machine)
>      /* Load firmware in flash / BIOS. */
>      dinfo = drive_get(IF_PFLASH, 0, fl_idx);
>      fl = pflash_cfi01_register(FLASH_ADDRESS, NULL, "mips_malta.bios",
> -                               BIOS_SIZE,
> +                               FLASH_SIZE,
>                                 dinfo ? blk_by_legacy_dinfo(dinfo) : NULL,
>                                 65536, FLASH_SIZE >> 16,
>                                 4, 0x0000, 0x0000, 0x0000, 0x0000, be);
>
Philippe Mathieu-Daudé March 8, 2019, 1:04 p.m. UTC | #2
On 3/8/19 1:32 PM, Philippe Mathieu-Daudé wrote:
> On 3/8/19 10:46 AM, Markus Armbruster wrote:
>> pflash_cfi01_register() takes a size in bytes, a block size in bytes
>> and a number of blocks.  mips_malta_init() passes BIOS_SIZE, 65536,
>> FLASH_SIZE >> 16.  Actually consistent only because BIOS_SIZE (defined
>> in include/hw/mips/bios.h as (4 * MiB)) matches FLASH_SIZE (defined
>> locally as 0x400000).  Confusing all the same.
>>
>> Pass FLASH_SIZE instead of BIOS_SIZE.
>>
>> Cc: Aurelien Jarno <aurelien@aurel32.net>
>> Cc: Aleksandar Rikalo <arikalo@wavecomp.com>
>> Signed-off-by: Markus Armbruster <armbru@redhat.com>
>> Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
>> Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
> 
> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>

Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com>

>> ---
>>  hw/mips/mips_malta.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/hw/mips/mips_malta.c b/hw/mips/mips_malta.c
>> index 4dfe06a1a0..2f20f56458 100644
>> --- a/hw/mips/mips_malta.c
>> +++ b/hw/mips/mips_malta.c
>> @@ -1262,7 +1262,7 @@ void mips_malta_init(MachineState *machine)
>>      /* Load firmware in flash / BIOS. */
>>      dinfo = drive_get(IF_PFLASH, 0, fl_idx);
>>      fl = pflash_cfi01_register(FLASH_ADDRESS, NULL, "mips_malta.bios",
>> -                               BIOS_SIZE,
>> +                               FLASH_SIZE,
>>                                 dinfo ? blk_by_legacy_dinfo(dinfo) : NULL,
>>                                 65536, FLASH_SIZE >> 16,
>>                                 4, 0x0000, 0x0000, 0x0000, 0x0000, be);
>>
diff mbox series

Patch

diff --git a/hw/mips/mips_malta.c b/hw/mips/mips_malta.c
index 4dfe06a1a0..2f20f56458 100644
--- a/hw/mips/mips_malta.c
+++ b/hw/mips/mips_malta.c
@@ -1262,7 +1262,7 @@  void mips_malta_init(MachineState *machine)
     /* Load firmware in flash / BIOS. */
     dinfo = drive_get(IF_PFLASH, 0, fl_idx);
     fl = pflash_cfi01_register(FLASH_ADDRESS, NULL, "mips_malta.bios",
-                               BIOS_SIZE,
+                               FLASH_SIZE,
                                dinfo ? blk_by_legacy_dinfo(dinfo) : NULL,
                                65536, FLASH_SIZE >> 16,
                                4, 0x0000, 0x0000, 0x0000, 0x0000, be);