coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
dptf.c File Reference
#include <acpi/acpigen.h>
#include <acpi/acpigen_pci.h>
#include <console/console.h>
#include <device/device.h>
#include <intelblocks/pmc_ipc.h>
#include <soc/pci_devs.h>
#include "chip.h"
#include "dptf.h"
Include dependency graph for dptf.c:

Go to the source code of this file.

Macros

#define DEFAULT_CHARGER_STR   "Battery Charger"
 
#define DEFAULT_TPCH_STR   "Intel PCH FIVR Participant"
 
#define DEFAULT_POWER_STR   "Power Participant"
 
#define DEFAULT_BATTERY_STR   "Battery Participant"
 
#define PMC_IPC_COMMAND_FIVR_SIZE   0x8
 

Enumerations

enum  dptf_generic_participant_type {
  DPTF_GENERIC_PARTICIPANT_TYPE_TSR = 0x3 , DPTF_GENERIC_PARTICIPANT_TYPE_TPCH = 0x5 , DPTF_GENERIC_PARTICIPANT_TYPE_CHARGER = 0xB , DPTF_GENERIC_PARTICIPANT_TYPE_BATTERY = 0xC ,
  DPTF_GENERIC_PARTICIPANT_TYPE_POWER = 0x11
}
 

Functions

static bool is_participant_used (const struct drivers_intel_dptf_config *config, enum dptf_participant participant)
 
static const char * dptf_acpi_name (const struct device *dev)
 
static int get_STA_value (const struct drivers_intel_dptf_config *config, enum dptf_participant participant)
 
static void dptf_write_hid (bool is_eisa, const char *hid)
 
static void dptf_write_generic_participant (const char *name, enum dptf_generic_participant_type ptype, const char *str, int sta_val, const struct dptf_platform_info *platform_info)
 
static void write_tcpu (const struct device *pci_dev, const struct drivers_intel_dptf_config *config)
 
static void write_fan (const struct drivers_intel_dptf_config *config, const struct dptf_platform_info *platform_info)
 
static void write_imok (void)
 
static void write_oem_variables (const struct drivers_intel_dptf_config *config)
 
static void write_generic_devices (const struct drivers_intel_dptf_config *config, const struct dptf_platform_info *platform_info)
 
static const char * get_pmc_ipcs_method (void)
 
static void write_tpch_write_method (const char *tpch_write_method_name, unsigned int ipc_subcmd_ctrl_value)
 
static void write_ppkg_package (const uint8_t i)
 
static void write_pkgc_method (void)
 
static void write_tpch_read_method (const char *tpch_read_method_name, unsigned int ipc_subcmd_ctrl_value)
 
static void write_create_tpch (const struct dptf_platform_info *platform_info)
 
static void write_tpch_methods (const struct dptf_platform_info *platform_info)
 
static void write_create_tpwr (const struct drivers_intel_dptf_config *config, const struct dptf_platform_info *platform_info)
 
static void write_tpwr_methods (const struct drivers_intel_dptf_config *config, const struct dptf_platform_info *platform_info)
 
static void write_create_tbat (const struct dptf_platform_info *platform_info)
 
static void write_tbat_methods (const struct dptf_platform_info *platform_info)
 
static void write_open_dptf_device (const struct device *dev, const struct dptf_platform_info *platform_info)
 
static void write_device_definitions (const struct device *dev)
 
static void write_policies (const struct drivers_intel_dptf_config *config)
 
static void write_controls (const struct drivers_intel_dptf_config *config)
 
static void write_options (const struct drivers_intel_dptf_config *config)
 
static void dptf_fill_ssdt (const struct device *dev)
 
static void dptf_enable_dev (struct device *dev)
 

Variables

static struct device_operations dptf_ops
 
struct chip_operations drivers_intel_dptf_ops
 

Macro Definition Documentation

◆ DEFAULT_BATTERY_STR

#define DEFAULT_BATTERY_STR   "Battery Participant"

Definition at line 24 of file dptf.c.

◆ DEFAULT_CHARGER_STR

#define DEFAULT_CHARGER_STR   "Battery Charger"

Definition at line 21 of file dptf.c.

◆ DEFAULT_POWER_STR

#define DEFAULT_POWER_STR   "Power Participant"

Definition at line 23 of file dptf.c.

◆ DEFAULT_TPCH_STR

#define DEFAULT_TPCH_STR   "Intel PCH FIVR Participant"

Definition at line 22 of file dptf.c.

◆ PMC_IPC_COMMAND_FIVR_SIZE

#define PMC_IPC_COMMAND_FIVR_SIZE   0x8

Definition at line 26 of file dptf.c.

Enumeration Type Documentation

◆ dptf_generic_participant_type

