VirtualBox

Changeset 101619 in vbox for trunk/src


Ignore:
Timestamp:
Oct 27, 2023 12:49:16 PM (16 months ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
159706
Message:

Main/src-client/ConsoleImpl: Preliminary code to hook up the power button requests to the GPIO interface for an ARM guest, bugref:10538

Location:
trunk/src/VBox/Main/src-client
Files:
2 edited

Legend:

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

    r101597 r101619  
    27162716        PPDMIBASE pBase = NULL;
    27172717        int vrc = ptrVM.vtable()->pfnPDMR3QueryDeviceLun(ptrVM.rawUVM(), "acpi", 0, 0, &pBase);
     2718        /** @todo r=aeichner Think about a prettier way to do this without relying on hardocded device/driver names. */
     2719        if (vrc == VERR_PDM_DEVICE_INSTANCE_NOT_FOUND) /* Try GPIO device for ARM VMs */
     2720            vrc = ptrVM.vtable()->pfnPDMR3QueryDriverOnLun(ptrVM.rawUVM(), "arm-pl061-gpio", 0, 0, "GpioButton", &pBase);
    27182721        if (RT_SUCCESS(vrc))
    27192722        {
     
    28232826                vrc = VERR_PDM_MISSING_INTERFACE;
    28242827        }
     2828
     2829        if (vrc == VERR_PDM_DEVICE_INSTANCE_NOT_FOUND)
     2830        {
     2831            /* Might be an ARM VM. */
     2832            /** @todo r=aeichner Think about a prettier way to do this without relying on hardocded device/driver names,
     2833             *                   and this shouldn't be here as it is not about ACPI but needs a dedicated interface. */
     2834            vrc = ptrVM.vtable()->pfnPDMR3QueryDriverOnLun(ptrVM.rawUVM(), "arm-pl061-gpio", 0, 0, "GpioButton", &pBase);
     2835            if (RT_SUCCESS(vrc))
     2836            {
     2837                Assert(pBase);
     2838                PPDMIEVENTBUTTONPORT pPort = PDMIBASE_QUERY_INTERFACE(pBase, PDMIEVENTBUTTONPORT);
     2839                if (pPort)
     2840                {
     2841                    bool fEntered = false;
     2842                    vrc = pPort->pfnQueryGuestCanHandleButtonEvents(pPort, &fEntered);
     2843                    if (RT_SUCCESS(vrc))
     2844                        *aEntered = fEntered;
     2845                }
     2846                else
     2847                    vrc = VERR_PDM_MISSING_INTERFACE;
     2848            }
     2849        }
    28252850    }
    28262851
     
    28502875        PPDMIBASE pBase = NULL;
    28512876        int vrc = ptrVM.vtable()->pfnPDMR3QueryDeviceLun(ptrVM.rawUVM(), "acpi", 0, 0, &pBase);
     2877        /** @todo r=aeichner Think about a prettier way to do this without relying on hardocded device/driver names. */
     2878        if (vrc == VERR_PDM_DEVICE_INSTANCE_NOT_FOUND) /* Try GPIO device for ARM VMs */
     2879            vrc = ptrVM.vtable()->pfnPDMR3QueryDriverOnLun(ptrVM.rawUVM(), "arm-pl061-gpio", 0, 0, "GpioButton", &pBase);
    28522880        if (RT_SUCCESS(vrc))
    28532881        {
  • trunk/src/VBox/Main/src-client/ConsoleImplConfigArmV8.cpp

    r101577 r101619  
    248248                                           0x01, 0x0a, 0x104);                              VRC();
    249249        vrc = RTFdtNodePropertyAddEmpty(   hFdt, "always-on");                              VRC();
    250         vrc = RTFdtNodePropertyAddString(  hFdt, "compatible",       "arm,armv7-timer");    VRC();
     250        vrc = RTFdtNodePropertyAddString(  hFdt, "compatible",       "arm,armv8-timer");    VRC();
    251251        vrc = RTFdtNodeFinalize(hFdt);
    252252
     
    258258        vrc = RTFdtNodePropertyAddString(  hFdt, "compatible",         "fixed-clock");      VRC();
    259259        vrc = RTFdtNodeFinalize(hFdt);
    260 
    261         /* Configure gpio keys (non functional at the moment). */
    262         vrc = RTFdtNodeAdd(hFdt, "gpio-keys");                                              VRC();
    263         vrc = RTFdtNodePropertyAddString(hFdt, "compatible",           "gpio-keys");        VRC();
    264 
    265         vrc = RTFdtNodeAdd(hFdt, "poweroff");                                               VRC();
    266         vrc = RTFdtNodePropertyAddCellsU32(hFdt, "gpios", 3, idPHandleGpio, 3, 0);          VRC();
    267         vrc = RTFdtNodePropertyAddU32(     hFdt, "linux,code", 0x74);                       VRC();
    268         vrc = RTFdtNodePropertyAddString(  hFdt, "label",      "GPIO Key Poweroff");        VRC();
    269         vrc = RTFdtNodeFinalize(hFdt);                                                      VRC();
    270 
    271         vrc = RTFdtNodeFinalize(hFdt);                                                      VRC();
    272260
    273261        /*
     
    535523        vrc = RTFdtNodeFinalize(hFdt);                                                      VRC();
    536524
     525        /* Configure gpio keys. */
    537526        InsertConfigNode(pDevices, "arm-pl061-gpio",&pDev);
    538527        InsertConfigNode(pDev,     "0",            &pInst);
     
    550539                                             "arm,pl061", "arm,primecell");                 VRC();
    551540        vrc = RTFdtNodePropertyAddCellsU64(hFdt, "reg", 2, 0x09030000, _4K);                VRC();
     541        vrc = RTFdtNodeFinalize(hFdt);                                                      VRC();
     542
     543        InsertConfigNode(pInst,    "LUN#0",           &pLunL0);
     544        InsertConfigString(pLunL0, "Driver",          "GpioButton");
     545        InsertConfigNode(pLunL0,   "Config",          &pCfg);
     546        InsertConfigInteger(pCfg,  "PowerButtonGpio", 3);
     547        InsertConfigInteger(pCfg,  "SleepButtonGpio", 4);
     548
     549        vrc = RTFdtNodeAdd(hFdt, "gpio-keys");                                              VRC();
     550        vrc = RTFdtNodePropertyAddString(hFdt, "compatible",           "gpio-keys");        VRC();
     551
     552        vrc = RTFdtNodeAdd(hFdt, "poweroff");                                               VRC();
     553        vrc = RTFdtNodePropertyAddCellsU32(hFdt, "gpios", 3, idPHandleGpio, 3, 0);          VRC();
     554        vrc = RTFdtNodePropertyAddU32(     hFdt, "linux,code", 0x74);                       VRC();
     555        vrc = RTFdtNodePropertyAddString(  hFdt, "label",      "GPIO Key Poweroff");        VRC();
     556        vrc = RTFdtNodeFinalize(hFdt);                                                      VRC();
     557
     558        vrc = RTFdtNodeAdd(hFdt, "suspend");                                                VRC();
     559        vrc = RTFdtNodePropertyAddCellsU32(hFdt, "gpios", 3, idPHandleGpio, 4, 0);          VRC();
     560        vrc = RTFdtNodePropertyAddU32(     hFdt, "linux,code", 0xcd);                       VRC();
     561        vrc = RTFdtNodePropertyAddString(  hFdt, "label",      "GPIO Key Suspend");         VRC();
     562        vrc = RTFdtNodeFinalize(hFdt); 
     563
    552564        vrc = RTFdtNodeFinalize(hFdt);                                                      VRC();
    553565
Note: See TracChangeset for help on using the changeset viewer.

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