[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 26/42] hw/isa/piix4: Make PIIX4's ACPI and USB functions opti
From: |
Bernhard Beschow |
Subject: |
Re: [PATCH 26/42] hw/isa/piix4: Make PIIX4's ACPI and USB functions optional |
Date: |
Sun, 18 Sep 2022 21:47:52 +0000 |
Am 18. September 2022 20:10:51 UTC schrieb Mark Cave-Ayland
<mark.cave-ayland@ilande.co.uk>:
>On 01/09/2022 17:25, Bernhard Beschow wrote:
>
>> This aligns PIIX4 with PIIX3.
>>
>> Signed-off-by: Bernhard Beschow <shentey@gmail.com>
>> ---
>> hw/isa/piix4.c | 44 ++++++++++++++++++++++++++++++++------------
>> hw/mips/malta.c | 6 ++++--
>> 2 files changed, 36 insertions(+), 14 deletions(-)
>>
>> diff --git a/hw/isa/piix4.c b/hw/isa/piix4.c
>> index 67881e3a75..ed9eca715f 100644
>> --- a/hw/isa/piix4.c
>> +++ b/hw/isa/piix4.c
>> @@ -50,9 +50,16 @@ struct PIIX4State {
>> PCIIDEState ide;
>> UHCIState uhci;
>> PIIX4PMState pm;
>> +
>> + uint32_t smb_io_base;
>> +
>> /* Reset Control Register */
>> MemoryRegion rcr_mem;
>> uint8_t rcr;
>> +
>> + bool has_acpi;
>> + bool has_usb;
>> + bool smm_enabled;
>> };
>> OBJECT_DECLARE_SIMPLE_TYPE(PIIX4State, PIIX4_PCI_DEVICE)
>> @@ -258,17 +265,26 @@ static void piix4_realize(PCIDevice *dev, Error **errp)
>> }
>> /* USB */
>> - qdev_prop_set_int32(DEVICE(&s->uhci), "addr", dev->devfn + 2);
>> - if (!qdev_realize(DEVICE(&s->uhci), BUS(pci_bus), errp)) {
>> - return;
>> + if (s->has_usb) {
>> + object_initialize_child(OBJECT(dev), "uhci", &s->uhci,
>> + "piix4-usb-uhci");
>
>Can you use the relevant TYPE_ macro here for the USB-UHCI device?
>
>> + qdev_prop_set_int32(DEVICE(&s->uhci), "addr", dev->devfn + 2);
>> + if (!qdev_realize(DEVICE(&s->uhci), BUS(pci_bus), errp)) {
>> + return;
>> + }
>> }
>> /* ACPI controller */
>> - qdev_prop_set_int32(DEVICE(&s->pm), "addr", dev->devfn + 3);
>> - if (!qdev_realize(DEVICE(&s->pm), BUS(pci_bus), errp)) {
>> - return;
>> + if (s->has_acpi) {
>> + object_initialize_child(OBJECT(s), "pm", &s->pm, TYPE_PIIX4_PM);
>> + qdev_prop_set_int32(DEVICE(&s->pm), "addr", dev->devfn + 3);
>> + qdev_prop_set_uint32(DEVICE(&s->pm), "smb_io_base", s->smb_io_base);
>> + qdev_prop_set_bit(DEVICE(&s->pm), "smm-enabled", s->smm_enabled);
>> + if (!qdev_realize(DEVICE(&s->pm), BUS(pci_bus), errp)) {
>> + return;
>> + }
>> + qdev_connect_gpio_out(DEVICE(&s->pm), 0, s->isa[9]);
>> }
>> - qdev_connect_gpio_out(DEVICE(&s->pm), 0, s->isa[9]);
>> pci_bus_irqs(pci_bus, piix4_set_irq, pci_slot_get_pirq, s,
>> PIIX_NUM_PIRQS);
>> }
>> @@ -279,13 +295,16 @@ static void piix4_init(Object *obj)
>> object_initialize_child(obj, "rtc", &s->rtc, TYPE_MC146818_RTC);
>> object_initialize_child(obj, "ide", &s->ide, "piix4-ide");
>
>... and same here for IDE?
Sure!
Best regards,
Bernhard
>
>> - object_initialize_child(obj, "uhci", &s->uhci, "piix4-usb-uhci");
>> -
>> - object_initialize_child(obj, "pm", &s->pm, TYPE_PIIX4_PM);
>> - qdev_prop_set_uint32(DEVICE(&s->pm), "smb_io_base", 0x1100);
>> - qdev_prop_set_bit(DEVICE(&s->pm), "smm-enabled", 0);
>> }
>> +static Property piix4_props[] = {
>> + DEFINE_PROP_UINT32("smb_io_base", PIIX4State, smb_io_base, 0),
>> + DEFINE_PROP_BOOL("has-acpi", PIIX4State, has_acpi, true),
>> + DEFINE_PROP_BOOL("has-usb", PIIX4State, has_usb, true),
>> + DEFINE_PROP_BOOL("smm-enabled", PIIX4State, smm_enabled, false),
>> + DEFINE_PROP_END_OF_LIST(),
>> +};
>> +
>> static void piix4_class_init(ObjectClass *klass, void *data)
>> {
>> DeviceClass *dc = DEVICE_CLASS(klass);
>> @@ -304,6 +323,7 @@ static void piix4_class_init(ObjectClass *klass, void
>> *data)
>> */
>> dc->user_creatable = false;
>> dc->hotpluggable = false;
>> + device_class_set_props(dc, piix4_props);
>> }
>> static const TypeInfo piix4_info = {
>> diff --git a/hw/mips/malta.c b/hw/mips/malta.c
>> index a4b866a2cf..6339b0d66c 100644
>> --- a/hw/mips/malta.c
>> +++ b/hw/mips/malta.c
>> @@ -1400,8 +1400,10 @@ void mips_malta_init(MachineState *machine)
>> empty_slot_init("GT64120", 0, 0x20000000);
>> /* Southbridge */
>> - piix4 = pci_create_simple_multifunction(pci_bus, PCI_DEVFN(10, 0), true,
>> - TYPE_PIIX4_PCI_DEVICE);
>> + piix4 = pci_new_multifunction(PCI_DEVFN(10, 0), true,
>> + TYPE_PIIX4_PCI_DEVICE);
>> + qdev_prop_set_uint32(DEVICE(piix4), "smb_io_base", 0x1100);
>> + pci_realize_and_unref(piix4, pci_bus, &error_fatal);
>> isa_bus = ISA_BUS(qdev_get_child_bus(DEVICE(piix4), "isa.0"));
>> dev = DEVICE(object_resolve_path_component(OBJECT(piix4), "ide"));
>
>
>ATB,
>
>Mark.
- [PATCH 31/42] hw/isa/piix4: Rename reset control operations to match PIIX3, (continued)
- [PATCH 31/42] hw/isa/piix4: Rename reset control operations to match PIIX3, Bernhard Beschow, 2022/09/01
- [PATCH 24/42] hw/isa/piix4: Add missing initialization, Bernhard Beschow, 2022/09/01
- [PATCH 28/42] hw/isa/piix4: Remove unused code, Bernhard Beschow, 2022/09/01
- [PATCH 21/42] hw/isa/piix3: Rename typedef PIIX3State to PIIXState, Bernhard Beschow, 2022/09/01
- [PATCH 41/42] hw/isa/piix: Drop the "3" from the PIIX base class, Bernhard Beschow, 2022/09/01
- [PATCH 30/42] hw/isa/piix4: Reuse struct PIIXState from PIIX3, Bernhard Beschow, 2022/09/01
- [PATCH 27/42] hw/isa/piix4: Allow board to provide PCI interrupt routes, Bernhard Beschow, 2022/09/01
- [PATCH 26/42] hw/isa/piix4: Make PIIX4's ACPI and USB functions optional, Bernhard Beschow, 2022/09/01
- [PATCH 25/42] hw/isa/piix4: Move pci_ide_create_devs() call to board code, Bernhard Beschow, 2022/09/01
- [PATCH 35/42] hw/isa/piix: Harmonize names of reset control memory regions, Bernhard Beschow, 2022/09/01
- [PATCH 33/42] hw/isa/piix4: Prefix pci_slot_get_pirq() with "piix4_", Bernhard Beschow, 2022/09/01
- [PATCH 40/42] hw/isa/piix: Share PIIX3 base class with PIIX4, Bernhard Beschow, 2022/09/01
- [PATCH 37/42] hw/isa/piix: Rename functions to be shared for interrupt triggering, Bernhard Beschow, 2022/09/01
- [PATCH 38/42] hw/isa/piix: Consolidate IRQ triggering, Bernhard Beschow, 2022/09/01
- [PATCH 29/42] hw/isa/piix4: Use ISA PIC device, Bernhard Beschow, 2022/09/01
- [PATCH 36/42] hw/isa/piix: Reuse PIIX3 base class' realize method in PIIX4, Bernhard Beschow, 2022/09/01
- [PATCH 39/42] hw/isa/piix: Unexport PIIXState, Bernhard Beschow, 2022/09/01