Enumerator
DPTF_GENERIC_PARTICIPANT_TYPE_TSR 
DPTF_GENERIC_PARTICIPANT_TYPE_TPCH 
DPTF_GENERIC_PARTICIPANT_TYPE_CHARGER 
DPTF_GENERIC_PARTICIPANT_TYPE_BATTERY 
DPTF_GENERIC_PARTICIPANT_TYPE_POWER 

Definition at line 13 of file dptf.c.

Function Documentation

◆ dptf_acpi_name()

static const char* dptf_acpi_name ( const struct device dev)
static

Definition at line 60 of file dptf.c.

◆ dptf_enable_dev()

static void dptf_enable_dev ( struct device dev)
static

Definition at line 541 of file dptf.c.

References dptf_ops, and device::ops.

◆ dptf_fill_ssdt()

static void dptf_fill_ssdt ( const struct device dev)
static

◆ dptf_write_generic_participant()

static void dptf_write_generic_participant ( const char *  name,
enum dptf_generic_participant_type  ptype,
const char *  str,
int  sta_val,
const struct dptf_platform_info platform_info 
)
static

Definition at line 82 of file dptf.c.

References acpigen_pop_len(), acpigen_write_device(), acpigen_write_name(), acpigen_write_name_integer(), acpigen_write_name_string(), acpigen_write_STA(), dptf_write_hid(), dptf_platform_info::generic_hid, name, and dptf_platform_info::use_eisa_hids.

Referenced by write_generic_devices().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ dptf_write_hid()

static void dptf_write_hid ( bool  is_eisa,
const char *  hid 
)
static

Definition at line 73 of file dptf.c.

References acpigen_emit_eisaid(), and acpigen_write_string().

Referenced by dptf_write_generic_participant(), write_create_tbat(), write_create_tpch(), write_create_tpwr(), write_fan(), and write_open_dptf_device().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_pmc_ipcs_method()

static const char* get_pmc_ipcs_method ( void  )
static

Definition at line 207 of file dptf.c.

References acpi_device_path_join(), BIOS_ERR, NULL, PCH_DEVFN_PMC, pcidev_path_on_root(), and printk.

Referenced by write_tpch_read_method(), and write_tpch_write_method().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_STA_value()

static int get_STA_value ( const struct drivers_intel_dptf_config config,
enum dptf_participant  participant 
)
static

Definition at line 65 of file dptf.c.

References ACPI_STATUS_DEVICE_ALL_OFF, ACPI_STATUS_DEVICE_ALL_ON, config, and is_participant_used().

Referenced by write_fan(), write_generic_devices(), and write_tcpu().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ is_participant_used()

static bool is_participant_used ( const struct drivers_intel_dptf_config config,
enum dptf_participant  participant 
)
static

Definition at line 32 of file dptf.c.

References config, DPTF_FAN, DPTF_MAX_ACTIVE_POLICIES, DPTF_MAX_CRITICAL_POLICIES, DPTF_MAX_PASSIVE_POLICIES, and DPTF_NONE.

Referenced by get_STA_value(), and write_options().

Here is the caller graph for this function:

◆ write_controls()

static void write_controls ( const struct drivers_intel_dptf_config config)
static

Definition at line 489 of file dptf.c.

References config, DPTF_MAX_CHARGER_PERF_STATES, DPTF_MAX_FAN_PERF_STATES, dptf_write_charger_perf(), dptf_write_fan_perf(), and dptf_write_power_limits().

Referenced by dptf_fill_ssdt().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ write_create_tbat()

static void write_create_tbat ( const struct dptf_platform_info platform_info)
static

◆ write_create_tpch()

static void write_create_tpch ( const struct dptf_platform_info platform_info)
static

◆ write_create_tpwr()

◆ write_device_definitions()

static void write_device_definitions ( const struct device dev)
static

◆ write_fan()

static void write_fan ( const struct drivers_intel_dptf_config config,
const struct dptf_platform_info platform_info 
)
static

Definition at line 119 of file dptf.c.

References acpigen_pop_len(), acpigen_write_device(), acpigen_write_name(), acpigen_write_name_integer(), acpigen_write_STA(), config, DPTF_FAN, dptf_write_hid(), dptf_platform_info::fan_hid, get_STA_value(), and dptf_platform_info::use_eisa_hids.

Referenced by write_device_definitions().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ write_generic_devices()

static void write_generic_devices ( const struct drivers_intel_dptf_config config,
const struct dptf_platform_info platform_info 
)
static

Definition at line 187 of file dptf.c.

References ACPI_NAME_BUFFER_SIZE, config, DEFAULT_CHARGER_STR, DPTF_CHARGER, DPTF_GENERIC_PARTICIPANT_TYPE_CHARGER, DPTF_GENERIC_PARTICIPANT_TYPE_TSR, DPTF_MAX_TSR, DPTF_TEMP_SENSOR_0, dptf_write_generic_participant(), get_STA_value(), name, NULL, and snprintf().

