coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
gl9755.c
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 
3 /* Driver for Genesys Logic GL9755 */
4 
5 #include <console/console.h>
6 #include <device/device.h>
7 #include <device/path.h>
8 #include <device/pci.h>
9 #include <device/pci_ops.h>
10 #include <device/pci_ids.h>
11 #include "gl9755.h"
12 
13 static void gl9755_enable(struct device *dev)
14 {
15  uint32_t reg;
16 
17  printk(BIOS_INFO, "GL9755: configure ASPM and LTR\n");
18 
19  /* Set Vendor Config to be configurable */
20  pci_or_config32(dev, CFG, CFG_EN);
21 
22  /* Set LTR value */
24 
25  /* Adjust L1 exit latency to enable ASPM */
26  reg = pci_read_config32(dev, CFG2);
27  reg &= ~CFG2_LAT_L1_MASK;
28  reg |= CFG2_LAT_L1_64US;
29  pci_write_config32(dev, CFG2, reg);
30 
31  /* Disable ASPM L0s support */
33 
34  /* Turn off debug mode to enable SCP/OCP */
36 
37  /* Set Vendor Config to be non-configurable */
38  pci_and_config32(dev, CFG, ~CFG_EN);
39 }
40 
41 static struct device_operations gl9755_ops = {
43  .set_resources = pci_dev_set_resources,
44  .enable_resources = pci_dev_enable_resources,
45  .ops_pci = &pci_dev_ops_pci,
46  .enable = gl9755_enable
47 };
48 
49 static const unsigned short pci_device_ids[] = {
51  0
52 };
53 
54 static const struct pci_driver genesyslogic_gl9755 __pci_driver = {
55  .ops = &gl9755_ops,
56  .vendor = PCI_VID_GLI,
57  .devices = pci_device_ids,
58 };
59 
61  CHIP_NAME("Genesys Logic GL9755")
62 };
#define printk(level,...)
Definition: stdlib.h:16
#define CFG_EN
Definition: gl9750.h:9
#define CFG2
Definition: gl9750.h:10
#define CFG2_L0S_SUPPORT
Definition: gl9750.h:11
#define CFG
Definition: gl9750.h:8
struct chip_operations drivers_generic_genesyslogic_gl9755_ops
Definition: gl9755.c:60
static void gl9755_enable(struct device *dev)
Definition: gl9755.c:13
static struct device_operations gl9755_ops
Definition: gl9755.c:41
static const unsigned short pci_device_ids[]
Definition: gl9755.c:49
static const struct pci_driver genesyslogic_gl9755 __pci_driver
Definition: gl9755.c:54
#define SNOOP_VALUE
Definition: gl9755.h:15
#define CFG2_LAT_L1_MASK
Definition: gl9755.h:11
#define NO_SNOOP_SCALE
Definition: gl9755.h:18
#define SNOOP_SCALE
Definition: gl9755.h:16
#define SCP_DEBUG
Definition: gl9755.h:20
#define LTR
Definition: gl9755.h:14
#define CFG2_LAT_L1_64US
Definition: gl9755.h:12
#define NO_SNOOP_VALUE
Definition: gl9755.h:17
#define CFG3
Definition: gl9755.h:19
#define CHIP_NAME(X)
Definition: device.h:32
static __always_inline void pci_or_config32(const struct device *dev, u16 reg, u32 ormask)
Definition: pci_ops.h:191
static __always_inline void pci_write_config32(const struct device *dev, u16 reg, u32 val)
Definition: pci_ops.h:76
static __always_inline u32 pci_read_config32(const struct device *dev, u16 reg)
Definition: pci_ops.h:58
static __always_inline void pci_and_config32(const struct device *dev, u16 reg, u32 andmask)
Definition: pci_ops.h:158
#define BIOS_INFO
BIOS_INFO - Expected events.
Definition: loglevel.h:113
void pci_dev_enable_resources(struct device *dev)
Definition: pci_device.c:721
void pci_dev_read_resources(struct device *dev)
Definition: pci_device.c:534
struct pci_operations pci_dev_ops_pci
Default device operation for PCI devices.
Definition: pci_device.c:911
void pci_dev_set_resources(struct device *dev)
Definition: pci_device.c:691
#define PCI_DID_GLI_9755
Definition: pci_ids.h:2088
#define PCI_VID_GLI
Definition: pci_ids.h:2086
unsigned int uint32_t
Definition: stdint.h:14
void(* read_resources)(struct device *dev)
Definition: device.h:39
Definition: device.h:107