[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v3 0/4] ide: implement simple legacy/native mode switching fo
From: |
Peter Maydell |
Subject: |
Re: [PATCH v3 0/4] ide: implement simple legacy/native mode switching for PCI IDE controllers |
Date: |
Tue, 21 Nov 2023 11:04:08 +0000 |
On Tue, 21 Nov 2023 at 10:18, Mark Cave-Ayland
<mark.cave-ayland@ilande.co.uk> wrote:
> In the meantime the department of hacks has been looking at ways of trying to
> set BAR
> addresses during reset, and humbly submits the following for consideration:
> +static void via_ide_bar_reset(void *opaque)
> +{
> + PCIIDEState *d = PCI_IDE(opaque);
> + PCIDevice *pd = PCI_DEVICE(d);
> + uint8_t *pci_conf = pd->config;
> +
> + /*
> + * Some OSs e.g. AmigaOS rely on the default BMDMA BAR value being
> present
> + * to initialise correctly, even in legacy mode(!)
> + */
> + pci_set_long(pci_conf + PCI_BASE_ADDRESS_4,
> + 0xcc00 | PCI_BASE_ADDRESS_SPACE_IO);
> +
> + /* Unregister reset function */
> + qemu_unregister_reset(via_ide_bar_reset, opaque);
> +}
> +
> static void via_ide_reset(DeviceState *dev)
> {
> PCIIDEState *d = PCI_IDE(dev);
> @@ -156,6 +174,9 @@ static void via_ide_reset(DeviceState *dev)
> pci_set_long(pci_conf + 0x68, 0x00000200);
> /* PCI PM Block */
> pci_set_long(pci_conf + 0xc0, 0x00020001);
> +
> + /* Register separate function to set BAR values after PCI bus reset */
> + qemu_register_reset(via_ide_bar_reset, d);
> }
I'm definitely not very enthusiastic about hacks which
increase the usage of qemu_register_reset() and rely
on reset-hook call order. We really need to try to have
another go at cleaning up the reset mess and this would be
yet another thing somebody's going to have to undo some day.
Unregistering your reset function in the reset function is
also rather curious...
thanks
-- PMM
- Re: [PATCH v3 0/4] ide: implement simple legacy/native mode switching for PCI IDE controllers, (continued)
- Re: [PATCH v3 0/4] ide: implement simple legacy/native mode switching for PCI IDE controllers, Kevin Wolf, 2023/11/20
- Re: [PATCH v3 0/4] ide: implement simple legacy/native mode switching for PCI IDE controllers, BALATON Zoltan, 2023/11/20
- Re: [PATCH v3 0/4] ide: implement simple legacy/native mode switching for PCI IDE controllers, BALATON Zoltan, 2023/11/20
- Re: [PATCH v3 0/4] ide: implement simple legacy/native mode switching for PCI IDE controllers, Kevin Wolf, 2023/11/20
- Re: [PATCH v3 0/4] ide: implement simple legacy/native mode switching for PCI IDE controllers, BALATON Zoltan, 2023/11/20
- Re: [PATCH v3 0/4] ide: implement simple legacy/native mode switching for PCI IDE controllers, Kevin Wolf, 2023/11/21
- Re: [PATCH v3 0/4] ide: implement simple legacy/native mode switching for PCI IDE controllers, Mark Cave-Ayland, 2023/11/20
- Re: [PATCH v3 0/4] ide: implement simple legacy/native mode switching for PCI IDE controllers, BALATON Zoltan, 2023/11/20
- Re: [PATCH v3 0/4] ide: implement simple legacy/native mode switching for PCI IDE controllers, Kevin Wolf, 2023/11/21
- Re: [PATCH v3 0/4] ide: implement simple legacy/native mode switching for PCI IDE controllers, Mark Cave-Ayland, 2023/11/21
- Re: [PATCH v3 0/4] ide: implement simple legacy/native mode switching for PCI IDE controllers,
Peter Maydell <=
Re: [PATCH v3 0/4] ide: implement simple legacy/native mode switching for PCI IDE controllers, Mark Cave-Ayland, 2023/11/20