[PATCH 07/10] hw/ppc/mac.h: Move macio specific atuff out from shared header

BALATON Zoltan posted 10 patches 3 years, 4 months ago
Maintainers: John Snow <jsnow@redhat.com>, Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
There is a newer version of this series
[PATCH 07/10] hw/ppc/mac.h: Move macio specific atuff out from shared header
Posted by BALATON Zoltan 3 years, 4 months ago
Move the parts specific to and only used by macio out from the shared
mac.h into macio.c where they better belong.

Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu>
---
 hw/misc/macio/macio.c | 26 ++++++++++++++++++++++++--
 hw/ppc/mac.h          | 23 -----------------------
 2 files changed, 24 insertions(+), 25 deletions(-)

diff --git a/hw/misc/macio/macio.c b/hw/misc/macio/macio.c
index c1fad43f6c..eca5983a4d 100644
--- a/hw/misc/macio/macio.c
+++ b/hw/misc/macio/macio.c
@@ -37,8 +37,30 @@
 #include "hw/intc/heathrow_pic.h"
 #include "trace.h"
 
-/* Note: this code is strongly inspirated from the corresponding code
- * in PearPC */
+#define ESCC_CLOCK 3686400
+
+/* Old World IRQs */
+#define OLDWORLD_CUDA_IRQ      0x12
+#define OLDWORLD_ESCCB_IRQ     0x10
+#define OLDWORLD_ESCCA_IRQ     0xf
+#define OLDWORLD_IDE0_IRQ      0xd
+#define OLDWORLD_IDE0_DMA_IRQ  0x2
+#define OLDWORLD_IDE1_IRQ      0xe
+#define OLDWORLD_IDE1_DMA_IRQ  0x3
+
+/* New World IRQs */
+#define NEWWORLD_CUDA_IRQ      0x19
+#define NEWWORLD_PMU_IRQ       0x19
+#define NEWWORLD_ESCCB_IRQ     0x24
+#define NEWWORLD_ESCCA_IRQ     0x25
+#define NEWWORLD_IDE0_IRQ      0xd
+#define NEWWORLD_IDE0_DMA_IRQ  0x2
+#define NEWWORLD_IDE1_IRQ      0xe
+#define NEWWORLD_IDE1_DMA_IRQ  0x3
+#define NEWWORLD_EXTING_GPIO1  0x2f
+#define NEWWORLD_EXTING_GPIO9  0x37
+
+/* Note: this code is strongly inspired by the corresponding code in PearPC */
 
 /*
  * The mac-io has two interfaces to the ESCC. One is called "escc-legacy",
diff --git a/hw/ppc/mac.h b/hw/ppc/mac.h
index e97087c7e7..55cb02c990 100644
--- a/hw/ppc/mac.h
+++ b/hw/ppc/mac.h
@@ -35,29 +35,6 @@
 #define KERNEL_LOAD_ADDR 0x01000000
 #define KERNEL_GAP       0x00100000
 
-#define ESCC_CLOCK 3686400
-
-/* Old World IRQs */
-#define OLDWORLD_CUDA_IRQ      0x12
-#define OLDWORLD_ESCCB_IRQ     0x10
-#define OLDWORLD_ESCCA_IRQ     0xf
-#define OLDWORLD_IDE0_IRQ      0xd
-#define OLDWORLD_IDE0_DMA_IRQ  0x2
-#define OLDWORLD_IDE1_IRQ      0xe
-#define OLDWORLD_IDE1_DMA_IRQ  0x3
-
-/* New World IRQs */
-#define NEWWORLD_CUDA_IRQ      0x19
-#define NEWWORLD_PMU_IRQ       0x19
-#define NEWWORLD_ESCCB_IRQ     0x24
-#define NEWWORLD_ESCCA_IRQ     0x25
-#define NEWWORLD_IDE0_IRQ      0xd
-#define NEWWORLD_IDE0_DMA_IRQ  0x2
-#define NEWWORLD_IDE1_IRQ      0xe
-#define NEWWORLD_IDE1_DMA_IRQ  0x3
-#define NEWWORLD_EXTING_GPIO1  0x2f
-#define NEWWORLD_EXTING_GPIO9  0x37
-
 /* Grackle PCI */
 #define TYPE_GRACKLE_PCI_HOST_BRIDGE "grackle-pcihost"
 
-- 
2.30.4
Re: [PATCH 07/10] hw/ppc/mac.h: Move macio specific atuff out from shared header
Posted by Mark Cave-Ayland 3 years, 4 months ago
On 17/09/2022 00:07, BALATON Zoltan wrote:

Typo in subject: s/atuff/stuff/

