VirtualBox

Changeset 12431 in vbox


Ignore:
Timestamp:
Sep 12, 2008 3:29:01 PM (16 years ago)
Author:
vboxsync
Message:

DevACPI: r=bird: C++ is ring-3 only. class names are not all uppercase. doxygen comments starts with / and are used whereever possible.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/PC/DevACPI.cpp

    r12428 r12431  
    189189    uint8_t             u8UseFdc;
    190190    bool                fPowerButtonHandled;
    191    
     191
    192192    /** ACPI port base interface. */
    193193    PDMIBASE            IBase;
     
    399399AssertCompileSize(ACPITBLIOAPIC, 12);
    400400
    401 /** Multiple APIC Description Table */
    402401#ifdef VBOX_WITH_SMP_GUESTS
    403 
    404 #define PCAT_COMPAT     0x1                     /**< system has also a dual-8259 setup */
    405 
    406 /*
     402#ifdef IN_RING3 /**@todo r=bird: Move this down to where it's used. */
     403
     404# define PCAT_COMPAT     0x1                     /**< system has also a dual-8259 setup */
     405
     406/**
     407 * Multiple APIC Description Table.
     408 *
    407409 * This structure looks somewhat convoluted due layout of MADT table in MP case.
    408  * There extpected to be multiple LAPIC records for each CPU, thus we cannot 
     410 * There extpected to be multiple LAPIC records for each CPU, thus we cannot
    409411 * use regular C structure and proxy to raw memory instead.
    410412 */
    411 class ACPITBLMADT
    412 {
    413     /*
     413class AcpiTableMADT
     414{
     415    /**
    414416     * All actual data stored in dynamically allocated memory pointed by this field.
    415417     */
    416418    uint8_t*            pData;
    417     /*
     419    /**
    418420     * Number of CPU entries in this MADT.
    419421     */
    420422    uint32_t            cCpus;
    421    
     423
    422424 public:
    423     /*
     425    /**
    424426     * Address of ACPI header
    425427     */
     
    428430        return (ACPITBLHEADER*)pData;
    429431    }
    430    
    431     /*
     432
     433    /**
    432434     * Address of local APIC for each CPU. Note that different CPUs address different LAPICs,
    433435     * although address is the same for all of them.
     
    437439        return  (uint32_t*)(header_addr() + 1);
    438440    }
    439    
    440     /*
     441
     442    /**
    441443     * Address of APIC flags
    442444     */
     
    445447        return (uint32_t*)(u32LAPIC_addr() + 1);
    446448    }
    447    
    448     /*
     449
     450    /**
    449451     * Address of per-CPU LAPIC descriptions
    450452     */
     
    454456    }
    455457
    456     /*
     458    /**
    457459     * Address of IO APIC description
    458460     */
     
    462464    }
    463465
    464     /*
     466    /**
    465467     * Size of MADT.
    466468     * Note that this function assumes IOApic to be the last field in structure.
     
    471473    }
    472474
    473     /*
     475    /**
    474476     * Raw data of MADT.
    475477     */
     
    479481    }
    480482
    481     /*
     483    /**
    482484     * Size of MADT for given ACPI config, useful to compute layout.
    483485     */
    484486    static uint32_t sizeFor(ACPIState *s)
    485487    {
    486         return ACPITBLMADT(s->cCpus).size();
     488        return AcpiTableMADT(s->cCpus).size();
    487489    }
    488490
     
    490492     * Constructor, only works in Ring 3, doesn't look like a big deal.
    491493     */
    492     ACPITBLMADT(uint16_t cpus)
     494    AcpiTableMADT(uint16_t cpus)
    493495    {
    494496        cCpus = cpus;
    495497        pData = 0;
    496 #ifdef IN_RING3
    497498        uint32_t sSize = size();
    498499        pData = (uint8_t*)RTMemAllocZ(sSize);
    499 #else
    500         AssertMsgFailed(("cannot use in inner rings"));
    501 #endif
    502     }
    503 
    504     ~ACPITBLMADT()
    505     {
    506 #ifdef IN_RING3
     500    }
     501
     502    ~AcpiTableMADT()
     503    {
    507504        RTMemFree(pData);
    508 #else
    509         AssertMsgFailed(("cannot use in inner rings"));
    510 #endif
    511505    }
    512506};
    513 #else
     507#endif /* IN_RING3 */
     508
     509#else  /* !VBOX_WITH_SMP_GUESTS */
     510/** Multiple APIC Description Table */
    514511struct ACPITBLMADT
    515512{
     
    522519};
    523520AssertCompileSize(ACPITBLMADT, 64);
    524 #endif
     521#endif /* !VBOX_WITH_SMP_GUESTS */
    525522
    526523#pragma pack()
     
    754751static void acpiSetupMADT (ACPIState *s, RTGCPHYS32 addr)
    755752{
    756 #if VBOX_WITH_SMP_GUESTS
     753#ifdef VBOX_WITH_SMP_GUESTS
    757754    uint16_t cpus = s->cCpus;
    758     ACPITBLMADT madt(cpus);
     755    AcpiTableMADT madt(cpus);
    759756
    760757    acpiPrepareHeader(madt.header_addr(), "APIC", madt.size(), 2);
    761    
     758
    762759    *madt.u32LAPIC_addr()          = RT_H2LE_U32(0xfee00000);
    763760    *madt.u32Flags_addr()          = RT_H2LE_U32(PCAT_COMPAT);
    764    
     761
    765762    ACPITBLLAPIC* lapic = madt.LApics_addr();
    766763    for (uint16_t i = 0; i < cpus; i++)
     
    786783    acpiPhyscpy (s, addr, madt.data(), madt.size());
    787784
    788 #else
     785#else  /* !VBOX_WITH_SMP_GUESTS */
    789786    ACPITBLMADT madt;
    790787
     
    813810    madt.header.u8Checksum = acpiChecksum ((uint8_t*)&madt, sizeof(madt));
    814811    acpiPhyscpy (s, addr, &madt, sizeof(madt));
    815 #endif
     812#endif /* !VBOX_WITH_SMP_GUESTS */
    816813}
    817814
     
    16641661        apic_addr = RT_ALIGN_32 (facs_addr + sizeof(ACPITBLFACS), 16);
    16651662#ifdef VBOX_WITH_SMP_GUESTS
    1666         /* 
    1667          * @todo r=nike maybe some refactoring needed to compute tables layout,
     1663        /**
     1664         * @todo nike: maybe some refactoring needed to compute tables layout,
    16681665         * but as this code is executed only once it doesn't make sense to optimize much
    16691666         */
    1670         dsdt_addr = RT_ALIGN_32 (apic_addr + ACPITBLMADT::sizeFor(s), 16);
     1667        dsdt_addr = RT_ALIGN_32 (apic_addr + AcpiTableMADT::sizeFor(s), 16);
    16711668#else
    16721669        dsdt_addr = RT_ALIGN_32 (apic_addr + sizeof(ACPITBLMADT), 16);
     
    17291726
    17301727    /* Validate and read the configuration. */
    1731     if (!CFGMR3AreValuesValid (pCfgHandle, 
     1728    if (!CFGMR3AreValuesValid (pCfgHandle,
    17321729                               "RamSize\0"
    17331730                               "IOAPIC\0"
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