qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] mac99: Add motherboard devices before PCI cards
@ 2014-06-23 22:03 BALATON Zoltan
  2014-06-23 22:44 ` [Qemu-devel] [Qemu-ppc] " Mark Cave-Ayland
  0 siblings, 1 reply; 3+ messages in thread
From: BALATON Zoltan @ 2014-06-23 22:03 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-ppc, agraf, afaerber

Change the order of creating devices for New World Mac emulation so
that devices on the motherboard are added first and PCI cards (VGA and
NIC) come later. As a side effect, this also causes OpenBIOS to map
the motherboard devices into the MMIO space to the same addresses as
on real hardware and allow clients that hardcode these addresses (e.g.
MorphOS) to find and use them until OpenBIOS is tought to map devices
to specific addresses. (On real hardware the graphics and network
cards are really on separate buses but we don't model that yet.) This
brings the memory map closer to what is found on PowerMac3,1.

Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu>
---
 hw/ppc/mac_newworld.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/hw/ppc/mac_newworld.c b/hw/ppc/mac_newworld.c
index e493dc1..1a1e305 100644
--- a/hw/ppc/mac_newworld.c
+++ b/hw/ppc/mac_newworld.c
@@ -373,18 +373,11 @@ static void ppc_core99_init(MachineState *machine)
         machine_arch = ARCH_MAC99;
     }
     /* init basic PC hardware */
-    pci_vga_init(pci_bus);
-
     escc_mem = escc_init(0, pic[0x25], pic[0x24],
                          serial_hds[0], serial_hds[1], ESCC_CLOCK, 4);
     memory_region_init_alias(escc_bar, NULL, "escc-bar",
                              escc_mem, 0, memory_region_size(escc_mem));
 
-    for(i = 0; i < nb_nics; i++)
-        pci_nic_init_nofail(&nd_table[i], pci_bus, "ne2k_pci", NULL);
-
-    ide_drive_get(hd, MAX_IDE_BUS);
-
     macio = pci_create(pci_bus, -1, TYPE_NEWWORLD_MACIO);
     dev = DEVICE(macio);
     qdev_connect_gpio_out(dev, 0, pic[0x19]); /* CUDA */
@@ -395,6 +388,8 @@ static void ppc_core99_init(MachineState *machine)
     macio_init(macio, pic_mem, escc_bar);
 
     /* We only emulate 2 out of 3 IDE controllers for now */
+    ide_drive_get(hd, MAX_IDE_BUS);
+
     macio_ide = MACIO_IDE(object_resolve_path_component(OBJECT(macio),
                                                         "ide[0]"));
     macio_ide_init_drives(macio_ide, hd);
@@ -420,9 +415,14 @@ static void ppc_core99_init(MachineState *machine)
         }
     }
 
+    pci_vga_init(pci_bus);
+
     if (graphic_depth != 15 && graphic_depth != 32 && graphic_depth != 8)
         graphic_depth = 15;
 
+    for(i = 0; i < nb_nics; i++)
+        pci_nic_init_nofail(&nd_table[i], pci_bus, "ne2k_pci", NULL);
+
     /* The NewWorld NVRAM is not located in the MacIO device */
     dev = qdev_create(NULL, TYPE_MACIO_NVRAM);
     qdev_prop_set_uint32(dev, "size", 0x2000);
-- 
1.8.1.5

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [Qemu-ppc] [PATCH] mac99: Add motherboard devices before PCI cards
  2014-06-23 22:03 [Qemu-devel] [PATCH] mac99: Add motherboard devices before PCI cards BALATON Zoltan
@ 2014-06-23 22:44 ` Mark Cave-Ayland
  2014-06-24 10:30   ` BALATON Zoltan
  0 siblings, 1 reply; 3+ messages in thread
From: Mark Cave-Ayland @ 2014-06-23 22:44 UTC (permalink / raw)
  To: BALATON Zoltan, qemu-devel; +Cc: qemu-ppc, afaerber

On 23/06/14 23:03, BALATON Zoltan wrote:

> Change the order of creating devices for New World Mac emulation so
> that devices on the motherboard are added first and PCI cards (VGA and
> NIC) come later. As a side effect, this also causes OpenBIOS to map
> the motherboard devices into the MMIO space to the same addresses as
> on real hardware and allow clients that hardcode these addresses (e.g.
> MorphOS) to find and use them until OpenBIOS is tought to map devices
> to specific addresses. (On real hardware the graphics and network
> cards are really on separate buses but we don't model that yet.) This
> brings the memory map closer to what is found on PowerMac3,1.
>
> Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu>
> ---
>   hw/ppc/mac_newworld.c | 14 +++++++-------
>   1 file changed, 7 insertions(+), 7 deletions(-)
>
> diff --git a/hw/ppc/mac_newworld.c b/hw/ppc/mac_newworld.c
> index e493dc1..1a1e305 100644
> --- a/hw/ppc/mac_newworld.c
> +++ b/hw/ppc/mac_newworld.c
> @@ -373,18 +373,11 @@ static void ppc_core99_init(MachineState *machine)
>           machine_arch = ARCH_MAC99;
>       }
>       /* init basic PC hardware */
> -    pci_vga_init(pci_bus);
> -
>       escc_mem = escc_init(0, pic[0x25], pic[0x24],
>                            serial_hds[0], serial_hds[1], ESCC_CLOCK, 4);
>       memory_region_init_alias(escc_bar, NULL, "escc-bar",
>                                escc_mem, 0, memory_region_size(escc_mem));
>
> -    for(i = 0; i < nb_nics; i++)
> -        pci_nic_init_nofail(&nd_table[i], pci_bus, "ne2k_pci", NULL);
> -
> -    ide_drive_get(hd, MAX_IDE_BUS);
> -
>       macio = pci_create(pci_bus, -1, TYPE_NEWWORLD_MACIO);
>       dev = DEVICE(macio);
>       qdev_connect_gpio_out(dev, 0, pic[0x19]); /* CUDA */
> @@ -395,6 +388,8 @@ static void ppc_core99_init(MachineState *machine)
>       macio_init(macio, pic_mem, escc_bar);
>
>       /* We only emulate 2 out of 3 IDE controllers for now */
> +    ide_drive_get(hd, MAX_IDE_BUS);
> +
>       macio_ide = MACIO_IDE(object_resolve_path_component(OBJECT(macio),
>                                                           "ide[0]"));
>       macio_ide_init_drives(macio_ide, hd);
> @@ -420,9 +415,14 @@ static void ppc_core99_init(MachineState *machine)
>           }
>       }
>
> +    pci_vga_init(pci_bus);
> +
>       if (graphic_depth != 15 && graphic_depth != 32 && graphic_depth != 8)
>           graphic_depth = 15;

Missing braces here.

> +    for(i = 0; i < nb_nics; i++)
> +        pci_nic_init_nofail(&nd_table[i], pci_bus, "ne2k_pci", NULL);
> +

And here too.

>       /* The NewWorld NVRAM is not located in the MacIO device */
>       dev = qdev_create(NULL, TYPE_MACIO_NVRAM);
>       qdev_prop_set_uint32(dev, "size", 0x2000);

Generally the rule with QEMU is that as you change parts of the code 
that haven't been touched for a while, you should update them to meet 
the new style guidelines. Did you run the diffs through 
scripts/checkpatch.pl at all as that should catch styling points like this?


ATB,

Mark.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [Qemu-ppc] [PATCH] mac99: Add motherboard devices before PCI cards
  2014-06-23 22:44 ` [Qemu-devel] [Qemu-ppc] " Mark Cave-Ayland
@ 2014-06-24 10:30   ` BALATON Zoltan
  0 siblings, 0 replies; 3+ messages in thread
From: BALATON Zoltan @ 2014-06-24 10:30 UTC (permalink / raw)
  To: Mark Cave-Ayland; +Cc: qemu-ppc, qemu-devel, afaerber

On Mon, 23 Jun 2014, Mark Cave-Ayland wrote:
> On 23/06/14 23:03, BALATON Zoltan wrote:
>> Change the order of creating devices for New World Mac emulation so
>> that devices on the motherboard are added first and PCI cards (VGA and
>> NIC) come later. As a side effect, this also causes OpenBIOS to map
>> the motherboard devices into the MMIO space to the same addresses as
>> on real hardware and allow clients that hardcode these addresses (e.g.
>> MorphOS) to find and use them until OpenBIOS is tought to map devices
>> to specific addresses. (On real hardware the graphics and network
>> cards are really on separate buses but we don't model that yet.) This
>> brings the memory map closer to what is found on PowerMac3,1.
>> 
>> Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu>
>> ---
>>   hw/ppc/mac_newworld.c | 14 +++++++-------
>>   1 file changed, 7 insertions(+), 7 deletions(-)
>> 
>> diff --git a/hw/ppc/mac_newworld.c b/hw/ppc/mac_newworld.c
>> index e493dc1..1a1e305 100644
>> --- a/hw/ppc/mac_newworld.c
>> +++ b/hw/ppc/mac_newworld.c
>> @@ -373,18 +373,11 @@ static void ppc_core99_init(MachineState *machine)
>>           machine_arch = ARCH_MAC99;
>>       }
>>       /* init basic PC hardware */
>> -    pci_vga_init(pci_bus);
>> -
>>       escc_mem = escc_init(0, pic[0x25], pic[0x24],
>>                            serial_hds[0], serial_hds[1], ESCC_CLOCK, 4);
>>       memory_region_init_alias(escc_bar, NULL, "escc-bar",
>>                                escc_mem, 0, memory_region_size(escc_mem));
>> 
>> -    for(i = 0; i < nb_nics; i++)
>> -        pci_nic_init_nofail(&nd_table[i], pci_bus, "ne2k_pci", NULL);
>> -
>> -    ide_drive_get(hd, MAX_IDE_BUS);
>> -
>>       macio = pci_create(pci_bus, -1, TYPE_NEWWORLD_MACIO);
>>       dev = DEVICE(macio);
>>       qdev_connect_gpio_out(dev, 0, pic[0x19]); /* CUDA */
>> @@ -395,6 +388,8 @@ static void ppc_core99_init(MachineState *machine)
>>       macio_init(macio, pic_mem, escc_bar);
>>
>>       /* We only emulate 2 out of 3 IDE controllers for now */
>> +    ide_drive_get(hd, MAX_IDE_BUS);
>> +
>>       macio_ide = MACIO_IDE(object_resolve_path_component(OBJECT(macio),
>>                                                           "ide[0]"));
>>       macio_ide_init_drives(macio_ide, hd);
>> @@ -420,9 +415,14 @@ static void ppc_core99_init(MachineState *machine)
>>           }
>>       }
>> 
>> +    pci_vga_init(pci_bus);
>> +
>>       if (graphic_depth != 15 && graphic_depth != 32 && graphic_depth != 8)
>>           graphic_depth = 15;
>
> Missing braces here.
>
>> +    for(i = 0; i < nb_nics; i++)
>> +        pci_nic_init_nofail(&nd_table[i], pci_bus, "ne2k_pci", NULL);
>> +
>
> And here too.
>
>>       /* The NewWorld NVRAM is not located in the MacIO device */
>>       dev = qdev_create(NULL, TYPE_MACIO_NVRAM);
>>       qdev_prop_set_uint32(dev, "size", 0x2000);
>
> Generally the rule with QEMU is that as you change parts of the code that 
> haven't been touched for a while, you should update them to meet the new 
> style guidelines. Did you run the diffs through scripts/checkpatch.pl at all 
> as that should catch styling points like this?

Not this one as I haven't expected it to break anything and I did not 
expect it to be broken. Sent a v2.

Regards,
BALATON Zoltan

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-06-24 10:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-06-23 22:03 [Qemu-devel] [PATCH] mac99: Add motherboard devices before PCI cards BALATON Zoltan
2014-06-23 22:44 ` [Qemu-devel] [Qemu-ppc] " Mark Cave-Ayland
2014-06-24 10:30   ` BALATON Zoltan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).