qemu-devel
[Top][All Lists]
Advanced

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

Re: [PATCH v4 02/20] nubus-device: expose separate super slot memory reg


From: Mark Cave-Ayland
Subject: Re: [PATCH v4 02/20] nubus-device: expose separate super slot memory region
Date: Wed, 22 Sep 2021 11:24:45 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.14.0

On 20/09/2021 20:54, Laurent Vivier wrote:

Le 17/09/2021 à 09:50, Mark Cave-Ayland a écrit :
According to "Designing Cards and Drivers for the Macintosh Family" each 
physical
nubus slot can access 2 separate address ranges: a super slot memory region 
which
is 256MB and a standard slot memory region which is 16MB.

Currently a Nubus device uses the physical slot number to determine whether it 
is
using a standard slot memory region or a super slot memory region rather than
exposing both memory regions for use as required.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
  hw/nubus/nubus-device.c  | 36 ++++++++++++++++++------------------
  include/hw/nubus/nubus.h |  1 +
  2 files changed, 19 insertions(+), 18 deletions(-)

diff --git a/hw/nubus/nubus-device.c b/hw/nubus/nubus-device.c
index be01269563..36203848e5 100644
--- a/hw/nubus/nubus-device.c
+++ b/hw/nubus/nubus-device.c
@@ -168,26 +168,26 @@ static void nubus_device_realize(DeviceState *dev, Error 
**errp)
      }
nd->slot = nubus->current_slot++;
-    name = g_strdup_printf("nubus-slot-%d", nd->slot);
-
-    if (nd->slot < NUBUS_FIRST_SLOT) {
-        /* Super */
-        slot_offset = (nd->slot - 6) * NUBUS_SUPER_SLOT_SIZE;
-
-        memory_region_init(&nd->slot_mem, OBJECT(dev), name,
-                           NUBUS_SUPER_SLOT_SIZE);
-        memory_region_add_subregion(&nubus->super_slot_io, slot_offset,
-                                    &nd->slot_mem);
-    } else {
-        /* Normal */
-        slot_offset = nd->slot * NUBUS_SLOT_SIZE;
-
-        memory_region_init(&nd->slot_mem, OBJECT(dev), name, NUBUS_SLOT_SIZE);
-        memory_region_add_subregion(&nubus->slot_io, slot_offset,
-                                    &nd->slot_mem);
-    }
+ /* Super */
+    slot_offset = (nd->slot - 6) * NUBUS_SUPER_SLOT_SIZE;
+

Is it possible to remove this patch?

The "(nd->slot - 6)" looks weird and it is removed in patch 20.

This is another place where I decided to keep the existing logic as-is and then make the change to remove the -6 offset later on in patch 12 ("nubus: move nubus to its own 32-bit address space").

Certainly the existing offset is wrong, but given that there are currently no devices that use the super slot then I will bring the change to remove the offset forward to this patch in v5.

If not:

Reviewed-by: Laurent Vivier <laurent@vivier.eu>

Thanks,
Laurent


ATB,

Mark.



reply via email to

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