VirtualBox

Changeset 106360 in vbox for trunk/src/VBox/Main/src-client


Ignore:
Timestamp:
Oct 16, 2024 12:58:46 PM (5 months ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
165173
Message:

Main/ConsoleImplConfigArmV8.cpp: Generate ACPI tables if ACPI is enabled for the VM, bugref:10733

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/src-client/ConsoleImplConfigArmV8.cpp

    r106061 r106360  
    6868#include "BusAssignmentManager.h"
    6969#include "ResourceAssignmentManager.h"
     70#include "SystemTableBuilder.h"
    7071#ifdef VBOX_WITH_EXTPACK
    7172# include "ExtPackManagerImpl.h"
     
    188189                                                                                   _1G - (VBOXPLATFORMARMV8_PHYS_ADDR + _1M), /*cbMmio32*/
    189190                                                                                   32                                         /*cInterrupts*/);
     191    SystemTableBuilder *pSysTblsBldAcpi = NULL;
     192
     193    /*
     194     * ACPI
     195     */
     196    BOOL fACPI;
     197    hrc = firmwareSettings->COMGETTER(ACPIEnabled)(&fACPI);                                 H();
     198    if (fACPI)
     199        pSysTblsBldAcpi = SystemTableBuilder::createInstance(kSystemTableType_Acpi);
     200
    190201
    191202    /*
     
    271282        vrc = RTFdtNodeFinalize(hFdt);
    272283
     284        if (pSysTblsBldAcpi)
     285        {
     286            vrc = pSysTblsBldAcpi->configureClock();
     287            VRC();
     288        }
     289
    273290        /*
    274291         * MM values.
     
    294311        vrc = RTFdtNodePropertyAddString(  hFdt, "device_type",      "memory");             VRC();
    295312        vrc = RTFdtNodeFinalize(hFdt);                                                      VRC();
     313
     314        if (pSysTblsBldAcpi)
     315        {
     316            vrc = pSysTblsBldAcpi->addMemory(GCPhysRam, cbRam);
     317            VRC();
     318        }
    296319
    297320        /* Configure the CPUs in the system, only one socket and cluster at the moment. */
     
    325348            }
    326349            vrc = RTFdtNodeFinalize(hFdt);                                                  VRC();
     350
     351            if (pSysTblsBldAcpi)
     352            {
     353                vrc = pSysTblsBldAcpi->addCpu(i);
     354                VRC();
     355            }
    327356        }
    328357
     
    441470        vrc = RTFdtNodePropertyAddU32(     hFdt, "#interrupt-cells", 3);                                VRC();
    442471
     472        if (pSysTblsBldAcpi)
     473        {
     474            vrc = pSysTblsBldAcpi->configureGic(cCpus, GCPhysIntcDist, cbMmioIntcDist,
     475                                                GCPhysIntcReDist, cbMmioIntcReDist);
     476            VRC();
     477        }
     478
    443479#if 0
    444480        vrc = RTFdtNodeAddF(hFdt, "its@%RX32", 0x08080000);                                 VRC();
     
    474510            vrc = RTFdtNodePropertyAddString(  hFdt, "compatible", "qemu,fw-cfg-mmio");     VRC();
    475511            vrc = RTFdtNodeFinalize(hFdt);                                                  VRC();
     512
     513            if (pSysTblsBldAcpi)
     514            {
     515                vrc = pSysTblsBldAcpi->addMmioDeviceNoIrq("qemu-fw-cfg", 0, GCPhysMmioStart, cbMmio);
     516                VRC();
     517            }
    476518        }
    477519
     
    530572                                                 "arm,pl011", "arm,primecell");                     VRC();
    531573            vrc = RTFdtNodeFinalize(hFdt);                                                          VRC();
     574
     575            if (pSysTblsBldAcpi)
     576            {
     577                vrc = pSysTblsBldAcpi->addMmioDevice("arm-pl011", ulInstance, GCPhysMmioStart, cbMmio, iIrq);
     578                VRC();
     579            }
    532580
    533581            BOOL  fServer;
     
    588636        vrc = RTFdtNodePropertyAddCellsU64(hFdt, "reg", 2, GCPhysMmioStart, cbMmio);        VRC();
    589637        vrc = RTFdtNodeFinalize(hFdt);                                                      VRC();
     638
     639        if (pSysTblsBldAcpi)
     640        {
     641            vrc = pSysTblsBldAcpi->addMmioDevice("arm-pl061-gpio", 0, GCPhysMmioStart, _4K, iIrq);
     642            VRC();
     643        }
    590644
    591645        InsertConfigNode(pInst,    "LUN#0",           &pLunL0);
     
    679733        vrc = RTFdtNodeFinalize(hFdt);                                                          VRC();
    680734
     735        if (pSysTblsBldAcpi)
     736        {
     737            vrc = pSysTblsBldAcpi->configurePcieRootBus("pci-generic-ecam", aPinIrqs, GCPhysMmioStart, GCPhysPciMmioEcam,
     738                                                        cbPciMmioEcam, GCPhysMmioStart, cbMmio, GCPhysPciMmio32, cbPciMmio32);
     739            VRC();
     740        }
     741
    681742        /*
    682743         * VMSVGA compliant graphics controller.
     
    802863    Assert(SUCCEEDED(hrc));
    803864
     865    RTGCPHYS GCPhysXsdp = NIL_RTGCPHYS;
     866    size_t cbAcpiXsdp = 0;
     867    size_t cbAcpi     = 0;
     868    if (pSysTblsBldAcpi)
     869    {
     870        vrc = pSysTblsBldAcpi->finishTables(VBOXPLATFORMARMV8_PHYS_ADDR + sizeof(ArmV8Platform) + RT_ALIGN_64(cbFdt, _64K),
     871                                            hVfsIosDesc, &GCPhysXsdp, &cbAcpiXsdp, &cbAcpi);
     872        AssertRCReturn(vrc, vrc);
     873        Assert(GCPhysXsdp > VBOXPLATFORMARMV8_PHYS_ADDR);
     874
     875        /* Dump the ACPI table for debugging purposes if requested. */
     876        Bstr SysTblsDumpVal;
     877        hrc = mMachine->GetExtraData(Bstr("VBoxInternal2/DumpSysTables").raw(),
     878                                     SysTblsDumpVal.asOutParam());
     879        if (   hrc == S_OK
     880            && SysTblsDumpVal.isNotEmpty())
     881        {
     882            vrc = pSysTblsBldAcpi->dumpTables(Utf8Str(SysTblsDumpVal).c_str());
     883            AssertRCReturn(vrc, vrc);
     884        }
     885
     886        delete pSysTblsBldAcpi;
     887
     888        vrc = RTVfsIoStrmZeroFill(hVfsIosDesc, (RTFOFF)(RT_ALIGN_64(cbAcpi, _64K) - cbAcpi));
     889        AssertRCReturn(vrc, vrc);
     890    }
     891
    804892    ArmV8Platform.u32Magic            = VBOXPLATFORMARMV8_MAGIC;
    805893    ArmV8Platform.u32Version          = VBOXPLATFORMARMV8_VERSION;
     
    810898    ArmV8Platform.i64OffFdt           = sizeof(ArmV8Platform);
    811899    ArmV8Platform.cbFdt               = RT_ALIGN_64(cbFdt, _64K);
    812     ArmV8Platform.i64OffAcpiXsdp      = 0;
    813     ArmV8Platform.cbAcpiXsdp          = 0;
     900    if (cbAcpi)
     901    {
     902        ArmV8Platform.i64OffAcpi      = sizeof(ArmV8Platform) + RT_ALIGN_64(cbFdt, _64K);
     903        ArmV8Platform.cbAcpi          = RT_ALIGN_64(cbAcpi, _64K);
     904        ArmV8Platform.i64OffAcpiXsdp  = GCPhysXsdp - VBOXPLATFORMARMV8_PHYS_ADDR;
     905        ArmV8Platform.cbAcpiXsdp      = cbAcpiXsdp;
     906    }
    814907    ArmV8Platform.i64OffUefiRom       = -128 * _1M;
    815908    ArmV8Platform.cbUefiRom           = _64M;
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette