Re: [Qemu-devel] [PATCH 02/25] hw/dma/i8257: Rename DMA_init() to i8257_dma_init()

2018-03-10 Thread Mark Cave-Ayland

On 09/03/18 20:51, Artyom Tarasenko wrote:


On Fri, Mar 9, 2018 at 1:19 PM, Mark Cave-Ayland
 wrote:

On 09/03/18 10:43, Philippe Mathieu-Daudé wrote:


Hi Mark,

On 03/09/2018 11:32 AM, Mark Cave-Ayland wrote:


On 08/03/18 22:39, Philippe Mathieu-Daudé wrote:


- Move the header from hw/isa/ to hw/dma/
- Remove the old i386/pc dependency
- use a bool type for the high_page_enable argument

Signed-off-by: Philippe Mathieu-Daudé 
---
include/hw/{isa => dma}/i8257.h | 6 ++
include/hw/isa/isa.h| 2 --
hw/dma/i82374.c | 3 ++-
hw/dma/i8257.c  | 4 ++--
hw/i386/pc.c| 3 ++-
hw/mips/mips_fulong2e.c | 3 ++-
hw/mips/mips_jazz.c | 3 ++-
hw/mips/mips_malta.c| 3 ++-
hw/sparc/sun4m.c| 4 
hw/sparc64/sun4u.c  | 4 
MAINTAINERS | 2 +-
11 files changed, 19 insertions(+), 18 deletions(-)
rename include/hw/{isa => dma}/i8257.h (86%)

diff --git a/include/hw/isa/i8257.h b/include/hw/dma/i8257.h
similarity index 86%
rename from include/hw/isa/i8257.h
rename to include/hw/dma/i8257.h
index 88a2766a3f..2cab50bb6c 100644
--- a/include/hw/isa/i8257.h
+++ b/include/hw/dma/i8257.h
@@ -1,6 +1,10 @@
#ifndef HW_I8257_H
#define HW_I8257_H
+#include "hw/hw.h"
+#include "hw/isa/isa.h"
+#include "exec/ioport.h"
+
#define TYPE_I8257 "i8257"
  typedef struct I8257Regs {
@@ -40,4 +44,6 @@ typedef struct I8257State {
PortioList portio_pageh;
} I8257State;
+void i8257_dma_init(ISABus *bus, bool high_page_enable);
+
#endif
diff --git a/include/hw/isa/isa.h b/include/hw/isa/isa.h
index 95593408ef..b9dbab24b4 100644
--- a/include/hw/isa/isa.h
+++ b/include/hw/isa/isa.h
@@ -151,6 +151,4 @@ static inline ISABus
*isa_bus_from_device(ISADevice *d)
return ISA_BUS(qdev_get_parent_bus(DEVICE(d)));
}
-/* i8257.c */
-void DMA_init(ISABus *bus, int high_page_enable);
#endif
diff --git a/hw/dma/i82374.c b/hw/dma/i82374.c
index 6c0f975df0..83c87d92e0 100644
--- a/hw/dma/i82374.c
+++ b/hw/dma/i82374.c
@@ -24,6 +24,7 @@
  #include "qemu/osdep.h"
#include "hw/isa/isa.h"
+#include "hw/dma/i8257.h"
  #define TYPE_I82374 "i82374"
#define I82374(obj) OBJECT_CHECK(I82374State, (obj), TYPE_I82374)
@@ -123,7 +124,7 @@ static void i82374_realize(DeviceState *dev, Error
**errp)
portio_list_add(>port_list,
isa_address_space_io(>parent_obj),
s->iobase);
-DMA_init(isa_bus_from_device(ISA_DEVICE(dev)), 1);
+i8257_dma_init(isa_bus_from_device(ISA_DEVICE(dev)), true);
memset(s->commands, 0, sizeof(s->commands));
}
diff --git a/hw/dma/i8257.c b/hw/dma/i8257.c
index bd23e893bf..52675e97c9 100644
--- a/hw/dma/i8257.c
+++ b/hw/dma/i8257.c
@@ -24,7 +24,7 @@
#include "qemu/osdep.h"
#include "hw/hw.h"
#include "hw/isa/isa.h"
-#include "hw/isa/i8257.h"
+#include "hw/dma/i8257.h"
#include "qemu/main-loop.h"
#include "trace.h"
@@ -622,7 +622,7 @@ static void i8257_register_types(void)
  type_init(i8257_register_types)
