[PATCH v2 08/12] hw/block/fdc-isa: Implement relocation and toggling for TYPE_ISA_FDC

Bernhard Beschow posted 12 patches 11 months, 2 weeks ago
Maintainers: Juan Quintela <quintela@redhat.com>, Peter Xu <peterx@redhat.com>, Fabiano Rosas <farosas@suse.de>, Leonardo Bras <leobras@redhat.com>, John Snow <jsnow@redhat.com>, Kevin Wolf <kwolf@redhat.com>, Hanna Reitz <hreitz@redhat.com>, "Michael S. Tsirkin" <mst@redhat.com>, Paolo Bonzini <pbonzini@redhat.com>, "Marc-André Lureau" <marcandre.lureau@redhat.com>, BALATON Zoltan <balaton@eik.bme.hu>, "Philippe Mathieu-Daudé" <philmd@linaro.org>, Jiaxun Yang <jiaxun.yang@flygoat.com>, David Hildenbrand <david@redhat.com>
There is a newer version of this series
[PATCH v2 08/12] hw/block/fdc-isa: Implement relocation and toggling for TYPE_ISA_FDC
Posted by Bernhard Beschow 11 months, 2 weeks ago
Implement isa_fdc_set_{enabled,iobase} in order to implement relocation and
toggling of SuperI/O functions in the VIA south bridges without breaking
encapsulation.

Signed-off-by: Bernhard Beschow <shentey@gmail.com>
---
 include/hw/block/fdc.h |  3 +++
 hw/block/fdc-isa.c     | 14 ++++++++++++++
 2 files changed, 17 insertions(+)

diff --git a/include/hw/block/fdc.h b/include/hw/block/fdc.h
index 35248c0837..c367c5efea 100644
--- a/include/hw/block/fdc.h
+++ b/include/hw/block/fdc.h
@@ -14,6 +14,9 @@ void fdctrl_init_sysbus(qemu_irq irq, hwaddr mmio_base, DriveInfo **fds);
 void sun4m_fdctrl_init(qemu_irq irq, hwaddr io_base,
                        DriveInfo **fds, qemu_irq *fdc_tc);
 
+void isa_fdc_set_iobase(ISADevice *fdc, hwaddr iobase);
+void isa_fdc_set_enabled(ISADevice *fdc, bool enabled);
+
 FloppyDriveType isa_fdc_get_drive_type(ISADevice *fdc, int i);
 int cmos_get_fd_drive_type(FloppyDriveType fd0);
 
diff --git a/hw/block/fdc-isa.c b/hw/block/fdc-isa.c
index b4c92b40b3..c989325de3 100644
--- a/hw/block/fdc-isa.c
+++ b/hw/block/fdc-isa.c
@@ -192,6 +192,20 @@ static Aml *build_fdinfo_aml(int idx, FloppyDriveType type)
     return dev;
 }
 
