diff mbox series

[v2,20/20] q800: configure nubus available slots for Quadra 800

Message ID 20210915101026.25174-21-mark.cave-ayland@ilande.co.uk
State New
Headers show
Series nubus: bus, device, bridge, IRQ and address space improvements | expand

Commit Message

Mark Cave-Ayland Sept. 15, 2021, 10:10 a.m. UTC
Slot 0x9 is reserved for use by the in-built framebuffer whilst only slots
0xc, 0xd and 0xe physically exist on the Quadra 800.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
---
 hw/m68k/q800.c | 9 +++++++++
 1 file changed, 9 insertions(+)

Comments

BALATON Zoltan Sept. 15, 2021, 10:50 a.m. UTC | #1
On Wed, 15 Sep 2021, Mark Cave-Ayland wrote:
> Slot 0x9 is reserved for use by the in-built framebuffer whilst only slots
> 0xc, 0xd and 0xe physically exist on the Quadra 800.
>
> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
> ---
> hw/m68k/q800.c | 9 +++++++++
> 1 file changed, 9 insertions(+)
>
> diff --git a/hw/m68k/q800.c b/hw/m68k/q800.c
> index fbc45a301f..65c80421c6 100644
> --- a/hw/m68k/q800.c
> +++ b/hw/m68k/q800.c
> @@ -78,6 +78,13 @@
>
> #define MAC_CLOCK  3686418
>
> +/*
> + * Slot 0x9 is reserved for use by the in-built framebuffer whilst only
> + * slots 0xc, 0xd and 0xe physically exist on the Quadra 800
> + */
> +#define Q800_NUBUS_SLOTS_AVAILABLE    ((1UL << 0x9) | (1UL << 0xc) | \
> +                                       (1UL << 0xd) | (1UL << 0xe))

There is a BIT(x) macro for these kind of constants that I find more 
readable as there would be less < signs and perenthesis but I don't insist 
on using it just note for consideration in case you need another respin for 
other reasons. (That macro could also be used to shorten the ~(1UL << nr_bits)
values in other patches.)

Regards.
BALATON Zoltan

> +
> /*
>  * The GLUE (General Logic Unit) is an Apple custom integrated circuit chip
>  * that performs a variety of functions (RAM management, clock generation, ...).
> @@ -392,6 +399,8 @@ static void q800_init(MachineState *machine)
>     /* NuBus */
>
>     dev = qdev_new(TYPE_MAC_NUBUS_BRIDGE);
> +    qdev_prop_set_uint32(dev, "slot-available-mask",
> +                         Q800_NUBUS_SLOTS_AVAILABLE);
>     sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal);
>     sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, 9 * NUBUS_SUPER_SLOT_SIZE);
>     sysbus_mmio_map(SYS_BUS_DEVICE(dev), 1, NUBUS_SLOT_BASE +
>
Philippe Mathieu-Daudé Sept. 15, 2021, 11:32 a.m. UTC | #2
On 9/15/21 12:50 PM, BALATON Zoltan wrote:
> On Wed, 15 Sep 2021, Mark Cave-Ayland wrote:
>> Slot 0x9 is reserved for use by the in-built framebuffer whilst only
>> slots
>> 0xc, 0xd and 0xe physically exist on the Quadra 800.
>>
>> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
>> ---
>> hw/m68k/q800.c | 9 +++++++++
>> 1 file changed, 9 insertions(+)

>> +/*
>> + * Slot 0x9 is reserved for use by the in-built framebuffer whilst only
>> + * slots 0xc, 0xd and 0xe physically exist on the Quadra 800
>> + */
>> +#define Q800_NUBUS_SLOTS_AVAILABLE    ((1UL << 0x9) | (1UL << 0xc) | \
>> +                                       (1UL << 0xd) | (1UL << 0xe))
> 
> There is a BIT(x) macro for these kind of constants that I find more
> readable as there would be less < signs and perenthesis but I don't
> insist on using it just note for consideration in case you need another
> respin for other reasons. (That macro could also be used to shorten the
> ~(1UL << nr_bits)
> values in other patches.)

