diff mbox series

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

Message ID 20231218185114.119736-9-shentey@gmail.com
State New
Headers show
Series hw/isa/vt82c686: Implement relocation and toggling of SuperI/O functions | expand

Commit Message

Bernhard Beschow Dec. 18, 2023, 6:51 p.m. UTC
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(+)

Comments

BALATON Zoltan Dec. 19, 2023, 12:09 a.m. UTC | #1
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;
>
Bernhard Beschow Dec. 21, 2023, 2:26 p.m. UTC | #2
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;
>>
diff mbox series

Patch

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;