-void DMA_init(ISABus *bus, int high_page_enable)
+void i8257_dma_init(ISABus *bus, bool high_page_enable)
{
ISADevice *isa1, *isa2;
DeviceState *d;
diff --git a/hw/i386/pc.c b/hw/i386/pc.c
index 81364932d3..ec75b09a8f 100644
--- a/hw/i386/pc.c
+++ b/hw/i386/pc.c
@@ -41,6 +41,7 @@
#include "elf.h"
#include "multiboot.h"
#include "hw/timer/mc146818rtc.h"
+#include "hw/dma/i8257.h"
#include "hw/timer/i8254.h"
#include "hw/audio/pcspk.h"
#include "hw/pci/msi.h"
@@ -1609,7 +1610,7 @@ void pc_basic_device_init(ISABus *isa_bus,
qemu_irq *gsi,
port92_init(port92, a20_line[1]);
g_free(a20_line);
-DMA_init(isa_bus, 0);
+i8257_dma_init(isa_bus, 0);
  for(i = 0; i < MAX_FD; i++) {
fd[i] = drive_get(IF_FLOPPY, 0, i);
diff --git a/hw/mips/mips_fulong2e.c b/hw/mips/mips_fulong2e.c
index dc77b55755..0545fcd899 100644
--- a/hw/mips/mips_fulong2e.c
+++ b/hw/mips/mips_fulong2e.c
@@ -22,6 +22,7 @@
#include "qapi/error.h"
#include "hw/hw.h"
#include "hw/i386/pc.h"
+#include "hw/dma/i8257.h"
#include "hw/char/serial.h"
#include "hw/char/parallel.h"
#include "hw/block/fdc.h"
@@ -360,7 +361,7 @@ static void mips_fulong2e_init(MachineState
*machine)
  /* init other devices */
pit = i8254_pit_init(isa_bus, 0x40, 0, NULL);
-DMA_init(isa_bus, 0);
+i8257_dma_init(isa_bus, 0);
  /* Super I/O */
isa_create_simple(isa_bus, "i8042");
diff --git a/hw/mips/mips_jazz.c b/hw/mips/mips_jazz.c
index b24305b7b4..827ffdcd4a 100644
--- a/hw/mips/mips_jazz.c
+++ b/hw/mips/mips_jazz.c
@@ -27,6 +27,7 @@
#include "hw/mips/mips.h"
#include "hw/mips/cpudevs.h"
#include "hw/i386/pc.h"
+#include "hw/dma/i8257.h"
#include 

Re: [Qemu-devel] [PATCH 02/25] hw/dma/i8257: Rename DMA_init() to i8257_dma_init()

2018-03-09 Thread Artyom Tarasenko
On Fri, Mar 9, 2018 at 1:19 PM, Mark Cave-Ayland
 wrote:
> On 09/03/18 10:43, Philippe Mathieu-Daudé wrote:
>>
>> Hi Mark,
>>
>> On 03/09/2018 11:32 AM, Mark Cave-Ayland wrote:
>>>
>>> On 08/03/18 22:39, Philippe Mathieu-Daudé wrote:
>>>
 - Move the header from hw/isa/ to hw/dma/
 - Remove the old i386/pc dependency
 - use a bool type for the high_page_enable argument

 Signed-off-by: Philippe Mathieu-Daudé 
 ---
include/hw/{isa => dma}/i8257.h | 6 ++
include/hw/isa/isa.h| 2 --
hw/dma/i82374.c | 3 ++-
hw/dma/i8257.c  | 4 ++--
hw/i386/pc.c| 3 ++-
hw/mips/mips_fulong2e.c | 3 ++-
hw/mips/mips_jazz.c | 3 ++-
hw/mips/mips_malta.c| 3 ++-
hw/sparc/sun4m.c| 4 
hw/sparc64/sun4u.c  | 4 
MAINTAINERS | 2 +-
11 files changed, 19 insertions(+), 18 deletions(-)
rename include/hw/{isa => dma}/i8257.h (86%)

 diff --git a/include/hw/isa/i8257.h b/include/hw/dma/i8257.h
 similarity index 86%
 rename from include/hw/isa/i8257.h
 rename to include/hw/dma/i8257.h
 index 88a2766a3f..2cab50bb6c 100644
 --- a/include/hw/isa/i8257.h
 +++ b/include/hw/dma/i8257.h
 @@ -1,6 +1,10 @@
#ifndef HW_I8257_H
#define HW_I8257_H
+#include "hw/hw.h"
 +#include "hw/isa/isa.h"
 +#include "exec/ioport.h"
 +
#define TYPE_I8257 "i8257"
  typedef struct I8257Regs {
 @@ -40,4 +44,6 @@ typedef struct I8257State {
PortioList portio_pageh;
} I8257State;
+void i8257_dma_init(ISABus *bus, bool high_page_enable);
 +
#endif
 diff --git a/include/hw/isa/isa.h b/include/hw/isa/isa.h
 index 95593408ef..b9dbab24b4 100644
 --- a/include/hw/isa/isa.h
 +++ b/include/hw/isa/isa.h
 @@ -151,6 +151,4 @@ static inline ISABus
 *isa_bus_from_device(ISADevice *d)
return ISA_BUS(qdev_get_parent_bus(DEVICE(d)));
}
-/* i8257.c */
 -void DMA_init(ISABus *bus, int high_page_enable);
#endif
 diff --git a/hw/dma/i82374.c b/hw/dma/i82374.c
 index 6c0f975df0..83c87d92e0 100644
 --- a/hw/dma/i82374.c
 +++ b/hw/dma/i82374.c
 @@ -24,6 +24,7 @@
  #include "qemu/osdep.h"
#include "hw/isa/isa.h"
 +#include "hw/dma/i8257.h"
  #define TYPE_I82374 "i82374"
#define I82374(obj) OBJECT_CHECK(I82374State, (obj), TYPE_I82374)
 @@ -123,7 +124,7 @@ static void i82374_realize(DeviceState *dev, Error
 **errp)
portio_list_add(>port_list,
 isa_address_space_io(>parent_obj),
s->iobase);
-DMA_init(isa_bus_from_device(ISA_DEVICE(dev)), 1);
 +i8257_dma_init(isa_bus_from_device(ISA_DEVICE(dev)), true);
memset(s->commands, 0, sizeof(s->commands));
}
diff --git a/hw/dma/i8257.c b/hw/dma/i8257.c
 index bd23e893bf..52675e97c9 100644
 --- a/hw/dma/i8257.c
 +++ b/hw/dma/i8257.c
 @@ -24,7 +24,7 @@
#include "qemu/osdep.h"
#include "hw/hw.h"
#include "hw/isa/isa.h"
 -#include "hw/isa/i8257.h"
 +#include "hw/dma/i8257.h"
#include "qemu/main-loop.h"
#include "trace.h"
@@ -622,7 +622,7 @@ static void i8257_register_types(void)
  type_init(i8257_register_types)
-void DMA_init(ISABus *bus, int high_page_enable)
 +void i8257_dma_init(ISABus *bus, bool high_page_enable)
{
ISADevice *isa1, *isa2;
DeviceState *d;
 diff --git a/hw/i386/pc.c b/hw/i386/pc.c
 index 81364932d3..ec75b09a8f 100644
 --- a/hw/i386/pc.c
 +++ b/hw/i386/pc.c
 @@ -41,6 +41,7 @@
#include "elf.h"
#include "multiboot.h"
#include "hw/timer/mc146818rtc.h"
 +#include "hw/dma/i8257.h"
#include "hw/timer/i8254.h"
#include "hw/audio/pcspk.h"
#include "hw/pci/msi.h"
 @@ -1609,7 +1610,7 @@ void pc_basic_device_init(ISABus *isa_bus,
 qemu_irq *gsi,
port92_init(port92, a20_line[1]);
g_free(a20_line);
-DMA_init(isa_bus, 0);
 +i8257_dma_init(isa_bus, 0);
  for(i = 0; i < MAX_FD; i++) {
fd[i] = drive_get(IF_FLOPPY, 0, i);
 diff --git a/hw/mips/mips_fulong2e.c b/hw/mips/mips_fulong2e.c
 index dc77b55755..0545fcd899 100644
 --- a/hw/mips/mips_fulong2e.c
 +++ b/hw/mips/mips_fulong2e.c
 @@ -22,6 +22,7 @@
#include "qapi/error.h"
#include "hw/hw.h"
#include "hw/i386/pc.h"
 +#include "hw/dma/i8257.h"
#include "hw/char/serial.h"
#include "hw/char/parallel.h"
#include "hw/block/fdc.h"
 @@ -360,7 +361,7 @@ static void mips_fulong2e_init(MachineState
 

Re: [Qemu-devel] [PATCH 02/25] hw/dma/i8257: Rename DMA_init() to i8257_dma_init()

2018-03-09 Thread Mark Cave-Ayland

On 09/03/18 10:43, Philippe Mathieu-Daudé wrote:

Hi Mark,

On 03/09/2018 11:32 AM, Mark Cave-Ayland wrote:

On 08/03/18 22:39, Philippe Mathieu-Daudé wrote:


- Move the header from hw/isa/ to hw/dma/
- Remove the old i386/pc dependency
- use a bool type for the high_page_enable argument

Signed-off-by: Philippe Mathieu-Daudé 
---
   include/hw/{isa => dma}/i8257.h | 6 ++
   include/hw/isa/isa.h    | 2 --
   hw/dma/i82374.c | 3 ++-
   hw/dma/i8257.c  | 4 ++--
   hw/i386/pc.c    | 3 ++-
   hw/mips/mips_fulong2e.c | 3 ++-
   hw/mips/mips_jazz.c | 3 ++-
   hw/mips/mips_malta.c    | 3 ++-
   hw/sparc/sun4m.c    | 4 
   hw/sparc64/sun4u.c  | 4 
   MAINTAINERS | 2 +-
   11 files changed, 19 insertions(+), 18 deletions(-)
   rename include/hw/{isa => dma}/i8257.h (86%)

diff --git a/include/hw/isa/i8257.h b/include/hw/dma/i8257.h
similarity index 86%
rename from include/hw/isa/i8257.h
rename to include/hw/dma/i8257.h
index 88a2766a3f..2cab50bb6c 100644
--- a/include/hw/isa/i8257.h
+++ b/include/hw/dma/i8257.h
@@ -1,6 +1,10 @@
   #ifndef HW_I8257_H
   #define HW_I8257_H
   +#include "hw/hw.h"
+#include "hw/isa/isa.h"
+#include "exec/ioport.h"
+
   #define TYPE_I8257 "i8257"
     typedef struct I8257Regs {
@@ -40,4 +44,6 @@ typedef struct I8257State {
   PortioList portio_pageh;
   } I8257State;
   +void i8257_dma_init(ISABus *bus, bool high_page_enable);
+
   #endif
diff --git a/include/hw/isa/isa.h b/include/hw/isa/isa.h
index 95593408ef..b9dbab24b4 100644
--- a/include/hw/isa/isa.h
+++ b/include/hw/isa/isa.h
@@ -151,6 +151,4 @@ static inline ISABus
*isa_bus_from_device(ISADevice *d)
   return ISA_BUS(qdev_get_parent_bus(DEVICE(d)));
   }
   -/* i8257.c */
-void DMA_init(ISABus *bus, int high_page_enable);
   #endif
diff --git a/hw/dma/i82374.c b/hw/dma/i82374.c
index 6c0f975df0..83c87d92e0 100644
--- a/hw/dma/i82374.c
+++ b/hw/dma/i82374.c
@@ -24,6 +24,7 @@
     #include "qemu/osdep.h"
   #include "hw/isa/isa.h"
+#include "hw/dma/i8257.h"
     #define TYPE_I82374 "i82374"
   #define I82374(obj) OBJECT_CHECK(I82374State, (obj), TYPE_I82374)
@@ -123,7 +124,7 @@ static void i82374_realize(DeviceState *dev, Error
**errp)
   portio_list_add(>port_list,
isa_address_space_io(>parent_obj),
   s->iobase);
   -    DMA_init(isa_bus_from_device(ISA_DEVICE(dev)), 1);
+    i8257_dma_init(isa_bus_from_device(ISA_DEVICE(dev)), true);
   memset(s->commands, 0, sizeof(s->commands));
   }
   diff --git a/hw/dma/i8257.c b/hw/dma/i8257.c
index bd23e893bf..52675e97c9 100644
--- a/hw/dma/i8257.c
+++ b/hw/dma/i8257.c
@@ -24,7 +24,7 @@
   #include "qemu/osdep.h"
   #include "hw/hw.h"
   #include "hw/isa/isa.h"
-#include "hw/isa/i8257.h"
+#include "hw/dma/i8257.h"
   #include "qemu/main-loop.h"
   #include "trace.h"
   @@ -622,7 +622,7 @@ static void i8257_register_types(void)
     type_init(i8257_register_types)
   -void DMA_init(ISABus *bus, int high_page_enable)
+void i8257_dma_init(ISABus *bus, bool high_page_enable)
   {
   ISADevice *isa1, *isa2;
   DeviceState *d;
diff --git a/hw/i386/pc.c b/hw/i386/pc.c
index 81364932d3..ec75b09a8f 100644
--- a/hw/i386/pc.c
+++ b/hw/i386/pc.c
@@ -41,6 +41,7 @@
   #include "elf.h"
   #include "multiboot.h"
   #include "hw/timer/mc146818rtc.h"
+#include "hw/dma/i8257.h"
   #include "hw/timer/i8254.h"
   #include "hw/audio/pcspk.h"
   #include "hw/pci/msi.h"
@@ -1609,7 +1610,7 @@ void pc_basic_device_init(ISABus *isa_bus,
qemu_irq *gsi,
   port92_init(port92, a20_line[1]);
   g_free(a20_line);
   -    DMA_init(isa_bus, 0);
+    i8257_dma_init(isa_bus, 0);
     for(i = 0; i < MAX_FD; i++) {
   fd[i] = drive_get(IF_FLOPPY, 0, i);
diff --git a/hw/mips/mips_fulong2e.c b/hw/mips/mips_fulong2e.c
index dc77b55755..0545fcd899 100644
--- a/hw/mips/mips_fulong2e.c
+++ b/hw/mips/mips_fulong2e.c
@@ -22,6 +22,7 @@
   #include "qapi/error.h"
   #include "hw/hw.h"
   #include "hw/i386/pc.h"
+#include "hw/dma/i8257.h"
   #include "hw/char/serial.h"
   #include "hw/char/parallel.h"
   #include "hw/block/fdc.h"
@@ -360,7 +361,7 @@ static void mips_fulong2e_init(MachineState *machine)
     /* init other devices */
   pit = i8254_pit_init(isa_bus, 0x40, 0, NULL);
-    DMA_init(isa_bus, 0);
+    i8257_dma_init(isa_bus, 0);
     /* Super I/O */
   isa_create_simple(isa_bus, "i8042");
diff --git a/hw/mips/mips_jazz.c b/hw/mips/mips_jazz.c
index b24305b7b4..827ffdcd4a 100644
--- a/hw/mips/mips_jazz.c
+++ b/hw/mips/mips_jazz.c
@@ -27,6 +27,7 @@
   #include "hw/mips/mips.h"
   #include "hw/mips/cpudevs.h"
   #include "hw/i386/pc.h"
+#include "hw/dma/i8257.h"
   #include "hw/char/serial.h"
   #include "hw/char/parallel.h"
   #include "hw/isa/isa.h"
@@ -220,7 +221,7 @@ static void mips_jazz_init(MachineState *machine,
   /* ISA devices */
   i8259 = i8259_init(isa_bus, env->irq[4]);
 

Re: [Qemu-devel] [PATCH 02/25] hw/dma/i8257: Rename DMA_init() to i8257_dma_init()

2018-03-09 Thread Philippe Mathieu-Daudé
Hi Mark,

On 03/09/2018 11:32 AM, Mark Cave-Ayland wrote:
> On 08/03/18 22:39, Philippe Mathieu-Daudé wrote:
> 
>> - Move the header from hw/isa/ to hw/dma/
>> - Remove the old i386/pc dependency
>> - use a bool type for the high_page_enable argument
>>
>> Signed-off-by: Philippe Mathieu-Daudé 
>> ---
>>   include/hw/{isa => dma}/i8257.h | 6 ++
>>   include/hw/isa/isa.h    | 2 --
>>   hw/dma/i82374.c | 3 ++-
>>   hw/dma/i8257.c  | 4 ++--
>>   hw/i386/pc.c    | 3 ++-
>>   hw/mips/mips_fulong2e.c | 3 ++-
>>   hw/mips/mips_jazz.c | 3 ++-
>>   hw/mips/mips_malta.c    | 3 ++-
>>   hw/sparc/sun4m.c    | 4 
>>   hw/sparc64/sun4u.c  | 4 
>>   MAINTAINERS | 2 +-
>>   11 files changed, 19 insertions(+), 18 deletions(-)
>>   rename include/hw/{isa => dma}/i8257.h (86%)
>>
>> diff --git a/include/hw/isa/i8257.h b/include/hw/dma/i8257.h
>> similarity index 86%
>> rename from include/hw/isa/i8257.h
>> rename to include/hw/dma/i8257.h
>> index 88a2766a3f..2cab50bb6c 100644
>> --- a/include/hw/isa/i8257.h
>> +++ b/include/hw/dma/i8257.h
>> @@ -1,6 +1,10 @@
>>   #ifndef HW_I8257_H
>>   #define HW_I8257_H
>>   +#include "hw/hw.h"
>> +#include "hw/isa/isa.h"
>> +#include "exec/ioport.h"
>> +
>>   #define TYPE_I8257 "i8257"
>>     typedef struct I8257Regs {
>> @@ -40,4 +44,6 @@ typedef struct I8257State {
>>   PortioList portio_pageh;
>>   } I8257State;
>>   +void i8257_dma_init(ISABus *bus, bool high_page_enable);
>> +
>>   #endif
>> diff --git a/include/hw/isa/isa.h b/include/hw/isa/isa.h
>> index 95593408ef..b9dbab24b4 100644
>> --- a/include/hw/isa/isa.h
>> +++ b/include/hw/isa/isa.h
>> @@ -151,6 +151,4 @@ static inline ISABus
>> *isa_bus_from_device(ISADevice *d)
>>   return ISA_BUS(qdev_get_parent_bus(DEVICE(d)));
>>   }
>>   -/* i8257.c */
>> -void DMA_init(ISABus *bus, int high_page_enable);
>>   #endif
>> diff --git a/hw/dma/i82374.c b/hw/dma/i82374.c
>> index 6c0f975df0..83c87d92e0 100644
>> --- a/hw/dma/i82374.c
>> +++ b/hw/dma/i82374.c
>> @@ -24,6 +24,7 @@
>>     #include "qemu/osdep.h"
>>   #include "hw/isa/isa.h"
>> +#include "hw/dma/i8257.h"
>>     #define TYPE_I82374 "i82374"
>>   #define I82374(obj) OBJECT_CHECK(I82374State, (obj), TYPE_I82374)
>> @@ -123,7 +124,7 @@ static void i82374_realize(DeviceState *dev, Error
>> **errp)
>>   portio_list_add(>port_list,
>> isa_address_space_io(>parent_obj),
>>   s->iobase);
>>   -    DMA_init(isa_bus_from_device(ISA_DEVICE(dev)), 1);
>> +    i8257_dma_init(isa_bus_from_device(ISA_DEVICE(dev)), true);
>>   memset(s->commands, 0, sizeof(s->commands));
>>   }
>>   diff --git a/hw/dma/i8257.c b/hw/dma/i8257.c
>> index bd23e893bf..52675e97c9 100644
>> --- a/hw/dma/i8257.c
>> +++ b/hw/dma/i8257.c
>> @@ -24,7 +24,7 @@
>>   #include "qemu/osdep.h"
>>   #include "hw/hw.h"
>>   #include "hw/isa/isa.h"
>> -#include "hw/isa/i8257.h"
>> +#include "hw/dma/i8257.h"
>>   #include "qemu/main-loop.h"
>>   #include "trace.h"
>>   @@ -622,7 +622,7 @@ static void i8257_register_types(void)
>>     type_init(i8257_register_types)
>>   -void DMA_init(ISABus *bus, int high_page_enable)
>> +void i8257_dma_init(ISABus *bus, bool high_page_enable)
>>   {
>>   ISADevice *isa1, *isa2;
>>   DeviceState *d;
>> diff --git a/hw/i386/pc.c b/hw/i386/pc.c
>> index 81364932d3..ec75b09a8f 100644
>> --- a/hw/i386/pc.c
>> +++ b/hw/i386/pc.c
>> @@ -41,6 +41,7 @@
>>   #include "elf.h"
>>   #include "multiboot.h"
>>   #include "hw/timer/mc146818rtc.h"
>> +#include "hw/dma/i8257.h"
>>   #include "hw/timer/i8254.h"
>>   #include "hw/audio/pcspk.h"
>>   #include "hw/pci/msi.h"
>> @@ -1609,7 +1610,7 @@ void pc_basic_device_init(ISABus *isa_bus,
>> qemu_irq *gsi,
>>   port92_init(port92, a20_line[1]);
>>   g_free(a20_line);
>>   -    DMA_init(isa_bus, 0);
>> +    i8257_dma_init(isa_bus, 0);
>>     for(i = 0; i < MAX_FD; i++) {
>>   fd[i] = drive_get(IF_FLOPPY, 0, i);
>> diff --git a/hw/mips/mips_fulong2e.c b/hw/mips/mips_fulong2e.c
>> index dc77b55755..0545fcd899 100644
>> --- a/hw/mips/mips_fulong2e.c
>> +++ b/hw/mips/mips_fulong2e.c
>> @@ -22,6 +22,7 @@
>>   #include "qapi/error.h"
>>   #include "hw/hw.h"
>>   #include "hw/i386/pc.h"
>> +#include "hw/dma/i8257.h"
>>   #include "hw/char/serial.h"
>>   #include "hw/char/parallel.h"
>>   #include "hw/block/fdc.h"
>> @@ -360,7 +361,7 @@ static void mips_fulong2e_init(MachineState *machine)
>>     /* init other devices */
>>   pit = i8254_pit_init(isa_bus, 0x40, 0, NULL);
>> -    DMA_init(isa_bus, 0);
>> +    i8257_dma_init(isa_bus, 0);
>>     /* Super I/O */
>>   isa_create_simple(isa_bus, "i8042");
>> diff --git a/hw/mips/mips_jazz.c b/hw/mips/mips_jazz.c
>> index b24305b7b4..827ffdcd4a 100644
>> --- a/hw/mips/mips_jazz.c
>> +++ b/hw/mips/mips_jazz.c
>> @@ -27,6 +27,7 @@
>>   #include "hw/mips/mips.h"
>>   #include "hw/mips/cpudevs.h"

Re: [Qemu-devel] [PATCH 02/25] hw/dma/i8257: Rename DMA_init() to i8257_dma_init()

2018-03-09 Thread Mark Cave-Ayland

On 08/03/18 22:39, Philippe Mathieu-Daudé wrote:


- Move the header from hw/isa/ to hw/dma/
- Remove the old i386/pc dependency
- use a bool type for the high_page_enable argument

Signed-off-by: Philippe Mathieu-Daudé 
---
  include/hw/{isa => dma}/i8257.h | 6 ++
  include/hw/isa/isa.h| 2 --
  hw/dma/i82374.c | 3 ++-
  hw/dma/i8257.c  | 4 ++--
  hw/i386/pc.c| 3 ++-
  hw/mips/mips_fulong2e.c | 3 ++-
  hw/mips/mips_jazz.c | 3 ++-
  hw/mips/mips_malta.c| 3 ++-
  hw/sparc/sun4m.c| 4 
  hw/sparc64/sun4u.c  | 4 
  MAINTAINERS | 2 +-
  11 files changed, 19 insertions(+), 18 deletions(-)
  rename include/hw/{isa => dma}/i8257.h (86%)

diff --git a/include/hw/isa/i8257.h b/include/hw/dma/i8257.h
similarity index 86%
rename from include/hw/isa/i8257.h
rename to include/hw/dma/i8257.h
index 88a2766a3f..2cab50bb6c 100644
--- a/include/hw/isa/i8257.h
+++ b/include/hw/dma/i8257.h
@@ -1,6 +1,10 @@
  #ifndef HW_I8257_H
  #define HW_I8257_H
  
+#include "hw/hw.h"

+#include "hw/isa/isa.h"
+#include "exec/ioport.h"
+
  #define TYPE_I8257 "i8257"
  
  typedef struct I8257Regs {

@@ -40,4 +44,6 @@ typedef struct I8257State {
  PortioList portio_pageh;
  } I8257State;
  
+void i8257_dma_init(ISABus *bus, bool high_page_enable);

+
  #endif
diff --git a/include/hw/isa/isa.h b/include/hw/isa/isa.h
index 95593408ef..b9dbab24b4 100644
--- a/include/hw/isa/isa.h
+++ b/include/hw/isa/isa.h
@@ -151,6 +151,4 @@ static inline ISABus *isa_bus_from_device(ISADevice *d)
  return ISA_BUS(qdev_get_parent_bus(DEVICE(d)));
  }
  
-/* i8257.c */

-void DMA_init(ISABus *bus, int high_page_enable);
  #endif
diff --git a/hw/dma/i82374.c b/hw/dma/i82374.c
index 6c0f975df0..83c87d92e0 100644
--- a/hw/dma/i82374.c
+++ b/hw/dma/i82374.c
@@ -24,6 +24,7 @@
  
  #include "qemu/osdep.h"

  #include "hw/isa/isa.h"
+#include "hw/dma/i8257.h"
  
  #define TYPE_I82374 "i82374"

  #define I82374(obj) OBJECT_CHECK(I82374State, (obj), TYPE_I82374)
@@ -123,7 +124,7 @@ static void i82374_realize(DeviceState *dev, Error **errp)
  portio_list_add(>port_list, isa_address_space_io(>parent_obj),
  s->iobase);
  
-DMA_init(isa_bus_from_device(ISA_DEVICE(dev)), 1);

+i8257_dma_init(isa_bus_from_device(ISA_DEVICE(dev)), true);
  memset(s->commands, 0, sizeof(s->commands));
  }
  
diff --git a/hw/dma/i8257.c b/hw/dma/i8257.c

index bd23e893bf..52675e97c9 100644
--- a/hw/dma/i8257.c
+++ b/hw/dma/i8257.c
@@ -24,7 +24,7 @@
  #include "qemu/osdep.h"
  #include "hw/hw.h"
  #include "hw/isa/isa.h"
-#include "hw/isa/i8257.h"
+#include "hw/dma/i8257.h"
  #include "qemu/main-loop.h"
  #include "trace.h"
  
@@ -622,7 +622,7 @@ static void i8257_register_types(void)
  
  type_init(i8257_register_types)
  
-void DMA_init(ISABus *bus, int high_page_enable)

+void i8257_dma_init(ISABus *bus, bool high_page_enable)
  {
  ISADevice *isa1, *isa2;
  DeviceState *d;
diff --git a/hw/i386/pc.c b/hw/i386/pc.c
index 81364932d3..ec75b09a8f 100644
--- a/hw/i386/pc.c
+++ b/hw/i386/pc.c
@@ -41,6 +41,7 @@
  #include "elf.h"
  #include "multiboot.h"
  #include "hw/timer/mc146818rtc.h"
+#include "hw/dma/i8257.h"
  #include "hw/timer/i8254.h"
  #include "hw/audio/pcspk.h"
  #include "hw/pci/msi.h"
@@ -1609,7 +1610,7 @@ void pc_basic_device_init(ISABus *isa_bus, qemu_irq *gsi,
  port92_init(port92, a20_line[1]);
  g_free(a20_line);
  
-DMA_init(isa_bus, 0);

+i8257_dma_init(isa_bus, 0);
  
  for(i = 0; i < MAX_FD; i++) {

  fd[i] = drive_get(IF_FLOPPY, 0, i);
diff --git a/hw/mips/mips_fulong2e.c b/hw/mips/mips_fulong2e.c
index dc77b55755..0545fcd899 100644
--- a/hw/mips/mips_fulong2e.c
+++ b/hw/mips/mips_fulong2e.c
@@ -22,6 +22,7 @@
  #include "qapi/error.h"
  #include "hw/hw.h"
  #include "hw/i386/pc.h"
+#include "hw/dma/i8257.h"
  #include "hw/char/serial.h"
  #include "hw/char/parallel.h"
  #include "hw/block/fdc.h"
@@ -360,7 +361,7 @@ static void mips_fulong2e_init(MachineState *machine)
  
  /* init other devices */

  pit = i8254_pit_init(isa_bus, 0x40, 0, NULL);
-DMA_init(isa_bus, 0);
+i8257_dma_init(isa_bus, 0);
  
  /* Super I/O */

  isa_create_simple(isa_bus, "i8042");
diff --git a/hw/mips/mips_jazz.c b/hw/mips/mips_jazz.c
index b24305b7b4..827ffdcd4a 100644
--- a/hw/mips/mips_jazz.c
+++ b/hw/mips/mips_jazz.c
@@ -27,6 +27,7 @@
  #include "hw/mips/mips.h"
  #include "hw/mips/cpudevs.h"
  #include "hw/i386/pc.h"
+#include "hw/dma/i8257.h"
  #include "hw/char/serial.h"
  #include "hw/char/parallel.h"
  #include "hw/isa/isa.h"
@@ -220,7 +221,7 @@ static void mips_jazz_init(MachineState *machine,
  /* ISA devices */
  i8259 = i8259_init(isa_bus, env->irq[4]);
  isa_bus_irqs(isa_bus, i8259);
-DMA_init(isa_bus, 0);
+i8257_dma_init(isa_bus, 0);
  pit = i8254_pit_init(isa_bus, 0x40, 0, NULL);
  

[Qemu-devel] [PATCH 02/25] hw/dma/i8257: Rename DMA_init() to i8257_dma_init()

2018-03-08 Thread Philippe Mathieu-Daudé
- Move the header from hw/isa/ to hw/dma/
- Remove the old i386/pc dependency
- use a bool type for the high_page_enable argument

Signed-off-by: Philippe Mathieu-Daudé 
---
 include/hw/{isa => dma}/i8257.h | 6 ++
 include/hw/isa/isa.h| 2 --
 hw/dma/i82374.c | 3 ++-
 hw/dma/i8257.c  | 4 ++--
 hw/i386/pc.c| 3 ++-
 hw/mips/mips_fulong2e.c | 3 ++-
 hw/mips/mips_jazz.c | 3 ++-
 hw/mips/mips_malta.c| 3 ++-
 hw/sparc/sun4m.c| 4 
 hw/sparc64/sun4u.c  | 4 
 MAINTAINERS | 2 +-
 11 files changed, 19 insertions(+), 18 deletions(-)
 rename include/hw/{isa => dma}/i8257.h (86%)

diff --git a/include/hw/isa/i8257.h b/include/hw/dma/i8257.h
similarity index 86%
rename from include/hw/isa/i8257.h
rename to include/hw/dma/i8257.h
index 88a2766a3f..2cab50bb6c 100644
--- a/include/hw/isa/i8257.h
+++ b/include/hw/dma/i8257.h
@@ -1,6 +1,10 @@
 #ifndef HW_I8257_H
 #define HW_I8257_H
 
+#include "hw/hw.h"
+#include "hw/isa/isa.h"
+#include "exec/ioport.h"
+
 #define TYPE_I8257 "i8257"
 
 typedef struct I8257Regs {
@@ -40,4 +44,6 @@ typedef struct I8257State {
 PortioList portio_pageh;
 } I8257State;
 
+void i8257_dma_init(ISABus *bus, bool high_page_enable);
+
 #endif
diff --git a/include/hw/isa/isa.h b/include/hw/isa/isa.h
index 95593408ef..b9dbab24b4 100644
--- a/include/hw/isa/isa.h
+++ b/include/hw/isa/isa.h
@@ -151,6 +151,4 @@ static inline ISABus *isa_bus_from_device(ISADevice *d)
 return ISA_BUS(qdev_get_parent_bus(DEVICE(d)));
 }
 
-/* i8257.c */
-void DMA_init(ISABus *bus, int high_page_enable);
 #endif
diff --git a/hw/dma/i82374.c b/hw/dma/i82374.c
index 6c0f975df0..83c87d92e0 100644
--- a/hw/dma/i82374.c
+++ b/hw/dma/i82374.c
@@ -24,6 +24,7 @@
 
 #include "qemu/osdep.h"
 #include "hw/isa/isa.h"
+#include "hw/dma/i8257.h"
 
 #define TYPE_I82374 "i82374"
 #define I82374(obj) OBJECT_CHECK(I82374State, (obj), TYPE_I82374)
@@ -123,7 +124,7 @@ static void i82374_realize(DeviceState *dev, Error **errp)
 portio_list_add(>port_list, isa_address_space_io(>parent_obj),
 s->iobase);
 
-DMA_init(isa_bus_from_device(ISA_DEVICE(dev)), 1);
+i8257_dma_init(isa_bus_from_device(ISA_DEVICE(dev)), true);
 memset(s->commands, 0, sizeof(s->commands));
 }
 
diff --git a/hw/dma/i8257.c b/hw/dma/i8257.c
index bd23e893bf..52675e97c9 100644
--- a/hw/dma/i8257.c
+++ b/hw/dma/i8257.c
@@ -24,7 +24,7 @@
 #include "qemu/osdep.h"
 #include "hw/hw.h"
 #include "hw/isa/isa.h"
-#include "hw/isa/i8257.h"
+#include "hw/dma/i8257.h"
 #include "qemu/main-loop.h"
 #include "trace.h"
 
@@ -622,7 +622,7 @@ static void i8257_register_types(void)
 
 type_init(i8257_register_types)
 
-void DMA_init(ISABus *bus, int high_page_enable)
+void i8257_dma_init(ISABus *bus, bool high_page_enable)
 {
 ISADevice *isa1, *isa2;
 DeviceState *d;
diff --git a/hw/i386/pc.c b/hw/i386/pc.c
index 81364932d3..ec75b09a8f 100644
--- a/hw/i386/pc.c
+++ b/hw/i386/pc.c
@@ -41,6 +41,7 @@
 #include "elf.h"
 #include "multiboot.h"
 #include "hw/timer/mc146818rtc.h"
+#include "hw/dma/i8257.h"
 #include "hw/timer/i8254.h"
 #include "hw/audio/pcspk.h"
 #include "hw/pci/msi.h"
@@ -1609,7 +1610,7 @@ void pc_basic_device_init(ISABus *isa_bus, qemu_irq *gsi,
 port92_init(port92, a20_line[1]);
 g_free(a20_line);
 
-DMA_init(isa_bus, 0);
+i8257_dma_init(isa_bus, 0);
 
 for(i = 0; i < MAX_FD; i++) {
 fd[i] = drive_get(IF_FLOPPY, 0, i);
diff --git a/hw/mips/mips_fulong2e.c b/hw/mips/mips_fulong2e.c
index dc77b55755..0545fcd899 100644
--- a/hw/mips/mips_fulong2e.c
+++ b/hw/mips/mips_fulong2e.c
@@ -22,6 +22,7 @@
 #include "qapi/error.h"
 #include "hw/hw.h"
 #include "hw/i386/pc.h"
+#include "hw/dma/i8257.h"
 #include "hw/char/serial.h"
 #include "hw/char/parallel.h"
 #include "hw/block/fdc.h"
@@ -360,7 +361,7 @@ static void mips_fulong2e_init(MachineState *machine)
 
 /* init other devices */
 pit = i8254_pit_init(isa_bus, 0x40, 0, NULL);
-DMA_init(isa_bus, 0);
+i8257_dma_init(isa_bus, 0);
 
 /* Super I/O */
 isa_create_simple(isa_bus, "i8042");
diff --git a/hw/mips/mips_jazz.c b/hw/mips/mips_jazz.c
index b24305b7b4..827ffdcd4a 100644
--- a/hw/mips/mips_jazz.c
+++ b/hw/mips/mips_jazz.c
@@ -27,6 +27,7 @@
 #include "hw/mips/mips.h"
 #include "hw/mips/cpudevs.h"
 #include "hw/i386/pc.h"
+#include "hw/dma/i8257.h"
 #include "hw/char/serial.h"
 #include "hw/char/parallel.h"
 #include "hw/isa/isa.h"
@@ -220,7 +221,7 @@ static void mips_jazz_init(MachineState *machine,
 /* ISA devices */
 i8259 = i8259_init(isa_bus, env->irq[4]);
 isa_bus_irqs(isa_bus, i8259);
-DMA_init(isa_bus, 0);
+i8257_dma_init(isa_bus, 0);
 pit = i8254_pit_init(isa_bus, 0x40, 0, NULL);
 pcspk_init(isa_bus, pit);
 
diff --git a/hw/mips/mips_malta.c b/hw/mips/mips_malta.c
index c74882c7e9..9cb86c432e 100644
--- a/hw/mips/mips_malta.c
+++