> Move the parts specific to and only used by macio out from the shared
> mac.h into macio.c where they better belong.
> 
> Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu>
> ---
>   hw/misc/macio/macio.c | 26 ++++++++++++++++++++++++--
>   hw/ppc/mac.h          | 23 -----------------------
>   2 files changed, 24 insertions(+), 25 deletions(-)
> 
> diff --git a/hw/misc/macio/macio.c b/hw/misc/macio/macio.c
> index c1fad43f6c..eca5983a4d 100644
> --- a/hw/misc/macio/macio.c
> +++ b/hw/misc/macio/macio.c
> @@ -37,8 +37,30 @@
>   #include "hw/intc/heathrow_pic.h"
>   #include "trace.h"
>   
> -/* Note: this code is strongly inspirated from the corresponding code
> - * in PearPC */
> +#define ESCC_CLOCK 3686400
> +
> +/* Old World IRQs */
> +#define OLDWORLD_CUDA_IRQ      0x12
> +#define OLDWORLD_ESCCB_IRQ     0x10
> +#define OLDWORLD_ESCCA_IRQ     0xf
> +#define OLDWORLD_IDE0_IRQ      0xd
> +#define OLDWORLD_IDE0_DMA_IRQ  0x2
> +#define OLDWORLD_IDE1_IRQ      0xe
> +#define OLDWORLD_IDE1_DMA_IRQ  0x3
> +
> +/* New World IRQs */
> +#define NEWWORLD_CUDA_IRQ      0x19
> +#define NEWWORLD_PMU_IRQ       0x19
> +#define NEWWORLD_ESCCB_IRQ     0x24
> +#define NEWWORLD_ESCCA_IRQ     0x25
> +#define NEWWORLD_IDE0_IRQ      0xd
> +#define NEWWORLD_IDE0_DMA_IRQ  0x2
> +#define NEWWORLD_IDE1_IRQ      0xe
> +#define NEWWORLD_IDE1_DMA_IRQ  0x3
> +#define NEWWORLD_EXTING_GPIO1  0x2f
> +#define NEWWORLD_EXTING_GPIO9  0x37
> +
> +/* Note: this code is strongly inspired by the corresponding code in PearPC */

These IRQ numbers are effectively hardcoded because of the board layout (and at some 
point some of this wiring may move to the board), so I think macio.h is the best 
place for these to allow for use in multiple places if needed.

>   /*
>    * The mac-io has two interfaces to the ESCC. One is called "escc-legacy",
> diff --git a/hw/ppc/mac.h b/hw/ppc/mac.h
> index e97087c7e7..55cb02c990 100644
> --- a/hw/ppc/mac.h
> +++ b/hw/ppc/mac.h
> @@ -35,29 +35,6 @@
>   #define KERNEL_LOAD_ADDR 0x01000000
>   #define KERNEL_GAP       0x00100000
>   
> -#define ESCC_CLOCK 3686400
> -
> -/* Old World IRQs */
> -#define OLDWORLD_CUDA_IRQ      0x12
> -#define OLDWORLD_ESCCB_IRQ     0x10
> -#define OLDWORLD_ESCCA_IRQ     0xf
> -#define OLDWORLD_IDE0_IRQ      0xd
> -#define OLDWORLD_IDE0_DMA_IRQ  0x2
> -#define OLDWORLD_IDE1_IRQ      0xe
> -#define OLDWORLD_IDE1_DMA_IRQ  0x3
> -
> -/* New World IRQs */
> -#define NEWWORLD_CUDA_IRQ      0x19
> -#define NEWWORLD_PMU_IRQ       0x19
> -#define NEWWORLD_ESCCB_IRQ     0x24
> -#define NEWWORLD_ESCCA_IRQ     0x25
> -#define NEWWORLD_IDE0_IRQ      0xd
> -#define NEWWORLD_IDE0_DMA_IRQ  0x2
> -#define NEWWORLD_IDE1_IRQ      0xe
> -#define NEWWORLD_IDE1_DMA_IRQ  0x3
> -#define NEWWORLD_EXTING_GPIO1  0x2f
> -#define NEWWORLD_EXTING_GPIO9  0x37
> -
>   /* Grackle PCI */
>   #define TYPE_GRACKLE_PCI_HOST_BRIDGE "grackle-pcihost"


ATB,

