Changeset 25966 in vbox for trunk/src/VBox/Devices/PC
- Timestamp:
- Jan 22, 2010 11:15:43 AM (15 years ago)
- svn:sync-xref-src-repo-rev:
- 56818
- Location:
- trunk/src/VBox/Devices/PC
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/PC/DevACPI.cpp
r25928 r25966 33 33 # include <iprt/alloc.h> 34 34 # include <iprt/string.h> 35 # include <iprt/uuid.h> 35 36 #endif /* IN_RING3 */ 36 37 … … 1935 1936 1936 1937 /** 1937 * Queries an interface to the driver. 1938 * 1939 * @returns Pointer to interface. 1940 * @returns NULL if the interface was not supported by the driver. 1941 * @param pInterface Pointer to this interface structure. 1942 * @param enmInterface The requested interface identification. 1943 * @thread Any thread. 1938 * @interface_method_impl{PDMIBASE,pfnQueryInterface} 1944 1939 */ 1945 static DECLCALLBACK(void *) acpiQueryInterface(PPDMIBASE pInterface, PDMINTERFACE enmInterface) 1946 { 1947 ACPIState *pThis = (ACPIState*)((uintptr_t)pInterface - RT_OFFSETOF(ACPIState, IBase)); 1948 switch (enmInterface) 1949 { 1950 case PDMINTERFACE_BASE: 1951 return &pThis->IBase; 1952 case PDMINTERFACE_ACPI_PORT: 1953 return &pThis->IACPIPort; 1954 default: 1955 return NULL; 1956 } 1940 static DECLCALLBACK(void *) acpiQueryInterface(PPDMIBASE pInterface, const char *pszIID) 1941 { 1942 ACPIState *pThis = RT_FROM_MEMBER(pInterface, ACPIState, IBase); 1943 if (RTUuidCompare2Strs(pszIID, PDMIBASE_IID) == 0) 1944 return &pThis->IBase; 1945 if (RTUuidCompare2Strs(pszIID, PDMINTERFACE_ACPI_PORT) == 0) 1946 return &pThis->IACPIPort; 1947 return NULL; 1957 1948 } 1958 1949 -
trunk/src/VBox/Devices/PC/DrvACPI.cpp
r25893 r25966 33 33 #include <iprt/assert.h> 34 34 #include <iprt/string.h> 35 #include <iprt/uuid.h> 35 36 36 37 #ifdef RT_OS_LINUX … … 66 67 /** 67 68 * ACPI driver instance data. 69 * 70 * @implements PDMIACPICONNECTOR 68 71 */ 69 72 typedef struct DRVACPI … … 79 82 80 83 /** 81 * Queries an interface to the driver. 82 * 83 * @returns Pointer to interface. 84 * @returns NULL if the interface was not supported by the driver. 85 * @param pInterface Pointer to this interface structure. 86 * @param enmInterface The requested interface identification. 87 * @thread Any thread. 84 * @interface_method_impl{PDMIBASE,pfnQueryInterface} 88 85 */ 89 static DECLCALLBACK(void *) drvACPIQueryInterface(PPDMIBASE pInterface, PDMINTERFACE enmInterface)86 static DECLCALLBACK(void *) drvACPIQueryInterface(PPDMIBASE pInterface, const char *pszIID) 90 87 { 91 88 PPDMDRVINS pDrvIns = PDMIBASE_2_PDMDRV(pInterface); 92 89 PDRVACPI pThis = PDMINS_2_DATA(pDrvIns, PDRVACPI); 93 switch (enmInterface) 94 { 95 case PDMINTERFACE_BASE: 96 return &pDrvIns->IBase; 97 case PDMINTERFACE_ACPI_CONNECTOR: 98 return &pThis->IACPIConnector; 99 default: 100 return NULL; 101 } 90 91 if (RTUuidCompare2Strs(pszIID, PDMIBASE_IID) == 0) 92 return &pDrvIns->IBase; 93 if (RTUuidCompare2Strs(pszIID, PDMINTERFACE_ACPI_CONNECTOR) == 0) 94 return &pThis->IACPIConnector; 95 return NULL; 102 96 } 103 97 … … 117 111 { 118 112 /* running on battery? */ 119 if ( (powerStatus.ACLineStatus == 0) 120 || (powerStatus.ACLineStatus == 255) 121 && (powerStatus.BatteryFlag & 15)) 113 if ( powerStatus.ACLineStatus == 0 /* Offline */ 114 || powerStatus.ACLineStatus == 255 /* Unknown */ 115 && (powerStatus.BatteryFlag & 15) /* high | low | critical | charging */ 116 ) /** @todo why is 'charging' included in the flag test? Add parenthesis around the right bits so the code is clearer. */ 122 117 { 123 118 *pPowerSource = PDM_ACPI_POWER_SOURCE_BATTERY; -
trunk/src/VBox/Devices/PC/DrvAcpiCpu.cpp
r25893 r25966 5 5 6 6 /* 7 * Copyright (C) 2006-20 07Sun Microsystems, Inc.7 * Copyright (C) 2006-2010 Sun Microsystems, Inc. 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 29 29 #include <iprt/assert.h> 30 30 #include <iprt/string.h> 31 #include <iprt/uuid.h> 31 32 32 33 #include "Builtins.h" 33 34 35 34 36 /** 35 * Queries an interface to the driver. 36 * 37 * @returns Pointer to interface. 38 * @returns NULL if the interface was not supported by the driver. 39 * @param pInterface Pointer to this interface structure. 40 * @param enmInterface The requested interface identification. 41 * @thread Any thread. 37 * @interface_method_impl{PDMIBASE,pfnQueryInterface} 42 38 */ 43 static DECLCALLBACK(void *) drvACPICpuQueryInterface(PPDMIBASE pInterface, PDMINTERFACE enmInterface)39 static DECLCALLBACK(void *) drvACPICpuQueryInterface(PPDMIBASE pInterface, const char *pszIID) 44 40 { 45 41 PPDMDRVINS pDrvIns = PDMIBASE_2_PDMDRV(pInterface); 46 47 switch (enmInterface) 48 { 49 case PDMINTERFACE_BASE: 50 return &pDrvIns->IBase; 51 default: 52 return NULL; 53 } 42 if (RTUuidCompare2Strs(pszIID, PDMIBASE_IID) == 0) 43 return &pDrvIns->IBase; 44 return NULL; 54 45 } 55 46
Note:
See TracChangeset
for help on using the changeset viewer.