Changeset 3645 in vbox for trunk/src/VBox/Devices/PC
- Timestamp:
- Jul 16, 2007 3:31:38 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/PC/DevACPI.cpp
r2981 r3645 28 28 #ifdef IN_RING3 29 29 #include <iprt/alloc.h> 30 #include <iprt/string.h> 30 31 #endif /* IN_RING3 */ 31 32 32 33 #include "Builtins.h" 33 #include "vl_vbox.h"34 34 35 35 #ifdef LOG_ENABLED … … 445 445 { 446 446 memcpy(header->au8Signature, au8Signature, 4); 447 header->u32Length = cpu_to_le32(u32Length);447 header->u32Length = RT_H2LE_U32(u32Length); 448 448 header->u8Revision = u8Revision; 449 449 memcpy(header->au8OemId, "VBOX ", 6); 450 450 memcpy(header->au8OemTabId, "VBOX", 4); 451 451 memcpy(header->au8OemTabId+4, au8Signature, 4); 452 header->u32OemRevision = cpu_to_le32(1);452 header->u32OemRevision = RT_H2LE_U32(1); 453 453 memcpy(header->au8CreatorId, "ASL ", 4); 454 header->u32CreatorRev = cpu_to_le32(0x61);454 header->u32CreatorRev = RT_H2LE_U32(0x61); 455 455 } 456 456 … … 463 463 g->u8RegisterBitOffset = u8RegisterBitOffset; 464 464 g->u8AccessSize = u8AccessSize; 465 g->u64Address = cpu_to_le64(u64Address);465 g->u64Address = RT_H2LE_U64(u64Address); 466 466 } 467 467 … … 484 484 memset (&facs, 0, sizeof(facs)); 485 485 memcpy (facs.au8Signature, "FACS", 4); 486 facs.u32Length = cpu_to_le32(sizeof(ACPITBLFACS));487 facs.u32HWSignature = cpu_to_le32(0);488 facs.u32FWVector = cpu_to_le32(0);489 facs.u32GlobalLock = cpu_to_le32(0);490 facs.u32Flags = cpu_to_le32(0);491 facs.u64X_FWVector = cpu_to_le64(0);486 facs.u32Length = RT_H2LE_U32(sizeof(ACPITBLFACS)); 487 facs.u32HWSignature = RT_H2LE_U32(0); 488 facs.u32FWVector = RT_H2LE_U32(0); 489 facs.u32GlobalLock = RT_H2LE_U32(0); 490 facs.u32Flags = RT_H2LE_U32(0); 491 facs.u64X_FWVector = RT_H2LE_U64(0); 492 492 facs.u8Version = 1; 493 493 … … 502 502 memset (&fadt, 0, sizeof(fadt)); 503 503 acpiPrepareHeader (&fadt.header, "FACP", sizeof(fadt), 4); 504 fadt.u32FACS = cpu_to_le32(facs_addr);505 fadt.u32DSDT = cpu_to_le32(dsdt_addr);504 fadt.u32FACS = RT_H2LE_U32(facs_addr); 505 fadt.u32DSDT = RT_H2LE_U32(dsdt_addr); 506 506 fadt.u8IntModel = INT_MODEL_DUAL_PIC; 507 507 fadt.u8PreferredPMProfile = 0; /* unspecified */ 508 fadt.u16SCIInt = cpu_to_le16(SCI_INT);509 fadt.u32SMICmd = cpu_to_le32(SMI_CMD);508 fadt.u16SCIInt = RT_H2LE_U16(SCI_INT); 509 fadt.u32SMICmd = RT_H2LE_U32(SMI_CMD); 510 510 fadt.u8AcpiEnable = ACPI_ENABLE; 511 511 fadt.u8AcpiDisable = ACPI_DISABLE; 512 512 fadt.u8S4BIOSReq = 0; 513 513 fadt.u8PStateCnt = 0; 514 fadt.u32PM1aEVTBLK = cpu_to_le32(PM1a_EVT_BLK);515 fadt.u32PM1bEVTBLK = cpu_to_le32(PM1b_EVT_BLK);516 fadt.u32PM1aCTLBLK = cpu_to_le32(PM1a_CTL_BLK);517 fadt.u32PM1bCTLBLK = cpu_to_le32(PM1b_CTL_BLK);518 fadt.u32PM2CTLBLK = cpu_to_le32(PM2_CTL_BLK);519 fadt.u32PMTMRBLK = cpu_to_le32(PM_TMR_BLK);520 fadt.u32GPE0BLK = cpu_to_le32(GPE0_BLK);521 fadt.u32GPE1BLK = cpu_to_le32(GPE1_BLK);514 fadt.u32PM1aEVTBLK = RT_H2LE_U32(PM1a_EVT_BLK); 515 fadt.u32PM1bEVTBLK = RT_H2LE_U32(PM1b_EVT_BLK); 516 fadt.u32PM1aCTLBLK = RT_H2LE_U32(PM1a_CTL_BLK); 517 fadt.u32PM1bCTLBLK = RT_H2LE_U32(PM1b_CTL_BLK); 518 fadt.u32PM2CTLBLK = RT_H2LE_U32(PM2_CTL_BLK); 519 fadt.u32PMTMRBLK = RT_H2LE_U32(PM_TMR_BLK); 520 fadt.u32GPE0BLK = RT_H2LE_U32(GPE0_BLK); 521 fadt.u32GPE1BLK = RT_H2LE_U32(GPE1_BLK); 522 522 fadt.u8PM1EVTLEN = 4; 523 523 fadt.u8PM1CTLLEN = 2; … … 528 528 fadt.u8GPE1BASE = GPE1_BASE; 529 529 fadt.u8CSTCNT = 0; 530 fadt.u16PLVL2LAT = cpu_to_le16(P_LVL2_LAT);531 fadt.u16PLVL3LAT = cpu_to_le16(P_LVL3_LAT);532 fadt.u16FlushSize = cpu_to_le16(FLUSH_SIZE);533 fadt.u16FlushStride = cpu_to_le16(FLUSH_STRIDE);530 fadt.u16PLVL2LAT = RT_H2LE_U16(P_LVL2_LAT); 531 fadt.u16PLVL3LAT = RT_H2LE_U16(P_LVL3_LAT); 532 fadt.u16FlushSize = RT_H2LE_U16(FLUSH_SIZE); 533 fadt.u16FlushStride = RT_H2LE_U16(FLUSH_STRIDE); 534 534 fadt.u8DutyOffset = 0; 535 535 fadt.u8DutyWidth = 0; … … 537 537 fadt.u8MonAlarm = 0; 538 538 fadt.u8Century = 0; 539 fadt.u16IAPCBOOTARCH = cpu_to_le16(IAPC_BOOT_ARCH_LEGACY_DEV | IAPC_BOOT_ARCH_8042);539 fadt.u16IAPCBOOTARCH = RT_H2LE_U16(IAPC_BOOT_ARCH_LEGACY_DEV | IAPC_BOOT_ARCH_8042); 540 540 /** @note WBINVD is required for ACPI versions newer than 1.0 */ 541 fadt.u32Flags = cpu_to_le32( FADT_FL_WBINVD | FADT_FL_SLP_BUTTON541 fadt.u32Flags = RT_H2LE_U32( FADT_FL_WBINVD | FADT_FL_SLP_BUTTON 542 542 | FADT_FL_FIX_RTC | FADT_FL_TMR_VAL_EXT); 543 543 acpiWriteGenericAddr(&fadt.ResetReg, 1, 8, 0, 1, ACPI_RESET_BLK); 544 544 fadt.u8ResetVal = ACPI_RESET_REG_VAL; 545 fadt.u64XFACS = cpu_to_le64((uint64_t)facs_addr);546 fadt.u64XDSDT = cpu_to_le64((uint64_t)dsdt_addr);545 fadt.u64XFACS = RT_H2LE_U64((uint64_t)facs_addr); 546 fadt.u64XDSDT = RT_H2LE_U64((uint64_t)dsdt_addr); 547 547 acpiWriteGenericAddr(&fadt.X_PM1aEVTBLK, 1, 32, 0, 2, PM1a_EVT_BLK); 548 548 acpiWriteGenericAddr(&fadt.X_PM1bEVTBLK, 0, 0, 0, 0, PM1b_EVT_BLK); … … 574 574 for (unsigned int i = 0; i < nb_entries; ++i) 575 575 { 576 rsdt->u32Entry[i] = cpu_to_le32(addrs[i]);576 rsdt->u32Entry[i] = RT_H2LE_U32(addrs[i]); 577 577 Log(("Setup RSDT: [%d] = %x\n", i, rsdt->u32Entry[i])); 578 578 } … … 596 596 for (unsigned int i = 0; i < nb_entries; ++i) 597 597 { 598 xsdt->u64Entry[i] = cpu_to_le64((uint64_t)addrs[i]);598 xsdt->u64Entry[i] = RT_H2LE_U64((uint64_t)addrs[i]); 599 599 Log(("Setup XSDT: [%d] = %VX64\n", i, xsdt->u64Entry[i])); 600 600 } … … 614 614 memcpy(rsdp->au8OemId, "VBOX ", 6); 615 615 rsdp->u8Revision = ACPI_REVISION; 616 rsdp->u32RSDT = cpu_to_le32(rsdt_addr);616 rsdp->u32RSDT = RT_H2LE_U32(rsdt_addr); 617 617 rsdp->u8Checksum = acpiChecksum((uint8_t*)rsdp, RT_OFFSETOF(ACPITBLRSDP, u32Length)); 618 618 619 619 /* ACPI 2.0 part (XSDT) */ 620 rsdp->u32Length = cpu_to_le32(sizeof(ACPITBLRSDP));621 rsdp->u64XSDT = cpu_to_le64(xsdt_addr);620 rsdp->u32Length = RT_H2LE_U32(sizeof(ACPITBLRSDP)); 621 rsdp->u64XSDT = RT_H2LE_U64(xsdt_addr); 622 622 rsdp->u8ExtChecksum = acpiChecksum ((uint8_t*)rsdp, sizeof(ACPITBLRSDP)); 623 623 } … … 636 636 acpiPrepareHeader(&madt.header, "APIC", sizeof(madt), 2); 637 637 638 madt.u32LAPIC = cpu_to_le32(0xfee00000);639 madt.u32Flags = cpu_to_le32(PCAT_COMPAT);638 madt.u32LAPIC = RT_H2LE_U32(0xfee00000); 639 madt.u32Flags = RT_H2LE_U32(PCAT_COMPAT); 640 640 641 641 madt.LApic.u8Type = 0; … … 643 643 madt.LApic.u8ProcId = 0; 644 644 madt.LApic.u8ApicId = 0; 645 madt.LApic.u32Flags = cpu_to_le32(LAPIC_ENABLED);645 madt.LApic.u32Flags = RT_H2LE_U32(LAPIC_ENABLED); 646 646 647 647 madt.IOApic.u8Type = 1; … … 649 649 madt.IOApic.u8IOApicId = 0; 650 650 madt.IOApic.u8Reserved = 0; 651 madt.IOApic.u32Address = cpu_to_le32(0xfec00000);652 madt.IOApic.u32GSIB = cpu_to_le32(0);651 madt.IOApic.u32Address = RT_H2LE_U32(0xfec00000); 652 madt.IOApic.u32GSIB = RT_H2LE_U32(0); 653 653 654 654 madt.header.u8Checksum = acpiChecksum ((uint8_t*)&madt, sizeof(madt));
Note:
See TracChangeset
for help on using the changeset viewer.