I2CAccess.h 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. /** @file
  2. Misc Registers Definition.
  3. Copyright (c) 2011 - 2015, Intel Corporation. All rights reserved.<BR>
  4. SPDX-License-Identifier: BSD-2-Clause-Patent
  5. --*/
  6. #ifndef _I2C_ACCESS_H_
  7. #define _I2C_ACCESS_H_
  8. #include "I2CIoLibPei.h"
  9. #define DEFAULT_PCI_BUS_NUMBER_PCH 0
  10. #define PCI_DEVICE_NUMBER_PCH_LPC 31
  11. #define PCI_FUNCTION_NUMBER_PCH_LPC 0
  12. #define R_PCH_LPC_ACPI_BASE 0x40 // ABASE, 16bit
  13. #define R_PCH_LPC_ACPI_BASEADR 0x400 // ABASE, 16bit
  14. #define B_PCH_LPC_ACPI_BASE_EN BIT1 // Enable Bit
  15. #define B_PCH_LPC_ACPI_BASE_BAR 0x0000FF80 // Base Address, 128 Bytes
  16. #define V_PCH_ACPI_PM1_TMR_MAX_VAL 0x1000000 // The timer is 24 bit overflow
  17. #define B_PCH_ACPI_PM1_TMR_VAL 0xFFFFFF // The timer value mask
  18. #define R_PCH_ACPI_PM1_TMR 0x08 // Power Management 1 Timer
  19. #define V_PCH_ACPI_PM1_TMR_FREQUENCY 3579545 // Timer Frequency
  20. #define PchLpcPciCfg8(Register) I2CLibPeiMmioRead8 (MmPciAddress (0, DEFAULT_PCI_BUS_NUMBER_PCH, PCI_DEVICE_NUMBER_PCH_LPC, 0, Register))
  21. #define PCIEX_BASE_ADDRESS 0xE0000000
  22. #define PCI_EXPRESS_BASE_ADDRESS ((VOID *) (UINTN) PCIEX_BASE_ADDRESS)
  23. #define MmPciAddress( Segment, Bus, Device, Function, Register ) \
  24. ( (UINTN)PCI_EXPRESS_BASE_ADDRESS + \
  25. (UINTN)(Bus << 20) + \
  26. (UINTN)(Device << 15) + \
  27. (UINTN)(Function << 12) + \
  28. (UINTN)(Register) \
  29. )
  30. #endif