qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] q800: move dp8393x_prom memory region to Q800MachineState


From: Mark Cave-Ayland
Subject: Re: [PATCH] q800: move dp8393x_prom memory region to Q800MachineState
Date: Thu, 28 Dec 2023 18:43:02 +0000
User-agent: Mozilla Thunderbird

On 28/12/2023 09:46, Philippe Mathieu-Daudé wrote:

On 27/12/23 22:02, Mark Cave-Ayland wrote:
There is no need to dynamically allocate the memory region from the heap.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
---
  hw/m68k/q800.c         | 7 +++----
  include/hw/m68k/q800.h | 1 +
  2 files changed, 4 insertions(+), 4 deletions(-)


@@ -406,13 +405,13 @@ static void q800_machine_init(MachineState *machine)
      sysbus_connect_irq(sysbus, 0,
                         qdev_get_gpio_in(DEVICE(&m->glue), GLUE_IRQ_IN_SONIC));
-    memory_region_init_rom(dp8393x_prom, NULL, "dp8393x-q800.prom",
+    memory_region_init_rom(&m->dp8393x_prom, NULL, "dp8393x-q800.prom",
                             SONIC_PROM_SIZE, &error_fatal);
      memory_region_add_subregion(get_system_memory(), SONIC_PROM_BASE,
-                                dp8393x_prom);
+                                &m->dp8393x_prom);
      /* Add MAC address with valid checksum to PROM */
-    prom = memory_region_get_ram_ptr(dp8393x_prom);
+    prom = memory_region_get_ram_ptr(&m->dp8393x_prom);
      checksum = 0;
      for (i = 0; i < 6; i++) {
          prom[i] = revbit8(nd_table[0].macaddr.a[i]);

Similar pattern in mips_jazz_init(). I wonder if we can extract the
PROM checksums in a common helper declared in "hw/net/dp8393x.h".

That used to be the case before I added the support for the q800 machine, however the encoding of the MAC address and checksum are completely different between the jazz and q800 machines. The misleading part is the memory regions have been created with a _prom suffix and AFAICT the SONIC doesn't have any on-board NVRAM at all, so my guess is that the MAC address is stored in per-machine non-volatile memory.

Anyhow for this patch:
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>

Thanks!


ATB,

Mark.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]