Good idea.
Mark Cave-Ayland Sept. 15, 2021, 11:41 a.m. UTC | #3
On 15/09/2021 11:50, BALATON Zoltan wrote:

> On Wed, 15 Sep 2021, Mark Cave-Ayland wrote:
>> Slot 0x9 is reserved for use by the in-built framebuffer whilst only slots
>> 0xc, 0xd and 0xe physically exist on the Quadra 800.
>>
>> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
>> ---
>> hw/m68k/q800.c | 9 +++++++++
>> 1 file changed, 9 insertions(+)
>>
>> diff --git a/hw/m68k/q800.c b/hw/m68k/q800.c
>> index fbc45a301f..65c80421c6 100644
>> --- a/hw/m68k/q800.c
>> +++ b/hw/m68k/q800.c
>> @@ -78,6 +78,13 @@
>>
>> #define MAC_CLOCK  3686418
>>
>> +/*
>> + * Slot 0x9 is reserved for use by the in-built framebuffer whilst only
>> + * slots 0xc, 0xd and 0xe physically exist on the Quadra 800
>> + */
>> +#define Q800_NUBUS_SLOTS_AVAILABLE    ((1UL << 0x9) | (1UL << 0xc) | \
>> +                                       (1UL << 0xd) | (1UL << 0xe))
> 
> There is a BIT(x) macro for these kind of constants that I find more readable as 
> there would be less < signs and perenthesis but I don't insist on using it just note 
> for consideration in case you need another respin for other reasons. (That macro 
> could also be used to shorten the ~(1UL << nr_bits)
> values in other patches.)
> 
> Regards.
> BALATON Zoltan

Good point. I need to head out for a few hours now, but I'll try this and incorporate 
it into a v3 patchset later (along with any other feedback from v2).

>> +
>> /*
>>  * The GLUE (General Logic Unit) is an Apple custom integrated circuit chip
>>  * that performs a variety of functions (RAM management, clock generation, ...).
>> @@ -392,6 +399,8 @@ static void q800_init(MachineState *machine)
>>     /* NuBus */
>>
>>     dev = qdev_new(TYPE_MAC_NUBUS_BRIDGE);
>> +    qdev_prop_set_uint32(dev, "slot-available-mask",
>> +                         Q800_NUBUS_SLOTS_AVAILABLE);
>>     sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal);
>>     sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, 9 * NUBUS_SUPER_SLOT_SIZE);
>>     sysbus_mmio_map(SYS_BUS_DEVICE(dev), 1, NUBUS_SLOT_BASE +


ATB,

Mark.
diff mbox series

Patch

diff --git a/hw/m68k/q800.c b/hw/m68k/q800.c
index fbc45a301f..65c80421c6 100644
--- a/hw/m68k/q800.c
+++ b/hw/m68k/q800.c
@@ -78,6 +78,13 @@ 
 
 #define MAC_CLOCK  3686418
 
+/*
+ * Slot 0x9 is reserved for use by the in-built framebuffer whilst only
+ * slots 0xc, 0xd and 0xe physically exist on the Quadra 800
+ */
+#define Q800_NUBUS_SLOTS_AVAILABLE    ((1UL << 0x9) | (1UL << 0xc) | \
+                                       (1UL << 0xd) | (1UL << 0xe))
+
 /*
  * The GLUE (General Logic Unit) is an Apple custom integrated circuit chip
  * that performs a variety of functions (RAM management, clock generation, ...).
@@ -392,6 +399,8 @@  static void q800_init(MachineState *machine)
     /* NuBus */
 
     dev = qdev_new(TYPE_MAC_NUBUS_BRIDGE);
+    qdev_prop_set_uint32(dev, "slot-available-mask",
+                         Q800_NUBUS_SLOTS_AVAILABLE);
     sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal);
     sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, 9 * NUBUS_SUPER_SLOT_SIZE);
     sysbus_mmio_map(SYS_BUS_DEVICE(dev), 1, NUBUS_SLOT_BASE +