+void isa_fdc_set_iobase(ISADevice *fdc, hwaddr iobase)
+{
+    FDCtrlISABus *isa = ISA_FDC(fdc);
+
+    fdc->ioport_id = iobase;
+    isa->iobase = iobase;
+    portio_list_set_address(&isa->portio_list, isa->iobase);
+}
+
+void isa_fdc_set_enabled(ISADevice *fdc, bool enabled)
+{
+    portio_list_set_enabled(&ISA_FDC(fdc)->portio_list, enabled);
+}
+
 int cmos_get_fd_drive_type(FloppyDriveType fd0)
 {
     int val;
-- 
2.43.0
Re: [PATCH v2 08/12] hw/block/fdc-isa: Implement relocation and toggling for TYPE_ISA_FDC
Posted by BALATON Zoltan 11 months, 1 week ago
On Mon, 18 Dec 2023, Bernhard Beschow wrote:
> Implement isa_fdc_set_{enabled,iobase} in order to implement relocation and
> toggling of SuperI/O functions in the VIA south bridges without breaking
> encapsulation.

You may want to revise these commit messages. What toggling means is only 
defined in the last patch but I can't think of a better name for it other 
than spelling out enable/disable. It's probably also not relevant in this 
commit message to mention VIA south bridges as this is a generic function 
not specific to that usage only.

Regards,
BALATON Zoltan

> Signed-off-by: Bernhard Beschow <shentey@gmail.com>
> ---
> include/hw/block/fdc.h |  3 +++
> hw/block/fdc-isa.c     | 14 ++++++++++++++
> 2 files changed, 17 insertions(+)
>
> diff --git a/include/hw/block/fdc.h b/include/hw/block/fdc.h
> index 35248c0837..c367c5efea 100644
> --- a/include/hw/block/fdc.h
> +++ b/include/hw/block/fdc.h
> @@ -14,6 +14,9 @@ void fdctrl_init_sysbus(qemu_irq irq, hwaddr mmio_base, DriveInfo **fds);
> void sun4m_fdctrl_init(qemu_irq irq, hwaddr io_base,
>                        DriveInfo **fds, qemu_irq *fdc_tc);
>
> +void isa_fdc_set_iobase(ISADevice *fdc, hwaddr iobase);
> +void isa_fdc_set_enabled(ISADevice *fdc, bool enabled);
> +
> FloppyDriveType isa_fdc_get_drive_type(ISADevice *fdc, int i);
> int cmos_get_fd_drive_type(FloppyDriveType fd0);
>
> diff --git a/hw/block/fdc-isa.c b/hw/block/fdc-isa.c
> index b4c92b40b3..c989325de3 100644
> --- a/hw/block/fdc-isa.c
> +++ b/hw/block/fdc-isa.c
> @@ -192,6 +192,20 @@ static Aml *build_fdinfo_aml(int idx, FloppyDriveType type)
>     return dev;
> }
>
> +void isa_fdc_set_iobase(ISADevice *fdc, hwaddr iobase)
> +{
> +    FDCtrlISABus *isa = ISA_FDC(fdc);
> +
> +    fdc->ioport_id = iobase;
> +    isa->iobase = iobase;
> +    portio_list_set_address(&isa->portio_list, isa->iobase);
> +}
> +
> +void isa_fdc_set_enabled(ISADevice *fdc, bool enabled)
> +{
> +    portio_list_set_enabled(&ISA_FDC(fdc)->portio_list, enabled);
> +}
> +
> int cmos_get_fd_drive_type(FloppyDriveType fd0)
> {
>     int val;
>
Re: [PATCH v2 08/12] hw/block/fdc-isa: Implement relocation and toggling for TYPE_ISA_FDC
Posted by Bernhard Beschow 11 months, 1 week ago

Am 19. Dezember 2023 00:09:23 UTC schrieb BALATON Zoltan <balaton@eik.bme.hu>:
>On Mon, 18 Dec 2023, Bernhard Beschow wrote:
>> Implement isa_fdc_set_{enabled,iobase} in order to implement relocation and
>> toggling of SuperI/O functions in the VIA south bridges without breaking
>> encapsulation.
>
>You may want to revise these commit messages. What toggling means is only defined in the last patch but I can't think of a better name for it other than spelling out enable/disable.

I'll use enable/disable then.

> It's probably also not relevant in this commit message to mention VIA south bridges as this is a generic function not specific to that usage only.

I'll refer to SuperI/O chips rather than VIA specifically since I want to point out the distinction to properties.

Best regards,
Bernhard

>
>Regards,
>BALATON Zoltan
>
>> Signed-off-by: Bernhard Beschow <shentey@gmail.com>
>> ---
>> include/hw/block/fdc.h |  3 +++
>> hw/block/fdc-isa.c     | 14 ++++++++++++++
>> 2 files changed, 17 insertions(+)
>> 
>> diff --git a/include/hw/block/fdc.h b/include/hw/block/fdc.h
>> index 35248c0837..c367c5efea 100644
>> --- a/include/hw/block/fdc.h
>> +++ b/include/hw/block/fdc.h
>> @@ -14,6 +14,9 @@ void fdctrl_init_sysbus(qemu_irq irq, hwaddr mmio_base, DriveInfo **fds);
>> void sun4m_fdctrl_init(qemu_irq irq, hwaddr io_base,
>>                        DriveInfo **fds, qemu_irq *fdc_tc);
>> 
>> +void isa_fdc_set_iobase(ISADevice *fdc, hwaddr iobase);
>> +void isa_fdc_set_enabled(ISADevice *fdc, bool enabled);
>> +
>> FloppyDriveType isa_fdc_get_drive_type(ISADevice *fdc, int i);
>> int cmos_get_fd_drive_type(FloppyDriveType fd0);
>> 
>> diff --git a/hw/block/fdc-isa.c b/hw/block/fdc-isa.c
>> index b4c92b40b3..c989325de3 100644
>> --- a/hw/block/fdc-isa.c
>> +++ b/hw/block/fdc-isa.c
>> @@ -192,6 +192,20 @@ static Aml *build_fdinfo_aml(int idx, FloppyDriveType type)
>>     return dev;
>> }
>> 
>> +void isa_fdc_set_iobase(ISADevice *fdc, hwaddr iobase)
>> +{
>> +    FDCtrlISABus *isa = ISA_FDC(fdc);
>> +
>> +    fdc->ioport_id = iobase;
>> +    isa->iobase = iobase;
>> +    portio_list_set_address(&isa->portio_list, isa->iobase);
>> +}
>> +
>> +void isa_fdc_set_enabled(ISADevice *fdc, bool enabled)
>> +{
>> +    portio_list_set_enabled(&ISA_FDC(fdc)->portio_list, enabled);
>> +}
>> +
>> int cmos_get_fd_drive_type(FloppyDriveType fd0)
>> {
>>     int val;
>>