coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
thermal.c
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 
3 #include <console/console.h>
4 #include <device/device.h>
5 #include <device/pci.h>
6 #include <device/pci_def.h>
7 #include <device/pci_ids.h>
8 #include "pch.h"
9 #include <device/mmio.h>
10 
11 static void thermal_init(struct device *dev)
12 {
13  struct resource *res;
14  u8 *base;
15  printk(BIOS_DEBUG, "Thermal init start.\n");
16 
18  if (!res)
19  return;
20 
21  base = res2mmio(res, 0, 0);
22  write32(base + 4, 0x3a2b);
23  write8(base + 0xe, 0x40);
24  write16(base + 0x56, 0xffff);
25  write16(base + 0x64, 0xffff);
26  write16(base + 0x66, 0xffff);
27  write16(base + 0x68, 0xfa);
28 
29  write8(base + 1, 0xb8);
30 
31  printk(BIOS_DEBUG, "Thermal init done.\n");
32 }
33 
34 static struct device_operations thermal_ops = {
36  .set_resources = pci_dev_set_resources,
37  .enable_resources = pci_dev_enable_resources,
38  .init = thermal_init,
39  .ops_pci = &pci_dev_ops_pci,
40 };
41 
42 static const struct pci_driver pch_thermal __pci_driver = {
43  .ops = &thermal_ops,
44  .vendor = PCI_VID_INTEL,
46 };
static void write8(void *addr, uint8_t val)
Definition: mmio.h:30
static void write32(void *addr, uint32_t val)
Definition: mmio.h:40
static void write16(void *addr, uint16_t val)
Definition: mmio.h:35
#define printk(level,...)
Definition: stdlib.h:16
struct resource * probe_resource(const struct device *dev, unsigned int index)
See if a resource structure already exists for a given index.
Definition: device_util.c:323
#define BIOS_DEBUG
BIOS_DEBUG - Verbose output.
Definition: loglevel.h:128
#define PCI_BASE_ADDRESS_0
Definition: pci_def.h:63
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_INTEL_IBEXPEAK_THERMAL
Definition: pci_ids.h:2815
#define PCI_VID_INTEL
Definition: pci_ids.h:2157
static void * res2mmio(const struct resource *res, unsigned long offset, unsigned long mask)
Definition: resource.h:87
uintptr_t base
Definition: uart.c:17
static void thermal_init(struct device *dev)
Definition: thermal.c:11
static const struct pci_driver pch_thermal __pci_driver
Definition: thermal.c:42
static struct device_operations thermal_ops
Definition: thermal.c:34
uint8_t u8
Definition: stdint.h:45
void(* read_resources)(struct device *dev)
Definition: device.h:39
Definition: device.h:107