Mark.
Re: [PATCH 07/10] hw/ppc/mac.h: Move macio specific atuff out from shared header
Posted by BALATON Zoltan 3 years, 4 months ago
On Sun, 25 Sep 2022, Mark Cave-Ayland wrote:
> On 17/09/2022 00:07, BALATON Zoltan wrote:
> Typo in subject: s/atuff/stuff/
>> Move the parts specific to and only used by macio out from the shared
>> mac.h into macio.c where they better belong.
>> 
>> Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu>
>> ---
>>   hw/misc/macio/macio.c | 26 ++++++++++++++++++++++++--
>>   hw/ppc/mac.h          | 23 -----------------------
>>   2 files changed, 24 insertions(+), 25 deletions(-)
>> 
>> diff --git a/hw/misc/macio/macio.c b/hw/misc/macio/macio.c
>> index c1fad43f6c..eca5983a4d 100644
>> --- a/hw/misc/macio/macio.c
>> +++ b/hw/misc/macio/macio.c
>> @@ -37,8 +37,30 @@
>>   #include "hw/intc/heathrow_pic.h"
>>   #include "trace.h"
>>   -/* Note: this code is strongly inspirated from the corresponding code
>> - * in PearPC */
>> +#define ESCC_CLOCK 3686400
>> +
>> +/* Old World IRQs */
>> +#define OLDWORLD_CUDA_IRQ      0x12
>> +#define OLDWORLD_ESCCB_IRQ     0x10
>> +#define OLDWORLD_ESCCA_IRQ     0xf
>> +#define OLDWORLD_IDE0_IRQ      0xd
>> +#define OLDWORLD_IDE0_DMA_IRQ  0x2
>> +#define OLDWORLD_IDE1_IRQ      0xe
>> +#define OLDWORLD_IDE1_DMA_IRQ  0x3
>> +
>> +/* New World IRQs */
>> +#define NEWWORLD_CUDA_IRQ      0x19
>> +#define NEWWORLD_PMU_IRQ       0x19
>> +#define NEWWORLD_ESCCB_IRQ     0x24
>> +#define NEWWORLD_ESCCA_IRQ     0x25
>> +#define NEWWORLD_IDE0_IRQ      0xd
>> +#define NEWWORLD_IDE0_DMA_IRQ  0x2
>> +#define NEWWORLD_IDE1_IRQ      0xe
>> +#define NEWWORLD_IDE1_DMA_IRQ  0x3
>> +#define NEWWORLD_EXTING_GPIO1  0x2f
>> +#define NEWWORLD_EXTING_GPIO9  0x37
>> +
>> +/* Note: this code is strongly inspired by the corresponding code in 
>> PearPC */
>
> These IRQ numbers are effectively hardcoded because of the board layout (and 
> at some point some of this wiring may move to the board), so I think macio.h 
> is the best place for these to allow for use in multiple places if needed.

They aren't needed anywhere else currently that's what I've moved them 
here and they could be moved elsewhere when needed but I can put it in the 
header too if you like just don't see the need for that.

Regards,
BALATON Zoltan

>>   /*
>>    * The mac-io has two interfaces to the ESCC. One is called 
>> "escc-legacy",
>> diff --git a/hw/ppc/mac.h b/hw/ppc/mac.h
>> index e97087c7e7..55cb02c990 100644
>> --- a/hw/ppc/mac.h
>> +++ b/hw/ppc/mac.h
>> @@ -35,29 +35,6 @@
>>   #define KERNEL_LOAD_ADDR 0x01000000
>>   #define KERNEL_GAP       0x00100000
>>   -#define ESCC_CLOCK 3686400
>> -
>> -/* Old World IRQs */
>> -#define OLDWORLD_CUDA_IRQ      0x12
>> -#define OLDWORLD_ESCCB_IRQ     0x10
>> -#define OLDWORLD_ESCCA_IRQ     0xf
>> -#define OLDWORLD_IDE0_IRQ      0xd
>> -#define OLDWORLD_IDE0_DMA_IRQ  0x2
>> -#define OLDWORLD_IDE1_IRQ      0xe
>> -#define OLDWORLD_IDE1_DMA_IRQ  0x3
>> -
>> -/* New World IRQs */
>> -#define NEWWORLD_CUDA_IRQ      0x19
>> -#define NEWWORLD_PMU_IRQ       0x19
>> -#define NEWWORLD_ESCCB_IRQ     0x24
>> -#define NEWWORLD_ESCCA_IRQ     0x25
>> -#define NEWWORLD_IDE0_IRQ      0xd
>> -#define NEWWORLD_IDE0_DMA_IRQ  0x2
>> -#define NEWWORLD_IDE1_IRQ      0xe
>> -#define NEWWORLD_IDE1_DMA_IRQ  0x3
>> -#define NEWWORLD_EXTING_GPIO1  0x2f
>> -#define NEWWORLD_EXTING_GPIO9  0x37
>> -
>>   /* Grackle PCI */
>>   #define TYPE_GRACKLE_PCI_HOST_BRIDGE "grackle-pcihost"
>
>
> ATB,
>
> Mark.
>
>
Re: [PATCH 07/10] hw/ppc/mac.h: Move macio specific atuff out from shared header
Posted by Philippe Mathieu-Daudé via 3 years, 4 months ago
On 17/9/22 01:07, BALATON Zoltan wrote:
> Move the parts specific to and only used by macio out from the shared
> mac.h into macio.c where they better belong.
> 
> Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu>
> ---
>   hw/misc/macio/macio.c | 26 ++++++++++++++++++++++++--
>   hw/ppc/mac.h          | 23 -----------------------
>   2 files changed, 24 insertions(+), 25 deletions(-)

BTW Subject: "Move macio specifics out of shared header"?
Re: [PATCH 07/10] hw/ppc/mac.h: Move macio specific atuff out from shared header
Posted by Philippe Mathieu-Daudé via 3 years, 4 months ago
On 17/9/22 01:07, BALATON Zoltan wrote:
> Move the parts specific to and only used by macio out from the shared
> mac.h into macio.c where they better belong.
> 
> Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu>
> ---
>   hw/misc/macio/macio.c | 26 ++++++++++++++++++++++++--
>   hw/ppc/mac.h          | 23 -----------------------
>   2 files changed, 24 insertions(+), 25 deletions(-)

Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>