Changeset 41599 in vbox for trunk/src/VBox/Devices/PC
- Timestamp:
- Jun 6, 2012 1:45:19 PM (13 years ago)
- Location:
- trunk/src/VBox/Devices/PC
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/PC/DevPcBios.cpp
r41593 r41599 42 42 #define NET_BOOT_DEVS 4 43 43 44 #define CMOS_BANK_LOWER_LIMIT 0x0E45 #define CMOS_BANK_UPPER_LIMIT 0x7F46 #define CMOS_BANK2_LOWER_LIMIT 0x8047 #define CMOS_BANK2_UPPER_LIMIT 0xFF48 49 #define CMOS_RTC_OFFSET_SEC 0x050 #define CMOS_RTC_OFFSET_MIN 0x0251 #define CMOS_RTC_OFFSET_HR 0x0452 #define CMOS_RTC_OFFSET_DAY 0x0753 #define CMOS_RTC_OFFSET_MONTH 0x0854 #define CMOS_RTC_OFFSET_YEAR 0x0955 44 56 45 /** @page pg_devbios_cmos_assign CMOS Assignments (BIOS) … … 239 228 240 229 241 static uint8_t bcd2bin(uint8_t val)242 {243 return (val & 0x0f) + (val >>4) *10;244 }245 246 230 /** 247 231 * Write to CMOS memory. … … 271 255 272 256 return u8val; 273 }274 275 /**276 * @callback_method_impl{FNDBGFHANDLERDEV,277 * Dumps the cmos Bank Info.}278 */279 static DECLCALLBACK(void) CMOSBankInfo(PPDMDEVINS pDevIns, PCDBGFINFOHLP pHlp, const char *pszArgs)280 {281 const char *PChCMOSBank = "CMOS Bank Info 0x0E - 0x7F";282 uint16_t u16ByteCount = 0;283 uint8_t u8CMOSByte;284 pHlp->pfnPrintf(pHlp, "%s\n" ,PChCMOSBank);285 for (u16ByteCount = CMOS_BANK_LOWER_LIMIT; u16ByteCount < CMOS_BANK_UPPER_LIMIT; u16ByteCount++)286 {287 u8CMOSByte = pcbiosCmosRead(pDevIns, u16ByteCount);288 pHlp->pfnPrintf(pHlp, "Off: 0x%02x Val: 0x%02x\n",u16ByteCount, u8CMOSByte);289 }290 }291 292 /**293 * @callback_method_impl{FNDBGFHANDLERDEV,294 * Dumps the cmos Bank2 Info.}295 */296 static DECLCALLBACK(void) CMOSBank2Info(PPDMDEVINS pDevIns, PCDBGFINFOHLP pHlp, const char *pszArgs)297 {298 const char *PChCMOSBank = "CMOS Bank2 Info 0x80 - 0xFF";299 uint16_t u16ByteCount = 0;300 uint8_t u8CMOSByte;301 pHlp->pfnPrintf(pHlp, "%s\n" ,PChCMOSBank);302 for (u16ByteCount = CMOS_BANK2_LOWER_LIMIT; u16ByteCount < CMOS_BANK2_UPPER_LIMIT; u16ByteCount++)303 {304 u8CMOSByte = pcbiosCmosRead(pDevIns, u16ByteCount);305 pHlp->pfnPrintf(pHlp, "Off: 0x%02x Val: 0x%02x\n",u16ByteCount, u8CMOSByte);306 }307 }308 309 /**310 * @callback_method_impl{FNDBGFHANDLERDEV,311 * Dumps the cmos RTC Info.}312 */313 static DECLCALLBACK(void) CMOSRTCInfo(PPDMDEVINS pDevIns, PCDBGFINFOHLP pHlp, const char *pszArgs)314 {315 const char * PCFailNotice = "Failed To Read Values. Time Update in Progress";316 uint8_t u8Sec = 0;317 uint8_t u8Min = 0;318 uint8_t u8Hr = 0;319 uint8_t u8Day = 0;320 uint8_t u8Month = 0;321 uint8_t u8Year = 0;322 uint8_t u8RegB = 0;323 324 /*Don't move further if update is in progress*/325 if((pcbiosCmosRead(pDevIns, 0x0A) & 0x80 ))326 {327 pHlp->pfnPrintf(pHlp, " %s\n", PCFailNotice);328 }329 else330 {331 u8Sec = pcbiosCmosRead(pDevIns, CMOS_RTC_OFFSET_SEC);332 u8Min = pcbiosCmosRead(pDevIns, CMOS_RTC_OFFSET_MIN);333 u8Hr = pcbiosCmosRead(pDevIns, CMOS_RTC_OFFSET_HR);334 u8Day = pcbiosCmosRead(pDevIns, CMOS_RTC_OFFSET_DAY);335 u8Month = pcbiosCmosRead(pDevIns, CMOS_RTC_OFFSET_MONTH);336 u8Year = pcbiosCmosRead(pDevIns, CMOS_RTC_OFFSET_YEAR);337 338 u8RegB = pcbiosCmosRead(pDevIns, 0x0B);339 if (!(u8RegB & 0x04))340 {341 u8Sec = (u8Sec & 0x0F) + ((u8Sec / 16) * 10);342 u8Min = (u8Min & 0x0F) + ((u8Min / 16) * 10);343 u8Hr = (u8Hr & 0x0F) + (( (u8Hr & 0x70) / 16) * 10) | (u8Hr & 0x80);344 u8Day = (u8Day & 0x0F) + ((u8Day / 16) * 10);345 u8Month = (u8Month & 0x0F) + ((u8Month / 16) * 10);346 u8Year = (u8Year & 0x0F) + ((u8Year / 16) * 10);347 }348 pHlp->pfnPrintf(pHlp, " Time: Hr:%u Min:%u Sec:%u, Day:%u Month:%u Year:%u\n", u8Hr, u8Min, u8Sec, u8Day, u8Month, u8Year);349 }350 257 } 351 258 … … 1024 931 PDMDEV_CHECK_VERSIONS_RETURN(pDevIns); 1025 932 1026 /*1027 * Register debugger info callback.1028 */1029 PDMDevHlpDBGFInfoRegister(pDevIns, "cmos", "Display CMOS Bank 1 Info.. "1030 "'cmos'. No argument.", CMOSBankInfo);1031 PDMDevHlpDBGFInfoRegister(pDevIns, "cmos2", "Display CMOS Bank 2 Info.. "1032 "'cmos2'. No argument", CMOSBank2Info);1033 PDMDevHlpDBGFInfoRegister(pDevIns, "rtc", "Display CMOS RTC info "1034 "'rtc'. No argument", CMOSRTCInfo);1035 933 /* 1036 934 * Validate configuration. … … 1532 1430 if (pThis->uBootDelay > 15) 1533 1431 pThis->uBootDelay = 15; 1534 1535 1432 1536 1433 /* -
trunk/src/VBox/Devices/PC/DevRTC.cpp
r41566 r41599 44 44 * Header Files * 45 45 *******************************************************************************/ 46 #define LOG_GROUP LOG_GROUP_DEV_RTC 46 #define LOG_GROUP LOG_GROUP_DEV_RTC 47 47 #include <VBox/vmm/pdmdev.h> 48 48 #include <VBox/log.h> … … 57 57 58 58 #include "VBoxDD.h" 59 60 59 struct RTCState; 61 60 typedef struct RTCState RTCState; … … 111 110 #define REG_B_UIE 0x10 112 111 112 #define CMOS_BANK_LOWER_LIMIT 0x0E 113 #define CMOS_BANK_UPPER_LIMIT 0x7F 114 #define CMOS_BANK2_LOWER_LIMIT 0x80 115 #define CMOS_BANK2_UPPER_LIMIT 0xFF 113 116 114 117 /** The saved state version. */ … … 275 278 return ((a >> 4) * 10) + (a & 0x0f); 276 279 } 280 281 #ifdef IN_RING3 282 283 /** 284 * @callback_method_impl{FNDBGFHANDLERDEV, 285 * Dumps the cmos Bank Info.} 286 */ 287 static DECLCALLBACK(void) CMOSBankInfo(PPDMDEVINS pDevIns, PCDBGFINFOHLP pHlp, const char *pszArgs) 288 { 289 RTCState *pThis = PDMINS_2_DATA(pDevIns, RTCState *); 290 const char *PChCMOSBank = "CMOS Bank Info 0x0E - 0x7F"; 291 uint16_t u16ByteCount = 0; 292 uint8_t u8CMOSByte; 293 pHlp->pfnPrintf(pHlp, "%s\n" ,PChCMOSBank); 294 for (u16ByteCount = CMOS_BANK_LOWER_LIMIT; u16ByteCount < CMOS_BANK_UPPER_LIMIT; u16ByteCount++) 295 { 296 u8CMOSByte = pThis->cmos_data[u16ByteCount]; 297 pHlp->pfnPrintf(pHlp, "Off: 0x%02x Val: 0x%02x\n",u16ByteCount, u8CMOSByte); 298 } 299 } 300 301 /** 302 * @callback_method_impl{FNDBGFHANDLERDEV, 303 * Dumps the cmos Bank2 Info.} 304 */ 305 static DECLCALLBACK(void) CMOSBank2Info(PPDMDEVINS pDevIns, PCDBGFINFOHLP pHlp, const char *pszArgs) 306 { 307 RTCState *pThis = PDMINS_2_DATA(pDevIns, RTCState *); 308 const char *PChCMOSBank = "CMOS Bank2 Info 0x80 - 0xFF"; 309 uint16_t u16ByteCount = 0; 310 uint8_t u8CMOSByte; 311 pHlp->pfnPrintf(pHlp, "%s\n" ,PChCMOSBank); 312 for (u16ByteCount = CMOS_BANK2_LOWER_LIMIT; u16ByteCount < CMOS_BANK2_UPPER_LIMIT; u16ByteCount++) 313 { 314 u8CMOSByte = pThis->cmos_data[u16ByteCount]; 315 pHlp->pfnPrintf(pHlp, "Off: 0x%02x Val: 0x%02x\n",u16ByteCount, u8CMOSByte); 316 } 317 } 318 319 /** 320 * @callback_method_impl{FNDBGFHANDLERDEV, 321 * Dumps the cmos RTC Info.} 322 */ 323 static DECLCALLBACK(void) CMOSRTCInfo(PPDMDEVINS pDevIns, PCDBGFINFOHLP pHlp, const char *pszArgs) 324 { 325 RTCState *pThis = PDMINS_2_DATA(pDevIns, RTCState *); 326 uint8_t u8Sec = 0; 327 uint8_t u8Min = 0; 328 uint8_t u8Hr = 0; 329 uint8_t u8Day = 0; 330 uint8_t u8Month = 0; 331 uint8_t u8Year = 0; 332 333 u8Sec = from_bcd(pThis, pThis->cmos_data[RTC_SECONDS]); 334 u8Min = from_bcd(pThis, pThis->cmos_data[RTC_MINUTES]); 335 u8Hr = from_bcd(pThis, pThis->cmos_data[RTC_HOURS] & 0x7f); 336 if ( !(pThis->cmos_data[RTC_REG_B] & 0x02) 337 && (pThis->cmos_data[RTC_HOURS] & 0x80)) 338 u8Hr += 12; 339 u8Day = from_bcd(pThis, pThis->cmos_data[RTC_DAY_OF_MONTH]); 340 u8Month = from_bcd(pThis, pThis->cmos_data[RTC_MONTH]) ; 341 u8Year = from_bcd(pThis, pThis->cmos_data[RTC_YEAR]); 342 pHlp->pfnPrintf(pHlp, "Time: Hr:%u Min:%u Sec:%u, Day:%u Month:%u Year:%u\n", u8Hr, u8Min, u8Sec, u8Day, u8Month, u8Year); 343 } 344 345 #endif 277 346 278 347 … … 1164 1233 return rc; 1165 1234 1235 /* 1236 * Register debugger info callback. 1237 */ 1238 PDMDevHlpDBGFInfoRegister(pDevIns, "cmos", "Display CMOS Bank 1 Info.. " 1239 "'cmos'. No argument.", CMOSBankInfo); 1240 PDMDevHlpDBGFInfoRegister(pDevIns, "cmos2", "Display CMOS Bank 2 Info.. " 1241 "'cmos2'. No argument", CMOSBank2Info); 1242 PDMDevHlpDBGFInfoRegister(pDevIns, "rtc", "Display CMOS RTC info " 1243 "'rtc'. No argument", CMOSRTCInfo); 1166 1244 return VINF_SUCCESS; 1167 1245 }
Note:
See TracChangeset
for help on using the changeset viewer.