VirtualBox

Changeset 16170 in vbox for trunk/src/VBox/Devices/PC


Ignore:
Timestamp:
Jan 22, 2009 2:40:08 PM (16 years ago)
Author:
vboxsync
Message:

More device work

Location:
trunk/src/VBox/Devices/PC
Files:
2 edited

Legend:

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

    r16042 r16170  
    6666#define SYSI_DATA       0x0000404c
    6767#define ACPI_RESET_BLK  0x00004050
    68 #define FDC_STATUS      0x00004054
    6968
    7069/* PM1x status register bits */
     
    132131    SYSTEM_INFO_INDEX_MEMORY_LENGTH     = 0,
    133132    SYSTEM_INFO_INDEX_USE_IOAPIC        = 1,
    134     SYSTEM_INFO_INDEX_LAST              = 2,
     133    SYSTEM_INFO_INDEX_HPET_STATUS       = 2,
     134    SYSTEM_INFO_INDEX_SMC_STATUS        = 3,
     135    SYSTEM_INFO_INDEX_FDC_STATUS        = 4,
     136    SYSTEM_INFO_INDEX_LAST              = 5,
    135137    SYSTEM_INFO_INDEX_INVALID           = 0x80,
    136138    SYSTEM_INFO_INDEX_VALID             = 0x200
     
    184186    uint8_t             u8UseIOApic;
    185187    uint8_t             u8UseFdc;
     188    /* If High Precision Event Timer device should be supported */
     189    uint8_t             u8UseHpet;
     190    /* If System Management Controller device should be supported */
     191    uint8_t             u8UseSmc;
     192
    186193    bool                fPowerButtonHandled;
    187 
    188194    /** ACPI port base interface. */
    189195    PDMIBASE            IBase;
     
    196202    /** Pointer to the driver connector interface */
    197203    R3PTRTYPE(PPDMIACPICONNECTOR) pDrv;
     204
     205    uint32_t            Alignment0; /**< Structure size alignment. */
     206
    198207};
    199208
     
    533542IO_WRITE_PROTO (acpiBatIndexWrite);
    534543IO_READ_PROTO  (acpiBatDataRead);
    535 IO_READ_PROTO  (acpiFdcStatusRead);
    536544IO_READ_PROTO  (acpiSysInfoDataRead);
    537545IO_WRITE_PROTO (acpiSysInfoDataWrite);
     
    12461254}
    12471255
    1248 IO_READ_PROTO (acpiFdcStatusRead)
    1249 {
    1250     ACPIState *s = (ACPIState *)pvUser;
    1251 
    1252     switch (cb)
    1253     {
    1254         case 4:
    1255             *pu32 = s->u8UseFdc
    1256                 ?   STA_DEVICE_PRESENT_MASK                 /* present */
    1257                   | STA_DEVICE_ENABLED_MASK                 /* enabled and decodes its resources */
    1258                   | STA_DEVICE_SHOW_IN_UI_MASK              /* should be shown in UI */
    1259                   | STA_DEVICE_FUNCTIONING_PROPERLY_MASK    /* functioning properly */
    1260                 : 0;                                        /* device not present */
    1261             break;
    1262         default:
    1263             return VERR_IOM_IOPORT_UNUSED;
    1264     }
    1265     return VINF_SUCCESS;
    1266 }
    1267 
    12681256IO_WRITE_PROTO (acpiSysInfoIndexWrite)
    12691257{
     
    12771265        else
    12781266        {
     1267            /* see comment at the declaration of u8IndexShift */
     1268            if (s->u8IndexShift == 0)
     1269            {
     1270                if (((u32 >> 2) < SYSTEM_INFO_INDEX_LAST) && ((u32 & 0x3)) == 0)
     1271                {
     1272                    s->u8IndexShift = 2;
     1273                }
     1274            }
     1275
    12791276            u32 >>= s->u8IndexShift;
    12801277            Assert (u32 < SYSTEM_INFO_INDEX_LAST);
     
    13061303                    *pu32 = s->u8UseIOApic;
    13071304                    break;
    1308  
     1305
     1306                case SYSTEM_INFO_INDEX_HPET_STATUS:
     1307                    *pu32 = s->u8UseHpet ? (  STA_DEVICE_PRESENT_MASK
     1308                                            | STA_DEVICE_ENABLED_MASK
     1309                                            | STA_DEVICE_SHOW_IN_UI_MASK
     1310                                            | STA_DEVICE_FUNCTIONING_PROPERLY_MASK)
     1311                            : 0;
     1312                    break;
     1313
     1314                case SYSTEM_INFO_INDEX_SMC_STATUS:
     1315                    *pu32 = s->u8UseSmc ? (  STA_DEVICE_PRESENT_MASK
     1316                                           | STA_DEVICE_ENABLED_MASK
     1317                                           /* no need to show this device in the UI */
     1318                                           | STA_DEVICE_FUNCTIONING_PROPERLY_MASK)
     1319                            : 0;
     1320                    break;
     1321
     1322                case SYSTEM_INFO_INDEX_FDC_STATUS:
     1323                    *pu32 = s->u8UseFdc ? (  STA_DEVICE_PRESENT_MASK
     1324                                           | STA_DEVICE_ENABLED_MASK
     1325                                           | STA_DEVICE_SHOW_IN_UI_MASK
     1326                                           | STA_DEVICE_FUNCTIONING_PROPERLY_MASK)
     1327                            : 0;
     1328                    break;
     1329
     1330
    13091331                /* Solaris 9 tries to read from this index */
    13101332                case SYSTEM_INFO_INDEX_INVALID:
    13111333                    *pu32 = 0;
    13121334                    break;
    1313                    
     1335
    13141336                default:
    13151337                    AssertMsgFailed (("Invalid system info index %d\n", s->uSystemInfoIndex));
     
    17541776                               "GCEnabled\0"
    17551777                               "R0Enabled\0"
    1756                                "FdcEnabled\0"))
     1778                               "HpetEnabled\0"
     1779                               "SmcEnabled\0"
     1780                               "FdcEnabled\0"
     1781                               ))
    17571782        return PDMDEV_SET_ERROR(pDevIns, VERR_PDM_DEVINS_UNKNOWN_CFG_VALUES,
    17581783                                N_("Configuration error: Invalid config key for ACPI device"));
     
    17801805        return PDMDEV_SET_ERROR(pDevIns, rc,
    17811806                                N_("Configuration error: Failed to read \"FdcEnabled\""));
     1807
     1808    /* query whether we are supposed to present HPET */
     1809    rc = CFGMR3QueryU8Def (pCfgHandle, "HpetEnabled", &s->u8UseHpet, 0);
     1810    if (RT_FAILURE(rc))
     1811        return PDMDEV_SET_ERROR(pDevIns, rc,
     1812                                N_("Configuration error: Failed to read \"HpetEnabled\""));
     1813    /* query whether we are supposed to present SMC */
     1814    rc = CFGMR3QueryU8Def (pCfgHandle, "SmcEnabled", &s->u8UseSmc, 0);
     1815    if (RT_FAILURE(rc))
     1816        return PDMDEV_SET_ERROR(pDevIns, rc,
     1817                                N_("Configuration error: Failed to read \"SmcEnabled\""));
    17821818
    17831819    rc = CFGMR3QueryBool (pCfgHandle, "GCEnabled", &fGCEnabled);
     
    18311867    R (SYSI_INDEX,     1, acpiSysInfoIndexWrite, NULL,                "ACPI system info index");
    18321868    R (SYSI_DATA,      1, acpiSysInfoDataWrite,  acpiSysInfoDataRead, "ACPI system info data");
    1833     R (FDC_STATUS,     1, NULL,                  acpiFdcStatusRead,   "ACPI FDC status index");
    18341869    R (GPE0_BLK + L,   L, acpiGpe0EnWrite,       acpiGpe0EnRead,      "ACPI GPE0 Enable");
    18351870    R (GPE0_BLK,       L, acpiGpe0StsWrite,      acpiGpe0StsRead,     "ACPI GPE0 Status");
     
    20212056#endif /* IN_RING3 */
    20222057#endif /* !VBOX_DEVICE_STRUCT_TESTCASE */
    2023 
  • trunk/src/VBox/Devices/PC/vbox.dsl

    r16042 r16170  
    141141            MEML, 32,
    142142            UIOA, 32,
     143            UHPT, 32,
     144            USMC, 32,
     145            UFDC, 32,
    143146            Offset (0x80),
    144147            ININ, 32,
     
    154157            DBG ("UIOA: ")
    155158            HEX4 (UIOA)
     159            DBG ("UHPT: ")
     160            HEX4 (UHPT)
     161            DBG ("USMC: ")
     162            HEX4 (USMC)
     163            DBG ("UFDC: ")
     164            HEX4 (UFDC)
    156165        }
    157166
     
    564573                    Name (_HID, EisaId ("PNP0700"))
    565574
    566                     OperationRegion (CFDC, SystemIO, 0x4054, 0x08)
    567                     Field (CFDC, DwordAcc, NoLock, Preserve)
    568                     {
    569                         FSTA, 32,
    570                     }
    571 
    572575                    Method (_STA, 0, NotSerialized)
    573576                    {
    574                         Return (FSTA)
     577                        Return (UFDC)
    575578                    }
    576579
     
    852855    Scope (\_SB)
    853856    {
     857         // High Precision Event Timer
     858        Device(HPET) {
     859            Name(_HID,  EISAID("PNP0103"))
     860            Name(_UID, 0)
     861            Method (_STA, 0, NotSerialized) {
     862                    Return(UHPT)
     863            }
     864            Name(_CRS, ResourceTemplate() {
     865                DWordMemory(
     866                    ResourceConsumer, PosDecode, MinFixed, MaxFixed,
     867                    NonCacheable, ReadWrite,
     868                    0x00000000,
     869                    0xFED00000,
     870                    0xFED003FF,
     871                    0x00000000,
     872                    0x00000400 /* 1K memory: FED00000 - FED003FF */
     873                )
     874            })
     875        }
     876 
     877       // System Management Controller
     878       Device (SMC)
     879       {
     880            Name (_HID, EisaId ("APP0001"))
     881            Name (_CID, "smc-napa")
     882
     883            Method (_STA, 0, NotSerialized)
     884            {
     885                Return (USMC)
     886            }
     887            Name (_CRS, ResourceTemplate ()
     888            {
     889                IO (Decode16,
     890                    0x0300,             // Range Minimum
     891                    0x0300,             // Range Maximum
     892                    0x01,               // Alignment
     893                    0x20,               // Length
     894                    )
     895                //IRQNoFlags () {8}
     896            })
     897        }
     898
    854899        // Fields within PIIX3 configuration[0x60..0x63] with
    855900        // IRQ mappings
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