VirtualBox

Ignore:
Timestamp:
Oct 12, 2015 10:32:18 AM (9 years ago)
Author:
vboxsync
Message:

EFI: Remove AcpiTimerLib from VBoxPkg and merge changes with OvmfPkg AcpiTimerLib

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/EFI/Firmware/OvmfPkg/Library/AcpiTimerLib/AcpiTimerLib.c

    r48674 r58172  
    2525// PIIX4 Power Management Base Address
    2626//
     27#ifndef VBOX
    2728UINT32 mPmba = 0x400;
     29#else
     30UINT32 mPmba = 0x4000;
     31#endif
    2832
    2933#define PCI_BAR_IO             0x1
     
    4145
    4246**/
     47#ifndef VBOX
    4348RETURN_STATUS
    4449EFIAPI
     
    6873  return RETURN_SUCCESS;
    6974}
     75#else
     76RETURN_STATUS
     77EFIAPI
     78AcpiTimerLibConstructor (
     79  VOID
     80  )
     81{
     82  UINT8     u8Device = 7;
     83  UINT16    u16VendorID = 0;
     84  UINT16    u16DeviceID = 0;
     85  u16VendorID = PciRead16(PCI_LIB_ADDRESS(0, u8Device, 0, 0));
     86  u16DeviceID = PciRead16(PCI_LIB_ADDRESS(0, u8Device, 0, 2));
     87  if (   u16VendorID != 0x8086
     88      || u16DeviceID != 0x7113)
     89    return RETURN_ABORTED;
     90
     91  if (PciRead8 (PCI_LIB_ADDRESS (0,u8Device,0,0x80)) & 1) {
     92    mPmba = PciRead32 (PCI_LIB_ADDRESS (0, u8Device, 0, 0x40));
     93    ASSERT (mPmba & PCI_BAR_IO);
     94    DEBUG((DEBUG_INFO, "%a:%d mPmba:%x\n", __FUNCTION__, __LINE__, mPmba));
     95    mPmba &= ~PCI_BAR_IO;
     96    DEBUG((DEBUG_INFO, "%a:%d mPmba:%x\n", __FUNCTION__, __LINE__, mPmba));
     97  } else {
     98    PciAndThenOr32 (PCI_LIB_ADDRESS (0,u8Device,0,0x40),
     99                    (UINT32) ~0xfc0, mPmba);
     100    PciOr8         (PCI_LIB_ADDRESS (0,u8Device,0,0x04), 0x01);
     101    DEBUG((DEBUG_INFO, "%a:%d mPmba:%x\n", __FUNCTION__, __LINE__, mPmba));
     102  }
     103
     104  //
     105  // ACPI Timer enable is in Bus 0, Device ?, Function 3
     106  //
     107  PciOr8         (PCI_LIB_ADDRESS (0,u8Device,0,0x80), 0x01);
     108  return RETURN_SUCCESS;
     109}
     110#endif
    70111
    71112/**
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