coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
early_pm.c
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 
3 #include <stdint.h>
4 #include <device/pci_ops.h>
5 #include <device/pci.h>
6 #include <device/pci_def.h>
7 #include <device/pci_ids.h>
8 #include "i82371eb.h"
9 
10 void enable_pm(void)
11 {
12  u8 reg8;
13  u16 reg16;
14 
15  /* Get the SMBus/PM device of the 82371AB/EB/MB. */
18 
19  /* Set the PM I/O base. */
21 
22  /* Enable access to the PM I/O space. */
23  reg16 = pci_read_config16(dev, PCI_COMMAND);
24  reg16 |= PCI_COMMAND_IO;
25  pci_write_config16(dev, PCI_COMMAND, reg16);
26 
27  /* PM I/O Space Enable (PMIOSE). */
28  reg8 = pci_read_config8(dev, PMREGMISC);
29  reg8 |= PMIOSE;
30  pci_write_config8(dev, PMREGMISC, reg8);
31 }
void enable_pm(void)
Definition: early_pm.c:10
#define PMIOSE
Definition: i82371eb.h:103
#define PMREGMISC
Definition: i82371eb.h:102
#define PMBA
Definition: i82371eb.h:89
static __always_inline void pci_write_config32(const struct device *dev, u16 reg, u32 val)
Definition: pci_ops.h:76
static __always_inline u16 pci_read_config16(const struct device *dev, u16 reg)
Definition: pci_ops.h:52
static __always_inline u8 pci_read_config8(const struct device *dev, u16 reg)
Definition: pci_ops.h:46
static __always_inline void pci_write_config16(const struct device *dev, u16 reg, u16 val)
Definition: pci_ops.h:70
static __always_inline void pci_write_config8(const struct device *dev, u16 reg, u8 val)
Definition: pci_ops.h:64
#define DEFAULT_PMBASE
Definition: iomap.h:14
#define PCI_COMMAND_IO
Definition: pci_def.h:11
#define PCI_COMMAND
Definition: pci_def.h:10
pci_devfn_t pci_locate_device(unsigned int pci_id, pci_devfn_t dev)
Definition: pci_early.c:110
#define PCI_DID_INTEL_82371AB_SMB_ACPI
Definition: pci_ids.h:2206
#define PCI_VID_INTEL
Definition: pci_ids.h:2157
u32 pci_devfn_t
Definition: pci_type.h:8
#define PCI_ID(VENDOR_ID, DEVICE_ID)
Definition: bootblock.c:10
uint16_t u16
Definition: stdint.h:48
uint8_t u8
Definition: stdint.h:45