sb/intel/common: Drop some PCH_LPC_DEV macros

The macro definitions depend on __SIMPLE_DEVICE__ and are only used in
the get_gpio_base() or lpc_get_pmbase() functions, which already guard
PCH_LPC_DEV usage using __SIMPLE_DEVICE__ in preprocessor.

Change-Id: I5d3681debe29471dfa143ba100eb9060f6364c93
Signed-off-by: Angel Pons <th3fanbus@gmail.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/52461
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Tim Wawrzynczak <twawrzynczak@chromium.org>
Reviewed-by: Michael Niewöhner <foss@mniewoehner.de>
This commit is contained in:
Angel Pons 2021-04-17 12:32:38 +02:00 committed by Michael Niewöhner
parent 0db4b27c7d
commit ac9af1adb9
2 changed files with 4 additions and 18 deletions

View File

@ -13,25 +13,18 @@
/* LPC GPIO Base Address Register */
#define GPIO_BASE 0x48
/* PCI Configuration Space (D31:F0): LPC */
#if defined(__SIMPLE_DEVICE__)
#define PCH_LPC_DEV PCI_DEV(0, 0x1f, 0)
#else
#define PCH_LPC_DEV pcidev_on_root(0x1f, 0)
#endif
static u16 get_gpio_base(void)
{
#ifdef __SIMPLE_DEVICE__
/* Don't assume GPIO_BASE is still the same */
return pci_read_config16(PCH_LPC_DEV, GPIO_BASE) & 0xfffe;
return pci_read_config16(PCI_DEV(0, 0x1f, 0), GPIO_BASE) & 0xfffe;
#else
static u16 gpiobase;
if (gpiobase)
return gpiobase;
gpiobase = pci_read_config16(PCH_LPC_DEV, GPIO_BASE) & 0xfffe;
gpiobase = pci_read_config16(pcidev_on_root(0x1f, 0), GPIO_BASE) & 0xfffe;
return gpiobase;
#endif

View File

@ -16,25 +16,18 @@
#define PMBASE 0x40
#define PMSIZE 0x80
/* PCI Configuration Space (D31:F0): LPC */
#if defined(__SIMPLE_DEVICE__)
#define PCH_LPC_DEV PCI_DEV(0, 0x1f, 0)
#else
#define PCH_LPC_DEV pcidev_on_root(0x1f, 0)
#endif
u16 lpc_get_pmbase(void)
{
#ifdef __SIMPLE_DEVICE__
/* Don't assume PMBASE is still the same */
return pci_read_config16(PCH_LPC_DEV, PMBASE) & 0xfffc;
return pci_read_config16(PCI_DEV(0, 0x1f, 0), PMBASE) & 0xfffc;
#else
static u16 pmbase;
if (pmbase)
return pmbase;
pmbase = pci_read_config16(PCH_LPC_DEV, PMBASE) & 0xfffc;
pmbase = pci_read_config16(pcidev_on_root(0x1f, 0), PMBASE) & 0xfffc;
return pmbase;
#endif