VirtualBox

Changeset 25048 in vbox


Ignore:
Timestamp:
Nov 27, 2009 12:37:09 PM (15 years ago)
Author:
vboxsync
Message:

DevFwCommon(,DevPcBios,DevEFI): nitpicking - made the prefix correspond to the filename, public interfaces uses a capitalize prefix to highlight that they are public, don't use parameters with defaults. Fixed -Wshadow warning.

Location:
trunk/src/VBox/Devices
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/EFI/DevEFI.cpp

    r25025 r25048  
    909909    uuid.Gen.u16TimeMid = RT_H2BE_U16(uuid.Gen.u16TimeMid);
    910910    uuid.Gen.u16TimeHiAndVersion = RT_H2BE_U16(uuid.Gen.u16TimeHiAndVersion);
    911     rc = sharedfwPlantDMITable(pDevIns, pThis->au8DMIPage, VBOX_DMI_TABLE_SIZE, &uuid, pCfgHandle, true);
     911    rc = FwCommonPlantDMITable(pDevIns, pThis->au8DMIPage, VBOX_DMI_TABLE_SIZE, &uuid, pCfgHandle, true /* fPutSmbiosHeaders */);
    912912    if (RT_FAILURE(rc))
    913913        return rc;
    914914
    915     sharedfwPlantMpsTable(pDevIns, pThis->au8DMIPage + VBOX_DMI_TABLE_SIZE, pThis->cCpus);
     915    FwCommonPlantMpsTable(pDevIns, pThis->au8DMIPage + VBOX_DMI_TABLE_SIZE, pThis->cCpus);
    916916
    917917    rc = PDMDevHlpROMRegister(pDevIns, VBOX_DMI_TABLE_BASE, _4K, pThis->au8DMIPage,
  • trunk/src/VBox/Devices/PC/DevFwCommon.cpp

    r25025 r25048  
    11/* $Id$ */
    22/** @file
    3  * Shared firmware code.
     3 * FwCommon - Shared firmware code (used by DevPcBios & DevEFI).
    44 */
    55
     
    2323*   Header Files                                                               *
    2424*******************************************************************************/
    25 /** @todo: what should it be? */
    26 #define LOG_GROUP LOG_GROUP_DEV_PC_BIOS
     25#define LOG_GROUP LOG_GROUP_DEV
    2726#include <VBox/pdmdev.h>
    2827
    2928#include <VBox/log.h>
     29#include <VBox/err.h>
     30#include <VBox/param.h>
     31
    3032#include <iprt/assert.h>
    31 #include <iprt/alloc.h>
    3233#include <iprt/buildconfig.h>
    3334#include <iprt/file.h>
     35#include <iprt/mem.h>
    3436#include <iprt/string.h>
    3537#include <iprt/uuid.h>
    36 #include <VBox/err.h>
    37 #include <VBox/param.h>
    3838
    3939#include "../Builtins.h"
     
    4141#include "DevFwCommon.h"
    4242
     43
     44/*******************************************************************************
     45*   Structures and Typedefs                                                    *
     46*******************************************************************************/
    4347#pragma pack(1)
    4448
     
    258262 * @param   len             size of data
    259263 */
    260 static uint8_t sharedfwChecksum(const uint8_t * const au8Data, uint32_t u32Length)
     264static uint8_t fwCommonChecksum(const uint8_t * const au8Data, uint32_t u32Length)
    261265{
    262266    uint8_t u8Sum = 0;
     
    270274 *
    271275 * @returns VBox status code.
    272  * @param   pDevIns     The device instance.
    273  * @param   pTable      Where to create the DMI table.
    274  * @param   cbMax       The max size of the DMI table.
    275  * @param   pUuid       Pointer to the UUID to use if the DmiUuid
    276  *                      configuration string isn't present.
    277  * @param   pCfgHandle  The handle to our config node.
     276 * @param   pDevIns             The device instance.
     277 * @param   pTable              Where to create the DMI table.
     278 * @param   cbMax               The max size of the DMI table.
     279 * @param   pUuid               Pointer to the UUID to use if the DmiUuid
     280 *                              configuration string isn't present.
     281 * @param   pCfgHandle          The handle to our config node.
     282 * @param   fPutSmbiosHeaders   Plant SMBIOS headers if true.
    278283 */
    279 int sharedfwPlantDMITable(PPDMDEVINS pDevIns, uint8_t *pTable, unsigned cbMax, PRTUUID pUuid, PCFGMNODE pCfgHandle, bool fPutSmbiosHeaders)
     284int FwCommonPlantDMITable(PPDMDEVINS pDevIns, uint8_t *pTable, unsigned cbMax, PCRTUUID pUuid, PCFGMNODE pCfgHandle, bool fPutSmbiosHeaders)
    280285{
    281286    char *pszStr = (char *)pTable;
     
    421426    if (pszDmiSystemUuid)
    422427    {
    423         int rc = RTUuidFromStr(&uuid, pszDmiSystemUuid);
     428        rc = RTUuidFromStr(&uuid, pszDmiSystemUuid);
    424429        if (RT_FAILURE(rc))
    425430            return PDMDevHlpVMSetError(pDevIns, rc, RT_SRC_POS,
     
    551556        };
    552557
    553         aBiosHeaders.smbios.u8Checksum = sharedfwChecksum((uint8_t*)&aBiosHeaders.smbios, sizeof(aBiosHeaders.smbios));
    554         aBiosHeaders.dmi.u8Checksum = sharedfwChecksum((uint8_t*)&aBiosHeaders.dmi, sizeof(aBiosHeaders.dmi));
     558        aBiosHeaders.smbios.u8Checksum = fwCommonChecksum((uint8_t*)&aBiosHeaders.smbios, sizeof(aBiosHeaders.smbios));
     559        aBiosHeaders.dmi.u8Checksum = fwCommonChecksum((uint8_t*)&aBiosHeaders.dmi, sizeof(aBiosHeaders.dmi));
    555560
    556561        //Log(("Write SMBIOS\n"));
     
    589594 * @param   addr       physical address in guest memory.
    590595 */
    591 void sharedfwPlantMpsTable(PPDMDEVINS pDevIns, uint8_t *pTable, uint16_t numCpus)
     596void FwCommonPlantMpsTable(PPDMDEVINS pDevIns, uint8_t *pTable, uint16_t cCpus)
    592597{
    593598    /* configuration table */
     
    599604    pCfgTab->u32OemTablePtr        =  0;
    600605    pCfgTab->u16OemTableSize       =  0;
    601     pCfgTab->u16EntryCount         =  numCpus /* Processors */
     606    pCfgTab->u16EntryCount         =  cCpus /* Processors */
    602607                                   +  1 /* ISA Bus */
    603608                                   +  1 /* I/O-APIC */
     
    622627    /* Construct MPS table for each VCPU. */
    623628    PMPSPROCENTRY pProcEntry = (PMPSPROCENTRY)(pCfgTab+1);
    624     for (int i = 0; i<numCpus; i++)
     629    for (int i = 0; i < cCpus; i++)
    625630    {
    626631        pProcEntry->u8EntryType        = 0; /* processor entry */
     
    647652     *           ... At least one I/O APIC must be enabled." */
    648653    PMPSIOAPICENTRY pIOAPICEntry   = (PMPSIOAPICENTRY)(pBusEntry+1);
    649     uint16_t apicId = numCpus;
     654    uint16_t apicId = cCpus;
    650655    pIOAPICEntry->u8EntryType      = 2; /* I/O-APIC entry */
    651656    pIOAPICEntry->u8Id             = apicId; /* this ID is referenced by the interrupt entries */
     
    668673
    669674    pCfgTab->u16Length             = (uint8_t*)pIrqEntry - pTable;
    670     pCfgTab->u8Checksum            = sharedfwChecksum(pTable, pCfgTab->u16Length);
     675    pCfgTab->u8Checksum            = fwCommonChecksum(pTable, pCfgTab->u16Length);
    671676
    672677    AssertMsg(pCfgTab->u16Length < 0x1000 - 0x100,
     
    688693    floatPtr.au8Feature[3]         = 0;
    689694    floatPtr.au8Feature[4]         = 0;
    690     floatPtr.u8Checksum            = sharedfwChecksum((uint8_t*)&floatPtr, 16);
     695    floatPtr.u8Checksum            = fwCommonChecksum((uint8_t*)&floatPtr, 16);
    691696    PDMDevHlpPhysWrite (pDevIns, 0x9fff0, &floatPtr, 16);
    692697}
     698
  • trunk/src/VBox/Devices/PC/DevFwCommon.h

    r25025 r25048  
    11/* $Id$ */
    22/** @file
    3  * DevFwCommon - shared header for code common between different firmware types (EFI, BIOS).
     3 * FwCommon - Shared firmware code, header.
    44 */
    55
     
    2020 */
    2121
    22 #ifndef DEV_FWCOMMON_H
    23 #define DEV_FWCOMMON_H
     22#ifndef ___PC_FwCommon_h
     23#define ___PC_FwCommon_h
    2424
    2525#include "DevPcBios.h"
     
    3232
    3333/* Plant DMI table */
    34 int sharedfwPlantDMITable(PPDMDEVINS pDevIns, uint8_t *pTable, unsigned cbMax, PRTUUID pUuid, PCFGMNODE pCfgHandle, bool fPutSmbiosHeaders = false);
     34int FwCommonPlantDMITable(PPDMDEVINS pDevIns, uint8_t *pTable, unsigned cbMax, PCRTUUID pUuid, PCFGMNODE pCfgHandle, bool fPutSmbiosHeaders);
    3535
    3636/* Plant MPS table */
    37 void sharedfwPlantMpsTable(PPDMDEVINS pDevIns, uint8_t *pTable, uint16_t numCpus);
     37void FwCommonPlantMpsTable(PPDMDEVINS pDevIns, uint8_t *pTable, uint16_t cCpus);
    3838
    3939#endif
     40
  • trunk/src/VBox/Devices/PC/DevPcBios.cpp

    r24706 r25048  
    747747
    748748    if (pThis->u8IOAPIC)
    749         sharedfwPlantMpsTable(pDevIns, pThis->au8DMIPage + VBOX_DMI_TABLE_SIZE, pThis->cCpus);
     749        FwCommonPlantMpsTable(pDevIns, pThis->au8DMIPage + VBOX_DMI_TABLE_SIZE, pThis->cCpus);
    750750
    751751    /*
     
    10291029    uuid.Gen.u16TimeMid = RT_H2BE_U16(uuid.Gen.u16TimeMid);
    10301030    uuid.Gen.u16TimeHiAndVersion = RT_H2BE_U16(uuid.Gen.u16TimeHiAndVersion);
    1031     rc = sharedfwPlantDMITable(pDevIns, pThis->au8DMIPage, VBOX_DMI_TABLE_SIZE, &uuid, pCfgHandle);
     1031    rc = FwCommonPlantDMITable(pDevIns, pThis->au8DMIPage, VBOX_DMI_TABLE_SIZE, &uuid, pCfgHandle, false /*fPutSmbiosHeaders*/);
    10321032    if (RT_FAILURE(rc))
    10331033        return rc;
    10341034    if (pThis->u8IOAPIC)
    1035         sharedfwPlantMpsTable(pDevIns, pThis->au8DMIPage + VBOX_DMI_TABLE_SIZE, pThis->cCpus);
     1035        FwCommonPlantMpsTable(pDevIns, pThis->au8DMIPage + VBOX_DMI_TABLE_SIZE, pThis->cCpus);
    10361036
    10371037    rc = PDMDevHlpROMRegister(pDevIns, VBOX_DMI_TABLE_BASE, _4K, pThis->au8DMIPage,
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