Referenced by write_device_definitions().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ write_imok()

static void write_imok ( void  )
static

Definition at line 131 of file dptf.c.

References acpigen_emit_byte(), acpigen_write_method(), acpigen_write_method_end(), ARG0_OP, and RETURN_OP.

Referenced by write_device_definitions().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ write_oem_variables()

static void write_oem_variables ( const struct drivers_intel_dptf_config config)
static

◆ write_open_dptf_device()

static void write_open_dptf_device ( const struct device dev,
const struct dptf_platform_info platform_info 
)
static

◆ write_options()

static void write_options ( const struct drivers_intel_dptf_config config)
static

Definition at line 497 of file dptf.c.

References acpigen_pop_len(), config, DPTF_FAN, DPTF_TEMP_SENSOR_0, DPTF_TEMP_SENSOR_4, dptf_write_fan_options(), dptf_write_scope(), dptf_write_STR(), dptf_write_tsr_hysteresis(), and is_participant_used().

Referenced by dptf_fill_ssdt().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ write_pkgc_method()

static void write_pkgc_method ( void  )
static

Definition at line 262 of file dptf.c.

References acpigen_write_method_end(), acpigen_write_method_serialized(), acpigen_write_name(), acpigen_write_package(), acpigen_write_package_end(), acpigen_write_return_namestr(), acpigen_write_zero(), and write_ppkg_package().

Referenced by write_tpch_methods().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ write_policies()

static void write_policies ( const struct drivers_intel_dptf_config config)
static

Definition at line 472 of file dptf.c.

References config, DPTF_MAX_ACTIVE_POLICIES, DPTF_MAX_CRITICAL_POLICIES, DPTF_MAX_PASSIVE_POLICIES, dptf_write_active_policies(), dptf_write_critical_policies(), dptf_write_enabled_policies(), and dptf_write_passive_policies().

Referenced by dptf_fill_ssdt().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ write_ppkg_package()

static void write_ppkg_package ( const uint8_t  i)
static

Definition at line 240 of file dptf.c.

References acpigen_emit_byte(), acpigen_emit_namestring(), acpigen_write_integer(), acpigen_write_store(), ARG0_OP, DEREF_OP, INDEX_OP, and ZERO_OP.

Referenced by write_pkgc_method().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ write_tbat_methods()

static void write_tbat_methods ( const struct dptf_platform_info platform_info)
static

Definition at line 417 of file dptf.c.

References write_create_tbat().

Referenced by write_device_definitions().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ write_tcpu()

static void write_tcpu ( const struct device pci_dev,
const struct drivers_intel_dptf_config config 
)
static

Definition at line 106 of file dptf.c.

References acpigen_pop_len(), acpigen_write_ADR_pci_device(), acpigen_write_device(), acpigen_write_scope(), acpigen_write_STA(), config, DPTF_CPU, get_STA_value(), pci_dev, and TCPU_SCOPE.

Referenced by write_device_definitions().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ write_tpch_methods()

◆ write_tpch_read_method()

static void write_tpch_read_method ( const char *  tpch_read_method_name,
unsigned int  ipc_subcmd_ctrl_value 
)
static

◆ write_tpch_write_method()

static void write_tpch_write_method ( const char *  tpch_write_method_name,
unsigned int  ipc_subcmd_ctrl_value 
)
static

◆ write_tpwr_methods()

static void write_tpwr_methods ( const struct drivers_intel_dptf_config config,
const struct dptf_platform_info platform_info 
)
static

Definition at line 397 of file dptf.c.

References config, and write_create_tpwr().

Referenced by write_device_definitions().

Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ dptf_ops

struct device_operations dptf_ops
static
Initial value:
= {
.read_resources = noop_read_resources,
.set_resources = noop_set_resources,
.acpi_name = dptf_acpi_name,
.acpi_fill_ssdt = dptf_fill_ssdt,
}
static const char * dptf_acpi_name(const struct device *dev)
Definition: dptf.c:60
static void dptf_fill_ssdt(const struct device *dev)
Definition: dptf.c:522
static void noop_read_resources(struct device *dev)
Standard device operations function pointers shims.
Definition: device.h:73
static void noop_set_resources(struct device *dev)
Definition: device.h:74

Definition at line 522 of file dptf.c.

Referenced by dptf_enable_dev().

◆ drivers_intel_dptf_ops

struct chip_operations drivers_intel_dptf_ops
Initial value:
= {
.enable_dev = dptf_enable_dev,
}
static void dptf_enable_dev(struct device *dev)
Definition: dptf.c:541

Definition at line 541 of file dptf.c.